import { h } from "@stencil/core";
import CategoryFilter from "@ecl/category-filter";
export class EclCategoryFilter {
    constructor() {
        this.styleClass = '';
        this.noScript = false;
    }
    getClass() {
        const styleClasses = [
            `ecl-category-filter`,
            this.styleClass
        ];
        if (this.colorMode) {
            styleClasses.push(`ecl-color-mode--${this.colorMode}`);
        }
        return styleClasses.join(' ');
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    componentDidRender() {
        const items = Array.from(this.el.querySelectorAll('.ecl-category-filter__item--level-1'));
        if (items[0]) {
            const lastItem = items[items.length - 1];
            lastItem.parentElement.parentElement.style.border = 'none';
        }
        if (!this.noScript) {
            ;
            window.ECL = window.ECL || {};
            ECL.CategoryFilter = CategoryFilter;
            const categoryFilter = new CategoryFilter(this.el.firstElementChild);
            categoryFilter.init();
        }
    }
    render() {
        return (h("nav", { key: 'd8dbe5af69a29bd86a4f73063f887d8306f53c07', class: this.getClass(), "data-ecl-category-filter": true }, h("ul", { key: 'e54a0d4973382703d9c5795a4bbe5bc37c483ba1', class: "ecl-category-filter__list" }, h("slot", { key: 'c4dfc0edc820485f0cfdeefdc230f1b6d53cdc1a' }))));
    }
    static get is() { return "ecl-category-filter"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "ec": ["./build/styles/ecl-category-filter-ec.css"],
            "eu": ["./build/styles/ecl-category-filter-eu.css"]
        };
    }
    static get styleUrls() {
        return {
            "ec": ["build/styles/ecl-category-filter-ec.css"],
            "eu": ["build/styles/ecl-category-filter-eu.css"]
        };
    }
    static get assetsDirs() { return ["build"]; }
    static get properties() {
        return {
            "styleClass": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "style-class",
                "defaultValue": "''"
            },
            "theme": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "theme"
            },
            "noScript": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "no-script",
                "defaultValue": "false"
            },
            "colorMode": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "color-mode"
            }
        };
    }
    static get elementRef() { return "el"; }
}
