import { GlobalChartState } from '../../../../state/chart_state' ; import { createCustomCachedSelector } from '../../../../state/create_selector' ; import { getChartThemeSelector } from '../../../../state/selectors/get_chart_theme' ; import { nullShapeViewModel , ShapeViewModel } from '../../layout/types/viewmodel_types' ; import { render } from '../../layout/viewmodel/scenegraph' ; import { computeChartElementSizesSelector } from './compute_chart_dimensions' ; import { getColorScale } from './get_color_scale' ; import { getHeatmapSpecSelector } from './get_heatmap_spec' ; import { getHeatmapTableSelector } from './get_heatmap_table' ; import { isEmptySelector } from './is_empty' ; const getDeselectedSeriesSelector = ( state ) => state . interactions . deselectedDataSeries ; internal export const getHeatmapGeometries = createCustomCachedSelector ( [ getHeatmapSpecSelector , computeChartElementSizesSelector , getHeatmapTableSelector , getColorScale , getDeselectedSeriesSelector , getChartThemeSelector , isEmptySelector , ] , ( heatmapSpec , dims , heatmapTable , { bands , scale : colorScale } , deselectedSeries , theme , empty ) : ShapeViewModel => { const disabledBandLabels = new Set ( deselectedSeries . map ( ( { specId } ) => { return specId ; } ) ) ; const bandsToHide = bands . filter ( ( { label } ) => { return disabledBandLabels . has ( label ) ; } ) . map ( ( { start , end } ) => [ start , end ] ) ; return heatmapSpec && ! empty ? render ( heatmapSpec , dims , heatmapTable , colorScale , bandsToHide , theme ) : nullShapeViewModel ( ) ; } ) ;