"use strict";(self.webpackChunknpwd_crypto=self.webpackChunknpwd_crypto||[]).push([[563,376],{5376:(e,t,n)=>{n.r(t),n.d(t,{Bar:()=>v,Bubble:()=>A,Chart:()=>p,Doughnut:()=>m,Line:()=>h,Pie:()=>y,PolarArea:()=>w,Radar:()=>C,Scatter:()=>R,getDatasetAtEvent:()=>d,getElementAtEvent:()=>f,getElementsAtEvent:()=>g});var r=n(2950),a=n.n(r),s=n(7e3);const o="label";function u(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function l(e,t){e.labels=t}function c(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o;const r=[];e.datasets=t.map((t=>{const a=e.datasets.find((e=>e[n]===t[n]));return a&&t.data&&!r.includes(a)?(r.push(a),Object.assign(a,t),a):{...t}}))}function i(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:o;const n={labels:[],datasets:[]};return l(n,e.labels),c(n,e.datasets,t),n}function d(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"dataset",{intersect:!0},!1)}function f(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"nearest",{intersect:!0},!1)}function g(e,t){return e.getElementsAtEventForMode(t.nativeEvent,"index",{intersect:!0},!1)}function b(e,t){let{height:n=150,width:o=300,redraw:d=!1,datasetIdKey:f,type:g,data:b,options:p,plugins:E=[],fallbackContent:h,updateMode:v,...C}=e;const m=(0,r.useRef)(null),w=(0,r.useRef)(),A=()=>{m.current&&(w.current=new s.Chart(m.current,{type:g,data:i(b,f),options:p&&{...p},plugins:E}),u(t,w.current))},y=()=>{u(t,null),w.current&&(w.current.destroy(),w.current=null)};return(0,r.useEffect)((()=>{var e,t;!d&&w.current&&p&&(e=w.current,t=p,Object.assign(e.options,t))}),[d,p]),(0,r.useEffect)((()=>{!d&&w.current&&l(w.current.config.data,b.labels)}),[d,b.labels]),(0,r.useEffect)((()=>{!d&&w.current&&b.datasets&&c(w.current.config.data,b.datasets,f)}),[d,b.datasets]),(0,r.useEffect)((()=>{w.current&&(d?(y(),setTimeout(A)):w.current.update(v))}),[d,p,b.labels,b.datasets,v]),(0,r.useEffect)((()=>{w.current&&(y(),setTimeout(A))}),[g]),(0,r.useEffect)((()=>(A(),()=>y())),[]),a().createElement("canvas",Object.assign({ref:m,role:"img",height:n,width:o},C),h)}const p=(0,r.forwardRef)(b);function E(e,t){return s.Chart.register(t),(0,r.forwardRef)(((t,n)=>a().createElement(p,Object.assign({},t,{ref:n,type:e}))))}const h=E("line",s.LineController),v=E("bar",s.BarController),C=E("radar",s.RadarController),m=E("doughnut",s.DoughnutController),w=E("polarArea",s.PolarAreaController),A=E("bubble",s.BubbleController),y=E("pie",s.PieController),R=E("scatter",s.ScatterController)}}]);
//# sourceMappingURL=data:application/json;charset=utf-8;base64,[encoded data, 13112 characters]