@nivo/line
Advanced tools
@@ -1,2 +0,2 @@ | ||
| "use strict";var e=require("react"),o=require("@nivo/core"),i=require("@nivo/axes"),n=require("@nivo/legends"),r=require("@nivo/tooltip"),t=require("d3-shape"),a=require("lodash/uniqueId.js"),l=require("@nivo/theming"),s=require("@nivo/colors"),u=require("@nivo/scales"),d=require("react/jsx-runtime"),c=require("@react-spring/web"),h=require("@nivo/voronoi");function p(){return p=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},p.apply(null,arguments)}function v(e,o){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==o.indexOf(n))continue;i[n]=e[n]}return i}var f,b={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:e.memo((function(e){var o=e.point;return d.jsx(r.BasicTooltip,{id:d.jsxs("span",{children:["x: ",d.jsx("strong",{children:o.data.xFormatted}),", y:"," ",d.jsx("strong",{children:o.data.yFormatted})]}),enableChip:!0,color:o.seriesColor})})),sliceTooltip:e.memo((function(e){var o=e.slice,i=e.axis,n=l.useTheme(),t="x"===i?"y":"x";return d.jsx(r.TableTooltip,{rows:o.points.map((function(e){return[d.jsx(r.Chip,{color:e.seriesColor,style:n.tooltip.chip},"chip"),e.seriesId,d.jsx("span",{style:n.tooltip.tableCellValue,children:e.data[t+"Formatted"]},"value")]}))})})),debugMesh:!1,renderWrapper:!0},x=p({},b,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisBottom:{},axisLeft:{},useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),m=p({},b,{pixelRatio:"undefined"!=typeof window&&null!=(f=window.devicePixelRatio)?f:1,axisBottom:{},axisLeft:{}});function g(i){return e.useMemo((function(){return t.line().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y((function(e){return e.y})).curve(o.curveFromProp(i))}),[i])}function y(i){var n=i.curve,r=i.yScale,a=i.areaBaselineValue;return e.useMemo((function(){return t.area().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y1((function(e){return e.y})).curve(o.curveFromProp(n)).y0(r(a))}),[n,r,a])}var C=function(o){var i=o.componentId,n=o.enableSlices,r=o.points,t=o.width,a=o.height;return e.useMemo((function(){if("x"===n){var e=new Map;return r.forEach((function(o){null!==o.data.x&&null!==o.data.y&&(e.has(o.x)?e.get(o.x).push(o):e.set(o.x,[o]))})),Array.from(e.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,n){var r,l,s=e[0],u=e[1],d=n[o-1],c=n[o+1];return r=d?s-(s-d[0])/2:s,l=c?s-r+(c[0]-s)/2:t-r,{id:"slice:"+i+":"+s,x0:r,x:s,y0:0,y:0,width:l,height:a,points:u.reverse()}}))}if("y"===n){var o=new Map;return r.forEach((function(e){null!==e.data.x&&null!==e.data.y&&(o.has(e.y)?o.get(e.y).push(e):o.set(e.y,[e]))})),Array.from(o.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,i){var n,r,l=e[0],s=e[1],u=i[o-1],d=i[o+1];return n=u?l-(l-u[0])/2:l,r=d?l-n+(d[0]-l)/2:a-n,{id:l,x0:0,x:0,y0:n,y:l,width:t,height:r,points:s.reverse()}}))}return[]}),[i,n,a,r,t])},M="line",S=function(i){var n=i.data,r=i.xScale,t=void 0===r?b.xScale:r,d=i.xFormat,c=i.yScale,h=void 0===c?b.yScale:c,v=i.yFormat,f=i.width,m=i.height,S=i.colors,k=void 0===S?b.colors:S,T=i.curve,B=void 0===T?b.curve:T,w=i.areaBaselineValue,L=void 0===w?b.areaBaselineValue:w,D=i.pointColor,j=void 0===D?b.pointColor:D,I=i.pointBorderColor,W=void 0===I?b.pointBorderColor:I,E=i.enableSlices,F=void 0===E?x.enableSlices:E,P=i.initialHiddenIds,G=void 0===P?x.initialHiddenIds:P,O=e.useState(a(M))[0],A=o.useValueFormatter(d),V=o.useValueFormatter(v),H=s.useOrdinalColorScale(k,"id"),R=l.useTheme(),Y=s.useInheritedColor(j,R),q=s.useInheritedColor(W,R),U=e.useState(null!=G?G:[]),X=U[0],z=U[1],_=e.useMemo((function(){return u.computeXYScalesForSeries(n.filter((function(e){return-1===X.indexOf(e.id)})),t,h,f,m)}),[n,X,t,h,f,m]),N=_.xScale,Q=_.yScale,J=_.series,K=e.useMemo((function(){var e=n.map((function(e){return{id:e.id,label:""+e.id,color:H(e)}})),o=e.map((function(e){return p({},J.find((function(o){return o.id===e.id})),{color:e.color})})).filter((function(e){return Boolean(e.id)}));return{legendData:e.map((function(e){return p({},e,{hidden:!o.find((function(o){return o.id===e.id}))})})).reverse(),series:o}}),[n,J,H]),Z=K.legendData,$=K.series,ee=e.useCallback((function(e){z((function(o){return o.indexOf(e)>-1?o.filter((function(o){return o!==e})):[].concat(o,[e])}))}),[]),oe=function(o){var i=o.series,n=o.getPointColor,r=o.getPointBorderColor,t=o.formatX,a=o.formatY;return e.useMemo((function(){return i.reduce((function(e,o,i){return[].concat(e,o.data.filter((function(e){return null!==e.position.x&&null!==e.position.y})).map((function(l,s){var u={id:o.id+"."+s,indexInSeries:s,absIndex:e.length+s,seriesIndex:i,seriesId:o.id,seriesColor:o.color,x:l.position.x,y:l.position.y,data:p({},l.data,{xFormatted:t(l.data.x),yFormatted:a(l.data.y)})};return u.color=n({series:o,point:u}),u.borderColor=r(u),u})))}),[])}),[i,n,r,t,a])}({series:$,getPointColor:Y,getPointBorderColor:q,formatX:A,formatY:V}),ie=C({componentId:O,enableSlices:F,points:oe,width:f,height:m});return{legendData:Z,toggleSeries:ee,lineGenerator:g(B),areaGenerator:y({curve:B,yScale:Q,areaBaselineValue:L}),getColor:H,series:$,xScale:N,yScale:Q,slices:ie,points:oe}},k=function(e){var i=e.areaBlendMode,n=e.areaOpacity,r=e.color,t=e.fill,a=e.path,l=o.useMotionConfig(),s=l.animate,u=l.config,h=o.useAnimatedPath(a),p=c.useSpring({color:r,config:u,immediate:!s});return d.jsx(c.animated.path,{d:h,fill:t||p.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:i}})},T=e.memo((function(e){var o=e.areaGenerator,i=e.areaOpacity,n=e.areaBlendMode,r=e.series.slice(0).reverse();return d.jsx("g",{children:r.map((function(e){return d.jsx(k,p({path:o(e.data.map((function(e){return e.position})))},p({areaOpacity:i,areaBlendMode:n},e)),""+e.id)}))})})),B=e.memo((function(i){var n=i.lineGenerator,r=i.points,t=i.color,a=i.thickness,l=e.useMemo((function(){return n(r)}),[n,r]),s=o.useAnimatedPath(l);return d.jsx(c.animated.path,{d:s,fill:"none",strokeWidth:a,stroke:t})})),w=e.memo((function(e){var o=e.series,i=e.lineGenerator,n=e.lineWidth;return d.jsx(d.Fragment,{children:o.slice(0).reverse().map((function(e){var o=e.id,r=e.data,t=e.color;return d.jsx(B,{points:r.map((function(e){return e.position})),lineGenerator:i,color:t,thickness:n},o)}))})})),L=e.memo((function(o){var i=o.slice,n=o.slices,t=o.axis,a=o.debug,l=o.tooltip,s=o.isCurrent,u=o.setCurrent,c=o.onMouseEnter,h=o.onMouseMove,p=o.onMouseLeave,v=o.onMouseDown,f=o.onMouseUp,b=o.onClick,x=o.onDoubleClick,m=o.onTouchStart,g=o.onTouchMove,y=o.onTouchEnd,C=r.useTooltip(),M=C.showTooltipFromEvent,S=C.hideTooltip,k=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),c&&c(i,o)}),[M,l,i,t,u,c]),T=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),h&&h(i,o)}),[M,l,i,t,h]),B=e.useCallback((function(e){S(),u(null),p&&p(i,e)}),[S,u,p,i]),w=e.useCallback((function(e){v&&v(i,e)}),[i,v]),L=e.useCallback((function(e){f&&f(i,e)}),[i,f]),D=e.useCallback((function(e){b&&b(i,e)}),[i,b]),j=e.useCallback((function(e){x&&x(i,e)}),[i,x]),I=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),m&&m(i,o)}),[t,m,u,M,i,l]),W=e.useCallback((function(o){var r=o.touches[0],a=document.elementFromPoint(r.clientX,r.clientY),s=null==a?void 0:a.getAttribute("data-ref");if(s){var d=n.find((function(e){return e.id===s}));d&&(M(e.createElement(l,{slice:d,axis:t}),o,"right"),u(d))}g&&g(i,o)}),[t,g,u,M,i,n,l]),E=e.useCallback((function(e){S(),u(null),y&&y(i,e)}),[S,u,y,i]);return d.jsx("rect",{x:i.x0,y:i.y0,width:i.width,height:i.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:s&&a?.35:0,onMouseEnter:k,onMouseMove:T,onMouseLeave:B,onMouseDown:w,onMouseUp:L,onClick:D,onDoubleClick:j,onTouchStart:I,onTouchMove:W,onTouchEnd:E,"data-ref":i.id})})),D=e.memo((function(e){var o=e.slices,i=e.axis,n=e.debug,r=e.tooltip,t=e.current,a=e.setCurrent,l=e.onMouseEnter,s=e.onMouseMove,u=e.onMouseLeave,c=e.onMouseDown,h=e.onMouseUp,p=e.onClick,v=e.onDoubleClick,f=e.onTouchStart,b=e.onTouchMove,x=e.onTouchEnd;return d.jsx(d.Fragment,{children:o.map((function(e){return d.jsx(L,{slice:e,slices:o,axis:i,debug:n,tooltip:r,setCurrent:a,isCurrent:null!==t&&t.id===e.id,onMouseEnter:l,onMouseMove:s,onMouseLeave:u,onMouseDown:c,onMouseUp:h,onClick:p,onDoubleClick:v,onTouchStart:f,onTouchMove:b,onTouchEnd:x},e.id)}))})})),j=e.memo((function(i){var n=i.points,t=i.symbol,a=i.size,l=i.borderWidth,s=i.enableLabel,u=i.label,c=i.labelYOffset,h=i.isFocusable,p=i.setCurrentPoint,v=i.tooltip,f=i.margin,b=i.ariaLabel,x=i.ariaLabelledBy,m=i.ariaDescribedBy,g=i.ariaHidden,y=i.ariaDisabled,C=o.getLabelGenerator(u),M=r.useTooltip(),S=M.showTooltipAt,k=M.hideTooltip,T=n.slice(0).sort((function(e,o){return e.indexInSeries-o.indexInSeries})).sort((function(e,o){return o.seriesIndex-e.seriesIndex})).map((function(o){return{id:o.id,x:o.x,y:o.y,datum:o.data,fill:o.color,stroke:o.borderColor,label:s?C(o):null,ariaLabel:b?b(o):void 0,ariaLabelledBy:x?x(o):void 0,ariaDescribedBy:m?m(o):void 0,ariaHidden:g?g(o):void 0,ariaDisabled:y?y(o):void 0,onFocus:h?function(){p(o),S(e.createElement(v,{point:o}),[f.left+o.x,f.top+o.y],"top")}:void 0,onBlur:h?function(){p(null),k()}:void 0}}));return d.jsx("g",{children:T.map((function(e){return d.jsx(o.DotsItem,{x:e.x,y:e.y,datum:e.datum,symbol:t,size:a,color:e.fill,borderWidth:l,borderColor:e.stroke,label:e.label,labelYOffset:c,ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,ariaHidden:e.ariaHidden,ariaDisabled:e.ariaDisabled,isFocusable:h,onFocus:e.onFocus,onBlur:e.onBlur,testId:"line.point."+e.id},e.id)}))})})),I=e.memo((function(o){var i=o.points,n=o.width,t=o.height,a=o.margin,l=o.setCurrent,s=o.onMouseEnter,u=o.onMouseMove,c=o.onMouseLeave,p=o.onMouseDown,v=o.onMouseUp,f=o.onClick,b=o.onDoubleClick,x=o.onTouchStart,m=o.onTouchMove,g=o.onTouchEnd,y=o.tooltip,C=o.debug,M=o.enableTouchCrosshair,S=r.useTooltip(),k=S.showTooltipAt,T=S.hideTooltip,B=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),s&&s(o,i)}),[k,y,s,a]),w=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),u&&u(o,i)}),[k,y,a.left,a.top,u]),L=e.useCallback((function(e,o){T(),c&&c(e,o)}),[T,c]),D=e.useCallback((function(e,o){p&&p(e,o)}),[p]),j=e.useCallback((function(e,o){v&&v(e,o)}),[v]),I=e.useCallback((function(e,o){f&&f(e,o)}),[f]),W=e.useCallback((function(e,o){b&&b(e,o)}),[b]),E=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),x&&x(o,i)}),[a.left,a.top,x,k,y]),F=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),m&&m(o,i)}),[a.left,a.top,m,k,y]),P=e.useCallback((function(e,o){T(),g&&g(e,o)}),[g,T]);return d.jsx(h.Mesh,{nodes:i,width:n,height:t,setCurrent:l,onMouseEnter:B,onMouseMove:w,onMouseLeave:L,onMouseDown:D,onMouseUp:j,onClick:I,onDoubleClick:W,onTouchStart:E,onTouchMove:F,onTouchEnd:P,enableTouchCrosshair:M,debug:C})})),W=["isInteractive","animate","motionConfig","theme","renderWrapper"];function E(t){var a=t.data,l=t.xScale,s=void 0===l?x.xScale:l,u=t.xFormat,c=t.yScale,h=void 0===c?x.yScale:c,v=t.yFormat,f=t.curve,b=void 0===f?x.curve:f,m=t.margin,g=t.width,y=t.height,C=t.colors,M=void 0===C?x.colors:C,k=t.lineWidth,B=void 0===k?x.lineWidth:k,L=t.layers,W=void 0===L?x.layers:L,E=t.enableArea,F=void 0===E?x.enableArea:E,P=t.areaBaselineValue,G=void 0===P?x.areaBaselineValue:P,O=t.areaOpacity,A=void 0===O?x.areaOpacity:O,V=t.areaBlendMode,H=void 0===V?x.areaBlendMode:V,R=t.enablePoints,Y=void 0===R?x.enablePoints:R,q=t.pointSymbol,U=t.pointSize,X=void 0===U?x.pointSize:U,z=t.pointColor,_=void 0===z?x.pointColor:z,N=t.pointBorderWidth,Q=void 0===N?x.pointBorderWidth:N,J=t.pointBorderColor,K=void 0===J?x.pointBorderColor:J,Z=t.enablePointLabel,$=void 0===Z?x.enablePointLabel:Z,ee=t.pointLabel,oe=void 0===ee?x.pointLabel:ee,ie=t.pointLabelYOffset,ne=t.enableGridX,re=void 0===ne?x.enableGridX:ne,te=t.gridXValues,ae=t.enableGridY,le=void 0===ae?x.enableGridY:ae,se=t.gridYValues,ue=t.axisTop,de=t.axisRight,ce=t.axisBottom,he=void 0===ce?x.axisBottom:ce,pe=t.axisLeft,ve=void 0===pe?x.axisLeft:pe,fe=t.defs,be=void 0===fe?x.defs:fe,xe=t.fill,me=void 0===xe?x.fill:xe,ge=t.markers,ye=t.legends,Ce=void 0===ye?x.legends:ye,Me=t.isInteractive,Se=void 0===Me?x.isInteractive:Me,ke=t.useMesh,Te=void 0===ke?x.useMesh:ke,Be=t.debugMesh,we=void 0===Be?x.debugMesh:Be,Le=t.onMouseEnter,De=t.onMouseMove,je=t.onMouseLeave,Ie=t.onMouseDown,We=t.onMouseUp,Ee=t.onClick,Fe=t.onDoubleClick,Pe=t.onTouchStart,Ge=t.onTouchMove,Oe=t.onTouchEnd,Ae=t.tooltip,Ve=void 0===Ae?x.tooltip:Ae,He=t.enableSlices,Re=void 0===He?x.enableSlices:He,Ye=t.debugSlices,qe=void 0===Ye?x.debugSlices:Ye,Ue=t.sliceTooltip,Xe=void 0===Ue?x.sliceTooltip:Ue,ze=t.enableCrosshair,_e=void 0===ze?x.enableCrosshair:ze,Ne=t.crosshairType,Qe=void 0===Ne?x.crosshairType:Ne,Je=t.enableTouchCrosshair,Ke=void 0===Je?x.enableTouchCrosshair:Je,Ze=t.role,$e=void 0===Ze?x.role:Ze,eo=t.ariaLabel,oo=t.ariaLabelledBy,io=t.ariaDescribedBy,no=t.isFocusable,ro=void 0===no?x.isFocusable:no,to=t.pointAriaLabel,ao=t.pointAriaLabelledBy,lo=t.pointAriaDescribedBy,so=t.pointAriaHidden,uo=t.pointAriaDisabled,co=t.initialHiddenIds,ho=void 0===co?x.initialHiddenIds:co,po=o.useDimensions(g,y,m),vo=po.margin,fo=po.innerWidth,bo=po.innerHeight,xo=po.outerWidth,mo=po.outerHeight,go=S({data:a,xScale:s,xFormat:u,yScale:h,yFormat:v,width:fo,height:bo,colors:M,curve:b,areaBaselineValue:G,pointColor:_,pointBorderColor:K,enableSlices:Re,initialHiddenIds:ho}),yo=go.legendData,Co=go.toggleSeries,Mo=go.lineGenerator,So=go.areaGenerator,ko=go.series,To=go.xScale,Bo=go.yScale,wo=go.slices,Lo=go.points,Do=e.useState(null),jo=Do[0],Io=Do[1],Wo=e.useState(null),Eo=Wo[0],Fo=Wo[1],Po={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};W.includes("grid")&&(re||le)&&(Po.grid=d.jsx(i.Grid,{width:fo,height:bo,xScale:re?To:null,yScale:le?Bo:null,xValues:te,yValues:se},"grid")),W.includes("markers")&&Array.isArray(ge)&&ge.length>0&&(Po.markers=d.jsx(o.CartesianMarkers,{markers:ge,width:fo,height:bo,xScale:To,yScale:Bo},"markers")),W.includes("axes")&&(Po.axes=d.jsx(i.Axes,{xScale:To,yScale:Bo,width:fo,height:bo,top:ue,right:de,bottom:he,left:ve},"axes")),W.includes("lines")&&(Po.lines=d.jsx(w,{series:ko,lineGenerator:Mo,lineWidth:B},"lines")),W.includes("legends")&&Ce.length>0&&(Po.legends=d.jsx(e.Fragment,{children:Ce.map((function(e,o){return d.jsx(n.BoxLegendSvg,p({},e,{containerWidth:fo,containerHeight:bo,data:e.data||yo,toggleSerie:e.toggleSerie?Co:void 0}),o)}))},"legends"));var Go=o.bindDefs(be,ko,me);F&&(Po.areas=d.jsx(T,{areaGenerator:So,areaOpacity:A,areaBlendMode:H,series:ko},"areas")),Se&&!1!==Re&&(Po.slices=d.jsx(D,{slices:wo,axis:Re,debug:qe,tooltip:Xe,current:Eo,setCurrent:Fo,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe},"slices")),Y&&(Po.points=d.jsx(j,{points:Lo,symbol:q,size:X,borderWidth:Q,enableLabel:$,label:oe,labelYOffset:ie,isFocusable:ro,setCurrentPoint:Io,tooltip:Ve,margin:vo,ariaLabel:to,ariaLabelledBy:ao,ariaDescribedBy:lo,ariaHidden:so,ariaDisabled:uo},"points")),Se&&_e&&(null!==jo&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:jo.x,y:jo.y,type:Qe},"crosshair")),null!==Eo&&Re&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:Eo.x,y:Eo.y,type:Re},"crosshair"))),Se&&Te&&!1===Re&&(Po.mesh=d.jsx(I,{points:Lo,width:fo,height:bo,margin:vo,setCurrent:Io,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe,tooltip:Ve,enableTouchCrosshair:Ke,debug:we},"mesh"));var Oo=e.useMemo((function(){return{innerWidth:fo,innerHeight:bo,series:ko,slices:wo,points:Lo,xScale:To,yScale:Bo,lineGenerator:Mo,areaGenerator:So,currentPoint:jo,setCurrentPoint:Io,currentSlice:Eo,setCurrentSlice:Fo}}),[fo,bo,ko,wo,Lo,To,Bo,Mo,So,jo,Io,Eo,Fo]);return d.jsx(o.SvgWrapper,{defs:Go,width:xo,height:mo,margin:vo,role:$e,ariaLabel:eo,ariaLabelledBy:oo,ariaDescribedBy:io,isFocusable:ro,children:W.map((function(o,i){return"function"==typeof o?d.jsx(e.Fragment,{children:o(Oo)},i):Po[o]}))})}function F(e){var i=e.isInteractive,n=void 0===i?x.isInteractive:i,r=e.animate,t=void 0===r?x.animate:r,a=e.motionConfig,l=void 0===a?x.motionConfig:a,s=e.theme,u=e.renderWrapper,c=v(e,W);return d.jsx(o.Container,{animate:t,isInteractive:n,motionConfig:l,renderWrapper:u,theme:s,children:d.jsx(E,p({isInteractive:n},c))})}var P=["isInteractive","renderWrapper","theme"],G=function(t){var a=t.width,s=t.height,u=t.margin,c=t.pixelRatio,v=void 0===c?m.pixelRatio:c,f=t.data,b=t.xScale,x=void 0===b?m.xScale:b,g=t.xFormat,y=t.yScale,C=void 0===y?m.yScale:y,M=t.yFormat,k=t.curve,T=void 0===k?m.curve:k,B=t.layers,w=void 0===B?m.layers:B,L=t.colors,D=void 0===L?m.colors:L,j=t.lineWidth,I=void 0===j?m.lineWidth:j,W=t.enableArea,E=void 0===W?m.enableArea:W,F=t.areaBaselineValue,P=void 0===F?m.areaBaselineValue:F,G=t.areaOpacity,O=void 0===G?m.areaOpacity:G,A=t.enablePoints,V=void 0===A?m.enablePoints:A,H=t.pointSize,R=void 0===H?m.pointSize:H,Y=t.pointColor,q=void 0===Y?m.pointColor:Y,U=t.pointBorderWidth,X=void 0===U?m.pointBorderWidth:U,z=t.pointBorderColor,_=void 0===z?m.pointBorderColor:z,N=t.enableGridX,Q=void 0===N?m.enableGridX:N,J=t.gridXValues,K=t.enableGridY,Z=void 0===K?m.enableGridY:K,$=t.gridYValues,ee=t.axisTop,oe=t.axisRight,ie=t.axisBottom,ne=void 0===ie?m.axisBottom:ie,re=t.axisLeft,te=void 0===re?m.axisLeft:re,ae=t.legends,le=void 0===ae?m.legends:ae,se=t.isInteractive,ue=void 0===se?m.isInteractive:se,de=t.debugMesh,ce=void 0===de?m.debugMesh:de,he=t.onMouseLeave,pe=t.onMouseDown,ve=t.onMouseUp,fe=t.onClick,be=t.onDoubleClick,xe=t.tooltip,me=void 0===xe?m.tooltip:xe,ge=t.forwardedRef,ye=e.useRef(null),Ce=o.useDimensions(a,s,u),Me=Ce.margin,Se=Ce.innerWidth,ke=Ce.innerHeight,Te=Ce.outerWidth,Be=Ce.outerHeight,we=l.useTheme(),Le=e.useState(null),De=Le[0],je=Le[1],Ie=S({data:f,xScale:x,xFormat:g,yScale:C,yFormat:M,width:Se,height:ke,colors:D,curve:T,areaBaselineValue:P,pointColor:q,pointBorderColor:_}),We=Ie.lineGenerator,Ee=Ie.areaGenerator,Fe=Ie.series,Pe=Ie.xScale,Ge=Ie.yScale,Oe=Ie.points,Ae=e.useMemo((function(){return{innerWidth:Se,innerHeight:ke,series:Fe,points:Oe,xScale:Pe,yScale:Ge,lineWidth:I,lineGenerator:We,areaGenerator:Ee,currentPoint:De,setCurrentPoint:je}}),[Se,ke,Fe,Oe,Pe,Ge,I,We,Ee,De]),Ve=h.useVoronoiMesh({points:Oe,width:Se,height:ke,debug:ce}),He=Ve.delaunay,Re=Ve.voronoi;e.useEffect((function(){if(null!==ye.current){ye.current.width=Te*v,ye.current.height=Be*v;var e=ye.current.getContext("2d");e.scale(v,v),e.fillStyle=we.background,e.fillRect(0,0,Te,Be),e.translate(Me.left,Me.top),w.forEach((function(o){if("function"==typeof o&&o(e,Ae),"grid"===o&&(we.grid.line.strokeWidth||0)>0&&(e.lineWidth=we.grid.line.strokeWidth,e.strokeStyle=we.grid.line.stroke,Q&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Pe,axis:"x",values:J}),Z&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Ge,axis:"y",values:$})),"axes"===o&&i.renderAxesToCanvas(e,{xScale:Pe,yScale:Ge,width:Se,height:ke,top:ee,right:oe,bottom:ne,left:te,theme:we}),"areas"===o&&!0===E){e.save(),e.globalAlpha=O,Ee.context(e);for(var r=Fe.length-1;r>=0;r--)e.fillStyle=Fe[r].color,e.beginPath(),Ee(Fe[r].data.map((function(e){return e.position}))),e.fill();e.restore()}if("lines"===o&&(We.context(e),Fe.forEach((function(o){e.strokeStyle=o.color,e.lineWidth=I,e.beginPath(),We(o.data.map((function(e){return e.position}))),e.stroke()}))),"points"===o&&!0===V&&R>0&&Oe.forEach((function(o){e.fillStyle=o.color,e.beginPath(),e.arc(o.x,o.y,R/2,0,2*Math.PI),e.fill(),X>0&&(e.strokeStyle=o.borderColor,e.lineWidth=X,e.stroke())})),"mesh"===o&&!0===ce&&void 0!==Re&&(h.renderVoronoiToCanvas(e,Re),De&&h.renderVoronoiCellToCanvas(e,Re,De.absIndex)),"legends"===o){var t=Fe.map((function(e){return{id:e.id,label:e.id,color:e.color}})).reverse();le.forEach((function(o){n.renderLegendToCanvas(e,p({},o,{data:o.data||t,containerWidth:Se,containerHeight:ke,theme:we}))}))}}))}}),[ye,Te,Be,w,we,We,Fe,Pe,Ge,Q,J,Z,$,ee,oe,ne,te,le,Oe,V,R,De]);var Ye=e.useCallback((function(e){if(!ye.current)return null;var i=o.getRelativeCursor(ye.current,e),n=i[0],r=i[1];if(!o.isCursorInRect(Me.left,Me.top,Se,ke,n,r))return null;var t=He.find(n-Me.left,r-Me.top);return Oe[t]}),[ye,Me,Se,ke,He]),qe=r.useTooltip(),Ue=qe.showTooltipFromEvent,Xe=qe.hideTooltip,ze=e.useCallback((function(o){var i=Ye(o);je(i),i?Ue(e.createElement(me,{point:i}),o):Xe()}),[Ye,je,Ue,Xe,me]),_e=e.useCallback((function(e){Xe(),je(null),De&&he&&he(De,e)}),[Xe,je,he]),Ne=e.useCallback((function(e){if(pe){var o=Ye(e);o&&pe(o,e)}}),[Ye,pe]),Qe=e.useCallback((function(e){if(ve){var o=Ye(e);o&&ve(o,e)}}),[Ye,ve]),Je=e.useCallback((function(e){if(fe){var o=Ye(e);o&&fe(o,e)}}),[Ye,fe]),Ke=e.useCallback((function(e){if(be){var o=Ye(e);o&&be(o,e)}}),[Ye,be]);return d.jsx("canvas",{ref:o.mergeRefs(ye,ge),width:Te*v,height:Be*v,style:{width:Te,height:Be,cursor:ue?"auto":"normal"},onMouseEnter:ue?ze:void 0,onMouseMove:ue?ze:void 0,onMouseLeave:ue?_e:void 0,onMouseDown:ue?Ne:void 0,onMouseUp:ue?Qe:void 0,onClick:ue?Je:void 0,onDoubleClick:ue?Ke:void 0})},O=e.forwardRef((function(e,i){var n=e.isInteractive,r=e.renderWrapper,t=e.theme,a=v(e,P);return d.jsx(o.Container,{isInteractive:n,renderWrapper:r,theme:t,animate:!1,children:d.jsx(G,p({},a,{forwardedRef:i}))})}));var A=e.forwardRef((function(e,i){return d.jsx(o.ResponsiveWrapper,{children:function(o){var n=o.width,r=o.height;return d.jsx(O,p({width:n,height:r},e,{ref:i}))}})}));exports.LINE_UNIQUE_ID_PREFIX=M,exports.Line=F,exports.LineCanvas=O,exports.ResponsiveLine=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var i=o.width,n=o.height;return d.jsx(F,p({width:i,height:n},e))}})},exports.ResponsiveLineCanvas=A,exports.canvasDefaultProps=m,exports.commonDefaultProps=b,exports.isPoint=function(e){return void 0!==e.seriesId},exports.isSliceData=function(e){return void 0!==e.points},exports.svgDefaultProps=x,exports.useAreaGenerator=y,exports.useLine=S,exports.useLineGenerator=g,exports.useSlices=C; | ||
| "use strict";var e=require("react"),o=require("@nivo/core"),i=require("@nivo/axes"),n=require("@nivo/legends"),r=require("@nivo/tooltip"),t=require("d3-shape"),a=require("lodash/uniqueId.js"),l=require("@nivo/theming"),s=require("@nivo/colors"),u=require("@nivo/scales"),d=require("react/jsx-runtime"),c=require("@react-spring/web"),h=require("@nivo/voronoi");function p(){return p=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},p.apply(null,arguments)}function v(e,o){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==o.indexOf(n))continue;i[n]=e[n]}return i}var f,b={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:e.memo((function(e){var o=e.point;return d.jsx(r.BasicTooltip,{id:d.jsxs("span",{children:["x: ",d.jsx("strong",{children:o.data.xFormatted}),", y:"," ",d.jsx("strong",{children:o.data.yFormatted})]}),enableChip:!0,color:o.seriesColor})})),sliceTooltip:e.memo((function(e){var o=e.slice,i=e.axis,n=l.useTheme(),t="x"===i?"y":"x";return d.jsx(r.TableTooltip,{rows:o.points.map((function(e){return[d.jsx(r.Chip,{color:e.seriesColor,style:n.tooltip.chip},"chip"),e.seriesId,d.jsx("span",{style:n.tooltip.tableCellValue,children:e.data[t+"Formatted"]},"value")]}))})})),debugMesh:!1,renderWrapper:!0},x=p({},b,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisBottom:{},axisLeft:{},useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),m=p({},b,{pixelRatio:"undefined"!=typeof window&&null!=(f=window.devicePixelRatio)?f:1,axisBottom:{},axisLeft:{}});function g(i){return e.useMemo((function(){return t.line().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y((function(e){return e.y})).curve(o.curveFromProp(i))}),[i])}function y(i){var n=i.curve,r=i.yScale,a=i.areaBaselineValue;return e.useMemo((function(){return t.area().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y1((function(e){return e.y})).curve(o.curveFromProp(n)).y0(r(a))}),[n,r,a])}var C=function(o){var i=o.componentId,n=o.enableSlices,r=o.points,t=o.width,a=o.height;return e.useMemo((function(){if("x"===n){var e=new Map;return r.forEach((function(o){null!==o.data.x&&null!==o.data.y&&(e.has(o.x)?e.get(o.x).push(o):e.set(o.x,[o]))})),Array.from(e.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,n){var r,l,s=e[0],u=e[1],d=n[o-1],c=n[o+1];return r=d?s-(s-d[0])/2:s,l=c?s-r+(c[0]-s)/2:t-r,{id:"slice:"+i+":"+s,x0:r,x:s,y0:0,y:0,width:l,height:a,points:u.reverse()}}))}if("y"===n){var o=new Map;return r.forEach((function(e){null!==e.data.x&&null!==e.data.y&&(o.has(e.y)?o.get(e.y).push(e):o.set(e.y,[e]))})),Array.from(o.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,i){var n,r,l=e[0],s=e[1],u=i[o-1],d=i[o+1];return n=u?l-(l-u[0])/2:l,r=d?l-n+(d[0]-l)/2:a-n,{id:l,x0:0,x:0,y0:n,y:l,width:t,height:r,points:s.reverse()}}))}return[]}),[i,n,a,r,t])},M="line",S=function(i){var n=i.data,r=i.xScale,t=void 0===r?b.xScale:r,d=i.xFormat,c=i.yScale,h=void 0===c?b.yScale:c,v=i.yFormat,f=i.width,m=i.height,S=i.colors,k=void 0===S?b.colors:S,T=i.curve,B=void 0===T?b.curve:T,w=i.areaBaselineValue,L=void 0===w?b.areaBaselineValue:w,D=i.pointColor,j=void 0===D?b.pointColor:D,I=i.pointBorderColor,W=void 0===I?b.pointBorderColor:I,E=i.enableSlices,F=void 0===E?x.enableSlices:E,P=i.initialHiddenIds,G=void 0===P?x.initialHiddenIds:P,O=e.useState(a(M))[0],A=o.useValueFormatter(d),V=o.useValueFormatter(v),H=s.useOrdinalColorScale(k,"id"),R=l.useTheme(),Y=s.useInheritedColor(j,R),q=s.useInheritedColor(W,R),U=e.useState(null!=G?G:[]),X=U[0],z=U[1],_=e.useMemo((function(){return u.computeXYScalesForSeries(n.filter((function(e){return-1===X.indexOf(e.id)})),t,h,f,m)}),[n,X,t,h,f,m]),N=_.xScale,Q=_.yScale,J=_.series,K=e.useMemo((function(){var e=n.map((function(e){return{id:e.id,label:""+e.id,color:H(e)}})),o=e.map((function(e){return p({},J.find((function(o){return o.id===e.id})),{color:e.color})})).filter((function(e){return Boolean(e.id)}));return{legendData:e.map((function(e){return p({},e,{hidden:!o.find((function(o){return o.id===e.id}))})})).reverse(),series:o}}),[n,J,H]),Z=K.legendData,$=K.series,ee=e.useCallback((function(e){z((function(o){return o.indexOf(e)>-1?o.filter((function(o){return o!==e})):[].concat(o,[e])}))}),[]),oe=function(o){var i=o.series,n=o.getPointColor,r=o.getPointBorderColor,t=o.formatX,a=o.formatY;return e.useMemo((function(){return i.reduce((function(e,o,i){return[].concat(e,o.data.filter((function(e){return null!==e.position.x&&null!==e.position.y})).map((function(l,s){var u={id:o.id+"."+s,indexInSeries:s,absIndex:e.length+s,seriesIndex:i,seriesId:o.id,seriesColor:o.color,x:l.position.x,y:l.position.y,data:p({},l.data,{xFormatted:t(l.data.x),yFormatted:a(l.data.y)})};return u.color=n({series:o,point:u}),u.borderColor=r(u),u})))}),[])}),[i,n,r,t,a])}({series:$,getPointColor:Y,getPointBorderColor:q,formatX:A,formatY:V}),ie=C({componentId:O,enableSlices:F,points:oe,width:f,height:m});return{legendData:Z,toggleSeries:ee,lineGenerator:g(B),areaGenerator:y({curve:B,yScale:Q,areaBaselineValue:L}),getColor:H,series:$,xScale:N,yScale:Q,slices:ie,points:oe}},k=function(e){var i=e.areaBlendMode,n=e.areaOpacity,r=e.color,t=e.fill,a=e.path,l=o.useMotionConfig(),s=l.animate,u=l.config,h=o.useAnimatedPath(a),p=c.useSpring({color:r,config:u,immediate:!s});return d.jsx(c.animated.path,{d:h,fill:t||p.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:i}})},T=e.memo((function(e){var o=e.areaGenerator,i=e.areaOpacity,n=e.areaBlendMode,r=e.series.slice(0).reverse();return d.jsx("g",{children:r.map((function(e){return d.jsx(k,p({path:o(e.data.map((function(e){return e.position})))},p({areaOpacity:i,areaBlendMode:n},e)),""+e.id)}))})})),B=e.memo((function(i){var n=i.lineGenerator,r=i.points,t=i.color,a=i.thickness,l=e.useMemo((function(){return n(r)}),[n,r]),s=o.useAnimatedPath(l);return d.jsx(c.animated.path,{d:s,fill:"none",strokeWidth:a,stroke:t})})),w=e.memo((function(e){var o=e.series,i=e.lineGenerator,n=e.lineWidth;return d.jsx(d.Fragment,{children:o.slice(0).reverse().map((function(e){var o=e.id,r=e.data,t=e.color;return d.jsx(B,{points:r.map((function(e){return e.position})),lineGenerator:i,color:t,thickness:n},o)}))})})),L=e.memo((function(o){var i=o.slice,n=o.slices,t=o.axis,a=o.debug,l=o.tooltip,s=o.isCurrent,u=o.setCurrent,c=o.onMouseEnter,h=o.onMouseMove,p=o.onMouseLeave,v=o.onMouseDown,f=o.onMouseUp,b=o.onClick,x=o.onDoubleClick,m=o.onTouchStart,g=o.onTouchMove,y=o.onTouchEnd,C=r.useTooltip(),M=C.showTooltipFromEvent,S=C.hideTooltip,k=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),c&&c(i,o)}),[M,l,i,t,u,c]),T=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),h&&h(i,o)}),[M,l,i,t,h]),B=e.useCallback((function(e){S(),u(null),p&&p(i,e)}),[S,u,p,i]),w=e.useCallback((function(e){v&&v(i,e)}),[i,v]),L=e.useCallback((function(e){f&&f(i,e)}),[i,f]),D=e.useCallback((function(e){b&&b(i,e)}),[i,b]),j=e.useCallback((function(e){x&&x(i,e)}),[i,x]),I=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),m&&m(i,o)}),[t,m,u,M,i,l]),W=e.useCallback((function(o){var r=o.touches[0],a=document.elementFromPoint(r.clientX,r.clientY),s=null==a?void 0:a.getAttribute("data-ref");if(s){var d=n.find((function(e){return e.id===s}));d&&(M(e.createElement(l,{slice:d,axis:t}),o,"right"),u(d))}g&&g(i,o)}),[t,g,u,M,i,n,l]),E=e.useCallback((function(e){S(),u(null),y&&y(i,e)}),[S,u,y,i]);return d.jsx("rect",{x:i.x0,y:i.y0,width:i.width,height:i.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:s&&a?.35:0,onMouseEnter:k,onMouseMove:T,onMouseLeave:B,onMouseDown:w,onMouseUp:L,onClick:D,onDoubleClick:j,onTouchStart:I,onTouchMove:W,onTouchEnd:E,"data-ref":i.id})})),D=e.memo((function(e){var o=e.slices,i=e.axis,n=e.debug,r=e.tooltip,t=e.current,a=e.setCurrent,l=e.onMouseEnter,s=e.onMouseMove,u=e.onMouseLeave,c=e.onMouseDown,h=e.onMouseUp,p=e.onClick,v=e.onDoubleClick,f=e.onTouchStart,b=e.onTouchMove,x=e.onTouchEnd;return d.jsx(d.Fragment,{children:o.map((function(e){return d.jsx(L,{slice:e,slices:o,axis:i,debug:n,tooltip:r,setCurrent:a,isCurrent:null!==t&&t.id===e.id,onMouseEnter:l,onMouseMove:s,onMouseLeave:u,onMouseDown:c,onMouseUp:h,onClick:p,onDoubleClick:v,onTouchStart:f,onTouchMove:b,onTouchEnd:x},e.id)}))})})),j=e.memo((function(i){var n=i.points,t=i.symbol,a=i.size,l=i.borderWidth,s=i.enableLabel,u=i.label,c=i.labelYOffset,h=i.isFocusable,p=i.setCurrentPoint,v=i.tooltip,f=i.margin,b=i.ariaLabel,x=i.ariaLabelledBy,m=i.ariaDescribedBy,g=i.ariaHidden,y=i.ariaDisabled,C=o.getLabelGenerator(u),M=r.useTooltip(),S=M.showTooltipAt,k=M.hideTooltip,T=n.slice(0).sort((function(e,o){return e.indexInSeries-o.indexInSeries})).sort((function(e,o){return o.seriesIndex-e.seriesIndex})).map((function(o){return{id:o.id,x:o.x,y:o.y,datum:o.data,fill:o.color,stroke:o.borderColor,label:s?C(o):null,ariaLabel:b?b(o):void 0,ariaLabelledBy:x?x(o):void 0,ariaDescribedBy:m?m(o):void 0,ariaHidden:g?g(o):void 0,ariaDisabled:y?y(o):void 0,onFocus:h?function(){p(o),S(e.createElement(v,{point:o}),[f.left+o.x,f.top+o.y],"top")}:void 0,onBlur:h?function(){p(null),k()}:void 0}}));return d.jsx("g",{children:T.map((function(e){return d.jsx(o.DotsItem,{x:e.x,y:e.y,datum:e.datum,symbol:t,size:a,color:e.fill,borderWidth:l,borderColor:e.stroke,label:e.label,labelYOffset:c,ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,ariaHidden:e.ariaHidden,ariaDisabled:e.ariaDisabled,isFocusable:h,onFocus:e.onFocus,onBlur:e.onBlur,testId:"line.point."+e.id},e.id)}))})})),I=e.memo((function(o){var i=o.points,n=o.width,t=o.height,a=o.margin,l=o.setCurrent,s=o.onMouseEnter,u=o.onMouseMove,c=o.onMouseLeave,p=o.onMouseDown,v=o.onMouseUp,f=o.onClick,b=o.onDoubleClick,x=o.onTouchStart,m=o.onTouchMove,g=o.onTouchEnd,y=o.tooltip,C=o.debug,M=o.enableTouchCrosshair,S=r.useTooltip(),k=S.showTooltipAt,T=S.hideTooltip,B=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),s&&s(o,i)}),[k,y,s,a]),w=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),u&&u(o,i)}),[k,y,a.left,a.top,u]),L=e.useCallback((function(e,o){T(),c&&c(e,o)}),[T,c]),D=e.useCallback((function(e,o){p&&p(e,o)}),[p]),j=e.useCallback((function(e,o){v&&v(e,o)}),[v]),I=e.useCallback((function(e,o){f&&f(e,o)}),[f]),W=e.useCallback((function(e,o){b&&b(e,o)}),[b]),E=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),x&&x(o,i)}),[a.left,a.top,x,k,y]),F=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),m&&m(o,i)}),[a.left,a.top,m,k,y]),P=e.useCallback((function(e,o){T(),g&&g(e,o)}),[g,T]);return d.jsx(h.Mesh,{nodes:i,width:n,height:t,setCurrent:l,onMouseEnter:B,onMouseMove:w,onMouseLeave:L,onMouseDown:D,onMouseUp:j,onClick:I,onDoubleClick:W,onTouchStart:E,onTouchMove:F,onTouchEnd:P,enableTouchCrosshair:M,debug:C})})),W=["isInteractive","animate","motionConfig","theme","renderWrapper"];function E(t){var a=t.data,l=t.xScale,s=void 0===l?x.xScale:l,u=t.xFormat,c=t.yScale,h=void 0===c?x.yScale:c,v=t.yFormat,f=t.curve,b=void 0===f?x.curve:f,m=t.margin,g=t.width,y=t.height,C=t.colors,M=void 0===C?x.colors:C,k=t.lineWidth,B=void 0===k?x.lineWidth:k,L=t.layers,W=void 0===L?x.layers:L,E=t.enableArea,F=void 0===E?x.enableArea:E,P=t.areaBaselineValue,G=void 0===P?x.areaBaselineValue:P,O=t.areaOpacity,A=void 0===O?x.areaOpacity:O,V=t.areaBlendMode,H=void 0===V?x.areaBlendMode:V,R=t.enablePoints,Y=void 0===R?x.enablePoints:R,q=t.pointSymbol,U=t.pointSize,X=void 0===U?x.pointSize:U,z=t.pointColor,_=void 0===z?x.pointColor:z,N=t.pointBorderWidth,Q=void 0===N?x.pointBorderWidth:N,J=t.pointBorderColor,K=void 0===J?x.pointBorderColor:J,Z=t.enablePointLabel,$=void 0===Z?x.enablePointLabel:Z,ee=t.pointLabel,oe=void 0===ee?x.pointLabel:ee,ie=t.pointLabelYOffset,ne=t.enableGridX,re=void 0===ne?x.enableGridX:ne,te=t.gridXValues,ae=t.enableGridY,le=void 0===ae?x.enableGridY:ae,se=t.gridYValues,ue=t.axisTop,de=t.axisRight,ce=t.axisBottom,he=void 0===ce?x.axisBottom:ce,pe=t.axisLeft,ve=void 0===pe?x.axisLeft:pe,fe=t.defs,be=void 0===fe?x.defs:fe,xe=t.fill,me=void 0===xe?x.fill:xe,ge=t.markers,ye=t.legends,Ce=void 0===ye?x.legends:ye,Me=t.isInteractive,Se=void 0===Me?x.isInteractive:Me,ke=t.useMesh,Te=void 0===ke?x.useMesh:ke,Be=t.debugMesh,we=void 0===Be?x.debugMesh:Be,Le=t.onMouseEnter,De=t.onMouseMove,je=t.onMouseLeave,Ie=t.onMouseDown,We=t.onMouseUp,Ee=t.onClick,Fe=t.onDoubleClick,Pe=t.onTouchStart,Ge=t.onTouchMove,Oe=t.onTouchEnd,Ae=t.tooltip,Ve=void 0===Ae?x.tooltip:Ae,He=t.enableSlices,Re=void 0===He?x.enableSlices:He,Ye=t.debugSlices,qe=void 0===Ye?x.debugSlices:Ye,Ue=t.sliceTooltip,Xe=void 0===Ue?x.sliceTooltip:Ue,ze=t.enableCrosshair,_e=void 0===ze?x.enableCrosshair:ze,Ne=t.crosshairType,Qe=void 0===Ne?x.crosshairType:Ne,Je=t.enableTouchCrosshair,Ke=void 0===Je?x.enableTouchCrosshair:Je,Ze=t.role,$e=void 0===Ze?x.role:Ze,eo=t.ariaLabel,oo=t.ariaLabelledBy,io=t.ariaDescribedBy,no=t.isFocusable,ro=void 0===no?x.isFocusable:no,to=t.pointAriaLabel,ao=t.pointAriaLabelledBy,lo=t.pointAriaDescribedBy,so=t.pointAriaHidden,uo=t.pointAriaDisabled,co=t.initialHiddenIds,ho=void 0===co?x.initialHiddenIds:co,po=o.useDimensions(g,y,m),vo=po.margin,fo=po.innerWidth,bo=po.innerHeight,xo=po.outerWidth,mo=po.outerHeight,go=S({data:a,xScale:s,xFormat:u,yScale:h,yFormat:v,width:fo,height:bo,colors:M,curve:b,areaBaselineValue:G,pointColor:_,pointBorderColor:K,enableSlices:Re,initialHiddenIds:ho}),yo=go.legendData,Co=go.toggleSeries,Mo=go.lineGenerator,So=go.areaGenerator,ko=go.series,To=go.xScale,Bo=go.yScale,wo=go.slices,Lo=go.points,Do=e.useState(null),jo=Do[0],Io=Do[1],Wo=e.useState(null),Eo=Wo[0],Fo=Wo[1],Po={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};W.includes("grid")&&(re||le)&&(Po.grid=d.jsx(i.Grid,{width:fo,height:bo,xScale:re?To:null,yScale:le?Bo:null,xValues:te,yValues:se},"grid")),W.includes("markers")&&Array.isArray(ge)&&ge.length>0&&(Po.markers=d.jsx(o.CartesianMarkers,{markers:ge,width:fo,height:bo,xScale:To,yScale:Bo},"markers")),W.includes("axes")&&(Po.axes=d.jsx(i.Axes,{xScale:To,yScale:Bo,width:fo,height:bo,top:ue,right:de,bottom:he,left:ve},"axes")),W.includes("lines")&&(Po.lines=d.jsx(w,{series:ko,lineGenerator:Mo,lineWidth:B},"lines")),W.includes("legends")&&Ce.length>0&&(Po.legends=d.jsx(e.Fragment,{children:Ce.map((function(e,o){return d.jsx(n.BoxLegendSvg,p({},e,{containerWidth:fo,containerHeight:bo,data:e.data||yo,toggleSerie:e.toggleSerie?Co:void 0}),o)}))},"legends"));var Go=o.bindDefs(be,ko,me);F&&(Po.areas=d.jsx(T,{areaGenerator:So,areaOpacity:A,areaBlendMode:H,series:ko},"areas")),Se&&!1!==Re&&(Po.slices=d.jsx(D,{slices:wo,axis:Re,debug:qe,tooltip:Xe,current:Eo,setCurrent:Fo,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe},"slices")),Y&&(Po.points=d.jsx(j,{points:Lo,symbol:q,size:X,borderWidth:Q,enableLabel:$,label:oe,labelYOffset:ie,isFocusable:ro,setCurrentPoint:Io,tooltip:Ve,margin:vo,ariaLabel:to,ariaLabelledBy:ao,ariaDescribedBy:lo,ariaHidden:so,ariaDisabled:uo},"points")),Se&&_e&&(null!==jo&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:jo.x,y:jo.y,type:Qe},"crosshair")),null!==Eo&&Re&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:Eo.x,y:Eo.y,type:Re},"crosshair"))),Se&&Te&&!1===Re&&(Po.mesh=d.jsx(I,{points:Lo,width:fo,height:bo,margin:vo,setCurrent:Io,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe,tooltip:Ve,enableTouchCrosshair:Ke,debug:we},"mesh"));var Oo=p({},t,{innerWidth:fo,innerHeight:bo,series:ko,slices:wo,points:Lo,xScale:To,yScale:Bo,lineGenerator:Mo,areaGenerator:So,currentPoint:jo,setCurrentPoint:Io,currentSlice:Eo,setCurrentSlice:Fo});return d.jsx(o.SvgWrapper,{defs:Go,width:xo,height:mo,margin:vo,role:$e,ariaLabel:eo,ariaLabelledBy:oo,ariaDescribedBy:io,isFocusable:ro,children:W.map((function(o,i){return"function"==typeof o?d.jsx(e.Fragment,{children:o(Oo)},i):Po[o]}))})}function F(e){var i=e.isInteractive,n=void 0===i?x.isInteractive:i,r=e.animate,t=void 0===r?x.animate:r,a=e.motionConfig,l=void 0===a?x.motionConfig:a,s=e.theme,u=e.renderWrapper,c=v(e,W);return d.jsx(o.Container,{animate:t,isInteractive:n,motionConfig:l,renderWrapper:u,theme:s,children:d.jsx(E,p({isInteractive:n},c))})}var P=["isInteractive","renderWrapper","theme"],G=function(t){var a=t.width,s=t.height,u=t.margin,c=t.pixelRatio,v=void 0===c?m.pixelRatio:c,f=t.data,b=t.xScale,x=void 0===b?m.xScale:b,g=t.xFormat,y=t.yScale,C=void 0===y?m.yScale:y,M=t.yFormat,k=t.curve,T=void 0===k?m.curve:k,B=t.layers,w=void 0===B?m.layers:B,L=t.colors,D=void 0===L?m.colors:L,j=t.lineWidth,I=void 0===j?m.lineWidth:j,W=t.enableArea,E=void 0===W?m.enableArea:W,F=t.areaBaselineValue,P=void 0===F?m.areaBaselineValue:F,G=t.areaOpacity,O=void 0===G?m.areaOpacity:G,A=t.enablePoints,V=void 0===A?m.enablePoints:A,H=t.pointSize,R=void 0===H?m.pointSize:H,Y=t.pointColor,q=void 0===Y?m.pointColor:Y,U=t.pointBorderWidth,X=void 0===U?m.pointBorderWidth:U,z=t.pointBorderColor,_=void 0===z?m.pointBorderColor:z,N=t.enableGridX,Q=void 0===N?m.enableGridX:N,J=t.gridXValues,K=t.enableGridY,Z=void 0===K?m.enableGridY:K,$=t.gridYValues,ee=t.axisTop,oe=t.axisRight,ie=t.axisBottom,ne=void 0===ie?m.axisBottom:ie,re=t.axisLeft,te=void 0===re?m.axisLeft:re,ae=t.legends,le=void 0===ae?m.legends:ae,se=t.isInteractive,ue=void 0===se?m.isInteractive:se,de=t.debugMesh,ce=void 0===de?m.debugMesh:de,he=t.onMouseLeave,pe=t.onMouseDown,ve=t.onMouseUp,fe=t.onClick,be=t.onDoubleClick,xe=t.tooltip,me=void 0===xe?m.tooltip:xe,ge=t.forwardedRef,ye=e.useRef(null),Ce=o.useDimensions(a,s,u),Me=Ce.margin,Se=Ce.innerWidth,ke=Ce.innerHeight,Te=Ce.outerWidth,Be=Ce.outerHeight,we=l.useTheme(),Le=e.useState(null),De=Le[0],je=Le[1],Ie=S({data:f,xScale:x,xFormat:g,yScale:C,yFormat:M,width:Se,height:ke,colors:D,curve:T,areaBaselineValue:P,pointColor:q,pointBorderColor:_}),We=Ie.lineGenerator,Ee=Ie.areaGenerator,Fe=Ie.series,Pe=Ie.xScale,Ge=Ie.yScale,Oe=Ie.points,Ae=e.useMemo((function(){return{innerWidth:Se,innerHeight:ke,series:Fe,points:Oe,xScale:Pe,yScale:Ge,lineWidth:I,lineGenerator:We,areaGenerator:Ee,currentPoint:De,setCurrentPoint:je}}),[Se,ke,Fe,Oe,Pe,Ge,I,We,Ee,De]),Ve=h.useVoronoiMesh({points:Oe,width:Se,height:ke,debug:ce}),He=Ve.delaunay,Re=Ve.voronoi;e.useEffect((function(){if(null!==ye.current){ye.current.width=Te*v,ye.current.height=Be*v;var e=ye.current.getContext("2d");e.scale(v,v),e.fillStyle=we.background,e.fillRect(0,0,Te,Be),e.translate(Me.left,Me.top),w.forEach((function(o){if("function"==typeof o&&o(e,Ae),"grid"===o&&(we.grid.line.strokeWidth||0)>0&&(e.lineWidth=we.grid.line.strokeWidth,e.strokeStyle=we.grid.line.stroke,Q&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Pe,axis:"x",values:J}),Z&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Ge,axis:"y",values:$})),"axes"===o&&i.renderAxesToCanvas(e,{xScale:Pe,yScale:Ge,width:Se,height:ke,top:ee,right:oe,bottom:ne,left:te,theme:we}),"areas"===o&&!0===E){e.save(),e.globalAlpha=O,Ee.context(e);for(var r=Fe.length-1;r>=0;r--)e.fillStyle=Fe[r].color,e.beginPath(),Ee(Fe[r].data.map((function(e){return e.position}))),e.fill();e.restore()}if("lines"===o&&(We.context(e),Fe.forEach((function(o){e.strokeStyle=o.color,e.lineWidth=I,e.beginPath(),We(o.data.map((function(e){return e.position}))),e.stroke()}))),"points"===o&&!0===V&&R>0&&Oe.forEach((function(o){e.fillStyle=o.color,e.beginPath(),e.arc(o.x,o.y,R/2,0,2*Math.PI),e.fill(),X>0&&(e.strokeStyle=o.borderColor,e.lineWidth=X,e.stroke())})),"mesh"===o&&!0===ce&&void 0!==Re&&(h.renderVoronoiToCanvas(e,Re),De&&h.renderVoronoiCellToCanvas(e,Re,De.absIndex)),"legends"===o){var t=Fe.map((function(e){return{id:e.id,label:e.id,color:e.color}})).reverse();le.forEach((function(o){n.renderLegendToCanvas(e,p({},o,{data:o.data||t,containerWidth:Se,containerHeight:ke,theme:we}))}))}}))}}),[ye,Te,Be,w,we,We,Fe,Pe,Ge,Q,J,Z,$,ee,oe,ne,te,le,Oe,V,R,De]);var Ye=e.useCallback((function(e){if(!ye.current)return null;var i=o.getRelativeCursor(ye.current,e),n=i[0],r=i[1];if(!o.isCursorInRect(Me.left,Me.top,Se,ke,n,r))return null;var t=He.find(n-Me.left,r-Me.top);return Oe[t]}),[ye,Me,Se,ke,He]),qe=r.useTooltip(),Ue=qe.showTooltipFromEvent,Xe=qe.hideTooltip,ze=e.useCallback((function(o){var i=Ye(o);je(i),i?Ue(e.createElement(me,{point:i}),o):Xe()}),[Ye,je,Ue,Xe,me]),_e=e.useCallback((function(e){Xe(),je(null),De&&he&&he(De,e)}),[Xe,je,he]),Ne=e.useCallback((function(e){if(pe){var o=Ye(e);o&&pe(o,e)}}),[Ye,pe]),Qe=e.useCallback((function(e){if(ve){var o=Ye(e);o&&ve(o,e)}}),[Ye,ve]),Je=e.useCallback((function(e){if(fe){var o=Ye(e);o&&fe(o,e)}}),[Ye,fe]),Ke=e.useCallback((function(e){if(be){var o=Ye(e);o&&be(o,e)}}),[Ye,be]);return d.jsx("canvas",{ref:o.mergeRefs(ye,ge),width:Te*v,height:Be*v,style:{width:Te,height:Be,cursor:ue?"auto":"normal"},onMouseEnter:ue?ze:void 0,onMouseMove:ue?ze:void 0,onMouseLeave:ue?_e:void 0,onMouseDown:ue?Ne:void 0,onMouseUp:ue?Qe:void 0,onClick:ue?Je:void 0,onDoubleClick:ue?Ke:void 0})},O=e.forwardRef((function(e,i){var n=e.isInteractive,r=e.renderWrapper,t=e.theme,a=v(e,P);return d.jsx(o.Container,{isInteractive:n,renderWrapper:r,theme:t,animate:!1,children:d.jsx(G,p({},a,{forwardedRef:i}))})}));var A=e.forwardRef((function(e,i){return d.jsx(o.ResponsiveWrapper,{children:function(o){var n=o.width,r=o.height;return d.jsx(O,p({width:n,height:r},e,{ref:i}))}})}));exports.LINE_UNIQUE_ID_PREFIX=M,exports.Line=F,exports.LineCanvas=O,exports.ResponsiveLine=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var i=o.width,n=o.height;return d.jsx(F,p({width:i,height:n},e))}})},exports.ResponsiveLineCanvas=A,exports.canvasDefaultProps=m,exports.commonDefaultProps=b,exports.isPoint=function(e){return void 0!==e.seriesId},exports.isSliceData=function(e){return void 0!==e.points},exports.svgDefaultProps=x,exports.useAreaGenerator=y,exports.useLine=S,exports.useLineGenerator=g,exports.useSlices=C; | ||
| //# sourceMappingURL=nivo-line.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
| "use strict";var e=require("react"),o=require("@nivo/core"),i=require("@nivo/axes"),n=require("@nivo/legends"),r=require("@nivo/tooltip"),t=require("d3-shape"),a=require("lodash/uniqueId.js"),l=require("@nivo/theming"),s=require("@nivo/colors"),u=require("@nivo/scales"),d=require("react/jsx-runtime"),c=require("@react-spring/web"),h=require("@nivo/voronoi");function p(){return p=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},p.apply(null,arguments)}function v(e,o){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==o.indexOf(n))continue;i[n]=e[n]}return i}var f,b={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:e.memo((function(e){var o=e.point;return d.jsx(r.BasicTooltip,{id:d.jsxs("span",{children:["x: ",d.jsx("strong",{children:o.data.xFormatted}),", y:"," ",d.jsx("strong",{children:o.data.yFormatted})]}),enableChip:!0,color:o.seriesColor})})),sliceTooltip:e.memo((function(e){var o=e.slice,i=e.axis,n=l.useTheme(),t="x"===i?"y":"x";return d.jsx(r.TableTooltip,{rows:o.points.map((function(e){return[d.jsx(r.Chip,{color:e.seriesColor,style:n.tooltip.chip},"chip"),e.seriesId,d.jsx("span",{style:n.tooltip.tableCellValue,children:e.data[t+"Formatted"]},"value")]}))})})),debugMesh:!1,renderWrapper:!0},x=p({},b,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisBottom:{},axisLeft:{},useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),m=p({},b,{pixelRatio:"undefined"!=typeof window&&null!=(f=window.devicePixelRatio)?f:1,axisBottom:{},axisLeft:{}});function g(i){return e.useMemo((function(){return t.line().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y((function(e){return e.y})).curve(o.curveFromProp(i))}),[i])}function y(i){var n=i.curve,r=i.yScale,a=i.areaBaselineValue;return e.useMemo((function(){return t.area().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y1((function(e){return e.y})).curve(o.curveFromProp(n)).y0(r(a))}),[n,r,a])}var C=function(o){var i=o.componentId,n=o.enableSlices,r=o.points,t=o.width,a=o.height;return e.useMemo((function(){if("x"===n){var e=new Map;return r.forEach((function(o){null!==o.data.x&&null!==o.data.y&&(e.has(o.x)?e.get(o.x).push(o):e.set(o.x,[o]))})),Array.from(e.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,n){var r,l,s=e[0],u=e[1],d=n[o-1],c=n[o+1];return r=d?s-(s-d[0])/2:s,l=c?s-r+(c[0]-s)/2:t-r,{id:"slice:"+i+":"+s,x0:r,x:s,y0:0,y:0,width:l,height:a,points:u.reverse()}}))}if("y"===n){var o=new Map;return r.forEach((function(e){null!==e.data.x&&null!==e.data.y&&(o.has(e.y)?o.get(e.y).push(e):o.set(e.y,[e]))})),Array.from(o.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,i){var n,r,l=e[0],s=e[1],u=i[o-1],d=i[o+1];return n=u?l-(l-u[0])/2:l,r=d?l-n+(d[0]-l)/2:a-n,{id:l,x0:0,x:0,y0:n,y:l,width:t,height:r,points:s.reverse()}}))}return[]}),[i,n,a,r,t])},M="line",S=function(i){var n=i.data,r=i.xScale,t=void 0===r?b.xScale:r,d=i.xFormat,c=i.yScale,h=void 0===c?b.yScale:c,v=i.yFormat,f=i.width,m=i.height,S=i.colors,k=void 0===S?b.colors:S,T=i.curve,B=void 0===T?b.curve:T,w=i.areaBaselineValue,L=void 0===w?b.areaBaselineValue:w,D=i.pointColor,j=void 0===D?b.pointColor:D,I=i.pointBorderColor,W=void 0===I?b.pointBorderColor:I,E=i.enableSlices,F=void 0===E?x.enableSlices:E,P=i.initialHiddenIds,G=void 0===P?x.initialHiddenIds:P,O=e.useState(a(M))[0],A=o.useValueFormatter(d),V=o.useValueFormatter(v),H=s.useOrdinalColorScale(k,"id"),R=l.useTheme(),Y=s.useInheritedColor(j,R),q=s.useInheritedColor(W,R),U=e.useState(null!=G?G:[]),X=U[0],z=U[1],_=e.useMemo((function(){return u.computeXYScalesForSeries(n.filter((function(e){return-1===X.indexOf(e.id)})),t,h,f,m)}),[n,X,t,h,f,m]),N=_.xScale,Q=_.yScale,J=_.series,K=e.useMemo((function(){var e=n.map((function(e){return{id:e.id,label:""+e.id,color:H(e)}})),o=e.map((function(e){return p({},J.find((function(o){return o.id===e.id})),{color:e.color})})).filter((function(e){return Boolean(e.id)}));return{legendData:e.map((function(e){return p({},e,{hidden:!o.find((function(o){return o.id===e.id}))})})).reverse(),series:o}}),[n,J,H]),Z=K.legendData,$=K.series,ee=e.useCallback((function(e){z((function(o){return o.indexOf(e)>-1?o.filter((function(o){return o!==e})):[].concat(o,[e])}))}),[]),oe=function(o){var i=o.series,n=o.getPointColor,r=o.getPointBorderColor,t=o.formatX,a=o.formatY;return e.useMemo((function(){return i.reduce((function(e,o,i){return[].concat(e,o.data.filter((function(e){return null!==e.position.x&&null!==e.position.y})).map((function(l,s){var u={id:o.id+"."+s,indexInSeries:s,absIndex:e.length+s,seriesIndex:i,seriesId:o.id,seriesColor:o.color,x:l.position.x,y:l.position.y,data:p({},l.data,{xFormatted:t(l.data.x),yFormatted:a(l.data.y)})};return u.color=n({series:o,point:u}),u.borderColor=r(u),u})))}),[])}),[i,n,r,t,a])}({series:$,getPointColor:Y,getPointBorderColor:q,formatX:A,formatY:V}),ie=C({componentId:O,enableSlices:F,points:oe,width:f,height:m});return{legendData:Z,toggleSeries:ee,lineGenerator:g(B),areaGenerator:y({curve:B,yScale:Q,areaBaselineValue:L}),getColor:H,series:$,xScale:N,yScale:Q,slices:ie,points:oe}},k=function(e){var i=e.areaBlendMode,n=e.areaOpacity,r=e.color,t=e.fill,a=e.path,l=o.useMotionConfig(),s=l.animate,u=l.config,h=o.useAnimatedPath(a),p=c.useSpring({color:r,config:u,immediate:!s});return d.jsx(c.animated.path,{d:h,fill:t||p.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:i}})},T=e.memo((function(e){var o=e.areaGenerator,i=e.areaOpacity,n=e.areaBlendMode,r=e.series.slice(0).reverse();return d.jsx("g",{children:r.map((function(e){return d.jsx(k,p({path:o(e.data.map((function(e){return e.position})))},p({areaOpacity:i,areaBlendMode:n},e)),""+e.id)}))})})),B=e.memo((function(i){var n=i.lineGenerator,r=i.points,t=i.color,a=i.thickness,l=e.useMemo((function(){return n(r)}),[n,r]),s=o.useAnimatedPath(l);return d.jsx(c.animated.path,{d:s,fill:"none",strokeWidth:a,stroke:t})})),w=e.memo((function(e){var o=e.series,i=e.lineGenerator,n=e.lineWidth;return d.jsx(d.Fragment,{children:o.slice(0).reverse().map((function(e){var o=e.id,r=e.data,t=e.color;return d.jsx(B,{points:r.map((function(e){return e.position})),lineGenerator:i,color:t,thickness:n},o)}))})})),L=e.memo((function(o){var i=o.slice,n=o.slices,t=o.axis,a=o.debug,l=o.tooltip,s=o.isCurrent,u=o.setCurrent,c=o.onMouseEnter,h=o.onMouseMove,p=o.onMouseLeave,v=o.onMouseDown,f=o.onMouseUp,b=o.onClick,x=o.onDoubleClick,m=o.onTouchStart,g=o.onTouchMove,y=o.onTouchEnd,C=r.useTooltip(),M=C.showTooltipFromEvent,S=C.hideTooltip,k=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),c&&c(i,o)}),[M,l,i,t,u,c]),T=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),h&&h(i,o)}),[M,l,i,t,h]),B=e.useCallback((function(e){S(),u(null),p&&p(i,e)}),[S,u,p,i]),w=e.useCallback((function(e){v&&v(i,e)}),[i,v]),L=e.useCallback((function(e){f&&f(i,e)}),[i,f]),D=e.useCallback((function(e){b&&b(i,e)}),[i,b]),j=e.useCallback((function(e){x&&x(i,e)}),[i,x]),I=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),m&&m(i,o)}),[t,m,u,M,i,l]),W=e.useCallback((function(o){var r=o.touches[0],a=document.elementFromPoint(r.clientX,r.clientY),s=null==a?void 0:a.getAttribute("data-ref");if(s){var d=n.find((function(e){return e.id===s}));d&&(M(e.createElement(l,{slice:d,axis:t}),o,"right"),u(d))}g&&g(i,o)}),[t,g,u,M,i,n,l]),E=e.useCallback((function(e){S(),u(null),y&&y(i,e)}),[S,u,y,i]);return d.jsx("rect",{x:i.x0,y:i.y0,width:i.width,height:i.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:s&&a?.35:0,onMouseEnter:k,onMouseMove:T,onMouseLeave:B,onMouseDown:w,onMouseUp:L,onClick:D,onDoubleClick:j,onTouchStart:I,onTouchMove:W,onTouchEnd:E,"data-ref":i.id})})),D=e.memo((function(e){var o=e.slices,i=e.axis,n=e.debug,r=e.tooltip,t=e.current,a=e.setCurrent,l=e.onMouseEnter,s=e.onMouseMove,u=e.onMouseLeave,c=e.onMouseDown,h=e.onMouseUp,p=e.onClick,v=e.onDoubleClick,f=e.onTouchStart,b=e.onTouchMove,x=e.onTouchEnd;return d.jsx(d.Fragment,{children:o.map((function(e){return d.jsx(L,{slice:e,slices:o,axis:i,debug:n,tooltip:r,setCurrent:a,isCurrent:null!==t&&t.id===e.id,onMouseEnter:l,onMouseMove:s,onMouseLeave:u,onMouseDown:c,onMouseUp:h,onClick:p,onDoubleClick:v,onTouchStart:f,onTouchMove:b,onTouchEnd:x},e.id)}))})})),j=e.memo((function(i){var n=i.points,t=i.symbol,a=i.size,l=i.borderWidth,s=i.enableLabel,u=i.label,c=i.labelYOffset,h=i.isFocusable,p=i.setCurrentPoint,v=i.tooltip,f=i.margin,b=i.ariaLabel,x=i.ariaLabelledBy,m=i.ariaDescribedBy,g=i.ariaHidden,y=i.ariaDisabled,C=o.getLabelGenerator(u),M=r.useTooltip(),S=M.showTooltipAt,k=M.hideTooltip,T=n.slice(0).sort((function(e,o){return e.indexInSeries-o.indexInSeries})).sort((function(e,o){return o.seriesIndex-e.seriesIndex})).map((function(o){return{id:o.id,x:o.x,y:o.y,datum:o.data,fill:o.color,stroke:o.borderColor,label:s?C(o):null,ariaLabel:b?b(o):void 0,ariaLabelledBy:x?x(o):void 0,ariaDescribedBy:m?m(o):void 0,ariaHidden:g?g(o):void 0,ariaDisabled:y?y(o):void 0,onFocus:h?function(){p(o),S(e.createElement(v,{point:o}),[f.left+o.x,f.top+o.y],"top")}:void 0,onBlur:h?function(){p(null),k()}:void 0}}));return d.jsx("g",{children:T.map((function(e){return d.jsx(o.DotsItem,{x:e.x,y:e.y,datum:e.datum,symbol:t,size:a,color:e.fill,borderWidth:l,borderColor:e.stroke,label:e.label,labelYOffset:c,ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,ariaHidden:e.ariaHidden,ariaDisabled:e.ariaDisabled,isFocusable:h,onFocus:e.onFocus,onBlur:e.onBlur,testId:"line.point."+e.id},e.id)}))})})),I=e.memo((function(o){var i=o.points,n=o.width,t=o.height,a=o.margin,l=o.setCurrent,s=o.onMouseEnter,u=o.onMouseMove,c=o.onMouseLeave,p=o.onMouseDown,v=o.onMouseUp,f=o.onClick,b=o.onDoubleClick,x=o.onTouchStart,m=o.onTouchMove,g=o.onTouchEnd,y=o.tooltip,C=o.debug,M=o.enableTouchCrosshair,S=r.useTooltip(),k=S.showTooltipAt,T=S.hideTooltip,B=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),s&&s(o,i)}),[k,y,s,a]),w=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),u&&u(o,i)}),[k,y,a.left,a.top,u]),L=e.useCallback((function(e,o){T(),c&&c(e,o)}),[T,c]),D=e.useCallback((function(e,o){p&&p(e,o)}),[p]),j=e.useCallback((function(e,o){v&&v(e,o)}),[v]),I=e.useCallback((function(e,o){f&&f(e,o)}),[f]),W=e.useCallback((function(e,o){b&&b(e,o)}),[b]),E=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),x&&x(o,i)}),[a.left,a.top,x,k,y]),F=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),m&&m(o,i)}),[a.left,a.top,m,k,y]),P=e.useCallback((function(e,o){T(),g&&g(e,o)}),[g,T]);return d.jsx(h.Mesh,{nodes:i,width:n,height:t,setCurrent:l,onMouseEnter:B,onMouseMove:w,onMouseLeave:L,onMouseDown:D,onMouseUp:j,onClick:I,onDoubleClick:W,onTouchStart:E,onTouchMove:F,onTouchEnd:P,enableTouchCrosshair:M,debug:C})})),W=["isInteractive","animate","motionConfig","theme","renderWrapper"];function E(t){var a=t.data,l=t.xScale,s=void 0===l?x.xScale:l,u=t.xFormat,c=t.yScale,h=void 0===c?x.yScale:c,v=t.yFormat,f=t.curve,b=void 0===f?x.curve:f,m=t.margin,g=t.width,y=t.height,C=t.colors,M=void 0===C?x.colors:C,k=t.lineWidth,B=void 0===k?x.lineWidth:k,L=t.layers,W=void 0===L?x.layers:L,E=t.enableArea,F=void 0===E?x.enableArea:E,P=t.areaBaselineValue,G=void 0===P?x.areaBaselineValue:P,O=t.areaOpacity,A=void 0===O?x.areaOpacity:O,V=t.areaBlendMode,H=void 0===V?x.areaBlendMode:V,R=t.enablePoints,Y=void 0===R?x.enablePoints:R,q=t.pointSymbol,U=t.pointSize,X=void 0===U?x.pointSize:U,z=t.pointColor,_=void 0===z?x.pointColor:z,N=t.pointBorderWidth,Q=void 0===N?x.pointBorderWidth:N,J=t.pointBorderColor,K=void 0===J?x.pointBorderColor:J,Z=t.enablePointLabel,$=void 0===Z?x.enablePointLabel:Z,ee=t.pointLabel,oe=void 0===ee?x.pointLabel:ee,ie=t.pointLabelYOffset,ne=t.enableGridX,re=void 0===ne?x.enableGridX:ne,te=t.gridXValues,ae=t.enableGridY,le=void 0===ae?x.enableGridY:ae,se=t.gridYValues,ue=t.axisTop,de=t.axisRight,ce=t.axisBottom,he=void 0===ce?x.axisBottom:ce,pe=t.axisLeft,ve=void 0===pe?x.axisLeft:pe,fe=t.defs,be=void 0===fe?x.defs:fe,xe=t.fill,me=void 0===xe?x.fill:xe,ge=t.markers,ye=t.legends,Ce=void 0===ye?x.legends:ye,Me=t.isInteractive,Se=void 0===Me?x.isInteractive:Me,ke=t.useMesh,Te=void 0===ke?x.useMesh:ke,Be=t.debugMesh,we=void 0===Be?x.debugMesh:Be,Le=t.onMouseEnter,De=t.onMouseMove,je=t.onMouseLeave,Ie=t.onMouseDown,We=t.onMouseUp,Ee=t.onClick,Fe=t.onDoubleClick,Pe=t.onTouchStart,Ge=t.onTouchMove,Oe=t.onTouchEnd,Ae=t.tooltip,Ve=void 0===Ae?x.tooltip:Ae,He=t.enableSlices,Re=void 0===He?x.enableSlices:He,Ye=t.debugSlices,qe=void 0===Ye?x.debugSlices:Ye,Ue=t.sliceTooltip,Xe=void 0===Ue?x.sliceTooltip:Ue,ze=t.enableCrosshair,_e=void 0===ze?x.enableCrosshair:ze,Ne=t.crosshairType,Qe=void 0===Ne?x.crosshairType:Ne,Je=t.enableTouchCrosshair,Ke=void 0===Je?x.enableTouchCrosshair:Je,Ze=t.role,$e=void 0===Ze?x.role:Ze,eo=t.ariaLabel,oo=t.ariaLabelledBy,io=t.ariaDescribedBy,no=t.isFocusable,ro=void 0===no?x.isFocusable:no,to=t.pointAriaLabel,ao=t.pointAriaLabelledBy,lo=t.pointAriaDescribedBy,so=t.pointAriaHidden,uo=t.pointAriaDisabled,co=t.initialHiddenIds,ho=void 0===co?x.initialHiddenIds:co,po=o.useDimensions(g,y,m),vo=po.margin,fo=po.innerWidth,bo=po.innerHeight,xo=po.outerWidth,mo=po.outerHeight,go=S({data:a,xScale:s,xFormat:u,yScale:h,yFormat:v,width:fo,height:bo,colors:M,curve:b,areaBaselineValue:G,pointColor:_,pointBorderColor:K,enableSlices:Re,initialHiddenIds:ho}),yo=go.legendData,Co=go.toggleSeries,Mo=go.lineGenerator,So=go.areaGenerator,ko=go.series,To=go.xScale,Bo=go.yScale,wo=go.slices,Lo=go.points,Do=e.useState(null),jo=Do[0],Io=Do[1],Wo=e.useState(null),Eo=Wo[0],Fo=Wo[1],Po={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};W.includes("grid")&&(re||le)&&(Po.grid=d.jsx(i.Grid,{width:fo,height:bo,xScale:re?To:null,yScale:le?Bo:null,xValues:te,yValues:se},"grid")),W.includes("markers")&&Array.isArray(ge)&&ge.length>0&&(Po.markers=d.jsx(o.CartesianMarkers,{markers:ge,width:fo,height:bo,xScale:To,yScale:Bo},"markers")),W.includes("axes")&&(Po.axes=d.jsx(i.Axes,{xScale:To,yScale:Bo,width:fo,height:bo,top:ue,right:de,bottom:he,left:ve},"axes")),W.includes("lines")&&(Po.lines=d.jsx(w,{series:ko,lineGenerator:Mo,lineWidth:B},"lines")),W.includes("legends")&&Ce.length>0&&(Po.legends=d.jsx(e.Fragment,{children:Ce.map((function(e,o){return d.jsx(n.BoxLegendSvg,p({},e,{containerWidth:fo,containerHeight:bo,data:e.data||yo,toggleSerie:e.toggleSerie?Co:void 0}),o)}))},"legends"));var Go=o.bindDefs(be,ko,me);F&&(Po.areas=d.jsx(T,{areaGenerator:So,areaOpacity:A,areaBlendMode:H,series:ko},"areas")),Se&&!1!==Re&&(Po.slices=d.jsx(D,{slices:wo,axis:Re,debug:qe,tooltip:Xe,current:Eo,setCurrent:Fo,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe},"slices")),Y&&(Po.points=d.jsx(j,{points:Lo,symbol:q,size:X,borderWidth:Q,enableLabel:$,label:oe,labelYOffset:ie,isFocusable:ro,setCurrentPoint:Io,tooltip:Ve,margin:vo,ariaLabel:to,ariaLabelledBy:ao,ariaDescribedBy:lo,ariaHidden:so,ariaDisabled:uo},"points")),Se&&_e&&(null!==jo&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:jo.x,y:jo.y,type:Qe},"crosshair")),null!==Eo&&Re&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:Eo.x,y:Eo.y,type:Re},"crosshair"))),Se&&Te&&!1===Re&&(Po.mesh=d.jsx(I,{points:Lo,width:fo,height:bo,margin:vo,setCurrent:Io,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe,tooltip:Ve,enableTouchCrosshair:Ke,debug:we},"mesh"));var Oo=e.useMemo((function(){return{innerWidth:fo,innerHeight:bo,series:ko,slices:wo,points:Lo,xScale:To,yScale:Bo,lineGenerator:Mo,areaGenerator:So,currentPoint:jo,setCurrentPoint:Io,currentSlice:Eo,setCurrentSlice:Fo}}),[fo,bo,ko,wo,Lo,To,Bo,Mo,So,jo,Io,Eo,Fo]);return d.jsx(o.SvgWrapper,{defs:Go,width:xo,height:mo,margin:vo,role:$e,ariaLabel:eo,ariaLabelledBy:oo,ariaDescribedBy:io,isFocusable:ro,children:W.map((function(o,i){return"function"==typeof o?d.jsx(e.Fragment,{children:o(Oo)},i):Po[o]}))})}function F(e){var i=e.isInteractive,n=void 0===i?x.isInteractive:i,r=e.animate,t=void 0===r?x.animate:r,a=e.motionConfig,l=void 0===a?x.motionConfig:a,s=e.theme,u=e.renderWrapper,c=v(e,W);return d.jsx(o.Container,{animate:t,isInteractive:n,motionConfig:l,renderWrapper:u,theme:s,children:d.jsx(E,p({isInteractive:n},c))})}var P=["isInteractive","renderWrapper","theme"],G=function(t){var a=t.width,s=t.height,u=t.margin,c=t.pixelRatio,v=void 0===c?m.pixelRatio:c,f=t.data,b=t.xScale,x=void 0===b?m.xScale:b,g=t.xFormat,y=t.yScale,C=void 0===y?m.yScale:y,M=t.yFormat,k=t.curve,T=void 0===k?m.curve:k,B=t.layers,w=void 0===B?m.layers:B,L=t.colors,D=void 0===L?m.colors:L,j=t.lineWidth,I=void 0===j?m.lineWidth:j,W=t.enableArea,E=void 0===W?m.enableArea:W,F=t.areaBaselineValue,P=void 0===F?m.areaBaselineValue:F,G=t.areaOpacity,O=void 0===G?m.areaOpacity:G,A=t.enablePoints,V=void 0===A?m.enablePoints:A,H=t.pointSize,R=void 0===H?m.pointSize:H,Y=t.pointColor,q=void 0===Y?m.pointColor:Y,U=t.pointBorderWidth,X=void 0===U?m.pointBorderWidth:U,z=t.pointBorderColor,_=void 0===z?m.pointBorderColor:z,N=t.enableGridX,Q=void 0===N?m.enableGridX:N,J=t.gridXValues,K=t.enableGridY,Z=void 0===K?m.enableGridY:K,$=t.gridYValues,ee=t.axisTop,oe=t.axisRight,ie=t.axisBottom,ne=void 0===ie?m.axisBottom:ie,re=t.axisLeft,te=void 0===re?m.axisLeft:re,ae=t.legends,le=void 0===ae?m.legends:ae,se=t.isInteractive,ue=void 0===se?m.isInteractive:se,de=t.debugMesh,ce=void 0===de?m.debugMesh:de,he=t.onMouseLeave,pe=t.onMouseDown,ve=t.onMouseUp,fe=t.onClick,be=t.onDoubleClick,xe=t.tooltip,me=void 0===xe?m.tooltip:xe,ge=t.forwardedRef,ye=e.useRef(null),Ce=o.useDimensions(a,s,u),Me=Ce.margin,Se=Ce.innerWidth,ke=Ce.innerHeight,Te=Ce.outerWidth,Be=Ce.outerHeight,we=l.useTheme(),Le=e.useState(null),De=Le[0],je=Le[1],Ie=S({data:f,xScale:x,xFormat:g,yScale:C,yFormat:M,width:Se,height:ke,colors:D,curve:T,areaBaselineValue:P,pointColor:q,pointBorderColor:_}),We=Ie.lineGenerator,Ee=Ie.areaGenerator,Fe=Ie.series,Pe=Ie.xScale,Ge=Ie.yScale,Oe=Ie.points,Ae=e.useMemo((function(){return{innerWidth:Se,innerHeight:ke,series:Fe,points:Oe,xScale:Pe,yScale:Ge,lineWidth:I,lineGenerator:We,areaGenerator:Ee,currentPoint:De,setCurrentPoint:je}}),[Se,ke,Fe,Oe,Pe,Ge,I,We,Ee,De]),Ve=h.useVoronoiMesh({points:Oe,width:Se,height:ke,debug:ce}),He=Ve.delaunay,Re=Ve.voronoi;e.useEffect((function(){if(null!==ye.current){ye.current.width=Te*v,ye.current.height=Be*v;var e=ye.current.getContext("2d");e.scale(v,v),e.fillStyle=we.background,e.fillRect(0,0,Te,Be),e.translate(Me.left,Me.top),w.forEach((function(o){if("function"==typeof o&&o(e,Ae),"grid"===o&&(we.grid.line.strokeWidth||0)>0&&(e.lineWidth=we.grid.line.strokeWidth,e.strokeStyle=we.grid.line.stroke,Q&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Pe,axis:"x",values:J}),Z&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Ge,axis:"y",values:$})),"axes"===o&&i.renderAxesToCanvas(e,{xScale:Pe,yScale:Ge,width:Se,height:ke,top:ee,right:oe,bottom:ne,left:te,theme:we}),"areas"===o&&!0===E){e.save(),e.globalAlpha=O,Ee.context(e);for(var r=Fe.length-1;r>=0;r--)e.fillStyle=Fe[r].color,e.beginPath(),Ee(Fe[r].data.map((function(e){return e.position}))),e.fill();e.restore()}if("lines"===o&&(We.context(e),Fe.forEach((function(o){e.strokeStyle=o.color,e.lineWidth=I,e.beginPath(),We(o.data.map((function(e){return e.position}))),e.stroke()}))),"points"===o&&!0===V&&R>0&&Oe.forEach((function(o){e.fillStyle=o.color,e.beginPath(),e.arc(o.x,o.y,R/2,0,2*Math.PI),e.fill(),X>0&&(e.strokeStyle=o.borderColor,e.lineWidth=X,e.stroke())})),"mesh"===o&&!0===ce&&void 0!==Re&&(h.renderVoronoiToCanvas(e,Re),De&&h.renderVoronoiCellToCanvas(e,Re,De.absIndex)),"legends"===o){var t=Fe.map((function(e){return{id:e.id,label:e.id,color:e.color}})).reverse();le.forEach((function(o){n.renderLegendToCanvas(e,p({},o,{data:o.data||t,containerWidth:Se,containerHeight:ke,theme:we}))}))}}))}}),[ye,Te,Be,w,we,We,Fe,Pe,Ge,Q,J,Z,$,ee,oe,ne,te,le,Oe,V,R,De]);var Ye=e.useCallback((function(e){if(!ye.current)return null;var i=o.getRelativeCursor(ye.current,e),n=i[0],r=i[1];if(!o.isCursorInRect(Me.left,Me.top,Se,ke,n,r))return null;var t=He.find(n-Me.left,r-Me.top);return Oe[t]}),[ye,Me,Se,ke,He]),qe=r.useTooltip(),Ue=qe.showTooltipFromEvent,Xe=qe.hideTooltip,ze=e.useCallback((function(o){var i=Ye(o);je(i),i?Ue(e.createElement(me,{point:i}),o):Xe()}),[Ye,je,Ue,Xe,me]),_e=e.useCallback((function(e){Xe(),je(null),De&&he&&he(De,e)}),[Xe,je,he]),Ne=e.useCallback((function(e){if(pe){var o=Ye(e);o&&pe(o,e)}}),[Ye,pe]),Qe=e.useCallback((function(e){if(ve){var o=Ye(e);o&&ve(o,e)}}),[Ye,ve]),Je=e.useCallback((function(e){if(fe){var o=Ye(e);o&&fe(o,e)}}),[Ye,fe]),Ke=e.useCallback((function(e){if(be){var o=Ye(e);o&&be(o,e)}}),[Ye,be]);return d.jsx("canvas",{ref:o.mergeRefs(ye,ge),width:Te*v,height:Be*v,style:{width:Te,height:Be,cursor:ue?"auto":"normal"},onMouseEnter:ue?ze:void 0,onMouseMove:ue?ze:void 0,onMouseLeave:ue?_e:void 0,onMouseDown:ue?Ne:void 0,onMouseUp:ue?Qe:void 0,onClick:ue?Je:void 0,onDoubleClick:ue?Ke:void 0})},O=e.forwardRef((function(e,i){var n=e.isInteractive,r=e.renderWrapper,t=e.theme,a=v(e,P);return d.jsx(o.Container,{isInteractive:n,renderWrapper:r,theme:t,animate:!1,children:d.jsx(G,p({},a,{forwardedRef:i}))})}));var A=e.forwardRef((function(e,i){return d.jsx(o.ResponsiveWrapper,{children:function(o){var n=o.width,r=o.height;return d.jsx(O,p({width:n,height:r},e,{ref:i}))}})}));exports.LINE_UNIQUE_ID_PREFIX=M,exports.Line=F,exports.LineCanvas=O,exports.ResponsiveLine=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var i=o.width,n=o.height;return d.jsx(F,p({width:i,height:n},e))}})},exports.ResponsiveLineCanvas=A,exports.canvasDefaultProps=m,exports.commonDefaultProps=b,exports.isPoint=function(e){return void 0!==e.seriesId},exports.isSliceData=function(e){return void 0!==e.points},exports.svgDefaultProps=x,exports.useAreaGenerator=y,exports.useLine=S,exports.useLineGenerator=g,exports.useSlices=C; | ||
| "use strict";var e=require("react"),o=require("@nivo/core"),i=require("@nivo/axes"),n=require("@nivo/legends"),r=require("@nivo/tooltip"),t=require("d3-shape"),a=require("lodash/uniqueId.js"),l=require("@nivo/theming"),s=require("@nivo/colors"),u=require("@nivo/scales"),d=require("react/jsx-runtime"),c=require("@react-spring/web"),h=require("@nivo/voronoi");function p(){return p=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},p.apply(null,arguments)}function v(e,o){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==o.indexOf(n))continue;i[n]=e[n]}return i}var f,b={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:e.memo((function(e){var o=e.point;return d.jsx(r.BasicTooltip,{id:d.jsxs("span",{children:["x: ",d.jsx("strong",{children:o.data.xFormatted}),", y:"," ",d.jsx("strong",{children:o.data.yFormatted})]}),enableChip:!0,color:o.seriesColor})})),sliceTooltip:e.memo((function(e){var o=e.slice,i=e.axis,n=l.useTheme(),t="x"===i?"y":"x";return d.jsx(r.TableTooltip,{rows:o.points.map((function(e){return[d.jsx(r.Chip,{color:e.seriesColor,style:n.tooltip.chip},"chip"),e.seriesId,d.jsx("span",{style:n.tooltip.tableCellValue,children:e.data[t+"Formatted"]},"value")]}))})})),debugMesh:!1,renderWrapper:!0},x=p({},b,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisBottom:{},axisLeft:{},useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),m=p({},b,{pixelRatio:"undefined"!=typeof window&&null!=(f=window.devicePixelRatio)?f:1,axisBottom:{},axisLeft:{}});function g(i){return e.useMemo((function(){return t.line().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y((function(e){return e.y})).curve(o.curveFromProp(i))}),[i])}function y(i){var n=i.curve,r=i.yScale,a=i.areaBaselineValue;return e.useMemo((function(){return t.area().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y1((function(e){return e.y})).curve(o.curveFromProp(n)).y0(r(a))}),[n,r,a])}var C=function(o){var i=o.componentId,n=o.enableSlices,r=o.points,t=o.width,a=o.height;return e.useMemo((function(){if("x"===n){var e=new Map;return r.forEach((function(o){null!==o.data.x&&null!==o.data.y&&(e.has(o.x)?e.get(o.x).push(o):e.set(o.x,[o]))})),Array.from(e.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,n){var r,l,s=e[0],u=e[1],d=n[o-1],c=n[o+1];return r=d?s-(s-d[0])/2:s,l=c?s-r+(c[0]-s)/2:t-r,{id:"slice:"+i+":"+s,x0:r,x:s,y0:0,y:0,width:l,height:a,points:u.reverse()}}))}if("y"===n){var o=new Map;return r.forEach((function(e){null!==e.data.x&&null!==e.data.y&&(o.has(e.y)?o.get(e.y).push(e):o.set(e.y,[e]))})),Array.from(o.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,i){var n,r,l=e[0],s=e[1],u=i[o-1],d=i[o+1];return n=u?l-(l-u[0])/2:l,r=d?l-n+(d[0]-l)/2:a-n,{id:l,x0:0,x:0,y0:n,y:l,width:t,height:r,points:s.reverse()}}))}return[]}),[i,n,a,r,t])},M="line",S=function(i){var n=i.data,r=i.xScale,t=void 0===r?b.xScale:r,d=i.xFormat,c=i.yScale,h=void 0===c?b.yScale:c,v=i.yFormat,f=i.width,m=i.height,S=i.colors,k=void 0===S?b.colors:S,T=i.curve,B=void 0===T?b.curve:T,w=i.areaBaselineValue,L=void 0===w?b.areaBaselineValue:w,D=i.pointColor,j=void 0===D?b.pointColor:D,I=i.pointBorderColor,W=void 0===I?b.pointBorderColor:I,E=i.enableSlices,F=void 0===E?x.enableSlices:E,P=i.initialHiddenIds,G=void 0===P?x.initialHiddenIds:P,O=e.useState(a(M))[0],A=o.useValueFormatter(d),V=o.useValueFormatter(v),H=s.useOrdinalColorScale(k,"id"),R=l.useTheme(),Y=s.useInheritedColor(j,R),q=s.useInheritedColor(W,R),U=e.useState(null!=G?G:[]),X=U[0],z=U[1],_=e.useMemo((function(){return u.computeXYScalesForSeries(n.filter((function(e){return-1===X.indexOf(e.id)})),t,h,f,m)}),[n,X,t,h,f,m]),N=_.xScale,Q=_.yScale,J=_.series,K=e.useMemo((function(){var e=n.map((function(e){return{id:e.id,label:""+e.id,color:H(e)}})),o=e.map((function(e){return p({},J.find((function(o){return o.id===e.id})),{color:e.color})})).filter((function(e){return Boolean(e.id)}));return{legendData:e.map((function(e){return p({},e,{hidden:!o.find((function(o){return o.id===e.id}))})})).reverse(),series:o}}),[n,J,H]),Z=K.legendData,$=K.series,ee=e.useCallback((function(e){z((function(o){return o.indexOf(e)>-1?o.filter((function(o){return o!==e})):[].concat(o,[e])}))}),[]),oe=function(o){var i=o.series,n=o.getPointColor,r=o.getPointBorderColor,t=o.formatX,a=o.formatY;return e.useMemo((function(){return i.reduce((function(e,o,i){return[].concat(e,o.data.filter((function(e){return null!==e.position.x&&null!==e.position.y})).map((function(l,s){var u={id:o.id+"."+s,indexInSeries:s,absIndex:e.length+s,seriesIndex:i,seriesId:o.id,seriesColor:o.color,x:l.position.x,y:l.position.y,data:p({},l.data,{xFormatted:t(l.data.x),yFormatted:a(l.data.y)})};return u.color=n({series:o,point:u}),u.borderColor=r(u),u})))}),[])}),[i,n,r,t,a])}({series:$,getPointColor:Y,getPointBorderColor:q,formatX:A,formatY:V}),ie=C({componentId:O,enableSlices:F,points:oe,width:f,height:m});return{legendData:Z,toggleSeries:ee,lineGenerator:g(B),areaGenerator:y({curve:B,yScale:Q,areaBaselineValue:L}),getColor:H,series:$,xScale:N,yScale:Q,slices:ie,points:oe}},k=function(e){var i=e.areaBlendMode,n=e.areaOpacity,r=e.color,t=e.fill,a=e.path,l=o.useMotionConfig(),s=l.animate,u=l.config,h=o.useAnimatedPath(a),p=c.useSpring({color:r,config:u,immediate:!s});return d.jsx(c.animated.path,{d:h,fill:t||p.color,fillOpacity:n,strokeWidth:0,style:{mixBlendMode:i}})},T=e.memo((function(e){var o=e.areaGenerator,i=e.areaOpacity,n=e.areaBlendMode,r=e.series.slice(0).reverse();return d.jsx("g",{children:r.map((function(e){return d.jsx(k,p({path:o(e.data.map((function(e){return e.position})))},p({areaOpacity:i,areaBlendMode:n},e)),""+e.id)}))})})),B=e.memo((function(i){var n=i.lineGenerator,r=i.points,t=i.color,a=i.thickness,l=e.useMemo((function(){return n(r)}),[n,r]),s=o.useAnimatedPath(l);return d.jsx(c.animated.path,{d:s,fill:"none",strokeWidth:a,stroke:t})})),w=e.memo((function(e){var o=e.series,i=e.lineGenerator,n=e.lineWidth;return d.jsx(d.Fragment,{children:o.slice(0).reverse().map((function(e){var o=e.id,r=e.data,t=e.color;return d.jsx(B,{points:r.map((function(e){return e.position})),lineGenerator:i,color:t,thickness:n},o)}))})})),L=e.memo((function(o){var i=o.slice,n=o.slices,t=o.axis,a=o.debug,l=o.tooltip,s=o.isCurrent,u=o.setCurrent,c=o.onMouseEnter,h=o.onMouseMove,p=o.onMouseLeave,v=o.onMouseDown,f=o.onMouseUp,b=o.onClick,x=o.onDoubleClick,m=o.onTouchStart,g=o.onTouchMove,y=o.onTouchEnd,C=r.useTooltip(),M=C.showTooltipFromEvent,S=C.hideTooltip,k=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),c&&c(i,o)}),[M,l,i,t,u,c]),T=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),h&&h(i,o)}),[M,l,i,t,h]),B=e.useCallback((function(e){S(),u(null),p&&p(i,e)}),[S,u,p,i]),w=e.useCallback((function(e){v&&v(i,e)}),[i,v]),L=e.useCallback((function(e){f&&f(i,e)}),[i,f]),D=e.useCallback((function(e){b&&b(i,e)}),[i,b]),j=e.useCallback((function(e){x&&x(i,e)}),[i,x]),I=e.useCallback((function(o){M(e.createElement(l,{slice:i,axis:t}),o,"right"),u(i),m&&m(i,o)}),[t,m,u,M,i,l]),W=e.useCallback((function(o){var r=o.touches[0],a=document.elementFromPoint(r.clientX,r.clientY),s=null==a?void 0:a.getAttribute("data-ref");if(s){var d=n.find((function(e){return e.id===s}));d&&(M(e.createElement(l,{slice:d,axis:t}),o,"right"),u(d))}g&&g(i,o)}),[t,g,u,M,i,n,l]),E=e.useCallback((function(e){S(),u(null),y&&y(i,e)}),[S,u,y,i]);return d.jsx("rect",{x:i.x0,y:i.y0,width:i.width,height:i.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:s&&a?.35:0,onMouseEnter:k,onMouseMove:T,onMouseLeave:B,onMouseDown:w,onMouseUp:L,onClick:D,onDoubleClick:j,onTouchStart:I,onTouchMove:W,onTouchEnd:E,"data-ref":i.id})})),D=e.memo((function(e){var o=e.slices,i=e.axis,n=e.debug,r=e.tooltip,t=e.current,a=e.setCurrent,l=e.onMouseEnter,s=e.onMouseMove,u=e.onMouseLeave,c=e.onMouseDown,h=e.onMouseUp,p=e.onClick,v=e.onDoubleClick,f=e.onTouchStart,b=e.onTouchMove,x=e.onTouchEnd;return d.jsx(d.Fragment,{children:o.map((function(e){return d.jsx(L,{slice:e,slices:o,axis:i,debug:n,tooltip:r,setCurrent:a,isCurrent:null!==t&&t.id===e.id,onMouseEnter:l,onMouseMove:s,onMouseLeave:u,onMouseDown:c,onMouseUp:h,onClick:p,onDoubleClick:v,onTouchStart:f,onTouchMove:b,onTouchEnd:x},e.id)}))})})),j=e.memo((function(i){var n=i.points,t=i.symbol,a=i.size,l=i.borderWidth,s=i.enableLabel,u=i.label,c=i.labelYOffset,h=i.isFocusable,p=i.setCurrentPoint,v=i.tooltip,f=i.margin,b=i.ariaLabel,x=i.ariaLabelledBy,m=i.ariaDescribedBy,g=i.ariaHidden,y=i.ariaDisabled,C=o.getLabelGenerator(u),M=r.useTooltip(),S=M.showTooltipAt,k=M.hideTooltip,T=n.slice(0).sort((function(e,o){return e.indexInSeries-o.indexInSeries})).sort((function(e,o){return o.seriesIndex-e.seriesIndex})).map((function(o){return{id:o.id,x:o.x,y:o.y,datum:o.data,fill:o.color,stroke:o.borderColor,label:s?C(o):null,ariaLabel:b?b(o):void 0,ariaLabelledBy:x?x(o):void 0,ariaDescribedBy:m?m(o):void 0,ariaHidden:g?g(o):void 0,ariaDisabled:y?y(o):void 0,onFocus:h?function(){p(o),S(e.createElement(v,{point:o}),[f.left+o.x,f.top+o.y],"top")}:void 0,onBlur:h?function(){p(null),k()}:void 0}}));return d.jsx("g",{children:T.map((function(e){return d.jsx(o.DotsItem,{x:e.x,y:e.y,datum:e.datum,symbol:t,size:a,color:e.fill,borderWidth:l,borderColor:e.stroke,label:e.label,labelYOffset:c,ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,ariaHidden:e.ariaHidden,ariaDisabled:e.ariaDisabled,isFocusable:h,onFocus:e.onFocus,onBlur:e.onBlur,testId:"line.point."+e.id},e.id)}))})})),I=e.memo((function(o){var i=o.points,n=o.width,t=o.height,a=o.margin,l=o.setCurrent,s=o.onMouseEnter,u=o.onMouseMove,c=o.onMouseLeave,p=o.onMouseDown,v=o.onMouseUp,f=o.onClick,b=o.onDoubleClick,x=o.onTouchStart,m=o.onTouchMove,g=o.onTouchEnd,y=o.tooltip,C=o.debug,M=o.enableTouchCrosshair,S=r.useTooltip(),k=S.showTooltipAt,T=S.hideTooltip,B=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),s&&s(o,i)}),[k,y,s,a]),w=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),u&&u(o,i)}),[k,y,a.left,a.top,u]),L=e.useCallback((function(e,o){T(),c&&c(e,o)}),[T,c]),D=e.useCallback((function(e,o){p&&p(e,o)}),[p]),j=e.useCallback((function(e,o){v&&v(e,o)}),[v]),I=e.useCallback((function(e,o){f&&f(e,o)}),[f]),W=e.useCallback((function(e,o){b&&b(e,o)}),[b]),E=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),x&&x(o,i)}),[a.left,a.top,x,k,y]),F=e.useCallback((function(o,i){k(e.createElement(y,{point:o}),[o.x+a.left,o.y+a.top],"top"),m&&m(o,i)}),[a.left,a.top,m,k,y]),P=e.useCallback((function(e,o){T(),g&&g(e,o)}),[g,T]);return d.jsx(h.Mesh,{nodes:i,width:n,height:t,setCurrent:l,onMouseEnter:B,onMouseMove:w,onMouseLeave:L,onMouseDown:D,onMouseUp:j,onClick:I,onDoubleClick:W,onTouchStart:E,onTouchMove:F,onTouchEnd:P,enableTouchCrosshair:M,debug:C})})),W=["isInteractive","animate","motionConfig","theme","renderWrapper"];function E(t){var a=t.data,l=t.xScale,s=void 0===l?x.xScale:l,u=t.xFormat,c=t.yScale,h=void 0===c?x.yScale:c,v=t.yFormat,f=t.curve,b=void 0===f?x.curve:f,m=t.margin,g=t.width,y=t.height,C=t.colors,M=void 0===C?x.colors:C,k=t.lineWidth,B=void 0===k?x.lineWidth:k,L=t.layers,W=void 0===L?x.layers:L,E=t.enableArea,F=void 0===E?x.enableArea:E,P=t.areaBaselineValue,G=void 0===P?x.areaBaselineValue:P,O=t.areaOpacity,A=void 0===O?x.areaOpacity:O,V=t.areaBlendMode,H=void 0===V?x.areaBlendMode:V,R=t.enablePoints,Y=void 0===R?x.enablePoints:R,q=t.pointSymbol,U=t.pointSize,X=void 0===U?x.pointSize:U,z=t.pointColor,_=void 0===z?x.pointColor:z,N=t.pointBorderWidth,Q=void 0===N?x.pointBorderWidth:N,J=t.pointBorderColor,K=void 0===J?x.pointBorderColor:J,Z=t.enablePointLabel,$=void 0===Z?x.enablePointLabel:Z,ee=t.pointLabel,oe=void 0===ee?x.pointLabel:ee,ie=t.pointLabelYOffset,ne=t.enableGridX,re=void 0===ne?x.enableGridX:ne,te=t.gridXValues,ae=t.enableGridY,le=void 0===ae?x.enableGridY:ae,se=t.gridYValues,ue=t.axisTop,de=t.axisRight,ce=t.axisBottom,he=void 0===ce?x.axisBottom:ce,pe=t.axisLeft,ve=void 0===pe?x.axisLeft:pe,fe=t.defs,be=void 0===fe?x.defs:fe,xe=t.fill,me=void 0===xe?x.fill:xe,ge=t.markers,ye=t.legends,Ce=void 0===ye?x.legends:ye,Me=t.isInteractive,Se=void 0===Me?x.isInteractive:Me,ke=t.useMesh,Te=void 0===ke?x.useMesh:ke,Be=t.debugMesh,we=void 0===Be?x.debugMesh:Be,Le=t.onMouseEnter,De=t.onMouseMove,je=t.onMouseLeave,Ie=t.onMouseDown,We=t.onMouseUp,Ee=t.onClick,Fe=t.onDoubleClick,Pe=t.onTouchStart,Ge=t.onTouchMove,Oe=t.onTouchEnd,Ae=t.tooltip,Ve=void 0===Ae?x.tooltip:Ae,He=t.enableSlices,Re=void 0===He?x.enableSlices:He,Ye=t.debugSlices,qe=void 0===Ye?x.debugSlices:Ye,Ue=t.sliceTooltip,Xe=void 0===Ue?x.sliceTooltip:Ue,ze=t.enableCrosshair,_e=void 0===ze?x.enableCrosshair:ze,Ne=t.crosshairType,Qe=void 0===Ne?x.crosshairType:Ne,Je=t.enableTouchCrosshair,Ke=void 0===Je?x.enableTouchCrosshair:Je,Ze=t.role,$e=void 0===Ze?x.role:Ze,eo=t.ariaLabel,oo=t.ariaLabelledBy,io=t.ariaDescribedBy,no=t.isFocusable,ro=void 0===no?x.isFocusable:no,to=t.pointAriaLabel,ao=t.pointAriaLabelledBy,lo=t.pointAriaDescribedBy,so=t.pointAriaHidden,uo=t.pointAriaDisabled,co=t.initialHiddenIds,ho=void 0===co?x.initialHiddenIds:co,po=o.useDimensions(g,y,m),vo=po.margin,fo=po.innerWidth,bo=po.innerHeight,xo=po.outerWidth,mo=po.outerHeight,go=S({data:a,xScale:s,xFormat:u,yScale:h,yFormat:v,width:fo,height:bo,colors:M,curve:b,areaBaselineValue:G,pointColor:_,pointBorderColor:K,enableSlices:Re,initialHiddenIds:ho}),yo=go.legendData,Co=go.toggleSeries,Mo=go.lineGenerator,So=go.areaGenerator,ko=go.series,To=go.xScale,Bo=go.yScale,wo=go.slices,Lo=go.points,Do=e.useState(null),jo=Do[0],Io=Do[1],Wo=e.useState(null),Eo=Wo[0],Fo=Wo[1],Po={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};W.includes("grid")&&(re||le)&&(Po.grid=d.jsx(i.Grid,{width:fo,height:bo,xScale:re?To:null,yScale:le?Bo:null,xValues:te,yValues:se},"grid")),W.includes("markers")&&Array.isArray(ge)&&ge.length>0&&(Po.markers=d.jsx(o.CartesianMarkers,{markers:ge,width:fo,height:bo,xScale:To,yScale:Bo},"markers")),W.includes("axes")&&(Po.axes=d.jsx(i.Axes,{xScale:To,yScale:Bo,width:fo,height:bo,top:ue,right:de,bottom:he,left:ve},"axes")),W.includes("lines")&&(Po.lines=d.jsx(w,{series:ko,lineGenerator:Mo,lineWidth:B},"lines")),W.includes("legends")&&Ce.length>0&&(Po.legends=d.jsx(e.Fragment,{children:Ce.map((function(e,o){return d.jsx(n.BoxLegendSvg,p({},e,{containerWidth:fo,containerHeight:bo,data:e.data||yo,toggleSerie:e.toggleSerie?Co:void 0}),o)}))},"legends"));var Go=o.bindDefs(be,ko,me);F&&(Po.areas=d.jsx(T,{areaGenerator:So,areaOpacity:A,areaBlendMode:H,series:ko},"areas")),Se&&!1!==Re&&(Po.slices=d.jsx(D,{slices:wo,axis:Re,debug:qe,tooltip:Xe,current:Eo,setCurrent:Fo,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe},"slices")),Y&&(Po.points=d.jsx(j,{points:Lo,symbol:q,size:X,borderWidth:Q,enableLabel:$,label:oe,labelYOffset:ie,isFocusable:ro,setCurrentPoint:Io,tooltip:Ve,margin:vo,ariaLabel:to,ariaLabelledBy:ao,ariaDescribedBy:lo,ariaHidden:so,ariaDisabled:uo},"points")),Se&&_e&&(null!==jo&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:jo.x,y:jo.y,type:Qe},"crosshair")),null!==Eo&&Re&&(Po.crosshair=d.jsx(r.Crosshair,{width:fo,height:bo,x:Eo.x,y:Eo.y,type:Re},"crosshair"))),Se&&Te&&!1===Re&&(Po.mesh=d.jsx(I,{points:Lo,width:fo,height:bo,margin:vo,setCurrent:Io,onMouseEnter:Le,onMouseMove:De,onMouseLeave:je,onMouseDown:Ie,onMouseUp:We,onClick:Ee,onDoubleClick:Fe,onTouchStart:Pe,onTouchMove:Ge,onTouchEnd:Oe,tooltip:Ve,enableTouchCrosshair:Ke,debug:we},"mesh"));var Oo=p({},t,{innerWidth:fo,innerHeight:bo,series:ko,slices:wo,points:Lo,xScale:To,yScale:Bo,lineGenerator:Mo,areaGenerator:So,currentPoint:jo,setCurrentPoint:Io,currentSlice:Eo,setCurrentSlice:Fo});return d.jsx(o.SvgWrapper,{defs:Go,width:xo,height:mo,margin:vo,role:$e,ariaLabel:eo,ariaLabelledBy:oo,ariaDescribedBy:io,isFocusable:ro,children:W.map((function(o,i){return"function"==typeof o?d.jsx(e.Fragment,{children:o(Oo)},i):Po[o]}))})}function F(e){var i=e.isInteractive,n=void 0===i?x.isInteractive:i,r=e.animate,t=void 0===r?x.animate:r,a=e.motionConfig,l=void 0===a?x.motionConfig:a,s=e.theme,u=e.renderWrapper,c=v(e,W);return d.jsx(o.Container,{animate:t,isInteractive:n,motionConfig:l,renderWrapper:u,theme:s,children:d.jsx(E,p({isInteractive:n},c))})}var P=["isInteractive","renderWrapper","theme"],G=function(t){var a=t.width,s=t.height,u=t.margin,c=t.pixelRatio,v=void 0===c?m.pixelRatio:c,f=t.data,b=t.xScale,x=void 0===b?m.xScale:b,g=t.xFormat,y=t.yScale,C=void 0===y?m.yScale:y,M=t.yFormat,k=t.curve,T=void 0===k?m.curve:k,B=t.layers,w=void 0===B?m.layers:B,L=t.colors,D=void 0===L?m.colors:L,j=t.lineWidth,I=void 0===j?m.lineWidth:j,W=t.enableArea,E=void 0===W?m.enableArea:W,F=t.areaBaselineValue,P=void 0===F?m.areaBaselineValue:F,G=t.areaOpacity,O=void 0===G?m.areaOpacity:G,A=t.enablePoints,V=void 0===A?m.enablePoints:A,H=t.pointSize,R=void 0===H?m.pointSize:H,Y=t.pointColor,q=void 0===Y?m.pointColor:Y,U=t.pointBorderWidth,X=void 0===U?m.pointBorderWidth:U,z=t.pointBorderColor,_=void 0===z?m.pointBorderColor:z,N=t.enableGridX,Q=void 0===N?m.enableGridX:N,J=t.gridXValues,K=t.enableGridY,Z=void 0===K?m.enableGridY:K,$=t.gridYValues,ee=t.axisTop,oe=t.axisRight,ie=t.axisBottom,ne=void 0===ie?m.axisBottom:ie,re=t.axisLeft,te=void 0===re?m.axisLeft:re,ae=t.legends,le=void 0===ae?m.legends:ae,se=t.isInteractive,ue=void 0===se?m.isInteractive:se,de=t.debugMesh,ce=void 0===de?m.debugMesh:de,he=t.onMouseLeave,pe=t.onMouseDown,ve=t.onMouseUp,fe=t.onClick,be=t.onDoubleClick,xe=t.tooltip,me=void 0===xe?m.tooltip:xe,ge=t.forwardedRef,ye=e.useRef(null),Ce=o.useDimensions(a,s,u),Me=Ce.margin,Se=Ce.innerWidth,ke=Ce.innerHeight,Te=Ce.outerWidth,Be=Ce.outerHeight,we=l.useTheme(),Le=e.useState(null),De=Le[0],je=Le[1],Ie=S({data:f,xScale:x,xFormat:g,yScale:C,yFormat:M,width:Se,height:ke,colors:D,curve:T,areaBaselineValue:P,pointColor:q,pointBorderColor:_}),We=Ie.lineGenerator,Ee=Ie.areaGenerator,Fe=Ie.series,Pe=Ie.xScale,Ge=Ie.yScale,Oe=Ie.points,Ae=e.useMemo((function(){return{innerWidth:Se,innerHeight:ke,series:Fe,points:Oe,xScale:Pe,yScale:Ge,lineWidth:I,lineGenerator:We,areaGenerator:Ee,currentPoint:De,setCurrentPoint:je}}),[Se,ke,Fe,Oe,Pe,Ge,I,We,Ee,De]),Ve=h.useVoronoiMesh({points:Oe,width:Se,height:ke,debug:ce}),He=Ve.delaunay,Re=Ve.voronoi;e.useEffect((function(){if(null!==ye.current){ye.current.width=Te*v,ye.current.height=Be*v;var e=ye.current.getContext("2d");e.scale(v,v),e.fillStyle=we.background,e.fillRect(0,0,Te,Be),e.translate(Me.left,Me.top),w.forEach((function(o){if("function"==typeof o&&o(e,Ae),"grid"===o&&(we.grid.line.strokeWidth||0)>0&&(e.lineWidth=we.grid.line.strokeWidth,e.strokeStyle=we.grid.line.stroke,Q&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Pe,axis:"x",values:J}),Z&&i.renderGridLinesToCanvas(e,{width:Se,height:ke,scale:Ge,axis:"y",values:$})),"axes"===o&&i.renderAxesToCanvas(e,{xScale:Pe,yScale:Ge,width:Se,height:ke,top:ee,right:oe,bottom:ne,left:te,theme:we}),"areas"===o&&!0===E){e.save(),e.globalAlpha=O,Ee.context(e);for(var r=Fe.length-1;r>=0;r--)e.fillStyle=Fe[r].color,e.beginPath(),Ee(Fe[r].data.map((function(e){return e.position}))),e.fill();e.restore()}if("lines"===o&&(We.context(e),Fe.forEach((function(o){e.strokeStyle=o.color,e.lineWidth=I,e.beginPath(),We(o.data.map((function(e){return e.position}))),e.stroke()}))),"points"===o&&!0===V&&R>0&&Oe.forEach((function(o){e.fillStyle=o.color,e.beginPath(),e.arc(o.x,o.y,R/2,0,2*Math.PI),e.fill(),X>0&&(e.strokeStyle=o.borderColor,e.lineWidth=X,e.stroke())})),"mesh"===o&&!0===ce&&void 0!==Re&&(h.renderVoronoiToCanvas(e,Re),De&&h.renderVoronoiCellToCanvas(e,Re,De.absIndex)),"legends"===o){var t=Fe.map((function(e){return{id:e.id,label:e.id,color:e.color}})).reverse();le.forEach((function(o){n.renderLegendToCanvas(e,p({},o,{data:o.data||t,containerWidth:Se,containerHeight:ke,theme:we}))}))}}))}}),[ye,Te,Be,w,we,We,Fe,Pe,Ge,Q,J,Z,$,ee,oe,ne,te,le,Oe,V,R,De]);var Ye=e.useCallback((function(e){if(!ye.current)return null;var i=o.getRelativeCursor(ye.current,e),n=i[0],r=i[1];if(!o.isCursorInRect(Me.left,Me.top,Se,ke,n,r))return null;var t=He.find(n-Me.left,r-Me.top);return Oe[t]}),[ye,Me,Se,ke,He]),qe=r.useTooltip(),Ue=qe.showTooltipFromEvent,Xe=qe.hideTooltip,ze=e.useCallback((function(o){var i=Ye(o);je(i),i?Ue(e.createElement(me,{point:i}),o):Xe()}),[Ye,je,Ue,Xe,me]),_e=e.useCallback((function(e){Xe(),je(null),De&&he&&he(De,e)}),[Xe,je,he]),Ne=e.useCallback((function(e){if(pe){var o=Ye(e);o&&pe(o,e)}}),[Ye,pe]),Qe=e.useCallback((function(e){if(ve){var o=Ye(e);o&&ve(o,e)}}),[Ye,ve]),Je=e.useCallback((function(e){if(fe){var o=Ye(e);o&&fe(o,e)}}),[Ye,fe]),Ke=e.useCallback((function(e){if(be){var o=Ye(e);o&&be(o,e)}}),[Ye,be]);return d.jsx("canvas",{ref:o.mergeRefs(ye,ge),width:Te*v,height:Be*v,style:{width:Te,height:Be,cursor:ue?"auto":"normal"},onMouseEnter:ue?ze:void 0,onMouseMove:ue?ze:void 0,onMouseLeave:ue?_e:void 0,onMouseDown:ue?Ne:void 0,onMouseUp:ue?Qe:void 0,onClick:ue?Je:void 0,onDoubleClick:ue?Ke:void 0})},O=e.forwardRef((function(e,i){var n=e.isInteractive,r=e.renderWrapper,t=e.theme,a=v(e,P);return d.jsx(o.Container,{isInteractive:n,renderWrapper:r,theme:t,animate:!1,children:d.jsx(G,p({},a,{forwardedRef:i}))})}));var A=e.forwardRef((function(e,i){return d.jsx(o.ResponsiveWrapper,{children:function(o){var n=o.width,r=o.height;return d.jsx(O,p({width:n,height:r},e,{ref:i}))}})}));exports.LINE_UNIQUE_ID_PREFIX=M,exports.Line=F,exports.LineCanvas=O,exports.ResponsiveLine=function(e){return d.jsx(o.ResponsiveWrapper,{children:function(o){var i=o.width,n=o.height;return d.jsx(F,p({width:i,height:n},e))}})},exports.ResponsiveLineCanvas=A,exports.canvasDefaultProps=m,exports.commonDefaultProps=b,exports.isPoint=function(e){return void 0!==e.seriesId},exports.isSliceData=function(e){return void 0!==e.points},exports.svgDefaultProps=x,exports.useAreaGenerator=y,exports.useLine=S,exports.useLineGenerator=g,exports.useSlices=C; | ||
| //# sourceMappingURL=nivo-line.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
| import{memo as e,useMemo as o,useState as i,useCallback as n,createElement as r,Fragment as t,forwardRef as a,useRef as l,useEffect as s}from"react";import{curveFromProp as d,useValueFormatter as u,useMotionConfig as c,useAnimatedPath as h,getLabelGenerator as f,DotsItem as p,Container as v,useDimensions as b,CartesianMarkers as g,bindDefs as m,SvgWrapper as y,ResponsiveWrapper as x,getRelativeCursor as M,isCursorInRect as C,mergeRefs as S}from"@nivo/core";import{Grid as B,Axes as w,renderGridLinesToCanvas as k,renderAxesToCanvas as T}from"@nivo/axes";import{BoxLegendSvg as L,renderLegendToCanvas as D}from"@nivo/legends";import{BasicTooltip as W,TableTooltip as I,Chip as F,useTooltip as E,Crosshair as G}from"@nivo/tooltip";import{line as P,area as O}from"d3-shape";import H from"lodash/uniqueId.js";import{useTheme as A}from"@nivo/theming";import{useOrdinalColorScale as V,useInheritedColor as Y}from"@nivo/colors";import{computeXYScalesForSeries as U}from"@nivo/scales";import{jsx as X,jsxs as R,Fragment as z}from"react/jsx-runtime";import{useSpring as j,animated as q}from"@react-spring/web";import{Mesh as J,useVoronoiMesh as K,renderVoronoiToCanvas as N,renderVoronoiCellToCanvas as Q}from"@nivo/voronoi";function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},Z.apply(null,arguments)}function $(e,o){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==o.indexOf(n))continue;i[n]=e[n]}return i}var _,ee={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:e((function(e){var o=e.point;return X(W,{id:R("span",{children:["x: ",X("strong",{children:o.data.xFormatted}),", y:"," ",X("strong",{children:o.data.yFormatted})]}),enableChip:!0,color:o.seriesColor})})),sliceTooltip:e((function(e){var o=e.slice,i=e.axis,n=A(),r="x"===i?"y":"x";return X(I,{rows:o.points.map((function(e){return[X(F,{color:e.seriesColor,style:n.tooltip.chip},"chip"),e.seriesId,X("span",{style:n.tooltip.tableCellValue,children:e.data[r+"Formatted"]},"value")]}))})})),debugMesh:!1,renderWrapper:!0},oe=Z({},ee,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisBottom:{},axisLeft:{},useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),ie=Z({},ee,{pixelRatio:"undefined"!=typeof window&&null!=(_=window.devicePixelRatio)?_:1,axisBottom:{},axisLeft:{}});function ne(e){return o((function(){return P().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y((function(e){return e.y})).curve(d(e))}),[e])}function re(e){var i=e.curve,n=e.yScale,r=e.areaBaselineValue;return o((function(){return O().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y1((function(e){return e.y})).curve(d(i)).y0(n(r))}),[i,n,r])}var te=function(e){var i=e.componentId,n=e.enableSlices,r=e.points,t=e.width,a=e.height;return o((function(){if("x"===n){var e=new Map;return r.forEach((function(o){null!==o.data.x&&null!==o.data.y&&(e.has(o.x)?e.get(o.x).push(o):e.set(o.x,[o]))})),Array.from(e.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,n){var r,l,s=e[0],d=e[1],u=n[o-1],c=n[o+1];return r=u?s-(s-u[0])/2:s,l=c?s-r+(c[0]-s)/2:t-r,{id:"slice:"+i+":"+s,x0:r,x:s,y0:0,y:0,width:l,height:a,points:d.reverse()}}))}if("y"===n){var o=new Map;return r.forEach((function(e){null!==e.data.x&&null!==e.data.y&&(o.has(e.y)?o.get(e.y).push(e):o.set(e.y,[e]))})),Array.from(o.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,i){var n,r,l=e[0],s=e[1],d=i[o-1],u=i[o+1];return n=d?l-(l-d[0])/2:l,r=u?l-n+(u[0]-l)/2:a-n,{id:l,x0:0,x:0,y0:n,y:l,width:t,height:r,points:s.reverse()}}))}return[]}),[i,n,a,r,t])},ae="line",le=function(e){var r=e.data,t=e.xScale,a=void 0===t?ee.xScale:t,l=e.xFormat,s=e.yScale,d=void 0===s?ee.yScale:s,c=e.yFormat,h=e.width,f=e.height,p=e.colors,v=void 0===p?ee.colors:p,b=e.curve,g=void 0===b?ee.curve:b,m=e.areaBaselineValue,y=void 0===m?ee.areaBaselineValue:m,x=e.pointColor,M=void 0===x?ee.pointColor:x,C=e.pointBorderColor,S=void 0===C?ee.pointBorderColor:C,B=e.enableSlices,w=void 0===B?oe.enableSlices:B,k=e.initialHiddenIds,T=void 0===k?oe.initialHiddenIds:k,L=i(H(ae))[0],D=u(l),W=u(c),I=V(v,"id"),F=A(),E=Y(M,F),G=Y(S,F),P=i(null!=T?T:[]),O=P[0],X=P[1],R=o((function(){return U(r.filter((function(e){return-1===O.indexOf(e.id)})),a,d,h,f)}),[r,O,a,d,h,f]),z=R.xScale,j=R.yScale,q=R.series,J=o((function(){var e=r.map((function(e){return{id:e.id,label:""+e.id,color:I(e)}})),o=e.map((function(e){return Z({},q.find((function(o){return o.id===e.id})),{color:e.color})})).filter((function(e){return Boolean(e.id)}));return{legendData:e.map((function(e){return Z({},e,{hidden:!o.find((function(o){return o.id===e.id}))})})).reverse(),series:o}}),[r,q,I]),K=J.legendData,N=J.series,Q=n((function(e){X((function(o){return o.indexOf(e)>-1?o.filter((function(o){return o!==e})):[].concat(o,[e])}))}),[]),$=function(e){var i=e.series,n=e.getPointColor,r=e.getPointBorderColor,t=e.formatX,a=e.formatY;return o((function(){return i.reduce((function(e,o,i){return[].concat(e,o.data.filter((function(e){return null!==e.position.x&&null!==e.position.y})).map((function(l,s){var d={id:o.id+"."+s,indexInSeries:s,absIndex:e.length+s,seriesIndex:i,seriesId:o.id,seriesColor:o.color,x:l.position.x,y:l.position.y,data:Z({},l.data,{xFormatted:t(l.data.x),yFormatted:a(l.data.y)})};return d.color=n({series:o,point:d}),d.borderColor=r(d),d})))}),[])}),[i,n,r,t,a])}({series:N,getPointColor:E,getPointBorderColor:G,formatX:D,formatY:W}),_=te({componentId:L,enableSlices:w,points:$,width:h,height:f});return{legendData:K,toggleSeries:Q,lineGenerator:ne(g),areaGenerator:re({curve:g,yScale:j,areaBaselineValue:y}),getColor:I,series:N,xScale:z,yScale:j,slices:_,points:$}},se=function(e){var o=e.areaBlendMode,i=e.areaOpacity,n=e.color,r=e.fill,t=e.path,a=c(),l=a.animate,s=a.config,d=h(t),u=j({color:n,config:s,immediate:!l});return X(q.path,{d:d,fill:r||u.color,fillOpacity:i,strokeWidth:0,style:{mixBlendMode:o}})},de=e((function(e){var o=e.areaGenerator,i=e.areaOpacity,n=e.areaBlendMode,r=e.series.slice(0).reverse();return X("g",{children:r.map((function(e){return X(se,Z({path:o(e.data.map((function(e){return e.position})))},Z({areaOpacity:i,areaBlendMode:n},e)),""+e.id)}))})})),ue=e((function(e){var i=e.lineGenerator,n=e.points,r=e.color,t=e.thickness,a=o((function(){return i(n)}),[i,n]),l=h(a);return X(q.path,{d:l,fill:"none",strokeWidth:t,stroke:r})})),ce=e((function(e){var o=e.series,i=e.lineGenerator,n=e.lineWidth;return X(z,{children:o.slice(0).reverse().map((function(e){var o=e.id,r=e.data,t=e.color;return X(ue,{points:r.map((function(e){return e.position})),lineGenerator:i,color:t,thickness:n},o)}))})})),he=e((function(e){var o=e.slice,i=e.slices,t=e.axis,a=e.debug,l=e.tooltip,s=e.isCurrent,d=e.setCurrent,u=e.onMouseEnter,c=e.onMouseMove,h=e.onMouseLeave,f=e.onMouseDown,p=e.onMouseUp,v=e.onClick,b=e.onDoubleClick,g=e.onTouchStart,m=e.onTouchMove,y=e.onTouchEnd,x=E(),M=x.showTooltipFromEvent,C=x.hideTooltip,S=n((function(e){M(r(l,{slice:o,axis:t}),e,"right"),d(o),u&&u(o,e)}),[M,l,o,t,d,u]),B=n((function(e){M(r(l,{slice:o,axis:t}),e,"right"),c&&c(o,e)}),[M,l,o,t,c]),w=n((function(e){C(),d(null),h&&h(o,e)}),[C,d,h,o]),k=n((function(e){f&&f(o,e)}),[o,f]),T=n((function(e){p&&p(o,e)}),[o,p]),L=n((function(e){v&&v(o,e)}),[o,v]),D=n((function(e){b&&b(o,e)}),[o,b]),W=n((function(e){M(r(l,{slice:o,axis:t}),e,"right"),d(o),g&&g(o,e)}),[t,g,d,M,o,l]),I=n((function(e){var n=e.touches[0],a=document.elementFromPoint(n.clientX,n.clientY),s=null==a?void 0:a.getAttribute("data-ref");if(s){var u=i.find((function(e){return e.id===s}));u&&(M(r(l,{slice:u,axis:t}),e,"right"),d(u))}m&&m(o,e)}),[t,m,d,M,o,i,l]),F=n((function(e){C(),d(null),y&&y(o,e)}),[C,d,y,o]);return X("rect",{x:o.x0,y:o.y0,width:o.width,height:o.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:s&&a?.35:0,onMouseEnter:S,onMouseMove:B,onMouseLeave:w,onMouseDown:k,onMouseUp:T,onClick:L,onDoubleClick:D,onTouchStart:W,onTouchMove:I,onTouchEnd:F,"data-ref":o.id})})),fe=e((function(e){var o=e.slices,i=e.axis,n=e.debug,r=e.tooltip,t=e.current,a=e.setCurrent,l=e.onMouseEnter,s=e.onMouseMove,d=e.onMouseLeave,u=e.onMouseDown,c=e.onMouseUp,h=e.onClick,f=e.onDoubleClick,p=e.onTouchStart,v=e.onTouchMove,b=e.onTouchEnd;return X(z,{children:o.map((function(e){return X(he,{slice:e,slices:o,axis:i,debug:n,tooltip:r,setCurrent:a,isCurrent:null!==t&&t.id===e.id,onMouseEnter:l,onMouseMove:s,onMouseLeave:d,onMouseDown:u,onMouseUp:c,onClick:h,onDoubleClick:f,onTouchStart:p,onTouchMove:v,onTouchEnd:b},e.id)}))})})),pe=e((function(e){var o=e.points,i=e.symbol,n=e.size,t=e.borderWidth,a=e.enableLabel,l=e.label,s=e.labelYOffset,d=e.isFocusable,u=e.setCurrentPoint,c=e.tooltip,h=e.margin,v=e.ariaLabel,b=e.ariaLabelledBy,g=e.ariaDescribedBy,m=e.ariaHidden,y=e.ariaDisabled,x=f(l),M=E(),C=M.showTooltipAt,S=M.hideTooltip,B=o.slice(0).sort((function(e,o){return e.indexInSeries-o.indexInSeries})).sort((function(e,o){return o.seriesIndex-e.seriesIndex})).map((function(e){return{id:e.id,x:e.x,y:e.y,datum:e.data,fill:e.color,stroke:e.borderColor,label:a?x(e):null,ariaLabel:v?v(e):void 0,ariaLabelledBy:b?b(e):void 0,ariaDescribedBy:g?g(e):void 0,ariaHidden:m?m(e):void 0,ariaDisabled:y?y(e):void 0,onFocus:d?function(){u(e),C(r(c,{point:e}),[h.left+e.x,h.top+e.y],"top")}:void 0,onBlur:d?function(){u(null),S()}:void 0}}));return X("g",{children:B.map((function(e){return X(p,{x:e.x,y:e.y,datum:e.datum,symbol:i,size:n,color:e.fill,borderWidth:t,borderColor:e.stroke,label:e.label,labelYOffset:s,ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,ariaHidden:e.ariaHidden,ariaDisabled:e.ariaDisabled,isFocusable:d,onFocus:e.onFocus,onBlur:e.onBlur,testId:"line.point."+e.id},e.id)}))})})),ve=e((function(e){var o=e.points,i=e.width,t=e.height,a=e.margin,l=e.setCurrent,s=e.onMouseEnter,d=e.onMouseMove,u=e.onMouseLeave,c=e.onMouseDown,h=e.onMouseUp,f=e.onClick,p=e.onDoubleClick,v=e.onTouchStart,b=e.onTouchMove,g=e.onTouchEnd,m=e.tooltip,y=e.debug,x=e.enableTouchCrosshair,M=E(),C=M.showTooltipAt,S=M.hideTooltip,B=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),s&&s(e,o)}),[C,m,s,a]),w=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),d&&d(e,o)}),[C,m,a.left,a.top,d]),k=n((function(e,o){S(),u&&u(e,o)}),[S,u]),T=n((function(e,o){c&&c(e,o)}),[c]),L=n((function(e,o){h&&h(e,o)}),[h]),D=n((function(e,o){f&&f(e,o)}),[f]),W=n((function(e,o){p&&p(e,o)}),[p]),I=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),v&&v(e,o)}),[a.left,a.top,v,C,m]),F=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),b&&b(e,o)}),[a.left,a.top,b,C,m]),G=n((function(e,o){S(),g&&g(e,o)}),[g,S]);return X(J,{nodes:o,width:i,height:t,setCurrent:l,onMouseEnter:B,onMouseMove:w,onMouseLeave:k,onMouseDown:T,onMouseUp:L,onClick:D,onDoubleClick:W,onTouchStart:I,onTouchMove:F,onTouchEnd:G,enableTouchCrosshair:x,debug:y})})),be=["isInteractive","animate","motionConfig","theme","renderWrapper"];function ge(e){var n=e.data,r=e.xScale,a=void 0===r?oe.xScale:r,l=e.xFormat,s=e.yScale,d=void 0===s?oe.yScale:s,u=e.yFormat,c=e.curve,h=void 0===c?oe.curve:c,f=e.margin,p=e.width,v=e.height,x=e.colors,M=void 0===x?oe.colors:x,C=e.lineWidth,S=void 0===C?oe.lineWidth:C,k=e.layers,T=void 0===k?oe.layers:k,D=e.enableArea,W=void 0===D?oe.enableArea:D,I=e.areaBaselineValue,F=void 0===I?oe.areaBaselineValue:I,E=e.areaOpacity,P=void 0===E?oe.areaOpacity:E,O=e.areaBlendMode,H=void 0===O?oe.areaBlendMode:O,A=e.enablePoints,V=void 0===A?oe.enablePoints:A,Y=e.pointSymbol,U=e.pointSize,R=void 0===U?oe.pointSize:U,z=e.pointColor,j=void 0===z?oe.pointColor:z,q=e.pointBorderWidth,J=void 0===q?oe.pointBorderWidth:q,K=e.pointBorderColor,N=void 0===K?oe.pointBorderColor:K,Q=e.enablePointLabel,$=void 0===Q?oe.enablePointLabel:Q,_=e.pointLabel,ee=void 0===_?oe.pointLabel:_,ie=e.pointLabelYOffset,ne=e.enableGridX,re=void 0===ne?oe.enableGridX:ne,te=e.gridXValues,ae=e.enableGridY,se=void 0===ae?oe.enableGridY:ae,ue=e.gridYValues,he=e.axisTop,be=e.axisRight,ge=e.axisBottom,me=void 0===ge?oe.axisBottom:ge,ye=e.axisLeft,xe=void 0===ye?oe.axisLeft:ye,Me=e.defs,Ce=void 0===Me?oe.defs:Me,Se=e.fill,Be=void 0===Se?oe.fill:Se,we=e.markers,ke=e.legends,Te=void 0===ke?oe.legends:ke,Le=e.isInteractive,De=void 0===Le?oe.isInteractive:Le,We=e.useMesh,Ie=void 0===We?oe.useMesh:We,Fe=e.debugMesh,Ee=void 0===Fe?oe.debugMesh:Fe,Ge=e.onMouseEnter,Pe=e.onMouseMove,Oe=e.onMouseLeave,He=e.onMouseDown,Ae=e.onMouseUp,Ve=e.onClick,Ye=e.onDoubleClick,Ue=e.onTouchStart,Xe=e.onTouchMove,Re=e.onTouchEnd,ze=e.tooltip,je=void 0===ze?oe.tooltip:ze,qe=e.enableSlices,Je=void 0===qe?oe.enableSlices:qe,Ke=e.debugSlices,Ne=void 0===Ke?oe.debugSlices:Ke,Qe=e.sliceTooltip,Ze=void 0===Qe?oe.sliceTooltip:Qe,$e=e.enableCrosshair,_e=void 0===$e?oe.enableCrosshair:$e,eo=e.crosshairType,oo=void 0===eo?oe.crosshairType:eo,io=e.enableTouchCrosshair,no=void 0===io?oe.enableTouchCrosshair:io,ro=e.role,to=void 0===ro?oe.role:ro,ao=e.ariaLabel,lo=e.ariaLabelledBy,so=e.ariaDescribedBy,uo=e.isFocusable,co=void 0===uo?oe.isFocusable:uo,ho=e.pointAriaLabel,fo=e.pointAriaLabelledBy,po=e.pointAriaDescribedBy,vo=e.pointAriaHidden,bo=e.pointAriaDisabled,go=e.initialHiddenIds,mo=void 0===go?oe.initialHiddenIds:go,yo=b(p,v,f),xo=yo.margin,Mo=yo.innerWidth,Co=yo.innerHeight,So=yo.outerWidth,Bo=yo.outerHeight,wo=le({data:n,xScale:a,xFormat:l,yScale:d,yFormat:u,width:Mo,height:Co,colors:M,curve:h,areaBaselineValue:F,pointColor:j,pointBorderColor:N,enableSlices:Je,initialHiddenIds:mo}),ko=wo.legendData,To=wo.toggleSeries,Lo=wo.lineGenerator,Do=wo.areaGenerator,Wo=wo.series,Io=wo.xScale,Fo=wo.yScale,Eo=wo.slices,Go=wo.points,Po=i(null),Oo=Po[0],Ho=Po[1],Ao=i(null),Vo=Ao[0],Yo=Ao[1],Uo={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};T.includes("grid")&&(re||se)&&(Uo.grid=X(B,{width:Mo,height:Co,xScale:re?Io:null,yScale:se?Fo:null,xValues:te,yValues:ue},"grid")),T.includes("markers")&&Array.isArray(we)&&we.length>0&&(Uo.markers=X(g,{markers:we,width:Mo,height:Co,xScale:Io,yScale:Fo},"markers")),T.includes("axes")&&(Uo.axes=X(w,{xScale:Io,yScale:Fo,width:Mo,height:Co,top:he,right:be,bottom:me,left:xe},"axes")),T.includes("lines")&&(Uo.lines=X(ce,{series:Wo,lineGenerator:Lo,lineWidth:S},"lines")),T.includes("legends")&&Te.length>0&&(Uo.legends=X(t,{children:Te.map((function(e,o){return X(L,Z({},e,{containerWidth:Mo,containerHeight:Co,data:e.data||ko,toggleSerie:e.toggleSerie?To:void 0}),o)}))},"legends"));var Xo=m(Ce,Wo,Be);W&&(Uo.areas=X(de,{areaGenerator:Do,areaOpacity:P,areaBlendMode:H,series:Wo},"areas")),De&&!1!==Je&&(Uo.slices=X(fe,{slices:Eo,axis:Je,debug:Ne,tooltip:Ze,current:Vo,setCurrent:Yo,onMouseEnter:Ge,onMouseMove:Pe,onMouseLeave:Oe,onMouseDown:He,onMouseUp:Ae,onClick:Ve,onDoubleClick:Ye,onTouchStart:Ue,onTouchMove:Xe,onTouchEnd:Re},"slices")),V&&(Uo.points=X(pe,{points:Go,symbol:Y,size:R,borderWidth:J,enableLabel:$,label:ee,labelYOffset:ie,isFocusable:co,setCurrentPoint:Ho,tooltip:je,margin:xo,ariaLabel:ho,ariaLabelledBy:fo,ariaDescribedBy:po,ariaHidden:vo,ariaDisabled:bo},"points")),De&&_e&&(null!==Oo&&(Uo.crosshair=X(G,{width:Mo,height:Co,x:Oo.x,y:Oo.y,type:oo},"crosshair")),null!==Vo&&Je&&(Uo.crosshair=X(G,{width:Mo,height:Co,x:Vo.x,y:Vo.y,type:Je},"crosshair"))),De&&Ie&&!1===Je&&(Uo.mesh=X(ve,{points:Go,width:Mo,height:Co,margin:xo,setCurrent:Ho,onMouseEnter:Ge,onMouseMove:Pe,onMouseLeave:Oe,onMouseDown:He,onMouseUp:Ae,onClick:Ve,onDoubleClick:Ye,onTouchStart:Ue,onTouchMove:Xe,onTouchEnd:Re,tooltip:je,enableTouchCrosshair:no,debug:Ee},"mesh"));var Ro=o((function(){return{innerWidth:Mo,innerHeight:Co,series:Wo,slices:Eo,points:Go,xScale:Io,yScale:Fo,lineGenerator:Lo,areaGenerator:Do,currentPoint:Oo,setCurrentPoint:Ho,currentSlice:Vo,setCurrentSlice:Yo}}),[Mo,Co,Wo,Eo,Go,Io,Fo,Lo,Do,Oo,Ho,Vo,Yo]);return X(y,{defs:Xo,width:So,height:Bo,margin:xo,role:to,ariaLabel:ao,ariaLabelledBy:lo,ariaDescribedBy:so,isFocusable:co,children:T.map((function(e,o){return"function"==typeof e?X(t,{children:e(Ro)},o):Uo[e]}))})}function me(e){var o=e.isInteractive,i=void 0===o?oe.isInteractive:o,n=e.animate,r=void 0===n?oe.animate:n,t=e.motionConfig,a=void 0===t?oe.motionConfig:t,l=e.theme,s=e.renderWrapper,d=$(e,be);return X(v,{animate:r,isInteractive:i,motionConfig:a,renderWrapper:s,theme:l,children:X(ge,Z({isInteractive:i},d))})}var ye=function(e){return X(x,{children:function(o){var i=o.width,n=o.height;return X(me,Z({width:i,height:n},e))}})},xe=["isInteractive","renderWrapper","theme"],Me=function(e){var t=e.width,a=e.height,d=e.margin,u=e.pixelRatio,c=void 0===u?ie.pixelRatio:u,h=e.data,f=e.xScale,p=void 0===f?ie.xScale:f,v=e.xFormat,g=e.yScale,m=void 0===g?ie.yScale:g,y=e.yFormat,x=e.curve,B=void 0===x?ie.curve:x,w=e.layers,L=void 0===w?ie.layers:w,W=e.colors,I=void 0===W?ie.colors:W,F=e.lineWidth,G=void 0===F?ie.lineWidth:F,P=e.enableArea,O=void 0===P?ie.enableArea:P,H=e.areaBaselineValue,V=void 0===H?ie.areaBaselineValue:H,Y=e.areaOpacity,U=void 0===Y?ie.areaOpacity:Y,R=e.enablePoints,z=void 0===R?ie.enablePoints:R,j=e.pointSize,q=void 0===j?ie.pointSize:j,J=e.pointColor,$=void 0===J?ie.pointColor:J,_=e.pointBorderWidth,ee=void 0===_?ie.pointBorderWidth:_,oe=e.pointBorderColor,ne=void 0===oe?ie.pointBorderColor:oe,re=e.enableGridX,te=void 0===re?ie.enableGridX:re,ae=e.gridXValues,se=e.enableGridY,de=void 0===se?ie.enableGridY:se,ue=e.gridYValues,ce=e.axisTop,he=e.axisRight,fe=e.axisBottom,pe=void 0===fe?ie.axisBottom:fe,ve=e.axisLeft,be=void 0===ve?ie.axisLeft:ve,ge=e.legends,me=void 0===ge?ie.legends:ge,ye=e.isInteractive,xe=void 0===ye?ie.isInteractive:ye,Me=e.debugMesh,Ce=void 0===Me?ie.debugMesh:Me,Se=e.onMouseLeave,Be=e.onMouseDown,we=e.onMouseUp,ke=e.onClick,Te=e.onDoubleClick,Le=e.tooltip,De=void 0===Le?ie.tooltip:Le,We=e.forwardedRef,Ie=l(null),Fe=b(t,a,d),Ee=Fe.margin,Ge=Fe.innerWidth,Pe=Fe.innerHeight,Oe=Fe.outerWidth,He=Fe.outerHeight,Ae=A(),Ve=i(null),Ye=Ve[0],Ue=Ve[1],Xe=le({data:h,xScale:p,xFormat:v,yScale:m,yFormat:y,width:Ge,height:Pe,colors:I,curve:B,areaBaselineValue:V,pointColor:$,pointBorderColor:ne}),Re=Xe.lineGenerator,ze=Xe.areaGenerator,je=Xe.series,qe=Xe.xScale,Je=Xe.yScale,Ke=Xe.points,Ne=o((function(){return{innerWidth:Ge,innerHeight:Pe,series:je,points:Ke,xScale:qe,yScale:Je,lineWidth:G,lineGenerator:Re,areaGenerator:ze,currentPoint:Ye,setCurrentPoint:Ue}}),[Ge,Pe,je,Ke,qe,Je,G,Re,ze,Ye]),Qe=K({points:Ke,width:Ge,height:Pe,debug:Ce}),Ze=Qe.delaunay,$e=Qe.voronoi;s((function(){if(null!==Ie.current){Ie.current.width=Oe*c,Ie.current.height=He*c;var e=Ie.current.getContext("2d");e.scale(c,c),e.fillStyle=Ae.background,e.fillRect(0,0,Oe,He),e.translate(Ee.left,Ee.top),L.forEach((function(o){if("function"==typeof o&&o(e,Ne),"grid"===o&&(Ae.grid.line.strokeWidth||0)>0&&(e.lineWidth=Ae.grid.line.strokeWidth,e.strokeStyle=Ae.grid.line.stroke,te&&k(e,{width:Ge,height:Pe,scale:qe,axis:"x",values:ae}),de&&k(e,{width:Ge,height:Pe,scale:Je,axis:"y",values:ue})),"axes"===o&&T(e,{xScale:qe,yScale:Je,width:Ge,height:Pe,top:ce,right:he,bottom:pe,left:be,theme:Ae}),"areas"===o&&!0===O){e.save(),e.globalAlpha=U,ze.context(e);for(var i=je.length-1;i>=0;i--)e.fillStyle=je[i].color,e.beginPath(),ze(je[i].data.map((function(e){return e.position}))),e.fill();e.restore()}if("lines"===o&&(Re.context(e),je.forEach((function(o){e.strokeStyle=o.color,e.lineWidth=G,e.beginPath(),Re(o.data.map((function(e){return e.position}))),e.stroke()}))),"points"===o&&!0===z&&q>0&&Ke.forEach((function(o){e.fillStyle=o.color,e.beginPath(),e.arc(o.x,o.y,q/2,0,2*Math.PI),e.fill(),ee>0&&(e.strokeStyle=o.borderColor,e.lineWidth=ee,e.stroke())})),"mesh"===o&&!0===Ce&&void 0!==$e&&(N(e,$e),Ye&&Q(e,$e,Ye.absIndex)),"legends"===o){var n=je.map((function(e){return{id:e.id,label:e.id,color:e.color}})).reverse();me.forEach((function(o){D(e,Z({},o,{data:o.data||n,containerWidth:Ge,containerHeight:Pe,theme:Ae}))}))}}))}}),[Ie,Oe,He,L,Ae,Re,je,qe,Je,te,ae,de,ue,ce,he,pe,be,me,Ke,z,q,Ye]);var _e=n((function(e){if(!Ie.current)return null;var o=M(Ie.current,e),i=o[0],n=o[1];if(!C(Ee.left,Ee.top,Ge,Pe,i,n))return null;var r=Ze.find(i-Ee.left,n-Ee.top);return Ke[r]}),[Ie,Ee,Ge,Pe,Ze]),eo=E(),oo=eo.showTooltipFromEvent,io=eo.hideTooltip,no=n((function(e){var o=_e(e);Ue(o),o?oo(r(De,{point:o}),e):io()}),[_e,Ue,oo,io,De]),ro=n((function(e){io(),Ue(null),Ye&&Se&&Se(Ye,e)}),[io,Ue,Se]),to=n((function(e){if(Be){var o=_e(e);o&&Be(o,e)}}),[_e,Be]),ao=n((function(e){if(we){var o=_e(e);o&&we(o,e)}}),[_e,we]),lo=n((function(e){if(ke){var o=_e(e);o&&ke(o,e)}}),[_e,ke]),so=n((function(e){if(Te){var o=_e(e);o&&Te(o,e)}}),[_e,Te]);return X("canvas",{ref:S(Ie,We),width:Oe*c,height:He*c,style:{width:Oe,height:He,cursor:xe?"auto":"normal"},onMouseEnter:xe?no:void 0,onMouseMove:xe?no:void 0,onMouseLeave:xe?ro:void 0,onMouseDown:xe?to:void 0,onMouseUp:xe?ao:void 0,onClick:xe?lo:void 0,onDoubleClick:xe?so:void 0})},Ce=a((function(e,o){var i=e.isInteractive,n=e.renderWrapper,r=e.theme,t=$(e,xe);return X(v,{isInteractive:i,renderWrapper:n,theme:r,animate:!1,children:X(Me,Z({},t,{forwardedRef:o}))})}));var Se=a((function(e,o){return X(x,{children:function(i){var n=i.width,r=i.height;return X(Ce,Z({width:n,height:r},e,{ref:o}))}})}));function Be(e){return void 0!==e.seriesId}function we(e){return void 0!==e.points}export{ae as LINE_UNIQUE_ID_PREFIX,me as Line,Ce as LineCanvas,ye as ResponsiveLine,Se as ResponsiveLineCanvas,ie as canvasDefaultProps,ee as commonDefaultProps,Be as isPoint,we as isSliceData,oe as svgDefaultProps,re as useAreaGenerator,le as useLine,ne as useLineGenerator,te as useSlices}; | ||
| import{memo as e,useMemo as o,useState as i,useCallback as n,createElement as r,Fragment as t,forwardRef as a,useRef as l,useEffect as s}from"react";import{curveFromProp as d,useValueFormatter as u,useMotionConfig as c,useAnimatedPath as h,getLabelGenerator as f,DotsItem as p,Container as v,useDimensions as b,CartesianMarkers as g,bindDefs as m,SvgWrapper as y,ResponsiveWrapper as x,getRelativeCursor as M,isCursorInRect as C,mergeRefs as S}from"@nivo/core";import{Grid as B,Axes as w,renderGridLinesToCanvas as k,renderAxesToCanvas as T}from"@nivo/axes";import{BoxLegendSvg as L,renderLegendToCanvas as D}from"@nivo/legends";import{BasicTooltip as W,TableTooltip as I,Chip as F,useTooltip as E,Crosshair as G}from"@nivo/tooltip";import{line as P,area as O}from"d3-shape";import H from"lodash/uniqueId.js";import{useTheme as A}from"@nivo/theming";import{useOrdinalColorScale as V,useInheritedColor as Y}from"@nivo/colors";import{computeXYScalesForSeries as U}from"@nivo/scales";import{jsx as X,jsxs as R,Fragment as z}from"react/jsx-runtime";import{useSpring as j,animated as q}from"@react-spring/web";import{Mesh as J,useVoronoiMesh as K,renderVoronoiToCanvas as N,renderVoronoiCellToCanvas as Q}from"@nivo/voronoi";function Z(){return Z=Object.assign?Object.assign.bind():function(e){for(var o=1;o<arguments.length;o++){var i=arguments[o];for(var n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},Z.apply(null,arguments)}function $(e,o){if(null==e)return{};var i={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==o.indexOf(n))continue;i[n]=e[n]}return i}var _,ee={xScale:{type:"point"},yScale:{type:"linear",min:0,max:"auto"},curve:"linear",colors:{scheme:"nivo"},lineWidth:2,layers:["grid","markers","axes","areas","crosshair","lines","points","slices","mesh","legends"],enablePoints:!0,pointSize:6,pointColor:{from:"series.color"},pointBorderWidth:0,pointBorderColor:{theme:"background"},enableArea:!1,areaBaselineValue:0,areaOpacity:.2,enableGridX:!0,enableGridY:!0,legends:[],isInteractive:!0,tooltip:e((function(e){var o=e.point;return X(W,{id:R("span",{children:["x: ",X("strong",{children:o.data.xFormatted}),", y:"," ",X("strong",{children:o.data.yFormatted})]}),enableChip:!0,color:o.seriesColor})})),sliceTooltip:e((function(e){var o=e.slice,i=e.axis,n=A(),r="x"===i?"y":"x";return X(I,{rows:o.points.map((function(e){return[X(F,{color:e.seriesColor,style:n.tooltip.chip},"chip"),e.seriesId,X("span",{style:n.tooltip.tableCellValue,children:e.data[r+"Formatted"]},"value")]}))})})),debugMesh:!1,renderWrapper:!0},oe=Z({},ee,{defs:[],fill:[],enablePointLabel:!1,pointLabel:"data.yFormatted",areaBlendMode:"normal",axisBottom:{},axisLeft:{},useMesh:!1,enableSlices:!1,debugSlices:!1,enableCrosshair:!0,crosshairType:"bottom-left",enableTouchCrosshair:!1,initialHiddenIds:[],animate:!0,motionConfig:"gentle",role:"img",isFocusable:!1}),ie=Z({},ee,{pixelRatio:"undefined"!=typeof window&&null!=(_=window.devicePixelRatio)?_:1,axisBottom:{},axisLeft:{}});function ne(e){return o((function(){return P().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y((function(e){return e.y})).curve(d(e))}),[e])}function re(e){var i=e.curve,n=e.yScale,r=e.areaBaselineValue;return o((function(){return O().defined((function(e){return null!==e.x&&null!==e.y})).x((function(e){return e.x})).y1((function(e){return e.y})).curve(d(i)).y0(n(r))}),[i,n,r])}var te=function(e){var i=e.componentId,n=e.enableSlices,r=e.points,t=e.width,a=e.height;return o((function(){if("x"===n){var e=new Map;return r.forEach((function(o){null!==o.data.x&&null!==o.data.y&&(e.has(o.x)?e.get(o.x).push(o):e.set(o.x,[o]))})),Array.from(e.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,n){var r,l,s=e[0],d=e[1],u=n[o-1],c=n[o+1];return r=u?s-(s-u[0])/2:s,l=c?s-r+(c[0]-s)/2:t-r,{id:"slice:"+i+":"+s,x0:r,x:s,y0:0,y:0,width:l,height:a,points:d.reverse()}}))}if("y"===n){var o=new Map;return r.forEach((function(e){null!==e.data.x&&null!==e.data.y&&(o.has(e.y)?o.get(e.y).push(e):o.set(e.y,[e]))})),Array.from(o.entries()).sort((function(e,o){return e[0]-o[0]})).map((function(e,o,i){var n,r,l=e[0],s=e[1],d=i[o-1],u=i[o+1];return n=d?l-(l-d[0])/2:l,r=u?l-n+(u[0]-l)/2:a-n,{id:l,x0:0,x:0,y0:n,y:l,width:t,height:r,points:s.reverse()}}))}return[]}),[i,n,a,r,t])},ae="line",le=function(e){var r=e.data,t=e.xScale,a=void 0===t?ee.xScale:t,l=e.xFormat,s=e.yScale,d=void 0===s?ee.yScale:s,c=e.yFormat,h=e.width,f=e.height,p=e.colors,v=void 0===p?ee.colors:p,b=e.curve,g=void 0===b?ee.curve:b,m=e.areaBaselineValue,y=void 0===m?ee.areaBaselineValue:m,x=e.pointColor,M=void 0===x?ee.pointColor:x,C=e.pointBorderColor,S=void 0===C?ee.pointBorderColor:C,B=e.enableSlices,w=void 0===B?oe.enableSlices:B,k=e.initialHiddenIds,T=void 0===k?oe.initialHiddenIds:k,L=i(H(ae))[0],D=u(l),W=u(c),I=V(v,"id"),F=A(),E=Y(M,F),G=Y(S,F),P=i(null!=T?T:[]),O=P[0],X=P[1],R=o((function(){return U(r.filter((function(e){return-1===O.indexOf(e.id)})),a,d,h,f)}),[r,O,a,d,h,f]),z=R.xScale,j=R.yScale,q=R.series,J=o((function(){var e=r.map((function(e){return{id:e.id,label:""+e.id,color:I(e)}})),o=e.map((function(e){return Z({},q.find((function(o){return o.id===e.id})),{color:e.color})})).filter((function(e){return Boolean(e.id)}));return{legendData:e.map((function(e){return Z({},e,{hidden:!o.find((function(o){return o.id===e.id}))})})).reverse(),series:o}}),[r,q,I]),K=J.legendData,N=J.series,Q=n((function(e){X((function(o){return o.indexOf(e)>-1?o.filter((function(o){return o!==e})):[].concat(o,[e])}))}),[]),$=function(e){var i=e.series,n=e.getPointColor,r=e.getPointBorderColor,t=e.formatX,a=e.formatY;return o((function(){return i.reduce((function(e,o,i){return[].concat(e,o.data.filter((function(e){return null!==e.position.x&&null!==e.position.y})).map((function(l,s){var d={id:o.id+"."+s,indexInSeries:s,absIndex:e.length+s,seriesIndex:i,seriesId:o.id,seriesColor:o.color,x:l.position.x,y:l.position.y,data:Z({},l.data,{xFormatted:t(l.data.x),yFormatted:a(l.data.y)})};return d.color=n({series:o,point:d}),d.borderColor=r(d),d})))}),[])}),[i,n,r,t,a])}({series:N,getPointColor:E,getPointBorderColor:G,formatX:D,formatY:W}),_=te({componentId:L,enableSlices:w,points:$,width:h,height:f});return{legendData:K,toggleSeries:Q,lineGenerator:ne(g),areaGenerator:re({curve:g,yScale:j,areaBaselineValue:y}),getColor:I,series:N,xScale:z,yScale:j,slices:_,points:$}},se=function(e){var o=e.areaBlendMode,i=e.areaOpacity,n=e.color,r=e.fill,t=e.path,a=c(),l=a.animate,s=a.config,d=h(t),u=j({color:n,config:s,immediate:!l});return X(q.path,{d:d,fill:r||u.color,fillOpacity:i,strokeWidth:0,style:{mixBlendMode:o}})},de=e((function(e){var o=e.areaGenerator,i=e.areaOpacity,n=e.areaBlendMode,r=e.series.slice(0).reverse();return X("g",{children:r.map((function(e){return X(se,Z({path:o(e.data.map((function(e){return e.position})))},Z({areaOpacity:i,areaBlendMode:n},e)),""+e.id)}))})})),ue=e((function(e){var i=e.lineGenerator,n=e.points,r=e.color,t=e.thickness,a=o((function(){return i(n)}),[i,n]),l=h(a);return X(q.path,{d:l,fill:"none",strokeWidth:t,stroke:r})})),ce=e((function(e){var o=e.series,i=e.lineGenerator,n=e.lineWidth;return X(z,{children:o.slice(0).reverse().map((function(e){var o=e.id,r=e.data,t=e.color;return X(ue,{points:r.map((function(e){return e.position})),lineGenerator:i,color:t,thickness:n},o)}))})})),he=e((function(e){var o=e.slice,i=e.slices,t=e.axis,a=e.debug,l=e.tooltip,s=e.isCurrent,d=e.setCurrent,u=e.onMouseEnter,c=e.onMouseMove,h=e.onMouseLeave,f=e.onMouseDown,p=e.onMouseUp,v=e.onClick,b=e.onDoubleClick,g=e.onTouchStart,m=e.onTouchMove,y=e.onTouchEnd,x=E(),M=x.showTooltipFromEvent,C=x.hideTooltip,S=n((function(e){M(r(l,{slice:o,axis:t}),e,"right"),d(o),u&&u(o,e)}),[M,l,o,t,d,u]),B=n((function(e){M(r(l,{slice:o,axis:t}),e,"right"),c&&c(o,e)}),[M,l,o,t,c]),w=n((function(e){C(),d(null),h&&h(o,e)}),[C,d,h,o]),k=n((function(e){f&&f(o,e)}),[o,f]),T=n((function(e){p&&p(o,e)}),[o,p]),L=n((function(e){v&&v(o,e)}),[o,v]),D=n((function(e){b&&b(o,e)}),[o,b]),W=n((function(e){M(r(l,{slice:o,axis:t}),e,"right"),d(o),g&&g(o,e)}),[t,g,d,M,o,l]),I=n((function(e){var n=e.touches[0],a=document.elementFromPoint(n.clientX,n.clientY),s=null==a?void 0:a.getAttribute("data-ref");if(s){var u=i.find((function(e){return e.id===s}));u&&(M(r(l,{slice:u,axis:t}),e,"right"),d(u))}m&&m(o,e)}),[t,m,d,M,o,i,l]),F=n((function(e){C(),d(null),y&&y(o,e)}),[C,d,y,o]);return X("rect",{x:o.x0,y:o.y0,width:o.width,height:o.height,stroke:"red",strokeWidth:a?1:0,strokeOpacity:.75,fill:"red",fillOpacity:s&&a?.35:0,onMouseEnter:S,onMouseMove:B,onMouseLeave:w,onMouseDown:k,onMouseUp:T,onClick:L,onDoubleClick:D,onTouchStart:W,onTouchMove:I,onTouchEnd:F,"data-ref":o.id})})),fe=e((function(e){var o=e.slices,i=e.axis,n=e.debug,r=e.tooltip,t=e.current,a=e.setCurrent,l=e.onMouseEnter,s=e.onMouseMove,d=e.onMouseLeave,u=e.onMouseDown,c=e.onMouseUp,h=e.onClick,f=e.onDoubleClick,p=e.onTouchStart,v=e.onTouchMove,b=e.onTouchEnd;return X(z,{children:o.map((function(e){return X(he,{slice:e,slices:o,axis:i,debug:n,tooltip:r,setCurrent:a,isCurrent:null!==t&&t.id===e.id,onMouseEnter:l,onMouseMove:s,onMouseLeave:d,onMouseDown:u,onMouseUp:c,onClick:h,onDoubleClick:f,onTouchStart:p,onTouchMove:v,onTouchEnd:b},e.id)}))})})),pe=e((function(e){var o=e.points,i=e.symbol,n=e.size,t=e.borderWidth,a=e.enableLabel,l=e.label,s=e.labelYOffset,d=e.isFocusable,u=e.setCurrentPoint,c=e.tooltip,h=e.margin,v=e.ariaLabel,b=e.ariaLabelledBy,g=e.ariaDescribedBy,m=e.ariaHidden,y=e.ariaDisabled,x=f(l),M=E(),C=M.showTooltipAt,S=M.hideTooltip,B=o.slice(0).sort((function(e,o){return e.indexInSeries-o.indexInSeries})).sort((function(e,o){return o.seriesIndex-e.seriesIndex})).map((function(e){return{id:e.id,x:e.x,y:e.y,datum:e.data,fill:e.color,stroke:e.borderColor,label:a?x(e):null,ariaLabel:v?v(e):void 0,ariaLabelledBy:b?b(e):void 0,ariaDescribedBy:g?g(e):void 0,ariaHidden:m?m(e):void 0,ariaDisabled:y?y(e):void 0,onFocus:d?function(){u(e),C(r(c,{point:e}),[h.left+e.x,h.top+e.y],"top")}:void 0,onBlur:d?function(){u(null),S()}:void 0}}));return X("g",{children:B.map((function(e){return X(p,{x:e.x,y:e.y,datum:e.datum,symbol:i,size:n,color:e.fill,borderWidth:t,borderColor:e.stroke,label:e.label,labelYOffset:s,ariaLabel:e.ariaLabel,ariaLabelledBy:e.ariaLabelledBy,ariaDescribedBy:e.ariaDescribedBy,ariaHidden:e.ariaHidden,ariaDisabled:e.ariaDisabled,isFocusable:d,onFocus:e.onFocus,onBlur:e.onBlur,testId:"line.point."+e.id},e.id)}))})})),ve=e((function(e){var o=e.points,i=e.width,t=e.height,a=e.margin,l=e.setCurrent,s=e.onMouseEnter,d=e.onMouseMove,u=e.onMouseLeave,c=e.onMouseDown,h=e.onMouseUp,f=e.onClick,p=e.onDoubleClick,v=e.onTouchStart,b=e.onTouchMove,g=e.onTouchEnd,m=e.tooltip,y=e.debug,x=e.enableTouchCrosshair,M=E(),C=M.showTooltipAt,S=M.hideTooltip,B=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),s&&s(e,o)}),[C,m,s,a]),w=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),d&&d(e,o)}),[C,m,a.left,a.top,d]),k=n((function(e,o){S(),u&&u(e,o)}),[S,u]),T=n((function(e,o){c&&c(e,o)}),[c]),L=n((function(e,o){h&&h(e,o)}),[h]),D=n((function(e,o){f&&f(e,o)}),[f]),W=n((function(e,o){p&&p(e,o)}),[p]),I=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),v&&v(e,o)}),[a.left,a.top,v,C,m]),F=n((function(e,o){C(r(m,{point:e}),[e.x+a.left,e.y+a.top],"top"),b&&b(e,o)}),[a.left,a.top,b,C,m]),G=n((function(e,o){S(),g&&g(e,o)}),[g,S]);return X(J,{nodes:o,width:i,height:t,setCurrent:l,onMouseEnter:B,onMouseMove:w,onMouseLeave:k,onMouseDown:T,onMouseUp:L,onClick:D,onDoubleClick:W,onTouchStart:I,onTouchMove:F,onTouchEnd:G,enableTouchCrosshair:x,debug:y})})),be=["isInteractive","animate","motionConfig","theme","renderWrapper"];function ge(e){var o=e.data,n=e.xScale,r=void 0===n?oe.xScale:n,a=e.xFormat,l=e.yScale,s=void 0===l?oe.yScale:l,d=e.yFormat,u=e.curve,c=void 0===u?oe.curve:u,h=e.margin,f=e.width,p=e.height,v=e.colors,x=void 0===v?oe.colors:v,M=e.lineWidth,C=void 0===M?oe.lineWidth:M,S=e.layers,k=void 0===S?oe.layers:S,T=e.enableArea,D=void 0===T?oe.enableArea:T,W=e.areaBaselineValue,I=void 0===W?oe.areaBaselineValue:W,F=e.areaOpacity,E=void 0===F?oe.areaOpacity:F,P=e.areaBlendMode,O=void 0===P?oe.areaBlendMode:P,H=e.enablePoints,A=void 0===H?oe.enablePoints:H,V=e.pointSymbol,Y=e.pointSize,U=void 0===Y?oe.pointSize:Y,R=e.pointColor,z=void 0===R?oe.pointColor:R,j=e.pointBorderWidth,q=void 0===j?oe.pointBorderWidth:j,J=e.pointBorderColor,K=void 0===J?oe.pointBorderColor:J,N=e.enablePointLabel,Q=void 0===N?oe.enablePointLabel:N,$=e.pointLabel,_=void 0===$?oe.pointLabel:$,ee=e.pointLabelYOffset,ie=e.enableGridX,ne=void 0===ie?oe.enableGridX:ie,re=e.gridXValues,te=e.enableGridY,ae=void 0===te?oe.enableGridY:te,se=e.gridYValues,ue=e.axisTop,he=e.axisRight,be=e.axisBottom,ge=void 0===be?oe.axisBottom:be,me=e.axisLeft,ye=void 0===me?oe.axisLeft:me,xe=e.defs,Me=void 0===xe?oe.defs:xe,Ce=e.fill,Se=void 0===Ce?oe.fill:Ce,Be=e.markers,we=e.legends,ke=void 0===we?oe.legends:we,Te=e.isInteractive,Le=void 0===Te?oe.isInteractive:Te,De=e.useMesh,We=void 0===De?oe.useMesh:De,Ie=e.debugMesh,Fe=void 0===Ie?oe.debugMesh:Ie,Ee=e.onMouseEnter,Ge=e.onMouseMove,Pe=e.onMouseLeave,Oe=e.onMouseDown,He=e.onMouseUp,Ae=e.onClick,Ve=e.onDoubleClick,Ye=e.onTouchStart,Ue=e.onTouchMove,Xe=e.onTouchEnd,Re=e.tooltip,ze=void 0===Re?oe.tooltip:Re,je=e.enableSlices,qe=void 0===je?oe.enableSlices:je,Je=e.debugSlices,Ke=void 0===Je?oe.debugSlices:Je,Ne=e.sliceTooltip,Qe=void 0===Ne?oe.sliceTooltip:Ne,Ze=e.enableCrosshair,$e=void 0===Ze?oe.enableCrosshair:Ze,_e=e.crosshairType,eo=void 0===_e?oe.crosshairType:_e,oo=e.enableTouchCrosshair,io=void 0===oo?oe.enableTouchCrosshair:oo,no=e.role,ro=void 0===no?oe.role:no,to=e.ariaLabel,ao=e.ariaLabelledBy,lo=e.ariaDescribedBy,so=e.isFocusable,uo=void 0===so?oe.isFocusable:so,co=e.pointAriaLabel,ho=e.pointAriaLabelledBy,fo=e.pointAriaDescribedBy,po=e.pointAriaHidden,vo=e.pointAriaDisabled,bo=e.initialHiddenIds,go=void 0===bo?oe.initialHiddenIds:bo,mo=b(f,p,h),yo=mo.margin,xo=mo.innerWidth,Mo=mo.innerHeight,Co=mo.outerWidth,So=mo.outerHeight,Bo=le({data:o,xScale:r,xFormat:a,yScale:s,yFormat:d,width:xo,height:Mo,colors:x,curve:c,areaBaselineValue:I,pointColor:z,pointBorderColor:K,enableSlices:qe,initialHiddenIds:go}),wo=Bo.legendData,ko=Bo.toggleSeries,To=Bo.lineGenerator,Lo=Bo.areaGenerator,Do=Bo.series,Wo=Bo.xScale,Io=Bo.yScale,Fo=Bo.slices,Eo=Bo.points,Go=i(null),Po=Go[0],Oo=Go[1],Ho=i(null),Ao=Ho[0],Vo=Ho[1],Yo={grid:null,markers:null,axes:null,areas:null,crosshair:null,lines:null,points:null,slices:null,mesh:null,legends:null};k.includes("grid")&&(ne||ae)&&(Yo.grid=X(B,{width:xo,height:Mo,xScale:ne?Wo:null,yScale:ae?Io:null,xValues:re,yValues:se},"grid")),k.includes("markers")&&Array.isArray(Be)&&Be.length>0&&(Yo.markers=X(g,{markers:Be,width:xo,height:Mo,xScale:Wo,yScale:Io},"markers")),k.includes("axes")&&(Yo.axes=X(w,{xScale:Wo,yScale:Io,width:xo,height:Mo,top:ue,right:he,bottom:ge,left:ye},"axes")),k.includes("lines")&&(Yo.lines=X(ce,{series:Do,lineGenerator:To,lineWidth:C},"lines")),k.includes("legends")&&ke.length>0&&(Yo.legends=X(t,{children:ke.map((function(e,o){return X(L,Z({},e,{containerWidth:xo,containerHeight:Mo,data:e.data||wo,toggleSerie:e.toggleSerie?ko:void 0}),o)}))},"legends"));var Uo=m(Me,Do,Se);D&&(Yo.areas=X(de,{areaGenerator:Lo,areaOpacity:E,areaBlendMode:O,series:Do},"areas")),Le&&!1!==qe&&(Yo.slices=X(fe,{slices:Fo,axis:qe,debug:Ke,tooltip:Qe,current:Ao,setCurrent:Vo,onMouseEnter:Ee,onMouseMove:Ge,onMouseLeave:Pe,onMouseDown:Oe,onMouseUp:He,onClick:Ae,onDoubleClick:Ve,onTouchStart:Ye,onTouchMove:Ue,onTouchEnd:Xe},"slices")),A&&(Yo.points=X(pe,{points:Eo,symbol:V,size:U,borderWidth:q,enableLabel:Q,label:_,labelYOffset:ee,isFocusable:uo,setCurrentPoint:Oo,tooltip:ze,margin:yo,ariaLabel:co,ariaLabelledBy:ho,ariaDescribedBy:fo,ariaHidden:po,ariaDisabled:vo},"points")),Le&&$e&&(null!==Po&&(Yo.crosshair=X(G,{width:xo,height:Mo,x:Po.x,y:Po.y,type:eo},"crosshair")),null!==Ao&&qe&&(Yo.crosshair=X(G,{width:xo,height:Mo,x:Ao.x,y:Ao.y,type:qe},"crosshair"))),Le&&We&&!1===qe&&(Yo.mesh=X(ve,{points:Eo,width:xo,height:Mo,margin:yo,setCurrent:Oo,onMouseEnter:Ee,onMouseMove:Ge,onMouseLeave:Pe,onMouseDown:Oe,onMouseUp:He,onClick:Ae,onDoubleClick:Ve,onTouchStart:Ye,onTouchMove:Ue,onTouchEnd:Xe,tooltip:ze,enableTouchCrosshair:io,debug:Fe},"mesh"));var Xo=Z({},e,{innerWidth:xo,innerHeight:Mo,series:Do,slices:Fo,points:Eo,xScale:Wo,yScale:Io,lineGenerator:To,areaGenerator:Lo,currentPoint:Po,setCurrentPoint:Oo,currentSlice:Ao,setCurrentSlice:Vo});return X(y,{defs:Uo,width:Co,height:So,margin:yo,role:ro,ariaLabel:to,ariaLabelledBy:ao,ariaDescribedBy:lo,isFocusable:uo,children:k.map((function(e,o){return"function"==typeof e?X(t,{children:e(Xo)},o):Yo[e]}))})}function me(e){var o=e.isInteractive,i=void 0===o?oe.isInteractive:o,n=e.animate,r=void 0===n?oe.animate:n,t=e.motionConfig,a=void 0===t?oe.motionConfig:t,l=e.theme,s=e.renderWrapper,d=$(e,be);return X(v,{animate:r,isInteractive:i,motionConfig:a,renderWrapper:s,theme:l,children:X(ge,Z({isInteractive:i},d))})}var ye=function(e){return X(x,{children:function(o){var i=o.width,n=o.height;return X(me,Z({width:i,height:n},e))}})},xe=["isInteractive","renderWrapper","theme"],Me=function(e){var t=e.width,a=e.height,d=e.margin,u=e.pixelRatio,c=void 0===u?ie.pixelRatio:u,h=e.data,f=e.xScale,p=void 0===f?ie.xScale:f,v=e.xFormat,g=e.yScale,m=void 0===g?ie.yScale:g,y=e.yFormat,x=e.curve,B=void 0===x?ie.curve:x,w=e.layers,L=void 0===w?ie.layers:w,W=e.colors,I=void 0===W?ie.colors:W,F=e.lineWidth,G=void 0===F?ie.lineWidth:F,P=e.enableArea,O=void 0===P?ie.enableArea:P,H=e.areaBaselineValue,V=void 0===H?ie.areaBaselineValue:H,Y=e.areaOpacity,U=void 0===Y?ie.areaOpacity:Y,R=e.enablePoints,z=void 0===R?ie.enablePoints:R,j=e.pointSize,q=void 0===j?ie.pointSize:j,J=e.pointColor,$=void 0===J?ie.pointColor:J,_=e.pointBorderWidth,ee=void 0===_?ie.pointBorderWidth:_,oe=e.pointBorderColor,ne=void 0===oe?ie.pointBorderColor:oe,re=e.enableGridX,te=void 0===re?ie.enableGridX:re,ae=e.gridXValues,se=e.enableGridY,de=void 0===se?ie.enableGridY:se,ue=e.gridYValues,ce=e.axisTop,he=e.axisRight,fe=e.axisBottom,pe=void 0===fe?ie.axisBottom:fe,ve=e.axisLeft,be=void 0===ve?ie.axisLeft:ve,ge=e.legends,me=void 0===ge?ie.legends:ge,ye=e.isInteractive,xe=void 0===ye?ie.isInteractive:ye,Me=e.debugMesh,Ce=void 0===Me?ie.debugMesh:Me,Se=e.onMouseLeave,Be=e.onMouseDown,we=e.onMouseUp,ke=e.onClick,Te=e.onDoubleClick,Le=e.tooltip,De=void 0===Le?ie.tooltip:Le,We=e.forwardedRef,Ie=l(null),Fe=b(t,a,d),Ee=Fe.margin,Ge=Fe.innerWidth,Pe=Fe.innerHeight,Oe=Fe.outerWidth,He=Fe.outerHeight,Ae=A(),Ve=i(null),Ye=Ve[0],Ue=Ve[1],Xe=le({data:h,xScale:p,xFormat:v,yScale:m,yFormat:y,width:Ge,height:Pe,colors:I,curve:B,areaBaselineValue:V,pointColor:$,pointBorderColor:ne}),Re=Xe.lineGenerator,ze=Xe.areaGenerator,je=Xe.series,qe=Xe.xScale,Je=Xe.yScale,Ke=Xe.points,Ne=o((function(){return{innerWidth:Ge,innerHeight:Pe,series:je,points:Ke,xScale:qe,yScale:Je,lineWidth:G,lineGenerator:Re,areaGenerator:ze,currentPoint:Ye,setCurrentPoint:Ue}}),[Ge,Pe,je,Ke,qe,Je,G,Re,ze,Ye]),Qe=K({points:Ke,width:Ge,height:Pe,debug:Ce}),Ze=Qe.delaunay,$e=Qe.voronoi;s((function(){if(null!==Ie.current){Ie.current.width=Oe*c,Ie.current.height=He*c;var e=Ie.current.getContext("2d");e.scale(c,c),e.fillStyle=Ae.background,e.fillRect(0,0,Oe,He),e.translate(Ee.left,Ee.top),L.forEach((function(o){if("function"==typeof o&&o(e,Ne),"grid"===o&&(Ae.grid.line.strokeWidth||0)>0&&(e.lineWidth=Ae.grid.line.strokeWidth,e.strokeStyle=Ae.grid.line.stroke,te&&k(e,{width:Ge,height:Pe,scale:qe,axis:"x",values:ae}),de&&k(e,{width:Ge,height:Pe,scale:Je,axis:"y",values:ue})),"axes"===o&&T(e,{xScale:qe,yScale:Je,width:Ge,height:Pe,top:ce,right:he,bottom:pe,left:be,theme:Ae}),"areas"===o&&!0===O){e.save(),e.globalAlpha=U,ze.context(e);for(var i=je.length-1;i>=0;i--)e.fillStyle=je[i].color,e.beginPath(),ze(je[i].data.map((function(e){return e.position}))),e.fill();e.restore()}if("lines"===o&&(Re.context(e),je.forEach((function(o){e.strokeStyle=o.color,e.lineWidth=G,e.beginPath(),Re(o.data.map((function(e){return e.position}))),e.stroke()}))),"points"===o&&!0===z&&q>0&&Ke.forEach((function(o){e.fillStyle=o.color,e.beginPath(),e.arc(o.x,o.y,q/2,0,2*Math.PI),e.fill(),ee>0&&(e.strokeStyle=o.borderColor,e.lineWidth=ee,e.stroke())})),"mesh"===o&&!0===Ce&&void 0!==$e&&(N(e,$e),Ye&&Q(e,$e,Ye.absIndex)),"legends"===o){var n=je.map((function(e){return{id:e.id,label:e.id,color:e.color}})).reverse();me.forEach((function(o){D(e,Z({},o,{data:o.data||n,containerWidth:Ge,containerHeight:Pe,theme:Ae}))}))}}))}}),[Ie,Oe,He,L,Ae,Re,je,qe,Je,te,ae,de,ue,ce,he,pe,be,me,Ke,z,q,Ye]);var _e=n((function(e){if(!Ie.current)return null;var o=M(Ie.current,e),i=o[0],n=o[1];if(!C(Ee.left,Ee.top,Ge,Pe,i,n))return null;var r=Ze.find(i-Ee.left,n-Ee.top);return Ke[r]}),[Ie,Ee,Ge,Pe,Ze]),eo=E(),oo=eo.showTooltipFromEvent,io=eo.hideTooltip,no=n((function(e){var o=_e(e);Ue(o),o?oo(r(De,{point:o}),e):io()}),[_e,Ue,oo,io,De]),ro=n((function(e){io(),Ue(null),Ye&&Se&&Se(Ye,e)}),[io,Ue,Se]),to=n((function(e){if(Be){var o=_e(e);o&&Be(o,e)}}),[_e,Be]),ao=n((function(e){if(we){var o=_e(e);o&&we(o,e)}}),[_e,we]),lo=n((function(e){if(ke){var o=_e(e);o&&ke(o,e)}}),[_e,ke]),so=n((function(e){if(Te){var o=_e(e);o&&Te(o,e)}}),[_e,Te]);return X("canvas",{ref:S(Ie,We),width:Oe*c,height:He*c,style:{width:Oe,height:He,cursor:xe?"auto":"normal"},onMouseEnter:xe?no:void 0,onMouseMove:xe?no:void 0,onMouseLeave:xe?ro:void 0,onMouseDown:xe?to:void 0,onMouseUp:xe?ao:void 0,onClick:xe?lo:void 0,onDoubleClick:xe?so:void 0})},Ce=a((function(e,o){var i=e.isInteractive,n=e.renderWrapper,r=e.theme,t=$(e,xe);return X(v,{isInteractive:i,renderWrapper:n,theme:r,animate:!1,children:X(Me,Z({},t,{forwardedRef:o}))})}));var Se=a((function(e,o){return X(x,{children:function(i){var n=i.width,r=i.height;return X(Ce,Z({width:n,height:r},e,{ref:o}))}})}));function Be(e){return void 0!==e.seriesId}function we(e){return void 0!==e.points}export{ae as LINE_UNIQUE_ID_PREFIX,me as Line,Ce as LineCanvas,ye as ResponsiveLine,Se as ResponsiveLineCanvas,ie as canvasDefaultProps,ee as commonDefaultProps,Be as isPoint,we as isSliceData,oe as svgDefaultProps,re as useAreaGenerator,le as useLine,ne as useLineGenerator,te as useSlices}; | ||
| //# sourceMappingURL=nivo-line.mjs.map |
@@ -14,3 +14,3 @@ import { FunctionComponent, MouseEvent, TouchEvent, AriaAttributes } from 'react'; | ||
| id: AllowedSeriesId; | ||
| data: { | ||
| data: readonly { | ||
| x: AllowedValue; | ||
@@ -24,3 +24,3 @@ y: AllowedValue; | ||
| export type InferX<T> = T extends { | ||
| data: Array<infer D>; | ||
| data: ReadonlyArray<infer D>; | ||
| } ? D extends { | ||
@@ -30,3 +30,3 @@ x: infer X; | ||
| export type InferY<T> = T extends { | ||
| data: Array<infer D>; | ||
| data: ReadonlyArray<infer D>; | ||
| } ? D extends { | ||
@@ -37,3 +37,3 @@ y: infer Y; | ||
| id: string; | ||
| data: { | ||
| data: readonly { | ||
| x: string | null; | ||
@@ -50,7 +50,7 @@ y: number | null; | ||
| } | ||
| export interface ComputedSeries<Series extends LineSeries> { | ||
| export type ComputedSeries<Series extends LineSeries> = Omit<Series, 'data' | 'id'> & { | ||
| id: InferSeriesId<Series>; | ||
| data: readonly ComputedDatum<Series>[]; | ||
| color: string; | ||
| } | ||
| }; | ||
| export interface Point<Series extends LineSeries> { | ||
@@ -84,3 +84,3 @@ id: string; | ||
| height: number; | ||
| points: Point<Series>[]; | ||
| points: readonly Point<Series>[]; | ||
| } | ||
@@ -125,7 +125,7 @@ export type PointOrSliceData<Series extends LineSeries> = Point<Series> | SliceData<Series>; | ||
| } | ||
| export interface LineCustomSvgLayerProps<Series extends LineSeries> extends CommonCustomLayerProps<Series> { | ||
| export type LineCustomSvgLayerProps<Series extends LineSeries> = Omit<LineSvgPropsWithDefaults<Series>, 'xScale' | 'yScale'> & CommonCustomLayerProps<Series> & { | ||
| slices: readonly SliceData<Series>[]; | ||
| currentSlice: SliceData<Series> | null; | ||
| setCurrentSlice: (slice: SliceData<Series> | null) => void; | ||
| } | ||
| }; | ||
| export type LineCustomSvgLayer<Series extends LineSeries> = FunctionComponent<LineCustomSvgLayerProps<Series>>; | ||
@@ -132,0 +132,0 @@ export type LineSvgLayer<Series extends LineSeries> = LineLayerId | LineCustomSvgLayer<Series>; |
+5
-5
| { | ||
| "name": "@nivo/line", | ||
| "version": "0.92.0", | ||
| "version": "0.92.1", | ||
| "license": "MIT", | ||
@@ -40,7 +40,7 @@ "author": { | ||
| "@nivo/annotations": "0.92.0", | ||
| "@nivo/axes": "0.92.0", | ||
| "@nivo/axes": "0.92.1", | ||
| "@nivo/colors": "0.92.0", | ||
| "@nivo/core": "0.92.0", | ||
| "@nivo/legends": "0.92.0", | ||
| "@nivo/scales": "0.92.0", | ||
| "@nivo/legends": "0.92.1", | ||
| "@nivo/scales": "0.92.1", | ||
| "@nivo/theming": "0.92.0", | ||
@@ -59,3 +59,3 @@ "@nivo/tooltip": "0.92.0", | ||
| }, | ||
| "gitHead": "21dcc7f512262e41fe1ea2ad920f03ed46c9a9b6" | ||
| "gitHead": "50486cdc630eed6680b5b51d2f419f1869c184f5" | ||
| } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
387872
0.3%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated