import { getApiKey } from '@basemaps/shared/build/api.js';
import { MapConfig } from './config.map.js';
const currentApiKey = getApiKey();
export const Config = {
    get BaseUrl() {
        return process.env['TILE_HOST'] ?? '';
    },
    get ApiKey() {
        return currentApiKey;
    },
    get GoogleAnalytics() {
        return process.env['GOOGLE_ANALYTICS'] ?? '';
    },
    get Version() {
        return process.env['GIT_VERSION'] ?? '';
    },
    /** Github buildId */
    get BuildId() {
        return process.env['BUILD_ID'] ?? '';
    },
    map: new MapConfig(),
};
// Inject google analytics after everything has loaded
if (Config.GoogleAnalytics !== '' && typeof window !== 'undefined') {
    window.dataLayer = window.dataLayer || [];
    window.gtag = function gtag() {
        window.dataLayer.push(arguments); // eslint-disable-line prefer-rest-params
    };
    window.gtag('js', new Date());
    window.gtag('config', `${Config.GoogleAnalytics}`);
    const script = document.createElement('script');
    script.setAttribute('async', '');
    script.setAttribute('src', `https://www.googletagmanager.com/gtag/js?id=${Config.GoogleAnalytics}`);
    document.head.appendChild(script);
}
export function gaEvent(category, action, value) {
    if (Config.GoogleAnalytics === '')
        return;
    window.gtag('event', action, { event_category: category, value });
}
//# sourceMappingURL=config.js.map