'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var _tslib = require('../../chunks/bundle-Conb-pOy.js');
var React = require('react');
var ui_Label = require('../../chunks/bundle-zgmRG2KL.js');
var ui_Icon = require('../../ui/Icon.js');
var utils = require('../../chunks/bundle-B78tdF27.js');
var ChannelSettings_components_ChannelSettingsMenuItem = require('./ChannelSettingsMenuItem.js');
var useChannelSettings = require('../../chunks/bundle-B4ZDxwge.js');
require('../../chunks/bundle-BbrBawlX.js');
require('../../chunks/bundle-CkQrhwR6.js');
require('@sendbird/chat/message');
require('../../chunks/bundle-DPDyqKIJ.js');
require('../../chunks/bundle-Cyl6_qLo.js');
require('../../chunks/bundle-B19RHFpR.js');
require('../../chunks/bundle-Cfh78Xnm.js');
require('@sendbird/chat/groupChannel');
require('../../chunks/bundle-t8BQsgL5.js');
require('../../chunks/bundle-CZ38Etcw.js');
require('../../chunks/bundle-Bnb8seJF.js');
require('../../chunks/bundle-Bq15P9qk.js');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');

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

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

var MenuListByRole = function (_a) {
    var menuItems = _a.menuItems;
    var channel = useChannelSettings.useChannelSettings().state.channel;
    var menuItemsByRole = utils.isOperator(channel) ? menuItems.operator : menuItems.nonOperator;
    // State to track the open accordion key
    var _b = React.useState(null), openAccordionKey = _b[0], setOpenAccordionKey = _b[1];
    return (React__default.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.default.createElement(ChannelSettings_components_ChannelSettingsMenuItem.MenuItem, { key: key, onClick: item.onClick, onKeyDown: item.onKeyDown, renderLeft: function () { return React__default.default.createElement(ui_Icon.default, _tslib.__assign({}, item.icon)); }, renderMiddle: function () { return React__default.default.createElement(ui_Label.Label, _tslib.__assign({}, item.label)); }, renderRight: item.rightComponent, renderAccordion: item.accordionComponent, accordionOpened: openAccordionKey === key, setAccordionOpened: function () {
                setOpenAccordionKey(function (prevKey) { return (prevKey === key ? null : key); });
            } }));
    })));
};

exports.MenuListByRole = MenuListByRole;
exports.default = MenuListByRole;
//# sourceMappingURL=ChannelSettingMenuList.js.map
