import { r as registerInstance, h, H as Host, g as getElement } from './index-2dd70086.js';
import { b as balBrowser } from './browser-a623d3a0.js';
import { b as balDevice } from './device-85159a44.js';
import { h as debounce, k as rIC } from './helpers-2253b115.js';
import { L as Logger } from './log-cf8e52ef.js';
import { b as updateBalAnimated } from './config.utils-8fe5be10.js';
import './icons.constant-47b0ca12.js';

const balAppCss = ":root{--bal-app-height:100%}.bal-app{position:relative;display:block}";

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 App = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.debouncedNotify = debounce(() => this.notifyResize(), 100);
        this.notifyResize = async () => {
            if (balBrowser.hasDocument && balBrowser.hasWindow) {
                const doc = document.documentElement;
                doc.style.setProperty('--bal-app-height', `${window.innerHeight}px`);
            }
        };
        this.animated = true;
        this.ready = false;
    }
    createLogger(log) {
        this.log = log;
    }
    connectedCallback() {
        updateBalAnimated(this.animated);
        if (balBrowser.hasWindow) {
            window.addEventListener('resize', this.debouncedNotify);
            this.debouncedNotify();
        }
    }
    componentDidLoad() {
        rIC(async () => {
            this.ready = true;
            import('./focus-visible-0d06bcc3.js').then(module => (this.focusVisible = module.startFocusVisible()));
        });
    }
    disconnectedCallback() {
        if (balBrowser.hasWindow) {
            window.removeEventListener('resize', this.debouncedNotify);
        }
    }
    async setFocus(elements) {
        if (this.focusVisible) {
            this.focusVisible.setFocus(elements);
        }
    }
    render() {
        return (h(Host, { role: "application", class: {
                'bal-app': true,
                'bal-app--safari': balBrowser.isSafari,
                'bal-app--touch': balDevice.hasTouchScreen,
            } }, h("slot", null)));
    }
    get el() { return getElement(this); }
};
__decorate([
    Logger('bal-app')
], App.prototype, "createLogger", null);
App.style = balAppCss;

export { App as bal_app };
