import { clsx } from 'clsx';
import { useMemo } from 'react';
import { Theme } from '../common/theme.mjs';
import '../common/direction.mjs';
import '@transferwise/neptune-tokens';
import '../common/propsValues/control.mjs';
import '../common/propsValues/size.mjs';
import '../common/propsValues/typography.mjs';
import '../common/propsValues/width.mjs';
import '../common/propsValues/type.mjs';
import '../common/propsValues/dateMode.mjs';
import '../common/propsValues/monthFormat.mjs';
import '../common/propsValues/position.mjs';
import '../common/propsValues/layouts.mjs';
import '../common/propsValues/status.mjs';
import '../common/propsValues/sentiment.mjs';
import '../common/propsValues/profileType.mjs';
import '../common/propsValues/variant.mjs';
import '../common/propsValues/scroll.mjs';
import '../common/propsValues/markdownNodeType.mjs';
import '../common/fileType.mjs';
import '@transferwise/formatting';
import { getBrandColorFromSeed } from '../common/colors.mjs';
import '@transferwise/icons';
import 'react-intl';
import '../common/closeButton/CloseButton.messages.mjs';
import { jsx } from 'react/jsx-runtime';

const backwardsCompatibleSize = size => {
  switch (size) {
    case 'sm':
      return 24;
    case 'md':
      return 48;
    case 'lg':
      return 72;
    default:
      return size;
  }
};
/**
 * @deprecated Use `AvatarView` component instead
 */
const Avatar = ({
  backgroundColor = null,
  backgroundColorSeed = null,
  children = null,
  className,
  outlined = false,
  size: sizeFromProps = 48,
  theme = Theme.LIGHT,
  type = 'thumbnail',
  'aria-label': ariaLabel
}) => {
  const backgroundColorFromSeed = useMemo(() => !backgroundColor && backgroundColorSeed ? getBrandColorFromSeed(backgroundColorSeed) : undefined, [backgroundColor, backgroundColorSeed]);
  const size = backwardsCompatibleSize(sizeFromProps);
  return /*#__PURE__*/jsx("div", {
    className: clsx('tw-avatar', className, `tw-avatar--${size}`, `tw-avatar--${type}`, {
      'tw-avatar--outlined': outlined,
      'tw-avatar--branded': Boolean(backgroundColorFromSeed),
      'np-text-title-body': type === 'initials'
    }),
    "aria-label": ariaLabel,
    children: /*#__PURE__*/jsx("div", {
      className: "tw-avatar__content",
      style: {
        backgroundColor: backgroundColor || backgroundColorFromSeed
      },
      children: children
    })
  });
};

export { Avatar as default };
//# sourceMappingURL=Avatar.mjs.map
