/**
 * Copyright Aquera Inc 2023
 *
 * This source code is licensed under the BSD-3-Clause license found in the
 * LICENSE file in the root directory of this source tree.
 */
import { __decorate } from "tslib";
import { html, } from 'lit';
import { customElement } from 'lit/decorators.js';
import { styles } from './nile-breadcrumb.css';
import NileElement from '../internal/nile-element';
/**
 * Nile BreadCrumb component.
 *
 * @tag nile-breadcrumb
 *
 */
let NileBreadcrumb = class NileBreadcrumb extends NileElement {
    /**
     * The styles for Breadcrumb
     * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
     */
    static get styles() {
        return [styles];
    }
    /* #endregion */
    /* #region Methods */
    /**
     * Render method
     * @slot This is a slot test
     */
    connectedCallback() {
        super.connectedCallback();
        this.updateComplete.then(() => {
            this.changeLastItem();
        });
    }
    changeLastItem() {
        const items = [...this.querySelectorAll('nile-breadcrumb-item')];
        const itemslength = items.length;
        for (let i = 0; i < itemslength - 1; i++) {
            const element = items[i];
            element.isLast = false;
        }
        const lastItem = items[itemslength - 1];
        lastItem.isLast = true;
    }
    handleRemoveClick(event) {
        this.emit('nile-click', { value: event.target.innerText });
    }
    render() {
        return html `
      <slot
        @slotchange=${this.changeLastItem}
        @nile-click-item=${this.handleRemoveClick}
        class="breadcrumb"
      ></slot>
    `;
    }
};
NileBreadcrumb = __decorate([
    customElement('nile-breadcrumb')
], NileBreadcrumb);
export { NileBreadcrumb };
export default NileBreadcrumb;
//# sourceMappingURL=nile-breadcrumb.js.map