import { h, Host } from "@stencil/core";
import { getScrollParent, positionAbsoluteElement } from "../../utils/position-element";
export class BdsAutocomplete {
    constructor() {
        this.refDropdown = (el) => {
            this.dropElement = el;
        };
        this.refIconDrop = (el) => {
            this.iconDropElement = el;
        };
        this.refCheckAllInput = (input) => {
            this.checkAllInput = input;
        };
        this.onFocus = () => {
            this.isFocused = true;
            this.isPressed = true;
            this.bdsFocus.emit();
            if (this.selectionType == 'multiple')
                this.textMultiselect = '';
        };
        this.onFocusout = () => {
            if (!this.isOpen) {
                this.nativeInput.value = this.getText();
            }
        };
        this.onBlur = () => {
            var _a;
            this.bdsBlur.emit();
            this.isPressed = false;
            if (this.selectionType == 'multiple' && ((_a = this.checkedOptions) === null || _a === void 0 ? void 0 : _a.length) > 0)
                this.getTextMultiselect(this.checkedOptions);
            if (!this.isOpen) {
                this.isFocused = false;
                this.nativeInput.value = this.getText();
            }
        };
        this.onClickWrapper = () => {
            this.onFocus();
            this.toggle();
            if (this.nativeInput) {
                this.nativeInput.focus();
            }
        };
        this.toggle = () => {
            if (!this.disabled) {
                this.isOpen = !this.isOpen;
            }
        };
        this.getTextFromOption = (opt) => {
            var _a, _b;
            if ((opt === null || opt === void 0 ? void 0 : opt.status) || (opt === null || opt === void 0 ? void 0 : opt.bulkOption)) {
                if (this.internalOptions) {
                    const internalOption = this.internalOptions.find((option) => option.value == opt.value);
                    if (internalOption) {
                        return internalOption.label;
                    }
                }
                return opt.querySelector(`#bds-typo-label-${this.value}`).textContent;
            }
            return (opt === null || opt === void 0 ? void 0 : opt.titleText) ? opt.titleText : (_b = (_a = opt === null || opt === void 0 ? void 0 : opt.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
        };
        this.getText = () => {
            const opt = this.childOptions.find((option) => option.value == this.value);
            return this.getTextFromOption(opt);
        };
        this.getTextMultiselect = (data) => {
            const valueInput = (data === null || data === void 0 ? void 0 : data.length) > 0 && `${data === null || data === void 0 ? void 0 : data.length} selecionados`;
            this.textMultiselect = valueInput;
        };
        this.handlerMultiselect = () => {
            this.updateListChecked(this.childOptions);
            this.checkAllInput.checked = false;
        };
        this.handleCheckAll = (event) => {
            const { detail: { checked }, } = event;
            for (const option of this.childOptions) {
                if (checked) {
                    option.toMark();
                }
                else {
                    option.markOff();
                }
            }
            setTimeout(() => {
                this.updateListChecked(this.childOptions);
            }, 10);
        };
        this.updateListChecked = (data) => {
            for (const option of data) {
                option.checked ? option.classList.add('option-checked') : option.classList.remove('option-checked');
            }
            const defaultCheckedOptions = Array.from(data).filter((item) => item.checked == true);
            const value = defaultCheckedOptions.map((term) => ({
                value: term.value,
                label: term.textContent,
                checked: term.checked,
            }));
            this.checkedOptions = value;
        };
        this.handler = (event) => {
            const { detail: { value }, } = event;
            this.value = value;
            this.toggle();
        };
        this.cleanInputSelection = async () => {
            if (!this.disabled) {
                this.value = '';
                this.nativeInput.value = '';
                this.isOpen = false;
                this.bdsCancel.emit({ value: '' });
                await this.resetFilterOptions();
            }
        };
        this.changedInputValue = async (ev) => {
            const input = ev.target;
            if (input) {
                this.value = input.value || '';
            }
            this.bdsInput.emit(ev);
            if (this.nativeInput.value) {
                await this.filterOptions(this.nativeInput.value);
            }
            else {
                this.value = '';
                if (this.isOpen) {
                    await this.resetFilterOptions();
                }
                else {
                    this.setTimeoutFilter();
                }
            }
            if (this.isOpen === false) {
                this.value = this.getSelectedValue();
                this.setTimeoutFilter();
            }
        };
        this.intoView = null;
        this.isPressed = false;
        this.isOpen = false;
        this.text = '';
        this.textMultiselect = '';
        this.placeholderState = this.placeholder;
        this.internalOptions = undefined;
        this.cloneOptions = undefined;
        this.checkedOptions = undefined;
        this.isFocused = false;
        this.validationDanger = false;
        this.validationMesage = '';
        this.options = undefined;
        this.value = undefined;
        this.selected = undefined;
        this.danger = false;
        this.success = false;
        this.disabled = false;
        this.searchOnlyTitle = true;
        this.label = '';
        this.icon = '';
        this.placeholder = '';
        this.helperMessage = '';
        this.errorMessage = '';
        this.successMessage = '';
        this.optionsPosition = 'auto';
        this.clearIconOnFocus = false;
        this.dataTest = null;
        this.loading = false;
        this.selectionType = 'single';
        this.selectionTitle = '';
    }
    isOpenChanged(isOpen) {
        if (this.positionHeightDrop == 'bottom') {
            this.iconDropElement.name = this.isOpen ? 'arrow-up' : 'arrow-down';
        }
        else {
            this.iconDropElement.name = this.isOpen ? 'arrow-down' : 'arrow-up';
        }
        if (isOpen)
            if (this.optionsPosition != 'auto') {
                this.setDefaultPlacement(this.optionsPosition);
            }
            else {
                this.validatePositionDrop();
            }
    }
    itemSelectedChanged() {
        this.bdsSelectedChange.emit(this.selected);
    }
    valueChanged() {
        this.bdsChange.emit({ value: this.value == null ? this.value : this.value.toString() });
        for (const option of this.childOptions) {
            option.selected = this.value === option.value;
        }
        this.selected = this.childOptionSelected;
        this.text = this.getText();
    }
    handleWindow(ev) {
        if (!this.el.contains(ev.target)) {
            this.isOpen = false;
        }
    }
    changeCheckedOptions() {
        var _a;
        this.placeholderState =
            this.selectionType === 'multiple'
                ? ((_a = this.checkedOptions) === null || _a === void 0 ? void 0 : _a.length) === 0 || this.checkedOptions === null
                    ? this.placeholder
                    : ''
                : this.placeholder;
        this.getTextMultiselect(this.checkedOptions);
        this.bdsMultiselectedChange.emit({ value: this.checkedOptions });
    }
    parseOptions() {
        if (this.options) {
            this.resetFilterOptions();
            try {
                this.internalOptions = typeof this.options === 'string' ? JSON.parse(this.options) : this.options;
            }
            catch (e) {
                this.internalOptions = [];
            }
        }
    }
    changeSelectionType() {
        if (!this.options) {
            for (const option of this.childOptions) {
                if (this.selectionType === 'multiple') {
                    option.typeOption = 'checkbox';
                    option.addEventListener('optionChecked', this.handlerMultiselect);
                }
                else {
                    option.typeOption = 'default';
                    option.selected = this.value === option.value;
                    option.addEventListener('optionSelected', this.handler);
                }
            }
        }
    }
    componentWillLoad() {
        this.intoView = getScrollParent(this.el);
        this.options && this.parseOptions();
    }
    componentDidLoad() {
        if (!this.options) {
            for (const option of this.childOptions) {
                if (this.selectionType === 'multiple') {
                    option.typeOption = 'checkbox';
                    option.addEventListener('optionChecked', this.handlerMultiselect);
                }
                else {
                    option.typeOption = 'default';
                    option.selected = this.value === option.value;
                    option.addEventListener('optionSelected', this.handler);
                }
            }
        }
        this.text = this.getText();
        if (this.optionsPosition != 'auto') {
            this.setDefaultPlacement(this.optionsPosition);
        }
        else {
            this.validatePositionDrop();
        }
    }
    setDefaultPlacement(value) {
        if (value == 'bottom') {
            this.dropElement.classList.add('select__options--position-bottom');
            this.iconDropElement.name = 'arrow-down';
        }
        else {
            this.dropElement.classList.add('select__options--position-top');
            this.iconDropElement.name = 'arrow-up';
        }
    }
    validatePositionDrop() {
        const positionValue = positionAbsoluteElement({
            actionElement: this.el,
            changedElement: this.dropElement,
            intoView: this.intoView,
        });
        this.positionHeightDrop = positionValue.y;
        if (positionValue.y == 'bottom') {
            this.dropElement.classList.add('select__options--position-bottom');
            this.iconDropElement.name = 'arrow-down';
        }
        else {
            this.dropElement.classList.add('select__options--position-top');
            this.iconDropElement.name = 'arrow-up';
        }
    }
    get childOptions() {
        return this.options
            ? Array.from(this.el.shadowRoot.querySelectorAll('bds-select-option'))
            : Array.from(this.el.querySelectorAll('bds-select-option'));
    }
    get childOptionSelected() {
        return this.options
            ? Array.from(this.el.shadowRoot.querySelectorAll('bds-select-option')).find((option) => option.selected)
            : Array.from(this.el.querySelectorAll('bds-select-option')).find((option) => option.selected);
    }
    keyPressWrapper(event) {
        var _a, _b, _c, _d;
        switch (event.key) {
            case 'Enter':
                this.toggle();
                break;
            case 'ArrowDown':
                if (!this.disabled) {
                    this.isOpen = true;
                }
                if (this.childOptionSelected) {
                    this.value = (_a = this.childOptionSelected.nextSibling) === null || _a === void 0 ? void 0 : _a.value;
                    return;
                }
                this.value = (_b = this.el.firstElementChild) === null || _b === void 0 ? void 0 : _b.value;
                break;
            case 'ArrowUp':
                if (this.childOptionSelected) {
                    this.value = (_c = this.childOptionSelected.previousSibling) === null || _c === void 0 ? void 0 : _c.value;
                    return;
                }
                this.value = (_d = this.el.lastElementChild) === null || _d === void 0 ? void 0 : _d.value;
                break;
        }
    }
    setTimeoutFilter() {
        setTimeout(() => {
            this.resetFilterOptions();
        }, 500);
    }
    async filterOptions(term) {
        if (!term) {
            await this.resetFilterOptions();
        }
        for (const option of this.childOptions) {
            const optionTextLowercase = this.searchOnlyTitle
                ? this.getTextFromOption(option).toLowerCase()
                : option.textContent.toLowerCase();
            const termLower = term.toLowerCase();
            optionTextLowercase.includes(termLower)
                ? option.removeAttribute('invisible')
                : option.setAttribute('invisible', 'invisible');
        }
    }
    async resetFilterOptions() {
        const childOptions = this.childOptions;
        for (const option of childOptions) {
            option.removeAttribute('invisible');
        }
    }
    getSelectedValue() {
        var _a;
        return (_a = this.childOptionSelected) === null || _a === void 0 ? void 0 : _a.value;
    }
    renderIcon() {
        return (this.icon && (h("div", { class: {
                input__icon: true,
                'input__icon--large': !!this.label,
            } }, h("bds-icon", { size: this.label ? 'medium' : 'small', name: this.icon, color: "inherit" }))));
    }
    renderLabel() {
        return (this.label && (h("label", { class: {
                input__container__label: true,
                'input__container__label--pressed': this.isPressed && !this.disabled,
            } }, h("bds-typo", { variant: "fs-12", bold: "bold" }, this.label))));
    }
    renderMessage() {
        const icon = this.danger ? 'error' : this.success ? 'checkball' : 'info';
        let message = this.danger ? this.errorMessage : this.success ? this.successMessage : this.helperMessage;
        if (!message && this.validationDanger)
            message = this.validationMesage;
        const styles = this.danger || this.validationDanger
            ? 'input__message input__message--danger'
            : this.success
                ? 'input__message input__message--success'
                : 'input__message';
        if (message) {
            return (h("div", { class: styles, part: "input__message" }, h("div", { class: "input__message__icon" }, h("bds-icon", { size: "x-small", name: icon, theme: "solid", color: "inherit" })), h("bds-typo", { class: "input__message__text", variant: "fs-12" }, message)));
        }
        return undefined;
    }
    render() {
        var _a, _b;
        return (h(Host, { key: 'b5f349581d14493a61a5f575b94762c3adb142e8', "aria-disabled": this.disabled ? 'true' : null }, h("div", { key: '5e0ed765f96f249e7b5f72b42135d984a335659e', class: {
                input: true,
                select: true,
                'input--state-primary': !this.danger,
                'input--state-danger': this.danger || this.validationDanger,
                'input--state-success': this.success,
                'input--state-disabled': this.disabled,
                'input--label': !!this.label,
                'input--pressed': this.isPressed,
            }, onClick: this.onClickWrapper }, this.renderIcon(), h("div", { key: '0f72467e36410adef65a11db3f6c38e6102910b9', class: "input__container", tabindex: "0", onFocusout: this.onFocusout }, this.renderLabel(), h("div", { key: 'dbcd91e61795463cb22980420be90b5a381afcf6', class: { input__container__wrapper: true } }, ((_a = this.textMultiselect) === null || _a === void 0 ? void 0 : _a.length) > 0 && (h("bds-typo", { key: 'e236c2a0985263501d550a9c72d7edfe7d881db6', variant: "fs-14", class: "inside-input-left" }, this.textMultiselect)), h("input", { key: '16cb8fa40071f3a031ce26d6afe17095bd5dd2ab', class: { input__container__text: true }, ref: (input) => (this.nativeInput = input), disabled: this.disabled, onBlur: this.onBlur, onFocus: this.onFocus, onInput: this.changedInputValue, placeholder: this.placeholderState, type: "text", value: this.text, "data-test": this.dataTest, onKeyDown: this.keyPressWrapper.bind(this) }))), h("div", { key: '3a82c26c73c169433149692a995f59316230f66f', class: "select__icon" }, h("bds-icon", { key: 'd89350097b44713a6559602f00bcf205e239a6c9', size: "small", name: "error", theme: "solid", onClick: this.cleanInputSelection, class: {
                'icon-hidden': (this.clearIconOnFocus && (!this.isFocused || !this.isOpen)) || !this.value,
            } }), h("bds-icon", { key: '5aae56a71a7b11b9a8d9316a8cd189e2c53216f5', ref: (el) => this.refIconDrop(el), size: "small", color: "inherit" }))), this.renderMessage(), this.loading ? (h("div", { ref: (el) => this.refDropdown(el), class: {
                select__options: true,
                'select__options--open': this.isOpen,
            } }, h("bds-loading-spinner", { class: "load-spinner", size: "small" }))) : (h("div", { ref: (el) => this.refDropdown(el), class: {
                select__options: true,
                'select__options--open': this.isOpen,
            } }, this.selectionTitle && this.selectionType == 'multiple' && (h("bds-typo", { class: "selection-title", variant: "fs-10", bold: "bold" }, this.selectionTitle)), this.selectionType == 'multiple' && (this.value == null || this.value.length <= 0) && (h("bds-checkbox", { ref: this.refCheckAllInput, refer: `refer-multiselect`, label: `Selecionar Todos`, name: "chack-all", class: "select-all", onBdsChange: (ev) => this.handleCheckAll(ev) })), ((_b = this.checkedOptions) === null || _b === void 0 ? void 0 : _b.length) > 0 && (h("span", { class: "content-divisor" }, h("span", { class: "divisor" }))), this.internalOptions ? (this.internalOptions.map((option, idx) => (h("bds-select-option", { onOptionSelected: this.handler, onOptionChecked: this.handlerMultiselect, selected: this.value === option.value, value: option.value, key: idx, bulkOption: option.bulkOption, status: option.status, "type-option": this.selectionType == 'multiple' ? 'checkbox' : 'default' }, option.label)))) : (h("slot", null))))));
    }
    static get is() { return "bds-autocomplete"; }
    static get encapsulation() { return "shadow"; }
    static get originalStyleUrls() {
        return {
            "$": ["autocomplete.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["autocomplete.css"]
        };
    }
    static get properties() {
        return {
            "options": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string | AutocompleteOption[]",
                    "resolved": "AutocompleteOption[] | string",
                    "references": {
                        "AutocompleteOption": {
                            "location": "import",
                            "path": "./autocomplete-select-interface",
                            "id": "src/components/autocomplete/autocomplete-select-interface.ts::AutocompleteOption"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "The options of the select\nShould be passed this way:\noptions='[{\"value\": \"Cat\", \"label\": \"Meow\"}, {\"value\": \"Dog\", \"label\": \"Woof\"}]'\nOptions can also be passed as child by using bds-select-option component, but passing as a child you may have some compatibility problems with Angular."
                },
                "attribute": "options",
                "reflect": false
            },
            "value": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string | null",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "the value of the select."
                },
                "attribute": "value",
                "reflect": false
            },
            "selected": {
                "type": "unknown",
                "mutable": true,
                "complexType": {
                    "original": "HTMLBdsSelectOptionElement | null",
                    "resolved": "HTMLBdsSelectOptionElement",
                    "references": {
                        "HTMLBdsSelectOptionElement": {
                            "location": "global",
                            "id": "global::HTMLBdsSelectOptionElement"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "the item selected."
                }
            },
            "danger": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Add state danger on input, use for use feedback."
                },
                "attribute": "danger",
                "reflect": true,
                "defaultValue": "false"
            },
            "success": {
                "type": "boolean",
                "mutable": true,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Add state success on input, use for use feedback."
                },
                "attribute": "success",
                "reflect": true,
                "defaultValue": "false"
            },
            "disabled": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Disabled input."
                },
                "attribute": "disabled",
                "reflect": true,
                "defaultValue": "false"
            },
            "searchOnlyTitle": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Search only the title property"
                },
                "attribute": "search-only-title",
                "reflect": true,
                "defaultValue": "true"
            },
            "label": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "label in input, with he the input size increases."
                },
                "attribute": "label",
                "reflect": false,
                "defaultValue": "''"
            },
            "icon": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "used for add icon in input left. Uses the bds-icon component."
                },
                "attribute": "icon",
                "reflect": true,
                "defaultValue": "''"
            },
            "placeholder": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Placeholder for native input element."
                },
                "attribute": "placeholder",
                "reflect": false,
                "defaultValue": "''"
            },
            "helperMessage": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Indicated to pass a help the user in complex filling."
                },
                "attribute": "helper-message",
                "reflect": false,
                "defaultValue": "''"
            },
            "errorMessage": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Indicated to pass an feeback to user."
                },
                "attribute": "error-message",
                "reflect": false,
                "defaultValue": "''"
            },
            "successMessage": {
                "type": "string",
                "mutable": true,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Indicated to pass an feeback to user."
                },
                "attribute": "success-message",
                "reflect": false,
                "defaultValue": "''"
            },
            "optionsPosition": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "AutocompleteOptionsPositionType",
                    "resolved": "\"auto\" | \"bottom\" | \"top\"",
                    "references": {
                        "AutocompleteOptionsPositionType": {
                            "location": "import",
                            "path": "./autocomplete-select-interface",
                            "id": "src/components/autocomplete/autocomplete-select-interface.ts::AutocompleteOptionsPositionType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Set the placement of the options menu. Can be 'bottom' or 'top'."
                },
                "attribute": "options-position",
                "reflect": false,
                "defaultValue": "'auto'"
            },
            "clearIconOnFocus": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "If true, the X icon will appear only when component is focused."
                },
                "attribute": "clear-icon-on-focus",
                "reflect": false,
                "defaultValue": "false"
            },
            "dataTest": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Data test is the prop to specifically test the component action object."
                },
                "attribute": "data-test",
                "reflect": false,
                "defaultValue": "null"
            },
            "loading": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Is Loading, is the prop to enable that the component is loading."
                },
                "attribute": "loading",
                "reflect": false,
                "defaultValue": "false"
            },
            "selectionType": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "SelectionType",
                    "resolved": "\"multiple\" | \"single\"",
                    "references": {
                        "SelectionType": {
                            "location": "local",
                            "path": "/home/runner/work/blip-ds/blip-ds/src/components/autocomplete/autocomplete.tsx",
                            "id": "src/components/autocomplete/autocomplete.tsx::SelectionType"
                        }
                    }
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Multiselect, Prop to enable multi selections."
                },
                "attribute": "selection-type",
                "reflect": false,
                "defaultValue": "'single'"
            },
            "selectionTitle": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": true,
                "docs": {
                    "tags": [],
                    "text": "Selection Title, Prop to enable title to select."
                },
                "attribute": "selection-title",
                "reflect": false,
                "defaultValue": "''"
            }
        };
    }
    static get states() {
        return {
            "intoView": {},
            "isPressed": {},
            "isOpen": {},
            "text": {},
            "textMultiselect": {},
            "placeholderState": {},
            "internalOptions": {},
            "cloneOptions": {},
            "checkedOptions": {},
            "isFocused": {},
            "validationDanger": {},
            "validationMesage": {}
        };
    }
    static get events() {
        return [{
                "method": "bdsChange",
                "name": "bdsChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the value has changed."
                },
                "complexType": {
                    "original": "AutocompleteChangeEventDetail",
                    "resolved": "AutocompleteChangeEventDetail",
                    "references": {
                        "AutocompleteChangeEventDetail": {
                            "location": "import",
                            "path": "./autocomplete-select-interface",
                            "id": "src/components/autocomplete/autocomplete-select-interface.ts::AutocompleteChangeEventDetail"
                        }
                    }
                }
            }, {
                "method": "bdsSelectedChange",
                "name": "bdsSelectedChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the selected value has changed."
                },
                "complexType": {
                    "original": "AutocompleteSelectedChangeEventDetail",
                    "resolved": "AutocompleteSelectedChangeEventDetail",
                    "references": {
                        "AutocompleteSelectedChangeEventDetail": {
                            "location": "import",
                            "path": "./autocomplete-select-interface",
                            "id": "src/components/autocomplete/autocomplete-select-interface.ts::AutocompleteSelectedChangeEventDetail"
                        }
                    }
                }
            }, {
                "method": "bdsMultiselectedChange",
                "name": "bdsMultiselectedChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the selected value has changed."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "bdsInput",
                "name": "bdsInput",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the input has changed."
                },
                "complexType": {
                    "original": "KeyboardEvent",
                    "resolved": "KeyboardEvent",
                    "references": {
                        "KeyboardEvent": {
                            "location": "global",
                            "id": "global::KeyboardEvent"
                        }
                    }
                }
            }, {
                "method": "bdsCancel",
                "name": "bdsCancel",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the selection is cancelled."
                },
                "complexType": {
                    "original": "AutocompleteChangeEventDetail",
                    "resolved": "AutocompleteChangeEventDetail",
                    "references": {
                        "AutocompleteChangeEventDetail": {
                            "location": "import",
                            "path": "./autocomplete-select-interface",
                            "id": "src/components/autocomplete/autocomplete-select-interface.ts::AutocompleteChangeEventDetail"
                        }
                    }
                }
            }, {
                "method": "bdsFocus",
                "name": "bdsFocus",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the select loses focus."
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }, {
                "method": "bdsBlur",
                "name": "bdsBlur",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [],
                    "text": "Emitted when the select loses focus."
                },
                "complexType": {
                    "original": "void",
                    "resolved": "void",
                    "references": {}
                }
            }];
    }
    static get elementRef() { return "el"; }
    static get watchers() {
        return [{
                "propName": "isOpen",
                "methodName": "isOpenChanged"
            }, {
                "propName": "selected",
                "methodName": "itemSelectedChanged"
            }, {
                "propName": "value",
                "methodName": "valueChanged"
            }, {
                "propName": "checkedOptions",
                "methodName": "changeCheckedOptions"
            }, {
                "propName": "options",
                "methodName": "parseOptions"
            }, {
                "propName": "selectionType",
                "methodName": "changeSelectionType"
            }];
    }
    static get listeners() {
        return [{
                "name": "mousedown",
                "method": "handleWindow",
                "target": "window",
                "capture": false,
                "passive": true
            }];
    }
}
//# sourceMappingURL=autocomplete.js.map
