{"version":3,"file":"CirclePackingGraph-ChGsB3vr.cjs","names":[],"sources":["../node_modules/d3-array/src/extent.js","../node_modules/d3-force-boundary/dist/d3-force-boundary.esm.js","../src/Components/Graphs/CirclePackingGraph/Graph.tsx","../src/Components/Graphs/CirclePackingGraph/getMaxCircleRadius.ts","../src/Components/Graphs/CirclePackingGraph/index.tsx"],"sourcesContent":["export default function extent(values, valueof) {\n  let min;\n  let max;\n  if (valueof === undefined) {\n    for (const value of values) {\n      if (value != null) {\n        if (min === undefined) {\n          if (value >= value) min = max = value;\n        } else {\n          if (min > value) min = value;\n          if (max < value) max = value;\n        }\n      }\n    }\n  } else {\n    let index = -1;\n    for (let value of values) {\n      if ((value = valueof(value, ++index, values)) != null) {\n        if (min === undefined) {\n          if (value >= value) min = max = value;\n        } else {\n          if (min > value) min = value;\n          if (max < value) max = value;\n        }\n      }\n    }\n  }\n  return [min, max];\n}\n","// https://observablehq.com/@john-guerra/d3-force-boundary v0.0.2 Copyright 2022 John Alexis Guerra Gómez\nfunction constant(x) {\n  return function() {\n    return x;\n  };\n}\n\nfunction forceBoundary(x0, y0, x1, y1) {\n  var strength = constant(0.1),\n      hardBoundary = true,\n      border = constant( Math.min((x1 - x0)/2, (y1 - y0)/2) ),\n      nodes,\n      strengthsX,\n      strengthsY,\n      x0z, x1z,\n      y0z, y1z,\n      borderz,\n      halfX, halfY;\n\n  if (typeof x0 !== \"function\") x0 = constant(x0 == null ? -100 : +x0);\n  if (typeof x1 !== \"function\") x1 = constant(x1 == null ? 100 : +x1);\n  if (typeof y0 !== \"function\") y0 = constant(y0 == null ? -100 : +y0);\n  if (typeof y1 !== \"function\") y1 = constant(y1 == null ? 100 : +y1);\n\n  function getVx(halfX, x, strengthX, border, alpha) {\n    return (halfX - x) *  Math.min(2, Math.abs( halfX - x) / halfX) * strengthX * alpha;\n  }\n\n  function force(alpha) {\n    for (var i = 0, n = nodes.length, node; i < n; ++i) {\n      node = nodes[i];\n      // debugger;\n      if ((node.x < (x0z[i] + borderz[i]) || node.x > (x1z[i] - borderz[i])) ||\n        (node.y < (y0z[i] + borderz[i]) || node.y > (y1z[i] - borderz[i]))) {\n        node.vx += getVx(halfX[i], node.x, strengthsX[i], borderz[i], alpha);\n        node.vy += getVx(halfY[i], node.y, strengthsY[i], borderz[i], alpha);\n      } else if (node.y < (y0z[i] + borderz[i]) || node.y > (y1z[i] - borderz[i])) ;\n\n      if (hardBoundary) {\n        if (node.x >= x1z[i]) node.vx += x1z[i] - node.x;\n        if (node.x <= x0z[i]) node.vx += x0z[i] - node.x;\n        if (node.y >= y1z[i]) node.vy += y1z[i] - node.y;\n        if (node.y <= y0z[i]) node.vy += y0z[i] - node.y;\n      }\n    }\n  }\n\n  function initialize() {\n    if (!nodes) return;\n    var i, n = nodes.length;\n    strengthsX = new Array(n);\n    strengthsY = new Array(n);\n    x0z = new Array(n);\n    y0z = new Array(n);\n    x1z = new Array(n);\n    y1z = new Array(n);\n    halfY = new Array(n);\n    halfX = new Array(n);\n    borderz = new Array(n);\n\n    for (i = 0; i < n; ++i) {\n      strengthsX[i] = (isNaN(x0z[i] = +x0(nodes[i], i, nodes)) ||\n        isNaN(x1z[i] = +x1(nodes[i], i, nodes))) ? 0 : +strength(nodes[i], i, nodes);\n      strengthsY[i] = (isNaN(y0z[i] = +y0(nodes[i], i, nodes)) ||\n        isNaN(y1z[i] = +y1(nodes[i], i, nodes))) ? 0 : +strength(nodes[i], i, nodes);\n      halfX[i] = x0z[i] + (x1z[i] - x0z[i])/2,\n      halfY[i] = y0z[i] + (y1z[i] - y0z[i])/2;\n      borderz[i] = +border(nodes[i], i, nodes);\n    }\n  }\n\n  force.initialize = function(_) {\n    nodes = _;\n    initialize();\n  };\n\n  force.x0 = function(_) {\n    return arguments.length ? (x0 = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : x0;\n  };\n\n  force.x1 = function(_) {\n    return arguments.length ? (x1 = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : x1;\n  };\n\n  force.y0 = function(_) {\n    return arguments.length ? (y0 = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : y0;\n  };\n\n  force.y1 = function(_) {\n    return arguments.length ? (y1 = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : y1;\n  };\n\n  force.strength = function(_) {\n    return arguments.length ? (strength = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : strength;\n  };\n\n  force.border = function(_) {\n    return arguments.length ? (border = typeof _ === \"function\" ? _ : constant(+_), initialize(), force) : border;\n  };\n\n  force.hardBoundary = function(_) {\n    return arguments.length ? (hardBoundary = _, force) : hardBoundary;\n  };\n\n  return force;\n}\n\nexport default forceBoundary;\n","import { cn } from '@undp/design-system-react/cn';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { extent } from 'd3-array';\r\nimport { forceCollide, forceManyBody, forceSimulation, forceX, forceY } from 'd3-force';\r\nimport forceBoundary from 'd3-force-boundary';\r\nimport { scaleSqrt } from 'd3-scale';\r\nimport orderBy from 'lodash.orderby';\r\nimport { useEffect, useMemo, useRef, useState } from 'react';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport type { ClassNameObject, PadZerosTypes, StyleObject, TreeMapDataType } from '@/Types';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { getGraphDimensions } from '@/Utils/getGraphDimensions';\r\nimport { getTextColorBasedOnBgColor } from '@/Utils/getTextColorBasedOnBgColor';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\n\r\ninterface Props {\r\n  data: TreeMapDataType[];\r\n  colors: string[];\r\n  colorDomain: string[];\r\n  leftMargin: number;\r\n  rightMargin: number;\r\n  topMargin: number;\r\n  bottomMargin: number;\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  showLabels: boolean | ((_d: any) => React.ReactNode);\r\n  showValues: boolean;\r\n  width: number;\r\n  height: number;\r\n  suffix: string;\r\n  prefix: string;\r\n  selectedColor?: string;\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  tooltip?: string | ((_d: any) => React.ReactNode);\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  onSeriesMouseOver?: (_d: any) => void;\r\n  highlightedDataPoints?: (string | number)[];\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  onSeriesMouseClick?: (_d: any) => void;\r\n  theme: 'light' | 'dark';\r\n  maxRadiusValue?: number;\r\n  radius: number;\r\n  resetSelectionOnDoubleClick: boolean;\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n  styles?: StyleObject;\r\n  classNames?: ClassNameObject;\r\n  dimmedOpacity: number;\r\n  precision: number;\r\n  locale: string;\r\n  padZeros: PadZerosTypes;\r\n  minLabelRadius: number;\r\n}\r\n\r\ninterface TreeMapDataTypeForBubbleChart extends TreeMapDataType {\r\n  x: number;\r\n  y: number;\r\n  vx: number;\r\n  vy: number;\r\n}\r\n\r\nexport const Graph = (props: Props) => {\r\n  const {\r\n    data,\r\n    colors,\r\n    leftMargin,\r\n    width,\r\n    height,\r\n    colorDomain,\r\n    selectedColor,\r\n    rightMargin,\r\n    topMargin,\r\n    bottomMargin,\r\n    showLabels,\r\n    tooltip,\r\n    onSeriesMouseOver,\r\n    showValues,\r\n    suffix,\r\n    prefix,\r\n    highlightedDataPoints,\r\n    onSeriesMouseClick,\r\n    maxRadiusValue,\r\n    radius,\r\n    resetSelectionOnDoubleClick,\r\n    detailsOnClick,\r\n    styles,\r\n    classNames,\r\n    dimmedOpacity,\r\n    precision,\r\n    locale,\r\n    padZeros,\r\n    minLabelRadius,\r\n  } = props;\r\n  const svgRef = useRef(null);\r\n\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n  const [viewPortDimensions, setViewPortDimensions] = useState<\r\n    [number, number, number, number] | undefined\r\n  >(undefined);\r\n  const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n  const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n  const [finalData, setFinalData] = useState<TreeMapDataTypeForBubbleChart[] | null>(null);\r\n\r\n  const margin = {\r\n    top: topMargin,\r\n    bottom: bottomMargin,\r\n    left: leftMargin,\r\n    right: rightMargin,\r\n  };\r\n\r\n  const { graphHeight, graphWidth } = getGraphDimensions({ width, height }, margin);\r\n\r\n  const dataOrdered = useMemo(\r\n    () =>\r\n      data.filter((d) => !checkIfNullOrUndefined(d.size)).length === 0\r\n        ? data\r\n        : orderBy(\r\n            data.filter((d) => !checkIfNullOrUndefined(d.size)),\r\n            'radius',\r\n            'asc',\r\n          ),\r\n    [data],\r\n  );\r\n\r\n  const radiusScale = useMemo(\r\n    () =>\r\n      data.filter((d) => d.size === undefined || d.size === null).length !== data.length\r\n        ? scaleSqrt()\r\n            .domain([\r\n              0,\r\n              checkIfNullOrUndefined(maxRadiusValue)\r\n                ? Math.max(...data.map((d) => d.size).filter((d) => d !== undefined && d !== null))\r\n                : (maxRadiusValue as number),\r\n            ])\r\n            .range([0.25, radius])\r\n            .nice()\r\n        : undefined,\r\n    [data, radius, maxRadiusValue],\r\n  );\r\n\r\n  // Memoize simulation setup\r\n  useEffect(() => {\r\n    const setupSimulation = () => {\r\n      const dataTemp = dataOrdered.map((d) => ({ ...d, ...(d.data && { data: { ...d.data } }) }));\r\n      // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n      const simulation = forceSimulation(dataTemp as any)\r\n        .force('y', forceY((_d) => graphHeight / 2).strength(1))\r\n        .force('x', forceX((_d) => graphWidth / 2).strength(1))\r\n        .force(\r\n          'collide',\r\n          // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n          forceCollide((d: any) => (radiusScale ? radiusScale(d.size || 0) + 1 : radius + 1)),\r\n        )\r\n        .force('charge', forceManyBody().strength(-15))\r\n        .force('boundary', forceBoundary(0, 0, graphWidth, graphHeight).strength(0.2).border(50))\r\n        .alphaDecay(0.05)\r\n        .tick(10000);\r\n\r\n      simulation\r\n        .on('tick', () => {\r\n          setFinalData(dataTemp as TreeMapDataTypeForBubbleChart[]);\r\n        })\r\n        .on('end', () => {\r\n          setFinalData(dataTemp as TreeMapDataTypeForBubbleChart[]);\r\n          const xMinExtent =\r\n            extent(\r\n              dataTemp as TreeMapDataTypeForBubbleChart[],\r\n              (d) => d.x - (radiusScale ? radiusScale(d.size || 0) + 1 : radius + 1),\r\n            )[0] || 0;\r\n          const yMinExtent =\r\n            extent(\r\n              dataTemp as TreeMapDataTypeForBubbleChart[],\r\n              (d) => d.y - (radiusScale ? radiusScale(d.size || 0) + 1 : radius + 1),\r\n            )[0] || 0;\r\n          const xMaxExtent =\r\n            extent(\r\n              dataTemp as TreeMapDataTypeForBubbleChart[],\r\n              (d) => d.x + (radiusScale ? radiusScale(d.size || 0) + 1 : radius + 1),\r\n            )[1] || 0;\r\n          const yMaxExtent =\r\n            extent(\r\n              dataTemp as TreeMapDataTypeForBubbleChart[],\r\n              (d) => d.y + (radiusScale ? radiusScale(d.size || 0) + 1 : radius + 1),\r\n            )[1] || 0;\r\n          setViewPortDimensions([\r\n            xMinExtent,\r\n            yMinExtent,\r\n            xMinExtent < 0 ? xMaxExtent - xMinExtent : xMaxExtent,\r\n            yMinExtent < 0 ? yMaxExtent - yMinExtent : yMaxExtent,\r\n          ]);\r\n        });\r\n    };\r\n\r\n    setupSimulation();\r\n  }, [radius, graphHeight, graphWidth, dataOrdered, radiusScale]);\r\n\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const handleMouseEnter = (event: any, d: any) => {\r\n    setMouseOverData(d);\r\n    setEventY(event.clientY);\r\n    setEventX(event.clientX);\r\n    onSeriesMouseOver?.(d);\r\n  };\r\n\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const handleMouseMove = (event: any, d: any) => {\r\n    setMouseOverData(d);\r\n    setEventY(event.clientY);\r\n    setEventX(event.clientX);\r\n  };\r\n\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const handleClick = (d: any) => {\r\n    if (onSeriesMouseClick || detailsOnClick) {\r\n      if (mouseClickData === d.label && resetSelectionOnDoubleClick) {\r\n        setMouseClickData(undefined);\r\n        onSeriesMouseClick?.(undefined);\r\n      } else {\r\n        setMouseClickData(d.label);\r\n        onSeriesMouseClick?.(d);\r\n      }\r\n    }\r\n  };\r\n\r\n  const handleMouseLeave = () => {\r\n    setMouseOverData(undefined);\r\n    setEventX(undefined);\r\n    setEventY(undefined);\r\n    onSeriesMouseOver?.(undefined);\r\n  };\r\n\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const getCircleColor = (d: any) =>\r\n    data.filter((el) => el.color).length === 0\r\n      ? colors[0]\r\n      : !d.color\r\n        ? Colors.gray\r\n        : colors[colorDomain.indexOf(d.color)];\r\n\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  const getOpacity = (d: any) =>\r\n    selectedColor\r\n      ? d.color\r\n        ? colors[colorDomain.indexOf(d.color)] === selectedColor\r\n          ? 1\r\n          : dimmedOpacity\r\n        : dimmedOpacity\r\n      : highlightedDataPoints\r\n        ? highlightedDataPoints.indexOf(d.label) !== -1\r\n          ? 0.85\r\n          : dimmedOpacity\r\n        : 0.85;\r\n\r\n  // Render loading state\r\n  if (!finalData) {\r\n    return (\r\n      <div style={{ width: `${width}px`, height: `${height}px` }}>\r\n        <div className='flex m-auto items-center justify-center p-0 leading-xs text-base h-40'>\r\n          <Spinner />\r\n        </div>\r\n      </div>\r\n    );\r\n  }\r\n  if (viewPortDimensions) {\r\n    return (\r\n      <>\r\n        <svg\r\n          width={`${width}px`}\r\n          height={`${height}px`}\r\n          viewBox={`${viewPortDimensions[0] > 0 ? 0 : viewPortDimensions[0]} ${\r\n            viewPortDimensions[1] > 0 ? 0 : viewPortDimensions[1]\r\n          } ${width < viewPortDimensions[2] ? viewPortDimensions[2] : width} ${\r\n            height < viewPortDimensions[3] ? viewPortDimensions[3] : height\r\n          }`}\r\n          direction='ltr'\r\n          ref={svgRef}\r\n        >\r\n          <g transform={`translate(${margin.left},${margin.top})`}>\r\n            {finalData.map((d) => {\r\n              const circleColor = getCircleColor(d);\r\n              const opacity = getOpacity(d);\r\n              const bubbleRadius = radiusScale ? radiusScale(d.size || 0) : radius;\r\n              const showLabel = bubbleRadius >= 20 && (showLabels || showValues);\r\n              return (\r\n                // biome-ignore lint/a11y/noStaticElementInteractions: interaction for graph\r\n                <g\r\n                  className='undp-viz-g-with-hover'\r\n                  key={d.label}\r\n                  opacity={opacity}\r\n                  transform={`translate(${d.x},${d.y})`}\r\n                  onMouseEnter={(event) => handleMouseEnter(event, d)}\r\n                  onMouseMove={(event) => handleMouseMove(event, d)}\r\n                  onClick={() => handleClick(d)}\r\n                  onMouseLeave={handleMouseLeave}\r\n                >\r\n                  <circle cx={0} cy={0} r={bubbleRadius} fill={circleColor} />\r\n                  {(showLabel || showValues) &&\r\n                    d.size !== undefined &&\r\n                    d.size !== null &&\r\n                    bubbleRadius >= minLabelRadius && (\r\n                      <g>\r\n                        <foreignObject\r\n                          y={0 - bubbleRadius}\r\n                          x={0 - bubbleRadius}\r\n                          width={2 * bubbleRadius}\r\n                          height={2 * bubbleRadius}\r\n                        >\r\n                          <div\r\n                            className='flex flex-col justify-center items-center h-full py-0 px-3'\r\n                            style={{\r\n                              display: 'flex',\r\n                              flexDirection: 'column',\r\n                              justifyContent: 'center',\r\n                              alignItems: 'center',\r\n                              height: '100%',\r\n                              padding: '0 0.75rem',\r\n                            }}\r\n                          >\r\n                            {showLabels &&\r\n                              (showLabels instanceof Function ? (\r\n                                showLabels(d)\r\n                              ) : (\r\n                                <P\r\n                                  className={cn(\r\n                                    'text-center leading-sm overflow-hidden m-0 circle-packing-label',\r\n                                    classNames?.graphObjectValues,\r\n                                  )}\r\n                                  marginBottom='none'\r\n                                  style={{\r\n                                    fontSize: `${Math.min(\r\n                                      Math.max(Math.round(bubbleRadius / 4), 12),\r\n                                      Math.max(\r\n                                        Math.round((bubbleRadius * 12) / `${d.label}`.length),\r\n                                        12,\r\n                                      ),\r\n                                      14,\r\n                                    )}px`,\r\n                                    WebkitLineClamp:\r\n                                      bubbleRadius * 2 < 60\r\n                                        ? 1\r\n                                        : bubbleRadius * 2 < 75\r\n                                          ? 2\r\n                                          : bubbleRadius * 2 < 100\r\n                                            ? 3\r\n                                            : undefined,\r\n                                    display: '-webkit-box',\r\n                                    WebkitBoxOrient: 'vertical',\r\n                                    color: getTextColorBasedOnBgColor(circleColor),\r\n                                    hyphens: 'auto',\r\n                                    ...(styles?.graphObjectValues || {}),\r\n                                  }}\r\n                                >\r\n                                  {d.label}\r\n                                </P>\r\n                              ))}\r\n                            {showValues && (\r\n                              <P\r\n                                className='text-center font-bold leading-sm w-full m-0 circle-packing-value'\r\n                                marginBottom='none'\r\n                                style={{\r\n                                  fontSize: `${Math.min(\r\n                                    Math.max(Math.round(bubbleRadius / 4), 14),\r\n                                    14,\r\n                                  )}px`,\r\n                                  color: getTextColorBasedOnBgColor(circleColor),\r\n                                }}\r\n                              >\r\n                                {numberFormattingFunction(\r\n                                  d.size,\r\n                                  undefined,\r\n                                  precision,\r\n                                  prefix,\r\n                                  suffix,\r\n                                  locale,\r\n                                  padZeros,\r\n                                )}\r\n                              </P>\r\n                            )}\r\n                          </div>\r\n                        </foreignObject>\r\n                      </g>\r\n                    )}\r\n                </g>\r\n              );\r\n            })}\r\n          </g>\r\n        </svg>\r\n        {mouseOverData && tooltip && eventX && eventY && (\r\n          <Tooltip\r\n            data={mouseOverData}\r\n            body={tooltip}\r\n            xPos={eventX}\r\n            yPos={eventY}\r\n            backgroundStyle={styles?.tooltip}\r\n            className={classNames?.tooltip}\r\n          />\r\n        )}\r\n        {detailsOnClick && mouseClickData !== undefined ? (\r\n          <DetailsModal\r\n            body={detailsOnClick}\r\n            data={mouseClickData}\r\n            setData={setMouseClickData}\r\n            className={classNames?.modal}\r\n          />\r\n        ) : null}\r\n      </>\r\n    );\r\n  }\r\n  return null;\r\n};\r\n","export function getMaxCircleRadius(\r\n  values: (number | undefined | null)[],\r\n  width: number,\r\n  height: number,\r\n  circularBoundary?: boolean,\r\n) {\r\n  const filteredValues = values.filter((d) => d !== undefined && d !== null);\r\n  const containerRadius =\r\n    circularBoundary === false\r\n      ? Math.sqrt((width * height) / Math.PI)\r\n      : Math.min(width, height) / 2;\r\n  const totalValue = filteredValues.reduce((sum, v) => sum + v, 0);\r\n  const maxValue = Math.max(...filteredValues);\r\n  const getPackingEfficiency = (n: number) => {\r\n    if (n <= 5) return 0.9;\r\n    if (n <= 10) return 0.85;\r\n    if (n <= 20) return 0.8;\r\n    return 0.7;\r\n  };\r\n  const getEfficiencyBecauseOfContainerRadius = (r: number) => {\r\n    if (r <= 200) return 0.85;\r\n    if (r <= 250) return 0.95;\r\n    return 1;\r\n  };\r\n  return (\r\n    containerRadius *\r\n    Math.sqrt(maxValue / totalValue) *\r\n    (circularBoundary ? getEfficiencyBecauseOfContainerRadius(containerRadius) : 1) *\r\n    (circularBoundary ? getPackingEfficiency(filteredValues.length) : 1)\r\n  );\r\n}\r\n","import { useRef, useState } from 'react';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { useElementSize } from '@/hooks/useElementSize';\r\nimport type {\r\n  ClassNameObject,\r\n  Languages,\r\n  NumberFormatOptions,\r\n  SourcesDataType,\r\n  StyleObject,\r\n  TreeMapDataType,\r\n} from '@/Types';\r\nimport { uniqBy } from '@/Utils/uniqBy';\r\nimport { Graph } from './Graph';\r\nimport { getMaxCircleRadius } from './getMaxCircleRadius';\r\n\r\ninterface Props {\r\n  // Data\r\n  /** Array of data objects */\r\n  data: TreeMapDataType[];\r\n\r\n  // Titles, Labels, and Sources\r\n  /** Title of the graph */\r\n  graphTitle?: string | React.ReactNode;\r\n  /** Description of the graph */\r\n  graphDescription?: string | React.ReactNode;\r\n  /** Footnote for the graph */\r\n  footNote?: string | React.ReactNode;\r\n  /** Source data for the graph */\r\n  sources?: SourcesDataType[];\r\n  /** Accessibility label */\r\n  ariaLabel?: string;\r\n\r\n  // Colors and Styling\r\n  /** Color or array of colors for circle */\r\n  colors?: string | string[];\r\n  /** Domain of colors for the graph */\r\n  colorDomain?: string[];\r\n  /** Title for the color legend */\r\n  colorLegendTitle?: string;\r\n  /** Background color of the graph */\r\n  backgroundColor?: string | boolean;\r\n  /** Custom styles for the graph. Each object should be a valid React CSS style object. */\r\n  styles?: StyleObject;\r\n  /** Custom class names */\r\n  classNames?: ClassNameObject;\r\n\r\n  // Size and Spacing\r\n  /** Width of the graph */\r\n  width?: number;\r\n  /** Height of the graph */\r\n  height?: number;\r\n  /** Minimum height of the graph */\r\n  minHeight?: number;\r\n  /** Relative height scaling factor. This overwrites the height props */\r\n  relativeHeight?: number;\r\n  /** Padding around the graph. Defaults to 0 if no backgroundColor is mentioned else defaults to 1rem */\r\n  padding?: string;\r\n  /** Left margin of the graph */\r\n  leftMargin?: number;\r\n  /** Right margin of the graph */\r\n  rightMargin?: number;\r\n  /** Top margin of the graph */\r\n  topMargin?: number;\r\n  /** Bottom margin of the graph */\r\n  bottomMargin?: number;\r\n\r\n  // Values and Ticks\r\n  /** Maximum value mapped to the radius chart */\r\n  maxRadiusValue?: number;\r\n\r\n  // Graph Parameters\r\n  /** If true, the graph will be rendered in a circle layout */\r\n  circularBoundary?: boolean;\r\n  /** Maximum radius of the circle */\r\n  radius?: number;\r\n  /** Toggle visibility of labels or defines what is shown in the label */\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  showLabels?: boolean | ((_d: any) => React.ReactNode);\r\n  /** Minimum radius of the circle for the label to be visible */\r\n  minLabelRadius?: number;\r\n  /** Toggle visibility of values */\r\n  showValues?: boolean;\r\n  /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n  showColorScale?: boolean;\r\n  /** Toggle visibility of NA color in the color scale. This is only applicable if the data props hae color parameter and showColorScale prop is true */\r\n  showNAColor?: boolean;\r\n  /** Data points to highlight. Use the label value from data to highlight the data point */\r\n  highlightedDataPoints?: (string | number)[];\r\n  /** Defines the opacity of the non-highlighted data */\r\n  dimmedOpacity?: number;\r\n  /** Configuration options for controlling number formatting, localization, prefixes/suffixes, precision, and zero padding. */\r\n  numberDisplayOptions?: NumberFormatOptions;\r\n  /** Enable graph download option as png */\r\n  graphDownload?: boolean;\r\n  /** Enable data download option as a csv */\r\n  dataDownload?: boolean;\r\n  /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n  resetSelectionOnDoubleClick?: boolean;\r\n\r\n  // Interactions and Callbacks\r\n  /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  tooltip?: string | ((_d: any) => React.ReactNode);\r\n  /** Details displayed on the modal when user clicks of a data point. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n  /** Callback for mouse over event */\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  onSeriesMouseOver?: (_d: any) => void;\r\n  /** Callback for mouse click event */\r\n  // biome-ignore lint/suspicious/noExplicitAny: undefined data type\r\n  onSeriesMouseClick?: (_d: any) => void;\r\n\r\n  // Configuration and Options\r\n  /** Language setting  */\r\n  language?: Languages;\r\n  /** Color theme */\r\n  theme?: 'light' | 'dark';\r\n  /** Unique ID for the graph */\r\n  graphID?: string;\r\n}\r\n\r\nexport function CirclePackingGraph(props: Props) {\r\n  const {\r\n    data,\r\n    graphTitle,\r\n    colors,\r\n    sources,\r\n    graphDescription,\r\n    leftMargin = 0,\r\n    rightMargin = 0,\r\n    height,\r\n    width,\r\n    footNote,\r\n    colorDomain,\r\n    colorLegendTitle,\r\n    padding,\r\n    backgroundColor = false,\r\n    topMargin = 0,\r\n    bottomMargin = 0,\r\n    showLabels = true,\r\n    relativeHeight,\r\n    tooltip,\r\n    onSeriesMouseOver,\r\n    showColorScale = true,\r\n    showValues,\r\n    graphID,\r\n    highlightedDataPoints,\r\n    onSeriesMouseClick,\r\n    graphDownload = false,\r\n    dataDownload = false,\r\n    language = 'en',\r\n    showNAColor,\r\n    minHeight = 0,\r\n    theme = 'light',\r\n    ariaLabel,\r\n    radius,\r\n    maxRadiusValue,\r\n    resetSelectionOnDoubleClick = true,\r\n    detailsOnClick,\r\n    styles,\r\n    classNames,\r\n    dimmedOpacity = 0.3,\r\n    circularBoundary = true,\r\n    numberDisplayOptions,\r\n    minLabelRadius = 7.5,\r\n  } = props;\r\n\r\n  const { graphDiv, svgWidth, svgHeight } = useElementSize<HTMLDivElement>();\r\n  const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n  const graphParentDiv = useRef<HTMLDivElement>(null);\r\n  return (\r\n    <GraphContainer\r\n      className={classNames?.graphContainer}\r\n      style={styles?.graphContainer}\r\n      id={graphID}\r\n      ref={graphParentDiv}\r\n      aria-label={ariaLabel}\r\n      backgroundColor={backgroundColor}\r\n      theme={theme}\r\n      language={language}\r\n      minHeight={minHeight}\r\n      width={width}\r\n      height={height}\r\n      relativeHeight={relativeHeight}\r\n      padding={padding}\r\n    >\r\n      {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n        <GraphHeader\r\n          styles={{\r\n            title: styles?.title,\r\n            description: styles?.description,\r\n          }}\r\n          classNames={{\r\n            title: classNames?.title,\r\n            description: classNames?.description,\r\n          }}\r\n          graphTitle={graphTitle}\r\n          graphDescription={graphDescription}\r\n          width={width}\r\n          graphDownload={graphDownload ? graphParentDiv : undefined}\r\n          dataDownload={\r\n            dataDownload\r\n              ? data.map((d) => d.data).filter((d) => d !== undefined).length > 0\r\n                ? data.map((d) => d.data).filter((d) => d !== undefined)\r\n                : data.filter((d) => d !== undefined)\r\n              : null\r\n          }\r\n        />\r\n      ) : null}\r\n      {showColorScale && data.filter((el) => el.color).length !== 0 && data.length > 0 ? (\r\n        <ColorLegendWithMouseOver\r\n          width={width}\r\n          colorLegendTitle={colorLegendTitle}\r\n          colors={(colors as string[] | undefined) || Colors[theme].categoricalColors.colors}\r\n          colorDomain={colorDomain || (uniqBy(data, 'color', true) as string[])}\r\n          setSelectedColor={setSelectedColor}\r\n          showNAColor={showNAColor === undefined || showNAColor === null ? true : showNAColor}\r\n          isCenter\r\n          className={classNames?.colorLegend}\r\n        />\r\n      ) : null}\r\n      <GraphArea ref={graphDiv}>\r\n        {data.length === 0 && <EmptyState />}\r\n        {svgWidth && svgHeight && data.length > 0 ? (\r\n          <Graph\r\n            data={data}\r\n            colors={\r\n              data.filter((el) => el.color).length === 0\r\n                ? colors\r\n                  ? [colors as string]\r\n                  : [Colors.primaryColors['blue-600']]\r\n                : (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n            }\r\n            colorDomain={\r\n              data.filter((el) => el.color).length === 0\r\n                ? []\r\n                : colorDomain || (uniqBy(data, 'color', true) as string[])\r\n            }\r\n            width={svgWidth}\r\n            height={svgHeight}\r\n            leftMargin={leftMargin}\r\n            rightMargin={rightMargin}\r\n            topMargin={topMargin}\r\n            bottomMargin={bottomMargin}\r\n            showLabels={showLabels}\r\n            showValues={\r\n              showValues !== false\r\n                ? data.filter((el) => el.size).length !== 0\r\n                : (showValues as boolean)\r\n            }\r\n            selectedColor={selectedColor}\r\n            tooltip={tooltip}\r\n            onSeriesMouseOver={onSeriesMouseOver}\r\n            highlightedDataPoints={highlightedDataPoints}\r\n            onSeriesMouseClick={onSeriesMouseClick}\r\n            theme={theme}\r\n            radius={\r\n              !radius\r\n                ? getMaxCircleRadius(\r\n                    data.map((d) => d.size),\r\n                    svgWidth,\r\n                    svgHeight,\r\n                    circularBoundary,\r\n                  )\r\n                : radius\r\n            }\r\n            maxRadiusValue={maxRadiusValue}\r\n            resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n            detailsOnClick={detailsOnClick}\r\n            styles={styles}\r\n            classNames={classNames}\r\n            dimmedOpacity={dimmedOpacity}\r\n            locale={numberDisplayOptions?.locale || 'en'}\r\n            padZeros={numberDisplayOptions?.padZeros || 'none'}\r\n            suffix={numberDisplayOptions?.suffix || ''}\r\n            prefix={numberDisplayOptions?.prefix || ''}\r\n            precision={numberDisplayOptions?.precision ?? 2}\r\n            minLabelRadius={minLabelRadius}\r\n          />\r\n        ) : null}\r\n      </GraphArea>\r\n      {sources || footNote ? (\r\n        <GraphFooter\r\n          styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n          classNames={{\r\n            footnote: classNames?.footnote,\r\n            source: classNames?.source,\r\n          }}\r\n          sources={sources}\r\n          footNote={footNote}\r\n          width={width}\r\n        />\r\n      ) : null}\r\n    </GraphContainer>\r\n  );\r\n}\r\n"],"x_google_ignoreList":[0,1],"mappings":"s2BAAA,SAAwB,EAAO,EAAQ,EAAS,CAC9C,IAAI,EACA,EACJ,GAAI,IAAY,IAAA,OACT,IAAM,KAAS,EACd,GAAS,OACP,IAAQ,IAAA,GACN,GAAS,IAAO,EAAM,EAAM,IAE5B,EAAM,IAAO,EAAM,GACnB,EAAM,IAAO,EAAM,SAIxB,CACL,IAAI,EAAQ,GACZ,IAAK,IAAI,KAAS,GACX,EAAQ,EAAQ,EAAO,EAAE,EAAO,CAAM,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