"use strict";

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

var _lodash = _interopRequireDefault(require("lodash.merge"));

var _tools = require("../theme/tools");

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

/**
 *
 * @param filterProps Filtered props array
 * @param inlineResolvedProps inline resolved props
 * @param inlineStateResolvedProps inline state props from resolved props
 * @param defaultStateThemeStyles  default state theme styles
 * @param defaultThemeStyles default theme styles
 * @returns layout and non-layout props for inline and default props
 */
const extractFilteredProps = (filterProps = [], inlineResolvedProps = {}, inlineStateResolvedProps = {}, defaultStateThemeStyles = {}, defaultThemeStyles = {}) => {
  //Merge with default styles
  const [layoutStyles, nonLayoutStyles] = (0, _tools.extractInObject)(defaultThemeStyles, filterProps); //Merge with default state styles

  const [stateLayoutStyles, stateNonLayoutStyles] = (0, _tools.extractInObject)({ ...defaultStateThemeStyles,
    ..._lodash.default.apply({}, inlineStateResolvedProps === null || inlineStateResolvedProps === void 0 ? void 0 : inlineStateResolvedProps.INTERNAL_themeStyle)
  }, filterProps); //Merge with inline props

  const [layoutProps, nonLayoutProps] = (0, _tools.extractInObject)(inlineResolvedProps, filterProps); //Merge with inline state props

  const [stateLayoutProps, stateNonLayoutProps] = (0, _tools.extractInObject)(inlineStateResolvedProps, filterProps);
  return {
    layoutStyles,
    nonLayoutStyles,
    stateLayoutStyles,
    stateNonLayoutStyles,
    layoutProps,
    nonLayoutProps,
    stateLayoutProps,
    stateNonLayoutProps
  };
};

exports.extractFilteredProps = extractFilteredProps;
//# sourceMappingURL=extractFilteredProps.js.map