import React__default, { useMemo } from 'react';
import Avatar from './Avatar.js';
import Icon, { IconTypes, IconColors } from './Icon.js';
import { g as generateDefaultAvatar, a as getChannelAvatarSource } from '../utils-cd7ab927.js';
import './ImageRenderer.js';
import '../uuid-8b344dd2.js';
import 'prop-types';

function ChannelAvatar(_ref) {
  let {
    channel,
    userId,
    theme,
    width = 56,
    height = 56
  } = _ref;
  const isBroadcast = channel === null || channel === void 0 ? void 0 : channel.isBroadcast;
  const memoizedAvatar = useMemo(() => isBroadcast ? generateDefaultAvatar(channel) ? /*#__PURE__*/React__default.createElement("div", {
    className: "sendbird-chat-header--default-avatar",
    style: {
      width,
      height,
      display: 'flex',
      justifyContent: 'center',
      alignItems: 'center'
    }
  }, /*#__PURE__*/React__default.createElement(Icon, {
    type: IconTypes.BROADCAST,
    fillColor: IconColors.CONTENT,
    width: width * 0.575,
    height: height * 0.575
  })) : /*#__PURE__*/React__default.createElement(Avatar, {
    className: "sendbird-chat-header--avatar--broadcast-channel",
    src: getChannelAvatarSource(channel, userId),
    width: width,
    height: height,
    alt: channel === null || channel === void 0 ? void 0 : channel.name
  }) : /*#__PURE__*/React__default.createElement(Avatar, {
    className: "sendbird-chat-header--avatar--group-channel",
    src: getChannelAvatarSource(channel, userId),
    width: `${width}px`,
    height: `${height}px`,
    alt: channel === null || channel === void 0 ? void 0 : channel.name
  }), [channel === null || channel === void 0 ? void 0 : channel.members, channel === null || channel === void 0 ? void 0 : channel.coverUrl, theme]);
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, memoizedAvatar);
}

export { ChannelAvatar as default };
//# sourceMappingURL=ChannelAvatar.js.map
