var _excluded = ["children", "badgeSize", "badgeColor"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
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; }
import React from 'react';
import styled from 'styled-components';
import { BaseBadge } from '..';
import { Typography } from '../../../..';
import { isElement, isFunction } from '../../../../common/utils';
import { AccountBadgeSize } from './AccountBadge.constants';
import { AccountBadgeStack } from '../AccountBadgeStack';
var StyledTypography = styled(Typography).withConfig({
  displayName: "AccountBadge__StyledTypography",
  componentId: "sc-1qc7p61-0"
})(["font-weight:800;"]);
var AccountBadgeContent = function AccountBadgeContent(_ref) {
  var children = _ref.children,
    typographyType = _ref.typographyType;
  if (typeof children === 'undefined') return null;
  if (isFunction(children)) return children();
  if (isElement(children)) return children;
  return React.createElement(StyledTypography, {
    type: typographyType,
    color: function color(t) {
      return t.color.badgeTextColor;
    }
  }, children);
};
var AccountBadge = React.forwardRef(function (_ref2, ref) {
  var children = _ref2.children,
    _ref2$badgeSize = _ref2.badgeSize,
    badgeSize = _ref2$badgeSize === void 0 ? 'm' : _ref2$badgeSize,
    _ref2$badgeColor = _ref2.badgeColor,
    badgeColor = _ref2$badgeColor === void 0 ? function (t) {
      return t.color.accountBadgeBackground;
    } : _ref2$badgeColor,
    htmlProps = _objectWithoutProperties(_ref2, _excluded);
  var baseBadgeSize = typeof badgeSize === 'number' ? badgeSize : AccountBadgeSize[badgeSize];
  var typographyType = baseBadgeSize === AccountBadgeSize.l ? 'tertiary' : 'caption';
  return React.createElement(BaseBadge, _extends({}, htmlProps, {
    ref: ref,
    badgeColor: badgeColor,
    badgeSize: baseBadgeSize,
    symmetricShape: true
  }), React.createElement(AccountBadgeContent, {
    typographyType: typographyType
  }, children));
});
var CompoundAccountBadge = Object.assign({}, AccountBadge, {
  Stack: AccountBadgeStack
});
export { CompoundAccountBadge };