import 'core-js/modules/es.regexp.exec.js';
import 'core-js/modules/es.string.starts-with.js';

// Currently, we are only using these five font weights. However, we may consider adding XBold and Black weights if there is a need for them in the future.
const fontWeightThin = 250;
const fontWeightLight = 300;
const fontWeightRegular = 400;
const fontWeightMedium = 500;
const fontWeightBold = 700;
const NormalColorValueReg = /^#[a-zA-Z0-9]{3,6}$/;
const getThemeColor = (paletteOptions, color) => {
  if (NormalColorValueReg.test(color)) {
    return color;
  }
  const colorKeyPath = color.split('.');
  const firstPath = colorKeyPath[0];
  if (colorKeyPath.length > 1 && firstPath) {
    const firstObj = paletteOptions[firstPath];
    const secondPath = colorKeyPath[1];
    if (firstObj) {
      return firstObj[secondPath];
    }
  }
  return paletteOptions.primary.main;
};
// From https://github.com/emotion-js/emotion/issues/2193
// Allow easy filtering props that are only used for styling and should not be passed to the DOM
const transientPropCheck = {
  shouldForwardProp: propName => !propName.startsWith('$')
};
const getColor = (color, colorOptions) => {
  if (colorOptions === null || colorOptions === void 0 ? void 0 : colorOptions[color]) {
    return colorOptions[color];
  }
  return '';
};

export { fontWeightBold, fontWeightLight, fontWeightMedium, fontWeightRegular, fontWeightThin, getColor, getThemeColor, transientPropCheck };
