import { createContext, useContext } from "solid-js";

/**
 * Autocomplete-specific context layered on top of the combobox root
 * context. Carries bits that combobox doesn't know about — currently
 * just the `mode`, which drives `aria-autocomplete` on the input and
 * the `data-*` attributes on the input-group.
 *
 * The bulk of shared state (open, inputValue, indices, refs, etc.)
 * still flows through `ComboboxRootContext` so that every
 * combobox-provided sub-part (Portal, Positioner, Popup, List, etc.)
 * works against an autocomplete root without rewiring.
 */

export const AutocompleteRootContext = createContext(null);
export function useAutocompleteRootContext(optional) {
  const ctx = useContext(AutocompleteRootContext);
  if (ctx == null && !optional) {
    throw new Error("Base UI: AutocompleteRootContext is missing. Autocomplete parts must be placed within <Autocomplete.Root>.");
  }
  return ctx;
}
//# sourceMappingURL=autocomplete-root-context.jsx.map
