@undp/data-viz 2.4.1 → 2.5.1

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 (271) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.cjs.map +1 -1
  3. package/dist/AreaChart.d.ts +11 -9
  4. package/dist/AreaChart.js +320 -322
  5. package/dist/AreaChart.js.map +1 -1
  6. package/dist/BarGraph.cjs +1 -1
  7. package/dist/BarGraph.cjs.map +1 -1
  8. package/dist/BarGraph.d.ts +15 -25
  9. package/dist/BarGraph.js +1694 -1694
  10. package/dist/BarGraph.js.map +1 -1
  11. package/dist/BasicStatCard.cjs +1 -1
  12. package/dist/BasicStatCard.cjs.map +1 -1
  13. package/dist/BasicStatCard.d.ts +13 -9
  14. package/dist/BasicStatCard.js +79 -81
  15. package/dist/BasicStatCard.js.map +1 -1
  16. package/dist/BeeSwarmChart.cjs +1 -1
  17. package/dist/BeeSwarmChart.cjs.map +1 -1
  18. package/dist/BeeSwarmChart.d.ts +11 -9
  19. package/dist/BeeSwarmChart.js +335 -336
  20. package/dist/BeeSwarmChart.js.map +1 -1
  21. package/dist/BiVariateChoroplethMap.cjs +1 -1
  22. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  23. package/dist/BiVariateChoroplethMap.d.ts +13 -3
  24. package/dist/BiVariateChoroplethMap.js +309 -304
  25. package/dist/BiVariateChoroplethMap.js.map +1 -1
  26. package/dist/BulletChart.cjs +1 -1
  27. package/dist/BulletChart.cjs.map +1 -1
  28. package/dist/BulletChart.d.ts +11 -5
  29. package/dist/BulletChart.js +560 -559
  30. package/dist/BulletChart.js.map +1 -1
  31. package/dist/ButterflyChart.cjs +1 -1
  32. package/dist/ButterflyChart.cjs.map +1 -1
  33. package/dist/ButterflyChart.d.ts +11 -9
  34. package/dist/ButterflyChart.js +348 -350
  35. package/dist/ButterflyChart.js.map +1 -1
  36. package/dist/ChoroplethMap.cjs +1 -1
  37. package/dist/ChoroplethMap.cjs.map +1 -1
  38. package/dist/ChoroplethMap.d.ts +11 -3
  39. package/dist/ChoroplethMap.js +314 -311
  40. package/dist/ChoroplethMap.js.map +1 -1
  41. package/dist/CirclePackingGraph.cjs +1 -1
  42. package/dist/CirclePackingGraph.d.ts +11 -9
  43. package/dist/CirclePackingGraph.js +1 -1
  44. package/dist/DataCards.cjs +1 -1
  45. package/dist/DataCards.d.ts +1 -1
  46. package/dist/DataCards.js +1 -1
  47. package/dist/DataTable.cjs +1 -1
  48. package/dist/DataTable.cjs.map +1 -1
  49. package/dist/DataTable.d.ts +4 -5
  50. package/dist/DataTable.js +114 -116
  51. package/dist/DataTable.js.map +1 -1
  52. package/dist/{DetailsModal-jmmKRMRM.cjs → DetailsModal-Du8Fr1QD.cjs} +2 -2
  53. package/dist/{DetailsModal-jmmKRMRM.cjs.map → DetailsModal-Du8Fr1QD.cjs.map} +1 -1
  54. package/dist/{DetailsModal-B2XBWR7w.js → DetailsModal-GqEbGHY2.js} +2 -2
  55. package/dist/{DetailsModal-B2XBWR7w.js.map → DetailsModal-GqEbGHY2.js.map} +1 -1
  56. package/dist/DifferenceLineChart.cjs +1 -1
  57. package/dist/DifferenceLineChart.cjs.map +1 -1
  58. package/dist/DifferenceLineChart.d.ts +11 -9
  59. package/dist/DifferenceLineChart.js +502 -504
  60. package/dist/DifferenceLineChart.js.map +1 -1
  61. package/dist/DonutChart.cjs +1 -1
  62. package/dist/DonutChart.cjs.map +1 -1
  63. package/dist/DonutChart.d.ts +14 -9
  64. package/dist/DonutChart.js +174 -179
  65. package/dist/DonutChart.js.map +1 -1
  66. package/dist/DotDensityMap.cjs +1 -1
  67. package/dist/DotDensityMap.cjs.map +1 -1
  68. package/dist/DotDensityMap.d.ts +1 -1
  69. package/dist/DotDensityMap.js +270 -267
  70. package/dist/DotDensityMap.js.map +1 -1
  71. package/dist/DualAxisLineChart.cjs +1 -1
  72. package/dist/DualAxisLineChart.cjs.map +1 -1
  73. package/dist/DualAxisLineChart.d.ts +13 -9
  74. package/dist/DualAxisLineChart.js +341 -351
  75. package/dist/DualAxisLineChart.js.map +1 -1
  76. package/dist/DumbbellChart.cjs +1 -1
  77. package/dist/DumbbellChart.cjs.map +1 -1
  78. package/dist/DumbbellChart.d.ts +11 -9
  79. package/dist/DumbbellChart.js +592 -593
  80. package/dist/DumbbellChart.js.map +1 -1
  81. package/dist/GeoHubCompareMaps.cjs +1 -1
  82. package/dist/GeoHubCompareMaps.d.ts +1 -1
  83. package/dist/GeoHubCompareMaps.js +1 -1
  84. package/dist/GeoHubMap.cjs +1 -1
  85. package/dist/GeoHubMap.d.ts +1 -1
  86. package/dist/GeoHubMap.js +1 -1
  87. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  88. package/dist/GeoHubMapWithLayerSelection.d.ts +1 -1
  89. package/dist/GeoHubMapWithLayerSelection.js +1 -1
  90. package/dist/GraphEl-BgkDbq50.cjs +2 -0
  91. package/dist/GraphEl-BgkDbq50.cjs.map +1 -0
  92. package/dist/GraphEl-Ch0uAeZw.js +1830 -0
  93. package/dist/GraphEl-Ch0uAeZw.js.map +1 -0
  94. package/dist/GriddedGraphs.cjs +1 -1
  95. package/dist/GriddedGraphs.d.ts +29 -16
  96. package/dist/GriddedGraphs.js +1 -1
  97. package/dist/GriddedGraphsFromConfig.d.ts +29 -16
  98. package/dist/HeatMap.cjs +1 -1
  99. package/dist/HeatMap.cjs.map +1 -1
  100. package/dist/HeatMap.d.ts +11 -9
  101. package/dist/HeatMap.js +203 -205
  102. package/dist/HeatMap.js.map +1 -1
  103. package/dist/Histogram.cjs +1 -1
  104. package/dist/Histogram.cjs.map +1 -1
  105. package/dist/Histogram.d.ts +11 -5
  106. package/dist/Histogram.js +88 -89
  107. package/dist/Histogram.js.map +1 -1
  108. package/dist/HybridMap.cjs +1 -1
  109. package/dist/HybridMap.cjs.map +1 -1
  110. package/dist/HybridMap.d.ts +11 -3
  111. package/dist/HybridMap.js +339 -336
  112. package/dist/HybridMap.js.map +1 -1
  113. package/dist/ImageDownloadButton.cjs +1 -1
  114. package/dist/ImageDownloadButton.js +1 -1
  115. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  116. package/dist/LineChartWithConfidenceInterval.cjs.map +1 -1
  117. package/dist/LineChartWithConfidenceInterval.d.ts +11 -9
  118. package/dist/LineChartWithConfidenceInterval.js +393 -395
  119. package/dist/LineChartWithConfidenceInterval.js.map +1 -1
  120. package/dist/LinearColorLegend.cjs +1 -1
  121. package/dist/LinearColorLegend.js +1 -1
  122. package/dist/MultiGraphDashboard.d.ts +29 -16
  123. package/dist/MultiGraphDashboardFromConfig.d.ts +29 -16
  124. package/dist/MultiGraphDashboardWideToLongFormat.d.ts +1 -1
  125. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.d.ts +1 -1
  126. package/dist/MultiLineAltChart.cjs +1 -1
  127. package/dist/MultiLineAltChart.cjs.map +1 -1
  128. package/dist/MultiLineAltChart.d.ts +11 -9
  129. package/dist/MultiLineAltChart.js +411 -413
  130. package/dist/MultiLineAltChart.js.map +1 -1
  131. package/dist/MultiLineChart.cjs +1 -1
  132. package/dist/MultiLineChart.cjs.map +1 -1
  133. package/dist/MultiLineChart.d.ts +11 -9
  134. package/dist/MultiLineChart.js +438 -440
  135. package/dist/MultiLineChart.js.map +1 -1
  136. package/dist/ParetoChart.cjs +1 -1
  137. package/dist/ParetoChart.cjs.map +1 -1
  138. package/dist/ParetoChart.d.ts +13 -13
  139. package/dist/ParetoChart.js +347 -355
  140. package/dist/ParetoChart.js.map +1 -1
  141. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +29 -16
  142. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +29 -16
  143. package/dist/PerformanceIntensiveScrollStory.d.ts +29 -16
  144. package/dist/RadarChart.cjs +1 -1
  145. package/dist/RadarChart.cjs.map +1 -1
  146. package/dist/RadarChart.d.ts +11 -5
  147. package/dist/RadarChart.js +213 -213
  148. package/dist/RadarChart.js.map +1 -1
  149. package/dist/SankeyChart.cjs +1 -1
  150. package/dist/SankeyChart.cjs.map +1 -1
  151. package/dist/SankeyChart.d.ts +11 -9
  152. package/dist/SankeyChart.js +448 -450
  153. package/dist/SankeyChart.js.map +1 -1
  154. package/dist/ScatterPlot.cjs +1 -1
  155. package/dist/ScatterPlot.cjs.map +1 -1
  156. package/dist/ScatterPlot.d.ts +15 -13
  157. package/dist/ScatterPlot.js +477 -483
  158. package/dist/ScatterPlot.js.map +1 -1
  159. package/dist/ScrollStory.d.ts +29 -16
  160. package/dist/SimpleLineChart.cjs +1 -1
  161. package/dist/SimpleLineChart.cjs.map +1 -1
  162. package/dist/SimpleLineChart.d.ts +11 -9
  163. package/dist/SimpleLineChart.js +362 -364
  164. package/dist/SimpleLineChart.js.map +1 -1
  165. package/dist/SingleGraphDashboard.cjs +1 -1
  166. package/dist/SingleGraphDashboard.d.ts +29 -16
  167. package/dist/SingleGraphDashboard.js +1 -1
  168. package/dist/SingleGraphDashboardFromConfig.d.ts +29 -16
  169. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +29 -16
  170. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +29 -16
  171. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  172. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  173. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +29 -16
  174. package/dist/SingleGraphDashboardThreeDGraphs.js +40 -39
  175. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  176. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +29 -16
  177. package/dist/SlopeChart.cjs +1 -1
  178. package/dist/SlopeChart.d.ts +1 -1
  179. package/dist/SlopeChart.js +2 -2
  180. package/dist/SparkLine.cjs +1 -1
  181. package/dist/SparkLine.d.ts +1 -1
  182. package/dist/SparkLine.js +1 -1
  183. package/dist/StatCardFromData.cjs +1 -1
  184. package/dist/StatCardFromData.cjs.map +1 -1
  185. package/dist/StatCardFromData.d.ts +11 -9
  186. package/dist/StatCardFromData.js +113 -116
  187. package/dist/StatCardFromData.js.map +1 -1
  188. package/dist/StripChart.cjs +1 -1
  189. package/dist/StripChart.cjs.map +1 -1
  190. package/dist/StripChart.d.ts +11 -9
  191. package/dist/StripChart.js +434 -435
  192. package/dist/StripChart.js.map +1 -1
  193. package/dist/ThreeDGlobe.cjs +1 -1
  194. package/dist/ThreeDGlobe.cjs.map +1 -1
  195. package/dist/ThreeDGlobe.d.ts +11 -3
  196. package/dist/ThreeDGlobe.js +143 -143
  197. package/dist/ThreeDGlobe.js.map +1 -1
  198. package/dist/ThresholdColorLegendWithMouseOver.cjs +1 -1
  199. package/dist/ThresholdColorLegendWithMouseOver.js +1 -1
  200. package/dist/{Tooltip-Bj-s__cI.js → Tooltip-3EYDVa3w.js} +2 -2
  201. package/dist/{Tooltip-Bj-s__cI.js.map → Tooltip-3EYDVa3w.js.map} +1 -1
  202. package/dist/{Tooltip-Hr46paWP.cjs → Tooltip-C9F3uYG0.cjs} +2 -2
  203. package/dist/{Tooltip-Hr46paWP.cjs.map → Tooltip-C9F3uYG0.cjs.map} +1 -1
  204. package/dist/TreeMapGraph.cjs +1 -1
  205. package/dist/TreeMapGraph.cjs.map +1 -1
  206. package/dist/TreeMapGraph.d.ts +11 -9
  207. package/dist/TreeMapGraph.js +369 -371
  208. package/dist/TreeMapGraph.js.map +1 -1
  209. package/dist/Types.d.ts +29 -16
  210. package/dist/UnitChart.cjs +1 -1
  211. package/dist/UnitChart.cjs.map +1 -1
  212. package/dist/UnitChart.d.ts +11 -5
  213. package/dist/UnitChart.js +118 -119
  214. package/dist/UnitChart.js.map +1 -1
  215. package/dist/WaterfallChart.cjs +1 -1
  216. package/dist/WaterfallChart.cjs.map +1 -1
  217. package/dist/WaterfallChart.d.ts +11 -9
  218. package/dist/WaterfallChart.js +306 -308
  219. package/dist/WaterfallChart.js.map +1 -1
  220. package/dist/XTicksAndGridLines-B4UhDVyU.cjs +2 -0
  221. package/dist/XTicksAndGridLines-B4UhDVyU.cjs.map +1 -0
  222. package/dist/XTicksAndGridLines-CkYwVshF.js +40 -0
  223. package/dist/XTicksAndGridLines-CkYwVshF.js.map +1 -0
  224. package/dist/YTicksAndGridLines-BbujwxOB.js +40 -0
  225. package/dist/YTicksAndGridLines-BbujwxOB.js.map +1 -0
  226. package/dist/YTicksAndGridLines-sT3zdCs6.cjs +2 -0
  227. package/dist/YTicksAndGridLines-sT3zdCs6.cjs.map +1 -0
  228. package/dist/{imageDownload-Diofs_vY.js → imageDownload-BYsNEtMS.js} +11 -11
  229. package/dist/{imageDownload-Diofs_vY.js.map → imageDownload-BYsNEtMS.js.map} +1 -1
  230. package/dist/{imageDownload-61q6jyJW.cjs → imageDownload-CkMwA7Cw.cjs} +4 -4
  231. package/dist/{imageDownload-61q6jyJW.cjs.map → imageDownload-CkMwA7Cw.cjs.map} +1 -1
  232. package/dist/index-BPyj_6hG.js +375 -0
  233. package/dist/index-BPyj_6hG.js.map +1 -0
  234. package/dist/index-DuLvdHo2.cjs +2 -0
  235. package/dist/index-DuLvdHo2.cjs.map +1 -0
  236. package/dist/index.cjs +1 -1
  237. package/dist/index.d.ts +108 -245
  238. package/dist/index.js +3 -3
  239. package/dist/numberFormattingFunction-BUUV_luR.js +28 -0
  240. package/dist/numberFormattingFunction-BUUV_luR.js.map +1 -0
  241. package/dist/numberFormattingFunction-u2iNHL_c.cjs +2 -0
  242. package/dist/numberFormattingFunction-u2iNHL_c.cjs.map +1 -0
  243. package/dist/{string2HTML-ZoGd08P_.cjs → string2HTML-30nfIm8R.cjs} +2 -2
  244. package/dist/{string2HTML-ZoGd08P_.cjs.map → string2HTML-30nfIm8R.cjs.map} +1 -1
  245. package/dist/{string2HTML-BrFperRM.js → string2HTML-DL-pInUB.js} +2 -2
  246. package/dist/{string2HTML-BrFperRM.js.map → string2HTML-DL-pInUB.js.map} +1 -1
  247. package/dist/style.css +1 -1
  248. package/dist/utils.cjs +1 -1
  249. package/dist/utils.d.ts +1 -1
  250. package/dist/utils.js +2 -2
  251. package/package.json +2 -2
  252. package/dist/GraphEl-B73N4RIA.js +0 -1906
  253. package/dist/GraphEl-B73N4RIA.js.map +0 -1
  254. package/dist/GraphEl-Lt1og0C-.cjs +0 -2
  255. package/dist/GraphEl-Lt1og0C-.cjs.map +0 -1
  256. package/dist/XTicksAndGridLines-C5DuC5oY.cjs +0 -2
  257. package/dist/XTicksAndGridLines-C5DuC5oY.cjs.map +0 -1
  258. package/dist/XTicksAndGridLines-gdbGX2rm.js +0 -39
  259. package/dist/XTicksAndGridLines-gdbGX2rm.js.map +0 -1
  260. package/dist/YTicksAndGridLines-CsNSq9W9.js +0 -39
  261. package/dist/YTicksAndGridLines-CsNSq9W9.js.map +0 -1
  262. package/dist/YTicksAndGridLines-DFjm8RCc.cjs +0 -2
  263. package/dist/YTicksAndGridLines-DFjm8RCc.cjs.map +0 -1
  264. package/dist/index-B0Awa_de.js +0 -377
  265. package/dist/index-B0Awa_de.js.map +0 -1
  266. package/dist/index-CP8cmNzt.cjs +0 -2
  267. package/dist/index-CP8cmNzt.cjs.map +0 -1
  268. package/dist/numberFormattingFunction-Cn9R7CM9.cjs +0 -2
  269. package/dist/numberFormattingFunction-Cn9R7CM9.cjs.map +0 -1
  270. package/dist/numberFormattingFunction-DqMf_v1m.js +0 -28
  271. package/dist/numberFormattingFunction-DqMf_v1m.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DonutChart.js","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n Math.abs(endAngleInRadians - startAngleInRadians) === 2 * Math.PI\r\n ? 0.999999 * endAngleInRadians\r\n : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { isValidElement, ReactElement, useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?: string | { label: string; suffix?: string; prefix?: string } | ReactElement;\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n precision: number;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n locale: string;\r\n naLabel: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision,\r\n animate,\r\n trackColor,\r\n locale,\r\n naLabel,\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 pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\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 return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\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 className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n isValidElement(mainText) ? (\r\n mainText\r\n ) : (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n naLabel,\r\n precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n locale,\r\n )\r\n : naLabel}\r\n </H2>\r\n )\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText || isValidElement(mainText) ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\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 style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\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 />\r\n ))}\r\n </AnimatePresence>\r\n </motion.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 <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { ReactElement, useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\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 { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\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 /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 donut chart */\r\n radius?: number;\r\n\r\n // Values and Ticks\r\n /** Prefix for values */\r\n prefix?: string;\r\n /** Suffix for values */\r\n suffix?: string;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?: string | { label: string; suffix?: string; prefix?: string } | ReactElement;\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Specifies the number of decimal places to display in the value. */\r\n precision?: number;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n /** Locale for number formatting. Must matches what `Intl.NumberFormat` expects. */\r\n locale?: string;\r\n /** Defines how “NA” values should be displayed/labelled in the graph */\r\n naLabel?: string;\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 DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n suffix = '',\r\n sources,\r\n prefix = '',\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\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 graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n precision = 2,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n locale = 'en',\r\n naLabel = 'NA',\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(d.size, naLabel, precision, prefix, suffix, locale)}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\r\n precision={precision}\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 locale={locale}\r\n trackColor={trackColor}\r\n naLabel={naLabel}\r\n />\r\n ) : null}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","k","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","abs","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","precision","animate","trackColor","locale","naLabel","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","isValidElement","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","prefix","suffix","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":";;;;;;;;;;;;;;;;;;AASO,MAAMA,KAAK,KAAK,IAEVC,KAAM,IAAID;ACXR,SAAAE,GAASC,GAAGC,GAAG;AAC5B,SAAOA,IAAID,IAAI,KAAKC,IAAID,IAAI,IAAIC,KAAKD,IAAI,IAAI;AAC/C;ACFe,SAAAE,GAASC,GAAG;AACzB,SAAOA;AACT;ACIe,SAAAC,KAAW;AACxB,MAAIC,IAAQH,IACRI,IAAaP,IACbQ,IAAO,MACPC,IAAaC,EAAS,CAAC,GACvBC,IAAWD,EAASX,EAAG,GACvBa,IAAWF,EAAS,CAAC;AAEzB,WAAS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oF,KAAWE,IACVxD,gBAAAA,EAAAA,IAACwG,IAAA,EACC,QAAQ;AAAA,MAAEC,UAAU7I,GAAQ6I;AAAAA,MAAUC,QAAQ9I,GAAQ8I;AAAAA,IAAAA,GACtD,YAAY;AAAA,MACVD,UAAU5I,GAAY4I;AAAAA,MACtBC,QAAQ7I,GAAY6I;AAAAA,IAAAA,GAEtB,SAAApD,GACA,UAAAE,GACA,OAAAU,EAAA,CAAa,IAEb;AAAA,EAAA,GACN;AAEJ;","x_google_ignoreList":[0,1,2,3]}
1
+ {"version":3,"file":"DonutChart.js","sources":["../node_modules/d3-shape/src/math.js","../node_modules/d3-shape/src/descending.js","../node_modules/d3-shape/src/identity.js","../node_modules/d3-shape/src/pie.js","../src/Utils/getArc.ts","../src/Components/Graphs/DonutChart/Graph.tsx","../src/Components/Graphs/DonutChart/index.tsx"],"sourcesContent":["export const abs = Math.abs;\nexport const atan2 = Math.atan2;\nexport const cos = Math.cos;\nexport const max = Math.max;\nexport const min = Math.min;\nexport const sin = Math.sin;\nexport const sqrt = Math.sqrt;\n\nexport const epsilon = 1e-12;\nexport const pi = Math.PI;\nexport const halfPi = pi / 2;\nexport const tau = 2 * pi;\n\nexport function acos(x) {\n return x > 1 ? 0 : x < -1 ? pi : Math.acos(x);\n}\n\nexport function asin(x) {\n return x >= 1 ? halfPi : x <= -1 ? -halfPi : Math.asin(x);\n}\n","export default function(a, b) {\n return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;\n}\n","export default function(d) {\n return d;\n}\n","import array from \"./array.js\";\nimport constant from \"./constant.js\";\nimport descending from \"./descending.js\";\nimport identity from \"./identity.js\";\nimport {tau} from \"./math.js\";\n\nexport default function() {\n var value = identity,\n sortValues = descending,\n sort = null,\n startAngle = constant(0),\n endAngle = constant(tau),\n padAngle = constant(0);\n\n function pie(data) {\n var i,\n n = (data = array(data)).length,\n j,\n k,\n sum = 0,\n index = new Array(n),\n arcs = new Array(n),\n a0 = +startAngle.apply(this, arguments),\n da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),\n a1,\n p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),\n pa = p * (da < 0 ? -1 : 1),\n v;\n\n for (i = 0; i < n; ++i) {\n if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {\n sum += v;\n }\n }\n\n // Optionally sort the arcs by previously-computed values or by data.\n if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });\n else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });\n\n // Compute the arcs! They are stored in the original data's order.\n for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {\n j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {\n data: data[j],\n index: i,\n value: v,\n startAngle: a0,\n endAngle: a1,\n padAngle: p\n };\n }\n\n return arcs;\n }\n\n pie.value = function(_) {\n return arguments.length ? (value = typeof _ === \"function\" ? _ : constant(+_), pie) : value;\n };\n\n pie.sortValues = function(_) {\n return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;\n };\n\n pie.sort = function(_) {\n return arguments.length ? (sort = _, sortValues = null, pie) : sort;\n };\n\n pie.startAngle = function(_) {\n return arguments.length ? (startAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : startAngle;\n };\n\n pie.endAngle = function(_) {\n return arguments.length ? (endAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : endAngle;\n };\n\n pie.padAngle = function(_) {\n return arguments.length ? (padAngle = typeof _ === \"function\" ? _ : constant(+_), pie) : padAngle;\n };\n\n return pie;\n}\n","const polarToCartesian = (\r\n centerX: number,\r\n centerY: number,\r\n radius: number,\r\n angleInRadians: number,\r\n) => {\r\n return {\r\n x: centerX + radius * Math.cos(angleInRadians),\r\n y: centerY + radius * Math.sin(angleInRadians),\r\n };\r\n};\r\n\r\nexport function getArc(\r\n x: number,\r\n y: number,\r\n radius: number,\r\n startAngleInRadians: number,\r\n endAngleInRadians: number,\r\n) {\r\n const start = polarToCartesian(x, y, radius, startAngleInRadians);\r\n const end = polarToCartesian(\r\n x,\r\n y,\r\n radius,\r\n Math.abs(endAngleInRadians - startAngleInRadians) === 2 * Math.PI\r\n ? 0.999999 * endAngleInRadians\r\n : endAngleInRadians,\r\n );\r\n const largeArcFlag = endAngleInRadians - startAngleInRadians <= Math.PI ? '0' : '1';\r\n const d = ['M', start.x, start.y, 'A', radius, radius, 0, largeArcFlag, 1, end.x, end.y].join(\r\n ' ',\r\n );\r\n return d;\r\n}\r\n","/* eslint-disable @typescript-eslint/no-explicit-any */\r\nimport isEqual from 'fast-deep-equal';\r\nimport { pie } from 'd3-shape';\r\nimport { isValidElement, ReactElement, useRef, useState } from 'react';\r\nimport { H2, P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport { AnimateDataType, ClassNameObject, DonutChartDataType, StyleObject } from '@/Types';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { DetailsModal } from '@/Components/Elements/DetailsModal';\r\nimport { getArc } from '@/Utils/getArc';\r\n\r\ninterface Props {\r\n mainText?:\r\n | string\r\n | {\r\n label: string;\r\n suffix?: string;\r\n prefix?: string;\r\n locale?: string;\r\n padZeros?: boolean;\r\n precision?: number;\r\n }\r\n | ReactElement;\r\n radius: number;\r\n colors: string[];\r\n subNote?: string;\r\n strokeWidth: number;\r\n data: DonutChartDataType[];\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n onSeriesMouseOver?: (_d: any) => void;\r\n onSeriesMouseClick?: (_d: any) => void;\r\n colorDomain: string[];\r\n resetSelectionOnDoubleClick: boolean;\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n trackColor: string;\r\n naLabel: string;\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n mainText,\r\n data,\r\n radius,\r\n colors,\r\n subNote,\r\n strokeWidth,\r\n tooltip,\r\n onSeriesMouseOver,\r\n onSeriesMouseClick,\r\n colorDomain,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate,\r\n trackColor,\r\n naLabel,\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 pieData = pie()\r\n .sort(null)\r\n .startAngle(0)\r\n .value((d: any) => d.size);\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 return (\r\n <>\r\n <motion.svg\r\n ref={svgRef}\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 className='mx-auto'\r\n >\r\n <motion.g transform={`translate(${radius} ${radius})`}>\r\n {mainText || subNote ? (\r\n <foreignObject\r\n y={0 - (radius - strokeWidth)}\r\n x={0 - (radius - strokeWidth)}\r\n width={2 * (radius - strokeWidth)}\r\n height={2 * (radius - strokeWidth)}\r\n >\r\n <div className='flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-4'>\r\n {mainText ? (\r\n isValidElement(mainText) ? (\r\n mainText\r\n ) : (\r\n <H2\r\n marginBottom='none'\r\n className='donut-main-text text-primary-gray-700 dark:text-primary-gray-100 leading-none text-center'\r\n >\r\n {typeof mainText === 'string'\r\n ? mainText\r\n : data.findIndex(d => d.label === mainText.label) !== -1\r\n ? numberFormattingFunction(\r\n data[data.findIndex(d => d.label === mainText.label)].size,\r\n naLabel,\r\n mainText.precision,\r\n mainText.prefix,\r\n mainText.suffix,\r\n mainText.locale,\r\n mainText.padZeros,\r\n )\r\n : naLabel}\r\n </H2>\r\n )\r\n ) : null}\r\n {subNote ? (\r\n <P\r\n marginBottom='none'\r\n size='base'\r\n leading='none'\r\n className='donut-sub-note text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {subNote}\r\n </P>\r\n ) : typeof mainText === 'string' || !mainText || isValidElement(mainText) ? null : (\r\n <P\r\n size='base'\r\n marginBottom='none'\r\n leading='none'\r\n className='donut-label text-primary-gray-700 dark:text-primary-gray-100 text-center font-bold'\r\n >\r\n {mainText.label}\r\n </P>\r\n )}\r\n </div>\r\n </foreignObject>\r\n ) : null}\r\n <circle\r\n cx={0}\r\n cy={0}\r\n r={radius - strokeWidth / 2}\r\n fill='none'\r\n stroke={trackColor}\r\n strokeWidth={strokeWidth}\r\n />\r\n <AnimatePresence>\r\n {pieData(data as any).map((d, i) => (\r\n <motion.path\r\n key={i}\r\n variants={{\r\n initial: {\r\n pathLength: 0,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\r\n : 1,\r\n },\r\n whileInView: {\r\n pathLength: 1,\r\n d: getArc(\r\n 0,\r\n 0,\r\n radius - strokeWidth / 2,\r\n d.startAngle - Math.PI / 2,\r\n d.endAngle - Math.PI / 2,\r\n ),\r\n opacity: mouseOverData\r\n ? mouseOverData.label === (d.data as any).label\r\n ? 1\r\n : 0.3\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 style={{\r\n stroke:\r\n colorDomain.indexOf((d.data as any).label) !== -1\r\n ? colors[colorDomain.indexOf((d.data as any).label) % colors.length]\r\n : Colors.gray,\r\n strokeWidth,\r\n fill: 'none',\r\n }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d.data);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d.data) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d.data);\r\n if (onSeriesMouseClick) onSeriesMouseClick(d.data);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d.data);\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 />\r\n ))}\r\n </AnimatePresence>\r\n </motion.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 <DetailsModal\r\n body={detailsOnClick}\r\n data={mouseClickData}\r\n setData={setMouseClickData}\r\n className={classNames?.modal}\r\n />\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { ReactElement, useEffect, useRef, useState } from 'react';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport orderBy from 'lodash.orderby';\r\nimport { Spacer } from '@undp/design-system-react/Spacer';\r\nimport { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n DonutChartDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n AnimateDataType,\r\n NumberFormatOptions,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\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 { GraphArea, GraphContainer } from '@/Components/Elements/GraphContainer';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects */\r\n data: DonutChartDataType[];\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 /** Array of colors for each segment */\r\n colors?: string[];\r\n /** Domain of colors for the graph */\r\n colorDomain?: 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 donut chart */\r\n radius?: number;\r\n\r\n // Graph Parameters\r\n /** Toggle visibility of color scale. This is only applicable if the data props hae color parameter */\r\n showColorScale?: boolean;\r\n /** Max width of the color scale as a css property */\r\n colorScaleMaxWidth?: string;\r\n /** Stroke width of the arcs and circle of the donut */\r\n strokeWidth?: number;\r\n /** Sorting order for data. This is overwritten by labelOrder prop */\r\n sortData?: 'asc' | 'desc';\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Large text at the center of the donut chart. If the type is an object then the text is the value in the data for the label mentioned in the object */\r\n mainText?:\r\n | string\r\n | {\r\n label: string;\r\n suffix?: string;\r\n prefix?: string;\r\n locale?: string;\r\n padZeros?: boolean;\r\n precision?: number;\r\n }\r\n | ReactElement;\r\n /** Small text at the center of the donut chart */\r\n subNote?: string;\r\n /** Track color (i.e. the color of the donut chart's background) of the donut chart */\r\n trackColor?: string;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n /** Configuration options for controlling number formatting, localization, prefixes/suffixes, precision, and zero padding. */\r\n numberDisplayOptions?: NumberFormatOptions;\r\n /** Defines how “NA” values should be displayed/labelled in the graph */\r\n naLabel?: string;\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 DonutChart(props: Props) {\r\n const {\r\n mainText,\r\n graphTitle,\r\n colors = Colors.light.categoricalColors.colors,\r\n sources,\r\n strokeWidth = 50,\r\n graphDescription,\r\n subNote,\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 graphDownload = false,\r\n dataDownload = false,\r\n colorDomain,\r\n sortData,\r\n language = 'en',\r\n theme = 'light',\r\n width,\r\n height,\r\n minHeight = 0,\r\n relativeHeight,\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n colorScaleMaxWidth,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n animate = false,\r\n trackColor = Colors.light.grays['gray-200'],\r\n naLabel = 'NA',\r\n numberDisplayOptions,\r\n } = props;\r\n\r\n const [graphRadius, setGraphRadius] = useState(0);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setGraphRadius(\r\n (Math.min(\r\n ...[entries[0].target.clientWidth || 620, entries[0].target.clientHeight || 480],\r\n ) || 420) / 2,\r\n );\r\n });\r\n if (graphDiv.current) {\r\n resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, []);\r\n\r\n const sortedData = sortData ? orderBy(data, ['size'], [sortData]) : data;\r\n\r\n return (\r\n <GraphContainer\r\n className={classNames?.graphContainer}\r\n style={styles?.graphContainer}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={ariaLabel}\r\n backgroundColor={backgroundColor}\r\n theme={theme}\r\n language={language}\r\n minHeight={minHeight}\r\n width={width}\r\n height={height}\r\n relativeHeight={relativeHeight}\r\n padding={padding}\r\n >\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {showColorScale && data.length > 0 ? (\r\n <>\r\n <div\r\n className={cn(\r\n 'leading-0 flex mb-0 ml-auto mr-auto justify-center gap-x-3 gap-y-0 flex-wrap',\r\n classNames?.colorLegend,\r\n )}\r\n style={{ maxWidth: colorScaleMaxWidth }}\r\n aria-label='Color legend'\r\n >\r\n {sortedData.map((d, i) => (\r\n <div className='flex gap-2 items-center pb-3' key={i}>\r\n <div\r\n className='w-3 h-3 rounded-full'\r\n style={{\r\n backgroundColor:\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) !== -1\r\n ? (colors || Colors[theme].categoricalColors.colors)[\r\n (colorDomain || sortedData.map(el => el.label)).indexOf(d.label) %\r\n (colors || Colors[theme].categoricalColors.colors).length\r\n ]\r\n : Colors.gray,\r\n }}\r\n />\r\n <P\r\n marginBottom='none'\r\n size='sm'\r\n className='text-primary-gray-700 dark:text-primary-gray-100'\r\n >\r\n {d.label}:{' '}\r\n <span className='font-bold' style={{ fontSize: 'inherit' }}>\r\n {numberFormattingFunction(\r\n d.size,\r\n naLabel,\r\n numberDisplayOptions?.precision,\r\n numberDisplayOptions?.prefix,\r\n numberDisplayOptions?.suffix,\r\n numberDisplayOptions?.locale,\r\n numberDisplayOptions?.padZeros,\r\n )}\r\n </span>\r\n </P>\r\n </div>\r\n ))}\r\n </div>\r\n <Spacer size='lg' />\r\n </>\r\n ) : null}\r\n <GraphArea ref={graphDiv}>\r\n {data.length === 0 && <EmptyState />}\r\n {graphRadius && data.length > 0 ? (\r\n <Graph\r\n mainText={mainText}\r\n data={sortedData}\r\n colors={colors}\r\n radius={radius || graphRadius}\r\n subNote={subNote}\r\n strokeWidth={strokeWidth}\r\n tooltip={tooltip}\r\n colorDomain={colorDomain || sortedData.map(d => d.label)}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n detailsOnClick={detailsOnClick}\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 trackColor={trackColor}\r\n naLabel={naLabel}\r\n />\r\n ) : null}\r\n </GraphArea>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </GraphContainer>\r\n );\r\n}\r\n"],"names":["pi","tau","descending","a","b","identity","d","pie","value","sortValues","sort","startAngle","constant","endAngle","padAngle","data","i","n","array","j","sum","index","arcs","a0","da","a1","p","pa","v","_","polarToCartesian","centerX","centerY","radius","angleInRadians","x","Math","cos","y","sin","getArc","startAngleInRadians","endAngleInRadians","start","end","abs","PI","largeArcFlag","join","Graph","props","$","_c","mainText","colors","subNote","strokeWidth","tooltip","onSeriesMouseOver","onSeriesMouseClick","colorDomain","resetSelectionOnDoubleClick","detailsOnClick","styles","classNames","animate","trackColor","naLabel","svgRef","useRef","t0","amount","once","isInView","useInView","pieData","_temp","mouseOverData","setMouseOverData","useState","undefined","mouseClickData","setMouseClickData","eventX","setEventX","eventY","setEventY","t1","motion","t2","t3","t4","t5","t6","t7","t8","t9","jsx","jsxs","isValidElement","H2","findIndex","d_1","label","numberFormattingFunction","d_0","size","precision","prefix","suffix","locale","padZeros","P","t10","t11","T0","AnimatePresence","t12","duration","d_2","initial","pathLength","opacity","whileInView","transition","stroke","indexOf","length","Colors","gray","fill","event","clientY","clientX","isEqual","event_0","t13","map","t14","t15","g","t16","svg","t17","Tooltip","t18","modal","DetailsModal","t19","Fragment","DonutChart","graphTitle","light","categoricalColors","sources","graphDescription","footNote","showColorScale","padding","backgroundColor","graphID","graphDownload","dataDownload","sortData","language","theme","width","height","minHeight","relativeHeight","ariaLabel","colorScaleMaxWidth","grays","numberDisplayOptions","graphRadius","setGraphRadius","graphDiv","graphParentDiv","useEffect","resizeObserver","ResizeObserver","entries","min","target","clientWidth","clientHeight","current","observe","disconnect","sortedData","orderBy","GraphContainer","graphContainer","GraphHeader","title","description","filter","cn","colorLegend","maxWidth","el","fontSize","Spacer","GraphArea","EmptyState","GraphFooter","footnote","source"],"mappings":";;;;;;;;;;;;;;;;;;AASO,MAAMA,KAAK,KAAK,IAEVC,KAAM,IAAID;ACXR,SAAAE,GAASC,GAAGC,GAAG;AAC5B,SAAOA,IAAID,IAAI,KAAKC,IAAID,IAAI,IAAIC,KAAKD,IAAI,IAAI;AAC/C;ACFe,SAAAE,GAASC,GAAG;AACzB,SAAOA;AACT;ACIe,SAAAC,KAAW;AACxB,MAAIC,IAAQH,IACRI,IAAaP,IACbQ,IAAO,MACPC,IAAaC,EAAS,CAAC,GACvBC,IAAWD,EAASX,EAAG,GACvBa,IAAWF,EAAS,CAAC;AAEzB,WAASL,EAAIQ,GAAM;AACjB,QAAIC,GACAC,KAAKF,IAAOG,GAAMH,CAAI,GAAG,QACzBI,GACA,GACAC,IAAM,GACNC,IAAQ,IAAI,MAAMJ,CAAC,GACnBK,IAAO,IAAI,MAAML,CAAC,GAClBM,IAAK,CAACZ,EAAW,MAAM,MAAM,SAAS,GACtCa,IAAK,KAAK,IAAIvB,IAAK,KAAK,IAAI,CAACA,IAAKY,EAAS,MAAM,MAAM,SAAS,IAAIU,CAAE,CAAC,GACvEE,GACAC,IAAI,KAAK,IAAI,KAAK,IAAIF,CAAE,IAAIP,GAAGH,EAAS,MAAM,MAAM,SAAS,CAAC,GAC9Da,IAAK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,IAAA,EAAU,KAAK3B,GACbjK,UAAAA;AAAAA,MAAAA,EAAKgH,WAAW,KAAK9B,gBAAAA,EAAAA,IAAC2G,IAAA,CAAA,CAAU;AAAA,MAChC9B,KAAe/J,EAAKgH,SAAS,IAC5B9B,gBAAAA,EAAAA,IAAChD,IAAA,EACC,UAAAI,GACA,MAAMwI,GACN,QAAAvI,GACA,QAAQrB,KAAU6I,GAClB,SAAAvH,GACA,aAAAC,GACA,SAAAC,GACA,aAAaG,KAAeiI,EAAWpD,IAAInI,CAAAA,MAAKA,EAAEiG,KAAK,GACvD,mBAAA7C,GACA,oBAAAC,GACA,6BAAAE,GACA,QAAAE,GACA,gBAAAD,GACA,SACEG,MAAY,KACR;AAAA,QAAEqD,UAAU;AAAA,QAAK9C,MAAM;AAAA,QAAMD,QAAQ;AAAA,MAAA,IACrCN,KAAW;AAAA,QAAEqD,UAAU;AAAA,QAAG9C,MAAM;AAAA,QAAMD,QAAQ;AAAA,MAAA,GAEpD,YAAAL,IACA,SAAAC,GAAA,CAAiB,IAEjB;AAAA,IAAA,GACN;AAAA,IACCuF,KAAWE,IACV3D,gBAAAA,EAAAA,IAAC4G,IAAA,EACC,QAAQ;AAAA,MAAEC,UAAU/I,GAAQ+I;AAAAA,MAAUC,QAAQhJ,GAAQgJ;AAAAA,IAAAA,GACtD,YAAY;AAAA,MACVD,UAAU9I,GAAY8I;AAAAA,MACtBC,QAAQ/I,GAAY+I;AAAAA,IAAAA,GAEtB,SAAArD,GACA,UAAAE,GACA,OAAAU,EAAA,CAAa,IAEb;AAAA,EAAA,GACN;AAEJ;","x_google_ignoreList":[0,1,2,3]}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),i=require("react"),jt=require("./parse-xYI9yrvL.cjs"),bt=require("./getSliderMarks-BzrpHrHS.cjs"),Mt=require("./Spinner-WHzzloYQ.cjs"),Ot=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),Nt=require("./Typography-BqmyF1gP.cjs"),qt=require("./index-C5K--w8d.cjs"),Bt=require("./Tooltip-Hr46paWP.cjs"),D=require("./Colors.cjs"),nt=require("./index-BhI7mBJx.cjs"),$t=require("./DetailsModal-jmmKRMRM.cjs"),It=require("./pow-BnyPO-NX.cjs"),yt=require("./select-Bnfk0lJx.cjs"),at=require("./proxy-CqH8m8IQ.cjs"),Pt=require("./use-in-view-dnRv_qqF.cjs"),_t=require("./index-FXfr51ZM.cjs"),Wt=require("./GraphFooter.cjs"),zt=require("./GraphHeader.cjs"),Et=require("./fetchAndParseData-QTF6tjij.cjs"),Vt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Lt=require("./uniqBy-O05lp2S5.cjs"),Dt=require("./GraphContainer-Cul9b74X.cjs");function At(n){const{data:e,colors:r,mapData:K,colorLegendTitle:q,colorDomain:y,radius:k,height:g,width:m,scale:x,centerPoint:B,tooltip:Z,showLabels:xe,mapBorderWidth:ge,mapBorderColor:ye,mapNoDataColor:ve,onSeriesMouseOver:Q,showColorScale:$e,zoomScaleExtend:Ie,zoomTranslateExtend:Pe,highlightedDataPoints:je,onSeriesMouseClick:ee,resetSelectionOnDoubleClick:be,detailsOnClick:v,styles:te,classNames:W,mapProjection:z,zoomInteraction:C,animate:j,dimmedOpacity:oe,customLayers:re,maxRadiusValue:Ee,collapseColorScaleByDefault:De,projectionRotate:$,rewindCoordinatesInMapData:V,overlayMapData:L,overlayMapBorderColor:_e,overlayMapBorderWidth:We}=n,A=i.useMemo(()=>V?S.index_default(K,{reverse:!0}):K,[K,V]),ze=i.useMemo(()=>!V||!L?L:S.index_default(L,{reverse:!0}),[L,V]),[ae,d]=i.useState(void 0),[f,Ce]=i.useState(De===void 0?!(m<680):!De),ne=i.useRef(null),[ie,se]=i.useState(void 0),[F,I]=i.useState(void 0),[T,G]=i.useState(void 0),[H,le]=i.useState(void 0),p=i.useRef(null),b=Pt.useInView(p,{once:j.once,amount:j.amount}),U=i.useRef(null),w=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?It.sqrt().domain([0,Ee]).range([.25,k]).nice():void 0;i.useEffect(()=>{const t=yt.select(U.current),h=yt.select(p.current),a=u=>{if(C==="noZoom")return!1;if(C==="button")return!u.type.includes("wheel");const _=u.type==="wheel",Me=u.type.startsWith("touch"),Oe=u.type==="mousedown"||u.type==="mousemove";return Me?!0:_?C==="scroll"?!0:u.ctrlKey:Oe&&!u.button&&!u.ctrlKey},ue=S.zoom().scaleExtent(Ie).translateExtent(Pe||[[-20,-20],[m+20,g+20]]).filter(a).on("zoom",({transform:u})=>{t.attr("transform",u)});h.call(ue),ne.current=ue},[g,m,C]);const P=S.index_default$1(A),M=qt.index_default(A),we=(P[2]-P[0])*1.15,Re=(P[3]-P[1])*1.15,Se=m*190/960*360/we,ke=g*190/678*180/Re,R=x*Math.min(Se,ke),X=z==="mercator"?S.geoMercator().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="equalEarth"?S.geoEqualEarth().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="naturalEarth"?S.geoNaturalEarth1().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):z==="orthographic"?S.geoOrthographic().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R):S.geoAlbersUsa().rotate($).center(B||M.geometry.coordinates).translate([m/2,g/2]).scale(R),Y=S.geoPath().projection(X),ce=t=>{if(!p.current||!ne.current)return;yt.select(p.current).call(ne.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(at.motion.svg,{width:`${m}px`,height:`${g}px`,viewBox:`0 0 ${m} ${g}`,ref:p,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:U,children:[re.filter(t=>t.position==="before").map(t=>t.layer),A.features.map((t,h)=>{const a=Y(t);return a?o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ye,strokeWidth:ge,fill:ve,vectorEffect:"non-scaling-stroke"}},h):null}),ze?.features.map((t,h)=>{const a=Y(t);return a?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:_e||ye,strokeWidth:We||ge+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},h):null}),o.jsxRuntimeExports.jsx(_t.AnimatePresence,{children:e.map(t=>{const h=e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray;return o.jsxRuntimeExports.jsxs(at.motion.g,{className:"undp-map-dots",variants:{initial:{opacity:0},whileInView:{opacity:ae?ae===h?1:oe:je?je.indexOf(t.label||"")!==-1?1:oe:1,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},onMouseEnter:a=>{I(t),le(a.clientY),G(a.clientX),Q?.(t)},onMouseMove:a=>{I(t),le(a.clientY),G(a.clientX)},onMouseLeave:()=>{I(void 0),G(void 0),le(void 0),Q?.(void 0)},onClick:()=>{(ee||v)&&(Ot.isEqual(ie,t)&&be?(se(void 0),ee?.(void 0)):(se(t),ee?.(t)))},transform:`translate(${X([t.long,t.lat])[0]},${X([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(at.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray},whileInView:{r:w?w(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray,transition:{duration:j.duration}}},initial:"initial",animate:b?"whileInView":"initial",exit:{r:0,transition:{duration:j.duration}},style:{fillOpacity:.8,vectorEffect:"non-scaling-stroke"}}),xe&&t.label?o.jsxRuntimeExports.jsx(at.motion.text,{variants:{initial:{opacity:0,x:w?w(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray},whileInView:{opacity:1,x:w?w(t.radius||0):k,transition:{duration:j.duration},fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:D.Colors.gray}},initial:"initial",animate:b?"whileInView":"initial",exit:{opacity:0,transition:{duration:j.duration}},y:0,className:o.mo("graph-value text-sm",W?.graphObjectValues),style:{textAnchor:"start",vectorEffect:"non-scaling-stroke",...te?.graphObjectValues||{}},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),re.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||$e===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",W?.colorLegend),children:f?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{Ce(!1)},children:o.jsxRuntimeExports.jsx(nt.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[q&&q!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:q}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:y.map((t,h)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{d(r[h%r.length])},onMouseLeave:()=>{d(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[h%r.length]}}),o.jsxRuntimeExports.jsx(Nt._,{size:"sm",marginBottom:"none",leading:"none",children:t})]},h))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{Ce(!0)},children:o.jsxRuntimeExports.jsx(nt.ExpandIcon,{})})}),C==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),v&&ie!==void 0?o.jsxRuntimeExports.jsx($t.DetailsModal,{body:v,data:ie,setData:se,className:W?.modal}):null,F&&Z&&T&&H?o.jsxRuntimeExports.jsx(Bt.Tooltip,{data:F,body:Z,xPos:T,yPos:H,backgroundStyle:te?.tooltip,className:W?.tooltip}):null]})}function Ft(n){const e=o.compilerRuntimeExports.c(128),{data:r,mapData:K,graphTitle:q,colors:y,sources:k,graphDescription:g,height:m,width:x,footNote:B,colorLegendTitle:Z,colorDomain:xe,radius:ge,scale:ye,centerPoint:ve,padding:Q,mapBorderWidth:$e,mapNoDataColor:Ie,backgroundColor:Pe,showLabels:je,mapBorderColor:ee,tooltip:be,relativeHeight:v,onSeriesMouseOver:te,isWorldMap:W,showColorScale:z,zoomScaleExtend:C,zoomTranslateExtend:j,graphID:oe,highlightedDataPoints:re,onSeriesMouseClick:Ee,graphDownload:De,dataDownload:$,showAntarctica:V,language:L,minHeight:_e,theme:We,ariaLabel:A,resetSelectionOnDoubleClick:ze,detailsOnClick:ae,styles:d,classNames:f,mapProjection:Ce,zoomInteraction:ne,animate:ie,dimmedOpacity:se,customLayers:F,maxRadiusValue:I,timeline:T,collapseColorScaleByDefault:G,projectionRotate:H,rewindCoordinatesInMapData:le,mapOverlay:p}=n,b=K===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":K,U=B===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":B,w=ge===void 0?5:ge,P=ye===void 0?.95:ye,M=$e===void 0?.5:$e,we=Ie===void 0?D.Colors.light.graphNoData:Ie,Re=Pe===void 0?!1:Pe,Se=je===void 0?!1:je,ke=ee===void 0?D.Colors.light.grays["gray-500"]:ee,R=W===void 0?!0:W,X=z===void 0?!0:z;let Y;e[0]!==C?(Y=C===void 0?[.8,6]:C,e[0]=C,e[1]=Y):Y=e[1];const ce=Y,t=De===void 0?!1:De,h=$===void 0?!1:$,a=V===void 0?!1:V,ue=L===void 0?"en":L,u=_e===void 0?0:_e,_=We===void 0?"light":We,Me=ze===void 0?!0:ze,Oe=Ce===void 0?"naturalEarth":Ce,it=ne===void 0?"button":ne,Ve=ie===void 0?!1:ie,st=se===void 0?.3:se;let Le;e[2]!==F?(Le=F===void 0?[]:F,e[2]=F,e[3]=Le):Le=e[3];const lt=Le;let Ae;e[4]!==T?(Ae=T===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:T,e[4]=T,e[5]=Ae):Ae=e[5];const s=Ae;let Fe;e[6]!==H?(Fe=H===void 0?[0,0]:H,e[6]=H,e[7]=Fe):Fe=e[7];const ct=Fe,ut=le===void 0?!0:le,[J,Ct]=i.useState(0),[Ne,wt]=i.useState(0),[O,Rt]=i.useState(s.autoplay);let qe;if(e[8]!==r||e[9]!==s.dateFormat){let l;e[11]!==s.dateFormat?(l=E=>jt.parse(`${E.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=l):l=e[12],qe=[...new Set(r.filter(to).map(l))],qe.sort(eo),e[8]=r,e[9]=s.dateFormat,e[10]=qe}else qe=e[10];const c=qe,[N,dt]=i.useState(s.autoplay?0:c.length-1),[de,St]=i.useState(void 0),[pt,kt]=i.useState(void 0),mt=i.useRef(null),vt=i.useRef(null);let Te,Ge;e[13]===Symbol.for("react.memo_cache_sentinel")?(Te=()=>{const l=new ResizeObserver(E=>{Ct(E[0].target.clientWidth||620),wt(E[0].target.clientHeight||480)});return mt.current&&l.observe(mt.current),()=>l.disconnect()},Ge=[],e[13]=Te,e[14]=Ge):(Te=e[13],Ge=e[14]),i.useEffect(Te,Ge);let He;e[15]===Symbol.for("react.memo_cache_sentinel")?(He=l=>{St(l)},e[15]=He):He=e[15];const Ue=i.useEffectEvent(He);let Xe;e[16]===Symbol.for("react.memo_cache_sentinel")?(Xe=l=>{kt(l)},e[16]=Xe):Xe=e[16];const Be=i.useEffectEvent(Xe);let Ye;e[17]!==b||e[18]!==Ue?(Ye=()=>{typeof b=="string"?Et.fetchAndParseJSON(b).then(E=>{Ue(E)}):Ue(b)},e[17]=b,e[18]=Ue,e[19]=Ye):Ye=e[19];let Je;e[20]!==b?(Je=[b],e[20]=b,e[21]=Je):Je=e[21],i.useEffect(Ye,Je);let Ke;e[22]!==p?.mapData||e[23]!==Be?(Ke=()=>{p?.mapData||Be(void 0),typeof p?.mapData=="string"?Et.fetchAndParseJSON(p?.mapData).then(E=>{Be(E)}):Be(p?.mapData)},e[22]=p?.mapData,e[23]=Be,e[24]=Ke):Ke=e[24];const ft=p?.mapData;let Ze;e[25]!==ft?(Ze=[ft],e[25]=ft,e[26]=Ze):Ze=e[26],i.useEffect(Ke,Ze);let Qe,et;e[27]!==O||e[28]!==s.speed||e[29]!==c?(Qe=()=>{const l=setInterval(()=>{dt(E=>E<c.length-1?E+1:0)},(s.speed||2)*1e3);return O||clearInterval(l),()=>clearInterval(l)},et=[c,O,s.speed],e[27]=O,e[28]=s.speed,e[29]=c,e[30]=Qe,e[31]=et):(Qe=e[30],et=e[31]),i.useEffect(Qe,et);const ht=s.dateFormat||"yyyy";let tt;e[32]!==N||e[33]!==ht||e[34]!==s.showOnlyActiveDate||e[35]!==c?(tt=bt.getSliderMarks(c,N,s.showOnlyActiveDate,ht),e[32]=N,e[33]=ht,e[34]=s.showOnlyActiveDate,e[35]=c,e[36]=tt):tt=e[36];const ot=tt,xt=f?.graphContainer,gt=d?.graphContainer;let pe;e[37]!==f?.description||e[38]!==f?.title||e[39]!==r||e[40]!==h||e[41]!==g||e[42]!==t||e[43]!==q||e[44]!==d?.description||e[45]!==d?.title||e[46]!==x?(pe=q||g||t||h?o.jsxRuntimeExports.jsx(zt.GraphHeader,{styles:{title:d?.title,description:d?.description},classNames:{title:f?.title,description:f?.description},graphTitle:q,graphDescription:g,width:x,graphDownload:t?vt:void 0,dataDownload:h?r.map(Qt).filter(Zt).length>0?r.map(Kt).filter(Jt):r.filter(Yt):null}):null,e[37]=f?.description,e[38]=f?.title,e[39]=r,e[40]=h,e[41]=g,e[42]=t,e[43]=q,e[44]=d?.description,e[45]=d?.title,e[46]=x,e[47]=pe):pe=e[47];let me;e[48]!==N||e[49]!==ot||e[50]!==O||e[51]!==s.enabled||e[52]!==c?(me=s.enabled&&c.length>0&&ot?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Rt(!O)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":O?"Click to pause animation":"Click to play animation",children:O?o.jsxRuntimeExports.jsx(nt.Pause,{}):o.jsxRuntimeExports.jsx(nt.Play,{})}),o.jsxRuntimeExports.jsx(bt.Nr,{min:c[0],max:c[c.length-1],marks:ot,step:null,defaultValue:c[c.length-1],value:c[N],onChangeComplete:l=>{dt(c.indexOf(l))},onChange:l=>{dt(c.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[48]=N,e[49]=ot,e[50]=O,e[51]=s.enabled,e[52]=c,e[53]=me):me=e[53];let fe;e[54]!==Ve||e[55]!==ve||e[56]!==f||e[57]!==G||e[58]!==xe||e[59]!==Z||e[60]!==y||e[61]!==lt||e[62]!==r||e[63]!==ae||e[64]!==st||e[65]!==m||e[66]!==re||e[67]!==N||e[68]!==R||e[69]!==ke||e[70]!==M||e[71]!==we||e[72]!==p?.mapBorderColor||e[73]!==p?.mapBorderWidth||e[74]!==Oe||e[75]!==de||e[76]!==I||e[77]!==u||e[78]!==Ee||e[79]!==te||e[80]!==pt||e[81]!==ct||e[82]!==w||e[83]!==v||e[84]!==Me||e[85]!==ut||e[86]!==P||e[87]!==a||e[88]!==X||e[89]!==Se||e[90]!==d||e[91]!==Ne||e[92]!==J||e[93]!==_||e[94]!==s.dateFormat||e[95]!==s.enabled||e[96]!==be||e[97]!==c||e[98]!==x||e[99]!==it||e[100]!==ce||e[101]!==j?(fe=o.jsxRuntimeExports.jsx(Dt.GraphArea,{ref:mt,children:J&&Ne&&de?o.jsxRuntimeExports.jsx(At,{data:r.filter(l=>s.enabled?`${l.date}`===jt.format(new Date(c[N]),s.dateFormat||"yyyy"):l),mapData:a?de:{...de,features:de.features.filter(Xt)},colorDomain:r.filter(Ut).length===0?[]:xe||Lt.uniqBy(r,"color",!0),width:J,height:Ne,scale:P,centerPoint:ve,colors:r.filter(Ht).length===0?y?[y]:[D.Colors.primaryColors["blue-600"]]:y||D.Colors[_].categoricalColors.colors,colorLegendTitle:Z,radius:w,overlayMapData:pt,overlayMapBorderColor:p?.mapBorderColor,overlayMapBorderWidth:p?.mapBorderWidth,mapBorderWidth:M,mapNoDataColor:we,mapBorderColor:ke,tooltip:be,onSeriesMouseOver:te,showLabels:Se,isWorldMap:R,showColorScale:X,zoomScaleExtend:ce,zoomTranslateExtend:j,onSeriesMouseClick:Ee,highlightedDataPoints:re,resetSelectionOnDoubleClick:Me,styles:d,classNames:f,zoomInteraction:it,detailsOnClick:ae,mapProjection:Oe||(R?"naturalEarth":"mercator"),animate:Ve===!0?{duration:.5,once:!0,amount:.5}:Ve||{duration:0,once:!0,amount:0},dimmedOpacity:st,customLayers:lt,maxRadiusValue:Vt.checkIfNullOrUndefined(I)?Math.max(...r.map(Gt).filter(Tt)):I,collapseColorScaleByDefault:G,projectionRotate:ct,rewindCoordinatesInMapData:ut}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(u,m||(v?u?(x||J)*v>u?(x||J)*v:u:(x||J)*v:Ne))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Mt.w,{"aria-label":"Loading graph"})})}),e[54]=Ve,e[55]=ve,e[56]=f,e[57]=G,e[58]=xe,e[59]=Z,e[60]=y,e[61]=lt,e[62]=r,e[63]=ae,e[64]=st,e[65]=m,e[66]=re,e[67]=N,e[68]=R,e[69]=ke,e[70]=M,e[71]=we,e[72]=p?.mapBorderColor,e[73]=p?.mapBorderWidth,e[74]=Oe,e[75]=de,e[76]=I,e[77]=u,e[78]=Ee,e[79]=te,e[80]=pt,e[81]=ct,e[82]=w,e[83]=v,e[84]=Me,e[85]=ut,e[86]=P,e[87]=a,e[88]=X,e[89]=Se,e[90]=d,e[91]=Ne,e[92]=J,e[93]=_,e[94]=s.dateFormat,e[95]=s.enabled,e[96]=be,e[97]=c,e[98]=x,e[99]=it,e[100]=ce,e[101]=j,e[102]=fe):fe=e[102];let he;e[103]!==f?.footnote||e[104]!==f?.source||e[105]!==U||e[106]!==k||e[107]!==d?.footnote||e[108]!==d?.source||e[109]!==x?(he=k||U?o.jsxRuntimeExports.jsx(Wt.GraphFooter,{styles:{footnote:d?.footnote,source:d?.source},classNames:{footnote:f?.footnote,source:f?.source},sources:k,footNote:U,width:x}):null,e[103]=f?.footnote,e[104]=f?.source,e[105]=U,e[106]=k,e[107]=d?.footnote,e[108]=d?.source,e[109]=x,e[110]=he):he=e[110];let rt;return e[111]!==A||e[112]!==Re||e[113]!==oe||e[114]!==m||e[115]!==ue||e[116]!==u||e[117]!==Q||e[118]!==v||e[119]!==xt||e[120]!==gt||e[121]!==pe||e[122]!==me||e[123]!==fe||e[124]!==he||e[125]!==_||e[126]!==x?(rt=o.jsxRuntimeExports.jsxs(Dt.GraphContainer,{className:xt,style:gt,id:oe,ref:vt,"aria-label":A,backgroundColor:Re,theme:_,language:ue,minHeight:u,width:x,height:m,relativeHeight:v,padding:Q,children:[pe,me,fe,he]}),e[111]=A,e[112]=Re,e[113]=oe,e[114]=m,e[115]=ue,e[116]=u,e[117]=Q,e[118]=v,e[119]=xt,e[120]=gt,e[121]=pe,e[122]=me,e[123]=fe,e[124]=he,e[125]=_,e[126]=x,e[127]=rt):rt=e[127],rt}function Tt(n){return n!=null}function Gt(n){return n.radius}function Ht(n){return n.color}function Ut(n){return n.color}function Xt(n){return n.properties?.NAME!=="Antarctica"}function Yt(n){return n!==void 0}function Jt(n){return n!==void 0}function Kt(n){return n.data}function Zt(n){return n!==void 0}function Qt(n){return n.data}function eo(n,e){return n-e}function to(n){return n.date}exports.DotDensityMap=Ft;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index-CHPV5EwG-D4pAp7u0.cjs"),i=require("react"),jt=require("./parse-xYI9yrvL.cjs"),bt=require("./getSliderMarks-BzrpHrHS.cjs"),Mt=require("./Spinner-WHzzloYQ.cjs"),Ot=require("./index-DQA8q5sC.cjs"),S=require("./index-DLFt97gy.cjs"),Nt=require("./Typography-BqmyF1gP.cjs"),qt=require("./index-C5K--w8d.cjs"),Bt=require("./Tooltip-C9F3uYG0.cjs"),w=require("./Colors.cjs"),it=require("./index-BhI7mBJx.cjs"),It=require("./DetailsModal-Du8Fr1QD.cjs"),$t=require("./ImageDownloadButton.cjs"),Pt=require("./pow-BnyPO-NX.cjs"),yt=require("./select-Bnfk0lJx.cjs"),nt=require("./proxy-CqH8m8IQ.cjs"),_t=require("./use-in-view-dnRv_qqF.cjs"),zt=require("./index-FXfr51ZM.cjs"),Wt=require("./GraphFooter.cjs"),Vt=require("./GraphHeader.cjs"),Et=require("./fetchAndParseData-QTF6tjij.cjs"),Lt=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),At=require("./uniqBy-O05lp2S5.cjs"),Dt=require("./GraphContainer-Cul9b74X.cjs");function Ft(n){const{data:e,colors:r,mapData:X,colorLegendTitle:B,colorDomain:y,radius:k,height:g,width:p,scale:f,centerPoint:I,tooltip:Y,showLabels:fe,mapBorderWidth:he,mapBorderColor:ge,mapNoDataColor:ye,onSeriesMouseOver:J,showColorScale:$e,zoomScaleExtend:Pe,zoomTranslateExtend:_e,highlightedDataPoints:ve,onSeriesMouseClick:K,resetSelectionOnDoubleClick:je,detailsOnClick:j,styles:Z,classNames:A,mapProjection:F,zoomInteraction:C,animate:b,dimmedOpacity:Q,customLayers:ee,maxRadiusValue:be,collapseColorScaleByDefault:Ee,projectionRotate:$,rewindCoordinatesInMapData:T,overlayMapData:G,overlayMapBorderColor:ze,overlayMapBorderWidth:We,graphDownload:te}=n,oe=i.useMemo(()=>T?S.index_default(X,{reverse:!0}):X,[X,T]),De=i.useMemo(()=>!T||!G?G:S.index_default(G,{reverse:!0}),[G,T]),[u,d]=i.useState(void 0),[Ve,we]=i.useState(Ee===void 0?!(p<680):!Ee),re=i.useRef(null),[ae,P]=i.useState(void 0),[H,_]=i.useState(void 0),[ne,z]=i.useState(void 0),[Ce,m]=i.useState(void 0),v=i.useRef(null),W=_t.useInView(v,{once:b.once,amount:b.amount}),ie=i.useRef(null),R=e.filter(t=>t.radius===void 0||t.radius===null).length!==e.length?Pt.sqrt().domain([0,be]).range([.25,k]).nice():void 0;i.useEffect(()=>{const t=yt.select(ie.current),h=yt.select(v.current),a=x=>{if(C==="noZoom")return!1;if(C==="button")return!x.type.includes("wheel");const Me=x.type==="wheel",Oe=x.type.startsWith("touch"),Ne=x.type==="mousedown"||x.type==="mousemove";return Oe?!0:Me?C==="scroll"?!0:x.ctrlKey:Ne&&!x.button&&!x.ctrlKey},E=S.zoom().scaleExtent(Pe).translateExtent(_e||[[-20,-20],[p+20,g+20]]).filter(a).on("zoom",({transform:x})=>{t.attr("transform",x)});h.call(E),re.current=E},[g,p,C]);const V=S.index_default$1(oe),M=qt.index_default(oe),Re=(V[2]-V[0])*1.15,Se=(V[3]-V[1])*1.15,ke=p*190/960*360/Re,se=g*190/678*180/Se,O=f*Math.min(ke,se),L=F==="mercator"?S.geoMercator().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):F==="equalEarth"?S.geoEqualEarth().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):F==="naturalEarth"?S.geoNaturalEarth1().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):F==="orthographic"?S.geoOrthographic().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O):S.geoAlbersUsa().rotate($).center(I||M.geometry.coordinates).translate([p/2,g/2]).scale(O),le=S.geoPath().projection(L),ce=t=>{if(!v.current||!re.current)return;yt.select(v.current).call(re.current.scaleBy,t==="in"?1.2:1/1.2)};return o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsxs("div",{className:"relative",children:[o.jsxRuntimeExports.jsx(nt.motion.svg,{width:`${p}px`,height:`${g}px`,viewBox:`0 0 ${p} ${g}`,ref:v,direction:"ltr",children:o.jsxRuntimeExports.jsxs("g",{ref:ie,children:[ee.filter(t=>t.position==="before").map(t=>t.layer),oe.features.map((t,h)=>{const a=le(t);return a?o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ge,strokeWidth:he,fill:ye,vectorEffect:"non-scaling-stroke"}},h):null}),De?.features.map((t,h)=>{const a=le(t);return a?o.jsxRuntimeExports.jsx("g",{children:o.jsxRuntimeExports.jsx("path",{d:a,style:{stroke:ze||ge,strokeWidth:We||he+1,fill:"none",pointerEvents:"none",vectorEffect:"non-scaling-stroke"}})},h):null}),o.jsxRuntimeExports.jsx(zt.AnimatePresence,{children:e.map(t=>{const h=e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray;return o.jsxRuntimeExports.jsxs(nt.motion.g,{className:"undp-map-dots",variants:{initial:{opacity:0},whileInView:{opacity:u?u===h?1:Q:ve?ve.indexOf(t.label||"")!==-1?1:Q:1,transition:{duration:b.duration}}},initial:"initial",animate:W?"whileInView":"initial",exit:{opacity:0,transition:{duration:b.duration}},onMouseEnter:a=>{_(t),m(a.clientY),z(a.clientX),J?.(t)},onMouseMove:a=>{_(t),m(a.clientY),z(a.clientX)},onMouseLeave:()=>{_(void 0),z(void 0),m(void 0),J?.(void 0)},onClick:()=>{(K||j)&&(Ot.isEqual(ae,t)&&je?(P(void 0),K?.(void 0)):(P(t),K?.(t)))},transform:`translate(${L([t.long,t.lat])[0]},${L([t.long,t.lat])[1]})`,children:[o.jsxRuntimeExports.jsx(nt.motion.circle,{cx:0,cy:0,variants:{initial:{r:0,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray},whileInView:{r:R?R(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray,stroke:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray,transition:{duration:b.duration}}},initial:"initial",animate:W?"whileInView":"initial",exit:{r:0,transition:{duration:b.duration}},style:{fillOpacity:.8,vectorEffect:"non-scaling-stroke"}}),fe&&t.label?o.jsxRuntimeExports.jsx(nt.motion.text,{variants:{initial:{opacity:0,x:R?R(t.radius||0):k,fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray},whileInView:{opacity:1,x:R?R(t.radius||0):k,transition:{duration:b.duration},fill:e.filter(a=>a.color).length===0?r[0]:t.color?r[y.indexOf(`${t.color}`)]:w.Colors.gray}},initial:"initial",animate:W?"whileInView":"initial",exit:{opacity:0,transition:{duration:b.duration}},y:0,className:o.mo("graph-value text-sm",A?.graphObjectValues),style:{textAnchor:"start",vectorEffect:"non-scaling-stroke",...Z?.graphObjectValues||{}},dx:4,dy:5,children:t.label}):null]},t.label||`${t.lat}-${t.long}`)})}),ee.filter(t=>t.position==="after").map(t=>t.layer)]})}),e.filter(t=>t.color).length===0||$e===!1?null:o.jsxRuntimeExports.jsx("div",{className:o.mo("absolute left-4 bottom-4 map-color-legend",A?.colorLegend),children:Ve?o.jsxRuntimeExports.jsxs(o.jsxRuntimeExports.Fragment,{children:[o.jsxRuntimeExports.jsx("div",{className:"color-legend-close-button bg-[rgba(240,240,240,0.7)] dark:bg-[rgba(30,30,30,0.7)] border border-[var(--gray-400)] rounded-full w-6 h-6 p-[3px] cursor-pointer z-10 absolute right-[-0.75rem] top-[-0.75rem]",onClick:()=>{we(!1)},children:o.jsxRuntimeExports.jsx(it.X,{})}),o.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)"},children:[B&&B!==""?o.jsxRuntimeExports.jsx("p",{className:"p-0 leading-normal overflow-hidden text-primary-gray-700 dark:text-primary-gray-300",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical"},children:B}):null,o.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-3",children:y.map((t,h)=>o.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 items-center",onMouseOver:()=>{d(r[h%r.length])},onMouseLeave:()=>{d(void 0)},children:[o.jsxRuntimeExports.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:r[h%r.length]}}),o.jsxRuntimeExports.jsx(Nt._,{size:"sm",marginBottom:"none",leading:"none",children:t})]},h))})]})]}):o.jsxRuntimeExports.jsx("button",{type:"button",className:"p-1 border-0 rounded-[2px] text-primary-gray-700 bg-primary-gray-300 dark:bg-primary-gray-500 map-legend-button",onClick:()=>{we(!0)},children:o.jsxRuntimeExports.jsx(it.ExpandIcon,{})})}),C==="button"&&o.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col undp-viz-zoom-buttons",children:[o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("in"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),o.jsxRuntimeExports.jsx("button",{onClick:()=>ce("out"),className:"leading-0 px-2 py-3.5 text-primary-gray-700 border border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-550 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]}),te&&o.jsxRuntimeExports.jsx("div",{className:"absolute right-4 top-4 flex flex-col image-download-button",children:o.jsxRuntimeExports.jsx($t.ImageDownloadButton,{nodeID:te,buttonSmall:!0})})]}),j&&ae!==void 0?o.jsxRuntimeExports.jsx(It.DetailsModal,{body:j,data:ae,setData:P,className:A?.modal}):null,H&&Y&&ne&&Ce?o.jsxRuntimeExports.jsx(Bt.Tooltip,{data:H,body:Y,xPos:ne,yPos:Ce,backgroundStyle:Z?.tooltip,className:A?.tooltip}):null]})}function Tt(n){const e=o.compilerRuntimeExports.c(128),{data:r,mapData:X,graphTitle:B,colors:y,sources:k,graphDescription:g,height:p,width:f,footNote:I,colorLegendTitle:Y,colorDomain:fe,radius:he,scale:ge,centerPoint:ye,padding:J,mapBorderWidth:$e,mapNoDataColor:Pe,backgroundColor:_e,showLabels:ve,mapBorderColor:K,tooltip:je,relativeHeight:j,onSeriesMouseOver:Z,isWorldMap:A,showColorScale:F,zoomScaleExtend:C,zoomTranslateExtend:b,graphID:Q,highlightedDataPoints:ee,onSeriesMouseClick:be,graphDownload:Ee,dataDownload:$,showAntarctica:T,language:G,minHeight:ze,theme:We,ariaLabel:te,resetSelectionOnDoubleClick:oe,detailsOnClick:De,styles:u,classNames:d,mapProjection:Ve,zoomInteraction:we,animate:re,dimmedOpacity:ae,customLayers:P,maxRadiusValue:H,timeline:_,collapseColorScaleByDefault:ne,projectionRotate:z,rewindCoordinatesInMapData:Ce,mapOverlay:m}=n,v=X===void 0?"https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap-v2.json":X,W=I===void 0?"The designations employed and the presentation of material on this map do not imply the expression of any opinion whatsoever on the part of the Secretariat of the United Nations or UNDP concerning the legal status of any country, territory, city or area or its authorities, or concerning the delimitation of its frontiers or boundaries.":I,ie=he===void 0?5:he,R=ge===void 0?.95:ge,V=$e===void 0?.5:$e,M=Pe===void 0?w.Colors.light.graphNoData:Pe,Re=_e===void 0?!1:_e,Se=ve===void 0?!1:ve,ke=K===void 0?w.Colors.light.grays["gray-500"]:K,se=A===void 0?!0:A,O=F===void 0?!0:F;let L;e[0]!==C?(L=C===void 0?[.8,6]:C,e[0]=C,e[1]=L):L=e[1];const le=L,ce=Ee===void 0?!1:Ee,t=$===void 0?!1:$,h=T===void 0?!1:T,a=G===void 0?"en":G,E=ze===void 0?0:ze,x=We===void 0?"light":We,Me=oe===void 0?!0:oe,Oe=Ve===void 0?"naturalEarth":Ve,Ne=we===void 0?"button":we,Le=re===void 0?!1:re,st=ae===void 0?.3:ae;let Ae;e[2]!==P?(Ae=P===void 0?[]:P,e[2]=P,e[3]=Ae):Ae=e[3];const lt=Ae;let Fe;e[4]!==_?(Fe=_===void 0?{enabled:!1,autoplay:!1,showOnlyActiveDate:!0}:_,e[4]=_,e[5]=Fe):Fe=e[5];const s=Fe;let Te;e[6]!==z?(Te=z===void 0?[0,0]:z,e[6]=z,e[7]=Te):Te=e[7];const ct=Te,ut=Ce===void 0?!0:Ce,[U,wt]=i.useState(0),[qe,Ct]=i.useState(0),[N,Rt]=i.useState(s.autoplay);let Be;if(e[8]!==r||e[9]!==s.dateFormat){let l;e[11]!==s.dateFormat?(l=D=>jt.parse(`${D.date}`,s.dateFormat||"yyyy",new Date).getTime(),e[11]=s.dateFormat,e[12]=l):l=e[12],Be=[...new Set(r.filter(oo).map(l))],Be.sort(to),e[8]=r,e[9]=s.dateFormat,e[10]=Be}else Be=e[10];const c=Be,[q,dt]=i.useState(s.autoplay?0:c.length-1),[ue,St]=i.useState(void 0),[pt,kt]=i.useState(void 0),mt=i.useRef(null),vt=i.useRef(null);let Ge,He;e[13]===Symbol.for("react.memo_cache_sentinel")?(Ge=()=>{const l=new ResizeObserver(D=>{wt(D[0].target.clientWidth||620),Ct(D[0].target.clientHeight||480)});return mt.current&&l.observe(mt.current),()=>l.disconnect()},He=[],e[13]=Ge,e[14]=He):(Ge=e[13],He=e[14]),i.useEffect(Ge,He);let Ue;e[15]===Symbol.for("react.memo_cache_sentinel")?(Ue=l=>{St(l)},e[15]=Ue):Ue=e[15];const Xe=i.useEffectEvent(Ue);let Ye;e[16]===Symbol.for("react.memo_cache_sentinel")?(Ye=l=>{kt(l)},e[16]=Ye):Ye=e[16];const Ie=i.useEffectEvent(Ye);let Je;e[17]!==v||e[18]!==Xe?(Je=()=>{typeof v=="string"?Et.fetchAndParseJSON(v).then(D=>{Xe(D)}):Xe(v)},e[17]=v,e[18]=Xe,e[19]=Je):Je=e[19];let Ke;e[20]!==v?(Ke=[v],e[20]=v,e[21]=Ke):Ke=e[21],i.useEffect(Je,Ke);let Ze;e[22]!==m?.mapData||e[23]!==Ie?(Ze=()=>{m?.mapData||Ie(void 0),typeof m?.mapData=="string"?Et.fetchAndParseJSON(m?.mapData).then(D=>{Ie(D)}):Ie(m?.mapData)},e[22]=m?.mapData,e[23]=Ie,e[24]=Ze):Ze=e[24];const xt=m?.mapData;let Qe;e[25]!==xt?(Qe=[xt],e[25]=xt,e[26]=Qe):Qe=e[26],i.useEffect(Ze,Qe);let et,tt;e[27]!==N||e[28]!==s.speed||e[29]!==c?(et=()=>{const l=setInterval(()=>{dt(D=>D<c.length-1?D+1:0)},(s.speed||2)*1e3);return N||clearInterval(l),()=>clearInterval(l)},tt=[c,N,s.speed],e[27]=N,e[28]=s.speed,e[29]=c,e[30]=et,e[31]=tt):(et=e[30],tt=e[31]),i.useEffect(et,tt);const ft=s.dateFormat||"yyyy";let ot;e[32]!==q||e[33]!==ft||e[34]!==s.showOnlyActiveDate||e[35]!==c?(ot=bt.getSliderMarks(c,q,s.showOnlyActiveDate,ft),e[32]=q,e[33]=ft,e[34]=s.showOnlyActiveDate,e[35]=c,e[36]=ot):ot=e[36];const rt=ot,ht=d?.graphContainer,gt=u?.graphContainer;let de;e[37]!==d?.description||e[38]!==d?.title||e[39]!==r||e[40]!==t||e[41]!==g||e[42]!==B||e[43]!==u?.description||e[44]!==u?.title||e[45]!==f?(de=B||g||t?o.jsxRuntimeExports.jsx(Vt.GraphHeader,{styles:{title:u?.title,description:u?.description},classNames:{title:d?.title,description:d?.description},graphTitle:B,graphDescription:g,width:f,dataDownload:t?r.map(eo).filter(Qt).length>0?r.map(Zt).filter(Kt):r.filter(Jt):null}):null,e[37]=d?.description,e[38]=d?.title,e[39]=r,e[40]=t,e[41]=g,e[42]=B,e[43]=u?.description,e[44]=u?.title,e[45]=f,e[46]=de):de=e[46];let pe;e[47]!==q||e[48]!==rt||e[49]!==N||e[50]!==s.enabled||e[51]!==c?(pe=s.enabled&&c.length>0&&rt?o.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[o.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Rt(!N)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":N?"Click to pause animation":"Click to play animation",children:N?o.jsxRuntimeExports.jsx(it.Pause,{}):o.jsxRuntimeExports.jsx(it.Play,{})}),o.jsxRuntimeExports.jsx(bt.Nr,{min:c[0],max:c[c.length-1],marks:rt,step:null,defaultValue:c[c.length-1],value:c[q],onChangeComplete:l=>{dt(c.indexOf(l))},onChange:l=>{dt(c.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e[47]=q,e[48]=rt,e[49]=N,e[50]=s.enabled,e[51]=c,e[52]=pe):pe=e[52];let me;e[53]!==Le||e[54]!==ye||e[55]!==d||e[56]!==ne||e[57]!==fe||e[58]!==Y||e[59]!==y||e[60]!==lt||e[61]!==r||e[62]!==De||e[63]!==st||e[64]!==ce||e[65]!==p||e[66]!==ee||e[67]!==q||e[68]!==se||e[69]!==ke||e[70]!==V||e[71]!==M||e[72]!==m?.mapBorderColor||e[73]!==m?.mapBorderWidth||e[74]!==Oe||e[75]!==ue||e[76]!==H||e[77]!==E||e[78]!==be||e[79]!==Z||e[80]!==pt||e[81]!==ct||e[82]!==ie||e[83]!==j||e[84]!==Me||e[85]!==ut||e[86]!==R||e[87]!==h||e[88]!==O||e[89]!==Se||e[90]!==u||e[91]!==qe||e[92]!==U||e[93]!==x||e[94]!==s.dateFormat||e[95]!==s.enabled||e[96]!==je||e[97]!==c||e[98]!==f||e[99]!==Ne||e[100]!==le||e[101]!==b?(me=o.jsxRuntimeExports.jsx(Dt.GraphArea,{ref:mt,children:U&&qe&&ue?o.jsxRuntimeExports.jsx(Ft,{data:r.filter(l=>s.enabled?`${l.date}`===jt.format(new Date(c[q]),s.dateFormat||"yyyy"):l),mapData:h?ue:{...ue,features:ue.features.filter(Yt)},colorDomain:r.filter(Xt).length===0?[]:fe||At.uniqBy(r,"color",!0),width:U,height:qe,scale:R,centerPoint:ye,colors:r.filter(Ut).length===0?y?[y]:[w.Colors.primaryColors["blue-600"]]:y||w.Colors[x].categoricalColors.colors,colorLegendTitle:Y,radius:ie,overlayMapData:pt,overlayMapBorderColor:m?.mapBorderColor,overlayMapBorderWidth:m?.mapBorderWidth,mapBorderWidth:V,mapNoDataColor:M,mapBorderColor:ke,tooltip:je,onSeriesMouseOver:Z,showLabels:Se,isWorldMap:se,showColorScale:O,zoomScaleExtend:le,zoomTranslateExtend:b,onSeriesMouseClick:be,highlightedDataPoints:ee,resetSelectionOnDoubleClick:Me,styles:u,classNames:d,zoomInteraction:Ne,detailsOnClick:De,mapProjection:Oe||(se?"naturalEarth":"mercator"),animate:Le===!0?{duration:.5,once:!0,amount:.5}:Le||{duration:0,once:!0,amount:0},dimmedOpacity:st,customLayers:lt,maxRadiusValue:Lt.checkIfNullOrUndefined(H)?Math.max(...r.map(Ht).filter(Gt)):H,collapseColorScaleByDefault:ne,projectionRotate:ct,rewindCoordinatesInMapData:ut,graphDownload:ce?vt:void 0}):o.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(E,p||(j?E?(f||U)*j>E?(f||U)*j:E:(f||U)*j:qe))}px`},className:"flex items-center justify-center",children:o.jsxRuntimeExports.jsx(Mt.w,{"aria-label":"Loading graph"})})}),e[53]=Le,e[54]=ye,e[55]=d,e[56]=ne,e[57]=fe,e[58]=Y,e[59]=y,e[60]=lt,e[61]=r,e[62]=De,e[63]=st,e[64]=ce,e[65]=p,e[66]=ee,e[67]=q,e[68]=se,e[69]=ke,e[70]=V,e[71]=M,e[72]=m?.mapBorderColor,e[73]=m?.mapBorderWidth,e[74]=Oe,e[75]=ue,e[76]=H,e[77]=E,e[78]=be,e[79]=Z,e[80]=pt,e[81]=ct,e[82]=ie,e[83]=j,e[84]=Me,e[85]=ut,e[86]=R,e[87]=h,e[88]=O,e[89]=Se,e[90]=u,e[91]=qe,e[92]=U,e[93]=x,e[94]=s.dateFormat,e[95]=s.enabled,e[96]=je,e[97]=c,e[98]=f,e[99]=Ne,e[100]=le,e[101]=b,e[102]=me):me=e[102];let xe;e[103]!==d?.footnote||e[104]!==d?.source||e[105]!==W||e[106]!==k||e[107]!==u?.footnote||e[108]!==u?.source||e[109]!==f?(xe=k||W?o.jsxRuntimeExports.jsx(Wt.GraphFooter,{styles:{footnote:u?.footnote,source:u?.source},classNames:{footnote:d?.footnote,source:d?.source},sources:k,footNote:W,width:f}):null,e[103]=d?.footnote,e[104]=d?.source,e[105]=W,e[106]=k,e[107]=u?.footnote,e[108]=u?.source,e[109]=f,e[110]=xe):xe=e[110];let at;return e[111]!==te||e[112]!==Re||e[113]!==Q||e[114]!==p||e[115]!==a||e[116]!==E||e[117]!==J||e[118]!==j||e[119]!==ht||e[120]!==gt||e[121]!==de||e[122]!==pe||e[123]!==me||e[124]!==xe||e[125]!==x||e[126]!==f?(at=o.jsxRuntimeExports.jsxs(Dt.GraphContainer,{className:ht,style:gt,id:Q,ref:vt,"aria-label":te,backgroundColor:Re,theme:x,language:a,minHeight:E,width:f,height:p,relativeHeight:j,padding:J,children:[de,pe,me,xe]}),e[111]=te,e[112]=Re,e[113]=Q,e[114]=p,e[115]=a,e[116]=E,e[117]=J,e[118]=j,e[119]=ht,e[120]=gt,e[121]=de,e[122]=pe,e[123]=me,e[124]=xe,e[125]=x,e[126]=f,e[127]=at):at=e[127],at}function Gt(n){return n!=null}function Ht(n){return n.radius}function Ut(n){return n.color}function Xt(n){return n.color}function Yt(n){return n.properties?.NAME!=="Antarctica"}function Jt(n){return n!==void 0}function Kt(n){return n!==void 0}function Zt(n){return n.data}function Qt(n){return n!==void 0}function eo(n){return n.data}function to(n,e){return n-e}function oo(n){return n.date}exports.DotDensityMap=Tt;
2
2
  //# sourceMappingURL=DotDensityMap.cjs.map