@undp/data-viz 1.4.12 → 1.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.js +25 -24
  4. package/dist/AreaChart.js.map +1 -1
  5. package/dist/BarGraph.cjs +1 -1
  6. package/dist/BarGraph.cjs.map +1 -1
  7. package/dist/BarGraph.js +638 -632
  8. package/dist/BarGraph.js.map +1 -1
  9. package/dist/BeeSwarmChart.cjs +1 -1
  10. package/dist/BeeSwarmChart.cjs.map +1 -1
  11. package/dist/BeeSwarmChart.js +134 -132
  12. package/dist/BeeSwarmChart.js.map +1 -1
  13. package/dist/BiVariateChoroplethMap.cjs +1 -1
  14. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  15. package/dist/BiVariateChoroplethMap.js +35 -34
  16. package/dist/BiVariateChoroplethMap.js.map +1 -1
  17. package/dist/BulletChart.cjs +1 -1
  18. package/dist/BulletChart.cjs.map +1 -1
  19. package/dist/BulletChart.js +226 -224
  20. package/dist/BulletChart.js.map +1 -1
  21. package/dist/ButterflyChart.cjs +1 -1
  22. package/dist/ButterflyChart.cjs.map +1 -1
  23. package/dist/ButterflyChart.js +48 -47
  24. package/dist/ButterflyChart.js.map +1 -1
  25. package/dist/ChoroplethMap.cjs +1 -1
  26. package/dist/ChoroplethMap.cjs.map +1 -1
  27. package/dist/ChoroplethMap.js +56 -55
  28. package/dist/ChoroplethMap.js.map +1 -1
  29. package/dist/CirclePackingGraph.cjs +1 -1
  30. package/dist/CirclePackingGraph.js +1 -1
  31. package/dist/DataCards.cjs +3 -3
  32. package/dist/DataCards.cjs.map +1 -1
  33. package/dist/DataCards.js +2 -1
  34. package/dist/DataCards.js.map +1 -1
  35. package/dist/DataTable.cjs +1 -1
  36. package/dist/DataTable.cjs.map +1 -1
  37. package/dist/DataTable.js +9 -8
  38. package/dist/DataTable.js.map +1 -1
  39. package/dist/DifferenceLineChart.cjs +1 -1
  40. package/dist/DifferenceLineChart.cjs.map +1 -1
  41. package/dist/DifferenceLineChart.js +1 -0
  42. package/dist/DifferenceLineChart.js.map +1 -1
  43. package/dist/DonutChart.cjs +1 -1
  44. package/dist/DonutChart.cjs.map +1 -1
  45. package/dist/DonutChart.js +77 -76
  46. package/dist/DonutChart.js.map +1 -1
  47. package/dist/DotDensityMap.cjs +1 -1
  48. package/dist/DotDensityMap.cjs.map +1 -1
  49. package/dist/DotDensityMap.js +1 -0
  50. package/dist/DotDensityMap.js.map +1 -1
  51. package/dist/{DropdownSelect-CeHog_ih.js → DropdownSelect-CtOKZHD0.js} +22 -20
  52. package/dist/{DropdownSelect-CeHog_ih.js.map → DropdownSelect-CtOKZHD0.js.map} +1 -1
  53. package/dist/{DropdownSelect-BmE5JaeE.cjs → DropdownSelect-DBDM64B5.cjs} +2 -2
  54. package/dist/{DropdownSelect-BmE5JaeE.cjs.map → DropdownSelect-DBDM64B5.cjs.map} +1 -1
  55. package/dist/DualAxisLineChart.cjs +1 -1
  56. package/dist/DualAxisLineChart.cjs.map +1 -1
  57. package/dist/DualAxisLineChart.d.ts +3 -1
  58. package/dist/DualAxisLineChart.js +265 -261
  59. package/dist/DualAxisLineChart.js.map +1 -1
  60. package/dist/DumbbellChart.cjs +1 -1
  61. package/dist/DumbbellChart.cjs.map +1 -1
  62. package/dist/DumbbellChart.js +216 -214
  63. package/dist/DumbbellChart.js.map +1 -1
  64. package/dist/GeoHubCompareMaps.cjs +1 -1
  65. package/dist/GeoHubCompareMaps.cjs.map +1 -1
  66. package/dist/GeoHubCompareMaps.js +1 -0
  67. package/dist/GeoHubCompareMaps.js.map +1 -1
  68. package/dist/GeoHubMap.cjs +1 -1
  69. package/dist/GeoHubMap.cjs.map +1 -1
  70. package/dist/GeoHubMap.js +29 -28
  71. package/dist/GeoHubMap.js.map +1 -1
  72. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  73. package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
  74. package/dist/GeoHubMapWithLayerSelection.js +34 -33
  75. package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
  76. package/dist/{GraphEl-s3ctz7oA.js → GraphEl-N6vuMRw_.js} +6 -2
  77. package/dist/GraphEl-N6vuMRw_.js.map +1 -0
  78. package/dist/GraphEl-Zl0W-LK9.cjs +2 -0
  79. package/dist/GraphEl-Zl0W-LK9.cjs.map +1 -0
  80. package/dist/GriddedGraphs.cjs +1 -1
  81. package/dist/GriddedGraphs.d.ts +1 -0
  82. package/dist/GriddedGraphs.js +2 -2
  83. package/dist/GriddedGraphsFromConfig.d.ts +1 -0
  84. package/dist/HeatMap.cjs +1 -1
  85. package/dist/HeatMap.cjs.map +1 -1
  86. package/dist/HeatMap.js +55 -54
  87. package/dist/HeatMap.js.map +1 -1
  88. package/dist/Histogram.cjs +1 -1
  89. package/dist/Histogram.js +1 -1
  90. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  91. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  92. package/dist/LineChartWithConfidenceInterval.js +22 -21
  93. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  94. package/dist/MultiGraphDashboard.cjs +1 -1
  95. package/dist/MultiGraphDashboard.d.ts +1 -0
  96. package/dist/MultiGraphDashboard.js +1 -1
  97. package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
  98. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  99. package/dist/MultiGraphDashboardWideToLongFormat.js +1 -1
  100. package/dist/MultiLineAltChart.cjs +1 -1
  101. package/dist/MultiLineAltChart.cjs.map +1 -1
  102. package/dist/MultiLineAltChart.js +34 -33
  103. package/dist/MultiLineAltChart.js.map +1 -1
  104. package/dist/MultiLineChart.cjs +1 -1
  105. package/dist/MultiLineChart.cjs.map +1 -1
  106. package/dist/MultiLineChart.js +72 -71
  107. package/dist/MultiLineChart.js.map +1 -1
  108. package/dist/ParetoChart.cjs +1 -1
  109. package/dist/ParetoChart.cjs.map +1 -1
  110. package/dist/ParetoChart.d.ts +4 -0
  111. package/dist/ParetoChart.js +317 -312
  112. package/dist/ParetoChart.js.map +1 -1
  113. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  114. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
  115. package/dist/PerformanceIntensiveMultiGraphDashboard.js +1 -1
  116. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
  117. package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
  118. package/dist/RadarChart.cjs +1 -1
  119. package/dist/RadarChart.cjs.map +1 -1
  120. package/dist/RadarChart.js +27 -26
  121. package/dist/RadarChart.js.map +1 -1
  122. package/dist/SankeyChart.cjs +1 -1
  123. package/dist/SankeyChart.cjs.map +1 -1
  124. package/dist/SankeyChart.js +30 -29
  125. package/dist/SankeyChart.js.map +1 -1
  126. package/dist/ScatterPlot.cjs +1 -1
  127. package/dist/ScatterPlot.cjs.map +1 -1
  128. package/dist/ScatterPlot.js +119 -118
  129. package/dist/ScatterPlot.js.map +1 -1
  130. package/dist/ScrollStory.d.ts +1 -0
  131. package/dist/SimpleLineChart.cjs +1 -1
  132. package/dist/SimpleLineChart.cjs.map +1 -1
  133. package/dist/SimpleLineChart.js +16 -15
  134. package/dist/SimpleLineChart.js.map +1 -1
  135. package/dist/SingleGraphDashboard.cjs +1 -1
  136. package/dist/SingleGraphDashboard.d.ts +1 -0
  137. package/dist/SingleGraphDashboard.js +2 -2
  138. package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
  139. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
  140. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
  141. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  142. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
  143. package/dist/SingleGraphDashboardThreeDGraphs.js +1 -1
  144. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
  145. package/dist/SlopeChart.cjs +1 -1
  146. package/dist/SlopeChart.cjs.map +1 -1
  147. package/dist/SlopeChart.js +46 -45
  148. package/dist/SlopeChart.js.map +1 -1
  149. package/dist/SparkLine.cjs +1 -1
  150. package/dist/SparkLine.cjs.map +1 -1
  151. package/dist/SparkLine.js +12 -11
  152. package/dist/SparkLine.js.map +1 -1
  153. package/dist/StripChart.cjs +1 -1
  154. package/dist/StripChart.cjs.map +1 -1
  155. package/dist/StripChart.js +81 -79
  156. package/dist/StripChart.js.map +1 -1
  157. package/dist/ThreeDGlobe.cjs +1 -1
  158. package/dist/ThreeDGlobe.cjs.map +1 -1
  159. package/dist/ThreeDGlobe.js +1 -0
  160. package/dist/ThreeDGlobe.js.map +1 -1
  161. package/dist/TreeMapGraph.cjs +1 -1
  162. package/dist/TreeMapGraph.cjs.map +1 -1
  163. package/dist/TreeMapGraph.js +114 -113
  164. package/dist/TreeMapGraph.js.map +1 -1
  165. package/dist/Types.d.ts +1 -0
  166. package/dist/UnitChart.cjs +1 -1
  167. package/dist/UnitChart.cjs.map +1 -1
  168. package/dist/UnitChart.js +10 -9
  169. package/dist/UnitChart.js.map +1 -1
  170. package/dist/{index-CZLvTu6p.cjs → index-BbNoLJ_w.cjs} +2 -2
  171. package/dist/{index-CZLvTu6p.cjs.map → index-BbNoLJ_w.cjs.map} +1 -1
  172. package/dist/{index-DGAaLNu9.js → index-Bc5VF70V.js} +46 -45
  173. package/dist/{index-DGAaLNu9.js.map → index-Bc5VF70V.js.map} +1 -1
  174. package/dist/index.cjs +1 -1
  175. package/dist/index.d.ts +8 -1
  176. package/dist/index.js +1 -1
  177. package/package.json +2 -2
  178. package/dist/GraphEl-OzC-icbr.cjs +0 -2
  179. package/dist/GraphEl-OzC-icbr.cjs.map +0 -1
  180. package/dist/GraphEl-s3ctz7oA.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RadarChart.js","sources":["../node_modules/d3-shape/src/curve/radial.js","../node_modules/d3-shape/src/lineRadial.js","../node_modules/d3-shape/src/noop.js","../node_modules/d3-shape/src/curve/cardinal.js","../node_modules/d3-shape/src/curve/cardinalClosed.js","../node_modules/d3-shape/src/curve/linearClosed.js","../src/Components/Graphs/RadarChart/Graph.tsx","../src/Components/Graphs/RadarChart/index.tsx"],"sourcesContent":["import curveLinear from \"./linear.js\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nexport default function curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport line from \"./line.js\";\n\nexport function lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nexport default function() {\n return lineRadial(line().curve(curveRadialLinear));\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { lineRadial, curveLinearClosed, curveCardinalClosed } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { scaleLinear } from 'd3-scale';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n RadarChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n radius: number;\r\n lineColors: string[];\r\n axisLabels: (string | number)[];\r\n data: RadarChartDataType[];\r\n\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n selectedColor?: string;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n strokeWidth: number;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n showValues: boolean;\r\n showDots: boolean;\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n curveType: 'linear' | 'curve';\r\n noOfTicks: number;\r\n maxValue?: number;\r\n minValue?: number;\r\n fillShape: boolean;\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n radius,\r\n lineColors,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n selectedColor,\r\n axisLabels,\r\n strokeWidth,\r\n showValues,\r\n showDots,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n leftMargin,\r\n curveType,\r\n noOfTicks,\r\n minValue,\r\n maxValue,\r\n resetSelectionOnDoubleClick,\r\n fillShape,\r\n highlightedLines,\r\n animate,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const curve = curveType === 'linear' ? curveLinearClosed : curveCardinalClosed;\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const radiusWithoutMargin = Math.min(\r\n (2 * radius - leftMargin - rightMargin) / 2,\r\n (2 * radius - topMargin - bottomMargin) / 2,\r\n );\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const angleScale = scaleLinear()\r\n .domain([0, data[0].values.length])\r\n .range([0, 2 * Math.PI]);\r\n\r\n const maxVal = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n\r\n const minVal = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) >= 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n const scale = scaleLinear().domain([minVal, maxVal]).range([0, radiusWithoutMargin]).nice();\r\n const ticksArray = scale.ticks(noOfTicks);\r\n const lineShape = lineRadial<number>()\r\n .radius(d => scale(d))\r\n .angle((_, i) => angleScale(i))\r\n .curve(curve);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g transform={`translate(${radiusWithoutMargin},${radiusWithoutMargin})`}>\r\n {axisLabels.map((d, i) => (\r\n <g key={i}>\r\n <line\r\n x1={0}\r\n y1={0}\r\n x2={Math.cos(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n y2={Math.sin(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n key={i}\r\n className={cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.axis,\r\n )}\r\n style={styles?.xAxis?.axis}\r\n />\r\n <text\r\n x={Math.cos(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n y={Math.sin(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n style={{\r\n textAnchor:\r\n Math.cos(angleScale(i) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.xAxis?.labels || ''),\r\n }}\r\n dy={\r\n Math.sin(angleScale(i) - Math.PI / 2) < 0\r\n ? 0\r\n : Math.sin(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 5\r\n : 10\r\n }\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.xAxis?.labels,\r\n )}\r\n >\r\n {d}\r\n </text>\r\n </g>\r\n ))}\r\n {ticksArray.map((d, i) => (\r\n <g key={i}>\r\n <path\r\n d={lineShape(Array(axisLabels.length).fill(d)) || ''}\r\n className={cn(\r\n 'stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.gridLines,\r\n )}\r\n style={{\r\n ...styles?.xAxis?.gridLines,\r\n fill: 'none',\r\n }}\r\n />\r\n <foreignObject\r\n x={-25}\r\n y={\r\n Math.sin(-Math.PI / 2) * scale(d) > -0.0001\r\n ? Math.sin(-Math.PI / 2) * scale(d) - 7\r\n : Math.sin(-Math.PI / 2) * scale(d) - 5\r\n }\r\n width={50}\r\n height={12}\r\n >\r\n <div className='flex justify-center'>\r\n <p\r\n className={cn(\r\n 'fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700',\r\n classNames?.xAxis?.labels,\r\n )}\r\n style={styles?.xAxis?.labels}\r\n >\r\n {numberFormattingFunction(d, 'NA', precision)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ))}\r\n <AnimatePresence>\r\n {data.map((d, i) => (\r\n <motion.g\r\n key={d.label || i}\r\n variants={{\r\n initial: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : 0.3\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.path\r\n d={lineShape(d.values) || ''}\r\n variants={{\r\n initial: { d: lineShape(d.values.map(_el => 0)) || '' },\r\n whileInView: {\r\n d: lineShape(d.values) || '',\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n fill: fillShape\r\n ? data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)]\r\n : 'none',\r\n fillOpacity: 0.1,\r\n strokeWidth,\r\n }}\r\n />\r\n <g>\r\n {d.values.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n cx={Math.cos(angleScale(j) - Math.PI / 2) * scale(el)}\r\n cy={Math.sin(angleScale(j) - Math.PI / 2) * scale(el)}\r\n r={4}\r\n style={{\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n }}\r\n variants={{\r\n initial: { cx: 0, cy: 0, opacity: 0 },\r\n whileInView: {\r\n cx: Math.cos(angleScale(j) - Math.PI / 2) * scale(el),\r\n cy: Math.sin(angleScale(j) - Math.PI / 2) * scale(el),\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n x={Math.cos(angleScale(j) - Math.PI / 2) * (scale(el) + 6)}\r\n y={Math.sin(angleScale(j) - Math.PI / 2) * (scale(el) + 6)}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor:\r\n Math.cos(angleScale(j) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n dy={\r\n Math.sin(angleScale(j) - Math.PI / 2) < 0\r\n ? 10\r\n : Math.sin(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 0\r\n : 0\r\n }\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n </g>\r\n </motion.g>\r\n ))}\r\n </AnimatePresence>\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.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 ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport uniqBy from 'lodash.uniqby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n RadarChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: RadarChartDataType[];\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 each line */\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 /** Radius of the radar chart */\r\n radius?: number;\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 for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle is the shape is filled or not */\r\n fillShape?: boolean;\r\n /** No. of ticks on the x-axis */\r\n noOfTicks?: number;\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 highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the axes */\r\n axisLabels: (string | number)[];\r\n /** Curve type for the line */\r\n curveType?: 'linear' | 'curve';\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\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\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 RadarChart(props: Props) {\r\n const {\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n topMargin = 75,\r\n bottomMargin = 75,\r\n leftMargin = 75,\r\n rightMargin = 75,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n language = 'en',\r\n theme = 'light',\r\n highlightedLines = [],\r\n width,\r\n height,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n relativeHeight,\r\n ariaLabel,\r\n colorLegendTitle,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n showNAColor = true,\r\n axisLabels,\r\n showDots = true,\r\n showValues = false,\r\n curveType = 'curve',\r\n noOfTicks = 5,\r\n minValue,\r\n maxValue,\r\n fillShape = false,\r\n resetSelectionOnDoubleClick = true,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 420);\r\n setSvgHeight(height || entries[0].target.clientHeight || 420);\r\n setGraphRadius(\r\n (Math.min(\r\n ...[\r\n width || entries[0].target.clientWidth || 620,\r\n height || entries[0].target.clientHeight || 480,\r\n ],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 420);\r\n setSvgWidth(graphDiv.current.clientWidth || 420);\r\n setGraphRadius(\r\n (Math.min(...[graphDiv.current.clientWidth, graphDiv.current.clientHeight]) || 420) / 2,\r\n );\r\n if (!width || !radius) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height, radius]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n minHeight: 'inherit',\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a donut or pie chart chart. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col gap-2 w-full grow justify-between'>\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.current : 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 <div\r\n className='flex grow flex-col justify-center items-stretch gap-8 flex-wrap'\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n }}\r\n >\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className={`flex ${\r\n width ? 'grow-0' : 'grow'\r\n } items-center justify-center leading-0`}\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n height: height\r\n ? `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`\r\n : 'auto',\r\n }}\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n <div className='w-full flex justify-center leading-0'>\r\n {radius || graphRadius ? (\r\n <Graph\r\n data={data}\r\n lineColors={\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) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n radius={radius || graphRadius}\r\n tooltip={tooltip}\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n selectedColor={selectedColor}\r\n axisLabels={axisLabels}\r\n strokeWidth={strokeWidth}\r\n showValues={showValues}\r\n showDots={showDots}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n curveType={curveType}\r\n noOfTicks={noOfTicks}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n fillShape={fillShape}\r\n highlightedLines={highlightedLines}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </>\r\n )}\r\n </div>\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 ) : (\r\n <div />\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["curveRadialLinear","curveRadial","curveLinear","Radial","curve","a","r","radial","context","lineRadial","l","c","_","lineRadial$1","line","noop","point","that","x","y","Cardinal","tension","custom","cardinal","CardinalClosed","curveCardinalClosed","LinearClosed","curveLinearClosed","Graph","props","data","radius","lineColors","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","detailsOnClick","styles","classNames","selectedColor","axisLabels","strokeWidth","showValues","showDots","rightMargin","topMargin","bottomMargin","leftMargin","curveType","noOfTicks","minValue","maxValue","resetSelectionOnDoubleClick","fillShape","highlightedLines","animate","dimmedOpacity","precision","customLayers","svgRef","useRef","isInView","useInView","margin","radiusWithoutMargin","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","angleScale","scaleLinear","maxVal","checkIfNullOrUndefined","d","minVal","scale","ticksArray","lineShape","i","jsxs","Fragment","jsx","motion","cn","numberFormattingFunction","AnimatePresence","event","isEqual","_el","el","Colors","j","Tooltip","Modal","string2HTML","RadarChart","graphTitle","colors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorLegendTitle","showNAColor","graphRadius","setGraphRadius","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,IAAIA,KAAoBC,GAAYC,EAAW;AAEtD,SAASC,GAAOC,GAAO;AACrB,OAAK,SAASA;AAChB;AAEAD,GAAO,YAAY;AAAA,EACjB,WAAW,WAAW;AACpB,SAAK,OAAO,UAAS;AAAA,EACvB;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,OAAO,QAAO;AAAA,EACrB;AAAA,EACA,WAAW,WAAW;AACpB,SAAK,OAAO,UAAS;AAAA,EACvB;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,OAAO,QAAO;AAAA,EACrB;AAAA,EACA,OAA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,mBAAA7C;AAAA,8BACA,oBAAAC;AAAA,8BACA,QAAAG;AAAA,8BACA,gBAAAD;AAAA,8BACA,eAAAG;AAAA,8BACA,YAAAC;AAAA,8BACA,aAAAC;AAAA,8BACA,YAAAC;AAAA,8BACA,UAAAC;AAAA,8BACA,WAAAE;AAAA,8BACA,cAAAC;AAAA,8BACA,YAAAC;AAAA,8BACA,aAAAH;AAAA,8BACA,WAAAI;AAAA,8BACA,WAAAC;AAAA,8BACA,UAAAC;AAAA,8BACA,UAAAC;AAAA,8BACA,WAAAE;AAAA,8BACA,kBAAAC;AAAA,8BACA,6BAAAF;AAAA,8BACA,SACEG,MAAY,KACR,EAAE,UAAU,KAAK,MAAM,IAAM,QAAQ,IAAA,IACrCA,KAAW,EAAE,UAAU,GAAG,MAAM,IAAM,QAAQ,EAAA;AAAA,8BAEpD,eAAAC;AAAA,8BACA,WAAAC;AAAA,8BACA,cAAAC;AAAA,4BAAA;AAAA,0BAAA,IAEA,KAAA,CACN;AAAA,wBAAA;AAAA,sBAAA;AAAA,oBACF,EAAA,CACF;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAGH6C,KAAWE,IACVnB,gBAAAA,EAAAA;AAAAA,kBAACmD;AAAA,kBAAA;AAAA,oBACC,QAAQ,EAAE,UAAUpG,GAAQ,UAAU,QAAQA,GAAQ,OAAA;AAAA,oBACtD,YAAY;AAAA,sBACV,UAAUC,GAAY;AAAA,sBACtB,QAAQA,GAAY;AAAA,oBAAA;AAAA,oBAEtB,SAAAiE;AAAA,oBACA,UAAAE;AAAA,oBACA,OAAAS;AAAA,kBAAA;AAAA,gBAAA,0BAGD,OAAA,CAAA,CAAI;AAAA,cAAA,EAAA,CAET;AAAA,YAAA;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1,2,3,4,5]}
1
+ {"version":3,"file":"RadarChart.js","sources":["../node_modules/d3-shape/src/curve/radial.js","../node_modules/d3-shape/src/lineRadial.js","../node_modules/d3-shape/src/noop.js","../node_modules/d3-shape/src/curve/cardinal.js","../node_modules/d3-shape/src/curve/cardinalClosed.js","../node_modules/d3-shape/src/curve/linearClosed.js","../src/Components/Graphs/RadarChart/Graph.tsx","../src/Components/Graphs/RadarChart/index.tsx"],"sourcesContent":["import curveLinear from \"./linear.js\";\n\nexport var curveRadialLinear = curveRadial(curveLinear);\n\nfunction Radial(curve) {\n this._curve = curve;\n}\n\nRadial.prototype = {\n areaStart: function() {\n this._curve.areaStart();\n },\n areaEnd: function() {\n this._curve.areaEnd();\n },\n lineStart: function() {\n this._curve.lineStart();\n },\n lineEnd: function() {\n this._curve.lineEnd();\n },\n point: function(a, r) {\n this._curve.point(r * Math.sin(a), r * -Math.cos(a));\n }\n};\n\nexport default function curveRadial(curve) {\n\n function radial(context) {\n return new Radial(curve(context));\n }\n\n radial._curve = curve;\n\n return radial;\n}\n","import curveRadial, {curveRadialLinear} from \"./curve/radial.js\";\nimport line from \"./line.js\";\n\nexport function lineRadial(l) {\n var c = l.curve;\n\n l.angle = l.x, delete l.x;\n l.radius = l.y, delete l.y;\n\n l.curve = function(_) {\n return arguments.length ? c(curveRadial(_)) : c()._curve;\n };\n\n return l;\n}\n\nexport default function() {\n return lineRadial(line().curve(curveRadialLinear));\n}\n","export default function() {}\n","export function point(that, x, y) {\n that._context.bezierCurveTo(\n that._x1 + that._k * (that._x2 - that._x0),\n that._y1 + that._k * (that._y2 - that._y0),\n that._x2 + that._k * (that._x1 - x),\n that._y2 + that._k * (that._y1 - y),\n that._x2,\n that._y2\n );\n}\n\nexport function Cardinal(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinal.prototype = {\n areaStart: function() {\n this._line = 0;\n },\n areaEnd: function() {\n this._line = NaN;\n },\n lineStart: function() {\n this._x0 = this._x1 = this._x2 =\n this._y0 = this._y1 = this._y2 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 2: this._context.lineTo(this._x2, this._y2); break;\n case 3: point(this, this._x1, this._y1); break;\n }\n if (this._line || (this._line !== 0 && this._point === 1)) this._context.closePath();\n this._line = 1 - this._line;\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y); break;\n case 1: this._point = 2; this._x1 = x, this._y1 = y; break;\n case 2: this._point = 3; // falls through\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new Cardinal(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\nimport {point} from \"./cardinal.js\";\n\nexport function CardinalClosed(context, tension) {\n this._context = context;\n this._k = (1 - tension) / 6;\n}\n\nCardinalClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 =\n this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN;\n this._point = 0;\n },\n lineEnd: function() {\n switch (this._point) {\n case 1: {\n this._context.moveTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 2: {\n this._context.lineTo(this._x3, this._y3);\n this._context.closePath();\n break;\n }\n case 3: {\n this.point(this._x3, this._y3);\n this.point(this._x4, this._y4);\n this.point(this._x5, this._y5);\n break;\n }\n }\n },\n point: function(x, y) {\n x = +x, y = +y;\n switch (this._point) {\n case 0: this._point = 1; this._x3 = x, this._y3 = y; break;\n case 1: this._point = 2; this._context.moveTo(this._x4 = x, this._y4 = y); break;\n case 2: this._point = 3; this._x5 = x, this._y5 = y; break;\n default: point(this, x, y); break;\n }\n this._x0 = this._x1, this._x1 = this._x2, this._x2 = x;\n this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;\n }\n};\n\nexport default (function custom(tension) {\n\n function cardinal(context) {\n return new CardinalClosed(context, tension);\n }\n\n cardinal.tension = function(tension) {\n return custom(+tension);\n };\n\n return cardinal;\n})(0);\n","import noop from \"../noop.js\";\n\nfunction LinearClosed(context) {\n this._context = context;\n}\n\nLinearClosed.prototype = {\n areaStart: noop,\n areaEnd: noop,\n lineStart: function() {\n this._point = 0;\n },\n lineEnd: function() {\n if (this._point) this._context.closePath();\n },\n point: function(x, y) {\n x = +x, y = +y;\n if (this._point) this._context.lineTo(x, y);\n else this._point = 1, this._context.moveTo(x, y);\n }\n};\n\nexport default function(context) {\n return new LinearClosed(context);\n}\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { lineRadial, curveLinearClosed, curveCardinalClosed } from 'd3-shape';\r\nimport { useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { scaleLinear } from 'd3-scale';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n RadarChartDataType,\r\n StyleObject,\r\n} from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n radius: number;\r\n lineColors: string[];\r\n axisLabels: (string | number)[];\r\n data: RadarChartDataType[];\r\n\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n selectedColor?: string;\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n strokeWidth: number;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n showValues: boolean;\r\n showDots: boolean;\r\n topMargin: number;\r\n bottomMargin: number;\r\n leftMargin: number;\r\n rightMargin: number;\r\n curveType: 'linear' | 'curve';\r\n noOfTicks: number;\r\n maxValue?: number;\r\n minValue?: number;\r\n fillShape: boolean;\r\n resetSelectionOnDoubleClick: boolean;\r\n highlightedLines: (string | number)[];\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n precision: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n radius,\r\n lineColors,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n selectedColor,\r\n axisLabels,\r\n strokeWidth,\r\n showValues,\r\n showDots,\r\n rightMargin,\r\n topMargin,\r\n bottomMargin,\r\n leftMargin,\r\n curveType,\r\n noOfTicks,\r\n minValue,\r\n maxValue,\r\n resetSelectionOnDoubleClick,\r\n fillShape,\r\n highlightedLines,\r\n animate,\r\n dimmedOpacity,\r\n precision,\r\n customLayers,\r\n } = props;\r\n const svgRef = useRef(null);\r\n const isInView = useInView(svgRef, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const curve = curveType === 'linear' ? curveLinearClosed : curveCardinalClosed;\r\n const margin = {\r\n top: topMargin,\r\n bottom: bottomMargin,\r\n left: leftMargin,\r\n right: rightMargin,\r\n };\r\n const radiusWithoutMargin = Math.min(\r\n (2 * radius - leftMargin - rightMargin) / 2,\r\n (2 * radius - topMargin - bottomMargin) / 2,\r\n );\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const angleScale = scaleLinear()\r\n .domain([0, data[0].values.length])\r\n .range([0, 2 * Math.PI]);\r\n\r\n const maxVal = !checkIfNullOrUndefined(maxValue)\r\n ? (maxValue as number)\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) < 0\r\n ? 0\r\n : Math.max(\r\n ...data.map(d =>\r\n Math.max(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n\r\n const minVal = !checkIfNullOrUndefined(minValue)\r\n ? (minValue as number)\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n ) >= 0\r\n ? 0\r\n : Math.min(\r\n ...data.map(d =>\r\n Math.min(...(d.values.filter(l => !checkIfNullOrUndefined(l)) as number[])),\r\n ),\r\n );\r\n const scale = scaleLinear().domain([minVal, maxVal]).range([0, radiusWithoutMargin]).nice();\r\n const ticksArray = scale.ticks(noOfTicks);\r\n const lineShape = lineRadial<number>()\r\n .radius(d => scale(d))\r\n .angle((_, i) => angleScale(i))\r\n .curve(curve);\r\n return (\r\n <>\r\n <motion.svg\r\n width={`${radius * 2}px`}\r\n height={`${radius * 2}px`}\r\n viewBox={`0 0 ${radius * 2} ${radius * 2}`}\r\n direction='ltr'\r\n ref={svgRef}\r\n >\r\n <g transform={`translate(${margin.left},${margin.top})`}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n <g transform={`translate(${radiusWithoutMargin},${radiusWithoutMargin})`}>\r\n {axisLabels.map((d, i) => (\r\n <g key={i}>\r\n <line\r\n x1={0}\r\n y1={0}\r\n x2={Math.cos(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n y2={Math.sin(angleScale(i) - Math.PI / 2) * radiusWithoutMargin}\r\n key={i}\r\n className={cn(\r\n 'stroke-1 stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.axis,\r\n )}\r\n style={styles?.xAxis?.axis}\r\n />\r\n <text\r\n x={Math.cos(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n y={Math.sin(angleScale(i) - Math.PI / 2) * (radiusWithoutMargin + 6)}\r\n style={{\r\n textAnchor:\r\n Math.cos(angleScale(i) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.xAxis?.labels || ''),\r\n }}\r\n dy={\r\n Math.sin(angleScale(i) - Math.PI / 2) < 0\r\n ? 0\r\n : Math.sin(angleScale(i) - Math.PI / 2) < 0.00001\r\n ? 5\r\n : 10\r\n }\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.xAxis?.labels,\r\n )}\r\n >\r\n {d}\r\n </text>\r\n </g>\r\n ))}\r\n {ticksArray.map((d, i) => (\r\n <g key={i}>\r\n <path\r\n d={lineShape(Array(axisLabels.length).fill(d)) || ''}\r\n className={cn(\r\n 'stroke-primary-gray-500 dark:stroke-primary-gray-550',\r\n classNames?.xAxis?.gridLines,\r\n )}\r\n style={{\r\n ...styles?.xAxis?.gridLines,\r\n fill: 'none',\r\n }}\r\n />\r\n <foreignObject\r\n x={-25}\r\n y={\r\n Math.sin(-Math.PI / 2) * scale(d) > -0.0001\r\n ? Math.sin(-Math.PI / 2) * scale(d) - 7\r\n : Math.sin(-Math.PI / 2) * scale(d) - 5\r\n }\r\n width={50}\r\n height={12}\r\n >\r\n <div className='flex justify-center'>\r\n <p\r\n className={cn(\r\n 'fill-primary-gray-500 dark:fill-primary-gray-550 text-xs m-0 py-0 px-1.5 text-center leading-none bg-primary-white dark:bg-primary-gray-700',\r\n classNames?.xAxis?.labels,\r\n )}\r\n style={styles?.xAxis?.labels}\r\n >\r\n {numberFormattingFunction(d, 'NA', precision)}\r\n </p>\r\n </div>\r\n </foreignObject>\r\n </g>\r\n ))}\r\n <AnimatePresence>\r\n {data.map((d, i) => (\r\n <motion.g\r\n key={d.label || i}\r\n variants={{\r\n initial: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : 0.3\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n opacity: mouseOverData\r\n ? d.label === mouseOverData.label\r\n ? 1\r\n : dimmedOpacity\r\n : selectedColor\r\n ? d.color\r\n ? lineColors[colorDomain.indexOf(d.color)] === selectedColor\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : highlightedLines.length !== 0\r\n ? d.label\r\n ? highlightedLines.indexOf(d.label) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n >\r\n <motion.path\r\n d={lineShape(d.values) || ''}\r\n variants={{\r\n initial: { d: lineShape(d.values.map(_el => 0)) || '' },\r\n whileInView: {\r\n d: lineShape(d.values) || '',\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n style={{\r\n stroke:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n fill: fillShape\r\n ? data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)]\r\n : 'none',\r\n fillOpacity: 0.1,\r\n strokeWidth,\r\n }}\r\n />\r\n <g>\r\n {d.values.map((el, j) => (\r\n <g key={j}>\r\n {!checkIfNullOrUndefined(el) ? (\r\n <>\r\n {showDots ? (\r\n <motion.circle\r\n cx={Math.cos(angleScale(j) - Math.PI / 2) * scale(el)}\r\n cy={Math.sin(angleScale(j) - Math.PI / 2) * scale(el)}\r\n r={4}\r\n style={{\r\n fill:\r\n data.filter(el => el.color).length === 0\r\n ? lineColors[0]\r\n : !d.color\r\n ? Colors.gray\r\n : lineColors[colorDomain.indexOf(d.color)],\r\n }}\r\n variants={{\r\n initial: { cx: 0, cy: 0, opacity: 0 },\r\n whileInView: {\r\n cx: Math.cos(angleScale(j) - Math.PI / 2) * scale(el),\r\n cy: Math.sin(angleScale(j) - Math.PI / 2) * scale(el),\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n />\r\n ) : null}\r\n {showValues ? (\r\n <motion.text\r\n x={Math.cos(angleScale(j) - Math.PI / 2) * (scale(el) + 6)}\r\n y={Math.sin(angleScale(j) - Math.PI / 2) * (scale(el) + 6)}\r\n style={{\r\n fill: lineColors[i],\r\n textAnchor:\r\n Math.cos(angleScale(j) - Math.PI / 2) < 0\r\n ? 'end'\r\n : Math.cos(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 'middle'\r\n : 'start',\r\n ...(styles?.graphObjectValues || {}),\r\n }}\r\n dy={\r\n Math.sin(angleScale(j) - Math.PI / 2) < 0\r\n ? 10\r\n : Math.sin(angleScale(j) - Math.PI / 2) < 0.00001\r\n ? 0\r\n : 0\r\n }\r\n className={cn(\r\n 'graph-value text-xs font-bold',\r\n classNames?.graphObjectValues,\r\n )}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n >\r\n {numberFormattingFunction(el, 'NA', precision)}\r\n </motion.text>\r\n ) : null}\r\n </>\r\n ) : null}\r\n </g>\r\n ))}\r\n </g>\r\n </motion.g>\r\n ))}\r\n </AnimatePresence>\r\n </g>\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.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 ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport uniqBy from 'lodash.uniqby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n RadarChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { EmptyState } from '@/Components/Elements/EmptyState';\r\nimport { ColorLegendWithMouseOver } from '@/Components/Elements/ColorLegendWithMouseOver';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: RadarChartDataType[];\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 each line */\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 /** Radius of the radar chart */\r\n radius?: number;\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 for the chart */\r\n maxValue?: number;\r\n /** Minimum value for the chart */\r\n minValue?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of values */\r\n showValues?: boolean;\r\n /** Toggle visibility of dots on the line */\r\n showDots?: boolean;\r\n /** Stroke width of the line */\r\n strokeWidth?: number;\r\n /** Toggle is the shape is filled or not */\r\n fillShape?: boolean;\r\n /** No. of ticks on the x-axis */\r\n noOfTicks?: number;\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 highlightedLines?: (string | number)[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Labels for the axes */\r\n axisLabels: (string | number)[];\r\n /** Curve type for the line */\r\n curveType?: 'linear' | 'curve';\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\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\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n /** Callback for mouse over event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n /** Callback for mouse click event */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\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 RadarChart(props: Props) {\r\n const {\r\n graphTitle,\r\n colors,\r\n sources,\r\n graphDescription,\r\n footNote,\r\n radius,\r\n data,\r\n showColorScale = true,\r\n padding,\r\n backgroundColor = false,\r\n tooltip,\r\n onSeriesMouseOver,\r\n graphID,\r\n onSeriesMouseClick,\r\n topMargin = 75,\r\n bottomMargin = 75,\r\n leftMargin = 75,\r\n rightMargin = 75,\r\n graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n language = 'en',\r\n theme = 'light',\r\n highlightedLines = [],\r\n width,\r\n height,\r\n minHeight = 0,\r\n strokeWidth = 2,\r\n relativeHeight,\r\n ariaLabel,\r\n colorLegendTitle,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n showNAColor = true,\r\n axisLabels,\r\n showDots = true,\r\n showValues = false,\r\n curveType = 'curve',\r\n noOfTicks = 5,\r\n minValue,\r\n maxValue,\r\n fillShape = false,\r\n resetSelectionOnDoubleClick = true,\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n precision = 2,\r\n customLayers = [],\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].target.clientWidth || 420);\r\n setSvgHeight(height || entries[0].target.clientHeight || 420);\r\n setGraphRadius(\r\n (Math.min(\r\n ...[\r\n width || entries[0].target.clientWidth || 620,\r\n height || entries[0].target.clientHeight || 480,\r\n ],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 420);\r\n setSvgWidth(graphDiv.current.clientWidth || 420);\r\n setGraphRadius(\r\n (Math.min(...[graphDiv.current.clientWidth, graphDiv.current.clientHeight]) || 420) / 2,\r\n );\r\n if (!width || !radius) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height, radius]);\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n minHeight: 'inherit',\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is a donut or pie chart chart. ${graphDescription ? ` ${graphDescription}` : ''}`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col gap-2 w-full grow justify-between'>\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.current : 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 <div\r\n className='flex grow flex-col justify-center items-stretch gap-8 flex-wrap'\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n }}\r\n >\r\n {data.length === 0 ? (\r\n <EmptyState />\r\n ) : (\r\n <>\r\n {showColorScale && data.filter(el => el.color).length !== 0 ? (\r\n <ColorLegendWithMouseOver\r\n width={width}\r\n colorLegendTitle={colorLegendTitle}\r\n colors={\r\n (colors as string[] | undefined) || Colors[theme].categoricalColors.colors\r\n }\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n setSelectedColor={setSelectedColor}\r\n showNAColor={showNAColor}\r\n />\r\n ) : null}\r\n <div\r\n className={`flex ${\r\n width ? 'grow-0' : 'grow'\r\n } items-center justify-center leading-0`}\r\n style={{\r\n width: width ? `${width}px` : '100%',\r\n height: height\r\n ? `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`\r\n : 'auto',\r\n }}\r\n ref={graphDiv}\r\n aria-label='Graph area'\r\n >\r\n <div className='w-full flex justify-center leading-0'>\r\n {radius || graphRadius ? (\r\n <Graph\r\n data={data}\r\n lineColors={\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) ||\r\n Colors[theme].categoricalColors.colors\r\n }\r\n radius={radius || graphRadius}\r\n tooltip={tooltip}\r\n colorDomain={\r\n colorDomain ||\r\n (uniqBy(\r\n data.filter(el => el.color),\r\n 'color',\r\n ).map(d => d.color) as string[])\r\n }\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n selectedColor={selectedColor}\r\n axisLabels={axisLabels}\r\n strokeWidth={strokeWidth}\r\n showValues={showValues}\r\n showDots={showDots}\r\n topMargin={topMargin}\r\n bottomMargin={bottomMargin}\r\n leftMargin={leftMargin}\r\n rightMargin={rightMargin}\r\n curveType={curveType}\r\n noOfTicks={noOfTicks}\r\n minValue={minValue}\r\n maxValue={maxValue}\r\n fillShape={fillShape}\r\n highlightedLines={highlightedLines}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n precision={precision}\r\n customLayers={customLayers}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </>\r\n )}\r\n </div>\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 ) : (\r\n <div />\r\n )}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["curveRadialLinear","curveRadial","curveLinear","Radial","curve","a","r","radial","context","lineRadial","l","c","_","lineRadial$1","line","noop","point","that","x","y","Cardinal","tension","custom","cardinal","CardinalClosed","curveCardinalClosed","LinearClosed","curveLinearClosed","Graph","props","data","radius","lineColors","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","detailsOnClick","styles","classNames","selectedColor","axisLabels","strokeWidth","showValues","showDots","rightMargin","topMargin","bottomMargin","leftMargin","curveType","noOfTicks","minValue","maxValue","resetSelectionOnDoubleClick","fillShape","highlightedLines","animate","dimmedOpacity","precision","customLayers","svgRef","useRef","isInView","useInView","margin","radiusWithoutMargin","mouseOverData","setMouseOverData","useState","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","angleScale","scaleLinear","maxVal","checkIfNullOrUndefined","d","minVal","scale","ticksArray","lineShape","i","jsxs","Fragment","jsx","motion","cn","numberFormattingFunction","AnimatePresence","event","isEqual","_el","el","Colors","j","Tooltip","Modal","string2HTML","RadarChart","graphTitle","colors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorLegendTitle","showNAColor","graphRadius","setGraphRadius","svgWidth","setSvgWidth","svgHeight","setSvgHeight","setSelectedColor","graphDiv","graphParentDiv","useEffect","resizeObserver","entries","GraphHeader","EmptyState","ColorLegendWithMouseOver","uniqBy","GraphFooter"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,IAAIA,KAAoBC,GAAYC,EAAW;AAEtD,SAASC,GAAOC,GAAO;AACrB,OAAK,SAASA;AAChB;AAEAD,GAAO,YAAY;AAAA,EACjB,WAAW,WAAW;AACpB,SAAK,OAAO,UAAS;AAAA,EACvB;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,OAAO,QAAO;AAAA,EACrB;AAAA,EACA,WAAW,WAAW;AACpB,SAAK,OAAO,UAAS;AAAA,EACvB;AAAA,EACA,SAAS,WAAW;AAClB,SAAK,OAAO,QAAO;AAAA,EACrB;AAAA,EACA,OAAO,SAASE,GAAGC,GAA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const h=require("./index-CHPV5EwG-DDoeWRVt.cjs"),q=require("react"),ot=require("./index-CZbIGs8q.cjs"),ut=require("./index-BzeLQvXk.cjs"),Et=require("./index-C21TvELx.cjs"),Dt=require("./index-BXns0-ng.cjs"),Pt=require("./Modal-tXZlLE5s.cjs"),ct=require("./Typography-k-kOjICQ.cjs"),Lt=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-n8z5bfav.cjs"),It=require("./string2HTML-D2Avudmb.cjs"),Ht=require("./use-in-view-sQJZ_xDO.cjs"),xt=require("./proxy-BHRoeZgd.cjs"),At=require("./index-BW8iNx7E.cjs"),Wt=require("./GraphHeader.cjs"),Gt=require("./GraphFooter.cjs"),Mt=require("./Colors.cjs"),Ft=require("./generateRandomString-B5zBiJzS.cjs"),Xt=require("./EmptyState-d8_8SxeW.cjs");function Rt(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i<a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i<l||i===void 0&&l>=l)&&(i=l)}return i}function Ot(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i>a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}return i}function pt(e,n){let i=0;if(n===void 0)for(let a of e)(a=+a)&&(i+=a);else{let a=-1;for(let l of e)(l=+n(l,++a,e))&&(i+=l)}return i}function Yt(e){return e.target.depth}function Ut(e,n){return e.sourceLinks.length?e.depth:n-1}function mt(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Ot(e.sourceLinks,Yt)-1:0}function ft(e){return function(){return e}}function St(e,n){return ht(e.source,n.source)||e.index-n.index}function _t(e,n){return ht(e.target,n.target)||e.index-n.index}function ht(e,n){return e.y0-n.y0}function yt(e){return e.value}function Zt(e){return e.index}function Qt(e){return e.nodes}function Jt(e){return e.links}function Nt(e,n){const i=e.get(n);if(!i)throw new Error("missing: "+n);return i}function Ct({nodes:e}){for(const n of e){let i=n.y0,a=i;for(const l of n.sourceLinks)l.y0=i+l.width/2,i+=l.width;for(const l of n.targetLinks)l.y1=a+l.width/2,a+=l.width}}function vt(){let e=0,n=0,i=1,a=1,l=24,m=8,g,x=Zt,v=Ut,w,j,b=Qt,$=Jt,R=6;function d(){const t={nodes:b.apply(null,arguments),links:$.apply(null,arguments)};return S(t),L(t),V(t),X(t),A(t),Ct(t),t}d.update=function(t){return Ct(t),t},d.nodeId=function(t){return arguments.length?(x=typeof t=="function"?t:ft(t),d):x},d.nodeAlign=function(t){return arguments.length?(v=typeof t=="function"?t:ft(t),d):v},d.nodeSort=function(t){return arguments.length?(w=t,d):w},d.nodeWidth=function(t){return arguments.length?(l=+t,d):l},d.nodePadding=function(t){return arguments.length?(m=g=+t,d):m},d.nodes=function(t){return arguments.length?(b=typeof t=="function"?t:ft(t),d):b},d.links=function(t){return arguments.length?($=typeof t=="function"?t:ft(t),d):$},d.linkSort=function(t){return arguments.length?(j=t,d):j},d.size=function(t){return arguments.length?(e=n=0,i=+t[0],a=+t[1],d):[i-e,a-n]},d.extent=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],n=+t[0][1],a=+t[1][1],d):[[e,n],[i,a]]},d.iterations=function(t){return arguments.length?(R=+t,d):R};function S({nodes:t,links:u}){for(const[c,r]of t.entries())r.index=c,r.sourceLinks=[],r.targetLinks=[];const s=new Map(t.map((c,r)=>[x(c,r,t),c]));for(const[c,r]of u.entries()){r.index=c;let{source:f,target:p}=r;typeof f!="object"&&(f=r.source=Nt(s,f)),typeof p!="object"&&(p=r.target=Nt(s,p)),f.sourceLinks.push(r),p.targetLinks.push(r)}if(j!=null)for(const{sourceLinks:c,targetLinks:r}of t)c.sort(j),r.sort(j)}function L({nodes:t}){for(const u of t)u.value=u.fixedValue===void 0?Math.max(pt(u.sourceLinks,yt),pt(u.targetLinks,yt)):u.fixedValue}function V({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.depth=r;for(const{target:p}of f.sourceLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function X({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.height=r;for(const{source:p}of f.targetLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function B({nodes:t}){const u=Rt(t,r=>r.depth)+1,s=(i-e-l)/(u-1),c=new Array(u);for(const r of t){const f=Math.max(0,Math.min(u-1,Math.floor(v.call(null,r,u))));r.layer=f,r.x0=e+f*s,r.x1=r.x0+l,c[f]?c[f].push(r):c[f]=[r]}if(w)for(const r of c)r.sort(w);return c}function _(t){const u=Ot(t,s=>(a-n-(s.length-1)*g)/pt(s,yt));for(const s of t){let c=n;for(const r of s){r.y0=c,r.y1=c+r.value*u,c=r.y1+g;for(const f of r.sourceLinks)f.width=f.value*u}c=(a-c+g)/(s.length+1);for(let r=0;r<s.length;++r){const f=s[r];f.y0+=c*(r+1),f.y1+=c*(r+1)}P(s)}}function A(t){const u=B(t);g=Math.min(m,(a-n)/(Rt(u,s=>s.length)-1)),_(u);for(let s=0;s<R;++s){const c=Math.pow(.99,s),r=Math.max(1-c,(s+1)/R);tt(u,c,r),K(u,c,r)}}function K(t,u,s){for(let c=1,r=t.length;c<r;++c){const f=t[c];for(const p of f){let N=0,C=0;for(const{source:I,value:O}of p.targetLinks){let H=O*(p.layer-I.layer);N+=U(I,p)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function tt(t,u,s){for(let c=t.length,r=c-2;r>=0;--r){const f=t[r];for(const p of f){let N=0,C=0;for(const{target:I,value:O}of p.sourceLinks){let H=O*(I.layer-p.layer);N+=nt(p,I)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function D(t,u){const s=t.length>>1,c=t[s];et(t,c.y0-g,s-1,u),Y(t,c.y1+g,s+1,u),et(t,a,t.length-1,u),Y(t,n,0,u)}function Y(t,u,s,c){for(;s<t.length;++s){const r=t[s],f=(u-r.y0)*c;f>1e-6&&(r.y0+=f,r.y1+=f),u=r.y1+g}}function et(t,u,s,c){for(;s>=0;--s){const r=t[s],f=(r.y1-u)*c;f>1e-6&&(r.y0-=f,r.y1-=f),u=r.y0-g}}function T({sourceLinks:t,targetLinks:u}){if(j===void 0){for(const{source:{sourceLinks:s}}of u)s.sort(_t);for(const{target:{targetLinks:s}}of t)s.sort(St)}}function P(t){if(j===void 0)for(const{sourceLinks:u,targetLinks:s}of t)u.sort(_t),s.sort(St)}function U(t,u){let s=t.y0-(t.sourceLinks.length-1)*g/2;for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s+=r+g}for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s-=r}return s}function nt(t,u){let s=u.y0-(u.targetLinks.length-1)*g/2;for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s+=r+g}for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s-=r}return s}return d}var jt=Math.PI,kt=2*jt,J=1e-6,Kt=kt-J;function wt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qt(){return new wt}wt.prototype=qt.prototype={constructor:wt,moveTo:function(e,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,n){this._+="L"+(this._x1=+e)+","+(this._y1=+n)},quadraticCurveTo:function(e,n,i,a){this._+="Q"+ +e+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},bezierCurveTo:function(e,n,i,a,l,m){this._+="C"+ +e+","+ +n+","+ +i+","+ +a+","+(this._x1=+l)+","+(this._y1=+m)},arcTo:function(e,n,i,a,l){e=+e,n=+n,i=+i,a=+a,l=+l;var m=this._x1,g=this._y1,x=i-e,v=a-n,w=m-e,j=g-n,b=w*w+j*j;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=n);else if(b>J)if(!(Math.abs(j*x-v*w)>J)||!l)this._+="L"+(this._x1=e)+","+(this._y1=n);else{var $=i-m,R=a-g,d=x*x+v*v,S=$*$+R*R,L=Math.sqrt(d),V=Math.sqrt(b),X=l*Math.tan((jt-Math.acos((d+b-S)/(2*L*V)))/2),B=X/V,_=X/L;Math.abs(B-1)>J&&(this._+="L"+(e+B*w)+","+(n+B*j)),this._+="A"+l+","+l+",0,0,"+ +(j*$>w*R)+","+(this._x1=e+_*x)+","+(this._y1=n+_*v)}},arc:function(e,n,i,a,l,m){e=+e,n=+n,i=+i,m=!!m;var g=i*Math.cos(a),x=i*Math.sin(a),v=e+g,w=n+x,j=1^m,b=m?a-l:l-a;if(i<0)throw new Error("negative radius: "+i);this._x1===null?this._+="M"+v+","+w:(Math.abs(this._x1-v)>J||Math.abs(this._y1-w)>J)&&(this._+="L"+v+","+w),i&&(b<0&&(b=b%kt+kt),b>Kt?this._+="A"+i+","+i+",0,1,"+j+","+(e-g)+","+(n-x)+"A"+i+","+i+",0,1,"+j+","+(this._x1=v)+","+(this._y1=w):b>J&&(this._+="A"+i+","+i+",0,"+ +(b>=jt)+","+j+","+(this._x1=e+i*Math.cos(l))+","+(this._y1=n+i*Math.sin(l))))},rect:function(e,n,i,a){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +a+"h"+-i+"Z"},toString:function(){return this._}};function Tt(e){return function(){return e}}function te(e){return e[0]}function ee(e){return e[1]}var ne=Array.prototype.slice;function oe(e){return e.source}function ie(e){return e.target}function re(e){var n=oe,i=ie,a=te,l=ee,m=null;function g(){var x,v=ne.call(arguments),w=n.apply(this,v),j=i.apply(this,v);if(m||(m=x=qt()),e(m,+a.apply(this,(v[0]=w,v)),+l.apply(this,v),+a.apply(this,(v[0]=j,v)),+l.apply(this,v)),x)return m=null,x+""||null}return g.source=function(x){return arguments.length?(n=x,g):n},g.target=function(x){return arguments.length?(i=x,g):i},g.x=function(x){return arguments.length?(a=typeof x=="function"?x:Tt(+x),g):a},g.y=function(x){return arguments.length?(l=typeof x=="function"?x:Tt(+x),g):l},g.context=function(x){return arguments.length?(m=x??null,g):m},g}function se(e,n,i,a,l){e.moveTo(n,i),e.bezierCurveTo(n=(n+a)/2,i,n,l,a,l)}function ae(){return re(se)}function le(e){return[e.source.x1,e.y0]}function ue(e){return[e.target.x0,e.y1]}function ce(){return ae().source(le).target(ue)}function fe(e){const{data:n,showLabels:i,leftMargin:a,rightMargin:l,truncateBy:m,width:g,height:x,topMargin:v,bottomMargin:w,tooltip:j,onSeriesMouseOver:b,suffix:$,prefix:R,showValues:d,onSeriesMouseClick:S,nodePadding:L,nodeWidth:V,id:X,highlightedSourceDataPoints:B,highlightedTargetDataPoints:_,defaultLinkOpacity:A,sourceTitle:K,targetTitle:tt,animate:D,sortNodes:Y,resetSelectionOnDoubleClick:et,detailsOnClick:T,styles:P,classNames:U,precision:nt,customLayers:t}=e,u=q.useRef(null),s=Ht.useInView(u,{once:D.once,amount:D.amount}),[c,r]=q.useState(void 0),[f,p]=q.useState(void 0),[N,C]=q.useState(void 0),[W,I]=q.useState(void 0),[O,H]=q.useState(void 0),z={top:v,bottom:w,left:a,right:l},G=g-z.left-z.right,F=x-z.top-z.bottom,rt=Y==="mostReadable"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt):Y==="none"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(()=>null).linkSort(()=>null):vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(Y==="desc"?(o,M)=>(M.value||0)-(o.value||0):(o,M)=>(o.value||0)-(M.value||0)),{nodes:st,links:at}=rt(n),Q=ce();return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[h.jsxRuntimeExports.jsxs(xt.motion.svg,{width:`${g}px`,height:`${x}px`,viewBox:`0 0 ${g} ${x}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:u,children:[K?h.jsxRuntimeExports.jsx("text",{x:z.left,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:K}):null,tt?h.jsxRuntimeExports.jsx("text",{x:g-z.right,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:tt}):null,h.jsxRuntimeExports.jsxs("g",{transform:`translate(${z.left},${z.top})`,children:[t.filter(o=>o.position==="before").map(o=>o.layer),st.filter(o=>o.type==="source").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:0-a,width:a,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`,overflow:"visible"},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-right-label text-right",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:"none",size:"sm",leading:"none",className:h.mo("sankey-right-value text-right font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),st.filter(o=>o.type==="target").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:V,width:l-V,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-left-label text-left",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{size:"sm",leading:"none",marginBottom:"none",className:h.mo("sankey-left-value text-left font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),h.jsxRuntimeExports.jsx("defs",{children:at.map((o,M)=>h.jsxRuntimeExports.jsxs("linearGradient",{id:`${X}-gradient-${M}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[h.jsxRuntimeExports.jsx("stop",{offset:"0%",style:{stopColor:o.source.color,stopOpacity:1}}),h.jsxRuntimeExports.jsx("stop",{offset:"100%",style:{stopColor:o.target.color,stopOpacity:1}})]},M))}),h.jsxRuntimeExports.jsx("g",{children:h.jsxRuntimeExports.jsx(At.AnimatePresence,{children:at.map((o,M)=>h.jsxRuntimeExports.jsx(xt.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:Z=>{r(o.data),H(Z.clientY),I(Z.clientX),b?.(o)},onMouseMove:Z=>{r(o.data),H(Z.clientY),I(Z.clientX)},onClick:()=>{(S||T)&&(Dt.isEqual(f,o.data)&&et?(p(void 0),S?.(void 0)):(p(o.data),S?.(o.data)))},onMouseLeave:()=>{r(void 0),I(void 0),H(void 0),b?.(void 0)},variants:{initial:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A},whileInView:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:h.jsxRuntimeExports.jsx(xt.motion.path,{d:Q(o)||"",style:{stroke:`url(#${X}-gradient-${M})`,strokeWidth:o.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial"},`${o.source}-${o.target}`)},`${o.source}-${o.target}`))})}),t.filter(o=>o.position==="after").map(o=>o.layer)]})]}),c&&j&&W&&O?h.jsxRuntimeExports.jsx(zt.Tooltip,{data:c,body:j,xPos:W,yPos:O,backgroundStyle:P?.tooltip,className:U?.tooltip}):null,T&&f!==void 0?h.jsxRuntimeExports.jsx(Pt.X,{open:f!==void 0,onClose:()=>{p(void 0)},children:h.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof T=="string"?{__html:It.string2HTML(T,f)}:void 0,children:typeof T=="function"?T(f):null})}):null]})}function he(e){const{data:n,graphTitle:i,sources:a,graphDescription:l,showLabels:m=!0,leftMargin:g=75,rightMargin:x=75,topMargin:v=30,bottomMargin:w=10,truncateBy:j=999,height:b,width:$,footNote:R,padding:d,backgroundColor:S,tooltip:L,onSeriesMouseOver:V,suffix:X="",prefix:B="",relativeHeight:_,showValues:A=!0,graphID:K,onSeriesMouseClick:tt,graphDownload:D=!1,dataDownload:Y=!1,fillContainer:et=!0,language:T="en",minHeight:P=0,theme:U="light",ariaLabel:nt,sourceColors:t,targetColors:u,sourceColorDomain:s,targetColorDomain:c,nodePadding:r=5,nodeWidth:f=5,highlightedSourceDataPoints:p=[],highlightedTargetDataPoints:N=[],defaultLinkOpacity:C=.3,sourceTitle:W,targetTitle:I,sortNodes:O="mostReadable",resetSelectionOnDoubleClick:H=!0,detailsOnClick:z,styles:G,classNames:F,animate:rt=!1,precision:st=2,customLayers:at=[]}=e,[Q,o]=q.useState(0),[M,Z]=q.useState(0),[bt,Vt]=q.useState(void 0),it=q.useRef(null),$t=q.useRef(null);return q.useEffect(()=>{const E=ot.uniqBy(n,"source").map(k=>({name:`source_${k.source}`,type:"source",label:`${k.source}`,color:typeof t=="string"||!t?t||Mt.Colors.graphMainColor:t[(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)>t.length?t.length-1:(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)],totalValue:Et.sum(n.filter(y=>`${y.source}`==`${k.source}`).map(y=>y.value))})),lt=O==="asc"?ut.sortBy(E,k=>k.totalValue):O==="desc"?ut.sortBy(E,k=>k.totalValue).reverse():E,gt=ot.uniqBy(n,"target").map(k=>({name:`target_${k.target}`,type:"target",label:`${k.target}`,color:typeof u=="string"||!u?u||Mt.Colors.graphMainColor:u[(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)>u.length?u.length-1:(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)],totalValue:Et.sum(n.filter(y=>`${y.target}`==`${k.target}`).map(y=>y.value))})),Bt=O==="asc"?ut.sortBy(gt,k=>k.totalValue):O==="desc"?ut.sortBy(gt,k=>k.totalValue).reverse():gt,dt=[...lt,...Bt];Vt({nodes:dt,links:n.map(k=>({source:dt.findIndex(y=>y.name===`source_${k.source}`),target:dt.findIndex(y=>y.name===`target_${k.target}`),value:k.value,data:{...k}}))})},[n,O,s,t,c,u]),q.useEffect(()=>{const E=new ResizeObserver(lt=>{o($||lt[0].target.clientWidth||620),Z(b||lt[0].target.clientHeight||480)});return it.current&&(Z(it.current.clientHeight||480),o(it.current.clientWidth||620),$||E.observe(it.current)),()=>E.disconnect()},[$,b]),h.jsxRuntimeExports.jsx("div",{className:`${U||"light"} flex ${$?"grow-0":"grow"} ${et?"w-full":"w-fit"} `,dir:T==="he"||T==="ar"?"rtl":void 0,children:h.jsxRuntimeExports.jsx("div",{className:h.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${T||"en"}`,F?.graphContainer),style:{...G?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:K,ref:$t,"aria-label":nt||`${i?`The graph shows ${i}. `:""}This is a sankey chart showing flow. ${l?` ${l}`:""}`,children:h.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?d||"1rem":d||0},children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[i||l||D||Y?h.jsxRuntimeExports.jsx(Wt.GraphHeader,{styles:{title:G?.title,description:G?.description},classNames:{title:F?.title,description:F?.description},graphTitle:i,graphDescription:l,width:$,graphDownload:D?$t.current:void 0,dataDownload:Y?n.map(E=>E.data).filter(E=>E!==void 0).length>0?n.map(E=>E.data).filter(E=>E!==void 0):n.filter(E=>E!==void 0):null}):null,h.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:n.length===0?h.jsxRuntimeExports.jsx(Xt.EmptyState,{}):h.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:it,"aria-label":"Graph area",children:($||Q)&&(b||M)&&bt?h.jsxRuntimeExports.jsx(fe,{data:bt,width:$||Q,nodePadding:r,nodeWidth:f,height:Math.max(P,b||(_?P?($||Q)*_>P?($||Q)*_:P:($||Q)*_:M)),showLabels:m,leftMargin:g,rightMargin:x,topMargin:v,bottomMargin:w,truncateBy:j,tooltip:L,onSeriesMouseOver:V,showValues:A,suffix:X,prefix:B,onSeriesMouseClick:tt,id:Ft.generateRandomString(8),highlightedSourceDataPoints:p.map(E=>`${E}`),highlightedTargetDataPoints:N.map(E=>`${E}`),defaultLinkOpacity:C,sourceTitle:W,targetTitle:I,sortNodes:O,resetSelectionOnDoubleClick:H,styles:G,classNames:F,detailsOnClick:z,animate:rt===!0?{duration:.5,once:!0,amount:.5}:rt||{duration:0,once:!0,amount:0},precision:st,customLayers:at}):null})}),a||R?h.jsxRuntimeExports.jsx(Gt.GraphFooter,{styles:{footnote:G?.footnote,source:G?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:a,footNote:R,width:$}):null]})})})})}exports.SankeyChart=he;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index-CHPV5EwG-DDoeWRVt.cjs"),q=require("react"),ot=require("./index-CZbIGs8q.cjs"),ut=require("./index-BzeLQvXk.cjs"),Et=require("./index-C21TvELx.cjs"),Dt=require("./index-BXns0-ng.cjs"),Pt=require("./Modal-tXZlLE5s.cjs"),ct=require("./Typography-k-kOjICQ.cjs"),Lt=require("./numberFormattingFunction-02t-wJta.cjs"),zt=require("./Tooltip-n8z5bfav.cjs"),It=require("./string2HTML-D2Avudmb.cjs"),Ht=require("./use-in-view-sQJZ_xDO.cjs"),xt=require("./proxy-BHRoeZgd.cjs"),At=require("./index-BW8iNx7E.cjs"),Wt=require("./GraphHeader.cjs"),Gt=require("./GraphFooter.cjs"),Mt=require("./Colors.cjs"),Ft=require("./generateRandomString-B5zBiJzS.cjs"),Xt=require("./EmptyState-d8_8SxeW.cjs");function Rt(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i<a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i<l||i===void 0&&l>=l)&&(i=l)}return i}function Ot(e,n){let i;if(n===void 0)for(const a of e)a!=null&&(i>a||i===void 0&&a>=a)&&(i=a);else{let a=-1;for(let l of e)(l=n(l,++a,e))!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}return i}function pt(e,n){let i=0;if(n===void 0)for(let a of e)(a=+a)&&(i+=a);else{let a=-1;for(let l of e)(l=+n(l,++a,e))&&(i+=l)}return i}function Yt(e){return e.target.depth}function Ut(e,n){return e.sourceLinks.length?e.depth:n-1}function mt(e){return e.targetLinks.length?e.depth:e.sourceLinks.length?Ot(e.sourceLinks,Yt)-1:0}function ft(e){return function(){return e}}function St(e,n){return ht(e.source,n.source)||e.index-n.index}function _t(e,n){return ht(e.target,n.target)||e.index-n.index}function ht(e,n){return e.y0-n.y0}function yt(e){return e.value}function Zt(e){return e.index}function Qt(e){return e.nodes}function Jt(e){return e.links}function Nt(e,n){const i=e.get(n);if(!i)throw new Error("missing: "+n);return i}function Ct({nodes:e}){for(const n of e){let i=n.y0,a=i;for(const l of n.sourceLinks)l.y0=i+l.width/2,i+=l.width;for(const l of n.targetLinks)l.y1=a+l.width/2,a+=l.width}}function vt(){let e=0,n=0,i=1,a=1,l=24,m=8,g,x=Zt,v=Ut,w,j,b=Qt,$=Jt,R=6;function d(){const t={nodes:b.apply(null,arguments),links:$.apply(null,arguments)};return S(t),L(t),V(t),X(t),A(t),Ct(t),t}d.update=function(t){return Ct(t),t},d.nodeId=function(t){return arguments.length?(x=typeof t=="function"?t:ft(t),d):x},d.nodeAlign=function(t){return arguments.length?(v=typeof t=="function"?t:ft(t),d):v},d.nodeSort=function(t){return arguments.length?(w=t,d):w},d.nodeWidth=function(t){return arguments.length?(l=+t,d):l},d.nodePadding=function(t){return arguments.length?(m=g=+t,d):m},d.nodes=function(t){return arguments.length?(b=typeof t=="function"?t:ft(t),d):b},d.links=function(t){return arguments.length?($=typeof t=="function"?t:ft(t),d):$},d.linkSort=function(t){return arguments.length?(j=t,d):j},d.size=function(t){return arguments.length?(e=n=0,i=+t[0],a=+t[1],d):[i-e,a-n]},d.extent=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],n=+t[0][1],a=+t[1][1],d):[[e,n],[i,a]]},d.iterations=function(t){return arguments.length?(R=+t,d):R};function S({nodes:t,links:u}){for(const[c,r]of t.entries())r.index=c,r.sourceLinks=[],r.targetLinks=[];const s=new Map(t.map((c,r)=>[x(c,r,t),c]));for(const[c,r]of u.entries()){r.index=c;let{source:f,target:p}=r;typeof f!="object"&&(f=r.source=Nt(s,f)),typeof p!="object"&&(p=r.target=Nt(s,p)),f.sourceLinks.push(r),p.targetLinks.push(r)}if(j!=null)for(const{sourceLinks:c,targetLinks:r}of t)c.sort(j),r.sort(j)}function L({nodes:t}){for(const u of t)u.value=u.fixedValue===void 0?Math.max(pt(u.sourceLinks,yt),pt(u.targetLinks,yt)):u.fixedValue}function V({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.depth=r;for(const{target:p}of f.sourceLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function X({nodes:t}){const u=t.length;let s=new Set(t),c=new Set,r=0;for(;s.size;){for(const f of s){f.height=r;for(const{source:p}of f.targetLinks)c.add(p)}if(++r>u)throw new Error("circular link");s=c,c=new Set}}function B({nodes:t}){const u=Rt(t,r=>r.depth)+1,s=(i-e-l)/(u-1),c=new Array(u);for(const r of t){const f=Math.max(0,Math.min(u-1,Math.floor(v.call(null,r,u))));r.layer=f,r.x0=e+f*s,r.x1=r.x0+l,c[f]?c[f].push(r):c[f]=[r]}if(w)for(const r of c)r.sort(w);return c}function _(t){const u=Ot(t,s=>(a-n-(s.length-1)*g)/pt(s,yt));for(const s of t){let c=n;for(const r of s){r.y0=c,r.y1=c+r.value*u,c=r.y1+g;for(const f of r.sourceLinks)f.width=f.value*u}c=(a-c+g)/(s.length+1);for(let r=0;r<s.length;++r){const f=s[r];f.y0+=c*(r+1),f.y1+=c*(r+1)}P(s)}}function A(t){const u=B(t);g=Math.min(m,(a-n)/(Rt(u,s=>s.length)-1)),_(u);for(let s=0;s<R;++s){const c=Math.pow(.99,s),r=Math.max(1-c,(s+1)/R);et(u,c,r),tt(u,c,r)}}function tt(t,u,s){for(let c=1,r=t.length;c<r;++c){const f=t[c];for(const p of f){let N=0,C=0;for(const{source:I,value:O}of p.targetLinks){let H=O*(p.layer-I.layer);N+=U(I,p)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function et(t,u,s){for(let c=t.length,r=c-2;r>=0;--r){const f=t[r];for(const p of f){let N=0,C=0;for(const{target:I,value:O}of p.sourceLinks){let H=O*(I.layer-p.layer);N+=nt(p,I)*H,C+=H}if(!(C>0))continue;let W=(N/C-p.y0)*u;p.y0+=W,p.y1+=W,T(p)}w===void 0&&f.sort(ht),D(f,s)}}function D(t,u){const s=t.length>>1,c=t[s];Q(t,c.y0-g,s-1,u),Y(t,c.y1+g,s+1,u),Q(t,a,t.length-1,u),Y(t,n,0,u)}function Y(t,u,s,c){for(;s<t.length;++s){const r=t[s],f=(u-r.y0)*c;f>1e-6&&(r.y0+=f,r.y1+=f),u=r.y1+g}}function Q(t,u,s,c){for(;s>=0;--s){const r=t[s],f=(r.y1-u)*c;f>1e-6&&(r.y0-=f,r.y1-=f),u=r.y0-g}}function T({sourceLinks:t,targetLinks:u}){if(j===void 0){for(const{source:{sourceLinks:s}}of u)s.sort(_t);for(const{target:{targetLinks:s}}of t)s.sort(St)}}function P(t){if(j===void 0)for(const{sourceLinks:u,targetLinks:s}of t)u.sort(_t),s.sort(St)}function U(t,u){let s=t.y0-(t.sourceLinks.length-1)*g/2;for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s+=r+g}for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s-=r}return s}function nt(t,u){let s=u.y0-(u.targetLinks.length-1)*g/2;for(const{source:c,width:r}of u.targetLinks){if(c===t)break;s+=r+g}for(const{target:c,width:r}of t.sourceLinks){if(c===u)break;s-=r}return s}return d}var jt=Math.PI,kt=2*jt,K=1e-6,Kt=kt-K;function wt(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function qt(){return new wt}wt.prototype=qt.prototype={constructor:wt,moveTo:function(e,n){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(e,n){this._+="L"+(this._x1=+e)+","+(this._y1=+n)},quadraticCurveTo:function(e,n,i,a){this._+="Q"+ +e+","+ +n+","+(this._x1=+i)+","+(this._y1=+a)},bezierCurveTo:function(e,n,i,a,l,m){this._+="C"+ +e+","+ +n+","+ +i+","+ +a+","+(this._x1=+l)+","+(this._y1=+m)},arcTo:function(e,n,i,a,l){e=+e,n=+n,i=+i,a=+a,l=+l;var m=this._x1,g=this._y1,x=i-e,v=a-n,w=m-e,j=g-n,b=w*w+j*j;if(l<0)throw new Error("negative radius: "+l);if(this._x1===null)this._+="M"+(this._x1=e)+","+(this._y1=n);else if(b>K)if(!(Math.abs(j*x-v*w)>K)||!l)this._+="L"+(this._x1=e)+","+(this._y1=n);else{var $=i-m,R=a-g,d=x*x+v*v,S=$*$+R*R,L=Math.sqrt(d),V=Math.sqrt(b),X=l*Math.tan((jt-Math.acos((d+b-S)/(2*L*V)))/2),B=X/V,_=X/L;Math.abs(B-1)>K&&(this._+="L"+(e+B*w)+","+(n+B*j)),this._+="A"+l+","+l+",0,0,"+ +(j*$>w*R)+","+(this._x1=e+_*x)+","+(this._y1=n+_*v)}},arc:function(e,n,i,a,l,m){e=+e,n=+n,i=+i,m=!!m;var g=i*Math.cos(a),x=i*Math.sin(a),v=e+g,w=n+x,j=1^m,b=m?a-l:l-a;if(i<0)throw new Error("negative radius: "+i);this._x1===null?this._+="M"+v+","+w:(Math.abs(this._x1-v)>K||Math.abs(this._y1-w)>K)&&(this._+="L"+v+","+w),i&&(b<0&&(b=b%kt+kt),b>Kt?this._+="A"+i+","+i+",0,1,"+j+","+(e-g)+","+(n-x)+"A"+i+","+i+",0,1,"+j+","+(this._x1=v)+","+(this._y1=w):b>K&&(this._+="A"+i+","+i+",0,"+ +(b>=jt)+","+j+","+(this._x1=e+i*Math.cos(l))+","+(this._y1=n+i*Math.sin(l))))},rect:function(e,n,i,a){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+n)+"h"+ +i+"v"+ +a+"h"+-i+"Z"},toString:function(){return this._}};function Tt(e){return function(){return e}}function te(e){return e[0]}function ee(e){return e[1]}var ne=Array.prototype.slice;function oe(e){return e.source}function ie(e){return e.target}function re(e){var n=oe,i=ie,a=te,l=ee,m=null;function g(){var x,v=ne.call(arguments),w=n.apply(this,v),j=i.apply(this,v);if(m||(m=x=qt()),e(m,+a.apply(this,(v[0]=w,v)),+l.apply(this,v),+a.apply(this,(v[0]=j,v)),+l.apply(this,v)),x)return m=null,x+""||null}return g.source=function(x){return arguments.length?(n=x,g):n},g.target=function(x){return arguments.length?(i=x,g):i},g.x=function(x){return arguments.length?(a=typeof x=="function"?x:Tt(+x),g):a},g.y=function(x){return arguments.length?(l=typeof x=="function"?x:Tt(+x),g):l},g.context=function(x){return arguments.length?(m=x??null,g):m},g}function se(e,n,i,a,l){e.moveTo(n,i),e.bezierCurveTo(n=(n+a)/2,i,n,l,a,l)}function ae(){return re(se)}function le(e){return[e.source.x1,e.y0]}function ue(e){return[e.target.x0,e.y1]}function ce(){return ae().source(le).target(ue)}function fe(e){const{data:n,showLabels:i,leftMargin:a,rightMargin:l,truncateBy:m,width:g,height:x,topMargin:v,bottomMargin:w,tooltip:j,onSeriesMouseOver:b,suffix:$,prefix:R,showValues:d,onSeriesMouseClick:S,nodePadding:L,nodeWidth:V,id:X,highlightedSourceDataPoints:B,highlightedTargetDataPoints:_,defaultLinkOpacity:A,sourceTitle:tt,targetTitle:et,animate:D,sortNodes:Y,resetSelectionOnDoubleClick:Q,detailsOnClick:T,styles:P,classNames:U,precision:nt,customLayers:t}=e,u=q.useRef(null),s=Ht.useInView(u,{once:D.once,amount:D.amount}),[c,r]=q.useState(void 0),[f,p]=q.useState(void 0),[N,C]=q.useState(void 0),[W,I]=q.useState(void 0),[O,H]=q.useState(void 0),z={top:v,bottom:w,left:a,right:l},G=g-z.left-z.right,F=x-z.top-z.bottom,rt=Y==="mostReadable"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt):Y==="none"?vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(()=>null).linkSort(()=>null):vt().nodeWidth(V).nodePadding(L).size([G,F]).nodeAlign(mt).nodeSort(Y==="desc"?(o,M)=>(M.value||0)-(o.value||0):(o,M)=>(o.value||0)-(M.value||0)),{nodes:st,links:at}=rt(n),J=ce();return h.jsxRuntimeExports.jsxs(h.jsxRuntimeExports.Fragment,{children:[h.jsxRuntimeExports.jsxs(xt.motion.svg,{width:`${g}px`,height:`${x}px`,viewBox:`0 0 ${g} ${x}`,style:{marginLeft:"auto",marginRight:"auto"},direction:"ltr",ref:u,children:[tt?h.jsxRuntimeExports.jsx("text",{x:z.left,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"start"},children:tt}):null,et?h.jsxRuntimeExports.jsx("text",{x:g-z.right,y:z.top-10,className:"text-base font-bold fill-primary-gray-700 dark:fill-primary-gray-100",style:{textAnchor:"end"},children:et}):null,h.jsxRuntimeExports.jsxs("g",{transform:`translate(${z.left},${z.top})`,children:[t.filter(o=>o.position==="before").map(o=>o.layer),st.filter(o=>o.type==="source").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:0-a,width:a,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`,overflow:"visible"},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-right-label text-right",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:"none",size:"sm",leading:"none",className:h.mo("sankey-right-value text-right font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),st.filter(o=>o.type==="target").map((o,M)=>h.jsxRuntimeExports.jsx("g",{onMouseEnter:()=>{C(o)},onMouseLeave:()=>{C(void 0)},children:h.jsxRuntimeExports.jsxs("g",{transform:`translate(${o.x0},${o.y0})`,children:[h.jsxRuntimeExports.jsx("rect",{x:0,y:0,width:(o.x1||0)-(o.x0||0),height:(o.y1||0)-(o.y0||0),style:{fill:o.color}}),i||d?h.jsxRuntimeExports.jsx("foreignObject",{y:0-L/2,x:V,width:l-V,height:(o.y1||0)-(o.y0||0)+L,children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-0.5 justify-center py-0 px-1.5",style:{height:`${(o.y1||0)-(o.y0||0)+L}px`},children:[i?h.jsxRuntimeExports.jsx(ct.u,{marginBottom:d?"3xs":"none",size:"sm",leading:"none",className:h.mo("sankey-left-label text-left",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:`${o.label}`.length<m?`${o.label}`:`${`${o.label}`.substring(0,m)}...`}):null,d?h.jsxRuntimeExports.jsx(ct.u,{size:"sm",leading:"none",marginBottom:"none",className:h.mo("sankey-left-value text-left font-bold",U?.graphObjectValues),style:{hyphens:"auto",color:o.color,...P?.graphObjectValues},children:Lt.numberFormattingFunction(o.value,"NA",nt,R,$)}):null]})}):null]})},M)),h.jsxRuntimeExports.jsx("defs",{children:at.map((o,M)=>h.jsxRuntimeExports.jsxs("linearGradient",{id:`${X}-gradient-${M}`,x1:"0%",y1:"0%",x2:"100%",y2:"0%",gradientUnits:"userSpaceOnUse",children:[h.jsxRuntimeExports.jsx("stop",{offset:"0%",style:{stopColor:o.source.color,stopOpacity:1}}),h.jsxRuntimeExports.jsx("stop",{offset:"100%",style:{stopColor:o.target.color,stopOpacity:1}})]},M))}),h.jsxRuntimeExports.jsx("g",{children:h.jsxRuntimeExports.jsx(At.AnimatePresence,{children:at.map((o,M)=>h.jsxRuntimeExports.jsx(xt.motion.g,{className:"undp-viz-g-with-hover",onMouseEnter:Z=>{r(o.data),H(Z.clientY),I(Z.clientX),b?.(o)},onMouseMove:Z=>{r(o.data),H(Z.clientY),I(Z.clientX)},onClick:()=>{(S||T)&&(Dt.isEqual(f,o.data)&&Q?(p(void 0),S?.(void 0)):(p(o.data),S?.(o.data)))},onMouseLeave:()=>{r(void 0),I(void 0),H(void 0),b?.(void 0)},variants:{initial:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A},whileInView:{opacity:N?o.source.name===N.name||o.target.name===N.name?.85:A:(B.length!==0||_.length!==0)&&(B.indexOf(o.source.label)!==-1||_.indexOf(o.target.label)!==-1)?.85:A,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial",exit:{opacity:0,transition:{duration:D.duration}},children:h.jsxRuntimeExports.jsx(xt.motion.path,{d:J(o)||"",style:{stroke:`url(#${X}-gradient-${M})`,strokeWidth:o.width,fill:"none"},exit:{opacity:0,transition:{duration:D.duration}},variants:{initial:{pathLength:0,opacity:1},whileInView:{pathLength:1,opacity:1,transition:{duration:D.duration}}},initial:"initial",animate:s?"whileInView":"initial"},`${o.source}-${o.target}`)},`${o.source}-${o.target}`))})}),t.filter(o=>o.position==="after").map(o=>o.layer)]})]}),c&&j&&W&&O?h.jsxRuntimeExports.jsx(zt.Tooltip,{data:c,body:j,xPos:W,yPos:O,backgroundStyle:P?.tooltip,className:U?.tooltip}):null,T&&f!==void 0?h.jsxRuntimeExports.jsx(Pt.X,{open:f!==void 0,onClose:()=>{p(void 0)},children:h.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof T=="string"?{__html:It.string2HTML(T,f)}:void 0,children:typeof T=="function"?T(f):null})}):null]})}function he(e){const{data:n,graphTitle:i,sources:a,graphDescription:l,showLabels:m=!0,leftMargin:g=75,rightMargin:x=75,topMargin:v=30,bottomMargin:w=10,truncateBy:j=999,height:b,width:$,footNote:R,padding:d,backgroundColor:S,tooltip:L,onSeriesMouseOver:V,suffix:X="",prefix:B="",relativeHeight:_,showValues:A=!0,graphID:tt,onSeriesMouseClick:et,graphDownload:D=!1,dataDownload:Y=!1,fillContainer:Q=!0,language:T="en",minHeight:P=0,theme:U="light",ariaLabel:nt,sourceColors:t,targetColors:u,sourceColorDomain:s,targetColorDomain:c,nodePadding:r=5,nodeWidth:f=5,highlightedSourceDataPoints:p=[],highlightedTargetDataPoints:N=[],defaultLinkOpacity:C=.3,sourceTitle:W,targetTitle:I,sortNodes:O="mostReadable",resetSelectionOnDoubleClick:H=!0,detailsOnClick:z,styles:G,classNames:F,animate:rt=!1,precision:st=2,customLayers:at=[]}=e,[J,o]=q.useState(0),[M,Z]=q.useState(0),[bt,Vt]=q.useState(void 0),it=q.useRef(null),$t=q.useRef(null);return q.useEffect(()=>{const E=ot.uniqBy(n,"source").map(k=>({name:`source_${k.source}`,type:"source",label:`${k.source}`,color:typeof t=="string"||!t?t||Mt.Colors.graphMainColor:t[(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)>t.length?t.length-1:(s||ot.uniqBy(n,"source").map(y=>`${y.source}`)).findIndex(y=>`${y}`==`${k.source}`)],totalValue:Et.sum(n.filter(y=>`${y.source}`==`${k.source}`).map(y=>y.value))})),lt=O==="asc"?ut.sortBy(E,k=>k.totalValue):O==="desc"?ut.sortBy(E,k=>k.totalValue).reverse():E,gt=ot.uniqBy(n,"target").map(k=>({name:`target_${k.target}`,type:"target",label:`${k.target}`,color:typeof u=="string"||!u?u||Mt.Colors.graphMainColor:u[(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)>u.length?u.length-1:(c||ot.uniqBy(n,"target").map(y=>`${y.target}`)).findIndex(y=>`${y}`==`${k.target}`)],totalValue:Et.sum(n.filter(y=>`${y.target}`==`${k.target}`).map(y=>y.value))})),Bt=O==="asc"?ut.sortBy(gt,k=>k.totalValue):O==="desc"?ut.sortBy(gt,k=>k.totalValue).reverse():gt,dt=[...lt,...Bt];Vt({nodes:dt,links:n.map(k=>({source:dt.findIndex(y=>y.name===`source_${k.source}`),target:dt.findIndex(y=>y.name===`target_${k.target}`),value:k.value,data:{...k}}))})},[n,O,s,t,c,u]),q.useEffect(()=>{const E=new ResizeObserver(lt=>{o($||lt[0].target.clientWidth||620),Z(b||lt[0].target.clientHeight||480)});return it.current&&(Z(it.current.clientHeight||480),o(it.current.clientWidth||620),$||E.observe(it.current)),()=>E.disconnect()},[$,b]),h.jsxRuntimeExports.jsx("div",{className:`${U||"light"} flex ${$?"grow-0":"grow"} ${Q?"w-full":"w-fit"} `,dir:T==="he"||T==="ar"?"rtl":void 0,children:h.jsxRuntimeExports.jsx("div",{className:h.mo(`${S?S===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${T||"en"}`,Q?"w-full":"w-fit",F?.graphContainer),style:{...G?.graphContainer||{},...S&&S!==!0?{backgroundColor:S}:{}},id:tt,ref:$t,"aria-label":nt||`${i?`The graph shows ${i}. `:""}This is a sankey chart showing flow. ${l?` ${l}`:""}`,children:h.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:S?d||"1rem":d||0},children:h.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[i||l||D||Y?h.jsxRuntimeExports.jsx(Wt.GraphHeader,{styles:{title:G?.title,description:G?.description},classNames:{title:F?.title,description:F?.description},graphTitle:i,graphDescription:l,width:$,graphDownload:D?$t.current:void 0,dataDownload:Y?n.map(E=>E.data).filter(E=>E!==void 0).length>0?n.map(E=>E.data).filter(E=>E!==void 0):n.filter(E=>E!==void 0):null}):null,h.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:n.length===0?h.jsxRuntimeExports.jsx(Xt.EmptyState,{}):h.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center gap-3 w-full leading-0",ref:it,"aria-label":"Graph area",children:($||J)&&(b||M)&&bt?h.jsxRuntimeExports.jsx(fe,{data:bt,width:$||J,nodePadding:r,nodeWidth:f,height:Math.max(P,b||(_?P?($||J)*_>P?($||J)*_:P:($||J)*_:M)),showLabels:m,leftMargin:g,rightMargin:x,topMargin:v,bottomMargin:w,truncateBy:j,tooltip:L,onSeriesMouseOver:V,showValues:A,suffix:X,prefix:B,onSeriesMouseClick:et,id:Ft.generateRandomString(8),highlightedSourceDataPoints:p.map(E=>`${E}`),highlightedTargetDataPoints:N.map(E=>`${E}`),defaultLinkOpacity:C,sourceTitle:W,targetTitle:I,sortNodes:O,resetSelectionOnDoubleClick:H,styles:G,classNames:F,detailsOnClick:z,animate:rt===!0?{duration:.5,once:!0,amount:.5}:rt||{duration:0,once:!0,amount:0},precision:st,customLayers:at}):null})}),a||R?h.jsxRuntimeExports.jsx(Gt.GraphFooter,{styles:{footnote:G?.footnote,source:G?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:a,footNote:R,width:$}):null]})})})})}exports.SankeyChart=he;
2
2
  //# sourceMappingURL=SankeyChart.cjs.map