import { p as proxyCustomElement, H, h, c as Host } from './p-ae373651.js';
import { c as createDefaultConfig, e as defaultIconPack, i as useLanguage } from './p-5b3a7f00.js';
import './p-a83ccdbd.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { d as defineCustomElement$3 } from './p-3e0452c4.js';
import { d as defineCustomElement$2 } from './p-7c6602b9.js';

const rtkEndedScreenCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}.rejoin-button{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-6, 24px);padding-bottom:var(--rtk-space-6, 24px);padding-left:var(--rtk-space-16, 64px);padding-right:var(--rtk-space-16, 64px)}.rejoin-icon{margin-right:var(--rtk-space-2, 8px)}p{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}p.breakout{font-size:20px;display:flex;flex-direction:column;align-items:center}p.breakout span{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-0, 0px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}span{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}";
const RtkEndedScreenStyle0 = rtkEndedScreenCss;

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 RtkEndedScreen$1 = /*@__PURE__*/ proxyCustomElement(class RtkEndedScreen extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        /** Config object */
        this.config = createDefaultConfig();
        /** Icon */
        this.icon = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        /** Icon pack */
        this.iconPack = defaultIconPack;
        this.message = '';
    }
    connectedCallback() {
        this.statesChanged(this.states);
    }
    getBreakoutRoomsMessage(states) {
        var _a;
        let message;
        if ((states === null || states === void 0 ? void 0 : states.roomLeftState) === 'connected-meeting') {
            if (((_a = this.states.activeBreakoutRoomsManager) === null || _a === void 0 ? void 0 : _a.destinationMeetingId) ===
                this.meeting.connectedMeetings.parentMeeting.id) {
                message = 'breakout_rooms.move_reason.switch_main_room';
            }
            else {
                message = 'breakout_rooms.move_reason.switch_room';
            }
        }
        return message;
    }
    statesChanged(states) {
        if (states != null) {
            switch (states === null || states === void 0 ? void 0 : states.roomLeftState) {
                case 'left':
                    this.message = 'ended.left';
                    break;
                case 'kicked':
                    this.message = 'ended.kicked';
                    break;
                case 'disconnected':
                    this.message = 'ended.disconnected';
                    break;
                case 'rejected':
                    this.message = 'ended.rejected';
                    break;
                case 'connected-meeting':
                    this.message = this.getBreakoutRoomsMessage(states);
                    break;
                case 'unauthorized':
                    this.message = 'ended.unauthorized';
                    break;
                default:
                    this.message = 'ended';
            }
        }
    }
    renderBreakoutRoomScreen() {
        return (h(Host, null, h("div", { class: "ctr", part: "container" }, h("rtk-icon", { icon: this.iconPack.breakout_rooms }), h("p", { part: "message", class: "breakout" }, this.t(this.message)))));
    }
    render() {
        if (!this.meeting)
            return null;
        const states = this.states;
        if (states.roomLeftState === 'connected-meeting') {
            return this.renderBreakoutRoomScreen();
        }
        return (h(Host, null, h("div", { class: "ctr", part: "container" }, h("rtk-logo", { meeting: this.meeting, config: this.config, part: "logo", t: this.t }), h("p", { part: "message" }, this.t(this.message)), (states === null || states === void 0 ? void 0 : states.roomLeftState) === 'disconnected' && (h("span", { part: "description" }, this.t('ended.network'))))));
    }
    static get watchers() { return {
        "states": ["statesChanged"]
    }; }
    static get style() { return RtkEndedScreenStyle0; }
}, [1, "rtk-ended-screen", {
        "config": [16],
        "size": [513],
        "states": [16],
        "t": [16],
        "iconPack": [16],
        "meeting": [16],
        "icon": [32],
        "message": [32]
    }, undefined, {
        "states": ["statesChanged"]
    }]);
__decorate([
    SyncWithStore()
], RtkEndedScreen$1.prototype, "config", void 0);
__decorate([
    SyncWithStore()
], RtkEndedScreen$1.prototype, "states", void 0);
__decorate([
    SyncWithStore()
], RtkEndedScreen$1.prototype, "t", void 0);
__decorate([
    SyncWithStore()
], RtkEndedScreen$1.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkEndedScreen$1.prototype, "meeting", void 0);
function defineCustomElement$1() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-ended-screen", "rtk-icon", "rtk-logo"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-ended-screen":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkEndedScreen$1);
            }
            break;
        case "rtk-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "rtk-logo":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
    } });
}
defineCustomElement$1();

const RtkEndedScreen = RtkEndedScreen$1;
const defineCustomElement = defineCustomElement$1;

export { RtkEndedScreen, defineCustomElement };
