import { p as proxyCustomElement, H, h, c as Host } from './p-ae373651.js';
import { e as defaultIconPack, i as useLanguage } from './p-5b3a7f00.js';
import { h as hasOnlyEmojis } from './p-efabd2ce.js';
import { C as ChatHead } from './p-38d22d57.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { T as TextMessageView } from './p-1a950769.js';

var __decorate = (undefined && undefined.__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;
};
const RtkTextMessage = /*@__PURE__*/ proxyCustomElement(class RtkTextMessage extends H {
    constructor() {
        super();
        this.__registerHost();
        /** Date object of now, to calculate distance between dates */
        this.now = new Date();
        /** Whether the message is continued by same user */
        this.isContinued = false;
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        /** show message in bubble */
        this.showBubble = false;
    }
    render() {
        return (h(Host, { key: 'a34dd007a87a134202e153f3d886102bbe6a685c' }, !this.isContinued && (h(ChatHead, { key: '8505cee0d359b7449776ece2bbd7455811217a41', name: this.message.displayName, time: this.message.time, now: this.now })), h("div", { key: '00b2baca454b62e4984e82790580bac116a046a0', class: {
                body: true,
                bubble: this.showBubble,
            }, part: "body" }, h("div", { key: 'ecc8de946011c9836cebfd626a27cb23f111d0cc', class: { text: true, emoji: hasOnlyEmojis(this.message.message) } }, h(TextMessageView, { key: '1efad576e6110986cb2abac7ff2c42b492c995aa', message: this.message.message })))));
    }
}, [0, "rtk-text-message", {
        "message": [16],
        "now": [16],
        "isContinued": [516, "is-continued"],
        "iconPack": [16],
        "t": [16],
        "showBubble": [4, "show-bubble"]
    }]);
__decorate([
    SyncWithStore()
], RtkTextMessage.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkTextMessage.prototype, "t", void 0);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-text-message"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-text-message":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkTextMessage);
            }
            break;
    } });
}
defineCustomElement();

export { RtkTextMessage as R, defineCustomElement as d };
