"use client";
import { useCombobox } from "./useCombobox.js";
/**
 * @since 6.0.0
 */ export function useSelectCombobox(options) {
    const { value, values, ...comboboxOptions } = options;
    return useCombobox({
        ...comboboxOptions,
        searchable: true,
        extendKeyDown (movementData) {
            const { event, show, focusLast, visible } = movementData;
            if (visible) {
                return;
            }
            switch(event.key){
                case " ":
                case "Home":
                case "End":
                    event.preventDefault();
                    event.stopPropagation();
                    focusLast.current = event.key === "End";
                    show();
                    break;
            }
        },
        getEnterDefaultFocusedIndex (options) {
            const { focusLast } = options;
            if (focusLast && !value) {
                return values.length - 1;
            }
            return Math.max(0, values.findIndex((option)=>option === value));
        }
    });
}

//# sourceMappingURL=useSelectCombobox.js.map