import{r as registerInstance,h,H as Host}from"./index-853c3f3f.js";import{s as stopEventBubbling}from"./form-input-fd2d14ca.js";import{B as BEM}from"./bem-1b28532d.js";import{B as BalScrollHandler}from"./scroll-e5864193.js";import{b as balBrowser}from"./browser-9199b5e2.js";var NavigationPopover=function(){function t(t){var i=this;registerInstance(this,t);this.toggle=function(t){stopEventBubbling(t);i.clearTimeouts();if(!i.isActive){BalScrollHandler.disableSmoothScrolling();i.scrollToTopTimer=setTimeout((function(){if(balBrowser.hasWindow){window.scrollTo(0,0)}}),0)}i.setActiveTimer=setTimeout((function(){BalScrollHandler.enableSmoothScrolling();i.isActive=!i.isActive}),100)};this.isActive=false;this.label="";this.inverted=false;this.icon=undefined;this.backdrop=false;this.size="";this.inactiveColor="light";this.activeColor="primary";this.heading=undefined;this.closable=true;this.contentRadius="normal";this.position="bottom-start";this.contentWidth=0;this.contentMinWidth=0;this.offsetY=0;this.square=false;this.contentNoShadow=false;this.contentExpanded=false;this.arrow=false;this.mobileTop=false}t.prototype.clearTimeouts=function(){if(this.scrollToTopTimer){clearTimeout(this.scrollToTopTimer)}if(this.setActiveTimer){clearTimeout(this.setActiveTimer)}};t.prototype.render=function(){var t=this;var i=BEM.block("nav").element("popover");return h(Host,{class:Object.assign(Object.assign({},i.class()),{control:true})},h("bal-popover",{active:this.isActive,onBalChange:function(i){return t.isActive=i.detail},arrow:this.arrow,backdrop:this.backdrop,position:this.position,offsetY:this.offsetY,"mobile-top":this.mobileTop},h("bal-button",{"bal-popover-trigger":true,icon:this.icon,size:this.size,inverted:this.inverted,color:this.isActive?this.activeColor:this.inactiveColor,square:this.square,onClick:this.toggle,"aria-haspopup":"true",class:"bal-navigation-popover__button bal-navigation-popover__button-".concat(this.isActive?this.activeColor:this.inactiveColor)},this.label),h("bal-popover-content",{radius:this.contentRadius,"content-width":this.contentWidth,"content-min-width":this.contentMinWidth,"no-shadow":this.contentNoShadow,expanded:this.contentExpanded,"mobile-top":this.mobileTop},(this.closable||this.heading)&&h("div",{class:Object.assign({},i.element("head").class())},this.heading&&h("bal-heading",{space:"none",level:"h4"},this.heading),this.closable&&h("bal-close",{onClick:function(){return t.isActive=!t.isActive}})),h("slot",null))))};return t}();export{NavigationPopover as bal_navigation_popover};