import { getApiKey } from '@basemaps/shared/build/api.js';
import { MapConfig } from './config.map.js';
const currentApiKey = getApiKey();
export const Config = {
    get BaseUrl() {
        var _a;
        return (_a = process.env.TILE_HOST) !== null && _a !== void 0 ? _a : '';
    },
    get ApiKey() {
        return currentApiKey;
    },
    get GoogleAnalytics() {
        var _a;
        return (_a = process.env.GOOGLE_ANALYTICS) !== null && _a !== void 0 ? _a : '';
    },
    get Version() {
        var _a;
        return (_a = process.env.GIT_VERSION) !== null && _a !== void 0 ? _a : '';
    },
    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