import { _ as __assign } from '../../chunks/bundle-yl5d1NoZ.js';
import React__default, { useState } from 'react';
import { u as useChannelSettings } from '../../chunks/bundle-CvsU5rx0.js';
import { u as useLocalization } from '../../chunks/bundle-Del33VzI.js';
import { useMenuItems } from '../hooks/useMenuList.js';
import { d as deleteNullish, c as classnames } from '../../chunks/bundle-MlG9piGf.js';
import { ChannelSettingsHeader } from './ChannelSettingsHeader.js';
import PlaceHolder, { PlaceHolderTypes } from '../../ui/PlaceHolder.js';
import { L as Label, a as LabelTypography, b as LabelColors } from '../../chunks/bundle-viBng0Kh.js';
import Icon, { IconTypes, IconColors } from '../../ui/Icon.js';
import ChannelProfile from './ChannelProfile.js';
import LeaveChannel from './LeaveChannel.js';
import { MenuItem } from './ChannelSettingsMenuItem.js';
import { MenuListByRole } from './ChannelSettingMenuList.js';
import { u as useSendbird } from '../../chunks/bundle-i_3w58Zd.js';
export { B as BannedUserList, M as MutedMemberList, O as OperatorList } from '../../chunks/bundle-DP--Jqg5.js';
export { M as MemberList } from '../../chunks/bundle-g_iPnYTz.js';
import '../../chunks/bundle-BUYU9H94.js';
import '../../chunks/bundle-CqLLOVG5.js';
import '@sendbird/chat/groupChannel';
import '../../chunks/bundle-DGh2T5IL.js';
import '../../chunks/bundle-CM73CDTO.js';
import '../../chunks/bundle-B0s_McF0.js';
import '../../chunks/bundle-C1dqPUnT.js';
import '../../chunks/bundle-BZGITC2g.js';
import '../../ui/Badge.js';
import '../../ui/Toggle.js';
import '../../ui/Header.js';
import '../../chunks/bundle-DBhJIxHw.js';
import '../../ui/TextButton.js';
import '../../chunks/bundle-Bokm7tQ9.js';
import '../../ui/IconButton.js';
import '../../ui/Loader.js';
import '../../ui/ChannelAvatar.js';
import '../../chunks/bundle-CAEBoiEz.js';
import '../../ui/ImageRenderer.js';
import '../../chunks/bundle-Dl_v8XoN.js';
import '../../chunks/bundle-B2BBbSEN.js';
import './EditDetailsModal.js';
import '../../chunks/bundle-CtQtfJlT.js';
import 'react-dom';
import '../../ui/Button.js';
import '../../ui/Input.js';
import '../../chunks/bundle-vmZ9LoYK.js';
import '../../utils/message/getOutgoingMessageState.js';
import '../../chunks/bundle-DgosLQK9.js';
import '../../chunks/bundle-DEuCwnTn.js';
import '../../chunks/bundle-fdEQfX2s.js';
import '../../chunks/bundle-DFni3Lhf.js';
import '@sendbird/chat/message';
import '@sendbird/chat';
import '@sendbird/chat/openChannel';
import '../../chunks/bundle-0vQ6L6RB.js';
import '../../chunks/bundle-Bch_Ry4S.js';
import '../../ui/SortByRow.js';
import '../../ui/UserListItem.js';
import '../../ui/MutedAvatarOverlay.js';
import '../../ui/Checkbox.js';
import '../../ui/UserProfile.js';
import '../../sendbirdSelectors.js';
import '../../chunks/bundle-BOykFtQ3.js';
import '../../chunks/bundle-BGCu7v8M.js';
import '@sendbird/uikit-tools';
import '../../chunks/bundle-CMi8r50C.js';

var ChannelSettingsUI = function (props) {
    var _a = deleteNullish(props), _b = _a.renderHeader, renderHeader = _b === void 0 ? function (props) { return React__default.createElement(ChannelSettingsHeader, __assign({}, props)); } : _b, renderLeaveChannel = _a.renderLeaveChannel, renderChannelProfile = _a.renderChannelProfile, _c = _a.renderModerationPanel, renderModerationPanel = _c === void 0 ? function (props) { return React__default.createElement(MenuListByRole, __assign({}, props)); } : _c, renderPlaceholderError = _a.renderPlaceholderError, renderPlaceholderLoading = _a.renderPlaceholderLoading;
    var state = useSendbird().state;
    var isOnline = state.config.isOnline;
    var _d = useChannelSettings().state, channel = _d.channel, invalidChannel = _d.invalidChannel, onCloseClick = _d.onCloseClick, loading = _d.loading;
    var stringSet = useLocalization().stringSet;
    var menuItems = useMenuItems();
    var _e = useState(false), showLeaveChannelModal = _e[0], setShowLeaveChannelModal = _e[1];
    if (loading) {
        if (renderPlaceholderLoading)
            return renderPlaceholderLoading();
        return React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.LOADING });
    }
    var headerProps = { onCloseClick: onCloseClick };
    if (invalidChannel || !channel) {
        return (React__default.createElement("div", null,
            renderHeader(headerProps),
            React__default.createElement("div", null, renderPlaceholderError ? renderPlaceholderError() : React__default.createElement(PlaceHolder, { type: PlaceHolderTypes.WRONG }))));
    }
    return (React__default.createElement(React__default.Fragment, null,
        renderHeader(headerProps),
        React__default.createElement("div", { className: "sendbird-channel-settings__scroll-area" },
            (renderChannelProfile === null || renderChannelProfile === void 0 ? void 0 : renderChannelProfile()) || React__default.createElement(ChannelProfile, null), renderModerationPanel === null || renderModerationPanel === void 0 ? void 0 :
            renderModerationPanel({ menuItems: menuItems }),
            (renderLeaveChannel === null || renderLeaveChannel === void 0 ? void 0 : renderLeaveChannel()) || (React__default.createElement(MenuItem, { className: classnames(!isOnline ? 'sendbird-channel-settings__panel-item__disabled' : '', 'sendbird-channel-settings__panel-item__leave-channel'), onKeyDown: function () {
                    if (!isOnline)
                        return;
                    setShowLeaveChannelModal(true);
                }, onClick: function () {
                    if (!isOnline)
                        return;
                    setShowLeaveChannelModal(true);
                }, renderLeft: function () { return (React__default.createElement(Icon, { className: ['sendbird-channel-settings__panel-icon-left', 'sendbird-channel-settings__panel-icon__leave'].join(' '), type: IconTypes.LEAVE, fillColor: IconColors.ERROR, height: "24px", width: "24px" })); }, renderMiddle: function () { return (React__default.createElement(Label, { type: LabelTypography.SUBTITLE_1, color: LabelColors.ONBACKGROUND_1 }, stringSet.CHANNEL_SETTING__LEAVE_CHANNEL__TITLE)); } })),
            showLeaveChannelModal && (React__default.createElement(LeaveChannel, { onCancel: function () {
                    setShowLeaveChannelModal(false);
                }, onSubmit: function () {
                    setShowLeaveChannelModal(false);
                    onCloseClick === null || onCloseClick === void 0 ? void 0 : onCloseClick();
                } })))));
};

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