import { p as proxyCustomElement, H, e as createEvent, h, c as Host } from './p-ae373651.js';
import { e as defaultIconPack, i as useLanguage } from './p-5b3a7f00.js';
import { i as isFullScreenEnabled, r as requestFullScreen, e as exitFullScreen, a as isFullScreenSupported } from './p-3974d97a.js';
import { S as SyncWithStore } from './p-070aa695.js';
import { d as defineCustomElement$3 } from './p-0031a3c0.js';
import { d as defineCustomElement$2 } from './p-3e0452c4.js';
import { d as defineCustomElement$1 } from './p-e6245534.js';

const rtkFullscreenToggleCss = ":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{display:block}:host([data-hidden]){display:none}";
const RtkFullscreenToggleStyle0 = rtkFullscreenToggleCss;

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 RtkFullscreenToggle = /*@__PURE__*/ proxyCustomElement(class RtkFullscreenToggle extends H {
    constructor() {
        super();
        this.__registerHost();
        this.__attachShadow();
        this.stateUpdate = createEvent(this, "rtkStateUpdate", 7);
        /** Variant */
        this.variant = 'button';
        /** Icon pack */
        this.iconPack = defaultIconPack;
        /** Language */
        this.t = useLanguage();
        this.fullScreenActive = false;
        this.isFullScreenSupported = true;
        this.onFullScreenchange = () => {
            this.fullScreenActive = isFullScreenEnabled();
        };
        this.toggleFullScreen = () => {
            let fullScreenElement = this.targetElement || document.querySelector('rtk-meeting');
            if (!fullScreenElement)
                return;
            if (!this.fullScreenActive) {
                requestFullScreen(fullScreenElement);
                this.fullScreenActive = true;
            }
            else {
                exitFullScreen();
                this.fullScreenActive = false;
            }
            this.stateUpdate.emit({ activeMoreMenu: false });
        };
    }
    connectedCallback() {
        this.isFullScreenSupported = isFullScreenSupported();
        this.onFullScreenchange();
        window.addEventListener('webkitfullscreenchange', this.onFullScreenchange);
        window.addEventListener('fullscreenchange', this.onFullScreenchange);
    }
    disconnectedCallback() {
        window.removeEventListener('webkitfullscreenchange', this.onFullScreenchange);
        window.removeEventListener('fullscreenchange', this.onFullScreenchange);
    }
    render() {
        if (!this.isFullScreenSupported) {
            return h(Host, { "data-hidden": true });
        }
        return (h(Host, { title: this.t('full_screen') }, h("rtk-controlbar-button", { size: this.size, iconPack: this.iconPack, onClick: this.toggleFullScreen, icon: this.fullScreenActive
                ? this.iconPack.full_screen_minimize
                : this.iconPack.full_screen_maximize, label: this.fullScreenActive ? this.t('full_screen.exit') : this.t('full_screen'), variant: this.variant })));
    }
    static get style() { return RtkFullscreenToggleStyle0; }
}, [1, "rtk-fullscreen-toggle", {
        "states": [16],
        "targetElement": [16],
        "variant": [513],
        "size": [513],
        "iconPack": [16],
        "t": [16],
        "fullScreenActive": [32],
        "isFullScreenSupported": [32]
    }]);
__decorate([
    SyncWithStore()
], RtkFullscreenToggle.prototype, "states", void 0);
__decorate([
    SyncWithStore()
], RtkFullscreenToggle.prototype, "iconPack", void 0);
__decorate([
    SyncWithStore()
], RtkFullscreenToggle.prototype, "t", void 0);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["rtk-fullscreen-toggle", "rtk-controlbar-button", "rtk-icon", "rtk-spinner"];
    components.forEach(tagName => { switch (tagName) {
        case "rtk-fullscreen-toggle":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, RtkFullscreenToggle);
            }
            break;
        case "rtk-controlbar-button":
            if (!customElements.get(tagName)) {
                defineCustomElement$3();
            }
            break;
        case "rtk-icon":
            if (!customElements.get(tagName)) {
                defineCustomElement$2();
            }
            break;
        case "rtk-spinner":
            if (!customElements.get(tagName)) {
                defineCustomElement$1();
            }
            break;
    } });
}
defineCustomElement();

export { RtkFullscreenToggle as R, defineCustomElement as d };
