'use client';
"use strict";var e=require("tslib"),t=require("react"),a=require("tailwind-merge"),i=require("recharts"),r=require("../common/utils.cjs"),l=require("../common/ChartLegend.cjs"),n=require("../common/ChartTooltip.cjs"),o=require("../common/NoData.cjs"),s=require("../../../lib/hexColors.cjs"),c=require("../../../lib/constants.cjs"),u=require("../../../lib/theme.cjs"),d=require("../../../lib/utils.cjs");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=m(t);const f=h.default.forwardRef(((m,f)=>{const{data:y=[],categories:p=[],index:v,colors:x=u.themeColorRange,valueFormatter:w=d.defaultValueFormatter,startEndOnly:g=!1,showXAxis:A=!0,showYAxis:E=!0,yAxisWidth:k=56,animationDuration:C=1500,showAnimation:L=!0,showTooltip:q=!0,showLegend:D=!0,showGridLines:b=!0,autoMinValue:j=!1,curveType:T="linear",minValue:N,maxValue:F,connectNulls:V=!1,allowDecimals:G=!0,className:S,noDataText:W}=m,Y=e.__rest(m,["data","categories","index","colors","valueFormatter","startEndOnly","showXAxis","showYAxis","yAxisWidth","animationDuration","showAnimation","showTooltip","showLegend","showGridLines","autoMinValue","curveType","minValue","maxValue","connectNulls","allowDecimals","className","noDataText"]),[z,M]=t.useState(60),O=r.constructCategoryColors(p,x),R=r.getYAxisDomain(j,N,F);return h.default.createElement("div",Object.assign({ref:f,className:a.twMerge("w-full h-80",S)},Y),h.default.createElement(i.ResponsiveContainer,{width:"100%",height:"100%"},(null==y?void 0:y.length)?h.default.createElement(i.LineChart,{data:y},b?h.default.createElement(i.CartesianGrid,{strokeDasharray:"3 3",horizontal:!0,vertical:!1}):null,h.default.createElement(i.XAxis,{hide:!A,dataKey:v,interval:"preserveStartEnd",tick:{transform:"translate(0, 6)"},ticks:g?[y[0][v],y[y.length-1][v]]:void 0,style:{fontSize:"12px",fontFamily:"Inter; Helvetica"},tickLine:!1,axisLine:!1,padding:{left:10,right:10},minTickGap:5}),h.default.createElement(i.YAxis,{width:k,hide:!E,axisLine:!1,tickLine:!1,type:"number",domain:R,tick:{transform:"translate(-3, 0)"},style:{fontSize:"12px",fontFamily:"Inter; Helvetica"},tickFormatter:w,allowDecimals:G}),q?h.default.createElement(i.Tooltip,{wrapperStyle:{outline:"none"},isAnimationActive:!1,cursor:{stroke:"#d1d5db",strokeWidth:1},content:({active:e,payload:t,label:a})=>h.default.createElement(n.default,{active:e,payload:t,label:a,valueFormatter:w,categoryColors:O}),position:{y:0}}):null,D?h.default.createElement(i.Legend,{verticalAlign:"top",height:z,content:({payload:e})=>l({payload:e},O,M)}):null,p.map((e=>{var t;return h.default.createElement(i.Line,{key:e,name:e,type:T,dataKey:e,stroke:s.hexColors[null!==(t=O.get(e))&&void 0!==t?t:c.BaseColors.Gray],strokeWidth:2,dot:!1,isAnimationActive:L,animationDuration:C,connectNulls:V})}))):h.default.createElement(o,{noDataText:W})))}));f.displayName="LineChart",module.exports=f;
