import { h } from "@stencil/core";
import { ResolveLocation } from '../../models/resolve-location';
export class BceElementImage {
    constructor() {
        this.resolveLocation = ResolveLocation.NOOP;
        this.url = '';
    }
    componentWillLoad() {
        if (!this.template)
            return;
        if (this.template.location.startsWith('BCE://'))
            this.resolveLocation(this.template.location).then(url => (this.url = url));
        else
            this.url = this.template.location;
    }
    render() {
        return this.template && this.url && h("img", { src: this.url });
    }
    static get is() { return "bce-element-image"; }
    static get originalStyleUrls() { return {
        "$": ["bce-element-image.scss"]
    }; }
    static get styleUrls() { return {
        "$": ["bce-element-image.css"]
    }; }
    static get properties() { return {
        "template": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "Block.ElementImage.Template",
                "resolved": "undefined | { readonly location: string; }",
                "references": {
                    "Block": {
                        "location": "import",
                        "path": "../../models/block"
                    }
                }
            },
            "required": false,
            "optional": true,
            "docs": {
                "tags": [],
                "text": ""
            }
        },
        "resolveLocation": {
            "type": "unknown",
            "mutable": false,
            "complexType": {
                "original": "ResolveLocation",
                "resolved": "(location: string) => Promise<string>",
                "references": {
                    "ResolveLocation": {
                        "location": "import",
                        "path": "../../models/resolve-location"
                    }
                }
            },
            "required": false,
            "optional": false,
            "docs": {
                "tags": [],
                "text": ""
            },
            "defaultValue": "ResolveLocation.NOOP"
        }
    }; }
    static get states() { return {
        "url": {}
    }; }
}
