import { h } from "@stencil/core";
import getAssetPath from "../../utils/assetPath";
export class EclFooterEc {
    constructor() {
        this.styleClass = '';
    }
    getClass() {
        const styleClasses = [
            `ecl-site-footer`,
            `ecl-site-footer--${this.variant}`,
            this.styleClass
        ];
        return styleClasses.join(' ');
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    componentDidLoad() {
        const lists = this.el.querySelectorAll('.ecl-site-footer__list');
        const titles = this.el.querySelectorAll('ecl-text[tag="div"]');
        const social = this.el.querySelector('.ecl-social-media-follow__description');
        if (titles && titles[0]) {
            titles.forEach((title) => {
                const section = title.parentElement.parentElement;
                title.firstElementChild.classList.add(`sc-ecl-footer-${this.theme}-${this.theme}`);
                section.insertBefore(title.firstElementChild, section.firstElementChild);
            });
        }
        if (lists) {
            lists.forEach((list) => {
                const items = list.querySelectorAll('.ecl-site-footer__list-item');
                if (items) {
                    list.innerHTML = '';
                    list.append(...items);
                }
            });
        }
        if (social) {
            social.classList.add(`sc-ecl-footer-${this.theme}-${this.theme}`);
        }
    }
    render() {
        const coOwnerLinks = this.coOwnerLinks ? JSON.parse(this.coOwnerLinks) : '';
        const logoPath = getAssetPath(`./build/images/${this.theme}/logos/negative/logo-${this.theme}--${this.logoLangCode}.svg`);
        return (h("footer", { key: 'f572dfddd6c1618cfd0f432147cc601acf7a1876', class: this.getClass() }, (this.coOwnerTitle || this.coOwnerLinks) &&
            h("div", { key: '5de167255b6e635388850c57a081014215030768', class: "ecl-site-footer__co-owner" }, h("div", { key: '883ec33c4777c86a46cdba019deecb0fb10260d4', class: "ecl-container ecl-site-footer__co-owner-container" }, this.coOwnerTitle &&
                h("div", { key: '3ac0b0352b8889ad56820c0f00750711e2ef36d5', class: "ecl-site-footer__co-owner-title" }, this.coOwnerTitle), coOwnerLinks &&
                h("ul", { key: '3eb7d645956946821c48e0ae16072356c6f2a23e', class: "ecl-site-footer__co-owner-list" }, coOwnerLinks.map((link, i) => {
                    let liClass = 'ecl-site-footer__co-owner-item';
                    if (i === 0) {
                        liClass += ' is-first';
                    }
                    return (h("li", { class: liClass }, h("ecl-link", { path: link.path, styleClass: `ecl-site-footer__co-owner-link sc-ecl-footer-${this.theme}-${this.theme}` }, link.label)));
                })))), h("div", { key: '9985e13a6583c9d753e23cc5609cc3f1de99d236', class: "ecl-site-footer__main" }, h("div", { key: 'e62cde7f24b8cb03fd8da395816e763e439eb32c', class: "ecl-container ecl-site-footer__container" }, h("div", { key: '686572d2093fbd38438c84113219d4a37a0fc9ba', class: "ecl-site-footer__row ecl-site-footer__row--specific" }, h("div", { key: 'f866fb11cfe13bae6a36e89b7371d11eb213852d', class: "ecl-site-footer__section ecl-site-footer__section--site-info" }, this.variant === 'core' &&
            h("ecl-link", { key: '2907efa06d77cd1a975e12afa0cbd0c5f976065e', path: this.logoLink, theme: this.theme, variant: "standalone", styleClass: `ecl-site-footer__logo-link sc-ecl-footer-${this.theme}-${this.theme}` }, h("ecl-picture", { key: '73278b6d05585c795158fe47a164c0a5d45c9556', theme: this.theme, imageAlt: this.logoAlt, imgClass: `sc-ecl-footer-${this.theme}-${this.theme} ecl-site-footer__logo-image`, styleClass: `ecl-site-footer__picture sc-ecl-site-footer-${this.theme}-${this.theme}`, image: logoPath }, h("source", { key: 'e5e856bab88e544c3936df8e80b50a4e6b9fa6d0', srcSet: logoPath, media: "(min-width: 996px)" }), h("slot", { key: 'fc3441e6c005008d3ca992fed27cd3fd10def657', name: "sources" }))), this.variant !== 'core' &&
            h("div", { key: 'c456532968f4c53d88f9fa678c5a22a36eb78783', class: "ecl-site-footer__title" }, h("ecl-link", { key: '83017fe971a35da79dd0c2a114db9e66749ad8f6', inverted: true, path: this.siteLink }, this.siteName)), h("div", { key: '70ce2300001713c83305c21c8bd871971efa5ad9', class: "ecl-site-footer__description" }, this.description, this.descriptionName &&
            h("span", { key: '04c543fa78ef3c0aaf5633651f640fc1c19ca6db', class: "ecl-site-footer__description-name" }, this.descriptionName)), h("slot", { key: '22e33e9c18b37c3f4099e6e55c8e233e28507eef', name: "ecl-footer-social-follow-info" })), this.variant === 'core' &&
            h("div", { key: '98eeab7afebed262e8b84dea2955b127d87aed30', class: "ecl-site-footer__section ecl-site-footer__section--core" }, h("ul", { key: 'd3835750828fa269afc0e5f8ef9d0c61a30b430e', class: "ecl-site-footer__list" }, h("slot", { key: 'fc89bc67f05ea380c93af70d4f64e8cc6238a8bd', name: "ecl-footer-list-core" }))), this.variant !== 'core' &&
            h("div", { key: 'b6d9bf7a4e5c0cfcc4c223d3271d503ff06062b2', class: "ecl-site-footer__section ecl-site-footer__section--links" }, h("div", { key: '0fca192e46966290349cdd884e45d45e3e122193', class: "ecl-site-footer__row" }, h("div", { key: '627e7fa3c4bfdf32c0bdbc20f970c614b4997e0d', class: "ecl-site-footer__section ecl-site-footer__section--contact" }, h("ul", { key: '97dbeac9627595b7b46e98a30a3778d71cd04862', class: "ecl-site-footer__list" }, h("slot", { key: 'c54fa7dea806093a4e53803781a1945d19ce96d5', name: "ecl-footer-list-contact" }))), h("div", { key: 'f85719fcb23c057c2eb6542f8c9955339b1404a9', class: "ecl-site-footer__section ecl-site-footer__section--about" }, h("ul", { key: '38e4b67390990c85069173d1d9a7797a5dd9114f', class: "ecl-site-footer__list" }, h("slot", { key: '5b012a81780772950c6776298b9adcecf1c12c0e', name: "ecl-footer-list-about" })))), h("div", { key: '240019cea8b2e8ee7258d6313cf6aba6f49d2859', class: "ecl-site-footer__row" }, h("div", { key: '32b4b679480781a46b1788410787f5331f0f6d8e', class: "ecl-site-footer__section ecl-site-footer__section--more" }, h("ul", { key: '706f80b6f0ff9b11852e52c827bd836647d65e52', class: "ecl-site-footer__list" }, h("slot", { key: '38ad415018c20703384158de291ac0886423d719', name: "ecl-footer-list-more" }))), h("div", { key: '3ae22b01635904a19d7dc79d452fa11bb8ea9553', class: "ecl-site-footer__section ecl-site-footer__section--related" }, h("ul", { key: 'd7dc7a4b31e0879ccd73339ed56727d91baa8184', class: "ecl-site-footer__list" }, h("slot", { key: '8ea3d82b45d134cfc2f00d806a5763b43ba9f142', name: "ecl-footer-list-related" })))))), h("div", { key: 'c868b632efd6615d6271df0595eff6b2ce0d22bb', class: "ecl-site-footer__row ecl-site-footer__row--common" }, h("div", { key: '4de92f852c81178e231658b124690bd8231fe25e', class: "ecl-site-footer__section ecl-site-footer__section--common" }, this.variant !== 'core' &&
            h("ecl-link", { key: 'a5407fd0055e8cdaf8ae824c548530a9bea7a753', path: this.logoLink, theme: this.theme, variant: "standalone", inverted: true, styleClass: `ecl-site-footer__logo-link sc-ecl-footer-${this.theme}-${this.theme}` }, h("ecl-picture", { key: '7cebbc79b8e0eccab0cd6993014a71e3ab0e2645', theme: this.theme, imageAlt: this.logoAlt, imgClass: `sc-ecl-footer-${this.theme}-${this.theme} ecl-site-footer__logo-image`, styleClass: `ecl-site-footer__picture sc-ecl-site-footer-${this.theme}-${this.theme}`, image: logoPath }, h("slot", { key: '1025adfa82a5d4c7bdc281945ff41afcf5189504', name: "sources" }))), h("div", { key: '0f199c06cd3b897df9cd9cc8da6ce4aab08e4a0f', class: "ecl-site-footer__extra-links-container" }, h("slot", { key: '9e72cb83405f58a732fb8f85d1ba3c803fc33273', name: "ecl-footer-social-follow" })), h("ul", { key: 'db5ce0961d47ed743e9c27c31516d5fed6c52e27', class: "ecl-site-footer__list  ecl-site-footer__list--inline" }, h("slot", { key: '554db32ee80f2ef5a1f1c638bfd96da78ed7722c', name: "ecl-footer-list-bottom-left" }))))))));
    }
    static get is() { return "ecl-footer-ec"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "ec": ["./build/styles/ecl-footer-ec.css"]
        };
    }
    static get styleUrls() {
        return {
            "ec": ["build/styles/ecl-footer-ec.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"
            },
            "logoAlt": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "logo-alt"
            },
            "logoTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "logo-title"
            },
            "logoLink": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "logo-link"
            },
            "logoLangCode": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "logo-lang-code"
            },
            "variant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "variant"
            },
            "description": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "description"
            },
            "descriptionName": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "description-name"
            },
            "siteName": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "site-name"
            },
            "siteLink": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "site-link"
            },
            "coOwnerTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "co-owner-title"
            },
            "coOwnerLinks": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "co-owner-links"
            }
        };
    }
    static get elementRef() { return "el"; }
}
