import { __decorate, __metadata } from "tslib";
import { h, Host, } from "@stencil/core";
import { ariaBooleanToString } from "../../utils/aria";
import { inheritAttributes } from "../../utils/attributes";
import { BEM } from "../../utils/bem";
import { ListenToElementStates } from "../../utils/element-states";
import { FOCUS_KEYS } from "../../utils/focus-visible";
import { defaultBalAriaForm } from "../../utils/form";
import { inputSetBlur, inputSetFocus, stopEventBubbling } from "../../utils/form-input";
import { isDescendant } from "../../utils/helpers";
import { isSpaceKey } from "../../utils/keyboard";
import { Logger } from "../../utils/log";
export class Checkbox {
    constructor() {
        this.inputId = `bal-cb-${checkboxIds++}`;
        this.inheritedAttributes = {};
        this.keyboardMode = true;
        this.hasLabel = true;
        this.focused = false;
        this.ariaForm = defaultBalAriaForm;
        /**
         * Track focus state
         * If `true` checkbox needs to remain focused
         */
        this.wasFocused = false;
        this.outerElementState = {
            hovered: false,
            pressed: false,
        };
        this.innerElementState = {
            hovered: false,
            pressed: false,
        };
        this.mergedElementState = {
            hovered: false,
            pressed: false,
        };
        /**
         * PUBLIC PROPERTY API
         * ------------------------------------------------------
         */
        /**
         * The name of the control, which is submitted with the form data.
         */
        this.name = this.inputId;
        /**
         * Label of the radio item.
         */
        this.label = '';
        /**
         * If `true` the checkbox has no label
         */
        this.labelHidden = false;
        /**
         * If `true` the control is no padding
         */
        this.flat = false;
        /**
         * Defines the layout of the checkbox button
         */
        this.interface = 'checkbox';
        /**
         * A DOMString representing the value of the checkbox. This is not displayed on the
         * client-side, but on the server this is the value given to the data
         * submitted with the checkbox's name.
         */
        this.value = 'on';
        /**
         * If `true`, the checkbox is selected.
         */
        this.checked = false;
        this.initialValue = false;
        /**
         * If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants.
         */
        this.disabled = false;
        /**
         * If `true` the element can not mutated, meaning the user can not edit the control.
         */
        this.readonly = false;
        /**
         * If `true`, the user must fill in a value before submitting a form.
         */
        this.required = false;
        /**
         * If `true`, in Angular reactive forms the control will not be set invalid
         */
        this.autoInvalidOff = false;
        /**
         * If `true`, the value will not be send with a form submit
         */
        this.nonSubmit = false;
        /**
         * If `true` the component gets a invalid style.
         */
        this.invalid = false;
        /**
         * @internal
         */
        this.hovered = false;
        /**
         * @internal
         */
        this.pressed = false;
        /**
         * @internal
         */
        this.colSize = 1;
        /**
         * @internal
         */
        this.colSizeTablet = 1;
        /**
         * @internal
         */
        this.colSizeMobile = 1;
        this.setChecked = (state) => {
            this.checked = state;
            this.balChange.emit(this.checked);
        };
        this.toggleChecked = (ev) => {
            ev.preventDefault();
            this.setFocus();
            this.setChecked(!this.checked);
        };
        this.onClick = (ev) => {
            if (this.disabled) {
                return;
            }
            const element = ev.target;
            if (element && element.href) {
                return;
            }
            if (this.wasFocused) {
                this.focused = true;
            }
            this.toggleChecked(ev);
        };
        this.onFocus = (ev) => {
            if (this.disabled || this.readonly) {
                this.focused = false;
                return stopEventBubbling(ev);
            }
            this.balFocus.emit(ev);
            if (this.keyboardMode) {
                this.focused = true;
                this.wasFocused = true;
            }
        };
        this.onBlur = (ev) => {
            if (this.disabled || this.readonly) {
                return stopEventBubbling(ev);
            }
            this.balBlur.emit(ev);
            this.focused = false;
        };
        this.onPointerDown = () => (this.keyboardMode = false);
        this.onKeydown = (ev) => {
            if (!isSpaceKey(ev)) {
                this.wasFocused = false;
            }
            this.keyboardMode = FOCUS_KEYS.includes(ev.key);
        };
    }
    createLogger(log) {
        this.log = log;
    }
    hoveredChanged() {
        this.innerElementState = {
            hovered: this.hovered,
            pressed: this.pressed,
        };
        this.mergeElementState();
    }
    pressedChanged() {
        this.innerElementState = {
            hovered: this.hovered,
            pressed: this.pressed,
        };
        this.mergeElementState();
    }
    /**
     * LIFECYCLE
     * ------------------------------------------------------
     */
    connectedCallback() {
        this.hoveredChanged();
        if (this.group) {
            this.updateState();
            this.group.addEventListener('balChange', () => this.updateState());
        }
        this.initialValue = this.checked;
        this.el.addEventListener('keydown', this.onKeydown);
        this.el.addEventListener('touchstart', this.onPointerDown);
        this.el.addEventListener('mousedown', this.onPointerDown);
    }
    componentWillLoad() {
        this.inheritedAttributes = inheritAttributes(this.el, ['aria-label', 'tabindex', 'title']);
    }
    componentWillRender() {
        this.interactionChildElements.forEach(el => {
            el.disabled = this.disabled || this.readonly;
            el.invalid = this.invalid;
            el.checked = this.checked;
        });
    }
    disconnectedCallback() {
        if (this.group) {
            this.group.removeEventListener('balChange', () => this.updateState());
        }
        this.el.removeEventListener('keydown', this.onKeydown);
        this.el.removeEventListener('touchstart', this.onPointerDown);
        this.el.removeEventListener('mousedown', this.onPointerDown);
    }
    /**
     * LISTENERS
     * ------------------------------------------------------
     */
    listenOnClick(ev) {
        if ((this.disabled || this.readonly) &&
            ev.target &&
            (ev.target === this.el || isDescendant(this.el, ev.target))) {
            stopEventBubbling(ev);
        }
    }
    resetHandler(ev) {
        const formElement = ev.target;
        if (formElement === null || formElement === void 0 ? void 0 : formElement.contains(this.el)) {
            this.checked = this.initialValue;
        }
    }
    elementStateListener(info) {
        this.outerElementState = info;
        this.mergeElementState();
    }
    /**
     * PUBLIC METHODS
     * ------------------------------------------------------
     */
    /**
     * Sets the focus on the checkbox input element.
     */
    async setFocus() {
        inputSetFocus(this);
    }
    /**
     * Sets blur on the native `input`. Use this method instead of the global
     * `input.blur()`.
     * @internal
     */
    async setBlur() {
        inputSetBlur(this);
    }
    /**
     * Returns the native `<input>` element used under the hood.
     */
    getInputElement() {
        return Promise.resolve(this.nativeInput);
    }
    /**
     * Options of the tab like label, value etc.
     */
    async getOption() {
        return this.option;
    }
    /**
     * @internal
     */
    async updateState() {
        if (this.group && this.group.control && Array.isArray(this.group.value)) {
            const newChecked = this.group.value.includes(this.value);
            if (newChecked !== this.checked) {
                this.checked = newChecked;
            }
        }
    }
    /**
     * @internal
     */
    async setAriaForm(ariaForm) {
        this.ariaForm = Object.assign({}, ariaForm);
    }
    /**
     * GETTERS
     * ------------------------------------------------------
     */
    get group() {
        return this.el.closest('bal-checkbox-group');
    }
    get interactionChildElements() {
        return Array.from(this.el.querySelectorAll('bal-check, bal-switch, bal-icon'));
    }
    get option() {
        return {
            name: this.name,
            value: this.value,
            checked: this.checked,
            label: this.label,
            labelHidden: this.labelHidden,
            flat: this.flat,
            interface: this.interface,
            disabled: this.disabled,
            readonly: this.readonly,
            required: this.required,
            nonSubmit: this.nonSubmit,
            invalid: this.invalid,
        };
    }
    /**
     * EVENT HANDLERS
     * ------------------------------------------------------
     */
    mergeElementState() {
        this.mergedElementState = {
            hovered: this.outerElementState.hovered || this.innerElementState.hovered,
            pressed: this.outerElementState.pressed || this.innerElementState.pressed,
        };
        this.interactionChildElements.forEach(el => {
            ;
            el.hovered = this.mergedElementState.hovered;
            el.pressed = this.mergedElementState.pressed;
        });
    }
    /**
     * RENDER
     * ------------------------------------------------------
     */
    render() {
        const block = BEM.block('checkbox');
        const inputEl = block.element('input');
        const labelEl = block.element('label');
        const labelTextEl = labelEl.element('text');
        const labelIconEl = labelEl.element('icon');
        const focused = this.focused && this.buttonTabindex !== -1;
        const inputAttributes = this.inheritedAttributes;
        if (this.buttonTabindex !== undefined) {
            inputAttributes.tabIndex = this.buttonTabindex;
        }
        const hasFormControl = !this.nonSubmit;
        const id = this.ariaForm.controlId || this.inputId;
        const labelId = this.ariaForm.labelId || null;
        const LabelTag = hasFormControl ? 'label' : 'span';
        return (h(Host, { key: 'e6718d0f01496940fbc03686159599af02e63be2', "aria-checked": `${this.checked}`, "aria-disabled": ariaBooleanToString(this.disabled), "aria-invalid": this.invalid === true ? 'true' : 'false', "aria-hidden": ariaBooleanToString(this.disabled || this.nonSubmit), "aria-focused": focused ? 'true' : null, "aria-labelledby": labelId, "aria-describedby": this.ariaForm.messageId, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ 'bal-focused': focused }, block.class()), block.modifier('checkbox').class()), block.modifier('button').class(this.interface === 'button')), block.modifier('switch').class(this.interface === 'switch')), block.modifier('tile').class(this.interface === 'tile')), block.modifier(`tile-color-${this.color}`).class(this.interface === 'tile' && !!this.color)), block.modifier('focused').class(this.focused)), block.modifier('invalid').class(this.invalid)), block.modifier('checked').class(this.checked)), block.modifier('flat').class(this.flat)), block.modifier('disabled').class(this.disabled || this.readonly)), block.modifier('hovered').class(this.mergedElementState.hovered)), block.modifier('pressed').class(this.mergedElementState.pressed)), block.modifier(`column-${this.colSize}`).class(this.interface === 'tile' && this.colSize > 1)), block
                .modifier(`column-tablet-${this.colSizeTablet}`)
                .class(this.interface === 'tile' && this.colSizeTablet > 1)), block
                .modifier(`column-mobile-${this.colSizeMobile}`)
                .class(this.interface === 'tile' && this.colSizeMobile > 1)), onClick: this.onClick }, h(LabelTag, { key: '3bd8c2c8217d5e958009aeb3465bd7c8446c6960', class: Object.assign({}, labelEl.class()), "data-testid": "bal-checkbox-label" }, hasFormControl ? (h("input", Object.assign({ id: id, type: "checkbox", "data-testid": "bal-checkbox-input", name: this.name, value: this.value, checked: this.checked, required: this.required, disabled: this.disabled || this.nonSubmit, readonly: this.readonly, class: Object.assign({}, inputEl.class()), "aria-hidden": ariaBooleanToString(this.nonSubmit), "aria-invalid": this.invalid === true ? 'true' : 'false', "aria-describedby": this.ariaForm.messageId, onChange: ev => this.toggleChecked(ev), onFocus: ev => this.onFocus(ev), onBlur: ev => this.onBlur(ev), ref: inputEl => (this.nativeInput = inputEl) }, inputAttributes))) : (''), this.interface !== 'tile' ? (h("div", { class: Object.assign({}, labelIconEl.class()) }, this.interface === 'switch' ? (h("bal-switch", { checked: this.checked, disabled: this.disabled || this.readonly, invalid: this.invalid, hovered: this.mergedElementState.hovered, pressed: this.mergedElementState.pressed })) : (h("bal-check", { checked: this.checked, disabled: this.disabled || this.readonly, invalid: this.invalid, inverted: this.interface === 'button' && this.checked, hovered: this.mergedElementState.hovered, pressed: this.mergedElementState.pressed })))) : (''), h("div", { key: 'c1d1b270f076b748681da1d4fdb36380e8bfaf45', class: Object.assign(Object.assign({}, labelTextEl.class()), labelTextEl.modifier('hidden').class(this.labelHidden)) }, h("slot", { key: '123d7f262307eda399023cdc4ecbe6c83d352336' })))));
    }
    static get is() { return "bal-checkbox"; }
    static get originalStyleUrls() {
        return {
            "$": ["bal-checkbox.sass"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["bal-checkbox.css"]
        };
    }
    static get properties() {
        return {
            "name": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "The name of the control, which is submitted with the form data."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "name",
                "defaultValue": "this.inputId"
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Label of the radio item."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "label",
                "defaultValue": "''"
            },
            "labelHidden": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true` the checkbox has no label"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "label-hidden",
                "defaultValue": "false"
            },
            "flat": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true` the control is no padding"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "flat",
                "defaultValue": "false"
            },
            "interface": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "BalProps.BalCheckboxInterface",
                    "resolved": "\"button\" | \"checkbox\" | \"switch\" | \"tile\"",
                    "references": {
                        "BalProps": {
                            "location": "global",
                            "id": "global::BalProps"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "Defines the layout of the checkbox button"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "interface",
                "defaultValue": "'checkbox'"
            },
            "value": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "string | number",
                    "resolved": "number | string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "A DOMString representing the value of the checkbox. This is not displayed on the\nclient-side, but on the server this is the value given to the data\nsubmitted with the checkbox's name."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "value",
                "defaultValue": "'on'"
            },
            "checked": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the checkbox is selected."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "checked",
                "defaultValue": "false"
            },
            "disabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the element is not mutable, focusable, or even submitted with the form. The user can neither edit nor focus on the control, nor its form control descendants."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "disabled",
                "defaultValue": "false"
            },
            "readonly": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true` the element can not mutated, meaning the user can not edit the control."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "readonly",
                "defaultValue": "false"
            },
            "required": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the user must fill in a value before submitting a form."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "required",
                "defaultValue": "false"
            },
            "autoInvalidOff": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, in Angular reactive forms the control will not be set invalid"
                },
                "getter": false,
                "setter": false,
                "reflect": true,
                "attribute": "auto-invalid-off",
                "defaultValue": "false"
            },
            "nonSubmit": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true`, the value will not be send with a form submit"
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "non-submit",
                "defaultValue": "false"
            },
            "invalid": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [],
                    "text": "If `true` the component gets a invalid style."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "invalid",
                "defaultValue": "false"
            },
            "hovered": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "hovered",
                "defaultValue": "false"
            },
            "pressed": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "pressed",
                "defaultValue": "false"
            },
            "color": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "BalProps.BalCheckboxTileColor",
                    "resolved": "\"\" | \"green\" | \"purple\" | \"red\" | \"yellow\"",
                    "references": {
                        "BalProps": {
                            "location": "global",
                            "id": "global::BalProps"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Defines the color of the tile checkbox."
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "color"
            },
            "colSize": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "BalProps.BalCheckboxGroupColumns",
                    "resolved": "1 | 2 | 3 | 4",
                    "references": {
                        "BalProps": {
                            "location": "global",
                            "id": "global::BalProps"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "col-size",
                "defaultValue": "1"
            },
            "colSizeTablet": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "BalProps.BalCheckboxGroupColumns",
                    "resolved": "1 | 2 | 3 | 4",
                    "references": {
                        "BalProps": {
                            "location": "global",
                            "id": "global::BalProps"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "col-size-tablet",
                "defaultValue": "1"
            },
            "colSizeMobile": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "BalProps.BalCheckboxGroupColumns",
                    "resolved": "1 | 2 | 3 | 4",
                    "references": {
                        "BalProps": {
                            "location": "global",
                            "id": "global::BalProps"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }],
                    "text": ""
                },
                "getter": false,
                "setter": false,
                "reflect": false,
                "attribute": "col-size-mobile",
                "defaultValue": "1"
            }
        };
    }
    static get states() {
        return {
            "hasLabel": {},
            "focused": {},
            "buttonTabindex": {},
            "ariaForm": {},
            "wasFocused": {},
            "mergedElementState": {}
        };
    }
    static get events() {
        return [{
                "method": "balFocus",
                "name": "balFocus",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the toggle has focus."
                },
                "complexType": {
                    "original": "BalEvents.BalCheckboxFocusDetail",
                    "resolved": "FocusEvent",
                    "references": {
                        "BalEvents": {
                            "location": "global",
                            "id": "global::BalEvents"
                        }
                    }
                }
            }, {
                "method": "balBlur",
                "name": "balBlur",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the toggle loses focus."
                },
                "complexType": {
                    "original": "BalEvents.BalCheckboxBlurDetail",
                    "resolved": "FocusEvent",
                    "references": {
                        "BalEvents": {
                            "location": "global",
                            "id": "global::BalEvents"
                        }
                    }
                }
            }, {
                "method": "balChange",
                "name": "balChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the value property has changed."
                },
                "complexType": {
                    "original": "BalEvents.BalCheckboxChangeDetail",
                    "resolved": "boolean",
                    "references": {
                        "BalEvents": {
                            "location": "global",
                            "id": "global::BalEvents"
                        }
                    }
                }
            }];
    }
    static get methods() {
        return {
            "setFocus": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Sets the focus on the checkbox input element.",
                    "tags": []
                }
            },
            "setBlur": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "Sets blur on the native `input`. Use this method instead of the global\n`input.blur()`.",
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }]
                }
            },
            "getInputElement": {
                "complexType": {
                    "signature": "() => Promise<HTMLInputElement | undefined>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "HTMLInputElement": {
                            "location": "global",
                            "id": "global::HTMLInputElement"
                        }
                    },
                    "return": "Promise<HTMLInputElement>"
                },
                "docs": {
                    "text": "Returns the native `<input>` element used under the hood.",
                    "tags": []
                }
            },
            "getOption": {
                "complexType": {
                    "signature": "() => Promise<BalCheckboxOption>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "BalCheckboxOption": {
                            "location": "import",
                            "path": "./bal-checkbox.type",
                            "id": "src/components/bal-checkbox/bal-checkbox.type.ts::BalCheckboxOption"
                        }
                    },
                    "return": "Promise<BalCheckboxOption>"
                },
                "docs": {
                    "text": "Options of the tab like label, value etc.",
                    "tags": []
                }
            },
            "updateState": {
                "complexType": {
                    "signature": "() => Promise<void>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }]
                }
            },
            "setAriaForm": {
                "complexType": {
                    "signature": "(ariaForm: BalAriaForm) => Promise<void>",
                    "parameters": [{
                            "name": "ariaForm",
                            "type": "BalAriaForm",
                            "docs": ""
                        }],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "BalAriaForm": {
                            "location": "import",
                            "path": "../../utils/form",
                            "id": "src/utils/form.ts::BalAriaForm"
                        }
                    },
                    "return": "Promise<void>"
                },
                "docs": {
                    "text": "",
                    "tags": [{
                            "name": "internal",
                            "text": undefined
                        }]
                }
            }
        };
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "hovered",
                "methodName": "hoveredChanged"
            }, {
                "propName": "pressed",
                "methodName": "pressedChanged"
            }];
    }
    static get listeners() {
        return [{
                "name": "click",
                "method": "listenOnClick",
                "target": "document",
                "capture": true,
                "passive": false
            }, {
                "name": "reset",
                "method": "resetHandler",
                "target": "document",
                "capture": true,
                "passive": false
            }];
    }
}
__decorate([
    Logger('bal-checkbox'),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Function]),
    __metadata("design:returntype", void 0)
], Checkbox.prototype, "createLogger", null);
__decorate([
    ListenToElementStates(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [Object]),
    __metadata("design:returntype", void 0)
], Checkbox.prototype, "elementStateListener", null);
let checkboxIds = 0;
