import { r as registerInstance, h, a as getElement } from './index-ytAlchvh.js';

const EclBreadcrumbItem = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.currentPage = false;
        this.ellipsis = false;
        this.buttonAriaLabel = '';
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    getClass() {
        const styleClasses = [
            `ecl-breadcrumb__segment`,
            `sc-ecl-breadcrumb-${this.theme}`,
            this.styleClass
        ];
        if (this.ellipsis) {
            styleClasses.push('ecl-breadcrumb__segment--ellipsis');
        }
        if (this.currentPage) {
            styleClasses.push('ecl-breadcrumb__current-page');
        }
        return styleClasses.join(' ');
    }
    getLinkClass() {
        const linkClasses = [
            'ecl-link',
            `sc-ecl-link-${this.theme}`,
            `sc-ecl-breadcrumb-${this.theme}`,
            'ecl-link--standalone',
            'ecl-link--no-visited',
            'ecl-breadcrumb__link'
        ];
        return linkClasses.join(' ');
    }
    getLiAttrs() {
        const attrs = { 'data-ecl-breadcrumb-item': 'static' };
        if (this.ellipsis) {
            attrs['data-ecl-breadcrumb-ellipsis'] = '';
            attrs['aria-hidden'] = 'true';
        }
        if (this.currentPage) {
            attrs['aria-current'] = 'page';
        }
        return attrs;
    }
    render() {
        return (h("li", Object.assign({ key: '5a6afc6994fd27c63f426c5c78b28bc0cf35adc9', class: this.getClass() }, this.getLiAttrs()), !this.currentPage && !this.ellipsis ?
            [
                h("ecl-link", { variant: "standalone", path: this.path, "style-class": this.getLinkClass() }, h("slot", null)),
                h("ecl-icon", { "style-class": `ecl-breadcrumb__icon sc-ecl-breadcrumb-${this.theme}`, icon: "corner-arrow", rotate: "90", size: "fluid" })
            ]
            :
                h("slot", null), this.ellipsis ?
            [
                h("ecl-button", { "style-class": `ecl-breadcrumb__ellipsis sc-ecl-breadcrumb-${this.theme}`, variant: "ghost", "data-ecl-breadcrumb-ellipsis-button": true, "aria-label": this.buttonAriaLabel }, "..."),
                h("ecl-icon", { "style-class": `ecl-breadcrumb__icon sc-ecl-breadcrumb-${this.theme}`, size: "fluid", rotate: "90", icon: "corner-arrow" })
            ] : '', this.currentPage ?
            h("slot", null) : ''));
    }
    get el() { return getElement(this); }
};

export { EclBreadcrumbItem as ecl_breadcrumb_item };
