"use strict";

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); }
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _excluded = ["xs", "sm", "md", "lg", "xl"],
  _excluded2 = ["size"];
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
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; }
var getStylesForSizes = function getStylesForSizes(getProps, stylesPerPropCallbacks) {
  return function (p) {
    var _filter;
    var props = getProps(p);
    var xs = props.xs,
      sm = props.sm,
      md = props.md,
      lg = props.lg,
      xl = props.xl,
      baseProps = _objectWithoutProperties(props, _excluded);
    return (_filter = [_objectSpread({
      size: 'xs'
    }, xs), _objectSpread({
      size: 'sm'
    }, sm), _objectSpread({
      size: 'md'
    }, md), _objectSpread({
      size: 'lg'
    }, lg), _objectSpread({
      size: 'xl'
    }, xl)].filter(function (screenSizeProps) {
      return Object.keys(screenSizeProps).length > 1;
    })) === null || _filter === void 0 ? void 0 : _filter.map(function (_ref) {
      var _Object$keys;
      var size = _ref.size,
        sizeSpecificProps = _objectWithoutProperties(_ref, _excluded2);
      var styles = (_Object$keys = Object.keys(sizeSpecificProps)) === null || _Object$keys === void 0 ? void 0 : _Object$keys.map(function (key) {
        return stylesPerPropCallbacks[key](_objectSpread(_objectSpread(_objectSpread({}, baseProps), sizeSpecificProps), {}, {
          theme: p.theme
        }));
      }).join('\n');
      if (size !== 'xs') {
        return "".concat(p.theme.media.greaterThan(p.theme.breakpoints[size]), " { ").concat(styles, " }");
      }
      return styles;
    }).join('\n');
  };
};
var _default = exports.default = getStylesForSizes;