'use strict';

var React = require('react');
var LocalizationContext = require('../../chunks/bundle-BmMxoxjN.js');
var ui_Label = require('../../chunks/bundle-CY_gcwTl.js');
var ui_Icon = require('../../ui/Icon.js');
var ui_Badge = require('../../ui/Badge.js');
var MemberList = require('../../chunks/bundle-wgw5fXTW.js');
var ChannelSettings_context = require('../context.js');
require('../../chunks/bundle-Dqor5-v9.js');
require('../../chunks/bundle-pG37uJy2.js');
require('../../chunks/bundle-DXT1Y4Vj.js');
require('@sendbird/chat');
require('../../ui/Button.js');
require('../../chunks/bundle-PGvCxwe4.js');
require('@sendbird/chat/openChannel');
require('../../useSendbirdStateContext.js');
require('../../withSendbird.js');
require('../../chunks/bundle-B6pik6Q8.js');
require('react-dom');
require('../../ui/SortByRow.js');
require('../../chunks/bundle-DIZXTVPY.js');
require('../../ui/IconButton.js');
require('../../chunks/bundle-slo-uj1z.js');
require('@sendbird/chat/groupChannel');
require('../../utils/message/getOutgoingMessageState.js');
require('../../chunks/bundle-BS4UAC4Z.js');
require('../../chunks/bundle-DRUCFhOE.js');
require('../../chunks/bundle-CXXt3nEF.js');
require('../../ui/UserListItem.js');
require('@sendbird/uikit-tools');
require('../../chunks/bundle-dudJtubx.js');
require('../../chunks/bundle-CTIC4U7B.js');
require('css-vars-ponyfill');
require('../../chunks/bundle-BbgSFL3H.js');
require('../../chunks/bundle-DJNCbN6b.js');
require('../../chunks/bundle-DWCO2Wap.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-CT-nv6tW.js');
require('../../ui/MutedAvatarOverlay.js');
require('../../ui/Checkbox.js');
require('../../ui/UserProfile.js');
require('../../sendbirdSelectors.js');
require('../../chunks/bundle-DCgRyaAA.js');
require('../../chunks/bundle-BCfjcyQ0.js');
require('../../chunks/bundle-DRHHz9fP.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-D-MC1CM2.js');
require('../../chunks/bundle-DCSdwR_f.js');

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

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

var kFormatter = function (num) {
    return Math.abs(num) > 999
        ? "".concat((Math.abs(num) / 1000).toFixed(1), "K")
        : num;
};
var UserPanel = function () {
    var stringSet = React.useContext(LocalizationContext.LocalizationContext).stringSet;
    var _a = React.useState(false), showAccordion = _a[0], setShowAccordion = _a[1];
    var channel = ChannelSettings_context.useChannelSettingsContext().channel;
    return (React__default.default.createElement("div", { className: 'sendbird-channel-settings__user-panel' },
        React__default.default.createElement("div", { className: [
                'sendbird-channel-settings__panel-item',
                'sendbird-channel-settings__members',
            ].join(' '), role: "switch", "aria-checked": showAccordion, onKeyDown: function () { return setShowAccordion(!showAccordion); }, onClick: function () { return setShowAccordion(!showAccordion); }, tabIndex: 0 },
            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" }),
            React__default.default.createElement(ui_Label.Label, { type: ui_Label.LabelTypography.SUBTITLE_1, color: ui_Label.LabelColors.ONBACKGROUND_1 },
                stringSet.CHANNEL_SETTING__MEMBERS__TITLE,
                React__default.default.createElement(ui_Badge, { className: 'sendbird-channel-settings__badge', count: channel ? kFormatter(channel === null || channel === void 0 ? void 0 : channel.memberCount) : '' })),
            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 && (React__default.default.createElement(MemberList.MemberList, null))));
};

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