{"version":3,"file":"RegressionLine-1CF94AAi.cjs","names":[],"sources":["../src/Components/Elements/RegressionLine.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\nimport { AnimatePresence, motion } from 'motion/react';\r\n\r\nimport type { AnimateDataType } from '@/Types';\r\nimport { generateRandomString } from '@/Utils/generateRandomString';\r\n\r\ninterface Props {\r\n  color?: string;\r\n  y1: number;\r\n  y2: number;\r\n  x1: number;\r\n  x2: number;\r\n  graphWidth: number;\r\n  graphHeight: number;\r\n  className?: string;\r\n  style?: React.CSSProperties;\r\n  animate: AnimateDataType;\r\n  isInView: boolean;\r\n}\r\n\r\nexport function RegressionLine(props: Props) {\r\n  const { color, x1, x2, y1, y2, className, style, animate, isInView, graphWidth, graphHeight } =\r\n    props;\r\n  const id = generateRandomString(8);\r\n  return (\r\n    <g>\r\n      <defs>\r\n        <clipPath id={id}>\r\n          <rect x='0' y='0' width={graphWidth} height={graphHeight} />\r\n        </clipPath>\r\n      </defs>\r\n      <AnimatePresence>\r\n        <motion.line\r\n          clipPath={`url(#${id})`}\r\n          className={cn('undp-ref-line', !color ? 'stroke-foreground-soft' : undefined, className)}\r\n          style={{\r\n            fill: 'none',\r\n            ...(style || {}),\r\n          }}\r\n          exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n          variants={{\r\n            initial: {\r\n              y1,\r\n              y2: y1,\r\n              x1,\r\n              x2: x1,\r\n              ...(color && { stroke: color }),\r\n            },\r\n            whileInView: {\r\n              y1,\r\n              y2,\r\n              x1,\r\n              x2,\r\n              ...(color && { stroke: color }),\r\n              transition: { duration: animate.duration },\r\n            },\r\n          }}\r\n          initial='initial'\r\n          animate={isInView ? 'whileInView' : 'initial'}\r\n        />\r\n      </AnimatePresence>\r\n    </g>\r\n  );\r\n}\r\n"],"mappings":"kNAoBA,SAAgB,EAAe,EAAc,CAC3C,GAAM,CAAE,QAAO,KAAI,KAAI,KAAI,KAAI,YAAW,QAAO,UAAS,WAAU,aAAY,eAC9E,EACI,EAAK,EAAA,EAAqB,CAAC,EACjC,OACE,EAAA,EAAA,MAAC,IAAD,CAAA,SAAA,EACE,EAAA,EAAA,KAAC,OAAD,CAAA,UACE,EAAA,EAAA,KAAC,WAAD,CAAc,eACZ,EAAA,EAAA,KAAC,OAAD,CAAM,EAAE,IAAI,EAAE,IAAI,MAAO,EAAY,OAAQ,CAAc,CAAA,CACnD,CAAA,CACN,CAAA,GACN,EAAA,EAAA,KAAC,EAAA,EAAD,CAAA,UACE,EAAA,EAAA,KAAC,EAAA,EAAO,KAAR,CACE,SAAU,QAAQ,EAAG,GACrB,WAAA,EAAA,EAAA,IAAc,gBAAkB,EAAmC,IAAA,GAA3B,yBAAsC,CAAS,EACvF,MAAO,CACL,KAAM,OACN,GAAI,GAAS,CAAC,CAChB,EACA,KAAM,CAAE,QAAS,EAAG,WAAY,CAAE,SAAU,EAAQ,QAAS,CAAE,EAC/D,SAAU,CACR,QAAS,CACP,KACA,GAAI,EACJ,KACA,GAAI,EACJ,GAAI,GAAS,CAAE,OAAQ,CAAM,CAC/B,EACA,YAAa,CACX,KACA,KACA,KACA,KACA,GAAI,GAAS,CAAE,OAAQ,CAAM,EAC7B,WAAY,CAAE,SAAU,EAAQ,QAAS,CAC3C,CACF,EACA,QAAQ,UACR,QAAS,EAAW,cAAgB,SACrC,CAAA,CACc,CAAA,CAChB,CAAA,CAAA,CAEP"}