'use strict';

var React = require('react');
var ui_Label = require('../chunks/bundle-CY_gcwTl.js');
var ui_LinkLabel = require('./LinkLabel.js');
var index = require('../chunks/bundle-slo-uj1z.js');
var ui_MentionLabel = require('./MentionLabel.js');
require('../chunks/bundle-Dqor5-v9.js');
require('../chunks/bundle-pG37uJy2.js');
require('../chunks/bundle-DXT1Y4Vj.js');
require('@sendbird/chat/groupChannel');
require('../utils/message/getOutgoingMessageState.js');
require('../chunks/bundle-BS4UAC4Z.js');
require('../chunks/bundle-DRUCFhOE.js');
require('../chunks/bundle-CXXt3nEF.js');
require('../chunks/bundle-B6pik6Q8.js');
require('react-dom');
require('@sendbird/chat');
require('@sendbird/chat/openChannel');
require('./SortByRow.js');
require('../chunks/bundle-DIZXTVPY.js');
require('../withSendbird.js');
require('./IconButton.js');
require('../chunks/bundle-BmMxoxjN.js');
require('./UserProfile.js');
require('../chunks/bundle-DJNCbN6b.js');
require('@sendbird/uikit-tools');
require('../chunks/bundle-dudJtubx.js');
require('../chunks/bundle-CTIC4U7B.js');
require('./Button.js');
require('./Icon.js');
require('css-vars-ponyfill');
require('../chunks/bundle-BbgSFL3H.js');
require('../useSendbirdStateContext.js');
require('../sendbirdSelectors.js');
require('../chunks/bundle-DCgRyaAA.js');
require('../chunks/bundle-DWCO2Wap.js');
require('./ImageRenderer.js');
require('../chunks/bundle-CT-nv6tW.js');

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

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

/**
 * @deprecated  This component is deprecated and will be removed in the next major version.
 * Use TextFragment instead.
 */
// Word and StringObj will include types: normal, mention, url
function Word(props) {
    var word = props.word, message = props.message, _a = props.isByMe, isByMe = _a === void 0 ? false : _a, _b = props.mentionTemplate, mentionTemplate = _b === void 0 ? '@' : _b, _c = props.renderString, renderString = _c === void 0 ? null : _c;
    if (word === '') {
        return null;
    }
    return (React__default.default.createElement("span", { className: "sendbird-word", "data-testid": "sendbird-ui-word" }, (message === null || message === void 0 ? void 0 : message.mentionedUsers) && index.convertWordToStringObj(word, message.mentionedUsers).map(function (stringObj, index$1) {
        var type = (stringObj === null || stringObj === void 0 ? void 0 : stringObj.type) || '';
        var value = (stringObj === null || stringObj === void 0 ? void 0 : stringObj.value) || '';
        var userId = (stringObj === null || stringObj === void 0 ? void 0 : stringObj.userId) || '';
        var key = "".concat(value, "-").concat(index$1);
        if (renderString && typeof renderString === 'function') {
            return renderString(stringObj);
        }
        if (type === index.StringObjType.mention) {
            return (React__default.default.createElement(ui_MentionLabel, { key: key, mentionTemplate: mentionTemplate, mentionedUserId: userId, mentionedUserNickname: value, isByMe: isByMe }));
        }
        else if (type === index.StringObjType.url) {
            return (React__default.default.createElement(ui_LinkLabel.default, { key: key, className: "sendbird-word__url", src: word, type: ui_Label.LabelTypography.BODY_1, color: isByMe ? ui_Label.LabelColors.ONCONTENT_1 : ui_Label.LabelColors.ONBACKGROUND_1 }, value));
        }
        else {
            return value;
        }
    })));
}

module.exports = Word;
//# sourceMappingURL=Word.js.map
