import { r as registerInstance, h, g as getElement } from './core-095fd691.js';
import { l as linker } from './input-linker-2b74e80e.js';

const BceElementImageTemplate = class {
    constructor(hostRef) {
        registerInstance(this, hostRef);
        this.metadata = {};
        this.location = '';
        this.placeholderLocation = 'Image URL';
        this._link = linker(this, this.handleInput);
        this._location = this._link('location');
    }
    handleInput(name, event) {
        const input = event.target;
        if (!input)
            return;
        event.cancelBubble = true;
        this[name] = input.value;
        this.value = this.updateValue({ [name]: input.value });
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    updateValue(part = {}) {
        const current = {
            location: this.location,
            metadata: Object.assign({}, this.metadata)
        };
        return Object.assign({}, current, part);
    }
    componentDidLoad() {
        this.value = this.updateValue();
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    }
    render() {
        const buttons = {
            labelUploadButton: this.labelUploadButton,
            labelDeleteButton: this.labelDeleteButton
        };
        return h("bce-upload-input", Object.assign({}, this._location, buttons));
    }
    get el() { return getElement(this); }
};

export { BceElementImageTemplate as bce_element_image_template };
