"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = createDarkTheme;

var _animation = _interopRequireDefault(require("../shared/animation"));

var _borders = _interopRequireDefault(require("./borders"));

var _breakpoints = _interopRequireDefault(require("../shared/breakpoints"));

var _deepMerge = _interopRequireDefault(require("../../utils/deep-merge"));

var _colorTokens = _interopRequireDefault(require("./color-tokens"));

var _tokens = require("../../tokens");

var _colorComponentTokens = _interopRequireDefault(require("./color-component-tokens"));

var _colorSemanticTokens = _interopRequireDefault(require("./color-semantic-tokens"));

var _typography = _interopRequireDefault(require("../shared/typography"));

var _grid = _interopRequireDefault(require("../shared/grid"));

var _lighting = _interopRequireDefault(require("../shared/lighting"));

var _mediaQuery = _interopRequireDefault(require("../shared/media-query"));

var _sizing = _interopRequireDefault(require("../shared/sizing"));

var _excluded = ["primaryFontFamily"];

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); 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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

function createDarkTheme() {
  var primitives = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var // Used to override default theme property values derived from primitives
  overrides = arguments.length > 1 ? arguments[1] : undefined;

  // Extract font tokens and color tokens from primitives
  var primaryFontFamily = primitives.primaryFontFamily,
      customFoundationColorTokens = _objectWithoutProperties(primitives, _excluded); // Assemble color tokens by overriding defaults with custom color tokens


  var foundationColorTokens = _objectSpread(_objectSpread({}, _colorTokens.default), customFoundationColorTokens);

  var theme = {
    animation: _animation.default,
    borders: _borders.default,
    breakpoints: _breakpoints.default,
    colors: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _tokens.colors), foundationColorTokens), (0, _colorComponentTokens.default)(foundationColorTokens)), (0, _colorSemanticTokens.default)(foundationColorTokens)),
    direction: 'auto',
    grid: _grid.default,
    lighting: _lighting.default,
    mediaQuery: _mediaQuery.default,
    sizing: _sizing.default,
    typography: _typography.default,
    // TODO(#2318) Remove in v11, the next major version.
    // Do not use.
    zIndex: {
      modal: 2000
    }
  };
  return (0, _deepMerge.default)(theme, overrides);
}