"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StyledBadge = void 0;
const Badge_1 = require("../Badge");
const index_1 = require("../styled/index");
const getBadgeBgColor = ({ color, theme, variant, }) => {
    if (variant === 'contained' || variant === 'light') {
        return 'transparent';
    }
    const bgColor = {
        grey: theme.palette.grey[800],
        primary: theme.palette.primary[800],
        success: theme.palette.success[800],
        warning: theme.palette.warning[800],
        error: theme.palette.error[800],
        white: theme.palette.grey[300],
        transparent: 'transparent',
    };
    return bgColor[color];
};
const getBadgeColor = ({ color, theme, variant, isChecked, isDisabled, }) => {
    if (isDisabled) {
        return theme.palette.grey[500];
    }
    if (isChecked) {
        return theme.palette.primary.contrastText;
    }
    if (color === 'white') {
        return theme.palette.grey[900];
    }
    if (color === 'grey' || color === 'transparent') {
        return variant === 'text'
            ? theme.palette.primary.contrastText
            : theme.palette.grey[900];
    }
    if (variant === 'light') {
        return theme.palette[color][900];
    }
    return theme.palette.primary.contrastText;
};
exports.StyledBadge = (0, index_1.styled)(Badge_1.Badge, {
    shouldForwardProp: (prop) => !['$color', '$variant', '$isChecked', '$isDisabled'].includes(prop),
}) `
  vertical-align: text-top;

  & span.MuiBadge-badge {
    cursor: text;
    user-select: auto;

    position: static;
    transform: none;

    min-width: ${({ $variant }) => ($variant === 'text' ? '24px' : 'unset')};

    /* Выравнивание текста TagBadge и Tag */
    margin-top: ${({ $variant }) => ($variant === 'text' ? 0 : '0.15em')};
    padding: ${({ theme, $variant }) => $variant === 'text' ? theme.spacing(0, 1) : 0};

    color: ${({ theme, $color, $variant, $isChecked, $isDisabled }) => getBadgeColor({
    theme,
    color: $color,
    variant: $variant,
    isChecked: $isChecked,
    isDisabled: $isDisabled,
})};

    background-color: ${({ theme, $color, $variant }) => getBadgeBgColor({ theme, color: $color, variant: $variant })};
  }
`;
