import { p as proxyCustomElement, H, h } from './p-604af0ee.js';

const DgaNavHeaderSubMenu = /*@__PURE__*/ proxyCustomElement(class DgaNavHeaderSubMenu extends H {
    constructor() {
        super();
        this.__registerHost();
        this.active = false;
        this.subMenuFullWidth = false;
    }
    onActiveChange() {
        if (this.active && this.submenu) {
            this.submenu.style.display = 'block';
            this.submenu.style.maxHeight = `${this.submenu.scrollHeight}px`;
        }
        else if (this.submenu) {
            this.submenu.style.maxHeight = '';
        }
    }
    componentDidLoad() {
        this.submenu = this.el.shadowRoot.querySelector('.header__sub-menu');
        this.onActiveChange(); // Ensure styles are set on initial load
    }
    render() {
        const backgroundClass = this.background === 'Brand' ? 'header__sub-menu--bg-brand' : '';
        const fullWidthClass = this.subMenuFullWidth ? 'header__sub-menu--full' : '';
        return (h("div", { key: '60795e354d8aca73dbadda2e1abb81731662d046', class: `header__sub-menu ${backgroundClass} ${fullWidthClass}`, ref: el => (this.submenu = el) }, h("div", { key: 'e26408241071d544add36fb1769893e9964ebbd5', class: "sub-menu__container" }, h("slot", { key: '59998beb0e160440d9c7c788b826dba6ee98712b' }))));
    }
    get el() { return this; }
    static get watchers() { return {
        "active": ["onActiveChange"]
    }; }
}, [4, "dga-nav-header-sub-menu", {
        "active": [4],
        "subMenuFullWidth": [4, "sub-menu-full-width"],
        "background": [1]
    }, undefined, {
        "active": ["onActiveChange"]
    }]);
function defineCustomElement() {
    if (typeof customElements === "undefined") {
        return;
    }
    const components = ["dga-nav-header-sub-menu"];
    components.forEach(tagName => { switch (tagName) {
        case "dga-nav-header-sub-menu":
            if (!customElements.get(tagName)) {
                customElements.define(tagName, DgaNavHeaderSubMenu);
            }
            break;
    } });
}

export { DgaNavHeaderSubMenu as D, defineCustomElement as d };

//# sourceMappingURL=p-09b411c7.js.map