import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
import "core-js/modules/es.array.for-each.js";
import "core-js/modules/es.object.entries.js";
import "core-js/modules/es.object.to-string.js";
import "core-js/modules/es.regexp.exec.js";
import "core-js/modules/es.string.replace.js";
import "core-js/modules/esnext.iterator.constructor.js";
import "core-js/modules/esnext.iterator.for-each.js";
import "core-js/modules/web.dom-collections.for-each.js";
import { FcrUIConfig } from './fcr-ui-config';
export var themeMode = 'light';
export var setThemeMode = function setThemeMode(mode) {
  themeMode = mode;
};
export var generateTheme = function generateTheme() {
  var theme = new FcrUIConfig();
  var colors = theme.colors,
    radius = theme.radius,
    font = theme.font;
  // add css variables to the root element
  var root = document.documentElement;
  // insert colors by theme
  Object.entries(colors[themeMode]).forEach(function (_ref) {
    var _ref2 = _slicedToArray(_ref, 2),
      key = _ref2[0],
      value = _ref2[1];
    // console.log('root', key, document.documentElement);

    root.style.setProperty("--".concat(camelTounderline(key)), value);
  });
  // insert radius
  Object.entries(radius).forEach(function (_ref3) {
    var _ref4 = _slicedToArray(_ref3, 2),
      key = _ref4[0],
      value = _ref4[1];
    root.style.setProperty("--".concat(camelTounderline(key)), value + 'px');
  });
  // insert font
  Object.entries(font).forEach(function (_ref5) {
    var _ref6 = _slicedToArray(_ref5, 2),
      key = _ref6[0],
      value = _ref6[1];
    root.style.setProperty("--".concat(camelTounderline(key)), value);
  });
};
var camelTounderline = function camelTounderline(str) {
  return str.replace(/([A-Z])/g, '_$1').toLowerCase();
};