anarock-widgets 1.0.351 → 1.0.352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/anarock-widgets.css +1 -1
- package/dist/index.cjs.js +3 -2
- package/dist/index.es.js +21 -11
- package/dist/index.umd.js +3 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -299,7 +299,8 @@ Take a look at the reducer(s) handling this action type: ${p.type}.
|
|
|
299
299
|
* Released under the MIT License
|
|
300
300
|
*/class _ce{constructor(){this._request=null,this._charts=new Map,this._running=!1,this._lastDate=void 0}_notify(t,n,r,i){const o=n.listeners[i],a=n.duration;o.forEach(s=>s({chart:t,initial:n.initial,numSteps:a,currentStep:Math.min(r-n.start,a)}))}_refresh(){this._request||(this._running=!0,this._request=ZR.call(window,()=>{this._update(),this._request=null,this._running&&this._refresh()}))}_update(t=Date.now()){let n=0;this._charts.forEach((r,i)=>{if(!r.running||!r.items.length)return;const o=r.items;let a=o.length-1,s=!1,l;for(;a>=0;--a)l=o[a],l._active?(l._total>r.duration&&(r.duration=l._total),l.tick(t),s=!0):(o[a]=o[o.length-1],o.pop());s&&(i.draw(),this._notify(i,r,t,"progress")),o.length||(r.running=!1,this._notify(i,r,t,"complete"),r.initial=!1),n+=o.length}),this._lastDate=t,n===0&&(this._running=!1)}_getAnims(t){const n=this._charts;let r=n.get(t);return r||(r={running:!1,initial:!0,items:[],listeners:{complete:[],progress:[]}},n.set(t,r)),r}listen(t,n,r){this._getAnims(t).listeners[n].push(r)}add(t,n){!n||!n.length||this._getAnims(t).items.push(...n)}has(t){return this._getAnims(t).items.length>0}start(t){const n=this._charts.get(t);n&&(n.running=!0,n.start=Date.now(),n.duration=n.items.reduce((r,i)=>Math.max(r,i._duration),0),this._refresh())}running(t){if(!this._running)return!1;const n=this._charts.get(t);return!(!n||!n.running||!n.items.length)}stop(t){const n=this._charts.get(t);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(t,n,Date.now(),"complete")}remove(t){return this._charts.delete(t)}}var Xi=new _ce;const eP="transparent",Ece={boolean(e,t,n){return n>.5?t:e},color(e,t,n){const r=zC(e||eP),i=r.valid&&zC(t||eP);return i&&i.valid?i.mix(r,n).hexString():t},number(e,t,n){return e+(t-e)*n}};class Sce{constructor(t,n,r,i){const o=n[r];i=Ud([t.to,i,o,t.from]);const a=Ud([t.from,o,i]);this._active=!0,this._fn=t.fn||Ece[t.type||typeof a],this._easing=jc[t.easing]||jc.linear,this._start=Math.floor(Date.now()+(t.delay||0)),this._duration=this._total=Math.floor(t.duration),this._loop=!!t.loop,this._target=n,this._prop=r,this._from=a,this._to=i,this._promises=void 0}active(){return this._active}update(t,n,r){if(this._active){this._notify(!1);const i=this._target[this._prop],o=r-this._start,a=this._duration-o;this._start=r,this._duration=Math.floor(Math.max(a,t.duration)),this._total+=o,this._loop=!!t.loop,this._to=Ud([t.to,n,i,t.from]),this._from=Ud([t.from,i,n])}}cancel(){this._active&&(this.tick(Date.now()),this._active=!1,this._notify(!1))}tick(t){const n=t-this._start,r=this._duration,i=this._prop,o=this._from,a=this._loop,s=this._to;let l;if(this._active=o!==s&&(a||n<r),!this._active){this._target[i]=s,this._notify(!0);return}if(n<0){this._target[i]=o;return}l=n/r%2,l=a&&l>1?2-l:l,l=this._easing(Math.min(1,Math.max(0,l))),this._target[i]=this._fn(o,s,l)}wait(){const t=this._promises||(this._promises=[]);return new Promise((n,r)=>{t.push({res:n,rej:r})})}_notify(t){const n=t?"res":"rej",r=this._promises||[];for(let i=0;i<r.length;i++)r[i][n]()}}class fI{constructor(t,n){this._chart=t,this._properties=new Map,this.configure(n)}configure(t){if(!Re(t))return;const n=Object.keys(Ft.animation),r=this._properties;Object.getOwnPropertyNames(t).forEach(i=>{const o=t[i];if(!Re(o))return;const a={};for(const s of n)a[s]=o[s];(un(o.properties)&&o.properties||[i]).forEach(s=>{(s===i||!r.has(s))&&r.set(s,a)})})}_animateOptions(t,n){const r=n.options,i=Cce(t,r);if(!i)return[];const o=this._createAnimations(i,r);return r.$shared&&Oce(t.options.$animations,r).then(()=>{t.options=r},()=>{}),o}_createAnimations(t,n){const r=this._properties,i=[],o=t.$animations||(t.$animations={}),a=Object.keys(n),s=Date.now();let l;for(l=a.length-1;l>=0;--l){const c=a[l];if(c.charAt(0)==="$")continue;if(c==="options"){i.push(...this._animateOptions(t,n));continue}const u=n[c];let d=o[c];const f=r.get(c);if(d)if(f&&d.active()){d.update(f,u,s);continue}else d.cancel();if(!f||!f.duration){t[c]=u;continue}o[c]=d=new Sce(f,t,c,u),i.push(d)}return i}update(t,n){if(this._properties.size===0){Object.assign(t,n);return}const r=this._createAnimations(t,n);if(r.length)return Xi.add(this._chart,r),!0}}function Oce(e,t){const n=[],r=Object.keys(t);for(let i=0;i<r.length;i++){const o=e[r[i]];o&&o.active()&&n.push(o.wait())}return Promise.all(n)}function Cce(e,t){if(!t)return;let n=e.options;if(!n){e.options=t;return}return n.$shared&&(e.options=n=Object.assign({},n,{$shared:!1,$animations:{}})),n}function tP(e,t){const n=e&&e.options||{},r=n.reverse,i=n.min===void 0?t:0,o=n.max===void 0?t:0;return{start:r?o:i,end:r?i:o}}function Pce(e,t,n){if(n===!1)return!1;const r=tP(e,n),i=tP(t,n);return{top:i.end,right:r.end,bottom:i.start,left:r.start}}function kce(e){let t,n,r,i;return Re(e)?(t=e.top,n=e.right,r=e.bottom,i=e.left):t=n=r=i=e,{top:t,right:n,bottom:r,left:i,disabled:e===!1}}function pI(e,t){const n=[],r=e._getSortedDatasetMetas(t);let i,o;for(i=0,o=r.length;i<o;++i)n.push(r[i].index);return n}function nP(e,t,n,r={}){const i=e.keys,o=r.mode==="single";let a,s,l,c;if(t===null)return;let u=!1;for(a=0,s=i.length;a<s;++a){if(l=+i[a],l===n){if(u=!0,r.all)continue;break}c=e.values[l],Yr(c)&&(o||t===0||Ti(t)===Ti(c))&&(t+=c)}return!u&&!r.all?0:t}function Dce(e,t){const{iScale:n,vScale:r}=t,i=n.axis==="x"?"x":"y",o=r.axis==="x"?"x":"y",a=Object.keys(e),s=new Array(a.length);let l,c,u;for(l=0,c=a.length;l<c;++l)u=a[l],s[l]={[i]:u,[o]:e[u]};return s}function Cv(e,t){const n=e&&e.options.stacked;return n||n===void 0&&t.stack!==void 0}function Ace(e,t,n){return`${e.id}.${t.id}.${n.stack||n.type}`}function Tce(e){const{min:t,max:n,minDefined:r,maxDefined:i}=e.getUserBounds();return{min:r?t:Number.NEGATIVE_INFINITY,max:i?n:Number.POSITIVE_INFINITY}}function Mce(e,t,n){const r=e[t]||(e[t]={});return r[n]||(r[n]={})}function rP(e,t,n,r){for(const i of t.getMatchingVisibleMetas(r).reverse()){const o=e[i.index];if(n&&o>0||!n&&o<0)return i.index}return null}function iP(e,t){const{chart:n,_cachedMeta:r}=e,i=n._stacks||(n._stacks={}),{iScale:o,vScale:a,index:s}=r,l=o.axis,c=a.axis,u=Ace(o,a,r),d=t.length;let f;for(let p=0;p<d;++p){const m=t[p],{[l]:g,[c]:v}=m,x=m._stacks||(m._stacks={});f=x[c]=Mce(i,u,g),f[s]=v,f._top=rP(f,a,!0,r.type),f._bottom=rP(f,a,!1,r.type);const _=f._visualValues||(f._visualValues={});_[s]=v}}function Pv(e,t){const n=e.scales;return Object.keys(n).filter(r=>n[r].axis===t).shift()}function Nce(e,t){return bs(e,{active:!1,dataset:void 0,datasetIndex:t,index:t,mode:"default",type:"dataset"})}function jce(e,t,n){return bs(e,{active:!1,dataIndex:t,parsed:void 0,raw:void 0,element:n,index:t,mode:"default",type:"data"})}function lc(e,t){const n=e.controller.index,r=e.vScale&&e.vScale.axis;if(r){t=t||e._parsed;for(const i of t){const o=i._stacks;if(!o||o[r]===void 0||o[r][n]===void 0)return;delete o[r][n],o[r]._visualValues!==void 0&&o[r]._visualValues[n]!==void 0&&delete o[r]._visualValues[n]}}}const kv=e=>e==="reset"||e==="none",oP=(e,t)=>t?e:Object.assign({},e),Rce=(e,t,n)=>e&&!t.hidden&&t._stacked&&{keys:pI(n,!0),values:null};class lm{static defaults={};static datasetElementType=null;static dataElementType=null;constructor(t,n){this.chart=t,this._ctx=t.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 t=this._cachedMeta;this.configure(),this.linkScales(),t._stacked=Cv(t.vScale,t),this.addElements(),this.options.fill&&!this.chart.isPluginEnabled("filler")&&console.warn("Tried to use the 'fill' option without the 'Filler' plugin enabled. Please import and register the 'Filler' plugin and make sure it is not disabled in the options")}updateIndex(t){this.index!==t&&lc(this._cachedMeta),this.index=t}linkScales(){const t=this.chart,n=this._cachedMeta,r=this.getDataset(),i=(d,f,p,m)=>d==="x"?f:d==="r"?m:p,o=n.xAxisID=Se(r.xAxisID,Pv(t,"x")),a=n.yAxisID=Se(r.yAxisID,Pv(t,"y")),s=n.rAxisID=Se(r.rAxisID,Pv(t,"r")),l=n.indexAxis,c=n.iAxisID=i(l,o,a,s),u=n.vAxisID=i(l,a,o,s);n.xScale=this.getScaleForId(o),n.yScale=this.getScaleForId(a),n.rScale=this.getScaleForId(s),n.iScale=this.getScaleForId(c),n.vScale=this.getScaleForId(u)}getDataset(){return this.chart.data.datasets[this.index]}getMeta(){return this.chart.getDatasetMeta(this.index)}getScaleForId(t){return this.chart.scales[t]}_getOtherScale(t){const n=this._cachedMeta;return t===n.iScale?n.vScale:n.iScale}reset(){this._update("reset")}_destroy(){const t=this._cachedMeta;this._data&&BC(this._data,this),t._stacked&&lc(t)}_dataCheck(){const t=this.getDataset(),n=t.data||(t.data=[]),r=this._data;if(Re(n)){const i=this._cachedMeta;this._data=Dce(n,i)}else if(r!==n){if(r){BC(r,this);const i=this._cachedMeta;lc(i),i._parsed=[]}n&&Object.isExtensible(n)&&hle(n,this),this._syncList=[],this._data=n}}addElements(){const t=this._cachedMeta;this._dataCheck(),this.datasetElementType&&(t.dataset=new this.datasetElementType)}buildOrUpdateElements(t){const n=this._cachedMeta,r=this.getDataset();let i=!1;this._dataCheck();const o=n._stacked;n._stacked=Cv(n.vScale,n),n.stack!==r.stack&&(i=!0,lc(n),n.stack=r.stack),this._resyncElements(t),(i||o!==n._stacked)&&(iP(this,n._parsed),n._stacked=Cv(n.vScale,n))}configure(){const t=this.chart.config,n=t.datasetScopeKeys(this._type),r=t.getOptionScopes(this.getDataset(),n,!0);this.options=t.createResolver(r,this.getContext()),this._parsing=this.options.parsing,this._cachedDataOpts={}}parse(t,n){const{_cachedMeta:r,_data:i}=this,{iScale:o,_stacked:a}=r,s=o.axis;let l=t===0&&n===i.length?!0:r._sorted,c=t>0&&r._parsed[t-1],u,d,f;if(this._parsing===!1)r._parsed=i,r._sorted=!0,f=i;else{un(i[t])?f=this.parseArrayData(r,i,t,n):Re(i[t])?f=this.parseObjectData(r,i,t,n):f=this.parsePrimitiveData(r,i,t,n);const p=()=>d[s]===null||c&&d[s]<c[s];for(u=0;u<n;++u)r._parsed[u+t]=d=f[u],l&&(p()&&(l=!1),c=d);r._sorted=l}a&&iP(this,f)}parsePrimitiveData(t,n,r,i){const{iScale:o,vScale:a}=t,s=o.axis,l=a.axis,c=o.getLabels(),u=o===a,d=new Array(i);let f,p,m;for(f=0,p=i;f<p;++f)m=f+r,d[f]={[s]:u||o.parse(c[m],m),[l]:a.parse(n[m],m)};return d}parseArrayData(t,n,r,i){const{xScale:o,yScale:a}=t,s=new Array(i);let l,c,u,d;for(l=0,c=i;l<c;++l)u=l+r,d=n[u],s[l]={x:o.parse(d[0],u),y:a.parse(d[1],u)};return s}parseObjectData(t,n,r,i){const{xScale:o,yScale:a}=t,{xAxisKey:s="x",yAxisKey:l="y"}=this._parsing,c=new Array(i);let u,d,f,p;for(u=0,d=i;u<d;++u)f=u+r,p=n[f],c[u]={x:o.parse(ds(p,s),f),y:a.parse(ds(p,l),f)};return c}getParsed(t){return this._cachedMeta._parsed[t]}getDataElement(t){return this._cachedMeta.data[t]}applyStack(t,n,r){const i=this.chart,o=this._cachedMeta,a=n[t.axis],s={keys:pI(i,!0),values:n._stacks[t.axis]._visualValues};return nP(s,a,o.index,{mode:r})}updateRangeFromParsed(t,n,r,i){const o=r[n.axis];let a=o===null?NaN:o;const s=i&&r._stacks[n.axis];i&&s&&(i.values=s,a=nP(i,o,this._cachedMeta.index)),t.min=Math.min(t.min,a),t.max=Math.max(t.max,a)}getMinMax(t,n){const r=this._cachedMeta,i=r._parsed,o=r._sorted&&t===r.iScale,a=i.length,s=this._getOtherScale(t),l=Rce(n,r,this.chart),c={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY},{min:u,max:d}=Tce(s);let f,p;function m(){p=i[f];const g=p[s.axis];return!Yr(p[t.axis])||u>g||d<g}for(f=0;f<a&&!(!m()&&(this.updateRangeFromParsed(c,t,p,l),o));++f);if(o){for(f=a-1;f>=0;--f)if(!m()){this.updateRangeFromParsed(c,t,p,l);break}}return c}getAllParsedValues(t){const n=this._cachedMeta._parsed,r=[];let i,o,a;for(i=0,o=n.length;i<o;++i)a=n[i][t.axis],Yr(a)&&r.push(a);return r}getMaxOverflow(){return!1}getLabelAndValue(t){const n=this._cachedMeta,r=n.iScale,i=n.vScale,o=this.getParsed(t);return{label:r?""+r.getLabelForValue(o[r.axis]):"",value:i?""+i.getLabelForValue(o[i.axis]):""}}_update(t){const n=this._cachedMeta;this.update(t||"default"),n._clip=kce(Se(this.options.clip,Pce(n.xScale,n.yScale,this.getMaxOverflow())))}update(t){}draw(){const t=this._ctx,n=this.chart,r=this._cachedMeta,i=r.data||[],o=n.chartArea,a=[],s=this._drawStart||0,l=this._drawCount||i.length-s,c=this.options.drawActiveElementsOnTop;let u;for(r.dataset&&r.dataset.draw(t,o,s,l),u=s;u<s+l;++u){const d=i[u];d.hidden||(d.active&&c?a.push(d):d.draw(t,o))}for(u=0;u<a.length;++u)a[u].draw(t,o)}getStyle(t,n){const r=n?"active":"default";return t===void 0&&this._cachedMeta.dataset?this.resolveDatasetElementOptions(r):this.resolveDataElementOptions(t||0,r)}getContext(t,n,r){const i=this.getDataset();let o;if(t>=0&&t<this._cachedMeta.data.length){const a=this._cachedMeta.data[t];o=a.$context||(a.$context=jce(this.getContext(),t,a)),o.parsed=this.getParsed(t),o.raw=i.data[t],o.index=o.dataIndex=t}else o=this.$context||(this.$context=Nce(this.chart.getContext(),this.index)),o.dataset=i,o.index=o.datasetIndex=this.index;return o.active=!!n,o.mode=r,o}resolveDatasetElementOptions(t){return this._resolveElementOptions(this.datasetElementType.id,t)}resolveDataElementOptions(t,n){return this._resolveElementOptions(this.dataElementType.id,n,t)}_resolveElementOptions(t,n="default",r){const i=n==="active",o=this._cachedDataOpts,a=t+"-"+n,s=o[a],l=this.enableOptionSharing&&du(r);if(s)return oP(s,l);const c=this.chart.config,u=c.datasetElementScopeKeys(this._type,t),d=i?[`${t}Hover`,"hover",t,""]:[t,""],f=c.getOptionScopes(this.getDataset(),u),p=Object.keys(Ft.elements[t]),m=()=>this.getContext(r,i,n),g=c.resolveNamedOptions(f,p,m,d);return g.$shared&&(g.$shared=l,o[a]=Object.freeze(oP(g,l))),g}_resolveAnimations(t,n,r){const i=this.chart,o=this._cachedDataOpts,a=`animation-${n}`,s=o[a];if(s)return s;let l;if(i.options.animation!==!1){const u=this.chart.config,d=u.datasetAnimationScopeKeys(this._type,n),f=u.getOptionScopes(this.getDataset(),d);l=u.createResolver(f,this.getContext(t,r,n))}const c=new fI(i,l&&l.animations);return l&&l._cacheable&&(o[a]=Object.freeze(c)),c}getSharedOptions(t){if(t.$shared)return this._sharedOptions||(this._sharedOptions=Object.assign({},t))}includeOptions(t,n){return!n||kv(t)||this.chart._animationsDisabled}_getSharedOptions(t,n){const r=this.resolveDataElementOptions(t,n),i=this._sharedOptions,o=this.getSharedOptions(r),a=this.includeOptions(n,o)||o!==i;return this.updateSharedOptions(o,n,r),{sharedOptions:o,includeOptions:a}}updateElement(t,n,r,i){kv(i)?Object.assign(t,r):this._resolveAnimations(n,i).update(t,r)}updateSharedOptions(t,n,r){t&&!kv(n)&&this._resolveAnimations(void 0,n).update(t,r)}_setStyle(t,n,r,i){t.active=i;const o=this.getStyle(n,i);this._resolveAnimations(n,r,i).update(t,{options:!i&&this.getSharedOptions(o)||o})}removeHoverStyle(t,n,r){this._setStyle(t,r,"active",!1)}setHoverStyle(t,n,r){this._setStyle(t,r,"active",!0)}_removeDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!1)}_setDatasetHoverStyle(){const t=this._cachedMeta.dataset;t&&this._setStyle(t,void 0,"active",!0)}_resyncElements(t){const n=this._data,r=this._cachedMeta.data;for(const[s,l,c]of this._syncList)this[s](l,c);this._syncList=[];const i=r.length,o=n.length,a=Math.min(o,i);a&&this.parse(0,a),o>i?this._insertElements(i,o-i,t):o<i&&this._removeElements(o,i-o)}_insertElements(t,n,r=!0){const i=this._cachedMeta,o=i.data,a=t+n;let s;const l=c=>{for(c.length+=n,s=c.length-1;s>=a;s--)c[s]=c[s-n]};for(l(o),s=t;s<a;++s)o[s]=new this.dataElementType;this._parsing&&l(i._parsed),this.parse(t,n),r&&this.updateElements(o,t,n,"reset")}updateElements(t,n,r,i){}_removeElements(t,n){const r=this._cachedMeta;if(this._parsing){const i=r._parsed.splice(t,n);r._stacked&&lc(r,i)}r.data.splice(t,n)}_sync(t){if(this._parsing)this._syncList.push(t);else{const[n,r,i]=t;this[n](r,i)}this.chart._dataChanges.push([this.index,...t])}_onDataPush(){const t=arguments.length;this._sync(["_insertElements",this.getDataset().data.length-t,t])}_onDataPop(){this._sync(["_removeElements",this._cachedMeta.data.length-1,1])}_onDataShift(){this._sync(["_removeElements",0,1])}_onDataSplice(t,n){n&&this._sync(["_removeElements",t,n]);const r=arguments.length-2;r&&this._sync(["_insertElements",t,r])}_onDataUnshift(){this._sync(["_insertElements",0,arguments.length])}}function Ice(e,t){if(!e._cache.$bar){const n=e.getMatchingVisibleMetas(t);let r=[];for(let i=0,o=n.length;i<o;i++)r=r.concat(n[i].controller.getAllParsedValues(e));e._cache.$bar=QR(r.sort((i,o)=>i-o))}return e._cache.$bar}function Lce(e){const t=e.iScale,n=Ice(t,e.type);let r=t._length,i,o,a,s;const l=()=>{a===32767||a===-32768||(du(s)&&(r=Math.min(r,Math.abs(a-s)||r)),s=a)};for(i=0,o=n.length;i<o;++i)a=t.getPixelForValue(n[i]),l();for(s=void 0,i=0,o=t.ticks.length;i<o;++i)a=t.getPixelForTick(i),l();return r}function $ce(e,t,n,r){const i=n.barThickness;let o,a;return Ke(i)?(o=t.min*n.categoryPercentage,a=n.barPercentage):(o=i*r,a=1),{chunk:o/r,ratio:a,start:t.pixels[e]-o/2}}function Fce(e,t,n,r){const i=t.pixels,o=i[e];let a=e>0?i[e-1]:null,s=e<i.length-1?i[e+1]:null;const l=n.categoryPercentage;a===null&&(a=o-(s===null?t.end-t.start:s-o)),s===null&&(s=o+o-a);const c=o-(o-Math.min(a,s))/2*l;return{chunk:Math.abs(s-a)/2*l/r,ratio:n.barPercentage,start:c}}function Bce(e,t,n,r){const i=n.parse(e[0],r),o=n.parse(e[1],r),a=Math.min(i,o),s=Math.max(i,o);let l=a,c=s;Math.abs(a)>Math.abs(s)&&(l=s,c=a),t[n.axis]=c,t._custom={barStart:l,barEnd:c,start:i,end:o,min:a,max:s}}function hI(e,t,n,r){return un(e)?Bce(e,t,n,r):t[n.axis]=n.parse(e,r),t}function aP(e,t,n,r){const i=e.iScale,o=e.vScale,a=i.getLabels(),s=i===o,l=[];let c,u,d,f;for(c=n,u=n+r;c<u;++c)f=t[c],d={},d[i.axis]=s||i.parse(a[c],c),l.push(hI(f,d,o,c));return l}function Dv(e){return e&&e.barStart!==void 0&&e.barEnd!==void 0}function Wce(e,t,n){return e!==0?Ti(e):(t.isHorizontal()?1:-1)*(t.min>=n?1:-1)}function Vce(e){let t,n,r,i,o;return e.horizontal?(t=e.base>e.x,n="left",r="right"):(t=e.base<e.y,n="bottom",r="top"),t?(i="end",o="start"):(i="start",o="end"),{start:n,end:r,reverse:t,top:i,bottom:o}}function zce(e,t,n,r){let i=t.borderSkipped;const o={};if(!i){e.borderSkipped=o;return}if(i===!0){e.borderSkipped={top:!0,right:!0,bottom:!0,left:!0};return}const{start:a,end:s,reverse:l,top:c,bottom:u}=Vce(e);i==="middle"&&n&&(e.enableBorderRadius=!0,(n._top||0)===r?i=c:(n._bottom||0)===r?i=u:(o[sP(u,a,s,l)]=!0,i=c)),o[sP(i,a,s,l)]=!0,e.borderSkipped=o}function sP(e,t,n,r){return r?(e=Hce(e,t,n),e=lP(e,n,t)):e=lP(e,t,n),e}function Hce(e,t,n){return e===t?n:e===n?t:e}function lP(e,t,n){return e==="start"?t:e==="end"?n:e}function Yce(e,{inflateAmount:t},n){e.inflateAmount=t==="auto"?n===1?.33:0:t}class Uce extends lm{static id="bar";static defaults={datasetElementType:!1,dataElementType:"bar",categoryPercentage:.8,barPercentage:.9,grouped:!0,animations:{numbers:{type:"number",properties:["x","y","base","width","height"]}}};static overrides={scales:{_index_:{type:"category",offset:!0,grid:{offset:!0}},_value_:{type:"linear",beginAtZero:!0}}};parsePrimitiveData(t,n,r,i){return aP(t,n,r,i)}parseArrayData(t,n,r,i){return aP(t,n,r,i)}parseObjectData(t,n,r,i){const{iScale:o,vScale:a}=t,{xAxisKey:s="x",yAxisKey:l="y"}=this._parsing,c=o.axis==="x"?s:l,u=a.axis==="x"?s:l,d=[];let f,p,m,g;for(f=r,p=r+i;f<p;++f)g=n[f],m={},m[o.axis]=o.parse(ds(g,c),f),d.push(hI(ds(g,u),m,a,f));return d}updateRangeFromParsed(t,n,r,i){super.updateRangeFromParsed(t,n,r,i);const o=r._custom;o&&n===this._cachedMeta.vScale&&(t.min=Math.min(t.min,o.min),t.max=Math.max(t.max,o.max))}getMaxOverflow(){return 0}getLabelAndValue(t){const n=this._cachedMeta,{iScale:r,vScale:i}=n,o=this.getParsed(t),a=o._custom,s=Dv(a)?"["+a.start+", "+a.end+"]":""+i.getLabelForValue(o[i.axis]);return{label:""+r.getLabelForValue(o[r.axis]),value:s}}initialize(){this.enableOptionSharing=!0,super.initialize();const t=this._cachedMeta;t.stack=this.getDataset().stack}update(t){const n=this._cachedMeta;this.updateElements(n.data,0,n.data.length,t)}updateElements(t,n,r,i){const o=i==="reset",{index:a,_cachedMeta:{vScale:s}}=this,l=s.getBasePixel(),c=s.isHorizontal(),u=this._getRuler(),{sharedOptions:d,includeOptions:f}=this._getSharedOptions(n,i);for(let p=n;p<n+r;p++){const m=this.getParsed(p),g=o||Ke(m[s.axis])?{base:l,head:l}:this._calculateBarValuePixels(p),v=this._calculateBarIndexPixels(p,u),x=(m._stacks||{})[s.axis],_={horizontal:c,base:g.base,enableBorderRadius:!x||Dv(m._custom)||a===x._top||a===x._bottom,x:c?g.head:v.center,y:c?v.center:g.head,height:c?v.size:Math.abs(g.size),width:c?Math.abs(g.size):v.size};f&&(_.options=d||this.resolveDataElementOptions(p,t[p].active?"active":i));const w=_.options||t[p].options;zce(_,w,x,a),Yce(_,w,u.ratio),this.updateElement(t[p],p,_,i)}}_getStacks(t,n){const{iScale:r}=this._cachedMeta,i=r.getMatchingVisibleMetas(this._type).filter(u=>u.controller.options.grouped),o=r.options.stacked,a=[],s=this._cachedMeta.controller.getParsed(n),l=s&&s[r.axis],c=u=>{const d=u._parsed.find(p=>p[r.axis]===l),f=d&&d[u.vScale.axis];if(Ke(f)||isNaN(f))return!0};for(const u of i)if(!(n!==void 0&&c(u))&&((o===!1||a.indexOf(u.stack)===-1||o===void 0&&u.stack===void 0)&&a.push(u.stack),u.index===t))break;return a.length||a.push(void 0),a}_getStackCount(t){return this._getStacks(void 0,t).length}_getAxisCount(){return this._getAxis().length}getFirstScaleIdForIndexAxis(){const t=this.chart.scales,n=this.chart.options.indexAxis;return Object.keys(t).filter(r=>t[r].axis===n).shift()}_getAxis(){const t={},n=this.getFirstScaleIdForIndexAxis();for(const r of this.chart.data.datasets)t[Se(this.chart.options.indexAxis==="x"?r.xAxisID:r.yAxisID,n)]=!0;return Object.keys(t)}_getStackIndex(t,n,r){const i=this._getStacks(t,r),o=n!==void 0?i.indexOf(n):-1;return o===-1?i.length-1:o}_getRuler(){const t=this.options,n=this._cachedMeta,r=n.iScale,i=[];let o,a;for(o=0,a=n.data.length;o<a;++o)i.push(r.getPixelForValue(this.getParsed(o)[r.axis],o));const s=t.barThickness;return{min:s||Lce(n),pixels:i,start:r._startPixel,end:r._endPixel,stackCount:this._getStackCount(),scale:r,grouped:t.grouped,ratio:s?1:t.categoryPercentage*t.barPercentage}}_calculateBarValuePixels(t){const{_cachedMeta:{vScale:n,_stacked:r,index:i},options:{base:o,minBarLength:a}}=this,s=o||0,l=this.getParsed(t),c=l._custom,u=Dv(c);let d=l[n.axis],f=0,p=r?this.applyStack(n,l,r):d,m,g;p!==d&&(f=p-d,p=d),u&&(d=c.barStart,p=c.barEnd-c.barStart,d!==0&&Ti(d)!==Ti(c.barEnd)&&(f=0),f+=d);const v=!Ke(o)&&!u?o:f;let x=n.getPixelForValue(v);if(this.chart.getDataVisibility(t)?m=n.getPixelForValue(f+p):m=x,g=m-x,Math.abs(g)<a){g=Wce(g,n,s)*a,d===s&&(x-=g/2);const _=n.getPixelForDecimal(0),w=n.getPixelForDecimal(1),y=Math.min(_,w),E=Math.max(_,w);x=Math.max(Math.min(x,E),y),m=x+g,r&&!u&&(l._stacks[n.axis]._visualValues[i]=n.getValueForPixel(m)-n.getValueForPixel(x))}if(x===n.getPixelForValue(s)){const _=Ti(g)*n.getLineWidthForValue(s)/2;x+=_,g-=_}return{size:g,base:x,head:m,center:m+g/2}}_calculateBarIndexPixels(t,n){const r=n.scale,i=this.options,o=i.skipNull,a=Se(i.maxBarThickness,1/0);let s,l;const c=this._getAxisCount();if(n.grouped){const u=o?this._getStackCount(t):n.stackCount,d=i.barThickness==="flex"?Fce(t,n,i,u*c):$ce(t,n,i,u*c),f=this.chart.options.indexAxis==="x"?this.getDataset().xAxisID:this.getDataset().yAxisID,p=this._getAxis().indexOf(Se(f,this.getFirstScaleIdForIndexAxis())),m=this._getStackIndex(this.index,this._cachedMeta.stack,o?t:void 0)+p;s=d.start+d.chunk*m+d.chunk/2,l=Math.min(a,d.chunk*d.ratio)}else s=r.getPixelForValue(this.getParsed(t)[r.axis],t),l=Math.min(a,n.min*n.ratio);return{base:s-l/2,head:s+l/2,center:s,size:l}}draw(){const t=this._cachedMeta,n=t.vScale,r=t.data,i=r.length;let o=0;for(;o<i;++o)this.getParsed(o)[n.axis]!==null&&!r[o].hidden&&r[o].draw(this._ctx)}}function Kce(e,t,n){let r=1,i=1,o=0,a=0;if(t<Nt){const s=e,l=s+t,c=Math.cos(s),u=Math.sin(s),d=Math.cos(l),f=Math.sin(l),p=(w,y,E)=>pu(w,s,l,!0)?1:Math.max(y,y*n,E,E*n),m=(w,y,E)=>pu(w,s,l,!0)?-1:Math.min(y,y*n,E,E*n),g=p(0,c,d),v=p(en,u,f),x=m(lt,c,d),_=m(lt+en,u,f);r=(g-x)/2,i=(v-_)/2,o=-(g+x)/2,a=-(v+_)/2}return{ratioX:r,ratioY:i,offsetX:o,offsetY:a}}class qce extends lm{static id="doughnut";static defaults={datasetElementType:!1,dataElementType:"arc",animation:{animateRotate:!0,animateScale:!1},animations:{numbers:{type:"number",properties:["circumference","endAngle","innerRadius","outerRadius","startAngle","x","y","offset","borderWidth","spacing"]}},cutout:"50%",rotation:0,circumference:360,radius:"100%",spacing:0,indexAxis:"r"};static descriptors={_scriptable:t=>t!=="spacing",_indexable:t=>t!=="spacing"&&!t.startsWith("borderDash")&&!t.startsWith("hoverBorderDash")};static overrides={aspectRatio:1,plugins:{legend:{labels:{generateLabels(t){const n=t.data;if(n.labels.length&&n.datasets.length){const{labels:{pointStyle:r,color:i}}=t.legend.options;return n.labels.map((o,a)=>{const l=t.getDatasetMeta(0).controller.getStyle(a);return{text:o,fillStyle:l.backgroundColor,strokeStyle:l.borderColor,fontColor:i,lineWidth:l.borderWidth,pointStyle:r,hidden:!t.getDataVisibility(a),index:a}})}return[]}},onClick(t,n,r){r.chart.toggleDataVisibility(n.index),r.chart.update()}}}};constructor(t,n){super(t,n),this.enableOptionSharing=!0,this.innerRadius=void 0,this.outerRadius=void 0,this.offsetX=void 0,this.offsetY=void 0}linkScales(){}parse(t,n){const r=this.getDataset().data,i=this._cachedMeta;if(this._parsing===!1)i._parsed=r;else{let o=l=>+r[l];if(Re(r[t])){const{key:l="value"}=this._parsing;o=c=>+ds(r[c],l)}let a,s;for(a=t,s=t+n;a<s;++a)i._parsed[a]=o(a)}}_getRotation(){return lo(this.options.rotation-90)}_getCircumference(){return lo(this.options.circumference)}_getRotationExtents(){let t=Nt,n=-Nt;for(let r=0;r<this.chart.data.datasets.length;++r)if(this.chart.isDatasetVisible(r)&&this.chart.getDatasetMeta(r).type===this._type){const i=this.chart.getDatasetMeta(r).controller,o=i._getRotation(),a=i._getCircumference();t=Math.min(t,o),n=Math.max(n,o+a)}return{rotation:t,circumference:n-t}}update(t){const n=this.chart,{chartArea:r}=n,i=this._cachedMeta,o=i.data,a=this.getMaxBorderWidth()+this.getMaxOffset(o)+this.options.spacing,s=Math.max((Math.min(r.width,r.height)-a)/2,0),l=Math.min(Qse(this.options.cutout,s),1),c=this._getRingWeight(this.index),{circumference:u,rotation:d}=this._getRotationExtents(),{ratioX:f,ratioY:p,offsetX:m,offsetY:g}=Kce(d,u,l),v=(r.width-a)/f,x=(r.height-a)/p,_=Math.max(Math.min(v,x)/2,0),w=UR(this.options.radius,_),y=Math.max(w*l,0),E=(w-y)/this._getVisibleDatasetWeightTotal();this.offsetX=m*w,this.offsetY=g*w,i.total=this.calculateTotal(),this.outerRadius=w-E*this._getRingWeightOffset(this.index),this.innerRadius=Math.max(this.outerRadius-E*c,0),this.updateElements(o,0,o.length,t)}_circumference(t,n){const r=this.options,i=this._cachedMeta,o=this._getCircumference();return n&&r.animation.animateRotate||!this.chart.getDataVisibility(t)||i._parsed[t]===null||i.data[t].hidden?0:this.calculateCircumference(i._parsed[t]*o/Nt)}updateElements(t,n,r,i){const o=i==="reset",a=this.chart,s=a.chartArea,c=a.options.animation,u=(s.left+s.right)/2,d=(s.top+s.bottom)/2,f=o&&c.animateScale,p=f?0:this.innerRadius,m=f?0:this.outerRadius,{sharedOptions:g,includeOptions:v}=this._getSharedOptions(n,i);let x=this._getRotation(),_;for(_=0;_<n;++_)x+=this._circumference(_,o);for(_=n;_<n+r;++_){const w=this._circumference(_,o),y=t[_],E={x:u+this.offsetX,y:d+this.offsetY,startAngle:x,endAngle:x+w,circumference:w,outerRadius:m,innerRadius:p};v&&(E.options=g||this.resolveDataElementOptions(_,y.active?"active":i)),x+=w,this.updateElement(y,_,E,i)}}calculateTotal(){const t=this._cachedMeta,n=t.data;let r=0,i;for(i=0;i<n.length;i++){const o=t._parsed[i];o!==null&&!isNaN(o)&&this.chart.getDataVisibility(i)&&!n[i].hidden&&(r+=Math.abs(o))}return r}calculateCircumference(t){const n=this._cachedMeta.total;return n>0&&!isNaN(t)?Nt*(Math.abs(t)/n):0}getLabelAndValue(t){const n=this._cachedMeta,r=this.chart,i=r.data.labels||[],o=x1(n._parsed[t],r.options.locale);return{label:i[t]||"",value:o}}getMaxBorderWidth(t){let n=0;const r=this.chart;let i,o,a,s,l;if(!t){for(i=0,o=r.data.datasets.length;i<o;++i)if(r.isDatasetVisible(i)){a=r.getDatasetMeta(i),t=a.data,s=a.controller;break}}if(!t)return 0;for(i=0,o=t.length;i<o;++i)l=s.resolveDataElementOptions(i),l.borderAlign!=="inner"&&(n=Math.max(n,l.borderWidth||0,l.hoverBorderWidth||0));return n}getMaxOffset(t){let n=0;for(let r=0,i=t.length;r<i;++r){const o=this.resolveDataElementOptions(r);n=Math.max(n,o.offset||0,o.hoverOffset||0)}return n}_getRingWeightOffset(t){let n=0;for(let r=0;r<t;++r)this.chart.isDatasetVisible(r)&&(n+=this._getRingWeight(r));return n}_getRingWeight(t){return Math.max(Se(this.chart.data.datasets[t].weight,1),0)}_getVisibleDatasetWeightTotal(){return this._getRingWeightOffset(this.chart.data.datasets.length)||1}}class Gce extends lm{static id="line";static defaults={datasetElementType:"line",dataElementType:"point",showLine:!0,spanGaps:!1};static overrides={scales:{_index_:{type:"category"},_value_:{type:"linear"}}};initialize(){this.enableOptionSharing=!0,this.supportsDecimation=!0,super.initialize()}update(t){const n=this._cachedMeta,{dataset:r,data:i=[],_dataset:o}=n,a=this.chart._animationsDisabled;let{start:s,count:l}=vle(n,i,a);this._drawStart=s,this._drawCount=l,yle(n)&&(s=0,l=i.length),r._chart=this.chart,r._datasetIndex=this.index,r._decimated=!!o._decimated,r.points=i;const c=this.resolveDatasetElementOptions(t);this.options.showLine||(c.borderWidth=0),c.segment=this.options.segment,this.updateElement(r,void 0,{animated:!a,options:c},t),this.updateElements(i,s,l,t)}updateElements(t,n,r,i){const o=i==="reset",{iScale:a,vScale:s,_stacked:l,_dataset:c}=this._cachedMeta,{sharedOptions:u,includeOptions:d}=this._getSharedOptions(n,i),f=a.axis,p=s.axis,{spanGaps:m,segment:g}=this.options,v=fu(m)?m:Number.POSITIVE_INFINITY,x=this.chart._animationsDisabled||o||i==="none",_=n+r,w=t.length;let y=n>0&&this.getParsed(n-1);for(let E=0;E<w;++E){const S=t[E],k=x?S:{};if(E<n||E>=_){k.skip=!0;continue}const D=this.getParsed(E),T=Ke(D[p]),R=k[f]=a.getPixelForValue(D[f],E),A=k[p]=o||T?s.getBasePixel():s.getPixelForValue(l?this.applyStack(s,D,l):D[p],E);k.skip=isNaN(R)||isNaN(A)||T,k.stop=E>0&&Math.abs(D[f]-y[f])>v,g&&(k.parsed=D,k.raw=c.data[E]),d&&(k.options=u||this.resolveDataElementOptions(E,S.active?"active":i)),x||this.updateElement(S,E,k,i),y=D}}getMaxOverflow(){const t=this._cachedMeta,n=t.dataset,r=n.options&&n.options.borderWidth||0,i=t.data||[];if(!i.length)return r;const o=i[0].size(this.resolveDataElementOptions(0)),a=i[i.length-1].size(this.resolveDataElementOptions(i.length-1));return Math.max(r,o,a)/2}draw(){const t=this._cachedMeta;t.dataset.updateControlPoints(this.chart.chartArea,t.iScale.axis),super.draw()}}function _a(){throw new Error("This method is not implemented: Check that a complete date adapter is provided.")}class D1{static override(t){Object.assign(D1.prototype,t)}options;constructor(t){this.options=t||{}}init(){}formats(){return _a()}parse(){return _a()}format(){return _a()}add(){return _a()}diff(){return _a()}startOf(){return _a()}endOf(){return _a()}}var Xce={_date:D1};function Qce(e,t,n,r){const{controller:i,data:o,_sorted:a}=e,s=i._cachedMeta.iScale,l=e.dataset&&e.dataset.options?e.dataset.options.spanGaps:null;if(s&&t===s.axis&&t!=="r"&&a&&o.length){const c=s._reversePixels?fle:za;if(r){if(i._sharedOptions){const u=o[0],d=typeof u.getRange=="function"&&u.getRange(t);if(d){const f=c(o,t,n-d),p=c(o,t,n+d);return{lo:f.lo,hi:p.hi}}}}else{const u=c(o,t,n);if(l){const{vScale:d}=i._cachedMeta,{_parsed:f}=e,p=f.slice(0,u.lo+1).reverse().findIndex(g=>!Ke(g[d.axis]));u.lo-=Math.max(0,p);const m=f.slice(u.hi).findIndex(g=>!Ke(g[d.axis]));u.hi+=Math.max(0,m)}return u}}return{lo:0,hi:o.length-1}}function cm(e,t,n,r,i){const o=e.getSortedVisibleDatasetMetas(),a=n[t];for(let s=0,l=o.length;s<l;++s){const{index:c,data:u}=o[s],{lo:d,hi:f}=Qce(o[s],t,a,i);for(let p=d;p<=f;++p){const m=u[p];m.skip||r(m,c,p)}}}function Zce(e){const t=e.indexOf("x")!==-1,n=e.indexOf("y")!==-1;return function(r,i){const o=t?Math.abs(r.x-i.x):0,a=n?Math.abs(r.y-i.y):0;return Math.sqrt(Math.pow(o,2)+Math.pow(a,2))}}function Av(e,t,n,r,i){const o=[];return!i&&!e.isPointInArea(t)||cm(e,n,t,function(s,l,c){!i&&!hu(s,e.chartArea,0)||s.inRange(t.x,t.y,r)&&o.push({element:s,datasetIndex:l,index:c})},!0),o}function Jce(e,t,n,r){let i=[];function o(a,s,l){const{startAngle:c,endAngle:u}=a.getProps(["startAngle","endAngle"],r),{angle:d}=GR(a,{x:t.x,y:t.y});pu(d,c,u)&&i.push({element:a,datasetIndex:s,index:l})}return cm(e,n,t,o),i}function eue(e,t,n,r,i,o){let a=[];const s=Zce(n);let l=Number.POSITIVE_INFINITY;function c(u,d,f){const p=u.inRange(t.x,t.y,i);if(r&&!p)return;const m=u.getCenterPoint(i);if(!(!!o||e.isPointInArea(m))&&!p)return;const v=s(t,m);v<l?(a=[{element:u,datasetIndex:d,index:f}],l=v):v===l&&a.push({element:u,datasetIndex:d,index:f})}return cm(e,n,t,c),a}function Tv(e,t,n,r,i,o){return!o&&!e.isPointInArea(t)?[]:n==="r"&&!r?Jce(e,t,n,i):eue(e,t,n,r,i,o)}function cP(e,t,n,r,i){const o=[],a=n==="x"?"inXRange":"inYRange";let s=!1;return cm(e,n,t,(l,c,u)=>{l[a]&&l[a](t[n],i)&&(o.push({element:l,datasetIndex:c,index:u}),s=s||l.inRange(t.x,t.y,i))}),r&&!s?[]:o}var tue={modes:{index(e,t,n,r){const i=Na(t,e),o=n.axis||"x",a=n.includeInvisible||!1,s=n.intersect?Av(e,i,o,r,a):Tv(e,i,o,!1,r,a),l=[];return s.length?(e.getSortedVisibleDatasetMetas().forEach(c=>{const u=s[0].index,d=c.data[u];d&&!d.skip&&l.push({element:d,datasetIndex:c.index,index:u})}),l):[]},dataset(e,t,n,r){const i=Na(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;let s=n.intersect?Av(e,i,o,r,a):Tv(e,i,o,!1,r,a);if(s.length>0){const l=s[0].datasetIndex,c=e.getDatasetMeta(l).data;s=[];for(let u=0;u<c.length;++u)s.push({element:c[u],datasetIndex:l,index:u})}return s},point(e,t,n,r){const i=Na(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;return Av(e,i,o,r,a)},nearest(e,t,n,r){const i=Na(t,e),o=n.axis||"xy",a=n.includeInvisible||!1;return Tv(e,i,o,n.intersect,r,a)},x(e,t,n,r){const i=Na(t,e);return cP(e,i,"x",n.intersect,r)},y(e,t,n,r){const i=Na(t,e);return cP(e,i,"y",n.intersect,r)}}};const mI=["left","top","right","bottom"];function cc(e,t){return e.filter(n=>n.pos===t)}function uP(e,t){return e.filter(n=>mI.indexOf(n.pos)===-1&&n.box.axis===t)}function uc(e,t){return e.sort((n,r)=>{const i=t?r:n,o=t?n:r;return i.weight===o.weight?i.index-o.index:i.weight-o.weight})}function nue(e){const t=[];let n,r,i,o,a,s;for(n=0,r=(e||[]).length;n<r;++n)i=e[n],{position:o,options:{stack:a,stackWeight:s=1}}=i,t.push({index:n,box:i,pos:o,horizontal:i.isHorizontal(),weight:i.weight,stack:a&&o+a,stackWeight:s});return t}function rue(e){const t={};for(const n of e){const{stack:r,pos:i,stackWeight:o}=n;if(!r||!mI.includes(i))continue;const a=t[r]||(t[r]={count:0,placed:0,weight:0,size:0});a.count++,a.weight+=o}return t}function iue(e,t){const n=rue(e),{vBoxMaxWidth:r,hBoxMaxHeight:i}=t;let o,a,s;for(o=0,a=e.length;o<a;++o){s=e[o];const{fullSize:l}=s.box,c=n[s.stack],u=c&&s.stackWeight/c.weight;s.horizontal?(s.width=u?u*r:l&&t.availableWidth,s.height=i):(s.width=r,s.height=u?u*i:l&&t.availableHeight)}return n}function oue(e){const t=nue(e),n=uc(t.filter(c=>c.box.fullSize),!0),r=uc(cc(t,"left"),!0),i=uc(cc(t,"right")),o=uc(cc(t,"top"),!0),a=uc(cc(t,"bottom")),s=uP(t,"x"),l=uP(t,"y");return{fullSize:n,leftAndTop:r.concat(o),rightAndBottom:i.concat(l).concat(a).concat(s),chartArea:cc(t,"chartArea"),vertical:r.concat(i).concat(l),horizontal:o.concat(a).concat(s)}}function dP(e,t,n,r){return Math.max(e[n],t[n])+Math.max(e[r],t[r])}function gI(e,t){e.top=Math.max(e.top,t.top),e.left=Math.max(e.left,t.left),e.bottom=Math.max(e.bottom,t.bottom),e.right=Math.max(e.right,t.right)}function aue(e,t,n,r){const{pos:i,box:o}=n,a=e.maxPadding;if(!Re(i)){n.size&&(e[i]-=n.size);const d=r[n.stack]||{size:0,count:1};d.size=Math.max(d.size,n.horizontal?o.height:o.width),n.size=d.size/d.count,e[i]+=n.size}o.getPadding&&gI(a,o.getPadding());const s=Math.max(0,t.outerWidth-dP(a,e,"left","right")),l=Math.max(0,t.outerHeight-dP(a,e,"top","bottom")),c=s!==e.w,u=l!==e.h;return e.w=s,e.h=l,n.horizontal?{same:c,other:u}:{same:u,other:c}}function sue(e){const t=e.maxPadding;function n(r){const i=Math.max(t[r]-e[r],0);return e[r]+=i,i}e.y+=n("top"),e.x+=n("left"),n("right"),n("bottom")}function lue(e,t){const n=t.maxPadding;function r(i){const o={left:0,top:0,right:0,bottom:0};return i.forEach(a=>{o[a]=Math.max(t[a],n[a])}),o}return r(e?["left","right"]:["top","bottom"])}function Ec(e,t,n,r){const i=[];let o,a,s,l,c,u;for(o=0,a=e.length,c=0;o<a;++o){s=e[o],l=s.box,l.update(s.width||t.w,s.height||t.h,lue(s.horizontal,t));const{same:d,other:f}=aue(t,n,s,r);c|=d&&i.length,u=u||f,l.fullSize||i.push(s)}return c&&Ec(i,t,n,r)||u}function Xd(e,t,n,r,i){e.top=n,e.left=t,e.right=t+r,e.bottom=n+i,e.width=r,e.height=i}function fP(e,t,n,r){const i=n.padding;let{x:o,y:a}=t;for(const s of e){const l=s.box,c=r[s.stack]||{placed:0,weight:1},u=s.stackWeight/c.weight||1;if(s.horizontal){const d=t.w*u,f=c.size||l.height;du(c.start)&&(a=c.start),l.fullSize?Xd(l,i.left,a,n.outerWidth-i.right-i.left,f):Xd(l,t.left+c.placed,a,d,f),c.start=a,c.placed+=d,a=l.bottom}else{const d=t.h*u,f=c.size||l.width;du(c.start)&&(o=c.start),l.fullSize?Xd(l,o,i.top,f,n.outerHeight-i.bottom-i.top):Xd(l,o,t.top+c.placed,f,d),c.start=o,c.placed+=d,o=l.right}}t.x=o,t.y=a}var Yo={addBox(e,t){e.boxes||(e.boxes=[]),t.fullSize=t.fullSize||!1,t.position=t.position||"top",t.weight=t.weight||0,t._layers=t._layers||function(){return[{z:0,draw(n){t.draw(n)}}]},e.boxes.push(t)},removeBox(e,t){const n=e.boxes?e.boxes.indexOf(t):-1;n!==-1&&e.boxes.splice(n,1)},configure(e,t,n){t.fullSize=n.fullSize,t.position=n.position,t.weight=n.weight},update(e,t,n,r){if(!e)return;const i=ii(e.options.layout.padding),o=Math.max(t-i.width,0),a=Math.max(n-i.height,0),s=oue(e.boxes),l=s.vertical,c=s.horizontal;Ze(e.boxes,g=>{typeof g.beforeLayout=="function"&&g.beforeLayout()});const u=l.reduce((g,v)=>v.box.options&&v.box.options.display===!1?g:g+1,0)||1,d=Object.freeze({outerWidth:t,outerHeight:n,padding:i,availableWidth:o,availableHeight:a,vBoxMaxWidth:o/2/u,hBoxMaxHeight:a/2}),f=Object.assign({},i);gI(f,ii(r));const p=Object.assign({maxPadding:f,w:o,h:a,x:i.left,y:i.top},i),m=iue(l.concat(c),d);Ec(s.fullSize,p,d,m),Ec(l,p,d,m),Ec(c,p,d,m)&&Ec(l,p,d,m),sue(p),fP(s.leftAndTop,p,d,m),p.x+=p.w,p.y+=p.h,fP(s.rightAndBottom,p,d,m),e.chartArea={left:p.left,top:p.top,right:p.left+p.w,bottom:p.top+p.h,height:p.h,width:p.w},Ze(s.chartArea,g=>{const v=g.box;Object.assign(v,e.chartArea),v.update(p.w,p.h,{left:0,top:0,right:0,bottom:0})})}};class vI{acquireContext(t,n){}releaseContext(t){return!1}addEventListener(t,n,r){}removeEventListener(t,n,r){}getDevicePixelRatio(){return 1}getMaximumSize(t,n,r,i){return n=Math.max(0,n||t.width),r=r||t.height,{width:n,height:Math.max(0,i?Math.floor(n/i):r)}}isAttached(t){return!0}updateConfig(t){}}class cue extends vI{acquireContext(t){return t&&t.getContext&&t.getContext("2d")||null}updateConfig(t){t.options.animation=!1}}const bf="$chartjs",uue={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"},pP=e=>e===null||e==="";function due(e,t){const n=e.style,r=e.getAttribute("height"),i=e.getAttribute("width");if(e[bf]={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",pP(i)){const o=XC(e,"width");o!==void 0&&(e.width=o)}if(pP(r))if(e.style.height==="")e.height=e.width/(t||2);else{const o=XC(e,"height");o!==void 0&&(e.height=o)}return e}const yI=sce?{passive:!0}:!1;function fue(e,t,n){e&&e.addEventListener(t,n,yI)}function pue(e,t,n){e&&e.canvas&&e.canvas.removeEventListener(t,n,yI)}function hue(e,t){const n=uue[e.type]||e.type,{x:r,y:i}=Na(e,t);return{type:n,chart:t,native:e,x:r!==void 0?r:null,y:i!==void 0?i:null}}function $p(e,t){for(const n of e)if(n===t||n.contains(t))return!0}function mue(e,t,n){const r=e.canvas,i=new MutationObserver(o=>{let a=!1;for(const s of o)a=a||$p(s.addedNodes,r),a=a&&!$p(s.removedNodes,r);a&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}function gue(e,t,n){const r=e.canvas,i=new MutationObserver(o=>{let a=!1;for(const s of o)a=a||$p(s.removedNodes,r),a=a&&!$p(s.addedNodes,r);a&&n()});return i.observe(document,{childList:!0,subtree:!0}),i}const mu=new Map;let hP=0;function bI(){const e=window.devicePixelRatio;e!==hP&&(hP=e,mu.forEach((t,n)=>{n.currentDevicePixelRatio!==e&&t()}))}function vue(e,t){mu.size||window.addEventListener("resize",bI),mu.set(e,t)}function yue(e){mu.delete(e),mu.size||window.removeEventListener("resize",bI)}function bue(e,t,n){const r=e.canvas,i=r&&k1(r);if(!i)return;const o=JR((s,l)=>{const c=i.clientWidth;n(s,l),c<i.clientWidth&&n()},window),a=new ResizeObserver(s=>{const l=s[0],c=l.contentRect.width,u=l.contentRect.height;c===0&&u===0||o(c,u)});return a.observe(i),vue(e,o),a}function Mv(e,t,n){n&&n.disconnect(),t==="resize"&&yue(e)}function xue(e,t,n){const r=e.canvas,i=JR(o=>{e.ctx!==null&&n(hue(o,e))},e);return fue(r,t,i),i}class wue extends vI{acquireContext(t,n){const r=t&&t.getContext&&t.getContext("2d");return r&&r.canvas===t?(due(t,n),r):null}releaseContext(t){const n=t.canvas;if(!n[bf])return!1;const r=n[bf].initial;["height","width"].forEach(o=>{const a=r[o];Ke(a)?n.removeAttribute(o):n.setAttribute(o,a)});const i=r.style||{};return Object.keys(i).forEach(o=>{n.style[o]=i[o]}),n.width=n.width,delete n[bf],!0}addEventListener(t,n,r){this.removeEventListener(t,n);const i=t.$proxies||(t.$proxies={}),a={attach:mue,detach:gue,resize:bue}[n]||xue;i[n]=a(t,n,r)}removeEventListener(t,n){const r=t.$proxies||(t.$proxies={}),i=r[n];if(!i)return;({attach:Mv,detach:Mv,resize:Mv}[n]||pue)(t,n,i),r[n]=void 0}getDevicePixelRatio(){return window.devicePixelRatio}getMaximumSize(t,n,r,i){return ace(t,n,r,i)}isAttached(t){const n=t&&k1(t);return!!(n&&n.isConnected)}}function _ue(e){return!P1()||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas?cue:wue}let ha=class{static defaults={};static defaultRoutes=void 0;x;y;active=!1;options;$animations;tooltipPosition(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}hasValue(){return fu(this.x)&&fu(this.y)}getProps(t,n){const r=this.$animations;if(!n||!r)return this;const i={};return t.forEach(o=>{i[o]=r[o]&&r[o].active()?r[o]._to:this[o]}),i}};function Eue(e,t){const n=e.options.ticks,r=Sue(e),i=Math.min(n.maxTicksLimit||r,r),o=n.major.enabled?Cue(t):[],a=o.length,s=o[0],l=o[a-1],c=[];if(a>i)return Pue(t,c,o,a/i),c;const u=Oue(o,t,i);if(a>0){let d,f;const p=a>1?Math.round((l-s)/(a-1)):null;for(Qd(t,c,u,Ke(p)?0:s-p,s),d=0,f=a-1;d<f;d++)Qd(t,c,u,o[d],o[d+1]);return Qd(t,c,u,l,Ke(p)?t.length:l+p),c}return Qd(t,c,u),c}function Sue(e){const t=e.options.offset,n=e._tickSize(),r=e._length/n+(t?0:1),i=e._maxLength/n;return Math.floor(Math.min(r,i))}function Oue(e,t,n){const r=kue(e),i=t.length/n;if(!r)return Math.max(i,1);const o=ole(r);for(let a=0,s=o.length-1;a<s;a++){const l=o[a];if(l>i)return l}return Math.max(i,1)}function Cue(e){const t=[];let n,r;for(n=0,r=e.length;n<r;n++)e[n].major&&t.push(n);return t}function Pue(e,t,n,r){let i=0,o=n[0],a;for(r=Math.ceil(r),a=0;a<e.length;a++)a===o&&(t.push(e[a]),i++,o=n[i*r])}function Qd(e,t,n,r,i){const o=Se(r,0),a=Math.min(Se(i,e.length),e.length);let s=0,l,c,u;for(n=Math.ceil(n),i&&(l=i-r,n=l/Math.floor(l/n)),u=o;u<0;)s++,u=Math.round(o+s*n);for(c=Math.max(o,0);c<a;c++)c===u&&(t.push(e[c]),s++,u=Math.round(o+s*n))}function kue(e){const t=e.length;let n,r;if(t<2)return!1;for(r=e[0],n=1;n<t;++n)if(e[n]-e[n-1]!==r)return!1;return r}const Due=e=>e==="left"?"right":e==="right"?"left":e,mP=(e,t,n)=>t==="top"||t==="left"?e[t]+n:e[t]-n,gP=(e,t)=>Math.min(t||e,e);function vP(e,t){const n=[],r=e.length/t,i=e.length;let o=0;for(;o<i;o+=r)n.push(e[Math.floor(o)]);return n}function Aue(e,t,n){const r=e.ticks.length,i=Math.min(t,r-1),o=e._startPixel,a=e._endPixel,s=1e-6;let l=e.getPixelForTick(i),c;if(!(n&&(r===1?c=Math.max(l-o,a-l):t===0?c=(e.getPixelForTick(1)-l)/2:c=(l-e.getPixelForTick(i-1))/2,l+=i<t?c:-c,l<o-s||l>a+s)))return l}function Tue(e,t){Ze(e,n=>{const r=n.gc,i=r.length/2;let o;if(i>t){for(o=0;o<i;++o)delete n.data[r[o]];r.splice(0,i)}})}function dc(e){return e.drawTicks?e.tickLength:0}function yP(e,t){if(!e.display)return 0;const n=or(e.font,t),r=ii(e.padding);return(un(e.text)?e.text.length:1)*n.lineHeight+r.height}function Mue(e,t){return bs(e,{scale:t,type:"scale"})}function Nue(e,t,n){return bs(e,{tick:n,index:t,type:"tick"})}function jue(e,t,n){let r=eI(e);return(n&&t!=="right"||!n&&t==="right")&&(r=Due(r)),r}function Rue(e,t,n,r){const{top:i,left:o,bottom:a,right:s,chart:l}=e,{chartArea:c,scales:u}=l;let d=0,f,p,m;const g=a-i,v=s-o;if(e.isHorizontal()){if(p=hr(r,o,s),Re(n)){const x=Object.keys(n)[0],_=n[x];m=u[x].getPixelForValue(_)+g-t}else n==="center"?m=(c.bottom+c.top)/2+g-t:m=mP(e,n,t);f=s-o}else{if(Re(n)){const x=Object.keys(n)[0],_=n[x];p=u[x].getPixelForValue(_)-v+t}else n==="center"?p=(c.left+c.right)/2-v+t:p=mP(e,n,t);m=hr(r,a,i),d=n==="left"?-en:en}return{titleX:p,titleY:m,maxWidth:f,rotation:d}}class $l extends ha{constructor(t){super(),this.id=t.id,this.type=t.type,this.options=void 0,this.ctx=t.ctx,this.chart=t.chart,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.width=void 0,this.height=void 0,this._margins={left:0,right:0,top:0,bottom:0},this.maxWidth=void 0,this.maxHeight=void 0,this.paddingTop=void 0,this.paddingBottom=void 0,this.paddingLeft=void 0,this.paddingRight=void 0,this.axis=void 0,this.labelRotation=void 0,this.min=void 0,this.max=void 0,this._range=void 0,this.ticks=[],this._gridLineItems=null,this._labelItems=null,this._labelSizes=null,this._length=0,this._maxLength=0,this._longestTextCache={},this._startPixel=void 0,this._endPixel=void 0,this._reversePixels=!1,this._userMax=void 0,this._userMin=void 0,this._suggestedMax=void 0,this._suggestedMin=void 0,this._ticksLength=0,this._borderValue=0,this._cache={},this._dataLimitsCached=!1,this.$context=void 0}init(t){this.options=t.setContext(this.getContext()),this.axis=t.axis,this._userMin=this.parse(t.min),this._userMax=this.parse(t.max),this._suggestedMin=this.parse(t.suggestedMin),this._suggestedMax=this.parse(t.suggestedMax)}parse(t,n){return t}getUserBounds(){let{_userMin:t,_userMax:n,_suggestedMin:r,_suggestedMax:i}=this;return t=di(t,Number.POSITIVE_INFINITY),n=di(n,Number.NEGATIVE_INFINITY),r=di(r,Number.POSITIVE_INFINITY),i=di(i,Number.NEGATIVE_INFINITY),{min:di(t,r),max:di(n,i),minDefined:Yr(t),maxDefined:Yr(n)}}getMinMax(t){let{min:n,max:r,minDefined:i,maxDefined:o}=this.getUserBounds(),a;if(i&&o)return{min:n,max:r};const s=this.getMatchingVisibleMetas();for(let l=0,c=s.length;l<c;++l)a=s[l].controller.getMinMax(this,t),i||(n=Math.min(n,a.min)),o||(r=Math.max(r,a.max));return n=o&&n>r?r:n,r=i&&n>r?n:r,{min:di(n,di(r,n)),max:di(r,di(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 t=this.chart.data;return this.options.labels||(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels||[]}getLabelItems(t=this.chart.chartArea){return this._labelItems||(this._labelItems=this._computeLabelItems(t))}beforeLayout(){this._cache={},this._dataLimitsCached=!1}beforeUpdate(){ht(this.options.beforeUpdate,[this])}update(t,n,r){const{beginAtZero:i,grace:o,ticks:a}=this.options,s=a.sampleSize;this.beforeUpdate(),this.maxWidth=t,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=$le(this,o,i),this._dataLimitsCached=!0),this.beforeBuildTicks(),this.ticks=this.buildTicks()||[],this.afterBuildTicks();const l=s<this.ticks.length;this._convertTicksToLabels(l?vP(this.ticks,s):this.ticks),this.configure(),this.beforeCalculateLabelRotation(),this.calculateLabelRotation(),this.afterCalculateLabelRotation(),a.display&&(a.autoSkip||a.source==="auto")&&(this.ticks=Eue(this,this.ticks),this._labelSizes=null,this.afterAutoSkip()),l&&this._convertTicksToLabels(this.ticks),this.beforeFit(),this.fit(),this.afterFit(),this.afterUpdate()}configure(){let t=this.options.reverse,n,r;this.isHorizontal()?(n=this.left,r=this.right):(n=this.top,r=this.bottom,t=!t),this._startPixel=n,this._endPixel=r,this._reversePixels=t,this._length=r-n,this._alignToPixels=this.options.alignToPixels}afterUpdate(){ht(this.options.afterUpdate,[this])}beforeSetDimensions(){ht(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(){ht(this.options.afterSetDimensions,[this])}_callHooks(t){this.chart.notifyPlugins(t,this.getContext()),ht(this.options[t],[this])}beforeDataLimits(){this._callHooks("beforeDataLimits")}determineDataLimits(){}afterDataLimits(){this._callHooks("afterDataLimits")}beforeBuildTicks(){this._callHooks("beforeBuildTicks")}buildTicks(){return[]}afterBuildTicks(){this._callHooks("afterBuildTicks")}beforeTickToLabelConversion(){ht(this.options.beforeTickToLabelConversion,[this])}generateTickLabels(t){const n=this.options.ticks;let r,i,o;for(r=0,i=t.length;r<i;r++)o=t[r],o.label=ht(n.callback,[o.value,r,t],this)}afterTickToLabelConversion(){ht(this.options.afterTickToLabelConversion,[this])}beforeCalculateLabelRotation(){ht(this.options.beforeCalculateLabelRotation,[this])}calculateLabelRotation(){const t=this.options,n=t.ticks,r=gP(this.ticks.length,t.ticks.maxTicksLimit),i=n.minRotation||0,o=n.maxRotation;let a=i,s,l,c;if(!this._isVisible()||!n.display||i>=o||r<=1||!this.isHorizontal()){this.labelRotation=i;return}const u=this._getLabelSizes(),d=u.widest.width,f=u.highest.height,p=Mn(this.chart.width-d,0,this.maxWidth);s=t.offset?this.maxWidth/r:p/(r-1),d+6>s&&(s=p/(r-(t.offset?.5:1)),l=this.maxHeight-dc(t.grid)-n.padding-yP(t.title,this.chart.options.font),c=Math.sqrt(d*d+f*f),a=cle(Math.min(Math.asin(Mn((u.highest.height+6)/s,-1,1)),Math.asin(Mn(l/c,-1,1))-Math.asin(Mn(f/c,-1,1)))),a=Math.max(i,Math.min(o,a))),this.labelRotation=a}afterCalculateLabelRotation(){ht(this.options.afterCalculateLabelRotation,[this])}afterAutoSkip(){}beforeFit(){ht(this.options.beforeFit,[this])}fit(){const t={width:0,height:0},{chart:n,options:{ticks:r,title:i,grid:o}}=this,a=this._isVisible(),s=this.isHorizontal();if(a){const l=yP(i,n.options.font);if(s?(t.width=this.maxWidth,t.height=dc(o)+l):(t.height=this.maxHeight,t.width=dc(o)+l),r.display&&this.ticks.length){const{first:c,last:u,widest:d,highest:f}=this._getLabelSizes(),p=r.padding*2,m=lo(this.labelRotation),g=Math.cos(m),v=Math.sin(m);if(s){const x=r.mirror?0:v*d.width+g*f.height;t.height=Math.min(this.maxHeight,t.height+x+p)}else{const x=r.mirror?0:g*d.width+v*f.height;t.width=Math.min(this.maxWidth,t.width+x+p)}this._calculatePadding(c,u,v,g)}}this._handleMargins(),s?(this.width=this._length=n.width-this._margins.left-this._margins.right,this.height=t.height):(this.width=t.width,this.height=this._length=n.height-this._margins.top-this._margins.bottom)}_calculatePadding(t,n,r,i){const{ticks:{align:o,padding:a},position:s}=this.options,l=this.labelRotation!==0,c=s!=="top"&&this.axis==="x";if(this.isHorizontal()){const u=this.getPixelForTick(0)-this.left,d=this.right-this.getPixelForTick(this.ticks.length-1);let f=0,p=0;l?c?(f=i*t.width,p=r*n.height):(f=r*t.height,p=i*n.width):o==="start"?p=n.width:o==="end"?f=t.width:o!=="inner"&&(f=t.width/2,p=n.width/2),this.paddingLeft=Math.max((f-u+a)*this.width/(this.width-u),0),this.paddingRight=Math.max((p-d+a)*this.width/(this.width-d),0)}else{let u=n.height/2,d=t.height/2;o==="start"?(u=0,d=t.height):o==="end"&&(u=n.height,d=0),this.paddingTop=u+a,this.paddingBottom=d+a}}_handleMargins(){this._margins&&(this._margins.left=Math.max(this.paddingLeft,this._margins.left),this._margins.top=Math.max(this.paddingTop,this._margins.top),this._margins.right=Math.max(this.paddingRight,this._margins.right),this._margins.bottom=Math.max(this.paddingBottom,this._margins.bottom))}afterFit(){ht(this.options.afterFit,[this])}isHorizontal(){const{axis:t,position:n}=this.options;return n==="top"||n==="bottom"||t==="x"}isFullSize(){return this.options.fullSize}_convertTicksToLabels(t){this.beforeTickToLabelConversion(),this.generateTickLabels(t);let n,r;for(n=0,r=t.length;n<r;n++)Ke(t[n].label)&&(t.splice(n,1),r--,n--);this.afterTickToLabelConversion()}_getLabelSizes(){let t=this._labelSizes;if(!t){const n=this.options.ticks.sampleSize;let r=this.ticks;n<r.length&&(r=vP(r,n)),this._labelSizes=t=this._computeLabelSizes(r,r.length,this.options.ticks.maxTicksLimit)}return t}_computeLabelSizes(t,n,r){const{ctx:i,_longestTextCache:o}=this,a=[],s=[],l=Math.floor(n/gP(n,r));let c=0,u=0,d,f,p,m,g,v,x,_,w,y,E;for(d=0;d<n;d+=l){if(m=t[d].label,g=this._resolveTickFontOptions(d),i.font=v=g.string,x=o[v]=o[v]||{data:{},gc:[]},_=g.lineHeight,w=y=0,!Ke(m)&&!un(m))w=YC(i,x.data,x.gc,w,m),y=_;else if(un(m))for(f=0,p=m.length;f<p;++f)E=m[f],!Ke(E)&&!un(E)&&(w=YC(i,x.data,x.gc,w,E),y+=_);a.push(w),s.push(y),c=Math.max(w,c),u=Math.max(y,u)}Tue(o,n);const S=a.indexOf(c),k=s.indexOf(u),D=T=>({width:a[T]||0,height:s[T]||0});return{first:D(0),last:D(n-1),widest:D(S),highest:D(k),widths:a,heights:s}}getLabelForValue(t){return t}getPixelForValue(t,n){return NaN}getValueForPixel(t){}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getPixelForDecimal(t){this._reversePixels&&(t=1-t);const n=this._startPixel+t*this._length;return dle(this._alignToPixels?wa(this.chart,n,0):n)}getDecimalForPixel(t){const n=(t-this._startPixel)/this._length;return this._reversePixels?1-n:n}getBasePixel(){return this.getPixelForValue(this.getBaseValue())}getBaseValue(){const{min:t,max:n}=this;return t<0&&n<0?n:t>0&&n>0?t:0}getContext(t){const n=this.ticks||[];if(t>=0&&t<n.length){const r=n[t];return r.$context||(r.$context=Nue(this.getContext(),t,r))}return this.$context||(this.$context=Mue(this.chart.getContext(),this))}_tickSize(){const t=this.options.ticks,n=lo(this.labelRotation),r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n)),o=this._getLabelSizes(),a=t.autoSkipPadding||0,s=o?o.widest.width+a:0,l=o?o.highest.height+a:0;return this.isHorizontal()?l*r>s*i?s/r:l/i:l*i<s*r?l/r:s/i}_isVisible(){const t=this.options.display;return t!=="auto"?!!t:this.getMatchingVisibleMetas().length>0}_computeGridLineItems(t){const n=this.axis,r=this.chart,i=this.options,{grid:o,position:a,border:s}=i,l=o.offset,c=this.isHorizontal(),d=this.ticks.length+(l?1:0),f=dc(o),p=[],m=s.setContext(this.getContext()),g=m.display?m.width:0,v=g/2,x=function($){return wa(r,$,g)};let _,w,y,E,S,k,D,T,R,A,C,N;if(a==="top")_=x(this.bottom),k=this.bottom-f,T=_-v,A=x(t.top)+v,N=t.bottom;else if(a==="bottom")_=x(this.top),A=t.top,N=x(t.bottom)-v,k=_+v,T=this.top+f;else if(a==="left")_=x(this.right),S=this.right-f,D=_-v,R=x(t.left)+v,C=t.right;else if(a==="right")_=x(this.left),R=t.left,C=x(t.right)-v,S=_+v,D=this.left+f;else if(n==="x"){if(a==="center")_=x((t.top+t.bottom)/2+.5);else if(Re(a)){const $=Object.keys(a)[0],B=a[$];_=x(this.chart.scales[$].getPixelForValue(B))}A=t.top,N=t.bottom,k=_+v,T=k+f}else if(n==="y"){if(a==="center")_=x((t.left+t.right)/2);else if(Re(a)){const $=Object.keys(a)[0],B=a[$];_=x(this.chart.scales[$].getPixelForValue(B))}S=_-v,D=S-f,R=t.left,C=t.right}const M=Se(i.ticks.maxTicksLimit,d),j=Math.max(1,Math.ceil(d/M));for(w=0;w<d;w+=j){const $=this.getContext(w),B=o.setContext($),z=s.setContext($),V=B.lineWidth,W=B.color,Q=z.dash||[],X=z.dashOffset,oe=B.tickWidth,Z=B.tickColor,re=B.tickBorderDash||[],ae=B.tickBorderDashOffset;y=Aue(this,w,l),y!==void 0&&(E=wa(r,y,V),c?S=D=R=C=E:k=T=A=N=E,p.push({tx1:S,ty1:k,tx2:D,ty2:T,x1:R,y1:A,x2:C,y2:N,width:V,color:W,borderDash:Q,borderDashOffset:X,tickWidth:oe,tickColor:Z,tickBorderDash:re,tickBorderDashOffset:ae}))}return this._ticksLength=d,this._borderValue=_,p}_computeLabelItems(t){const n=this.axis,r=this.options,{position:i,ticks:o}=r,a=this.isHorizontal(),s=this.ticks,{align:l,crossAlign:c,padding:u,mirror:d}=o,f=dc(r.grid),p=f+u,m=d?-u:p,g=-lo(this.labelRotation),v=[];let x,_,w,y,E,S,k,D,T,R,A,C,N="middle";if(i==="top")S=this.bottom-m,k=this._getXAxisLabelAlignment();else if(i==="bottom")S=this.top+m,k=this._getXAxisLabelAlignment();else if(i==="left"){const j=this._getYAxisLabelAlignment(f);k=j.textAlign,E=j.x}else if(i==="right"){const j=this._getYAxisLabelAlignment(f);k=j.textAlign,E=j.x}else if(n==="x"){if(i==="center")S=(t.top+t.bottom)/2+p;else if(Re(i)){const j=Object.keys(i)[0],$=i[j];S=this.chart.scales[j].getPixelForValue($)+p}k=this._getXAxisLabelAlignment()}else if(n==="y"){if(i==="center")E=(t.left+t.right)/2-p;else if(Re(i)){const j=Object.keys(i)[0],$=i[j];E=this.chart.scales[j].getPixelForValue($)}k=this._getYAxisLabelAlignment(f).textAlign}n==="y"&&(l==="start"?N="top":l==="end"&&(N="bottom"));const M=this._getLabelSizes();for(x=0,_=s.length;x<_;++x){w=s[x],y=w.label;const j=o.setContext(this.getContext(x));D=this.getPixelForTick(x)+o.labelOffset,T=this._resolveTickFontOptions(x),R=T.lineHeight,A=un(y)?y.length:1;const $=A/2,B=j.color,z=j.textStrokeColor,V=j.textStrokeWidth;let W=k;a?(E=D,k==="inner"&&(x===_-1?W=this.options.reverse?"left":"right":x===0?W=this.options.reverse?"right":"left":W="center"),i==="top"?c==="near"||g!==0?C=-A*R+R/2:c==="center"?C=-M.highest.height/2-$*R+R:C=-M.highest.height+R/2:c==="near"||g!==0?C=R/2:c==="center"?C=M.highest.height/2-$*R:C=M.highest.height-A*R,d&&(C*=-1),g!==0&&!j.showLabelBackdrop&&(E+=R/2*Math.sin(g))):(S=D,C=(1-A)*R/2);let Q;if(j.showLabelBackdrop){const X=ii(j.backdropPadding),oe=M.heights[x],Z=M.widths[x];let re=C-X.top,ae=0-X.left;switch(N){case"middle":re-=oe/2;break;case"bottom":re-=oe;break}switch(k){case"center":ae-=Z/2;break;case"right":ae-=Z;break;case"inner":x===_-1?ae-=Z:x>0&&(ae-=Z/2);break}Q={left:ae,top:re,width:Z+X.width,height:oe+X.height,color:j.backdropColor}}v.push({label:y,font:T,textOffset:C,options:{rotation:g,color:B,strokeColor:z,strokeWidth:V,textAlign:W,textBaseline:N,translation:[E,S],backdrop:Q}})}return v}_getXAxisLabelAlignment(){const{position:t,ticks:n}=this.options;if(-lo(this.labelRotation))return t==="top"?"left":"right";let i="center";return n.align==="start"?i="left":n.align==="end"?i="right":n.align==="inner"&&(i="inner"),i}_getYAxisLabelAlignment(t){const{position:n,ticks:{crossAlign:r,mirror:i,padding:o}}=this.options,a=this._getLabelSizes(),s=t+o,l=a.widest.width;let c,u;return n==="left"?i?(u=this.right+o,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u+=l)):(u=this.right-s,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u=this.left)):n==="right"?i?(u=this.left+o,r==="near"?c="right":r==="center"?(c="center",u-=l/2):(c="left",u-=l)):(u=this.left+s,r==="near"?c="left":r==="center"?(c="center",u+=l/2):(c="right",u=this.right)):c="right",{textAlign:c,x:u}}_computeLabelArea(){if(this.options.ticks.mirror)return;const t=this.chart,n=this.options.position;if(n==="left"||n==="right")return{top:0,left:this.left,bottom:t.height,right:this.right};if(n==="top"||n==="bottom")return{top:this.top,left:0,bottom:this.bottom,right:t.width}}drawBackground(){const{ctx:t,options:{backgroundColor:n},left:r,top:i,width:o,height:a}=this;n&&(t.save(),t.fillStyle=n,t.fillRect(r,i,o,a),t.restore())}getLineWidthForValue(t){const n=this.options.grid;if(!this._isVisible()||!n.display)return 0;const i=this.ticks.findIndex(o=>o.value===t);return i>=0?n.setContext(this.getContext(i)).lineWidth:0}drawGrid(t){const n=this.options.grid,r=this.ctx,i=this._gridLineItems||(this._gridLineItems=this._computeGridLineItems(t));let o,a;const s=(l,c,u)=>{!u.width||!u.color||(r.save(),r.lineWidth=u.width,r.strokeStyle=u.color,r.setLineDash(u.borderDash||[]),r.lineDashOffset=u.borderDashOffset,r.beginPath(),r.moveTo(l.x,l.y),r.lineTo(c.x,c.y),r.stroke(),r.restore())};if(n.display)for(o=0,a=i.length;o<a;++o){const l=i[o];n.drawOnChartArea&&s({x:l.x1,y:l.y1},{x:l.x2,y:l.y2},l),n.drawTicks&&s({x:l.tx1,y:l.ty1},{x:l.tx2,y:l.ty2},{color:l.tickColor,width:l.tickWidth,borderDash:l.tickBorderDash,borderDashOffset:l.tickBorderDashOffset})}}drawBorder(){const{chart:t,ctx:n,options:{border:r,grid:i}}=this,o=r.setContext(this.getContext()),a=r.display?o.width:0;if(!a)return;const s=i.setContext(this.getContext(0)).lineWidth,l=this._borderValue;let c,u,d,f;this.isHorizontal()?(c=wa(t,this.left,a)-a/2,u=wa(t,this.right,s)+s/2,d=f=l):(d=wa(t,this.top,a)-a/2,f=wa(t,this.bottom,s)+s/2,c=u=l),n.save(),n.lineWidth=o.width,n.strokeStyle=o.color,n.beginPath(),n.moveTo(c,d),n.lineTo(u,f),n.stroke(),n.restore()}drawLabels(t){if(!this.options.ticks.display)return;const r=this.ctx,i=this._computeLabelArea();i&&w1(r,i);const o=this.getLabelItems(t);for(const a of o){const s=a.options,l=a.font,c=a.label,u=a.textOffset;Rp(r,c,0,u,l,s)}i&&_1(r)}drawTitle(){const{ctx:t,options:{position:n,title:r,reverse:i}}=this;if(!r.display)return;const o=or(r.font),a=ii(r.padding),s=r.align;let l=o.lineHeight/2;n==="bottom"||n==="center"||Re(n)?(l+=a.bottom,un(r.text)&&(l+=o.lineHeight*(r.text.length-1))):l+=a.top;const{titleX:c,titleY:u,maxWidth:d,rotation:f}=Rue(this,l,n,s);Rp(t,r.text,0,0,o,{color:r.color,maxWidth:d,rotation:f,textAlign:jue(s,n,i),textBaseline:"middle",translation:[c,u]})}draw(t){this._isVisible()&&(this.drawBackground(),this.drawGrid(t),this.drawBorder(),this.drawTitle(),this.drawLabels(t))}_layers(){const t=this.options,n=t.ticks&&t.ticks.z||0,r=Se(t.grid&&t.grid.z,-1),i=Se(t.border&&t.border.z,0);return!this._isVisible()||this.draw!==$l.prototype.draw?[{z:n,draw:o=>{this.draw(o)}}]:[{z:r,draw:o=>{this.drawBackground(),this.drawGrid(o),this.drawTitle()}},{z:i,draw:()=>{this.drawBorder()}},{z:n,draw:o=>{this.drawLabels(o)}}]}getMatchingVisibleMetas(t){const n=this.chart.getSortedVisibleDatasetMetas(),r=this.axis+"AxisID",i=[];let o,a;for(o=0,a=n.length;o<a;++o){const s=n[o];s[r]===this.id&&(!t||s.type===t)&&i.push(s)}return i}_resolveTickFontOptions(t){const n=this.options.ticks.setContext(this.getContext(t));return or(n.font)}_maxDigits(){const t=this._resolveTickFontOptions(0).lineHeight;return(this.isHorizontal()?this.width:this.height)/t}}class Zd{constructor(t,n,r){this.type=t,this.scope=n,this.override=r,this.items=Object.create(null)}isForType(t){return Object.prototype.isPrototypeOf.call(this.type.prototype,t.prototype)}register(t){const n=Object.getPrototypeOf(t);let r;$ue(n)&&(r=this.register(n));const i=this.items,o=t.id,a=this.scope+"."+o;if(!o)throw new Error("class does not have id: "+t);return o in i||(i[o]=t,Iue(t,a,r),this.override&&Ft.override(t.id,t.overrides)),a}get(t){return this.items[t]}unregister(t){const n=this.items,r=t.id,i=this.scope;r in n&&delete n[r],i&&r in Ft[i]&&(delete Ft[i][r],this.override&&delete fs[r])}}function Iue(e,t,n){const r=uu(Object.create(null),[n?Ft.get(n):{},Ft.get(t),e.defaults]);Ft.set(t,r),e.defaultRoutes&&Lue(t,e.defaultRoutes),e.descriptors&&Ft.describe(t,e.descriptors)}function Lue(e,t){Object.keys(t).forEach(n=>{const r=n.split("."),i=r.pop(),o=[e].concat(r).join("."),a=t[n].split("."),s=a.pop(),l=a.join(".");Ft.route(o,i,l,s)})}function $ue(e){return"id"in e&&"defaults"in e}class Fue{constructor(){this.controllers=new Zd(lm,"datasets",!0),this.elements=new Zd(ha,"elements"),this.plugins=new Zd(Object,"plugins"),this.scales=new Zd($l,"scales"),this._typedRegistries=[this.controllers,this.scales,this.elements]}add(...t){this._each("register",t)}remove(...t){this._each("unregister",t)}addControllers(...t){this._each("register",t,this.controllers)}addElements(...t){this._each("register",t,this.elements)}addPlugins(...t){this._each("register",t,this.plugins)}addScales(...t){this._each("register",t,this.scales)}getController(t){return this._get(t,this.controllers,"controller")}getElement(t){return this._get(t,this.elements,"element")}getPlugin(t){return this._get(t,this.plugins,"plugin")}getScale(t){return this._get(t,this.scales,"scale")}removeControllers(...t){this._each("unregister",t,this.controllers)}removeElements(...t){this._each("unregister",t,this.elements)}removePlugins(...t){this._each("unregister",t,this.plugins)}removeScales(...t){this._each("unregister",t,this.scales)}_each(t,n,r){[...n].forEach(i=>{const o=r||this._getRegistryForType(i);r||o.isForType(i)||o===this.plugins&&i.id?this._exec(t,o,i):Ze(i,a=>{const s=r||this._getRegistryForType(a);this._exec(t,s,a)})})}_exec(t,n,r){const i=v1(t);ht(r["before"+i],[],r),n[t](r),ht(r["after"+i],[],r)}_getRegistryForType(t){for(let n=0;n<this._typedRegistries.length;n++){const r=this._typedRegistries[n];if(r.isForType(t))return r}return this.plugins}_get(t,n,r){const i=n.get(t);if(i===void 0)throw new Error('"'+t+'" is not a registered '+r+".");return i}}var pi=new Fue;class Bue{constructor(){this._init=[]}notify(t,n,r,i){n==="beforeInit"&&(this._init=this._createDescriptors(t,!0),this._notify(this._init,t,"install"));const o=i?this._descriptors(t).filter(i):this._descriptors(t),a=this._notify(o,t,n,r);return n==="afterDestroy"&&(this._notify(o,t,"stop"),this._notify(this._init,t,"uninstall")),a}_notify(t,n,r,i){i=i||{};for(const o of t){const a=o.plugin,s=a[r],l=[n,i,o.options];if(ht(s,l,a)===!1&&i.cancelable)return!1}return!0}invalidate(){Ke(this._cache)||(this._oldCache=this._cache,this._cache=void 0)}_descriptors(t){if(this._cache)return this._cache;const n=this._cache=this._createDescriptors(t);return this._notifyStateChanges(t),n}_createDescriptors(t,n){const r=t&&t.config,i=Se(r.options&&r.options.plugins,{}),o=Wue(r);return i===!1&&!n?[]:zue(t,o,i,n)}_notifyStateChanges(t){const n=this._oldCache||[],r=this._cache,i=(o,a)=>o.filter(s=>!a.some(l=>s.plugin.id===l.plugin.id));this._notify(i(n,r),t,"stop"),this._notify(i(r,n),t,"start")}}function Wue(e){const t={},n=[],r=Object.keys(pi.plugins.items);for(let o=0;o<r.length;o++)n.push(pi.getPlugin(r[o]));const i=e.plugins||[];for(let o=0;o<i.length;o++){const a=i[o];n.indexOf(a)===-1&&(n.push(a),t[a.id]=!0)}return{plugins:n,localIds:t}}function Vue(e,t){return!t&&e===!1?null:e===!0?{}:e}function zue(e,{plugins:t,localIds:n},r,i){const o=[],a=e.getContext();for(const s of t){const l=s.id,c=Vue(r[l],i);c!==null&&o.push({plugin:s,options:Hue(e.config,{plugin:s,local:n[l]},c,a)})}return o}function Hue(e,{plugin:t,local:n},r,i){const o=e.pluginScopeKeys(t),a=e.getOptionScopes(r,o);return n&&t.defaults&&a.push(t.defaults),e.createResolver(a,i,[""],{scriptable:!1,indexable:!1,allKeys:!0})}function ub(e,t){const n=Ft.datasets[e]||{};return((t.datasets||{})[e]||{}).indexAxis||t.indexAxis||n.indexAxis||"x"}function Yue(e,t){let n=e;return e==="_index_"?n=t:e==="_value_"&&(n=t==="x"?"y":"x"),n}function Uue(e,t){return e===t?"_index_":"_value_"}function bP(e){if(e==="x"||e==="y"||e==="r")return e}function Kue(e){if(e==="top"||e==="bottom")return"x";if(e==="left"||e==="right")return"y"}function db(e,...t){if(bP(e))return e;for(const n of t){const r=n.axis||Kue(n.position)||e.length>1&&bP(e[0].toLowerCase());if(r)return r}throw new Error(`Cannot determine type of '${e}' axis. Please provide 'axis' or 'position' option.`)}function xP(e,t,n){if(n[t+"AxisID"]===e)return{axis:t}}function que(e,t){if(t.data&&t.data.datasets){const n=t.data.datasets.filter(r=>r.xAxisID===e||r.yAxisID===e);if(n.length)return xP(e,"x",n[0])||xP(e,"y",n[0])}return{}}function Gue(e,t){const n=fs[e.type]||{scales:{}},r=t.scales||{},i=ub(e.type,t),o=Object.create(null);return Object.keys(r).forEach(a=>{const s=r[a];if(!Re(s))return console.error(`Invalid scale configuration for scale: ${a}`);if(s._proxy)return console.warn(`Ignoring resolver passed as options for scale: ${a}`);const l=db(a,s,que(a,e),Ft.scales[s.type]),c=Uue(l,i),u=n.scales||{};o[a]=Mc(Object.create(null),[{axis:l},s,u[l],u[c]])}),e.data.datasets.forEach(a=>{const s=a.type||e.type,l=a.indexAxis||ub(s,t),u=(fs[s]||{}).scales||{};Object.keys(u).forEach(d=>{const f=Yue(d,l),p=a[f+"AxisID"]||f;o[p]=o[p]||Object.create(null),Mc(o[p],[{axis:f},r[p],u[d]])})}),Object.keys(o).forEach(a=>{const s=o[a];Mc(s,[Ft.scales[s.type],Ft.scale])}),o}function xI(e){const t=e.options||(e.options={});t.plugins=Se(t.plugins,{}),t.scales=Gue(e,t)}function wI(e){return e=e||{},e.datasets=e.datasets||[],e.labels=e.labels||[],e}function Xue(e){return e=e||{},e.data=wI(e.data),xI(e),e}const wP=new Map,_I=new Set;function Jd(e,t){let n=wP.get(e);return n||(n=t(),wP.set(e,n),_I.add(n)),n}const fc=(e,t,n)=>{const r=ds(t,n);r!==void 0&&e.add(r)};class Que{constructor(t){this._config=Xue(t),this._scopeCache=new Map,this._resolverCache=new Map}get platform(){return this._config.platform}get type(){return this._config.type}set type(t){this._config.type=t}get data(){return this._config.data}set data(t){this._config.data=wI(t)}get options(){return this._config.options}set options(t){this._config.options=t}get plugins(){return this._config.plugins}update(){const t=this._config;this.clearCache(),xI(t)}clearCache(){this._scopeCache.clear(),this._resolverCache.clear()}datasetScopeKeys(t){return Jd(t,()=>[[`datasets.${t}`,""]])}datasetAnimationScopeKeys(t,n){return Jd(`${t}.transition.${n}`,()=>[[`datasets.${t}.transitions.${n}`,`transitions.${n}`],[`datasets.${t}`,""]])}datasetElementScopeKeys(t,n){return Jd(`${t}-${n}`,()=>[[`datasets.${t}.elements.${n}`,`datasets.${t}`,`elements.${n}`,""]])}pluginScopeKeys(t){const n=t.id,r=this.type;return Jd(`${r}-plugin-${n}`,()=>[[`plugins.${n}`,...t.additionalOptionScopes||[]]])}_cachedScopes(t,n){const r=this._scopeCache;let i=r.get(t);return(!i||n)&&(i=new Map,r.set(t,i)),i}getOptionScopes(t,n,r){const{options:i,type:o}=this,a=this._cachedScopes(t,r),s=a.get(n);if(s)return s;const l=new Set;n.forEach(u=>{t&&(l.add(t),u.forEach(d=>fc(l,t,d))),u.forEach(d=>fc(l,i,d)),u.forEach(d=>fc(l,fs[o]||{},d)),u.forEach(d=>fc(l,Ft,d)),u.forEach(d=>fc(l,lb,d))});const c=Array.from(l);return c.length===0&&c.push(Object.create(null)),_I.has(n)&&a.set(n,c),c}chartOptionScopes(){const{options:t,type:n}=this;return[t,fs[n]||{},Ft.datasets[n]||{},{type:n},Ft,lb]}resolveNamedOptions(t,n,r,i=[""]){const o={$shared:!0},{resolver:a,subPrefixes:s}=_P(this._resolverCache,t,i);let l=a;if(Jue(a,n)){o.$shared=!1,r=sa(r)?r():r;const c=this.createResolver(t,r,s);l=yl(a,r,c)}for(const c of n)o[c]=l[c];return o}createResolver(t,n,r=[""],i){const{resolver:o}=_P(this._resolverCache,t,r);return Re(n)?yl(o,n,void 0,i):o}}function _P(e,t,n){let r=e.get(t);r||(r=new Map,e.set(t,r));const i=n.join();let o=r.get(i);return o||(o={resolver:S1(t,n),subPrefixes:n.filter(s=>!s.toLowerCase().includes("hover"))},r.set(i,o)),o}const Zue=e=>Re(e)&&Object.getOwnPropertyNames(e).some(t=>sa(e[t]));function Jue(e,t){const{isScriptable:n,isIndexable:r}=iI(e);for(const i of t){const o=n(i),a=r(i),s=(a||o)&&e[i];if(o&&(sa(s)||Zue(s))||a&&un(s))return!0}return!1}var ede="4.5.0";const tde=["top","bottom","left","right","chartArea"];function EP(e,t){return e==="top"||e==="bottom"||tde.indexOf(e)===-1&&t==="x"}function SP(e,t){return function(n,r){return n[e]===r[e]?n[t]-r[t]:n[e]-r[e]}}function OP(e){const t=e.chart,n=t.options.animation;t.notifyPlugins("afterRender"),ht(n&&n.onComplete,[e],t)}function nde(e){const t=e.chart,n=t.options.animation;ht(n&&n.onProgress,[e],t)}function EI(e){return P1()&&typeof e=="string"?e=document.getElementById(e):e&&e.length&&(e=e[0]),e&&e.canvas&&(e=e.canvas),e}const xf={},CP=e=>{const t=EI(e);return Object.values(xf).filter(n=>n.canvas===t).pop()};function rde(e,t,n){const r=Object.keys(e);for(const i of r){const o=+i;if(o>=t){const a=e[i];delete e[i],(n>0||o>t)&&(e[o+n]=a)}}}function ide(e,t,n,r){return!n||e.type==="mouseout"?null:r?t:e}let Kn=class{static defaults=Ft;static instances=xf;static overrides=fs;static registry=pi;static version=ede;static getChart=CP;static register(...t){pi.add(...t),PP()}static unregister(...t){pi.remove(...t),PP()}constructor(t,n){const r=this.config=new Que(n),i=EI(t),o=CP(i);if(o)throw new Error("Canvas is already in use. Chart with ID '"+o.id+"' must be destroyed before the canvas with ID '"+o.canvas.id+"' can be reused.");const a=r.createResolver(r.chartOptionScopes(),this.getContext());this.platform=new(r.platform||_ue(i)),this.platform.updateConfig(r);const s=this.platform.acquireContext(i,a.aspectRatio),l=s&&s.canvas,c=l&&l.height,u=l&&l.width;if(this.id=Xse(),this.ctx=s,this.canvas=l,this.width=u,this.height=c,this._options=a,this._aspectRatio=this.aspectRatio,this._layers=[],this._metasets=[],this._stacks=void 0,this.boxes=[],this.currentDevicePixelRatio=void 0,this.chartArea=void 0,this._active=[],this._lastEvent=void 0,this._listeners={},this._responsiveListeners=void 0,this._sortedMetasets=[],this.scales={},this._plugins=new Bue,this.$proxies={},this._hiddenIndices={},this.attached=!1,this._animationsDisabled=void 0,this.$context=void 0,this._doResize=mle(d=>this.update(d),a.resizeDelay||0),this._dataChanges=[],xf[this.id]=this,!s||!l){console.error("Failed to create chart: can't acquire context from the given item");return}Xi.listen(this,"complete",OP),Xi.listen(this,"progress",nde),this._initialize(),this.attached&&this.update()}get aspectRatio(){const{options:{aspectRatio:t,maintainAspectRatio:n},width:r,height:i,_aspectRatio:o}=this;return Ke(t)?n&&o?o:i?r/i:null:t}get data(){return this.config.data}set data(t){this.config.data=t}get options(){return this._options}set options(t){this.config.options=t}get registry(){return pi}_initialize(){return this.notifyPlugins("beforeInit"),this.options.responsive?this.resize():GC(this,this.options.devicePixelRatio),this.bindEvents(),this.notifyPlugins("afterInit"),this}clear(){return UC(this.canvas,this.ctx),this}stop(){return Xi.stop(this),this}resize(t,n){Xi.running(this)?this._resizeBeforeDraw={width:t,height:n}:this._resize(t,n)}_resize(t,n){const r=this.options,i=this.canvas,o=r.maintainAspectRatio&&this.aspectRatio,a=this.platform.getMaximumSize(i,t,n,o),s=r.devicePixelRatio||this.platform.getDevicePixelRatio(),l=this.width?"resize":"attach";this.width=a.width,this.height=a.height,this._aspectRatio=this.aspectRatio,GC(this,s,!0)&&(this.notifyPlugins("resize",{size:a}),ht(r.onResize,[this,a],this),this.attached&&this._doResize(l)&&this.render())}ensureScalesHaveIDs(){const n=this.options.scales||{};Ze(n,(r,i)=>{r.id=i})}buildOrUpdateScales(){const t=this.options,n=t.scales,r=this.scales,i=Object.keys(r).reduce((a,s)=>(a[s]=!1,a),{});let o=[];n&&(o=o.concat(Object.keys(n).map(a=>{const s=n[a],l=db(a,s),c=l==="r",u=l==="x";return{options:s,dposition:c?"chartArea":u?"bottom":"left",dtype:c?"radialLinear":u?"category":"linear"}}))),Ze(o,a=>{const s=a.options,l=s.id,c=db(l,s),u=Se(s.type,a.dtype);(s.position===void 0||EP(s.position,c)!==EP(a.dposition))&&(s.position=a.dposition),i[l]=!0;let d=null;if(l in r&&r[l].type===u)d=r[l];else{const f=pi.getScale(u);d=new f({id:l,type:u,ctx:this.ctx,chart:this}),r[d.id]=d}d.init(s,t)}),Ze(i,(a,s)=>{a||delete r[s]}),Ze(r,a=>{Yo.configure(this,a,a.options),Yo.addBox(this,a)})}_updateMetasets(){const t=this._metasets,n=this.data.datasets.length,r=t.length;if(t.sort((i,o)=>i.index-o.index),r>n){for(let i=n;i<r;++i)this._destroyDatasetMeta(i);t.splice(n,r-n)}this._sortedMetasets=t.slice(0).sort(SP("order","index"))}_removeUnreferencedMetasets(){const{_metasets:t,data:{datasets:n}}=this;t.length>n.length&&delete this._stacks,t.forEach((r,i)=>{n.filter(o=>o===r._dataset).length===0&&this._destroyDatasetMeta(i)})}buildOrUpdateControllers(){const t=[],n=this.data.datasets;let r,i;for(this._removeUnreferencedMetasets(),r=0,i=n.length;r<i;r++){const o=n[r];let a=this.getDatasetMeta(r);const s=o.type||this.config.type;if(a.type&&a.type!==s&&(this._destroyDatasetMeta(r),a=this.getDatasetMeta(r)),a.type=s,a.indexAxis=o.indexAxis||ub(s,this.options),a.order=o.order||0,a.index=r,a.label=""+o.label,a.visible=this.isDatasetVisible(r),a.controller)a.controller.updateIndex(r),a.controller.linkScales();else{const l=pi.getController(s),{datasetElementType:c,dataElementType:u}=Ft.datasets[s];Object.assign(l,{dataElementType:pi.getElement(u),datasetElementType:c&&pi.getElement(c)}),a.controller=new l(this,r),t.push(a.controller)}}return this._updateMetasets(),t}_resetElements(){Ze(this.data.datasets,(t,n)=>{this.getDatasetMeta(n).controller.reset()},this)}reset(){this._resetElements(),this.notifyPlugins("reset")}update(t){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:t,cancelable:!0})===!1)return;const o=this.buildOrUpdateControllers();this.notifyPlugins("beforeElementsUpdate");let a=0;for(let c=0,u=this.data.datasets.length;c<u;c++){const{controller:d}=this.getDatasetMeta(c),f=!i&&o.indexOf(d)===-1;d.buildOrUpdateElements(f),a=Math.max(+d.getMaxOverflow(),a)}a=this._minPadding=r.layout.autoPadding?a:0,this._updateLayout(a),i||Ze(o,c=>{c.reset()}),this._updateDatasets(t),this.notifyPlugins("afterUpdate",{mode:t}),this._layers.sort(SP("z","_idx"));const{_active:s,_lastEvent:l}=this;l?this._eventHandler(l,!0):s.length&&this._updateHoverStyles(s,s,!0),this.render()}_updateScales(){Ze(this.scales,t=>{Yo.removeBox(this,t)}),this.ensureScalesHaveIDs(),this.buildOrUpdateScales()}_checkEventBindings(){const t=this.options,n=new Set(Object.keys(this._listeners)),r=new Set(t.events);(!IC(n,r)||!!this._responsiveListeners!==t.responsive)&&(this.unbindEvents(),this.bindEvents())}_updateHiddenIndices(){const{_hiddenIndices:t}=this,n=this._getUniformDataChanges()||[];for(const{method:r,start:i,count:o}of n){const a=r==="_removeElements"?-o:o;rde(t,i,a)}}_getUniformDataChanges(){const t=this._dataChanges;if(!t||!t.length)return;this._dataChanges=[];const n=this.data.datasets.length,r=o=>new Set(t.filter(a=>a[0]===o).map((a,s)=>s+","+a.splice(1).join(","))),i=r(0);for(let o=1;o<n;o++)if(!IC(i,r(o)))return;return Array.from(i).map(o=>o.split(",")).map(o=>({method:o[1],start:+o[2],count:+o[3]}))}_updateLayout(t){if(this.notifyPlugins("beforeLayout",{cancelable:!0})===!1)return;Yo.update(this,this.width,this.height,t);const n=this.chartArea,r=n.width<=0||n.height<=0;this._layers=[],Ze(this.boxes,i=>{r&&i.position==="chartArea"||(i.configure&&i.configure(),this._layers.push(...i._layers()))},this),this._layers.forEach((i,o)=>{i._idx=o}),this.notifyPlugins("afterLayout")}_updateDatasets(t){if(this.notifyPlugins("beforeDatasetsUpdate",{mode:t,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,sa(t)?t({datasetIndex:n}):t);this.notifyPlugins("afterDatasetsUpdate",{mode:t})}}_updateDataset(t,n){const r=this.getDatasetMeta(t),i={meta:r,index:t,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&&(Xi.has(this)?this.attached&&!Xi.running(this)&&Xi.start(this):(this.draw(),OP({chart:this})))}draw(){let t;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(t=0;t<n.length&&n[t].z<=0;++t)n[t].draw(this.chartArea);for(this._drawDatasets();t<n.length;++t)n[t].draw(this.chartArea);this.notifyPlugins("afterDraw")}_getSortedDatasetMetas(t){const n=this._sortedMetasets,r=[];let i,o;for(i=0,o=n.length;i<o;++i){const a=n[i];(!t||a.visible)&&r.push(a)}return r}getSortedVisibleDatasetMetas(){return this._getSortedDatasetMetas(!0)}_drawDatasets(){if(this.notifyPlugins("beforeDatasetsDraw",{cancelable:!0})===!1)return;const t=this.getSortedVisibleDatasetMetas();for(let n=t.length-1;n>=0;--n)this._drawDataset(t[n]);this.notifyPlugins("afterDatasetsDraw")}_drawDataset(t){const n=this.ctx,r={meta:t,index:t.index,cancelable:!0},i=wce(this,t);this.notifyPlugins("beforeDatasetDraw",r)!==!1&&(i&&w1(n,i),t.controller.draw(),i&&_1(n),r.cancelable=!1,this.notifyPlugins("afterDatasetDraw",r))}isPointInArea(t){return hu(t,this.chartArea,this._minPadding)}getElementsAtEventForMode(t,n,r,i){const o=tue.modes[n];return typeof o=="function"?o(this,t,r,i):[]}getDatasetMeta(t){const n=this.data.datasets[t],r=this._metasets;let i=r.filter(o=>o&&o._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:t,_dataset:n,_parsed:[],_sorted:!1},r.push(i)),i}getContext(){return this.$context||(this.$context=bs(null,{chart:this,type:"chart"}))}getVisibleDatasetCount(){return this.getSortedVisibleDatasetMetas().length}isDatasetVisible(t){const n=this.data.datasets[t];if(!n)return!1;const r=this.getDatasetMeta(t);return typeof r.hidden=="boolean"?!r.hidden:!n.hidden}setDatasetVisibility(t,n){const r=this.getDatasetMeta(t);r.hidden=!n}toggleDataVisibility(t){this._hiddenIndices[t]=!this._hiddenIndices[t]}getDataVisibility(t){return!this._hiddenIndices[t]}_updateVisibility(t,n,r){const i=r?"show":"hide",o=this.getDatasetMeta(t),a=o.controller._resolveAnimations(void 0,i);du(n)?(o.data[n].hidden=!r,this.update()):(this.setDatasetVisibility(t,r),a.update(o,{visible:r}),this.update(s=>s.datasetIndex===t?i:void 0))}hide(t,n){this._updateVisibility(t,n,!1)}show(t,n){this._updateVisibility(t,n,!0)}_destroyDatasetMeta(t){const n=this._metasets[t];n&&n.controller&&n.controller._destroy(),delete this._metasets[t]}_stop(){let t,n;for(this.stop(),Xi.remove(this),t=0,n=this.data.datasets.length;t<n;++t)this._destroyDatasetMeta(t)}destroy(){this.notifyPlugins("beforeDestroy");const{canvas:t,ctx:n}=this;this._stop(),this.config.clearCache(),t&&(this.unbindEvents(),UC(t,n),this.platform.releaseContext(n),this.canvas=null,this.ctx=null),delete xf[this.id],this.notifyPlugins("afterDestroy")}toBase64Image(...t){return this.canvas.toDataURL(...t)}bindEvents(){this.bindUserEvents(),this.options.responsive?this.bindResponsiveEvents():this.attached=!0}bindUserEvents(){const t=this._listeners,n=this.platform,r=(o,a)=>{n.addEventListener(this,o,a),t[o]=a},i=(o,a,s)=>{o.offsetX=a,o.offsetY=s,this._eventHandler(o)};Ze(this.options.events,o=>r(o,i))}bindResponsiveEvents(){this._responsiveListeners||(this._responsiveListeners={});const t=this._responsiveListeners,n=this.platform,r=(l,c)=>{n.addEventListener(this,l,c),t[l]=c},i=(l,c)=>{t[l]&&(n.removeEventListener(this,l,c),delete t[l])},o=(l,c)=>{this.canvas&&this.resize(l,c)};let a;const s=()=>{i("attach",s),this.attached=!0,this.resize(),r("resize",o),r("detach",a)};a=()=>{this.attached=!1,i("resize",o),this._stop(),this._resize(0,0),r("attach",s)},n.isAttached(this.canvas)?s():a()}unbindEvents(){Ze(this._listeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._listeners={},Ze(this._responsiveListeners,(t,n)=>{this.platform.removeEventListener(this,n,t)}),this._responsiveListeners=void 0}updateHoverStyle(t,n,r){const i=r?"set":"remove";let o,a,s,l;for(n==="dataset"&&(o=this.getDatasetMeta(t[0].datasetIndex),o.controller["_"+i+"DatasetHoverStyle"]()),s=0,l=t.length;s<l;++s){a=t[s];const c=a&&this.getDatasetMeta(a.datasetIndex).controller;c&&c[i+"HoverStyle"](a.element,a.datasetIndex,a.index)}}getActiveElements(){return this._active||[]}setActiveElements(t){const n=this._active||[],r=t.map(({datasetIndex:o,index:a})=>{const s=this.getDatasetMeta(o);if(!s)throw new Error("No dataset found at index "+o);return{datasetIndex:o,element:s.data[a],index:a}});!Mp(r,n)&&(this._active=r,this._lastEvent=null,this._updateHoverStyles(r,n))}notifyPlugins(t,n,r){return this._plugins.notify(this,t,n,r)}isPluginEnabled(t){return this._plugins._cache.filter(n=>n.plugin.id===t).length===1}_updateHoverStyles(t,n,r){const i=this.options.hover,o=(l,c)=>l.filter(u=>!c.some(d=>u.datasetIndex===d.datasetIndex&&u.index===d.index)),a=o(n,t),s=r?t:o(t,n);a.length&&this.updateHoverStyle(a,i.mode,!1),s.length&&i.mode&&this.updateHoverStyle(s,i.mode,!0)}_eventHandler(t,n){const r={event:t,replay:n,cancelable:!0,inChartArea:this.isPointInArea(t)},i=a=>(a.options.events||this.options.events).includes(t.native.type);if(this.notifyPlugins("beforeEvent",r,i)===!1)return;const o=this._handleEvent(t,n,r.inChartArea);return r.cancelable=!1,this.notifyPlugins("afterEvent",r,i),(o||r.changed)&&this.render(),this}_handleEvent(t,n,r){const{_active:i=[],options:o}=this,a=n,s=this._getActiveElements(t,i,r,a),l=nle(t),c=ide(t,this._lastEvent,r,l);r&&(this._lastEvent=null,ht(o.onHover,[t,s,this],this),l&&ht(o.onClick,[t,s,this],this));const u=!Mp(s,i);return(u||n)&&(this._active=s,this._updateHoverStyles(s,i,n)),this._lastEvent=c,u}_getActiveElements(t,n,r,i){if(t.type==="mouseout")return[];if(!r)return n;const o=this.options.hover;return this.getElementsAtEventForMode(t,o.mode,o,i)}};function PP(){return Ze(Kn.instances,e=>e._plugins.invalidate())}function ode(e,t,n){const{startAngle:r,x:i,y:o,outerRadius:a,innerRadius:s,options:l}=t,{borderWidth:c,borderJoinStyle:u}=l,d=Math.min(c/a,Jr(r-n));if(e.beginPath(),e.arc(i,o,a-c/2,r+d/2,n-d/2),s>0){const f=Math.min(c/s,Jr(r-n));e.arc(i,o,s+c/2,n-f/2,r+f/2,!0)}else{const f=Math.min(c/2,a*Jr(r-n));if(u==="round")e.arc(i,o,f,n-lt/2,r+lt/2,!0);else if(u==="bevel"){const p=2*f*f,m=-p*Math.cos(n+lt/2)+i,g=-p*Math.sin(n+lt/2)+o,v=p*Math.cos(r+lt/2)+i,x=p*Math.sin(r+lt/2)+o;e.lineTo(m,g),e.lineTo(v,x)}}e.closePath(),e.moveTo(0,0),e.rect(0,0,e.canvas.width,e.canvas.height),e.clip("evenodd")}function ade(e,t,n){const{startAngle:r,pixelMargin:i,x:o,y:a,outerRadius:s,innerRadius:l}=t;let c=i/s;e.beginPath(),e.arc(o,a,s,r-c,n+c),l>i?(c=i/l,e.arc(o,a,l,n+c,r-c,!0)):e.arc(o,a,i,n+en,r-en),e.closePath(),e.clip()}function sde(e){return E1(e,["outerStart","outerEnd","innerStart","innerEnd"])}function lde(e,t,n,r){const i=sde(e.options.borderRadius),o=(n-t)/2,a=Math.min(o,r*t/2),s=l=>{const c=(n-Math.min(o,l))*r/2;return Mn(l,0,Math.min(o,c))};return{outerStart:s(i.outerStart),outerEnd:s(i.outerEnd),innerStart:Mn(i.innerStart,0,a),innerEnd:Mn(i.innerEnd,0,a)}}function js(e,t,n,r){return{x:n+e*Math.cos(t),y:r+e*Math.sin(t)}}function Fp(e,t,n,r,i,o){const{x:a,y:s,startAngle:l,pixelMargin:c,innerRadius:u}=t,d=Math.max(t.outerRadius+r+n-c,0),f=u>0?u+r+n+c:0;let p=0;const m=i-l;if(r){const j=u>0?u-r:0,$=d>0?d-r:0,B=(j+$)/2,z=B!==0?m*B/(B+r):m;p=(m-z)/2}const g=Math.max(.001,m*d-n/lt)/d,v=(m-g)/2,x=l+v+p,_=i-v-p,{outerStart:w,outerEnd:y,innerStart:E,innerEnd:S}=lde(t,f,d,_-x),k=d-w,D=d-y,T=x+w/k,R=_-y/D,A=f+E,C=f+S,N=x+E/A,M=_-S/C;if(e.beginPath(),o){const j=(T+R)/2;if(e.arc(a,s,d,T,j),e.arc(a,s,d,j,R),y>0){const V=js(D,R,a,s);e.arc(V.x,V.y,y,R,_+en)}const $=js(C,_,a,s);if(e.lineTo($.x,$.y),S>0){const V=js(C,M,a,s);e.arc(V.x,V.y,S,_+en,M+Math.PI)}const B=(_-S/f+(x+E/f))/2;if(e.arc(a,s,f,_-S/f,B,!0),e.arc(a,s,f,B,x+E/f,!0),E>0){const V=js(A,N,a,s);e.arc(V.x,V.y,E,N+Math.PI,x-en)}const z=js(k,x,a,s);if(e.lineTo(z.x,z.y),w>0){const V=js(k,T,a,s);e.arc(V.x,V.y,w,x-en,T)}}else{e.moveTo(a,s);const j=Math.cos(T)*d+a,$=Math.sin(T)*d+s;e.lineTo(j,$);const B=Math.cos(R)*d+a,z=Math.sin(R)*d+s;e.lineTo(B,z)}e.closePath()}function cde(e,t,n,r,i){const{fullCircles:o,startAngle:a,circumference:s}=t;let l=t.endAngle;if(o){Fp(e,t,n,r,l,i);for(let c=0;c<o;++c)e.fill();isNaN(s)||(l=a+(s%Nt||Nt))}return Fp(e,t,n,r,l,i),e.fill(),l}function ude(e,t,n,r,i){const{fullCircles:o,startAngle:a,circumference:s,options:l}=t,{borderWidth:c,borderJoinStyle:u,borderDash:d,borderDashOffset:f,borderRadius:p}=l,m=l.borderAlign==="inner";if(!c)return;e.setLineDash(d||[]),e.lineDashOffset=f,m?(e.lineWidth=c*2,e.lineJoin=u||"round"):(e.lineWidth=c,e.lineJoin=u||"bevel");let g=t.endAngle;if(o){Fp(e,t,n,r,g,i);for(let v=0;v<o;++v)e.stroke();isNaN(s)||(g=a+(s%Nt||Nt))}m&&ade(e,t,g),l.selfJoin&&g-a>=lt&&p===0&&u!=="miter"&&ode(e,t,g),o||(Fp(e,t,n,r,g,i),e.stroke())}class A1 extends ha{static id="arc";static defaults={borderAlign:"center",borderColor:"#fff",borderDash:[],borderDashOffset:0,borderJoinStyle:void 0,borderRadius:0,borderWidth:2,offset:0,spacing:0,angle:void 0,circular:!0,selfJoin:!1};static defaultRoutes={backgroundColor:"backgroundColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"};circumference;endAngle;fullCircles;innerRadius;outerRadius;pixelMargin;startAngle;constructor(t){super(),this.options=void 0,this.circumference=void 0,this.startAngle=void 0,this.endAngle=void 0,this.innerRadius=void 0,this.outerRadius=void 0,this.pixelMargin=0,this.fullCircles=0,t&&Object.assign(this,t)}inRange(t,n,r){const i=this.getProps(["x","y"],r),{angle:o,distance:a}=GR(i,{x:t,y:n}),{startAngle:s,endAngle:l,innerRadius:c,outerRadius:u,circumference:d}=this.getProps(["startAngle","endAngle","innerRadius","outerRadius","circumference"],r),f=(this.options.spacing+this.options.borderWidth)/2,p=Se(d,l-s),m=pu(o,s,l)&&s!==l,g=p>=Nt||m,v=Ho(a,c+f,u+f);return g&&v}getCenterPoint(t){const{x:n,y:r,startAngle:i,endAngle:o,innerRadius:a,outerRadius:s}=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius"],t),{offset:l,spacing:c}=this.options,u=(i+o)/2,d=(a+s+c+l)/2;return{x:n+Math.cos(u)*d,y:r+Math.sin(u)*d}}tooltipPosition(t){return this.getCenterPoint(t)}draw(t){const{options:n,circumference:r}=this,i=(n.offset||0)/4,o=(n.spacing||0)/2,a=n.circular;if(this.pixelMargin=n.borderAlign==="inner"?.33:0,this.fullCircles=r>Nt?Math.floor(r/Nt):0,r===0||this.innerRadius<0||this.outerRadius<0)return;t.save();const s=(this.startAngle+this.endAngle)/2;t.translate(Math.cos(s)*i,Math.sin(s)*i);const l=1-Math.sin(Math.min(lt,r||0)),c=i*l;t.fillStyle=n.backgroundColor,t.strokeStyle=n.borderColor,cde(t,this,c,o,a),ude(t,this,c,o,a),t.restore()}}function SI(e,t,n=t){e.lineCap=Se(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Se(n.borderDash,t.borderDash)),e.lineDashOffset=Se(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Se(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Se(n.borderWidth,t.borderWidth),e.strokeStyle=Se(n.borderColor,t.borderColor)}function dde(e,t,n){e.lineTo(n.x,n.y)}function fde(e){return e.stepped?Dle:e.tension||e.cubicInterpolationMode==="monotone"?Ale:dde}function OI(e,t,n={}){const r=e.length,{start:i=0,end:o=r-1}=n,{start:a,end:s}=t,l=Math.max(i,a),c=Math.min(o,s),u=i<a&&o<a||i>s&&o>s;return{count:r,start:l,loop:t.loop,ilen:c<l&&!u?r+c-l:c-l}}function pde(e,t,n,r){const{points:i,options:o}=t,{count:a,start:s,loop:l,ilen:c}=OI(i,n,r),u=fde(o);let{move:d=!0,reverse:f}=r||{},p,m,g;for(p=0;p<=c;++p)m=i[(s+(f?c-p:p))%a],!m.skip&&(d?(e.moveTo(m.x,m.y),d=!1):u(e,g,m,f,o.stepped),g=m);return l&&(m=i[(s+(f?c:0))%a],u(e,g,m,f,o.stepped)),!!l}function hde(e,t,n,r){const i=t.points,{count:o,start:a,ilen:s}=OI(i,n,r),{move:l=!0,reverse:c}=r||{};let u=0,d=0,f,p,m,g,v,x;const _=y=>(a+(c?s-y:y))%o,w=()=>{g!==v&&(e.lineTo(u,v),e.lineTo(u,g),e.lineTo(u,x))};for(l&&(p=i[_(0)],e.moveTo(p.x,p.y)),f=0;f<=s;++f){if(p=i[_(f)],p.skip)continue;const y=p.x,E=p.y,S=y|0;S===m?(E<g?g=E:E>v&&(v=E),u=(d*u+y)/++d):(w(),e.lineTo(y,E),m=S,d=0,g=v=E),x=E}w()}function fb(e){const t=e.options,n=t.borderDash&&t.borderDash.length;return!e._decimated&&!e._loop&&!t.tension&&t.cubicInterpolationMode!=="monotone"&&!t.stepped&&!n?hde:pde}function mde(e){return e.stepped?lce:e.tension||e.cubicInterpolationMode==="monotone"?cce:ja}function gde(e,t,n,r){let i=t._path;i||(i=t._path=new Path2D,t.path(i,n,r)&&i.closePath()),SI(e,t.options),e.stroke(i)}function vde(e,t,n,r){const{segments:i,options:o}=t,a=fb(t);for(const s of i)SI(e,o,s.style),e.beginPath(),a(e,t,s,{start:n,end:n+r-1})&&e.closePath(),e.stroke()}const yde=typeof Path2D=="function";function bde(e,t,n,r){yde&&!t.options.segment?gde(e,t,n,r):vde(e,t,n,r)}class T1 extends ha{static id="line";static defaults={borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",borderWidth:3,capBezierPoints:!0,cubicInterpolationMode:"default",fill:!1,spanGaps:!1,stepped:!1,tension:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};static descriptors={_scriptable:!0,_indexable:t=>t!=="borderDash"&&t!=="fill"};constructor(t){super(),this.animated=!0,this.options=void 0,this._chart=void 0,this._loop=void 0,this._fullLoop=void 0,this._path=void 0,this._points=void 0,this._segments=void 0,this._decimated=!1,this._pointsUpdated=!1,this._datasetIndex=void 0,t&&Object.assign(this,t)}updateControlPoints(t,n){const r=this.options;if((r.tension||r.cubicInterpolationMode==="monotone")&&!r.stepped&&!this._pointsUpdated){const i=r.spanGaps?this._loop:this._fullLoop;ece(this._points,r,t,i,n),this._pointsUpdated=!0}}set points(t){this._points=t,delete this._segments,delete this._path,this._pointsUpdated=!1}get points(){return this._points}get segments(){return this._segments||(this._segments=vce(this,this.options.segment))}first(){const t=this.segments,n=this.points;return t.length&&n[t[0].start]}last(){const t=this.segments,n=this.points,r=t.length;return r&&n[t[r-1].end]}interpolate(t,n){const r=this.options,i=t[n],o=this.points,a=hce(this,{property:n,start:i,end:i});if(!a.length)return;const s=[],l=mde(r);let c,u;for(c=0,u=a.length;c<u;++c){const{start:d,end:f}=a[c],p=o[d],m=o[f];if(p===m){s.push(p);continue}const g=Math.abs((i-p[n])/(m[n]-p[n])),v=l(p,m,g,r.stepped);v[n]=t[n],s.push(v)}return s.length===1?s[0]:s}pathSegment(t,n,r){return fb(this)(t,this,n,r)}path(t,n,r){const i=this.segments,o=fb(this);let a=this._loop;n=n||0,r=r||this.points.length-n;for(const s of i)a&=o(t,this,s,{start:n,end:n+r-1});return!!a}draw(t,n,r,i){const o=this.options||{};(this.points||[]).length&&o.borderWidth&&(t.save(),bde(t,this,r,i),t.restore()),this.animated&&(this._pointsUpdated=!1,this._path=void 0)}}function kP(e,t,n,r){const i=e.options,{[n]:o}=e.getProps([n],r);return Math.abs(t-o)<i.radius+i.hitRadius}class M1 extends ha{static id="point";parsed;skip;stop;static defaults={borderWidth:1,hitRadius:1,hoverBorderWidth:1,hoverRadius:4,pointStyle:"circle",radius:3,rotation:0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.parsed=void 0,this.skip=void 0,this.stop=void 0,t&&Object.assign(this,t)}inRange(t,n,r){const i=this.options,{x:o,y:a}=this.getProps(["x","y"],r);return Math.pow(t-o,2)+Math.pow(n-a,2)<Math.pow(i.hitRadius+i.radius,2)}inXRange(t,n){return kP(this,t,"x",n)}inYRange(t,n){return kP(this,t,"y",n)}getCenterPoint(t){const{x:n,y:r}=this.getProps(["x","y"],t);return{x:n,y:r}}size(t){t=t||this.options||{};let n=t.radius||0;n=Math.max(n,n&&t.hoverRadius||0);const r=n&&t.borderWidth||0;return(n+r)*2}draw(t,n){const r=this.options;this.skip||r.radius<.1||!hu(this,n,this.size(r)/2)||(t.strokeStyle=r.borderColor,t.lineWidth=r.borderWidth,t.fillStyle=r.backgroundColor,cb(t,r,this.x,this.y))}getRange(){const t=this.options||{};return t.radius+t.hitRadius}}function CI(e,t){const{x:n,y:r,base:i,width:o,height:a}=e.getProps(["x","y","base","width","height"],t);let s,l,c,u,d;return e.horizontal?(d=a/2,s=Math.min(n,i),l=Math.max(n,i),c=r-d,u=r+d):(d=o/2,s=n-d,l=n+d,c=Math.min(r,i),u=Math.max(r,i)),{left:s,top:c,right:l,bottom:u}}function Uo(e,t,n,r){return e?0:Mn(t,n,r)}function xde(e,t,n){const r=e.options.borderWidth,i=e.borderSkipped,o=rI(r);return{t:Uo(i.top,o.top,0,n),r:Uo(i.right,o.right,0,t),b:Uo(i.bottom,o.bottom,0,n),l:Uo(i.left,o.left,0,t)}}function wde(e,t,n){const{enableBorderRadius:r}=e.getProps(["enableBorderRadius"]),i=e.options.borderRadius,o=Ks(i),a=Math.min(t,n),s=e.borderSkipped,l=r||Re(i);return{topLeft:Uo(!l||s.top||s.left,o.topLeft,0,a),topRight:Uo(!l||s.top||s.right,o.topRight,0,a),bottomLeft:Uo(!l||s.bottom||s.left,o.bottomLeft,0,a),bottomRight:Uo(!l||s.bottom||s.right,o.bottomRight,0,a)}}function _de(e){const t=CI(e),n=t.right-t.left,r=t.bottom-t.top,i=xde(e,n/2,r/2),o=wde(e,n/2,r/2);return{outer:{x:t.left,y:t.top,w:n,h:r,radius:o},inner:{x:t.left+i.l,y:t.top+i.t,w:n-i.l-i.r,h:r-i.t-i.b,radius:{topLeft:Math.max(0,o.topLeft-Math.max(i.t,i.l)),topRight:Math.max(0,o.topRight-Math.max(i.t,i.r)),bottomLeft:Math.max(0,o.bottomLeft-Math.max(i.b,i.l)),bottomRight:Math.max(0,o.bottomRight-Math.max(i.b,i.r))}}}}function Nv(e,t,n,r){const i=t===null,o=n===null,s=e&&!(i&&o)&&CI(e,r);return s&&(i||Ho(t,s.left,s.right))&&(o||Ho(n,s.top,s.bottom))}function Ede(e){return e.topLeft||e.topRight||e.bottomLeft||e.bottomRight}function Sde(e,t){e.rect(t.x,t.y,t.w,t.h)}function jv(e,t,n={}){const r=e.x!==n.x?-t:0,i=e.y!==n.y?-t:0,o=(e.x+e.w!==n.x+n.w?t:0)-r,a=(e.y+e.h!==n.y+n.h?t:0)-i;return{x:e.x+r,y:e.y+i,w:e.w+o,h:e.h+a,radius:e.radius}}class Fl extends ha{static id="bar";static defaults={borderSkipped:"start",borderWidth:0,borderRadius:0,inflateAmount:"auto",pointStyle:void 0};static defaultRoutes={backgroundColor:"backgroundColor",borderColor:"borderColor"};constructor(t){super(),this.options=void 0,this.horizontal=void 0,this.base=void 0,this.width=void 0,this.height=void 0,this.inflateAmount=void 0,t&&Object.assign(this,t)}draw(t){const{inflateAmount:n,options:{borderColor:r,backgroundColor:i}}=this,{inner:o,outer:a}=_de(this),s=Ede(a.radius)?Ip:Sde;t.save(),(a.w!==o.w||a.h!==o.h)&&(t.beginPath(),s(t,jv(a,n,o)),t.clip(),s(t,jv(o,-n,a)),t.fillStyle=r,t.fill("evenodd")),t.beginPath(),s(t,jv(o,n)),t.fillStyle=i,t.fill(),t.restore()}inRange(t,n,r){return Nv(this,t,n,r)}inXRange(t,n){return Nv(this,t,null,n)}inYRange(t,n){return Nv(this,null,t,n)}getCenterPoint(t){const{x:n,y:r,base:i,horizontal:o}=this.getProps(["x","y","base","horizontal"],t);return{x:o?(n+i)/2:n,y:o?r:(r+i)/2}}getRange(t){return t==="x"?this.width/2:this.height/2}}const DP=(e,t)=>{let{boxHeight:n=t,boxWidth:r=t}=e;return e.usePointStyle&&(n=Math.min(n,t),r=e.pointStyleWidth||Math.min(r,t)),{boxWidth:r,boxHeight:n,itemHeight:Math.max(t,n)}},Ode=(e,t)=>e!==null&&t!==null&&e.datasetIndex===t.datasetIndex&&e.index===t.index;class AP extends ha{constructor(t){super(),this._added=!1,this.legendHitBoxes=[],this._hoveredItem=null,this.doughnutMode=!1,this.chart=t.chart,this.options=t.options,this.ctx=t.ctx,this.legendItems=void 0,this.columnSizes=void 0,this.lineWidths=void 0,this.maxHeight=void 0,this.maxWidth=void 0,this.top=void 0,this.bottom=void 0,this.left=void 0,this.right=void 0,this.height=void 0,this.width=void 0,this._margins=void 0,this.position=void 0,this.weight=void 0,this.fullSize=void 0}update(t,n,r){this.maxWidth=t,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 t=this.options.labels||{};let n=ht(t.generateLabels,[this.chart],this)||[];t.filter&&(n=n.filter(r=>t.filter(r,this.chart.data))),t.sort&&(n=n.sort((r,i)=>t.sort(r,i,this.chart.data))),this.options.reverse&&n.reverse(),this.legendItems=n}fit(){const{options:t,ctx:n}=this;if(!t.display){this.width=this.height=0;return}const r=t.labels,i=or(r.font),o=i.size,a=this._computeTitleHeight(),{boxWidth:s,itemHeight:l}=DP(r,o);let c,u;n.font=i.string,this.isHorizontal()?(c=this.maxWidth,u=this._fitRows(a,o,s,l)+10):(u=this.maxHeight,c=this._fitCols(a,i,s,l)+10),this.width=Math.min(c,t.maxWidth||this.maxWidth),this.height=Math.min(u,t.maxHeight||this.maxHeight)}_fitRows(t,n,r,i){const{ctx:o,maxWidth:a,options:{labels:{padding:s}}}=this,l=this.legendHitBoxes=[],c=this.lineWidths=[0],u=i+s;let d=t;o.textAlign="left",o.textBaseline="middle";let f=-1,p=-u;return this.legendItems.forEach((m,g)=>{const v=r+n/2+o.measureText(m.text).width;(g===0||c[c.length-1]+v+2*s>a)&&(d+=u,c[c.length-(g>0?0:1)]=0,p+=u,f++),l[g]={left:0,top:p,row:f,width:v,height:i},c[c.length-1]+=v+s}),d}_fitCols(t,n,r,i){const{ctx:o,maxHeight:a,options:{labels:{padding:s}}}=this,l=this.legendHitBoxes=[],c=this.columnSizes=[],u=a-t;let d=s,f=0,p=0,m=0,g=0;return this.legendItems.forEach((v,x)=>{const{itemWidth:_,itemHeight:w}=Cde(r,n,o,v,i);x>0&&p+w+2*s>u&&(d+=f+s,c.push({width:f,height:p}),m+=f+s,g++,f=p=0),l[x]={left:m,top:p,col:g,width:_,height:w},f=Math.max(f,_),p+=w+s}),d+=f,c.push({width:f,height:p}),d}adjustHitBoxes(){if(!this.options.display)return;const t=this._computeTitleHeight(),{legendHitBoxes:n,options:{align:r,labels:{padding:i},rtl:o}}=this,a=qs(o,this.left,this.width);if(this.isHorizontal()){let s=0,l=hr(r,this.left+i,this.right-this.lineWidths[s]);for(const c of n)s!==c.row&&(s=c.row,l=hr(r,this.left+i,this.right-this.lineWidths[s])),c.top+=this.top+t+i,c.left=a.leftForLtr(a.x(l),c.width),l+=c.width+i}else{let s=0,l=hr(r,this.top+t+i,this.bottom-this.columnSizes[s].height);for(const c of n)c.col!==s&&(s=c.col,l=hr(r,this.top+t+i,this.bottom-this.columnSizes[s].height)),c.top=l,c.left+=this.left+i,c.left=a.leftForLtr(a.x(c.left),c.width),l+=c.height+i}}isHorizontal(){return this.options.position==="top"||this.options.position==="bottom"}draw(){if(this.options.display){const t=this.ctx;w1(t,this),this._draw(),_1(t)}}_draw(){const{options:t,columnSizes:n,lineWidths:r,ctx:i}=this,{align:o,labels:a}=t,s=Ft.color,l=qs(t.rtl,this.left,this.width),c=or(a.font),{padding:u}=a,d=c.size,f=d/2;let p;this.drawTitle(),i.textAlign=l.textAlign("left"),i.textBaseline="middle",i.lineWidth=.5,i.font=c.string;const{boxWidth:m,boxHeight:g,itemHeight:v}=DP(a,d),x=function(S,k,D){if(isNaN(m)||m<=0||isNaN(g)||g<0)return;i.save();const T=Se(D.lineWidth,1);if(i.fillStyle=Se(D.fillStyle,s),i.lineCap=Se(D.lineCap,"butt"),i.lineDashOffset=Se(D.lineDashOffset,0),i.lineJoin=Se(D.lineJoin,"miter"),i.lineWidth=T,i.strokeStyle=Se(D.strokeStyle,s),i.setLineDash(Se(D.lineDash,[])),a.usePointStyle){const R={radius:g*Math.SQRT2/2,pointStyle:D.pointStyle,rotation:D.rotation,borderWidth:T},A=l.xPlus(S,m/2),C=k+f;nI(i,R,A,C,a.pointStyleWidth&&m)}else{const R=k+Math.max((d-g)/2,0),A=l.leftForLtr(S,m),C=Ks(D.borderRadius);i.beginPath(),Object.values(C).some(N=>N!==0)?Ip(i,{x:A,y:R,w:m,h:g,radius:C}):i.rect(A,R,m,g),i.fill(),T!==0&&i.stroke()}i.restore()},_=function(S,k,D){Rp(i,D.text,S,k+v/2,c,{strikethrough:D.hidden,textAlign:l.textAlign(D.textAlign)})},w=this.isHorizontal(),y=this._computeTitleHeight();w?p={x:hr(o,this.left+u,this.right-r[0]),y:this.top+u+y,line:0}:p={x:this.left+u,y:hr(o,this.top+y+u,this.bottom-n[0].height),line:0},cI(this.ctx,t.textDirection);const E=v+u;this.legendItems.forEach((S,k)=>{i.strokeStyle=S.fontColor,i.fillStyle=S.fontColor;const D=i.measureText(S.text).width,T=l.textAlign(S.textAlign||(S.textAlign=a.textAlign)),R=m+f+D;let A=p.x,C=p.y;l.setWidth(this.width),w?k>0&&A+R+u>this.right&&(C=p.y+=E,p.line++,A=p.x=hr(o,this.left+u,this.right-r[p.line])):k>0&&C+E>this.bottom&&(A=p.x=A+n[p.line].width+u,p.line++,C=p.y=hr(o,this.top+y+u,this.bottom-n[p.line].height));const N=l.x(A);if(x(N,C,S),A=gle(T,A+m+f,w?A+R:this.right,t.rtl),_(l.x(A),C,S),w)p.x+=R+u;else if(typeof S.text!="string"){const M=c.lineHeight;p.y+=PI(S,M)+u}else p.y+=E}),uI(this.ctx,t.textDirection)}drawTitle(){const t=this.options,n=t.title,r=or(n.font),i=ii(n.padding);if(!n.display)return;const o=qs(t.rtl,this.left,this.width),a=this.ctx,s=n.position,l=r.size/2,c=i.top+l;let u,d=this.left,f=this.width;if(this.isHorizontal())f=Math.max(...this.lineWidths),u=this.top+c,d=hr(t.align,d,this.right-f);else{const m=this.columnSizes.reduce((g,v)=>Math.max(g,v.height),0);u=c+hr(t.align,this.top,this.bottom-m-t.labels.padding-this._computeTitleHeight())}const p=hr(s,d,d+f);a.textAlign=o.textAlign(eI(s)),a.textBaseline="middle",a.strokeStyle=n.color,a.fillStyle=n.color,a.font=r.string,Rp(a,n.text,p,u,r)}_computeTitleHeight(){const t=this.options.title,n=or(t.font),r=ii(t.padding);return t.display?n.lineHeight+r.height:0}_getLegendItemAt(t,n){let r,i,o;if(Ho(t,this.left,this.right)&&Ho(n,this.top,this.bottom)){for(o=this.legendHitBoxes,r=0;r<o.length;++r)if(i=o[r],Ho(t,i.left,i.left+i.width)&&Ho(n,i.top,i.top+i.height))return this.legendItems[r]}return null}handleEvent(t){const n=this.options;if(!Dde(t.type,n))return;const r=this._getLegendItemAt(t.x,t.y);if(t.type==="mousemove"||t.type==="mouseout"){const i=this._hoveredItem,o=Ode(i,r);i&&!o&&ht(n.onLeave,[t,i,this],this),this._hoveredItem=r,r&&!o&&ht(n.onHover,[t,r,this],this)}else r&&ht(n.onClick,[t,r,this],this)}}function Cde(e,t,n,r,i){const o=Pde(r,e,t,n),a=kde(i,r,t.lineHeight);return{itemWidth:o,itemHeight:a}}function Pde(e,t,n,r){let i=e.text;return i&&typeof i!="string"&&(i=i.reduce((o,a)=>o.length>a.length?o:a)),t+n.size/2+r.measureText(i).width}function kde(e,t,n){let r=e;return typeof t.text!="string"&&(r=PI(t,n)),r}function PI(e,t){const n=e.text?e.text.length:0;return t*n}function Dde(e,t){return!!((e==="mousemove"||e==="mouseout")&&(t.onHover||t.onLeave)||t.onClick&&(e==="click"||e==="mouseup"))}var li={id:"legend",_element:AP,start(e,t,n){const r=e.legend=new AP({ctx:e.ctx,options:n,chart:e});Yo.configure(e,r,n),Yo.addBox(e,r)},stop(e){Yo.removeBox(e,e.legend),delete e.legend},beforeUpdate(e,t,n){const r=e.legend;Yo.configure(e,r,n),r.options=n},afterUpdate(e){const t=e.legend;t.buildLabels(),t.adjustHitBoxes()},afterEvent(e,t){t.replay||e.legend.handleEvent(t.event)},defaults:{display:!0,position:"top",align:"center",fullSize:!0,reverse:!1,weight:1e3,onClick(e,t,n){const r=t.datasetIndex,i=n.chart;i.isDatasetVisible(r)?(i.hide(r),t.hidden=!0):(i.show(r),t.hidden=!1)},onHover:null,onLeave:null,labels:{color:e=>e.chart.options.color,boxWidth:40,padding:10,generateLabels(e){const t=e.data.datasets,{labels:{usePointStyle:n,pointStyle:r,textAlign:i,color:o,useBorderRadius:a,borderRadius:s}}=e.legend.options;return e._getSortedDatasetMetas().map(l=>{const c=l.controller.getStyle(n?0:void 0),u=ii(c.borderWidth);return{text:t[l.index].label,fillStyle:c.backgroundColor,fontColor:o,hidden:!l.visible,lineCap:c.borderCapStyle,lineDash:c.borderDash,lineDashOffset:c.borderDashOffset,lineJoin:c.borderJoinStyle,lineWidth:(u.width+u.height)/4,strokeStyle:c.borderColor,pointStyle:r||c.pointStyle,rotation:c.rotation,textAlign:i||c.textAlign,borderRadius:a&&(s||c.borderRadius),datasetIndex:l.index}},this)}},title:{color:e=>e.chart.options.color,display:!1,position:"center",text:""}},descriptors:{_scriptable:e=>!e.startsWith("on"),labels:{_scriptable:e=>!["generateLabels","filter","sort"].includes(e)}}};const Sc={average(e){if(!e.length)return!1;let t,n,r=new Set,i=0,o=0;for(t=0,n=e.length;t<n;++t){const s=e[t].element;if(s&&s.hasValue()){const l=s.tooltipPosition();r.add(l.x),i+=l.y,++o}}return o===0||r.size===0?!1:{x:[...r].reduce((s,l)=>s+l)/r.size,y:i/o}},nearest(e,t){if(!e.length)return!1;let n=t.x,r=t.y,i=Number.POSITIVE_INFINITY,o,a,s;for(o=0,a=e.length;o<a;++o){const l=e[o].element;if(l&&l.hasValue()){const c=l.getCenterPoint(),u=sb(t,c);u<i&&(i=u,s=l)}}if(s){const l=s.tooltipPosition();n=l.x,r=l.y}return{x:n,y:r}}};function fi(e,t){return t&&(un(t)?Array.prototype.push.apply(e,t):e.push(t)),e}function Qi(e){return(typeof e=="string"||e instanceof String)&&e.indexOf(`
|
|
301
301
|
`)>-1?e.split(`
|
|
302
|
-
`):e}function Ade(e,t){const{element:n,datasetIndex:r,index:i}=t,o=e.getDatasetMeta(r).controller,{label:a,value:s}=o.getLabelAndValue(i);return{chart:e,label:a,parsed:o.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:o.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function TP(e,t){const n=e.chart.ctx,{body:r,footer:i,title:o}=e,{boxWidth:a,boxHeight:s}=t,l=or(t.bodyFont),c=or(t.titleFont),u=or(t.footerFont),d=o.length,f=i.length,p=r.length,m=ii(t.padding);let g=m.height,v=0,x=r.reduce((y,E)=>y+E.before.length+E.lines.length+E.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),x){const y=t.displayColors?Math.max(s,l.lineHeight):l.lineHeight;g+=p*y+(x-p)*l.lineHeight+(x-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let _=0;const w=function(y){v=Math.max(v,n.measureText(y).width+_)};return n.save(),n.font=c.string,Ze(e.title,w),n.font=l.string,Ze(e.beforeBody.concat(e.afterBody),w),_=t.displayColors?a+2+t.boxPadding:0,Ze(r,y=>{Ze(y.before,w),Ze(y.lines,w),Ze(y.after,w)}),_=0,n.font=u.string,Ze(e.footer,w),n.restore(),v+=m.width,{width:v,height:g}}function Tde(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function Mde(e,t,n,r){const{x:i,width:o}=r,a=n.caretSize+n.caretPadding;if(e==="left"&&i+o+a>t.width||e==="right"&&i-o-a<0)return!0}function Nde(e,t,n,r){const{x:i,width:o}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return r==="center"?c=i<=(s+l)/2?"left":"right":i<=o/2?c="left":i>=a-o/2&&(c="right"),Mde(c,e,t,n)&&(c="center"),c}function MP(e,t,n){const r=n.yAlign||t.yAlign||Tde(e,n);return{xAlign:n.xAlign||t.xAlign||Nde(e,t,n,r),yAlign:r}}function jde(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function Rde(e,t,n){let{y:r,height:i}=e;return t==="top"?r+=n:t==="bottom"?r-=i+n:r-=i/2,r}function NP(e,t,n,r){const{caretSize:i,caretPadding:o,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=i+o,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ks(a);let m=jde(t,s);const g=Rde(t,l,c);return l==="center"?s==="left"?m+=c:s==="right"&&(m-=c):s==="left"?m-=Math.max(u,f)+i:s==="right"&&(m+=Math.max(d,p)+i),{x:Mn(m,0,r.width-t.width),y:Mn(g,0,r.height-t.height)}}function ef(e,t,n){const r=ii(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function jP(e){return fi([],Qi(e))}function Ide(e,t,n){return bs(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function RP(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const kI={beforeTitle:Gi,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:Gi,beforeBody:Gi,beforeLabel:Gi,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Ke(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.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(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Gi,afterBody:Gi,beforeFooter:Gi,footer:Gi,afterFooter:Gi};function Xn(e,t,n,r){const i=e[t].call(n,r);return typeof i>"u"?kI[t].call(n,r):i}class IP extends ha{static positioners=Sc;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,o=new fI(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Ide(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,i=Xn(r,"beforeTitle",this,t),o=Xn(r,"title",this,t),a=Xn(r,"afterTitle",this,t);let s=[];return s=fi(s,Qi(i)),s=fi(s,Qi(o)),s=fi(s,Qi(a)),s}getBeforeBody(t,n){return jP(Xn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,i=[];return Ze(t,o=>{const a={before:[],lines:[],after:[]},s=RP(r,o);fi(a.before,Qi(Xn(s,"beforeLabel",this,o))),fi(a.lines,Xn(s,"label",this,o)),fi(a.after,Qi(Xn(s,"afterLabel",this,o))),i.push(a)}),i}getAfterBody(t,n){return jP(Xn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,i=Xn(r,"beforeFooter",this,t),o=Xn(r,"footer",this,t),a=Xn(r,"afterFooter",this,t);let s=[];return s=fi(s,Qi(i)),s=fi(s,Qi(o)),s=fi(s,Qi(a)),s}_createItems(t){const n=this._active,r=this.chart.data,i=[],o=[],a=[];let s=[],l,c;for(l=0,c=n.length;l<c;++l)s.push(Ade(this.chart,n[l]));return t.filter&&(s=s.filter((u,d,f)=>t.filter(u,d,f,r))),t.itemSort&&(s=s.sort((u,d)=>t.itemSort(u,d,r))),Ze(s,u=>{const d=RP(t.callbacks,u);i.push(Xn(d,"labelColor",this,u)),o.push(Xn(d,"labelPointStyle",this,u)),a.push(Xn(d,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=s,s}update(t,n){const r=this.options.setContext(this.getContext()),i=this._active;let o,a=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const s=Sc[r.position].call(this,i,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const l=this._size=TP(this,r),c=Object.assign({},s,l),u=MP(this.chart,r,c),d=NP(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:s.x,caretY:s.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,i){const o=this.getCaretPosition(t,r,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:i,yAlign:o}=this,{caretSize:a,cornerRadius:s}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Ks(s),{x:f,y:p}=t,{width:m,height:g}=n;let v,x,_,w,y,E;return o==="center"?(y=p+g/2,i==="left"?(v=f,x=v-a,w=y+a,E=y-a):(v=f+m,x=v+a,w=y-a,E=y+a),_=v):(i==="left"?x=f+Math.max(l,u)+a:i==="right"?x=f+m-Math.max(c,d)-a:x=this.caretX,o==="top"?(w=p,y=w-a,v=x-a,_=x+a):(w=p+g,y=w+a,v=x+a,_=x-a),E=w),{x1:v,x2:x,x3:_,y1:w,y2:y,y3:E}}drawTitle(t,n,r){const i=this.title,o=i.length;let a,s,l;if(o){const c=qs(r.rtl,this.x,this.width);for(t.x=ef(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",a=or(r.titleFont),s=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,l=0;l<o;++l)n.fillText(i[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s,l+1===o&&(t.y+=r.titleMarginBottom-s)}}_drawColorBox(t,n,r,i,o){const a=this.labelColors[r],s=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=o,u=or(o.bodyFont),d=ef(this,"left",o),f=i.x(d),p=l<u.lineHeight?(u.lineHeight-l)/2:0,m=n.y+p;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:1},v=i.leftForLtr(f,c)+c/2,x=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,cb(t,g,v,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,cb(t,g,v,x)}else{t.lineWidth=Re(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const g=i.leftForLtr(f,c),v=i.leftForLtr(i.xPlus(f,1),c-2),x=Ks(a.borderRadius);Object.values(x).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ip(t,{x:g,y:m,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Ip(t,{x:v,y:m+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,m,c,l),t.strokeRect(g,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(v,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:i}=this,{bodySpacing:o,bodyAlign:a,displayColors:s,boxHeight:l,boxWidth:c,boxPadding:u}=r,d=or(r.bodyFont);let f=d.lineHeight,p=0;const m=qs(r.rtl,this.x,this.width),g=function(D){n.fillText(D,m.x(t.x+p),t.y+f/2),t.y+=f+o},v=m.textAlign(a);let x,_,w,y,E,S,k;for(n.textAlign=a,n.textBaseline="middle",n.font=d.string,t.x=ef(this,v,r),n.fillStyle=r.bodyColor,Ze(this.beforeBody,g),p=s&&v!=="right"?a==="center"?c/2+u:c+2+u:0,y=0,S=i.length;y<S;++y){for(x=i[y],_=this.labelTextColors[y],n.fillStyle=_,Ze(x.before,g),w=x.lines,s&&w.length&&(this._drawColorBox(n,t,y,m,r),f=Math.max(d.lineHeight,l)),E=0,k=w.length;E<k;++E)g(w[E]),f=d.lineHeight;Ze(x.after,g)}p=0,f=d.lineHeight,Ze(this.afterBody,g),t.y-=o}drawFooter(t,n,r){const i=this.footer,o=i.length;let a,s;if(o){const l=qs(r.rtl,this.x,this.width);for(t.x=ef(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",a=or(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,s=0;s<o;++s)n.fillText(i[s],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r.footerSpacing}}drawBackground(t,n,r,i){const{xAlign:o,yAlign:a}=this,{x:s,y:l}=t,{width:c,height:u}=r,{topLeft:d,topRight:f,bottomLeft:p,bottomRight:m}=Ks(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(s+d,l),a==="top"&&this.drawCaret(t,n,r,i),n.lineTo(s+c-f,l),n.quadraticCurveTo(s+c,l,s+c,l+f),a==="center"&&o==="right"&&this.drawCaret(t,n,r,i),n.lineTo(s+c,l+u-m),n.quadraticCurveTo(s+c,l+u,s+c-m,l+u),a==="bottom"&&this.drawCaret(t,n,r,i),n.lineTo(s+p,l+u),n.quadraticCurveTo(s,l+u,s,l+u-p),a==="center"&&o==="left"&&this.drawCaret(t,n,r,i),n.lineTo(s,l+d),n.quadraticCurveTo(s,l,s+d,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,i=r&&r.x,o=r&&r.y;if(i||o){const a=Sc[t.position].call(this,this._active,this._eventPosition);if(!a)return;const s=this._size=TP(this,t),l=Object.assign({},a,this._size),c=MP(n,t,l),u=NP(t,l,c,n);(i._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=s.width,this.height=s.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){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},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=ii(n.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&s&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,i,n),cI(t,n.textDirection),o.y+=a.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),uI(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,i=t.map(({datasetIndex:s,index:l})=>{const c=this.chart.getDatasetMeta(s);if(!c)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:c.data[l],index:l}}),o=!Mp(r,i),a=this._positionChanged(i,n);(o||a)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],a=this._getActiveElements(t,o,n,r),s=this._positionChanged(a,t),l=n||!Mp(a,o)||s;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,i){const o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(s=>this.chart.data.datasets[s.datasetIndex]&&this.chart.getDatasetMeta(s.datasetIndex).controller.getParsed(s.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:r,caretY:i,options:o}=this,a=Sc[o.position].call(this,t,n);return a!==!1&&(r!==a.x||i!==a.y)}}var Gr={id:"tooltip",_element:IP,positioners:Sc,afterInit(e,t,n){n&&(e.tooltip=new IP({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:kI},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Lde=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function $de(e,t,n,r){const i=e.indexOf(t);if(i===-1)return Lde(e,t,n,r);const o=e.lastIndexOf(t);return i!==o?n:i}const Fde=(e,t)=>e===null?null:Mn(Math.round(e),0,t);function LP(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Ro extends $l{static id="category";static defaults={ticks:{callback:LP}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:o}of n)r[i]===o&&r.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Ke(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:$de(r,t,Se(n,t),this._addedLabels),Fde(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,i=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=t;a<=n;a++)i.push({value:a});return i}getLabelForValue(t){return LP.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Bde(e,t){const n=[],{bounds:i,step:o,min:a,max:s,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:f}=e,p=o||1,m=u-1,{min:g,max:v}=t,x=!Ke(a),_=!Ke(s),w=!Ke(c),y=(v-g)/(d+1);let E=$C((v-g)/m/p)*p,S,k,D,T;if(E<1e-14&&!x&&!_)return[{value:g},{value:v}];T=Math.ceil(v/E)-Math.floor(g/E),T>m&&(E=$C(T*E/m/p)*p),Ke(l)||(S=Math.pow(10,l),E=Math.ceil(E*S)/S),i==="ticks"?(k=Math.floor(g/E)*E,D=Math.ceil(v/E)*E):(k=g,D=v),x&&_&&o&&sle((s-a)/o,E/1e3)?(T=Math.round(Math.min((s-a)/E,u)),E=(s-a)/T,k=a,D=s):w?(k=x?a:k,D=_?s:D,T=c-1,E=(D-k)/T):(T=(D-k)/E,Nc(T,Math.round(T),E/1e3)?T=Math.round(T):T=Math.ceil(T));const R=Math.max(FC(E),FC(k));S=Math.pow(10,Ke(l)?R:l),k=Math.round(k*S)/S,D=Math.round(D*S)/S;let A=0;for(x&&(f&&k!==a?(n.push({value:a}),k<a&&A++,Nc(Math.round((k+A*E)*S)/S,a,$P(a,y,e))&&A++):k<a&&A++);A<T;++A){const C=Math.round((k+A*E)*S)/S;if(_&&C>s)break;n.push({value:C})}return _&&f&&D!==s?n.length&&Nc(n[n.length-1].value,s,$P(s,y,e))?n[n.length-1].value=s:n.push({value:s}):(!_||D===s)&&n.push({value:D}),n}function $P(e,t,{horizontal:n,minRotation:r}){const i=lo(r),o=(n?Math.sin(i):Math.cos(i))||.001,a=.75*t*(""+e).length;return Math.min(t/o,a)}class Wde extends $l{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Ke(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:o}=this;const a=l=>i=n?i:l,s=l=>o=r?o:l;if(t){const l=Ti(i),c=Ti(o);l<0&&c<0?s(0):l>0&&c>0&&a(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);s(o+l),t||a(i-l)}this.min=i,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,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 t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,a=Bde(i,o);return t.bounds==="ticks"&&lle(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const i=(r-n)/Math.max(t.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return x1(t,this.chart.options.locale,this.options.ticks.format)}}class Io extends Wde{static id="linear";static defaults={ticks:{callback:tI.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Yr(t)?t:0,this.max=Yr(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=lo(this.options.ticks.minRotation),i=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const um={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}},nr=Object.keys(um);function FP(e,t){return e-t}function BP(e,t){if(Ke(t))return null;const n=e._adapter,{parser:r,round:i,isoWeekday:o}=e._parseOpts;let a=t;return typeof r=="function"&&(a=r(a)),Yr(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(i&&(a=i==="week"&&(fu(o)||o===!0)?n.startOf(a,"isoWeek",o):n.startOf(a,i)),+a)}function WP(e,t,n,r){const i=nr.length;for(let o=nr.indexOf(e);o<i-1;++o){const a=um[nr[o]],s=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(s*a.size))<=r)return nr[o]}return nr[i-1]}function Vde(e,t,n,r,i){for(let o=nr.length-1;o>=nr.indexOf(n);o--){const a=nr[o];if(um[a].common&&e._adapter.diff(i,r,a)>=t-1)return a}return nr[n?nr.indexOf(n):0]}function zde(e){for(let t=nr.indexOf(e)+1,n=nr.length;t<n;++t)if(um[nr[t]].common)return nr[t]}function VP(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:i}=y1(n,t),o=n[r]>=t?n[r]:n[i];e[o]=!0}}function Hde(e,t,n,r){const i=e._adapter,o=+i.startOf(t[0].value,r),a=t[t.length-1].value;let s,l;for(s=o;s<=a;s=+i.add(s,1,r))l=n[s],l>=0&&(t[l].major=!0);return t}function zP(e,t,n){const r=[],i={},o=t.length;let a,s;for(a=0;a<o;++a)s=t[a],i[s]=a,r.push({value:s,major:!1});return o===0||!n?r:Hde(e,r,i,n)}class HP extends $l{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),i=this._adapter=new Xce._date(t.adapters.date);i.init(n),Mc(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:BP(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:i,max:o,minDefined:a,maxDefined:s}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!s&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!s)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Yr(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),o=Yr(o)&&!isNaN(o)?o:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const o=this.min,a=this.max,s=ple(i,o,a);return this._unit=n.unit||(r.autoSkip?WP(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Vde(this,s.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:zde(this._unit),this.initOffsets(i),t.reverse&&s.reverse(),zP(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=Mn(n,0,a),r=Mn(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,i=this.options,o=i.time,a=o.unit||WP(o.minUnit,n,r,this._getLabelCapacity(n)),s=Se(i.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=fu(l)||l===!0,u={};let d=n,f,p;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(r,n,a)>1e5*s)throw new Error(n+" and "+r+" are too far apart with stepSize of "+s+" "+a);const m=i.ticks.source==="data"&&this.getDataTimestamps();for(f=d,p=0;f<r;f=+t.add(f,s,a),p++)VP(u,f,m);return(f===r||i.bounds==="ticks"||p===1)&&VP(u,f,m),Object.keys(u).sort(FP).map(g=>+g)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const i=this.options.time.displayFormats,o=this._unit,a=n||i[o];return this._adapter.format(t,a)}_tickFormatFunction(t,n,r,i){const o=this.options,a=o.ticks.callback;if(a)return ht(a,[t,n,r],this);const s=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&s[l],d=c&&s[c],f=r[n],p=c&&d&&f&&f.major;return this._adapter.format(t,i||(p?d:u))}generateTickLabels(t){let n,r,i;for(n=0,r=t.length;n<r;++n)i=t[n],i.label=this._tickFormatFunction(i.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,i=lo(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(i),a=Math.sin(i),s=this._resolveTickFontOptions(0).size;return{w:r*o+s*a,h:r*a+s*o}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,o=this._tickFormatFunction(t,0,zP(this,[t],this._majorUnit),i),a=this._getLabelSize(o),s=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return s>0?s:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;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)t=t.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)t.push(BP(this,i[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return QR(t.sort(FP))}}function tf(e,t,n){let r=0,i=e.length-1,o,a,s,l;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=za(e,"pos",t)),{pos:o,time:s}=e[r],{pos:a,time:l}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=za(e,"time",t)),{time:o,pos:s}=e[r],{time:a,pos:l}=e[i]);const c=a-o;return c?s+(l-s)*(t-o)/c:s}class Uhe extends HP{static id="timeseries";static defaults=HP.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=tf(n,this.min),this._tableRange=tf(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,i=[],o=[];let a,s,l,c,u;for(a=0,s=t.length;a<s;++a)c=t[a],c>=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,s=i.length;a<s;++a)u=i[a+1],l=i[a-1],c=i[a],Math.round((u+l)/2)!==c&&o.push({time:c,pos:a/(s-1)});return o}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,o)=>i-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(tf(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return tf(this._table,r*this._tableRange+this._minPos,!0)}}const DI="label";function YP(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Yde(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function AI(e,t){e.labels=t}function TI(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:DI;const r=[];e.datasets=t.map(i=>{const o=e.datasets.find(a=>a[n]===i[n]);return!o||!i.data||r.includes(o)?{...i}:(r.push(o),Object.assign(o,i),o)})}function Ude(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:DI;const n={labels:[],datasets:[]};return AI(n,e.labels),TI(n,e.datasets,t),n}function Kde(e,t){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:o,type:a,data:s,options:l,plugins:c=[],fallbackContent:u,updateMode:d,...f}=e,p=P.useRef(null),m=P.useRef(null),g=()=>{p.current&&(m.current=new Kn(p.current,{type:a,data:Ude(s,o),options:l&&{...l},plugins:c}),YP(t,m.current))},v=()=>{YP(t,null),m.current&&(m.current.destroy(),m.current=null)};return P.useEffect(()=>{!i&&m.current&&l&&Yde(m.current,l)},[i,l]),P.useEffect(()=>{!i&&m.current&&AI(m.current.config.data,s.labels)},[i,s.labels]),P.useEffect(()=>{!i&&m.current&&s.datasets&&TI(m.current.config.data,s.datasets,o)},[i,s.datasets]),P.useEffect(()=>{m.current&&(i?(v(),setTimeout(g)):m.current.update(d))},[i,l,s.labels,s.datasets,d]),P.useEffect(()=>{m.current&&(v(),setTimeout(g))},[a]),P.useEffect(()=>(g(),()=>v()),[]),P.createElement("canvas",{ref:p,role:"img",height:n,width:r,...f},u)}const qde=P.forwardRef(Kde);function N1(e,t){return Kn.register(t),P.forwardRef((n,r)=>P.createElement(qde,{...n,ref:r,type:e}))}const j1=N1("line",Gce),Bl=N1("bar",Uce),R1=N1("doughnut",qce);Kn.register(A1,Gr,li);const Gde={id:"bottomGlow",afterDatasetsDraw(e,t,n){if(!n?.enabled)return;const r=e.getDatasetMeta(0);if(!r?.data?.[0])return;const{ctx:i}=e,{x:o,y:a,innerRadius:s}=r.data[0],l=Math.max(s-2,0),c=a+l*.9,u=i.createRadialGradient(o,c,0,o,c,l*1.08);u.addColorStop(0,n.color??"rgba(186, 230, 253, 0.72)"),u.addColorStop(.3,"rgba(186, 230, 253, 0.4)"),u.addColorStop(.58,"rgba(186, 230, 253, 0.16)"),u.addColorStop(1,"rgba(186, 230, 253, 0)"),i.save(),i.beginPath(),i.arc(o,a,l,0,Math.PI*2),i.clip(),i.fillStyle=u,i.beginPath(),i.ellipse(o,c,l*1.08,l*.52,0,0,Math.PI*2),i.fill(),i.restore()}},Xde={id:"centerText",afterDraw(e,t,n){const{ctx:r}=e,i=e.getDatasetMeta(0);if(!i?.data?.[0])return;const{x:o,y:a}=i.data[0],{top:s="",bottom:l="",topSize:c=20,bottomSize:u=10,topColor:d="#0F172A",bottomColor:f="#64748B"}=n||{};r.save(),r.textAlign="center",r.textBaseline="middle",r.fillStyle=d,r.font=`600 ${c}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(s,o,a-6),r.fillStyle=f,r.font=`500 ${u}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(l,o,a+22),r.restore()}},MI=({title:e="Tickets",icon:t,firstLabel:n="First",firstValue:r=0,firstColor:i="#12B981",secondLabel:o="Second",secondValue:a=0,secondColor:s="#AB0000",growthPercentage:l="+0%",growthText:c="Compared to last month",totalLabel:u="Total",centerTopColor:d="#0F172A",centerBottomColor:f="#64748B",centerTopSize:p,centerBottomSize:m,showBottomGlow:g=!1,bottomGlowColor:v="rgba(186, 230, 253, 0.75)",widgetType:x="",resolvedWidgetType:_="",data:w})=>{const y=w?.title??e,E=w?.icon??t,S=w?.firstLabel??n,k=Number(w?.firstValue??r??0),D=w?.firstColor??i,T=w?.secondLabel??o,R=Number(w?.secondValue??a??0),A=w?.secondColor??s,C=w?.growthPercentage??l??"+0%",N=w?.growthText??c,M=w?.totalLabel??u,j=w?.widgetType??x??_,$=w?.centerTopSize??p??(j==="commercial"?34:20),B=w?.centerBottomSize??m??(j==="commercial"?14:10),z=w?.showBottomGlow??g,V=w?.bottomGlowColor??v,W=k+R,Q={labels:[S,T],datasets:[{data:[k,R],backgroundColor:[D,A],borderWidth:2,hoverOffset:4}]},X={responsive:!0,maintainAspectRatio:!1,cutout:"68%",plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi()},centerText:{top:`${W}`,bottom:M,topSize:$,bottomSize:B,topColor:d,bottomColor:f},bottomGlow:{enabled:z,color:V}}},oe=[{label:S,value:k,color:D},{label:T,value:R,color:A}],Z=C.toString().includes("+"),re=C.toString().includes("-"),ae=Z?"#1FA05B":"#AB0000";return h.jsx(Ie,{title:y,icon:E,className:j==="commercial"?"h-[362px]":"h-[238px]",children:h.jsxs("div",{className:"grid grid-cols-12 gap-[16px] items-center",children:[h.jsxs("div",{className:"col-span-5 space-y-[16px]",children:[oe.map((le,ue)=>h.jsxs("div",{children:[h.jsx("div",{className:`text-[12px] text-[#64748B] ${j==="commercial"?"mb-[8px]":""}`,children:le.label}),h.jsx("div",{className:"text-[28px] leading-[32px]",style:{color:le.color},children:le.value})]},ue)),h.jsxs("div",{className:`text-[12px] flex gap-[4px] ${j==="commercial"?"mt-[20px]":""} items-center`,style:{color:ae},children:[Z&&h.jsx(ns,{}),re&&h.jsx(ts,{}),h.jsx("div",{children:C.replace("+","").replace("-","")}),h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[14px] ml-[4px] whitespace-nowrap",children:N})]})]}),h.jsx("div",{className:"col-span-7",children:h.jsx("div",{className:`${j==="commercial"?"h-[260px] max-w-[263px]":"h-[158px] w-[158px]"} ml-auto mr-2`,children:h.jsx(R1,{data:Q,options:X,plugins:[Gde,Xde]})})})]})})},UP=({value:e=0,total:t=1,colorClass:n="",label:r=""})=>{const i=Math.max(0,Math.min(100,e/(t||1)*100)),o=n==="bg-[#8B5CF6]"?"text-[#8B5CF6]":n==="bg-[#12B981]"?"text-[#12B981]":"text-slate-600";return h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("div",{className:"w-2/3 min-w-[80px] h-3 rounded-full overflow-hidden",children:h.jsx("div",{className:`h-3 rounded-full ${n}`,style:{width:`${i}%`}})}),h.jsx("div",{className:`${o} !text-[12px] font-bold mt-1`,children:e}),h.jsx("div",{className:"!text-[12px] text-[#64748B] mt-1",children:r})]})},KP=({title:e,value:t,suffix:n,valueClass:r=""})=>h.jsxs("div",{className:"bg-white rounded-[12px] shadow-[0_0_12px_0_#EAF2FF] h-[98px] p-[16px] flex flex-col justify-center",children:[h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#121212] mb-[4px]",children:e}),h.jsxs("div",{className:`text-[28px] leading-[32px] flex item gap-[4px] font-medium ${r}`,children:[t," ",n&&h.jsx("div",{className:"text-[28px] leading-[32px] font-medium",children:n})]})]}),Qde=({data:e,totalUnits:t=847,occupiedUnits:n=756,ownerCount:r=700,tenantCount:i=56,avgResidents:o=4.4,avgLeaseMonths:a=18})=>{const s=Number(e?.totalUnits??t??0),l=Number(e?.occupiedUnits??n??0),c=Number(e?.ownerCount??r??0),u=Number(e?.tenantCount??i??0),d=e?.avgResidents??o,f=e?.avgLeaseMonths??a,p=c+u;return h.jsxs("div",{children:[h.jsxs("div",{className:"bg-white rounded-[12px] shadow-[0_0_12px_0_#EAF2FF] h-[128px] p-[16px] !mb-4",children:[h.jsxs("div",{className:"flex items-center gap-[12px] mb-[24px]",children:[h.jsx(Hb,{className:"h-8 w-8 text-[#329DFF]"}),h.jsx("div",{className:"font-medium text-[16px] text-[#121212]",children:"Occupancy Overview"})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("div",{className:"leading-[16px] text-[12px] text-[#64748B]",children:"Occupied Units"}),h.jsxs("div",{className:"flex items-center gap-[4px]",children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:l}),h.jsxs("div",{className:"text-[#64748B] text-[20px] leading-[32px]",children:["/",s]})]})]}),h.jsxs("div",{className:"flex items-end",children:[h.jsx(UP,{value:c,total:p,colorClass:"bg-[#8B5CF6]",label:"Owner"}),h.jsx(UP,{value:u,total:p,colorClass:"bg-[#12B981]",label:"Tenant"})]})]})]}),h.jsxs("div",{className:"mt-2.5 grid grid-cols-2 gap-[12px]",children:[h.jsx(KP,{title:"Avg Residents Per Unit",value:d,valueClass:"text-[#8B5CF6]"}),h.jsx(KP,{title:"Avg Lease Period",value:f,suffix:"months",valueClass:"text-[#E7A015]"})]})]})};Kn.register(A1,Gr,li);const Zde={id:"centerText",afterDraw(e,t,n){const{ctx:r}=e,i=e.getDatasetMeta(0);if(!i?.data?.[0])return;const{x:o,y:a}=i.data[0],{top:s="",bottom:l="",topSize:c=20,bottomSize:u=10,topColor:d="#0F172A",bottomColor:f="#64748B"}=n||{};r.save(),r.textAlign="center",r.textBaseline="middle",r.fillStyle=d,r.font=`600 ${c}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(s,o,a-5),r.fillStyle=f,r.font=`500 ${u}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(l,o,a+12),r.restore()}},Jde=({data:e,ownerCount:t=1e3,tenantCount:n=200,nonResidingOwners:r=26,growthPct:i="+9.1%"})=>{const o=Number(e?.ownerCount??t??0),a=Number(e?.tenantCount??n??0),s=Number(e?.nonResidingOwners??r??0),l=e?.growthPct??i,c=Math.max(o-s,0),u=o+a,d={labels:["Owners","Tenants","Non-residing Owner"],datasets:[{data:[c,a,s],backgroundColor:["#3C81F6","#08B6D4","#8B5CF6"],borderWidth:2,hoverOffset:4}]},f={responsive:!0,maintainAspectRatio:!1,cutout:"68%",plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi()},centerText:{top:`${u}`,bottom:"Total Members",topSize:20,bottomSize:10}}};return h.jsx(Ie,{title:"Resident Overview",icon:h.jsx(jD,{className:"h-6 w-6 text-[#8B5CF6]"}),className:"h-[238px]",children:h.jsxs("div",{className:" flex-1 min-h-0 grid grid-cols-12 gap-[16px] items-center",children:[h.jsxs("div",{className:"col-span-5",children:[h.jsxs("div",{children:[h.jsx("div",{className:"!text-[12px] text-[#64748B] leading-[16px]",children:"Total Owners"}),h.jsx("div",{className:"text-[28px] leading-[32px ] text-[#3C81F6]",children:o})]}),h.jsxs("div",{children:[h.jsx("div",{className:"!text-[12px] text-[#64748B] leading-[16px]",children:"Total Tenants"}),h.jsx("div",{className:"text-[28px] leading-[32px ] text-[#08B6D4]",children:a})]}),h.jsxs("div",{className:"text-[10px] text-[#1FA05B] flex gap-[8px] items-center",children:[h.jsx(Ou,{value:l}),h.jsx("div",{className:"text-[#64748B] ",children:"Compared to last month"})]})]}),h.jsx("div",{className:"col-span-7",children:h.jsx("div",{className:"h-[162px] w-[162px] ml-auto mr-2",children:h.jsx(R1,{data:d,options:f,plugins:[Zde]})})})]})})};Kn.register(Ro,Io,Fl,Gr,li);const efe=({data:e,blocks:t=[{name:"Block A",owner:110,rented:24,vacant:8},{name:"Block B",owner:95,rented:18,vacant:6},{name:"Block C",owner:65,rented:12,vacant:18},{name:"Block D",owner:78,rented:16,vacant:30}]})=>{const n=Array.isArray(e?.blocks)&&e.blocks.length>0?e.blocks:Array.isArray(e)&&e.length>0?e:t,r=n.map(c=>c.name),i=n.map(c=>Number(c.owner??0)),o=n.map(c=>Number(c.rented??0)),a=n.map(c=>Number(c.vacant??0)),s={labels:r,datasets:[{label:"Owner",data:i,backgroundColor:"#3C81F6",barThickness:40},{label:"",data:i.map(()=>2),backgroundColor:"transparent",barThickness:40},{label:"Rented",data:o,backgroundColor:"#8B5CF6",barThickness:40},{label:"",data:o.map(()=>2),backgroundColor:"transparent",barThickness:40},{label:"Vacant",data:a,backgroundColor:"#08B6D4",barThickness:40}]},l={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,boxWidth:10,boxHeight:10,pointStyle:"rectRot",padding:20}},tooltip:{enabled:!1,external:Fi({hideTitleForSingle:!1})}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{color:"#64748B"}},y:{stacked:!0,beginAtZero:!0,suggestedMax:180,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:20}}}};return h.jsx(Ie,{title:"Block-wise Occupancy",className:"w-full h-[360px]",titleWeight:"semi-bold",children:h.jsx(Bl,{data:s,options:l})})};Kn.register(Ro,Io,M1,T1,Gr,li);const tfe=e=>{const[t,n]=String(e).split(" ");return`${{Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"}[t]||t} 20${n}`},nfe=({data:e,labels:t=["Jan 25","Feb 25","Mar 25","Apr 25","May 25"],moveIn:n=[24,27,20,26,23],moveOut:r=[12,17,8,5,16]})=>{const i=Array.isArray(e?.labels)&&e.labels.length>0?e.labels:t,o=Array.isArray(e?.moveIn)&&e.moveIn.length>0?e.moveIn:n,a=Array.isArray(e?.moveOut)&&e.moveOut.length>0?e.moveOut:r,s={labels:i,datasets:[{label:"Move-in",data:o,borderColor:"#12B981",backgroundColor:"rgba(16,185,129,0.15)",pointBackgroundColor:"#12B981",pointStyle:"rectRot",fill:!1},{label:"Move-out",data:a,borderColor:"#8B5CF6",backgroundColor:"rgba(124,58,237,0.15)",pointBackgroundColor:"#8B5CF6",pointStyle:"rectRot",fill:!1}]},l={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,boxWidth:10,boxHeight:10,padding:20}},tooltip:{enabled:!1,external:Fi({titleFormatter:c=>c.title?.[0]?tfe(c.title[0]):"",hideTitleForSingle:!1})}},scales:{x:{grid:{color:"#F1F5F9"},ticks:{color:"#64748B"}},y:{beginAtZero:!0,suggestedMax:28,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:4,precision:0}}},elements:{line:{borderWidth:2,tension:0},point:{radius:0,hoverRadius:3,hitRadius:10}}};return h.jsx(Ie,{title:"Move-in/Out Trends",className:"w-full h-[360px]",titleWeight:"semi-bold",children:h.jsx(j1,{data:s,options:l})})};Kn.register(Ro,Io,M1,T1,Gr,li);const rfe=e=>{const[t,n]=String(e).split(" ");return`${{Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"}[t]||t} 20${n}`},ife=["Jan 25","Feb 25","Mar 25","Apr 25","May 25"],ofe=[24,27,20,26,23],afe=[4,17,8,5,16],NI=({data:e,labels:t,moveIn:n,moveOut:r})=>{const i=Array.isArray(e?.labels)&&e.labels.length>0?e.labels:Array.isArray(t)&&t.length>0?t:ife,o=Array.isArray(e?.moveIn)&&e.moveIn.length>0?e.moveIn:Array.isArray(n)&&n.length>0?n:ofe,a=Array.isArray(e?.moveOut)&&e.moveOut.length>0?e.moveOut:Array.isArray(r)&&r.length>0?r:afe,s={labels:i,datasets:[{label:"Income",data:o,borderColor:"#10B981",backgroundColor:"rgba(16,185,129,0.15)",pointBackgroundColor:"#10B981",pointStyle:"rectRot",fill:!1},{label:"Expenditure",data:a,borderColor:"#AB0000",backgroundColor:"rgba(124,58,237,0.15)",pointBackgroundColor:"#AB0000",pointStyle:"rectRot",fill:!1}]},l={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,boxWidth:10,boxHeight:10,padding:20}},tooltip:{enabled:!1,external:Fi({titleFormatter:c=>c.title?.[0]?rfe(c.title[0]):"",hideTitleForSingle:!1})}},scales:{x:{grid:{color:"#F1F5F9"},ticks:{color:"#64748B"}},y:{beginAtZero:!0,suggestedMax:28,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:4,precision:0}}},elements:{line:{borderWidth:2,tension:0},point:{radius:0,hoverRadius:3,hitRadius:10}}};return h.jsx(j1,{data:s,options:l})};function qP({label:e,value:t,positive:n,bgColor:r,delta:i,deltaLabel:o,textColor:a}){return h.jsxs("div",{className:`rounded-[8px] p-[16px] ${r} border border-[#EBEBEB] h-[126px]`,children:[h.jsx("div",{className:`text-[16px] leading-[20px] ${a}`,children:e}),h.jsx("div",{className:"mt-[16px] leading-[28px] !text-[24px] font-medium text-[#121212]",children:t}),h.jsxs("div",{className:"mt-[8px] flex items-center gap-[8px] leading-[14px] text-[10px]",children:[h.jsx("div",{className:n?"text-[#1FA05B] font-medium":"text-[#EF4444] font-medium",children:i}),h.jsx("div",{className:"text-[#64748B] ",children:o})]})]})}function sfe({data:e={}}){const t=e?.incomeCard??{label:"Total Income",value:"AED 5.68M",delta:"+4.4%",positive:!0,bgColor:"bg-slate-50",deltaLabel:"Compared to last month",textColor:"text-[#1FA05B]"},n=e?.expenditureCard??{label:"Total Expenditure",value:"AED 1.83M",delta:"-1.1%",positive:!1,bgColor:"bg-slate-50",deltaLabel:"Compared to last month",textColor:"text-[#AB0000]"};return h.jsxs(Ie,{title:"Accounting",className:"w-full h-[523px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-[16px]",children:[h.jsx(qP,{...t}),h.jsx(qP,{...n})]}),h.jsx("div",{className:"h-[254px] mt-[35.5px]",children:h.jsx(NI,{data:e?.incomeExpenditure})})]})}Kn.register(Ro,Io,Fl,Gr,li);const lfe=["Maintenance","Security","Utilities","Housekeeping","Administration","Others"],cfe=[55e3,56e3,64e3,38e3,54e3,65e3],ufe=[63e3,48e3,51300,28e3,42e3,35e3],dfe=({data:e={}})=>{const t=Array.isArray(e?.labels)&&e.labels.length>0?e.labels:lfe,n=Array.isArray(e?.budgetValues)&&e.budgetValues.length>0?e.budgetValues:cfe,r=Array.isArray(e?.actualValues)&&e.actualValues.length>0?e.actualValues:ufe,i={labels:t,datasets:[{label:"Budget",data:n,backgroundColor:"#93C5FD",barThickness:60},{label:"Actual",data:r,backgroundColor:"#3B82F6",barThickness:60}]},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,pointStyle:"rectRot",padding:20}},tooltip:{enabled:!1,external:Fi({titleFormatter:a=>a.title?.[0]||"",hideTitleForSingle:!1,rowsFormatter:a=>(a.dataPoints||[]).map(s=>({label:s.dataset.label||s.label,value:`AED ${(Number(s.raw??0)/1e3).toFixed(1)}K`,color:s.dataset.backgroundColor}))})}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B"}},y:{beginAtZero:!0,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",callback:a=>`${a/1e3}K`}}}};return h.jsx(Ie,{title:"Budget vs Actuals",className:"w-full h-[362px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:h.jsx(Bl,{data:i,options:o})})},ffe=[{title:"Primary Account",amount:285e4,subtitle:"Savings"},{title:"Emergency Fund",amount:12e5,subtitle:"Fixed deposit"},{title:"Maintenance Fund",amount:68e4,subtitle:"Current"}],pfe=({data:e})=>{const t=Array.isArray(e?.accounts)&&e.accounts.length>0?e.accounts:Array.isArray(e)&&e.length>0?e:ffe,n=t.reduce((i,o)=>i+o.amount,0),r=i=>i>=1e6?`AED ${(i/1e6).toFixed(2)}M`:i>=1e3?`AED ${(i/1e3).toFixed(1)}K`:`AED ${i}`;return h.jsxs(Ie,{title:"Cash & Bank Balance",className:"w-full h-[362px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),children:[h.jsx("div",{className:"flex flex-col gap-[12px]",children:t.map((i,o)=>h.jsxs("div",{className:"flex items-center justify-between bg-[#F9FAFB] rounded-[8px] p-[12px]",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"text-[14px] font-medium text-[#121212]",children:i.title}),h.jsx("div",{className:"!text-[12px] text-[#64748B]",children:i?.subtitle})]}),h.jsx("div",{className:"flex flex-col items-end",children:h.jsx("div",{className:"text-[14px] text-[#1FA05B] font-semibold",children:r(i.amount)})})]},o))}),h.jsxs("div",{className:"flex items-center justify-between border-t border-[#EBEBEB] h-[68px] px-[12px]",children:[h.jsx("div",{className:"text-[14px] font-medium text-[#121212]",children:"Total"}),h.jsx("div",{className:"text-[16px] text-[#1FA05B] font-bold",children:r(n)})]})]})};Kn.register(Ro,Io,Fl,Gr,li);const hfe=[{label:"Current Month",value:13e3,units:18},{label:"1-3 Months",value:9400,units:12},{label:"3-6 Months",value:8800,units:18},{label:"6+ Months",value:7200,units:6}],mfe=({data:e})=>{const t=Array.isArray(e?.items)&&e.items.length>0?e.items:Array.isArray(e)&&e.length>0?e:hfe,n=t.map(s=>s.label),r=t.map(s=>Number(s.value??0)),i=t.map(s=>Number(s.units??0)),o={labels:n,datasets:[{label:"Due",data:r,backgroundColor:"#EF4444",barThickness:60}]},a={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({titleFormatter:s=>s.title?.[0]||"",hideTitleForSingle:!1,rowsFormatter:s=>{const l=s.dataPoints?.[0];return l?[{label:"Due",value:`AED ${(Number(l.raw??0)/1e3).toFixed(1)}K`,color:l.dataset.backgroundColor},{label:"Units Count",value:`${i[l.dataIndex]??0}`,color:l.dataset.backgroundColor}]:[]}})}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B"}},y:{beginAtZero:!0,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",callback:s=>`${s/1e3}K`}}}};return h.jsxs(Ie,{title:"Dues Ageing",className:"w-full h-[362px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:[h.jsx("div",{className:"grid grid-cols-4 md:grid-cols-4 gap-[12px] h-[48px]",children:n.map((s,l)=>h.jsx("div",{className:"p-[8px] rounded-[8px] bg-slate-50",children:h.jsxs("div",{className:"flex justify-between items-start",children:[h.jsx("div",{className:"font-medium leading-[16px] !text-[12px] rounded",children:s}),h.jsxs("div",{className:"text-right",children:[h.jsxs("div",{className:"text-red-600 font-medium leading-[16px] !text-[12px]",children:["AED ",(r[l]/1e3).toFixed(1),"K"]}),h.jsxs("div",{className:" text-gray-500 leading-[14px] text-[10px]",children:[i[l]," Units"]})]})]})},s))}),h.jsx("div",{className:"h-[192px]",children:h.jsx(Bl,{data:o,options:a})})]})};Kn.register(A1,Gr,li);const gfe=[{label:"Maintenance",value:45e4,color:"#08B6D4"},{label:"Utilities",value:32e4,color:"#8B5CF6"},{label:"Security",value:28e4,color:"#EF4444"},{label:"Administration",value:18e4,color:"#F69E0A"},{label:"Others",value:12e4,color:"#12B981"}],vfe=({data:e})=>{const t=Array.isArray(e?.items)&&e.items.length>0?e.items:Array.isArray(e)&&e.length>0?e:gfe,n=t.map(l=>l.label),r=t.map(l=>Number(l.value??0)),i=t.map(l=>l.color),o={labels:n,datasets:[{label:"Expenses",data:r,backgroundColor:i,borderColor:"#FFFFFF",borderWidth:2,cutout:"70%"}]},a=r.reduce((l,c)=>l+c,0),s={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({rowsFormatter:l=>(l.dataPoints||[]).map(c=>({label:c.label,value:`AED ${c.formattedValue}`,color:Array.isArray(c.dataset.backgroundColor)?c.dataset.backgroundColor[c.dataIndex]:c.dataset.backgroundColor}))})}}};return h.jsxs(Ie,{title:"Expense Categories",className:"w-full h-[523px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:[h.jsxs("div",{className:"relative h-[259px] flex justify-center items-center",children:[h.jsx(R1,{data:o,options:s}),h.jsxs("div",{className:"absolute text-center",children:[h.jsxs("div",{className:"!text-[24px] font-medium leading-[28px] text-[#121212]",children:["AED ",(a/1e6).toFixed(2),"M"]}),h.jsx("div",{className:"text-[#121212] leading-[18px] text-[14px]",children:"Total Expenses"})]})]}),h.jsx("div",{className:"space-y-2",children:n.map((l,c)=>h.jsxs("div",{className:"flex justify-between items-center text-[14px] pb-2",children:[h.jsxs("div",{className:"flex items-center gap-[8px] !text-[12px] leading-[16px] text-[#64748B]",children:[h.jsx("div",{className:"w-[7px] h-[7px] rotate-45",style:{backgroundColor:o.datasets[0].backgroundColor[c]}}),l]}),h.jsxs("div",{className:"leading-[16px] !text-[12px] text-[#64748B]",children:["AED ",(r[c]/1e3).toFixed(0),"K"]})]},l))})]})};function En({image:e="https://cdni.iconscout.com/illustration/premium/thumb/businessman-sad-for-no-data-in-folder-illustration-svg-download-png-10155562.png",title:t="No Data Available",description:n="Catch up all the data. Change the date range to see the data."}){return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-[16px]",children:[h.jsx("img",{src:e,alt:"no data",className:"w-32 h-32 mb-4 opacity-80"}),h.jsx("div",{className:"text-[16px] font-semibold text-gray-900 mb-[4px]",children:t}),h.jsx("div",{className:"text-[12px] text-gray-500 max-w-[260px]",children:n})]})}const yfe=[{name:"Gym Equipment",value:1e6,color:"#08B6D4"},{name:"Security",value:8e5,color:"#EF4444"},{name:"Others",value:6e5,color:"#F59E0B"},{name:"Pool Maintenance",value:7e5,color:"#8B5CF6"},{name:"Administration",value:52e4,color:"#10B981"}];function bfe({data:e,currency:t="AED"}){const n=Array.isArray(e)&&e.length>0?e:yfe,r=n.reduce((o,a)=>o+Number(a.value??0),0);let i="";return r>=1e6?i=`${(r/1e6).toFixed(2)}M`:r>=1e3?i=`${(r/1e3).toFixed(2)}K`:i=r.toString(),h.jsx(Ie,{title:"Asset Value Breakdown",className:"h-[362px]",titleWeight:"semi-bold",children:r>0?h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"w-[214px] h-[181px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:n,innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",nameKey:"name",children:n.map((o,a)=>h.jsx(In,{fill:o.color},`cell-${a}`))}),h.jsx(Dt,{content:h.jsx(hs,{valueFormatter:o=>`${t} ${Number(o).toLocaleString()}`}),wrapperStyle:{zIndex:9999}})]})}),h.jsx("div",{className:"absolute inset-0 pointer-events-none flex flex-col items-center justify-center",children:h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"font-semibold text-[18px] leading-[12px] mb-[6px]",children:[t," ",i]}),h.jsx("div",{className:"text-[10px] leading-[12.59px] text-[#121212] mt-[6px]",children:"Total Assets"})]})})]}),h.jsxs("div",{className:"flex justify-between w-full px-[8px] sm:px-[12px] mt-4 text-[14px]",children:[h.jsx("div",{className:"flex flex-col gap-[8px]",children:n.slice(0,3).map(o=>h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"inline-block h-[7px] w-[7px] rotate-45",style:{backgroundColor:o.color}}),h.jsx("div",{className:"text-[#64748B] leading-[16px] !text-[12px]",children:o.name})]},o.name))}),h.jsx("div",{className:"flex flex-col gap-[8px] items-start",children:n.slice(3).map(o=>h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"inline-block h-[7px] w-[7px] rotate-45",style:{backgroundColor:o.color}}),h.jsx("div",{className:"text-[#64748B] leading-[16px] !text-[12px]",children:o.name})]},o.name))})]})]}):h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx(En,{})})})}Kn.register(Ro,Io,Fl,Gr,li);const xfe=[{label:"Gym",value:13e3,units:18},{label:"Parking",value:9400,units:12},{label:"Swimming Pool",value:8800,units:18},{label:"Community Hall",value:7200,units:6},{label:"Tennis Court",value:6e3,units:10}],wfe=({data:e})=>{const t=Array.isArray(e)&&e.length>0?e:xfe,n=t.map(s=>s.label),r=t.map(s=>Number(s.value??0)),i=t.map(s=>Number(s.units??0)),o={labels:n,datasets:[{label:"Due",data:r,backgroundColor:"#8B5CF6",barThickness:60}]},a={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({titleFormatter:s=>s.title?.[0]||"",hideTitleForSingle:!1,rowsFormatter:s=>{const l=s.dataPoints?.[0];return l?[{label:"Revenue",value:`AED ${(Number(l.raw??0)/1e3).toFixed(1)}K`,color:l.dataset.backgroundColor},{label:"Units Count",value:`${i[l.dataIndex]??0}`,color:l.dataset.backgroundColor}]:[]}})}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B"}},y:{beginAtZero:!0,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",callback:s=>`${s/1e3}K`}}}};return h.jsx(Ie,{title:"Revenue by Category",className:"w-full h-[362px]",titleWeight:"semi-bold",children:h.jsx(Bl,{data:o,options:a})})};function _fe(e){return tt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 5l0 2"},child:[]},{tag:"path",attr:{d:"M15 11l0 2"},child:[]},{tag:"path",attr:{d:"M15 17l0 2"},child:[]},{tag:"path",attr:{d:"M5 5h14a2 2 0 0 1 2 2v3a2 2 0 0 0 0 4v3a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-3a2 2 0 0 0 0 -4v-3a2 2 0 0 1 2 -2"},child:[]}]})(e)}function Efe(e){return tt({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M855.7 210.8l-42.4-42.4a8.03 8.03 0 0 0-11.3 0L168.3 801.9a8.03 8.03 0 0 0 0 11.3l42.4 42.4c3.1 3.1 8.2 3.1 11.3 0L855.6 222c3.2-3 3.2-8.1.1-11.2zM304 448c79.4 0 144-64.6 144-144s-64.6-144-144-144-144 64.6-144 144 64.6 144 144 144zm0-216c39.7 0 72 32.3 72 72s-32.3 72-72 72-72-32.3-72-72 32.3-72 72-72zm416 344c-79.4 0-144 64.6-144 144s64.6 144 144 144 144-64.6 144-144-64.6-144-144-144zm0 216c-39.7 0-72-32.3-72-72s32.3-72 72-72 72 32.3 72 72-32.3 72-72 72z"},child:[]}]})(e)}function Sfe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50"}){return h.jsxs(Ie,{title:e,icon:h.jsx("div",{className:"h-6 w-6 grid place-items-center",children:h.jsx(o,{className:`h-6 w-6 ${a}`})}),children:[h.jsx("div",{className:"text-4xl font-semibold tracking-tight text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] text-[14px]",children:[h.jsx("div",{className:i?"text-emerald-600 font-medium":"text-rose-600 font-medium",children:n}),h.jsx("div",{className:"text-slate-500",children:r})]})]})}const Ofe=[{title:"Total Bookings",value:160,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:ND,iconColor:"text-emerald-600"},{title:"Utilisation Rate",value:73,delta:"+2.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Efe,iconColor:"text-[#329DFF]"},{title:"Revenue",value:3,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:_fe,iconColor:"text-[#FA7E28]"},{title:"Pending Dues",value:5,delta:"-8.0%",deltaLabel:"Compared to last month",positive:!1,Icon:RD,iconColor:"text-[#DBB467]"}];function Cfe({data:e}){const t=Array.isArray(e)&&e.length>0?e:Ofe;return console.log(e,"carrrr"),h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[24px]",children:t.map((n,r)=>h.jsx(Sfe,{...n},r))})}/**
|
|
302
|
+
`):e}function Ade(e,t){const{element:n,datasetIndex:r,index:i}=t,o=e.getDatasetMeta(r).controller,{label:a,value:s}=o.getLabelAndValue(i);return{chart:e,label:a,parsed:o.getParsed(i),raw:e.data.datasets[r].data[i],formattedValue:s,dataset:o.getDataset(),dataIndex:i,datasetIndex:r,element:n}}function TP(e,t){const n=e.chart.ctx,{body:r,footer:i,title:o}=e,{boxWidth:a,boxHeight:s}=t,l=or(t.bodyFont),c=or(t.titleFont),u=or(t.footerFont),d=o.length,f=i.length,p=r.length,m=ii(t.padding);let g=m.height,v=0,x=r.reduce((y,E)=>y+E.before.length+E.lines.length+E.after.length,0);if(x+=e.beforeBody.length+e.afterBody.length,d&&(g+=d*c.lineHeight+(d-1)*t.titleSpacing+t.titleMarginBottom),x){const y=t.displayColors?Math.max(s,l.lineHeight):l.lineHeight;g+=p*y+(x-p)*l.lineHeight+(x-1)*t.bodySpacing}f&&(g+=t.footerMarginTop+f*u.lineHeight+(f-1)*t.footerSpacing);let _=0;const w=function(y){v=Math.max(v,n.measureText(y).width+_)};return n.save(),n.font=c.string,Ze(e.title,w),n.font=l.string,Ze(e.beforeBody.concat(e.afterBody),w),_=t.displayColors?a+2+t.boxPadding:0,Ze(r,y=>{Ze(y.before,w),Ze(y.lines,w),Ze(y.after,w)}),_=0,n.font=u.string,Ze(e.footer,w),n.restore(),v+=m.width,{width:v,height:g}}function Tde(e,t){const{y:n,height:r}=t;return n<r/2?"top":n>e.height-r/2?"bottom":"center"}function Mde(e,t,n,r){const{x:i,width:o}=r,a=n.caretSize+n.caretPadding;if(e==="left"&&i+o+a>t.width||e==="right"&&i-o-a<0)return!0}function Nde(e,t,n,r){const{x:i,width:o}=n,{width:a,chartArea:{left:s,right:l}}=e;let c="center";return r==="center"?c=i<=(s+l)/2?"left":"right":i<=o/2?c="left":i>=a-o/2&&(c="right"),Mde(c,e,t,n)&&(c="center"),c}function MP(e,t,n){const r=n.yAlign||t.yAlign||Tde(e,n);return{xAlign:n.xAlign||t.xAlign||Nde(e,t,n,r),yAlign:r}}function jde(e,t){let{x:n,width:r}=e;return t==="right"?n-=r:t==="center"&&(n-=r/2),n}function Rde(e,t,n){let{y:r,height:i}=e;return t==="top"?r+=n:t==="bottom"?r-=i+n:r-=i/2,r}function NP(e,t,n,r){const{caretSize:i,caretPadding:o,cornerRadius:a}=e,{xAlign:s,yAlign:l}=n,c=i+o,{topLeft:u,topRight:d,bottomLeft:f,bottomRight:p}=Ks(a);let m=jde(t,s);const g=Rde(t,l,c);return l==="center"?s==="left"?m+=c:s==="right"&&(m-=c):s==="left"?m-=Math.max(u,f)+i:s==="right"&&(m+=Math.max(d,p)+i),{x:Mn(m,0,r.width-t.width),y:Mn(g,0,r.height-t.height)}}function ef(e,t,n){const r=ii(n.padding);return t==="center"?e.x+e.width/2:t==="right"?e.x+e.width-r.right:e.x+r.left}function jP(e){return fi([],Qi(e))}function Ide(e,t,n){return bs(e,{tooltip:t,tooltipItems:n,type:"tooltip"})}function RP(e,t){const n=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return n?e.override(n):e}const kI={beforeTitle:Gi,title(e){if(e.length>0){const t=e[0],n=t.chart.data.labels,r=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return t.dataset.label||"";if(t.label)return t.label;if(r>0&&t.dataIndex<r)return n[t.dataIndex]}return""},afterTitle:Gi,beforeBody:Gi,beforeLabel:Gi,label(e){if(this&&this.options&&this.options.mode==="dataset")return e.label+": "+e.formattedValue||e.formattedValue;let t=e.dataset.label||"";t&&(t+=": ");const n=e.formattedValue;return Ke(n)||(t+=n),t},labelColor(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.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(e){const n=e.chart.getDatasetMeta(e.datasetIndex).controller.getStyle(e.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Gi,afterBody:Gi,beforeFooter:Gi,footer:Gi,afterFooter:Gi};function Xn(e,t,n,r){const i=e[t].call(n,r);return typeof i>"u"?kI[t].call(n,r):i}class IP extends ha{static positioners=Sc;constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const t=this._cachedAnimations;if(t)return t;const n=this.chart,r=this.options.setContext(this.getContext()),i=r.enabled&&n.options.animation&&r.animations,o=new fI(this.chart,i);return i._cacheable&&(this._cachedAnimations=Object.freeze(o)),o}getContext(){return this.$context||(this.$context=Ide(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,n){const{callbacks:r}=n,i=Xn(r,"beforeTitle",this,t),o=Xn(r,"title",this,t),a=Xn(r,"afterTitle",this,t);let s=[];return s=fi(s,Qi(i)),s=fi(s,Qi(o)),s=fi(s,Qi(a)),s}getBeforeBody(t,n){return jP(Xn(n.callbacks,"beforeBody",this,t))}getBody(t,n){const{callbacks:r}=n,i=[];return Ze(t,o=>{const a={before:[],lines:[],after:[]},s=RP(r,o);fi(a.before,Qi(Xn(s,"beforeLabel",this,o))),fi(a.lines,Xn(s,"label",this,o)),fi(a.after,Qi(Xn(s,"afterLabel",this,o))),i.push(a)}),i}getAfterBody(t,n){return jP(Xn(n.callbacks,"afterBody",this,t))}getFooter(t,n){const{callbacks:r}=n,i=Xn(r,"beforeFooter",this,t),o=Xn(r,"footer",this,t),a=Xn(r,"afterFooter",this,t);let s=[];return s=fi(s,Qi(i)),s=fi(s,Qi(o)),s=fi(s,Qi(a)),s}_createItems(t){const n=this._active,r=this.chart.data,i=[],o=[],a=[];let s=[],l,c;for(l=0,c=n.length;l<c;++l)s.push(Ade(this.chart,n[l]));return t.filter&&(s=s.filter((u,d,f)=>t.filter(u,d,f,r))),t.itemSort&&(s=s.sort((u,d)=>t.itemSort(u,d,r))),Ze(s,u=>{const d=RP(t.callbacks,u);i.push(Xn(d,"labelColor",this,u)),o.push(Xn(d,"labelPointStyle",this,u)),a.push(Xn(d,"labelTextColor",this,u))}),this.labelColors=i,this.labelPointStyles=o,this.labelTextColors=a,this.dataPoints=s,s}update(t,n){const r=this.options.setContext(this.getContext()),i=this._active;let o,a=[];if(!i.length)this.opacity!==0&&(o={opacity:0});else{const s=Sc[r.position].call(this,i,this._eventPosition);a=this._createItems(r),this.title=this.getTitle(a,r),this.beforeBody=this.getBeforeBody(a,r),this.body=this.getBody(a,r),this.afterBody=this.getAfterBody(a,r),this.footer=this.getFooter(a,r);const l=this._size=TP(this,r),c=Object.assign({},s,l),u=MP(this.chart,r,c),d=NP(r,c,u,this.chart);this.xAlign=u.xAlign,this.yAlign=u.yAlign,o={opacity:1,x:d.x,y:d.y,width:l.width,height:l.height,caretX:s.x,caretY:s.y}}this._tooltipItems=a,this.$context=void 0,o&&this._resolveAnimations().update(this,o),t&&r.external&&r.external.call(this,{chart:this.chart,tooltip:this,replay:n})}drawCaret(t,n,r,i){const o=this.getCaretPosition(t,r,i);n.lineTo(o.x1,o.y1),n.lineTo(o.x2,o.y2),n.lineTo(o.x3,o.y3)}getCaretPosition(t,n,r){const{xAlign:i,yAlign:o}=this,{caretSize:a,cornerRadius:s}=r,{topLeft:l,topRight:c,bottomLeft:u,bottomRight:d}=Ks(s),{x:f,y:p}=t,{width:m,height:g}=n;let v,x,_,w,y,E;return o==="center"?(y=p+g/2,i==="left"?(v=f,x=v-a,w=y+a,E=y-a):(v=f+m,x=v+a,w=y-a,E=y+a),_=v):(i==="left"?x=f+Math.max(l,u)+a:i==="right"?x=f+m-Math.max(c,d)-a:x=this.caretX,o==="top"?(w=p,y=w-a,v=x-a,_=x+a):(w=p+g,y=w+a,v=x+a,_=x-a),E=w),{x1:v,x2:x,x3:_,y1:w,y2:y,y3:E}}drawTitle(t,n,r){const i=this.title,o=i.length;let a,s,l;if(o){const c=qs(r.rtl,this.x,this.width);for(t.x=ef(this,r.titleAlign,r),n.textAlign=c.textAlign(r.titleAlign),n.textBaseline="middle",a=or(r.titleFont),s=r.titleSpacing,n.fillStyle=r.titleColor,n.font=a.string,l=0;l<o;++l)n.fillText(i[l],c.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+s,l+1===o&&(t.y+=r.titleMarginBottom-s)}}_drawColorBox(t,n,r,i,o){const a=this.labelColors[r],s=this.labelPointStyles[r],{boxHeight:l,boxWidth:c}=o,u=or(o.bodyFont),d=ef(this,"left",o),f=i.x(d),p=l<u.lineHeight?(u.lineHeight-l)/2:0,m=n.y+p;if(o.usePointStyle){const g={radius:Math.min(c,l)/2,pointStyle:s.pointStyle,rotation:s.rotation,borderWidth:1},v=i.leftForLtr(f,c)+c/2,x=m+l/2;t.strokeStyle=o.multiKeyBackground,t.fillStyle=o.multiKeyBackground,cb(t,g,v,x),t.strokeStyle=a.borderColor,t.fillStyle=a.backgroundColor,cb(t,g,v,x)}else{t.lineWidth=Re(a.borderWidth)?Math.max(...Object.values(a.borderWidth)):a.borderWidth||1,t.strokeStyle=a.borderColor,t.setLineDash(a.borderDash||[]),t.lineDashOffset=a.borderDashOffset||0;const g=i.leftForLtr(f,c),v=i.leftForLtr(i.xPlus(f,1),c-2),x=Ks(a.borderRadius);Object.values(x).some(_=>_!==0)?(t.beginPath(),t.fillStyle=o.multiKeyBackground,Ip(t,{x:g,y:m,w:c,h:l,radius:x}),t.fill(),t.stroke(),t.fillStyle=a.backgroundColor,t.beginPath(),Ip(t,{x:v,y:m+1,w:c-2,h:l-2,radius:x}),t.fill()):(t.fillStyle=o.multiKeyBackground,t.fillRect(g,m,c,l),t.strokeRect(g,m,c,l),t.fillStyle=a.backgroundColor,t.fillRect(v,m+1,c-2,l-2))}t.fillStyle=this.labelTextColors[r]}drawBody(t,n,r){const{body:i}=this,{bodySpacing:o,bodyAlign:a,displayColors:s,boxHeight:l,boxWidth:c,boxPadding:u}=r,d=or(r.bodyFont);let f=d.lineHeight,p=0;const m=qs(r.rtl,this.x,this.width),g=function(D){n.fillText(D,m.x(t.x+p),t.y+f/2),t.y+=f+o},v=m.textAlign(a);let x,_,w,y,E,S,k;for(n.textAlign=a,n.textBaseline="middle",n.font=d.string,t.x=ef(this,v,r),n.fillStyle=r.bodyColor,Ze(this.beforeBody,g),p=s&&v!=="right"?a==="center"?c/2+u:c+2+u:0,y=0,S=i.length;y<S;++y){for(x=i[y],_=this.labelTextColors[y],n.fillStyle=_,Ze(x.before,g),w=x.lines,s&&w.length&&(this._drawColorBox(n,t,y,m,r),f=Math.max(d.lineHeight,l)),E=0,k=w.length;E<k;++E)g(w[E]),f=d.lineHeight;Ze(x.after,g)}p=0,f=d.lineHeight,Ze(this.afterBody,g),t.y-=o}drawFooter(t,n,r){const i=this.footer,o=i.length;let a,s;if(o){const l=qs(r.rtl,this.x,this.width);for(t.x=ef(this,r.footerAlign,r),t.y+=r.footerMarginTop,n.textAlign=l.textAlign(r.footerAlign),n.textBaseline="middle",a=or(r.footerFont),n.fillStyle=r.footerColor,n.font=a.string,s=0;s<o;++s)n.fillText(i[s],l.x(t.x),t.y+a.lineHeight/2),t.y+=a.lineHeight+r.footerSpacing}}drawBackground(t,n,r,i){const{xAlign:o,yAlign:a}=this,{x:s,y:l}=t,{width:c,height:u}=r,{topLeft:d,topRight:f,bottomLeft:p,bottomRight:m}=Ks(i.cornerRadius);n.fillStyle=i.backgroundColor,n.strokeStyle=i.borderColor,n.lineWidth=i.borderWidth,n.beginPath(),n.moveTo(s+d,l),a==="top"&&this.drawCaret(t,n,r,i),n.lineTo(s+c-f,l),n.quadraticCurveTo(s+c,l,s+c,l+f),a==="center"&&o==="right"&&this.drawCaret(t,n,r,i),n.lineTo(s+c,l+u-m),n.quadraticCurveTo(s+c,l+u,s+c-m,l+u),a==="bottom"&&this.drawCaret(t,n,r,i),n.lineTo(s+p,l+u),n.quadraticCurveTo(s,l+u,s,l+u-p),a==="center"&&o==="left"&&this.drawCaret(t,n,r,i),n.lineTo(s,l+d),n.quadraticCurveTo(s,l,s+d,l),n.closePath(),n.fill(),i.borderWidth>0&&n.stroke()}_updateAnimationTarget(t){const n=this.chart,r=this.$animations,i=r&&r.x,o=r&&r.y;if(i||o){const a=Sc[t.position].call(this,this._active,this._eventPosition);if(!a)return;const s=this._size=TP(this,t),l=Object.assign({},a,this._size),c=MP(n,t,l),u=NP(t,l,c,n);(i._to!==u.x||o._to!==u.y)&&(this.xAlign=c.xAlign,this.yAlign=c.yAlign,this.width=s.width,this.height=s.height,this.caretX=a.x,this.caretY=a.y,this._resolveAnimations().update(this,u))}}_willRender(){return!!this.opacity}draw(t){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},o={x:this.x,y:this.y};r=Math.abs(r)<.001?0:r;const a=ii(n.padding),s=this.title.length||this.beforeBody.length||this.body.length||this.afterBody.length||this.footer.length;n.enabled&&s&&(t.save(),t.globalAlpha=r,this.drawBackground(o,t,i,n),cI(t,n.textDirection),o.y+=a.top,this.drawTitle(o,t,n),this.drawBody(o,t,n),this.drawFooter(o,t,n),uI(t,n.textDirection),t.restore())}getActiveElements(){return this._active||[]}setActiveElements(t,n){const r=this._active,i=t.map(({datasetIndex:s,index:l})=>{const c=this.chart.getDatasetMeta(s);if(!c)throw new Error("Cannot find a dataset at index "+s);return{datasetIndex:s,element:c.data[l],index:l}}),o=!Mp(r,i),a=this._positionChanged(i,n);(o||a)&&(this._active=i,this._eventPosition=n,this._ignoreReplayEvents=!0,this.update(!0))}handleEvent(t,n,r=!0){if(n&&this._ignoreReplayEvents)return!1;this._ignoreReplayEvents=!1;const i=this.options,o=this._active||[],a=this._getActiveElements(t,o,n,r),s=this._positionChanged(a,t),l=n||!Mp(a,o)||s;return l&&(this._active=a,(i.enabled||i.external)&&(this._eventPosition={x:t.x,y:t.y},this.update(!0,n))),l}_getActiveElements(t,n,r,i){const o=this.options;if(t.type==="mouseout")return[];if(!i)return n.filter(s=>this.chart.data.datasets[s.datasetIndex]&&this.chart.getDatasetMeta(s.datasetIndex).controller.getParsed(s.index)!==void 0);const a=this.chart.getElementsAtEventForMode(t,o.mode,o,r);return o.reverse&&a.reverse(),a}_positionChanged(t,n){const{caretX:r,caretY:i,options:o}=this,a=Sc[o.position].call(this,t,n);return a!==!1&&(r!==a.x||i!==a.y)}}var Gr={id:"tooltip",_element:IP,positioners:Sc,afterInit(e,t,n){n&&(e.tooltip=new IP({chart:e,options:n}))},beforeUpdate(e,t,n){e.tooltip&&e.tooltip.initialize(n)},reset(e,t,n){e.tooltip&&e.tooltip.initialize(n)},afterDraw(e){const t=e.tooltip;if(t&&t._willRender()){const n={tooltip:t};if(e.notifyPlugins("beforeTooltipDraw",{...n,cancelable:!0})===!1)return;t.draw(e.ctx),e.notifyPlugins("afterTooltipDraw",n)}},afterEvent(e,t){if(e.tooltip){const n=t.replay;e.tooltip.handleEvent(t.event,n,t.inChartArea)&&(t.changed=!0)}},defaults:{enabled:!0,external:null,position:"average",backgroundColor:"rgba(0,0,0,0.8)",titleColor:"#fff",titleFont:{weight:"bold"},titleSpacing:2,titleMarginBottom:6,titleAlign:"left",bodyColor:"#fff",bodySpacing:2,bodyFont:{},bodyAlign:"left",footerColor:"#fff",footerSpacing:2,footerMarginTop:6,footerFont:{weight:"bold"},footerAlign:"left",padding:6,caretPadding:2,caretSize:5,cornerRadius:6,boxHeight:(e,t)=>t.bodyFont.size,boxWidth:(e,t)=>t.bodyFont.size,multiKeyBackground:"#fff",displayColors:!0,boxPadding:0,borderColor:"rgba(0,0,0,0)",borderWidth:0,animation:{duration:400,easing:"easeOutQuart"},animations:{numbers:{type:"number",properties:["x","y","width","height","caretX","caretY"]},opacity:{easing:"linear",duration:200}},callbacks:kI},defaultRoutes:{bodyFont:"font",footerFont:"font",titleFont:"font"},descriptors:{_scriptable:e=>e!=="filter"&&e!=="itemSort"&&e!=="external",_indexable:!1,callbacks:{_scriptable:!1,_indexable:!1},animation:{_fallback:!1},animations:{_fallback:"animation"}},additionalOptionScopes:["interaction"]};const Lde=(e,t,n,r)=>(typeof t=="string"?(n=e.push(t)-1,r.unshift({index:n,label:t})):isNaN(t)&&(n=null),n);function $de(e,t,n,r){const i=e.indexOf(t);if(i===-1)return Lde(e,t,n,r);const o=e.lastIndexOf(t);return i!==o?n:i}const Fde=(e,t)=>e===null?null:Mn(Math.round(e),0,t);function LP(e){const t=this.getLabels();return e>=0&&e<t.length?t[e]:e}class Ro extends $l{static id="category";static defaults={ticks:{callback:LP}};constructor(t){super(t),this._startValue=void 0,this._valueRange=0,this._addedLabels=[]}init(t){const n=this._addedLabels;if(n.length){const r=this.getLabels();for(const{index:i,label:o}of n)r[i]===o&&r.splice(i,1);this._addedLabels=[]}super.init(t)}parse(t,n){if(Ke(t))return null;const r=this.getLabels();return n=isFinite(n)&&r[n]===t?n:$de(r,t,Se(n,t),this._addedLabels),Fde(n,r.length-1)}determineDataLimits(){const{minDefined:t,maxDefined:n}=this.getUserBounds();let{min:r,max:i}=this.getMinMax(!0);this.options.bounds==="ticks"&&(t||(r=0),n||(i=this.getLabels().length-1)),this.min=r,this.max=i}buildTicks(){const t=this.min,n=this.max,r=this.options.offset,i=[];let o=this.getLabels();o=t===0&&n===o.length-1?o:o.slice(t,n+1),this._valueRange=Math.max(o.length-(r?0:1),1),this._startValue=this.min-(r?.5:0);for(let a=t;a<=n;a++)i.push({value:a});return i}getLabelForValue(t){return LP.call(this,t)}configure(){super.configure(),this.isHorizontal()||(this._reversePixels=!this._reversePixels)}getPixelForValue(t){return typeof t!="number"&&(t=this.parse(t)),t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getPixelForTick(t){const n=this.ticks;return t<0||t>n.length-1?null:this.getPixelForValue(n[t].value)}getValueForPixel(t){return Math.round(this._startValue+this.getDecimalForPixel(t)*this._valueRange)}getBasePixel(){return this.bottom}}function Bde(e,t){const n=[],{bounds:i,step:o,min:a,max:s,precision:l,count:c,maxTicks:u,maxDigits:d,includeBounds:f}=e,p=o||1,m=u-1,{min:g,max:v}=t,x=!Ke(a),_=!Ke(s),w=!Ke(c),y=(v-g)/(d+1);let E=$C((v-g)/m/p)*p,S,k,D,T;if(E<1e-14&&!x&&!_)return[{value:g},{value:v}];T=Math.ceil(v/E)-Math.floor(g/E),T>m&&(E=$C(T*E/m/p)*p),Ke(l)||(S=Math.pow(10,l),E=Math.ceil(E*S)/S),i==="ticks"?(k=Math.floor(g/E)*E,D=Math.ceil(v/E)*E):(k=g,D=v),x&&_&&o&&sle((s-a)/o,E/1e3)?(T=Math.round(Math.min((s-a)/E,u)),E=(s-a)/T,k=a,D=s):w?(k=x?a:k,D=_?s:D,T=c-1,E=(D-k)/T):(T=(D-k)/E,Nc(T,Math.round(T),E/1e3)?T=Math.round(T):T=Math.ceil(T));const R=Math.max(FC(E),FC(k));S=Math.pow(10,Ke(l)?R:l),k=Math.round(k*S)/S,D=Math.round(D*S)/S;let A=0;for(x&&(f&&k!==a?(n.push({value:a}),k<a&&A++,Nc(Math.round((k+A*E)*S)/S,a,$P(a,y,e))&&A++):k<a&&A++);A<T;++A){const C=Math.round((k+A*E)*S)/S;if(_&&C>s)break;n.push({value:C})}return _&&f&&D!==s?n.length&&Nc(n[n.length-1].value,s,$P(s,y,e))?n[n.length-1].value=s:n.push({value:s}):(!_||D===s)&&n.push({value:D}),n}function $P(e,t,{horizontal:n,minRotation:r}){const i=lo(r),o=(n?Math.sin(i):Math.cos(i))||.001,a=.75*t*(""+e).length;return Math.min(t/o,a)}class Wde extends $l{constructor(t){super(t),this.start=void 0,this.end=void 0,this._startValue=void 0,this._endValue=void 0,this._valueRange=0}parse(t,n){return Ke(t)||(typeof t=="number"||t instanceof Number)&&!isFinite(+t)?null:+t}handleTickRangeOptions(){const{beginAtZero:t}=this.options,{minDefined:n,maxDefined:r}=this.getUserBounds();let{min:i,max:o}=this;const a=l=>i=n?i:l,s=l=>o=r?o:l;if(t){const l=Ti(i),c=Ti(o);l<0&&c<0?s(0):l>0&&c>0&&a(0)}if(i===o){let l=o===0?1:Math.abs(o*.05);s(o+l),t||a(i-l)}this.min=i,this.max=o}getTickLimit(){const t=this.options.ticks;let{maxTicksLimit:n,stepSize:r}=t,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 t=this.options,n=t.ticks;let r=this.getTickLimit();r=Math.max(2,r);const i={maxTicks:r,bounds:t.bounds,min:t.min,max:t.max,precision:n.precision,step:n.stepSize,count:n.count,maxDigits:this._maxDigits(),horizontal:this.isHorizontal(),minRotation:n.minRotation||0,includeBounds:n.includeBounds!==!1},o=this._range||this,a=Bde(i,o);return t.bounds==="ticks"&&lle(a,this,"value"),t.reverse?(a.reverse(),this.start=this.max,this.end=this.min):(this.start=this.min,this.end=this.max),a}configure(){const t=this.ticks;let n=this.min,r=this.max;if(super.configure(),this.options.offset&&t.length){const i=(r-n)/Math.max(t.length-1,1)/2;n-=i,r+=i}this._startValue=n,this._endValue=r,this._valueRange=r-n}getLabelForValue(t){return x1(t,this.chart.options.locale,this.options.ticks.format)}}class Io extends Wde{static id="linear";static defaults={ticks:{callback:tI.formatters.numeric}};determineDataLimits(){const{min:t,max:n}=this.getMinMax(!0);this.min=Yr(t)?t:0,this.max=Yr(n)?n:1,this.handleTickRangeOptions()}computeTickLimit(){const t=this.isHorizontal(),n=t?this.width:this.height,r=lo(this.options.ticks.minRotation),i=(t?Math.sin(r):Math.cos(r))||.001,o=this._resolveTickFontOptions(0);return Math.ceil(n/Math.min(40,o.lineHeight/i))}getPixelForValue(t){return t===null?NaN:this.getPixelForDecimal((t-this._startValue)/this._valueRange)}getValueForPixel(t){return this._startValue+this.getDecimalForPixel(t)*this._valueRange}}const um={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}},nr=Object.keys(um);function FP(e,t){return e-t}function BP(e,t){if(Ke(t))return null;const n=e._adapter,{parser:r,round:i,isoWeekday:o}=e._parseOpts;let a=t;return typeof r=="function"&&(a=r(a)),Yr(a)||(a=typeof r=="string"?n.parse(a,r):n.parse(a)),a===null?null:(i&&(a=i==="week"&&(fu(o)||o===!0)?n.startOf(a,"isoWeek",o):n.startOf(a,i)),+a)}function WP(e,t,n,r){const i=nr.length;for(let o=nr.indexOf(e);o<i-1;++o){const a=um[nr[o]],s=a.steps?a.steps:Number.MAX_SAFE_INTEGER;if(a.common&&Math.ceil((n-t)/(s*a.size))<=r)return nr[o]}return nr[i-1]}function Vde(e,t,n,r,i){for(let o=nr.length-1;o>=nr.indexOf(n);o--){const a=nr[o];if(um[a].common&&e._adapter.diff(i,r,a)>=t-1)return a}return nr[n?nr.indexOf(n):0]}function zde(e){for(let t=nr.indexOf(e)+1,n=nr.length;t<n;++t)if(um[nr[t]].common)return nr[t]}function VP(e,t,n){if(!n)e[t]=!0;else if(n.length){const{lo:r,hi:i}=y1(n,t),o=n[r]>=t?n[r]:n[i];e[o]=!0}}function Hde(e,t,n,r){const i=e._adapter,o=+i.startOf(t[0].value,r),a=t[t.length-1].value;let s,l;for(s=o;s<=a;s=+i.add(s,1,r))l=n[s],l>=0&&(t[l].major=!0);return t}function zP(e,t,n){const r=[],i={},o=t.length;let a,s;for(a=0;a<o;++a)s=t[a],i[s]=a,r.push({value:s,major:!1});return o===0||!n?r:Hde(e,r,i,n)}class HP extends $l{static id="time";static defaults={bounds:"data",adapters:{},time:{parser:!1,unit:!1,round:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{}},ticks:{source:"auto",callback:!1,major:{enabled:!1}}};constructor(t){super(t),this._cache={data:[],labels:[],all:[]},this._unit="day",this._majorUnit=void 0,this._offsets={},this._normalized=!1,this._parseOpts=void 0}init(t,n={}){const r=t.time||(t.time={}),i=this._adapter=new Xce._date(t.adapters.date);i.init(n),Mc(r.displayFormats,i.formats()),this._parseOpts={parser:r.parser,round:r.round,isoWeekday:r.isoWeekday},super.init(t),this._normalized=n.normalized}parse(t,n){return t===void 0?null:BP(this,t)}beforeLayout(){super.beforeLayout(),this._cache={data:[],labels:[],all:[]}}determineDataLimits(){const t=this.options,n=this._adapter,r=t.time.unit||"day";let{min:i,max:o,minDefined:a,maxDefined:s}=this.getUserBounds();function l(c){!a&&!isNaN(c.min)&&(i=Math.min(i,c.min)),!s&&!isNaN(c.max)&&(o=Math.max(o,c.max))}(!a||!s)&&(l(this._getLabelBounds()),(t.bounds!=="ticks"||t.ticks.source!=="labels")&&l(this.getMinMax(!1))),i=Yr(i)&&!isNaN(i)?i:+n.startOf(Date.now(),r),o=Yr(o)&&!isNaN(o)?o:+n.endOf(Date.now(),r)+1,this.min=Math.min(i,o-1),this.max=Math.max(i+1,o)}_getLabelBounds(){const t=this.getLabelTimestamps();let n=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY;return t.length&&(n=t[0],r=t[t.length-1]),{min:n,max:r}}buildTicks(){const t=this.options,n=t.time,r=t.ticks,i=r.source==="labels"?this.getLabelTimestamps():this._generate();t.bounds==="ticks"&&i.length&&(this.min=this._userMin||i[0],this.max=this._userMax||i[i.length-1]);const o=this.min,a=this.max,s=ple(i,o,a);return this._unit=n.unit||(r.autoSkip?WP(n.minUnit,this.min,this.max,this._getLabelCapacity(o)):Vde(this,s.length,n.minUnit,this.min,this.max)),this._majorUnit=!r.major.enabled||this._unit==="year"?void 0:zde(this._unit),this.initOffsets(i),t.reverse&&s.reverse(),zP(this,s,this._majorUnit)}afterAutoSkip(){this.options.offsetAfterAutoskip&&this.initOffsets(this.ticks.map(t=>+t.value))}initOffsets(t=[]){let n=0,r=0,i,o;this.options.offset&&t.length&&(i=this.getDecimalForValue(t[0]),t.length===1?n=1-i:n=(this.getDecimalForValue(t[1])-i)/2,o=this.getDecimalForValue(t[t.length-1]),t.length===1?r=o:r=(o-this.getDecimalForValue(t[t.length-2]))/2);const a=t.length<3?.5:.25;n=Mn(n,0,a),r=Mn(r,0,a),this._offsets={start:n,end:r,factor:1/(n+1+r)}}_generate(){const t=this._adapter,n=this.min,r=this.max,i=this.options,o=i.time,a=o.unit||WP(o.minUnit,n,r,this._getLabelCapacity(n)),s=Se(i.ticks.stepSize,1),l=a==="week"?o.isoWeekday:!1,c=fu(l)||l===!0,u={};let d=n,f,p;if(c&&(d=+t.startOf(d,"isoWeek",l)),d=+t.startOf(d,c?"day":a),t.diff(r,n,a)>1e5*s)throw new Error(n+" and "+r+" are too far apart with stepSize of "+s+" "+a);const m=i.ticks.source==="data"&&this.getDataTimestamps();for(f=d,p=0;f<r;f=+t.add(f,s,a),p++)VP(u,f,m);return(f===r||i.bounds==="ticks"||p===1)&&VP(u,f,m),Object.keys(u).sort(FP).map(g=>+g)}getLabelForValue(t){const n=this._adapter,r=this.options.time;return r.tooltipFormat?n.format(t,r.tooltipFormat):n.format(t,r.displayFormats.datetime)}format(t,n){const i=this.options.time.displayFormats,o=this._unit,a=n||i[o];return this._adapter.format(t,a)}_tickFormatFunction(t,n,r,i){const o=this.options,a=o.ticks.callback;if(a)return ht(a,[t,n,r],this);const s=o.time.displayFormats,l=this._unit,c=this._majorUnit,u=l&&s[l],d=c&&s[c],f=r[n],p=c&&d&&f&&f.major;return this._adapter.format(t,i||(p?d:u))}generateTickLabels(t){let n,r,i;for(n=0,r=t.length;n<r;++n)i=t[n],i.label=this._tickFormatFunction(i.value,n,t)}getDecimalForValue(t){return t===null?NaN:(t-this.min)/(this.max-this.min)}getPixelForValue(t){const n=this._offsets,r=this.getDecimalForValue(t);return this.getPixelForDecimal((n.start+r)*n.factor)}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return this.min+r*(this.max-this.min)}_getLabelSize(t){const n=this.options.ticks,r=this.ctx.measureText(t).width,i=lo(this.isHorizontal()?n.maxRotation:n.minRotation),o=Math.cos(i),a=Math.sin(i),s=this._resolveTickFontOptions(0).size;return{w:r*o+s*a,h:r*a+s*o}}_getLabelCapacity(t){const n=this.options.time,r=n.displayFormats,i=r[n.unit]||r.millisecond,o=this._tickFormatFunction(t,0,zP(this,[t],this._majorUnit),i),a=this._getLabelSize(o),s=Math.floor(this.isHorizontal()?this.width/a.w:this.height/a.h)-1;return s>0?s:1}getDataTimestamps(){let t=this._cache.data||[],n,r;if(t.length)return t;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)t=t.concat(i[n].controller.getAllParsedValues(this));return this._cache.data=this.normalize(t)}getLabelTimestamps(){const t=this._cache.labels||[];let n,r;if(t.length)return t;const i=this.getLabels();for(n=0,r=i.length;n<r;++n)t.push(BP(this,i[n]));return this._cache.labels=this._normalized?t:this.normalize(t)}normalize(t){return QR(t.sort(FP))}}function tf(e,t,n){let r=0,i=e.length-1,o,a,s,l;n?(t>=e[r].pos&&t<=e[i].pos&&({lo:r,hi:i}=za(e,"pos",t)),{pos:o,time:s}=e[r],{pos:a,time:l}=e[i]):(t>=e[r].time&&t<=e[i].time&&({lo:r,hi:i}=za(e,"time",t)),{time:o,pos:s}=e[r],{time:a,pos:l}=e[i]);const c=a-o;return c?s+(l-s)*(t-o)/c:s}class Uhe extends HP{static id="timeseries";static defaults=HP.defaults;constructor(t){super(t),this._table=[],this._minPos=void 0,this._tableRange=void 0}initOffsets(){const t=this._getTimestampsForTable(),n=this._table=this.buildLookupTable(t);this._minPos=tf(n,this.min),this._tableRange=tf(n,this.max)-this._minPos,super.initOffsets(t)}buildLookupTable(t){const{min:n,max:r}=this,i=[],o=[];let a,s,l,c,u;for(a=0,s=t.length;a<s;++a)c=t[a],c>=n&&c<=r&&i.push(c);if(i.length<2)return[{time:n,pos:0},{time:r,pos:1}];for(a=0,s=i.length;a<s;++a)u=i[a+1],l=i[a-1],c=i[a],Math.round((u+l)/2)!==c&&o.push({time:c,pos:a/(s-1)});return o}_generate(){const t=this.min,n=this.max;let r=super.getDataTimestamps();return(!r.includes(t)||!r.length)&&r.splice(0,0,t),(!r.includes(n)||r.length===1)&&r.push(n),r.sort((i,o)=>i-o)}_getTimestampsForTable(){let t=this._cache.all||[];if(t.length)return t;const n=this.getDataTimestamps(),r=this.getLabelTimestamps();return n.length&&r.length?t=this.normalize(n.concat(r)):t=n.length?n:r,t=this._cache.all=t,t}getDecimalForValue(t){return(tf(this._table,t)-this._minPos)/this._tableRange}getValueForPixel(t){const n=this._offsets,r=this.getDecimalForPixel(t)/n.factor-n.end;return tf(this._table,r*this._tableRange+this._minPos,!0)}}const DI="label";function YP(e,t){typeof e=="function"?e(t):e&&(e.current=t)}function Yde(e,t){const n=e.options;n&&t&&Object.assign(n,t)}function AI(e,t){e.labels=t}function TI(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:DI;const r=[];e.datasets=t.map(i=>{const o=e.datasets.find(a=>a[n]===i[n]);return!o||!i.data||r.includes(o)?{...i}:(r.push(o),Object.assign(o,i),o)})}function Ude(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:DI;const n={labels:[],datasets:[]};return AI(n,e.labels),TI(n,e.datasets,t),n}function Kde(e,t){const{height:n=150,width:r=300,redraw:i=!1,datasetIdKey:o,type:a,data:s,options:l,plugins:c=[],fallbackContent:u,updateMode:d,...f}=e,p=P.useRef(null),m=P.useRef(null),g=()=>{p.current&&(m.current=new Kn(p.current,{type:a,data:Ude(s,o),options:l&&{...l},plugins:c}),YP(t,m.current))},v=()=>{YP(t,null),m.current&&(m.current.destroy(),m.current=null)};return P.useEffect(()=>{!i&&m.current&&l&&Yde(m.current,l)},[i,l]),P.useEffect(()=>{!i&&m.current&&AI(m.current.config.data,s.labels)},[i,s.labels]),P.useEffect(()=>{!i&&m.current&&s.datasets&&TI(m.current.config.data,s.datasets,o)},[i,s.datasets]),P.useEffect(()=>{m.current&&(i?(v(),setTimeout(g)):m.current.update(d))},[i,l,s.labels,s.datasets,d]),P.useEffect(()=>{m.current&&(v(),setTimeout(g))},[a]),P.useEffect(()=>(g(),()=>v()),[]),P.createElement("canvas",{ref:p,role:"img",height:n,width:r,...f},u)}const qde=P.forwardRef(Kde);function N1(e,t){return Kn.register(t),P.forwardRef((n,r)=>P.createElement(qde,{...n,ref:r,type:e}))}const j1=N1("line",Gce),Bl=N1("bar",Uce),R1=N1("doughnut",qce);Kn.register(A1,Gr,li);const Gde={id:"bottomGlow",afterDatasetsDraw(e,t,n){if(!n?.enabled)return;const r=e.getDatasetMeta(0);if(!r?.data?.[0])return;const{ctx:i}=e,{x:o,y:a,innerRadius:s}=r.data[0],l=Math.max(s-2,0),c=a+l*.9,u=i.createRadialGradient(o,c,0,o,c,l*1.08);u.addColorStop(0,n.color??"rgba(186, 230, 253, 0.72)"),u.addColorStop(.3,"rgba(186, 230, 253, 0.4)"),u.addColorStop(.58,"rgba(186, 230, 253, 0.16)"),u.addColorStop(1,"rgba(186, 230, 253, 0)"),i.save(),i.beginPath(),i.arc(o,a,l,0,Math.PI*2),i.clip(),i.fillStyle=u,i.beginPath(),i.ellipse(o,c,l*1.08,l*.52,0,0,Math.PI*2),i.fill(),i.restore()}},Xde={id:"centerText",afterDraw(e,t,n){const{ctx:r}=e,i=e.getDatasetMeta(0);if(!i?.data?.[0])return;const{x:o,y:a}=i.data[0],{top:s="",bottom:l="",topSize:c=24,bottomSize:u=9,topColor:d="#121212",bottomColor:f="#121212"}=n||{};r.save(),r.textAlign="center",r.textBaseline="middle",r.fillStyle=d,r.font=`600 ${c}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(s,o,a-6),r.fillStyle=f,r.font=`500 ${u}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(l,o,a+22),r.restore()}},MI=({title:e="Tickets",icon:t,firstLabel:n="First",firstValue:r=0,firstColor:i="#12B981",secondLabel:o="Second",secondValue:a=0,secondColor:s="#AB0000",growthPercentage:l="+0%",growthText:c="Compared to last month",totalLabel:u="Total",centerTopColor:d="#0F172A",centerBottomColor:f="#64748B",centerTopSize:p,centerBottomSize:m,showBottomGlow:g=!1,bottomGlowColor:v="rgba(186, 230, 253, 0.75)",widgetType:x="",resolvedWidgetType:_="",data:w})=>{const y=w?.title??e,E=w?.icon??t,S=w?.firstLabel??n,k=Number(w?.firstValue??r??0),D=w?.firstColor??i,T=w?.secondLabel??o,R=Number(w?.secondValue??a??0),A=w?.secondColor??s,C=w?.growthPercentage??l??"+0%",N=w?.growthText??c,M=w?.totalLabel??u,j=w?.widgetType??x??_,$=w?.centerTopSize??p??(j==="commercial"?34:20),B=w?.centerBottomSize??m??(j==="commercial"?14:10),z=w?.showBottomGlow??g,V=w?.bottomGlowColor??v,W=k+R,Q={labels:[S,T],datasets:[{data:[k,R],backgroundColor:[D,A],borderWidth:2,hoverOffset:4}]},X={responsive:!0,maintainAspectRatio:!1,cutout:"68%",plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi()},centerText:{top:`${W}`,bottom:M,topSize:$,bottomSize:B,topColor:d,bottomColor:f},bottomGlow:{enabled:z,color:V}}},oe=[{label:S,value:k,color:D},{label:T,value:R,color:A}],Z=C.toString().includes("+"),re=C.toString().includes("-"),ae=Z?"#1FA05B":"#AB0000";return h.jsx(Ie,{title:y,icon:E,className:`
|
|
303
|
+
${j==="commercial"?"h-[362px]":"h-[238px]"}`,children:h.jsxs("div",{className:"grid grid-cols-12 gap-[16px] items-center",children:[h.jsxs("div",{className:"col-span-5 space-y-[12px]",children:[oe.map((le,ue)=>h.jsxs("div",{children:[h.jsx("div",{className:"text-[12px] text-[#64748B] mb-[8px]",children:le.label}),h.jsx("div",{className:"text-[28px] leading-[32px]",style:{color:le.color},children:le.value})]},ue)),h.jsxs("div",{className:`text-[12px] flex gap-[4px] ${j==="commercial"?"mt-[20px]":""} items-center`,style:{color:ae},children:[Z&&h.jsx(ns,{}),re&&h.jsx(ts,{}),h.jsx("div",{children:C.replace("+","").replace("-","")}),h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[14px] ml-[4px] whitespace-nowrap",children:N})]})]}),h.jsx("div",{className:"col-span-7",children:h.jsx("div",{className:`${j==="commercial"?"h-[260px] max-w-[263px]":"h-[158px] w-[158px]"} ml-auto mr-2`,children:h.jsx(R1,{data:Q,options:X,plugins:[Gde,Xde]})})})]})})},UP=({value:e=0,total:t=1,colorClass:n="",label:r=""})=>{const i=Math.max(0,Math.min(100,e/(t||1)*100)),o=n==="bg-[#8B5CF6]"?"text-[#8B5CF6]":n==="bg-[#12B981]"?"text-[#12B981]":"text-slate-600";return h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("div",{className:"w-2/3 min-w-[80px] h-3 rounded-full overflow-hidden",children:h.jsx("div",{className:`h-3 rounded-full ${n}`,style:{width:`${i}%`}})}),h.jsx("div",{className:`${o} !text-[12px] font-bold mt-1`,children:e}),h.jsx("div",{className:"!text-[12px] text-[#64748B] mt-1",children:r})]})},KP=({title:e,value:t,suffix:n,valueClass:r=""})=>h.jsxs("div",{className:"bg-white rounded-[12px] shadow-[0_0_12px_0_#EAF2FF] h-[98px] p-[16px] flex flex-col justify-center",children:[h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#121212] mb-[4px]",children:e}),h.jsxs("div",{className:`text-[28px] leading-[32px] flex item gap-[4px] font-medium ${r}`,children:[t," ",n&&h.jsx("div",{className:"text-[28px] leading-[32px] font-medium",children:n})]})]}),Qde=({data:e,totalUnits:t=847,occupiedUnits:n=756,ownerCount:r=700,tenantCount:i=56,avgResidents:o=4.4,avgLeaseMonths:a=18})=>{const s=Number(e?.totalUnits??t??0),l=Number(e?.occupiedUnits??n??0),c=Number(e?.ownerCount??r??0),u=Number(e?.tenantCount??i??0),d=e?.avgResidents??o,f=e?.avgLeaseMonths??a,p=c+u;return h.jsxs("div",{children:[h.jsxs("div",{className:"bg-white rounded-[12px] shadow-[0_0_12px_0_#EAF2FF] h-[128px] p-[16px] !mb-4",children:[h.jsxs("div",{className:"flex items-center gap-[12px] mb-[24px]",children:[h.jsx(Hb,{className:"h-8 w-8 text-[#329DFF]"}),h.jsx("div",{className:"font-medium text-[16px] text-[#121212]",children:"Occupancy Overview"})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsx("div",{className:"leading-[16px] text-[12px] text-[#64748B]",children:"Occupied Units"}),h.jsxs("div",{className:"flex items-center gap-[4px]",children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:l}),h.jsxs("div",{className:"text-[#64748B] text-[20px] leading-[32px]",children:["/",s]})]})]}),h.jsxs("div",{className:"flex items-end",children:[h.jsx(UP,{value:c,total:p,colorClass:"bg-[#8B5CF6]",label:"Owner"}),h.jsx(UP,{value:u,total:p,colorClass:"bg-[#12B981]",label:"Tenant"})]})]})]}),h.jsxs("div",{className:"mt-2.5 grid grid-cols-2 gap-[12px]",children:[h.jsx(KP,{title:"Avg Residents Per Unit",value:d,valueClass:"text-[#8B5CF6]"}),h.jsx(KP,{title:"Avg Lease Period",value:f,suffix:"months",valueClass:"text-[#E7A015]"})]})]})};Kn.register(A1,Gr,li);const Zde={id:"centerText",afterDraw(e,t,n){const{ctx:r}=e,i=e.getDatasetMeta(0);if(!i?.data?.[0])return;const{x:o,y:a}=i.data[0],{top:s="",bottom:l="",topSize:c=20,bottomSize:u=10,topColor:d="#0F172A",bottomColor:f="#64748B"}=n||{};r.save(),r.textAlign="center",r.textBaseline="middle",r.fillStyle=d,r.font=`600 ${c}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(s,o,a-5),r.fillStyle=f,r.font=`500 ${u}px Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif`,r.fillText(l,o,a+12),r.restore()}},Jde=({data:e,ownerCount:t=1e3,tenantCount:n=200,nonResidingOwners:r=26,growthPct:i="+9.1%"})=>{const o=Number(e?.ownerCount??t??0),a=Number(e?.tenantCount??n??0),s=Number(e?.nonResidingOwners??r??0),l=e?.growthPct??i,c=Math.max(o-s,0),u=o+a,d={labels:["Owners","Tenants","Non-residing Owner"],datasets:[{data:[c,a,s],backgroundColor:["#3C81F6","#08B6D4","#8B5CF6"],borderWidth:2,hoverOffset:4}]},f={responsive:!0,maintainAspectRatio:!1,cutout:"68%",plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi()},centerText:{top:`${u}`,bottom:"Total Members",topSize:20,bottomSize:10}}};return h.jsx(Ie,{title:"Resident Overview",icon:h.jsx(jD,{className:"h-6 w-6 text-[#8B5CF6]"}),className:"h-[238px]",children:h.jsxs("div",{className:" flex-1 min-h-0 grid grid-cols-12 gap-[16px] items-center",children:[h.jsxs("div",{className:"col-span-5",children:[h.jsxs("div",{children:[h.jsx("div",{className:"!text-[12px] text-[#64748B] leading-[16px]",children:"Total Owners"}),h.jsx("div",{className:"text-[28px] leading-[32px ] text-[#3C81F6]",children:o})]}),h.jsxs("div",{children:[h.jsx("div",{className:"!text-[12px] text-[#64748B] leading-[16px]",children:"Total Tenants"}),h.jsx("div",{className:"text-[28px] leading-[32px ] text-[#08B6D4]",children:a})]}),h.jsxs("div",{className:"text-[10px] text-[#1FA05B] flex gap-[8px] items-center",children:[h.jsx(Ou,{value:l}),h.jsx("div",{className:"text-[#64748B] ",children:"Compared to last month"})]})]}),h.jsx("div",{className:"col-span-7",children:h.jsx("div",{className:"h-[162px] w-[162px] ml-auto mr-2",children:h.jsx(R1,{data:d,options:f,plugins:[Zde]})})})]})})};Kn.register(Ro,Io,Fl,Gr,li);const efe=({data:e,blocks:t=[{name:"Block A",owner:110,rented:24,vacant:8},{name:"Block B",owner:95,rented:18,vacant:6},{name:"Block C",owner:65,rented:12,vacant:18},{name:"Block D",owner:78,rented:16,vacant:30}]})=>{const n=Array.isArray(e?.blocks)&&e.blocks.length>0?e.blocks:Array.isArray(e)&&e.length>0?e:t,r=n.map(c=>c.name),i=n.map(c=>Number(c.owner??0)),o=n.map(c=>Number(c.rented??0)),a=n.map(c=>Number(c.vacant??0)),s={labels:r,datasets:[{label:"Owner",data:i,backgroundColor:"#3C81F6",barThickness:40},{label:"",data:i.map(()=>2),backgroundColor:"transparent",barThickness:40},{label:"Rented",data:o,backgroundColor:"#8B5CF6",barThickness:40},{label:"",data:o.map(()=>2),backgroundColor:"transparent",barThickness:40},{label:"Vacant",data:a,backgroundColor:"#08B6D4",barThickness:40}]},l={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,boxWidth:10,boxHeight:10,pointStyle:"rectRot",padding:20}},tooltip:{enabled:!1,external:Fi({hideTitleForSingle:!1})}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{color:"#64748B"}},y:{stacked:!0,beginAtZero:!0,suggestedMax:180,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:20}}}};return h.jsx(Ie,{title:"Block-wise Occupancy",className:"w-full h-[360px]",titleWeight:"semi-bold",children:h.jsx(Bl,{data:s,options:l})})};Kn.register(Ro,Io,M1,T1,Gr,li);const tfe=e=>{const[t,n]=String(e).split(" ");return`${{Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"}[t]||t} 20${n}`},nfe=({data:e,labels:t=["Jan 25","Feb 25","Mar 25","Apr 25","May 25"],moveIn:n=[24,27,20,26,23],moveOut:r=[12,17,8,5,16]})=>{const i=Array.isArray(e?.labels)&&e.labels.length>0?e.labels:t,o=Array.isArray(e?.moveIn)&&e.moveIn.length>0?e.moveIn:n,a=Array.isArray(e?.moveOut)&&e.moveOut.length>0?e.moveOut:r,s={labels:i,datasets:[{label:"Move-in",data:o,borderColor:"#12B981",backgroundColor:"rgba(16,185,129,0.15)",pointBackgroundColor:"#12B981",pointStyle:"rectRot",fill:!1},{label:"Move-out",data:a,borderColor:"#8B5CF6",backgroundColor:"rgba(124,58,237,0.15)",pointBackgroundColor:"#8B5CF6",pointStyle:"rectRot",fill:!1}]},l={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,boxWidth:10,boxHeight:10,padding:20}},tooltip:{enabled:!1,external:Fi({titleFormatter:c=>c.title?.[0]?tfe(c.title[0]):"",hideTitleForSingle:!1})}},scales:{x:{grid:{color:"#F1F5F9"},ticks:{color:"#64748B"}},y:{beginAtZero:!0,suggestedMax:28,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:4,precision:0}}},elements:{line:{borderWidth:2,tension:0},point:{radius:0,hoverRadius:3,hitRadius:10}}};return h.jsx(Ie,{title:"Move-in/Out Trends",className:"w-full h-[360px]",titleWeight:"semi-bold",children:h.jsx(j1,{data:s,options:l})})};Kn.register(Ro,Io,M1,T1,Gr,li);const rfe=e=>{const[t,n]=String(e).split(" ");return`${{Jan:"January",Feb:"February",Mar:"March",Apr:"April",May:"May",Jun:"June",Jul:"July",Aug:"August",Sep:"September",Oct:"October",Nov:"November",Dec:"December"}[t]||t} 20${n}`},ife=["Jan 25","Feb 25","Mar 25","Apr 25","May 25"],ofe=[24,27,20,26,23],afe=[4,17,8,5,16],NI=({data:e,labels:t,moveIn:n,moveOut:r})=>{const i=Array.isArray(e?.labels)&&e.labels.length>0?e.labels:Array.isArray(t)&&t.length>0?t:ife,o=Array.isArray(e?.moveIn)&&e.moveIn.length>0?e.moveIn:Array.isArray(n)&&n.length>0?n:ofe,a=Array.isArray(e?.moveOut)&&e.moveOut.length>0?e.moveOut:Array.isArray(r)&&r.length>0?r:afe,s={labels:i,datasets:[{label:"Income",data:o,borderColor:"#10B981",backgroundColor:"rgba(16,185,129,0.15)",pointBackgroundColor:"#10B981",pointStyle:"rectRot",fill:!1},{label:"Expenditure",data:a,borderColor:"#AB0000",backgroundColor:"rgba(124,58,237,0.15)",pointBackgroundColor:"#AB0000",pointStyle:"rectRot",fill:!1}]},l={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,boxWidth:10,boxHeight:10,padding:20}},tooltip:{enabled:!1,external:Fi({titleFormatter:c=>c.title?.[0]?rfe(c.title[0]):"",hideTitleForSingle:!1})}},scales:{x:{grid:{color:"#F1F5F9"},ticks:{color:"#64748B"}},y:{beginAtZero:!0,suggestedMax:28,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:4,precision:0}}},elements:{line:{borderWidth:2,tension:0},point:{radius:0,hoverRadius:3,hitRadius:10}}};return h.jsx(j1,{data:s,options:l})};function qP({label:e,value:t,positive:n,bgColor:r,delta:i,deltaLabel:o,textColor:a}){return h.jsxs("div",{className:`rounded-[8px] p-[16px] ${r} border border-[#EBEBEB] h-[126px]`,children:[h.jsx("div",{className:`text-[16px] leading-[20px] ${a}`,children:e}),h.jsx("div",{className:"mt-[16px] leading-[28px] !text-[24px] font-medium text-[#121212]",children:t}),h.jsxs("div",{className:"mt-[8px] flex items-center gap-[8px] leading-[14px] text-[10px]",children:[h.jsx("div",{className:n?"text-[#1FA05B] font-medium":"text-[#EF4444] font-medium",children:i}),h.jsx("div",{className:"text-[#64748B] ",children:o})]})]})}function sfe({data:e={}}){const t=e?.incomeCard??{label:"Total Income",value:"AED 5.68M",delta:"+4.4%",positive:!0,bgColor:"bg-slate-50",deltaLabel:"Compared to last month",textColor:"text-[#1FA05B]"},n=e?.expenditureCard??{label:"Total Expenditure",value:"AED 1.83M",delta:"-1.1%",positive:!1,bgColor:"bg-slate-50",deltaLabel:"Compared to last month",textColor:"text-[#AB0000]"};return h.jsxs(Ie,{title:"Accounting",className:"w-full h-[523px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-[16px]",children:[h.jsx(qP,{...t}),h.jsx(qP,{...n})]}),h.jsx("div",{className:"h-[254px] mt-[35.5px]",children:h.jsx(NI,{data:e?.incomeExpenditure})})]})}Kn.register(Ro,Io,Fl,Gr,li);const lfe=["Maintenance","Security","Utilities","Housekeeping","Administration","Others"],cfe=[55e3,56e3,64e3,38e3,54e3,65e3],ufe=[63e3,48e3,51300,28e3,42e3,35e3],dfe=({data:e={}})=>{const t=Array.isArray(e?.labels)&&e.labels.length>0?e.labels:lfe,n=Array.isArray(e?.budgetValues)&&e.budgetValues.length>0?e.budgetValues:cfe,r=Array.isArray(e?.actualValues)&&e.actualValues.length>0?e.actualValues:ufe,i={labels:t,datasets:[{label:"Budget",data:n,backgroundColor:"#93C5FD",barThickness:60},{label:"Actual",data:r,backgroundColor:"#3B82F6",barThickness:60}]},o={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,pointStyle:"rectRot",padding:20}},tooltip:{enabled:!1,external:Fi({titleFormatter:a=>a.title?.[0]||"",hideTitleForSingle:!1,rowsFormatter:a=>(a.dataPoints||[]).map(s=>({label:s.dataset.label||s.label,value:`AED ${(Number(s.raw??0)/1e3).toFixed(1)}K`,color:s.dataset.backgroundColor}))})}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B"}},y:{beginAtZero:!0,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",callback:a=>`${a/1e3}K`}}}};return h.jsx(Ie,{title:"Budget vs Actuals",className:"w-full h-[362px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:h.jsx(Bl,{data:i,options:o})})},ffe=[{title:"Primary Account",amount:285e4,subtitle:"Savings"},{title:"Emergency Fund",amount:12e5,subtitle:"Fixed deposit"},{title:"Maintenance Fund",amount:68e4,subtitle:"Current"}],pfe=({data:e})=>{const t=Array.isArray(e?.accounts)&&e.accounts.length>0?e.accounts:Array.isArray(e)&&e.length>0?e:ffe,n=t.reduce((i,o)=>i+o.amount,0),r=i=>i>=1e6?`AED ${(i/1e6).toFixed(2)}M`:i>=1e3?`AED ${(i/1e3).toFixed(1)}K`:`AED ${i}`;return h.jsxs(Ie,{title:"Cash & Bank Balance",className:"w-full h-[362px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),children:[h.jsx("div",{className:"flex flex-col gap-[12px]",children:t.map((i,o)=>h.jsxs("div",{className:"flex items-center justify-between bg-[#F9FAFB] rounded-[8px] p-[12px]",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"text-[14px] font-medium text-[#121212]",children:i.title}),h.jsx("div",{className:"!text-[12px] text-[#64748B]",children:i?.subtitle})]}),h.jsx("div",{className:"flex flex-col items-end",children:h.jsx("div",{className:"text-[14px] text-[#1FA05B] font-semibold",children:r(i.amount)})})]},o))}),h.jsxs("div",{className:"flex items-center justify-between border-t border-[#EBEBEB] h-[68px] px-[12px]",children:[h.jsx("div",{className:"text-[14px] font-medium text-[#121212]",children:"Total"}),h.jsx("div",{className:"text-[16px] text-[#1FA05B] font-bold",children:r(n)})]})]})};Kn.register(Ro,Io,Fl,Gr,li);const hfe=[{label:"Current Month",value:13e3,units:18},{label:"1-3 Months",value:9400,units:12},{label:"3-6 Months",value:8800,units:18},{label:"6+ Months",value:7200,units:6}],mfe=({data:e})=>{const t=Array.isArray(e?.items)&&e.items.length>0?e.items:Array.isArray(e)&&e.length>0?e:hfe,n=t.map(s=>s.label),r=t.map(s=>Number(s.value??0)),i=t.map(s=>Number(s.units??0)),o={labels:n,datasets:[{label:"Due",data:r,backgroundColor:"#EF4444",barThickness:60}]},a={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({titleFormatter:s=>s.title?.[0]||"",hideTitleForSingle:!1,rowsFormatter:s=>{const l=s.dataPoints?.[0];return l?[{label:"Due",value:`AED ${(Number(l.raw??0)/1e3).toFixed(1)}K`,color:l.dataset.backgroundColor},{label:"Units Count",value:`${i[l.dataIndex]??0}`,color:l.dataset.backgroundColor}]:[]}})}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B"}},y:{beginAtZero:!0,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",callback:s=>`${s/1e3}K`}}}};return h.jsxs(Ie,{title:"Dues Ageing",className:"w-full h-[362px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:[h.jsx("div",{className:"grid grid-cols-4 md:grid-cols-4 gap-[12px] h-[48px]",children:n.map((s,l)=>h.jsx("div",{className:"p-[8px] rounded-[8px] bg-slate-50",children:h.jsxs("div",{className:"flex justify-between items-start",children:[h.jsx("div",{className:"font-medium leading-[16px] !text-[12px] rounded",children:s}),h.jsxs("div",{className:"text-right",children:[h.jsxs("div",{className:"text-red-600 font-medium leading-[16px] !text-[12px]",children:["AED ",(r[l]/1e3).toFixed(1),"K"]}),h.jsxs("div",{className:" text-gray-500 leading-[14px] text-[10px]",children:[i[l]," Units"]})]})]})},s))}),h.jsx("div",{className:"h-[192px]",children:h.jsx(Bl,{data:o,options:a})})]})};Kn.register(A1,Gr,li);const gfe=[{label:"Maintenance",value:45e4,color:"#08B6D4"},{label:"Utilities",value:32e4,color:"#8B5CF6"},{label:"Security",value:28e4,color:"#EF4444"},{label:"Administration",value:18e4,color:"#F69E0A"},{label:"Others",value:12e4,color:"#12B981"}],vfe=({data:e})=>{const t=Array.isArray(e?.items)&&e.items.length>0?e.items:Array.isArray(e)&&e.length>0?e:gfe,n=t.map(l=>l.label),r=t.map(l=>Number(l.value??0)),i=t.map(l=>l.color),o={labels:n,datasets:[{label:"Expenses",data:r,backgroundColor:i,borderColor:"#FFFFFF",borderWidth:2,cutout:"70%"}]},a=r.reduce((l,c)=>l+c,0),s={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({rowsFormatter:l=>(l.dataPoints||[]).map(c=>({label:c.label,value:`AED ${c.formattedValue}`,color:Array.isArray(c.dataset.backgroundColor)?c.dataset.backgroundColor[c.dataIndex]:c.dataset.backgroundColor}))})}}};return h.jsxs(Ie,{title:"Expense Categories",className:"w-full h-[523px]",period:h.jsx(xu,{className:"h-5 w-5 text-[#884EA7] cursor-pointer"}),titleWeight:"semi-bold",children:[h.jsxs("div",{className:"relative h-[259px] flex justify-center items-center",children:[h.jsx(R1,{data:o,options:s}),h.jsxs("div",{className:"absolute text-center",children:[h.jsxs("div",{className:"!text-[24px] font-medium leading-[28px] text-[#121212]",children:["AED ",(a/1e6).toFixed(2),"M"]}),h.jsx("div",{className:"text-[#121212] leading-[18px] text-[14px]",children:"Total Expenses"})]})]}),h.jsx("div",{className:"space-y-2",children:n.map((l,c)=>h.jsxs("div",{className:"flex justify-between items-center text-[14px] pb-2",children:[h.jsxs("div",{className:"flex items-center gap-[8px] !text-[12px] leading-[16px] text-[#64748B]",children:[h.jsx("div",{className:"w-[7px] h-[7px] rotate-45",style:{backgroundColor:o.datasets[0].backgroundColor[c]}}),l]}),h.jsxs("div",{className:"leading-[16px] !text-[12px] text-[#64748B]",children:["AED ",(r[c]/1e3).toFixed(0),"K"]})]},l))})]})};function En({image:e="https://cdni.iconscout.com/illustration/premium/thumb/businessman-sad-for-no-data-in-folder-illustration-svg-download-png-10155562.png",title:t="No Data Available",description:n="Catch up all the data. Change the date range to see the data."}){return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-[16px]",children:[h.jsx("img",{src:e,alt:"no data",className:"w-32 h-32 mb-4 opacity-80"}),h.jsx("div",{className:"text-[16px] font-semibold text-gray-900 mb-[4px]",children:t}),h.jsx("div",{className:"text-[12px] text-gray-500 max-w-[260px]",children:n})]})}const yfe=[{name:"Gym Equipment",value:1e6,color:"#08B6D4"},{name:"Security",value:8e5,color:"#EF4444"},{name:"Others",value:6e5,color:"#F59E0B"},{name:"Pool Maintenance",value:7e5,color:"#8B5CF6"},{name:"Administration",value:52e4,color:"#10B981"}];function bfe({data:e,currency:t="AED"}){const n=Array.isArray(e)&&e.length>0?e:yfe,r=n.reduce((o,a)=>o+Number(a.value??0),0);let i="";return r>=1e6?i=`${(r/1e6).toFixed(2)}M`:r>=1e3?i=`${(r/1e3).toFixed(2)}K`:i=r.toString(),h.jsx(Ie,{title:"Asset Value Breakdown",className:"h-[362px]",titleWeight:"semi-bold",children:r>0?h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"w-[214px] h-[181px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:n,innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",nameKey:"name",children:n.map((o,a)=>h.jsx(In,{fill:o.color},`cell-${a}`))}),h.jsx(Dt,{content:h.jsx(hs,{valueFormatter:o=>`${t} ${Number(o).toLocaleString()}`}),wrapperStyle:{zIndex:9999}})]})}),h.jsx("div",{className:"absolute inset-0 pointer-events-none flex flex-col items-center justify-center",children:h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"font-semibold text-[18px] leading-[12px] mb-[6px]",children:[t," ",i]}),h.jsx("div",{className:"text-[10px] leading-[12.59px] text-[#121212] mt-[6px]",children:"Total Assets"})]})})]}),h.jsxs("div",{className:"flex justify-between w-full px-[8px] sm:px-[12px] mt-4 text-[14px]",children:[h.jsx("div",{className:"flex flex-col gap-[8px]",children:n.slice(0,3).map(o=>h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"inline-block h-[7px] w-[7px] rotate-45",style:{backgroundColor:o.color}}),h.jsx("div",{className:"text-[#64748B] leading-[16px] !text-[12px]",children:o.name})]},o.name))}),h.jsx("div",{className:"flex flex-col gap-[8px] items-start",children:n.slice(3).map(o=>h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"inline-block h-[7px] w-[7px] rotate-45",style:{backgroundColor:o.color}}),h.jsx("div",{className:"text-[#64748B] leading-[16px] !text-[12px]",children:o.name})]},o.name))})]})]}):h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx(En,{})})})}Kn.register(Ro,Io,Fl,Gr,li);const xfe=[{label:"Gym",value:13e3,units:18},{label:"Parking",value:9400,units:12},{label:"Swimming Pool",value:8800,units:18},{label:"Community Hall",value:7200,units:6},{label:"Tennis Court",value:6e3,units:10}],wfe=({data:e})=>{const t=Array.isArray(e)&&e.length>0?e:xfe,n=t.map(s=>s.label),r=t.map(s=>Number(s.value??0)),i=t.map(s=>Number(s.units??0)),o={labels:n,datasets:[{label:"Due",data:r,backgroundColor:"#8B5CF6",barThickness:60}]},a={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({titleFormatter:s=>s.title?.[0]||"",hideTitleForSingle:!1,rowsFormatter:s=>{const l=s.dataPoints?.[0];return l?[{label:"Revenue",value:`AED ${(Number(l.raw??0)/1e3).toFixed(1)}K`,color:l.dataset.backgroundColor},{label:"Units Count",value:`${i[l.dataIndex]??0}`,color:l.dataset.backgroundColor}]:[]}})}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B"}},y:{beginAtZero:!0,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",callback:s=>`${s/1e3}K`}}}};return h.jsx(Ie,{title:"Revenue by Category",className:"w-full h-[362px]",titleWeight:"semi-bold",children:h.jsx(Bl,{data:o,options:a})})};function _fe(e){return tt({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 5l0 2"},child:[]},{tag:"path",attr:{d:"M15 11l0 2"},child:[]},{tag:"path",attr:{d:"M15 17l0 2"},child:[]},{tag:"path",attr:{d:"M5 5h14a2 2 0 0 1 2 2v3a2 2 0 0 0 0 4v3a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-3a2 2 0 0 0 0 -4v-3a2 2 0 0 1 2 -2"},child:[]}]})(e)}function Efe(e){return tt({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M855.7 210.8l-42.4-42.4a8.03 8.03 0 0 0-11.3 0L168.3 801.9a8.03 8.03 0 0 0 0 11.3l42.4 42.4c3.1 3.1 8.2 3.1 11.3 0L855.6 222c3.2-3 3.2-8.1.1-11.2zM304 448c79.4 0 144-64.6 144-144s-64.6-144-144-144-144 64.6-144 144 64.6 144 144 144zm0-216c39.7 0 72 32.3 72 72s-32.3 72-72 72-72-32.3-72-72 32.3-72 72-72zm416 344c-79.4 0-144 64.6-144 144s64.6 144 144 144 144-64.6 144-144-64.6-144-144-144zm0 216c-39.7 0-72-32.3-72-72s32.3-72 72-72 72 32.3 72 72-32.3 72-72 72z"},child:[]}]})(e)}function Sfe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50"}){return h.jsxs(Ie,{title:e,icon:h.jsx("div",{className:"h-6 w-6 grid place-items-center",children:h.jsx(o,{className:`h-6 w-6 ${a}`})}),children:[h.jsx("div",{className:"text-4xl font-semibold tracking-tight text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] text-[14px]",children:[h.jsx("div",{className:i?"text-emerald-600 font-medium":"text-rose-600 font-medium",children:n}),h.jsx("div",{className:"text-slate-500",children:r})]})]})}const Ofe=[{title:"Total Bookings",value:160,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:ND,iconColor:"text-emerald-600"},{title:"Utilisation Rate",value:73,delta:"+2.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Efe,iconColor:"text-[#329DFF]"},{title:"Revenue",value:3,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:_fe,iconColor:"text-[#FA7E28]"},{title:"Pending Dues",value:5,delta:"-8.0%",deltaLabel:"Compared to last month",positive:!1,Icon:RD,iconColor:"text-[#DBB467]"}];function Cfe({data:e}){const t=Array.isArray(e)&&e.length>0?e:Ofe;return console.log(e,"carrrr"),h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[24px]",children:t.map((n,r)=>h.jsx(Sfe,{...n},r))})}/**
|
|
303
304
|
* @license lucide-react v0.564.0 - ISC
|
|
304
305
|
*
|
|
305
306
|
* This source code is licensed under the ISC license.
|
|
@@ -389,6 +390,6 @@ Take a look at the reducer(s) handling this action type: ${p.type}.
|
|
|
389
390
|
*
|
|
390
391
|
* This source code is licensed under the ISC license.
|
|
391
392
|
* See the LICENSE file in the root directory of this source tree.
|
|
392
|
-
*/const Kfe=[["path",{d:"M19 5a2 2 0 0 0-2 2v11",key:"s41o68"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}],["path",{d:"M7 13h10",key:"1rwob1"}],["path",{d:"M7 9h10",key:"12czzb"}],["path",{d:"M9 5a2 2 0 0 0-2 2v11",key:"x0q4gh"}]],qfe=Yi("waves-ladder",Kfe),kt=({title:e,icon:t,period:n,isDateSelector:r=!1,children:i,footer:o,className:a="",titleWeight:s,titleColor:l,iconClassName:c,titleClassName:u,childrenClassName:d,rightContent:f,onCalendarClick:p,onPrevClick:m,onNextClick:g})=>{const v=s==="semi-bold"?600:500;return h.jsxs("div",{className:`relative bg-white p-[24px] !border-[0.5px] !border-[#EBEBEB] !rounded-[12px] !shadow-[0_0_12px_0_#EAF2FF] ${a}`,children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[t&&h.jsx("div",{className:c,children:t}),h.jsx("div",{style:{fontWeight:v,color:l||"#121212"},className:u||"text-[20px] leading-[24px]",children:e})]}),h.jsxs("div",{className:"flex items-center gap-[12px]",children:[f&&f,n&&!r&&h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:n}),r&&h.jsxs("div",{className:"flex items-center gap-[12px] px-[16px] py-[8px] rounded-[8px] bg-white text-sm text-[#64748B]",children:[h.jsx(jfe,{size:16,className:"text-[#64748B] cursor-pointer",onClick:p}),h.jsx(RI,{size:16,className:"cursor-pointer",onClick:m}),h.jsx("span",{className:"text-[12px] leading-[16px] text-[#64748B]",children:n}),h.jsx(II,{size:16,className:"cursor-pointer",onClick:g})]})]})]}),h.jsx("div",{className:`flex-1 min-h-0 mt-4 ${d}`,children:i}),o&&h.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100 text-[12px] text-[#64748B]",children:o})]})},Gfe={completed:18,not_completed:6,missed:4};function Xfe({data:e={}}){const t=e&&Object.keys(e).length>0?e:Gfe,n=[{name:"Completed",value:Number(t?.completed??0),color:"#12B981"},{name:"Delayed",value:Number(t?.not_completed??0),color:"#EF4444"},{name:"Missed",value:Number(t?.missed??0),color:"#F69E0A"}],r=Number(t?.completed??0)+Number(t?.not_completed??0)+Number(t?.missed??0),i=Number(t?.completed??0);return h.jsx(kt,{title:"Guard Patrols",className:"h-[362px]",titleWeight:"semi-bold",children:h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"w-[215px] h-[182px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:n??[],innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",nameKey:"name",children:n?.map?.((o,a)=>h.jsx(In,{fill:o?.color??"#ccc"},`cell-${a}`))}),h.jsx(Dt,{content:h.jsx(hs,{}),wrapperStyle:{zIndex:9999}})]})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsxs("div",{className:"font-medium text-[19.35px] leading-[23.65px]",children:[i??0,"/",r??0]}),h.jsx("div",{className:"text-[10.75px] leading-[15.05px] text-[#64748B]",children:"Completed"})]})]}),h.jsx("div",{className:"flex flex-col w-full text-[14px]",children:n?.length?n?.map?.((o,a)=>h.jsxs("div",{className:`flex items-center justify-between py-[10px] ${a!==(n?.length??0)-1?"border-b border-[#F1F5F9]":""}`,children:[h.jsxs("div",{className:"flex items-center gap-[10px]",children:[h.jsx("div",{className:"inline-block w-[16px] h-[7px]",style:{backgroundColor:o?.color??"#ccc"}}),h.jsx("div",{className:"leading-[16.09px] text-[12.07px] text-[#64748B]",children:o?.name??"-"})]}),h.jsx("div",{className:"leading-[16.09px] text-[12.07px] text-[#64748B]",children:o?.value??0})]},o?.name??a)):h.jsx("div",{className:"text-center text-gray-400 text-sm py-[24px]",children:"No patrol data"})})]})})}Kn.register(Ro,Io,M1,T1,Gr,li);const Qfe=["10 AM","12 PM","2 PM","4 PM","6 PM","8 PM","10 PM"],nf={guest:[9,5,12,7,3,6,4],cab:[15,12,10,14,7,12,8],delivery:[22,18,16,20,22,14,17],service:[13,12,8,9,5,10,7]},Zfe=[{key:"Guest",datasetIndex:0,color:"#EF4444"},{key:"Cab",datasetIndex:1,color:"#7C3AED"},{key:"Delivery",datasetIndex:2,color:"#10B981"},{key:"Service",datasetIndex:3,color:"#F59E0B"}],Jfe=({color:e,size:t=12})=>h.jsx("svg",{width:t,height:t,viewBox:"0 0 12 12",style:{display:"block",flexShrink:0},children:h.jsx("rect",{x:"1",y:"1",width:"10",height:"10",rx:"0",fill:e,transform:"rotate(45 6 6)"})}),epe=({chartRef:e})=>{const[t,n]=P.useState({}),r=i=>{const o=e.current;if(!o)return;const a=o.getDatasetMeta(i),s=!!a.hidden;a.hidden=!s,o.update(),n(l=>({...l,[i]:!s}))};return h.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"76px",marginTop:"10px",paddingBottom:"8px",flexWrap:"wrap"},children:Zfe.map(({key:i,datasetIndex:o,color:a})=>{const s=!!t[o];return h.jsxs("div",{onClick:()=>r(o),style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",userSelect:"none",opacity:s?.45:1,transition:"opacity 0.2s ease"},children:[h.jsx(Jfe,{color:a,size:12}),h.jsx("span",{style:{fontSize:"13px",color:"#64748B",fontWeight:400,lineHeight:1,textDecoration:s?"line-through":"none",transition:"text-decoration 0.15s ease"},children:i})]},i)})})},tpe=({data:e})=>{const t=P.useRef(null),r={labels:Array.isArray(e?.labels)&&e.labels.length>0?e.labels:Qfe,datasets:[{label:"Guest",data:Array.isArray(e?.guest)&&e.guest.length>0?e.guest:nf.guest,borderColor:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)",pointBackgroundColor:"#EF4444",pointStyle:"rectRot",fill:!1},{label:"Cab",data:Array.isArray(e?.cab)&&e.cab.length>0?e.cab:nf.cab,borderColor:"#7C3AED",backgroundColor:"rgba(124,58,237,0.15)",pointBackgroundColor:"#7C3AED",pointStyle:"rectRot",fill:!1},{label:"Delivery",data:Array.isArray(e?.delivery)&&e.delivery.length>0?e.delivery:nf.delivery,borderColor:"#10B981",backgroundColor:"rgba(16,185,129,0.15)",pointBackgroundColor:"#10B981",pointStyle:"rectRot",fill:!1},{label:"Service",data:Array.isArray(e?.service)&&e.service.length>0?e.service:nf.service,borderColor:"#F59E0B",backgroundColor:"rgba(245,158,11,0.15)",pointBackgroundColor:"#F59E0B",pointStyle:"rectRot",fill:!1}]},i={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({titleFormatter:o=>o.title?.[0]||"",hideTitleForSingle:!1})}},scales:{x:{grid:{color:"#F1F5F9"},ticks:{color:"#64748B"}},y:{beginAtZero:!0,suggestedMax:28,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:4,precision:0}}},elements:{line:{borderWidth:2,tension:0},point:{radius:0,hoverRadius:3,hitRadius:10}}};return h.jsxs(Ie,{title:"Hourly Traffic Flow",className:"w-full h-[362px]",children:[h.jsx("div",{style:{height:"calc(100% - 44px)",width:"100%"},children:h.jsx(j1,{ref:t,data:r,options:i})}),h.jsx(epe,{chartRef:t})]})},npe={open:4,in_progress:7,closed:12},rpe=[{incident_code:"INC-401",severity_level:"L1",severity:"Danger"},{incident_code:"INC-402",severity_level:"L2",severity:"High"},{incident_code:"INC-403",severity_level:"L3",severity:"Low"}];function ipe({incidentReports:e={},incidentReportsDetails:t=[]}){const n=e&&Object.keys(e).length>0?e:npe,r=Array.isArray(t)?t:rpe,i=Number(n?.open??0),o=Number(n?.in_progress??0),a=Number(n?.closed??0);return h.jsx(kt,{title:"Incident Reports",className:"h-[362px]",titleWeight:"semi-bold",children:h.jsxs("div",{children:[h.jsxs("div",{className:"flex w-full text-center gap-[24px]",children:[h.jsxs("div",{className:"flex-1 py-[12px] bg-[#FBF4F4] h-[76px] rounded",children:[h.jsx("div",{className:"!text-[24px] leading-[28px] font-medium text-[#AB0000]",children:i??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#AB0000]",children:"Open"})]}),h.jsxs("div",{className:"flex-1 py-[12px] bg-[#FFFBF2] h-[76px] rounded",children:[h.jsx("div",{className:"!text-[24px] leading-[28px] font-medium text-[#E7A015]",children:o??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#E7A015]",children:"In-progress"})]}),h.jsxs("div",{className:"flex-1 py-[12px] bg-[#F7FEFA] h-[76px] rounded",children:[h.jsx("div",{className:"!text-[24px] leading-[28px] font-medium text-[#1FA05B]",children:a??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#1FA05B]",children:"Closed"})]})]}),h.jsx("div",{className:"mt-4 space-y-2",children:r?.length?r?.map?.((s,l)=>{const c=s?.severity==="Danger"?"text-[#AB0000]":s?.severity==="High"?"text-[#E7A015]":"text-[#1FA05B]";return h.jsxs("div",{className:"flex items-center justify-between p-[12px] bg-[#FAFBFD] rounded-md",children:[h.jsx("div",{className:"flex items-center gap-[8px]",children:h.jsx("div",{className:"text-gray-700 font-medium",children:s?.incident_code??"-"})}),h.jsx("div",{className:`!text-[12px] font-semibold flex items-center gap-[4px] ${c}`,children:h.jsxs("div",{children:[s?.severity_level??"-"," - ",s?.severity??"-"]})})]},l)}):h.jsx("div",{className:"text-center text-gray-400 text-sm py-[24px]",children:"No incidents found"})})]})})}const ope=[{total_staff:42,absent_staff:6}],ape=[{staff_role_name:"Security Guard",total_staff:18,present_staff:16},{staff_role_name:"Supervisor",total_staff:8,present_staff:7},{staff_role_name:"Technician",total_staff:10,present_staff:9},{staff_role_name:"Technician",total_staff:10,present_staff:9}];function spe({staffPresentAbsent:e,staffPresentByRole:t}){const n=Array.isArray(e)&&e.length>0?e:ope,r=Array.isArray(t)&&t.length>0?t:ape,i=n?.[0]?.total_staff??0,o=n?.[0]?.absent_staff??0,a=(i??0)-(o??0);return h.jsx(kt,{title:"Staff Attendance",className:"h-[362px] overflow-hidden ",titleWeight:"semi-bold",children:h.jsxs("div",{children:[h.jsxs("div",{className:"flex gap-[16px] text-center mt-[24px]",children:[h.jsxs("div",{className:"flex-1 py-[12px] bg-[#F7FEFA] rounded h-[76px]",children:[h.jsx("div",{className:"text-[24px] font-medium text-[#1FA05B]",children:a??0}),h.jsx("div",{className:"text-[12px] text-[#1FA05B]",children:"Present"})]}),h.jsxs("div",{className:"flex-1 py-[12px] bg-[#FBF4F4] rounded h-[76px]",children:[h.jsx("div",{className:"text-[24px] font-medium text-[#AB0000]",children:o??0}),h.jsx("div",{className:"text-[12px] text-[#AB0000]",children:"Absent"})]})]}),h.jsx("div",{className:"mt-[24px] pb-[16px] space-y-[8px] overflow-y-auto max-h-[200px] hide-scrollbar",children:r?.length?r?.map?.((s,l)=>{const c=Number(s?.total_staff??0),u=Number(s?.present_staff??0);return h.jsxs("div",{className:"flex items-center justify-between p-[12px] bg-[#F8FAFC] rounded-md",children:[h.jsx("div",{className:"text-[#121212] text-[14px] leading-[18px] font-medium",children:s?.staff_role_name??"-"}),h.jsxs("div",{className:"text-[14px] leading-[20px] text-[#64748B]",children:[u??0,"/",c??0]})]},l)}):h.jsx(h.Fragment,{})})]})})}function lpe(e){return tt({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M116,132V96a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm12,56a16,16,0,1,0-16-16A16,16,0,0,0,128,188ZM228,56v56c0,54.29-26.32,87.22-48.4,105.29-23.71,19.39-47.44,26-48.44,26.29a12.1,12.1,0,0,1-6.32,0c-1-.28-24.73-6.9-48.44-26.29C54.32,199.22,28,166.29,28,112V56A20,20,0,0,1,48,36H208A20,20,0,0,1,228,56Zm-24,4H52v52c0,35.71,13.09,64.69,38.91,86.15A126.14,126.14,0,0,0,128,219.38a126.28,126.28,0,0,0,37.09-21.23C190.91,176.69,204,147.71,204,112Z"},child:[]}]})(e)}function cpe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50"}){return h.jsxs(Ie,{title:e,icon:h.jsx("div",{className:"h-6 w-6 grid place-items-center",children:h.jsx(o,{className:`h-6 w-6 ${a}`})}),children:[h.jsx("div",{className:"text-4xl font-semibold tracking-tight text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] text-[14px]",children:[h.jsx("div",{className:i?"text-emerald-600 font-medium":"text-rose-600 font-medium",children:n}),h.jsx("div",{className:"text-slate-500",children:r})]})]})}const upe=[{title:"Total Visitors",value:160,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Hb,iconColor:"text-[#329DFF]"},{title:"Active Incidents",value:73,delta:"+2.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Joe,iconColor:"text-[#F69E0A]"},{title:"Missed Patrols",value:3,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:lpe,iconColor:"text-[#AB0000]"},{title:"Parking Usage",value:5,delta:"-8.0%",deltaLabel:"Compared to last month",positive:!1,Icon:g8,iconColor:"text-[#36AB6C]"}];function dpe({data:e}){const t=Array.isArray(e)&&e.length>0?e:upe;return h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[24px]",children:t.map((n,r)=>h.jsx(cpe,{...n},r))})}const fpe=[{title:"Maintenance",total:12,pending:3},{title:"Security",total:8,pending:1},{title:"Housekeeping",total:6,pending:2},{title:"Utilities",total:10,pending:4}],ppe=(e="")=>e.replace(/</g,"<").replace(/>/g,">").replace(/<[^>]*>/g,"").trim();function hpe({data:e}){const t=Array.isArray(e?.complaints_by_category)&&e.complaints_by_category.length>0?e.complaints_by_category.map(n=>({title:ppe(n.category_name)||"—",total:n.total||0,pending:n.pending||0})):fpe;return h.jsx(Ie,{title:"Complaints",className:"h-[362px]",titleWeight:"semi-bold",titleClassName:"!text-[20px] !leading-[24px]",children:h.jsx("div",{className:"flex flex-col gap-[12px]",children:t.map((n,r)=>h.jsxs("div",{className:"flex items-center justify-between bg-[#F9FAFB] rounded-[8px] p-[12px] h-[62px]",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-[#121212] capitalize",children:n.title}),h.jsxs("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:["Total: ",n.total]})]}),h.jsxs("div",{className:"flex flex-col items-end",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-red-700",children:String(n.pending).padStart(2,"0")}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Pending"})]})]},r))})})}const mpe=e=>{const t={0:"𝟎",1:"𝟏",2:"𝟐",3:"𝟑",4:"𝟒",5:"𝟓",6:"𝟔",7:"𝟕",8:"𝟖",9:"𝟗"};return String(e).split("").map(n=>t[n]||n).join("")},gpe=[{level:"Level 1",open_count:3,in_progress_count:4,closed_count:5,total:12},{level:"Level 2",open_count:1,in_progress_count:1,closed_count:1,total:3},{level:"Level 3",open_count:5,in_progress_count:2,closed_count:3,total:10}],vpe=()=>{const e=[{label:"Open",color:"#EF4444"},{label:"In Progress",color:"#F59D0D"},{label:"Closed",color:"#12B981"}];return h.jsx("div",{style:{display:"flex",justifyContent:"space-between",gap:"15px"},children:e.map(t=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[h.jsx("div",{style:{width:"6px",height:"6px",backgroundColor:t.color,transform:"rotate(45deg)"}}),h.jsx("span",{style:{fontSize:"14px"},children:t.label})]},t.label))})},ype=({data:e})=>{const t=P.useMemo(()=>(Array.isArray(e?.complaints_by_level)&&e.complaints_by_level.some(l=>Number(l.total)>0)?e.complaints_by_level:gpe).map(l=>({level:l.level||"—",open_count:Number(l.open_count)||0,in_progress_count:Number(l.in_progress_count)||0,closed_count:Number(l.closed_count)||0,total:Number(l.total)||0})),[e]),n=P.useMemo(()=>Math.max(...t.map(a=>a.total),5),[t]),r=Math.ceil(n*1.2),i=6,o=Math.max(Math.ceil(n/i),1);return h.jsxs(Ie,{title:"Complaints by Level",className:"w-full h-[362px]",titleWeight:"semi-bold",titleClassName:"!text-[20px] !leading-[24px]",children:[h.jsx(Ot,{width:"100%",height:"85%",children:h.jsxs(No,{data:t,margin:{top:5,right:-25,left:-30,bottom:5},children:[h.jsx(ur,{strokeDasharray:"0",vertical:!1}),h.jsx(Un,{dataKey:"level"}),h.jsx(Ln,{domain:[0,r],ticks:Array.from({length:i+1},(a,s)=>s*o)}),h.jsx(Dt,{content:h.jsx(hs,{titleFormatter:a=>a,hideTitleForSingle:!1,rowFormatter:({payload:a})=>a.map(s=>({color:s.color||s.fill||s.payload?.color||"",label:s.name||s.dataKey,value:mpe(s.value??0)}))}),cursor:!1}),h.jsx(Kt,{dataKey:"open_count",name:"Open",stackId:"a",fill:"#EF4444",barSize:44,radius:[0,0,0,0]}),h.jsx(Kt,{dataKey:"in_progress_count",name:"In Progress",stackId:"a",fill:"#F59D0D",barSize:44,radius:[0,0,0,0]}),h.jsx(Kt,{dataKey:"closed_count",name:"Closed",stackId:"a",fill:"#12B981",barSize:44,radius:[0,0,0,0]})]})}),h.jsx(vpe,{})]})},bpe=[{title:"Maintenance",total:18,pending:4},{title:"Security",total:11,pending:2},{title:"Housekeeping",total:9,pending:3},{title:"Utilities",total:14,pending:5}];function xpe({data:e}){const t=Array.isArray(e?.request_box_by_type)&&e.request_box_by_type.length>0?e.request_box_by_type.map(n=>({title:n.category_name||"—",total:Number(n.total)||0,pending:Number(n.pending)||0})):bpe;return h.jsx(Ie,{title:"Request Box",className:"h-[362px]",titleWeight:"semi-bold",titleClassName:"!text-[20px] !leading-[24px]",children:h.jsx("div",{className:"flex flex-col gap-[12px]",children:t.map((n,r)=>h.jsxs("div",{className:"flex items-center justify-between bg-[#F9FAFB] rounded-[8px] p-[12px] h-[62px]",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-[#121212] capitalize",children:n.title}),h.jsxs("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:["Total: ",n.total]})]}),h.jsxs("div",{className:"flex flex-col items-end",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-red-700",children:String(n.pending).padStart(2,"0")}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Pending"})]})]},`${n.title}-${r}`))})})}function wpe(e){return tt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinejoin:"round",strokeWidth:"32",d:"M416 221.25V416a48 48 0 0 1-48 48H144a48 48 0 0 1-48-48V96a48 48 0 0 1 48-48h98.75a32 32 0 0 1 22.62 9.37l141.26 141.26a32 32 0 0 1 9.37 22.62z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M256 56v120a32 32 0 0 0 32 32h120m-232 80h160m-160 80h160"},child:[]}]})(e)}const _pe=["open_complaints","pending_requests","avg_response_time","resolution_rate"],Epe={open_complaints:{title:"Open Complaints",Icon:ND,iconColor:"#AB0000",deltaLabel:"Compared to last month"},pending_requests:{title:"Pending Requests",Icon:wpe,iconColor:"#E7A015",deltaLabel:"Compared to last month"},avg_response_time:{title:"Avg Response Time",Icon:O8,iconColor:"#1FA05B",deltaLabel:"Compared to last month"},resolution_rate:{title:"Resolution Rate",Icon:w8,iconColor:"#329DFF",deltaLabel:"Compared to last month"}},Spe=({children:e,size:t=28,lineHeight:n=32,weight:r=500,color:i="#121212"})=>h.jsx("div",{style:{fontWeight:r,fontSize:`${t}px`,lineHeight:`${n}px`,color:i},children:e}),Ope={primary:{size:28,lineHeight:32,weight:500}},Cpe={open_complaints:{current:24,trend_percent:"-8%",direction:"bad"},pending_requests:{current:17,trend_percent:"-5%",direction:"bad"},avg_response_time:{current:"2.4 h",trend_percent:"+6%",direction:"good"},resolution_rate:{current:"89%",trend_percent:"+4%",direction:"good"}};function Ppe({id:e,data:t}){return e&&t&&!t[e]&&t.current!==void 0?h.jsx(QP,{id:e,data:t}):h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[16px]",children:_pe.map(n=>h.jsx(QP,{id:n},n))})}function QP({id:e,data:t}){const n=Epe[e];if(!n)return null;const r=(d,f)=>f==null?"—":d==="avg_response_time"?typeof f=="number"?`${f} h`:f:d==="resolution_rate"&&typeof f=="number"?`${f}%`:f,{title:i,Icon:o=bu,iconColor:a,deltaLabel:s}=n,l=t&&Object.keys(t).length>0?t:Cpe[e],c=r(e,l?.current),u=l?.trend_percent??"—";return l?.direction==="good"||l?.direction,h.jsx("div",{className:"h-[132px]",children:h.jsxs(Ie,{title:i,titleColor:a,icon:h.jsx("div",{className:"h-[20px] w-[20px] flex items-center justify-center",children:h.jsx(o,{className:"h-[20px] w-[20px]",style:{color:a}})}),childrenClassName:"!space-y-[12px]",iconClassName:"!gap-[12px]",children:[h.jsx(Spe,{...Ope.primary,children:c}),h.jsxs("div",{className:"flex items-center gap-[8px] text-[12px] leading-[16px]",children:[h.jsx(Ou,{value:u}),h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px]",children:s})]})]})})}const kpe=[{title:"Holi Celebration",date:"25 Jun 2025",rsvp:"78/100",utilisation:71,status:"Upcoming"},{title:"Maintenance Meeting",date:"25 Jun 2025",rsvp:"45/60",utilisation:75,status:"Completed"}];function Dpe({title:e,date:t,rsvp:n,utilisation:r,status:i}){return h.jsxs("div",{className:" bg-[#F8FAFC] h-[106px] px-[12px] mt-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("div",{className:"text-[16px] leading-[20px] font-semibold text-[#121212]",children:e}),h.jsx("div",{className:`!text-[12px] font-medium leading-[16px] px-[8px] py-[4px] ${i==="Completed"?"text-[#36AB6C] bg-[#E6F7EE]":i==="Upcoming"?"text-[#329DFF] bg-[#E6F2FF]":"text-slate-500 bg-slate-100"}`,children:i})]}),h.jsx("div",{className:"text-[14px] leading-[18px] text-[#64748B]",children:t}),h.jsxs("div",{className:"flex justify-between items-center mt-2",children:[h.jsxs("div",{className:"text-[14px] leading-[18px] text-[#64748B]",children:[n," RSVP"]}),h.jsxs("div",{className:"text-[#3C82F6] text-[14px] leading-[18px] font-medium",children:[r,"% utilisation"]})]}),h.jsx("div",{className:"w-full bg-[#F8FAFC] h-[6px] rounded mt-2 mb-3",children:h.jsx("div",{className:"h-[6px] rounded bg-[#3C82F6]",style:{width:`${r}%`}})})]})}function Ape({data:e}){const t=Array.isArray(e)?e:kpe;return h.jsx(Ie,{title:"Events Utilisation",className:"w-full h-[360px] overflow-y-auto hide-scrollbar",children:h.jsx("div",{className:"m-auto",children:t?.length>0?t.map((n,r)=>h.jsx(Dpe,{...n},`${n.title}-${r}`)):h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx(En,{})})})})}const Tpe=[{label:"Active",value:138,subLabel:"3 expiring soon",bgColor:"bg-[#F0FFF7]",textColor:"text-[#1FA05B]"},{label:"Scheduled",value:13,subLabel:"4 this week",bgColor:"bg-[#FFFBF2]",textColor:"text-[#E7A015]"},{label:"Recurring",value:3,subLabel:"All active",bgColor:"bg-[#EDF6FF]",textColor:"text-[#329DFF]"},{label:"Expired",value:7,subLabel:"4 recent",bgColor:"bg-[#F6F6F6]",textColor:"text-[#64748B]"}];function Mpe({label:e,value:t,subLabel:n,bgColor:r,textColor:i}){return h.jsxs("div",{className:`rounded-[8px] p-[16px] ${r} h-[124px]`,children:[h.jsx("div",{className:`text-[16px] font-medium ${i} leading-[20px]`,children:e}),h.jsx("div",{className:"mt-4 text-[28px] leading-[32px] font-semibold text-[#121212]",children:t}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#64748B] mt-2",children:n})]})}function Npe({data:e}){const t=Array.isArray(e)&&e.length>0?e:Tpe;return h.jsx(Ie,{title:"Notice Board Status",className:"w-full h-[360px]",children:h.jsx("div",{className:"grid grid-cols-2 gap-[16px]",children:t.map((n,r)=>h.jsx(Mpe,{...n},`${n.label}-${r}`))})})}function jpe(e){return tt({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM19 20V4H5V20H19ZM8 9H16V11H8V9ZM8 13H16V15H8V13Z"},child:[]}]})(e)}function Rpe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50",iconUrl:l}){return h.jsx(Ie,{title:e,icon:h.jsx("div",{className:"grid place-items-center ",children:l?h.jsx("img",{src:l,alt:"icon",className:"h-8 w-8 object-contain"}):h.jsx(o,{className:`h-8 w-8 ${a}`})}),className:"h-[132px]",children:h.jsxs("div",{children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] pt-[8px] !text-[12px] leading-[16px]",children:[h.jsx(Ou,{value:n}),h.jsx("div",{className:"text-[#64748B]",children:r})]})]})})}function Ipe({data:e}){const t=[{title:e?.title||"Total Bookings",value:e?.value??0,delta:e?.delta??"0%",deltaLabel:e?.deltaLabel||"Compared to last month",positive:e?.positive??!1,Icon:e?.Icon,iconUrl:e?.iconUrl,iconColor:e?.iconColor||"text-emerald-600",iconBg:e?.iconBg||"bg-emerald-50"}];return h.jsx("div",{className:"h-full",children:t.map((n,r)=>h.jsx(Rpe,{...n},r))})}function Lpe(e){return tt({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"},child:[]}]})(e)}function $pe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50"}){return h.jsx(Ie,{title:e,icon:h.jsx("div",{className:`h-6 w-6 grid place-items-center rounded-md ${s}`,children:h.jsx(o,{className:`h-4 w-4 ${a}`})}),className:"h-[132px]",children:h.jsxs("div",{children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] pt-[8px] !text-[12px] leading-[16px]",children:[h.jsx("div",{className:i?"text-[#1FA05B] font-medium":"text-rose-600 font-medium",children:n}),h.jsx("div",{className:"text-[#64748B]",children:r})]})]})})}const Fpe=[{title:"Notice",value:160,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:jpe,iconColor:"text-emerald-600",iconBg:"bg-emerald-50"},{title:"Post",value:83,delta:"+2.0%",deltaLabel:"Compared to last month",positive:!0,Icon:v8,iconColor:"text-[#329DFF]",iconBg:"bg-emerald-50"},{title:"Poll",value:3,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Qoe,iconColor:"text-[#FA7E28]",iconBg:"bg-orange-100"},{title:"Poll",value:5,delta:"-8.0%",deltaLabel:"Compared to last month",positive:!1,Icon:Lpe,iconColor:"text-[#DBB467]",iconBg:"bg-yellow-100"}];function Bpe({data:e}){const t=Array.isArray(e)&&e.length>0?e:Fpe;return h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[24px]",children:t.map((n,r)=>h.jsx($pe,{...n},r))})}const ZP=({value:e=0,total:t=1,colorClass:n="",label:r=""})=>{const i=Number(e)||0,o=Number(t)||1,a=Math.max(0,Math.min(100,i/o*100)),s=n==="bg-[#3C81F6]"?"text-[#8B5CF6]":n==="bg-[#8B5CF6]"?"text-[#12B981]":"text-slate-600";return h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("div",{className:"w-2/3 min-w-[80px] h-5 rounded-full overflow-hidden",children:h.jsx("div",{className:`h-[11px] rounded-full ${n||""}`,style:{width:n==="bg-[#12B981]"?`${a+45}%`:`${a}%`}})}),h.jsx("div",{className:`${s} !text-[12px] font-bold mt-1`,children:i??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#64748B] mt-1",children:r??""})]})},Wpe=({data:e,occupiedUnits:t=1,EmployeesCount:n=8910,AdminsCount:r=910})=>{const i=e?.total_occupants!==void 0&&e?.total_occupants!==null?Number(e?.total_occupants)||0:Number(t)||0,o=e?.total_members!==void 0&&e?.total_members!==null?Number(e?.total_members)||0:Number(n)||0,a=e?.total_admins!==void 0&&e?.total_admins!==null?Number(e?.total_admins)||0:Number(r)||0,s=(o||0)+(a||0);return h.jsx("div",{children:h.jsxs("div",{className:"bg-white !border-[0.5px] !border-[#EBEBEB] rounded-[12px] shadow-[0_0_12px_0_#EAF2FF] p-[16px] h-[128px]",children:[h.jsxs("div",{className:"flex items-center gap-[12px] h-[20px]",style:{marginBottom:"24px"},children:[h.jsx(Hb,{className:"!text-[20px] text-[#329DFF]"}),h.jsx("div",{className:"font-medium text-[#121212] text-[16px] leading-[20px]",children:"Occupancy Overview"})]}),h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex flex-col gap-[4px]",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B] font-normal",children:"Total Occupants"}),h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:i??0})]}),h.jsxs("div",{className:"flex items-end gap-[4px]",children:[h.jsx(ZP,{value:o??0,total:s||1,colorClass:"bg-[#3C81F6]",label:(o??0)<=1?"Employee":"Employees"}),h.jsx(ZP,{value:a??0,total:s||1,colorClass:"bg-[#8B5CF6]",label:(a??0)<=1?"Admin":"Admins"})]})]})]})})};Kn.register(Ro,Io,Fl,Gr);const Vpe=({data:e})=>{const t=e!=null,n=e?.employee_data,r=["HP","Adobe","Anarock","Swiggy","Infosys","Zepto"],i=[2e3,1700,1500,1200,900,800],o=[],a=[];if(t){if(n&&n.length>0)for(let d=0;d<n.length;d++)o.push(n[d].name),a.push(n[d].employees)}else for(let d=0;d<r.length;d++)o.push(r[d]),a.push(i[d]);let s=!1;if(t)if(!n||n.length===0)s=!0;else{s=!0;for(let d=0;d<n.length;d++)if(n[d].employees!==0){s=!1;break}}let l=0;for(let d=0;d<a.length;d++)a[d]>l&&(l=a[d]);const c={labels:o,datasets:[{data:a,backgroundColor:[],barThickness:34}]};for(let d=0;d<a.length;d++)c.datasets[0].backgroundColor.push("#3C81F6");const u={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"#0F172A",titleColor:"#fff",bodyColor:"#fff",displayColors:!1,callbacks:{label:d=>`Employees: ${d.parsed.y}`}}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B",font:{size:12}}},y:{beginAtZero:!0,min:0,max:l>0?l+5:2e3,ticks:{stepSize:l>0?Math.ceil((l+5)/5):500,color:"#64748B",callback:d=>d},grid:{display:!1,color:"#E5E7EB",borderDash:[4,4],drawBorder:!1}}}};return t&&s?h.jsx(Ie,{className:"w-full h-[238px]",title:"Employee Footfall",period:"Today",icon:h.jsx(XP,{className:"!text-[24px] text-[#8B5CF6]"}),children:h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx(En,{title:"No Employee footfall Found",description:"Catch up all the data. Change the date range to see the data."})})}):h.jsxs(Ie,{className:"w-full h-[238px]",title:"Employee Footfall",period:"Today",icon:h.jsx(XP,{className:"!text-[24px] text-[#8B5CF6]"}),children:[h.jsxs("div",{className:"mb-[10px] mt-[8px] flex flex-col gap-[4px]!",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Employees Inside"}),h.jsx("div",{className:"text-[20px] leading-[24px] font-medium text-[#3C81F6]",children:t?e.total_employees:7500})]}),h.jsx("div",{className:"h-[110px]",children:h.jsx(Bl,{data:c,options:u})})]})},zpe="Rs",JP=["bg-blue-500","bg-red-500","bg-purple-700"],Ea={title:"Food & Beverages (Static Data)",period:"Today",summary:{totalOrders:247,revenueGenerated:"82K",growthPercentage:8,growthTotalPercentage:0},outlets:[{name:"HP",orders:120,revenue:"45K",percentage:70,color:"bg-[#3C81F6]"},{name:"Adobe",orders:85,revenue:"23K",percentage:50,color:"bg-[#3C81F6]"},{name:"Anarock",orders:42,revenue:"14K",percentage:25,color:"bg-[#3C81F6]"}]};function Bp(e,t=null){if(typeof e=="number")return e;if(typeof e=="string"){const n=Number(e.replace("%","").trim());return Number.isNaN(n)?t:n}return t}function ek(e){if(e==null||e==="")return"0";if(typeof e=="number")return C_(e);const t=Number(e);return Number.isNaN(t)?String(e):C_(t)}function Hpe(e){const t=e?.food_beverage_summary?{title:e?.title,period:e?.period,summary:{totalOrders:e?.food_beverage_summary?.total_orders,revenueGenerated:e?.food_beverage_summary?.revenue_generated,growthPercentage:e?.food_beverage_summary?.growth_percentage??e?.food_beverage_summary?.revenue_growth,growthTotalPercentage:e?.food_beverage_summary?.order_growth,currencyType:e?.food_beverage_summary?.currency_type},outlets:e?.chart_data}:e||{},n=t?.summary||{},i=(Array.isArray(t?.outlets)?t.outlets:[]).map((f,p)=>({name:f?.name||f?.outlet_name||f?.tenant_name||f?.company_name||"Unknown",orders:f?.orders??f?.total_orders??f?.count??0,revenue:f?.revenue??f?.revenue_generated??f?.total_revenue??0,percentage:f?.percentage,color:f?.color||JP[p%JP.length]})),o=n?.totalOrders??n?.orders??Ea.summary.totalOrders,a=n?.revenueGenerated??n?.revenue??Ea.summary.revenueGenerated,s=Bp(n?.growthPercentage??n?.revenueGrowth,Ea.summary.growthPercentage),l=Bp(n?.growthTotalPercentage??n?.orderGrowth,Ea.summary.growthTotalPercentage),c=n?.currencyType||n?.currency||zpe,u=i.reduce((f,p)=>f+(Number(p?.orders)||0),0),d=i.map(f=>({...f,percentage:f?.percentage!==null&&f?.percentage!==void 0?Number(f.percentage)||0:u>0?Math.round((Number(f?.orders)||0)/u*100):0}));return{title:t?.title||Ea.title,period:t?.period||Ea.period,summary:{totalOrders:o,revenueGenerated:a,growthPercentage:s,growthTotalPercentage:l,currencyType:c},outlets:d.length>0?d:Ea.outlets}}function Ype({data:e,title:t,period:n,icon:r}){const i=Hpe(e),o=t||i.title,a=n||i.period,s=r||h.jsx(Ufe,{className:"!text-[24px] text-[#FA7E28]"}),l=i.summary.totalOrders??0,c=ek(i.summary.revenueGenerated),u=Bp(i.summary.growthPercentage,0),d=Bp(i.summary.growthTotalPercentage,0),f=u>=0,p=d>=0;return h.jsx(Ie,{className:"h-[324px]",title:o,period:a,icon:s,children:h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex gap-[24px]",children:[h.jsxs("div",{className:"w-[65%] flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Total Orders"}),h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#8B5CF6]",children:l}),h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] ${p?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[p?h.jsx(ns,{}):h.jsx(ts,{}),d,"%",h.jsx("span",{children:"from last month"})]})]}),h.jsxs("div",{className:"w-[30%] flex flex-col gap-[8px] ",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B] whitespace-nowrap",children:"Revenue Generated"}),h.jsxs("div",{className:"text-[28px] leading-[32px] font-medium text-[#329DFF] whitespace-nowrap",children:[i.summary.currencyType," ",c]}),h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] whitespace-nowrap ${f?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[f?h.jsx(ns,{}):h.jsx(ts,{}),u,"%",h.jsx("span",{children:"from last month"})]})]})]}),h.jsx("div",{className:"mt-[16px]",children:i.outlets.map((m,g)=>h.jsxs("div",{className:g===i.outlets.length-1?"":"mb-[16px]",children:[h.jsxs("div",{className:"flex justify-between text-sm mb-[8px]",children:[h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px]",children:m.name}),h.jsxs("div",{className:"font-medium text-[12px] leading-[16px] flex items-center",children:[h.jsxs("div",{className:"text-[#64748B] inline-block",children:[m.orders," orders"]}),h.jsxs("div",{className:"mx-2 text-[#121212] inline-block",children:[i.summary.currencyType," ",ek(m.revenue)]})]})]}),h.jsx("div",{className:"h-[11px] bg-gray-100 rounded-full",children:h.jsx("div",{className:`h-[11px] rounded-full ${m.color}`,style:{width:`${m.percentage}%`}})})]},`${m.name}-${g}`))})]})})}function Upe({data:e}){const t=e?.amenity_summary?{amenitySummary:{totalBookings:e?.amenity_summary?.total_bookings??0,todayPaidRevenue:e?.amenity_summary?.today_paid_revenue??"0.00",growthPercentage:e?.amenity_summary?.growth_percentage??null,bookingGrowth:e?.amenity_summary?.booking_growth??null,currencyType:e?.amenity_summary?.currency_type??"Rs"},chartData:Array.isArray(e?.chart_data)?e.chart_data.map(m=>({facility_name:m?.facility_name,total_bookings:m?.total_bookings??0,paid_revenue:m?.paid_revenue??"0",isPaid:m?.is_paid===!0})):[]}:e||{},n=t?.amenitySummary||{},i=(Array.isArray(t?.chartData)?t.chartData:[]).map(m=>({...m,isPaid:m?.isPaid===!0})),o=i.length>0&&i.every(m=>m?.isPaid===!1),a=n?.totalBookings||0,s=n?.bookingGrowth;let l=0;if(typeof s=="number")l=s;else if(typeof s=="string"){const m=s.replace("%","").trim(),g=Number(m);l=isNaN(g)?0:g}const c=i.reduce((m,g)=>{const v=g?.total_bookings||0;return m+v},0),u=i.map(m=>{const g=m?.total_bookings||0,v=m?.isPaid?`${n?.currencyType||"Rs"} ${m?.paid_revenue||"0.00"}`:"",x=c>0?Math.round(g/c*100):0;return{name:m?.facility_name||"Unknown",bookings:g,revenue:v,percentage:x,color:"bg-[#3C81F6]",isPaid:m?.isPaid}}),d=n?.growthPercentage;let f=null;if(typeof d=="number")f=d;else if(typeof d=="string"){const m=d.replace("%","").trim(),g=Number(m);f=isNaN(g)?null:g}const p=f!==null?f>=0:!0;return h.jsx(Ie,{className:"h-[324px]",title:"Amenities",period:"Today",icon:h.jsx(qfe,{className:"!text-[24px] text-[#8B5CF6]"}),children:h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex gap-[24px]",children:[h.jsxs("div",{className:"w-[65%] flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Total Bookings"}),h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#8B5CF6]",children:a}),h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] ${l>=0?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[l>=0?h.jsx(ns,{}):h.jsx(ts,{}),l,"%",h.jsx("span",{children:"from last month"})]})]}),!o&&h.jsxs("div",{className:"w-[30%] flex flex-col gap-[8px] ",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B] whitespace-nowrap",children:"Revenue Generated"}),h.jsxs("div",{className:"text-[28px] leading-[32px] font-medium text-[#329DFF] whitespace-nowrap",children:[n?.currencyType||"Rs"," ",n?.todayPaidRevenue??"0.00"]}),f!==null&&h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] whitespace-nowrap ${p?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[p?h.jsx(ns,{}):h.jsx(ts,{}),f,"%",h.jsx("span",{children:"from last month"})]})]})]}),h.jsx("div",{className:"mt-[16px]",children:u.length>0?u.map((m,g)=>h.jsxs("div",{className:g===u.length-1?"":"mb-[16px]",children:[h.jsxs("div",{className:"flex justify-between text-sm mb-[8px]",children:[h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px]",children:m?.name}),h.jsxs("div",{className:"font-medium text-[12px] leading-[16px]",children:[h.jsxs("div",{className:"text-[#64748B] inline",children:[m?.bookings," ",m?.bookings<=1?"booking":"bookings"]}),m?.isPaid&&h.jsx("div",{className:"mx-2 text-[#121212] inline",children:m?.revenue})]})]}),h.jsx("div",{className:"h-[11px] bg-gray-100 rounded-full",children:h.jsx("div",{className:`h-[11px] rounded-full ${m?.color}`,style:{width:`${m?.percentage}%`}})})]},g)):h.jsx("div",{className:"flex items-center justify-center h-[120px]",children:h.jsx("div",{className:"text-[12px] text-[#94A3B8]",children:"No amenity usage data available"})})})]})})}Kn.register(Ro,Io,Fl,Gr,li);function Kpe({data:e=[]}){const t=[{level:"L1",open:55,in_progress:22,on_hold:15,closed:6},{level:"L2",open:45,in_progress:25,on_hold:18,closed:5},{level:"L3",open:58,in_progress:23,on_hold:14,closed:6}],n=e.length>0?e:t,r=[],i=[],o=[],a=[],s=[];for(let u=0;u<n.length;u++)r.push(n[u].level),i.push(Number(n[u].open)),o.push(Number(n[u].in_progress)),a.push(Number(n[u].on_hold)),s.push(Number(n[u].cancelled));const l={labels:r,datasets:[{label:"Open",data:i,backgroundColor:"#3B82F6",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"},{label:"In Progress",data:o,backgroundColor:"#F59E0B",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"},{label:"On-Hold",data:a,backgroundColor:"#64748B",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"},{label:"Cancelled",data:s,backgroundColor:"#FB2C36",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"}]},c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{usePointStyle:!1,pointStyle:"rect",padding:12,boxWidth:20,boxHeight:8,color:"#64748B"}},tooltip:{backgroundColor:"#0F172A",titleColor:"#fff",bodyColor:"#fff"}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{color:"#64748B"}},y:{stacked:!0,beginAtZero:!0,grid:{display:!1,color:"#E5E7EB",borderDash:[4,4],drawBorder:!1},ticks:{color:"#64748B",stepSize:1,precision:0,callback:u=>Math.round(u)}}}};return h.jsx(Ie,{className:"h-[267px]",title:"Ticket Escalation Levels",period:"Today",icon:h.jsx(_8,{className:"!text-[24px] text-[#3C81F6]"}),children:h.jsx("div",{className:"h-full",children:h.jsx(Bl,{data:l,options:c})})})}const qpe=({active:e,payload:t})=>{if(!e||!t||!t.length)return null;const n=t[0],r=n.payload.color;return h.jsx("div",{style:{backgroundColor:"#000000",color:"#ffffff",padding:"8px 10px",borderRadius:"8px",fontSize:"12px"},children:h.jsxs("div",{className:"flex items-center gap-[8px] font-medium",children:[h.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:r}}),h.jsx("div",{children:n.name}),h.jsx("div",{className:"ml-2",children:n.value})]})})};function Gpe({data:e=null}){const n=e||{open:12,on_hold:5,cancelled:3,completed:156,in_progress:8,total_complaints:184},r=a=>{const s=Number(a);return isNaN(s)?0:s},i=[{name:"Completed",value:r(n.completed),color:"#10B981"},{name:"Open",value:r(n.open),color:"#3B82F6"},{name:"In Progress",value:r(n.in_progress),color:"#F59E0B"},{name:"On Hold",value:r(n.on_hold),color:"#6B7280"},{name:"Cancelled",value:r(n.cancelled),color:"#EF4444"}],o=r(n.total_complaints);return h.jsx(Ie,{className:"h-[267px]",title:"Ticket Status",period:"Today",icon:h.jsx(Qv,{className:"!text-[24px] text-[#EF4444]"}),children:h.jsxs("div",{className:"flex h-full items-center gap-[16px]",children:[h.jsxs("div",{className:"w-[202px] h-[170px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:i,innerRadius:55,outerRadius:85,dataKey:"value",stroke:"#FFFFFF",strokeWidth:2,children:i.map((a,s)=>h.jsx(In,{fill:a.color},s))}),h.jsx(Dt,{content:a=>h.jsx(dr,{...a,data:i,children:h.jsx(qpe,{...a})})})]})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsxs("div",{className:"flex items-baseline text-[18px] leading-[22px] font-medium text-[#121212]",children:[h.jsx("div",{children:r(n.completed)}),h.jsxs("div",{className:"text-[18.18px] leading-[22.22px] text-[#121212]",children:["/",o]})]}),h.jsx("div",{className:"text-[10.1px] leading-[14.14px] text-[#64748B]",children:"Completed"})]})]}),h.jsx("div",{className:"flex-1 space-y-2",children:i.map(a=>h.jsxs("div",{className:"flex items-center justify-between text-[12px] leading-[17px] mt-[12px]",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"h-[7px] w-[16px]",style:{backgroundColor:a.color}}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:a.name})]}),h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px] font-medium",children:a.value})]},a.name))})]})})}const tk={visitorSummary:{totalVisitorsToday:150,peakTime:"2:00 - 4:00PM",peakCount:50,activeWalkins:18,preApprovedCheckins:3},popupData:{walkins:{currently_inside:18,total_visited_today:58},preApproved:{completed_visits:3,total_expected_today:5}},chart_data:[{hour:10,walkins:22,preApproved:30},{hour:12,walkins:15,preApproved:28},{hour:14,walkins:30,preApproved:38},{hour:16,walkins:45,preApproved:50},{hour:18,walkins:25,preApproved:40}]};function Xpe(e){const t=e>=12?"PM":"AM";let n=e%12;return n===0&&(n=12),`${n} ${t}`}function Qpe(e){if(typeof e=="number"&&e>=0&&e<=23)return e;if(typeof e=="string"){const t=e.trim().toUpperCase(),n=t.match(/^(\d{1,2})(?::\d{2})?\s*(AM|PM)$/);if(n){let i=Number(n[1])%12;return n[2]==="PM"&&(i+=12),i}const r=Number(t);if(!Number.isNaN(r)&&r>=0&&r<=23)return r}return null}function Zpe(e=[]){return Array.from({length:24},(t,n)=>{const r=e.find(i=>Qpe(i?.hour)===n)||{};return{hour:n,time:Xpe(n),walkins:Number(r?.walkins??0),approved:Number(r?.pre_approved??r?.preApproved??r?.approved??0)}})}function nk({title:e,color:t,rows:n=[],children:r}){const i=h.jsxs("div",{className:"bg-white rounded-[12px] min-w-[260px] p-[16px] border-[0.5px] border-[#EBEBEB] shadow-[0px_0px_12px_0px_#EAF2FF]",children:[h.jsx("div",{className:"flex items-center gap-[8px] font-medium text-[#121212]",children:h.jsx("div",{children:e??""})}),h.jsx("div",{className:"mt-[16px] pt-[16px] border-t border-dashed border-[#EBEBEB] space-y-[16px]",children:n?.map(({label:o,value:a,valueColor:s})=>h.jsxs("div",{className:"flex justify-between text-[14px] leading-[18px]",children:[h.jsx("div",{className:"text-[#64748B]",children:o??""}),h.jsx("div",{className:"font-semibold",style:{color:s||"#121212"},children:a??0})]},o))})]});return h.jsx(VR,{placement:"right-start",interactive:!0,delay:[100,0],offset:[6,0],appendTo:()=>document.body,maxWidth:"none",render:o=>h.jsx("div",{tabIndex:"-1",...o,children:i}),children:r})}function Jpe({active:e,payload:t}){return!e||!t?.length?null:h.jsx("div",{className:"rounded-[8px] bg-[#121212] px-[12px] py-[8px] text-[12px] text-white shadow-lg",children:t.map(n=>h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.stroke}}),h.jsx("span",{className:"min-w-[82px] text-[#D1D3D4]",children:n.name}),h.jsx("span",{className:"font-semibold",children:n.value})]},n.dataKey))})}function ehe({data:e}){const t=e&&Object.keys(e).length?e:tk,n=t?.visitor_summary?{totalVisitorsToday:t?.visitor_summary?.total_visitors_today??0,peakTime:t?.visitor_summary?.peak_time??"-"}:t?.visitorSummary??{},r=t?.walkins_popup_data?{walkins:{currently_inside:Number(t?.walkins_popup_data?.walkins_inside??0),total_visited_today:Number(t?.walkins_popup_data?.total_walkins??0)},preApproved:{completed_visits:Number(t?.pre_approved_popup_data?.pre_approved_check_ins??0),total_expected_today:Number(t?.pre_approved_popup_data?.total_pre_approved_check_ins??0)}}:t?.popupData??{},i=P.useMemo(()=>{const l=t?.chart_data??[];return Zpe(l.length?l:tk.chart_data)},[t]),{yAxisTicks:o,yAxisMax:a}=P.useMemo(()=>{const l=Math.max(...i.map(u=>Math.max(u.walkins,u.approved))),c=l>0?l:5;return{yAxisTicks:[0,Math.ceil(c/2),c],yAxisMax:c}},[i]),s=new Date().toLocaleTimeString("en-IN",{hour:"2-digit",minute:"2-digit",hour12:!0});return h.jsx(Ie,{className:"h-[377px]",title:"Visitor Updates",period:`Today at ${s}`,icon:h.jsx(Vb,{className:"!text-[24px] text-[#8B5CF6]"}),children:h.jsxs("div",{className:"flex flex-col gap-[24px]",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-y-4 gap-x-6",children:[h.jsxs("div",{className:"flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Total Visitors"}),h.jsx("div",{className:"text-[20px] font-medium text-[#08B6D4]",children:n?.totalVisitorsToday??0})]}),h.jsxs("div",{className:"flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Peak Time"}),h.jsx("div",{className:"text-[20px] font-medium text-[#8B5CF6]",children:n?.peakTime??"-"})]}),h.jsxs("div",{className:"mt-2 flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Active Walk-ins"}),h.jsxs("div",{className:"flex items-baseline text-xl font-medium leading-[32px]",children:[h.jsx("div",{className:"text-[28px] text-[#1FA05B] leading-[32px]",children:r?.walkins?.currently_inside??0}),h.jsx(nk,{title:"Active Walk-ins",color:"text-[#1FA05B]",rows:[{label:"Currently Inside",value:r?.walkins?.currently_inside??0,valueColor:"#1FA05B"},{label:"Total Visited Today",value:r?.walkins?.total_visited_today??0}],children:h.jsxs("div",{className:"text-[#64748B] cursor-pointer text-[20px] leading-[32px]",children:["/",r?.walkins?.total_visited_today??0]})})]})]}),h.jsxs("div",{className:"mt-2 flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Pre-approved Check-ins"}),h.jsxs("div",{className:"flex items-baseline text-xl font-medium leading-[32px]",children:[h.jsx("div",{className:"text-[28px] text-[#E7A015] leading-[32px]",children:r?.preApproved?.completed_visits??0}),h.jsx(nk,{title:"Pre-approved Check-ins",color:"text-[#E7A015]",rows:[{label:"Completed Visits",value:r?.preApproved?.completed_visits??0,valueColor:"#E7A015"},{label:"Total Expected Check-ins Today",value:r?.preApproved?.total_expected_today??0}],children:h.jsxs("div",{className:"text-[#64748B] cursor-pointer text-[20px] leading-[32px]",children:["/",r?.preApproved?.total_expected_today??0]})})]})]})]}),h.jsx("div",{className:"w-full h-[149px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(Yx,{data:i??[],margin:{top:5,right:0,left:0,bottom:-10},children:[h.jsx(ur,{stroke:"#E5E7EB",strokeDasharray:"4 4",vertical:!1}),h.jsx(Un,{dataKey:"time",tickFormatter:(l,c)=>c%4===0?l:"",axisLine:!1,tickLine:!1,tick:{fill:"#121212",fontSize:10,fontWeight:400}}),h.jsx(Ln,{width:24,axisLine:!1,tickLine:!1,allowDecimals:!1,ticks:o,domain:[0,a],tick:{fill:"#64748B",fontSize:10,fontWeight:400}}),h.jsx(Dt,{content:l=>h.jsx(dr,{...l,data:i,children:h.jsx(Jpe,{...l})})}),h.jsx(Qo,{type:"monotone",dataKey:"walkins",stroke:"#22C55E",strokeWidth:2,dot:!1,name:"Walk-ins",isAnimationActive:!1}),h.jsx(Qo,{type:"monotone",dataKey:"approved",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",dot:!1,name:"Pre-approved",isAnimationActive:!1})]})})})]})})}function the({data:e=null}){const t={total_entries:79.6,entries:59350,exit:40950},n=e&&Object.keys(e).length>0?e:t,r=c=>{const u=Number(c);return isNaN(u)?0:u},i=r(n.entries),o=r(n.exit),a=e&&Object.keys(e).length>0&&Number(e.entries)===0&&Number(e.exit)===0,s=[{name:"Entries",value:i,color:"#8B5CF6"},{name:"Exit",value:o,color:"#329DFF"}],l=r(n.total_entries);return h.jsx(kt,{className:"h-[362px]",title:"Access Overview",titleWeight:"semi-bold",children:a?h.jsx("div",{className:"h-[300px] flex items-center justify-center",children:h.jsx(En,{title:"No access Point Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsxs("div",{className:"flex flex-col items-center mt-[16px]",children:[h.jsxs("div",{className:"relative w-[212px] h-[212px]",children:[h.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h.jsx("div",{className:"w-[130px] h-[130px] rounded-full shadow-[0px_12px_35px_rgba(0,0,0,0.12)]"})}),h.jsx("div",{className:"h-[212px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:s,dataKey:"value",innerRadius:65,outerRadius:100,startAngle:360,endAngle:-180,paddingAngle:1,stroke:"transparent",children:s.map((c,u)=>h.jsx(In,{fill:c.color},u))}),h.jsx(Dt,{content:c=>h.jsx(dr,{...c,data:s,children:h.jsx(oi,{...c})})})]})})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsx("div",{className:"text-[22px] leading-[27px] font-medium text-[#121212]",children:l}),h.jsx("div",{className:"text-[12px] leading-[17px] text-[#64748B]",children:"Total Access"})]})]}),h.jsxs("div",{className:"mt-[28px] flex justify-between w-full px-[20px]",children:[h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsxs("div",{className:"flex items-center gap-[6px]",children:[h.jsx("div",{className:"w-[14px] h-[6px] bg-[#8B5CF6]"}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Entries"})]}),h.jsx("div",{className:"text-[18px] font-medium text-[#8B5CF6] mt-[4px]",children:i.toLocaleString()})]}),h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsxs("div",{className:"flex items-center gap-[6px]",children:[h.jsx("div",{className:"w-[14px] h-[6px] bg-[#329DFF]"}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Exit"})]}),h.jsx("div",{className:"text-[18px] font-medium text-[#329DFF] mt-[4px]",children:o.toLocaleString()})]})]})]})})}function LI({title:e="Access",data:t=[],height:n="h-[362px]"}){const r=i=>i==null?"0":Number(i).toLocaleString();return h.jsx(kt,{className:n,title:e,titleWeight:"semi-bold",children:h.jsxs("div",{className:"rounded-[12px] overflow-hidden mt-[16px]",children:[h.jsxs("div",{className:"grid grid-cols-2 bg-[#F8FAFC] py-[8px] px-[12px] text-[12px] leading-[16px] font-medium text-[#64748B]",children:[h.jsx("div",{children:"Point"}),h.jsx("div",{className:"text-right",children:"Access"})]}),t.map((i,o)=>h.jsxs("div",{className:"grid grid-cols-2 p-[12px] text-[14px] border-t border-[#E2E8F0]",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:i.label}),h.jsx("div",{className:"text-[12px] leading-[16px] text-right font-medium",style:{color:i.color||"#000"},children:r(i.value)})]},o))]})})}function nhe({data:e=[]}){const[t,n]=P.useState([]),r=e&&e.length?e:[],i=!e||e.length===0,o=e&&e.length>0&&e.every(c=>Number(c.entries)===0&&Number(c.exit)===0),a=i||o,s=c=>c>=1e3?`${c/1e3}K`:c,l=c=>{n(u=>u.includes(c)?u.filter(d=>d!==c):[...u,c])};return h.jsx(kt,{title:"Access Points Usage",titleWeight:"semi-bold",className:"h-[362px]",children:a?h.jsx("div",{className:"h-[270px] flex items-center justify-center",children:h.jsx(En,{title:"No access Point Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsx("div",{className:"mt-[24px] h-[270px] w-full",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:r,barSize:54,margin:{top:0,right:0,left:-20,bottom:0},children:[h.jsx(ur,{strokeDasharray:"8 8",vertical:!1}),h.jsx(Rx,{y:0,stroke:"#EBEBEB"}),h.jsx(Un,{dataKey:"block_name",tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1}),h.jsx(Ln,{tickFormatter:s,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1}),h.jsx(Dt,{cursor:!1,content:c=>h.jsx(dr,{...c,data:r,children:(()=>{if(!c.active||!c.label)return null;const u=r.find(d=>d.block_name===c.label);return h.jsxs("div",{className:"bg-[#111] text-white px-[14px] py-[8px] rounded-[6px] flex flex-col gap-[6px] text-[13px]",children:[h.jsx("div",{className:"font-semibold",children:c.label}),!t.includes("entries")&&h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-[#329DFF]"}),h.jsx("div",{className:"text-[#aaa]",children:"Entries"}),h.jsx("div",{className:"font-bold",children:u?.entries??0})]}),!t.includes("exit")&&h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-[#76BDFF]"}),h.jsx("div",{className:"text-[#aaa]",children:"Exit"}),h.jsx("div",{className:"font-bold",children:u?.exit??0})]})]})})()})}),h.jsx(El,{verticalAlign:"bottom",height:36,content:()=>{const c=[{key:"entries",label:"Entries",color:"#329DFF"},{key:"exit",label:"Exit",color:"#76BDFF"}];return h.jsx("div",{style:{display:"flex",gap:"20px",justifyContent:"center",marginTop:"20px"},children:c.map((u,d)=>{const f=t.includes(u.key);return h.jsxs("div",{onClick:()=>l(u.key),style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",opacity:f?.4:1},children:[h.jsx("div",{style:{width:"20px",height:"8px",backgroundColor:u.color}}),h.jsx("div",{style:{fontSize:"12px",color:"#64748B"},children:u.label})]},d)})})}}),h.jsx(Kt,{dataKey:"entries",stackId:"a",fill:"#329DFF",hide:t.includes("entries")}),h.jsx(Kt,{dataKey:"exit",stackId:"a",fill:"#76BDFF",hide:t.includes("exit")})]})})})})}const rhe=({x:e,y:t,payload:n})=>{const r=n.value.split(" ");return h.jsx("g",{transform:`translate(${e},${t})`,children:h.jsx("text",{x:-85,y:0,textAnchor:"start",fill:"#121212",fontSize:14,children:r.map((i,o)=>h.jsx("tspan",{x:-85,dy:o===0?0:16,children:i},o))})})};function ihe({data:e=[]}){const t=e&&e.length>0,n=e.map(r=>({name:r.category_name,value:r.total_complaints,color:"#08B6D4"}));return h.jsx(kt,{title:"Tickets per Category",className:"h-[362px]",titleWeight:"semi-bold",childrenClassName:"h-full mt-[24px]!",children:t?h.jsx("div",{className:"w-full h-[262px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:n,layout:"vertical",margin:{top:0,right:8,left:-20,bottom:0},children:[h.jsx(ur,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E5E7EB"}),h.jsx(Un,{type:"number",tick:{fill:"#94A3B8",fontSize:12},axisLine:!0,tickLine:!1,tickMargin:10,allowDecimals:!1}),h.jsx(Ln,{type:"category",dataKey:"name",axisLine:!1,tickLine:!1,width:132,tick:h.jsx(rhe,{})}),h.jsx(Dt,{cursor:{fill:"transparent"},position:{x:300,y:0},allowEscapeViewBox:{x:!0,y:!0},content:r=>r.active?h.jsx(dr,{...r,data:n,children:h.jsx(oi,{...r})}):null}),h.jsx(Kt,{dataKey:"value",barSize:36,fill:"#08B6D4"})]})})}):h.jsx(En,{title:"No Tickets Found",description:"Catch up all the data. Change the date range to see the data."})})}function ohe({icon:e,iconColor:t="#329DFF",title:n,value:r,percentage:i,percentageText:o}){const a=parseFloat(i),s=a>=0,l=s?"#16A34A":"#DC2626";return h.jsxs("div",{className:"relative bg-white !border-[0.5px] !border-[#EBEBEB] !rounded-[12px] !shadow-[0_0_12px_0_#EAF2FF] p-[16px]",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[e&&h.jsx("div",{className:"h-[20px] w-[20px]",style:{color:t,display:"flex",alignItems:"center",justifyContent:"center"},children:h.jsx(e,{className:"h-[20px] w-[20px]"})}),h.jsx("div",{className:"text-[16px] leading-[20px] font-medium text-[#64748B]",children:n})]}),h.jsx("div",{className:"mt-[16px] text-[28px] leading-[32px] font-medium text-[#121212]",children:r}),(i||o)&&h.jsxs("div",{className:"mt-[12px] flex items-center gap-[8px]",children:[i&&h.jsxs("div",{className:"flex items-center gap-[4px] text-[12px] leading-[16px] font-medium",style:{color:l},children:[s?h.jsx(ns,{}):h.jsx(ts,{}),Math.abs(a),"%"]}),o&&h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:o})]})]})}const ahe=({data:e=[],onDateChange:t})=>{const[n,r]=P.useState(new Date),[i,o]=P.useState(!1),s=(v=>{const x=new Date(v);return x.setDate(x.getDate()-6),x})(n),l=v=>{try{return v.toLocaleDateString("en-GB",{day:"2-digit",month:"short"})}catch{return""}},c=v=>{const x=new Date(v),_=new Date(x);_.setDate(_.getDate()-6),t&&t(_.toISOString(),x.toISOString())},u=()=>{const v=new Date(n);v.setDate(v.getDate()-7),r(v),c(v)},d=()=>{const v=new Date(n);v.setDate(v.getDate()+7),r(v),c(v)},f=()=>{o(v=>!v)},p=v=>{const x=v||new Date;r(x),c(x),o(!1)},m=Array.isArray(e)?e:[],g=!m.length||m.every(v=>v.no_of_visitors===0);return h.jsxs(kt,{title:"Weekly Visitor Pattern",period:`${l(s)} - ${l(n)}`,isDateSelector:!0,titleWeight:"semi-bold",className:"h-[360px]",childrenClassName:"mt-6",onPrevClick:u,onNextClick:d,onCalendarClick:f,children:[i&&h.jsx("div",{className:"anarock-datepicker absolute top-[70px] right-[24px] z-50",children:h.jsx(kD,{selected:n,onChange:p,inline:!0,maxDate:new Date,showYearDropdown:!0,scrollableYearDropdown:!0,yearDropdownItemNumber:40})}),g?h.jsx("div",{className:"w-full h-[280px] flex items-center justify-center",children:h.jsx(En,{title:"No Visitors Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsx("div",{className:"w-full h-[280px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(kj,{data:m,margin:{top:10,right:-10,left:-10,bottom:0},children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:"colorVisitors",x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:"#6366F1",stopOpacity:.25}),h.jsx("stop",{offset:"100%",stopColor:"#6366F1",stopOpacity:0})]})}),h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#F1F5F9"}),h.jsx(Un,{dataKey:"day",type:"category",scale:"point",padding:{left:20,right:20},tick:{fontSize:12,fill:"#64748B"},axisLine:!0,tickLine:!1,tickFormatter:v=>new Date(v).toLocaleDateString("en-GB",{day:"2-digit",month:"short"})}),h.jsx(Ln,{width:35,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1,allowDecimals:!1,domain:[0,"dataMax + 2"]}),h.jsx(Dt,{cursor:!1,content:v=>{const{active:x,payload:_,label:w}=v;if(!x||!_?.length)return null;const y=new Date(w).toLocaleDateString("en-GB",{day:"2-digit",month:"short"});return h.jsx(dr,{...v,data:m,children:h.jsx(oi,{active:x,payload:_,label:y})})}}),h.jsx(Bx,{type:"monotone",dataKey:"no_of_visitors",stroke:"#6366F1",strokeWidth:2,fill:"url(#colorVisitors)",dot:{r:5,stroke:"#6366F1",strokeWidth:2,fill:"#fff"},activeDot:v=>{const{cx:x,cy:_,stroke:w}=v;return h.jsxs("g",{children:[h.jsx("circle",{cx:x,cy:_,r:6,fill:"#fff",stroke:"#6466F1",strokeWidth:2}),h.jsx("circle",{cx:x,cy:_,r:2.5,fill:"#6466F1"})]})}})]})})})]})},she=[{building_name:"Google",no_of_visitors:1e3},{building_name:"Uber",no_of_visitors:3500},{building_name:"ANAROCK",no_of_visitors:2e3},{building_name:"Flipkart",no_of_visitors:8e3},{building_name:"HP",no_of_visitors:1650}],lhe=({data:e,title:t,bar:n})=>{const r=Array.isArray(e)&&e?.length===0,i=e==null?she:Array.isArray(e)?e:[];return h.jsx(kt,{title:t||"Organisation Wise Visitors",titleWeight:"semi-bold",className:"h-[360px]",childrenClassName:"mt-6",children:h.jsx("div",{className:"w-full h-[260px] flex items-center justify-center",children:r?h.jsx(En,{title:t||"Organisation Wise Visitors",description:"Catch up all the data. Change the date range to see the data."}):h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:i||[],margin:{top:10,right:10,left:10,bottom:-10},barCategoryGap:35,children:[h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#F1F5F9"}),h.jsx(Un,{dataKey:"building_name",tick:{fontSize:12,fill:"#64748B"},axisLine:!0,tickLine:!1}),h.jsx(Ln,{width:40,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1,allowDecimals:!1}),h.jsx(Dt,{cursor:!1,content:o=>o.active?h.jsx(dr,{...o,data:i,children:h.jsx(oi,{...o})}):null}),h.jsx(Kt,{dataKey:"no_of_visitors",name:"Visitors",maxBarSize:55,fill:n||"#3C81F6"})]})})})})};function che({data:e}){return h.jsx("div",{className:"h-full",children:e.map((t,n)=>{const r=parseFloat(t.delta),i=r>=0;return h.jsx(Ie,{iconClassName:"!gap-[8px]",title:h.jsx("div",{className:"text-[#64748B]",children:t.title}),icon:h.jsx(t.Icon,{className:"h-[20px] w-[20px]",style:{color:t.iconColor||"#000000"}}),className:`${t?.widget==="amenities"?"h-[139px]":"h-[124px]"}`,children:h.jsxs("div",{className:`flex flex-col gap-[8px] ${t?.widget==="amenities"?"mt-[3.5px]":"mt-0"}`,children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:t.value}),h.jsxs("div",{className:`flex items-center text-[12px] leading-[16px] ${t.delta?"gap-[8px]":""}`,children:[t.delta&&h.jsxs("div",{className:`flex items-center gap-[4px] px-[6px] py-[2px] rounded-[4px] font-medium
|
|
393
|
+
*/const Kfe=[["path",{d:"M19 5a2 2 0 0 0-2 2v11",key:"s41o68"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}],["path",{d:"M7 13h10",key:"1rwob1"}],["path",{d:"M7 9h10",key:"12czzb"}],["path",{d:"M9 5a2 2 0 0 0-2 2v11",key:"x0q4gh"}]],qfe=Yi("waves-ladder",Kfe),kt=({title:e,icon:t,period:n,isDateSelector:r=!1,children:i,footer:o,className:a="",titleWeight:s,titleColor:l,iconClassName:c,titleClassName:u,childrenClassName:d,rightContent:f,onCalendarClick:p,onPrevClick:m,onNextClick:g})=>{const v=s==="semi-bold"?600:500;return h.jsxs("div",{className:`relative bg-white p-[24px] !border-[0.5px] !border-[#EBEBEB] !rounded-[12px] !shadow-[0_0_12px_0_#EAF2FF] ${a}`,children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[t&&h.jsx("div",{className:c,children:t}),h.jsx("div",{style:{fontWeight:v,color:l||"#121212"},className:u||"text-[20px] leading-[24px]",children:e})]}),h.jsxs("div",{className:"flex items-center gap-[12px]",children:[f&&f,n&&!r&&h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:n}),r&&h.jsxs("div",{className:"flex items-center gap-[12px] px-[16px] py-[8px] rounded-[8px] bg-white text-sm text-[#64748B]",children:[h.jsx(jfe,{size:16,className:"text-[#64748B] cursor-pointer",onClick:p}),h.jsx(RI,{size:16,className:"cursor-pointer",onClick:m}),h.jsx("span",{className:"text-[12px] leading-[16px] text-[#64748B]",children:n}),h.jsx(II,{size:16,className:"cursor-pointer",onClick:g})]})]})]}),h.jsx("div",{className:`flex-1 min-h-0 mt-4 ${d}`,children:i}),o&&h.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100 text-[12px] text-[#64748B]",children:o})]})},Gfe={completed:18,not_completed:6,missed:4};function Xfe({data:e={}}){const t=e&&Object.keys(e).length>0?e:Gfe,n=[{name:"Completed",value:Number(t?.completed??0),color:"#12B981"},{name:"Delayed",value:Number(t?.not_completed??0),color:"#EF4444"},{name:"Missed",value:Number(t?.missed??0),color:"#F69E0A"}],r=Number(t?.completed??0)+Number(t?.not_completed??0)+Number(t?.missed??0),i=Number(t?.completed??0);return h.jsx(kt,{title:"Guard Patrols",className:"h-[362px]",titleWeight:"semi-bold",children:h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"w-[215px] h-[182px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:n??[],innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",nameKey:"name",children:n?.map?.((o,a)=>h.jsx(In,{fill:o?.color??"#ccc"},`cell-${a}`))}),h.jsx(Dt,{content:h.jsx(hs,{}),wrapperStyle:{zIndex:9999}})]})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsxs("div",{className:"font-medium text-[19.35px] leading-[23.65px]",children:[i??0,"/",r??0]}),h.jsx("div",{className:"text-[10.75px] leading-[15.05px] text-[#64748B]",children:"Completed"})]})]}),h.jsx("div",{className:"flex flex-col w-full text-[14px]",children:n?.length?n?.map?.((o,a)=>h.jsxs("div",{className:`flex items-center justify-between py-[10px] ${a!==(n?.length??0)-1?"border-b border-[#F1F5F9]":""}`,children:[h.jsxs("div",{className:"flex items-center gap-[10px]",children:[h.jsx("div",{className:"inline-block w-[16px] h-[7px]",style:{backgroundColor:o?.color??"#ccc"}}),h.jsx("div",{className:"leading-[16.09px] text-[12.07px] text-[#64748B]",children:o?.name??"-"})]}),h.jsx("div",{className:"leading-[16.09px] text-[12.07px] text-[#64748B]",children:o?.value??0})]},o?.name??a)):h.jsx("div",{className:"text-center text-gray-400 text-sm py-[24px]",children:"No patrol data"})})]})})}Kn.register(Ro,Io,M1,T1,Gr,li);const Qfe=["10 AM","12 PM","2 PM","4 PM","6 PM","8 PM","10 PM"],nf={guest:[9,5,12,7,3,6,4],cab:[15,12,10,14,7,12,8],delivery:[22,18,16,20,22,14,17],service:[13,12,8,9,5,10,7]},Zfe=[{key:"Guest",datasetIndex:0,color:"#EF4444"},{key:"Cab",datasetIndex:1,color:"#7C3AED"},{key:"Delivery",datasetIndex:2,color:"#10B981"},{key:"Service",datasetIndex:3,color:"#F59E0B"}],Jfe=({color:e,size:t=12})=>h.jsx("svg",{width:t,height:t,viewBox:"0 0 12 12",style:{display:"block",flexShrink:0},children:h.jsx("rect",{x:"1",y:"1",width:"10",height:"10",rx:"0",fill:e,transform:"rotate(45 6 6)"})}),epe=({chartRef:e})=>{const[t,n]=P.useState({}),r=i=>{const o=e.current;if(!o)return;const a=o.getDatasetMeta(i),s=!!a.hidden;a.hidden=!s,o.update(),n(l=>({...l,[i]:!s}))};return h.jsx("div",{style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center",gap:"76px",marginTop:"10px",paddingBottom:"8px",flexWrap:"wrap"},children:Zfe.map(({key:i,datasetIndex:o,color:a})=>{const s=!!t[o];return h.jsxs("div",{onClick:()=>r(o),style:{display:"flex",alignItems:"center",gap:"6px",cursor:"pointer",userSelect:"none",opacity:s?.45:1,transition:"opacity 0.2s ease"},children:[h.jsx(Jfe,{color:a,size:12}),h.jsx("span",{style:{fontSize:"13px",color:"#64748B",fontWeight:400,lineHeight:1,textDecoration:s?"line-through":"none",transition:"text-decoration 0.15s ease"},children:i})]},i)})})},tpe=({data:e})=>{const t=P.useRef(null),r={labels:Array.isArray(e?.labels)&&e.labels.length>0?e.labels:Qfe,datasets:[{label:"Guest",data:Array.isArray(e?.guest)&&e.guest.length>0?e.guest:nf.guest,borderColor:"#EF4444",backgroundColor:"rgba(239,68,68,0.15)",pointBackgroundColor:"#EF4444",pointStyle:"rectRot",fill:!1},{label:"Cab",data:Array.isArray(e?.cab)&&e.cab.length>0?e.cab:nf.cab,borderColor:"#7C3AED",backgroundColor:"rgba(124,58,237,0.15)",pointBackgroundColor:"#7C3AED",pointStyle:"rectRot",fill:!1},{label:"Delivery",data:Array.isArray(e?.delivery)&&e.delivery.length>0?e.delivery:nf.delivery,borderColor:"#10B981",backgroundColor:"rgba(16,185,129,0.15)",pointBackgroundColor:"#10B981",pointStyle:"rectRot",fill:!1},{label:"Service",data:Array.isArray(e?.service)&&e.service.length>0?e.service:nf.service,borderColor:"#F59E0B",backgroundColor:"rgba(245,158,11,0.15)",pointBackgroundColor:"#F59E0B",pointStyle:"rectRot",fill:!1}]},i={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:{display:!1},tooltip:{enabled:!1,external:Fi({titleFormatter:o=>o.title?.[0]||"",hideTitleForSingle:!1})}},scales:{x:{grid:{color:"#F1F5F9"},ticks:{color:"#64748B"}},y:{beginAtZero:!0,suggestedMax:28,grid:{color:"#F1F5F9"},ticks:{color:"#64748B",stepSize:4,precision:0}}},elements:{line:{borderWidth:2,tension:0},point:{radius:0,hoverRadius:3,hitRadius:10}}};return h.jsxs(Ie,{title:"Hourly Traffic Flow",className:"w-full h-[362px]",children:[h.jsx("div",{style:{height:"calc(100% - 44px)",width:"100%"},children:h.jsx(j1,{ref:t,data:r,options:i})}),h.jsx(epe,{chartRef:t})]})},npe={open:4,in_progress:7,closed:12},rpe=[{incident_code:"INC-401",severity_level:"L1",severity:"Danger"},{incident_code:"INC-402",severity_level:"L2",severity:"High"},{incident_code:"INC-403",severity_level:"L3",severity:"Low"}];function ipe({incidentReports:e={},incidentReportsDetails:t=[]}){const n=e&&Object.keys(e).length>0?e:npe,r=Array.isArray(t)?t:rpe,i=Number(n?.open??0),o=Number(n?.in_progress??0),a=Number(n?.closed??0);return h.jsx(kt,{title:"Incident Reports",className:"h-[362px]",titleWeight:"semi-bold",children:h.jsxs("div",{children:[h.jsxs("div",{className:"flex w-full text-center gap-[24px]",children:[h.jsxs("div",{className:"flex-1 py-[12px] bg-[#FBF4F4] h-[76px] rounded",children:[h.jsx("div",{className:"!text-[24px] leading-[28px] font-medium text-[#AB0000]",children:i??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#AB0000]",children:"Open"})]}),h.jsxs("div",{className:"flex-1 py-[12px] bg-[#FFFBF2] h-[76px] rounded",children:[h.jsx("div",{className:"!text-[24px] leading-[28px] font-medium text-[#E7A015]",children:o??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#E7A015]",children:"In-progress"})]}),h.jsxs("div",{className:"flex-1 py-[12px] bg-[#F7FEFA] h-[76px] rounded",children:[h.jsx("div",{className:"!text-[24px] leading-[28px] font-medium text-[#1FA05B]",children:a??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#1FA05B]",children:"Closed"})]})]}),h.jsx("div",{className:"mt-4 space-y-2",children:r?.length?r?.map?.((s,l)=>{const c=s?.severity==="Danger"?"text-[#AB0000]":s?.severity==="High"?"text-[#E7A015]":"text-[#1FA05B]";return h.jsxs("div",{className:"flex items-center justify-between p-[12px] bg-[#FAFBFD] rounded-md",children:[h.jsx("div",{className:"flex items-center gap-[8px]",children:h.jsx("div",{className:"text-gray-700 font-medium",children:s?.incident_code??"-"})}),h.jsx("div",{className:`!text-[12px] font-semibold flex items-center gap-[4px] ${c}`,children:h.jsxs("div",{children:[s?.severity_level??"-"," - ",s?.severity??"-"]})})]},l)}):h.jsx("div",{className:"text-center text-gray-400 text-sm py-[24px]",children:"No incidents found"})})]})})}const ope=[{total_staff:42,absent_staff:6}],ape=[{staff_role_name:"Security Guard",total_staff:18,present_staff:16},{staff_role_name:"Supervisor",total_staff:8,present_staff:7},{staff_role_name:"Technician",total_staff:10,present_staff:9},{staff_role_name:"Technician",total_staff:10,present_staff:9}];function spe({staffPresentAbsent:e,staffPresentByRole:t}){const n=Array.isArray(e)&&e.length>0?e:ope,r=Array.isArray(t)&&t.length>0?t:ape,i=n?.[0]?.total_staff??0,o=n?.[0]?.absent_staff??0,a=(i??0)-(o??0);return h.jsx(kt,{title:"Staff Attendance",className:"h-[362px] overflow-hidden ",titleWeight:"semi-bold",children:h.jsxs("div",{children:[h.jsxs("div",{className:"flex gap-[16px] text-center mt-[24px]",children:[h.jsxs("div",{className:"flex-1 py-[12px] bg-[#F7FEFA] rounded h-[76px]",children:[h.jsx("div",{className:"text-[24px] font-medium text-[#1FA05B]",children:a??0}),h.jsx("div",{className:"text-[12px] text-[#1FA05B]",children:"Present"})]}),h.jsxs("div",{className:"flex-1 py-[12px] bg-[#FBF4F4] rounded h-[76px]",children:[h.jsx("div",{className:"text-[24px] font-medium text-[#AB0000]",children:o??0}),h.jsx("div",{className:"text-[12px] text-[#AB0000]",children:"Absent"})]})]}),h.jsx("div",{className:"mt-[24px] pb-[16px] space-y-[8px] overflow-y-auto max-h-[200px] hide-scrollbar",children:r?.length?r?.map?.((s,l)=>{const c=Number(s?.total_staff??0),u=Number(s?.present_staff??0);return h.jsxs("div",{className:"flex items-center justify-between p-[12px] bg-[#F8FAFC] rounded-md",children:[h.jsx("div",{className:"text-[#121212] text-[14px] leading-[18px] font-medium",children:s?.staff_role_name??"-"}),h.jsxs("div",{className:"text-[14px] leading-[20px] text-[#64748B]",children:[u??0,"/",c??0]})]},l)}):h.jsx(h.Fragment,{})})]})})}function lpe(e){return tt({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M116,132V96a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm12,56a16,16,0,1,0-16-16A16,16,0,0,0,128,188ZM228,56v56c0,54.29-26.32,87.22-48.4,105.29-23.71,19.39-47.44,26-48.44,26.29a12.1,12.1,0,0,1-6.32,0c-1-.28-24.73-6.9-48.44-26.29C54.32,199.22,28,166.29,28,112V56A20,20,0,0,1,48,36H208A20,20,0,0,1,228,56Zm-24,4H52v52c0,35.71,13.09,64.69,38.91,86.15A126.14,126.14,0,0,0,128,219.38a126.28,126.28,0,0,0,37.09-21.23C190.91,176.69,204,147.71,204,112Z"},child:[]}]})(e)}function cpe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50"}){return h.jsxs(Ie,{title:e,icon:h.jsx("div",{className:"h-6 w-6 grid place-items-center",children:h.jsx(o,{className:`h-6 w-6 ${a}`})}),children:[h.jsx("div",{className:"text-4xl font-semibold tracking-tight text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] text-[14px]",children:[h.jsx("div",{className:i?"text-emerald-600 font-medium":"text-rose-600 font-medium",children:n}),h.jsx("div",{className:"text-slate-500",children:r})]})]})}const upe=[{title:"Total Visitors",value:160,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Hb,iconColor:"text-[#329DFF]"},{title:"Active Incidents",value:73,delta:"+2.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Joe,iconColor:"text-[#F69E0A]"},{title:"Missed Patrols",value:3,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:lpe,iconColor:"text-[#AB0000]"},{title:"Parking Usage",value:5,delta:"-8.0%",deltaLabel:"Compared to last month",positive:!1,Icon:g8,iconColor:"text-[#36AB6C]"}];function dpe({data:e}){const t=Array.isArray(e)&&e.length>0?e:upe;return h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[24px]",children:t.map((n,r)=>h.jsx(cpe,{...n},r))})}const fpe=[{title:"Maintenance",total:12,pending:3},{title:"Security",total:8,pending:1},{title:"Housekeeping",total:6,pending:2},{title:"Utilities",total:10,pending:4}],ppe=(e="")=>e.replace(/</g,"<").replace(/>/g,">").replace(/<[^>]*>/g,"").trim();function hpe({data:e}){const t=Array.isArray(e?.complaints_by_category)&&e.complaints_by_category.length>0?e.complaints_by_category.map(n=>({title:ppe(n.category_name)||"—",total:n.total||0,pending:n.pending||0})):fpe;return h.jsx(Ie,{title:"Complaints",className:"h-[362px]",titleWeight:"semi-bold",titleClassName:"!text-[20px] !leading-[24px]",children:h.jsx("div",{className:"flex flex-col gap-[12px]",children:t.map((n,r)=>h.jsxs("div",{className:"flex items-center justify-between bg-[#F9FAFB] rounded-[8px] p-[12px] h-[62px]",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-[#121212] capitalize",children:n.title}),h.jsxs("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:["Total: ",n.total]})]}),h.jsxs("div",{className:"flex flex-col items-end",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-red-700",children:String(n.pending).padStart(2,"0")}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Pending"})]})]},r))})})}const mpe=e=>{const t={0:"𝟎",1:"𝟏",2:"𝟐",3:"𝟑",4:"𝟒",5:"𝟓",6:"𝟔",7:"𝟕",8:"𝟖",9:"𝟗"};return String(e).split("").map(n=>t[n]||n).join("")},gpe=[{level:"Level 1",open_count:3,in_progress_count:4,closed_count:5,total:12},{level:"Level 2",open_count:1,in_progress_count:1,closed_count:1,total:3},{level:"Level 3",open_count:5,in_progress_count:2,closed_count:3,total:10}],vpe=()=>{const e=[{label:"Open",color:"#EF4444"},{label:"In Progress",color:"#F59D0D"},{label:"Closed",color:"#12B981"}];return h.jsx("div",{style:{display:"flex",justifyContent:"space-between",gap:"15px"},children:e.map(t=>h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[h.jsx("div",{style:{width:"6px",height:"6px",backgroundColor:t.color,transform:"rotate(45deg)"}}),h.jsx("span",{style:{fontSize:"14px"},children:t.label})]},t.label))})},ype=({data:e})=>{const t=P.useMemo(()=>(Array.isArray(e?.complaints_by_level)&&e.complaints_by_level.some(l=>Number(l.total)>0)?e.complaints_by_level:gpe).map(l=>({level:l.level||"—",open_count:Number(l.open_count)||0,in_progress_count:Number(l.in_progress_count)||0,closed_count:Number(l.closed_count)||0,total:Number(l.total)||0})),[e]),n=P.useMemo(()=>Math.max(...t.map(a=>a.total),5),[t]),r=Math.ceil(n*1.2),i=6,o=Math.max(Math.ceil(n/i),1);return h.jsxs(Ie,{title:"Complaints by Level",className:"w-full h-[362px]",titleWeight:"semi-bold",titleClassName:"!text-[20px] !leading-[24px]",children:[h.jsx(Ot,{width:"100%",height:"85%",children:h.jsxs(No,{data:t,margin:{top:5,right:-25,left:-30,bottom:5},children:[h.jsx(ur,{strokeDasharray:"0",vertical:!1}),h.jsx(Un,{dataKey:"level"}),h.jsx(Ln,{domain:[0,r],ticks:Array.from({length:i+1},(a,s)=>s*o)}),h.jsx(Dt,{content:h.jsx(hs,{titleFormatter:a=>a,hideTitleForSingle:!1,rowFormatter:({payload:a})=>a.map(s=>({color:s.color||s.fill||s.payload?.color||"",label:s.name||s.dataKey,value:mpe(s.value??0)}))}),cursor:!1}),h.jsx(Kt,{dataKey:"open_count",name:"Open",stackId:"a",fill:"#EF4444",barSize:44,radius:[0,0,0,0]}),h.jsx(Kt,{dataKey:"in_progress_count",name:"In Progress",stackId:"a",fill:"#F59D0D",barSize:44,radius:[0,0,0,0]}),h.jsx(Kt,{dataKey:"closed_count",name:"Closed",stackId:"a",fill:"#12B981",barSize:44,radius:[0,0,0,0]})]})}),h.jsx(vpe,{})]})},bpe=[{title:"Maintenance",total:18,pending:4},{title:"Security",total:11,pending:2},{title:"Housekeeping",total:9,pending:3},{title:"Utilities",total:14,pending:5}];function xpe({data:e}){const t=Array.isArray(e?.request_box_by_type)&&e.request_box_by_type.length>0?e.request_box_by_type.map(n=>({title:n.category_name||"—",total:Number(n.total)||0,pending:Number(n.pending)||0})):bpe;return h.jsx(Ie,{title:"Request Box",className:"h-[362px]",titleWeight:"semi-bold",titleClassName:"!text-[20px] !leading-[24px]",children:h.jsx("div",{className:"flex flex-col gap-[12px]",children:t.map((n,r)=>h.jsxs("div",{className:"flex items-center justify-between bg-[#F9FAFB] rounded-[8px] p-[12px] h-[62px]",children:[h.jsxs("div",{className:"flex flex-col",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-[#121212] capitalize",children:n.title}),h.jsxs("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:["Total: ",n.total]})]}),h.jsxs("div",{className:"flex flex-col items-end",children:[h.jsx("div",{className:"text-[14px] leading-[18px] font-medium text-red-700",children:String(n.pending).padStart(2,"0")}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Pending"})]})]},`${n.title}-${r}`))})})}function wpe(e){return tt({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinejoin:"round",strokeWidth:"32",d:"M416 221.25V416a48 48 0 0 1-48 48H144a48 48 0 0 1-48-48V96a48 48 0 0 1 48-48h98.75a32 32 0 0 1 22.62 9.37l141.26 141.26a32 32 0 0 1 9.37 22.62z"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M256 56v120a32 32 0 0 0 32 32h120m-232 80h160m-160 80h160"},child:[]}]})(e)}const _pe=["open_complaints","pending_requests","avg_response_time","resolution_rate"],Epe={open_complaints:{title:"Open Complaints",Icon:ND,iconColor:"#AB0000",deltaLabel:"Compared to last month"},pending_requests:{title:"Pending Requests",Icon:wpe,iconColor:"#E7A015",deltaLabel:"Compared to last month"},avg_response_time:{title:"Avg Response Time",Icon:O8,iconColor:"#1FA05B",deltaLabel:"Compared to last month"},resolution_rate:{title:"Resolution Rate",Icon:w8,iconColor:"#329DFF",deltaLabel:"Compared to last month"}},Spe=({children:e,size:t=28,lineHeight:n=32,weight:r=500,color:i="#121212"})=>h.jsx("div",{style:{fontWeight:r,fontSize:`${t}px`,lineHeight:`${n}px`,color:i},children:e}),Ope={primary:{size:28,lineHeight:32,weight:500}},Cpe={open_complaints:{current:24,trend_percent:"-8%",direction:"bad"},pending_requests:{current:17,trend_percent:"-5%",direction:"bad"},avg_response_time:{current:"2.4 h",trend_percent:"+6%",direction:"good"},resolution_rate:{current:"89%",trend_percent:"+4%",direction:"good"}};function Ppe({id:e,data:t}){return e&&t&&!t[e]&&t.current!==void 0?h.jsx(QP,{id:e,data:t}):h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[16px]",children:_pe.map(n=>h.jsx(QP,{id:n},n))})}function QP({id:e,data:t}){const n=Epe[e];if(!n)return null;const r=(d,f)=>f==null?"—":d==="avg_response_time"?typeof f=="number"?`${f} h`:f:d==="resolution_rate"&&typeof f=="number"?`${f}%`:f,{title:i,Icon:o=bu,iconColor:a,deltaLabel:s}=n,l=t&&Object.keys(t).length>0?t:Cpe[e],c=r(e,l?.current),u=l?.trend_percent??"—";return l?.direction==="good"||l?.direction,h.jsx("div",{className:"h-[132px]",children:h.jsxs(Ie,{title:i,titleColor:a,icon:h.jsx("div",{className:"h-[20px] w-[20px] flex items-center justify-center",children:h.jsx(o,{className:"h-[20px] w-[20px]",style:{color:a}})}),childrenClassName:"!space-y-[12px]",iconClassName:"!gap-[12px]",children:[h.jsx(Spe,{...Ope.primary,children:c}),h.jsxs("div",{className:"flex items-center gap-[8px] text-[12px] leading-[16px]",children:[h.jsx(Ou,{value:u}),h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px]",children:s})]})]})})}const kpe=[{title:"Holi Celebration",date:"25 Jun 2025",rsvp:"78/100",utilisation:71,status:"Upcoming"},{title:"Maintenance Meeting",date:"25 Jun 2025",rsvp:"45/60",utilisation:75,status:"Completed"}];function Dpe({title:e,date:t,rsvp:n,utilisation:r,status:i}){return h.jsxs("div",{className:" bg-[#F8FAFC] h-[106px] px-[12px] mt-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("div",{className:"text-[16px] leading-[20px] font-semibold text-[#121212]",children:e}),h.jsx("div",{className:`!text-[12px] font-medium leading-[16px] px-[8px] py-[4px] ${i==="Completed"?"text-[#36AB6C] bg-[#E6F7EE]":i==="Upcoming"?"text-[#329DFF] bg-[#E6F2FF]":"text-slate-500 bg-slate-100"}`,children:i})]}),h.jsx("div",{className:"text-[14px] leading-[18px] text-[#64748B]",children:t}),h.jsxs("div",{className:"flex justify-between items-center mt-2",children:[h.jsxs("div",{className:"text-[14px] leading-[18px] text-[#64748B]",children:[n," RSVP"]}),h.jsxs("div",{className:"text-[#3C82F6] text-[14px] leading-[18px] font-medium",children:[r,"% utilisation"]})]}),h.jsx("div",{className:"w-full bg-[#F8FAFC] h-[6px] rounded mt-2 mb-3",children:h.jsx("div",{className:"h-[6px] rounded bg-[#3C82F6]",style:{width:`${r}%`}})})]})}function Ape({data:e}){const t=Array.isArray(e)?e:kpe;return h.jsx(Ie,{title:"Events Utilisation",className:"w-full h-[360px] overflow-y-auto hide-scrollbar",children:h.jsx("div",{className:"m-auto",children:t?.length>0?t.map((n,r)=>h.jsx(Dpe,{...n},`${n.title}-${r}`)):h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx(En,{})})})})}const Tpe=[{label:"Active",value:138,subLabel:"3 expiring soon",bgColor:"bg-[#F0FFF7]",textColor:"text-[#1FA05B]"},{label:"Scheduled",value:13,subLabel:"4 this week",bgColor:"bg-[#FFFBF2]",textColor:"text-[#E7A015]"},{label:"Recurring",value:3,subLabel:"All active",bgColor:"bg-[#EDF6FF]",textColor:"text-[#329DFF]"},{label:"Expired",value:7,subLabel:"4 recent",bgColor:"bg-[#F6F6F6]",textColor:"text-[#64748B]"}];function Mpe({label:e,value:t,subLabel:n,bgColor:r,textColor:i}){return h.jsxs("div",{className:`rounded-[8px] p-[16px] ${r} h-[124px]`,children:[h.jsx("div",{className:`text-[16px] font-medium ${i} leading-[20px]`,children:e}),h.jsx("div",{className:"mt-4 text-[28px] leading-[32px] font-semibold text-[#121212]",children:t}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#64748B] mt-2",children:n})]})}function Npe({data:e}){const t=Array.isArray(e)&&e.length>0?e:Tpe;return h.jsx(Ie,{title:"Notice Board Status",className:"w-full h-[360px]",children:h.jsx("div",{className:"grid grid-cols-2 gap-[16px]",children:t.map((n,r)=>h.jsx(Mpe,{...n},`${n.label}-${r}`))})})}function jpe(e){return tt({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 22H4C3.44772 22 3 21.5523 3 21V3C3 2.44772 3.44772 2 4 2H20C20.5523 2 21 2.44772 21 3V21C21 21.5523 20.5523 22 20 22ZM19 20V4H5V20H19ZM8 9H16V11H8V9ZM8 13H16V15H8V13Z"},child:[]}]})(e)}function Rpe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50",iconUrl:l}){return h.jsx(Ie,{title:e,icon:h.jsx("div",{className:"grid place-items-center ",children:l?h.jsx("img",{src:l,alt:"icon",className:"h-8 w-8 object-contain"}):h.jsx(o,{className:`h-8 w-8 ${a}`})}),className:"h-[132px]",children:h.jsxs("div",{children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] pt-[8px] !text-[12px] leading-[16px]",children:[h.jsx(Ou,{value:n}),h.jsx("div",{className:"text-[#64748B]",children:r})]})]})})}function Ipe({data:e}){const t=[{title:e?.title||"Total Bookings",value:e?.value??0,delta:e?.delta??"0%",deltaLabel:e?.deltaLabel||"Compared to last month",positive:e?.positive??!1,Icon:e?.Icon,iconUrl:e?.iconUrl,iconColor:e?.iconColor||"text-emerald-600",iconBg:e?.iconBg||"bg-emerald-50"}];return h.jsx("div",{className:"h-full",children:t.map((n,r)=>h.jsx(Rpe,{...n},r))})}function Lpe(e){return tt({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"2",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"},child:[]}]})(e)}function $pe({title:e,value:t,delta:n,deltaLabel:r,positive:i=!0,Icon:o=bu,iconColor:a="text-emerald-600",iconBg:s="bg-emerald-50"}){return h.jsx(Ie,{title:e,icon:h.jsx("div",{className:`h-6 w-6 grid place-items-center rounded-md ${s}`,children:h.jsx(o,{className:`h-4 w-4 ${a}`})}),className:"h-[132px]",children:h.jsxs("div",{children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:t}),h.jsxs("div",{className:"flex items-center gap-[8px] pt-[8px] !text-[12px] leading-[16px]",children:[h.jsx("div",{className:i?"text-[#1FA05B] font-medium":"text-rose-600 font-medium",children:n}),h.jsx("div",{className:"text-[#64748B]",children:r})]})]})})}const Fpe=[{title:"Notice",value:160,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:jpe,iconColor:"text-emerald-600",iconBg:"bg-emerald-50"},{title:"Post",value:83,delta:"+2.0%",deltaLabel:"Compared to last month",positive:!0,Icon:v8,iconColor:"text-[#329DFF]",iconBg:"bg-emerald-50"},{title:"Poll",value:3,delta:"+11.0%",deltaLabel:"Compared to last month",positive:!0,Icon:Qoe,iconColor:"text-[#FA7E28]",iconBg:"bg-orange-100"},{title:"Poll",value:5,delta:"-8.0%",deltaLabel:"Compared to last month",positive:!1,Icon:Lpe,iconColor:"text-[#DBB467]",iconBg:"bg-yellow-100"}];function Bpe({data:e}){const t=Array.isArray(e)&&e.length>0?e:Fpe;return h.jsx("div",{className:"px-[20px] grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-[24px]",children:t.map((n,r)=>h.jsx($pe,{...n},r))})}const ZP=({value:e=0,total:t=1,colorClass:n="",label:r=""})=>{const i=Number(e)||0,o=Number(t)||1,a=Math.max(0,Math.min(100,i/o*100)),s=n==="bg-[#3C81F6]"?"text-[#8B5CF6]":n==="bg-[#8B5CF6]"?"text-[#12B981]":"text-slate-600";return h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("div",{className:"w-2/3 min-w-[80px] h-5 rounded-full overflow-hidden",children:h.jsx("div",{className:`h-[11px] rounded-full ${n||""}`,style:{width:n==="bg-[#12B981]"?`${a+45}%`:`${a}%`}})}),h.jsx("div",{className:`${s} !text-[12px] font-bold mt-1`,children:i??0}),h.jsx("div",{className:"!text-[12px] leading-[16px] text-[#64748B] mt-1",children:r??""})]})},Wpe=({data:e,occupiedUnits:t=1,EmployeesCount:n=8910,AdminsCount:r=910})=>{const i=e?.total_occupants!==void 0&&e?.total_occupants!==null?Number(e?.total_occupants)||0:Number(t)||0,o=e?.total_members!==void 0&&e?.total_members!==null?Number(e?.total_members)||0:Number(n)||0,a=e?.total_admins!==void 0&&e?.total_admins!==null?Number(e?.total_admins)||0:Number(r)||0,s=(o||0)+(a||0);return h.jsx("div",{children:h.jsxs("div",{className:"bg-white !border-[0.5px] !border-[#EBEBEB] rounded-[12px] shadow-[0_0_12px_0_#EAF2FF] p-[16px] h-[128px]",children:[h.jsxs("div",{className:"flex items-center gap-[12px] h-[20px]",style:{marginBottom:"24px"},children:[h.jsx(Hb,{className:"!text-[20px] text-[#329DFF]"}),h.jsx("div",{className:"font-medium text-[#121212] text-[16px] leading-[20px]",children:"Occupancy Overview"})]}),h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex flex-col gap-[4px]",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B] font-normal",children:"Total Occupants"}),h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:i??0})]}),h.jsxs("div",{className:"flex items-end gap-[4px]",children:[h.jsx(ZP,{value:o??0,total:s||1,colorClass:"bg-[#3C81F6]",label:(o??0)<=1?"Employee":"Employees"}),h.jsx(ZP,{value:a??0,total:s||1,colorClass:"bg-[#8B5CF6]",label:(a??0)<=1?"Admin":"Admins"})]})]})]})})};Kn.register(Ro,Io,Fl,Gr);const Vpe=({data:e})=>{const t=e!=null,n=e?.employee_data,r=["HP","Adobe","Anarock","Swiggy","Infosys","Zepto"],i=[2e3,1700,1500,1200,900,800],o=[],a=[];if(t){if(n&&n.length>0)for(let d=0;d<n.length;d++)o.push(n[d].name),a.push(n[d].employees)}else for(let d=0;d<r.length;d++)o.push(r[d]),a.push(i[d]);let s=!1;if(t)if(!n||n.length===0)s=!0;else{s=!0;for(let d=0;d<n.length;d++)if(n[d].employees!==0){s=!1;break}}let l=0;for(let d=0;d<a.length;d++)a[d]>l&&(l=a[d]);const c={labels:o,datasets:[{data:a,backgroundColor:[],barThickness:34}]};for(let d=0;d<a.length;d++)c.datasets[0].backgroundColor.push("#3C81F6");const u={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{backgroundColor:"#0F172A",titleColor:"#fff",bodyColor:"#fff",displayColors:!1,callbacks:{label:d=>`Employees: ${d.parsed.y}`}}},scales:{x:{grid:{display:!1},ticks:{color:"#64748B",font:{size:12}}},y:{beginAtZero:!0,min:0,max:l>0?l+5:2e3,ticks:{stepSize:l>0?Math.ceil((l+5)/5):500,color:"#64748B",callback:d=>d},grid:{display:!1,color:"#E5E7EB",borderDash:[4,4],drawBorder:!1}}}};return t&&s?h.jsx(Ie,{className:"w-full h-[238px]",title:"Employee Footfall",period:"Today",icon:h.jsx(XP,{className:"!text-[24px] text-[#8B5CF6]"}),children:h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx(En,{title:"No Employee footfall Found",description:"Catch up all the data. Change the date range to see the data."})})}):h.jsxs(Ie,{className:"w-full h-[238px]",title:"Employee Footfall",period:"Today",icon:h.jsx(XP,{className:"!text-[24px] text-[#8B5CF6]"}),children:[h.jsxs("div",{className:"mb-[10px] mt-[8px] flex flex-col gap-[4px]!",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Employees Inside"}),h.jsx("div",{className:"text-[20px] leading-[24px] font-medium text-[#3C81F6]",children:t?e.total_employees:7500})]}),h.jsx("div",{className:"h-[110px]",children:h.jsx(Bl,{data:c,options:u})})]})},zpe="Rs",JP=["bg-blue-500","bg-red-500","bg-purple-700"],Ea={title:"Food & Beverages (Static Data)",period:"Today",summary:{totalOrders:247,revenueGenerated:"82K",growthPercentage:8,growthTotalPercentage:0},outlets:[{name:"HP",orders:120,revenue:"45K",percentage:70,color:"bg-[#3C81F6]"},{name:"Adobe",orders:85,revenue:"23K",percentage:50,color:"bg-[#3C81F6]"},{name:"Anarock",orders:42,revenue:"14K",percentage:25,color:"bg-[#3C81F6]"}]};function Bp(e,t=null){if(typeof e=="number")return e;if(typeof e=="string"){const n=Number(e.replace("%","").trim());return Number.isNaN(n)?t:n}return t}function ek(e){if(e==null||e==="")return"0";if(typeof e=="number")return C_(e);const t=Number(e);return Number.isNaN(t)?String(e):C_(t)}function Hpe(e){const t=e?.food_beverage_summary?{title:e?.title,period:e?.period,summary:{totalOrders:e?.food_beverage_summary?.total_orders,revenueGenerated:e?.food_beverage_summary?.revenue_generated,growthPercentage:e?.food_beverage_summary?.growth_percentage??e?.food_beverage_summary?.revenue_growth,growthTotalPercentage:e?.food_beverage_summary?.order_growth,currencyType:e?.food_beverage_summary?.currency_type},outlets:e?.chart_data}:e||{},n=t?.summary||{},i=(Array.isArray(t?.outlets)?t.outlets:[]).map((f,p)=>({name:f?.name||f?.outlet_name||f?.tenant_name||f?.company_name||"Unknown",orders:f?.orders??f?.total_orders??f?.count??0,revenue:f?.revenue??f?.revenue_generated??f?.total_revenue??0,percentage:f?.percentage,color:f?.color||JP[p%JP.length]})),o=n?.totalOrders??n?.orders??Ea.summary.totalOrders,a=n?.revenueGenerated??n?.revenue??Ea.summary.revenueGenerated,s=Bp(n?.growthPercentage??n?.revenueGrowth,Ea.summary.growthPercentage),l=Bp(n?.growthTotalPercentage??n?.orderGrowth,Ea.summary.growthTotalPercentage),c=n?.currencyType||n?.currency||zpe,u=i.reduce((f,p)=>f+(Number(p?.orders)||0),0),d=i.map(f=>({...f,percentage:f?.percentage!==null&&f?.percentage!==void 0?Number(f.percentage)||0:u>0?Math.round((Number(f?.orders)||0)/u*100):0}));return{title:t?.title||Ea.title,period:t?.period||Ea.period,summary:{totalOrders:o,revenueGenerated:a,growthPercentage:s,growthTotalPercentage:l,currencyType:c},outlets:d.length>0?d:Ea.outlets}}function Ype({data:e,title:t,period:n,icon:r}){const i=Hpe(e),o=t||i.title,a=n||i.period,s=r||h.jsx(Ufe,{className:"!text-[24px] text-[#FA7E28]"}),l=i.summary.totalOrders??0,c=ek(i.summary.revenueGenerated),u=Bp(i.summary.growthPercentage,0),d=Bp(i.summary.growthTotalPercentage,0),f=u>=0,p=d>=0;return h.jsx(Ie,{className:"h-[324px]",title:o,period:a,icon:s,children:h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex gap-[24px]",children:[h.jsxs("div",{className:"w-[65%] flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Total Orders"}),h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#8B5CF6]",children:l}),h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] ${p?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[p?h.jsx(ns,{}):h.jsx(ts,{}),d,"%",h.jsx("span",{children:"from last month"})]})]}),h.jsxs("div",{className:"w-[30%] flex flex-col gap-[8px] ",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B] whitespace-nowrap",children:"Revenue Generated"}),h.jsxs("div",{className:"text-[28px] leading-[32px] font-medium text-[#329DFF] whitespace-nowrap",children:[i.summary.currencyType," ",c]}),h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] whitespace-nowrap ${f?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[f?h.jsx(ns,{}):h.jsx(ts,{}),u,"%",h.jsx("span",{children:"from last month"})]})]})]}),h.jsx("div",{className:"mt-[16px]",children:i.outlets.map((m,g)=>h.jsxs("div",{className:g===i.outlets.length-1?"":"mb-[16px]",children:[h.jsxs("div",{className:"flex justify-between text-sm mb-[8px]",children:[h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px]",children:m.name}),h.jsxs("div",{className:"font-medium text-[12px] leading-[16px] flex items-center",children:[h.jsxs("div",{className:"text-[#64748B] inline-block",children:[m.orders," orders"]}),h.jsxs("div",{className:"mx-2 text-[#121212] inline-block",children:[i.summary.currencyType," ",ek(m.revenue)]})]})]}),h.jsx("div",{className:"h-[11px] bg-gray-100 rounded-full",children:h.jsx("div",{className:`h-[11px] rounded-full ${m.color}`,style:{width:`${m.percentage}%`}})})]},`${m.name}-${g}`))})]})})}function Upe({data:e}){const t=e?.amenity_summary?{amenitySummary:{totalBookings:e?.amenity_summary?.total_bookings??0,todayPaidRevenue:e?.amenity_summary?.today_paid_revenue??"0.00",growthPercentage:e?.amenity_summary?.growth_percentage??null,bookingGrowth:e?.amenity_summary?.booking_growth??null,currencyType:e?.amenity_summary?.currency_type??"Rs"},chartData:Array.isArray(e?.chart_data)?e.chart_data.map(m=>({facility_name:m?.facility_name,total_bookings:m?.total_bookings??0,paid_revenue:m?.paid_revenue??"0",isPaid:m?.is_paid===!0})):[]}:e||{},n=t?.amenitySummary||{},i=(Array.isArray(t?.chartData)?t.chartData:[]).map(m=>({...m,isPaid:m?.isPaid===!0})),o=i.length>0&&i.every(m=>m?.isPaid===!1),a=n?.totalBookings||0,s=n?.bookingGrowth;let l=0;if(typeof s=="number")l=s;else if(typeof s=="string"){const m=s.replace("%","").trim(),g=Number(m);l=isNaN(g)?0:g}const c=i.reduce((m,g)=>{const v=g?.total_bookings||0;return m+v},0),u=i.map(m=>{const g=m?.total_bookings||0,v=m?.isPaid?`${n?.currencyType||"Rs"} ${m?.paid_revenue||"0.00"}`:"",x=c>0?Math.round(g/c*100):0;return{name:m?.facility_name||"Unknown",bookings:g,revenue:v,percentage:x,color:"bg-[#3C81F6]",isPaid:m?.isPaid}}),d=n?.growthPercentage;let f=null;if(typeof d=="number")f=d;else if(typeof d=="string"){const m=d.replace("%","").trim(),g=Number(m);f=isNaN(g)?null:g}const p=f!==null?f>=0:!0;return h.jsx(Ie,{className:"h-[324px]",title:"Amenities",period:"Today",icon:h.jsx(qfe,{className:"!text-[24px] text-[#8B5CF6]"}),children:h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex gap-[24px]",children:[h.jsxs("div",{className:"w-[65%] flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Total Bookings"}),h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#8B5CF6]",children:a}),h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] ${l>=0?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[l>=0?h.jsx(ns,{}):h.jsx(ts,{}),l,"%",h.jsx("span",{children:"from last month"})]})]}),!o&&h.jsxs("div",{className:"w-[30%] flex flex-col gap-[8px] ",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B] whitespace-nowrap",children:"Revenue Generated"}),h.jsxs("div",{className:"text-[28px] leading-[32px] font-medium text-[#329DFF] whitespace-nowrap",children:[n?.currencyType||"Rs"," ",n?.todayPaidRevenue??"0.00"]}),f!==null&&h.jsxs("div",{className:`w-fit inline-flex items-center gap-[4px] text-[10px] leading-[14px] p-[4px] rounded-[4px] whitespace-nowrap ${p?"text-[#1FA05B] bg-green-50":"text-red-600 bg-red-50"}`,children:[p?h.jsx(ns,{}):h.jsx(ts,{}),f,"%",h.jsx("span",{children:"from last month"})]})]})]}),h.jsx("div",{className:"mt-[16px]",children:u.length>0?u.map((m,g)=>h.jsxs("div",{className:g===u.length-1?"":"mb-[16px]",children:[h.jsxs("div",{className:"flex justify-between text-sm mb-[8px]",children:[h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px]",children:m?.name}),h.jsxs("div",{className:"font-medium text-[12px] leading-[16px]",children:[h.jsxs("div",{className:"text-[#64748B] inline",children:[m?.bookings," ",m?.bookings<=1?"booking":"bookings"]}),m?.isPaid&&h.jsx("div",{className:"mx-2 text-[#121212] inline",children:m?.revenue})]})]}),h.jsx("div",{className:"h-[11px] bg-gray-100 rounded-full",children:h.jsx("div",{className:`h-[11px] rounded-full ${m?.color}`,style:{width:`${m?.percentage}%`}})})]},g)):h.jsx("div",{className:"flex items-center justify-center h-[120px]",children:h.jsx("div",{className:"text-[12px] text-[#94A3B8]",children:"No amenity usage data available"})})})]})})}Kn.register(Ro,Io,Fl,Gr,li);function Kpe({data:e=[]}){const t=[{level:"L1",open:55,in_progress:22,on_hold:15,closed:6},{level:"L2",open:45,in_progress:25,on_hold:18,closed:5},{level:"L3",open:58,in_progress:23,on_hold:14,closed:6}],n=e.length>0?e:t,r=[],i=[],o=[],a=[],s=[];for(let u=0;u<n.length;u++)r.push(n[u].level),i.push(Number(n[u].open)),o.push(Number(n[u].in_progress)),a.push(Number(n[u].on_hold)),s.push(Number(n[u].cancelled));const l={labels:r,datasets:[{label:"Open",data:i,backgroundColor:"#3B82F6",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"},{label:"In Progress",data:o,backgroundColor:"#F59E0B",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"},{label:"On-Hold",data:a,backgroundColor:"#64748B",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"},{label:"Cancelled",data:s,backgroundColor:"#FB2C36",borderColor:"#FFFFFF",borderWidth:2,barThickness:38,stack:"tickets"}]},c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"bottom",labels:{usePointStyle:!1,pointStyle:"rect",padding:12,boxWidth:20,boxHeight:8,color:"#64748B"}},tooltip:{backgroundColor:"#0F172A",titleColor:"#fff",bodyColor:"#fff"}},scales:{x:{stacked:!0,grid:{display:!1},ticks:{color:"#64748B"}},y:{stacked:!0,beginAtZero:!0,grid:{display:!1,color:"#E5E7EB",borderDash:[4,4],drawBorder:!1},ticks:{color:"#64748B",stepSize:1,precision:0,callback:u=>Math.round(u)}}}};return h.jsx(Ie,{className:"h-[267px]",title:"Ticket Escalation Levels",period:"Today",icon:h.jsx(_8,{className:"!text-[24px] text-[#3C81F6]"}),children:h.jsx("div",{className:"h-full",children:h.jsx(Bl,{data:l,options:c})})})}const qpe=({active:e,payload:t})=>{if(!e||!t||!t.length)return null;const n=t[0],r=n.payload.color;return h.jsx("div",{style:{backgroundColor:"#000000",color:"#ffffff",padding:"8px 10px",borderRadius:"8px",fontSize:"12px"},children:h.jsxs("div",{className:"flex items-center gap-[8px] font-medium",children:[h.jsx("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:r}}),h.jsx("div",{children:n.name}),h.jsx("div",{className:"ml-2",children:n.value})]})})};function Gpe({data:e=null}){const n=e||{open:12,on_hold:5,cancelled:3,completed:156,in_progress:8,total_complaints:184},r=a=>{const s=Number(a);return isNaN(s)?0:s},i=[{name:"Completed",value:r(n.completed),color:"#10B981"},{name:"Open",value:r(n.open),color:"#3B82F6"},{name:"In Progress",value:r(n.in_progress),color:"#F59E0B"},{name:"On Hold",value:r(n.on_hold),color:"#6B7280"},{name:"Cancelled",value:r(n.cancelled),color:"#EF4444"}],o=r(n.total_complaints);return h.jsx(Ie,{className:"h-[267px]",title:"Ticket Status",period:"Today",icon:h.jsx(Qv,{className:"!text-[24px] text-[#EF4444]"}),children:h.jsxs("div",{className:"flex h-full items-center gap-[16px]",children:[h.jsxs("div",{className:"w-[202px] h-[170px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:i,innerRadius:55,outerRadius:85,dataKey:"value",stroke:"#FFFFFF",strokeWidth:2,children:i.map((a,s)=>h.jsx(In,{fill:a.color},s))}),h.jsx(Dt,{content:a=>h.jsx(dr,{...a,data:i,children:h.jsx(qpe,{...a})})})]})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsxs("div",{className:"flex items-baseline text-[18px] leading-[22px] font-medium text-[#121212]",children:[h.jsx("div",{children:r(n.completed)}),h.jsxs("div",{className:"text-[18.18px] leading-[22.22px] text-[#121212]",children:["/",o]})]}),h.jsx("div",{className:"text-[10.1px] leading-[14.14px] text-[#64748B]",children:"Completed"})]})]}),h.jsx("div",{className:"flex-1 space-y-2",children:i.map(a=>h.jsxs("div",{className:"flex items-center justify-between text-[12px] leading-[17px] mt-[12px]",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"h-[7px] w-[16px]",style:{backgroundColor:a.color}}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:a.name})]}),h.jsx("div",{className:"text-[#64748B] text-[12px] leading-[16px] font-medium",children:a.value})]},a.name))})]})})}const tk={visitorSummary:{totalVisitorsToday:150,peakTime:"2:00 - 4:00PM",peakCount:50,activeWalkins:18,preApprovedCheckins:3},popupData:{walkins:{currently_inside:18,total_visited_today:58},preApproved:{completed_visits:3,total_expected_today:5}},chart_data:[{hour:10,walkins:22,preApproved:30},{hour:12,walkins:15,preApproved:28},{hour:14,walkins:30,preApproved:38},{hour:16,walkins:45,preApproved:50},{hour:18,walkins:25,preApproved:40}]};function Xpe(e){const t=e>=12?"PM":"AM";let n=e%12;return n===0&&(n=12),`${n} ${t}`}function Qpe(e){if(typeof e=="number"&&e>=0&&e<=23)return e;if(typeof e=="string"){const t=e.trim().toUpperCase(),n=t.match(/^(\d{1,2})(?::\d{2})?\s*(AM|PM)$/);if(n){let i=Number(n[1])%12;return n[2]==="PM"&&(i+=12),i}const r=Number(t);if(!Number.isNaN(r)&&r>=0&&r<=23)return r}return null}function Zpe(e=[]){return Array.from({length:24},(t,n)=>{const r=e.find(i=>Qpe(i?.hour)===n)||{};return{hour:n,time:Xpe(n),walkins:Number(r?.walkins??0),approved:Number(r?.pre_approved??r?.preApproved??r?.approved??0)}})}function nk({title:e,color:t,rows:n=[],children:r}){const i=h.jsxs("div",{className:"bg-white rounded-[12px] min-w-[260px] p-[16px] border-[0.5px] border-[#EBEBEB] shadow-[0px_0px_12px_0px_#EAF2FF]",children:[h.jsx("div",{className:"flex items-center gap-[8px] font-medium text-[#121212]",children:h.jsx("div",{children:e??""})}),h.jsx("div",{className:"mt-[16px] pt-[16px] border-t border-dashed border-[#EBEBEB] space-y-[16px]",children:n?.map(({label:o,value:a,valueColor:s})=>h.jsxs("div",{className:"flex justify-between text-[14px] leading-[18px]",children:[h.jsx("div",{className:"text-[#64748B]",children:o??""}),h.jsx("div",{className:"font-semibold",style:{color:s||"#121212"},children:a??0})]},o))})]});return h.jsx(VR,{placement:"right-start",interactive:!0,delay:[100,0],offset:[6,0],appendTo:()=>document.body,maxWidth:"none",render:o=>h.jsx("div",{tabIndex:"-1",...o,children:i}),children:r})}function Jpe({active:e,payload:t}){return!e||!t?.length?null:h.jsx("div",{className:"rounded-[8px] bg-[#121212] px-[12px] py-[8px] text-[12px] text-white shadow-lg",children:t.map(n=>h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("span",{className:"h-2 w-2 rounded-full",style:{backgroundColor:n.stroke}}),h.jsx("span",{className:"min-w-[82px] text-[#D1D3D4]",children:n.name}),h.jsx("span",{className:"font-semibold",children:n.value})]},n.dataKey))})}function ehe({data:e}){const t=e&&Object.keys(e).length?e:tk,n=t?.visitor_summary?{totalVisitorsToday:t?.visitor_summary?.total_visitors_today??0,peakTime:t?.visitor_summary?.peak_time??"-"}:t?.visitorSummary??{},r=t?.walkins_popup_data?{walkins:{currently_inside:Number(t?.walkins_popup_data?.walkins_inside??0),total_visited_today:Number(t?.walkins_popup_data?.total_walkins??0)},preApproved:{completed_visits:Number(t?.pre_approved_popup_data?.pre_approved_check_ins??0),total_expected_today:Number(t?.pre_approved_popup_data?.total_pre_approved_check_ins??0)}}:t?.popupData??{},i=P.useMemo(()=>{const l=t?.chart_data??[];return Zpe(l.length?l:tk.chart_data)},[t]),{yAxisTicks:o,yAxisMax:a}=P.useMemo(()=>{const l=Math.max(...i.map(u=>Math.max(u.walkins,u.approved))),c=l>0?l:5;return{yAxisTicks:[0,Math.ceil(c/2),c],yAxisMax:c}},[i]),s=new Date().toLocaleTimeString("en-IN",{hour:"2-digit",minute:"2-digit",hour12:!0});return h.jsx(Ie,{className:"h-[377px]",title:"Visitor Updates",period:`Today at ${s}`,icon:h.jsx(Vb,{className:"!text-[24px] text-[#8B5CF6]"}),children:h.jsxs("div",{className:"flex flex-col gap-[24px]",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-y-4 gap-x-6",children:[h.jsxs("div",{className:"flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Total Visitors"}),h.jsx("div",{className:"text-[20px] font-medium text-[#08B6D4]",children:n?.totalVisitorsToday??0})]}),h.jsxs("div",{className:"flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Peak Time"}),h.jsx("div",{className:"text-[20px] font-medium text-[#8B5CF6]",children:n?.peakTime??"-"})]}),h.jsxs("div",{className:"mt-2 flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Active Walk-ins"}),h.jsxs("div",{className:"flex items-baseline text-xl font-medium leading-[32px]",children:[h.jsx("div",{className:"text-[28px] text-[#1FA05B] leading-[32px]",children:r?.walkins?.currently_inside??0}),h.jsx(nk,{title:"Active Walk-ins",color:"text-[#1FA05B]",rows:[{label:"Currently Inside",value:r?.walkins?.currently_inside??0,valueColor:"#1FA05B"},{label:"Total Visited Today",value:r?.walkins?.total_visited_today??0}],children:h.jsxs("div",{className:"text-[#64748B] cursor-pointer text-[20px] leading-[32px]",children:["/",r?.walkins?.total_visited_today??0]})})]})]}),h.jsxs("div",{className:"mt-2 flex flex-col gap-[8px]!",children:[h.jsx("div",{className:"text-[10px] text-[#64748B]",children:"Pre-approved Check-ins"}),h.jsxs("div",{className:"flex items-baseline text-xl font-medium leading-[32px]",children:[h.jsx("div",{className:"text-[28px] text-[#E7A015] leading-[32px]",children:r?.preApproved?.completed_visits??0}),h.jsx(nk,{title:"Pre-approved Check-ins",color:"text-[#E7A015]",rows:[{label:"Completed Visits",value:r?.preApproved?.completed_visits??0,valueColor:"#E7A015"},{label:"Total Expected Check-ins Today",value:r?.preApproved?.total_expected_today??0}],children:h.jsxs("div",{className:"text-[#64748B] cursor-pointer text-[20px] leading-[32px]",children:["/",r?.preApproved?.total_expected_today??0]})})]})]})]}),h.jsx("div",{className:"w-full h-[149px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(Yx,{data:i??[],margin:{top:5,right:0,left:0,bottom:-10},children:[h.jsx(ur,{stroke:"#E5E7EB",strokeDasharray:"4 4",vertical:!1}),h.jsx(Un,{dataKey:"time",tickFormatter:(l,c)=>c%4===0?l:"",axisLine:!1,tickLine:!1,tick:{fill:"#121212",fontSize:10,fontWeight:400}}),h.jsx(Ln,{width:24,axisLine:!1,tickLine:!1,allowDecimals:!1,ticks:o,domain:[0,a],tick:{fill:"#64748B",fontSize:10,fontWeight:400}}),h.jsx(Dt,{content:l=>h.jsx(dr,{...l,data:i,children:h.jsx(Jpe,{...l})})}),h.jsx(Qo,{type:"monotone",dataKey:"walkins",stroke:"#22C55E",strokeWidth:2,dot:!1,name:"Walk-ins",isAnimationActive:!1}),h.jsx(Qo,{type:"monotone",dataKey:"approved",stroke:"#F59E0B",strokeWidth:2,strokeDasharray:"5 5",dot:!1,name:"Pre-approved",isAnimationActive:!1})]})})})]})})}function the({data:e=null}){const t={total_entries:79.6,entries:59350,exit:40950},n=e&&Object.keys(e).length>0?e:t,r=c=>{const u=Number(c);return isNaN(u)?0:u},i=r(n.entries),o=r(n.exit),a=e&&Object.keys(e).length>0&&Number(e.entries)===0&&Number(e.exit)===0,s=[{name:"Entries",value:i,color:"#8B5CF6"},{name:"Exit",value:o,color:"#329DFF"}],l=r(n.total_entries);return h.jsx(kt,{className:"h-[362px]",title:"Access Overview",titleWeight:"semi-bold",children:a?h.jsx("div",{className:"h-[300px] flex items-center justify-center",children:h.jsx(En,{title:"No access Point Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsxs("div",{className:"flex flex-col items-center mt-[16px]",children:[h.jsxs("div",{className:"relative w-[212px] h-[212px]",children:[h.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h.jsx("div",{className:"w-[130px] h-[130px] rounded-full shadow-[0px_12px_35px_rgba(0,0,0,0.12)]"})}),h.jsx("div",{className:"h-[212px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:s,dataKey:"value",innerRadius:65,outerRadius:100,startAngle:360,endAngle:-180,paddingAngle:1,stroke:"transparent",children:s.map((c,u)=>h.jsx(In,{fill:c.color},u))}),h.jsx(Dt,{content:c=>h.jsx(dr,{...c,data:s,children:h.jsx(oi,{...c})})})]})})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsx("div",{className:"text-[22px] leading-[27px] font-medium text-[#121212]",children:l}),h.jsx("div",{className:"text-[12px] leading-[17px] text-[#64748B]",children:"Total Access"})]})]}),h.jsxs("div",{className:"mt-[28px] flex justify-between w-full px-[20px]",children:[h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsxs("div",{className:"flex items-center gap-[6px]",children:[h.jsx("div",{className:"w-[14px] h-[6px] bg-[#8B5CF6]"}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Entries"})]}),h.jsx("div",{className:"text-[18px] font-medium text-[#8B5CF6] mt-[4px]",children:i.toLocaleString()})]}),h.jsxs("div",{className:"flex flex-col items-center",children:[h.jsxs("div",{className:"flex items-center gap-[6px]",children:[h.jsx("div",{className:"w-[14px] h-[6px] bg-[#329DFF]"}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:"Exit"})]}),h.jsx("div",{className:"text-[18px] font-medium text-[#329DFF] mt-[4px]",children:o.toLocaleString()})]})]})]})})}function LI({title:e="Access",data:t=[],height:n="h-[362px]"}){const r=i=>i==null?"0":Number(i).toLocaleString();return h.jsx(kt,{className:n,title:e,titleWeight:"semi-bold",children:h.jsxs("div",{className:"rounded-[12px] overflow-hidden mt-[16px]",children:[h.jsxs("div",{className:"grid grid-cols-2 bg-[#F8FAFC] py-[8px] px-[12px] text-[12px] leading-[16px] font-medium text-[#64748B]",children:[h.jsx("div",{children:"Point"}),h.jsx("div",{className:"text-right",children:"Access"})]}),t.map((i,o)=>h.jsxs("div",{className:"grid grid-cols-2 p-[12px] text-[14px] border-t border-[#E2E8F0]",children:[h.jsx("div",{className:"text-[12px] leading-[16px] text-[#64748B]",children:i.label}),h.jsx("div",{className:"text-[12px] leading-[16px] text-right font-medium",style:{color:i.color||"#000"},children:r(i.value)})]},o))]})})}function nhe({data:e=[]}){const[t,n]=P.useState([]),r=e&&e.length?e:[],i=!e||e.length===0,o=e&&e.length>0&&e.every(c=>Number(c.entries)===0&&Number(c.exit)===0),a=i||o,s=c=>c>=1e3?`${c/1e3}K`:c,l=c=>{n(u=>u.includes(c)?u.filter(d=>d!==c):[...u,c])};return h.jsx(kt,{title:"Access Points Usage",titleWeight:"semi-bold",className:"h-[362px]",children:a?h.jsx("div",{className:"h-[270px] flex items-center justify-center",children:h.jsx(En,{title:"No access Point Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsx("div",{className:"mt-[24px] h-[270px] w-full",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:r,barSize:54,margin:{top:0,right:0,left:-20,bottom:0},children:[h.jsx(ur,{strokeDasharray:"8 8",vertical:!1}),h.jsx(Rx,{y:0,stroke:"#EBEBEB"}),h.jsx(Un,{dataKey:"block_name",tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1}),h.jsx(Ln,{tickFormatter:s,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1}),h.jsx(Dt,{cursor:!1,content:c=>h.jsx(dr,{...c,data:r,children:(()=>{if(!c.active||!c.label)return null;const u=r.find(d=>d.block_name===c.label);return h.jsxs("div",{className:"bg-[#111] text-white px-[14px] py-[8px] rounded-[6px] flex flex-col gap-[6px] text-[13px]",children:[h.jsx("div",{className:"font-semibold",children:c.label}),!t.includes("entries")&&h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-[#329DFF]"}),h.jsx("div",{className:"text-[#aaa]",children:"Entries"}),h.jsx("div",{className:"font-bold",children:u?.entries??0})]}),!t.includes("exit")&&h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"w-2 h-2 rounded-full bg-[#76BDFF]"}),h.jsx("div",{className:"text-[#aaa]",children:"Exit"}),h.jsx("div",{className:"font-bold",children:u?.exit??0})]})]})})()})}),h.jsx(El,{verticalAlign:"bottom",height:36,content:()=>{const c=[{key:"entries",label:"Entries",color:"#329DFF"},{key:"exit",label:"Exit",color:"#76BDFF"}];return h.jsx("div",{style:{display:"flex",gap:"20px",justifyContent:"center",marginTop:"20px"},children:c.map((u,d)=>{const f=t.includes(u.key);return h.jsxs("div",{onClick:()=>l(u.key),style:{display:"flex",alignItems:"center",gap:"8px",cursor:"pointer",opacity:f?.4:1},children:[h.jsx("div",{style:{width:"20px",height:"8px",backgroundColor:u.color}}),h.jsx("div",{style:{fontSize:"12px",color:"#64748B"},children:u.label})]},d)})})}}),h.jsx(Kt,{dataKey:"entries",stackId:"a",fill:"#329DFF",hide:t.includes("entries")}),h.jsx(Kt,{dataKey:"exit",stackId:"a",fill:"#76BDFF",hide:t.includes("exit")})]})})})})}const rhe=({x:e,y:t,payload:n})=>{const r=n.value.split(" ");return h.jsx("g",{transform:`translate(${e},${t})`,children:h.jsx("text",{x:-85,y:0,textAnchor:"start",fill:"#121212",fontSize:14,children:r.map((i,o)=>h.jsx("tspan",{x:-85,dy:o===0?0:16,children:i},o))})})};function ihe({data:e=[]}){const t=e&&e.length>0,n=e.map(r=>({name:r.category_name,value:r.total_complaints,color:"#08B6D4"}));return h.jsx(kt,{title:"Tickets per Category",className:"h-[362px]",titleWeight:"semi-bold",childrenClassName:"h-full mt-[24px]!",children:t?h.jsx("div",{className:"w-full h-[262px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:n,layout:"vertical",margin:{top:0,right:8,left:-20,bottom:0},children:[h.jsx(ur,{strokeDasharray:"3 3",horizontal:!1,stroke:"#E5E7EB"}),h.jsx(Un,{type:"number",tick:{fill:"#94A3B8",fontSize:12},axisLine:!0,tickLine:!1,tickMargin:10,allowDecimals:!1}),h.jsx(Ln,{type:"category",dataKey:"name",axisLine:!1,tickLine:!1,width:132,tick:h.jsx(rhe,{})}),h.jsx(Dt,{cursor:{fill:"transparent"},position:{x:300,y:0},allowEscapeViewBox:{x:!0,y:!0},content:r=>r.active?h.jsx(dr,{...r,data:n,children:h.jsx(oi,{...r})}):null}),h.jsx(Kt,{dataKey:"value",barSize:36,fill:"#08B6D4"})]})})}):h.jsx(En,{title:"No Tickets Found",description:"Catch up all the data. Change the date range to see the data."})})}function ohe({icon:e,iconColor:t="#329DFF",title:n,value:r,percentage:i,percentageText:o}){const a=parseFloat(i),s=a>=0,l=s?"#16A34A":"#DC2626";return h.jsxs("div",{className:"relative bg-white !border-[0.5px] !border-[#EBEBEB] !rounded-[12px] !shadow-[0_0_12px_0_#EAF2FF] p-[16px]",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[e&&h.jsx("div",{className:"h-[20px] w-[20px]",style:{color:t,display:"flex",alignItems:"center",justifyContent:"center"},children:h.jsx(e,{className:"h-[20px] w-[20px]"})}),h.jsx("div",{className:"text-[20px] leading-[100%] tracking-[-2%] font-medium text-[#64748B]",children:n})]}),h.jsx("div",{className:"mt-[16px] text-[28px] leading-[32px] font-medium text-[#121212]",children:r}),(i||o)&&h.jsxs("div",{className:"mt-[12px] flex items-center gap-[8px]",children:[i&&h.jsxs("div",{className:"flex items-center gap-[4px] text-[10px] leading-[14px] font-medium",style:{color:l},children:[s?h.jsx(ns,{}):h.jsx(ts,{}),Math.abs(a),"%"]}),o&&h.jsx("div",{className:"text-[10px] leading-[14px] text-[#64748B]",children:o})]})]})}const ahe=({data:e=[],onDateChange:t})=>{const[n,r]=P.useState(new Date),[i,o]=P.useState(!1),s=(v=>{const x=new Date(v);return x.setDate(x.getDate()-6),x})(n),l=v=>{try{return v.toLocaleDateString("en-GB",{day:"2-digit",month:"short"})}catch{return""}},c=v=>{const x=new Date(v),_=new Date(x);_.setDate(_.getDate()-6),t&&t(_.toISOString(),x.toISOString())},u=()=>{const v=new Date(n);v.setDate(v.getDate()-7),r(v),c(v)},d=()=>{const v=new Date(n);v.setDate(v.getDate()+7),r(v),c(v)},f=()=>{o(v=>!v)},p=v=>{const x=v||new Date;r(x),c(x),o(!1)},m=Array.isArray(e)?e:[],g=!m.length||m.every(v=>v.no_of_visitors===0);return h.jsxs(kt,{title:"Weekly Visitor Pattern",period:`${l(s)} - ${l(n)}`,isDateSelector:!0,titleWeight:"semi-bold",className:"h-[360px]",childrenClassName:"mt-6",onPrevClick:u,onNextClick:d,onCalendarClick:f,children:[i&&h.jsx("div",{className:"anarock-datepicker absolute top-[70px] right-[24px] z-50",children:h.jsx(kD,{selected:n,onChange:p,inline:!0,maxDate:new Date,showYearDropdown:!0,scrollableYearDropdown:!0,yearDropdownItemNumber:40})}),g?h.jsx("div",{className:"w-full h-[280px] flex items-center justify-center",children:h.jsx(En,{title:"No Visitors Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsx("div",{className:"w-full h-[280px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(kj,{data:m,margin:{top:10,right:-10,left:-10,bottom:0},children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:"colorVisitors",x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:"#6366F1",stopOpacity:.25}),h.jsx("stop",{offset:"100%",stopColor:"#6366F1",stopOpacity:0})]})}),h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#F1F5F9"}),h.jsx(Un,{dataKey:"day",type:"category",scale:"point",padding:{left:20,right:20},tick:{fontSize:12,fill:"#64748B"},axisLine:!0,tickLine:!1,tickFormatter:v=>new Date(v).toLocaleDateString("en-GB",{day:"2-digit",month:"short"})}),h.jsx(Ln,{width:35,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1,allowDecimals:!1,domain:[0,"dataMax + 2"]}),h.jsx(Dt,{cursor:!1,content:v=>{const{active:x,payload:_,label:w}=v;if(!x||!_?.length)return null;const y=new Date(w).toLocaleDateString("en-GB",{day:"2-digit",month:"short"});return h.jsx(dr,{...v,data:m,children:h.jsx(oi,{active:x,payload:_,label:y})})}}),h.jsx(Bx,{type:"monotone",dataKey:"no_of_visitors",stroke:"#6366F1",strokeWidth:2,fill:"url(#colorVisitors)",dot:{r:5,stroke:"#6366F1",strokeWidth:2,fill:"#fff"},activeDot:v=>{const{cx:x,cy:_,stroke:w}=v;return h.jsxs("g",{children:[h.jsx("circle",{cx:x,cy:_,r:6,fill:"#fff",stroke:"#6466F1",strokeWidth:2}),h.jsx("circle",{cx:x,cy:_,r:2.5,fill:"#6466F1"})]})}})]})})})]})},she=[{building_name:"Google",no_of_visitors:1e3},{building_name:"Uber",no_of_visitors:3500},{building_name:"ANAROCK",no_of_visitors:2e3},{building_name:"Flipkart",no_of_visitors:8e3},{building_name:"HP",no_of_visitors:1650}],lhe=({data:e,title:t,bar:n})=>{const r=Array.isArray(e)&&e?.length===0,i=e==null?she:Array.isArray(e)?e:[];return h.jsx(kt,{title:t||"Organisation Wise Visitors",titleWeight:"semi-bold",className:"h-[360px]",childrenClassName:"mt-6",children:h.jsx("div",{className:"w-full h-[260px] flex items-center justify-center",children:r?h.jsx(En,{title:t||"Organisation Wise Visitors",description:"Catch up all the data. Change the date range to see the data."}):h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:i||[],margin:{top:10,right:10,left:10,bottom:-10},barCategoryGap:35,children:[h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#F1F5F9"}),h.jsx(Un,{dataKey:"building_name",tick:{fontSize:12,fill:"#64748B"},axisLine:!0,tickLine:!1}),h.jsx(Ln,{width:40,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1,allowDecimals:!1}),h.jsx(Dt,{cursor:!1,content:o=>o.active?h.jsx(dr,{...o,data:i,children:h.jsx(oi,{...o})}):null}),h.jsx(Kt,{dataKey:"no_of_visitors",name:"Visitors",maxBarSize:55,fill:n||"#3C81F6"})]})})})})};function che({data:e}){return h.jsx("div",{className:"h-full",children:e.map((t,n)=>{const r=parseFloat(t.delta),i=r>=0;return h.jsx(Ie,{iconClassName:"!gap-[8px]",title:h.jsx("div",{className:"text-[#64748B]",children:t.title}),icon:h.jsx(t.Icon,{className:"h-[20px] w-[20px]",style:{color:t.iconColor||"#000000"}}),className:`${t?.widget==="amenities"?"h-[139px]":"h-[124px]"}`,children:h.jsxs("div",{className:`flex flex-col gap-[8px] ${t?.widget==="amenities"?"mt-[3.5px]":"mt-0"}`,children:[h.jsx("div",{className:"text-[28px] leading-[32px] font-medium text-[#121212]",children:t.value}),h.jsxs("div",{className:`flex items-center text-[12px] leading-[16px] ${t.delta?"gap-[8px]":""}`,children:[t.delta&&h.jsxs("div",{className:`flex items-center gap-[4px] px-[6px] py-[2px] rounded-[4px] font-medium
|
|
393
394
|
${i?"text-[#1FA05B] bg-[#F7FEFA]":"text-[#E11D48] bg-[#FBF4F4]"}
|
|
394
395
|
`,children:[i?h.jsx(ns,{}):h.jsx(ts,{}),Math.abs(r),"%"]}),h.jsx("div",{style:{color:"#64748B"},children:t.deltaLabel})]})]})},n)})})}const uhe=[{facility_name:"Table Tennis",total_booking:5},{facility_name:"Gym",total_booking:12},{facility_name:"Meeting Room A",total_booking:3},{facility_name:"Conference Hall",total_booking:8}],dhe=({x:e,y:t,payload:n})=>h.jsx("foreignObject",{x:(e||0)-80,y:(t||0)-18,width:80,height:40,children:h.jsx("div",{className:"text-[12px] leading-[16px] text-[#121212]",style:{width:"80px",whiteSpace:"normal",wordBreak:"break-word",textAlign:"left"},children:n?.value||""})});function fhe({data:e,bar:t}){const n=Array?.isArray(e)&&e?.length===0,i=(e==null?uhe:Array?.isArray(e)?e:[]).map(o=>({...o,name:o.facility_name,color:"#8B5CF6"}));return h.jsx(Ie,{title:"Bookings",icon:h.jsx(Hfe,{size:18,className:"text-[#DBB467]"}),className:"h-[288px]",children:h.jsx("div",{className:"w-full h-full flex items-center justify-center",children:n?h.jsx(En,{title:"No Booking Found",description:"Catch up all the data. Change the date range to see the data."}):h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:i||[],layout:"vertical",margin:{top:0,right:10,left:-12,bottom:0},children:[h.jsx(Un,{type:"number",allowDecimals:!1,tick:{fill:"#64748B",fontSize:12},axisLine:!0,tickLine:!1}),h.jsx(Ln,{type:"category",dataKey:"facility_name",axisLine:!1,tickLine:!1,width:100,tick:h.jsx(dhe,{})}),h.jsx(Dt,{cursor:{fill:"transparent"},position:{x:300,y:0},allowEscapeViewBox:{x:!0,y:!0},content:o=>o.active?h.jsx(dr,{...o,data:i,children:h.jsx(oi,{...o})}):null}),h.jsx(Kt,{dataKey:"total_booking",barSize:40,fill:t||"#8B5CF6"})]})})})})}const phe=[{building_name:"Google",no_of_booking:1},{building_name:"Uber",no_of_booking:2},{building_name:"ANAROCK",no_of_booking:4},{building_name:"Flipkart",no_of_booking:2},{building_name:"HP",no_of_booking:1}];function hhe({data:e}){const t=Array.isArray(e)&&e?.length===0,n=e==null?phe:Array.isArray(e)?e:[];return h.jsx(kt,{title:"Booking Trend by Organisation",titleWeight:"semi-bold",className:"h-[362px]",children:h.jsx("div",{className:"w-full h-[265px] mt-[28px] flex items-center justify-center",children:t?h.jsx(En,{title:"No Booking Found",description:"Catch up all the data. Change the date range to see the data."}):h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:n||[],margin:{top:0,right:0,left:-30,bottom:0},children:[h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#E5E7EB"}),h.jsx(Un,{dataKey:"building_name",axisLine:!1,tickLine:!1,tick:{fill:"#64748B",fontSize:12}}),h.jsx(Ln,{allowDecimals:!1,axisLine:!1,tickLine:!1,tick:{fill:"#64748B",fontSize:12},tickFormatter:r=>`${r??0}`}),h.jsx(Dt,{cursor:!1,allowEscapeViewBox:{x:!0,y:!0},content:r=>r.active?h.jsx(dr,{...r,data:n,children:h.jsx(oi,{...r})}):null}),h.jsx(Kt,{dataKey:"no_of_booking",barSize:54,fill:"#12B981"})]})})})})}const mhe=[{facility_name:"Table Tennis",paid_revenue:"24000.00"},{facility_name:"Games Room",paid_revenue:"14000.00"},{facility_name:"Badminton",paid_revenue:"10000.00"},{facility_name:"GYM",paid_revenue:"4000.00"}],rf=["#3C81F6","#60A5FA","#95BFFA","#BEDAFE","#DAE6FC"];function ghe({data:e,currencyType:t}){const n=Array?.isArray(e)&&e?.length===0,r=e??mhe,i=Array?.isArray(r)&&r?.length>0?r?.map(l=>({name:l?.facility_name||"Unknown",value:Number(l?.paid_revenue)||0})):[],a=(i?.length>0?i?.every(l=>l?.value===0):!1)?i?.map((l,c)=>({...l,value:c===0?1:0})):i,s=l=>`${t||"Rs"} ${l?.toLocaleString?.("en-IN")||0}`;return h.jsx(kt,{title:"Amenity Wise Revenue",titleWeight:"semi-bold",className:"h-[362px]",children:h.jsx("div",{className:"grid grid-cols-12 gap-[24px] items-center h-full mt-[16px]",children:n?h.jsx("div",{className:"col-span-12 flex items-center justify-center h-[240px]",children:h.jsx(En,{title:"No Amenity Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"col-span-6 h-[240px] w-full max-w-[240px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:a||[],dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:95,stroke:"#fff",strokeWidth:1,children:a?.map?.((l,c)=>h.jsx(In,{fill:rf?.[c%rf?.length]},`cell-${c}`))}),h.jsx(Dt,{cursor:!1,allowEscapeViewBox:{x:!0,y:!0},content:l=>l.active?h.jsx(dr,{...l,data:a,children:h.jsx(oi,{...l,formatter:c=>s(c)})}):null})]})})}),h.jsx("div",{className:"col-span-6",children:h.jsxs("div",{className:"rounded-[12px] !overflow-hidden border border-[#E2E8F0] !border-r-1 border-r-[#E2E8F0]! !pr-0 !mr-0",children:[h.jsxs("div",{className:"grid grid-cols-2 px-[12px] py-[8px] bg-[#EBEBEB] text-[12px] leading-[16px] font-semibold text-[#64748B]",children:[h.jsx("div",{children:"Amenity"}),h.jsx("div",{className:"text-right",children:"Revenue"})]}),h.jsx("div",{className:"divide-y divide-[#F1F5F9] max-h-[238px] overflow-y-auto hide-scrollbar",children:i?.map?.((l,c)=>h.jsxs("div",{className:"grid grid-cols-2 px-[16px] py-[16px] text-[14px] text-[#121212]",children:[h.jsxs("div",{className:"flex items-center gap-[12px]",children:[h.jsx("span",{className:"w-[16px] h-[7px]",style:{backgroundColor:rf?.[c%rf?.length]}}),h.jsx("span",{className:"text-[#64748B] text-[12px] leading-[16px]",children:l?.name||"Unknown"})]}),h.jsx("div",{className:"text-right text-[12px] leading-[16px] text-[#64748B]",children:s(l?.value||0)})]},l?.name||c))})]})})]})})})}const of=["#8CB33E","#F59E0B","#3B82F6","#06B6D4","#CFCFCF"],vhe=[{asset_group_name:"Lifts",asset_count:3},{asset_group_name:"Fire Systems",asset_count:16},{asset_group_name:"Generators",asset_count:16},{asset_group_name:"HVAC",asset_count:24},{asset_group_name:"Others",asset_count:97}],yhe=({rows:e,totalAssets:t})=>{const n=P.useMemo(()=>e?e.length===0?[]:e.map((i,o)=>({name:i.asset_group_name,facility_name:i.asset_group_name,value:i.asset_count||0,fill:of[o%of.length]})):vhe.map((i,o)=>({name:i.asset_group_name,facility_name:i.asset_group_name,value:i.asset_count||0,fill:of[o%of.length]})),[e]),r=t??n.reduce((i,o)=>i+o.value,0);return e&&e.length===0?h.jsx(kt,{title:"Assets by Type",titleWeight:"semi-bold",className:"h-full",children:h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(En,{title:"No Assets Found",description:"Catch up all the data. Change the date range to see the data."})})}):h.jsx(kt,{title:"Assets by Type",titleWeight:"semi-bold",className:"h-full",children:h.jsxs("div",{className:"flex items-center justify-between h-full mt-[16px]",children:[h.jsxs("div",{className:"relative w-[252px] h-[273px]",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:n,dataKey:"value",cx:"50%",cy:"50%",innerRadius:60,outerRadius:90,paddingAngle:2,stroke:"#FFFFFF",strokeWidth:2,startAngle:90,endAngle:-270,isAnimationActive:!1,children:n.map((i,o)=>h.jsx(In,{fill:i.fill},o))}),h.jsx(Dt,{cursor:!1,allowEscapeViewBox:{x:!0,y:!0},content:i=>i.active?h.jsx(dr,{...i,data:n,children:h.jsx(oi,{...i})}):null})]})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsx("div",{className:"text-[24px] leading-[33px] font-medium text-[#121212]",children:r}),h.jsx("div",{className:"text-[12px] leading-[17px] text-[#64748B] mt-[2px]",children:"Total Assets"})]})]}),h.jsx("div",{className:"flex-1 max-w-[280px]",children:h.jsxs("div",{className:"rounded-[12px] overflow-hidden bg-white border border-[#E2E8F0] !border-r-1 border-r-[#E2E8F0]! !pr-0 !mr-0",children:[h.jsxs("div",{className:"flex items-center justify-between px-[16px] py-[12px] bg-[#F8FAFC]",children:[h.jsx("div",{className:"text-[12px] font-medium text-[#64748B]",children:"Asset"}),h.jsx("div",{className:"text-[12px] font-medium text-[#64748B]",children:"Count"})]}),n.map((i,o)=>h.jsxs("div",{className:"max-h-[205px] overflow-y-auto hide-scrollbar flex items-center justify-between px-[16px] py-[12px] border-t border-[#F1F5F9]",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"w-[16px] h-[7px]",style:{backgroundColor:i.fill}}),h.jsx("div",{className:"text-[13px] text-[#475569]",children:i.name})]}),h.jsx("div",{className:"text-[13px] text-[#64748B]",children:i.value})]},o))]})})]})})},bhe=({data:e,title:t})=>{const[n,r]=P.useState({}),i=[{name:"Lifts",Cancelled:55,Closed:45,Open:50,OnHold:20,InProgress:10},{name:"Fire Systems",Cancelled:15,Closed:45,Open:15,OnHold:8,InProgress:5},{name:"Generators",Cancelled:12,Closed:45,Open:75,OnHold:18,InProgress:7},{name:"HVAC",Cancelled:45,Closed:80,Open:30,OnHold:22,InProgress:12},{name:"Others",Cancelled:18,Closed:18,Open:45,OnHold:9,InProgress:4}],o=P.useMemo(()=>e?Array.isArray(e)&&e.length===0?[]:e:i,[e]),a=s=>{const{dataKey:l}=s;r(c=>({...c,[l]:!c[l]}))};return Array.isArray(e)&&e.length===0?h.jsx(kt,{title:t||"Maintenance Status",titleWeight:"semi-bold",className:"h-full",children:h.jsx("div",{className:"w-full h-[260px] flex items-center justify-center",children:h.jsx(En,{title:"No Maintenance Assets Status Found",description:"Catch up all the data. Change the date range to see the data."})})}):h.jsx(kt,{title:t||"Maintenance Status",titleWeight:"semi-bold",className:"h-full",children:h.jsx("div",{className:"w-full h-[260px] flex items-center justify-center",children:Array.isArray(e)&&e.length===0?h.jsx("div",{className:"text-[#94A3B8] text-sm",children:"No Data Found"}):h.jsx("div",{className:"relative w-full h-[297px] mt-[20px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:o,barSize:54,barCategoryGap:"40%",margin:{top:20,right:20,left:-20,bottom:0},children:[h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#E2E8F0"}),h.jsx(Un,{dataKey:"name",tick:{fill:"#64748B",fontSize:12},axisLine:!1,tickLine:!1}),h.jsx(Ln,{tick:{fill:"#64748B",fontSize:12},axisLine:!1,tickLine:!1,allowDecimals:!1}),h.jsx(Dt,{cursor:{fill:"rgba(148, 163, 184, 0.12)"},allowEscapeViewBox:{x:!0,y:!0},content:s=>!s.active||!s.payload||!s.payload.length?null:h.jsx(dr,{...s,data:o,children:h.jsxs("div",{className:"bg-black rounded-[10px] px-[14px] py-[10px] text-[12px] text-white",children:[h.jsx("div",{className:"mb-[6px] font-semibold",children:s.label}),s.payload.map((l,c)=>{const u=l.color||l.fill||"#fff";return h.jsxs("div",{className:"flex items-center gap-[6px]",children:[h.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{backgroundColor:u}}),h.jsx("span",{className:"text-[#D1D3D4]",children:l.name}),h.jsx("span",{className:"text-white font-semibold",children:l.value})]},c)})]})})}),h.jsx(El,{verticalAlign:"bottom",align:"center",onClick:a,content:({payload:s})=>h.jsx("div",{className:"flex items-center justify-center gap-[16px] pt-4 flex-wrap",children:s.map((l,c)=>h.jsxs("div",{onClick:()=>a({dataKey:l.dataKey}),className:"flex items-center gap-[8px] cursor-pointer",children:[h.jsx("div",{style:{width:"16px",height:"8px",backgroundColor:n[l.dataKey]?"#CBD5E1":l.color}}),h.jsx("span",{style:{fontSize:"12px",color:n[l.dataKey]?"#CBD5E1":"#64748B"},children:l.value})]},c))})}),h.jsx(Kt,{dataKey:"Open",stackId:"a",fill:"#3B82F6",hide:n.Open}),h.jsx(Kt,{dataKey:"Closed",stackId:"a",fill:"#10B981",hide:n.Closed}),h.jsx(Kt,{dataKey:"Cancelled",stackId:"a",fill:"#B91C1C",hide:n.Cancelled}),h.jsx(Kt,{dataKey:"OnHold",stackId:"a",fill:"#64748B",hide:n.OnHold,name:"On-Hold"}),h.jsx(Kt,{dataKey:"InProgress",stackId:"a",fill:"#F59E0B",hide:n.InProgress,name:"In Progress"})]})})})})})};function xhe({data:e}){const t=[{name:"Completed",value:Number(e?.completed||0),color:"#12B981"},{name:"Not - Completed",value:Number(e?.not_completed||0),color:"#F69E0A"},{name:"Missed",value:Number(e?.missed||0),color:"#EF4444"}],n=Number(e?.completed||0)+Number(e?.not_completed||0)+Number(e?.missed||0),r=Number(e?.completed||0);return h.jsx(kt,{title:"Patrol Status",className:"h-[362px]",titleWeight:"semi-bold",children:h.jsxs("div",{className:"flex flex-col items-center justify-center",children:[h.jsxs("div",{className:"w-[215px] h-[182px] relative",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(zi,{children:[h.jsx(si,{data:t,innerRadius:60,outerRadius:90,paddingAngle:2,dataKey:"value",nameKey:"name",children:t.map((i,o)=>h.jsx(In,{fill:i.color},`cell-${o}`))}),h.jsx(Dt,{cursor:!1,allowEscapeViewBox:{x:!0,y:!0},content:i=>i.active?h.jsx(dr,{...i,data:t,children:h.jsx(oi,{...i})}):null})]})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center pointer-events-none",children:[h.jsxs("div",{className:"font-medium text-[19.35px] leading-[23.65px]",children:[r,"/",n]}),h.jsx("div",{className:"text-[10.75px] leading-[15.05px] text-[#64748B]",children:"Completed"})]})]}),h.jsx("div",{className:"flex flex-col w-full text-[14px]",children:t.map((i,o)=>h.jsxs("div",{className:`flex items-center justify-between py-[10px] ${o!==t.length-1?"border-b border-[#F1F5F9]":""}`,children:[h.jsxs("div",{className:"flex items-center gap-[10px]",children:[h.jsx("div",{className:"inline-block w-[16px] h-[7px]",style:{backgroundColor:i.color}}),h.jsx("div",{className:"leading-[16.09px] text-[12.07px] text-[#64748B]",children:i.name})]}),h.jsx("div",{className:"leading-[16.09px] text-[12.07px] text-[#64748B]",children:i.value})]},i.name))})]})})}function whe({incidentReports:e,incidentReportsDetails:t}){const n=Number(e?.open||0),r=Number(e?.in_progress||0),i=Number(e?.closed||0);return h.jsx(kt,{title:"Incident Reports",className:"h-[362px]",titleWeight:"semi-bold",children:h.jsxs("div",{children:[h.jsxs("div",{className:"flex w-full text-center gap-[16px] mt-[24px]",children:[h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-[#FBF4F4] h-[76px] rounded",children:[h.jsx("div",{className:"text-[24px] leading-[28px] font-medium text-[#AB0000]",children:n}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#AB0000]",children:"Open"})]}),h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-[#FFFBF2] h-[76px] rounded",children:[h.jsx("div",{className:"text-[24px] leading-[28px] font-medium text-[#F2A815]",children:r}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#F2A815]",children:"In-progress"})]}),h.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center bg-[#F7FEFA] h-[76px] rounded",children:[h.jsx("div",{className:"text-[24px] leading-[28px] font-medium text-[#1FA05B]",children:i}),h.jsx("div",{className:"text-[12px] leading-[16px] text-[#1FA05B]",children:"Closed"})]})]}),h.jsx("div",{className:"mt-4 space-y-2",children:t?.length>0?t.map((o,a)=>{const s=o?.escalation_level==="Danger"?"text-[#AB0000]":o?.escalation_level==="High"?"text-[#E7A015]":"text-[#1FA05B]";return h.jsxs("div",{className:"flex items-center justify-between p-[12px] bg-[#FAFBFD] rounded-md",children:[h.jsx("div",{className:"flex items-center gap-[8px]",children:h.jsx("div",{className:"text-gray-700 font-medium",children:o?.incident_reporting_id})}),h.jsx("div",{className:`!text-[12px] font-semibold flex items-center gap-[4px] ${s}`,children:h.jsxs("div",{children:[o?.escalation_value," - ",o?.escalation_level]})})]},a)}):h.jsx(h.Fragment,{})})]})})}function _he({columns:e=[{key:"a",label:"Organisation"},{key:"b",label:"Item"},{key:"c",label:"Closed"},{key:"d",label:"Open"},{key:"e",label:"AOV"},{key:"f",label:"% Revenue"}],data:t=[{a:"Google",b:"Coffee",c:"34,908",d:"₹ 57,21,288",e:"₹ 450",f:"43.6%"},{a:"Uber",b:"Paneer Combo",c:"12,000",d:"₹ 12,00,000",e:"₹ 500",f:"100%"}],rowsPerPage:n=10,setRowsPerPage:r=()=>{},currentPage:i=1,setCurrentPage:o=()=>{},totalRows:a=0,totalPages:s=1,pageOptions:l=[10,20,30,40,50]}){const c=Array.isArray(t)?t:[],u=Array.isArray(e)?e:[],d=n>0?Math.ceil(c.length/n):1,f=s||d,p=c,m=a===0&&c.length===0,g=`repeat(${u.length}, 1fr)`;return h.jsxs("div",{className:"w-full bg-white rounded-[12px] h-[390px] !border-[0.5px] !border-[#EBEBEB] !shadow-[0_0_12px_0_#EAF2FF] overflow-hidden flex flex-col",children:[h.jsxs("div",{className:"flex flex-col flex-1 overflow-hidden",children:[h.jsx("div",{className:"grid bg-[#354A5E] text-white text-[16px] leading-[20px] font-medium shrink-0",style:{gridTemplateColumns:g},children:u.map((v,x)=>h.jsx("div",{className:"px-[24px] py-[16px] text-[16px] leading-[20px] whitespace-nowrap text-left",children:v.label},x))}),h.jsx("div",{className:"flex-1 overflow-y-auto hide-scrollbar",children:m?h.jsx(En,{title:"No Data Found",description:"Catch up all the data. Change the date range to see the data."}):p.map((v,x)=>h.jsx("div",{className:"grid",style:{gridTemplateColumns:g},children:u.map((_,w)=>{const y=v[_.key],E=_.label==="Closed",S=_.label==="Open",k=typeof y=="string"&&y.includes("%"),D=y==="100%"?"bg-[#F0FEF2] text-[#36AB6C]":"bg-[#FFF0F0] text-[#AB0000]";return h.jsx("div",{className:`px-[24px] py-[16px] flex items-center justify-start ${w===0?"bg-white":"bg-gray-50"} text-[#121212]`,children:E?h.jsx("div",{className:"text-[14px] font-medium",style:{color:"#36AB6C"},children:y??"-"}):S?h.jsx("div",{className:"text-[14px] font-medium",style:{color:"#AB0000"},children:y??"-"}):k?h.jsx("div",{className:`inline-block px-[12px] py-[4px] rounded-full text-[14px] font-medium ${D}`,children:y}):h.jsx("div",{children:y??"-"})},w)})},x))})]}),h.jsxs("div",{className:"flex justify-end items-center px-[24px] py-[16px] text-sm bg-white border-t border-[#F0F0F0] gap-[32px] shrink-0",children:[h.jsxs("div",{className:"flex items-center gap-[8px] text-gray-600 text-[14px]",children:[h.jsx("div",{children:"Rows per page:"}),h.jsx("select",{value:n,onChange:v=>{r(Number(v.target.value)),o(1)},className:"border rounded px-[8px] py-[4px]",children:l.map((v,x)=>h.jsx("option",{value:v,children:v},x))}),h.jsxs("div",{className:"ml-4 text-[14px]",children:[c?.length===0?"0–0":`1–${c?.length}`," of"," ",a||c?.length]})]}),h.jsxs("div",{className:"flex items-center space-x-2 text-gray-600 text-[14px]",children:[h.jsx("button",{onClick:()=>o(1),disabled:i===1,className:"p-[8px] rounded hover:bg-gray-100 disabled:opacity-40",children:h.jsx(Bfe,{size:18})}),h.jsx("button",{onClick:()=>o(v=>v-1),disabled:i===1,className:"p-[8px] rounded hover:bg-gray-100 disabled:opacity-40",children:h.jsx(RI,{size:18})}),h.jsx("button",{onClick:()=>o(v=>v+1),disabled:i===f,className:"p-[8px] rounded hover:bg-gray-100 disabled:opacity-40",children:h.jsx(II,{size:18})}),h.jsx("button",{onClick:()=>o(f),disabled:i===f,className:"p-[8px] rounded hover:bg-gray-100 disabled:opacity-40",children:h.jsx(Vfe,{size:18})})]})]})]})}const $I=({options:e=[],value:t,onChange:n})=>{const[r,i]=P.useState(!1),o=P.useRef(null);return P.useEffect(()=>{const a=s=>{o.current&&!o.current.contains(s.target)&&i(!1)};return document.addEventListener("mousedown",a),()=>{document.removeEventListener("mousedown",a)}},[]),h.jsxs("div",{ref:o,className:"relative h-[32px]",children:[h.jsxs("div",{className:"flex items-center justify-between gap-[10px] px-[12px] py-[8px] border border-[#E2E8F0] rounded-[4px] cursor-pointer min-w-[140px]",onClick:()=>i(!r),children:[h.jsx("div",{className:"text-[12px] leading-[16px] min-w-[109px] text-[#64748B]",children:t}),h.jsx(Ife,{size:16,className:"text-[#64748B]"})]}),r&&h.jsx("div",{className:"absolute top-[110%] left-0 w-full bg-white border border-[#E2E8F0] rounded-[8px] shadow-md z-10",children:e.map((a,s)=>h.jsx("div",{className:"px-[12px] py-[8px] text-[14px] text-[#334155] hover:bg-[#F1F5F9] cursor-pointer",onClick:()=>{n(a),i(!1)},children:a},s))})]})},Ehe=({data:e})=>{const[t,n]=P.useState({}),[r,i]=P.useState("Kosmo One"),o=["Kosmo One","Kosmo Two","Kosmo Three"],a=[{name:"L1",Cancelled:55,Open:50,OnHold:20,InProgress:10},{name:"L2",Cancelled:15,Open:15,OnHold:8,InProgress:5},{name:"L3",Cancelled:12,Open:75,OnHold:18,InProgress:7}],s=P.useMemo(()=>e?Array.isArray(e)&&e.length===0?[]:e:a,[e]),l=c=>{const{dataKey:u}=c;n(d=>({...d,[u]:!d[u]}))};return Array.isArray(e)&&e.length===0?h.jsx(kt,{title:"Escalation Level By Building",titleWeight:"semi-bold",className:"h-full",children:h.jsx("div",{className:"w-full h-[362px] flex items-center justify-center",children:h.jsx(En,{title:"No Maintenance Assets Status Found",description:"Catch up all the data. Change the date range to see the data."})})}):h.jsx(kt,{title:"Escalation Level By Building",titleWeight:"semi-bold",className:"h-[362px]",childrenClassName:"mt-[21px]",rightContent:h.jsx($I,{options:o,value:r,onChange:c=>i(c)}),children:h.jsx("div",{className:"w-full flex items-center justify-center",children:Array.isArray(e)&&e.length===0?h.jsx("div",{className:"text-[#94A3B8] text-sm",children:"No Data Found"}):h.jsx("div",{className:"relative w-full h-[261px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(No,{data:s,barSize:54,barCategoryGap:"40%",margin:{top:20,right:20,left:-20,bottom:0},children:[h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#E2E8F0"}),h.jsx(Un,{dataKey:"name",tick:{fill:"#64748B",fontSize:12},axisLine:!1,tickLine:!1}),h.jsx(Ln,{tick:{fill:"#64748B",fontSize:12},axisLine:!1,tickLine:!1,allowDecimals:!1}),h.jsx(Dt,{cursor:{fill:"rgba(148, 163, 184, 0.12)"},content:({active:c,payload:u,label:d})=>!c||!u||!u.length?null:h.jsxs("div",{style:{backgroundColor:"#000",borderRadius:"10px",padding:"10px 14px",fontSize:"12px",color:"#fff"},children:[h.jsx("div",{style:{marginBottom:"6px",fontWeight:600},children:d}),u.map((f,p)=>{const m=f.color||f.fill||"#fff";return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"6px"},children:[h.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:m,display:"inline-block"}}),h.jsx("span",{style:{color:"#D1D3D4"},children:f.name}),h.jsx("span",{style:{color:"#fff",fontWeight:600},children:f.value})]},p)})]})}),h.jsx(El,{verticalAlign:"bottom",align:"center",onClick:l,content:({payload:c})=>h.jsx("div",{className:"flex items-center justify-center gap-[16px] pt-4 flex-wrap",children:c.map((u,d)=>h.jsxs("div",{onClick:()=>l({dataKey:u.dataKey}),className:"flex items-center gap-[8px] cursor-pointer",children:[h.jsx("div",{style:{width:"16px",height:"8px",backgroundColor:t[u.dataKey]?"#CBD5E1":u.color}}),h.jsx("span",{style:{fontSize:"12px",color:t[u.dataKey]?"#CBD5E1":"#64748B"},children:u.value})]},d))})}),h.jsx(Kt,{dataKey:"Open",stackId:"a",fill:"#3B82F6",hide:t.Open}),h.jsx(Kt,{dataKey:"Cancelled",stackId:"a",fill:"#B91C1C",hide:t.Cancelled}),h.jsx(Kt,{dataKey:"OnHold",stackId:"a",fill:"#64748B",hide:t.OnHold,name:"On-Hold"}),h.jsx(Kt,{dataKey:"InProgress",stackId:"a",fill:"#F59E0B",hide:t.InProgress,name:"In Progress"})]})})})})})},She=({data:e=[]})=>{const[t,n]=P.useState("Kosmo One"),r=["Kosmo One","Kosmo Two","Kosmo Three"],i=Array.isArray(e)?e:[],o=!i.length||i.every(a=>a.no_of_visitors===0);return h.jsx(kt,{title:"Top 5 Tenants by Visitors",titleWeight:"semi-bold",className:"h-[360px]",childrenClassName:"mt-[20px]",rightContent:h.jsx($I,{options:r,value:t,onChange:a=>n(a)}),children:o?h.jsx("div",{className:"w-full h-[280px] flex items-center justify-center",children:h.jsx(En,{title:"No Visitors Found",description:"Catch up all the data. Change the date range to see the data."})}):h.jsx("div",{className:"w-full h-[280px]",children:h.jsx(Ot,{width:"100%",height:"100%",children:h.jsxs(kj,{data:i,margin:{top:10,right:-10,left:-10,bottom:0},children:[h.jsx("defs",{children:h.jsxs("linearGradient",{id:"colorVisitors",x1:"0",y1:"0",x2:"0",y2:"1",children:[h.jsx("stop",{offset:"0%",stopColor:"#6366F1",stopOpacity:.25}),h.jsx("stop",{offset:"100%",stopColor:"#6366F1",stopOpacity:0})]})}),h.jsx(ur,{strokeDasharray:"3 3",vertical:!1,stroke:"#F1F5F9"}),h.jsx(Un,{dataKey:"day",type:"category",scale:"point",padding:{left:20,right:20},tick:{fontSize:12,fill:"#64748B"},axisLine:!0,tickLine:!1,tickFormatter:a=>new Date(a).toLocaleDateString("en-GB",{day:"2-digit",month:"short"})}),h.jsx(Ln,{width:35,tick:{fontSize:12,fill:"#64748B"},axisLine:!1,tickLine:!1,allowDecimals:!1,domain:[0,"dataMax + 2"]}),h.jsx(Dt,{cursor:!1,content:({active:a,payload:s,label:l,coordinate:c})=>{if(!a||!s?.length)return null;const u=new Date(l).toLocaleDateString("en-GB",{day:"2-digit",month:"short"});return h.jsx(oi,{active:a,payload:s,label:u})}}),h.jsx(Bx,{type:"monotone",dataKey:"no_of_visitors",stroke:"#6366F1",strokeWidth:2,fill:"url(#colorVisitors)",dot:{r:5,stroke:"#6366F1",strokeWidth:2,fill:"#fff"},activeDot:a=>{const{cx:s,cy:l,stroke:c}=a;return h.jsxs("g",{children:[h.jsx("circle",{cx:s,cy:l,r:6,fill:"#fff",stroke:"#6466F1",strokeWidth:2}),h.jsx("circle",{cx:s,cy:l,r:2.5,fill:"#6466F1"})]})}})]})})})})},Ohe=({data:e})=>{const t=[{name:"Kosmo One",total:29,pending:1,cancelled:2},{name:"OWC",total:23,pending:9,cancelled:3},{name:"Exora",total:40,pending:12,cancelled:1},{name:"OIC - T3",total:27,pending:19,cancelled:8}],n=e&&e.length?e:t;return h.jsx(kt,{title:"Building Wise Approvals",titleWeight:"semi-bold",className:"h-full",childrenClassName:"mt-[34px]",children:h.jsxs("div",{className:"w-full border border-[#EBEBEB] rounded-[10px] overflow-hidden",children:[h.jsxs("div",{className:"grid grid-cols-4 bg-[#FAFAFA] px-[12px] py-[8px] text-[12px] leading-[16px] font-semibold text-[#64748B]",children:[h.jsx("div",{children:"Tenant"}),h.jsx("div",{className:"flex justify-end",children:"Total"}),h.jsx("div",{className:"flex justify-end",children:"Pending"}),h.jsx("div",{className:"flex justify-end",children:"Cancelled"})]}),h.jsx("div",{className:"max-h-[280px] overflow-y-auto hide-scrollbar",children:n.map((r,i)=>h.jsxs("div",{className:"grid grid-cols-4 p-[12px] text-[12px] leading-[16px] border-t border-[#EBEBEB]",children:[h.jsx("div",{className:"text-[#475569]",children:r.name}),h.jsx("div",{className:"flex justify-end text-[#36AB6C] font-[400]",children:r.total}),h.jsx("div",{className:"flex justify-end text-[#F2A815] font-[400]",children:r.pending}),h.jsx("div",{className:"flex justify-end text-[#AB0000] font-[400]",children:r.cancelled})]},i))})]})})},af=["#8CB33E","#F59E0B","#3B82F6","#06B6D4","#CFCFCF"],Che=[{asset_group_name:"Lifts",asset_count:3,investment:"₹ 45L"},{asset_group_name:"Fire Systems",asset_count:16,investment:"₹ 28L"},{asset_group_name:"Generators",asset_count:16,investment:"₹ 95L"},{asset_group_name:"HVAC",asset_count:24,investment:"₹ 1.2Cr"},{asset_group_name:"Others",asset_count:97,investment:"₹ 52L"}],Phe=({rows:e,totalAssets:t})=>{const n=P.useMemo(()=>e?e.length===0?[]:e.map((i,o)=>({name:i.asset_group_name,value:i.asset_count||0,investment:i.investment||"-",color:af[o%af.length]})):Che.map((i,o)=>({name:i.asset_group_name,value:i.asset_count||0,investment:i.investment||"-",color:af[o%af.length]})),[e]),r=t??n.reduce((i,o)=>i+o.value,0);return e&&e.length===0?h.jsx(kt,{title:"Assets by Type",titleWeight:"semi-bold",className:"h-full",children:h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx(En,{title:"No Assets Found",description:"Catch up all the data. Change the date range to see the data."})})}):h.jsx(kt,{title:"Assets by Type",titleWeight:"semi-bold",className:"h-full",children:h.jsxs("div",{className:"flex items-center justify-between h-full mt-[16px]",children:[h.jsxs("div",{className:"relative w-[252px] h-[273px]",children:[h.jsx(Ot,{width:"100%",height:"100%",children:h.jsx(zi,{children:h.jsx(si,{data:n,dataKey:"value",cx:"50%",cy:"50%",innerRadius:60,outerRadius:90,paddingAngle:2,stroke:"#FFFFFF",strokeWidth:2,startAngle:90,endAngle:-270,children:n.map((i,o)=>h.jsx(In,{fill:i.color},o))})})}),h.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[h.jsx("div",{className:"text-[24px] leading-[33px] font-medium text-[#121212]",children:r}),h.jsx("div",{className:"text-[12px] leading-[17px] text-[#64748B] mt-[2px]",children:"Total Assets"})]})]}),h.jsx("div",{className:"flex-1 max-w-[280px]",children:h.jsxs("div",{className:"rounded-[12px] overflow-hidden bg-white border border-[#E2E8F0] !border-r-1 border-r-[#E2E8F0]! !pr-0 !mr-0",children:[h.jsxs("div",{className:"grid grid-cols-3 px-[16px] py-[12px] bg-[#F8FAFC]",children:[h.jsx("div",{className:"text-[12px] font-medium text-[#64748B]",children:"Asset"}),h.jsx("div",{className:"text-[12px] font-medium text-[#64748B] text-center",children:"Count"}),h.jsx("div",{className:"text-[12px] font-medium text-[#64748B] text-right",children:"Investment"})]}),h.jsx("div",{className:"max-h-[205px] overflow-y-auto hide-scrollbar",children:n.map((i,o)=>h.jsxs("div",{className:"grid grid-cols-3 px-[16px] py-[12px] border-t border-[#F1F5F9]",children:[h.jsxs("div",{className:"flex items-center gap-[8px]",children:[h.jsx("div",{className:"w-[16px] h-[7px]",style:{backgroundColor:i.color}}),h.jsx("div",{className:"text-[13px] text-[#475569]",children:i.name})]}),h.jsx("div",{className:"text-[13px] text-[#64748B] text-center",children:i.value}),h.jsx("div",{className:"text-[13px] text-[#64748B] text-right",children:i.investment})]},o))})]})})]})})};exports.AccessPointsUsage=nhe;exports.Accounting=sfe;exports.Amenities=Upe;exports.AmenitiesStatsCard=che;exports.AmenityWiseRevenue=ghe;exports.AssetValueBreakdown=bfe;exports.AssetsByType=yhe;exports.BlockWiseOccupancy=efe;exports.BookingTrendChart=hhe;exports.Bookings=fhe;exports.Budgets=dfe;exports.BuildingWiseApprovals=Ohe;exports.Card=Ie;exports.CardAccess=LI;exports.CashBankBalance=pfe;exports.CommercialAccessOverview=the;exports.CommercialGuardPatrols=xhe;exports.CommercialIncidentReports=whe;exports.CommercialOccupancy=Wpe;exports.CommercialReportTable=_he;exports.Community=eae;exports.Complaints=hpe;exports.ComplaintsByLevel=ype;exports.DuesAgeing=mfe;exports.EmployeeFootfall=Vpe;exports.Engagement=Lae;exports.EngagementStatsGrid=Bpe;exports.EscalationLevel=Ehe;exports.EventsUtilisation=Ape;exports.ExpenseCategories=vfe;exports.Facilities=$ae;exports.FinanceSummary=Fae;exports.FoodBeverages=Ype;exports.GateAndSecurityStatsGrid=dpe;exports.GateUpdates=Cse;exports.GuardPatrols=Xfe;exports.Header=s8;exports.Helpdesk=Pse;exports.HelpdeskStatsGrid=Ppe;exports.HourlyTrafficFlow=tpe;exports.IncidentReports=ipe;exports.IncomeExpenditure=NI;exports.MainHeader=x8;exports.MaintenanceStatus=bhe;exports.MetricCard=ohe;exports.MobileAccess=LI;exports.MoveInOutTrends=nfe;exports.NoticeBoardStatus=Npe;exports.OccupancyOverview=Qde;exports.OrganisationWiseVisitors=lhe;exports.PortfolioAssetsByType=Phe;exports.RequestBox=xpe;exports.ResidentOverview=Jde;exports.RevenuebyCategory=wfe;exports.SingleStats=Ipe;exports.StaffAttendance=spe;exports.StatsGrid=Cfe;exports.TenantsByVisitors=She;exports.TicketEscalation=Kpe;exports.TicketStatus=Gpe;exports.Tickets=MI;exports.TicketsperCategory=ihe;exports.UnitStatus=MI;exports.VisitorUpdates=ehe;exports.WeeklyVisitorPattern=ahe;
|