"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getHideRules = exports.getHideDisplayXl = exports.getHideDisplayLg = exports.getHideDisplayMd = exports.getHideDisplaySm = exports.getHideDisplay = void 0;

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

var getHideDisplay = function getHideDisplay(hide, size) {
  if (typeof hide === 'string') {
    return hide === size ? 'none' : undefined;
  }

  if (hide && hide[0]) {
    return hide.includes(size) ? 'none' : undefined;
  }
};

exports.getHideDisplay = getHideDisplay;

var legacyGetHideDisplayMd = function legacyGetHideDisplayMd(_ref) {
  var hide = _ref.hide;
  return hide === 'md' ? 'none' : undefined;
};

var getHideDisplaySm = function getHideDisplaySm(_ref2) {
  var hide = _ref2.hide;
  return getHideDisplay(hide, 'sm');
};

exports.getHideDisplaySm = getHideDisplaySm;

var getHideDisplayMd = function getHideDisplayMd(_ref3) {
  var hide = _ref3.hide;
  return getHideDisplay(hide, 'md');
};

exports.getHideDisplayMd = getHideDisplayMd;

var getHideDisplayLg = function getHideDisplayLg(_ref4) {
  var hide = _ref4.hide;
  return getHideDisplay(hide, 'lg');
};

exports.getHideDisplayLg = getHideDisplayLg;

var getHideDisplayXl = function getHideDisplayXl(_ref5) {
  var hide = _ref5.hide;
  return getHideDisplay(hide, 'xl');
};

exports.getHideDisplayXl = getHideDisplayXl;
var medium = parseInt(_breakpoints.bpMedium, 10);
var large = parseInt(_breakpoints.bpLarge, 10);
var xlarge = parseInt(_breakpoints.bpXLarge, 10);

var getHideRules = function getHideRules(props) {
  var hideSmRules = getHideDisplaySm(props);
  var hideMdRules = getHideDisplayMd(props);
  var legacyHideSmRules = legacyGetHideDisplayMd(props);
  var hideLgRules = getHideDisplayLg(props);
  var hideXlRules = getHideDisplayXl(props);
  return [hideSmRules ? "@media (min-width: 0px) and (max-width: ".concat(medium - 1, "px) { display: ").concat(hideSmRules, "; }\n") : '', hideMdRules ? "@media (min-width: ".concat(medium, "px) and (max-width: ").concat(large - 1, "px) { display: ").concat(hideMdRules, "; }\n") : '', legacyHideSmRules ? "@media (min-width: ".concat(medium, "px) { display: ").concat(legacyHideSmRules, "; }\n") : '', hideLgRules ? "@media (min-width: ".concat(large, "px) and (max-width: ").concat(xlarge - 1, "px) { display: ").concat(hideLgRules, "; }\n") : '', hideXlRules ? "@media (min-width: ".concat(xlarge, "px) { display: ").concat(hideXlRules, "; }\n") : ''].join('');
};

exports.getHideRules = getHideRules;