@undp/data-viz 1.4.15 → 1.5.0

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 (232) hide show
  1. package/dist/AreaChart.cjs +1 -1
  2. package/dist/AreaChart.js +4 -4
  3. package/dist/BarGraph.cjs +1 -1
  4. package/dist/BarGraph.js +8 -8
  5. package/dist/BeeSwarmChart.cjs +1 -1
  6. package/dist/BeeSwarmChart.js +5 -5
  7. package/dist/BiVariateChoroplethMap.cjs +1 -1
  8. package/dist/BiVariateChoroplethMap.cjs.map +1 -1
  9. package/dist/BiVariateChoroplethMap.js +35 -34
  10. package/dist/BiVariateChoroplethMap.js.map +1 -1
  11. package/dist/BulletChart.cjs +1 -1
  12. package/dist/BulletChart.js +5 -5
  13. package/dist/ButterflyChart.cjs +1 -1
  14. package/dist/ButterflyChart.js +5 -5
  15. package/dist/ChoroplethMap.cjs +1 -1
  16. package/dist/ChoroplethMap.cjs.map +1 -1
  17. package/dist/ChoroplethMap.js +52 -51
  18. package/dist/ChoroplethMap.js.map +1 -1
  19. package/dist/CirclePackingGraph.cjs +1 -1
  20. package/dist/CirclePackingGraph.js +3 -3
  21. package/dist/DataCards.cjs +1 -1
  22. package/dist/DataCards.js +5 -5
  23. package/dist/DataTable.cjs +1 -1
  24. package/dist/DataTable.js +3 -3
  25. package/dist/DifferenceLineChart.cjs +1 -1
  26. package/dist/DifferenceLineChart.js +3 -3
  27. package/dist/DonutChart.cjs +1 -1
  28. package/dist/DonutChart.js +4 -4
  29. package/dist/DotDensityMap.cjs +1 -1
  30. package/dist/DotDensityMap.cjs.map +1 -1
  31. package/dist/DotDensityMap.js +39 -38
  32. package/dist/DotDensityMap.js.map +1 -1
  33. package/dist/DualAxisLineChart.cjs +1 -1
  34. package/dist/DualAxisLineChart.js +3 -3
  35. package/dist/DumbbellChart.cjs +1 -1
  36. package/dist/DumbbellChart.js +6 -6
  37. package/dist/GeoHubCompareMaps.cjs +1 -1
  38. package/dist/GeoHubCompareMaps.js +1 -1
  39. package/dist/GeoHubMap.cjs +1 -1
  40. package/dist/GeoHubMap.js +3 -3
  41. package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
  42. package/dist/GeoHubMapWithLayerSelection.js +4 -4
  43. package/dist/{GraphEl-Bz2jatkM.cjs → GraphEl-4RUlclvW.cjs} +2 -2
  44. package/dist/{GraphEl-Bz2jatkM.cjs.map → GraphEl-4RUlclvW.cjs.map} +1 -1
  45. package/dist/{GraphEl-zNOHBYrK.js → GraphEl-ClIxlWa3.js} +2 -2
  46. package/dist/{GraphEl-zNOHBYrK.js.map → GraphEl-ClIxlWa3.js.map} +1 -1
  47. package/dist/GriddedGraphs.cjs +1 -1
  48. package/dist/GriddedGraphs.d.ts +58 -1
  49. package/dist/GriddedGraphs.js +7 -7
  50. package/dist/GriddedGraphsFromConfig.cjs +1 -1
  51. package/dist/GriddedGraphsFromConfig.d.ts +58 -1
  52. package/dist/GriddedGraphsFromConfig.js +1 -1
  53. package/dist/HeatMap.cjs +1 -1
  54. package/dist/HeatMap.js +4 -4
  55. package/dist/Histogram.cjs +1 -1
  56. package/dist/Histogram.js +1 -1
  57. package/dist/LineChartWithConfidenceInterval.cjs +1 -1
  58. package/dist/LineChartWithConfidenceInterval.js +3 -3
  59. package/dist/MultiGraphDashboard.cjs +1 -1
  60. package/dist/MultiGraphDashboard.d.ts +58 -1
  61. package/dist/MultiGraphDashboard.js +5 -5
  62. package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
  63. package/dist/MultiGraphDashboardFromConfig.d.ts +58 -1
  64. package/dist/MultiGraphDashboardFromConfig.js +1 -1
  65. package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
  66. package/dist/MultiGraphDashboardWideToLongFormat.js +2 -2
  67. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
  68. package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +1 -1
  69. package/dist/MultiLineAltChart.cjs +1 -1
  70. package/dist/MultiLineAltChart.js +4 -4
  71. package/dist/MultiLineChart.cjs +1 -1
  72. package/dist/MultiLineChart.js +3 -3
  73. package/dist/ParetoChart.cjs +1 -1
  74. package/dist/ParetoChart.js +3 -3
  75. package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
  76. package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +58 -1
  77. package/dist/PerformanceIntensiveMultiGraphDashboard.js +5 -5
  78. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
  79. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +58 -1
  80. package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +1 -1
  81. package/dist/PerformanceIntensiveScrollStory.d.ts +58 -1
  82. package/dist/RadarChart.cjs +1 -1
  83. package/dist/RadarChart.js +4 -4
  84. package/dist/SankeyChart.cjs +1 -1
  85. package/dist/SankeyChart.js +6 -6
  86. package/dist/ScatterPlot.cjs +1 -1
  87. package/dist/ScatterPlot.cjs.map +1 -1
  88. package/dist/ScatterPlot.js +31 -29
  89. package/dist/ScatterPlot.js.map +1 -1
  90. package/dist/ScrollStory.d.ts +58 -1
  91. package/dist/SimpleLineChart.cjs +1 -1
  92. package/dist/SimpleLineChart.js +3 -3
  93. package/dist/SingleGraphDashboard.cjs +1 -1
  94. package/dist/SingleGraphDashboard.d.ts +58 -1
  95. package/dist/SingleGraphDashboard.js +8 -8
  96. package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
  97. package/dist/SingleGraphDashboardFromConfig.d.ts +58 -1
  98. package/dist/SingleGraphDashboardFromConfig.js +1 -1
  99. package/dist/SingleGraphDashboardGeoHubMaps.d.ts +58 -1
  100. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
  101. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +58 -1
  102. package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +1 -1
  103. package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
  104. package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
  105. package/dist/SingleGraphDashboardThreeDGraphs.d.ts +58 -1
  106. package/dist/SingleGraphDashboardThreeDGraphs.js +20 -19
  107. package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
  108. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
  109. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +58 -1
  110. package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +1 -1
  111. package/dist/SlopeChart.cjs +1 -1
  112. package/dist/SlopeChart.js +4 -4
  113. package/dist/SparkLine.cjs +1 -1
  114. package/dist/SparkLine.js +2 -2
  115. package/dist/StatCardFromData.cjs +1 -1
  116. package/dist/StatCardFromData.js +1 -1
  117. package/dist/StripChart.cjs +1 -1
  118. package/dist/StripChart.js +5 -5
  119. package/dist/ThreeDGlobe.cjs +1 -1
  120. package/dist/ThreeDGlobe.cjs.map +1 -1
  121. package/dist/ThreeDGlobe.d.ts +61 -6
  122. package/dist/ThreeDGlobe.js +385 -314
  123. package/dist/ThreeDGlobe.js.map +1 -1
  124. package/dist/{Tooltip-DyM5snqx.js → Tooltip-CVCGWyzw.js} +2 -2
  125. package/dist/{Tooltip-DyM5snqx.js.map → Tooltip-CVCGWyzw.js.map} +1 -1
  126. package/dist/{Tooltip-n8z5bfav.cjs → Tooltip-De16GWhY.cjs} +2 -2
  127. package/dist/{Tooltip-n8z5bfav.cjs.map → Tooltip-De16GWhY.cjs.map} +1 -1
  128. package/dist/TreeMapGraph.cjs +1 -1
  129. package/dist/TreeMapGraph.js +3 -3
  130. package/dist/Types.d.ts +58 -1
  131. package/dist/UnitChart.cjs +1 -1
  132. package/dist/UnitChart.js +1 -1
  133. package/dist/_commonjsHelpers-BH3jXuIh.cjs +2 -0
  134. package/dist/_commonjsHelpers-BH3jXuIh.cjs.map +1 -0
  135. package/dist/_commonjsHelpers-ByX85dGu.js +34 -0
  136. package/dist/_commonjsHelpers-ByX85dGu.js.map +1 -0
  137. package/dist/{ensureCompleteData-BBDZbDCE.js → ensureCompleteData-BALdOrsS.js} +2 -2
  138. package/dist/{ensureCompleteData-BBDZbDCE.js.map → ensureCompleteData-BALdOrsS.js.map} +1 -1
  139. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs → ensureCompleteData-BU5Zlccy.cjs} +2 -2
  140. package/dist/{ensureCompleteData-DqWQ2Zbi.cjs.map → ensureCompleteData-BU5Zlccy.cjs.map} +1 -1
  141. package/dist/{fetchAndParseData-4gsYTy6_.js → fetchAndParseData-DBOl1Icl.js} +2 -2
  142. package/dist/{fetchAndParseData-4gsYTy6_.js.map → fetchAndParseData-DBOl1Icl.js.map} +1 -1
  143. package/dist/{fetchAndParseData-CQyVGCul.cjs → fetchAndParseData-Dcy7AS_0.cjs} +2 -2
  144. package/dist/{fetchAndParseData-CQyVGCul.cjs.map → fetchAndParseData-Dcy7AS_0.cjs.map} +1 -1
  145. package/dist/fetchAndParseData.cjs +1 -1
  146. package/dist/fetchAndParseData.js +1 -1
  147. package/dist/{filterData-B8ocT57s.js → filterData-9nEcQ-Jp.js} +3 -3
  148. package/dist/{filterData-B8ocT57s.js.map → filterData-9nEcQ-Jp.js.map} +1 -1
  149. package/dist/{filterData-DN6py7y_.cjs → filterData-BoYadk0l.cjs} +2 -2
  150. package/dist/{filterData-DN6py7y_.cjs.map → filterData-BoYadk0l.cjs.map} +1 -1
  151. package/dist/{getJenks-VhM3GIoC.js → getJenks-DW96UYNE.js} +2 -2
  152. package/dist/{getJenks-VhM3GIoC.js.map → getJenks-DW96UYNE.js.map} +1 -1
  153. package/dist/{getJenks-TWQvbuOz.cjs → getJenks-vofIZmeb.cjs} +2 -2
  154. package/dist/{getJenks-TWQvbuOz.cjs.map → getJenks-vofIZmeb.cjs.map} +1 -1
  155. package/dist/{getUniqValue-CHqgSss5.cjs → getUniqValue-CfuE_l9c.cjs} +2 -2
  156. package/dist/{getUniqValue-CHqgSss5.cjs.map → getUniqValue-CfuE_l9c.cjs.map} +1 -1
  157. package/dist/{getUniqValue-BtUENB2H.js → getUniqValue-CttuU_wn.js} +4 -4
  158. package/dist/{getUniqValue-BtUENB2H.js.map → getUniqValue-CttuU_wn.js.map} +1 -1
  159. package/dist/{index-CaAIPGZo.js → index-AqnpA7_O.js} +2 -2
  160. package/dist/{index-CaAIPGZo.js.map → index-AqnpA7_O.js.map} +1 -1
  161. package/dist/{index-CZbIGs8q.cjs → index-BJOeaYTk.cjs} +2 -2
  162. package/dist/{index-CZbIGs8q.cjs.map → index-BJOeaYTk.cjs.map} +1 -1
  163. package/dist/{index-Bc5VF70V.js → index-BMgDMxKJ.js} +6 -6
  164. package/dist/{index-Bc5VF70V.js.map → index-BMgDMxKJ.js.map} +1 -1
  165. package/dist/{index-B0rbzOoC.cjs → index-BS2TADPj.cjs} +2 -2
  166. package/dist/{index-B0rbzOoC.cjs.map → index-BS2TADPj.cjs.map} +1 -1
  167. package/dist/{index-DNj994Pv.cjs → index-BYzIB5V6.cjs} +2 -2
  168. package/dist/index-BYzIB5V6.cjs.map +1 -0
  169. package/dist/{index-27yTRcko.js → index-Bwrro8-q.js} +2 -2
  170. package/dist/{index-27yTRcko.js.map → index-Bwrro8-q.js.map} +1 -1
  171. package/dist/{index-BczVvEBZ.cjs → index-CQ3e6Ewi.cjs} +2 -2
  172. package/dist/{index-BczVvEBZ.cjs.map → index-CQ3e6Ewi.cjs.map} +1 -1
  173. package/dist/{index-C21TvELx.cjs → index-CSNtgibC.cjs} +2 -2
  174. package/dist/{index-C21TvELx.cjs.map → index-CSNtgibC.cjs.map} +1 -1
  175. package/dist/{index-D7ltPi18.js → index-CeVNqhMO.js} +2 -2
  176. package/dist/{index-D7ltPi18.js.map → index-CeVNqhMO.js.map} +1 -1
  177. package/dist/index-D05lK1Te.cjs +2 -0
  178. package/dist/index-D05lK1Te.cjs.map +1 -0
  179. package/dist/{index-Ds0uHjK9.cjs → index-D72cOtq7.cjs} +2 -2
  180. package/dist/{index-Ds0uHjK9.cjs.map → index-D72cOtq7.cjs.map} +1 -1
  181. package/dist/{index-Cdcfp4nk.js → index-DKCxu1Gh.js} +2 -2
  182. package/dist/index-DKCxu1Gh.js.map +1 -0
  183. package/dist/{index-BXns0-ng.cjs → index-DQA8q5sC.cjs} +2 -2
  184. package/dist/{index-BXns0-ng.cjs.map → index-DQA8q5sC.cjs.map} +1 -1
  185. package/dist/{index-BzeLQvXk.cjs → index-DYH8g9WA.cjs} +2 -2
  186. package/dist/{index-BzeLQvXk.cjs.map → index-DYH8g9WA.cjs.map} +1 -1
  187. package/dist/{index-BbNoLJ_w.cjs → index-Da2GUKrr.cjs} +2 -2
  188. package/dist/{index-BbNoLJ_w.cjs.map → index-Da2GUKrr.cjs.map} +1 -1
  189. package/dist/{index-BLizQDlg.js → index-DvVprvy6.js} +2 -2
  190. package/dist/{index-BLizQDlg.js.map → index-DvVprvy6.js.map} +1 -1
  191. package/dist/{index-UV9hjG_S.js → index-EArKRVKg.js} +2 -2
  192. package/dist/{index-UV9hjG_S.js.map → index-EArKRVKg.js.map} +1 -1
  193. package/dist/{index-C1rRk_50.js → index-V_JXij1_.js} +2 -2
  194. package/dist/{index-C1rRk_50.js.map → index-V_JXij1_.js.map} +1 -1
  195. package/dist/{index-DxagiOHo.js → index-fwdktvAS.js} +2 -2
  196. package/dist/{index-DxagiOHo.js.map → index-fwdktvAS.js.map} +1 -1
  197. package/dist/index-qfWCwobm.js +682 -0
  198. package/dist/index-qfWCwobm.js.map +1 -0
  199. package/dist/index.cjs +1 -1
  200. package/dist/index.d.ts +63 -7
  201. package/dist/index.js +6 -6
  202. package/dist/{string2HTML-CWHGfz_d.js → string2HTML-oFCROsus.js} +2 -2
  203. package/dist/{string2HTML-CWHGfz_d.js.map → string2HTML-oFCROsus.js.map} +1 -1
  204. package/dist/{string2HTML-D2Avudmb.cjs → string2HTML-z7CwHXcx.cjs} +2 -2
  205. package/dist/{string2HTML-D2Avudmb.cjs.map → string2HTML-z7CwHXcx.cjs.map} +1 -1
  206. package/dist/transformData.cjs +1 -1
  207. package/dist/transformData.js +3 -3
  208. package/dist/{transformDataForAggregation-CdcwlnNe.js → transformDataForAggregation-1BYVFqvF.js} +4 -4
  209. package/dist/{transformDataForAggregation-CdcwlnNe.js.map → transformDataForAggregation-1BYVFqvF.js.map} +1 -1
  210. package/dist/{transformDataForAggregation-Du-Hei-W.cjs → transformDataForAggregation-BVxVu4yY.cjs} +2 -2
  211. package/dist/{transformDataForAggregation-Du-Hei-W.cjs.map → transformDataForAggregation-BVxVu4yY.cjs.map} +1 -1
  212. package/dist/{transformDataForGraphFromFile-BCjsizvb.js → transformDataForGraphFromFile-BC9Ha8hF.js} +3 -3
  213. package/dist/{transformDataForGraphFromFile-BCjsizvb.js.map → transformDataForGraphFromFile-BC9Ha8hF.js.map} +1 -1
  214. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs → transformDataForGraphFromFile-b41aNQYY.cjs} +2 -2
  215. package/dist/{transformDataForGraphFromFile-B1A0AS-Z.cjs.map → transformDataForGraphFromFile-b41aNQYY.cjs.map} +1 -1
  216. package/dist/utils.cjs +1 -1
  217. package/dist/utils.js +2 -2
  218. package/dist/zoom-Bsbhil-K.cjs +2 -0
  219. package/dist/zoom-Bsbhil-K.cjs.map +1 -0
  220. package/dist/zoom-DAu91HKr.js +1864 -0
  221. package/dist/zoom-DAu91HKr.js.map +1 -0
  222. package/package.json +2 -2
  223. package/dist/_commonjsHelpers-DKOUU3wS.cjs +0 -2
  224. package/dist/_commonjsHelpers-DKOUU3wS.cjs.map +0 -1
  225. package/dist/_commonjsHelpers-DaMA6jEr.js +0 -9
  226. package/dist/_commonjsHelpers-DaMA6jEr.js.map +0 -1
  227. package/dist/index-Cdcfp4nk.js.map +0 -1
  228. package/dist/index-DNj994Pv.cjs.map +0 -1
  229. package/dist/zoom-Lo7IAUfC.cjs +0 -2
  230. package/dist/zoom-Lo7IAUfC.cjs.map +0 -1
  231. package/dist/zoom-_lqdiGoI.js +0 -1983
  232. package/dist/zoom-_lqdiGoI.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ce=require("./index-CZbIGs8q.cjs"),c=require("react"),ue=require("./index-BXns0-ng.cjs"),xe=require("./index-BczVvEBZ.cjs"),de=require("./Modal-tXZlLE5s.cjs"),he=require("./Spinner-DA6Z5E4n.cjs"),me=require("./numberFormattingFunction-02t-wJta.cjs"),fe=require("./Tooltip-n8z5bfav.cjs"),O=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),pe=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),le=require("./Colors.cjs"),ge=require("./string2HTML-D2Avudmb.cjs"),je=require("./Axis-DE7dSn1_.cjs"),Me=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ye=require("./ReferenceLine-CFVBBN__.cjs"),ve=require("./pow-B5-jkdHU.cjs"),be=require("./linear-BVckp9RD.cjs"),re=require("./y-QcCbqrzx.cjs"),we=require("./GraphFooter.cjs"),Re=require("./GraphHeader.cjs"),Ee=require("./ColorLegendWithMouseOver.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs"),Oe=require("./YTicksAndGridLines-DBDuz6vb.cjs");function ke(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:w,colorDomain:a,rightMargin:se,topMargin:I,bottomMargin:F,showLabels:A,tooltip:j,onSeriesMouseOver:$,refValues:x,selectedColor:B,startFromZero:U,radius:g,maxRadiusValue:G,maxValue:n,minValue:Z,highlightedDataPoints:J,onSeriesMouseClick:P,rtl:oe,resetSelectionOnDoubleClick:K,detailsOnClick:L,suffix:N,prefix:S,styles:y,classNames:q,noOfTicks:Q,dimmedOpacity:V,precision:H,customLayers:k}=ne,X=c.useRef(null),[R,v]=c.useState(void 0),[D,W]=c.useState(void 0),[Y,z]=c.useState(null),[ee,f]=c.useState(void 0),[p,d]=c.useState(void 0),h={top:I,bottom:F,left:ie,right:se},_=b-h.left-h.right,te=w-h.top-h.bottom,M=o.filter(e=>!O.checkIfNullOrUndefined(e.radius)).length===0?o:xe.orderBy(o.filter(e=>!O.checkIfNullOrUndefined(e.radius)),"radius","desc"),E=O.checkIfNullOrUndefined(n)?Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0&&!U?0:Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):n,r=O.checkIfNullOrUndefined(Z)?Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0&&!U?0:Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):Z,l=o.filter(e=>e.radius===void 0||e.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(G)?Math.max(...o.map(e=>e.radius).filter(e=>e!=null)):G]).range([.25,g]).nice():void 0,T=be.linear().domain([r,E]).range([0,_]).nice(),t=T.ticks(Q);return c.useEffect(()=>{z(null);const e=M.filter(m=>m.position);re.forceSimulation(e).force("x",re.forceX(m=>T(m.position)).strength(5)).force("y",re.forceY(m=>te/2).strength(1)).force("collide",re.forceCollide(m=>l?l(m.radius||0)+1:g+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{z(e)}).on("end",()=>{z(e)})},[o,g,te,_,r,E,M,T,l]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[Y?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${w}px`,viewBox:`0 0 ${b} ${w}`,direction:"ltr",ref:X,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{x1:T(r<0?0:r),x2:T(r<0?0:r),y1:0-h.top,y2:te+h.bottom,label:me.numberFormattingFunction(r<0?0:r,"NA",H,S,N),labelPos:{x:T(r<0?0:r),y:0-I,dy:"0.75em",dx:3},classNames:{axis:q?.xAxis?.axis,label:q?.yAxis?.labels},styles:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Me.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>T(e)),y1:0-I,y2:te+h.bottom,styles:{gridLines:y?.xAxis?.gridLines,labels:y?.xAxis?.labels},classNames:{gridLines:q?.xAxis?.gridLines,labels:q?.xAxis?.labels},suffix:N,prefix:S,labelType:"secondary",showGridLines:!0,precision:H})]}):null,k.filter(e=>e.position==="before").map(e=>e.layer),Y.map(e=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${e.x},${e.y})`,opacity:B?e.color&&u[a.indexOf(e.color)]===B?1:V:J.length!==0?J.indexOf(e.label)!==-1?.85:V:.85,onMouseEnter:m=>{v(e),d(m.clientY),f(m.clientX),$?.(e)},onMouseMove:m=>{v(e),d(m.clientY),f(m.clientX)},onClick:()=>{(P||L)&&(ue.isEqual(D,e)&&K?(W(void 0),P?.(void 0)):(W(e),P?.(e)))},onMouseLeave:()=>{v(void 0),f(void 0),d(void 0),$?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,fill:o.filter(m=>m.color).length===0?u[0]:e.color?u[a.indexOf(e.color)]:le.Colors.gray,radius:l?l(e.radius||0):g}),(l?l(e.radius||0):g)>10&&A?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(l?l(e.radius||0):g),x:0-(l?l(e.radius||0):g),width:2*(l?l(e.radius||0):g),height:2*(l?l(e.radius||0):g),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5",children:A?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",q?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((l?l(e.radius||0):g)/4),10),Math.max(Math.round((l?l(e.radius||0):g)*12/`${e.label}`.length),10),20)}px`,color:pe.getTextColorBasedOnBgColor(o.filter(m=>m.color).length===0?u[0]:e.color?u[a.indexOf(e.color)]:le.Colors.gray),hyphens:"auto",...y?.graphObjectValues||{}},children:e.label}):null})})}):null]},e.label)),x?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:x.map((e,m)=>i.jsxRuntimeExports.jsx(ye.RefLineX,{text:e.text,color:e.color,x:T(e.value),y1:0-h.top,y2:te+h.bottom,textSide:T(e.value)>_*.75||oe?"left":"right",classNames:e.classNames,styles:e.styles,isInView:!0},m))}):null,k.filter(e=>e.position==="after").map(e=>e.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${w}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),R&&j&&ee&&p?i.jsxRuntimeExports.jsx(fe.Tooltip,{data:R,body:j,xPos:ee,yPos:p,backgroundStyle:y?.tooltip,className:q?.tooltip}):null,L&&D!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:D!==void 0,onClose:()=>{W(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:ge.string2HTML(L,D)}:void 0,children:typeof L=="function"?L(D):null})}):null]})}function Ne(ne){const{data:o,graphTitle:u,backgroundColor:C=!1,topMargin:ie=25,bottomMargin:b=10,leftMargin:w=10,rightMargin:a=10,showLabels:se=!0,showTicks:I=!0,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:R=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:f,classNames:p,noOfTicks:d,dimmedOpacity:h=.3,precision:_=2,customLayers:te=[]}=ne,[M,E]=c.useState(0),[r,l]=c.useState(0),[T,t]=c.useState(void 0),e=c.useRef(null),m=c.useRef(null);return c.useEffect(()=>{const s=new ResizeObserver(ae=>{E(x||ae[0].target.clientWidth||620),l($||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),E(e.current.clientWidth||620),x||s.observe(e.current)),()=>s.disconnect()},[x,$]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,x?"w-fit":"w-full",p?.graphContainer),style:{...f?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:K,ref:m,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the x-axes. ${j?` ${j}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?G||"1rem":G||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||j||V||H?i.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:p?.title,description:p?.description},graphTitle:u,graphDescription:j,width:x,graphDownload:V?m.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(Ee.ColorLegendWithMouseOver,{width:x,colorLegendTitle:g,colors:F||le.Colors[v].categoricalColors.colors,colorDomain:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X??!0}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(x||M)&&($||r)?i.jsxRuntimeExports.jsx(ke,{data:o,circleColors:o.filter(s=>s.color).length===0?F?[F]:[le.Colors.primaryColors["blue-600"]]:F||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:x||M,selectedColor:T,height:Math.max(R,$||(n?R?(x||M)*n>R?(x||M)*n:R:(x||M)*n:r)),showTicks:I,leftMargin:w,rightMargin:a,topMargin:ie,bottomMargin:b,showLabels:se,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,rtl:k==="he"||k==="ar",resetSelectionOnDoubleClick:W,detailsOnClick:Y,suffix:z,prefix:ee,styles:f,classNames:p,noOfTicks:d||5,dimmedOpacity:h,precision:_,customLayers:te}):null})]})}),A||B?i.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:A,footNote:B,width:x}):null]})})})})}function Se(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:w,colorDomain:a,rightMargin:se,topMargin:I,bottomMargin:F,suffix:A,prefix:j,showLabels:$,tooltip:x,onSeriesMouseOver:B,refValues:U,selectedColor:g,startFromZero:G,radius:n,maxRadiusValue:Z,maxValue:J,minValue:P,highlightedDataPoints:oe,onSeriesMouseClick:K,resetSelectionOnDoubleClick:L,detailsOnClick:N,styles:S,classNames:y,noOfTicks:q,dimmedOpacity:Q,precision:V,customLayers:H}=ne,k=c.useRef(null),[X,R]=c.useState(void 0),[v,D]=c.useState(void 0),[W,Y]=c.useState(null),[z,ee]=c.useState(void 0),[f,p]=c.useState(void 0),d={top:I,bottom:F,left:ie,right:se},h=b-d.left-d.right,_=w-d.top-d.bottom,te=o.filter(t=>!O.checkIfNullOrUndefined(t.radius)).length===0?o:xe.orderBy(o.filter(t=>!O.checkIfNullOrUndefined(t.radius)),"radius","desc"),M=O.checkIfNullOrUndefined(J)?Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))<0&&!G?0:Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):J,E=O.checkIfNullOrUndefined(P)?Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))>=0&&!G?0:Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):P,r=o.filter(t=>t.radius===void 0||t.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(Z)?Math.max(...o.map(t=>t.radius).filter(t=>t!=null)):Z]).range([.25,n]).nice():void 0,l=be.linear().domain([E,M]).range([_,0]).nice(),T=l.ticks(q);return c.useEffect(()=>{Y(null);const t=te.filter(e=>e.position);re.forceSimulation(t).force("y",re.forceY(e=>l(e.position)).strength(5)).force("x",re.forceX(e=>h/2).strength(1)).force("collide",re.forceCollide(e=>r?r(e.radius||0)+1:n+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{Y(t)}).on("end",()=>{Y(t)})},[o,n,_,h,E,M,te,l,r]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[W?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${w}px`,viewBox:`0 0 ${b} ${w}`,direction:"ltr",ref:k,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{y1:l(E<0?0:E),y2:l(E<0?0:E),x1:0-d.left,x2:h+d.right,label:me.numberFormattingFunction(E<0?0:E,"NA",V,j,A),labelPos:{x:0-d.left,y:l(E<0?0:E),dx:0,dy:M<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:S?.xAxis?.axis,label:S?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Oe.YTicksAndGridLines,{values:T.filter(t=>t!==0),y:T.filter(t=>t!==0).map(t=>l(t)),x1:0-d.left,x2:h+d.right,styles:{gridLines:S?.yAxis?.gridLines,labels:S?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:A,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V})]}):null,H.filter(t=>t.position==="before").map(t=>t.layer),W.map(t=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${t.x},${t.y})`,opacity:g?t.color&&u[a.indexOf(t.color)]===g?1:Q:oe.length!==0?oe.indexOf(t.label)!==-1?.85:Q:.85,onMouseEnter:e=>{R(t),p(e.clientY),ee(e.clientX),B?.(t)},onMouseMove:e=>{R(t),p(e.clientY),ee(e.clientX)},onClick:()=>{(K||N)&&(ue.isEqual(v,t)&&L?(D(void 0),K?.(void 0)):(D(t),K?.(t)))},onMouseLeave:()=>{R(void 0),ee(void 0),p(void 0),B?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:r?r(t.radius||0):n,fill:o.filter(e=>e.color).length===0?u[0]:t.color?u[a.indexOf(t.color)]:le.Colors.gray}),(r?r(t.radius||0):n)>10&&$?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(r?r(t.radius||0):n),x:0-(r?r(t.radius||0):n),width:2*(r?r(t.radius||0):n),height:2*(r?r(t.radius||0):n),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit py-0 px-1.5",children:$?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",y?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((r?r(t.radius||0):n)/4),10),Math.max(Math.round((r?r(t.radius||0):n)*12/`${t.label}`.length),10),20)}px`,hyphens:"auto",color:pe.getTextColorBasedOnBgColor(o.filter(e=>e.color).length===0?u[0]:t.color?u[a.indexOf(t.color)]:le.Colors.gray),...S?.graphObjectValues||{}},children:t.label}):null})})}):null]},t.label)),U?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:U.map((t,e)=>i.jsxRuntimeExports.jsx(ye.RefLineY,{text:t.text,color:t.color,y:l(t.value),x1:0-d.left,x2:h+d.right,classNames:t.classNames,styles:t.styles,isInView:!0},e))}):null,H.filter(t=>t.position==="after").map(t=>t.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${w}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),X&&x&&z&&f?i.jsxRuntimeExports.jsx(fe.Tooltip,{data:X,body:x,xPos:z,yPos:f,backgroundStyle:S?.tooltip,className:y?.tooltip}):null,N&&v!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:v!==void 0,onClose:()=>{D(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof N=="string"?{__html:ge.string2HTML(N,v)}:void 0,children:typeof N=="function"?N(v):null})}):null]})}function De(ne){const{data:o,graphTitle:u,colors:C,sources:ie,graphDescription:b,height:w,width:a,footNote:se,colorDomain:I,colorLegendTitle:F,padding:A,backgroundColor:j=!1,topMargin:$=25,bottomMargin:x=10,leftMargin:B=100,rightMargin:U=40,showLabels:g=!0,showTicks:G=!0,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:R=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:f,classNames:p,noOfTicks:d,dimmedOpacity:h=.3,precision:_=2,customLayers:te=[]}=ne,[M,E]=c.useState(0),[r,l]=c.useState(0),[T,t]=c.useState(void 0),e=c.useRef(null),m=c.useRef(null);return c.useEffect(()=>{const s=new ResizeObserver(ae=>{E(a||ae[0].target.clientWidth||620),l(w||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),E(e.current.clientWidth||620),a||s.observe(e.current)),()=>s.disconnect()},[a,w]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${j?j===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,a?"w-fit":"w-full",p?.graphContainer),style:{...f?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:K,ref:m,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the y-axes. ${b?` ${b}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:j?A||"1rem":A||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||b||V||H?i.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:p?.title,description:p?.description},graphTitle:u,graphDescription:b,width:a,graphDownload:V?m.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(Ee.ColorLegendWithMouseOver,{width:a,colorLegendTitle:F,colors:C||le.Colors[v].categoricalColors.colors,colorDomain:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(a||M)&&(w||r)?i.jsxRuntimeExports.jsx(Se,{data:o,circleColors:o.filter(s=>s.color).length===0?C?[C]:[le.Colors.primaryColors["blue-600"]]:C||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:a||M,selectedColor:T,height:Math.max(R,w||(n?R?(a||M)*n>R?(a||M)*n:R:(a||M)*n:r)),showTicks:G,leftMargin:B,rightMargin:U,topMargin:$,bottomMargin:x,showLabels:g,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,resetSelectionOnDoubleClick:W,detailsOnClick:Y,styles:f,classNames:p,suffix:z,prefix:ee,noOfTicks:d||5,dimmedOpacity:h,precision:_,customLayers:te}):null})]})}),ie||se?i.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:ie,footNote:se,width:a}):null]})})})})}function Te(ne){const{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:w,rightMargin:a,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:R,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,detailsOnClick:Y,noOfTicks:z,orientation:ee="vertical",styles:f,classNames:p,dimmedOpacity:d,precision:h,customLayers:_}=ne;return ee==="vertical"?i.jsxRuntimeExports.jsx(De,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:w,rightMargin:a,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:R,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:f,detailsOnClick:Y,classNames:p,noOfTicks:z,dimmedOpacity:d,precision:h,customLayers:_}):i.jsxRuntimeExports.jsx(Ne,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:w,rightMargin:a,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:R,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:f,detailsOnClick:Y,classNames:p,noOfTicks:z,dimmedOpacity:d,precision:h,customLayers:_})}exports.BeeSwarmChart=Te;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-CHPV5EwG-DDoeWRVt.cjs"),ce=require("./index-BJOeaYTk.cjs"),c=require("react"),ue=require("./index-DQA8q5sC.cjs"),xe=require("./index-CQ3e6Ewi.cjs"),de=require("./Modal-tXZlLE5s.cjs"),he=require("./Spinner-DA6Z5E4n.cjs"),me=require("./numberFormattingFunction-02t-wJta.cjs"),fe=require("./Tooltip-De16GWhY.cjs"),O=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),pe=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),le=require("./Colors.cjs"),ge=require("./string2HTML-z7CwHXcx.cjs"),je=require("./Axis-DE7dSn1_.cjs"),Me=require("./XTicksAndGridLines-CCzXIV8d.cjs"),ye=require("./ReferenceLine-CFVBBN__.cjs"),ve=require("./pow-B5-jkdHU.cjs"),be=require("./linear-BVckp9RD.cjs"),re=require("./y-QcCbqrzx.cjs"),we=require("./GraphFooter.cjs"),Re=require("./GraphHeader.cjs"),Ee=require("./ColorLegendWithMouseOver.cjs"),Ce=require("./EmptyState-d8_8SxeW.cjs"),Oe=require("./YTicksAndGridLines-DBDuz6vb.cjs");function ke(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:w,colorDomain:a,rightMargin:se,topMargin:I,bottomMargin:F,showLabels:A,tooltip:j,onSeriesMouseOver:$,refValues:x,selectedColor:B,startFromZero:U,radius:g,maxRadiusValue:G,maxValue:n,minValue:Z,highlightedDataPoints:J,onSeriesMouseClick:P,rtl:oe,resetSelectionOnDoubleClick:K,detailsOnClick:L,suffix:N,prefix:S,styles:y,classNames:q,noOfTicks:Q,dimmedOpacity:V,precision:H,customLayers:k}=ne,X=c.useRef(null),[R,v]=c.useState(void 0),[D,W]=c.useState(void 0),[Y,z]=c.useState(null),[ee,f]=c.useState(void 0),[p,d]=c.useState(void 0),h={top:I,bottom:F,left:ie,right:se},_=b-h.left-h.right,te=w-h.top-h.bottom,M=o.filter(e=>!O.checkIfNullOrUndefined(e.radius)).length===0?o:xe.orderBy(o.filter(e=>!O.checkIfNullOrUndefined(e.radius)),"radius","desc"),E=O.checkIfNullOrUndefined(n)?Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))<0&&!U?0:Math.max(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):n,r=O.checkIfNullOrUndefined(Z)?Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position))>=0&&!U?0:Math.min(...o.filter(e=>!O.checkIfNullOrUndefined(e.position)).map(e=>e.position)):Z,l=o.filter(e=>e.radius===void 0||e.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(G)?Math.max(...o.map(e=>e.radius).filter(e=>e!=null)):G]).range([.25,g]).nice():void 0,T=be.linear().domain([r,E]).range([0,_]).nice(),t=T.ticks(Q);return c.useEffect(()=>{z(null);const e=M.filter(m=>m.position);re.forceSimulation(e).force("x",re.forceX(m=>T(m.position)).strength(5)).force("y",re.forceY(m=>te/2).strength(1)).force("collide",re.forceCollide(m=>l?l(m.radius||0)+1:g+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{z(e)}).on("end",()=>{z(e)})},[o,g,te,_,r,E,M,T,l]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[Y?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${w}px`,viewBox:`0 0 ${b} ${w}`,direction:"ltr",ref:X,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${h.left},${h.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{x1:T(r<0?0:r),x2:T(r<0?0:r),y1:0-h.top,y2:te+h.bottom,label:me.numberFormattingFunction(r<0?0:r,"NA",H,S,N),labelPos:{x:T(r<0?0:r),y:0-I,dy:"0.75em",dx:3},classNames:{axis:q?.xAxis?.axis,label:q?.yAxis?.labels},styles:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Me.XTicksAndGridLines,{values:t.filter(e=>e!==0),x:t.filter(e=>e!==0).map(e=>T(e)),y1:0-I,y2:te+h.bottom,styles:{gridLines:y?.xAxis?.gridLines,labels:y?.xAxis?.labels},classNames:{gridLines:q?.xAxis?.gridLines,labels:q?.xAxis?.labels},suffix:N,prefix:S,labelType:"secondary",showGridLines:!0,precision:H})]}):null,k.filter(e=>e.position==="before").map(e=>e.layer),Y.map(e=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${e.x},${e.y})`,opacity:B?e.color&&u[a.indexOf(e.color)]===B?1:V:J.length!==0?J.indexOf(e.label)!==-1?.85:V:.85,onMouseEnter:m=>{v(e),d(m.clientY),f(m.clientX),$?.(e)},onMouseMove:m=>{v(e),d(m.clientY),f(m.clientX)},onClick:()=>{(P||L)&&(ue.isEqual(D,e)&&K?(W(void 0),P?.(void 0)):(W(e),P?.(e)))},onMouseLeave:()=>{v(void 0),f(void 0),d(void 0),$?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,fill:o.filter(m=>m.color).length===0?u[0]:e.color?u[a.indexOf(e.color)]:le.Colors.gray,radius:l?l(e.radius||0):g}),(l?l(e.radius||0):g)>10&&A?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(l?l(e.radius||0):g),x:0-(l?l(e.radius||0):g),width:2*(l?l(e.radius||0):g),height:2*(l?l(e.radius||0):g),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col gap-0.5 justify-center items-center h-inherit py-0 px-1.5",children:A?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",q?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((l?l(e.radius||0):g)/4),10),Math.max(Math.round((l?l(e.radius||0):g)*12/`${e.label}`.length),10),20)}px`,color:pe.getTextColorBasedOnBgColor(o.filter(m=>m.color).length===0?u[0]:e.color?u[a.indexOf(e.color)]:le.Colors.gray),hyphens:"auto",...y?.graphObjectValues||{}},children:e.label}):null})})}):null]},e.label)),x?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:x.map((e,m)=>i.jsxRuntimeExports.jsx(ye.RefLineX,{text:e.text,color:e.color,x:T(e.value),y1:0-h.top,y2:te+h.bottom,textSide:T(e.value)>_*.75||oe?"left":"right",classNames:e.classNames,styles:e.styles,isInView:!0},m))}):null,k.filter(e=>e.position==="after").map(e=>e.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${w}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),R&&j&&ee&&p?i.jsxRuntimeExports.jsx(fe.Tooltip,{data:R,body:j,xPos:ee,yPos:p,backgroundStyle:y?.tooltip,className:q?.tooltip}):null,L&&D!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:D!==void 0,onClose:()=>{W(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof L=="string"?{__html:ge.string2HTML(L,D)}:void 0,children:typeof L=="function"?L(D):null})}):null]})}function Ne(ne){const{data:o,graphTitle:u,backgroundColor:C=!1,topMargin:ie=25,bottomMargin:b=10,leftMargin:w=10,rightMargin:a=10,showLabels:se=!0,showTicks:I=!0,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:R=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:f,classNames:p,noOfTicks:d,dimmedOpacity:h=.3,precision:_=2,customLayers:te=[]}=ne,[M,E]=c.useState(0),[r,l]=c.useState(0),[T,t]=c.useState(void 0),e=c.useRef(null),m=c.useRef(null);return c.useEffect(()=>{const s=new ResizeObserver(ae=>{E(x||ae[0].target.clientWidth||620),l($||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),E(e.current.clientWidth||620),x||s.observe(e.current)),()=>s.disconnect()},[x,$]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${x?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${C?C===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,x?"w-fit":"w-full",p?.graphContainer),style:{...f?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:K,ref:m,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the x-axes. ${j?` ${j}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?G||"1rem":G||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||j||V||H?i.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:p?.title,description:p?.description},graphTitle:u,graphDescription:j,width:x,graphDownload:V?m.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(Ee.ColorLegendWithMouseOver,{width:x,colorLegendTitle:g,colors:F||le.Colors[v].categoricalColors.colors,colorDomain:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X??!0}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(x||M)&&($||r)?i.jsxRuntimeExports.jsx(ke,{data:o,circleColors:o.filter(s=>s.color).length===0?F?[F]:[le.Colors.primaryColors["blue-600"]]:F||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:U||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:x||M,selectedColor:T,height:Math.max(R,$||(n?R?(x||M)*n>R?(x||M)*n:R:(x||M)*n:r)),showTicks:I,leftMargin:w,rightMargin:a,topMargin:ie,bottomMargin:b,showLabels:se,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,rtl:k==="he"||k==="ar",resetSelectionOnDoubleClick:W,detailsOnClick:Y,suffix:z,prefix:ee,styles:f,classNames:p,noOfTicks:d||5,dimmedOpacity:h,precision:_,customLayers:te}):null})]})}),A||B?i.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:A,footNote:B,width:x}):null]})})})})}function Se(ne){const{data:o,circleColors:u,showTicks:C,leftMargin:ie,width:b,height:w,colorDomain:a,rightMargin:se,topMargin:I,bottomMargin:F,suffix:A,prefix:j,showLabels:$,tooltip:x,onSeriesMouseOver:B,refValues:U,selectedColor:g,startFromZero:G,radius:n,maxRadiusValue:Z,maxValue:J,minValue:P,highlightedDataPoints:oe,onSeriesMouseClick:K,resetSelectionOnDoubleClick:L,detailsOnClick:N,styles:S,classNames:y,noOfTicks:q,dimmedOpacity:Q,precision:V,customLayers:H}=ne,k=c.useRef(null),[X,R]=c.useState(void 0),[v,D]=c.useState(void 0),[W,Y]=c.useState(null),[z,ee]=c.useState(void 0),[f,p]=c.useState(void 0),d={top:I,bottom:F,left:ie,right:se},h=b-d.left-d.right,_=w-d.top-d.bottom,te=o.filter(t=>!O.checkIfNullOrUndefined(t.radius)).length===0?o:xe.orderBy(o.filter(t=>!O.checkIfNullOrUndefined(t.radius)),"radius","desc"),M=O.checkIfNullOrUndefined(J)?Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))<0&&!G?0:Math.max(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):J,E=O.checkIfNullOrUndefined(P)?Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position))>=0&&!G?0:Math.min(...o.filter(t=>!O.checkIfNullOrUndefined(t.position)).map(t=>t.position)):P,r=o.filter(t=>t.radius===void 0||t.radius===null).length!==o.length?ve.sqrt().domain([0,O.checkIfNullOrUndefined(Z)?Math.max(...o.map(t=>t.radius).filter(t=>t!=null)):Z]).range([.25,n]).nice():void 0,l=be.linear().domain([E,M]).range([_,0]).nice(),T=l.ticks(q);return c.useEffect(()=>{Y(null);const t=te.filter(e=>e.position);re.forceSimulation(t).force("y",re.forceY(e=>l(e.position)).strength(5)).force("x",re.forceX(e=>h/2).strength(1)).force("collide",re.forceCollide(e=>r?r(e.radius||0)+1:n+1)).force("charge",re.forceManyBody().strength(-15)).alphaDecay(.05).tick(1e4).on("tick",()=>{Y(t)}).on("end",()=>{Y(t)})},[o,n,_,h,E,M,te,l,r]),i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[W?i.jsxRuntimeExports.jsx("svg",{width:`${b}px`,height:`${w}px`,viewBox:`0 0 ${b} ${w}`,direction:"ltr",ref:k,children:i.jsxRuntimeExports.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[C?i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx(je.Axis,{y1:l(E<0?0:E),y2:l(E<0?0:E),x1:0-d.left,x2:h+d.right,label:me.numberFormattingFunction(E<0?0:E,"NA",V,j,A),labelPos:{x:0-d.left,y:l(E<0?0:E),dx:0,dy:M<0?"1em":-5},classNames:{axis:y?.xAxis?.axis,label:y?.yAxis?.labels},styles:{axis:S?.xAxis?.axis,label:S?.yAxis?.labels}}),i.jsxRuntimeExports.jsx(Oe.YTicksAndGridLines,{values:T.filter(t=>t!==0),y:T.filter(t=>t!==0).map(t=>l(t)),x1:0-d.left,x2:h+d.right,styles:{gridLines:S?.yAxis?.gridLines,labels:S?.yAxis?.labels},classNames:{gridLines:y?.yAxis?.gridLines,labels:y?.yAxis?.labels},suffix:A,prefix:j,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:V})]}):null,H.filter(t=>t.position==="before").map(t=>t.layer),W.map(t=>i.jsxRuntimeExports.jsxs("g",{className:"undp-viz-g-with-hover",transform:`translate(${t.x},${t.y})`,opacity:g?t.color&&u[a.indexOf(t.color)]===g?1:Q:oe.length!==0?oe.indexOf(t.label)!==-1?.85:Q:.85,onMouseEnter:e=>{R(t),p(e.clientY),ee(e.clientX),B?.(t)},onMouseMove:e=>{R(t),p(e.clientY),ee(e.clientX)},onClick:()=>{(K||N)&&(ue.isEqual(v,t)&&L?(D(void 0),K?.(void 0)):(D(t),K?.(t)))},onMouseLeave:()=>{R(void 0),ee(void 0),p(void 0),B?.(void 0)},children:[i.jsxRuntimeExports.jsx("circle",{cx:0,cy:0,r:r?r(t.radius||0):n,fill:o.filter(e=>e.color).length===0?u[0]:t.color?u[a.indexOf(t.color)]:le.Colors.gray}),(r?r(t.radius||0):n)>10&&$?i.jsxRuntimeExports.jsx("g",{children:i.jsxRuntimeExports.jsx("foreignObject",{y:0-(r?r(t.radius||0):n),x:0-(r?r(t.radius||0):n),width:2*(r?r(t.radius||0):n),height:2*(r?r(t.radius||0):n),children:i.jsxRuntimeExports.jsx("div",{className:"flex flex-col justify-center items-center h-inherit py-0 px-1.5",children:$?i.jsxRuntimeExports.jsx("p",{className:i.mo("text-center leading-none m-0",y?.graphObjectValues),style:{fontSize:`${Math.min(Math.max(Math.round((r?r(t.radius||0):n)/4),10),Math.max(Math.round((r?r(t.radius||0):n)*12/`${t.label}`.length),10),20)}px`,hyphens:"auto",color:pe.getTextColorBasedOnBgColor(o.filter(e=>e.color).length===0?u[0]:t.color?u[a.indexOf(t.color)]:le.Colors.gray),...S?.graphObjectValues||{}},children:t.label}):null})})}):null]},t.label)),U?i.jsxRuntimeExports.jsx(i.jsxRuntimeExports.Fragment,{children:U.map((t,e)=>i.jsxRuntimeExports.jsx(ye.RefLineY,{text:t.text,color:t.color,y:l(t.value),x1:0-d.left,x2:h+d.right,classNames:t.classNames,styles:t.styles,isInView:!0},e))}):null,H.filter(t=>t.position==="after").map(t=>t.layer)]})}):i.jsxRuntimeExports.jsx("div",{style:{width:`${b}px`,height:`${w}px`},children:i.jsxRuntimeExports.jsx("div",{className:"flex m-auto items-center justify-center p-0 leading-none text-base h-40",children:i.jsxRuntimeExports.jsx(he.y,{})})}),X&&x&&z&&f?i.jsxRuntimeExports.jsx(fe.Tooltip,{data:X,body:x,xPos:z,yPos:f,backgroundStyle:S?.tooltip,className:y?.tooltip}):null,N&&v!==void 0?i.jsxRuntimeExports.jsx(de.X,{open:v!==void 0,onClose:()=>{D(void 0)},children:i.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof N=="string"?{__html:ge.string2HTML(N,v)}:void 0,children:typeof N=="function"?N(v):null})}):null]})}function De(ne){const{data:o,graphTitle:u,colors:C,sources:ie,graphDescription:b,height:w,width:a,footNote:se,colorDomain:I,colorLegendTitle:F,padding:A,backgroundColor:j=!1,topMargin:$=25,bottomMargin:x=10,leftMargin:B=100,rightMargin:U=40,showLabels:g=!0,showTicks:G=!0,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L=5,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q=[],onSeriesMouseClick:Q,graphDownload:V=!1,dataDownload:H=!1,language:k="en",showNAColor:X=!0,minHeight:R=0,theme:v="light",ariaLabel:D,resetSelectionOnDoubleClick:W=!0,detailsOnClick:Y,suffix:z="",prefix:ee="",styles:f,classNames:p,noOfTicks:d,dimmedOpacity:h=.3,precision:_=2,customLayers:te=[]}=ne,[M,E]=c.useState(0),[r,l]=c.useState(0),[T,t]=c.useState(void 0),e=c.useRef(null),m=c.useRef(null);return c.useEffect(()=>{const s=new ResizeObserver(ae=>{E(a||ae[0].target.clientWidth||620),l(w||ae[0].target.clientHeight||480)});return e.current&&(l(e.current.clientHeight||480),E(e.current.clientWidth||620),a||s.observe(e.current)),()=>s.disconnect()},[a,w]),i.jsxRuntimeExports.jsx("div",{className:`${v||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:i.jsxRuntimeExports.jsx("div",{className:i.mo(`${j?j===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${k||"en"}`,a?"w-fit":"w-full",p?.graphContainer),style:{...f?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:K,ref:m,"aria-label":D||`${u?`The graph shows ${u}. `:""}This is a bee swarm chart showing the distribution along the y-axes. ${b?` ${b}`:""}`,children:i.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:j?A||"1rem":A||0},children:i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[u||b||V||H?i.jsxRuntimeExports.jsx(Re.GraphHeader,{styles:{title:f?.title,description:f?.description},classNames:{title:p?.title,description:p?.description},graphTitle:u,graphDescription:b,width:a,graphDownload:V?m.current:void 0,dataDownload:H?o.map(s=>s.data).filter(s=>s!==void 0).length>0?o.map(s=>s.data).filter(s=>s!==void 0):o.filter(s=>s!==void 0):null}):null,i.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?i.jsxRuntimeExports.jsx(Ce.EmptyState,{}):i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[oe!==!1&&o.filter(s=>s.color).length!==0?i.jsxRuntimeExports.jsx(Ee.ColorLegendWithMouseOver,{width:a,colorLegendTitle:F,colors:C||le.Colors[v].categoricalColors.colors,colorDomain:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),setSelectedColor:t,showNAColor:X}):null,i.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center w-full leading-0",ref:e,"aria-label":"Graph area",children:(a||M)&&(w||r)?i.jsxRuntimeExports.jsx(Se,{data:o,circleColors:o.filter(s=>s.color).length===0?C?[C]:[le.Colors.primaryColors["blue-600"]]:C||le.Colors[v].categoricalColors.colors,colorDomain:o.filter(s=>s.color).length===0?[]:I||ce.uniqBy(o.filter(s=>s.color),"color").map(s=>s.color),width:a||M,selectedColor:T,height:Math.max(R,w||(n?R?(a||M)*n>R?(a||M)*n:R:(a||M)*n:r)),showTicks:G,leftMargin:B,rightMargin:U,topMargin:$,bottomMargin:x,showLabels:g,tooltip:Z,onSeriesMouseOver:J,refValues:P,startFromZero:!1,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,resetSelectionOnDoubleClick:W,detailsOnClick:Y,styles:f,classNames:p,suffix:z,prefix:ee,noOfTicks:d||5,dimmedOpacity:h,precision:_,customLayers:te}):null})]})}),ie||se?i.jsxRuntimeExports.jsx(we.GraphFooter,{styles:{footnote:f?.footnote,source:f?.source},classNames:{footnote:p?.footnote,source:p?.source},sources:ie,footNote:se,width:a}):null]})})})})}function Te(ne){const{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:w,rightMargin:a,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:R,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,detailsOnClick:Y,noOfTicks:z,orientation:ee="vertical",styles:f,classNames:p,dimmedOpacity:d,precision:h,customLayers:_}=ne;return ee==="vertical"?i.jsxRuntimeExports.jsx(De,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:w,rightMargin:a,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:R,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:f,detailsOnClick:Y,classNames:p,noOfTicks:z,dimmedOpacity:d,precision:h,customLayers:_}):i.jsxRuntimeExports.jsx(Ne,{data:o,graphTitle:u,backgroundColor:C,topMargin:ie,bottomMargin:b,leftMargin:w,rightMargin:a,showLabels:se,showTicks:I,colors:F,sources:A,graphDescription:j,height:$,width:x,footNote:B,colorDomain:U,colorLegendTitle:g,padding:G,relativeHeight:n,tooltip:Z,onSeriesMouseOver:J,refValues:P,showColorScale:oe,graphID:K,radius:L,maxRadiusValue:N,maxValue:S,minValue:y,highlightedDataPoints:q,onSeriesMouseClick:Q,graphDownload:V,dataDownload:H,language:k,showNAColor:X,minHeight:R,theme:v,ariaLabel:D,resetSelectionOnDoubleClick:W,styles:f,detailsOnClick:Y,classNames:p,noOfTicks:z,dimmedOpacity:d,precision:h,customLayers:_})}exports.BeeSwarmChart=Te;
2
2
  //# sourceMappingURL=BeeSwarmChart.cjs.map
@@ -1,16 +1,16 @@
1
1
  import { j as i, m as he } from "./index-CHPV5EwG-BPSP-7Jg.js";
2
- import { u as ce } from "./index-CaAIPGZo.js";
2
+ import { u as ce } from "./index-AqnpA7_O.js";
3
3
  import { useRef as ae, useState as T, useEffect as de } from "react";
4
- import { i as ge } from "./index-27yTRcko.js";
5
- import { o as ue } from "./index-BLizQDlg.js";
4
+ import { i as ge } from "./index-Bwrro8-q.js";
5
+ import { o as ue } from "./index-DvVprvy6.js";
6
6
  import { X as me } from "./Modal-DVVwpKhP.js";
7
7
  import { y as fe } from "./Spinner-C85UF28E.js";
8
8
  import { n as xe } from "./numberFormattingFunction-14YCbkN2.js";
9
- import { T as pe } from "./Tooltip-DyM5snqx.js";
9
+ import { T as pe } from "./Tooltip-CVCGWyzw.js";
10
10
  import { c as D } from "./checkIfNullOrUndefined-DmfiKkNw.js";
11
11
  import { g as ye } from "./getTextColorBasedOnBgColor-B6Nk2WBf.js";
12
12
  import { Colors as re } from "./Colors.js";
13
- import { s as ve } from "./string2HTML-CWHGfz_d.js";
13
+ import { s as ve } from "./string2HTML-oFCROsus.js";
14
14
  import { A as be } from "./Axis-Ddg-seDi.js";
15
15
  import { X as Te } from "./XTicksAndGridLines-Bn9u5gOM.js";
16
16
  import { a as Ve, R as Ae } from "./ReferenceLine-CfAW3vKJ.js";
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ke=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./parse-hMnG_lRV.cjs"),Pe=require("./index-CZbIGs8q.cjs"),Le=require("./index-BXns0-ng.cjs"),D=require("./zoom-Lo7IAUfC.cjs"),Te=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),ze=require("./Tooltip-n8z5bfav.cjs"),We=require("./string2HTML-D2Avudmb.cjs"),De=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),$e=require("./index-BW_-wD2k.cjs"),we=require("./select-Bnfk0lJx.cjs"),Me=require("./threshold-DNsSUf8Q.cjs"),Ae=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Be=require("./index-BW8iNx7E.cjs"),Fe=require("./GraphHeader.cjs"),Ve=require("./GraphFooter.cjs"),Re=require("./Colors.cjs"),He=require("./fetchAndParseData-CQyVGCul.cjs"),qe=require("./getJenks-TWQvbuOz.cjs"),Ge=require("./init-DU0ybBc_.cjs");function Ue(je){const{data:v,xDomain:R,mapData:f,xColorLegendTitle:M,yDomain:T,yColorLegendTitle:z,width:u,height:s,colors:Y,scale:J,centerPoint:$,mapBorderWidth:W,mapNoDataColor:q,mapBorderColor:ne,tooltip:se,onSeriesMouseOver:le,zoomScaleExtend:ce,zoomTranslateExtend:ve,highlightedIds:A,onSeriesMouseClick:b,mapProperty:B,resetSelectionOnDoubleClick:E,detailsOnClick:S,showColorScale:de,styles:be,classNames:Ee,mapProjection:F,zoomInteraction:O,animate:k,dimmedOpacity:V,customLayers:me}=je,[ue,K]=d.useState(!(u<680)),[H,G]=d.useState(void 0),[h,Z]=d.useState(void 0),[U,Q]=d.useState(void 0),[pe,w]=d.useState(void 0),[C,ee]=d.useState(void 0),I=d.useRef(null),X=Ae.useInView(I,{once:k.once,amount:k.amount}),xe=d.useRef(null),te=d.useRef(null);d.useEffect(()=>{const e=we.select(xe.current),n=we.select(I.current),r=o=>{if(O==="noZoom")return!1;if(O==="button")return!o.type.includes("wheel");const i=o.type==="wheel",m=o.type.startsWith("touch"),l=o.type==="mousedown"||o.type==="mousemove";return m?!0:i?O==="scroll"?!0:o.ctrlKey:l&&!o.button&&!o.ctrlKey},a=D.zoom().scaleExtent(ce).translateExtent(ve||[[-20,-20],[u+20,s+20]]).filter(r).on("zoom",({transform:o})=>{e.attr("transform",o)});n.call(a),te.current=a},[s,u,O]);const p=D.turf_bbox_default(f),g=D.turf_centroid_default(f),he=p[2]-p[0],re=p[3]-p[1],ge=u*190/960*360/he,P=s*190/678*180/re,L=J*Math.min(ge,P),c=F==="mercator"?D.geoMercator().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(L):F==="equalEarth"?D.geoEqualEarth().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(L):F==="naturalEarth"?D.geoNaturalEarth1().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(L):F==="orthographic"?D.geoOrthographic().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(L):D.geoAlbersUsa().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(L),oe=Array.from({length:R.length},(e,n)=>n),ae=Array.from({length:T.length},(e,n)=>n),_=Me.threshold().domain(R).range(oe),ye=Me.threshold().domain(T).range(ae),N=e=>{if(!I.current||!te.current)return;we.select(I.current).call(te.current.scaleBy,e==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(ie.motion.svg,{viewBox:`0 0 ${u} ${s}`,width:`${u}px`,height:`${s}px`,ref:I,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:xe,children:[me.filter(e=>e.position==="before").map(e=>e.layer),f.features.map((e,n)=>v.findIndex(a=>a.id===e.properties[B])!==-1?null:t.jsxRuntimeExports.jsx(ie.motion.g,{opacity:H?V:A.length!==0?A.indexOf(e.properties[B])!==-1?1:V:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((a,o)=>{let i="";return a.forEach(m=>{let l=" M";m.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==m.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),i+=l}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:W,fill:q}},o)}):e.geometry.coordinates.map((a,o)=>{let i="M";return a.forEach((m,l)=>{const x=c([m[0],m[1]]);l!==a.length-1?i=`${i}${x[0]} ${x[1]}L`:i=`${i}${x[0]} ${x[1]}`}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:W,fill:q}},o)})},n)),t.jsxRuntimeExports.jsx(Be.AnimatePresence,{children:v.map(e=>{const n=f.features.findIndex(i=>e.id===i.properties[B]),r=De.checkIfNullOrUndefined(e.x)?void 0:_(e.x),a=De.checkIfNullOrUndefined(e.y)?void 0:ye(e.y),o=r!==void 0&&a!==void 0?Y[a][r]:q;return t.jsxRuntimeExports.jsx(ie.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:H?H===o?1:V:A.length!==0?A.indexOf(e.id)!==-1?1:V:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:i=>{Q(e),ee(i.clientY),w(i.clientX),le?.(e)},onClick:()=>{(b||S)&&(Le.isEqual(h,e)&&E?(Z(void 0),b?.(void 0)):(Z(e),b?.(e)))},onMouseMove:i=>{Q(e),ee(i.clientY),w(i.clientX)},onMouseLeave:()=>{Q(void 0),w(void 0),ee(void 0),le?.(void 0)},children:n===-1?null:f.features[n].geometry.type==="MultiPolygon"?f.features[n].geometry.coordinates.map((i,m)=>{let l="";return i.forEach(x=>{let y=" M";x.forEach((j,Oe)=>{const fe=c([j[0],j[1]]);Oe!==x.length-1?y=`${y}${fe[0]} ${fe[1]}L`:y=`${y}${fe[0]} ${fe[1]}`}),l+=y}),t.jsxRuntimeExports.jsx(ie.motion.path,{variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},d:l,className:`${o===q?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)}):f.features[n].geometry.coordinates.map((i,m)=>{let l="M";return i.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==i.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),t.jsxRuntimeExports.jsx(ie.motion.path,{d:l,variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:X?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},className:`${o===q?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)})},e.id)})}),U?f.features.filter(e=>e.properties[B]===U.id).map((e,n)=>t.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((r,a)=>{let o="";return r.forEach(i=>{let m=" M";i.forEach((l,x)=>{const y=c([l[0],l[1]]);x!==i.length-1?m=`${m}${y[0]} ${y[1]}L`:m=`${m}${y[0]} ${y[1]}`}),o+=m}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)}):e.geometry.coordinates.map((r,a)=>{let o="M";return r.forEach((i,m)=>{const l=c([i[0],i[1]]);m!==r.length-1?o=`${o}${l[0]} ${l[1]}L`:o=`${o}${l[0]} ${l[1]}`}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)})},n)):null,me.filter(e=>e.position==="after").map(e=>e.layer)]})}),de===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:ue?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{K(!1)},children:t.jsxRuntimeExports.jsx($e.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:"175px"},children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:t.jsxRuntimeExports.jsxs("g",{children:[Y.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-n*25})`,children:e.map((r,a)=>t.jsxRuntimeExports.jsx("rect",{y:1,x:a*25+1,fill:r,width:23,height:23,strokeWidth:H===r?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{G(r)},onMouseLeave:()=>{G(void 0)}},a))},n)),t.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:R.map((e,n)=>t.jsxRuntimeExports.jsx("text",{y:10,x:(n+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")},n))}),T.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(R.length+1,5),4)*25+10},${100-n*25})`,children:t.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")})},n))]})}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:z})]}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:M})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{K(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),O==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>N("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>N("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),U&&se&&pe&&C?t.jsxRuntimeExports.jsx(ze.Tooltip,{data:U,body:se,xPos:pe,yPos:C,backgroundStyle:be?.tooltip,className:Ee?.tooltip}):null,S&&h!==void 0?t.jsxRuntimeExports.jsx(Te.X,{open:h!==void 0,onClose:()=>{Z(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:We.string2HTML(S,h)}:void 0,children:typeof S=="function"?S(h):null})}):null]})}function Xe(je){const{data:v,graphTitle:R,mapData:f="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:M=Re.Colors.light.bivariateColors.colors05x05,sources:T,graphDescription:z,height:u,width:s,footNote:Y="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.",xDomain:J,yDomain:$,xColorLegendTitle:W="X Color key",yColorLegendTitle:q="Y Color key",tooltip:ne,scale:se=.95,centerPoint:le,padding:ce,mapBorderWidth:ve=.5,mapNoDataColor:A=Re.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:B=Re.Colors.light.grays["gray-500"],relativeHeight:E,onSeriesMouseOver:S,isWorldMap:de=!0,zoomScaleExtend:be=[.8,6],zoomTranslateExtend:Ee,graphID:F,showColorScale:O=!0,highlightedIds:k=[],onSeriesMouseClick:V,mapProperty:me="ISO3",graphDownload:ue=!1,dataDownload:K=!1,showAntarctica:H=!1,language:G="en",minHeight:h=0,theme:Z="light",ariaLabel:U,resetSelectionOnDoubleClick:Q=!0,detailsOnClick:pe,styles:w,classNames:C,mapProjection:ee,zoomInteraction:I="button",animate:X=!1,dimmedOpacity:xe=.3,customLayers:te=[],timeline:p={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=je,[g,he]=d.useState(0),[re,ge]=d.useState(0),[P,L]=d.useState(p.autoplay),c=ke.sort(Pe.uniqBy(v.filter(r=>r.date!==void 0&&r.date!==null),r=>r.date).map(r=>Ce.parse(`${r.date}`,p.dateFormat||"yyyy",new Date).getTime()),(r,a)=>Ge.ascending(r,a)),[oe,ae]=d.useState(p.autoplay?0:c.length-1),[_,ye]=d.useState(void 0),N=d.useRef(null),e=d.useRef(null);d.useEffect(()=>{const r=new ResizeObserver(a=>{he(s||a[0].contentRect.width||760),ge(u||a[0].target.clientHeight||480)});return N.current&&(ge(N.current.clientHeight||480),he(N.current.clientWidth||760),s||r.observe(N.current)),()=>r.disconnect()},[s,u]),d.useEffect(()=>{typeof f=="string"?He.fetchAndParseJSON(f).then(a=>{ye(a)}):ye(f)},[f]),d.useEffect(()=>{const r=setInterval(()=>{ae(a=>a<c.length-1?a+1:0)},(p.speed||2)*1e3);return P||clearInterval(r),()=>clearInterval(r)},[c,P,p.speed]);const n=ke.getSliderMarks(c,oe,p.showOnlyActiveDate,p.dateFormat||"yyyy");return J&&$&&(J.length!==M[0].length-1||$.length!==M.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):t.jsxRuntimeExports.jsx("div",{className:`${Z||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:G==="he"||G==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${G||"en"}`,s?"w-fit":"w-full",C?.graphContainer),style:{...w?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:F,ref:e,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${z?` ${z}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?ce||"1rem":ce||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||z||ue||K?t.jsxRuntimeExports.jsx(Fe.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:C?.title,description:C?.description},graphTitle:R,graphDescription:z,width:s,graphDownload:ue?e.current:void 0,dataDownload:K?v.map(r=>r.data).filter(r=>r!==void 0).length>0?v.map(r=>r.data).filter(r=>r!==void 0):v.filter(r=>r!==void 0):null}):null,p.enabled&&c.length>0&&n?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{L(!P)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":P?"Click to pause animation":"Click to play animation",children:P?t.jsxRuntimeExports.jsx($e.Pause,{}):t.jsxRuntimeExports.jsx($e.Play,{})}),t.jsxRuntimeExports.jsx(ke.xr,{min:c[0],max:c[c.length-1],marks:n,step:null,defaultValue:c[c.length-1],value:c[oe],onChangeComplete:r=>{ae(c.indexOf(r))},onChange:r=>{ae(c.indexOf(r))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:N,"aria-label":"Map area",children:(s||g)&&(u||re)&&_?t.jsxRuntimeExports.jsx(Ue,{data:v.filter(r=>p.enabled?r.date===Ce.format(new Date(c[oe]),p.dateFormat||"yyyy"):r),mapData:H?_:{..._,features:_.features.filter(r=>r.properties.NAME!=="Antarctica")},xDomain:J||qe.getJenks(v.map(r=>r.x),M[0].length),yDomain:$||qe.getJenks(v.map(r=>r.y),M.length),width:s||g,height:Math.max(h,u||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re)),scale:se,centerPoint:le,colors:M,xColorLegendTitle:W,yColorLegendTitle:q,mapBorderWidth:ve,mapNoDataColor:A,mapBorderColor:B,tooltip:ne,onSeriesMouseOver:S,isWorldMap:de,zoomScaleExtend:be,zoomTranslateExtend:Ee,onSeriesMouseClick:V,mapProperty:me,highlightedIds:k,resetSelectionOnDoubleClick:Q,styles:w,showColorScale:O,classNames:C,mapProjection:ee||(de?"naturalEarth":"mercator"),detailsOnClick:pe,zoomInteraction:I,animate:X===!0?{duration:.5,once:!0,amount:.5}:X||{duration:0,once:!0,amount:0},dimmedOpacity:xe,customLayers:te}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,u||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ie.y,{"aria-label":"Loading graph"})})}),T||Y?t.jsxRuntimeExports.jsx(Ve.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:T,footNote:Y,width:s}):null]})})})})}exports.BiVariateChoroplethMap=Xe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),ke=require("./getSliderMarks-CtsEXiLV.cjs"),Ie=require("./Spinner-DA6Z5E4n.cjs"),Ce=require("./parse-hMnG_lRV.cjs"),Pe=require("./index-BJOeaYTk.cjs"),Le=require("./index-DQA8q5sC.cjs"),L=require("./zoom-Bsbhil-K.cjs"),Te=require("./index-D05lK1Te.cjs"),ze=require("./Modal-tXZlLE5s.cjs"),Se=require("./Typography-k-kOjICQ.cjs"),Ne=require("./numberFormattingFunction-02t-wJta.cjs"),We=require("./Tooltip-De16GWhY.cjs"),Ae=require("./string2HTML-z7CwHXcx.cjs"),De=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),$e=require("./index-BW_-wD2k.cjs"),we=require("./select-Bnfk0lJx.cjs"),Me=require("./threshold-DNsSUf8Q.cjs"),Be=require("./use-in-view-sQJZ_xDO.cjs"),ie=require("./proxy-BHRoeZgd.cjs"),Fe=require("./index-BW8iNx7E.cjs"),Ve=require("./GraphHeader.cjs"),He=require("./GraphFooter.cjs"),Re=require("./Colors.cjs"),_e=require("./fetchAndParseData-Dcy7AS_0.cjs"),qe=require("./getJenks-vofIZmeb.cjs"),Ge=require("./init-DU0ybBc_.cjs");function Ue(je){const{data:v,xDomain:R,mapData:f,xColorLegendTitle:D,yDomain:T,yColorLegendTitle:z,width:u,height:s,colors:Y,scale:J,centerPoint:$,mapBorderWidth:W,mapNoDataColor:M,mapBorderColor:ne,tooltip:se,onSeriesMouseOver:le,zoomScaleExtend:ce,zoomTranslateExtend:ve,highlightedIds:A,onSeriesMouseClick:b,mapProperty:B,resetSelectionOnDoubleClick:E,detailsOnClick:S,showColorScale:de,styles:be,classNames:Ee,mapProjection:F,zoomInteraction:q,animate:k,dimmedOpacity:V,customLayers:me}=je,[ue,K]=d.useState(!(u<680)),[H,_]=d.useState(void 0),[h,Z]=d.useState(void 0),[G,Q]=d.useState(void 0),[pe,w]=d.useState(void 0),[C,ee]=d.useState(void 0),O=d.useRef(null),U=Be.useInView(O,{once:k.once,amount:k.amount}),xe=d.useRef(null),te=d.useRef(null);d.useEffect(()=>{const e=we.select(xe.current),n=we.select(O.current),r=o=>{if(q==="noZoom")return!1;if(q==="button")return!o.type.includes("wheel");const i=o.type==="wheel",m=o.type.startsWith("touch"),l=o.type==="mousedown"||o.type==="mousemove";return m?!0:i?q==="scroll"?!0:o.ctrlKey:l&&!o.button&&!o.ctrlKey},a=L.zoom().scaleExtent(ce).translateExtent(ve||[[-20,-20],[u+20,s+20]]).filter(r).on("zoom",({transform:o})=>{e.attr("transform",o)});n.call(a),te.current=a},[s,u,q]);const p=L.turf_bbox_default(f),g=Te.turf_center_of_mass_default(f),he=p[2]-p[0],re=p[3]-p[1],ge=u*190/960*360/he,I=s*190/678*180/re,P=J*Math.min(ge,I),c=F==="mercator"?L.geoMercator().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):F==="equalEarth"?L.geoEqualEarth().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):F==="naturalEarth"?L.geoNaturalEarth1().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):F==="orthographic"?L.geoOrthographic().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P):L.geoAlbersUsa().rotate([0,0]).center($||g.geometry.coordinates).translate([u/2,s/2]).scale(P),oe=Array.from({length:R.length},(e,n)=>n),ae=Array.from({length:T.length},(e,n)=>n),X=Me.threshold().domain(R).range(oe),ye=Me.threshold().domain(T).range(ae),N=e=>{if(!O.current||!te.current)return;we.select(O.current).call(te.current.scaleBy,e==="in"?1.2:1/1.2)};return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsxs("div",{className:"relative",children:[t.jsxRuntimeExports.jsx(ie.motion.svg,{viewBox:`0 0 ${u} ${s}`,width:`${u}px`,height:`${s}px`,ref:O,direction:"ltr",children:t.jsxRuntimeExports.jsxs("g",{ref:xe,children:[me.filter(e=>e.position==="before").map(e=>e.layer),f.features.map((e,n)=>v.findIndex(a=>a.id===e.properties[B])!==-1?null:t.jsxRuntimeExports.jsx(ie.motion.g,{opacity:H?V:A.length!==0?A.indexOf(e.properties[B])!==-1?1:V:1,children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((a,o)=>{let i="";return a.forEach(m=>{let l=" M";m.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==m.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),i+=l}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:W,fill:M}},o)}):e.geometry.coordinates.map((a,o)=>{let i="M";return a.forEach((m,l)=>{const x=c([m[0],m[1]]);l!==a.length-1?i=`${i}${x[0]} ${x[1]}L`:i=`${i}${x[0]} ${x[1]}`}),t.jsxRuntimeExports.jsx("path",{d:i,style:{stroke:ne,strokeWidth:W,fill:M}},o)})},n)),t.jsxRuntimeExports.jsx(Fe.AnimatePresence,{children:v.map(e=>{const n=f.features.findIndex(i=>e.id===i.properties[B]),r=De.checkIfNullOrUndefined(e.x)?void 0:X(e.x),a=De.checkIfNullOrUndefined(e.y)?void 0:ye(e.y),o=r!==void 0&&a!==void 0?Y[a][r]:M;return t.jsxRuntimeExports.jsx(ie.motion.g,{variants:{initial:{opacity:0},whileInView:{opacity:H?H===o?1:V:A.length!==0?A.indexOf(e.id)!==-1?1:V:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},onMouseEnter:i=>{Q(e),ee(i.clientY),w(i.clientX),le?.(e)},onClick:()=>{(b||S)&&(Le.isEqual(h,e)&&E?(Z(void 0),b?.(void 0)):(Z(e),b?.(e)))},onMouseMove:i=>{Q(e),ee(i.clientY),w(i.clientX)},onMouseLeave:()=>{Q(void 0),w(void 0),ee(void 0),le?.(void 0)},children:n===-1?null:f.features[n].geometry.type==="MultiPolygon"?f.features[n].geometry.coordinates.map((i,m)=>{let l="";return i.forEach(x=>{let y=" M";x.forEach((j,Oe)=>{const fe=c([j[0],j[1]]);Oe!==x.length-1?y=`${y}${fe[0]} ${fe[1]}L`:y=`${y}${fe[0]} ${fe[1]}`}),l+=y}),t.jsxRuntimeExports.jsx(ie.motion.path,{variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},d:l,className:`${o===M?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)}):f.features[n].geometry.coordinates.map((i,m)=>{let l="M";return i.forEach((x,y)=>{const j=c([x[0],x[1]]);y!==i.length-1?l=`${l}${j[0]} ${j[1]}L`:l=`${l}${j[0]} ${j[1]}`}),t.jsxRuntimeExports.jsx(ie.motion.path,{d:l,variants:{initial:{fill:o,opacity:0},whileInView:{fill:o,opacity:1,transition:{duration:k.duration}}},initial:"initial",animate:U?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},className:`${o===M?"stroke-primary-gray-400 dark:stroke-primary-gray-500":"stroke-primary-white dark:stroke-primary-gray-650"}`,style:{strokeWidth:W}},`${e.id}-${m}`)})},e.id)})}),G?f.features.filter(e=>e.properties[B]===G.id).map((e,n)=>t.jsxRuntimeExports.jsx("g",{children:e.geometry.type==="MultiPolygon"?e.geometry.coordinates.map((r,a)=>{let o="";return r.forEach(i=>{let m=" M";i.forEach((l,x)=>{const y=c([l[0],l[1]]);x!==i.length-1?m=`${m}${y[0]} ${y[1]}L`:m=`${m}${y[0]} ${y[1]}`}),o+=m}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)}):e.geometry.coordinates.map((r,a)=>{let o="M";return r.forEach((i,m)=>{const l=c([i[0],i[1]]);m!==r.length-1?o=`${o}${l[0]} ${l[1]}L`:o=`${o}${l[0]} ${l[1]}`}),t.jsxRuntimeExports.jsx("path",{d:o,className:"stroke-primary-gray-700 dark:stroke-primary-gray-300",style:{fill:"none",fillOpacity:0,strokeWidth:"0.5"}},a)})},n)):null,me.filter(e=>e.position==="after").map(e=>e.layer)]})}),de===!1?null:t.jsxRuntimeExports.jsx("div",{className:"absolute left-4 bottom-4",children:ue?t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx("div",{style:{backgroundColor:"rgba(240,240,240, 0.7)",border:"1px solid var(--gray-400)",borderRadius:"999px",width:"24px",height:"24px",padding:"3px",cursor:"pointer",zIndex:10,position:"absolute",right:"-0.75rem",top:"-0.75rem"},onClick:()=>{K(!1)},children:t.jsxRuntimeExports.jsx($e.X,{})}),t.jsxRuntimeExports.jsxs("div",{className:"p-2",style:{backgroundColor:"rgba(240,240,240, 0.7)",width:"175px"},children:[t.jsxRuntimeExports.jsxs("div",{className:"flex gap-1 items-center",children:[t.jsxRuntimeExports.jsx("svg",{width:"136px",viewBox:"0 0 136 136",className:"shrink-0",children:t.jsxRuntimeExports.jsxs("g",{children:[Y.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(0,${100-n*25})`,children:e.map((r,a)=>t.jsxRuntimeExports.jsx("rect",{y:1,x:a*25+1,fill:r,width:23,height:23,strokeWidth:H===r?2:.25,style:{cursor:"pointer"},onMouseOver:()=>{_(r)},onMouseLeave:()=>{_(void 0)}},a))},n)),t.jsxRuntimeExports.jsx("g",{transform:"translate(0,125)",children:R.map((e,n)=>t.jsxRuntimeExports.jsx("text",{y:10,x:(n+1)*25,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")},n))}),T.map((e,n)=>t.jsxRuntimeExports.jsx("g",{transform:`translate(${Math.max(Math.min(R.length+1,5),4)*25+10},${100-n*25})`,children:t.jsxRuntimeExports.jsx("text",{x:0,transform:"rotate(-90)",y:0,fontSize:10,textAnchor:"middle",children:typeof e=="string"||e<1?e:Ne.numberFormattingFunction(e,"NA")})},n))]})}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"leading-normal text-center shrink-0",style:{display:"-webkit-box",WebkitLineClamp:"1",WebkitBoxOrient:"vertical",overflow:"hidden",writingMode:"vertical-rl",height:"8.5rem",transform:"rotate(180deg)"},children:z})]}),t.jsxRuntimeExports.jsx(Se.u,{marginBottom:"none",size:"xs",className:"mt-1 leading-normal text-center",style:{display:"-webkit-box",WebkitLineClamp:"1",width:"8.5rem",WebkitBoxOrient:"vertical",overflow:"hidden"},children:D})]})]}):t.jsxRuntimeExports.jsx("button",{type:"button",className:"mb-0 border-0 bg-transparent p-0 self-start",onClick:()=>{K(!0)},children:t.jsxRuntimeExports.jsx("div",{className:"items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500",children:"Show Legend"})})}),q==="button"&&t.jsxRuntimeExports.jsxs("div",{className:"absolute left-4 top-4 flex flex-col",children:[t.jsxRuntimeExports.jsx("button",{onClick:()=>N("in"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"+"}),t.jsxRuntimeExports.jsx("button",{onClick:()=>N("out"),className:"leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100",children:"–"})]})]}),G&&se&&pe&&C?t.jsxRuntimeExports.jsx(We.Tooltip,{data:G,body:se,xPos:pe,yPos:C,backgroundStyle:be?.tooltip,className:Ee?.tooltip}):null,S&&h!==void 0?t.jsxRuntimeExports.jsx(ze.X,{open:h!==void 0,onClose:()=>{Z(void 0)},children:t.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof S=="string"?{__html:Ae.string2HTML(S,h)}:void 0,children:typeof S=="function"?S(h):null})}):null]})}function Xe(je){const{data:v,graphTitle:R,mapData:f="https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json",colors:D=Re.Colors.light.bivariateColors.colors05x05,sources:T,graphDescription:z,height:u,width:s,footNote:Y="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.",xDomain:J,yDomain:$,xColorLegendTitle:W="X Color key",yColorLegendTitle:M="Y Color key",tooltip:ne,scale:se=.95,centerPoint:le,padding:ce,mapBorderWidth:ve=.5,mapNoDataColor:A=Re.Colors.light.graphNoData,backgroundColor:b=!1,mapBorderColor:B=Re.Colors.light.grays["gray-500"],relativeHeight:E,onSeriesMouseOver:S,isWorldMap:de=!0,zoomScaleExtend:be=[.8,6],zoomTranslateExtend:Ee,graphID:F,showColorScale:q=!0,highlightedIds:k=[],onSeriesMouseClick:V,mapProperty:me="ISO3",graphDownload:ue=!1,dataDownload:K=!1,showAntarctica:H=!1,language:_="en",minHeight:h=0,theme:Z="light",ariaLabel:G,resetSelectionOnDoubleClick:Q=!0,detailsOnClick:pe,styles:w,classNames:C,mapProjection:ee,zoomInteraction:O="button",animate:U=!1,dimmedOpacity:xe=.3,customLayers:te=[],timeline:p={enabled:!1,autoplay:!1,showOnlyActiveDate:!0}}=je,[g,he]=d.useState(0),[re,ge]=d.useState(0),[I,P]=d.useState(p.autoplay),c=ke.sort(Pe.uniqBy(v.filter(r=>r.date!==void 0&&r.date!==null),r=>r.date).map(r=>Ce.parse(`${r.date}`,p.dateFormat||"yyyy",new Date).getTime()),(r,a)=>Ge.ascending(r,a)),[oe,ae]=d.useState(p.autoplay?0:c.length-1),[X,ye]=d.useState(void 0),N=d.useRef(null),e=d.useRef(null);d.useEffect(()=>{const r=new ResizeObserver(a=>{he(s||a[0].contentRect.width||760),ge(u||a[0].target.clientHeight||480)});return N.current&&(ge(N.current.clientHeight||480),he(N.current.clientWidth||760),s||r.observe(N.current)),()=>r.disconnect()},[s,u]),d.useEffect(()=>{typeof f=="string"?_e.fetchAndParseJSON(f).then(a=>{ye(a)}):ye(f)},[f]),d.useEffect(()=>{const r=setInterval(()=>{ae(a=>a<c.length-1?a+1:0)},(p.speed||2)*1e3);return I||clearInterval(r),()=>clearInterval(r)},[c,I,p.speed]);const n=ke.getSliderMarks(c,oe,p.showOnlyActiveDate,p.dateFormat||"yyyy");return J&&$&&(J.length!==D[0].length-1||$.length!==D.length-1)?(console.error("the xDomain and yDomain array length don't match to the color array length"),null):t.jsxRuntimeExports.jsx("div",{className:`${Z||"light"} flex ${s?"w-fit grow-0":"w-full grow"}`,dir:_==="he"||_==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${b?b===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${_||"en"}`,s?"w-fit":"w-full",C?.graphContainer),style:{...w?.graphContainer||{},...b&&b!==!0?{backgroundColor:b}:{}},id:F,ref:e,"aria-label":G||`${R?`The graph shows ${R}. `:""}This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${z?` ${z}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:b?ce||"1rem":ce||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||z||ue||K?t.jsxRuntimeExports.jsx(Ve.GraphHeader,{styles:{title:w?.title,description:w?.description},classNames:{title:C?.title,description:C?.description},graphTitle:R,graphDescription:z,width:s,graphDownload:ue?e.current:void 0,dataDownload:K?v.map(r=>r.data).filter(r=>r!==void 0).length>0?v.map(r=>r.data).filter(r=>r!==void 0):v.filter(r=>r!==void 0):null}):null,p.enabled&&c.length>0&&n?t.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[t.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{P(!I)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":I?"Click to pause animation":"Click to play animation",children:I?t.jsxRuntimeExports.jsx($e.Pause,{}):t.jsxRuntimeExports.jsx($e.Play,{})}),t.jsxRuntimeExports.jsx(ke.xr,{min:c[0],max:c[c.length-1],marks:n,step:null,defaultValue:c[c.length-1],value:c[oe],onChangeComplete:r=>{ae(c.indexOf(r))},onChange:r=>{ae(c.indexOf(r))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,t.jsxRuntimeExports.jsx("div",{className:"flex flex-col grow justify-center leading-0",ref:N,"aria-label":"Map area",children:(s||g)&&(u||re)&&X?t.jsxRuntimeExports.jsx(Ue,{data:v.filter(r=>p.enabled?r.date===Ce.format(new Date(c[oe]),p.dateFormat||"yyyy"):r),mapData:H?X:{...X,features:X.features.filter(r=>r.properties.NAME!=="Antarctica")},xDomain:J||qe.getJenks(v.map(r=>r.x),D[0].length),yDomain:$||qe.getJenks(v.map(r=>r.y),D.length),width:s||g,height:Math.max(h,u||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re)),scale:se,centerPoint:le,colors:D,xColorLegendTitle:W,yColorLegendTitle:M,mapBorderWidth:ve,mapNoDataColor:A,mapBorderColor:B,tooltip:ne,onSeriesMouseOver:S,isWorldMap:de,zoomScaleExtend:be,zoomTranslateExtend:Ee,onSeriesMouseClick:V,mapProperty:me,highlightedIds:k,resetSelectionOnDoubleClick:Q,styles:w,showColorScale:q,classNames:C,mapProjection:ee||(de?"naturalEarth":"mercator"),detailsOnClick:pe,zoomInteraction:O,animate:U===!0?{duration:.5,once:!0,amount:.5}:U||{duration:0,once:!0,amount:0},dimmedOpacity:xe,customLayers:te}):t.jsxRuntimeExports.jsx("div",{style:{height:`${Math.max(h,u||(E?h?(s||g)*E>h?(s||g)*E:h:(s||g)*E:re))}px`},className:"flex items-center justify-center",children:t.jsxRuntimeExports.jsx(Ie.y,{"aria-label":"Loading graph"})})}),T||Y?t.jsxRuntimeExports.jsx(He.GraphFooter,{styles:{footnote:w?.footnote,source:w?.source},classNames:{footnote:C?.footnote,source:C?.source},sources:T,footNote:Y,width:s}):null]})})})})}exports.BiVariateChoroplethMap=Xe;
2
2
  //# sourceMappingURL=BiVariateChoroplethMap.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BiVariateChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centroid from '@turf/centroid';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centroid(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </motion.g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{ backgroundColor: 'rgba(240,240,240, 0.7)', width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { ascending, sort } from 'd3-array';\r\nimport uniqBy from 'lodash.uniqby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\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 /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: 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\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // 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 BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = '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.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(\r\n data.filter(d => d.date !== undefined && d.date !== null),\r\n d => d.date,\r\n ).map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].contentRect.width || 760);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n setMapShape(d);\r\n });\r\n } else {\r\n setMapShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","showLegend","setShowLegend","useState","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","mapG","zoomRef","useEffect","mapGSelect","select","mapSvgSelect","zoomFilter","e","isWheel","isTouch","isDrag","zoomBehavior","zoom","transform","bounds","bbox","center","centroid","lonDiff","latDiff","scaleX","scaleY","scaleVar","projection","geoMercator","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","xRange","_","i","yRange","xScale","scaleThreshold","yScale","handleZoom","direction","jsxs","Fragment","jsx","motion","d","el","j","masterPath","geo","path","c","k","point","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","yColorCoord","color","event","isEqual","X","numberFormattingFunction","P","Tooltip","Modal","string2HTML","BiVariateChoroplethMap","graphTitle","Colors","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","isWorldMap","graphID","graphDownload","dataDownload","showAntarctica","language","minHeight","theme","ariaLabel","timeline","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","resizeObserver","entries","fetchAndParseJSON","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","getJenks","Spinner","GraphFooter"],"mappings":"iiCA4EO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,QAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,MAAAC,EACA,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,eAAAC,GACA,QAAAC,GACA,kBAAAC,GACA,gBAAAC,GACA,oBAAAC,GACA,eAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,eAAAC,GACA,OAAAC,GACA,WAAAC,GACA,cAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,cAAAC,EACA,aAAAC,EAAA,EACE/B,GACE,CAACgC,GAAYC,CAAa,EAAIC,EAAAA,SAAS,EAAE3B,EAAQ,IAAI,EACrD,CAAC4B,EAAeC,CAAgB,EAAIF,EAAAA,SAA6B,MAAS,EAE1E,CAACG,EAAgBC,CAAiB,EAAIJ,EAAAA,SAAc,MAAS,EAE7D,CAACK,EAAeC,CAAgB,EAAIN,EAAAA,SAAc,MAAS,EAC3D,CAACO,GAAQC,CAAS,EAAIR,EAAAA,SAA6B,MAAS,EAC5D,CAACS,EAAQC,EAAS,EAAIV,EAAAA,SAA6B,MAAS,EAC5DW,EAASC,EAAAA,OAAsB,IAAI,EACnCC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMhB,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EACKoB,GAAOH,EAAAA,OAAoB,IAAI,EAC/BI,GAAUJ,EAAAA,OAAoD,IAAI,EAExEK,EAAAA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GAAG,KAAK,IACdwC,EACAzH,IACGkH,EACGO,GACG1H,GAAS8H,GAAYX,EAAiBO,GACpC1H,GAAS8H,GAAYX,EACtBO,GACD1H,GAAS8H,GAAYX,EACxBa,GAAA,CACP,IAAA,EAEH,UAAU,mCAEV,SAAA9C,EAAAA,kBAAAA,IAAC4E,GAAAA,EAAA,CAAQ,aAAW,eAAA,CAAgB,CAAA,CAAA,CACtC,CAAA,EAGHhD,GAAWE,EACV9B,EAAAA,kBAAAA,IAAC6E,GAAAA,YAAA,CACC,OAAQ,CAAE,SAAU7I,GAAQ,SAAU,OAAQA,GAAQ,MAAA,EACtD,WAAY,CACV,SAAUC,GAAY,SACtB,OAAQA,GAAY,MAAA,EAEtB,QAAA2F,EACA,SAAAE,EACA,MAAAhH,CAAA,CAAA,EAEA,IAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CACF,CAAA,CAGN"}
1
+ {"version":3,"file":"BiVariateChoroplethMap.cjs","sources":["../src/Components/Graphs/Maps/BiVariateMap/Graph.tsx","../src/Components/Graphs/Maps/BiVariateMap/index.tsx"],"sourcesContent":["import isEqual from 'fast-deep-equal';\r\nimport bbox from '@turf/bbox';\r\nimport centerOfMass from '@turf/center-of-mass';\r\nimport { useEffect, useRef, useState } from 'react';\r\nimport {\r\n geoAlbersUsa,\r\n geoEqualEarth,\r\n geoMercator,\r\n geoNaturalEarth1,\r\n geoOrthographic,\r\n} from 'd3-geo';\r\nimport { D3ZoomEvent, zoom, ZoomBehavior } from 'd3-zoom';\r\nimport { select } from 'd3-selection';\r\nimport { scaleThreshold } from 'd3-scale';\r\nimport { Modal } from '@undp/design-system-react/Modal';\r\nimport { P } from '@undp/design-system-react/Typography';\r\nimport { AnimatePresence, motion, useInView } from 'motion/react';\r\n\r\nimport {\r\n AnimateDataType,\r\n BivariateMapDataType,\r\n ClassNameObject,\r\n CustomLayerDataType,\r\n MapProjectionTypes,\r\n StyleObject,\r\n ZoomInteractionTypes,\r\n} from '@/Types';\r\nimport { numberFormattingFunction } from '@/Utils/numberFormattingFunction';\r\nimport { Tooltip } from '@/Components/Elements/Tooltip';\r\nimport { string2HTML } from '@/Utils/string2HTML';\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\nimport { X } from '@/Components/Icons';\r\n\r\ninterface Props {\r\n data: BivariateMapDataType[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData: any;\r\n xDomain: number[];\r\n yDomain: number[];\r\n width: number;\r\n height: number;\r\n colors: string[][];\r\n xColorLegendTitle: string;\r\n yColorLegendTitle: string;\r\n mapBorderWidth: number;\r\n mapNoDataColor: string;\r\n scale: number;\r\n centerPoint?: [number, number];\r\n mapBorderColor: string;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n tooltip?: string | ((_d: any) => React.ReactNode);\r\n zoomInteraction: ZoomInteractionTypes;\r\n mapProjection: MapProjectionTypes;\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseOver?: (_d: any) => void;\r\n isWorldMap: boolean;\r\n zoomScaleExtend: [number, number];\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n highlightedIds: string[];\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n onSeriesMouseClick?: (_d: any) => void;\r\n mapProperty: string;\r\n resetSelectionOnDoubleClick: boolean;\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n detailsOnClick?: string | ((_d: any) => React.ReactNode);\r\n showColorScale: boolean;\r\n styles?: StyleObject;\r\n classNames?: ClassNameObject;\r\n animate: AnimateDataType;\r\n dimmedOpacity: number;\r\n customLayers: CustomLayerDataType[];\r\n}\r\n\r\nexport function Graph(props: Props) {\r\n const {\r\n data,\r\n xDomain,\r\n mapData,\r\n xColorLegendTitle,\r\n yDomain,\r\n yColorLegendTitle,\r\n width,\r\n height,\r\n colors,\r\n scale,\r\n centerPoint,\r\n mapBorderWidth,\r\n mapNoDataColor,\r\n mapBorderColor,\r\n tooltip,\r\n onSeriesMouseOver,\r\n zoomScaleExtend,\r\n zoomTranslateExtend,\r\n highlightedIds,\r\n onSeriesMouseClick,\r\n mapProperty,\r\n resetSelectionOnDoubleClick,\r\n detailsOnClick,\r\n showColorScale,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction,\r\n animate,\r\n dimmedOpacity,\r\n customLayers,\r\n } = props;\r\n const [showLegend, setShowLegend] = useState(!(width < 680));\r\n const [selectedColor, setSelectedColor] = useState<string | undefined>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseClickData, setMouseClickData] = useState<any>(undefined);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mouseOverData, setMouseOverData] = useState<any>(undefined);\r\n const [eventX, setEventX] = useState<number | undefined>(undefined);\r\n const [eventY, setEventY] = useState<number | undefined>(undefined);\r\n const mapSvg = useRef<SVGSVGElement>(null);\r\n const isInView = useInView(mapSvg, {\r\n once: animate.once,\r\n amount: animate.amount,\r\n });\r\n const mapG = useRef<SVGGElement>(null);\r\n const zoomRef = useRef<ZoomBehavior<SVGSVGElement, unknown> | null>(null);\r\n\r\n useEffect(() => {\r\n const mapGSelect = select(mapG.current);\r\n const mapSvgSelect = select(mapSvg.current);\r\n const zoomFilter = (e: D3ZoomEvent<SVGSVGElement, unknown>['sourceEvent']) => {\r\n if (zoomInteraction === 'noZoom') return false;\r\n if (zoomInteraction === 'button') return !e.type.includes('wheel');\r\n const isWheel = e.type === 'wheel';\r\n const isTouch = e.type.startsWith('touch');\r\n const isDrag = e.type === 'mousedown' || e.type === 'mousemove';\r\n\r\n if (isTouch) return true;\r\n if (isWheel) {\r\n if (zoomInteraction === 'scroll') return true;\r\n return e.ctrlKey;\r\n }\r\n return isDrag && !e.button && !e.ctrlKey;\r\n };\r\n const zoomBehavior = zoom<SVGSVGElement, unknown>()\r\n .scaleExtent(zoomScaleExtend)\r\n .translateExtent(\r\n zoomTranslateExtend || [\r\n [-20, -20],\r\n [width + 20, height + 20],\r\n ],\r\n )\r\n .filter(zoomFilter)\r\n .on('zoom', ({ transform }) => {\r\n mapGSelect.attr('transform', transform);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapSvgSelect.call(zoomBehavior as any);\r\n\r\n zoomRef.current = zoomBehavior;\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n }, [height, width, zoomInteraction]);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const bounds = bbox(mapData as any);\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const center = centerOfMass(mapData as any);\r\n const lonDiff = bounds[2] - bounds[0];\r\n const latDiff = bounds[3] - bounds[1];\r\n const scaleX = (((width * 190) / 960) * 360) / lonDiff;\r\n const scaleY = (((height * 190) / 678) * 180) / latDiff;\r\n const scaleVar = scale * Math.min(scaleX, scaleY);\r\n\r\n const projection =\r\n mapProjection === 'mercator'\r\n ? geoMercator()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'equalEarth'\r\n ? geoEqualEarth()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'naturalEarth'\r\n ? geoNaturalEarth1()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : mapProjection === 'orthographic'\r\n ? geoOrthographic()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar)\r\n : geoAlbersUsa()\r\n .rotate([0, 0])\r\n .center(centerPoint || (center.geometry.coordinates as [number, number]))\r\n .translate([width / 2, height / 2])\r\n .scale(scaleVar);\r\n\r\n const xRange = Array.from({ length: xDomain.length }, (_, i) => i);\r\n\r\n const yRange = Array.from({ length: yDomain.length }, (_, i) => i);\r\n const xScale = scaleThreshold<number, number>().domain(xDomain).range(xRange);\r\n const yScale = scaleThreshold<number, number>().domain(yDomain).range(yRange);\r\n\r\n const handleZoom = (direction: 'in' | 'out') => {\r\n if (!mapSvg.current || !zoomRef.current) return;\r\n const svg = select(mapSvg.current);\r\n svg.call(zoomRef.current.scaleBy, direction === 'in' ? 1.2 : 1 / 1.2);\r\n };\r\n\r\n return (\r\n <>\r\n <div className='relative'>\r\n <motion.svg\r\n viewBox={`0 0 ${width} ${height}`}\r\n width={`${width}px`}\r\n height={`${height}px`}\r\n ref={mapSvg}\r\n direction='ltr'\r\n >\r\n <g ref={mapG}>\r\n {customLayers.filter(d => d.position === 'before').map(d => d.layer)}\r\n {\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData.features.map((d: any, i: number) => {\r\n const index = data.findIndex(el => el.id === d.properties[mapProperty]);\r\n if (index !== -1) return null;\r\n return (\r\n <motion.g\r\n key={i}\r\n opacity={\r\n selectedColor\r\n ? dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.properties[mapProperty]) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1\r\n }\r\n >\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n style={{\r\n stroke: mapBorderColor,\r\n strokeWidth: mapBorderWidth,\r\n fill: mapNoDataColor,\r\n }}\r\n />\r\n );\r\n })}\r\n </motion.g>\r\n );\r\n })\r\n }\r\n <AnimatePresence>\r\n {data.map(d => {\r\n const index = mapData.features.findIndex(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => d.id === el.properties[mapProperty],\r\n );\r\n const xColorCoord = !checkIfNullOrUndefined(d.x)\r\n ? xScale(d.x as number)\r\n : undefined;\r\n const yColorCoord = !checkIfNullOrUndefined(d.y)\r\n ? yScale(d.y as number)\r\n : undefined;\r\n const color =\r\n xColorCoord !== undefined && yColorCoord !== undefined\r\n ? colors[yColorCoord][xColorCoord]\r\n : mapNoDataColor;\r\n\r\n return (\r\n <motion.g\r\n key={d.id}\r\n variants={{\r\n initial: { opacity: 0 },\r\n whileInView: {\r\n opacity: selectedColor\r\n ? selectedColor === color\r\n ? 1\r\n : dimmedOpacity\r\n : highlightedIds.length !== 0\r\n ? highlightedIds.indexOf(d.id) !== -1\r\n ? 1\r\n : dimmedOpacity\r\n : 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n onMouseEnter={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n onSeriesMouseOver?.(d);\r\n }}\r\n onClick={() => {\r\n if (onSeriesMouseClick || detailsOnClick) {\r\n if (isEqual(mouseClickData, d) && resetSelectionOnDoubleClick) {\r\n setMouseClickData(undefined);\r\n onSeriesMouseClick?.(undefined);\r\n } else {\r\n setMouseClickData(d);\r\n onSeriesMouseClick?.(d);\r\n }\r\n }\r\n }}\r\n onMouseMove={event => {\r\n setMouseOverData(d);\r\n setEventY(event.clientY);\r\n setEventX(event.clientX);\r\n }}\r\n onMouseLeave={() => {\r\n setMouseOverData(undefined);\r\n setEventX(undefined);\r\n setEventY(undefined);\r\n onSeriesMouseOver?.(undefined);\r\n }}\r\n >\r\n {index === -1\r\n ? null\r\n : mapData.features[index].geometry.type === 'MultiPolygon'\r\n ? mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n d={masterPath}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )\r\n : mapData.features[index].geometry.coordinates.map(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <motion.path\r\n key={`${d.id}-${j}`}\r\n d={path}\r\n variants={{\r\n initial: { fill: color, opacity: 0 },\r\n whileInView: {\r\n fill: color,\r\n opacity: 1,\r\n transition: { duration: animate.duration },\r\n },\r\n }}\r\n initial='initial'\r\n animate={isInView ? 'whileInView' : 'initial'}\r\n exit={{ opacity: 0, transition: { duration: animate.duration } }}\r\n className={`${\r\n color === mapNoDataColor\r\n ? 'stroke-primary-gray-400 dark:stroke-primary-gray-500'\r\n : 'stroke-primary-white dark:stroke-primary-gray-650'\r\n }`}\r\n style={{\r\n strokeWidth: mapBorderWidth,\r\n }}\r\n />\r\n );\r\n },\r\n )}\r\n </motion.g>\r\n );\r\n })}\r\n </AnimatePresence>\r\n {mouseOverData\r\n ? mapData.features\r\n .filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (d: { properties: any }) => d.properties[mapProperty] === mouseOverData.id,\r\n )\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n .map((d: any, i: number) => {\r\n return (\r\n <g key={i}>\r\n {d.geometry.type === 'MultiPolygon'\r\n ? // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: any) => {\r\n let masterPath = '';\r\n el.forEach((geo: number[][]) => {\r\n let path = ' M';\r\n geo.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== geo.length - 1)\r\n path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n masterPath += path;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={masterPath}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })\r\n : // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n d.geometry.coordinates.map((el: any, j: number) => {\r\n let path = 'M';\r\n el.forEach((c: number[], k: number) => {\r\n const point = projection([c[0], c[1]]) as [number, number];\r\n if (k !== el.length - 1) path = `${path}${point[0]} ${point[1]}L`;\r\n else path = `${path}${point[0]} ${point[1]}`;\r\n });\r\n return (\r\n <path\r\n key={j}\r\n d={path}\r\n className='stroke-primary-gray-700 dark:stroke-primary-gray-300'\r\n style={{\r\n fill: 'none',\r\n fillOpacity: 0,\r\n strokeWidth: '0.5',\r\n }}\r\n />\r\n );\r\n })}\r\n </g>\r\n );\r\n })\r\n : null}\r\n {customLayers.filter(d => d.position === 'after').map(d => d.layer)}\r\n </g>\r\n </motion.svg>\r\n {showColorScale === false ? null : (\r\n <div className='absolute left-4 bottom-4'>\r\n {showLegend ? (\r\n <>\r\n <div\r\n style={{\r\n backgroundColor: 'rgba(240,240,240, 0.7)',\r\n border: '1px solid var(--gray-400)',\r\n borderRadius: '999px',\r\n width: '24px',\r\n height: '24px',\r\n padding: '3px',\r\n cursor: 'pointer',\r\n zIndex: 10,\r\n position: 'absolute',\r\n right: '-0.75rem',\r\n top: '-0.75rem',\r\n }}\r\n onClick={() => {\r\n setShowLegend(false);\r\n }}\r\n >\r\n <X />\r\n </div>\r\n <div\r\n className='p-2'\r\n style={{ backgroundColor: 'rgba(240,240,240, 0.7)', width: '175px' }}\r\n >\r\n <div className='flex gap-1 items-center'>\r\n <svg width='136px' viewBox='0 0 136 136' className='shrink-0'>\r\n <g>\r\n {colors.map((d, i) => (\r\n <g key={i} transform={`translate(0,${100 - i * 25})`}>\r\n {d.map((el, j) => (\r\n <rect\r\n key={j}\r\n y={1}\r\n x={j * 25 + 1}\r\n fill={el}\r\n width={23}\r\n height={23}\r\n strokeWidth={selectedColor === el ? 2 : 0.25}\r\n style={{ cursor: 'pointer' }}\r\n onMouseOver={() => {\r\n setSelectedColor(el);\r\n }}\r\n onMouseLeave={() => {\r\n setSelectedColor(undefined);\r\n }}\r\n />\r\n ))}\r\n </g>\r\n ))}\r\n <g transform='translate(0,125)'>\r\n {xDomain.map((el, j) => (\r\n <text key={j} y={10} x={(j + 1) * 25} fontSize={10} textAnchor='middle'>\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n ))}\r\n </g>\r\n {yDomain.map((el, j) => (\r\n <g\r\n key={j}\r\n transform={`translate(${\r\n Math.max(Math.min(xDomain.length + 1, 5), 4) * 25 + 10\r\n },${100 - j * 25})`}\r\n >\r\n <text\r\n x={0}\r\n transform='rotate(-90)'\r\n y={0}\r\n fontSize={10}\r\n textAnchor='middle'\r\n >\r\n {typeof el === 'string' || el < 1\r\n ? el\r\n : numberFormattingFunction(el, 'NA')}\r\n </text>\r\n </g>\r\n ))}\r\n </g>\r\n </svg>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='leading-normal text-center shrink-0'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n writingMode: 'vertical-rl',\r\n height: '8.5rem',\r\n transform: 'rotate(180deg)',\r\n }}\r\n >\r\n {yColorLegendTitle}\r\n </P>\r\n </div>\r\n <P\r\n marginBottom='none'\r\n size='xs'\r\n className='mt-1 leading-normal text-center'\r\n style={{\r\n display: '-webkit-box',\r\n WebkitLineClamp: '1',\r\n width: '8.5rem',\r\n WebkitBoxOrient: 'vertical',\r\n overflow: 'hidden',\r\n }}\r\n >\r\n {xColorLegendTitle}\r\n </P>\r\n </div>\r\n </>\r\n ) : (\r\n <button\r\n type='button'\r\n className='mb-0 border-0 bg-transparent p-0 self-start'\r\n onClick={() => {\r\n setShowLegend(true);\r\n }}\r\n >\r\n <div className='items-start text-sm font-medium cursor-pointer p-2 mb-0 flex text-primary-black dark:text-primary-gray-300 bg-primary-gray-300 dark:bg-primary-gray-550 border-primary-gray-400 dark:border-primary-gray-500'>\r\n Show Legend\r\n </div>\r\n </button>\r\n )}\r\n </div>\r\n )}\r\n {zoomInteraction === 'button' && (\r\n <div className='absolute left-4 top-4 flex flex-col'>\r\n <button\r\n onClick={() => handleZoom('in')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n +\r\n </button>\r\n <button\r\n onClick={() => handleZoom('out')}\r\n className='leading-0 px-2 py-3.5 border text-primary-gray-700 border-t-0 border-primary-gray-400 bg-primary-gray-200 dark:border-primary-gray-400 dark:bg-primary-gray-600 dark:text-primary-gray-100'\r\n >\r\n –\r\n </button>\r\n </div>\r\n )}\r\n </div>\r\n {mouseOverData && tooltip && eventX && eventY ? (\r\n <Tooltip\r\n data={mouseOverData}\r\n body={tooltip}\r\n xPos={eventX}\r\n yPos={eventY}\r\n backgroundStyle={styles?.tooltip}\r\n className={classNames?.tooltip}\r\n />\r\n ) : null}\r\n {detailsOnClick && mouseClickData !== undefined ? (\r\n <Modal\r\n open={mouseClickData !== undefined}\r\n onClose={() => {\r\n setMouseClickData(undefined);\r\n }}\r\n >\r\n <div\r\n className='graph-modal-content m-0'\r\n dangerouslySetInnerHTML={\r\n typeof detailsOnClick === 'string'\r\n ? { __html: string2HTML(detailsOnClick, mouseClickData) }\r\n : undefined\r\n }\r\n >\r\n {typeof detailsOnClick === 'function' ? detailsOnClick(mouseClickData) : null}\r\n </div>\r\n </Modal>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n","import { useEffect, useRef, useState } from 'react';\r\nimport { cn } from '@undp/design-system-react/cn';\r\nimport { SliderUI } from '@undp/design-system-react/SliderUI';\r\nimport { Spinner } from '@undp/design-system-react/Spinner';\r\nimport { format } from 'date-fns/format';\r\nimport { parse } from 'date-fns/parse';\r\nimport { ascending, sort } from 'd3-array';\r\nimport uniqBy from 'lodash.uniqby';\r\n\r\nimport { Graph } from './Graph';\r\n\r\nimport {\r\n BivariateMapDataType,\r\n Languages,\r\n SourcesDataType,\r\n StyleObject,\r\n ClassNameObject,\r\n MapProjectionTypes,\r\n ZoomInteractionTypes,\r\n CustomLayerDataType,\r\n AnimateDataType,\r\n TimelineDataType,\r\n} from '@/Types';\r\nimport { GraphHeader } from '@/Components/Elements/GraphHeader';\r\nimport { GraphFooter } from '@/Components/Elements/GraphFooter';\r\nimport { Colors } from '@/Components/ColorPalette';\r\nimport { fetchAndParseJSON } from '@/Utils/fetchAndParseData';\r\nimport { getJenks } from '@/Utils/getJenks';\r\nimport { Pause, Play } from '@/Components/Icons';\r\nimport { getSliderMarks } from '@/Utils/getSliderMarks';\r\n\r\ninterface Props {\r\n // Data\r\n /** Array of data objects. */\r\n data: BivariateMapDataType[];\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 /** Colors for the choropleth map. Array must be 5x5 */\r\n colors?: string[][];\r\n /** Title for the first color legend */\r\n xColorLegendTitle?: string;\r\n /** Title for the second color legend */\r\n yColorLegendTitle?: string;\r\n /** Domain of x-colors for the map */\r\n xDomain?: number[];\r\n /** Domain of y-colors for the map */\r\n yDomain?: number[];\r\n /** Color for the areas where data is no available */\r\n mapNoDataColor?: 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\r\n // Graph Parameters\r\n /** Map data as an object in geoJson format or a url for geoJson */\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n mapData?: any;\r\n /** Scaling factor for the map. Multiplies the scale number to scale. */\r\n scale?: number;\r\n /** Center point of the map */\r\n centerPoint?: [number, number];\r\n /** Defines the zoom mode for the map */\r\n zoomInteraction?: ZoomInteractionTypes;\r\n /** Stroke width of the regions in the map */\r\n mapBorderWidth?: number;\r\n /** Stroke color of the regions in the map */\r\n mapBorderColor?: string;\r\n /** Toggle if the map is a world map */\r\n isWorldMap?: boolean;\r\n /** Map projection type */\r\n mapProjection?: MapProjectionTypes;\r\n /** Extend of the allowed zoom in the map */\r\n zoomScaleExtend?: [number, number];\r\n /** Extend of the allowed panning in the map */\r\n zoomTranslateExtend?: [[number, number], [number, number]];\r\n /** Countries or regions to be highlighted */\r\n highlightedIds?: string[];\r\n /** Defines the opacity of the non-highlighted data */\r\n dimmedOpacity?: number;\r\n /** Toggles if the graph animates in when loaded. */\r\n animate?: boolean | AnimateDataType;\r\n /** Property in the property object in mapData geoJson object is used to match to the id in the data object */\r\n mapProperty?: string;\r\n /** Toggle visibility of color scale. */\r\n showColorScale?: boolean;\r\n /** Toggles the visibility of Antarctica in the default map. Only applicable for the default map. */\r\n showAntarctica?: boolean;\r\n /** Optional SVG <g> element or function that renders custom content behind or in front of the graph. */\r\n customLayers?: CustomLayerDataType[];\r\n /** Configures playback and slider controls for animating the chart over time. The data must have a key date for it to work properly. */\r\n timeline?: TimelineDataType;\r\n /** Enable graph download option as png */\r\n graphDownload?: boolean;\r\n /** Enable data download option as a csv */\r\n dataDownload?: boolean;\r\n /** Reset selection on double-click. Only applicable when used in a dashboard context with filters. */\r\n resetSelectionOnDoubleClick?: boolean;\r\n\r\n // Interactions and Callbacks\r\n /** Tooltip content. If the type is string then this uses the [handlebar](../?path=/docs/misc-handlebars-templates-and-custom-helpers--docs) template to display the data */\r\n // 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 BiVariateChoroplethMap(props: Props) {\r\n const {\r\n data,\r\n graphTitle,\r\n mapData = 'https://raw.githubusercontent.com/UNDP-Data/dv-country-geojson/refs/heads/main/worldMap.json',\r\n colors = Colors.light.bivariateColors.colors05x05,\r\n sources,\r\n graphDescription,\r\n height,\r\n width,\r\n footNote = '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.',\r\n xDomain,\r\n yDomain,\r\n xColorLegendTitle = 'X Color key',\r\n yColorLegendTitle = 'Y Color key',\r\n tooltip,\r\n scale = 0.95,\r\n centerPoint,\r\n padding,\r\n mapBorderWidth = 0.5,\r\n mapNoDataColor = Colors.light.graphNoData,\r\n backgroundColor = false,\r\n mapBorderColor = Colors.light.grays['gray-500'],\r\n relativeHeight,\r\n onSeriesMouseOver,\r\n isWorldMap = true,\r\n zoomScaleExtend = [0.8, 6],\r\n zoomTranslateExtend,\r\n graphID,\r\n showColorScale = true,\r\n highlightedIds = [],\r\n onSeriesMouseClick,\r\n mapProperty = 'ISO3',\r\n graphDownload = false,\r\n dataDownload = false,\r\n showAntarctica = false,\r\n language = 'en',\r\n minHeight = 0,\r\n theme = 'light',\r\n ariaLabel,\r\n resetSelectionOnDoubleClick = true,\r\n detailsOnClick,\r\n styles,\r\n classNames,\r\n mapProjection,\r\n zoomInteraction = 'button',\r\n animate = false,\r\n dimmedOpacity = 0.3,\r\n customLayers = [],\r\n timeline = { enabled: false, autoplay: false, showOnlyActiveDate: true },\r\n } = props;\r\n\r\n const [svgWidth, setSvgWidth] = useState(0);\r\n const [svgHeight, setSvgHeight] = useState(0);\r\n const [play, setPlay] = useState(timeline.autoplay);\r\n const uniqDatesSorted = sort(\r\n uniqBy(\r\n data.filter(d => d.date !== undefined && d.date !== null),\r\n d => d.date,\r\n ).map(d => parse(`${d.date}`, timeline.dateFormat || 'yyyy', new Date()).getTime()),\r\n (a, b) => ascending(a, b),\r\n );\r\n const [index, setIndex] = useState(timeline.autoplay ? 0 : uniqDatesSorted.length - 1);\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n const [mapShape, setMapShape] = useState<any>(undefined);\r\n\r\n const graphDiv = useRef<HTMLDivElement>(null);\r\n const graphParentDiv = useRef<HTMLDivElement>(null);\r\n useEffect(() => {\r\n const resizeObserver = new ResizeObserver(entries => {\r\n setSvgWidth(width || entries[0].contentRect.width || 760);\r\n setSvgHeight(height || entries[0].target.clientHeight || 480);\r\n });\r\n if (graphDiv.current) {\r\n setSvgHeight(graphDiv.current.clientHeight || 480);\r\n setSvgWidth(graphDiv.current.clientWidth || 760);\r\n if (!width) resizeObserver.observe(graphDiv.current);\r\n }\r\n return () => resizeObserver.disconnect();\r\n }, [width, height]);\r\n useEffect(() => {\r\n if (typeof mapData === 'string') {\r\n const fetchData = fetchAndParseJSON(mapData);\r\n fetchData.then(d => {\r\n setMapShape(d);\r\n });\r\n } else {\r\n setMapShape(mapData);\r\n }\r\n }, [mapData]);\r\n\r\n useEffect(() => {\r\n const interval = setInterval(\r\n () => {\r\n setIndex(i => (i < uniqDatesSorted.length - 1 ? i + 1 : 0));\r\n },\r\n (timeline.speed || 2) * 1000,\r\n );\r\n if (!play) clearInterval(interval);\r\n return () => clearInterval(interval);\r\n }, [uniqDatesSorted, play, timeline.speed]);\r\n\r\n const markObj = getSliderMarks(\r\n uniqDatesSorted,\r\n index,\r\n timeline.showOnlyActiveDate,\r\n timeline.dateFormat || 'yyyy',\r\n );\r\n\r\n if (xDomain && yDomain)\r\n if (xDomain.length !== colors[0].length - 1 || yDomain.length !== colors.length - 1) {\r\n console.error(\"the xDomain and yDomain array length don't match to the color array length\");\r\n return null;\r\n }\r\n return (\r\n <div\r\n className={`${theme || 'light'} flex ${width ? 'w-fit grow-0' : 'w-full grow'}`}\r\n dir={language === 'he' || language === 'ar' ? 'rtl' : undefined}\r\n >\r\n <div\r\n className={cn(\r\n `${\r\n !backgroundColor\r\n ? 'bg-transparent '\r\n : backgroundColor === true\r\n ? 'bg-primary-gray-200 dark:bg-primary-gray-650 '\r\n : ''\r\n }ml-auto mr-auto flex flex-col grow h-inherit ${language || 'en'}`,\r\n width ? 'w-fit' : 'w-full',\r\n classNames?.graphContainer,\r\n )}\r\n style={{\r\n ...(styles?.graphContainer || {}),\r\n ...(backgroundColor && backgroundColor !== true ? { backgroundColor } : {}),\r\n }}\r\n id={graphID}\r\n ref={graphParentDiv}\r\n aria-label={\r\n ariaLabel ||\r\n `${\r\n graphTitle ? `The graph shows ${graphTitle}. ` : ''\r\n }This is bi-variate choropleth map where geographic areas are colored in proportion to two variables.${\r\n graphDescription ? ` ${graphDescription}` : ''\r\n }`\r\n }\r\n >\r\n <div\r\n className='flex grow'\r\n style={{ padding: backgroundColor ? padding || '1rem' : padding || 0 }}\r\n >\r\n <div className='flex flex-col w-full gap-4 grow justify-between'>\r\n {graphTitle || graphDescription || graphDownload || dataDownload ? (\r\n <GraphHeader\r\n styles={{\r\n title: styles?.title,\r\n description: styles?.description,\r\n }}\r\n classNames={{\r\n title: classNames?.title,\r\n description: classNames?.description,\r\n }}\r\n graphTitle={graphTitle}\r\n graphDescription={graphDescription}\r\n width={width}\r\n graphDownload={graphDownload ? graphParentDiv.current : undefined}\r\n dataDownload={\r\n dataDownload\r\n ? data.map(d => d.data).filter(d => d !== undefined).length > 0\r\n ? data.map(d => d.data).filter(d => d !== undefined)\r\n : data.filter(d => d !== undefined)\r\n : null\r\n }\r\n />\r\n ) : null}\r\n {timeline.enabled && uniqDatesSorted.length > 0 && markObj ? (\r\n <div className='flex gap-6 items-center' dir='ltr'>\r\n <button\r\n type='button'\r\n onClick={() => {\r\n setPlay(!play);\r\n }}\r\n className='p-0 border-0 cursor-pointer bg-transparent'\r\n aria-label={play ? 'Click to pause animation' : 'Click to play animation'}\r\n >\r\n {play ? <Pause /> : <Play />}\r\n </button>\r\n <SliderUI\r\n min={uniqDatesSorted[0]}\r\n max={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n marks={markObj}\r\n step={null}\r\n defaultValue={uniqDatesSorted[uniqDatesSorted.length - 1]}\r\n value={uniqDatesSorted[index]}\r\n onChangeComplete={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n onChange={nextValue => {\r\n setIndex(uniqDatesSorted.indexOf(nextValue as number));\r\n }}\r\n aria-label='Time slider. Use arrow keys to adjust selected time period.'\r\n />\r\n </div>\r\n ) : null}\r\n <div\r\n className='flex flex-col grow justify-center leading-0'\r\n ref={graphDiv}\r\n aria-label='Map area'\r\n >\r\n {(width || svgWidth) && (height || svgHeight) && mapShape ? (\r\n <Graph\r\n data={data.filter(d =>\r\n timeline.enabled\r\n ? d.date ===\r\n format(new Date(uniqDatesSorted[index]), timeline.dateFormat || 'yyyy')\r\n : d,\r\n )}\r\n mapData={\r\n showAntarctica\r\n ? mapShape\r\n : {\r\n ...mapShape,\r\n features: mapShape.features.filter(\r\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n (el: any) => el.properties.NAME !== 'Antarctica',\r\n ),\r\n }\r\n }\r\n xDomain={\r\n xDomain ||\r\n getJenks(\r\n data.map(d => d.x as number | null | undefined),\r\n colors[0].length,\r\n )\r\n }\r\n yDomain={\r\n yDomain ||\r\n getJenks(\r\n data.map(d => d.y as number | null | undefined),\r\n colors.length,\r\n )\r\n }\r\n width={width || svgWidth}\r\n height={Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}\r\n scale={scale}\r\n centerPoint={centerPoint}\r\n colors={colors}\r\n xColorLegendTitle={xColorLegendTitle}\r\n yColorLegendTitle={yColorLegendTitle}\r\n mapBorderWidth={mapBorderWidth}\r\n mapNoDataColor={mapNoDataColor}\r\n mapBorderColor={mapBorderColor}\r\n tooltip={tooltip}\r\n onSeriesMouseOver={onSeriesMouseOver}\r\n isWorldMap={isWorldMap}\r\n zoomScaleExtend={zoomScaleExtend}\r\n zoomTranslateExtend={zoomTranslateExtend}\r\n onSeriesMouseClick={onSeriesMouseClick}\r\n mapProperty={mapProperty}\r\n highlightedIds={highlightedIds}\r\n resetSelectionOnDoubleClick={resetSelectionOnDoubleClick}\r\n styles={styles}\r\n showColorScale={showColorScale}\r\n classNames={classNames}\r\n mapProjection={mapProjection || (isWorldMap ? 'naturalEarth' : 'mercator')}\r\n detailsOnClick={detailsOnClick}\r\n zoomInteraction={zoomInteraction}\r\n animate={\r\n animate === true\r\n ? { duration: 0.5, once: true, amount: 0.5 }\r\n : animate || { duration: 0, once: true, amount: 0 }\r\n }\r\n dimmedOpacity={dimmedOpacity}\r\n customLayers={customLayers}\r\n />\r\n ) : (\r\n <div\r\n style={{\r\n height: `${Math.max(\r\n minHeight,\r\n height ||\r\n (relativeHeight\r\n ? minHeight\r\n ? (width || svgWidth) * relativeHeight > minHeight\r\n ? (width || svgWidth) * relativeHeight\r\n : minHeight\r\n : (width || svgWidth) * relativeHeight\r\n : svgHeight),\r\n )}px`,\r\n }}\r\n className='flex items-center justify-center'\r\n >\r\n <Spinner aria-label='Loading graph' />\r\n </div>\r\n )}\r\n </div>\r\n {sources || footNote ? (\r\n <GraphFooter\r\n styles={{ footnote: styles?.footnote, source: styles?.source }}\r\n classNames={{\r\n footnote: classNames?.footnote,\r\n source: classNames?.source,\r\n }}\r\n sources={sources}\r\n footNote={footNote}\r\n width={width}\r\n />\r\n ) : null}\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n}\r\n"],"names":["Graph","props","data","xDomain","mapData","xColorLegendTitle","yDomain","yColorLegendTitle","width","height","colors","scale","centerPoint","mapBorderWidth","mapNoDataColor","mapBorderColor","tooltip","onSeriesMouseOver","zoomScaleExtend","zoomTranslateExtend","highlightedIds","onSeriesMouseClick","mapProperty","resetSelectionOnDoubleClick","detailsOnClick","showColorScale","styles","classNames","mapProjection","zoomInteraction","animate","dimmedOpacity","customLayers","showLegend","setShowLegend","useState","selectedColor","setSelectedColor","mouseClickData","setMouseClickData","mouseOverData","setMouseOverData","eventX","setEventX","eventY","setEventY","mapSvg","useRef","isInView","useInView","mapG","zoomRef","useEffect","mapGSelect","select","mapSvgSelect","zoomFilter","e","isWheel","isTouch","isDrag","zoomBehavior","zoom","transform","bounds","bbox","center","centerOfMass","lonDiff","latDiff","scaleX","scaleY","scaleVar","projection","geoMercator","geoEqualEarth","geoNaturalEarth1","geoOrthographic","geoAlbersUsa","xRange","_","i","yRange","xScale","scaleThreshold","yScale","handleZoom","direction","jsxs","Fragment","jsx","motion","d","el","j","masterPath","geo","path","c","k","point","AnimatePresence","index","xColorCoord","checkIfNullOrUndefined","yColorCoord","color","event","isEqual","X","numberFormattingFunction","P","Tooltip","Modal","string2HTML","BiVariateChoroplethMap","graphTitle","Colors","sources","graphDescription","footNote","padding","backgroundColor","relativeHeight","isWorldMap","graphID","graphDownload","dataDownload","showAntarctica","language","minHeight","theme","ariaLabel","timeline","svgWidth","setSvgWidth","svgHeight","setSvgHeight","play","setPlay","uniqDatesSorted","sort","uniqBy","parse","a","b","ascending","setIndex","mapShape","setMapShape","graphDiv","graphParentDiv","resizeObserver","entries","fetchAndParseJSON","interval","markObj","getSliderMarks","cn","GraphHeader","Pause","Play","SliderUI","nextValue","format","getJenks","Spinner","GraphFooter"],"mappings":"okCA4EO,SAASA,GAAMC,GAAc,CAClC,KAAM,CACJ,KAAAC,EACA,QAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,QAAAC,EACA,kBAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,MAAAC,EACA,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,eAAAC,GACA,QAAAC,GACA,kBAAAC,GACA,gBAAAC,GACA,oBAAAC,GACA,eAAAC,EACA,mBAAAC,EACA,YAAAC,EACA,4BAAAC,EACA,eAAAC,EACA,eAAAC,GACA,OAAAC,GACA,WAAAC,GACA,cAAAC,EACA,gBAAAC,EACA,QAAAC,EACA,cAAAC,EACA,aAAAC,EAAA,EACE/B,GACE,CAACgC,GAAYC,CAAa,EAAIC,EAAAA,SAAS,EAAE3B,EAAQ,IAAI,EACrD,CAAC4B,EAAeC,CAAgB,EAAIF,EAAAA,SAA6B,MAAS,EAE1E,CAACG,EAAgBC,CAAiB,EAAIJ,EAAAA,SAAc,MAAS,EAE7D,CAACK,EAAeC,CAAgB,EAAIN,EAAAA,SAAc,MAAS,EAC3D,CAACO,GAAQC,CAAS,EAAIR,EAAAA,SAA6B,MAAS,EAC5D,CAACS,EAAQC,EAAS,EAAIV,EAAAA,SAA6B,MAAS,EAC5DW,EAASC,EAAAA,OAAsB,IAAI,EACnCC,EAAWC,GAAAA,UAAUH,EAAQ,CACjC,KAAMhB,EAAQ,KACd,OAAQA,EAAQ,MAAA,CACjB,EACKoB,GAAOH,EAAAA,OAAoB,IAAI,EAC/B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