import React__default, { useContext, useState } from 'react';
import { L as LocalizationContext } from '../../chunks/bundle-CfVl8s4A.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../chunks/bundle-BoHJWlEb.js';
import Icon, { IconTypes, IconColors } from '../../ui/Icon.js';
import Badge from '../../ui/Badge.js';
import { M as MemberList } from '../../chunks/bundle-CCLiaLWt.js';
import { useChannelSettingsContext } from '../context.js';
import '../../chunks/bundle-BL7mChau.js';
import '../../chunks/bundle-DQaFQR2q.js';
import '../../chunks/bundle-c8Tan9dw.js';
import '@sendbird/chat';
import '../../ui/Button.js';
import '../../chunks/bundle-BcUiOZii.js';
import '@sendbird/chat/openChannel';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../chunks/bundle-BjZ9zlI7.js';
import 'react-dom';
import '../../ui/SortByRow.js';
import '../../chunks/bundle-0P_11xTV.js';
import '../../ui/IconButton.js';
import '../../chunks/bundle-ca6IMmD9.js';
import '@sendbird/chat/groupChannel';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-RX4SHzNN.js';
import '../../chunks/bundle-Cj_Dxz14.js';
import '../../chunks/bundle-DOfvZYT8.js';
import '../../ui/UserListItem.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-PPnIQFif.js';
import '../../chunks/bundle-Bvh73TsV.js';
import 'css-vars-ponyfill';
import '../../chunks/bundle-hFyf4W91.js';
import '../../chunks/bundle-BtIszx7q.js';
import '../../chunks/bundle-BLuTnfAP.js';
import '../../ui/ImageRenderer.js';
import '../../chunks/bundle-BJvmAi6P.js';
import '../../ui/MutedAvatarOverlay.js';
import '../../ui/Checkbox.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle-CmhRN4oW.js';
import '../../chunks/bundle-Q8Sdlu1b.js';
import '../../chunks/bundle-BOZOvKGQ.js';
import '@sendbird/chat/message';
import '../../chunks/bundle-D7UVZS9Q.js';
import '../../chunks/bundle-Cf9I1_PI.js';

var kFormatter = function (num) {
    return Math.abs(num) > 999
        ? "".concat((Math.abs(num) / 1000).toFixed(1), "K")
        : num;
};
var UserPanel = function () {
    var stringSet = useContext(LocalizationContext).stringSet;
    var _a = useState(false), showAccordion = _a[0], setShowAccordion = _a[1];
    var channel = useChannelSettingsContext().channel;
    return (React__default.createElement("div", { className: 'sendbird-channel-settings__user-panel' },
        React__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.createElement(Icon, { className: "sendbird-channel-settings__panel-icon-left", type: IconTypes.MEMBERS, fillColor: IconColors.PRIMARY, height: "24px", width: "24px" }),
            React__default.createElement(Label, { type: LabelTypography.SUBTITLE_1, color: LabelColors.ONBACKGROUND_1 },
                stringSet.CHANNEL_SETTING__MEMBERS__TITLE,
                React__default.createElement(Badge, { className: 'sendbird-channel-settings__badge', count: channel ? kFormatter(channel === null || channel === void 0 ? void 0 : channel.memberCount) : '' })),
            React__default.createElement(Icon, { className: [
                    'sendbird-channel-settings__panel-icon-right',
                    'sendbird-channel-settings__panel-icon--chevron',
                    (showAccordion ? 'sendbird-channel-settings__panel-icon--open' : ''),
                ].join(' '), type: IconTypes.CHEVRON_RIGHT, height: "24px", width: "24px" })),
        showAccordion && (React__default.createElement(MemberList, null))));
};

export { UserPanel as default };
//# sourceMappingURL=UserPanel.js.map
