harshapitla/stackoverflow
0
1"use strict";(self.webpackChunkreact_template=self.webpackChunkreact_template||[]).push([[859],{5748:(e,t,r)=>{r.d(t,{b:()=>l});var n=r(5043),a=r(1603),i=r(6218),o=["axis"],l=(0,n.forwardRef)((e,t)=>n.createElement(i.P,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:o,tooltipPayloadSearcher:a.uN,categoricalChartProps:e,ref:t}))},8676:(e,t,r)=>{r.d(t,{N:()=>we,l:()=>Ee});var n=r(5043),a=r(8387),i=r(4020),o=r(1519),l=r(7287),c=r(6291),u=r(6307);function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s.apply(null,arguments)}var d=e=>{var{cx:t,cy:r,r:i,className:o}=e,d=(0,a.$)("recharts-dot",o);return(0,u.Et)(t)&&(0,u.Et)(r)&&(0,u.Et)(i)?n.createElement("circle",s({},(0,c.uZ)(e),(0,l._U)(e),{className:d,cx:t,cy:r,r:i})):null},p=r(240),f=r(9693),y=r(8743),v=r(8631),m=["points"];function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach(function(t){x(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function x(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function g(){return g=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g.apply(null,arguments)}function O(e){var{option:t,dotProps:r,className:i}=e;if((0,n.isValidElement)(t))return(0,n.cloneElement)(t,r);if("function"===typeof t)return t(r);var o=(0,a.$)(i,"boolean"!==typeof t?t.className:""),l=null!==r&&void 0!==r?r:{},{points:c}=l,u=function(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}(l,m);return n.createElement(d,g({},u,{className:o}))}function P(e){var{points:t,dot:r,className:a,dotClassName:o,dataKey:l,baseProps:c,needClip:u,clipPathId:s,zIndex:d=v.I.scatter}=e;if(!function(e,t){return null!=e&&(!!t||1===e.length)}(t,r))return null;var m=(0,p.y$)(r),h=(0,f.y)(r),x=t.map((e,a)=>{var i,u,s=b(b(b({r:3},c),h),{},{index:a,cx:null!==(i=e.x)&&void 0!==i?i:void 0,cy:null!==(u=e.y)&&void 0!==u?u:void 0,dataKey:l,value:e.value,payload:e.payload,points:t});return n.createElement(O,{key:"dot-".concat(a),option:r,dotProps:s,className:o})}),P={};return u&&null!=s&&(P.clipPath="url(#clipPath-".concat(m?"":"dots-").concat(s,")")),n.createElement(y.g,{zIndex:d},n.createElement(i.W,g({className:a},P),x))}var E=r(6015),j=r(4804),w=r(787),A=r(2711),I=r(2338);function N(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?N(Object(r),!0).forEach(function(t){D(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):N(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function D(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var S=e=>{var{point:t,childIndex:r,mainColor:a,activeDot:o,dataKey:u}=e;if(!1===o||null==t.x||null==t.y)return null;var s,p=k(k(k({},{index:r,dataKey:u,cx:t.x,cy:t.y,r:4,fill:null!==a&&void 0!==a?a:"none",strokeWidth:2,stroke:"#fff",payload:t.payload,value:t.value}),(0,c.ic)(o)),(0,l._U)(o));return s=(0,n.isValidElement)(o)?(0,n.cloneElement)(o,p):"function"===typeof o?o(p):n.createElement(d,p),n.createElement(i.W,{className:"recharts-active-dot"},s)};function C(e){var{points:t,mainColor:r,activeDot:a,itemDataKey:i,zIndex:o=v.I.activeDot}=e,l=(0,w.G)(A.A2),c=(0,I.EI)();if(null==t||null==c)return null;var s=t.find(e=>c.includes(e.payload));return(0,u.uy)(s)?null:n.createElement(y.g,{zIndex:o},n.createElement(S,{point:s,childIndex:Number(l),mainColor:r,dataKey:i,activeDot:a}))}var z=r(5175),K=r(6043),T=r(8327),W=r(8796),R=r(3987),M=r(2099),B=r(5340),G=r(773),L=(e,t,r,n)=>(0,G.Gx)(e,"xAxis",t,n),V=(e,t,r,n)=>(0,G.CR)(e,"xAxis",t,n),$=(e,t,r,n)=>(0,G.Gx)(e,"yAxis",r,n),_=(e,t,r,n)=>(0,G.CR)(e,"yAxis",r,n),F=(0,M.Mz)([W.fz,L,$,V,_],(e,t,r,n,a)=>(0,j._L)(e,"xAxis")?(0,j.Hj)(t,n,!1):(0,j.Hj)(r,a,!1));function H(e){return"line"===e.type}var U=(0,M.Mz)([G.ld,(e,t,r,n,a)=>a],(e,t)=>e.filter(H).find(e=>e.id===t)),Z=(0,M.Mz)([W.fz,L,$,V,_,U,F,B.HS],(e,t,r,n,a,i,o,l)=>{var{chartData:c,dataStartIndex:u,dataEndIndex:s}=l;if(null!=i&&null!=t&&null!=r&&null!=n&&null!=a&&0!==n.length&&0!==a.length&&null!=o){var d,{dataKey:p,data:f}=i;if(null!=(d=null!=f&&f.length>0?f:null===c||void 0===c?void 0:c.slice(u,s+1)))return Ee({layout:e,xAxis:t,yAxis:r,xAxisTicks:n,yAxisTicks:a,dataKey:p,bandSize:o,displayedData:d})}}),q=r(6098),J=r(2854),Q=r(6371),X=r(8333),Y=r(517),ee=r(830);var te=r(879),re=["id"],ne=["type","layout","connectNulls","needClip","shape"],ae=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function ie(){return ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ie.apply(null,arguments)}function oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function le(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(r),!0).forEach(function(t){ce(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ce(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ue(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],-1===t.indexOf(r)&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var se=e=>{var{dataKey:t,name:r,stroke:n,legendType:a,hide:i}=e;return[{inactive:i,dataKey:t,type:a,color:n,value:(0,j.uM)(r,t),payload:e}]};function de(e){var{dataKey:t,data:r,stroke:n,strokeWidth:a,fill:i,name:o,hide:l,unit:c}=e;return{dataDefinedOnItem:r,positions:void 0,settings:{stroke:n,strokeWidth:a,fill:i,dataKey:t,nameKey:void 0,name:(0,j.uM)(o,t),hide:l,type:e.tooltipType,color:e.stroke,unit:c}}}var pe=(e,t)=>"".concat(t,"px ").concat(e-t,"px");function fe(e,t){for(var r=e.length%2!==0?[...e,0]:e,n=[],a=0;a<t;++a)n=[...n,...r];return n}function ye(e){var{clipPathId:t,points:r,props:a}=e,{dot:i,dataKey:o,needClip:l}=a,{id:u}=a,s=ue(a,re),d=(0,c.uZ)(s);return n.createElement(P,{points:r,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:o,baseProps:d,needClip:l,clipPathId:t})}function ve(e){var{showLabels:t,children:r,points:a}=e,i=(0,n.useMemo)(()=>null===a||void 0===a?void 0:a.map(e=>{var t,r,n={x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(r=e.y)&&void 0!==r?r:0,width:0,lowerWidth:0,upperWidth:0,height:0};return le(le({},n),{},{value:e.value,payload:e.payload,viewBox:n,parentViewBox:void 0,fill:void 0})}),[a]);return n.createElement(o.h8,{value:t?i:void 0},r)}function me(e){var{clipPathId:t,pathRef:r,points:a,strokeDasharray:i,props:o}=e,{type:l,layout:c,connectNulls:u,needClip:s,shape:d}=o,p=ue(o,ne),y=le(le({},(0,f.a)(p)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(t,")"):void 0,points:a,type:l,layout:c,connectNulls:u,strokeDasharray:null!==i&&void 0!==i?i:o.strokeDasharray});return n.createElement(n.Fragment,null,(null===a||void 0===a?void 0:a.length)>1&&n.createElement(te.y,ie({shapeType:"curve",option:d},y,{pathRef:r})),n.createElement(ye,{points:a,clipPathId:t,props:o}))}function he(e){var{clipPathId:t,props:r,pathRef:a,previousPointsRef:i,longestAnimatedLengthRef:l}=e,{points:c,strokeDasharray:s,isAnimationActive:d,animationBegin:p,animationDuration:f,animationEasing:y,animateNewValues:v,width:m,height:h,onAnimationEnd:b,onAnimationStart:x}=r,g=i.current,O=(0,J.n)(r,"recharts-line-"),[P,E]=(0,n.useState)(!1),j=!P,w=(0,n.useCallback)(()=>{"function"===typeof b&&b(),E(!1)},[b]),A=(0,n.useCallback)(()=>{"function"===typeof x&&x(),E(!0)},[x]),I=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(t){return 0}}(a.current),N=l.current;return n.createElement(ve,{points:c,showLabels:j},r.children,n.createElement(ee.J,{animationId:O,begin:p,duration:f,isActive:d,easing:y,onAnimationEnd:w,onAnimationStart:A,key:O},e=>{var o,p=(0,u.GW)(N,I+N,e),f=Math.min(p,I);if(d)if(s){var y="".concat(s).split(/[,\s]+/gim).map(e=>parseFloat(e));o=((e,t,r)=>{var n=r.reduce((e,t)=>e+t);if(!n)return pe(t,e);for(var a=Math.floor(e/n),i=e%n,o=t-e,l=[],c=0,u=0;c<r.length;u+=r[c],++c)if(u+r[c]>i){l=[...r.slice(0,c),i-u];break}var s=l.length%2===0?[0,o]:[o];return[...fe(r,a),...l,...s].map(e=>"".concat(e,"px")).join(", ")})(f,I,y)}else o=pe(I,f);else o=null==s?void 0:String(s);if(g){var b=g.length/c.length,x=1===e?c:c.map((t,r)=>{var n=Math.floor(r*b);if(g[n]){var a=g[n];return le(le({},t),{},{x:(0,u.GW)(a.x,t.x,e),y:(0,u.GW)(a.y,t.y,e)})}return le(le({},t),{},v?{x:(0,u.GW)(2*m,t.x,e),y:(0,u.GW)(h/2,t.y,e)}:{x:t.x,y:t.y})});return i.current=x,n.createElement(me,{props:r,points:x,clipPathId:t,pathRef:a,strokeDasharray:o})}return e>0&&I>0&&(i.current=c,l.current=f),n.createElement(me,{props:r,points:c,clipPathId:t,pathRef:a,strokeDasharray:o})}),n.createElement(o.qY,{label:r.label}))}function be(e){var{clipPathId:t,props:r}=e,a=(0,n.useRef)(null),i=(0,n.useRef)(0),o=(0,n.useRef)(null);return n.createElement(he,{props:r,clipPathId:t,previousPointsRef:a,longestAnimatedLengthRef:i,pathRef:o})}var xe=(e,t)=>{var r,n;return{x:null!==(r=e.x)&&void 0!==r?r:void 0,y:null!==(n=e.y)&&void 0!==n?n:void 0,value:e.value,errorVal:(0,j.kr)(e.payload,t)}};class ge extends n.Component{render(){var{hide:e,dot:t,points:r,className:o,xAxisId:l,yAxisId:u,top:s,left:d,width:f,height:v,id:m,needClip:h,zIndex:b}=this.props;if(e)return null;var x=(0,a.$)("recharts-line",o),g=m,{r:O,strokeWidth:P}=function(e){var t=(0,c.ic)(e);if(null!=t){var{r:r,strokeWidth:n}=t,a=Number(r),i=Number(n);return(Number.isNaN(a)||a<0)&&(a=3),(Number.isNaN(i)||i<0)&&(i=2),{r:a,strokeWidth:i}}return{r:3,strokeWidth:2}}(t),E=(0,p.y$)(t),j=2*O+P;return n.createElement(y.g,{zIndex:b},n.createElement(i.W,{className:x},h&&n.createElement("defs",null,n.createElement(T.Q,{clipPathId:g,xAxisId:l,yAxisId:u}),!E&&n.createElement("clipPath",{id:"clipPath-dots-".concat(g)},n.createElement("rect",{x:d-j/2,y:s-j/2,width:f+j,height:v+j}))),n.createElement(K.zk,{xAxisId:l,yAxisId:u,data:r,dataPointFormatter:xe,errorBarOffset:0},n.createElement(be,{props:this.props,clipPathId:g}))),n.createElement(C,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey}))}}var Oe={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:!E.m.isSsr,label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:v.I.line};function Pe(e){var t=(0,Q.e)(e,Oe),{activeDot:r,animateNewValues:a,animationBegin:i,animationDuration:o,animationEasing:l,connectNulls:c,dot:u,hide:s,isAnimationActive:d,label:p,legendType:f,xAxisId:y,yAxisId:v,id:m}=t,h=ue(t,ae),{needClip:b}=(0,T.l)(y,v),x=(0,I.oM)(),g=(0,W.WX)(),O=(0,R.r)(),P=(0,w.G)(e=>Z(e,y,v,O,m));if("horizontal"!==g&&"vertical"!==g||null==P||null==x)return null;var{height:E,width:j,x:A,y:N}=x;return n.createElement(ge,ie({},h,{id:m,connectNulls:c,dot:u,activeDot:r,animateNewValues:a,animationBegin:i,animationDuration:o,animationEasing:l,isAnimationActive:d,hide:s,label:p,legendType:f,xAxisId:y,yAxisId:v,points:P,layout:g,height:E,width:j,left:A,top:N,needClip:b}))}function Ee(e){var{layout:t,xAxis:r,yAxis:n,xAxisTicks:a,yAxisTicks:i,dataKey:o,bandSize:l,displayedData:c}=e;return c.map((e,c)=>{var s=(0,j.kr)(e,o);if("horizontal"===t)return{x:(0,j.nb)({axis:r,ticks:a,bandSize:l,entry:e,index:c}),y:(0,u.uy)(s)?null:n.scale(s),value:s,payload:e};var d=(0,u.uy)(s)?null:r.scale(s),p=(0,j.nb)({axis:n,ticks:i,bandSize:l,entry:e,index:c});return null==d||null==p?null:{x:d,y:p,value:s,payload:e}}).filter(Boolean)}function je(e){var t=(0,Q.e)(e,Oe),r=(0,R.r)();return n.createElement(X.x,{id:t.id,type:"line"},e=>n.createElement(n.Fragment,null,n.createElement(q.A,{legendPayload:se(t)}),n.createElement(z.r,{fn:de,args:t}),n.createElement(Y.p,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:r}),n.createElement(Pe,ie({},t,{id:e}))))}var we=n.memo(je);we.displayName="Line"}}]);2//# sourceMappingURL=859.265ac4f8.chunk.js.map