var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
        r = Reflect.decorate(decorators, target, key, desc);
    else
        for (var i = decorators.length - 1; i >= 0; i--)
            if (d = decorators[i])
                r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Host, h, writeTask } from "@stencil/core";
import { defaultIconPack } from "../../exports";
import { useLanguage } from "../../lib/lang";
import { handleFilesDataTransfer, reverse, replyBlockPattern, extractReplyBlock, stripOutReplyBlock, MAX_TEXT_LENGTH, } from "../../utils/chat";
import gracefulStorage from "../../utils/graceful-storage";
import { SyncWithStore } from "../../utils/sync-with-store";
const MENTION_CHAR = '@';
/** @deprecated. This component is deprecated, please use rtk-chat-composer-view instead. */
export class RtkChatComposerUi {
    constructor() {
        /** Whether user can send text messages */
        this.canSendTextMessage = false;
        /** Whether user can send file messages */
        this.canSendFiles = false;
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        /** Whether to show emoji picker */
        this.disableEmojiPicker = false;
        /** prefill the composer */
        this.prefill = {};
        /** list of members that can be mentioned */
        this.members = [];
        this.emojiPickerActive = false;
        this.mentionQuery = '';
        this.focusedMemberIndex = 0;
        this.filePreview = null;
        this.fileReader = new FileReader();
        this.fileToUpload = null;
        this.handleKeyDown = (e) => {
            if (e.key === MENTION_CHAR && [undefined, ' '].includes(this.$textArea.value.at(-1))) {
                // [undefined, ' '] checks if mention is start of text or start of new word
                this.mentionQuery = MENTION_CHAR;
            }
            if (e.key === 'ArrowDown') {
                this.focusedMemberIndex = Math.min(this.focusedMemberIndex + 1, this.getFilteredMembers().length - 1);
            }
            if (e.key === 'ArrowUp') {
                this.focusedMemberIndex = Math.max(0, this.focusedMemberIndex - 1);
            }
            if (e.key === 'Escape' || (e.key === 'Backspace' && this.mentionQuery === MENTION_CHAR)) {
                this.mentionQuery = '';
            }
            if (['Enter', 'Tab', ' '].includes(e.key) && this.mentionQuery !== '') {
                const member = this.getFilteredMembers()[this.focusedMemberIndex];
                this.onMemberSelect(member);
                e.preventDefault();
                return;
            }
            // slack like typing experience
            if (e.key === 'Enter' && e.shiftKey) {
                const height = this.$textArea.clientHeight;
                if (height < 200) {
                    this.$textArea.style.height = this.$textArea.clientHeight + 20 + 'px';
                }
            }
            else if (e.key === 'Enter') {
                e.preventDefault();
                if (this.prefill.editMessage) {
                    this.handleEditMessage();
                }
                else {
                    this.handleSendMessage();
                }
            }
            else if (e.key === 'Backspace') {
                if (this.$textArea.value.endsWith('\n')) {
                    this.$textArea.style.height = this.$textArea.clientHeight - 20 + 'px';
                }
                else if (this.$textArea.value === '') {
                    this.$textArea.style.height = 'auto';
                }
            }
        };
        this.handleKeyUp = (_e) => {
            if (this.mentionQuery !== '') {
                const reversed = reverse(this.$textArea.value.trim());
                const query = reversed.substring(0, reversed.indexOf(MENTION_CHAR));
                this.mentionQuery = `${MENTION_CHAR}${reverse(query)}`;
            }
        };
        this.onPaste = (e) => {
            const data = e.clipboardData || e.originalEvent.clipboardData;
            writeTask(() => {
                if (data && data.items && data.items.length > 0) {
                    handleFilesDataTransfer(data.items, this.generateFilePreview);
                    this.$textArea.value = '';
                }
            });
        };
        this.generateFilePreview = (type, file) => {
            this.fileToUpload = { type, image: file, file };
            if (type === 'image') {
                this.fileReader.readAsDataURL(file);
            }
            else if (type === 'file') {
                this.filePreview = file.name;
            }
        };
        this.sendFile = () => {
            if (!this.canSendFiles) {
                return;
            }
            if (this.fileToUpload.type === 'image') {
                this.onNewMessage.emit({
                    type: 'image',
                    file: this.fileToUpload.image,
                    image: this.fileToUpload.image,
                });
            }
            else {
                this.onNewMessage.emit({ type: 'file', file: this.fileToUpload.file });
            }
            this.cleanUpFileUpload();
        };
        this.handleSendMessage = () => {
            if (!this.canSendTextMessage) {
                return;
            }
            if (this.fileToUpload !== null) {
                this.sendFile();
                return;
            }
            const message = this.$textArea.value.trim();
            if (message.length > 0) {
                if (this.prefill.replyMessage) {
                    this.onNewMessage.emit({
                        type: 'text',
                        message,
                        replyTo: this.prefill.replyMessage,
                    });
                }
                else {
                    this.onNewMessage.emit({ type: 'text', message });
                }
                this.cleanup();
            }
        };
        this.cleanup = () => {
            this.mentionQuery = '';
            this.focusedMemberIndex = 0;
            this.$textArea.value = '';
            this.$textArea.style.height = 'auto';
            gracefulStorage.setItem(this.storageKey, '');
        };
        this.handleEditMessage = () => {
            var _a;
            let editedMessage = this.$textArea.value.trim();
            if (((_a = this.prefill.editMessage) === null || _a === void 0 ? void 0 : _a.message) &&
                replyBlockPattern.test(this.prefill.editMessage.message)) {
                // add back the reply block which we stripped out for editing
                const replyBlock = extractReplyBlock(this.prefill.editMessage.message);
                editedMessage = `${replyBlock}\n\n${editedMessage}`;
            }
            this.onEditMessage.emit({
                id: this.prefill.editMessage.id,
                message: editedMessage,
            });
            this.cleanup();
        };
        this.handleEditCancel = () => {
            this.onEditCancelled.emit();
            this.cleanup();
        };
        this.initializeTextField = (el) => {
            this.$textArea = el;
            const message = gracefulStorage.getItem(this.storageKey) || '';
            this.$textArea.value = message;
        };
        this.onMemberSelect = (member) => {
            const reversedQuery = reverse(this.mentionQuery);
            const reversed = reverse(this.$textArea.value.trim()).replace(reversedQuery, '');
            this.$textArea.value = reverse(reversed) + `${MENTION_CHAR}${member.name} `;
            this.mentionQuery = '';
            this.focusedMemberIndex = 0;
            writeTask(() => this.$textArea.focus());
        };
        this.getFilteredMembers = () => {
            const query = this.mentionQuery.replace(MENTION_CHAR, '');
            return this.members.filter((member) => member.name.toLowerCase().includes(query.toLowerCase()));
        };
        this.cleanUpFileUpload = () => {
            this.filePreview = null;
            this.fileToUpload = null;
        };
        this.renderSuggestedReplies = () => {
            if (!this.prefill.suggestedReplies)
                return;
            if (this.prefill.suggestedReplies.length === 0)
                return;
            return (h("ul", { class: "suggested-replies scrollbar" }, this.prefill.suggestedReplies.map((reply) => (h("rtk-tooltip", { label: this.t('chat.click_to_send') }, h("li", { onClick: () => this.onNewMessage.emit({ type: 'text', message: reply }) }, reply))))));
        };
        this.renderMenu = () => {
            if (this.mentionQuery.length === 0)
                return;
            const filteredMembers = this.getFilteredMembers();
            if (filteredMembers.length === 0)
                return;
            return (h("ul", { class: "member-list scrollbar" }, filteredMembers.map((member, index) => (h("li", { class: { member: true, selected: index === this.focusedMemberIndex }, onClick: () => this.onMemberSelect(member), ref: ($li) => {
                    if (index === this.focusedMemberIndex) {
                        writeTask(() => {
                            if ($li)
                                $li.scrollIntoView({ behavior: 'smooth', block: 'end', inline: 'nearest' });
                        });
                    }
                } }, h("rtk-avatar", { participant: {
                    name: member.name,
                    picture: member.picture,
                }, size: "sm" }), h("span", null, member.name))))));
        };
    }
    connectedCallback() {
        this.fileReader.onload = (e) => {
            if (typeof e.target.result === 'string') {
                this.filePreview = e.target.result;
            }
        };
        // this.fileReader.onloadstart = () => {};
        // this.fileReader.onloadend = () => {};
    }
    componentDidRender() {
        if (this.prefill.editMessage || this.prefill.replyMessage) {
            writeTask(() => this.$textArea.focus());
        }
    }
    get storageKey() {
        return 'rtk-text-message';
    }
    uploadFile(type) {
        const input = document.createElement('input');
        input.type = 'file';
        if (type === 'image') {
            input.accept = 'image/*';
        }
        input.onchange = (e) => {
            const { validity, files: [file], } = e.target;
            if (validity.valid) {
                this.generateFilePreview(type, file);
            }
        };
        input.click();
    }
    renderFilePreview() {
        if (typeof this.filePreview !== 'string')
            return;
        return (h("div", { class: "preview-overlay" }, h("div", { class: "file-preview" }, h("rtk-tooltip", { label: this.t('chat.cancel_upload') }, h("rtk-button", { variant: "secondary", kind: "icon", onClick: this.cleanUpFileUpload }, h("rtk-icon", { icon: this.iconPack.dismiss }))), this.fileToUpload.type === 'image' ? (h("img", { class: "preview-image", src: this.filePreview })) : (h("div", { class: "preview-file" }, h("span", null, this.filePreview))))));
    }
    render() {
        var _a;
        let defaultValue = '';
        if ((_a = this.prefill.editMessage) === null || _a === void 0 ? void 0 : _a.message) {
            defaultValue = stripOutReplyBlock(this.prefill.editMessage.message);
        }
        return (h(Host, { key: 'c1bbf529244184de2062ddb50b40a918fe6b89f0' }, this.canSendTextMessage && this.emojiPickerActive && (h("rtk-emoji-picker", { key: '62c92f177bdf7ff725a345efd948fbd07e58efda', part: "emoji-picker", onPickerClose: () => {
                this.emojiPickerActive = false;
            }, onRtkEmojiClicked: (e) => {
                this.$textArea.value += e.detail;
                this.$textArea.focus();
            }, t: this.t })), this.renderSuggestedReplies(), h("slot", { key: '02f70148bdae1f9e3b9fc60d088c59f85af68880', name: "chat-addon" }), h("slot", { key: '0ac47b719d6c39807076f86bcd0fe4fb9b75fcd5', name: "quote-block" }), h("div", { key: 'e88db8097f1615f62235c41262700c0c11bc0453', class: "chat-input", part: "chat-input" }, this.renderMenu(), this.canSendTextMessage && (h("textarea", { key: 'f1aa0c834b37e25a7e3093d10b6ad4531d58c0e8', class: "scrollbar", part: "textarea", ref: this.initializeTextField, autoFocus: true, placeholder: this.fileToUpload ? '' : this.t('chat.message_placeholder'), value: defaultValue, onPaste: this.onPaste, maxLength: MAX_TEXT_LENGTH, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, onInput: (e) => {
                gracefulStorage.setItem(this.storageKey, e.target.value);
            }, disabled: !!this.filePreview })), h("div", { key: '724a8e40a0384c4f11efca4d7abf081b110a7c9f', class: "chat-buttons", part: "chat-buttons" }, h("div", { key: '028b74f93d7b8ba1964460ea80ed4c63d56e5146', class: "left", part: "chat-buttons-left" }, !this.prefill.editMessage &&
            this.canSendFiles && [
            h("rtk-tooltip", { key: 'e4b0edc4f6a0f8f8b91ec4925dbd661c3e3b1a32', label: this.t('chat.send_file') }, h("rtk-button", { key: '53f030c9720362995342eb1959da07136c44724b', variant: "ghost", kind: "icon", onClick: () => this.uploadFile('file'), title: this.t('chat.send_file') }, h("rtk-icon", { key: '51bf45a1074886452e1c7d6ca80d8b5f9e7a61ba', icon: this.iconPack.attach }))),
            h("rtk-tooltip", { key: 'd20a53b034f312ced9d7f5441da7574100cbb6e7', label: this.t('chat.send_img') }, h("rtk-button", { key: '822413ff8636a33d2d70c7d10412a0ff5d043d86', variant: "ghost", kind: "icon", onClick: () => this.uploadFile('image'), title: this.t('chat.send_img') }, h("rtk-icon", { key: 'af60e5ec42253e7780af31bc5f2fb9ad00ad6245', icon: this.iconPack.image }))),
        ], !this.prefill.editMessage && this.canSendTextMessage && !this.disableEmojiPicker && (h("rtk-tooltip", { key: '665bb180737c220297a9394f582ddd8d57135ed4', label: this.t('chat.send_emoji') }, h("rtk-button", { key: '6550bd345555644e89a501df5838452206ea9c55', variant: "ghost", kind: "icon", class: { active: this.emojiPickerActive }, title: this.t('chat.send_emoji'), onClick: () => {
                this.emojiPickerActive = !this.emojiPickerActive;
            } }, h("rtk-icon", { key: '4ee0c02bf3efc309a58db7be0f51545d6d346a9c', icon: this.iconPack.emoji_multiple }))))), !!this.filePreview && this.renderFilePreview(), this.canSendTextMessage && (h("div", { key: 'a7d3f27cbe43f591363d1ffd8858f30d457e6629', class: "right", part: "chat-buttons-right" }, !this.prefill.editMessage && (h("rtk-tooltip", { key: '57fc69e04c29b54cfb8510914659f0b94c3944eb', variant: "primary", label: this.t('chat.send_msg'), delay: 2000 }, h("rtk-button", { key: '949e480cc2a243265f1268aff6396cd9bda20b03', kind: "icon", onClick: () => this.handleSendMessage(), title: this.t('chat.send_msg') }, h("rtk-icon", { key: '8fe5bc5391bef475805c86ab3fec94690bd71dfd', icon: this.iconPack.send })))), this.prefill.editMessage && (h("div", { key: '3e87dae17dcac9be10a20fe15252756d496bf924', class: "edit-buttons" }, h("rtk-tooltip", { key: '201e7b44dc8a40cfc94bb299448a1e89c972ea92', variant: "secondary", label: this.t('cancel'), delay: 2000 }, h("rtk-button", { key: '64d5dc9e41bc87a654c760c709b7b7d378f28141', kind: "icon", variant: "secondary", onClick: () => this.handleEditCancel(), title: this.t('cancel') }, h("rtk-icon", { key: '7e75e511da878e45f88b75c2f23a855a8c191b9b', icon: this.iconPack.dismiss }))), h("rtk-tooltip", { key: 'df6284b88ac9651d5cb1c736b92fb929ee5795a1', variant: "primary", label: this.t('chat.update_msg'), delay: 2000 }, h("rtk-button", { key: 'c6b375320d193ccbf6658aa040302453ae361f91', kind: "icon", onClick: () => this.handleEditMessage(), title: this.t('chat.send_msg') }, h("rtk-icon", { key: 'f047153809bc154526364f2e9a903449f83f51a9', icon: this.iconPack.checkmark })))))))))));
    }
    static get is() { return "rtk-chat-composer-ui"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["rtk-chat-composer-ui.css"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["rtk-chat-composer-ui.css"]
        };
    }
    static get properties() {
        return {
            "canSendTextMessage": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Whether user can send text messages"
                },
                "getter": false,
                "setter": false,
                "attribute": "can-send-text-message",
                "reflect": false,
                "defaultValue": "false"
            },
            "canSendFiles": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Whether user can send file messages"
                },
                "getter": false,
                "setter": false,
                "attribute": "can-send-files",
                "reflect": false,
                "defaultValue": "false"
            },
            "size": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "Size",
                    "resolved": "\"lg\" | \"md\" | \"sm\" | \"xl\"",
                    "references": {
                        "Size": {
                            "location": "import",
                            "path": "../../exports",
                            "id": "src/exports.ts::Size"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Size"
                },
                "getter": false,
                "setter": false,
                "attribute": "size",
                "reflect": true
            },
            "iconPack": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "IconPack",
                    "resolved": "{ people: string; people_checked: string; chat: string; poll: string; participants: string; rocket: string; call_end: string; share: string; mic_on: string; mic_off: string; video_on: string; video_off: string; share_screen_start: string; share_screen_stop: string; share_screen_person: string; clock: string; dismiss: string; send: string; search: string; more_vertical: string; chevron_down: string; chevron_up: string; chevron_left: string; chevron_right: string; settings: string; wifi: string; speaker: string; speaker_off: string; download: string; full_screen_maximize: string; full_screen_minimize: string; copy: string; attach: string; image: string; emoji_multiple: string; image_off: string; disconnected: string; wand: string; recording: string; subtract: string; stop_recording: string; warning: string; pin: string; pin_off: string; spinner: string; breakout_rooms: string; add: string; shuffle: string; edit: string; delete: string; back: string; save: string; web: string; checkmark: string; spotlight: string; join_stage: string; leave_stage: string; pip_off: string; pip_on: string; signal_1: string; signal_2: string; signal_3: string; signal_4: string; signal_5: string; start_livestream: string; stop_livestream: string; viewers: string; debug: string; info: string; devices: string; horizontal_dots: string; ai_sparkle: string; meeting_ai: string; captionsOn: string; captionsOff: string; play: string; pause: string; fastForward: string; minimize: string; maximize: string; }",
                    "references": {
                        "IconPack": {
                            "location": "import",
                            "path": "../../exports",
                            "id": "src/exports.ts::IconPack"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Icon pack"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "defaultIconPack"
            },
            "t": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "RtkI18n",
                    "resolved": "(key: \"pin\" | \"unpin\" | \"kick\" | \"ended\" | \"disconnected\" | \"failed\" | \"type\" | \"end\" | \"joined\" | \"pinned\" | \"join\" | \"participants\" | \"logo\" | \"audio\" | \"search\" | \"video\" | \"image\" | \"chat\" | \"polls\" | \"leave\" | \"close\" | \"plugins\" | \"screenshare\" | \"(you)\" | (string & {}) | \"about_call\" | \"screen\" | \"camera\" | \"dismiss\" | \"page\" | \"more\" | \"page.prev\" | \"page.next\" | \"layout\" | \"layout.auto\" | \"settings\" | \"file\" | \"connection\" | \"leave_confirmation\" | \"cancel\" | \"yes\" | \"you\" | \"everyone\" | \"to\" | \"mute\" | \"accept\" | \"pip_on\" | \"pip_off\" | \"viewers\" | \"create\" | \"ask\" | \"activate\" | \"requests\" | \"mic_off\" | \"disable_mic\" | \"mic_on\" | \"enable_mic\" | \"test\" | \"minimize\" | \"maximize\" | \"mute_all\" | \"mute_all.description\" | \"mute_all.header\" | \"mute_all.allow_unmute\" | \"video_off\" | \"disable_video\" | \"video_on\" | \"enable_video\" | \"offline\" | \"offline.description\" | \"failed.description\" | \"disconnected.description\" | \"participants.errors.empty_results\" | \"participants.empty_list\" | \"participants.no_pending_requests\" | \"participants.turn_off_video\" | \"polls.by\" | \"polls.question\" | \"polls.question.placeholder\" | \"polls.answers\" | \"polls.option\" | \"polls.option.placeholder\" | \"polls.results.anon\" | \"polls.results.hide\" | \"polls.create\" | \"polls.cancel\" | \"polls.empty\" | \"polls.errors.question_required\" | \"polls.errors.empty_option\" | \"screenshare.min_preview\" | \"screenshare.max_preview\" | \"screenshare.shared\" | \"screenshare.start\" | \"screenshare.stop\" | \"screenshare.error.unknown\" | \"screenshare.error.max_count\" | \"plugins.empty\" | \"perm_denied\" | \"perm_denied.audio\" | \"perm_denied.video\" | \"perm_denied.screenshare\" | \"perm_denied.audio.chrome.message\" | \"perm_denied.video.chrome.message\" | \"perm_denied.screenshare.chrome.message\" | \"perm_denied.audio.safari.message\" | \"perm_denied.video.safari.message\" | \"perm_denied.screenshare.safari.message\" | \"perm_denied.audio.edge.message\" | \"perm_denied.video.edge.message\" | \"perm_denied.screenshare.edge.message\" | \"perm_denied.audio.microsoft edge.message\" | \"perm_denied.video.microsoft edge.message\" | \"perm_denied.screenshare.microsoft edge.message\" | \"perm_denied.audio.firefox.message\" | \"perm_denied.video.firefox.message\" | \"perm_denied.screenshare.firefox.message\" | \"perm_denied.audio.others.message\" | \"perm_denied.video.others.message\" | \"perm_denied.screenshare.others.message\" | \"perm_sys_denied\" | \"perm_sys_denied.audio\" | \"perm_sys_denied.video\" | \"perm_sys_denied.screenshare\" | \"perm_sys_denied.audio.macos.message\" | \"perm_sys_denied.video.macos.message\" | \"perm_sys_denied.screenshare.macos.message\" | \"perm_sys_denied.audio.ios.message\" | \"perm_sys_denied.video.ios.message\" | \"perm_sys_denied.screenshare.ios.message\" | \"perm_sys_denied.audio.windows.message\" | \"perm_sys_denied.video.windows.message\" | \"perm_sys_denied.screenshare.windows.message\" | \"perm_sys_denied.audio.android.message\" | \"perm_sys_denied.video.android.message\" | \"perm_sys_denied.screenshare.android.message\" | \"perm_sys_denied.audio.others.message\" | \"perm_sys_denied.video.others.message\" | \"perm_sys_denied.screenshare.others.message\" | \"perm_could_not_start\" | \"perm_could_not_start.audio\" | \"perm_could_not_start.video\" | \"perm_could_not_start.screenshare\" | \"perm_could_not_start.audio.message\" | \"perm_could_not_start.video.message\" | \"perm_could_not_start.screenshare.message\" | \"full_screen\" | \"full_screen.exit\" | \"waitlist.header_title\" | \"waitlist.body_text\" | \"waitlist.deny_request\" | \"waitlist.accept_request\" | \"waitlist.accept_all\" | \"stage_request.header_title\" | \"stage_request.deny_request\" | \"stage_request.accept_request\" | \"stage_request.accept_all\" | \"stage_request.deny_all\" | \"stage_request.approval_pending\" | \"stage_request.denied\" | \"stage_request.request\" | \"stage_request.requested\" | \"stage_request.cancel_request\" | \"stage_request.leave_stage\" | \"stage_request.request_tip\" | \"stage_request.leave_tip\" | \"stage_request.pending_tip\" | \"stage_request.denied_tip\" | \"stage.empty_host\" | \"stage.empty_host_summary\" | \"stage.empty_viewer\" | \"stage.remove_from_stage\" | \"stage.invited_notification\" | \"stage.add_to_stage\" | \"stage.join_title\" | \"stage.join_summary\" | \"stage.join_cancel\" | \"stage.join_confirm\" | \"setup_screen.join_in_as\" | \"setup_screen.your_name\" | \"stage.reconnecting\" | \"recording.label\" | \"recording.indicator\" | \"recording.started\" | \"recording.stopped\" | \"recording.paused\" | \"recording.error.start\" | \"recording.error.stop\" | \"recording.error.resume\" | \"recording.start\" | \"recording.stop\" | \"recording.resume\" | \"recording.starting\" | \"recording.stopping\" | \"recording.loading\" | \"recording.idle\" | \"audio_playback\" | \"audio_playback.title\" | \"audio_playback.description\" | \"breakout_rooms\" | \"breakout_rooms.room_config_header\" | \"breakout_rooms.join_breakout_header\" | \"breakout_rooms.empty\" | \"breakout_rooms.delete\" | \"breakout_rooms.switch\" | \"breakout_rooms.main_room\" | \"breakout_rooms.shuffle_participants\" | \"breakout_rooms.deselect\" | \"breakout_rooms.selected\" | \"breakout_rooms.num_of_rooms\" | \"breakout_rooms.approx\" | \"breakout_rooms.participants_per_room\" | \"breakout_rooms.division_text\" | \"breakout_rooms.start_breakout\" | \"breakout_rooms.close_breakout\" | \"breakout_rooms.update_breakout\" | \"breakout_rooms.discard_changes\" | \"breakout_rooms.room\" | \"breakout_rooms.rooms\" | \"breakout_rooms.room_name\" | \"breakout_rooms.edit_room_name\" | \"breakout_rooms.save_room_name\" | \"breakout_rooms.add_room\" | \"breakout_rooms.add_room_brief\" | \"breakout_rooms.select_all\" | \"breakout_rooms.unassign_all\" | \"breakout_rooms.assign\" | \"breakout_rooms.assign_participants\" | \"breakout_rooms.none_assigned\" | \"breakout_rooms.drag_drop_participants\" | \"breakout_rooms.click_drop_participants\" | \"breakout_rooms.status.assign_multiple\" | \"breakout_rooms.status.select_room\" | \"breakout_rooms.ephemeral_status.participants_assigned\" | \"breakout_rooms.ephemeral_status.participants_assigned_randomly\" | \"breakout_rooms.ephemeral_status.changes_discarded\" | \"breakout_rooms.confirm_modal.start_breakout.header\" | \"breakout_rooms.confirm_modal.start_breakout.content\" | \"breakout_rooms.confirm_modal.start_breakout.cancelText\" | \"breakout_rooms.confirm_modal.start_breakout.ctaText\" | \"breakout_rooms.confirm_modal.close_breakout.header\" | \"breakout_rooms.confirm_modal.close_breakout.content\" | \"breakout_rooms.confirm_modal.close_breakout.ctaText\" | \"breakout_rooms.move_reason.started_msg\" | \"breakout_rooms.move_reason.started_desc\" | \"breakout_rooms.move_reason.closed_msg\" | \"breakout_rooms.move_reason.closed_desc\" | \"breakout_rooms.move_reason.switch_room\" | \"breakout_rooms.move_reason.switch_main_room\" | \"breakout_rooms.all_assigned\" | \"breakout_rooms.empty_main_room\" | \"breakout_rooms.leave_confirmation\" | \"breakout_rooms.leave_confirmation.main_room_btn\" | \"ai\" | \"ai.meeting_ai\" | \"ai.home\" | \"ai.transcriptions\" | \"ai.personal\" | \"ai.caption_view\" | \"ai.chat.tooltip\" | \"ai.chat.summarize\" | \"ai.chat.agenda\" | \"ai.transcriptions.search_placeholder\" | \"ai.transcriptions.no_transcripts_found\" | \"ai.transcriptions.no_transcripts_yet\" | \"search.could_not_find\" | \"search.empty\" | \"end.all\" | \"ended.rejected\" | \"ended.left\" | \"ended.kicked\" | \"ended.disconnected\" | \"ended.network\" | \"ended.unauthorized\" | \"network\" | \"network.reconnecting\" | \"network.delay_extended\" | \"network.disconnected\" | \"network.leaving\" | \"network.restored\" | \"network.delay\" | \"network.lost\" | \"network.lost_extended\" | \"network.troubleshoot\" | \"join.network_error\" | \"join.media_error\" | \"join.media_firewall_error\" | \"join.default_error\" | \"join.error_code\" | \"livestream\" | \"livestream.indicator\" | \"livestream.skip\" | \"livestream.idle\" | \"livestream.starting\" | \"livestream.stopping\" | \"livestream.waiting_on_manual_ingestion\" | \"livestream.error.not_supported\" | \"livestream.error.not_found\" | \"livestream.error.unknown\" | \"livestream.error.sync\" | \"livestream.error.start\" | \"livestream.error.stop\" | \"livestream.go_live\" | \"livestream.end_live\" | \"livestream.error\" | \"cta.help\" | \"cta.continue\" | \"cta.reload\" | \"cta.confirmation\" | \"cta.system_settings\" | \"remote_access.empty\" | \"remote_access.requests\" | \"remote_access.allow\" | \"remote_access.grant\" | \"remote_access.indicator\" | \"chat.new\" | \"chat.max_limit_warning\" | \"chat.rate_limit_error\" | \"chat.member_name\" | \"chat.add_members\" | \"chat.delete_msg\" | \"chat.edit_msg\" | \"chat.send_msg\" | \"chat.send_attachment\" | \"chat.send_img\" | \"chat.send_file\" | \"chat.send_emoji\" | \"chat.update_msg\" | \"chat.img.loading\" | \"chat.error.img_not_found\" | \"chat.error.empty_results\" | \"chat.img.shared_by\" | \"chat.reply\" | \"chat.message_placeholder\" | \"chat.click_to_send\" | \"chat.search_msgs\" | \"chat.search_conversations\" | \"chat.start_conversation\" | \"chat.empty_search\" | \"chat.empty_chat\" | \"chat.cancel_upload\" | \"chat.view_chats\" | \"chat.everyone\" | \"chat.pinned_msgs\" | \"chat.toggle_pinned_msgs\" | \"date.today\" | \"date.yesterday\" | \"date.sunday\" | \"date.monday\" | \"date.tuesday\" | \"date.wednesday\" | \"date.thursday\" | \"date.friday\" | \"date.saturday\" | \"list.empty\" | \"grid.listening\" | \"transcript.off\" | \"transcript.on\" | \"settings.notification_sound\" | \"settings.microphone_input\" | \"settings.speaker_output\" | \"settings.mirror_video\" | \"settings.camera_off\" | \"dialog.close\" | \"notifications.joined\" | \"notifications.left\" | \"notifications.requesting_to_join_meeting\" | \"notifications.requested_to_join_stage\" | \"notifications.joined_stage\" | \"notifications.request_to_join_accepted\" | \"notifications.request_to_join_rejected\" | \"notifications.accept\" | \"notifications.new_poll_created_by\" | \"notifications.connected_to\" | \"notifications.plugin_switched_to\" | \"notifications.remote_control_requested\" | \"notifications.remote_control_request_sent\" | \"notifications.remote_control_request_accepted\" | \"notifications.remote_control_granted\" | \"notifications.remote_control_terminated\" | \"debugger.troubleshooting.label\" | \"debugger.quality.good\" | \"debugger.quality.average\" | \"debugger.quality.poor\" | \"debugger.stats.bitrate.label\" | \"debugger.stats.bitrate.description\" | \"debugger.stats.packet_loss.label\" | \"debugger.stats.packet_loss.description\" | \"debugger.stats.jitter.label\" | \"debugger.stats.jitter.description\" | \"debugger.stats.cpu_limitations.label\" | \"debugger.stats.cpu_limitations.description\" | \"debugger.stats.bandwidth_limitations.label\" | \"debugger.stats.bandwidth_limitations.description\" | \"debugger.audio.label\" | \"debugger.audio.troubleshooting.label\" | \"debugger.audio.messages.generating_report\" | \"debugger.audio.messages.enable_media\" | \"debugger.audio.sections.network_media\" | \"debugger.video.label\" | \"debugger.video.troubleshooting.label\" | \"debugger.video.messages.generating_report\" | \"debugger.video.messages.enable_media\" | \"debugger.video.sections.network_media\" | \"debugger.screenshare.label\" | \"debugger.screenshare.troubleshooting.label\" | \"debugger.screenshare.sections.network_media\" | \"debugger.screenshare.messages.generating_report\" | \"debugger.screenshare.messages.enable_media\" | \"debugger.system.label\" | \"debugger.system.troubleshooting.label\" | \"debugger.system.sections.battery\" | \"debugger.system.battery.level.label\" | \"debugger.system.battery.level.description\" | \"debugger.system.battery.charging.label\" | \"debugger.system.battery.charging.description\" | \"debugger.system.battery.charging.is_charging\" | \"debugger.system.battery.charging.is_not_charging\") => string",
                    "references": {
                        "RtkI18n": {
                            "location": "import",
                            "path": "../../lib/lang",
                            "id": "src/lib/lang/index.ts::RtkI18n"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Language"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "useLanguage()"
            },
            "disableEmojiPicker": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Whether to show emoji picker"
                },
                "getter": false,
                "setter": false,
                "attribute": "disable-emoji-picker",
                "reflect": false,
                "defaultValue": "false"
            },
            "prefill": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "{\n    suggestedReplies?: string[];\n    editMessage?: TextMessage;\n    replyMessage?: TextMessage;\n  }",
                    "resolved": "{ suggestedReplies?: string[]; editMessage?: TextMessage; replyMessage?: TextMessage; }",
                    "references": {
                        "TextMessage": {
                            "location": "import",
                            "path": "@cloudflare/realtimekit",
                            "id": "../../node_modules/@cloudflare/realtimekit/dist/index.d.ts::TextMessage"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "prefill the composer"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "{}"
            },
            "members": {
                "type": "unknown",
                "mutable": false,
                "complexType": {
                    "original": "RTKBasicParticipant[]",
                    "resolved": "BasicParticipant[]",
                    "references": {
                        "RTKBasicParticipant": {
                            "location": "import",
                            "path": "@cloudflare/realtimekit",
                            "id": "../../node_modules/@cloudflare/realtimekit/dist/index.d.ts::BasicParticipant"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "list of members that can be mentioned"
                },
                "getter": false,
                "setter": false,
                "defaultValue": "[]"
            }
        };
    }
    static get states() {
        return {
            "emojiPickerActive": {},
            "mentionQuery": {},
            "focusedMemberIndex": {},
            "filePreview": {}
        };
    }
    static get events() {
        return [{
                "method": "onNewMessage",
                "name": "rtkNewMessage",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event emitted when new message is submitted"
                },
                "complexType": {
                    "original": "RtkNewMessageEvent",
                    "resolved": "RtkFile | RtkImage | RtkText",
                    "references": {
                        "RtkNewMessageEvent": {
                            "location": "local",
                            "path": "/home/runner/work/realtimekit-ui/realtimekit-ui/packages/core/src/components/rtk-chat-composer-ui/rtk-chat-composer-ui.tsx",
                            "id": "src/components/rtk-chat-composer-ui/rtk-chat-composer-ui.tsx::RtkNewMessageEvent"
                        }
                    }
                }
            }, {
                "method": "onEditMessage",
                "name": "rtkEditMessage",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event emitted when message is edited"
                },
                "complexType": {
                    "original": "{\n    id: string;\n    message: string;\n  }",
                    "resolved": "{ id: string; message: string; }",
                    "references": {}
                }
            }, {
                "method": "onEditCancelled",
                "name": "rtkEditCancelled",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Event emitted when message editing is cancelled"
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }];
    }
}
__decorate([
    SyncWithStore()
], RtkChatComposerUi.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkChatComposerUi.prototype, "t", void 0);
