'use strict';

var index = require('./index-n_pDKBY2.js');
var frameworkDetection = require('./framework-detection-C_6nNXcS.js');
var domUtils = require('./dom-utils-dykhxr-_.js');

const breadcrumbCss = ":root{--ifx-font-family:\"Source Sans 3\", 'Arial, sans-serif'}:host{display:flex}.breadcrumb{list-style:none;padding:0px;margin:0px;display:flex;flex-direction:row;font-family:var(--ifx-font-family);font-size:0.875rem;align-items:flex-start}";

const Breadcrumb = class {
    constructor(hostRef) {
        index.registerInstance(this, hostRef);
    }
    async componentDidLoad() {
        if (!domUtils.isNestedInIfxComponent(this.el)) {
            const framework = frameworkDetection.detectFramework();
            frameworkDetection.trackComponent('ifx-breadcrumb', await framework);
        }
        const element = this.el.shadowRoot.firstChild;
        this.validateBreadcrumbItemStructure(element);
    }
    validateBreadcrumbItemStructure(element) {
        if (!element) {
            console.error('element not found');
            return;
        }
        const slot = element.querySelector('slot');
        if (slot) {
            const assignedNodes = slot.assignedNodes();
            for (let i = 0; i < assignedNodes.length; i++) {
                const node = assignedNodes[i];
                if (node.nodeName === 'IFX-BREADCRUMB-ITEM') {
                    const breadcrumbItem = node;
                    const breadcrumbItemLabel = breadcrumbItem.querySelector('ifx-breadcrumb-item-label');
                    const breadcrumbDropdown = breadcrumbItem.querySelector('ifx-dropdown-menu');
                    if (breadcrumbItemLabel.hasAttribute('href') && breadcrumbDropdown) {
                        throw new Error('ifx-breadcrumb-item cannot have both a href and a dropdown menu.');
                    }
                }
            }
        }
    }
    render() {
        return (index.h("nav", { key: 'edf76204e96413a39d1a543735bbb0a2530d8348', "aria-label": "Page navigation breadcrumb" }, index.h("ol", { key: '1b64075586076eb4f6ca73cf41202a52a180d1c3', class: "breadcrumb" }, index.h("slot", { key: '352a0be161eb7b0ab45bdbbb59d023bd9da6ff73' }))));
    }
    get el() { return index.getElement(this); }
};
Breadcrumb.style = breadcrumbCss;

exports.ifx_breadcrumb = Breadcrumb;
//# sourceMappingURL=ifx-breadcrumb.entry.cjs.js.map

//# sourceMappingURL=ifx-breadcrumb.cjs.entry.js.map