'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var Theme = require('primevue/themes');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var Theme__default = /*#__PURE__*/_interopDefaultLegacy(Theme);

var definePreset = (function (preset1, preset2) {
  var newPreset = Theme.SharedUtils.object.mergeKeys(preset1, preset2);
  Theme__default["default"].setPreset(newPreset);
  return newPreset;
});

var updatePreset = (function (preset) {
  var newPreset = Theme.SharedUtils.object.mergeKeys(Theme__default["default"].getPreset(), preset);
  Theme__default["default"].setPreset(newPreset);
  return newPreset;
});

function _typeof$2(o) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$2(o); }
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty$2(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty$2(obj, key, value) { key = _toPropertyKey$2(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey$2(t) { var i = _toPrimitive$2(t, "string"); return "symbol" == _typeof$2(i) ? i : i + ""; }
function _toPrimitive$2(t, r) { if ("object" != _typeof$2(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$2(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var updatePrimaryPalette = (function (primary) {
  var _Theme$getPreset = Theme__default["default"].getPreset(),
    primitive = _Theme$getPreset.primitive,
    semantic = _Theme$getPreset.semantic,
    components = _Theme$getPreset.components,
    directives = _Theme$getPreset.directives;
  var newPreset = {
    primitive: primitive,
    semantic: _objectSpread$2(_objectSpread$2({}, semantic), {}, {
      primary: primary
    }),
    components: components,
    directives: directives
  };
  Theme__default["default"].setPreset(newPreset);
  return newPreset;
});

function _typeof$1(o) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof$1(o); }
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$1(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty$1(obj, key, value) { key = _toPropertyKey$1(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey$1(t) { var i = _toPrimitive$1(t, "string"); return "symbol" == _typeof$1(i) ? i : i + ""; }
function _toPrimitive$1(t, r) { if ("object" != _typeof$1(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof$1(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var updateSurfacePalette = (function (surface) {
  var _semantic$colorScheme, _semantic$colorScheme2;
  var _Theme$getPreset = Theme__default["default"].getPreset(),
    primitive = _Theme$getPreset.primitive,
    semantic = _Theme$getPreset.semantic,
    components = _Theme$getPreset.components,
    directives = _Theme$getPreset.directives;
  var hasLightDark = (surface === null || surface === void 0 ? void 0 : surface.hasOwnProperty('light')) || (surface === null || surface === void 0 ? void 0 : surface.hasOwnProperty('dark'));
  var newColorScheme = {
    colorScheme: {
      light: _objectSpread$1(_objectSpread$1({}, semantic === null || semantic === void 0 || (_semantic$colorScheme = semantic.colorScheme) === null || _semantic$colorScheme === void 0 ? void 0 : _semantic$colorScheme.light), {
        surface: hasLightDark ? surface === null || surface === void 0 ? void 0 : surface.light : surface
      }),
      dark: _objectSpread$1(_objectSpread$1({}, semantic === null || semantic === void 0 || (_semantic$colorScheme2 = semantic.colorScheme) === null || _semantic$colorScheme2 === void 0 ? void 0 : _semantic$colorScheme2.dark), {
        surface: hasLightDark ? surface === null || surface === void 0 ? void 0 : surface.dark : surface
      })
    }
  };
  var newPreset = {
    primitive: primitive,
    semantic: _objectSpread$1(_objectSpread$1({}, semantic), newColorScheme),
    components: components,
    directives: directives
  };
  Theme__default["default"].setPreset(newPreset);
  return newPreset;
});

var usePreset = (function (preset) {
  Theme__default["default"].setPreset(preset);
  return preset;
});

function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var useTheme = (function (theme) {
  var _ref = [Theme__default["default"].getTheme(), theme],
    o1 = _ref[0].options,
    o2 = _ref[1].options;
  var newTheme = _objectSpread(_objectSpread({}, theme), {}, {
    options: _objectSpread(_objectSpread({}, o1), o2)
  });
  Theme__default["default"].setTheme(newTheme);
  return newTheme;
});

exports.definePreset = definePreset;
exports.updatePreset = updatePreset;
exports.updatePrimaryPalette = updatePrimaryPalette;
exports.updateSurfacePalette = updateSurfacePalette;
exports.usePreset = usePreset;
exports.useTheme = useTheme;
