import { r as registerInstance, h, g as getElement } from './core-095fd691.js';
import { l as linker } from './input-linker-2b74e80e.js';
var BceElementDownloadTemplate = /** @class */ (function () {
    function class_1(hostRef) {
        registerInstance(this, hostRef);
        this.metadata = {};
        this.text = '';
        this.location = '';
        this.placeholderText = 'File description';
        this.placeholderLocation = 'File URL';
        this._link = linker(this, this.handleInput);
        this._text = this._link('text');
        this._location = this._link('location');
    }
    class_1.prototype.handleInput = function (name, event) {
        var _a;
        var input = event.target;
        if (!input)
            return;
        event.cancelBubble = true;
        this[name] = input.value;
        this.value = this.updateValue((_a = {}, _a[name] = input.value, _a));
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    };
    class_1.prototype.updateValue = function (part) {
        if (part === void 0) { part = {}; }
        var current = {
            text: this.text,
            location: this.location,
            metadata: Object.assign({}, this.metadata)
        };
        return Object.assign({}, current, part);
    };
    class_1.prototype.componentDidLoad = function () {
        this.value = this.updateValue();
        this.el.dispatchEvent(new Event('input', { bubbles: true }));
    };
    class_1.prototype.render = function () {
        var buttons = {
            labelUploadButton: this.labelUploadButton,
            labelDeleteButton: this.labelDeleteButton
        };
        return [
            h("bce-input", Object.assign({ type: "text" }, this._text)),
            h("bce-upload-input", Object.assign({}, this._location, buttons))
        ];
    };
    Object.defineProperty(class_1.prototype, "el", {
        get: function () { return getElement(this); },
        enumerable: true,
        configurable: true
    });
    return class_1;
}());
export { BceElementDownloadTemplate as bce_element_download_template };
