@undp/data-viz 1.5.8 → 1.5.9
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.
- package/dist/AreaChart.cjs +1 -1
- package/dist/AreaChart.js +13 -13
- package/dist/{Axis-Ddg-seDi.js → Axis-4gUOL8B7.js} +2 -2
- package/dist/{Axis-Ddg-seDi.js.map → Axis-4gUOL8B7.js.map} +1 -1
- package/dist/{Axis-DE7dSn1_.cjs → Axis-CkNn1wit.cjs} +2 -2
- package/dist/{Axis-DE7dSn1_.cjs.map → Axis-CkNn1wit.cjs.map} +1 -1
- package/dist/{AxisTitle-CK9YeovX.cjs → AxisTitle-Wkz-xeQL.cjs} +2 -2
- package/dist/{AxisTitle-CK9YeovX.cjs.map → AxisTitle-Wkz-xeQL.cjs.map} +1 -1
- package/dist/{AxisTitle-BmHLMRJZ.js → AxisTitle-v6_xcXZ-.js} +2 -2
- package/dist/{AxisTitle-BmHLMRJZ.js.map → AxisTitle-v6_xcXZ-.js.map} +1 -1
- package/dist/BarGraph.cjs +1 -1
- package/dist/BarGraph.js +16 -16
- package/dist/BasicStatCard.cjs +1 -1
- package/dist/BasicStatCard.js +2 -2
- package/dist/BeeSwarmChart.cjs +1 -1
- package/dist/BeeSwarmChart.js +42 -42
- package/dist/BiVariateChoroplethMap.cjs +1 -1
- package/dist/BiVariateChoroplethMap.cjs.map +1 -1
- package/dist/BiVariateChoroplethMap.d.ts +2 -0
- package/dist/BiVariateChoroplethMap.js +257 -264
- package/dist/BiVariateChoroplethMap.js.map +1 -1
- package/dist/BulletChart.cjs +1 -1
- package/dist/BulletChart.js +14 -14
- package/dist/ButterflyChart.cjs +1 -1
- package/dist/ButterflyChart.js +45 -45
- package/dist/ChoroplethMap.cjs +1 -1
- package/dist/ChoroplethMap.cjs.map +1 -1
- package/dist/ChoroplethMap.d.ts +2 -0
- package/dist/ChoroplethMap.js +296 -304
- package/dist/ChoroplethMap.js.map +1 -1
- package/dist/CirclePackingGraph.cjs +1 -1
- package/dist/CirclePackingGraph.js +3 -3
- package/dist/ColorLegend.cjs +1 -1
- package/dist/ColorLegend.js +2 -2
- package/dist/ColorLegendWithMouseOver.cjs +1 -1
- package/dist/ColorLegendWithMouseOver.js +2 -2
- package/dist/CopyTextButton.cjs +4 -4
- package/dist/CopyTextButton.cjs.map +1 -1
- package/dist/CopyTextButton.js +27 -27
- package/dist/CopyTextButton.js.map +1 -1
- package/dist/CsvDownloadButton.cjs +1 -1
- package/dist/CsvDownloadButton.js +2 -2
- package/dist/DataCards.cjs +3 -3
- package/dist/DataCards.cjs.map +1 -1
- package/dist/DataCards.js +16 -16
- package/dist/DataCards.js.map +1 -1
- package/dist/DataTable.cjs +1 -1
- package/dist/DataTable.js +3 -3
- package/dist/DifferenceLineChart.cjs +1 -1
- package/dist/DifferenceLineChart.js +12 -12
- package/dist/DonutChart.cjs +1 -1
- package/dist/DonutChart.js +20 -20
- package/dist/DotDensityMap.cjs +1 -1
- package/dist/DotDensityMap.cjs.map +1 -1
- package/dist/DotDensityMap.d.ts +2 -0
- package/dist/DotDensityMap.js +282 -289
- package/dist/DotDensityMap.js.map +1 -1
- package/dist/{DropdownSelect-CtOKZHD0.js → DropdownSelect-6kjXM6oW.js} +2 -2
- package/dist/DropdownSelect-6kjXM6oW.js.map +1 -0
- package/dist/{DropdownSelect-DBDM64B5.cjs → DropdownSelect-vt8yiB-g.cjs} +5 -5
- package/dist/DropdownSelect-vt8yiB-g.cjs.map +1 -0
- package/dist/DualAxisLineChart.cjs +1 -1
- package/dist/DualAxisLineChart.js +9 -9
- package/dist/DumbbellChart.cjs +1 -1
- package/dist/DumbbellChart.js +50 -50
- package/dist/{EmptyState-DdTp-Mdn.js → EmptyState-36lXXyui.js} +4 -4
- package/dist/{EmptyState-DdTp-Mdn.js.map → EmptyState-36lXXyui.js.map} +1 -1
- package/dist/{EmptyState-d8_8SxeW.cjs → EmptyState-B8IpKGcL.cjs} +2 -2
- package/dist/{EmptyState-d8_8SxeW.cjs.map → EmptyState-B8IpKGcL.cjs.map} +1 -1
- package/dist/ExcelDownloadButton.cjs +1 -1
- package/dist/ExcelDownloadButton.js +2 -2
- package/dist/FootNote.cjs +1 -1
- package/dist/FootNote.js +2 -2
- package/dist/GeoHubCompareMaps.cjs +1 -1
- package/dist/GeoHubCompareMaps.cjs.map +1 -1
- package/dist/GeoHubCompareMaps.js +65 -80
- package/dist/GeoHubCompareMaps.js.map +1 -1
- package/dist/GeoHubMap.cjs +1 -1
- package/dist/GeoHubMap.cjs.map +1 -1
- package/dist/GeoHubMap.js +95 -125
- package/dist/GeoHubMap.js.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs +1 -1
- package/dist/GeoHubMapWithLayerSelection.cjs.map +1 -1
- package/dist/GeoHubMapWithLayerSelection.js +73 -88
- package/dist/GeoHubMapWithLayerSelection.js.map +1 -1
- package/dist/GraphDescription.cjs +1 -1
- package/dist/GraphDescription.js +2 -2
- package/dist/{GraphEl-CqWzvOyr.js → GraphEl-2IiUDxjR.js} +15 -12
- package/dist/GraphEl-2IiUDxjR.js.map +1 -0
- package/dist/GraphEl-qrlfGPe3.cjs +2 -0
- package/dist/GraphEl-qrlfGPe3.cjs.map +1 -0
- package/dist/GraphFooter.cjs +1 -1
- package/dist/GraphFooter.js +1 -1
- package/dist/GraphHeader.cjs +1 -1
- package/dist/GraphHeader.js +1 -1
- package/dist/GraphTitle.cjs +1 -1
- package/dist/GraphTitle.js +2 -2
- package/dist/GriddedGraphs.cjs +1 -1
- package/dist/GriddedGraphs.d.ts +1 -0
- package/dist/GriddedGraphs.js +5 -5
- package/dist/GriddedGraphsFromConfig.cjs +1 -1
- package/dist/GriddedGraphsFromConfig.d.ts +1 -0
- package/dist/GriddedGraphsFromConfig.js +2 -2
- package/dist/HeatMap.cjs +1 -1
- package/dist/HeatMap.js +19 -19
- package/dist/Histogram.cjs +1 -1
- package/dist/Histogram.js +3 -3
- package/dist/ImageDownloadButton.cjs +1 -1
- package/dist/ImageDownloadButton.js +2 -2
- package/dist/LineChartWithConfidenceInterval.cjs +1 -1
- package/dist/LineChartWithConfidenceInterval.js +12 -12
- package/dist/LinearColorLegend.cjs +1 -1
- package/dist/LinearColorLegend.js +2 -2
- package/dist/{Modal-DVVwpKhP.js → Modal-Cg8daIlV.js} +198 -187
- package/dist/Modal-Cg8daIlV.js.map +1 -0
- package/dist/Modal-CuuJdWkD.cjs +46 -0
- package/dist/Modal-CuuJdWkD.cjs.map +1 -0
- package/dist/MultiGraphDashboard.cjs +1 -1
- package/dist/MultiGraphDashboard.d.ts +1 -0
- package/dist/MultiGraphDashboard.js +3 -3
- package/dist/MultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/MultiGraphDashboardFromConfig.js +2 -2
- package/dist/MultiGraphDashboardWideToLongFormat.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormat.js +4 -4
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.cjs +1 -1
- package/dist/MultiGraphDashboardWideToLongFormatFromConfig.js +2 -2
- package/dist/MultiLineAltChart.cjs +1 -1
- package/dist/MultiLineAltChart.js +12 -12
- package/dist/MultiLineChart.cjs +1 -1
- package/dist/MultiLineChart.js +12 -12
- package/dist/ParetoChart.cjs +1 -1
- package/dist/ParetoChart.js +26 -26
- package/dist/PerformanceIntensiveMultiGraphDashboard.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboard.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboard.js +3 -3
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.cjs +1 -1
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.d.ts +1 -0
- package/dist/PerformanceIntensiveMultiGraphDashboardFromConfig.js +2 -2
- package/dist/PerformanceIntensiveScrollStory.cjs +1 -1
- package/dist/PerformanceIntensiveScrollStory.d.ts +1 -0
- package/dist/PerformanceIntensiveScrollStory.js +3 -3
- package/dist/RadarChart.cjs +1 -1
- package/dist/RadarChart.js +7 -7
- package/dist/{ReferenceLine-CfAW3vKJ.js → ReferenceLine-CPMaAX0r.js} +3 -3
- package/dist/{ReferenceLine-CfAW3vKJ.js.map → ReferenceLine-CPMaAX0r.js.map} +1 -1
- package/dist/{ReferenceLine-CFVBBN__.cjs → ReferenceLine-D04j-zeV.cjs} +2 -2
- package/dist/{ReferenceLine-CFVBBN__.cjs.map → ReferenceLine-D04j-zeV.cjs.map} +1 -1
- package/dist/{RegressionLine-C2--oMQq.js → RegressionLine-CW7iViH2.js} +4 -4
- package/dist/{RegressionLine-C2--oMQq.js.map → RegressionLine-CW7iViH2.js.map} +1 -1
- package/dist/{RegressionLine-Dj0GSiAp.cjs → RegressionLine-D-49RaHa.cjs} +2 -2
- package/dist/{RegressionLine-Dj0GSiAp.cjs.map → RegressionLine-D-49RaHa.cjs.map} +1 -1
- package/dist/SVGDownloadButton.cjs +1 -1
- package/dist/SVGDownloadButton.js +2 -2
- package/dist/SankeyChart.cjs +1 -1
- package/dist/SankeyChart.js +27 -27
- package/dist/ScatterPlot.cjs +1 -1
- package/dist/ScatterPlot.js +17 -17
- package/dist/ScrollStory.cjs +1 -1
- package/dist/ScrollStory.d.ts +1 -0
- package/dist/ScrollStory.js +3 -3
- package/dist/SimpleLineChart.cjs +1 -1
- package/dist/SimpleLineChart.js +13 -13
- package/dist/SingleGraphDashboard.cjs +1 -1
- package/dist/SingleGraphDashboard.d.ts +1 -0
- package/dist/SingleGraphDashboard.js +6 -6
- package/dist/SingleGraphDashboardFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardFromConfig.js +2 -2
- package/dist/SingleGraphDashboardGeoHubMaps.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMaps.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMaps.js +2 -2
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardGeoHubMapsFromConfig.js +2 -2
- package/dist/SingleGraphDashboardThreeDGraphs.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.cjs.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphs.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphs.js +14 -13
- package/dist/SingleGraphDashboardThreeDGraphs.js.map +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.cjs +1 -1
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.d.ts +1 -0
- package/dist/SingleGraphDashboardThreeDGraphsFromConfig.js +2 -2
- package/dist/SlopeChart.cjs +1 -1
- package/dist/SlopeChart.js +26 -26
- package/dist/Source.cjs +1 -1
- package/dist/Source.js +2 -2
- package/dist/SparkLine.cjs +1 -1
- package/dist/SparkLine.js +2 -2
- package/dist/{Spinner-C85UF28E.js → Spinner-Bpz70q_g.js} +2 -2
- package/dist/{Spinner-C85UF28E.js.map → Spinner-Bpz70q_g.js.map} +1 -1
- package/dist/{Spinner-DA6Z5E4n.cjs → Spinner-C6wLp85s.cjs} +2 -2
- package/dist/{Spinner-DA6Z5E4n.cjs.map → Spinner-C6wLp85s.cjs.map} +1 -1
- package/dist/StatCardFromData.cjs +1 -1
- package/dist/StatCardFromData.js +2 -2
- package/dist/StripChart.cjs +1 -1
- package/dist/StripChart.js +29 -29
- package/dist/ThreeDGlobe.cjs +1 -1
- package/dist/ThreeDGlobe.cjs.map +1 -1
- package/dist/ThreeDGlobe.d.ts +2 -0
- package/dist/ThreeDGlobe.js +220 -228
- package/dist/ThreeDGlobe.js.map +1 -1
- package/dist/ThresholdColorLegendWithMouseOver.cjs +1 -1
- package/dist/ThresholdColorLegendWithMouseOver.js +2 -2
- package/dist/{Tooltip-CVCGWyzw.js → Tooltip-6LIdPQGC.js} +2 -2
- package/dist/{Tooltip-CVCGWyzw.js.map → Tooltip-6LIdPQGC.js.map} +1 -1
- package/dist/{Tooltip-De16GWhY.cjs → Tooltip-Cpv0QohJ.cjs} +2 -2
- package/dist/{Tooltip-De16GWhY.cjs.map → Tooltip-Cpv0QohJ.cjs.map} +1 -1
- package/dist/TreeMapGraph.cjs +1 -1
- package/dist/TreeMapGraph.js +24 -24
- package/dist/Types.d.ts +1 -0
- package/dist/{Typography-k-kOjICQ.cjs → Typography-BDULiwlF.cjs} +2 -2
- package/dist/{Typography-k-kOjICQ.cjs.map → Typography-BDULiwlF.cjs.map} +1 -1
- package/dist/{Typography-Ctgfl1J5.js → Typography-LmZ9LEpe.js} +2 -2
- package/dist/{Typography-Ctgfl1J5.js.map → Typography-LmZ9LEpe.js.map} +1 -1
- package/dist/UnitChart.cjs +1 -1
- package/dist/UnitChart.js +5 -5
- package/dist/{XAxesLabels-Drf7M3YK.cjs → XAxesLabels-CLZnBgSr.cjs} +2 -2
- package/dist/{XAxesLabels-Drf7M3YK.cjs.map → XAxesLabels-CLZnBgSr.cjs.map} +1 -1
- package/dist/{XAxesLabels-loO78vUO.js → XAxesLabels-SOSmso5J.js} +3 -3
- package/dist/{XAxesLabels-loO78vUO.js.map → XAxesLabels-SOSmso5J.js.map} +1 -1
- package/dist/{XTicksAndGridLines-Bn9u5gOM.js → XTicksAndGridLines-DuydSnZ_.js} +2 -2
- package/dist/{XTicksAndGridLines-Bn9u5gOM.js.map → XTicksAndGridLines-DuydSnZ_.js.map} +1 -1
- package/dist/{XTicksAndGridLines-CCzXIV8d.cjs → XTicksAndGridLines-RKy7BVCO.cjs} +2 -2
- package/dist/{XTicksAndGridLines-CCzXIV8d.cjs.map → XTicksAndGridLines-RKy7BVCO.cjs.map} +1 -1
- package/dist/{YAxesLabels-DECkMgq8.js → YAxesLabels-DlDyLvhi.js} +3 -3
- package/dist/{YAxesLabels-DECkMgq8.js.map → YAxesLabels-DlDyLvhi.js.map} +1 -1
- package/dist/{YAxesLabels-yRFFdx1s.cjs → YAxesLabels-Dqd259-t.cjs} +2 -2
- package/dist/{YAxesLabels-yRFFdx1s.cjs.map → YAxesLabels-Dqd259-t.cjs.map} +1 -1
- package/dist/{YTicksAndGridLines-B6ah7CRf.js → YTicksAndGridLines-7t4MKtGw.js} +2 -2
- package/dist/{YTicksAndGridLines-B6ah7CRf.js.map → YTicksAndGridLines-7t4MKtGw.js.map} +1 -1
- package/dist/{YTicksAndGridLines-DBDuz6vb.cjs → YTicksAndGridLines-qGpRo_t1.cjs} +2 -2
- package/dist/{YTicksAndGridLines-DBDuz6vb.cjs.map → YTicksAndGridLines-qGpRo_t1.cjs.map} +1 -1
- package/dist/checkIfMultiple-Dko_cBvE.cjs +12 -0
- package/dist/checkIfMultiple-Dko_cBvE.cjs.map +1 -0
- package/dist/{checkIfMultiple-ChTJk2Tk.js → checkIfMultiple-u2SmbiCf.js} +11 -11
- package/dist/checkIfMultiple-u2SmbiCf.js.map +1 -0
- package/dist/{customArea-CK768gCn.cjs → customArea-1G1S78s_.cjs} +2 -2
- package/dist/{customArea-CK768gCn.cjs.map → customArea-1G1S78s_.cjs.map} +1 -1
- package/dist/{customArea-B-dWU0zZ.js → customArea-x4L4xwLl.js} +3 -3
- package/dist/{customArea-B-dWU0zZ.js.map → customArea-x4L4xwLl.js.map} +1 -1
- package/dist/getSliderMarks-CUxPy36E.cjs +6 -0
- package/dist/getSliderMarks-CUxPy36E.cjs.map +1 -0
- package/dist/{getSliderMarks-9cNoRkDx.js → getSliderMarks-_pYOWEtO.js} +3 -3
- package/dist/getSliderMarks-_pYOWEtO.js.map +1 -0
- package/dist/{index-BYzIB5V6.cjs → index-BHe3wsWF.cjs} +2 -2
- package/dist/{index-BYzIB5V6.cjs.map → index-BHe3wsWF.cjs.map} +1 -1
- package/dist/{index-DKCxu1Gh.js → index-Bw_eHBVN.js} +3 -3
- package/dist/{index-DKCxu1Gh.js.map → index-Bw_eHBVN.js.map} +1 -1
- package/dist/{index-BW_-wD2k.cjs → index-C0bpbS4F.cjs} +2 -2
- package/dist/{index-BW_-wD2k.cjs.map → index-C0bpbS4F.cjs.map} +1 -1
- package/dist/{index-37q0ULNQ.js → index-CE9pmfxt.js} +17 -17
- package/dist/{index-37q0ULNQ.js.map → index-CE9pmfxt.js.map} +1 -1
- package/dist/{index-CVlCtJbC.cjs → index-CEJwW3lL.cjs} +2 -2
- package/dist/{index-CVlCtJbC.cjs.map → index-CEJwW3lL.cjs.map} +1 -1
- package/dist/{index-CHPV5EwG-BPSP-7Jg.js → index-CHPV5EwG-DBWUSD9b.js} +539 -543
- package/dist/index-CHPV5EwG-DBWUSD9b.js.map +1 -0
- package/dist/index-CHPV5EwG-DjM48pIC.cjs +44 -0
- package/dist/index-CHPV5EwG-DjM48pIC.cjs.map +1 -0
- package/dist/{index-BW8iNx7E.cjs → index-Cm8NIdOO.cjs} +2 -2
- package/dist/{index-BW8iNx7E.cjs.map → index-Cm8NIdOO.cjs.map} +1 -1
- package/dist/{index-tvAyXPPW-DBlMKnNB.js → index-Cw8sCyo_-BuI_jX5Z.js} +3 -3
- package/dist/{index-tvAyXPPW-DBlMKnNB.js.map → index-Cw8sCyo_-BuI_jX5Z.js.map} +1 -1
- package/dist/index-Cw8sCyo_-gxT8ADyn.cjs +2 -0
- package/dist/index-Cw8sCyo_-gxT8ADyn.cjs.map +1 -0
- package/dist/{index-CNvov0eg.js → index-Cwgh7i7X.js} +3 -3
- package/dist/{index-CNvov0eg.js.map → index-Cwgh7i7X.js.map} +1 -1
- package/dist/{index-DG3YrCr5-D3FrrXj8.js → index-Dzc_aaI9-BKklH89r.js} +2 -2
- package/dist/{index-DG3YrCr5-D3FrrXj8.js.map → index-Dzc_aaI9-BKklH89r.js.map} +1 -1
- package/dist/{index-DG3YrCr5-v7rayV3N.cjs → index-Dzc_aaI9-RIk2GRHD.cjs} +2 -2
- package/dist/{index-DG3YrCr5-v7rayV3N.cjs.map → index-Dzc_aaI9-RIk2GRHD.cjs.map} +1 -1
- package/dist/{index-BmCqpO1B.js → index-zZjQEHlm.js} +2 -2
- package/dist/{index-BmCqpO1B.js.map → index-zZjQEHlm.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +1 -1
- package/dist/{proxy-CkpFesk1.js → proxy-BYIC9BuT.js} +2 -2
- package/dist/{proxy-CkpFesk1.js.map → proxy-BYIC9BuT.js.map} +1 -1
- package/dist/{proxy-BHRoeZgd.cjs → proxy-CKadx4lC.cjs} +2 -2
- package/dist/{proxy-BHRoeZgd.cjs.map → proxy-CKadx4lC.cjs.map} +1 -1
- package/dist/style.css +1 -1
- package/dist/{use-in-view-sQJZ_xDO.cjs → use-in-view-CEwlc_dd.cjs} +2 -2
- package/dist/{use-in-view-sQJZ_xDO.cjs.map → use-in-view-CEwlc_dd.cjs.map} +1 -1
- package/dist/{use-in-view-yS6jzJAp.js → use-in-view-DR-UTB96.js} +2 -2
- package/dist/{use-in-view-yS6jzJAp.js.map → use-in-view-DR-UTB96.js.map} +1 -1
- package/package.json +4 -4
- package/dist/DropdownSelect-CtOKZHD0.js.map +0 -1
- package/dist/DropdownSelect-DBDM64B5.cjs.map +0 -1
- package/dist/GraphEl-C6yjl1VM.cjs +0 -2
- package/dist/GraphEl-C6yjl1VM.cjs.map +0 -1
- package/dist/GraphEl-CqWzvOyr.js.map +0 -1
- package/dist/Modal-DVVwpKhP.js.map +0 -1
- package/dist/Modal-tXZlLE5s.cjs +0 -46
- package/dist/Modal-tXZlLE5s.cjs.map +0 -1
- package/dist/checkIfMultiple-BXbHUCWM.cjs +0 -12
- package/dist/checkIfMultiple-BXbHUCWM.cjs.map +0 -1
- package/dist/checkIfMultiple-ChTJk2Tk.js.map +0 -1
- package/dist/getSliderMarks-9cNoRkDx.js.map +0 -1
- package/dist/getSliderMarks-CRIbTGYV.cjs +0 -6
- package/dist/getSliderMarks-CRIbTGYV.cjs.map +0 -1
- package/dist/index-CHPV5EwG-BPSP-7Jg.js.map +0 -1
- package/dist/index-CHPV5EwG-DDoeWRVt.cjs +0 -44
- package/dist/index-CHPV5EwG-DDoeWRVt.cjs.map +0 -1
- package/dist/index-tvAyXPPW-DPOG-C2i.cjs +0 -2
- package/dist/index-tvAyXPPW-DPOG-C2i.cjs.map +0 -1
package/dist/AreaChart.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DDoeWRVt.cjs"),h=require("react"),m=require("./parse-hMnG_lRV.cjs"),ue=require("./index-CSNtgibC.cjs"),de=require("./index-CQ3e6Ewi.cjs"),he=require("./numberFormattingFunction-02t-wJta.cjs"),fe=require("./Tooltip-De16GWhY.cjs"),Z=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),me=require("./customArea-CK768gCn.cjs"),ye=require("./AxisTitle-CK9YeovX.cjs"),je=require("./Axis-DE7dSn1_.cjs"),ve=require("./XTicksAndGridLines-CCzXIV8d.cjs"),we=require("./ReferenceLine-CFVBBN__.cjs"),Re=require("./YTicksAndGridLines-DBDuz6vb.cjs"),Ee=require("./index-BYzIB5V6.cjs"),Ae=require("./time-Byw_jYQ7.cjs"),Ce=require("./linear-BVckp9RD.cjs"),be=require("./area-D3Qx7k7K.cjs"),Oe=require("./line-DHV4JwCR.cjs"),ee=require("./step-BZ3C8QFW.cjs"),qe=require("./select-Bnfk0lJx.cjs"),Ne=require("./init-DU0ybBc_.cjs"),Se=require("./pointer-Dkq5NV1q.cjs"),$e=require("./use-in-view-sQJZ_xDO.cjs"),te=require("./proxy-BHRoeZgd.cjs"),ke=require("./index-BW8iNx7E.cjs"),Le=require("./GraphFooter.cjs"),Te=require("./GraphHeader.cjs"),De=require("./ColorLegend.cjs"),Me=require("./Colors.cjs"),Fe=require("./EmptyState-d8_8SxeW.cjs");function He(se){const{data:w,width:R,height:q,colors:G,dateFormat:o,noOfXTicks:N,rightMargin:a,leftMargin:f,topMargin:ie,bottomMargin:re,yAxisTitle:P,tooltip:D,onSeriesMouseOver:p,highlightAreaSettings:oe,refValues:V,minValue:I,maxValue:Y,rtl:W,annotations:ne,customHighlightAreaSettings:ae,noOfYTicks:S,prefix:M,suffix:F,curveType:$,styles:g,classNames:d,precision:k,customLayers:H,animate:y}=se,E=h.useRef(null),j=$e.useInView(E,{once:y.once,amount:y.amount}),le=$==="linear"?Oe.curveLinear:$==="step"?ee.curveStep:$==="stepAfter"?ee.stepAfter:$==="stepBefore"?ee.stepBefore:ee.monotoneX,[b,X]=h.useState(void 0),[U,B]=h.useState(void 0),[_,z]=h.useState(void 0),c={top:ie,bottom:re,left:P?f+30:f,right:a},J=h.useRef(null),i=de.orderBy(w.map(e=>({...e,date:m.parse(`${e.date}`,o,new Date)})),["date"],["asc"]),A=oe.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,o,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,o,new Date)]})),ce=ae.map(e=>({...e,coordinates:e.coordinates.map((n,l)=>l%2===0?m.parse(`${n}`,o,new Date):n)})),xe=i[0].y.map((e,n)=>i.map(l=>({date:l.date,y0:n===0?0:ue.sum(l.y.filter((T,O)=>O<n)),y1:ue.sum(l.y.filter((T,O)=>O<=n))}))),v=R-c.left-c.right,x=q-c.top-c.bottom,K=i[0].date,Q=i[i.length-1].date,u=Z.checkIfNullOrUndefined(I)?0:I,C=Z.checkIfNullOrUndefined(Y)?Math.max(...w.map(e=>ue.sum(e.y)||0)):Y,r=Ae.time().domain([K,Q]).range([0,v]),s=Ce.linear().domain([u,C]).range([x,0]).nice(),L=be.area().x(e=>r(e.date)).y0(e=>s(e.y0)).y1(e=>s(e.y1)).curve(le),pe=s.ticks(S),ge=r.ticks(N);return h.useEffect(()=>{const e=l=>{const T=i[Ne.bisectCenter(i.map(O=>O.date),r.invert(Se.pointer(l)[0]),0)];X(T||i[i.length-1]),p?.(T||i[i.length-1]),z(l.clientY),B(l.clientX)},n=()=>{X(void 0),B(void 0),z(void 0),p?.(void 0)};qe.select(J.current).on("mousemove",e).on("mouseout",n),p?.(void 0)},[r,i,p]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(te.motion.svg,{width:`${R}px`,height:`${q}px`,viewBox:`0 0 ${R} ${q}`,direction:"ltr",ref:E,children:t.jsxRuntimeExports.jsx(ke.AnimatePresence,{children:t.jsxRuntimeExports.jsxs(te.motion.g,{transform:`translate(${c.left},${c.top})`,children:[t.jsxRuntimeExports.jsx(Ee.HighlightArea,{areaSettings:A,width:v,height:x,scale:r,animate:y,isInView:j}),t.jsxRuntimeExports.jsx(me.CustomArea,{animate:y,areaSettings:ce,scaleX:r,scaleY:s,isInView:j}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Re.YTicksAndGridLines,{values:pe.filter(e=>e!==0),y:pe.filter(e=>e!==0).map(e=>s(e)),x1:0-f,x2:v+c.right,styles:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},classNames:{gridLines:d?.yAxis?.gridLines,labels:d?.yAxis?.labels},suffix:F,prefix:M,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:k}),t.jsxRuntimeExports.jsx(je.Axis,{y1:s(u<0?0:u),y2:s(u<0?0:u),x1:0-f,x2:v+c.right,label:he.numberFormattingFunction(u<0?0:u,"NA",k,M,F),labelPos:{x:0-f,dx:0,dy:C<0?"1em":-5,y:s(u<0?0:u)},classNames:{axis:d?.xAxis?.axis,label:d?.yAxis?.labels},styles:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(ye.AxisTitle,{x:0-f-15,y:x/2,style:g?.yAxis?.title,className:d?.yAxis?.title,text:P,rotate90:!0})]}),t.jsxRuntimeExports.jsx(ve.XTicksAndGridLines,{values:ge.map(e=>m.format(e,o)),x:ge.map(e=>r(e)),y1:0,y2:x,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",d?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs",d?.xAxis?.labels)},suffix:F,prefix:M,labelType:"primary",showGridLines:!0,precision:k}),H.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs(te.motion.g,{children:[xe.map((e,n)=>t.jsxRuntimeExports.jsx(te.motion.path,{d:L(e),exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{d:L(e.map(l=>({...l,y0:0,y1:0}))),opacity:0},whileInView:{d:L(e),opacity:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",style:{fill:G[n],opacity:.8}},n)),b?t.jsxRuntimeExports.jsx("line",{y1:0,y2:x,x1:r(b.date),x2:r(b.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",d?.mouseOverLine),style:g?.mouseOverLine}):null]}),V?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:V.map((e,n)=>t.jsxRuntimeExports.jsx(we.RefLineY,{text:e.text,color:e.color,y:s(e.value),x1:0-f,x2:v+c.right,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n))}):null,t.jsxRuntimeExports.jsx("g",{children:ne.map((e,n)=>{const l=me.getLineEndPoint({x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,y:e.yCoordinate?s(e.yCoordinate):0},Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),T=e.showConnector?{y1:l.y,x1:l.x,y2:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),cx:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,cy:e.yCoordinate?s(e.yCoordinate):0,circleRadius:Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,O={y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0):v+c.right-(e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(me.Annotation,{color:e.color,connectorsSettings:T,labelSettings:O,text:e.text,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n)})}),H.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:J,style:{fill:"none",pointerEvents:"all"},width:v,height:x})]})})}),b&&D&&U&&_?t.jsxRuntimeExports.jsx(fe.Tooltip,{data:b,body:D,xPos:U,yPos:_,backgroundStyle:g?.tooltip,className:d?.tooltip}):null]})}function Ge(se){const{data:w,graphTitle:R,colors:q=Me.Colors.light.categoricalColors.colors,sources:G,graphDescription:o,height:N,width:a,footNote:f,noOfXTicks:ie=10,dateFormat:re="yyyy",colorDomain:P,padding:D,backgroundColor:p=!1,colorLegendTitle:oe,leftMargin:V=50,rightMargin:I=20,topMargin:Y=20,bottomMargin:W=25,highlightAreaSettings:ne=[],tooltip:ae,relativeHeight:S,onSeriesMouseOver:M,refValues:F=[],graphID:$,minValue:g,maxValue:d,graphDownload:k=!1,dataDownload:H=!1,showColorScale:y=!0,language:E="en",minHeight:j=0,annotations:le=[],customHighlightAreaSettings:b=[],theme:X="light",ariaLabel:U,yAxisTitle:B,noOfYTicks:_=5,prefix:z="",suffix:c="",curveType:J="curve",styles:i,classNames:A,precision:ce=2,customLayers:xe=[],animate:v=!1}=se,[x,K]=h.useState(0),[Q,u]=h.useState(0),C=h.useRef(null),r=h.useRef(null);return h.useEffect(()=>{const s=new ResizeObserver(L=>{K(a||L[0].target.clientWidth||620),u(N||L[0].target.clientHeight||480)});return C.current&&(u(C.current.clientHeight||480),K(C.current.clientWidth||620),a||s.observe(C.current)),()=>s.disconnect()},[a,N]),t.jsxRuntimeExports.jsx("div",{className:`${X||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:E==="he"||E==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${p?p===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${E||"en"}`,a?"w-fit":"w-full",A?.graphContainer),style:{...i?.graphContainer||{},...p&&p!==!0?{backgroundColor:p}:{}},id:$,ref:r,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is a stacked area chart that shows trends over time.${o?` ${o}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:p?D||"1rem":D||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||o||k||H?t.jsxRuntimeExports.jsx(Te.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:A?.title,description:A?.description},graphTitle:R,graphDescription:o,width:a,graphDownload:k?r.current:void 0,dataDownload:H?w.map(s=>s.data).filter(s=>s!==void 0).length>0?w.map(s=>s.data).filter(s=>s!==void 0):w.filter(s=>s!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:w.length===0?t.jsxRuntimeExports.jsx(Fe.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[y!==!1?t.jsxRuntimeExports.jsx(De.ColorLegend,{colorDomain:P,colors:q,colorLegendTitle:oe,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:C,"aria-label":"Graph area",children:(a||x)&&(N||Q)?t.jsxRuntimeExports.jsx(He,{data:w,colors:q,width:a||x,height:Math.max(j,N||(S?j?(a||x)*S>j?(a||x)*S:j:(a||x)*S:Q)),dateFormat:re,noOfXTicks:ie,leftMargin:V,rightMargin:I,topMargin:Y,bottomMargin:W,tooltip:ae,onSeriesMouseOver:M,highlightAreaSettings:ne,refValues:F,minValue:g,maxValue:d,rtl:E==="he"||E==="ar",annotations:le,customHighlightAreaSettings:b,yAxisTitle:B,noOfYTicks:_,prefix:z,suffix:c,curveType:J,styles:i,classNames:A,precision:ce,customLayers:xe,animate:v===!0?{duration:.5,once:!0,amount:.5}:v||{duration:0,once:!0,amount:0}}):null})]})}),G||f?t.jsxRuntimeExports.jsx(Le.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:G,footNote:f,width:a}):null]})})})})}exports.AreaChart=Ge;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CHPV5EwG-DjM48pIC.cjs"),h=require("react"),m=require("./parse-hMnG_lRV.cjs"),ue=require("./index-CSNtgibC.cjs"),de=require("./index-CQ3e6Ewi.cjs"),he=require("./numberFormattingFunction-02t-wJta.cjs"),fe=require("./Tooltip-Cpv0QohJ.cjs"),Z=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),me=require("./customArea-1G1S78s_.cjs"),ye=require("./AxisTitle-Wkz-xeQL.cjs"),je=require("./Axis-CkNn1wit.cjs"),ve=require("./XTicksAndGridLines-RKy7BVCO.cjs"),we=require("./ReferenceLine-D04j-zeV.cjs"),Re=require("./YTicksAndGridLines-qGpRo_t1.cjs"),Ee=require("./index-BHe3wsWF.cjs"),Ae=require("./time-Byw_jYQ7.cjs"),Ce=require("./linear-BVckp9RD.cjs"),be=require("./area-D3Qx7k7K.cjs"),Oe=require("./line-DHV4JwCR.cjs"),ee=require("./step-BZ3C8QFW.cjs"),qe=require("./select-Bnfk0lJx.cjs"),Ne=require("./init-DU0ybBc_.cjs"),Se=require("./pointer-Dkq5NV1q.cjs"),$e=require("./use-in-view-CEwlc_dd.cjs"),te=require("./proxy-CKadx4lC.cjs"),ke=require("./index-Cm8NIdOO.cjs"),Le=require("./GraphFooter.cjs"),Te=require("./GraphHeader.cjs"),De=require("./ColorLegend.cjs"),Me=require("./Colors.cjs"),Fe=require("./EmptyState-B8IpKGcL.cjs");function He(se){const{data:w,width:R,height:q,colors:G,dateFormat:o,noOfXTicks:N,rightMargin:a,leftMargin:f,topMargin:ie,bottomMargin:re,yAxisTitle:P,tooltip:D,onSeriesMouseOver:p,highlightAreaSettings:oe,refValues:V,minValue:I,maxValue:Y,rtl:W,annotations:ne,customHighlightAreaSettings:ae,noOfYTicks:S,prefix:M,suffix:F,curveType:$,styles:g,classNames:d,precision:k,customLayers:H,animate:y}=se,E=h.useRef(null),j=$e.useInView(E,{once:y.once,amount:y.amount}),le=$==="linear"?Oe.curveLinear:$==="step"?ee.curveStep:$==="stepAfter"?ee.stepAfter:$==="stepBefore"?ee.stepBefore:ee.monotoneX,[b,X]=h.useState(void 0),[U,B]=h.useState(void 0),[_,z]=h.useState(void 0),c={top:ie,bottom:re,left:P?f+30:f,right:a},J=h.useRef(null),i=de.orderBy(w.map(e=>({...e,date:m.parse(`${e.date}`,o,new Date)})),["date"],["asc"]),A=oe.map(e=>({...e,coordinates:[e.coordinates[0]===null?null:m.parse(`${e.coordinates[0]}`,o,new Date),e.coordinates[1]===null?null:m.parse(`${e.coordinates[1]}`,o,new Date)]})),ce=ae.map(e=>({...e,coordinates:e.coordinates.map((n,l)=>l%2===0?m.parse(`${n}`,o,new Date):n)})),xe=i[0].y.map((e,n)=>i.map(l=>({date:l.date,y0:n===0?0:ue.sum(l.y.filter((T,O)=>O<n)),y1:ue.sum(l.y.filter((T,O)=>O<=n))}))),v=R-c.left-c.right,x=q-c.top-c.bottom,K=i[0].date,Q=i[i.length-1].date,u=Z.checkIfNullOrUndefined(I)?0:I,C=Z.checkIfNullOrUndefined(Y)?Math.max(...w.map(e=>ue.sum(e.y)||0)):Y,r=Ae.time().domain([K,Q]).range([0,v]),s=Ce.linear().domain([u,C]).range([x,0]).nice(),L=be.area().x(e=>r(e.date)).y0(e=>s(e.y0)).y1(e=>s(e.y1)).curve(le),pe=s.ticks(S),ge=r.ticks(N);return h.useEffect(()=>{const e=l=>{const T=i[Ne.bisectCenter(i.map(O=>O.date),r.invert(Se.pointer(l)[0]),0)];X(T||i[i.length-1]),p?.(T||i[i.length-1]),z(l.clientY),B(l.clientX)},n=()=>{X(void 0),B(void 0),z(void 0),p?.(void 0)};qe.select(J.current).on("mousemove",e).on("mouseout",n),p?.(void 0)},[r,i,p]),t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[t.jsxRuntimeExports.jsx(te.motion.svg,{width:`${R}px`,height:`${q}px`,viewBox:`0 0 ${R} ${q}`,direction:"ltr",ref:E,children:t.jsxRuntimeExports.jsx(ke.AnimatePresence,{children:t.jsxRuntimeExports.jsxs(te.motion.g,{transform:`translate(${c.left},${c.top})`,children:[t.jsxRuntimeExports.jsx(Ee.HighlightArea,{areaSettings:A,width:v,height:x,scale:r,animate:y,isInView:j}),t.jsxRuntimeExports.jsx(me.CustomArea,{animate:y,areaSettings:ce,scaleX:r,scaleY:s,isInView:j}),t.jsxRuntimeExports.jsxs("g",{children:[t.jsxRuntimeExports.jsx(Re.YTicksAndGridLines,{values:pe.filter(e=>e!==0),y:pe.filter(e=>e!==0).map(e=>s(e)),x1:0-f,x2:v+c.right,styles:{gridLines:g?.yAxis?.gridLines,labels:g?.yAxis?.labels},classNames:{gridLines:d?.yAxis?.gridLines,labels:d?.yAxis?.labels},suffix:F,prefix:M,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:k}),t.jsxRuntimeExports.jsx(je.Axis,{y1:s(u<0?0:u),y2:s(u<0?0:u),x1:0-f,x2:v+c.right,label:he.numberFormattingFunction(u<0?0:u,"NA",k,M,F),labelPos:{x:0-f,dx:0,dy:C<0?"1em":-5,y:s(u<0?0:u)},classNames:{axis:d?.xAxis?.axis,label:d?.yAxis?.labels},styles:{axis:g?.xAxis?.axis,label:g?.yAxis?.labels}}),t.jsxRuntimeExports.jsx(ye.AxisTitle,{x:0-f-15,y:x/2,style:g?.yAxis?.title,className:d?.yAxis?.title,text:P,rotate90:!0})]}),t.jsxRuntimeExports.jsx(ve.XTicksAndGridLines,{values:ge.map(e=>m.format(e,o)),x:ge.map(e=>r(e)),y1:0,y2:x,styles:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},classNames:{gridLines:t.mo("opacity-0",d?.xAxis?.gridLines),labels:t.mo("fill-primary-gray-700 dark:fill-primary-gray-300 xs:max-[360px]:hidden text-[8px] sm:text-[9px] md:text-[10px] lg:text-xs",d?.xAxis?.labels)},suffix:F,prefix:M,labelType:"primary",showGridLines:!0,precision:k}),H.filter(e=>e.position==="before").map(e=>e.layer),t.jsxRuntimeExports.jsxs(te.motion.g,{children:[xe.map((e,n)=>t.jsxRuntimeExports.jsx(te.motion.path,{d:L(e),exit:{opacity:0,transition:{duration:y.duration}},variants:{initial:{d:L(e.map(l=>({...l,y0:0,y1:0}))),opacity:0},whileInView:{d:L(e),opacity:1,transition:{duration:y.duration}}},initial:"initial",animate:j?"whileInView":"initial",style:{fill:G[n],opacity:.8}},n)),b?t.jsxRuntimeExports.jsx("line",{y1:0,y2:x,x1:r(b.date),x2:r(b.date),className:t.mo("undp-tick-line stroke-primary-gray-700 dark:stroke-primary-gray-100",d?.mouseOverLine),style:g?.mouseOverLine}):null]}),V?t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:V.map((e,n)=>t.jsxRuntimeExports.jsx(we.RefLineY,{text:e.text,color:e.color,y:s(e.value),x1:0-f,x2:v+c.right,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n))}):null,t.jsxRuntimeExports.jsx("g",{children:ne.map((e,n)=>{const l=me.getLineEndPoint({x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8},{x:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,y:e.yCoordinate?s(e.yCoordinate):0},Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius),T=e.showConnector?{y1:l.y,x1:l.x,y2:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0):0+(e.yOffset||0),x2:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),cx:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date)):0,cy:e.yCoordinate?s(e.yCoordinate):0,circleRadius:Z.checkIfNullOrUndefined(e.connectorRadius)?3.5:e.connectorRadius,strokeWidth:e.showConnector===!0?2:Math.min(e.showConnector||0,1)}:void 0,O={y:e.yCoordinate?s(e.yCoordinate)+(e.yOffset||0)-8:0+(e.yOffset||0)-8,x:W?0:e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0),width:W?e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0):v+c.right-(e.xCoordinate?r(m.parse(`${e.xCoordinate}`,o,new Date))+(e.xOffset||0):0+(e.xOffset||0)),maxWidth:e.maxWidth,fontWeight:e.fontWeight,align:e.align};return t.jsxRuntimeExports.jsx(me.Annotation,{color:e.color,connectorsSettings:T,labelSettings:O,text:e.text,classNames:e.classNames,styles:e.styles,animate:y,isInView:j},n)})}),H.filter(e=>e.position==="after").map(e=>e.layer),t.jsxRuntimeExports.jsx("rect",{ref:J,style:{fill:"none",pointerEvents:"all"},width:v,height:x})]})})}),b&&D&&U&&_?t.jsxRuntimeExports.jsx(fe.Tooltip,{data:b,body:D,xPos:U,yPos:_,backgroundStyle:g?.tooltip,className:d?.tooltip}):null]})}function Ge(se){const{data:w,graphTitle:R,colors:q=Me.Colors.light.categoricalColors.colors,sources:G,graphDescription:o,height:N,width:a,footNote:f,noOfXTicks:ie=10,dateFormat:re="yyyy",colorDomain:P,padding:D,backgroundColor:p=!1,colorLegendTitle:oe,leftMargin:V=50,rightMargin:I=20,topMargin:Y=20,bottomMargin:W=25,highlightAreaSettings:ne=[],tooltip:ae,relativeHeight:S,onSeriesMouseOver:M,refValues:F=[],graphID:$,minValue:g,maxValue:d,graphDownload:k=!1,dataDownload:H=!1,showColorScale:y=!0,language:E="en",minHeight:j=0,annotations:le=[],customHighlightAreaSettings:b=[],theme:X="light",ariaLabel:U,yAxisTitle:B,noOfYTicks:_=5,prefix:z="",suffix:c="",curveType:J="curve",styles:i,classNames:A,precision:ce=2,customLayers:xe=[],animate:v=!1}=se,[x,K]=h.useState(0),[Q,u]=h.useState(0),C=h.useRef(null),r=h.useRef(null);return h.useEffect(()=>{const s=new ResizeObserver(L=>{K(a||L[0].target.clientWidth||620),u(N||L[0].target.clientHeight||480)});return C.current&&(u(C.current.clientHeight||480),K(C.current.clientWidth||620),a||s.observe(C.current)),()=>s.disconnect()},[a,N]),t.jsxRuntimeExports.jsx("div",{className:`${X||"light"} flex ${a?"w-fit grow-0":"w-full grow"}`,dir:E==="he"||E==="ar"?"rtl":void 0,children:t.jsxRuntimeExports.jsx("div",{className:t.mo(`${p?p===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${E||"en"}`,a?"w-fit":"w-full",A?.graphContainer),style:{...i?.graphContainer||{},...p&&p!==!0?{backgroundColor:p}:{}},id:$,ref:r,"aria-label":U||`${R?`The graph shows ${R}. `:""}This is a stacked area chart that shows trends over time.${o?` ${o}`:""}`,children:t.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:p?D||"1rem":D||0},children:t.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[R||o||k||H?t.jsxRuntimeExports.jsx(Te.GraphHeader,{styles:{title:i?.title,description:i?.description},classNames:{title:A?.title,description:A?.description},graphTitle:R,graphDescription:o,width:a,graphDownload:k?r.current:void 0,dataDownload:H?w.map(s=>s.data).filter(s=>s!==void 0).length>0?w.map(s=>s.data).filter(s=>s!==void 0):w.filter(s=>s!==void 0):null}):null,t.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:w.length===0?t.jsxRuntimeExports.jsx(Fe.EmptyState,{}):t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[y!==!1?t.jsxRuntimeExports.jsx(De.ColorLegend,{colorDomain:P,colors:q,colorLegendTitle:oe,showNAColor:!1}):null,t.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:C,"aria-label":"Graph area",children:(a||x)&&(N||Q)?t.jsxRuntimeExports.jsx(He,{data:w,colors:q,width:a||x,height:Math.max(j,N||(S?j?(a||x)*S>j?(a||x)*S:j:(a||x)*S:Q)),dateFormat:re,noOfXTicks:ie,leftMargin:V,rightMargin:I,topMargin:Y,bottomMargin:W,tooltip:ae,onSeriesMouseOver:M,highlightAreaSettings:ne,refValues:F,minValue:g,maxValue:d,rtl:E==="he"||E==="ar",annotations:le,customHighlightAreaSettings:b,yAxisTitle:B,noOfYTicks:_,prefix:z,suffix:c,curveType:J,styles:i,classNames:A,precision:ce,customLayers:xe,animate:v===!0?{duration:.5,once:!0,amount:.5}:v||{duration:0,once:!0,amount:0}}):null})]})}),G||f?t.jsxRuntimeExports.jsx(Le.GraphFooter,{styles:{footnote:i?.footnote,source:i?.source},classNames:{footnote:A?.footnote,source:A?.source},sources:G,footNote:f,width:a}):null]})})})})}exports.AreaChart=Ge;
|
|
2
2
|
//# sourceMappingURL=AreaChart.cjs.map
|
package/dist/AreaChart.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { j as t, m as te } from "./index-CHPV5EwG-
|
|
1
|
+
import { j as t, m as te } from "./index-CHPV5EwG-DBWUSD9b.js";
|
|
2
2
|
import { useRef as ae, useState as P, useEffect as he } from "react";
|
|
3
3
|
import { p as h, f as ue } from "./parse-DlCRUFh_.js";
|
|
4
4
|
import { s as fe } from "./index-CeVNqhMO.js";
|
|
5
5
|
import { o as de } from "./index-DvVprvy6.js";
|
|
6
6
|
import { n as ye } from "./numberFormattingFunction-14YCbkN2.js";
|
|
7
|
-
import { T as ve } from "./Tooltip-
|
|
7
|
+
import { T as ve } from "./Tooltip-6LIdPQGC.js";
|
|
8
8
|
import { c as Z } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
9
|
-
import { C as we, g as Ae, A as Ce } from "./customArea-
|
|
10
|
-
import { A as be } from "./AxisTitle-
|
|
11
|
-
import { A as je } from "./Axis-
|
|
12
|
-
import { X as Oe } from "./XTicksAndGridLines-
|
|
13
|
-
import { R as $e } from "./ReferenceLine-
|
|
14
|
-
import { Y as Ne } from "./YTicksAndGridLines-
|
|
15
|
-
import { H as De } from "./index-
|
|
9
|
+
import { C as we, g as Ae, A as Ce } from "./customArea-x4L4xwLl.js";
|
|
10
|
+
import { A as be } from "./AxisTitle-v6_xcXZ-.js";
|
|
11
|
+
import { A as je } from "./Axis-4gUOL8B7.js";
|
|
12
|
+
import { X as Oe } from "./XTicksAndGridLines-DuydSnZ_.js";
|
|
13
|
+
import { R as $e } from "./ReferenceLine-CPMaAX0r.js";
|
|
14
|
+
import { Y as Ne } from "./YTicksAndGridLines-7t4MKtGw.js";
|
|
15
|
+
import { H as De } from "./index-Bw_eHBVN.js";
|
|
16
16
|
import { t as Le } from "./time-BzJP5SPC.js";
|
|
17
17
|
import { a as ke } from "./linear-DUdu7l2G.js";
|
|
18
18
|
import { a as Se } from "./area-BE2wo7fv.js";
|
|
@@ -21,14 +21,14 @@ import { c as Me, s as He, a as Re, m as Fe } from "./step-BrDul-H4.js";
|
|
|
21
21
|
import { s as Ye } from "./select-DKy99ogv.js";
|
|
22
22
|
import { a as Pe } from "./init-BhZylTFx.js";
|
|
23
23
|
import { p as Ve } from "./pointer-CWRWOsrb.js";
|
|
24
|
-
import { u as We } from "./use-in-view-
|
|
25
|
-
import { m as ee } from "./proxy-
|
|
26
|
-
import { A as Xe } from "./index-
|
|
24
|
+
import { u as We } from "./use-in-view-DR-UTB96.js";
|
|
25
|
+
import { m as ee } from "./proxy-BYIC9BuT.js";
|
|
26
|
+
import { A as Xe } from "./index-Cwgh7i7X.js";
|
|
27
27
|
import { GraphFooter as Ee } from "./GraphFooter.js";
|
|
28
28
|
import { GraphHeader as Ge } from "./GraphHeader.js";
|
|
29
29
|
import { ColorLegend as Ie } from "./ColorLegend.js";
|
|
30
30
|
import { Colors as Be } from "./Colors.js";
|
|
31
|
-
import { E as _e } from "./EmptyState-
|
|
31
|
+
import { E as _e } from "./EmptyState-36lXXyui.js";
|
|
32
32
|
function ze(oe) {
|
|
33
33
|
const {
|
|
34
34
|
data: w,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as s, m as t } from "./index-CHPV5EwG-
|
|
1
|
+
import { j as s, m as t } from "./index-CHPV5EwG-DBWUSD9b.js";
|
|
2
2
|
import { c as n } from "./checkIfNullOrUndefined-DmfiKkNw.js";
|
|
3
3
|
function p(x) {
|
|
4
4
|
const { label: a, x2: i, y2: y, x1: m, y1: o, classNames: e, styles: l, labelPos: r } = x;
|
|
@@ -40,4 +40,4 @@ function p(x) {
|
|
|
40
40
|
export {
|
|
41
41
|
p as A
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=Axis-
|
|
43
|
+
//# sourceMappingURL=Axis-4gUOL8B7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis-
|
|
1
|
+
{"version":3,"file":"Axis-4gUOL8B7.js","sources":["../src/Components/Elements/Axes/Axis.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n label?: string;\r\n labelPos?: { x: number; y: number; dy: string | number; dx: string | number };\r\n y1: number;\r\n x1: number;\r\n y2: number;\r\n x2: number;\r\n classNames?: { axis?: string; label?: string };\r\n styles?: { axis?: React.CSSProperties; label?: React.CSSProperties };\r\n}\r\n\r\nexport function Axis(props: Props) {\r\n const { label, x2, y2, x1, y1, classNames, styles, labelPos } = props;\r\n return (\r\n <>\r\n <line\r\n y1={y1}\r\n y2={y2}\r\n x1={x1}\r\n x2={x2}\r\n style={styles?.axis}\r\n className={cn(\r\n 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300',\r\n classNames?.axis,\r\n )}\r\n />\r\n {!checkIfNullOrUndefined(label) ? (\r\n <text\r\n x={labelPos?.x}\r\n y={labelPos?.y}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.label || ''),\r\n }}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.label,\r\n )}\r\n dy={labelPos?.dy}\r\n dx={labelPos?.dx}\r\n >\r\n {label}\r\n </text>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n"],"names":["Axis","props","label","x2","y2","x1","y1","classNames","styles","labelPos","jsxs","Fragment","jsx","cn","checkIfNullOrUndefined"],"mappings":";;AAeO,SAASA,EAAKC,GAAc;AACjC,QAAM,EAAE,OAAAC,GAAO,IAAAC,GAAI,IAAAC,GAAI,IAAAC,GAAI,IAAAC,GAAI,YAAAC,GAAY,QAAAC,GAAQ,UAAAC,EAAA,IAAaR;AAChE,SACES,gBAAAA,EAAAA,KAAAC,YAAA,EACE,UAAA;AAAA,IAAAC,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAAN;AAAA,QACA,IAAAF;AAAA,QACA,IAAAC;AAAA,QACA,IAAAF;AAAA,QACA,OAAOK,GAAQ;AAAA,QACf,WAAWK;AAAAA,UACT;AAAA,UACAN,GAAY;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,IAEAO,EAAuBZ,CAAK,IAiB1B,OAhBFU,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,GAAGH,GAAU;AAAA,QACb,GAAGA,GAAU;AAAA,QACb,OAAO;AAAA,UACL,YAAY;AAAA,UACZ,GAAID,GAAQ,SAAS;AAAA,QAAA;AAAA,QAEvB,WAAWK;AAAAA,UACT;AAAA,UACAN,GAAY;AAAA,QAAA;AAAA,QAEd,IAAIE,GAAU;AAAA,QACd,IAAIA,GAAU;AAAA,QAEb,UAAAP;AAAA,MAAA;AAAA,IAAA;AAAA,EAED,GACN;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const s=require("./index-CHPV5EwG-
|
|
2
|
-
//# sourceMappingURL=Axis-
|
|
1
|
+
"use strict";const s=require("./index-CHPV5EwG-DjM48pIC.cjs"),c=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs");function o(x){const{label:r,x2:a,y2:i,x1:n,y1:y,classNames:t,styles:l,labelPos:e}=x;return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx("line",{y1:y,y2:i,x1:n,x2:a,style:l?.axis,className:s.mo("stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300",t?.axis)}),c.checkIfNullOrUndefined(r)?null:s.jsxRuntimeExports.jsx("text",{x:e?.x,y:e?.y,style:{textAnchor:"start",...l?.label||""},className:s.mo("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",t?.label),dy:e?.dy,dx:e?.dx,children:r})]})}exports.Axis=o;
|
|
2
|
+
//# sourceMappingURL=Axis-CkNn1wit.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis-
|
|
1
|
+
{"version":3,"file":"Axis-CkNn1wit.cjs","sources":["../src/Components/Elements/Axes/Axis.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\n\r\nimport { checkIfNullOrUndefined } from '@/Utils/checkIfNullOrUndefined';\r\n\r\ninterface Props {\r\n label?: string;\r\n labelPos?: { x: number; y: number; dy: string | number; dx: string | number };\r\n y1: number;\r\n x1: number;\r\n y2: number;\r\n x2: number;\r\n classNames?: { axis?: string; label?: string };\r\n styles?: { axis?: React.CSSProperties; label?: React.CSSProperties };\r\n}\r\n\r\nexport function Axis(props: Props) {\r\n const { label, x2, y2, x1, y1, classNames, styles, labelPos } = props;\r\n return (\r\n <>\r\n <line\r\n y1={y1}\r\n y2={y2}\r\n x1={x1}\r\n x2={x2}\r\n style={styles?.axis}\r\n className={cn(\r\n 'stroke-1 stroke-primary-gray-700 dark:stroke-primary-gray-300',\r\n classNames?.axis,\r\n )}\r\n />\r\n {!checkIfNullOrUndefined(label) ? (\r\n <text\r\n x={labelPos?.x}\r\n y={labelPos?.y}\r\n style={{\r\n textAnchor: 'start',\r\n ...(styles?.label || ''),\r\n }}\r\n className={cn(\r\n 'fill-primary-gray-700 dark:fill-primary-gray-300 text-xs',\r\n classNames?.label,\r\n )}\r\n dy={labelPos?.dy}\r\n dx={labelPos?.dx}\r\n >\r\n {label}\r\n </text>\r\n ) : null}\r\n </>\r\n );\r\n}\r\n"],"names":["Axis","props","label","x2","y2","x1","y1","classNames","styles","labelPos","jsxs","Fragment","jsx","cn","checkIfNullOrUndefined"],"mappings":"iHAeO,SAASA,EAAKC,EAAc,CACjC,KAAM,CAAE,MAAAC,EAAO,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,GAAAC,EAAI,WAAAC,EAAY,OAAAC,EAAQ,SAAAC,CAAA,EAAaR,EAChE,OACES,EAAAA,kBAAAA,KAAAC,6BAAA,CACE,SAAA,CAAAC,EAAAA,kBAAAA,IAAC,OAAA,CACC,GAAAN,EACA,GAAAF,EACA,GAAAC,EACA,GAAAF,EACA,MAAOK,GAAQ,KACf,UAAWK,EAAAA,GACT,gEACAN,GAAY,IAAA,CACd,CAAA,EAEAO,EAAAA,uBAAuBZ,CAAK,EAiB1B,KAhBFU,EAAAA,kBAAAA,IAAC,OAAA,CACC,EAAGH,GAAU,EACb,EAAGA,GAAU,EACb,MAAO,CACL,WAAY,QACZ,GAAID,GAAQ,OAAS,EAAA,EAEvB,UAAWK,EAAAA,GACT,2DACAN,GAAY,KAAA,EAEd,GAAIE,GAAU,GACd,GAAIA,GAAU,GAEb,SAAAP,CAAA,CAAA,CAED,EACN,CAEJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e=require("./index-CHPV5EwG-
|
|
2
|
-
//# sourceMappingURL=AxisTitle-
|
|
1
|
+
"use strict";const e=require("./index-CHPV5EwG-DjM48pIC.cjs");function x(r){const{text:t,x:s,y:i,className:l,style:a,rotate90:n}=r;return t?e.jsxRuntimeExports.jsx("text",{transform:`translate(${s}, ${i})${n?" rotate(-90)":""}`,style:{textAnchor:"middle",...a||{}},className:e.mo("fill-primary-gray-700 dark:fill-primary-gray-300 text-xs",l),children:t}):null}exports.AxisTitle=x;
|
|
2
|
+
//# sourceMappingURL=AxisTitle-Wkz-xeQL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxisTitle-
|
|
1
|
+
{"version":3,"file":"AxisTitle-Wkz-xeQL.cjs","sources":["../src/Components/Elements/Axes/AxisTitle.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\n\r\ninterface Props {\r\n text?: string;\r\n y: number;\r\n x: number;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n rotate90?: boolean;\r\n}\r\n\r\nexport function AxisTitle(props: Props) {\r\n const { text, x, y, className, style, rotate90 } = props;\r\n if (!text) return null;\r\n return (\r\n <text\r\n transform={`translate(${x}, ${y})${rotate90 ? ' rotate(-90)' : ''}`}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(style || {}),\r\n }}\r\n className={cn('fill-primary-gray-700 dark:fill-primary-gray-300 text-xs', className)}\r\n >\r\n {text}\r\n </text>\r\n );\r\n}\r\n"],"names":["AxisTitle","props","text","x","y","className","style","rotate90","jsx","cn"],"mappings":"8DAWO,SAASA,EAAUC,EAAc,CACtC,KAAM,CAAE,KAAAC,EAAM,EAAAC,EAAG,EAAAC,EAAG,UAAAC,EAAW,MAAAC,EAAO,SAAAC,GAAaN,EACnD,OAAKC,EAEHM,EAAAA,kBAAAA,IAAC,OAAA,CACC,UAAW,aAAaL,CAAC,KAAKC,CAAC,IAAIG,EAAW,eAAiB,EAAE,GACjE,MAAO,CACL,WAAY,SACZ,GAAID,GAAS,CAAA,CAAC,EAEhB,UAAWG,EAAAA,GAAG,2DAA4DJ,CAAS,EAElF,SAAAH,CAAA,CAAA,EAVa,IAapB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as m, m as n } from "./index-CHPV5EwG-
|
|
1
|
+
import { j as m, m as n } from "./index-CHPV5EwG-DBWUSD9b.js";
|
|
2
2
|
function x(r) {
|
|
3
3
|
const { text: t, x: e, y: a, className: s, style: l, rotate90: i } = r;
|
|
4
4
|
return t ? /* @__PURE__ */ m.jsx(
|
|
@@ -17,4 +17,4 @@ function x(r) {
|
|
|
17
17
|
export {
|
|
18
18
|
x as A
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=AxisTitle-
|
|
20
|
+
//# sourceMappingURL=AxisTitle-v6_xcXZ-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AxisTitle-
|
|
1
|
+
{"version":3,"file":"AxisTitle-v6_xcXZ-.js","sources":["../src/Components/Elements/Axes/AxisTitle.tsx"],"sourcesContent":["import { cn } from '@undp/design-system-react/cn';\r\n\r\ninterface Props {\r\n text?: string;\r\n y: number;\r\n x: number;\r\n className?: string;\r\n style?: React.CSSProperties;\r\n rotate90?: boolean;\r\n}\r\n\r\nexport function AxisTitle(props: Props) {\r\n const { text, x, y, className, style, rotate90 } = props;\r\n if (!text) return null;\r\n return (\r\n <text\r\n transform={`translate(${x}, ${y})${rotate90 ? ' rotate(-90)' : ''}`}\r\n style={{\r\n textAnchor: 'middle',\r\n ...(style || {}),\r\n }}\r\n className={cn('fill-primary-gray-700 dark:fill-primary-gray-300 text-xs', className)}\r\n >\r\n {text}\r\n </text>\r\n );\r\n}\r\n"],"names":["AxisTitle","props","text","x","y","className","style","rotate90","jsx","cn"],"mappings":";AAWO,SAASA,EAAUC,GAAc;AACtC,QAAM,EAAE,MAAAC,GAAM,GAAAC,GAAG,GAAAC,GAAG,WAAAC,GAAW,OAAAC,GAAO,UAAAC,MAAaN;AACnD,SAAKC,IAEHM,gBAAAA,EAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,aAAaL,CAAC,KAAKC,CAAC,IAAIG,IAAW,iBAAiB,EAAE;AAAA,MACjE,OAAO;AAAA,QACL,YAAY;AAAA,QACZ,GAAID,KAAS,CAAA;AAAA,MAAC;AAAA,MAEhB,WAAWG,EAAG,4DAA4DJ,CAAS;AAAA,MAElF,UAAAH;AAAA,IAAA;AAAA,EAAA,IAVa;AAapB;"}
|
package/dist/BarGraph.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DDoeWRVt.cjs"),d=require("react"),Ee=require("./parse-hMnG_lRV.cjs"),Ie=require("./getSliderMarks-CRIbTGYV.cjs"),$e=require("./index-CQ3e6Ewi.cjs"),Ae=require("./index-DQA8q5sC.cjs"),ze=require("./Modal-tXZlLE5s.cjs"),Me=require("./numberFormattingFunction-02t-wJta.cjs"),Ve=require("./Tooltip-De16GWhY.cjs"),q=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Ce=require("./Colors.cjs"),Le=require("./string2HTML-z7CwHXcx.cjs"),Ze=require("./XTicksAndGridLines-CCzXIV8d.cjs"),et=require("./YAxesLabels-yRFFdx1s.cjs"),Be=require("./AxisTitle-CK9YeovX.cjs"),Fe=require("./Axis-DE7dSn1_.cjs"),Pe=require("./ReferenceLine-CFVBBN__.cjs"),He=require("./use-in-view-sQJZ_xDO.cjs"),qe=require("./linear-BVckp9RD.cjs"),Te=require("./band-CAApY4Pd.cjs"),Ge=require("./index-BW8iNx7E.cjs"),fe=require("./proxy-BHRoeZgd.cjs"),Ue=require("./GraphFooter.cjs"),We=require("./GraphHeader.cjs"),Xe=require("./ColorLegendWithMouseOver.cjs"),Ye=require("./EmptyState-d8_8SxeW.cjs"),De=require("./index-BW_-wD2k.cjs"),Re=require("./ensureCompleteData-DkQYPeDa.cjs"),Se=require("./uniqBy-O05lp2S5.cjs"),_e=require("./sort-O96oMZLb.cjs"),Je=require("./init-DU0ybBc_.cjs"),ke=require("./index-CSNtgibC.cjs"),Qe=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),tt=require("./XAxesLabels-Drf7M3YK.cjs"),it=require("./YTicksAndGridLines-DBDuz6vb.cjs");function at(ye){const{data:o,barColor:p,suffix:G,prefix:$,barPadding:U,showValues:he,showTicks:me,leftMargin:pe,truncateBy:ee,width:H,height:ae,colorDomain:N,rightMargin:le,topMargin:xe,bottomMargin:C,showLabels:W,tooltip:J,onSeriesMouseOver:te,refValues:j,selectedColor:y,highlightedDataPoints:V,maxValue:se,minValue:re,onSeriesMouseClick:K,labelOrder:ie,rtl:ne,maxBarThickness:X,minBarThickness:ce,resetSelectionOnDoubleClick:Q,detailsOnClick:I,barAxisTitle:b,valueColor:g,noOfTicks:k,styles:D,classNames:M,animate:O,dimmedOpacity:T,precision:A,customLayers:v,naLabel:w}=ye,Y=d.useRef(null),S=He.useInView(Y,{once:O.once,amount:O.amount}),[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),[F,m]=d.useState(void 0),E={top:b?xe+25:xe,bottom:C,left:pe,right:le},h=H-E.left-E.right,c=ae-E.top-E.bottom,x=o.map((s,f)=>({...s,id:ie?`${s.label}`:`${f}`})),u=qe.linear().domain([re,se]).range([0,h]).nice(),a=ie||x.map(s=>`${s.id}`),r=Te.band().domain(a).range([0,ce?Math.max(c,ce*a.length):X?Math.min(c,X*a.length):c]).paddingInner(U),t=u.ticks(k);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:Y,width:`${H}px`,height:`${ae}px`,viewBox:`0 0 ${H} ${ae}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${E.left},${E.top})`,children:[me?e.jsxRuntimeExports.jsx(Ze.XTicksAndGridLines,{values:t.filter(s=>s!==0),x:t.filter(s=>s!==0).map(s=>u(s)),y1:0-xe,y2:c+E.bottom,styles:{gridLines:D?.xAxis?.gridLines,labels:D?.xAxis?.labels},classNames:{gridLines:M?.xAxis?.gridLines,labels:M?.xAxis?.labels},suffix:G,prefix:$,labelType:"secondary",showGridLines:!0,precision:A}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:h/2,y:0-E.top+15,style:D?.xAxis?.title,className:M?.xAxis?.title,text:b}),v.filter(s=>s.position==="before").map(s=>s.layer),e.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[x.map(s=>q.checkIfNullOrUndefined(r(s.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:y?s.color&&p[N.indexOf(s.color)]===y?1:T:V.length!==0?V.indexOf(s.label)!==-1?.85:T:.85},whileInView:{opacity:y?s.color&&p[N.indexOf(s.color)]===y?1:T:V.length!==0?V.indexOf(s.label)!==-1?.85:T:.85,transition:{duration:O.duration}}},initial:"initial",animate:S?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},onMouseEnter:f=>{oe(s),m(f.clientY),R(f.clientX),te?.(s)},onClick:()=>{(K||I)&&(Ae.isEqual(P,s)&&Q?(B(void 0),K?.(void 0)):(B(s),K?.(s)))},onMouseMove:f=>{oe(s),m(f.clientY),R(f.clientX)},onMouseLeave:()=>{oe(void 0),R(void 0),m(void 0),te?.(void 0)},children:[s.size?e.jsxRuntimeExports.jsx(fe.motion.rect,{variants:{initial:{width:0,x:u(0),y:r(`${s.id}`),fill:o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray},whileInView:{width:s.size>=0?u(s.size)-u(0):u(0)-u(s.size),x:s.size>=0?u(0):u(s.size),y:r(`${s.id}`),fill:o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray,transition:{duration:O.duration}}},initial:"initial",animate:S?"whileInView":"initial",exit:{width:0,x:u(0),transition:{duration:O.duration}},height:r.bandwidth()}):null,W?e.jsxRuntimeExports.jsx(et.YAxesLabels,{value:`${s.label}`.length<ee?`${s.label}`:`${`${s.label}`.substring(0,ee)}...`,y:r(s.id)||0,x:(s.size||0)<0?u(0):0-E.left,width:(s.size||0)<0?H-u(0):u(0)+E.left,height:r.bandwidth(),alignment:s.size&&s.size<0?"left":"right",style:D?.yAxis?.labels,className:M?.yAxis?.labels,animate:O,isInView:S}):null,he?e.jsxRuntimeExports.jsx(fe.motion.text,{style:{textAnchor:s.size&&s.size<0?"end":"start",...D?.graphObjectValues||{}},className:e.mo("graph-value text-sm",!g&&p.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",M?.graphObjectValues),dx:s.size&&s.size<0?-5:5,dy:"0.33em",variants:{initial:{x:u(0),y:r(`${s.id}`)+r.bandwidth()/2,opacity:0,fill:g||(o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray)},whileInView:{x:s.size?u(s.size):u(0),opacity:1,y:r(`${s.id}`)+r.bandwidth()/2,fill:g||(o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray),transition:{duration:O.duration}}},initial:"initial",animate:S?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},children:Me.numberFormattingFunction(s.size,w,A,$,G)}):null]},s.label)),e.jsxRuntimeExports.jsx(Fe.Axis,{x1:u(re<0?0:re),x2:u(re<0?0:re),y1:-2.5,y2:c+E.bottom,classNames:{axis:M?.yAxis?.axis},styles:{axis:D?.yAxis?.axis}}),j?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:j.map((s,f)=>e.jsxRuntimeExports.jsx(Pe.RefLineX,{text:s.text,color:s.color,x:u(s.value),y1:0-E.top,y2:c+E.bottom,textSide:u(s.value)>h*.75||ne?"left":"right",classNames:s.classNames,styles:s.styles,animate:O,isInView:S},f))}):null]}),v.filter(s=>s.position==="after").map(s=>s.layer)]})}),L&&J&&Z&&F?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:L,body:J,xPos:Z,yPos:F,backgroundStyle:D?.tooltip,className:M?.tooltip}):null,I&&P!==void 0?e.jsxRuntimeExports.jsx(ze.X,{open:P!==void 0,onClose:()=>{B(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof I=="string"?{__html:Le.string2HTML(I,P)}:void 0,children:typeof I=="function"?I(P):null})}):null]})}function st(ye){const{data:o,graphTitle:p,colors:G,suffix:$="",sources:U,prefix:he="",graphDescription:me,barPadding:pe=.25,showValues:ee=!0,showTicks:H=!0,leftMargin:ae=100,rightMargin:N=40,truncateBy:le=999,height:xe,width:C,footNote:W,colorDomain:J,colorLegendTitle:te,highlightedDataPoints:j=[],padding:y,backgroundColor:V=!1,topMargin:se=25,bottomMargin:re=10,showLabels:K=!0,relativeHeight:ie,tooltip:ne,onSeriesMouseOver:X,refValues:ce,showColorScale:Q=!0,graphID:I,maxValue:b,minValue:g,onSeriesMouseClick:k,graphDownload:D=!1,dataDownload:M=!1,sortData:O,labelOrder:T,language:A="en",showNAColor:v=!0,minHeight:w=0,theme:Y="light",maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B=!0,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F=5,valueColor:m,styles:E,classNames:h,filterNA:c=!0,animate:x=!1,dimmedOpacity:u=.3,precision:a=2,customLayers:r=[],timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:s="NA"}=ye,[f,we]=d.useState(0),[ue,_]=d.useState(0),[ge,Oe]=d.useState(t.autoplay),de=_e.sort(Se.uniqBy(o,"date",!0).map(n=>Ee.parse(`${n}`,t.dateFormat||"yyyy",new Date).getTime()),(n,je)=>Je.ascending(n,je)),[be,ve]=d.useState(t.autoplay?0:de.length-1),[Ne,l]=d.useState(void 0),i=d.useRef(null),z=d.useRef(null);d.useEffect(()=>{const n=new ResizeObserver(je=>{we(C||je[0].target.clientWidth||620),_(xe||je[0].target.clientHeight||480)});return i.current&&(_(i.current.clientHeight||480),we(i.current.clientWidth||620),C||n.observe(i.current)),()=>n.disconnect()},[C,xe]),d.useEffect(()=>{const n=setInterval(()=>{ve(je=>je<de.length-1?je+1:0)},(t.speed||2)*1e3);return ge||clearInterval(n),()=>clearInterval(n)},[de,ge,t.speed]);const Ke=Ie.getSliderMarks(de,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${Y||"light"} flex ${C?"w-fit grow-0":"w-full grow"}`,dir:A==="he"||A==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${V?V===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${A||"en"}`,C?"w-fit":"w-full",h?.graphContainer),style:{...E?.graphContainer||{},...V&&V!==!0?{backgroundColor:V}:{}},id:I,ref:z,"aria-label":P||`${p?`The graph shows ${p}. `:""}This is a bar chart. ${me?` ${me}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:V?y||"1rem":y||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||me||D||M?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:h?.title,description:h?.description},graphTitle:p,graphDescription:me,width:C,graphDownload:D?z.current:void 0,dataDownload:M?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,t.enabled&&de.length>0&&Ke?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Oe(!ge)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ge?"Click to pause animation":"Click to play animation",children:ge?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:de[0],max:de[de.length-1],marks:Ke,step:null,defaultValue:de[de.length-1],value:de[be],onChangeComplete:n=>{ve(de.indexOf(n))},onChange:n=>{ve(de.indexOf(n))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[Q&&o.filter(n=>n.color).length!==0?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:C,colorLegendTitle:te,colors:G||Ce.Colors[Y].categoricalColors.colors,colorDomain:J||Se.uniqBy(o,"color",!0),setSelectedColor:l,showNAColor:v}):null,e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:i,"aria-label":"Graph area",children:(C||f)&&(xe||ue)?e.jsxRuntimeExports.jsx(at,{data:O?$e.orderBy(Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!q.checkIfNullOrUndefined(n.size):n),[n=>n.size===void 0?O==="asc"?1/0:-1/0:n.size],[O]).filter((n,je)=>L?je<L:!0):Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!q.checkIfNullOrUndefined(n.size):n).filter((n,je)=>L?je<L:!0),barColor:o.filter(n=>n.color).length===0?G?[G]:[Ce.Colors.primaryColors["blue-600"]]:G||Ce.Colors[Y].categoricalColors.colors,colorDomain:o.filter(n=>n.color).length===0?[]:J||Se.uniqBy(o,"color",!0),width:C||f,selectedColor:Ne,height:Math.max(w,xe||(ie?w?(C||f)*ie>w?(C||f)*ie:w:(C||f)*ie:ue)),suffix:$,prefix:he,barPadding:pe,showValues:ee,showTicks:H,leftMargin:ae,rightMargin:N,topMargin:se,bottomMargin:re,truncateBy:le,showLabels:K,tooltip:ne,onSeriesMouseOver:X,refValues:ce,maxValue:q.checkIfNullOrUndefined(b)?Math.max(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size))<0?0:Math.max(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size)):b,minValue:q.checkIfNullOrUndefined(g)?Math.min(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size))>=0?0:Math.min(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size)):g,highlightedDataPoints:j,onSeriesMouseClick:k,labelOrder:T,rtl:A==="he"||A==="ar",maxBarThickness:S,minBarThickness:oe,resetSelectionOnDoubleClick:B,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,classNames:h,styles:E,animate:x===!0?{duration:.5,once:!0,amount:.5}:x||{duration:0,once:!0,amount:0},dimmedOpacity:u,precision:a,customLayers:r,naLabel:s}):null})]})}),U||W?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{sources:U,footNote:W,width:C,styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:h?.footnote,source:h?.source}}):null]})})})})}function rt(ye){const{data:o,barColors:p,barPadding:G,showTicks:$,leftMargin:U,truncateBy:he,width:me,height:pe,suffix:ee,prefix:H,showValues:ae,rightMargin:N,topMargin:le,bottomMargin:xe,showLabels:C,tooltip:W,onSeriesMouseOver:J,refValues:te,maxValue:j,minValue:y,onSeriesMouseClick:V,selectedColor:se,rtl:re,labelOrder:K,maxBarThickness:ie,resetSelectionOnDoubleClick:ne,detailsOnClick:X,barAxisTitle:ce,valueColor:Q,noOfTicks:I,styles:b,classNames:g,animate:k,colorDomain:D,precision:M,customLayers:O,naLabel:T}=ye,A=d.useRef(null),v=He.useInView(A,{once:k.once,amount:k.amount}),w={top:ce?le+25:le,bottom:xe,left:U,right:N},[Y,S]=d.useState(void 0),[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),F=me-w.left-w.right,m=pe-w.top-w.bottom,E=o.map((r,t)=>({...r,id:K?`${r.label}`:`${t}`})),h=K||E.map(r=>`${r.id}`),c=qe.linear().domain([y,j]).range([0,F]).nice(),x=Te.band().domain(h).range([0,ie?Math.min(m,ie*h.length):m]).paddingInner(G),u=Te.band().domain(o[0].size.map((r,t)=>`${t}`)).range([0,x.bandwidth()]).paddingInner(.1),a=c.ticks(I);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:A,width:`${me}px`,height:`${pe}px`,viewBox:`0 0 ${me} ${pe}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[$?e.jsxRuntimeExports.jsx(Ze.XTicksAndGridLines,{values:a.filter(r=>r!==0),x:a.filter(r=>r!==0).map(r=>c(r)),y1:0-le,y2:m+w.bottom,styles:{gridLines:b?.xAxis?.gridLines,labels:b?.xAxis?.labels},classNames:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},suffix:ee,prefix:H,labelType:"secondary",showGridLines:!0,precision:M}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:F/2,y:0-w.top+15,style:b?.xAxis?.title,className:g?.xAxis?.title,text:ce}),O.filter(r=>r.position==="before").map(r=>r.layer),e.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[E.map(r=>q.checkIfNullOrUndefined(x(r.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{variants:{initial:{x:0,y:x(`${r.id}`)},whileInView:{x:0,y:x(`${r.id}`),transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},children:[r.size.map((t,s)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",opacity:se?p[s]===se?1:.3:.85,onMouseEnter:f=>{S({...r,sizeIndex:s}),R(f.clientY),B(f.clientX),J?.({...r,sizeIndex:s})},onMouseMove:f=>{S({...r,sizeIndex:s}),R(f.clientY),B(f.clientX)},onMouseLeave:()=>{S(void 0),B(void 0),R(void 0),J?.(void 0)},onClick:()=>{(V||X)&&(Ae.isEqual(L,{...r,sizeIndex:s})&&ne?(oe(void 0),V?.(void 0)):(oe({...r,sizeIndex:s}),V&&V({...r,sizeIndex:s})))},children:[q.checkIfNullOrUndefined(t)?null:e.jsxRuntimeExports.jsx(fe.motion.rect,{y:u(`${s}`),variants:{initial:{width:0,x:c(0),fill:p[s]},whileInView:{width:q.checkIfNullOrUndefined(t)?0:t>=0?c(t)-c(0):c(0)-c(t),x:t>=0?c(0):c(t),fill:p[s],transition:{duration:k.duration}}},exit:{width:0,x:c(0),transition:{duration:k.duration}},height:u.bandwidth(),initial:"initial",animate:v?"whileInView":"initial"}),ae?e.jsxRuntimeExports.jsx(fe.motion.text,{y:u(`${s}`)+u.bandwidth()/2,style:{textAnchor:t&&t<0?"end":"start",...b?.graphObjectValues||{}},className:e.mo("graph-value text-sm",g?.graphObjectValues),dx:t&&t<0?-5:5,dy:"0.33em",variants:{initial:{x:c(0),opacity:0,fill:Q||p[s]},whileInView:{x:c(t||0),opacity:1,fill:Q||p[s],transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},children:Me.numberFormattingFunction(t,T,M,H,ee)}):null]},`${r.label}-${D[s]||s}`)),C?e.jsxRuntimeExports.jsx(et.YAxesLabels,{value:`${r.label}`.length<he?`${r.label}`:`${`${r.label}`.substring(0,he)}...`,y:0,x:0-w.left,width:c(y<0?0:y)+w.left,height:x.bandwidth(),style:b?.yAxis?.labels,className:g?.yAxis?.labels,animate:k,isInView:v}):null]},r.label)),e.jsxRuntimeExports.jsx(Fe.Axis,{x1:c(y<0?0:y),x2:c(y<0?0:y),y1:-2.5,y2:m+w.bottom,classNames:{axis:g?.yAxis?.axis},styles:{axis:b?.yAxis?.axis}}),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((r,t)=>e.jsxRuntimeExports.jsx(Pe.RefLineX,{text:r.text,color:r.color,x:c(r.value),y1:0-w.top,y2:m+w.bottom,textSide:c(r.value)>F*.75||re?"left":"right",classNames:r.classNames,styles:r.styles,animate:k,isInView:v},t))}):null]}),O.filter(r=>r.position==="after").map(r=>r.layer)]})}),Y&&W&&P&&Z?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:Y,body:W,xPos:P,yPos:Z,backgroundStyle:b?.tooltip,className:g?.tooltip}):null,X&&L!==void 0?e.jsxRuntimeExports.jsx(ze.X,{open:L!==void 0,onClose:()=>{oe(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof X=="string"?{__html:Le.string2HTML(X,L)}:void 0,children:typeof X=="function"?X(L):null})}):null]})}function nt(ye){const{data:o,graphTitle:p,colors:G=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,truncateBy:pe=999,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe="",prefix:C="",showValues:W=!0,showColorScale:J=!0,padding:te,backgroundColor:j=!1,leftMargin:y=100,rightMargin:V=40,topMargin:se=25,bottomMargin:re=10,showLabels:K=!0,relativeHeight:ie,tooltip:ne,onSeriesMouseOver:X,refValues:ce,graphID:Q,maxValue:I,minValue:b,onSeriesMouseClick:g,graphDownload:k=!1,dataDownload:D=!1,language:M="en",labelOrder:O,minHeight:T=0,theme:A="light",maxBarThickness:v,ariaLabel:w,resetSelectionOnDoubleClick:Y=!0,detailsOnClick:S,barAxisTitle:L,noOfTicks:oe=5,valueColor:P,styles:B,classNames:Z,filterNA:R=!0,animate:F=!1,precision:m=2,customLayers:E=[],timeline:h={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:c="NA",sortParameter:x,sortData:u}=ye,[a,r]=d.useState(0),[t,s]=d.useState(0),[f,we]=d.useState(h.autoplay),ue=_e.sort(Se.uniqBy(o,"date",!0).map(l=>Ee.parse(`${l}`,h.dateFormat||"yyyy",new Date).getTime()),(l,i)=>Je.ascending(l,i)),[_,ge]=d.useState(h.autoplay?0:ue.length-1),[Oe,de]=d.useState(void 0),be=d.useRef(null),ve=d.useRef(null);d.useEffect(()=>{const l=new ResizeObserver(i=>{r(H||i[0].target.clientWidth||620),s(ee||i[0].target.clientHeight||480)});return be.current&&(s(be.current.clientHeight||480),r(be.current.clientWidth||620),H||l.observe(be.current)),()=>l.disconnect()},[H,ee]),d.useEffect(()=>{const l=setInterval(()=>{ge(i=>i<ue.length-1?i+1:0)},(h.speed||2)*1e3);return f||clearInterval(l),()=>clearInterval(l)},[ue,f,h.speed]);const Ne=Ie.getSliderMarks(ue,_,h.showOnlyActiveDate,h.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${A||"light"} flex ${H?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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 ${M||"en"}`,H?"w-fit":"w-full",Z?.graphContainer),style:{...B?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:Q,ref:ve,"aria-label":w||`${p?`The graph shows ${p}. `:""}This is a grouped bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:j?te||"1rem":te||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[p||U||k||D?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:B?.title,description:B?.description},classNames:{title:Z?.title,description:Z?.description},graphTitle:p,graphDescription:U,width:H,graphDownload:k?ve.current:void 0,dataDownload:D?o.map(l=>l.data).filter(l=>l!==void 0).length>0?o.map(l=>l.data).filter(l=>l!==void 0):o.filter(l=>l!==void 0):null}):null,h.enabled&&ue.length>0&&Ne?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!f)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":f?"Click to pause animation":"Click to play animation",children:f?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:ue[0],max:ue[ue.length-1],marks:Ne,step:null,defaultValue:ue[ue.length-1],value:ue[_],onChangeComplete:l=>{ge(ue.indexOf(l))},onChange:l=>{ge(ue.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[J?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:H,colorDomain:N,colors:G,colorLegendTitle:le,setSelectedColor:de,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:be,"aria-label":"Graph area",children:(H||a)&&(ee||t)?e.jsxRuntimeExports.jsx(rt,{data:x!==void 0?x==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>R?!l.size.every(i=>i==null):l),l=>ke.sum(l.size.filter(i=>!q.checkIfNullOrUndefined(i))),[u||"asc"]):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>R?!l.size.every(i=>i==null):l),l=>q.checkIfNullOrUndefined(l.size[x])?-1/0:l.size[x],[u||"asc"]):Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>R?!l.size.every(i=>i==null):l),barColors:G,width:H||a,height:Math.max(T,ee||(ie?T?(H||a)*ie>T?(H||a)*ie:T:(H||a)*ie:t)),suffix:xe,prefix:C,showValues:W,barPadding:he,showTicks:me,leftMargin:y,rightMargin:V,topMargin:se,bottomMargin:re,truncateBy:pe,showLabels:K,tooltip:ne,onSeriesMouseOver:X,refValues:ce,maxValue:q.checkIfNullOrUndefined(I)?Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!q.checkIfNullOrUndefined(i)))))<0?0:Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!q.checkIfNullOrUndefined(i))))):I,minValue:q.checkIfNullOrUndefined(b)?Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!q.checkIfNullOrUndefined(i)))))>=0?0:Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!q.checkIfNullOrUndefined(i))))):b,onSeriesMouseClick:g,selectedColor:Oe,labelOrder:O,rtl:M==="he"||M==="ar",maxBarThickness:v,resetSelectionOnDoubleClick:Y,detailsOnClick:S,barAxisTitle:L,noOfTicks:oe,valueColor:P,styles:B,classNames:Z,colorDomain:N,animate:F===!0?{duration:.5,once:!0,amount:.5}:F||{duration:0,once:!0,amount:0},precision:m,customLayers:E,naLabel:c}):null})]})}),$||ae?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:B?.footnote,source:B?.source},classNames:{footnote:Z?.footnote,source:Z?.source},sources:$,footNote:ae,width:H}):null]})})})})}function lt(ye){const{data:o,barColors:p,barPadding:G,showTicks:$,leftMargin:U,rightMargin:he,truncateBy:me,width:pe,height:ee,topMargin:H,bottomMargin:ae,tooltip:N,onSeriesMouseOver:le,showLabels:xe,suffix:C,prefix:W,showValues:J,refValues:te,maxValue:j,onSeriesMouseClick:y,selectedColor:V,rtl:se,labelOrder:re,maxBarThickness:K,minBarThickness:ie,resetSelectionOnDoubleClick:ne,detailsOnClick:X,barAxisTitle:ce,valueColor:Q,noOfTicks:I,styles:b,classNames:g,animate:k,colorDomain:D,precision:M,customLayers:O,naLabel:T}=ye,A=d.useRef(null),v=He.useInView(A,{once:k.once,amount:k.amount}),w={top:ce?H+25:H,bottom:ae,left:U,right:he},[Y,S]=d.useState(void 0),[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),F=pe-w.left-w.right,m=ee-w.top-w.bottom,E=o.map((a,r)=>({...a,id:re?`${a.label}`:`${r}`})),h=re||E.map(a=>`${a.id}`),c=qe.linear().domain([0,j]).range([0,F]).nice(),x=Te.band().domain(h).range([0,ie?Math.max(m,ie*h.length):K?Math.min(m,K*h.length):m]).paddingInner(G),u=c.ticks(I);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:A,width:`${pe}px`,height:`${ee}px`,viewBox:`0 0 ${pe} ${ee}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[$?e.jsxRuntimeExports.jsx(Ze.XTicksAndGridLines,{values:u.filter(a=>a!==0),x:u.filter(a=>a!==0).map(a=>c(a)),y1:0-H,y2:m+w.bottom,styles:{gridLines:b?.xAxis?.gridLines,labels:b?.xAxis?.labels},classNames:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},suffix:C,prefix:W,labelType:"secondary",showGridLines:!0,precision:M}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:F/2,y:0-w.top+15,style:b?.xAxis?.title,className:g?.xAxis?.title,text:ce}),O.filter(a=>a.position==="before").map(a=>a.layer),e.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[E.map(a=>q.checkIfNullOrUndefined(x(a.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-low-opacity undp-viz-g-with-hover",variants:{initial:{x:0,y:x(`${a.id}`)},whileInView:{x:0,y:x(`${a.id}`),transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},children:[a.size.map((r,t)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{opacity:V?p[t]===V?1:.3:1,onMouseEnter:s=>{S({...a,sizeIndex:t}),R(s.clientY),B(s.clientX),le?.({...a,sizeIndex:t})},onMouseMove:s=>{S({...a,sizeIndex:t}),R(s.clientY),B(s.clientX)},onMouseLeave:()=>{S(void 0),B(void 0),R(void 0),le?.(void 0)},onClick:()=>{(y||X)&&(Ae.isEqual(L,{...a,sizeIndex:t})&&ne?(oe(void 0),y?.(void 0)):(oe({...a,sizeIndex:t}),y&&y({...a,sizeIndex:t})))},children:[r?e.jsxRuntimeExports.jsx(fe.motion.rect,{y:0,style:{fill:p[t]},height:x.bandwidth(),exit:{width:0,x:c(0),transition:{duration:k.duration}},variants:{initial:{width:0,x:c(0),fill:p[t]},whileInView:{width:c(r||0),x:c(t===0?0:ke.sum(a.size.filter((s,f)=>f<t&&s))),fill:p[t],transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial"},t):null,J?e.jsxRuntimeExports.jsx(fe.motion.text,{y:x.bandwidth()/2,style:{textAnchor:"middle",...b?.graphObjectValues||{}},dy:"0.33em",className:e.mo("graph-value text-sm",g?.graphObjectValues),exit:{opacity:0,transition:{duration:k.duration}},variants:{initial:{x:c(0),opacity:0,fill:Qe.getTextColorBasedOnBgColor(p[t])},whileInView:{x:c(t===0?0:ke.sum(a.size.filter((s,f)=>f<t&&s)))+c(r||0)/2,opacity:r&&c(r)/Me.numberFormattingFunction(r,T,M,W,C).length>12?1:0,fill:Qe.getTextColorBasedOnBgColor(p[t]),transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",children:Me.numberFormattingFunction(r,T,M,W,C)}):null]},`${a.label}-${D[t]||t}`)),xe?e.jsxRuntimeExports.jsx(et.YAxesLabels,{value:`${a.label}`.length<me?`${a.label}`:`${`${a.label}`.substring(0,me)}...`,y:0,x:0-w.left,width:0+w.left,height:x.bandwidth(),style:b?.yAxis?.labels,className:g?.yAxis?.labels,animate:k,isInView:v}):null,J?e.jsxRuntimeExports.jsx(fe.motion.text,{className:e.mo("graph-value graph-value-total text-sm",Q?"":" fill-primary-gray-700 dark:fill-primary-gray-300",g?.graphObjectValues),style:{...Q?{fill:Q}:{},textAnchor:"start",...b?.graphObjectValues||{}},y:x.bandwidth()/2,dx:5,dy:"0.33em",variants:{initial:{x:c(0),opacity:0,...Q?{fill:Q}:{}},whileInView:{x:c(ke.sum(a.size.map(r=>r||0))),opacity:1,...Q?{fill:Q}:{},transition:{duration:k.duration}}},exit:{opacity:0,transition:{duration:k.duration}},initial:"initial",animate:v?"whileInView":"initial",children:Me.numberFormattingFunction(ke.sum(a.size.filter(r=>r)),T,M,W,C)}):null]},a.label)),e.jsxRuntimeExports.jsx(Fe.Axis,{x1:c(0),x2:c(0),y1:-2.5,y2:m+w.bottom,classNames:{axis:g?.yAxis?.axis},styles:{axis:b?.yAxis?.axis}}),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((a,r)=>e.jsxRuntimeExports.jsx(Pe.RefLineX,{text:a.text,color:a.color,x:c(a.value),y1:0-w.top,y2:m+w.bottom,textSide:c(a.value)>F*.75||se?"left":"right",classNames:a.classNames,styles:a.styles,animate:k,isInView:v},r))}):null]}),O.filter(a=>a.position==="after").map(a=>a.layer)]})}),Y&&N&&P&&Z?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:Y,body:N,xPos:P,yPos:Z,backgroundStyle:b?.tooltip,className:g?.tooltip}):null,X&&L!==void 0?e.jsxRuntimeExports.jsx(ze.X,{open:L!==void 0,onClose:()=>{oe(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof X=="string"?{__html:Le.string2HTML(X,L)}:void 0,children:typeof X=="function"?X(L):null})}):null]})}function ot(ye){const{data:o,graphTitle:p,colors:G=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,leftMargin:pe=100,rightMargin:ee=40,truncateBy:H=999,height:ae,width:N,footNote:le,colorDomain:xe,colorLegendTitle:C,padding:W,backgroundColor:J=!1,topMargin:te=25,bottomMargin:j=10,tooltip:y,onSeriesMouseOver:V,suffix:se="",prefix:re="",showLabels:K=!0,relativeHeight:ie,showValues:ne=!0,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b=!1,dataDownload:g=!1,language:k="en",labelOrder:D,minHeight:M=0,theme:O="light",maxBarThickness:T,sortParameter:A,maxNumberOfBars:v,minBarThickness:w,showColorScale:Y=!0,ariaLabel:S,resetSelectionOnDoubleClick:L=!0,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B=5,valueColor:Z,styles:R,classNames:F,filterNA:m=!0,animate:E=!1,precision:h=2,customLayers:c=[],timeline:x={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:u="NA",sortData:a}=ye,[r,t]=d.useState(0),[s,f]=d.useState(0),[we,ue]=d.useState(x.autoplay),_=_e.sort(Se.uniqBy(o,"date",!0).map(i=>Ee.parse(`${i}`,x.dateFormat||"yyyy",new Date).getTime()),(i,z)=>Je.ascending(i,z)),[ge,Oe]=d.useState(x.autoplay?0:_.length-1),[de,be]=d.useState(void 0),ve=d.useRef(null),Ne=d.useRef(null);d.useEffect(()=>{const i=new ResizeObserver(z=>{t(N||z[0].target.clientWidth||620),f(ae||z[0].target.clientHeight||480)});return ve.current&&(f(ve.current.clientHeight||480),t(ve.current.clientWidth||620),N||i.observe(ve.current)),()=>i.disconnect()},[N,ae]),d.useEffect(()=>{const i=setInterval(()=>{Oe(z=>z<_.length-1?z+1:0)},(x.speed||2)*1e3);return we||clearInterval(i),()=>clearInterval(i)},[_,we,x.speed]);const l=Ie.getSliderMarks(_,ge,x.showOnlyActiveDate,x.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${O||"light"} flex ${N?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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"}`,N?"w-fit":"w-full",F?.graphContainer),style:{...R?.graphContainer||{},...J&&J!==!0?{backgroundColor:J}:{}},id:ce,ref:Ne,"aria-label":S||`${p?`The graph shows ${p}. `:""}This is a stacked bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:J?W||"1rem":W||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[p||U||b||g?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:R?.title,description:R?.description},classNames:{title:F?.title,description:F?.description},graphTitle:p,graphDescription:U,width:N,graphDownload:b?Ne.current:void 0,dataDownload:g?o.map(i=>i.data).filter(i=>i!==void 0).length>0?o.map(i=>i.data).filter(i=>i!==void 0):o.filter(i=>i!==void 0):null}):null,x.enabled&&_.length>0&&l?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ue(!we)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":we?"Click to pause animation":"Click to play animation",children:we?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:_[0],max:_[_.length-1],marks:l,step:null,defaultValue:_[_.length-1],value:_[ge],onChangeComplete:i=>{Oe(_.indexOf(i))},onChange:i=>{Oe(_.indexOf(i))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[Y?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:N,colorDomain:xe,colors:G,colorLegendTitle:C,setSelectedColor:be,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:ve,"aria-label":"Graph area",children:(N||r)&&(ae||s)?e.jsxRuntimeExports.jsx(lt,{data:A!==void 0?A==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>ke.sum(i.size.filter(z=>!q.checkIfNullOrUndefined(z))),[a||"asc"]).filter((i,z)=>v?z<v:!0):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>q.checkIfNullOrUndefined(i.size[A])?-1/0:i.size[A],[a||"asc"]).filter((i,z)=>v?z<v:!0):Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i).filter((i,z)=>v?z<v:!0),barColors:G,width:N||r,height:Math.max(M,ae||(ie?M?(N||r)*ie>M?(N||r)*ie:M:(N||r)*ie:s)),barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:te,bottomMargin:j,truncateBy:H,showLabels:K,tooltip:y,onSeriesMouseOver:V,showValues:ne,suffix:se,prefix:re,refValues:X,maxValue:q.checkIfNullOrUndefined(Q)?Math.max(...o.map(i=>ke.sum(i.size.filter(z=>!q.checkIfNullOrUndefined(z)))||0)):Q,onSeriesMouseClick:I,selectedColor:de,rtl:k==="he"||k==="ar",labelOrder:D,maxBarThickness:T,minBarThickness:w,resetSelectionOnDoubleClick:L,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,classNames:F,styles:R,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},colorDomain:xe,precision:h,customLayers:c,naLabel:u}):null})]})}),$||le?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:R?.footnote,source:R?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:$,footNote:le,width:N}):null]})})})})}function ut(ye){const{data:o,width:p,height:G,barColor:$,suffix:U,prefix:he,barPadding:me,showLabels:pe,showValues:ee,showTicks:H,colorDomain:ae,truncateBy:N,rightMargin:le,topMargin:xe,bottomMargin:C,leftMargin:W,tooltip:J,onSeriesMouseOver:te,refValues:j,selectedColor:y,maxValue:V,minValue:se,highlightedDataPoints:re,onSeriesMouseClick:K,labelOrder:ie,maxBarThickness:ne,minBarThickness:X,resetSelectionOnDoubleClick:ce,detailsOnClick:Q,barAxisTitle:I,valueColor:b,noOfTicks:g,styles:k,classNames:D,dimmedOpacity:M,animate:O,precision:T,customLayers:A,naLabel:v}=ye,w=d.useRef(null),Y=He.useInView(w,{once:O.once,amount:O.amount}),S={top:xe,bottom:C,left:I?W+30:W,right:le},[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),[F,m]=d.useState(void 0),E=p-S.left-S.right,h=G-S.top-S.bottom,c=qe.linear().domain([se,V]).range([h,0]).nice(),x=o.map((t,s)=>({...t,id:ie?`${t.label}`:`${s}`})),u=ie||x.map(t=>`${t.id}`),a=Te.band().domain(u).range([0,X?Math.max(E,X*u.length):ne?Math.min(E,ne*u.length):E]).paddingInner(me),r=c.ticks(g);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:w,width:`${p}px`,height:`${G}px`,viewBox:`0 0 ${p} ${G}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${S.left},${S.top})`,children:[e.jsxRuntimeExports.jsx(Fe.Axis,{y1:c(se<0?0:se),y2:c(se<0?0:se),x1:0-W,x2:E+S.right,label:Me.numberFormattingFunction(se<0?0:se,v,T,he,U),labelPos:{x:0-W,dx:0,dy:V<0?"1em":-5,y:c(se<0?0:se)},classNames:{axis:D?.xAxis?.axis,label:D?.yAxis?.labels},styles:{axis:k?.xAxis?.axis,label:k?.yAxis?.labels}}),H?e.jsxRuntimeExports.jsx(it.YTicksAndGridLines,{values:r.filter(t=>t!==0),y:r.filter(t=>t!==0).map(t=>c(t)),x1:0-W,x2:E+S.right,styles:{gridLines:k?.yAxis?.gridLines,labels:k?.yAxis?.labels},classNames:{gridLines:D?.yAxis?.gridLines,labels:D?.yAxis?.labels},suffix:U,prefix:he,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:T}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:0-W-15,y:h/2,style:k?.yAxis?.title,className:D?.yAxis?.title,text:I,rotate90:!0}),A.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[x.map((t,s)=>q.checkIfNullOrUndefined(a(t.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",initial:"initial",animate:Y?"whileInView":"initial",variants:{initial:{opacity:y?t.color&&$[ae.indexOf(t.color)]===y?1:M:re.length!==0?re.indexOf(t.label)!==-1?.85:M:.85},whileInView:{opacity:y?t.color&&$[ae.indexOf(t.color)]===y?1:M:re.length!==0?re.indexOf(t.label)!==-1?.85:M:.85,transition:{duration:O.duration}}},exit:{opacity:0,transition:{duration:O.duration}},onMouseEnter:f=>{oe(t),m(f.clientY),R(f.clientX),te?.(t)},onClick:()=>{(K||Q)&&(Ae.isEqual(P,t)&&ce?(B(void 0),K?.(void 0)):(B(t),K?.(t)))},onMouseMove:f=>{oe(t),m(f.clientY),R(f.clientX)},onMouseLeave:()=>{oe(void 0),R(void 0),m(void 0),te?.(void 0)},children:[t.size?e.jsxRuntimeExports.jsx(fe.motion.rect,{width:a.bandwidth(),initial:"initial",animate:Y?"whileInView":"initial",variants:{initial:{height:0,x:a(`${t.id}`),y:c(0),fill:o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray},whileInView:{height:t.size?Math.abs(c(t.size)-c(0)):0,y:t.size&&t.size>0?c(t.size):c(0),x:a(`${t.id}`),fill:o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray,transition:{duration:O.duration}}},exit:{height:0,y:c(0),transition:{duration:O.duration}}}):null,pe?e.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${t.label}`.length<N?`${t.label}`:`${`${t.label}`.substring(0,N)}...`,y:(t.size||0)<0?0:c(0)+5,x:a(`${t.id}`),width:a.bandwidth(),height:(t.size||0)<0?c(0)-5:S.bottom,style:k?.xAxis?.labels,className:D?.xAxis?.labels,alignment:(t.size||0)<0?"bottom":"top",animate:O,isInView:Y}):null,ee?e.jsxRuntimeExports.jsx(fe.motion.text,{style:{textAnchor:"middle",...k?.graphObjectValues||{}},className:e.mo("graph-value text-sm",!b&&$.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",D?.graphObjectValues),dy:t.size?t.size>=0?"-5px":"1em":"-5px",variants:{initial:{x:a(`${t.id}`)+a.bandwidth()/2,y:c(0),opacity:0,fill:b||(o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray)},whileInView:{x:a(`${t.id}`)+a.bandwidth()/2,y:c(t.size||0),fill:b||(o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray),opacity:1,transition:{duration:O.duration}}},initial:"initial",animate:Y?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},children:Me.numberFormattingFunction(t.size,v,T,he,U)}):null]},t.label)),j?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:j.map((t,s)=>e.jsxRuntimeExports.jsx(Pe.RefLineY,{text:t.text,color:t.color,y:c(t.value),x1:0-W,x2:E+S.right,classNames:t.classNames,styles:t.styles,animate:O,isInView:Y},s))}):null]}),A.filter(t=>t.position==="after").map(t=>t.layer)]})}),L&&J&&Z&&F?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:L,body:J,xPos:Z,yPos:F,backgroundStyle:k?.tooltip,className:D?.tooltip}):null,Q&&P!==void 0?e.jsxRuntimeExports.jsx(ze.X,{open:P!==void 0,onClose:()=>{B(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof Q=="string"?{__html:Le.string2HTML(Q,P)}:void 0,children:typeof Q=="function"?Q(P):null})}):null]})}function ct(ye){const{data:o,graphTitle:p,colors:G,barPadding:$=.25,showTicks:U=!0,leftMargin:he=20,rightMargin:me=20,topMargin:pe=20,bottomMargin:ee=25,truncateBy:H=999,showLabels:ae=!0,showValues:N=!0,backgroundColor:le=!1,suffix:xe="",prefix:C="",sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce=!0,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g=[],onSeriesMouseClick:k,graphDownload:D=!1,dataDownload:M=!1,language:O="en",theme:T="light",sortData:A,labelOrder:v,showNAColor:w=!0,minHeight:Y=0,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B=!0,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F=5,valueColor:m,styles:E,classNames:h,filterNA:c=!0,animate:x=!1,dimmedOpacity:u=.3,precision:a=2,customLayers:r=[],timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:s="NA"}=ye,[f,we]=d.useState(0),[ue,_]=d.useState(0),[ge,Oe]=d.useState(t.autoplay),de=_e.sort(Se.uniqBy(o,"date",!0).map(n=>Ee.parse(`${n}`,t.dateFormat||"yyyy",new Date).getTime()),(n,je)=>Je.ascending(n,je)),[be,ve]=d.useState(t.autoplay?0:de.length-1),[Ne,l]=d.useState(void 0),i=d.useRef(null),z=d.useRef(null);d.useEffect(()=>{const n=new ResizeObserver(je=>{we(j||je[0].target.clientWidth||620),_(te||je[0].target.clientHeight||480)});return i.current&&(_(i.current.clientHeight||480),we(i.current.clientWidth||620),j||n.observe(i.current)),()=>n.disconnect()},[j,te]),d.useEffect(()=>{const n=setInterval(()=>{ve(je=>je<de.length-1?je+1:0)},(t.speed||2)*1e3);return ge||clearInterval(n),()=>clearInterval(n)},[de,ge,t.speed]);const Ke=Ie.getSliderMarks(de,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${T||"light"} flex ${j?"w-fit grow-0":"w-full grow"}`,dir:O==="he"||O==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${le?le===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${O||"en"}`,j?"w-fit":"w-full",h?.graphContainer),style:{...E?.graphContainer||{},...le&&le!==!0?{backgroundColor:le}:{}},id:Q,ref:z,"aria-label":P||`${p?`The graph shows ${p}. `:""}This is a grouped bar chart. ${J?` ${J}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:le?re||"1rem":re||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||J||D||M?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:h?.title,description:h?.description},graphTitle:p,graphDescription:J,width:j,graphDownload:D?z.current:void 0,dataDownload:M?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,t.enabled&&de.length>0&&Ke?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Oe(!ge)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ge?"Click to pause animation":"Click to play animation",children:ge?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:de[0],max:de[de.length-1],marks:Ke,step:null,defaultValue:de[de.length-1],value:de[be],onChangeComplete:n=>{ve(de.indexOf(n))},onChange:n=>{ve(de.indexOf(n))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[ce&&o.filter(n=>n.color).length!==0?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:j,colorLegendTitle:se,colors:G||Ce.Colors[T].categoricalColors.colors,colorDomain:V||Se.uniqBy(o,"color",!0),setSelectedColor:l,showNAColor:w}):null,e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:i,"aria-label":"Graph area",children:(j||f)&&(te||ue)?e.jsxRuntimeExports.jsx(ut,{data:A?$e.orderBy(Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!q.checkIfNullOrUndefined(n.size):n),[n=>n.size===void 0?A==="asc"?-1/0:1/0:n.size],[A]).filter((n,je)=>L?je<L:!0):Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!q.checkIfNullOrUndefined(n.size):n).filter((n,je)=>L?je<L:!0),barColor:o.filter(n=>n.color).length===0?G?[G]:[Ce.Colors.primaryColors["blue-600"]]:G||Ce.Colors[T].categoricalColors.colors,colorDomain:o.filter(n=>n.color).length===0?[]:V||Se.uniqBy(o,"color",!0),width:j||f,refValues:X,height:Math.max(Y,te||(K?Y?(j||f)*K>Y?(j||f)*K:Y:(j||f)*K:ue)),suffix:xe,prefix:C,barPadding:$,showLabels:ae,showValues:N,showTicks:U,truncateBy:H,leftMargin:he,rightMargin:me,selectedColor:Ne,topMargin:pe,bottomMargin:ee,tooltip:ie,onSeriesMouseOver:ne,maxValue:q.checkIfNullOrUndefined(I)?Math.max(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size))<0?0:Math.max(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size)):I,minValue:q.checkIfNullOrUndefined(b)?Math.min(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size))>=0?0:Math.min(...o.filter(n=>!q.checkIfNullOrUndefined(n.size)).map(n=>n.size)):b,highlightedDataPoints:g,onSeriesMouseClick:k,labelOrder:v,maxBarThickness:S,minBarThickness:oe,resetSelectionOnDoubleClick:B,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,styles:E,classNames:h,animate:x===!0?{duration:.5,once:!0,amount:.5}:x||{duration:0,once:!0,amount:0},dimmedOpacity:u,precision:a,customLayers:r,naLabel:s}):null})]})}),W||y?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:W,footNote:y,width:j}):null]})})})})}function xt(ye){const{data:o,width:p,height:G,barColors:$,suffix:U,prefix:he,barPadding:me,showLabels:pe,showValues:ee,showTicks:H,truncateBy:ae,leftMargin:N,rightMargin:le,topMargin:xe,bottomMargin:C,tooltip:W,onSeriesMouseOver:J,refValues:te,maxValue:j,minValue:y,onSeriesMouseClick:V,selectedColor:se,labelOrder:re,maxBarThickness:K,resetSelectionOnDoubleClick:ie,detailsOnClick:ne,barAxisTitle:X,valueColor:ce,noOfTicks:Q,styles:I,classNames:b,animate:g,colorDomain:k,precision:D,customLayers:M,naLabel:O}=ye,T=d.useRef(null),A=He.useInView(T,{once:g.once,amount:g.amount}),v={top:xe,bottom:C,left:X?N+30:N,right:le},[w,Y]=d.useState(void 0),[S,L]=d.useState(void 0),[oe,P]=d.useState(void 0),[B,Z]=d.useState(void 0),R=p-v.left-v.right,F=G-v.top-v.bottom,m=qe.linear().domain([y,j]).range([F,0]).nice(),E=o.map((a,r)=>({...a,id:re?`${a.label}`:`${r}`})),h=re||E.map(a=>`${a.id}`),c=Te.band().domain(h).range([0,K?Math.min(R,K*h.length):R]).paddingInner(me),x=Te.band().domain(o[0].size.map((a,r)=>`${r}`)).range([0,c.bandwidth()]).paddingInner(.1),u=m.ticks(Q);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{width:`${p}px`,height:`${G}px`,viewBox:`0 0 ${p} ${G}`,direction:"ltr",ref:T,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${v.left},${v.top})`,children:[e.jsxRuntimeExports.jsx(Fe.Axis,{y1:m(y<0?0:y),y2:m(y<0?0:y),x1:0-N,x2:R+v.right,label:Me.numberFormattingFunction(y<0?0:y,O,D,he,U),labelPos:{x:0-N,dx:0,dy:j<0?"1em":-5,y:m(y<0?0:y)},classNames:{axis:b?.xAxis?.axis,label:b?.yAxis?.labels},styles:{axis:I?.xAxis?.axis,label:I?.yAxis?.labels}}),H?e.jsxRuntimeExports.jsx(it.YTicksAndGridLines,{values:u.filter(a=>a!==0),y:u.filter(a=>a!==0).map(a=>m(a)),x1:0-N,x2:R+v.right,styles:{gridLines:I?.yAxis?.gridLines,labels:I?.yAxis?.labels},classNames:{gridLines:b?.yAxis?.gridLines,labels:b?.yAxis?.labels},suffix:U,prefix:he,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:D}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:0-N-15,y:F/2,style:I?.yAxis?.title,className:b?.yAxis?.title,text:X,rotate90:!0}),M.filter(a=>a.position==="before").map(a=>a.layer),e.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[E.map(a=>q.checkIfNullOrUndefined(c(a.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{variants:{initial:{x:c(`${a.id}`),y:0},whileInView:{x:c(`${a.id}`),y:0,transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:[a.size.map((r,t)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",opacity:se?$[t]===se?1:.3:.85,onMouseEnter:s=>{Y({...a,sizeIndex:t}),Z(s.clientY),P(s.clientX),J?.({...a,sizeIndex:t})},onMouseMove:s=>{Y({...a,sizeIndex:t}),Z(s.clientY),P(s.clientX)},onMouseLeave:()=>{Y(void 0),P(void 0),Z(void 0),J?.(void 0)},onClick:()=>{(V||ne)&&(Ae.isEqual(S,{...a,sizeIndex:t})&&ie?(L(void 0),V?.(void 0)):(L({...a,sizeIndex:t}),V&&V({...a,sizeIndex:t})))},children:[e.jsxRuntimeExports.jsx(fe.motion.rect,{x:x(`${t}`),width:x.bandwidth(),variants:{initial:{height:0,y:m(0),fill:$[t]},whileInView:{height:q.checkIfNullOrUndefined(r)?0:Math.abs(m(r)-m(0)),y:q.checkIfNullOrUndefined(r)?m(0):r>0?m(r):m(0),fill:$[t],transition:{duration:g.duration}}},exit:{height:0,y:m(0),transition:{duration:g.duration}},initial:"initial",animate:A?"whileInView":"initial"}),ee?e.jsxRuntimeExports.jsx(fe.motion.text,{x:x(`${t}`)+x.bandwidth()/2,style:{textAnchor:"middle",...I?.graphObjectValues||{}},className:e.mo("graph-value text-sm",b?.graphObjectValues),dy:r?r>=0?"-5px":"1em":"-5px",variants:{initial:{y:m(0),opacity:0,fill:ce||$[t]},whileInView:{y:m(r||0),opacity:1,fill:ce||$[t],transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:Me.numberFormattingFunction(r,O,D,he,U)}):null]},`${a.label}-${k[t]||t}`)),pe?e.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${a.label}`.length<ae?`${a.label}`:`${`${a.label}`.substring(0,ae)}...`,y:m(0)+5,x:0,width:c.bandwidth(),height:v.bottom,style:I?.xAxis?.labels,className:b?.xAxis?.labels,alignment:"top",animate:g,isInView:A}):null]},a.label)),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((a,r)=>e.jsxRuntimeExports.jsx(Pe.RefLineY,{text:a.text,color:a.color,y:m(a.value),x1:0-N,x2:R+v.right,classNames:a.classNames,styles:a.styles,animate:g,isInView:A},r))}):null]}),M.filter(a=>a.position==="after").map(a=>a.layer)]})}),w&&W&&oe&&B?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:w,body:W,xPos:oe,yPos:B,backgroundStyle:I?.tooltip,className:b?.tooltip}):null,ne&&S!==void 0?e.jsxRuntimeExports.jsx(ze.X,{open:S!==void 0,onClose:()=>{L(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof ne=="string"?{__html:Le.string2HTML(ne,S)}:void 0,children:typeof ne=="function"?ne(S):null})}):null]})}function dt(ye){const{data:o,graphTitle:p,colors:G=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,leftMargin:pe=20,rightMargin:ee=20,topMargin:H=20,bottomMargin:ae=25,truncateBy:N=999,showLabels:le=!0,showValues:xe=!0,backgroundColor:C=!1,suffix:W="",prefix:J="",height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g=!1,dataDownload:k=!1,language:D="en",theme:M="light",labelOrder:O,minHeight:T=0,maxBarThickness:A,ariaLabel:v,resetSelectionOnDoubleClick:w=!0,detailsOnClick:Y,barAxisTitle:S,noOfTicks:L=5,valueColor:oe,styles:P,classNames:B,filterNA:Z=!0,showColorScale:R=!0,animate:F=!1,precision:m=2,customLayers:E=[],timeline:h={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:c="NA",sortParameter:x,sortData:u}=ye,[a,r]=d.useState(0),[t,s]=d.useState(0),[f,we]=d.useState(h.autoplay),ue=_e.sort(Se.uniqBy(o,"date",!0).map(l=>Ee.parse(`${l}`,h.dateFormat||"yyyy",new Date).getTime()),(l,i)=>Je.ascending(l,i)),[_,ge]=d.useState(h.autoplay?0:ue.length-1),[Oe,de]=d.useState(void 0),be=d.useRef(null),ve=d.useRef(null);d.useEffect(()=>{const l=new ResizeObserver(i=>{r(j||i[0].target.clientWidth||620),s(te||i[0].target.clientHeight||480)});return be.current&&(s(be.current.clientHeight||480),r(be.current.clientWidth||620),j||l.observe(be.current)),()=>l.disconnect()},[j,te]),d.useEffect(()=>{const l=setInterval(()=>{ge(i=>i<ue.length-1?i+1:0)},(h.speed||2)*1e3);return f||clearInterval(l),()=>clearInterval(l)},[ue,f,h.speed]);const Ne=Ie.getSliderMarks(ue,_,h.showOnlyActiveDate,h.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${M||"light"} flex ${j?"w-fit grow-0":"w-full grow"}`,dir:D==="he"||D==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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 ${D||"en"}`,j?"w-fit":"w-full",B?.graphContainer),style:{...P?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:ce,ref:ve,"aria-label":v||`${p?`The graph shows ${p}. `:""}This is a grouped bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?re||"1rem":re||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||U||g||k?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:P?.title,description:P?.description},classNames:{title:B?.title,description:B?.description},graphTitle:p,graphDescription:U,width:j,graphDownload:g?ve.current:void 0,dataDownload:k?o.map(l=>l.data).filter(l=>l!==void 0).length>0?o.map(l=>l.data).filter(l=>l!==void 0):o.filter(l=>l!==void 0):null}):null,h.enabled&&ue.length>0&&Ne?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!f)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":f?"Click to pause animation":"Click to play animation",children:f?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:ue[0],max:ue[ue.length-1],marks:Ne,step:null,defaultValue:ue[ue.length-1],value:ue[_],onChangeComplete:l=>{ge(ue.indexOf(l))},onChange:l=>{ge(ue.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[R?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:j,colorDomain:V,colors:G,colorLegendTitle:se,setSelectedColor:de,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:be,"aria-label":"Graph area",children:(j||a)&&(te||t)?e.jsxRuntimeExports.jsx(xt,{data:x!==void 0?x==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>Z?!l.size.every(i=>i==null):l),l=>ke.sum(l.size.filter(i=>!q.checkIfNullOrUndefined(i))),[u||"asc"]):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>Z?!l.size.every(i=>i==null):l),l=>q.checkIfNullOrUndefined(l.size[x])?-1/0:l.size[x],[u||"asc"]):Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>Z?!l.size.every(i=>i==null):l),barColors:G,width:j||a,height:Math.max(T,te||(K?T?(j||a)*K>T?(j||a)*K:T:(j||a)*K:t)),suffix:W,prefix:J,barPadding:he,showLabels:le,showValues:xe,showTicks:me,truncateBy:N,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,tooltip:ie,onSeriesMouseOver:ne,refValues:X,maxValue:q.checkIfNullOrUndefined(Q)?Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!q.checkIfNullOrUndefined(i)))))<0?0:Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!q.checkIfNullOrUndefined(i))))):Q,minValue:q.checkIfNullOrUndefined(I)?Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!q.checkIfNullOrUndefined(i)))))>=0?0:Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!q.checkIfNullOrUndefined(i))))):I,onSeriesMouseClick:b,selectedColor:Oe,labelOrder:O,maxBarThickness:A,resetSelectionOnDoubleClick:w,detailsOnClick:Y,barAxisTitle:S,noOfTicks:L,valueColor:oe,styles:P,classNames:B,animate:F===!0?{duration:.5,once:!0,amount:.5}:F||{duration:0,once:!0,amount:0},colorDomain:V,precision:m,customLayers:E,naLabel:c}):null})]})}),$||y?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:P?.footnote,source:P?.source},classNames:{footnote:B?.footnote,source:B?.source},sources:$,footNote:y,width:j}):null]})})})})}function mt(ye){const{data:o,width:p,height:G,barColors:$,barPadding:U,showLabels:he,showTicks:me,truncateBy:pe,leftMargin:ee,topMargin:H,bottomMargin:ae,rightMargin:N,tooltip:le,onSeriesMouseOver:xe,suffix:C,prefix:W,showValues:J,refValues:te,maxValue:j,onSeriesMouseClick:y,selectedColor:V,labelOrder:se,maxBarThickness:re,minBarThickness:K,resetSelectionOnDoubleClick:ie,detailsOnClick:ne,barAxisTitle:X,valueColor:ce,noOfTicks:Q,styles:I,classNames:b,animate:g,colorDomain:k,precision:D,customLayers:M,naLabel:O}=ye,T=d.useRef(null),A=He.useInView(T,{once:g.once,amount:g.amount}),v={top:H,bottom:ae,left:X?ee+30:ee,right:N},[w,Y]=d.useState(void 0),[S,L]=d.useState(void 0),[oe,P]=d.useState(void 0),[B,Z]=d.useState(void 0),R=p-v.left-v.right,F=G-v.top-v.bottom,m=qe.linear().domain([0,j]).range([F,0]).nice(),E=o.map((u,a)=>({...u,id:se?`${u.label}`:`${a}`})),h=se||E.map(u=>`${u.id}`),c=Te.band().domain(h).range([0,K?Math.max(R,K*h.length):re?Math.min(R,re*h.length):R]).paddingInner(U),x=m.ticks(Q);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{width:`${p}px`,height:`${G}px`,viewBox:`0 0 ${p} ${G}`,direction:"ltr",ref:T,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${v.left},${v.top})`,children:[e.jsxRuntimeExports.jsx(Fe.Axis,{y1:m(0),y2:m(0),x1:0-ee,x2:R+v.right,label:Me.numberFormattingFunction(0,O,D,W,C),labelPos:{x:0-ee,y:m(0),dx:0,dy:-5},classNames:{axis:b?.xAxis?.axis,label:b?.yAxis?.labels},styles:{axis:I?.xAxis?.axis,label:I?.yAxis?.labels}}),me?e.jsxRuntimeExports.jsx(it.YTicksAndGridLines,{values:x.filter(u=>u!==0),y:x.filter(u=>u!==0).map(u=>m(u)),x1:0-ee,x2:R+v.right,styles:{gridLines:I?.yAxis?.gridLines,labels:I?.yAxis?.labels},classNames:{gridLines:b?.yAxis?.gridLines,labels:b?.yAxis?.labels},suffix:C,prefix:W,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:D}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:0-ee-15,y:F/2,style:I?.yAxis?.title,className:b?.yAxis?.title,text:X,rotate90:!0}),M.filter(u=>u.position==="before").map(u=>u.layer),e.jsxRuntimeExports.jsxs(Ge.AnimatePresence,{children:[E.map(u=>q.checkIfNullOrUndefined(c(u.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-low-opacity undp-viz-g-with-hover",variants:{initial:{x:c(`${u.id}`),y:0},whileInView:{x:c(`${u.id}`),y:0,transition:{duration:g.duration}}},transition:{duration:g.duration},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:[u.size.map((a,r)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{opacity:V?$[r]===V?1:.3:1,onMouseEnter:t=>{Y({...u,sizeIndex:r}),Z(t.clientY),P(t.clientX),xe?.({...u,sizeIndex:r})},onMouseMove:t=>{Y({...u,sizeIndex:r}),Z(t.clientY),P(t.clientX)},onMouseLeave:()=>{Y(void 0),P(void 0),Z(void 0),xe?.(void 0)},onClick:()=>{(y||ne)&&(Ae.isEqual(S,{...u,sizeIndex:r})&&ie?(L(void 0),y?.(void 0)):(L({...u,sizeIndex:r}),y&&y({...u,sizeIndex:r})))},children:[e.jsxRuntimeExports.jsx(fe.motion.rect,{x:0,width:c.bandwidth(),variants:{initial:{height:0,fill:$[r],y:m(0)},whileInView:{height:Math.abs(m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))-m(ke.sum(u.size.filter((t,s)=>s<r&&t)))),y:m(ke.sum(u.size.filter((t,s)=>s<=r&&t))),fill:$[r],transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{height:0,y:m(0),transition:{duration:g.duration}}}),J?e.jsxRuntimeExports.jsx(fe.motion.text,{x:c.bandwidth()/2,style:{textAnchor:"middle",...I?.graphObjectValues||{}},className:e.mo("graph-value text-sm",b?.graphObjectValues),dy:"0.33em",variants:{initial:{y:m(0),opacity:0,fill:Qe.getTextColorBasedOnBgColor($[r])},whileInView:{y:m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))+Math.abs(m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))-m(ke.sum(u.size.filter((t,s)=>s<r&&t))))/2,opacity:a&&Math.abs(m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))-m(ke.sum(u.size.filter((t,s)=>s<r&&t))))>20?1:0,fill:Qe.getTextColorBasedOnBgColor($[r]),transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:Me.numberFormattingFunction(a,O,D,W,C)}):null]},`${u.label}-${k[r]||r}`)),he?e.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${u.label}`.length<pe?`${u.label}`:`${`${u.label}`.substring(0,pe)}...`,y:m(0)+5,x:0,width:c.bandwidth(),height:v.bottom,style:I?.xAxis?.labels,className:b?.xAxis?.labels,alignment:"top",animate:g,isInView:A}):null,J?e.jsxRuntimeExports.jsx(fe.motion.text,{style:{textAnchor:"middle",...I?.graphObjectValues||{}},x:c.bandwidth()/2,dy:-10,className:e.mo("graph-value graph-value-total",ce?"text-sm":"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",b?.graphObjectValues),variants:{initial:{y:m(0),opacity:0,...ce&&{fill:ce}},whileInView:{y:m(ke.sum(u.size.map(a=>a||0))),opacity:1,...ce&&{fill:ce},transition:{duration:g.duration}}},exit:{opacity:0,transition:{duration:g.duration}},initial:"initial",animate:A?"whileInView":"initial",children:Me.numberFormattingFunction(ke.sum(u.size.filter(a=>a)),O,D,W,C)}):null]},u.label)),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((u,a)=>e.jsxRuntimeExports.jsx(Pe.RefLineY,{text:u.text,color:u.color,y:m(u.value),x1:0-ee,x2:R+v.right,classNames:u.classNames,styles:u.styles,animate:g,isInView:A},a))}):null]}),M.filter(u=>u.position==="after").map(u=>u.layer)]})}),w&&le&&oe&&B?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:w,body:le,xPos:oe,yPos:B,backgroundStyle:I?.tooltip,className:b?.tooltip}):null,ne&&S!==void 0?e.jsxRuntimeExports.jsx(ze.X,{open:S!==void 0,onClose:()=>{L(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof ne=="string"?{__html:Le.string2HTML(ne,S)}:void 0,children:typeof ne=="function"?ne(S):null})}):null]})}function ht(ye){const{data:o,graphTitle:p,colors:G=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,leftMargin:pe=20,rightMargin:ee=20,topMargin:H=20,bottomMargin:ae=25,truncateBy:N=999,showLabels:le=!0,showValues:xe=!0,backgroundColor:C=!1,showColorScale:W=!0,suffix:J="",prefix:te="",height:j,width:y,footNote:V,colorDomain:se,colorLegendTitle:re,padding:K,tooltip:ie,onSeriesMouseOver:ne,relativeHeight:X,refValues:ce,graphID:Q,maxValue:I,onSeriesMouseClick:b,graphDownload:g=!1,dataDownload:k=!1,language:D="en",theme:M="light",labelOrder:O,minHeight:T=0,maxBarThickness:A,sortParameter:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L=!0,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B=5,valueColor:Z,styles:R,classNames:F,filterNA:m=!0,animate:E=!1,precision:h=2,customLayers:c=[],timeline:x={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:u="NA",sortData:a}=ye,[r,t]=d.useState(0),[s,f]=d.useState(0),[we,ue]=d.useState(x.autoplay),_=_e.sort(Se.uniqBy(o,"date",!0).map(i=>Ee.parse(`${i}`,x.dateFormat||"yyyy",new Date).getTime()),(i,z)=>Je.ascending(i,z)),[ge,Oe]=d.useState(x.autoplay?0:_.length-1),[de,be]=d.useState(void 0),ve=d.useRef(null),Ne=d.useRef(null);d.useEffect(()=>{const i=new ResizeObserver(z=>{t(y||z[0].target.clientWidth||620),f(j||z[0].target.clientHeight||480)});return ve.current&&(f(ve.current.clientHeight||480),t(ve.current.clientWidth||620),y||i.observe(ve.current)),()=>i.disconnect()},[y,j]),d.useEffect(()=>{const i=setInterval(()=>{Oe(z=>z<_.length-1?z+1:0)},(x.speed||2)*1e3);return we||clearInterval(i),()=>clearInterval(i)},[_,we,x.speed]);const l=Ie.getSliderMarks(_,ge,x.showOnlyActiveDate,x.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${M||"light"} flex ${y?"w-fit grow-0":"w-full grow"}`,dir:D==="he"||D==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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 ${D||"en"}`,y?"w-fit":"w-full",F?.graphContainer),style:{...R?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:Q,ref:Ne,"aria-label":S||`${p?`The graph shows ${p}. `:""}This is a stacked bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{style:{padding:C?K||"1rem":K||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||U||g||k?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:R?.title,description:R?.description},classNames:{title:F?.title,description:F?.description},graphTitle:p,graphDescription:U,width:y,graphDownload:g?Ne.current:void 0,dataDownload:k?o.map(i=>i.data).filter(i=>i!==void 0).length>0?o.map(i=>i.data).filter(i=>i!==void 0):o.filter(i=>i!==void 0):null}):null,x.enabled&&_.length>0&&l?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ue(!we)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":we?"Click to pause animation":"Click to play animation",children:we?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:_[0],max:_[_.length-1],marks:l,step:null,defaultValue:_[_.length-1],value:_[ge],onChangeComplete:i=>{Oe(_.indexOf(i))},onChange:i=>{Oe(_.indexOf(i))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[W?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:y,colorDomain:se,colors:G,colorLegendTitle:re,setSelectedColor:be,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:ve,"aria-label":"Graph area",children:(y||r)&&(j||s)?e.jsxRuntimeExports.jsx(mt,{data:v!==void 0?v==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>ke.sum(i.size.filter(z=>!q.checkIfNullOrUndefined(z))),[a||"asc"]).filter((i,z)=>w?z<w:!0):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>q.checkIfNullOrUndefined(i.size[v])?-1/0:i.size[v],[a||"asc"]).filter((i,z)=>w?z<w:!0):Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>m?!i.size.every(z=>z==null):i).filter((i,z)=>w?z<w:!0),barColors:G,width:y||r,height:Math.max(T,j||(X?T?(y||r)*X>T?(y||r)*X:T:(y||r)*X:s)),barPadding:he,showLabels:le,showTicks:me,truncateBy:N,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,tooltip:ie,onSeriesMouseOver:ne,showValues:xe,suffix:J,prefix:te,refValues:ce,maxValue:q.checkIfNullOrUndefined(I)?Math.max(...o.map(i=>ke.sum(i.size.filter(z=>!q.checkIfNullOrUndefined(z)))||0)):I,onSeriesMouseClick:b,selectedColor:de,labelOrder:O,maxBarThickness:A,minBarThickness:Y,resetSelectionOnDoubleClick:L,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,styles:R,classNames:F,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},colorDomain:se,precision:h,customLayers:c,naLabel:u}):null})]})}),$||V?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:R?.footnote,source:R?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:$,footNote:V,width:y}):null]})})})})}function pt(ye){const{data:o,graphTitle:p,colors:G,barPadding:$,showTicks:U,leftMargin:he,rightMargin:me,topMargin:pe,bottomMargin:ee,truncateBy:H,showLabels:ae,showValues:N,backgroundColor:le,suffix:xe,prefix:C,sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g,onSeriesMouseClick:k,graphDownload:D,dataDownload:M,language:O,theme:T,sortData:A,labelOrder:v,showNAColor:w,minHeight:Y,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,orientation:E="vertical",styles:h,classNames:c,filterNA:x,animate:u,dimmedOpacity:a,precision:r,customLayers:t,timeline:s,naLabel:f}=ye;return E==="vertical"?e.jsxRuntimeExports.jsx(ct,{data:o,graphTitle:p,colors:G,barPadding:$,showTicks:U,leftMargin:he,rightMargin:me,topMargin:pe,bottomMargin:ee,truncateBy:H,showLabels:ae,showValues:N,backgroundColor:le,suffix:xe,prefix:C,sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g,onSeriesMouseClick:k,graphDownload:D,dataDownload:M,language:O,theme:T,sortData:A,labelOrder:v,showNAColor:w,minHeight:Y,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B,styles:h,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,classNames:c,filterNA:x,animate:u,dimmedOpacity:a,precision:r,customLayers:t,timeline:s,naLabel:f}):e.jsxRuntimeExports.jsx(st,{data:o,graphTitle:p,colors:G,barPadding:$,showTicks:U,leftMargin:he,rightMargin:me,topMargin:pe,bottomMargin:ee,truncateBy:H,showLabels:ae,showValues:N,backgroundColor:le,suffix:xe,prefix:C,sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g,onSeriesMouseClick:k,graphDownload:D,dataDownload:M,language:O,theme:T,sortData:A,labelOrder:v,showNAColor:w,minHeight:Y,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B,styles:h,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,classNames:c,filterNA:x,animate:u,dimmedOpacity:a,precision:r,customLayers:t,timeline:s,naLabel:f})}function gt(ye){const{data:o,graphTitle:p,colors:G,sources:$,graphDescription:U,barPadding:he,showTicks:me,truncateBy:pe,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe,prefix:C,showValues:W,padding:J,backgroundColor:te,leftMargin:j,rightMargin:y,topMargin:V,bottomMargin:se,showLabels:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g,dataDownload:k,language:D,labelOrder:M,minHeight:O,theme:T,sortParameter:A,sortData:v,maxBarThickness:w,ariaLabel:Y,resetSelectionOnDoubleClick:S,detailsOnClick:L,barAxisTitle:oe,noOfTicks:P,valueColor:B,orientation:Z="vertical",styles:R,classNames:F,filterNA:m,animate:E,precision:h,customLayers:c,showColorScale:x,timeline:u,naLabel:a}=ye;return Z==="vertical"?e.jsxRuntimeExports.jsx(dt,{data:o,graphTitle:p,colors:G,sources:$,graphDescription:U,barPadding:he,showTicks:me,truncateBy:pe,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe,prefix:C,showValues:W,padding:J,backgroundColor:te,leftMargin:j,rightMargin:y,sortParameter:A,sortData:v,topMargin:V,bottomMargin:se,showLabels:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g,dataDownload:k,language:D,labelOrder:M,minHeight:O,theme:T,maxBarThickness:w,ariaLabel:Y,resetSelectionOnDoubleClick:S,styles:R,detailsOnClick:L,barAxisTitle:oe,noOfTicks:P,valueColor:B,classNames:F,filterNA:m,animate:E,precision:h,customLayers:c,showColorScale:x,timeline:u,naLabel:a}):e.jsxRuntimeExports.jsx(nt,{data:o,graphTitle:p,colors:G,sortParameter:A,sortData:v,sources:$,graphDescription:U,barPadding:he,showTicks:me,truncateBy:pe,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe,prefix:C,showValues:W,padding:J,backgroundColor:te,leftMargin:j,rightMargin:y,topMargin:V,bottomMargin:se,showLabels:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g,dataDownload:k,language:D,labelOrder:M,minHeight:O,theme:T,maxBarThickness:w,ariaLabel:Y,resetSelectionOnDoubleClick:S,styles:R,detailsOnClick:L,barAxisTitle:oe,noOfTicks:P,valueColor:B,classNames:F,filterNA:m,animate:E,precision:h,customLayers:c,showColorScale:x,timeline:u,naLabel:a})}function ft(ye){const{data:o,graphTitle:p,colors:G,sources:$,graphDescription:U,barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,truncateBy:N,showLabels:le,showValues:xe,backgroundColor:C,suffix:W,prefix:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,tooltip:K,onSeriesMouseOver:ie,relativeHeight:ne,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b,dataDownload:g,language:k,theme:D,labelOrder:M,minHeight:O,maxBarThickness:T,sortParameter:A,sortData:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,orientation:R="vertical",styles:F,classNames:m,filterNA:E,animate:h,precision:c,customLayers:x,showColorScale:u,timeline:a,naLabel:r}=ye;return R==="vertical"?e.jsxRuntimeExports.jsx(ht,{data:o,graphTitle:p,colors:G,sources:$,graphDescription:U,barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,truncateBy:N,showLabels:le,showValues:xe,backgroundColor:C,suffix:W,prefix:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,tooltip:K,onSeriesMouseOver:ie,relativeHeight:ne,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b,dataDownload:g,language:k,theme:D,labelOrder:M,minHeight:O,maxBarThickness:T,sortParameter:A,sortData:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L,styles:F,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,classNames:m,filterNA:E,animate:h,precision:c,customLayers:x,showColorScale:u,timeline:a,naLabel:r}):e.jsxRuntimeExports.jsx(ot,{data:o,graphTitle:p,colors:G,sources:$,graphDescription:U,barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,truncateBy:N,showLabels:le,showValues:xe,backgroundColor:C,suffix:W,prefix:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,tooltip:K,onSeriesMouseOver:ie,relativeHeight:ne,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b,dataDownload:g,language:k,theme:D,labelOrder:M,minHeight:O,maxBarThickness:T,sortParameter:A,sortData:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L,styles:F,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,classNames:m,filterNA:E,animate:h,precision:c,customLayers:x,showColorScale:u,timeline:a,naLabel:r})}exports.GroupedBarGraph=gt;exports.SimpleBarGraph=pt;exports.StackedBarGraph=ft;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CHPV5EwG-DjM48pIC.cjs"),d=require("react"),Ee=require("./parse-hMnG_lRV.cjs"),Ie=require("./getSliderMarks-CUxPy36E.cjs"),$e=require("./index-CQ3e6Ewi.cjs"),Ae=require("./index-DQA8q5sC.cjs"),ze=require("./Modal-CuuJdWkD.cjs"),Me=require("./numberFormattingFunction-02t-wJta.cjs"),Ve=require("./Tooltip-Cpv0QohJ.cjs"),G=require("./checkIfNullOrUndefined-BCW3Y1ML.cjs"),Ce=require("./Colors.cjs"),Le=require("./string2HTML-z7CwHXcx.cjs"),Ze=require("./XTicksAndGridLines-RKy7BVCO.cjs"),et=require("./YAxesLabels-Dqd259-t.cjs"),Be=require("./AxisTitle-Wkz-xeQL.cjs"),Fe=require("./Axis-CkNn1wit.cjs"),Pe=require("./ReferenceLine-D04j-zeV.cjs"),He=require("./use-in-view-CEwlc_dd.cjs"),Ge=require("./linear-BVckp9RD.cjs"),Te=require("./band-CAApY4Pd.cjs"),qe=require("./index-Cm8NIdOO.cjs"),fe=require("./proxy-CKadx4lC.cjs"),Ue=require("./GraphFooter.cjs"),We=require("./GraphHeader.cjs"),Xe=require("./ColorLegendWithMouseOver.cjs"),Ye=require("./EmptyState-B8IpKGcL.cjs"),De=require("./index-C0bpbS4F.cjs"),Re=require("./ensureCompleteData-DkQYPeDa.cjs"),Se=require("./uniqBy-O05lp2S5.cjs"),_e=require("./sort-O96oMZLb.cjs"),Je=require("./init-DU0ybBc_.cjs"),ke=require("./index-CSNtgibC.cjs"),Qe=require("./getTextColorBasedOnBgColor-nqY-bsM_.cjs"),tt=require("./XAxesLabels-CLZnBgSr.cjs"),it=require("./YTicksAndGridLines-qGpRo_t1.cjs");function at(ye){const{data:o,barColor:p,suffix:q,prefix:$,barPadding:U,showValues:he,showTicks:me,leftMargin:pe,truncateBy:ee,width:H,height:ae,colorDomain:N,rightMargin:le,topMargin:xe,bottomMargin:C,showLabels:W,tooltip:J,onSeriesMouseOver:te,refValues:j,selectedColor:y,highlightedDataPoints:V,maxValue:se,minValue:re,onSeriesMouseClick:K,labelOrder:ie,rtl:ne,maxBarThickness:X,minBarThickness:ce,resetSelectionOnDoubleClick:Q,detailsOnClick:I,barAxisTitle:b,valueColor:g,noOfTicks:k,styles:D,classNames:M,animate:O,dimmedOpacity:T,precision:A,customLayers:v,naLabel:w}=ye,Y=d.useRef(null),S=He.useInView(Y,{once:O.once,amount:O.amount}),[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),[F,m]=d.useState(void 0),E={top:b?xe+25:xe,bottom:C,left:pe,right:le},h=H-E.left-E.right,c=ae-E.top-E.bottom,x=o.map((s,f)=>({...s,id:ie?`${s.label}`:`${f}`})),u=Ge.linear().domain([re,se]).range([0,h]).nice(),a=ie||x.map(s=>`${s.id}`),r=Te.band().domain(a).range([0,ce?Math.max(c,ce*a.length):X?Math.min(c,X*a.length):c]).paddingInner(U),t=u.ticks(k);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:Y,width:`${H}px`,height:`${ae}px`,viewBox:`0 0 ${H} ${ae}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${E.left},${E.top})`,children:[me?e.jsxRuntimeExports.jsx(Ze.XTicksAndGridLines,{values:t.filter(s=>s!==0),x:t.filter(s=>s!==0).map(s=>u(s)),y1:0-xe,y2:c+E.bottom,styles:{gridLines:D?.xAxis?.gridLines,labels:D?.xAxis?.labels},classNames:{gridLines:M?.xAxis?.gridLines,labels:M?.xAxis?.labels},suffix:q,prefix:$,labelType:"secondary",showGridLines:!0,precision:A}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:h/2,y:0-E.top+15,style:D?.xAxis?.title,className:M?.xAxis?.title,text:b}),v.filter(s=>s.position==="before").map(s=>s.layer),e.jsxRuntimeExports.jsxs(qe.AnimatePresence,{children:[x.map(s=>G.checkIfNullOrUndefined(r(s.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",variants:{initial:{opacity:y?s.color&&p[N.indexOf(s.color)]===y?1:T:V.length!==0?V.indexOf(s.label)!==-1?.85:T:.85},whileInView:{opacity:y?s.color&&p[N.indexOf(s.color)]===y?1:T:V.length!==0?V.indexOf(s.label)!==-1?.85:T:.85,transition:{duration:O.duration}}},initial:"initial",animate:S?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},onMouseEnter:f=>{oe(s),m(f.clientY),R(f.clientX),te?.(s)},onClick:()=>{(K||I)&&(Ae.isEqual(P,s)&&Q?(B(void 0),K?.(void 0)):(B(s),K?.(s)))},onMouseMove:f=>{oe(s),m(f.clientY),R(f.clientX)},onMouseLeave:()=>{oe(void 0),R(void 0),m(void 0),te?.(void 0)},children:[s.size?e.jsxRuntimeExports.jsx(fe.motion.rect,{variants:{initial:{width:0,x:u(0),y:r(`${s.id}`),fill:o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray},whileInView:{width:s.size>=0?u(s.size)-u(0):u(0)-u(s.size),x:s.size>=0?u(0):u(s.size),y:r(`${s.id}`),fill:o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray,transition:{duration:O.duration}}},initial:"initial",animate:S?"whileInView":"initial",exit:{width:0,x:u(0),transition:{duration:O.duration}},height:r.bandwidth()}):null,W?e.jsxRuntimeExports.jsx(et.YAxesLabels,{value:`${s.label}`.length<ee?`${s.label}`:`${`${s.label}`.substring(0,ee)}...`,y:r(s.id)||0,x:(s.size||0)<0?u(0):0-E.left,width:(s.size||0)<0?H-u(0):u(0)+E.left,height:r.bandwidth(),alignment:s.size&&s.size<0?"left":"right",style:D?.yAxis?.labels,className:M?.yAxis?.labels,animate:O,isInView:S}):null,he?e.jsxRuntimeExports.jsx(fe.motion.text,{style:{textAnchor:s.size&&s.size<0?"end":"start",...D?.graphObjectValues||{}},className:e.mo("graph-value text-sm",!g&&p.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",M?.graphObjectValues),dx:s.size&&s.size<0?-5:5,dy:"0.33em",variants:{initial:{x:u(0),y:r(`${s.id}`)+r.bandwidth()/2,opacity:0,fill:g||(o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray)},whileInView:{x:s.size?u(s.size):u(0),opacity:1,y:r(`${s.id}`)+r.bandwidth()/2,fill:g||(o.filter(f=>f.color).length===0?p[0]:s.color?p[N.indexOf(s.color)]:Ce.Colors.gray),transition:{duration:O.duration}}},initial:"initial",animate:S?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},children:Me.numberFormattingFunction(s.size,w,A,$,q)}):null]},s.label)),e.jsxRuntimeExports.jsx(Fe.Axis,{x1:u(re<0?0:re),x2:u(re<0?0:re),y1:-2.5,y2:c+E.bottom,classNames:{axis:M?.yAxis?.axis},styles:{axis:D?.yAxis?.axis}}),j?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:j.map((s,f)=>e.jsxRuntimeExports.jsx(Pe.RefLineX,{text:s.text,color:s.color,x:u(s.value),y1:0-E.top,y2:c+E.bottom,textSide:u(s.value)>h*.75||ne?"left":"right",classNames:s.classNames,styles:s.styles,animate:O,isInView:S},f))}):null]}),v.filter(s=>s.position==="after").map(s=>s.layer)]})}),L&&J&&Z&&F?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:L,body:J,xPos:Z,yPos:F,backgroundStyle:D?.tooltip,className:M?.tooltip}):null,I&&P!==void 0?e.jsxRuntimeExports.jsx(ze.G,{open:P!==void 0,onClose:()=>{B(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof I=="string"?{__html:Le.string2HTML(I,P)}:void 0,children:typeof I=="function"?I(P):null})}):null]})}function st(ye){const{data:o,graphTitle:p,colors:q,suffix:$="",sources:U,prefix:he="",graphDescription:me,barPadding:pe=.25,showValues:ee=!0,showTicks:H=!0,leftMargin:ae=100,rightMargin:N=40,truncateBy:le=999,height:xe,width:C,footNote:W,colorDomain:J,colorLegendTitle:te,highlightedDataPoints:j=[],padding:y,backgroundColor:V=!1,topMargin:se=25,bottomMargin:re=10,showLabels:K=!0,relativeHeight:ie,tooltip:ne,onSeriesMouseOver:X,refValues:ce,showColorScale:Q=!0,graphID:I,maxValue:b,minValue:g,onSeriesMouseClick:k,graphDownload:D=!1,dataDownload:M=!1,sortData:O,labelOrder:T,language:A="en",showNAColor:v=!0,minHeight:w=0,theme:Y="light",maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B=!0,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F=5,valueColor:m,styles:E,classNames:h,filterNA:c=!0,animate:x=!1,dimmedOpacity:u=.3,precision:a=2,customLayers:r=[],timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:s="NA"}=ye,[f,we]=d.useState(0),[ue,_]=d.useState(0),[ge,Oe]=d.useState(t.autoplay),de=_e.sort(Se.uniqBy(o,"date",!0).map(n=>Ee.parse(`${n}`,t.dateFormat||"yyyy",new Date).getTime()),(n,je)=>Je.ascending(n,je)),[be,ve]=d.useState(t.autoplay?0:de.length-1),[Ne,l]=d.useState(void 0),i=d.useRef(null),z=d.useRef(null);d.useEffect(()=>{const n=new ResizeObserver(je=>{we(C||je[0].target.clientWidth||620),_(xe||je[0].target.clientHeight||480)});return i.current&&(_(i.current.clientHeight||480),we(i.current.clientWidth||620),C||n.observe(i.current)),()=>n.disconnect()},[C,xe]),d.useEffect(()=>{const n=setInterval(()=>{ve(je=>je<de.length-1?je+1:0)},(t.speed||2)*1e3);return ge||clearInterval(n),()=>clearInterval(n)},[de,ge,t.speed]);const Ke=Ie.getSliderMarks(de,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${Y||"light"} flex ${C?"w-fit grow-0":"w-full grow"}`,dir:A==="he"||A==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${V?V===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${A||"en"}`,C?"w-fit":"w-full",h?.graphContainer),style:{...E?.graphContainer||{},...V&&V!==!0?{backgroundColor:V}:{}},id:I,ref:z,"aria-label":P||`${p?`The graph shows ${p}. `:""}This is a bar chart. ${me?` ${me}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:V?y||"1rem":y||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||me||D||M?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:h?.title,description:h?.description},graphTitle:p,graphDescription:me,width:C,graphDownload:D?z.current:void 0,dataDownload:M?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,t.enabled&&de.length>0&&Ke?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Oe(!ge)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ge?"Click to pause animation":"Click to play animation",children:ge?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:de[0],max:de[de.length-1],marks:Ke,step:null,defaultValue:de[de.length-1],value:de[be],onChangeComplete:n=>{ve(de.indexOf(n))},onChange:n=>{ve(de.indexOf(n))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[Q&&o.filter(n=>n.color).length!==0?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:C,colorLegendTitle:te,colors:q||Ce.Colors[Y].categoricalColors.colors,colorDomain:J||Se.uniqBy(o,"color",!0),setSelectedColor:l,showNAColor:v}):null,e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:i,"aria-label":"Graph area",children:(C||f)&&(xe||ue)?e.jsxRuntimeExports.jsx(at,{data:O?$e.orderBy(Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!G.checkIfNullOrUndefined(n.size):n),[n=>n.size===void 0?O==="asc"?1/0:-1/0:n.size],[O]).filter((n,je)=>L?je<L:!0):Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!G.checkIfNullOrUndefined(n.size):n).filter((n,je)=>L?je<L:!0),barColor:o.filter(n=>n.color).length===0?q?[q]:[Ce.Colors.primaryColors["blue-600"]]:q||Ce.Colors[Y].categoricalColors.colors,colorDomain:o.filter(n=>n.color).length===0?[]:J||Se.uniqBy(o,"color",!0),width:C||f,selectedColor:Ne,height:Math.max(w,xe||(ie?w?(C||f)*ie>w?(C||f)*ie:w:(C||f)*ie:ue)),suffix:$,prefix:he,barPadding:pe,showValues:ee,showTicks:H,leftMargin:ae,rightMargin:N,topMargin:se,bottomMargin:re,truncateBy:le,showLabels:K,tooltip:ne,onSeriesMouseOver:X,refValues:ce,maxValue:G.checkIfNullOrUndefined(b)?Math.max(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size))<0?0:Math.max(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size)):b,minValue:G.checkIfNullOrUndefined(g)?Math.min(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size))>=0?0:Math.min(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size)):g,highlightedDataPoints:j,onSeriesMouseClick:k,labelOrder:T,rtl:A==="he"||A==="ar",maxBarThickness:S,minBarThickness:oe,resetSelectionOnDoubleClick:B,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,classNames:h,styles:E,animate:x===!0?{duration:.5,once:!0,amount:.5}:x||{duration:0,once:!0,amount:0},dimmedOpacity:u,precision:a,customLayers:r,naLabel:s}):null})]})}),U||W?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{sources:U,footNote:W,width:C,styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:h?.footnote,source:h?.source}}):null]})})})})}function rt(ye){const{data:o,barColors:p,barPadding:q,showTicks:$,leftMargin:U,truncateBy:he,width:me,height:pe,suffix:ee,prefix:H,showValues:ae,rightMargin:N,topMargin:le,bottomMargin:xe,showLabels:C,tooltip:W,onSeriesMouseOver:J,refValues:te,maxValue:j,minValue:y,onSeriesMouseClick:V,selectedColor:se,rtl:re,labelOrder:K,maxBarThickness:ie,resetSelectionOnDoubleClick:ne,detailsOnClick:X,barAxisTitle:ce,valueColor:Q,noOfTicks:I,styles:b,classNames:g,animate:k,colorDomain:D,precision:M,customLayers:O,naLabel:T}=ye,A=d.useRef(null),v=He.useInView(A,{once:k.once,amount:k.amount}),w={top:ce?le+25:le,bottom:xe,left:U,right:N},[Y,S]=d.useState(void 0),[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),F=me-w.left-w.right,m=pe-w.top-w.bottom,E=o.map((r,t)=>({...r,id:K?`${r.label}`:`${t}`})),h=K||E.map(r=>`${r.id}`),c=Ge.linear().domain([y,j]).range([0,F]).nice(),x=Te.band().domain(h).range([0,ie?Math.min(m,ie*h.length):m]).paddingInner(q),u=Te.band().domain(o[0].size.map((r,t)=>`${t}`)).range([0,x.bandwidth()]).paddingInner(.1),a=c.ticks(I);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:A,width:`${me}px`,height:`${pe}px`,viewBox:`0 0 ${me} ${pe}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[$?e.jsxRuntimeExports.jsx(Ze.XTicksAndGridLines,{values:a.filter(r=>r!==0),x:a.filter(r=>r!==0).map(r=>c(r)),y1:0-le,y2:m+w.bottom,styles:{gridLines:b?.xAxis?.gridLines,labels:b?.xAxis?.labels},classNames:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},suffix:ee,prefix:H,labelType:"secondary",showGridLines:!0,precision:M}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:F/2,y:0-w.top+15,style:b?.xAxis?.title,className:g?.xAxis?.title,text:ce}),O.filter(r=>r.position==="before").map(r=>r.layer),e.jsxRuntimeExports.jsxs(qe.AnimatePresence,{children:[E.map(r=>G.checkIfNullOrUndefined(x(r.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{variants:{initial:{x:0,y:x(`${r.id}`)},whileInView:{x:0,y:x(`${r.id}`),transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},children:[r.size.map((t,s)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",opacity:se?p[s]===se?1:.3:.85,onMouseEnter:f=>{S({...r,sizeIndex:s}),R(f.clientY),B(f.clientX),J?.({...r,sizeIndex:s})},onMouseMove:f=>{S({...r,sizeIndex:s}),R(f.clientY),B(f.clientX)},onMouseLeave:()=>{S(void 0),B(void 0),R(void 0),J?.(void 0)},onClick:()=>{(V||X)&&(Ae.isEqual(L,{...r,sizeIndex:s})&&ne?(oe(void 0),V?.(void 0)):(oe({...r,sizeIndex:s}),V&&V({...r,sizeIndex:s})))},children:[G.checkIfNullOrUndefined(t)?null:e.jsxRuntimeExports.jsx(fe.motion.rect,{y:u(`${s}`),variants:{initial:{width:0,x:c(0),fill:p[s]},whileInView:{width:G.checkIfNullOrUndefined(t)?0:t>=0?c(t)-c(0):c(0)-c(t),x:t>=0?c(0):c(t),fill:p[s],transition:{duration:k.duration}}},exit:{width:0,x:c(0),transition:{duration:k.duration}},height:u.bandwidth(),initial:"initial",animate:v?"whileInView":"initial"}),ae?e.jsxRuntimeExports.jsx(fe.motion.text,{y:u(`${s}`)+u.bandwidth()/2,style:{textAnchor:t&&t<0?"end":"start",...b?.graphObjectValues||{}},className:e.mo("graph-value text-sm",g?.graphObjectValues),dx:t&&t<0?-5:5,dy:"0.33em",variants:{initial:{x:c(0),opacity:0,fill:Q||p[s]},whileInView:{x:c(t||0),opacity:1,fill:Q||p[s],transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},children:Me.numberFormattingFunction(t,T,M,H,ee)}):null]},`${r.label}-${D[s]||s}`)),C?e.jsxRuntimeExports.jsx(et.YAxesLabels,{value:`${r.label}`.length<he?`${r.label}`:`${`${r.label}`.substring(0,he)}...`,y:0,x:0-w.left,width:c(y<0?0:y)+w.left,height:x.bandwidth(),style:b?.yAxis?.labels,className:g?.yAxis?.labels,animate:k,isInView:v}):null]},r.label)),e.jsxRuntimeExports.jsx(Fe.Axis,{x1:c(y<0?0:y),x2:c(y<0?0:y),y1:-2.5,y2:m+w.bottom,classNames:{axis:g?.yAxis?.axis},styles:{axis:b?.yAxis?.axis}}),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((r,t)=>e.jsxRuntimeExports.jsx(Pe.RefLineX,{text:r.text,color:r.color,x:c(r.value),y1:0-w.top,y2:m+w.bottom,textSide:c(r.value)>F*.75||re?"left":"right",classNames:r.classNames,styles:r.styles,animate:k,isInView:v},t))}):null]}),O.filter(r=>r.position==="after").map(r=>r.layer)]})}),Y&&W&&P&&Z?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:Y,body:W,xPos:P,yPos:Z,backgroundStyle:b?.tooltip,className:g?.tooltip}):null,X&&L!==void 0?e.jsxRuntimeExports.jsx(ze.G,{open:L!==void 0,onClose:()=>{oe(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof X=="string"?{__html:Le.string2HTML(X,L)}:void 0,children:typeof X=="function"?X(L):null})}):null]})}function nt(ye){const{data:o,graphTitle:p,colors:q=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,truncateBy:pe=999,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe="",prefix:C="",showValues:W=!0,showColorScale:J=!0,padding:te,backgroundColor:j=!1,leftMargin:y=100,rightMargin:V=40,topMargin:se=25,bottomMargin:re=10,showLabels:K=!0,relativeHeight:ie,tooltip:ne,onSeriesMouseOver:X,refValues:ce,graphID:Q,maxValue:I,minValue:b,onSeriesMouseClick:g,graphDownload:k=!1,dataDownload:D=!1,language:M="en",labelOrder:O,minHeight:T=0,theme:A="light",maxBarThickness:v,ariaLabel:w,resetSelectionOnDoubleClick:Y=!0,detailsOnClick:S,barAxisTitle:L,noOfTicks:oe=5,valueColor:P,styles:B,classNames:Z,filterNA:R=!0,animate:F=!1,precision:m=2,customLayers:E=[],timeline:h={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:c="NA",sortParameter:x,sortData:u}=ye,[a,r]=d.useState(0),[t,s]=d.useState(0),[f,we]=d.useState(h.autoplay),ue=_e.sort(Se.uniqBy(o,"date",!0).map(l=>Ee.parse(`${l}`,h.dateFormat||"yyyy",new Date).getTime()),(l,i)=>Je.ascending(l,i)),[_,ge]=d.useState(h.autoplay?0:ue.length-1),[Oe,de]=d.useState(void 0),be=d.useRef(null),ve=d.useRef(null);d.useEffect(()=>{const l=new ResizeObserver(i=>{r(H||i[0].target.clientWidth||620),s(ee||i[0].target.clientHeight||480)});return be.current&&(s(be.current.clientHeight||480),r(be.current.clientWidth||620),H||l.observe(be.current)),()=>l.disconnect()},[H,ee]),d.useEffect(()=>{const l=setInterval(()=>{ge(i=>i<ue.length-1?i+1:0)},(h.speed||2)*1e3);return f||clearInterval(l),()=>clearInterval(l)},[ue,f,h.speed]);const Ne=Ie.getSliderMarks(ue,_,h.showOnlyActiveDate,h.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${A||"light"} flex ${H?"w-fit grow-0":"w-full grow"}`,dir:M==="he"||M==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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 ${M||"en"}`,H?"w-fit":"w-full",Z?.graphContainer),style:{...B?.graphContainer||{},...j&&j!==!0?{backgroundColor:j}:{}},id:Q,ref:ve,"aria-label":w||`${p?`The graph shows ${p}. `:""}This is a grouped bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:j?te||"1rem":te||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[p||U||k||D?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:B?.title,description:B?.description},classNames:{title:Z?.title,description:Z?.description},graphTitle:p,graphDescription:U,width:H,graphDownload:k?ve.current:void 0,dataDownload:D?o.map(l=>l.data).filter(l=>l!==void 0).length>0?o.map(l=>l.data).filter(l=>l!==void 0):o.filter(l=>l!==void 0):null}):null,h.enabled&&ue.length>0&&Ne?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!f)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":f?"Click to pause animation":"Click to play animation",children:f?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:ue[0],max:ue[ue.length-1],marks:Ne,step:null,defaultValue:ue[ue.length-1],value:ue[_],onChangeComplete:l=>{ge(ue.indexOf(l))},onChange:l=>{ge(ue.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[J?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:H,colorDomain:N,colors:q,colorLegendTitle:le,setSelectedColor:de,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:be,"aria-label":"Graph area",children:(H||a)&&(ee||t)?e.jsxRuntimeExports.jsx(rt,{data:x!==void 0?x==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>R?!l.size.every(i=>i==null):l),l=>ke.sum(l.size.filter(i=>!G.checkIfNullOrUndefined(i))),[u||"asc"]):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>R?!l.size.every(i=>i==null):l),l=>G.checkIfNullOrUndefined(l.size[x])?-1/0:l.size[x],[u||"asc"]):Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>R?!l.size.every(i=>i==null):l),barColors:q,width:H||a,height:Math.max(T,ee||(ie?T?(H||a)*ie>T?(H||a)*ie:T:(H||a)*ie:t)),suffix:xe,prefix:C,showValues:W,barPadding:he,showTicks:me,leftMargin:y,rightMargin:V,topMargin:se,bottomMargin:re,truncateBy:pe,showLabels:K,tooltip:ne,onSeriesMouseOver:X,refValues:ce,maxValue:G.checkIfNullOrUndefined(I)?Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!G.checkIfNullOrUndefined(i)))))<0?0:Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!G.checkIfNullOrUndefined(i))))):I,minValue:G.checkIfNullOrUndefined(b)?Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!G.checkIfNullOrUndefined(i)))))>=0?0:Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!G.checkIfNullOrUndefined(i))))):b,onSeriesMouseClick:g,selectedColor:Oe,labelOrder:O,rtl:M==="he"||M==="ar",maxBarThickness:v,resetSelectionOnDoubleClick:Y,detailsOnClick:S,barAxisTitle:L,noOfTicks:oe,valueColor:P,styles:B,classNames:Z,colorDomain:N,animate:F===!0?{duration:.5,once:!0,amount:.5}:F||{duration:0,once:!0,amount:0},precision:m,customLayers:E,naLabel:c}):null})]})}),$||ae?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:B?.footnote,source:B?.source},classNames:{footnote:Z?.footnote,source:Z?.source},sources:$,footNote:ae,width:H}):null]})})})})}function lt(ye){const{data:o,barColors:p,barPadding:q,showTicks:$,leftMargin:U,rightMargin:he,truncateBy:me,width:pe,height:ee,topMargin:H,bottomMargin:ae,tooltip:N,onSeriesMouseOver:le,showLabels:xe,suffix:C,prefix:W,showValues:J,refValues:te,maxValue:j,onSeriesMouseClick:y,selectedColor:V,rtl:se,labelOrder:re,maxBarThickness:K,minBarThickness:ie,resetSelectionOnDoubleClick:ne,detailsOnClick:X,barAxisTitle:ce,valueColor:Q,noOfTicks:I,styles:b,classNames:g,animate:k,colorDomain:D,precision:M,customLayers:O,naLabel:T}=ye,A=d.useRef(null),v=He.useInView(A,{once:k.once,amount:k.amount}),w={top:ce?H+25:H,bottom:ae,left:U,right:he},[Y,S]=d.useState(void 0),[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),F=pe-w.left-w.right,m=ee-w.top-w.bottom,E=o.map((a,r)=>({...a,id:re?`${a.label}`:`${r}`})),h=re||E.map(a=>`${a.id}`),c=Ge.linear().domain([0,j]).range([0,F]).nice(),x=Te.band().domain(h).range([0,ie?Math.max(m,ie*h.length):K?Math.min(m,K*h.length):m]).paddingInner(q),u=c.ticks(I);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:A,width:`${pe}px`,height:`${ee}px`,viewBox:`0 0 ${pe} ${ee}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${w.left},${w.top})`,children:[$?e.jsxRuntimeExports.jsx(Ze.XTicksAndGridLines,{values:u.filter(a=>a!==0),x:u.filter(a=>a!==0).map(a=>c(a)),y1:0-H,y2:m+w.bottom,styles:{gridLines:b?.xAxis?.gridLines,labels:b?.xAxis?.labels},classNames:{gridLines:g?.xAxis?.gridLines,labels:g?.xAxis?.labels},suffix:C,prefix:W,labelType:"secondary",showGridLines:!0,precision:M}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:F/2,y:0-w.top+15,style:b?.xAxis?.title,className:g?.xAxis?.title,text:ce}),O.filter(a=>a.position==="before").map(a=>a.layer),e.jsxRuntimeExports.jsxs(qe.AnimatePresence,{children:[E.map(a=>G.checkIfNullOrUndefined(x(a.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-low-opacity undp-viz-g-with-hover",variants:{initial:{x:0,y:x(`${a.id}`)},whileInView:{x:0,y:x(`${a.id}`),transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",exit:{opacity:0,transition:{duration:k.duration}},children:[a.size.map((r,t)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{opacity:V?p[t]===V?1:.3:1,onMouseEnter:s=>{S({...a,sizeIndex:t}),R(s.clientY),B(s.clientX),le?.({...a,sizeIndex:t})},onMouseMove:s=>{S({...a,sizeIndex:t}),R(s.clientY),B(s.clientX)},onMouseLeave:()=>{S(void 0),B(void 0),R(void 0),le?.(void 0)},onClick:()=>{(y||X)&&(Ae.isEqual(L,{...a,sizeIndex:t})&&ne?(oe(void 0),y?.(void 0)):(oe({...a,sizeIndex:t}),y&&y({...a,sizeIndex:t})))},children:[r?e.jsxRuntimeExports.jsx(fe.motion.rect,{y:0,style:{fill:p[t]},height:x.bandwidth(),exit:{width:0,x:c(0),transition:{duration:k.duration}},variants:{initial:{width:0,x:c(0),fill:p[t]},whileInView:{width:c(r||0),x:c(t===0?0:ke.sum(a.size.filter((s,f)=>f<t&&s))),fill:p[t],transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial"},t):null,J?e.jsxRuntimeExports.jsx(fe.motion.text,{y:x.bandwidth()/2,style:{textAnchor:"middle",...b?.graphObjectValues||{}},dy:"0.33em",className:e.mo("graph-value text-sm",g?.graphObjectValues),exit:{opacity:0,transition:{duration:k.duration}},variants:{initial:{x:c(0),opacity:0,fill:Qe.getTextColorBasedOnBgColor(p[t])},whileInView:{x:c(t===0?0:ke.sum(a.size.filter((s,f)=>f<t&&s)))+c(r||0)/2,opacity:r&&c(r)/Me.numberFormattingFunction(r,T,M,W,C).length>12?1:0,fill:Qe.getTextColorBasedOnBgColor(p[t]),transition:{duration:k.duration}}},initial:"initial",animate:v?"whileInView":"initial",children:Me.numberFormattingFunction(r,T,M,W,C)}):null]},`${a.label}-${D[t]||t}`)),xe?e.jsxRuntimeExports.jsx(et.YAxesLabels,{value:`${a.label}`.length<me?`${a.label}`:`${`${a.label}`.substring(0,me)}...`,y:0,x:0-w.left,width:0+w.left,height:x.bandwidth(),style:b?.yAxis?.labels,className:g?.yAxis?.labels,animate:k,isInView:v}):null,J?e.jsxRuntimeExports.jsx(fe.motion.text,{className:e.mo("graph-value graph-value-total text-sm",Q?"":" fill-primary-gray-700 dark:fill-primary-gray-300",g?.graphObjectValues),style:{...Q?{fill:Q}:{},textAnchor:"start",...b?.graphObjectValues||{}},y:x.bandwidth()/2,dx:5,dy:"0.33em",variants:{initial:{x:c(0),opacity:0,...Q?{fill:Q}:{}},whileInView:{x:c(ke.sum(a.size.map(r=>r||0))),opacity:1,...Q?{fill:Q}:{},transition:{duration:k.duration}}},exit:{opacity:0,transition:{duration:k.duration}},initial:"initial",animate:v?"whileInView":"initial",children:Me.numberFormattingFunction(ke.sum(a.size.filter(r=>r)),T,M,W,C)}):null]},a.label)),e.jsxRuntimeExports.jsx(Fe.Axis,{x1:c(0),x2:c(0),y1:-2.5,y2:m+w.bottom,classNames:{axis:g?.yAxis?.axis},styles:{axis:b?.yAxis?.axis}}),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((a,r)=>e.jsxRuntimeExports.jsx(Pe.RefLineX,{text:a.text,color:a.color,x:c(a.value),y1:0-w.top,y2:m+w.bottom,textSide:c(a.value)>F*.75||se?"left":"right",classNames:a.classNames,styles:a.styles,animate:k,isInView:v},r))}):null]}),O.filter(a=>a.position==="after").map(a=>a.layer)]})}),Y&&N&&P&&Z?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:Y,body:N,xPos:P,yPos:Z,backgroundStyle:b?.tooltip,className:g?.tooltip}):null,X&&L!==void 0?e.jsxRuntimeExports.jsx(ze.G,{open:L!==void 0,onClose:()=>{oe(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof X=="string"?{__html:Le.string2HTML(X,L)}:void 0,children:typeof X=="function"?X(L):null})}):null]})}function ot(ye){const{data:o,graphTitle:p,colors:q=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,leftMargin:pe=100,rightMargin:ee=40,truncateBy:H=999,height:ae,width:N,footNote:le,colorDomain:xe,colorLegendTitle:C,padding:W,backgroundColor:J=!1,topMargin:te=25,bottomMargin:j=10,tooltip:y,onSeriesMouseOver:V,suffix:se="",prefix:re="",showLabels:K=!0,relativeHeight:ie,showValues:ne=!0,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b=!1,dataDownload:g=!1,language:k="en",labelOrder:D,minHeight:M=0,theme:O="light",maxBarThickness:T,sortParameter:A,maxNumberOfBars:v,minBarThickness:w,showColorScale:Y=!0,ariaLabel:S,resetSelectionOnDoubleClick:L=!0,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B=5,valueColor:Z,styles:R,classNames:F,filterNA:m=!0,animate:E=!1,precision:h=2,customLayers:c=[],timeline:x={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:u="NA",sortData:a}=ye,[r,t]=d.useState(0),[s,f]=d.useState(0),[we,ue]=d.useState(x.autoplay),_=_e.sort(Se.uniqBy(o,"date",!0).map(i=>Ee.parse(`${i}`,x.dateFormat||"yyyy",new Date).getTime()),(i,z)=>Je.ascending(i,z)),[ge,Oe]=d.useState(x.autoplay?0:_.length-1),[de,be]=d.useState(void 0),ve=d.useRef(null),Ne=d.useRef(null);d.useEffect(()=>{const i=new ResizeObserver(z=>{t(N||z[0].target.clientWidth||620),f(ae||z[0].target.clientHeight||480)});return ve.current&&(f(ve.current.clientHeight||480),t(ve.current.clientWidth||620),N||i.observe(ve.current)),()=>i.disconnect()},[N,ae]),d.useEffect(()=>{const i=setInterval(()=>{Oe(z=>z<_.length-1?z+1:0)},(x.speed||2)*1e3);return we||clearInterval(i),()=>clearInterval(i)},[_,we,x.speed]);const l=Ie.getSliderMarks(_,ge,x.showOnlyActiveDate,x.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${O||"light"} flex ${N?"w-fit grow-0":"w-full grow"}`,dir:k==="he"||k==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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"}`,N?"w-fit":"w-full",F?.graphContainer),style:{...R?.graphContainer||{},...J&&J!==!0?{backgroundColor:J}:{}},id:ce,ref:Ne,"aria-label":S||`${p?`The graph shows ${p}. `:""}This is a stacked bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:J?W||"1rem":W||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col gap-4 w-full grow justify-between",children:[p||U||b||g?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:R?.title,description:R?.description},classNames:{title:F?.title,description:F?.description},graphTitle:p,graphDescription:U,width:N,graphDownload:b?Ne.current:void 0,dataDownload:g?o.map(i=>i.data).filter(i=>i!==void 0).length>0?o.map(i=>i.data).filter(i=>i!==void 0):o.filter(i=>i!==void 0):null}):null,x.enabled&&_.length>0&&l?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ue(!we)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":we?"Click to pause animation":"Click to play animation",children:we?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:_[0],max:_[_.length-1],marks:l,step:null,defaultValue:_[_.length-1],value:_[ge],onChangeComplete:i=>{Oe(_.indexOf(i))},onChange:i=>{Oe(_.indexOf(i))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[Y?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:N,colorDomain:xe,colors:q,colorLegendTitle:C,setSelectedColor:be,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:ve,"aria-label":"Graph area",children:(N||r)&&(ae||s)?e.jsxRuntimeExports.jsx(lt,{data:A!==void 0?A==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>ke.sum(i.size.filter(z=>!G.checkIfNullOrUndefined(z))),[a||"asc"]).filter((i,z)=>v?z<v:!0):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>G.checkIfNullOrUndefined(i.size[A])?-1/0:i.size[A],[a||"asc"]).filter((i,z)=>v?z<v:!0):Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i).filter((i,z)=>v?z<v:!0),barColors:q,width:N||r,height:Math.max(M,ae||(ie?M?(N||r)*ie>M?(N||r)*ie:M:(N||r)*ie:s)),barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:te,bottomMargin:j,truncateBy:H,showLabels:K,tooltip:y,onSeriesMouseOver:V,showValues:ne,suffix:se,prefix:re,refValues:X,maxValue:G.checkIfNullOrUndefined(Q)?Math.max(...o.map(i=>ke.sum(i.size.filter(z=>!G.checkIfNullOrUndefined(z)))||0)):Q,onSeriesMouseClick:I,selectedColor:de,rtl:k==="he"||k==="ar",labelOrder:D,maxBarThickness:T,minBarThickness:w,resetSelectionOnDoubleClick:L,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,classNames:F,styles:R,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},colorDomain:xe,precision:h,customLayers:c,naLabel:u}):null})]})}),$||le?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:R?.footnote,source:R?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:$,footNote:le,width:N}):null]})})})})}function ut(ye){const{data:o,width:p,height:q,barColor:$,suffix:U,prefix:he,barPadding:me,showLabels:pe,showValues:ee,showTicks:H,colorDomain:ae,truncateBy:N,rightMargin:le,topMargin:xe,bottomMargin:C,leftMargin:W,tooltip:J,onSeriesMouseOver:te,refValues:j,selectedColor:y,maxValue:V,minValue:se,highlightedDataPoints:re,onSeriesMouseClick:K,labelOrder:ie,maxBarThickness:ne,minBarThickness:X,resetSelectionOnDoubleClick:ce,detailsOnClick:Q,barAxisTitle:I,valueColor:b,noOfTicks:g,styles:k,classNames:D,dimmedOpacity:M,animate:O,precision:T,customLayers:A,naLabel:v}=ye,w=d.useRef(null),Y=He.useInView(w,{once:O.once,amount:O.amount}),S={top:xe,bottom:C,left:I?W+30:W,right:le},[L,oe]=d.useState(void 0),[P,B]=d.useState(void 0),[Z,R]=d.useState(void 0),[F,m]=d.useState(void 0),E=p-S.left-S.right,h=q-S.top-S.bottom,c=Ge.linear().domain([se,V]).range([h,0]).nice(),x=o.map((t,s)=>({...t,id:ie?`${t.label}`:`${s}`})),u=ie||x.map(t=>`${t.id}`),a=Te.band().domain(u).range([0,X?Math.max(E,X*u.length):ne?Math.min(E,ne*u.length):E]).paddingInner(me),r=c.ticks(g);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{ref:w,width:`${p}px`,height:`${q}px`,viewBox:`0 0 ${p} ${q}`,direction:"ltr",children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${S.left},${S.top})`,children:[e.jsxRuntimeExports.jsx(Fe.Axis,{y1:c(se<0?0:se),y2:c(se<0?0:se),x1:0-W,x2:E+S.right,label:Me.numberFormattingFunction(se<0?0:se,v,T,he,U),labelPos:{x:0-W,dx:0,dy:V<0?"1em":-5,y:c(se<0?0:se)},classNames:{axis:D?.xAxis?.axis,label:D?.yAxis?.labels},styles:{axis:k?.xAxis?.axis,label:k?.yAxis?.labels}}),H?e.jsxRuntimeExports.jsx(it.YTicksAndGridLines,{values:r.filter(t=>t!==0),y:r.filter(t=>t!==0).map(t=>c(t)),x1:0-W,x2:E+S.right,styles:{gridLines:k?.yAxis?.gridLines,labels:k?.yAxis?.labels},classNames:{gridLines:D?.yAxis?.gridLines,labels:D?.yAxis?.labels},suffix:U,prefix:he,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:T}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:0-W-15,y:h/2,style:k?.yAxis?.title,className:D?.yAxis?.title,text:I,rotate90:!0}),A.filter(t=>t.position==="before").map(t=>t.layer),e.jsxRuntimeExports.jsxs(qe.AnimatePresence,{children:[x.map((t,s)=>G.checkIfNullOrUndefined(a(t.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",initial:"initial",animate:Y?"whileInView":"initial",variants:{initial:{opacity:y?t.color&&$[ae.indexOf(t.color)]===y?1:M:re.length!==0?re.indexOf(t.label)!==-1?.85:M:.85},whileInView:{opacity:y?t.color&&$[ae.indexOf(t.color)]===y?1:M:re.length!==0?re.indexOf(t.label)!==-1?.85:M:.85,transition:{duration:O.duration}}},exit:{opacity:0,transition:{duration:O.duration}},onMouseEnter:f=>{oe(t),m(f.clientY),R(f.clientX),te?.(t)},onClick:()=>{(K||Q)&&(Ae.isEqual(P,t)&&ce?(B(void 0),K?.(void 0)):(B(t),K?.(t)))},onMouseMove:f=>{oe(t),m(f.clientY),R(f.clientX)},onMouseLeave:()=>{oe(void 0),R(void 0),m(void 0),te?.(void 0)},children:[t.size?e.jsxRuntimeExports.jsx(fe.motion.rect,{width:a.bandwidth(),initial:"initial",animate:Y?"whileInView":"initial",variants:{initial:{height:0,x:a(`${t.id}`),y:c(0),fill:o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray},whileInView:{height:t.size?Math.abs(c(t.size)-c(0)):0,y:t.size&&t.size>0?c(t.size):c(0),x:a(`${t.id}`),fill:o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray,transition:{duration:O.duration}}},exit:{height:0,y:c(0),transition:{duration:O.duration}}}):null,pe?e.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${t.label}`.length<N?`${t.label}`:`${`${t.label}`.substring(0,N)}...`,y:(t.size||0)<0?0:c(0)+5,x:a(`${t.id}`),width:a.bandwidth(),height:(t.size||0)<0?c(0)-5:S.bottom,style:k?.xAxis?.labels,className:D?.xAxis?.labels,alignment:(t.size||0)<0?"bottom":"top",animate:O,isInView:Y}):null,ee?e.jsxRuntimeExports.jsx(fe.motion.text,{style:{textAnchor:"middle",...k?.graphObjectValues||{}},className:e.mo("graph-value text-sm",!b&&$.length>1?" fill-primary-gray-600 dark:fill-primary-gray-300":"",D?.graphObjectValues),dy:t.size?t.size>=0?"-5px":"1em":"-5px",variants:{initial:{x:a(`${t.id}`)+a.bandwidth()/2,y:c(0),opacity:0,fill:b||(o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray)},whileInView:{x:a(`${t.id}`)+a.bandwidth()/2,y:c(t.size||0),fill:b||(o.filter(f=>f.color).length===0?$[0]:t.color?$[ae.indexOf(t.color)]:Ce.Colors.gray),opacity:1,transition:{duration:O.duration}}},initial:"initial",animate:Y?"whileInView":"initial",exit:{opacity:0,transition:{duration:O.duration}},children:Me.numberFormattingFunction(t.size,v,T,he,U)}):null]},t.label)),j?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:j.map((t,s)=>e.jsxRuntimeExports.jsx(Pe.RefLineY,{text:t.text,color:t.color,y:c(t.value),x1:0-W,x2:E+S.right,classNames:t.classNames,styles:t.styles,animate:O,isInView:Y},s))}):null]}),A.filter(t=>t.position==="after").map(t=>t.layer)]})}),L&&J&&Z&&F?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:L,body:J,xPos:Z,yPos:F,backgroundStyle:k?.tooltip,className:D?.tooltip}):null,Q&&P!==void 0?e.jsxRuntimeExports.jsx(ze.G,{open:P!==void 0,onClose:()=>{B(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof Q=="string"?{__html:Le.string2HTML(Q,P)}:void 0,children:typeof Q=="function"?Q(P):null})}):null]})}function ct(ye){const{data:o,graphTitle:p,colors:q,barPadding:$=.25,showTicks:U=!0,leftMargin:he=20,rightMargin:me=20,topMargin:pe=20,bottomMargin:ee=25,truncateBy:H=999,showLabels:ae=!0,showValues:N=!0,backgroundColor:le=!1,suffix:xe="",prefix:C="",sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce=!0,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g=[],onSeriesMouseClick:k,graphDownload:D=!1,dataDownload:M=!1,language:O="en",theme:T="light",sortData:A,labelOrder:v,showNAColor:w=!0,minHeight:Y=0,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B=!0,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F=5,valueColor:m,styles:E,classNames:h,filterNA:c=!0,animate:x=!1,dimmedOpacity:u=.3,precision:a=2,customLayers:r=[],timeline:t={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:s="NA"}=ye,[f,we]=d.useState(0),[ue,_]=d.useState(0),[ge,Oe]=d.useState(t.autoplay),de=_e.sort(Se.uniqBy(o,"date",!0).map(n=>Ee.parse(`${n}`,t.dateFormat||"yyyy",new Date).getTime()),(n,je)=>Je.ascending(n,je)),[be,ve]=d.useState(t.autoplay?0:de.length-1),[Ne,l]=d.useState(void 0),i=d.useRef(null),z=d.useRef(null);d.useEffect(()=>{const n=new ResizeObserver(je=>{we(j||je[0].target.clientWidth||620),_(te||je[0].target.clientHeight||480)});return i.current&&(_(i.current.clientHeight||480),we(i.current.clientWidth||620),j||n.observe(i.current)),()=>n.disconnect()},[j,te]),d.useEffect(()=>{const n=setInterval(()=>{ve(je=>je<de.length-1?je+1:0)},(t.speed||2)*1e3);return ge||clearInterval(n),()=>clearInterval(n)},[de,ge,t.speed]);const Ke=Ie.getSliderMarks(de,be,t.showOnlyActiveDate,t.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${T||"light"} flex ${j?"w-fit grow-0":"w-full grow"}`,dir:O==="he"||O==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.mo(`${le?le===!0?"bg-primary-gray-200 dark:bg-primary-gray-650 ":"":"bg-transparent "}ml-auto mr-auto flex flex-col grow h-inherit ${O||"en"}`,j?"w-fit":"w-full",h?.graphContainer),style:{...E?.graphContainer||{},...le&&le!==!0?{backgroundColor:le}:{}},id:Q,ref:z,"aria-label":P||`${p?`The graph shows ${p}. `:""}This is a grouped bar chart. ${J?` ${J}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:le?re||"1rem":re||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||J||D||M?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:E?.title,description:E?.description},classNames:{title:h?.title,description:h?.description},graphTitle:p,graphDescription:J,width:j,graphDownload:D?z.current:void 0,dataDownload:M?o.map(n=>n.data).filter(n=>n!==void 0).length>0?o.map(n=>n.data).filter(n=>n!==void 0):o.filter(n=>n!==void 0):null}):null,t.enabled&&de.length>0&&Ke?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{Oe(!ge)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":ge?"Click to pause animation":"Click to play animation",children:ge?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:de[0],max:de[de.length-1],marks:Ke,step:null,defaultValue:de[de.length-1],value:de[be],onChangeComplete:n=>{ve(de.indexOf(n))},onChange:n=>{ve(de.indexOf(n))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[ce&&o.filter(n=>n.color).length!==0?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:j,colorLegendTitle:se,colors:q||Ce.Colors[T].categoricalColors.colors,colorDomain:V||Se.uniqBy(o,"color",!0),setSelectedColor:l,showNAColor:w}):null,e.jsxRuntimeExports.jsx("div",{className:"flex grow flex-col justify-center w-full leading-0",ref:i,"aria-label":"Graph area",children:(j||f)&&(te||ue)?e.jsxRuntimeExports.jsx(ut,{data:A?$e.orderBy(Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!G.checkIfNullOrUndefined(n.size):n),[n=>n.size===void 0?A==="asc"?-1/0:1/0:n.size],[A]).filter((n,je)=>L?je<L:!0):Re.ensureCompleteDataForBarChart(o,t.dateFormat||"yyyy").filter(n=>t.enabled?n.date===Ee.format(new Date(de[be]),t.dateFormat||"yyyy"):n).filter(n=>c?!G.checkIfNullOrUndefined(n.size):n).filter((n,je)=>L?je<L:!0),barColor:o.filter(n=>n.color).length===0?q?[q]:[Ce.Colors.primaryColors["blue-600"]]:q||Ce.Colors[T].categoricalColors.colors,colorDomain:o.filter(n=>n.color).length===0?[]:V||Se.uniqBy(o,"color",!0),width:j||f,refValues:X,height:Math.max(Y,te||(K?Y?(j||f)*K>Y?(j||f)*K:Y:(j||f)*K:ue)),suffix:xe,prefix:C,barPadding:$,showLabels:ae,showValues:N,showTicks:U,truncateBy:H,leftMargin:he,rightMargin:me,selectedColor:Ne,topMargin:pe,bottomMargin:ee,tooltip:ie,onSeriesMouseOver:ne,maxValue:G.checkIfNullOrUndefined(I)?Math.max(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size))<0?0:Math.max(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size)):I,minValue:G.checkIfNullOrUndefined(b)?Math.min(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size))>=0?0:Math.min(...o.filter(n=>!G.checkIfNullOrUndefined(n.size)).map(n=>n.size)):b,highlightedDataPoints:g,onSeriesMouseClick:k,labelOrder:v,maxBarThickness:S,minBarThickness:oe,resetSelectionOnDoubleClick:B,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,styles:E,classNames:h,animate:x===!0?{duration:.5,once:!0,amount:.5}:x||{duration:0,once:!0,amount:0},dimmedOpacity:u,precision:a,customLayers:r,naLabel:s}):null})]})}),W||y?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:E?.footnote,source:E?.source},classNames:{footnote:h?.footnote,source:h?.source},sources:W,footNote:y,width:j}):null]})})})})}function xt(ye){const{data:o,width:p,height:q,barColors:$,suffix:U,prefix:he,barPadding:me,showLabels:pe,showValues:ee,showTicks:H,truncateBy:ae,leftMargin:N,rightMargin:le,topMargin:xe,bottomMargin:C,tooltip:W,onSeriesMouseOver:J,refValues:te,maxValue:j,minValue:y,onSeriesMouseClick:V,selectedColor:se,labelOrder:re,maxBarThickness:K,resetSelectionOnDoubleClick:ie,detailsOnClick:ne,barAxisTitle:X,valueColor:ce,noOfTicks:Q,styles:I,classNames:b,animate:g,colorDomain:k,precision:D,customLayers:M,naLabel:O}=ye,T=d.useRef(null),A=He.useInView(T,{once:g.once,amount:g.amount}),v={top:xe,bottom:C,left:X?N+30:N,right:le},[w,Y]=d.useState(void 0),[S,L]=d.useState(void 0),[oe,P]=d.useState(void 0),[B,Z]=d.useState(void 0),R=p-v.left-v.right,F=q-v.top-v.bottom,m=Ge.linear().domain([y,j]).range([F,0]).nice(),E=o.map((a,r)=>({...a,id:re?`${a.label}`:`${r}`})),h=re||E.map(a=>`${a.id}`),c=Te.band().domain(h).range([0,K?Math.min(R,K*h.length):R]).paddingInner(me),x=Te.band().domain(o[0].size.map((a,r)=>`${r}`)).range([0,c.bandwidth()]).paddingInner(.1),u=m.ticks(Q);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{width:`${p}px`,height:`${q}px`,viewBox:`0 0 ${p} ${q}`,direction:"ltr",ref:T,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${v.left},${v.top})`,children:[e.jsxRuntimeExports.jsx(Fe.Axis,{y1:m(y<0?0:y),y2:m(y<0?0:y),x1:0-N,x2:R+v.right,label:Me.numberFormattingFunction(y<0?0:y,O,D,he,U),labelPos:{x:0-N,dx:0,dy:j<0?"1em":-5,y:m(y<0?0:y)},classNames:{axis:b?.xAxis?.axis,label:b?.yAxis?.labels},styles:{axis:I?.xAxis?.axis,label:I?.yAxis?.labels}}),H?e.jsxRuntimeExports.jsx(it.YTicksAndGridLines,{values:u.filter(a=>a!==0),y:u.filter(a=>a!==0).map(a=>m(a)),x1:0-N,x2:R+v.right,styles:{gridLines:I?.yAxis?.gridLines,labels:I?.yAxis?.labels},classNames:{gridLines:b?.yAxis?.gridLines,labels:b?.yAxis?.labels},suffix:U,prefix:he,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:D}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:0-N-15,y:F/2,style:I?.yAxis?.title,className:b?.yAxis?.title,text:X,rotate90:!0}),M.filter(a=>a.position==="before").map(a=>a.layer),e.jsxRuntimeExports.jsxs(qe.AnimatePresence,{children:[E.map(a=>G.checkIfNullOrUndefined(c(a.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{variants:{initial:{x:c(`${a.id}`),y:0},whileInView:{x:c(`${a.id}`),y:0,transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:[a.size.map((r,t)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-g-with-hover",opacity:se?$[t]===se?1:.3:.85,onMouseEnter:s=>{Y({...a,sizeIndex:t}),Z(s.clientY),P(s.clientX),J?.({...a,sizeIndex:t})},onMouseMove:s=>{Y({...a,sizeIndex:t}),Z(s.clientY),P(s.clientX)},onMouseLeave:()=>{Y(void 0),P(void 0),Z(void 0),J?.(void 0)},onClick:()=>{(V||ne)&&(Ae.isEqual(S,{...a,sizeIndex:t})&&ie?(L(void 0),V?.(void 0)):(L({...a,sizeIndex:t}),V&&V({...a,sizeIndex:t})))},children:[e.jsxRuntimeExports.jsx(fe.motion.rect,{x:x(`${t}`),width:x.bandwidth(),variants:{initial:{height:0,y:m(0),fill:$[t]},whileInView:{height:G.checkIfNullOrUndefined(r)?0:Math.abs(m(r)-m(0)),y:G.checkIfNullOrUndefined(r)?m(0):r>0?m(r):m(0),fill:$[t],transition:{duration:g.duration}}},exit:{height:0,y:m(0),transition:{duration:g.duration}},initial:"initial",animate:A?"whileInView":"initial"}),ee?e.jsxRuntimeExports.jsx(fe.motion.text,{x:x(`${t}`)+x.bandwidth()/2,style:{textAnchor:"middle",...I?.graphObjectValues||{}},className:e.mo("graph-value text-sm",b?.graphObjectValues),dy:r?r>=0?"-5px":"1em":"-5px",variants:{initial:{y:m(0),opacity:0,fill:ce||$[t]},whileInView:{y:m(r||0),opacity:1,fill:ce||$[t],transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:Me.numberFormattingFunction(r,O,D,he,U)}):null]},`${a.label}-${k[t]||t}`)),pe?e.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${a.label}`.length<ae?`${a.label}`:`${`${a.label}`.substring(0,ae)}...`,y:m(0)+5,x:0,width:c.bandwidth(),height:v.bottom,style:I?.xAxis?.labels,className:b?.xAxis?.labels,alignment:"top",animate:g,isInView:A}):null]},a.label)),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((a,r)=>e.jsxRuntimeExports.jsx(Pe.RefLineY,{text:a.text,color:a.color,y:m(a.value),x1:0-N,x2:R+v.right,classNames:a.classNames,styles:a.styles,animate:g,isInView:A},r))}):null]}),M.filter(a=>a.position==="after").map(a=>a.layer)]})}),w&&W&&oe&&B?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:w,body:W,xPos:oe,yPos:B,backgroundStyle:I?.tooltip,className:b?.tooltip}):null,ne&&S!==void 0?e.jsxRuntimeExports.jsx(ze.G,{open:S!==void 0,onClose:()=>{L(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof ne=="string"?{__html:Le.string2HTML(ne,S)}:void 0,children:typeof ne=="function"?ne(S):null})}):null]})}function dt(ye){const{data:o,graphTitle:p,colors:q=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,leftMargin:pe=20,rightMargin:ee=20,topMargin:H=20,bottomMargin:ae=25,truncateBy:N=999,showLabels:le=!0,showValues:xe=!0,backgroundColor:C=!1,suffix:W="",prefix:J="",height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g=!1,dataDownload:k=!1,language:D="en",theme:M="light",labelOrder:O,minHeight:T=0,maxBarThickness:A,ariaLabel:v,resetSelectionOnDoubleClick:w=!0,detailsOnClick:Y,barAxisTitle:S,noOfTicks:L=5,valueColor:oe,styles:P,classNames:B,filterNA:Z=!0,showColorScale:R=!0,animate:F=!1,precision:m=2,customLayers:E=[],timeline:h={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:c="NA",sortParameter:x,sortData:u}=ye,[a,r]=d.useState(0),[t,s]=d.useState(0),[f,we]=d.useState(h.autoplay),ue=_e.sort(Se.uniqBy(o,"date",!0).map(l=>Ee.parse(`${l}`,h.dateFormat||"yyyy",new Date).getTime()),(l,i)=>Je.ascending(l,i)),[_,ge]=d.useState(h.autoplay?0:ue.length-1),[Oe,de]=d.useState(void 0),be=d.useRef(null),ve=d.useRef(null);d.useEffect(()=>{const l=new ResizeObserver(i=>{r(j||i[0].target.clientWidth||620),s(te||i[0].target.clientHeight||480)});return be.current&&(s(be.current.clientHeight||480),r(be.current.clientWidth||620),j||l.observe(be.current)),()=>l.disconnect()},[j,te]),d.useEffect(()=>{const l=setInterval(()=>{ge(i=>i<ue.length-1?i+1:0)},(h.speed||2)*1e3);return f||clearInterval(l),()=>clearInterval(l)},[ue,f,h.speed]);const Ne=Ie.getSliderMarks(ue,_,h.showOnlyActiveDate,h.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${M||"light"} flex ${j?"w-fit grow-0":"w-full grow"}`,dir:D==="he"||D==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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 ${D||"en"}`,j?"w-fit":"w-full",B?.graphContainer),style:{...P?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:ce,ref:ve,"aria-label":v||`${p?`The graph shows ${p}. `:""}This is a grouped bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{className:"flex grow",style:{padding:C?re||"1rem":re||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||U||g||k?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:P?.title,description:P?.description},classNames:{title:B?.title,description:B?.description},graphTitle:p,graphDescription:U,width:j,graphDownload:g?ve.current:void 0,dataDownload:k?o.map(l=>l.data).filter(l=>l!==void 0).length>0?o.map(l=>l.data).filter(l=>l!==void 0):o.filter(l=>l!==void 0):null}):null,h.enabled&&ue.length>0&&Ne?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{we(!f)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":f?"Click to pause animation":"Click to play animation",children:f?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:ue[0],max:ue[ue.length-1],marks:Ne,step:null,defaultValue:ue[ue.length-1],value:ue[_],onChangeComplete:l=>{ge(ue.indexOf(l))},onChange:l=>{ge(ue.indexOf(l))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[R?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:j,colorDomain:V,colors:q,colorLegendTitle:se,setSelectedColor:de,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:be,"aria-label":"Graph area",children:(j||a)&&(te||t)?e.jsxRuntimeExports.jsx(xt,{data:x!==void 0?x==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>Z?!l.size.every(i=>i==null):l),l=>ke.sum(l.size.filter(i=>!G.checkIfNullOrUndefined(i))),[u||"asc"]):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>h.enabled?l.date===Ee.format(new Date(ue[_]),h.dateFormat||"yyyy"):l).filter(l=>Z?!l.size.every(i=>i==null):l),l=>G.checkIfNullOrUndefined(l.size[x])?-1/0:l.size[x],[u||"asc"]):Re.ensureCompleteDataForStackedBarChart(o,h.dateFormat||"yyyy").filter(l=>Z?!l.size.every(i=>i==null):l),barColors:q,width:j||a,height:Math.max(T,te||(K?T?(j||a)*K>T?(j||a)*K:T:(j||a)*K:t)),suffix:W,prefix:J,barPadding:he,showLabels:le,showValues:xe,showTicks:me,truncateBy:N,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,tooltip:ie,onSeriesMouseOver:ne,refValues:X,maxValue:G.checkIfNullOrUndefined(Q)?Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!G.checkIfNullOrUndefined(i)))))<0?0:Math.max(...o.map(l=>Math.max(...l.size.filter(i=>!G.checkIfNullOrUndefined(i))))):Q,minValue:G.checkIfNullOrUndefined(I)?Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!G.checkIfNullOrUndefined(i)))))>=0?0:Math.min(...o.map(l=>Math.min(...l.size.filter(i=>!G.checkIfNullOrUndefined(i))))):I,onSeriesMouseClick:b,selectedColor:Oe,labelOrder:O,maxBarThickness:A,resetSelectionOnDoubleClick:w,detailsOnClick:Y,barAxisTitle:S,noOfTicks:L,valueColor:oe,styles:P,classNames:B,animate:F===!0?{duration:.5,once:!0,amount:.5}:F||{duration:0,once:!0,amount:0},colorDomain:V,precision:m,customLayers:E,naLabel:c}):null})]})}),$||y?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:P?.footnote,source:P?.source},classNames:{footnote:B?.footnote,source:B?.source},sources:$,footNote:y,width:j}):null]})})})})}function mt(ye){const{data:o,width:p,height:q,barColors:$,barPadding:U,showLabels:he,showTicks:me,truncateBy:pe,leftMargin:ee,topMargin:H,bottomMargin:ae,rightMargin:N,tooltip:le,onSeriesMouseOver:xe,suffix:C,prefix:W,showValues:J,refValues:te,maxValue:j,onSeriesMouseClick:y,selectedColor:V,labelOrder:se,maxBarThickness:re,minBarThickness:K,resetSelectionOnDoubleClick:ie,detailsOnClick:ne,barAxisTitle:X,valueColor:ce,noOfTicks:Q,styles:I,classNames:b,animate:g,colorDomain:k,precision:D,customLayers:M,naLabel:O}=ye,T=d.useRef(null),A=He.useInView(T,{once:g.once,amount:g.amount}),v={top:H,bottom:ae,left:X?ee+30:ee,right:N},[w,Y]=d.useState(void 0),[S,L]=d.useState(void 0),[oe,P]=d.useState(void 0),[B,Z]=d.useState(void 0),R=p-v.left-v.right,F=q-v.top-v.bottom,m=Ge.linear().domain([0,j]).range([F,0]).nice(),E=o.map((u,a)=>({...u,id:se?`${u.label}`:`${a}`})),h=se||E.map(u=>`${u.id}`),c=Te.band().domain(h).range([0,K?Math.max(R,K*h.length):re?Math.min(R,re*h.length):R]).paddingInner(U),x=m.ticks(Q);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(fe.motion.svg,{width:`${p}px`,height:`${q}px`,viewBox:`0 0 ${p} ${q}`,direction:"ltr",ref:T,children:e.jsxRuntimeExports.jsxs("g",{transform:`translate(${v.left},${v.top})`,children:[e.jsxRuntimeExports.jsx(Fe.Axis,{y1:m(0),y2:m(0),x1:0-ee,x2:R+v.right,label:Me.numberFormattingFunction(0,O,D,W,C),labelPos:{x:0-ee,y:m(0),dx:0,dy:-5},classNames:{axis:b?.xAxis?.axis,label:b?.yAxis?.labels},styles:{axis:I?.xAxis?.axis,label:I?.yAxis?.labels}}),me?e.jsxRuntimeExports.jsx(it.YTicksAndGridLines,{values:x.filter(u=>u!==0),y:x.filter(u=>u!==0).map(u=>m(u)),x1:0-ee,x2:R+v.right,styles:{gridLines:I?.yAxis?.gridLines,labels:I?.yAxis?.labels},classNames:{gridLines:b?.yAxis?.gridLines,labels:b?.yAxis?.labels},suffix:C,prefix:W,labelType:"secondary",showGridLines:!0,labelPos:"vertical",precision:D}):null,e.jsxRuntimeExports.jsx(Be.AxisTitle,{x:0-ee-15,y:F/2,style:I?.yAxis?.title,className:b?.yAxis?.title,text:X,rotate90:!0}),M.filter(u=>u.position==="before").map(u=>u.layer),e.jsxRuntimeExports.jsxs(qe.AnimatePresence,{children:[E.map(u=>G.checkIfNullOrUndefined(c(u.id))?null:e.jsxRuntimeExports.jsxs(fe.motion.g,{className:"undp-viz-low-opacity undp-viz-g-with-hover",variants:{initial:{x:c(`${u.id}`),y:0},whileInView:{x:c(`${u.id}`),y:0,transition:{duration:g.duration}}},transition:{duration:g.duration},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:[u.size.map((a,r)=>e.jsxRuntimeExports.jsxs(fe.motion.g,{opacity:V?$[r]===V?1:.3:1,onMouseEnter:t=>{Y({...u,sizeIndex:r}),Z(t.clientY),P(t.clientX),xe?.({...u,sizeIndex:r})},onMouseMove:t=>{Y({...u,sizeIndex:r}),Z(t.clientY),P(t.clientX)},onMouseLeave:()=>{Y(void 0),P(void 0),Z(void 0),xe?.(void 0)},onClick:()=>{(y||ne)&&(Ae.isEqual(S,{...u,sizeIndex:r})&&ie?(L(void 0),y?.(void 0)):(L({...u,sizeIndex:r}),y&&y({...u,sizeIndex:r})))},children:[e.jsxRuntimeExports.jsx(fe.motion.rect,{x:0,width:c.bandwidth(),variants:{initial:{height:0,fill:$[r],y:m(0)},whileInView:{height:Math.abs(m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))-m(ke.sum(u.size.filter((t,s)=>s<r&&t)))),y:m(ke.sum(u.size.filter((t,s)=>s<=r&&t))),fill:$[r],transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{height:0,y:m(0),transition:{duration:g.duration}}}),J?e.jsxRuntimeExports.jsx(fe.motion.text,{x:c.bandwidth()/2,style:{textAnchor:"middle",...I?.graphObjectValues||{}},className:e.mo("graph-value text-sm",b?.graphObjectValues),dy:"0.33em",variants:{initial:{y:m(0),opacity:0,fill:Qe.getTextColorBasedOnBgColor($[r])},whileInView:{y:m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))+Math.abs(m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))-m(ke.sum(u.size.filter((t,s)=>s<r&&t))))/2,opacity:a&&Math.abs(m(ke.sum(u.size.filter((t,s)=>s<=r&&t)))-m(ke.sum(u.size.filter((t,s)=>s<r&&t))))>20?1:0,fill:Qe.getTextColorBasedOnBgColor($[r]),transition:{duration:g.duration}}},initial:"initial",animate:A?"whileInView":"initial",exit:{opacity:0,transition:{duration:g.duration}},children:Me.numberFormattingFunction(a,O,D,W,C)}):null]},`${u.label}-${k[r]||r}`)),he?e.jsxRuntimeExports.jsx(tt.XAxesLabels,{value:`${u.label}`.length<pe?`${u.label}`:`${`${u.label}`.substring(0,pe)}...`,y:m(0)+5,x:0,width:c.bandwidth(),height:v.bottom,style:I?.xAxis?.labels,className:b?.xAxis?.labels,alignment:"top",animate:g,isInView:A}):null,J?e.jsxRuntimeExports.jsx(fe.motion.text,{style:{textAnchor:"middle",...I?.graphObjectValues||{}},x:c.bandwidth()/2,dy:-10,className:e.mo("graph-value graph-value-total",ce?"text-sm":"fill-primary-gray-700 dark:fill-primary-gray-300 text-sm",b?.graphObjectValues),variants:{initial:{y:m(0),opacity:0,...ce&&{fill:ce}},whileInView:{y:m(ke.sum(u.size.map(a=>a||0))),opacity:1,...ce&&{fill:ce},transition:{duration:g.duration}}},exit:{opacity:0,transition:{duration:g.duration}},initial:"initial",animate:A?"whileInView":"initial",children:Me.numberFormattingFunction(ke.sum(u.size.filter(a=>a)),O,D,W,C)}):null]},u.label)),te?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:te.map((u,a)=>e.jsxRuntimeExports.jsx(Pe.RefLineY,{text:u.text,color:u.color,y:m(u.value),x1:0-ee,x2:R+v.right,classNames:u.classNames,styles:u.styles,animate:g,isInView:A},a))}):null]}),M.filter(u=>u.position==="after").map(u=>u.layer)]})}),w&&le&&oe&&B?e.jsxRuntimeExports.jsx(Ve.Tooltip,{data:w,body:le,xPos:oe,yPos:B,backgroundStyle:I?.tooltip,className:b?.tooltip}):null,ne&&S!==void 0?e.jsxRuntimeExports.jsx(ze.G,{open:S!==void 0,onClose:()=>{L(void 0)},children:e.jsxRuntimeExports.jsx("div",{className:"graph-modal-content m-0",dangerouslySetInnerHTML:typeof ne=="string"?{__html:Le.string2HTML(ne,S)}:void 0,children:typeof ne=="function"?ne(S):null})}):null]})}function ht(ye){const{data:o,graphTitle:p,colors:q=Ce.Colors.light.categoricalColors.colors,sources:$,graphDescription:U,barPadding:he=.25,showTicks:me=!0,leftMargin:pe=20,rightMargin:ee=20,topMargin:H=20,bottomMargin:ae=25,truncateBy:N=999,showLabels:le=!0,showValues:xe=!0,backgroundColor:C=!1,showColorScale:W=!0,suffix:J="",prefix:te="",height:j,width:y,footNote:V,colorDomain:se,colorLegendTitle:re,padding:K,tooltip:ie,onSeriesMouseOver:ne,relativeHeight:X,refValues:ce,graphID:Q,maxValue:I,onSeriesMouseClick:b,graphDownload:g=!1,dataDownload:k=!1,language:D="en",theme:M="light",labelOrder:O,minHeight:T=0,maxBarThickness:A,sortParameter:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L=!0,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B=5,valueColor:Z,styles:R,classNames:F,filterNA:m=!0,animate:E=!1,precision:h=2,customLayers:c=[],timeline:x={enabled:!1,autoplay:!1,showOnlyActiveDate:!0},naLabel:u="NA",sortData:a}=ye,[r,t]=d.useState(0),[s,f]=d.useState(0),[we,ue]=d.useState(x.autoplay),_=_e.sort(Se.uniqBy(o,"date",!0).map(i=>Ee.parse(`${i}`,x.dateFormat||"yyyy",new Date).getTime()),(i,z)=>Je.ascending(i,z)),[ge,Oe]=d.useState(x.autoplay?0:_.length-1),[de,be]=d.useState(void 0),ve=d.useRef(null),Ne=d.useRef(null);d.useEffect(()=>{const i=new ResizeObserver(z=>{t(y||z[0].target.clientWidth||620),f(j||z[0].target.clientHeight||480)});return ve.current&&(f(ve.current.clientHeight||480),t(ve.current.clientWidth||620),y||i.observe(ve.current)),()=>i.disconnect()},[y,j]),d.useEffect(()=>{const i=setInterval(()=>{Oe(z=>z<_.length-1?z+1:0)},(x.speed||2)*1e3);return we||clearInterval(i),()=>clearInterval(i)},[_,we,x.speed]);const l=Ie.getSliderMarks(_,ge,x.showOnlyActiveDate,x.dateFormat||"yyyy");return e.jsxRuntimeExports.jsx("div",{className:`${M||"light"} flex ${y?"w-fit grow-0":"w-full grow"}`,dir:D==="he"||D==="ar"?"rtl":void 0,children:e.jsxRuntimeExports.jsx("div",{className:e.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 ${D||"en"}`,y?"w-fit":"w-full",F?.graphContainer),style:{...R?.graphContainer||{},...C&&C!==!0?{backgroundColor:C}:{}},id:Q,ref:Ne,"aria-label":S||`${p?`The graph shows ${p}. `:""}This is a stacked bar chart. ${U?` ${U}`:""}`,children:e.jsxRuntimeExports.jsx("div",{style:{padding:C?K||"1rem":K||0},children:e.jsxRuntimeExports.jsxs("div",{className:"flex flex-col w-full gap-4 grow justify-between",children:[p||U||g||k?e.jsxRuntimeExports.jsx(We.GraphHeader,{styles:{title:R?.title,description:R?.description},classNames:{title:F?.title,description:F?.description},graphTitle:p,graphDescription:U,width:y,graphDownload:g?Ne.current:void 0,dataDownload:k?o.map(i=>i.data).filter(i=>i!==void 0).length>0?o.map(i=>i.data).filter(i=>i!==void 0):o.filter(i=>i!==void 0):null}):null,x.enabled&&_.length>0&&l?e.jsxRuntimeExports.jsxs("div",{className:"flex gap-6 items-center",dir:"ltr",children:[e.jsxRuntimeExports.jsx("button",{type:"button",onClick:()=>{ue(!we)},className:"p-0 border-0 cursor-pointer bg-transparent","aria-label":we?"Click to pause animation":"Click to play animation",children:we?e.jsxRuntimeExports.jsx(De.Pause,{}):e.jsxRuntimeExports.jsx(De.Play,{})}),e.jsxRuntimeExports.jsx(Ie.xr,{min:_[0],max:_[_.length-1],marks:l,step:null,defaultValue:_[_.length-1],value:_[ge],onChangeComplete:i=>{Oe(_.indexOf(i))},onChange:i=>{Oe(_.indexOf(i))},"aria-label":"Time slider. Use arrow keys to adjust selected time period."})]}):null,e.jsxRuntimeExports.jsx("div",{className:"grow flex flex-col justify-center gap-3 w-full",children:o.length===0?e.jsxRuntimeExports.jsx(Ye.EmptyState,{}):e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[W?e.jsxRuntimeExports.jsx(Xe.ColorLegendWithMouseOver,{width:y,colorDomain:se,colors:q,colorLegendTitle:re,setSelectedColor:be,showNAColor:!1}):null,e.jsxRuntimeExports.jsx("div",{className:"w-full grow leading-0",ref:ve,"aria-label":"Graph area",children:(y||r)&&(j||s)?e.jsxRuntimeExports.jsx(mt,{data:v!==void 0?v==="total"?$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>ke.sum(i.size.filter(z=>!G.checkIfNullOrUndefined(z))),[a||"asc"]).filter((i,z)=>w?z<w:!0):$e.orderBy(Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>x.enabled?i.date===Ee.format(new Date(_[ge]),x.dateFormat||"yyyy"):i).filter(i=>m?!i.size.every(z=>z==null):i),i=>G.checkIfNullOrUndefined(i.size[v])?-1/0:i.size[v],[a||"asc"]).filter((i,z)=>w?z<w:!0):Re.ensureCompleteDataForStackedBarChart(o,x.dateFormat||"yyyy").filter(i=>m?!i.size.every(z=>z==null):i).filter((i,z)=>w?z<w:!0),barColors:q,width:y||r,height:Math.max(T,j||(X?T?(y||r)*X>T?(y||r)*X:T:(y||r)*X:s)),barPadding:he,showLabels:le,showTicks:me,truncateBy:N,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,tooltip:ie,onSeriesMouseOver:ne,showValues:xe,suffix:J,prefix:te,refValues:ce,maxValue:G.checkIfNullOrUndefined(I)?Math.max(...o.map(i=>ke.sum(i.size.filter(z=>!G.checkIfNullOrUndefined(z)))||0)):I,onSeriesMouseClick:b,selectedColor:de,labelOrder:O,maxBarThickness:A,minBarThickness:Y,resetSelectionOnDoubleClick:L,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,styles:R,classNames:F,animate:E===!0?{duration:.5,once:!0,amount:.5}:E||{duration:0,once:!0,amount:0},colorDomain:se,precision:h,customLayers:c,naLabel:u}):null})]})}),$||V?e.jsxRuntimeExports.jsx(Ue.GraphFooter,{styles:{footnote:R?.footnote,source:R?.source},classNames:{footnote:F?.footnote,source:F?.source},sources:$,footNote:V,width:y}):null]})})})})}function pt(ye){const{data:o,graphTitle:p,colors:q,barPadding:$,showTicks:U,leftMargin:he,rightMargin:me,topMargin:pe,bottomMargin:ee,truncateBy:H,showLabels:ae,showValues:N,backgroundColor:le,suffix:xe,prefix:C,sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g,onSeriesMouseClick:k,graphDownload:D,dataDownload:M,language:O,theme:T,sortData:A,labelOrder:v,showNAColor:w,minHeight:Y,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,orientation:E="vertical",styles:h,classNames:c,filterNA:x,animate:u,dimmedOpacity:a,precision:r,customLayers:t,timeline:s,naLabel:f}=ye;return E==="vertical"?e.jsxRuntimeExports.jsx(ct,{data:o,graphTitle:p,colors:q,barPadding:$,showTicks:U,leftMargin:he,rightMargin:me,topMargin:pe,bottomMargin:ee,truncateBy:H,showLabels:ae,showValues:N,backgroundColor:le,suffix:xe,prefix:C,sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g,onSeriesMouseClick:k,graphDownload:D,dataDownload:M,language:O,theme:T,sortData:A,labelOrder:v,showNAColor:w,minHeight:Y,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B,styles:h,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,classNames:c,filterNA:x,animate:u,dimmedOpacity:a,precision:r,customLayers:t,timeline:s,naLabel:f}):e.jsxRuntimeExports.jsx(st,{data:o,graphTitle:p,colors:q,barPadding:$,showTicks:U,leftMargin:he,rightMargin:me,topMargin:pe,bottomMargin:ee,truncateBy:H,showLabels:ae,showValues:N,backgroundColor:le,suffix:xe,prefix:C,sources:W,graphDescription:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,showColorScale:ce,graphID:Q,maxValue:I,minValue:b,highlightedDataPoints:g,onSeriesMouseClick:k,graphDownload:D,dataDownload:M,language:O,theme:T,sortData:A,labelOrder:v,showNAColor:w,minHeight:Y,maxBarThickness:S,maxNumberOfBars:L,minBarThickness:oe,ariaLabel:P,resetSelectionOnDoubleClick:B,styles:h,detailsOnClick:Z,barAxisTitle:R,noOfTicks:F,valueColor:m,classNames:c,filterNA:x,animate:u,dimmedOpacity:a,precision:r,customLayers:t,timeline:s,naLabel:f})}function gt(ye){const{data:o,graphTitle:p,colors:q,sources:$,graphDescription:U,barPadding:he,showTicks:me,truncateBy:pe,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe,prefix:C,showValues:W,padding:J,backgroundColor:te,leftMargin:j,rightMargin:y,topMargin:V,bottomMargin:se,showLabels:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g,dataDownload:k,language:D,labelOrder:M,minHeight:O,theme:T,sortParameter:A,sortData:v,maxBarThickness:w,ariaLabel:Y,resetSelectionOnDoubleClick:S,detailsOnClick:L,barAxisTitle:oe,noOfTicks:P,valueColor:B,orientation:Z="vertical",styles:R,classNames:F,filterNA:m,animate:E,precision:h,customLayers:c,showColorScale:x,timeline:u,naLabel:a}=ye;return Z==="vertical"?e.jsxRuntimeExports.jsx(dt,{data:o,graphTitle:p,colors:q,sources:$,graphDescription:U,barPadding:he,showTicks:me,truncateBy:pe,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe,prefix:C,showValues:W,padding:J,backgroundColor:te,leftMargin:j,rightMargin:y,sortParameter:A,sortData:v,topMargin:V,bottomMargin:se,showLabels:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g,dataDownload:k,language:D,labelOrder:M,minHeight:O,theme:T,maxBarThickness:w,ariaLabel:Y,resetSelectionOnDoubleClick:S,styles:R,detailsOnClick:L,barAxisTitle:oe,noOfTicks:P,valueColor:B,classNames:F,filterNA:m,animate:E,precision:h,customLayers:c,showColorScale:x,timeline:u,naLabel:a}):e.jsxRuntimeExports.jsx(nt,{data:o,graphTitle:p,colors:q,sortParameter:A,sortData:v,sources:$,graphDescription:U,barPadding:he,showTicks:me,truncateBy:pe,height:ee,width:H,footNote:ae,colorDomain:N,colorLegendTitle:le,suffix:xe,prefix:C,showValues:W,padding:J,backgroundColor:te,leftMargin:j,rightMargin:y,topMargin:V,bottomMargin:se,showLabels:re,relativeHeight:K,tooltip:ie,onSeriesMouseOver:ne,refValues:X,graphID:ce,maxValue:Q,minValue:I,onSeriesMouseClick:b,graphDownload:g,dataDownload:k,language:D,labelOrder:M,minHeight:O,theme:T,maxBarThickness:w,ariaLabel:Y,resetSelectionOnDoubleClick:S,styles:R,detailsOnClick:L,barAxisTitle:oe,noOfTicks:P,valueColor:B,classNames:F,filterNA:m,animate:E,precision:h,customLayers:c,showColorScale:x,timeline:u,naLabel:a})}function ft(ye){const{data:o,graphTitle:p,colors:q,sources:$,graphDescription:U,barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,truncateBy:N,showLabels:le,showValues:xe,backgroundColor:C,suffix:W,prefix:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,tooltip:K,onSeriesMouseOver:ie,relativeHeight:ne,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b,dataDownload:g,language:k,theme:D,labelOrder:M,minHeight:O,maxBarThickness:T,sortParameter:A,sortData:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,orientation:R="vertical",styles:F,classNames:m,filterNA:E,animate:h,precision:c,customLayers:x,showColorScale:u,timeline:a,naLabel:r}=ye;return R==="vertical"?e.jsxRuntimeExports.jsx(ht,{data:o,graphTitle:p,colors:q,sources:$,graphDescription:U,barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,truncateBy:N,showLabels:le,showValues:xe,backgroundColor:C,suffix:W,prefix:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,tooltip:K,onSeriesMouseOver:ie,relativeHeight:ne,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b,dataDownload:g,language:k,theme:D,labelOrder:M,minHeight:O,maxBarThickness:T,sortParameter:A,sortData:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L,styles:F,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,classNames:m,filterNA:E,animate:h,precision:c,customLayers:x,showColorScale:u,timeline:a,naLabel:r}):e.jsxRuntimeExports.jsx(ot,{data:o,graphTitle:p,colors:q,sources:$,graphDescription:U,barPadding:he,showTicks:me,leftMargin:pe,rightMargin:ee,topMargin:H,bottomMargin:ae,truncateBy:N,showLabels:le,showValues:xe,backgroundColor:C,suffix:W,prefix:J,height:te,width:j,footNote:y,colorDomain:V,colorLegendTitle:se,padding:re,tooltip:K,onSeriesMouseOver:ie,relativeHeight:ne,refValues:X,graphID:ce,maxValue:Q,onSeriesMouseClick:I,graphDownload:b,dataDownload:g,language:k,theme:D,labelOrder:M,minHeight:O,maxBarThickness:T,sortParameter:A,sortData:v,maxNumberOfBars:w,minBarThickness:Y,ariaLabel:S,resetSelectionOnDoubleClick:L,styles:F,detailsOnClick:oe,barAxisTitle:P,noOfTicks:B,valueColor:Z,classNames:m,filterNA:E,animate:h,precision:c,customLayers:x,showColorScale:u,timeline:a,naLabel:r})}exports.GroupedBarGraph=gt;exports.SimpleBarGraph=pt;exports.StackedBarGraph=ft;
|
|
2
2
|
//# sourceMappingURL=BarGraph.cjs.map
|