'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-fadd5ce4.js');
const browser = require('./browser-9ac97263.js');
const device = require('./device-13af13af.js');
const helpers = require('./helpers-46584747.js');
const log = require('./log-71656e64.js');
const config_utils = require('./config.utils-aef60f18.js');
require('./icons.constant-f1294def.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) {
        index.registerInstance(this, hostRef);
        this.debouncedNotify = helpers.debounce(() => this.notifyResize(), 100);
        this.notifyResize = async () => {
            if (browser.balBrowser.hasDocument && browser.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() {
        config_utils.updateBalAnimated(this.animated);
        if (browser.balBrowser.hasWindow) {
            window.addEventListener('resize', this.debouncedNotify);
            this.debouncedNotify();
        }
    }
    componentDidLoad() {
        helpers.rIC(async () => {
            this.ready = true;
            Promise.resolve().then(function () { return require('./focus-visible-264bd9b8.js'); }).then(module => (this.focusVisible = module.startFocusVisible()));
        });
    }
    disconnectedCallback() {
        if (browser.balBrowser.hasWindow) {
            window.removeEventListener('resize', this.debouncedNotify);
        }
    }
    async setFocus(elements) {
        if (this.focusVisible) {
            this.focusVisible.setFocus(elements);
        }
    }
    render() {
        return (index.h(index.Host, { role: "application", class: {
                'bal-app': true,
                'bal-app--safari': browser.balBrowser.isSafari,
                'bal-app--touch': device.balDevice.hasTouchScreen,
            } }, index.h("slot", null)));
    }
    get el() { return index.getElement(this); }
};
__decorate([
    log.Logger('bal-app')
], App.prototype, "createLogger", null);
App.style = balAppCss;

exports.bal_app = App;
