"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _utils = require("../utils");

var _createColor = _interopRequireDefault(require("./createColor"));

var _createTransition = _interopRequireDefault(require("./createTransition"));

var _createSize = _interopRequireDefault(require("./createSize"));

var _createShadow = _interopRequireDefault(require("./createShadow"));

var _createBreakpoint = _interopRequireWildcard(require("./createBreakpoint"));

var _createTypography = _interopRequireDefault(require("./createTypography"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; if (obj != null) { var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

function createTheme(theme) {
  var _theme$colors = theme.colors,
      colorsInput = _theme$colors === void 0 ? {} : _theme$colors,
      _theme$sizes = theme.sizes,
      sizesInput = _theme$sizes === void 0 ? {} : _theme$sizes,
      _theme$transitions = theme.transitions,
      transitionsInput = _theme$transitions === void 0 ? {} : _theme$transitions,
      shadowsInput = theme.shadows,
      _theme$breakpoints = theme.breakpoints,
      breakpointsInput = _theme$breakpoints === void 0 ? _createBreakpoint.defaultBreakpoints : _theme$breakpoints,
      _theme$typographies = theme.typographies,
      typographiesInput = _theme$typographies === void 0 ? {} : _theme$typographies;
  var colors = (0, _createColor["default"])(colorsInput);
  var transitions = (0, _createTransition["default"])(transitionsInput);
  var sizes = (0, _createSize["default"])(sizesInput);
  var breakpoints = (0, _createBreakpoint["default"])(breakpointsInput);
  var typographies = (0, _createTypography["default"])(typographiesInput);
  return _objectSpread({
    shadows: shadowsInput || _createShadow["default"]
  }, (0, _utils.deepMerge)(theme, {
    colors: colors,
    sizes: sizes,
    transitions: transitions,
    breakpoints: breakpoints,
    typographies: typographies
  }));
}

var _default = createTheme;
exports["default"] = _default;