'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index$1 = require('./index-578e90b1.js');
const elementQuestionBase = require('./element-question-base-0c6e17d9.js');

const ElementCheckboxEditor = class {
    constructor(hostRef) {
        index$1.registerInstance(this, hostRef);
        this.handleOther = (event) => {
            const target = event.target;
            this.handler.set('options', target.value, { localize: true });
            this.handler.set('other', event.detail, { emit: true, localize: true });
        };
        this.transformMax = {
            path: 'validation',
            get: (value) => `max:${value}`,
            set: (value) => value.slice(4)
        };
    }
    prop(path, options = {}) {
        return this.handler.prop(path, Object.assign({}, options));
    }
    render() {
        const { options } = this.value;
        return (index$1.h(elementQuestionBase.ElementQuestionBase, { question: this.prop('question', { localize: true }), required: this.prop('required'), t: this.t }, index$1.h("bce-option-creator", Object.assign({}, this.prop('options', { default: () => [], localize: true }), { "allow-other": true, label: this.t('me-option'), other: this.handler.tryGet('other', { localize: true }), placeholder: this.t('me-option'), t: this.t, onOther: this.handleOther })), index$1.h("bce-input", Object.assign({}, this.prop('max', { transform: this.transformMax }), { label: this.t('me-element-checkbox-max'), max: '' + options.length, min: options.length ? '1' : '0', type: "number" })), index$1.h("bce-select", Object.assign({}, this.prop('orientation'), { label: this.t('me-orientation'), type: "radio" }), index$1.h("bce-option", { value: "horizontal" }, this.t('me-orientation-h')), index$1.h("bce-option", { value: "vertical" }, this.t('me-orientation-v'))), index$1.h("slot", null)));
    }
};

exports.bce_element_checkbox_editor = ElementCheckboxEditor;
