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

/**
 * Selection guard mirroring React's `selectionRef`. React uses it to gate
 * an accidental mousedown-drag-commit on items: after a mousedown on the
 * trigger, an unselected item's mouseup is blocked for 200ms, and a
 * currently-selected item's mouseup is blocked for 400ms.
 */

/**
 * Change-reason union for `Select.Root`. Mirrors Base UI React 1:1 —
 * every reason emitted from `setOpen` / `setValue` in the ported paths.
 */

/**
 * Shared state / handles surfaced through the Select root context. Every
 * reactive field is exposed as an `Accessor<T>` so consumers don't need to
 * wrap reads in `untrack` / `createMemo`.
 */

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