import { r as registerInstance, h } from './index-d0047af2.js';
import { E as ElementQuestionBase } from './element-question-base-5ebd9dee.js';
var ElementCheckboxEditor = /** @class */ (function () {
    function ElementCheckboxEditor(hostRef) {
        var _this = this;
        registerInstance(this, hostRef);
        this.label = {
            name: 'Checkbox',
            labelQuestion: 'Formulate your question',
            labelRequired: 'Required',
            labelMax: 'Max answers',
            labelOCOptionAdd: 'Add Option',
            labelOCOptionRemove: 'Delete Option',
            labelOCOther: 'Other',
            labelOCOtherAdd: 'Add "Other"',
            labelOCOtherRemove: 'Remove "Other"',
            labelOCImageUpload: 'Upload Image',
            labelOCImageDelete: 'Delete Image',
            labelOrientation: 'Oriëntation',
            labelOrientationH: 'Horizontal',
            labelOrientationV: 'Vertical',
            placeholderOptions: 'Option'
        };
        this.handleOther = function (event) {
            var target = event.target;
            _this.handler.set('options', target.value);
            _this.handler.set('other', event.detail, { emit: true });
        };
        this.transformMax = {
            path: 'validation',
            get: function (value) { return "max:" + value; },
            set: function (value) { return value.slice(4); }
        };
    }
    ElementCheckboxEditor.prototype.prop = function (path, options) {
        if (options === void 0) { options = {}; }
        return this.handler.prop(path, Object.assign(Object.assign({}, options), { label: this.label }));
    };
    ElementCheckboxEditor.prototype.render = function () {
        var _a = this.label, labelOrientationH = _a.labelOrientationH, labelOrientationV = _a.labelOrientationV;
        var options = this.value.options;
        return (h(ElementQuestionBase, { question: this.prop('question', { localize: true }), required: this.prop('required') }, h("bce-option-creator", Object.assign({}, this.prop('options', { default: function () { return []; }, localize: true }), { "allow-other": true, label: this.label, other: this.handler.get('other'), onOther: this.handleOther })), h("bce-input", Object.assign({}, this.prop('max', { transform: this.transformMax }), { type: "number", min: options.length ? '1' : '0', max: '' + options.length })), h("bce-select", Object.assign({}, this.prop('orientation'), { type: "radio" }), h("bce-option", { value: "horizontal" }, labelOrientationH), h("bce-option", { value: "vertical" }, labelOrientationV)), h("slot", null)));
    };
    return ElementCheckboxEditor;
}());
export { ElementCheckboxEditor as bce_element_checkbox_editor };
