import { h } from "@stencil/core";
export class EclPicture {
    constructor() {
        this.styleClass = '';
        this.imageAnchor = 'center';
        this.lazy = false;
        this.zoom = false;
    }
    getClass() {
        const styleClasses = [
            `ecl-picture`,
            this.styleClass
        ];
        if (this.zoom) {
            styleClasses.push('ecl-picture--zoom');
        }
        return styleClasses.join(' ');
    }
    getImgAttr() {
        const attrs = {
            src: this.image,
        };
        if (this.imgClass) {
            attrs['class'] = this.imgClass;
        }
        if (this.imageAlt) {
            attrs['alt'] = this.imageAlt;
        }
        if (this.lazy) {
            attrs['loading'] = 'lazy';
        }
        if (this.imageAnchor && this.imageAnchor !== 'center') {
            attrs['style'] = {
                '--ecl-image-anchor': this.imageAnchor,
            };
        }
        return attrs;
    }
    componentWillLoad() {
        var _a;
        this.theme = (_a = document.documentElement.getAttribute('data-ecl-theme')) !== null && _a !== void 0 ? _a : (this.theme || 'ec');
    }
    render() {
        return (h("picture", { key: 'd04b4b39630998f1f3708f2ce96c7feadc48c2b0', class: this.getClass() }, h("slot", { key: '0087999168fefe4ac6a4d36a014028cd18cf998c' }), h("img", Object.assign({ key: '6c9d5fd559a1e8a20f8a2421ebb08008bfe6de26' }, this.getImgAttr()))));
    }
    ;
    static get is() { return "ecl-picture"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "ec": ["./build/styles/ecl-picture-ec.css"],
            "eu": ["./build/styles/ecl-picture-eu.css"]
        };
    }
    static get styleUrls() {
        return {
            "ec": ["build/styles/ecl-picture-ec.css"],
            "eu": ["build/styles/ecl-picture-eu.css"]
        };
    }
    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"
            },
            "image": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "image"
            },
            "imgClass": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "img-class"
            },
            "imageAlt": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "image-alt"
            },
            "imageAnchor": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "image-anchor",
                "defaultValue": "'center'"
            },
            "lazy": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "lazy",
                "defaultValue": "false"
            },
            "zoom": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "zoom",
                "defaultValue": "false"
            }
        };
    }
}
