"use strict";

exports.__esModule = true;
exports.default = void 0;

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var CompositeAvatar = function CompositeAvatar(props) {
  var children = props.children,
      size = props.size,
      className = props.className;

  var isAvatar = function isAvatar() {
    return children.reduce(function (prev, child) {
      return prev && child.type.displayName === 'Avatar';
    }, true);
  };

  var getChildren = function getChildren() {
    if (children.length === 2 && isAvatar()) {
      return children;
    }

    throw new Error('Children should have 2 Avatar component');
  };

  return _react.default.createElement("div", {
    className: 'cui-composite-avatar' + ("" + (size && " cui-composite-avatar--" + size || '')) + ("" + (className && " " + className || ''))
  }, getChildren());
};

CompositeAvatar.displayName = 'CompositeAvatar';
CompositeAvatar.propTypes = {
  children: _propTypes.default.node,
  className: _propTypes.default.string,
  size: _propTypes.default.oneOf(['small', 'medium', 'large', 28, 40, 84, 135])
};
CompositeAvatar.defaultProps = {
  className: '',
  size: 'medium',
  children: null
};
var _default = CompositeAvatar;
exports.default = _default;