"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.tableThemeIsChanged = exports.themes = void 0;

const vutils_1 = require("@visactor/vutils");

function isTableTheme(theme) {
    return !!theme && "function" == typeof theme.getExtendTheme;
}

function getThemeComparableConfig(theme) {
    if (isTableTheme(theme)) {
        const extend = theme.getExtendTheme(), internal = theme.internalTheme, superTheme = null == internal ? void 0 : internal.superTheme;
        return {
            name: theme.name,
            extend: extend,
            superTheme: superTheme ? getThemeComparableConfig(superTheme) : void 0
        };
    }
    return theme;
}

function tableThemeIsChanged(prevTableTheme, newTableTheme) {
    if (!prevTableTheme && !newTableTheme) return !1;
    if (!prevTableTheme && newTableTheme) return !0;
    if (prevTableTheme && !newTableTheme) return !0;
    if (prevTableTheme === newTableTheme) return !1;
    const next = newTableTheme, prevConfig = getThemeComparableConfig(prevTableTheme), newConfig = getThemeComparableConfig(next);
    return !(0, vutils_1.isEqual)(prevConfig, newConfig);
}

exports.themes = {}, exports.tableThemeIsChanged = tableThemeIsChanged;
//# sourceMappingURL=themes.js.map
