import { _ as __assign } from '../../chunks/bundle-B9I7KCZ2.js';
import React__default, { useState } from 'react';
import { L as Label } from '../../chunks/bundle-B1gHpFXu.js';
import Icon from '../../ui/Icon.js';
import { i as isOperator } from '../../chunks/bundle-CmAD8QUZ.js';
import { M as MenuItem } from '../../chunks/bundle-DfkIV7Yk.js';
import { useChannelSettingsContext } from '../context.js';
import '../../chunks/bundle-BwafidOs.js';
import '../../chunks/bundle-B628FXKZ.js';
import '@sendbird/chat/message';
import '../../useSendbirdStateContext.js';
import '../../withSendbird.js';
import '../../chunks/bundle-DUd6AS_D.js';
import '../../chunks/bundle-B97onQ-B.js';

var MenuListByRole = function (_a) {
    var menuItems = _a.menuItems;
    var channel = useChannelSettingsContext().channel;
    var menuItemsByRole = isOperator(channel) ? menuItems.operator : menuItems.nonOperator;
    // State to track the open accordion key
    var _b = useState(null), openAccordionKey = _b[0], setOpenAccordionKey = _b[1];
    return (React__default.createElement("div", { className: "sendbird-channel-settings__operator" }, Object.entries(menuItemsByRole).map(function (_a) {
        var key = _a[0], item = _a[1];
        if (item.hideMenu)
            return null;
        return (React__default.createElement(MenuItem, { key: key, onClick: item.onClick, onKeyDown: item.onKeyDown, renderLeft: function () { return React__default.createElement(Icon, __assign({}, item.icon)); }, renderMiddle: function () { return React__default.createElement(Label, __assign({}, item.label)); }, renderRight: item.rightComponent, renderAccordion: item.accordionComponent, accordionOpened: openAccordionKey === key, setAccordionOpened: function () {
                setOpenAccordionKey(function (prevKey) { return (prevKey === key ? null : key); });
            } }));
    })));
};

export { MenuListByRole, MenuListByRole as default };
//# sourceMappingURL=ChannelSettingMenuList.js.map
