import { p as proxyCustomElement, H, e as createEvent, h, c as Host } from './p-ae373651.js';
import { e as defaultIconPack, i as useLanguage, I as resetRoomCount, B as BreakoutRoomsManager, H as participantIdentifier } from './p-5b3a7f00.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { d as defineCustomElement$8 } from './p-a3bf84d7.js';
import { d as defineCustomElement$7 } from './p-c5ef686a.js';
import { d as defineCustomElement$6 } from './p-f4a5c8ff.js';
import { d as defineCustomElement$5 } from './p-85587a5c.js';
import { d as defineCustomElement$4 } from './p-cb6f4d4b.js';
import { d as defineCustomElement$3 } from './p-3e0452c4.js';
import { d as defineCustomElement$2 } from './p-e6245534.js';
import { d as defineCustomElement$1 } from './p-bece0226.js';

const rtkBreakoutRoomsManagerCss = ":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)}.color-brand{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.color-danger{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.loading-content{height:var(--rtk-space-60, 240px);width:var(--rtk-space-96, 384px);padding:var(--rtk-space-9, 36px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;align-items:center;justify-content:center}.room-config{overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;flex-direction:column;width:var(--rtk-space-96, 384px);padding-left:var(--rtk-space-9, 36px);padding-right:var(--rtk-space-9, 36px);padding-top:var(--rtk-space-10, 40px);padding-bottom:var(--rtk-space-10, 40px)}header{margin-bottom:var(--rtk-space-8, 32px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px);font-size:24px;font-weight:600}header rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}.create-room{margin-bottom:var(--rtk-space-4, 16px);display:flex;align-items:center;gap:var(--rtk-space-3, 12px);width:100%}.create-room p{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-1, 4px);font-size:16px}.distribution-hint{margin-bottom:var(--rtk-space-8, 32px);font-size:14px;font-weight:400;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.distribution-hint em{font-style:normal;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}footer{display:flex;flex-direction:row;vertical-align:middle;justify-content:center}footer rtk-button{width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}label{margin-bottom:var(--rtk-space-3, 12px);font-weight:400;color:rgb(var(--rtk-colors-text-1000, 255 255 255));opacity:0.4}.participant-config-wrapper{width:850px;min-height:595px;max-width:100%;max-height:100%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;flex-direction:column}.participant-config-actions{display:flex;justify-content:space-between;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-5, 20px);padding-bottom:var(--rtk-space-5, 20px);border-bottom-right-radius:var(--rtk-border-radius-md, 8px);border-bottom-left-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.participant-config{display:flex;flex-grow:1;flex-direction:row;overflow:hidden}aside{box-sizing:border-box;display:flex;width:var(--rtk-space-96, 384px);flex-grow:1;flex-direction:column;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-4, 16px);border-right-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-right-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}aside header{margin-bottom:var(--rtk-space-4, 16px);width:100%;padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px);padding-top:var(--rtk-space-8, 32px);font-size:20px;font-weight:500;line-height:2rem}.shuffle-button{display:flex;flex-direction:row;align-items:center}.shuffle-button rtk-icon{height:var(--rtk-space-8, 32px)}.participants-assign-actions{display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:14px;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-2, 8px);margin-left:calc(var(--rtk-space-8, 32px) * -1);margin-right:calc(var(--rtk-space-4, 16px) * -1);padding-top:var(--rtk-space-0\\.5, 2px);padding-bottom:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.participants-assign-actions .deselect-button{height:var(--rtk-space-6, 24px)}.participants-assign-actions .deselect-button:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.assign-rooms{padding:var(--rtk-space-8, 32px);display:flex;width:100%;flex-direction:column}.assign-rooms .disabled{opacity:0.2}.assign-rooms .back{display:flex;cursor:pointer;flex-direction:row;align-items:center;justify-content:flex-start;padding:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-0, 0px);font-size:14px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.assign-rooms .back rtk-icon{height:var(--rtk-space-5, 20px)}.assign-rooms .row{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}.assign-rooms .row-header{margin:var(--rtk-space-0, 0px);font-size:16px;line-height:2rem}.assign-rooms .cta-buttons{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px)}.assign-rooms .cta-buttons rtk-button div{display:flex;flex-direction:row;align-items:center}.assign-rooms .cta-buttons rtk-button div rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.rooms{margin-bottom:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-1, 4px);display:flex;flex-grow:1;flex-direction:column;gap:var(--rtk-space-2, 8px);overflow-y:auto;max-height:500px}.rooms::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px)}.rooms::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.rooms::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.breakout-actions{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;gap:var(--rtk-space-2, 8px)}.breakout-actions .start-breakout-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.breakout-actions .close-breakout-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}.breakout-actions .update-breakout-button{background-color:transparent;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}.status-bar{display:flex;align-items:center;font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));width:var(--rtk-space-80, 320px)}.ephemeral-status{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.ephemeral-status rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.room-switcher-container{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));width:468px;padding:var(--rtk-space-8, 32px)}.add-room-jumbo-btn div{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.add-room-jumbo-btn div rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.br-primary-btn:not([disabled]){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-primary-btn:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}.br-secondary-btn:not([disabled]){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-secondary-btn:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}";
const RtkBreakoutRoomsManagerStyle0 = rtkBreakoutRoomsManagerCss;

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 MIN_ROOMS = 1;
const RtkBreakoutRoomsManager = /*@__PURE__*/ proxyCustomElement(class RtkBreakoutRoomsManager extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
        /** Flag to indicate busy state */
        this.loading = false;
        /** Breakout room config object */
        this.roomConfig = {
            rooms: 2,
            step: 'room-config',
            mode: 'create',
            applyingChanges: false,
        };
        /** List of assigned participants */
        // @State() unassignedParticipants: string[] = [];
        /** Flag that tells if participants are being assigned or not */
        this.assigningParticipants = false;
        /** List of selected peers */
        this.selectedParticipants = [];
        /** update about room changes */
        this.ephemeralStatusText = '';
        /** Flag that tells if participants are being dragged */
        this.isDragMode = false;
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        this.permissionsUpdateListener = () => {
            this.permissions = this.meeting.self.permissions.connectedMeetings;
        };
        this.updateLocalState = (payload) => {
            this.stateManager.updateCurrentState(payload);
            this.draftState = this.stateManager.currentState;
            if (this.meeting.connectedMeetings.isActive) {
                this.roomConfig = Object.assign(Object.assign({}, this.roomConfig), { mode: 'edit' });
            }
            if (this.roomConfig.mode === 'create' && !this.meeting.connectedMeetings.isActive) {
                resetRoomCount();
            }
            if (['edit', 'view'].includes(this.roomConfig.mode)) {
                this.roomConfig = Object.assign(Object.assign({}, this.roomConfig), { rooms: payload.meetings.length, step: 'participants-config' });
                this.selectedParticipants = [];
            }
        };
        this.onAddNewRoom = () => {
            this.stateManager.addNewMeeting();
            this.draftState = this.stateManager.currentState;
            this.selectorRef.scrollTo({ top: this.selectorRef.scrollHeight, behavior: 'smooth' });
        };
        this.onRoomUpdate = (event) => {
            const { detail } = event;
            this.stateManager.updateMeetingTitle(detail.id, detail.title);
            this.draftState = this.stateManager.currentState;
        };
        this.onRoomDelete = (id) => {
            const toDelete = this.stateManager.allConnectedMeetings.find((meeting) => meeting.id === id);
            if (toDelete) {
                this.stateManager.deleteMeeting(id);
                this.draftState = this.stateManager.currentState;
            }
        };
        this.unassignParticipant = (id) => {
            this.stateManager.unassignParticipants([id]);
            this.draftState = this.stateManager.currentState;
        };
        this.onUnassignAll = () => {
            this.stateManager.unassignAllParticipants();
            this.draftState = this.stateManager.currentState;
        };
        this.assignParticipantsToRoom = (destinationMeetingId) => {
            if (this.selectedParticipants.length === 0 || this.assigningParticipants == false)
                return;
            this.stateManager.assignParticipantsToMeeting(this.selectedParticipants, destinationMeetingId);
            this.draftState = this.stateManager.currentState;
            this.selectedParticipants = [];
            this.assigningParticipants = false;
            this.setEphemeralStatus(this.t('breakout_rooms.ephemeral_status.participants_assigned'));
        };
        this.handleClose = (stateUpdate, store) => {
            stateUpdate.emit({
                activeBreakoutRoomsManager: {
                    active: true,
                },
            });
            store.activeBreakoutRoomsManager = {
                active: true,
            };
        };
        this.enableConfirmationModal = (modalType = 'start-breakout') => {
            let activeConfirmationModal = {
                active: true,
                header: 'breakout_rooms.confirm_modal.start_breakout.header',
                content: 'breakout_rooms.confirm_modal.start_breakout.content',
                variant: 'primary',
                cancelText: 'breakout_rooms.confirm_modal.start_breakout.cancelText',
                ctaText: 'breakout_rooms.confirm_modal.start_breakout.ctaText',
                onClick: () => this.applyChanges(),
                onClose: this.handleClose,
            };
            if (modalType === 'close-breakout') {
                activeConfirmationModal = {
                    active: true,
                    header: 'breakout_rooms.confirm_modal.close_breakout.header',
                    content: 'breakout_rooms.confirm_modal.close_breakout.content',
                    variant: 'danger',
                    cancelText: 'cancel',
                    ctaText: 'breakout_rooms.confirm_modal.close_breakout.ctaText',
                    onClick: () => this.closeBreakout(),
                    onClose: this.handleClose,
                };
            }
            this.stateUpdate.emit({
                activeBreakoutRoomsManager: { active: false },
                activeConfirmationModal,
            });
        };
        this.close = () => {
            this.stateManager.discardChanges();
            this.stateUpdate.emit({
                activeBreakoutRoomsManager: {
                    active: false,
                },
            });
        };
        this.applyChanges = async () => {
            this.roomConfig = Object.assign(Object.assign({}, this.roomConfig), { applyingChanges: true });
            await this.stateManager.applyChanges(this.meeting);
            this.close();
            this.roomConfig = Object.assign(Object.assign({}, this.roomConfig), { applyingChanges: false });
        };
    }
    onSelectedParticipantsChanged(participants) {
        if (participants.length > 0)
            this.assigningParticipants = true;
        else
            this.assigningParticipants = false;
    }
    connectedCallback() {
        this.permissionsUpdateListener();
        this.meeting.connectedMeetings.on('stateUpdate', this.updateLocalState);
        this.meeting.connectedMeetings.on('changingMeeting', this.close);
        this.meeting.self.permissions.on('permissionsUpdate', this.permissionsUpdateListener);
        this.stateManager = new BreakoutRoomsManager();
        this.fetchRoomState();
    }
    disconnectedCallback() {
        this.meeting.connectedMeetings.off('stateUpdate', this.updateLocalState);
        this.meeting.connectedMeetings.off('changingMeeting', this.close);
        this.meeting.self.permissions.off('permissionsUpdate', this.permissionsUpdateListener);
    }
    async fetchRoomState() {
        this.loading = true;
        await this.meeting.connectedMeetings.getConnectedMeetings();
        this.loading = false;
    }
    setEphemeralStatus(text) {
        this.ephemeralStatusText = text;
        setTimeout(() => {
            this.ephemeralStatusText = '';
        }, 3000);
    }
    onCreateRooms() {
        this.selectedParticipants = [];
        this.stateManager.addNewMeetings(this.roomConfig.rooms);
        this.draftState = this.stateManager.currentState;
        // move to next step -> participants-config
        this.roomConfig = Object.assign(Object.assign({}, this.roomConfig), { step: 'participants-config' });
    }
    onParticipantDelete(event) {
        const { detail } = event;
        const id = participantIdentifier(detail);
        if (id == null)
            return;
        this.unassignParticipant(id);
    }
    toggleDragMode(e) {
        this.isDragMode = e.detail;
    }
    assignParticipantsRandomly() {
        if (this.stateManager.unassignedParticipants.length === 0)
            return;
        this.stateManager.assignParticipantsRandomly();
        this.draftState = this.stateManager.currentState;
        this.setEphemeralStatus(this.t('breakout_rooms.ephemeral_status.participants_assigned_randomly'));
    }
    async joinRoom(destinationMeetingId) {
        const participantId = participantIdentifier(this.meeting.self);
        this.stateManager.assignParticipantsToMeeting([participantId], destinationMeetingId);
        await this.applyChanges();
    }
    async closeBreakout() {
        this.stateManager.allConnectedMeetings.forEach((meeting) => this.stateManager.deleteMeeting(meeting.id));
        await this.applyChanges();
    }
    updateSelectedParticipants(e) {
        this.selectedParticipants = e.detail;
    }
    updateAllParticipants(e) {
        this.selectedParticipants = e.detail;
    }
    getStatusText() {
        if (this.ephemeralStatusText !== '')
            return this.ephemeralStatusText;
        let statusText = '';
        if (this.roomConfig.mode === 'create') {
            statusText = this.t('breakout_rooms.status.assign_multiple');
            if (this.selectedParticipants.length !== 0) {
                statusText = this.t('breakout_rooms.status.select_room');
            }
        }
        return statusText;
    }
    getApproxDistribution() {
        const num = this.stateManager.unassignedParticipants.length / (this.roomConfig.rooms || MIN_ROOMS);
        return Math.max(MIN_ROOMS, Math.round(num));
    }
    deselectAll() {
        this.selectedParticipants = [];
    }
    async discardChanges() {
        this.stateManager.discardChanges();
        await this.fetchRoomState();
        this.setEphemeralStatus(this.t('breakout_rooms.ephemeral_status.changes_discarded'));
    }
    shouldShowOnlyRoomSwitcher() {
        return this.permissions.canAlterConnectedMeetings === false;
    }
    getPermittedRooms() {
        if (this.permissions.canAlterConnectedMeetings || this.permissions.canSwitchConnectedMeetings) {
            return this.stateManager.allConnectedMeetings;
        }
        return this.stateManager.allConnectedMeetings.filter((cMeeting) => cMeeting.id === this.meeting.meta.meetingId);
    }
    renderMainRoomMaybe() {
        if (!(this.meeting.connectedMeetings.isActive && this.permissions.canSwitchToParentMeeting)) {
            return null;
        }
        return (h("rtk-breakout-room-manager", { key: this.stateManager.currentState.parentMeeting['id'], assigningParticipants: this.assigningParticipants, isDragMode: this.isDragMode, meeting: this.meeting, mode: this.roomConfig.mode, onParticipantsAdd: () => this.assignParticipantsToRoom(this.stateManager.currentState.parentMeeting['id']), onRoomJoin: () => this.joinRoom(this.stateManager.currentState.parentMeeting['id']), onUpdate: this.onRoomUpdate, states: this.states, room: Object.assign({}, this.stateManager.currentState.parentMeeting), iconPack: this.iconPack, t: this.t }));
    }
    renderRoomSwitcher() {
        return (h(Host, null, h("div", { class: "room-switcher-container" }, h("header", null, h("rtk-icon", { icon: this.iconPack.breakout_rooms }), h("span", null, this.t('breakout_rooms.join_breakout_header'))), h("div", { class: "rooms", ref: (el) => (this.selectorRef = el) }, this.renderMainRoomMaybe(), this.getPermittedRooms().map((room, idx) => {
            return (h("rtk-breakout-room-manager", { key: room['id'], assigningParticipants: this.assigningParticipants, isDragMode: this.isDragMode, defaultExpanded: idx === 0, meeting: this.meeting, mode: this.roomConfig.mode, onDelete: () => this.onRoomDelete(room['id']), onParticipantsAdd: () => this.assignParticipantsToRoom(room['id']), onRoomJoin: () => this.joinRoom(room['id']), states: this.states, room: Object.assign({}, room), iconPack: this.iconPack, t: this.t, allowDelete: false }));
        })))));
    }
    renderLoading() {
        return (h(Host, null, h("div", { class: "loading-content" }, h("rtk-spinner", { size: "xl" }))));
    }
    renderRoomConfig() {
        return (h(Host, null, h("div", { class: "room-config" }, h("header", null, h("rtk-icon", { icon: this.iconPack.breakout_rooms }), h("span", null, this.t('breakout_rooms.room_config_header'))), h("div", { class: "create-room" }, h("p", null, this.t('breakout_rooms.num_of_rooms')), h("rtk-counter", { value: this.roomConfig.rooms, minValue: MIN_ROOMS, iconPack: this.iconPack, t: this.t, onValueChange: (val) => {
                this.roomConfig = Object.assign(Object.assign({}, this.roomConfig), { rooms: Math.max(+val.detail, MIN_ROOMS) });
            } })), h("span", { class: "distribution-hint" }, `${this.t('breakout_rooms.approx')}${' '}`, ' ', h("em", null, this.getApproxDistribution(), " ", this.t('breakout_rooms.participants_per_room')), ' ', this.t('breakout_rooms.division_text')), h("footer", null, h("rtk-button", { kind: "button", size: "lg", title: this.t('create'), disabled: this.roomConfig.rooms === 0, onClick: () => this.onCreateRooms() }, this.t('create'))))));
    }
    render() {
        if (this.loading) {
            return this.renderLoading();
        }
        if (this.shouldShowOnlyRoomSwitcher()) {
            return this.renderRoomSwitcher();
        }
        if (this.roomConfig.step === 'room-config') {
            return this.renderRoomConfig();
        }
        // participant config
        return (h(Host, null, h("div", { class: "participant-config-wrapper" }, h("div", { class: "participant-config" }, h("aside", { part: "menu" }, h("header", null, this.t('breakout_rooms.assign_participants')), h("rtk-breakout-room-participants", { meeting: this.meeting, iconPack: this.iconPack, t: this.t, participantIds: this.stateManager.unassignedParticipants.map(participantIdentifier), selectedParticipantIds: this.selectedParticipants }, h("rtk-tooltip", { label: this.t('breakout_rooms.shuffle_participants'), slot: "shuffle-button" }, h("rtk-button", { disabled: this.roomConfig.mode === 'edit' ||
                this.stateManager.unassignedParticipants.length === 0, kind: "button", variant: "secondary", size: "md", onClick: () => this.assignParticipantsRandomly(), class: "shuffle-button br-primary-btn" }, h("rtk-icon", { icon: this.iconPack.shuffle })))), this.selectedParticipants.length !== 0 && (h("div", { class: "participants-assign-actions" }, h("span", null, `${this.selectedParticipants.length} ${this.t('breakout_rooms.selected')}`), h("rtk-button", { disabled: this.roomConfig.mode === 'edit', kind: "button", variant: "ghost", size: "md", onClick: () => this.deselectAll(), class: "deselect-button color-danger" }, this.t('breakout_rooms.deselect'))))), h("div", { class: "assign-rooms" }, h("div", { class: "row" }, h("p", { class: "row-header" }, this.t('breakout_rooms.rooms'), " (", this.stateManager.allConnectedMeetings.length, ")"), !this.assigningParticipants && (h("div", { class: "cta-buttons" }, h("rtk-button", { kind: "button", variant: "secondary", class: "br-primary-btn" }, h("div", { onClick: this.onAddNewRoom }, h("rtk-icon", { icon: this.iconPack.add }), this.t('breakout_rooms.add_room'))), this.stateManager.allConnectedMeetings.flatMap((m) => m.participants)
            .length !== 0 && (h("rtk-button", { kind: "button", variant: "ghost", onClick: this.onUnassignAll }, this.t('breakout_rooms.unassign_all')))))), h("div", { class: "rooms", ref: (el) => (this.selectorRef = el) }, this.renderMainRoomMaybe(), this.getPermittedRooms().map((room, idx) => {
            return (h("rtk-breakout-room-manager", { key: room['id'], assigningParticipants: this.assigningParticipants, isDragMode: this.isDragMode, defaultExpanded: idx === 0, meeting: this.meeting, mode: this.roomConfig.mode, onDelete: () => this.onRoomDelete(room['id']), onParticipantsAdd: () => this.assignParticipantsToRoom(room['id']), onRoomJoin: () => this.joinRoom(room['id']), onUpdate: this.onRoomUpdate, states: this.states, room: Object.assign({}, room), iconPack: this.iconPack, t: this.t, allowDelete: this.stateManager.allConnectedMeetings.length > MIN_ROOMS }));
        }), h("rtk-button", { kind: "button", variant: "secondary", onClick: this.onAddNewRoom, class: "add-room-jumbo-btn br-secondary-btn" }, h("div", null, h("rtk-icon", { icon: this.iconPack.add }), h("span", null, this.t('breakout_rooms.add_room_brief'))))))), h("div", { class: "participant-config-actions" }, h("div", { class: { 'status-bar': true, 'ephemeral-status': this.ephemeralStatusText !== '' } }, this.ephemeralStatusText !== '' && h("rtk-icon", { icon: this.iconPack.checkmark }), this.getStatusText()), h("div", { class: "breakout-actions" }, this.roomConfig.mode === 'create' && this.permissions.canAlterConnectedMeetings && (h("rtk-button", { size: "md", class: "start-breakout-button", onClick: () => this.enableConfirmationModal('start-breakout') }, this.t('breakout_rooms.start_breakout'))), this.roomConfig.mode === 'edit' &&
            this.stateManager.hasLocalChanges &&
            this.permissions.canAlterConnectedMeetings && (h("rtk-button", { size: "md", class: "color-danger", variant: "ghost", onClick: () => this.discardChanges() }, this.t('breakout_rooms.discard_changes'))), this.roomConfig.mode === 'edit' &&
            this.stateManager.hasLocalChanges &&
            this.permissions.canAlterConnectedMeetings && (h("rtk-button", { size: "md", class: "update-breakout-button", onClick: this.applyChanges }, this.t('breakout_rooms.update_breakout'))), this.roomConfig.mode === 'edit' &&
            !this.stateManager.hasLocalChanges &&
            this.permissions.canAlterConnectedMeetings && (h("rtk-button", { size: "md", class: "close-breakout-button", onClick: () => this.enableConfirmationModal('close-breakout') }, this.t('breakout_rooms.close_breakout'))))))));
    }
    static get watchers() { return {
        "selectedParticipants": ["onSelectedParticipantsChanged"]
    }; }
    static get style() { return RtkBreakoutRoomsManagerStyle0; }
}, [1, "rtk-breakout-rooms-manager", {
        "meeting": [16],
        "states": [16],
        "iconPack": [16],
        "t": [16],
        "loading": [32],
        "roomConfig": [32],
        "draftState": [32],
        "assigningParticipants": [32],
        "selectedParticipants": [32],
        "ephemeralStatusText": [32],
        "isDragMode": [32]
    }, [[0, "participantDelete", "onParticipantDelete"], [0, "participantsDragging", "toggleDragMode"], [0, "selectedParticipantsUpdate", "updateSelectedParticipants"], [0, "allParticipantsToggleUpdate", "updateAllParticipants"]], {
        "selectedParticipants": ["onSelectedParticipantsChanged"]
    }]);
__decorate([
    SyncWithStore()
], RtkBreakoutRoomsManager.prototype, "meeting", void 0);
__decorate([
    SyncWithStore()
], RtkBreakoutRoomsManager.prototype, "states", void 0);
__decorate([
    SyncWithStore()
], RtkBreakoutRoomsManager.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkBreakoutRoomsManager.prototype, "t", void 0);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-breakout-rooms-manager", "rtk-avatar", "rtk-breakout-room-manager", "rtk-breakout-room-participants", "rtk-button", "rtk-counter", "rtk-icon", "rtk-spinner", "rtk-tooltip"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-breakout-rooms-manager":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkBreakoutRoomsManager);
            }
            break;
        case "rtk-avatar":
            if (!customElements.get(tagName)) {
                defineCustomElement$8();
            }
            break;
        case "rtk-breakout-room-manager":
            if (!customElements.get(tagName)) {
                defineCustomElement$7();
            }
            break;
        case "rtk-breakout-room-participants":
            if (!customElements.get(tagName)) {
                defineCustomElement$6();
            }
            break;
        case "rtk-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$5();
            }
            break;
        case "rtk-counter":
            if (!customElements.get(tagName)) {
                defineCustomElement$4();
            }
            break;
        case "rtk-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "rtk-spinner":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "rtk-tooltip":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}
defineCustomElement();

export { RtkBreakoutRoomsManager as R, defineCustomElement as d };
