import type { CoreStart } from 'kibana/public' ; import type { MapsConfigType } from '../config' ; import type { MapsPluginStartDependencies } from './plugin' ; import type { EMSSettings } from '../../../../src/plugins/maps_ems/common/ems_settings' ; import type { PaletteRegistry } from '../../../../src/plugins/charts/public' ; import { MapsEmsPluginPublicStart } from '../../../../src/plugins/maps_ems/public' ; let coreStart ; let pluginsStart ; let mapsEms ; let emsSettings ; export function setStartServices ( core , plugins ) { coreStart = core ; pluginsStart = plugins ; mapsEms = plugins . mapsEms ; emsSettings = mapsEms . createEMSSettings ( ) ; } export const getIndexNameFormComponent = ( ) => pluginsStart . fileUpload . IndexNameFormComponent ; export const getFileUploadComponent = ( ) => pluginsStart . fileUpload . FileUploadComponent ; export const getIndexPatternService = ( ) => pluginsStart . data . indexPatterns ; export const getAutocompleteService = ( ) => pluginsStart . data . autocomplete ; export const getInspector = ( ) => pluginsStart . inspector ; export const getFileUpload = ( ) => pluginsStart . fileUpload ; export const getUiSettings = ( ) => coreStart . uiSettings ; export const getIsDarkMode = ( ) => getUiSettings ( ) . get ( 'theme:darkMode' , false ) ; export const getIndexPatternSelectComponent = ( ) => pluginsStart . data . ui . IndexPatternSelect ; export const getHttp = ( ) => coreStart . http ; export const getTimeFilter = ( ) => pluginsStart . data . query . timefilter . timefilter ; export const getToasts = ( ) => coreStart . notifications . toasts ; export const getSavedObjectsClient = ( ) => coreStart . savedObjects . client ; export const getCoreChrome = ( ) => coreStart . chrome ; export const getMapsCapabilities = ( ) => coreStart . application . capabilities . maps ; export const getVisualizeCapabilities = ( ) => coreStart . application . capabilities . visualize ; export const getDocLinks = ( ) => coreStart . docLinks ; export const getCoreOverlays = ( ) => coreStart . overlays ; export const getData = ( ) => pluginsStart . data ; export const getSavedObjects = ( ) => pluginsStart . savedObjects ; export const getUiActions = ( ) => pluginsStart . uiActions ; export const getCore = ( ) => coreStart ; export const getNavigation = ( ) => pluginsStart . navigation ; export const getCoreI18n = ( ) => coreStart . i18n ; export const getSearchService = ( ) => pluginsStart . data . search ; export const getEmbeddableService = ( ) => pluginsStart . embeddable ; export const getNavigateToApp = ( ) => coreStart . application . navigateToApp ; export const getSavedObjectsTagging = ( ) => pluginsStart . savedObjectsTagging ; export const getPresentationUtilContext = ( ) => pluginsStart . presentationUtil . ContextProvider ; export const getSecurityService = ( ) => pluginsStart . security ; export const getSpacesApi = ( ) => pluginsStart . spaces ; export const getTheme = ( ) => coreStart . theme ; let mapAppConfig ; export const setMapAppConfig = ( config ) => ( mapAppConfig = config ) ; export const getMapAppConfig = ( ) => mapAppConfig ; export const getShowMapsInspectorAdapter = ( ) => getMapAppConfig ( ) . showMapsInspectorAdapter ; export const getPreserveDrawingBuffer = ( ) => getMapAppConfig ( ) . preserveDrawingBuffer ; export const getMapsEmsStart = ( ) => { return mapsEms ; } ; export const getEMSSettings = ( ) => { return emsSettings ; } ; export const getEmsTileLayerId = ( ) => mapsEms . config . emsTileLayerId ; export const getTilemap = ( ) => { if ( mapsEms . config . tilemap ) { return mapsEms . config . tilemap ; } else { return { } ; } } ; export const getShareService = ( ) => pluginsStart . share ; export const getIsAllowByValueEmbeddables = ( ) => pluginsStart . dashboard . dashboardFeatureFlagConfig . allowByValueEmbeddables ; export async function getChartsPaletteServiceGetColor ( ) { const paletteRegistry = pluginsStart . charts ? await pluginsStart . charts . palettes . getPalettes ( ) : null ; if ( ! paletteRegistry ) { return null ; } const paletteDefinition = paletteRegistry . get ( 'default' ) ; const chartConfiguration = { syncColors : true } ; return ( value ) => { const series = [ { name : value , rankAtDepth : 0 , totalSeriesAtDepth : 1 } ] ; const color = paletteDefinition . getCategoricalColor ( series , chartConfiguration ) ; return color ? color : '#3d3d3d' ; } ; }