(function () {
    var cfg = window.zertiAdminTheme || {};
    var storageKey = cfg.storageKey || 'zertiAdminColorTheme';
    var root = document.getElementById('zertiAdmin');
    if (!root) {
        return;
    }

    try {
        var theme = localStorage.getItem(storageKey);
        if (theme !== 'light' && theme !== 'dark') {
            theme = root.getAttribute('data-bs-theme') || 'dark';
        }
        root.setAttribute('data-bs-theme', theme);
        document.body.setAttribute('data-zerti-bs-theme', theme);
    } catch (e) {}
})();
