import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import { ElementName } from '../../../../../constants';
import { messages } from '../../../../../messages';
import { useFlexibleUiContext } from '../../../../../state/flexible-ui-context';
import { BaseTextElement, toFormattedTextProps } from '../common';
var MAX_TEAM_MEMBER_LIMIT = 50;
var TeamMemberCountElement = function TeamMemberCountElement(props) {
  var _context$teamMemberCo;
  var context = useFlexibleUiContext();
  if (!(context !== null && context !== void 0 && context.teamMemberCount)) {
    return null;
  }
  var count = context !== null && context !== void 0 && context.teamMemberCount && (context === null || context === void 0 ? void 0 : context.teamMemberCount) > MAX_TEAM_MEMBER_LIMIT ? "".concat(MAX_TEAM_MEMBER_LIMIT, "+") : context === null || context === void 0 || (_context$teamMemberCo = context.teamMemberCount) === null || _context$teamMemberCo === void 0 ? void 0 : _context$teamMemberCo.toString();
  var data = count ? toFormattedTextProps(messages.team_members_count, count) : null;
  return data ? /*#__PURE__*/React.createElement(BaseTextElement, _extends({}, data, props, {
    name: ElementName.TeamMemberCount
  })) : null;
};
export default TeamMemberCountElement;