"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getItemBorderRadiusBottomRight = exports.getItemBorderRadiusBottomLeft = exports.getItemBorderRadiusTopRight = exports.getItemBorderRadiusTopLeft = exports.getTopBorderRadius = exports.getBottomBorderRadius = void 0;

var _spacing = require("../../../mixins/spacing");

var getPaddingAdjustedRadius = function getPaddingAdjustedRadius(theme, effectiveSpaceValue, getDim1, getDim2) {
  if (effectiveSpaceValue == null) {
    return theme.cardBorderRadius;
  }

  var paddingDim1 = getDim1(theme, effectiveSpaceValue, 'p');
  var paddingDim2 = getDim2(theme, effectiveSpaceValue, 'p');

  if (paddingDim1 && paddingDim1 !== '0' || paddingDim2 && paddingDim2 !== '0') {
    return 0;
  }

  return theme.cardBorderRadius;
};

var getBottomBorderRadius = function getBottomBorderRadius(_ref) {
  var theme = _ref.theme;
  return theme.cardBorderRadius;
};

exports.getBottomBorderRadius = getBottomBorderRadius;

var getTopBorderRadius = function getTopBorderRadius(_ref2) {
  var theme = _ref2.theme,
      flatTopCorners = _ref2.flatTopCorners;

  if (flatTopCorners) {
    return 0;
  }

  return theme.cardBorderRadius;
};

exports.getTopBorderRadius = getTopBorderRadius;

var getItemBorderRadiusTopLeft = function getItemBorderRadiusTopLeft(_ref3) {
  var theme = _ref3.theme,
      spacing = _ref3.spacing,
      flatTopCorners = _ref3.flatTopCorners,
      currentBreakpoint = _ref3.currentBreakpoint;

  if (flatTopCorners) {
    return 0;
  }

  return getPaddingAdjustedRadius(theme, (0, _spacing.getEffectiveSpaceValue)(spacing, currentBreakpoint), _spacing.getSpacingTop, _spacing.getSpacingLeft);
};

exports.getItemBorderRadiusTopLeft = getItemBorderRadiusTopLeft;

var getItemBorderRadiusTopRight = function getItemBorderRadiusTopRight(_ref4) {
  var theme = _ref4.theme,
      spacing = _ref4.spacing,
      flatTopCorners = _ref4.flatTopCorners,
      currentBreakpoint = _ref4.currentBreakpoint;

  if (flatTopCorners) {
    return 0;
  }

  return getPaddingAdjustedRadius(theme, (0, _spacing.getEffectiveSpaceValue)(spacing, currentBreakpoint), _spacing.getSpacingTop, _spacing.getSpacingRight);
};

exports.getItemBorderRadiusTopRight = getItemBorderRadiusTopRight;

var getItemBorderRadiusBottomLeft = function getItemBorderRadiusBottomLeft(_ref5) {
  var theme = _ref5.theme,
      spacing = _ref5.spacing,
      currentBreakpoint = _ref5.currentBreakpoint;
  return getPaddingAdjustedRadius(theme, (0, _spacing.getEffectiveSpaceValue)(spacing, currentBreakpoint), _spacing.getSpacingBottom, _spacing.getSpacingLeft);
};

exports.getItemBorderRadiusBottomLeft = getItemBorderRadiusBottomLeft;

var getItemBorderRadiusBottomRight = function getItemBorderRadiusBottomRight(_ref6) {
  var theme = _ref6.theme,
      spacing = _ref6.spacing,
      currentBreakpoint = _ref6.currentBreakpoint;
  return getPaddingAdjustedRadius(theme, (0, _spacing.getEffectiveSpaceValue)(spacing, currentBreakpoint), _spacing.getSpacingBottom, _spacing.getSpacingRight);
};

exports.getItemBorderRadiusBottomRight = getItemBorderRadiusBottomRight;