// Primitives
import chroma from "chroma-js";
import { tokens as webTokens, componentsList as webComponentList } from './web.index';
import { tokens as nativeMobileTokens, componentsList as nativeMobileComponentList } from './native_mobile.index';
const getFactorFromFormula = (formula) => {
    const match = formula.match(/[\d\.]+/);
    return match ? parseFloat(match[0]) : 0; // Default to 0 if no value found
};
export const brighten = (value, formula) => {
    const factor = getFactorFromFormula(formula);
    return chroma(value).brighten(factor / 20).hex(); // Adjust brightness
};
export const darken = (value, formula) => {
    const factor = getFactorFromFormula(formula);
    return chroma(value).darken(factor / 20).hex(); // Adjust darkness
};
export const contrast = (value) => {
    return chroma.contrast(value, '#FFFFFF') > 4.5 ? "#ffffff" : '#000000';
};
export const getTokens = (platform) => {
    if (platform === 'native_mobile') {
        return nativeMobileTokens;
    }
    else {
        return webTokens;
    }
};
export async function loadComponentTokens(componentName, platform = 'web') {
    const sanitizedComponentName = componentName.replace(/:\s*/g, '-');
    if (platform === 'native_mobile') {
        return import(`./src/tokens/mobile/components/${sanitizedComponentName}/${sanitizedComponentName}.json`);
    }
    else {
        return import(`./src/tokens/web/components/${sanitizedComponentName}/${sanitizedComponentName}.json`);
    }
}
export const getComponentsList = (platform) => {
    if (platform === 'native_mobile') {
        return nativeMobileComponentList;
    }
    else {
        return webComponentList;
    }
};
export { getSelectorFromGroup, cssVarCalcMixFormatter, componentVariantsFormatter } from "./src/utils/style-dictionary-utils.js";
//# sourceMappingURL=index.js.map