import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
import { useMemo } from 'react';
import { useNavigationMaps } from './usePathMaps.js';
import { filterItems } from '../utils/filterItems.js';

var useComboboxItems = function useComboboxItems(_ref) {
  var items = _ref.items,
    textValue = _ref.textValue,
    currentLabel = _ref.currentLabel,
    filter = _ref.filter;
  var filteredItems = useMemo(function () {
    return filterItems(items, textValue, currentLabel, filter);
  }, [currentLabel, filter, items, textValue]);
  var _useNavigationMaps = useNavigationMaps(filteredItems),
    _useNavigationMaps2 = _slicedToArray(_useNavigationMaps, 3),
    filteredPathMap = _useNavigationMaps2[0],
    filteredFocusedToValueMap = _useNavigationMaps2[1],
    filteredValueToPathMap = _useNavigationMaps2[2];
  return {
    filteredItems: filteredItems,
    filteredMaps: {
      pathMap: filteredPathMap,
      focusedToValueMap: filteredFocusedToValueMap,
      valueToPathMap: filteredValueToPathMap
    }
  };
};

export { useComboboxItems };
