You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
topnotch_website/public/js/filament/widgets/components/chart.js

38 lines
262 KiB
JavaScript

2 months ago
function At(){}var Do=function(){let s=0;return function(){return s++}}();function N(s){return s===null||typeof s>"u"}function $(s){if(Array.isArray&&Array.isArray(s))return!0;let t=Object.prototype.toString.call(s);return t.slice(0,7)==="[object"&&t.slice(-6)==="Array]"}function A(s){return s!==null&&Object.prototype.toString.call(s)==="[object Object]"}var K=s=>(typeof s=="number"||s instanceof Number)&&isFinite(+s);function mt(s,t){return K(s)?s:t}function C(s,t){return typeof s>"u"?t:s}var Eo=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100:s/t,En=(s,t)=>typeof s=="string"&&s.endsWith("%")?parseFloat(s)/100*t:+s;function j(s,t,e){if(s&&typeof s.call=="function")return s.apply(e,t)}function H(s,t,e,i){let n,r,o;if($(s))if(r=s.length,i)for(n=r-1;n>=0;n--)t.call(e,s[n],n);else for(n=0;n<r;n++)t.call(e,s[n],n);else if(A(s))for(o=Object.keys(s),r=o.length,n=0;n<r;n++)t.call(e,s[o[n]],o[n])}function ws(s,t){let e,i,n,r;if(!s||!t||s.length!==t.length)return!1;for(e=0,i=s.length;e<i;++e)if(n=s[e],r=t[e],n.datasetIndex!==r.datasetIndex||n.index!==r.index)return!1;return!0}function ki(s){if($(s))return s.map(ki);if(A(s)){let t=Object.create(null),e=Object.keys(s),i=e.length,n=0;for(;n<i;++n)t[e[n]]=ki(s[e[n]]);return t}return s}function Co(s){return["__proto__","prototype","constructor"].indexOf(s)===-1}function Dc(s,t,e,i){if(!Co(s))return;let n=t[s],r=e[s];A(n)&&A(r)?Ie(n,r,i):t[s]=ki(r)}function Ie(s,t,e){let i=$(t)?t:[t],n=i.length;if(!A(s))return s;e=e||{};let r=e.merger||Dc;for(let o=0;o<n;++o){if(t=i[o],!A(t))continue;let a=Object.keys(t);for(let l=0,c=a.length;l<c;++l)r(a[l],s,t,e)}return s}function Pe(s,t){return Ie(s,t,{merger:Ec})}function Ec(s,t,e){if(!Co(s))return;let i=t[s],n=e[s];A(i)&&A(n)?Pe(i,n):Object.prototype.hasOwnProperty.call(t,s)||(t[s]=ki(n))}var mo={"":s=>s,x:s=>s.x,y:s=>s.y};function Bt(s,t){return(mo[t]||(mo[t]=Cc(t)))(s)}function Cc(s){let t=Ic(s);return e=>{for(let i of t){if(i==="")break;e=e&&e[i]}return e}}function Ic(s){let t=s.split("."),e=[],i="";for(let n of t)i+=n,i.endsWith("\\")?i=i.slice(0,-1)+".":(e.push(i),i="");return e}function Oi(s){return s.charAt(0).toUpperCase()+s.slice(1)}var ft=s=>typeof s<"u",Ht=s=>typeof s=="function",Cn=(s,t)=>{if(s.size!==t.size)return!1;for(let e of s)if(!t.has(e))return!1;return!0};function Io(s){return s.type==="mouseup"||s.type==="click"||s.type==="contextmenu"}var Y=Math.PI,B=2*Y,Fc=B+Y,Mi=Number.POSITIVE_INFINITY,Ac=Y/180,Z=Y/2,ys=Y/4,go=Y*2/3,gt=Math.log10,Tt=Math.sign;function In(s){let t=Math.round(s);s=Re(s,t,s/1e3)?t:s;let e=Math.pow(10,Math.floor(gt(s))),i=s/e;return(i<=1?1:i<=2?2:i<=5?5:10)*e}function Fo(s){let t=[],e=Math.sqrt(s),i;for(i=1;i<e;i++)s%i===0&&(t.push(i),t.push(s/i));return e===(e|0)&&t.push(e),t.sort((n,r)=>n-r).pop(),t}function pe(s){return!isNaN(parseFloat(s))&&isFinite(s)}function Re(s,t,e){return Math.abs(s-t)<e}function Ao(s,t){let e=Math.round(s);return e-t<=s&&e+t>=s}function Fn(s,t,e){let i,n,r;for(i=0,n=s.length;i<n;i++)r=s[i][e],isNaN(r)||(t.min=Math.min(t.min,r),t.max=Math.max(t.max,r))}function wt(s){return s*(Y/180)}function Di(s){return s*(180/Y)}function An(s){if(!K(s))return;let t=1,e=0;for(;Math.round(s*t)/t!==s;)t*=10,e++;return e}function Ln(s,t){let e=t.x-s.x,i=t.y-s.y,n=Math.sqrt(e*e+i*i),r=Math.atan2(i,e);return r<-.5*Y&&(r+=B),{angle:r,distance:n}}function Ti(s,t){return Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}function Lc(s,t){return(s-t+Fc)%B-Y}function ht(s){return(s%B+B)%B}function Ne(s,t,e,i){let n=ht(s),r=ht(t),o=ht(e),a=ht(r-n),l=ht(o-n),c=ht(n-r),h=ht(n-o);return n===r||n===o||i&&r===o||a>l&&c<h}function it(s,t,e){return Math.max(t,Math.min(e,s))}function Lo(s){return it(s,-32768,32767)}function Lt(s,t,e,i=1e-6){return s>=Math.min(t,e)-i&&s<=Math.max(t,e)+i}function Ei(s,t,e){e=e||(o=>s[o]<t);let i=s.length-1,n=0,r;for(;i-n>1;)r=n+i>>1,e(r)?n=r:i=r;return{lo:n,hi:i}}var Ft=(s,t,e,i)=>Ei(s,e,i?n=>s[n][t]<=e:n=>s[n][t]<e),Po=(s,t,e)=>Ei(s,e,i=>s[i][t]>=e);function Ro(s,t,e){let i=0,n=s.length;for(;i<n&&s[i]<t;)i++;for(;n>i&&s[n-1]>e;)n--;return i>0||n<s.length?s.slice(i,n):s}va
`)>-1?s.split(`
`):s}function uf(s,t){let{element:e,datasetIndex:i,index:n}=t,r=s.getDatasetMeta(i).controller,{label:o,value:a}=r.getLabelAndValue(n);return{chart:s,label:o,parsed:r.getParsed(n),raw:s.data.datasets[i].data[n],formattedValue:a,dataset:r.getDataset(),dataIndex:n,datasetIndex:i,element:e}}function Va(s,t){let e=s.chart.ctx,{body:i,footer:n,title:r}=s,{boxWidth:o,boxHeight:a}=t,l=st(t.bodyFont),c=st(t.titleFont),h=st(t.footerFont),u=r.length,d=n.length,f=i.length,m=at(t.padding),g=m.height,p=0,y=i.reduce((w,x)=>w+x.before.length+x.lines.length+x.after.length,0);if(y+=s.beforeBody.length+s.afterBody.length,u&&(g+=u*c.lineHeight+(u-1)*t.titleSpacing+t.titleMarginBottom),y){let w=t.displayColors?Math.max(a,l.lineHeight):l.lineHeight;g+=f*w+(y-f)*l.lineHeight+(y-1)*t.bodySpacing}d&&(g+=t.footerMarginTop+d*h.lineHeight+(d-1)*t.footerSpacing);let b=0,_=function(w){p=Math.max(p,e.measureText(w).width+b)};return e.save(),e.font=c.string,H(s.title,_),e.font=l.string,H(s.beforeBody.concat(s.afterBody),_),b=t.displayColors?o+2+t.boxPadding:0,H(i,w=>{H(w.before,_),H(w.lines,_),H(w.after,_)}),b=0,e.font=h.string,H(s.footer,_),e.restore(),p+=m.width,{width:p,height:g}}function df(s,t){let{y:e,height:i}=t;return e<i/2?"top":e>s.height-i/2?"bottom":"center"}function ff(s,t,e,i){let{x:n,width:r}=i,o=e.caretSize+e.caretPadding;if(s==="left"&&n+r+o>t.width||s==="right"&&n-r-o<0)return!0}function mf(s,t,e,i){let{x:n,width:r}=e,{width:o,chartArea:{left:a,right:l}}=s,c="center";return i==="center"?c=n<=(a+l)/2?"left":"right":n<=r/2?c="left":n>=o-r/2&&(c="right"),ff(c,s,t,e)&&(c="center"),c}function Ha(s,t,e){let i=e.yAlign||t.yAlign||df(s,e);return{xAlign:e.xAlign||t.xAlign||mf(s,t,e,i),yAlign:i}}function gf(s,t){let{x:e,width:i}=s;return t==="right"?e-=i:t==="center"&&(e-=i/2),e}function pf(s,t,e){let{y:i,height:n}=s;return t==="top"?i+=e:t==="bottom"?i-=n+e:i-=n/2,i}function Ba(s,t,e,i){let{caretSize:n,caretPadding:r,cornerRadius:o}=s,{xAlign:a,yAlign:l}=e,c=n+r,{topLeft:h,topRight:u,bottomLeft:d,bottomRight:f}=se(o),m=gf(t,a),g=pf(t,l,c);return l==="center"?a==="left"?m+=c:a==="right"&&(m-=c):a==="left"?m-=Math.max(h,d)+n:a==="right"&&(m+=Math.max(u,f)+n),{x:it(m,0,i.width-t.width),y:it(g,0,i.height-t.height)}}function Hi(s,t,e){let i=at(e.padding);return t==="center"?s.x+s.width/2:t==="right"?s.x+s.width-i.right:s.x+i.left}function $a(s){return Pt([],Ut(s))}function yf(s,t,e){return $t(s,{tooltip:t,tooltipItems:e,type:"tooltip"})}function ja(s,t){let e=t&&t.dataset&&t.dataset.tooltip&&t.dataset.tooltip.callbacks;return e?s.override(e):s}var Rs=class extends yt{constructor(t){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=t.chart||t._chart,this._chart=this.chart,this.options=t.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(t){this.options=t,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){let t=this._cachedAnimations;if(t)return t;let e=this.chart,i=this.options.setContext(this.getContext()),n=i.enabled&&e.options.animation&&i.animations,r=new ji(this.chart,n);return n._cacheable&&(this._cachedAnimations=Object.freeze(r)),r}getContext(){return this.$context||(this.$context=yf(this.chart.getContext(),this,this._tooltipItems))}getTitle(t,e){let{callbacks:i}=e,n=i.beforeTitle.apply(this,[t]),r=i.title.apply(this,[t]),o=i.afterTitle.apply(this,[t]),a=[];return a=Pt(a,Ut(n)),a=Pt(a,Ut(r)),a=Pt(a,Ut(o)),a}getBeforeBody(t,e){return $a(e.callbacks.beforeBody.apply(this,[t]))}getBody(t,e){let{callbacks:i}=e,n=[];return H(t,r=>{let o={before:[],lines:[],after:[]},a=ja(i,r);Pt(o.before,Ut(a.beforeLabel.call(this,r))),Pt(o.lines,a.label.call(this,r)),Pt(o.after,Ut(a.afterLabel.
/*! Bundled license information:
chart.js/dist/chunks/helpers.segment.mjs:
(*!
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*)
chart.js/dist/chunks/helpers.segment.mjs:
(*!
* @kurkle/color v0.2.1
* https://github.com/kurkle/color#readme
* (c) 2022 Jukka Kurkela
* Released under the MIT License
*)
chart.js/dist/chart.mjs:
(*!
* Chart.js v3.9.1
* https://www.chartjs.org
* (c) 2022 Chart.js Contributors
* Released under the MIT License
*)
chartjs-adapter-luxon/dist/chartjs-adapter-luxon.esm.js:
(*!
* chartjs-adapter-luxon v1.3.1
* https://www.chartjs.org
* (c) 2023 chartjs-adapter-luxon Contributors
* Released under the MIT license
*)
*/