"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _constants = require("../../../../../constants");
var _messages = require("../../../../../messages");
var _flexibleUiContext = require("../../../../../state/flexible-ui-context");
var _common = require("../common");
var MAX_TEAM_MEMBER_LIMIT = 50;
var TeamMemberCountElement = function TeamMemberCountElement(props) {
  var _context$teamMemberCo;
  var context = (0, _flexibleUiContext.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 ? (0, _common.toFormattedTextProps)(_messages.messages.team_members_count, count) : null;
  return data ? /*#__PURE__*/_react.default.createElement(_common.BaseTextElement, (0, _extends2.default)({}, data, props, {
    name: _constants.ElementName.TeamMemberCount
  })) : null;
};
var _default = exports.default = TeamMemberCountElement;