/*
 * Copyright OpenSearch Contributors
 * SPDX-License-Identifier: Apache-2.0
 */
const THEME_STORAGE_KEY = 'agent-health-theme';
export function getTheme() {
    if (typeof window === 'undefined')
        return 'dark';
    const stored = localStorage.getItem(THEME_STORAGE_KEY);
    if (stored === 'light' || stored === 'dark') {
        return stored;
    }
    return 'dark';
}
export function setTheme(theme) {
    if (typeof window === 'undefined')
        return;
    localStorage.setItem(THEME_STORAGE_KEY, theme);
    applyTheme(theme);
}
export function applyTheme(theme) {
    if (typeof window === 'undefined')
        return;
    const root = document.documentElement;
    if (theme === 'dark') {
        root.classList.add('dark');
    }
    else {
        root.classList.remove('dark');
    }
}
export function initializeTheme() {
    const theme = getTheme();
    applyTheme(theme);
}
//# sourceMappingURL=theme.js.map