'use strict';

var React = require('react');
var LocalizationContext = require('../../chunks/bundle-DDNdw3A9.js');
var ui_Label = require('../../chunks/bundle-B0UICprZ.js');
var ui_TextButton = require('../../ui/TextButton.js');
var ui_OpenChannelAvatar = require('../../ui/OpenChannelAvatar.js');
var OpenChannelSettings_components_EditDetailsModal = require('./EditDetailsModal.js');
var OpenChannelSettings_context = require('../context.js');
var useSendbird = require('../../chunks/bundle-LI9JjqG2.js');
require('../../chunks/bundle-CxoFSSXv.js');
require('../../chunks/bundle-EhtiN7UV.js');
require('../../chunks/bundle-BV7y6VDn.js');
require('../../chunks/bundle-BIrmQghI.js');
require('../../chunks/bundle-CLL-nCFU.js');
require('../../ui/ImageRenderer.js');
require('../../chunks/bundle-DQNu-S6D.js');
require('../../chunks/bundle-C8MACRPO.js');
require('../../ui/Icon.js');
require('../../chunks/bundle-DAVPwIxJ.js');
require('../../chunks/bundle-BPWJgESF.js');
require('../../chunks/bundle-YeW89zsR.js');
require('react-dom');
require('../../chunks/bundle-CyQD5TkW.js');
require('../../ui/IconButton.js');
require('../../ui/Button.js');
require('../../chunks/bundle-BUGwK1WK.js');
require('../../ui/Input.js');
require('@sendbird/chat/openChannel');
require('../../chunks/bundle-DeyX1dvY.js');
require('../../chunks/bundle-AAO7jUU2.js');
require('../../chunks/bundle-yU9Mr2pS.js');
require('@sendbird/chat');
require('@sendbird/chat/groupChannel');

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

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

function ChannelProfile() {
    var _a, _b;
    var state = useSendbird.useSendbird().state;
    var disabled = !((_a = state === null || state === void 0 ? void 0 : state.config) === null || _a === void 0 ? void 0 : _a.isOnline);
    var theme = (_b = state === null || state === void 0 ? void 0 : state.config) === null || _b === void 0 ? void 0 : _b.theme;
    var channel = OpenChannelSettings_context.useOpenChannelSettingsContext().channel;
    var title = channel === null || channel === void 0 ? void 0 : channel.name;
    var _c = React.useState(false), showModal = _c[0], setShowModal = _c[1];
    var stringSet = React.useContext(LocalizationContext.LocalizationContext).stringSet;
    return (React__default.default.createElement("div", { className: "sendbird-openchannel-profile" },
        React__default.default.createElement("div", { className: "sendbird-openchannel-profile--inner" },
            React__default.default.createElement("div", { className: "sendbird-openchannel-profile__avatar" },
                React__default.default.createElement(ui_OpenChannelAvatar, { channel: channel, theme: theme, height: 80, width: 80 })),
            React__default.default.createElement(ui_Label.Label, { type: ui_Label.LabelTypography.SUBTITLE_2, color: ui_Label.LabelColors.ONBACKGROUND_1, className: "sendbird-openchannel-profile__title" }, title || stringSet.OPEN_CHANNEL_SETTINGS__NO_TITLE),
            React__default.default.createElement(ui_TextButton, { disabled: disabled, className: "sendbird-openchannel-profile__edit", onClick: function () {
                    if (disabled) {
                        return;
                    }
                    setShowModal(true);
                }, disableUnderline: true },
                React__default.default.createElement(ui_Label.Label, { type: ui_Label.LabelTypography.BUTTON_1, color: disabled ? ui_Label.LabelColors.ONBACKGROUND_2 : ui_Label.LabelColors.PRIMARY }, stringSet.CHANNEL_SETTING__PROFILE__EDIT)),
            showModal && (React__default.default.createElement(OpenChannelSettings_components_EditDetailsModal, { onCancel: function () { return setShowModal(false); } })))));
}

module.exports = ChannelProfile;
//# sourceMappingURL=OpenChannelProfile.js.map
