'use strict';

var index = require('./index-Bkm7eeWO.js');

const EclBreadcrumbItem = class {
    constructor(hostRef) {
        index.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 (index.h("li", Object.assign({ key: '5a6afc6994fd27c63f426c5c78b28bc0cf35adc9', class: this.getClass() }, this.getLiAttrs()), !this.currentPage && !this.ellipsis ?
            [
                index.h("ecl-link", { variant: "standalone", path: this.path, "style-class": this.getLinkClass() }, index.h("slot", null)),
                index.h("ecl-icon", { "style-class": `ecl-breadcrumb__icon sc-ecl-breadcrumb-${this.theme}`, icon: "corner-arrow", rotate: "90", size: "fluid" })
            ]
            :
                index.h("slot", null), this.ellipsis ?
            [
                index.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 }, "..."),
                index.h("ecl-icon", { "style-class": `ecl-breadcrumb__icon sc-ecl-breadcrumb-${this.theme}`, size: "fluid", rotate: "90", icon: "corner-arrow" })
            ] : '', this.currentPage ?
            index.h("slot", null) : ''));
    }
    get el() { return index.getElement(this); }
};

exports.ecl_breadcrumb_item = EclBreadcrumbItem;
