import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray } from '../_virtual/_rollupPluginBabelHelpers.js';

var getStaticVariants = function getStaticVariants(config) {
  if (!config.variations) {
    return [];
  }
  var res = [];
  var variations = config.variations;

  // eslint-disable-next-line guard-for-in
  for (var key in variations) {
    var css = variations[key].css;
    css && res.push(css);
  }
  return res;
};
var getDynamicVariants = function getDynamicVariants(config) {
  return function (props) {
    var res = [];

    // eslint-disable-next-line guard-for-in
    for (var key in config.variations) {
      if (key in props) {
        var variant = config.variations[key];
        var css = variant[props[key]];
        // no css for { modifier: true }
        css && Array.isArray(css) ? res.push.apply(res, _toConsumableArray(css)) : res.push(css);
      }
    }
    return res;
  };
};
var getIntersectionStyles = function getIntersectionStyles(props, intersections) {
  if (!intersections) {
    return [];
  }
  return intersections.reduce(function (styles, item) {
    var hasMatchStyle = Object.entries(item).filter(function (_ref) {
      var _ref2 = _slicedToArray(_ref, 1),
        key = _ref2[0];
      return key !== 'style';
    }).every(function (_ref3) {
      var _ref4 = _slicedToArray(_ref3, 2),
        key = _ref4[0],
        value = _ref4[1];
      return props[key] === value;
    });
    if (hasMatchStyle) {
      styles.push(item.style);
    }
    return styles;
  }, []);
};

export { getDynamicVariants, getIntersectionStyles, getStaticVariants };
//# sourceMappingURL=utils.js.map
