{"version":3,"file":"renderShape.mjs","names":[],"sources":["../../src/BarChart/renderShape.tsx"],"sourcesContent":["import { deepEqual } from '@/common/utils';\n\nexport const renderShape = (\n  props: any,\n  activeBar: any | undefined,\n  activeLegend: string | undefined,\n  layout: string,\n) => {\n  const { fillOpacity, name, payload, value } = props;\n  let { x, width, y, height } = props;\n\n  if (layout === 'horizontal' && height < 0) {\n    y += height;\n    height = Math.abs(height); // height must be a positive number\n  } else if (layout === 'vertical' && width < 0) {\n    x += width;\n    width = Math.abs(width); // width must be a positive number\n  }\n\n  return (\n    <rect\n      height={height}\n      opacity={\n        activeBar || (activeLegend && activeLegend !== name)\n          ? deepEqual(activeBar, { ...payload, value })\n            ? fillOpacity\n            : 0.3\n          : fillOpacity\n      }\n      width={width}\n      x={x}\n      y={y}\n    />\n  );\n};\n"],"mappings":";;;AAEA,MAAa,eACX,OACA,WACA,cACA,WACG;CACH,MAAM,EAAE,aAAa,MAAM,SAAS,UAAU;CAC9C,IAAI,EAAE,GAAG,OAAO,GAAG,WAAW;CAE9B,IAAI,WAAW,gBAAgB,SAAS,GAAG;EACzC,KAAK;EACL,SAAS,KAAK,IAAI,MAAM;CAC1B,OAAO,IAAI,WAAW,cAAc,QAAQ,GAAG;EAC7C,KAAK;EACL,QAAQ,KAAK,IAAI,KAAK;CACxB;CAEA,OACE,oBAAC,QAAD;EACU;EACR,SACE,aAAc,gBAAgB,iBAAiB,OAC3C,UAAU,WAAW;GAAE,GAAG;GAAS;EAAM,CAAC,IACxC,cACA,KACF;EAEC;EACJ;EACA;CACJ,CAAA;AAEL"}