import{__awaiter,__generator}from"tslib";import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-BdVwMG9u.js";import{_ as __decorate,a as __metadata}from"./tslib.es6-dfXERft2.js";import{b as balBrowser}from"./browser-B1u-Mq75.js";import{b as balDevice}from"./device-TtMibDFL.js";import{s as startFocusVisible}from"./focus-visible-DqCbGYzv.js";import{k as debounce,r as rIC,l as rOnLoad}from"./helpers-BNj87EbG.js";import{L as Logger}from"./log-CwssmmaV.js";import{b as updateBalAnimated}from"./config.utils-B7jugjyM.js";var balAppCss=":root{--bal-app-height:100%}.bal-app{position:relative}.lcp-wait{opacity:0;visibility:hidden;display:none}.lcp-ready .lcp-wait{opacity:inherit;visibility:inherit;display:inherit}";var App=function(){function t(t){var e=this;registerInstance(this,t);this.balAppReady=createEvent(this,"balAppReady");this.debouncedNotify=debounce((function(){return e.notifyResize()}),100);this.animated=true;this.ready=false;this.notifyResize=function(){return __awaiter(e,void 0,void 0,(function(){var t;return __generator(this,(function(e){if(balBrowser.hasDocument&&balBrowser.hasWindow){t=document.documentElement;t.style.setProperty("--bal-app-height","".concat(window.innerHeight,"px"))}return[2]}))}))}}t.prototype.createLogger=function(t){this.log=t};t.prototype.connectedCallback=function(){if(this.animated===false){updateBalAnimated(this.animated)}if(balBrowser.hasWindow){window.addEventListener("resize",this.debouncedNotify);this.debouncedNotify()}};t.prototype.componentDidLoad=function(){var t=this;rIC((function(){t.ready=true;startFocusVisible()}));rOnLoad((function(){if(balBrowser.hasDocument&&balBrowser.hasWindow){var e=document.documentElement;e.classList.add("lcp-ready");t.balAppReady.emit()}}))};t.prototype.disconnectedCallback=function(){if(balBrowser.hasWindow){window.removeEventListener("resize",this.debouncedNotify)}};t.prototype.setFocus=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(this.focusVisible){this.focusVisible.setFocus(t)}return[2]}))}))};t.prototype.render=function(){return h(Host,{key:"e6229236201fea92c4ccb1812f2f280a06130889",class:{"bal-app":true,"bal-app--safari":balBrowser.isSafari,"bal-app--touch":balDevice.hasTouchScreen}},h("slot",{key:"7712c7609c709dbe754eaf5700fd43ca3992a39f"}))};Object.defineProperty(t.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return t}();__decorate([Logger("bal-app"),__metadata("design:type",Function),__metadata("design:paramtypes",[Function]),__metadata("design:returntype",void 0)],App.prototype,"createLogger",null);App.style=balAppCss;export{App as bal_app};