'use strict';

var React = require('react');
var LocalizationContext = require('../../LocalizationContext-6adf6aa8.js');
var ui_Label = require('../../index-bff918b2.js');
var ui_Icon = require('../../ui/Icon.js');
var ui_Badge = require('../../ui/Badge.js');
var MemberList = require('../../MemberList-8121474e.js');
var ChannelSettings_context = require('../context.js');
require('../../stringSet-5157206d.js');
require('../../index-6a7f94de.js');
require('prop-types');
require('../../ui/Button.js');
require('../../ui/IconButton.js');
require('../../_rollupPluginBabelHelpers-ea66c137.js');
require('../../ui/ContextMenu.js');
require('react-dom');
require('../../ui/SortByRow.js');
require('../../uuid-f1d9be11.js');
require('../../index-86e680cb.js');
require('../../utils/message/getOutgoingMessageState.js');
require('./UserListItem.js');
require('../../UserProfileContext-2ff8462c.js');
require('../../ui/Avatar.js');
require('../../ui/ImageRenderer.js');
require('../../ui/MutedAvatarOverlay.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../topics-2fe6fef6.js');
require('../../utils-58f8eea0.js');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../ui/Modal.js');
require('../../index-f84d188a.js');
require('../../MediaQueryContext-1dd78ce3.js');
require('../../ui/UserListItem.js');
require('../../ui/Checkbox.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

const kFormatter = num => {
  return Math.abs(num) > 999 ? `${(Math.abs(num) / 1000).toFixed(1)}K` : num;
};
const UserPanel = () => {
  const {
    stringSet
  } = React.useContext(LocalizationContext.LocalizationContext);
  const [showAccordion, setShowAccordion] = React.useState(false);
  const {
    channel
  } = ChannelSettings_context.useChannelSettingsContext();
  return /*#__PURE__*/React__default["default"].createElement("div", {
    className: "sendbird-channel-settings__user-panel"
  }, /*#__PURE__*/React__default["default"].createElement("div", {
    className: ['sendbird-channel-settings__panel-item', 'sendbird-channel-settings__members'].join(' '),
    role: "switch",
    "aria-checked": showAccordion,
    onKeyDown: () => setShowAccordion(!showAccordion),
    onClick: () => setShowAccordion(!showAccordion),
    tabIndex: 0
  }, /*#__PURE__*/React__default["default"].createElement(ui_Icon["default"], {
    className: "sendbird-channel-settings__panel-icon-left",
    type: ui_Icon.IconTypes.MEMBERS,
    fillColor: ui_Icon.IconColors.PRIMARY,
    height: "24px",
    width: "24px"
  }), /*#__PURE__*/React__default["default"].createElement(ui_Label.Label, {
    type: ui_Label.LabelTypography.SUBTITLE_1,
    color: ui_Label.LabelColors.ONBACKGROUND_1
  }, stringSet.CHANNEL_SETTING__MEMBERS__TITLE, /*#__PURE__*/React__default["default"].createElement(ui_Badge, {
    className: 'sendbird-channel-settings__badge',
    count: kFormatter(channel === null || channel === void 0 ? void 0 : channel.memberCount)
  })), /*#__PURE__*/React__default["default"].createElement(ui_Icon["default"], {
    className: ['sendbird-channel-settings__panel-icon-right', 'sendbird-channel-settings__panel-icon--chevron', showAccordion ? 'sendbird-channel-settings__panel-icon--open' : ''].join(' '),
    type: ui_Icon.IconTypes.CHEVRON_RIGHT,
    height: "24px",
    width: "24px"
  })), showAccordion && /*#__PURE__*/React__default["default"].createElement(MemberList.MemberList, null));
};

module.exports = UserPanel;
//# sourceMappingURL=UserPanel.js.map
