{"version":3,"names":["untrack","contains","readOption","createStableCallback","useIsoLayoutEffect","useTimeout","isElementVisible","stopEvent","useTypeahead","context","props","store","rootStore","dataRef","listRef","elementsRef","onMatch","onMatchProp","onTypingChange","getActiveIndex","activeIndex","getEnabled","enabled","undefined","getResetMs","resetMs","getSelectedIndex","v","selectedIndex","read","timeout","stringRef","current","prevIndexRef","matchIndexRef","open","state","snapshot","clear","setTypingChange","value","typing","onKeyDown","event","isVisible","index","element","getMatchingIndex","list","string","startIndex","length","normalizedStartIndex","lowerString","toLocaleLowerCase","offset","text","startsWith","listContent","key","ctrlKey","metaKey","altKey","isNewSession","allowRapidSuccessionOfFirstLetter","every","start","prevIndex","onBlur","next","relatedTarget","currentDomReferenceElement","domReferenceElement","currentFloatingElement","floatingElement","withinReference","withinFloating","reference","floating","isStaticallyDisabled"],"sources":["use-typeahead.ts"],"sourcesContent":["/**\n * Stage 4.6 port of Base UI React's `useTypeahead` hook.\n *\n * React source:\n *   `base-ui/packages/react/src/floating-ui-react/hooks/useTypeahead.ts`\n *\n * Provides a matching callback that focuses / highlights a list item as\n * the user types. Typically paired with `useListNavigation`; the React\n * fork delivers this hook unchanged from upstream `@floating-ui/react`.\n *\n * ### React → Solid deviations\n *\n * 1. `useRef` → `MutableRef<T>` (matches sibling hooks). Closed-over\n *    `{ current }` containers hold the typeahead string, the last matched\n *    index, and the previous-index snapshot.\n *\n * 2. `useStableCallback` → `createStableCallback` from\n *    `src/internals/stable-callback.ts`. Used only where React stabilises\n *    identity for effect deps / memo keys — here it stabilises the\n *    event handlers so they can be captured in `reference` / `floating`\n *    bags without identity churn.\n *\n * 3. `useIsoLayoutEffect` (with React single-callback + deps) →\n *    `createRenderEffect`-backed `useIsoLayoutEffect(compute, apply)` in\n *    split form. Tracked reads go in the `compute` factory; the\n *    side-effect body runs in `apply`. We use `store.state.open`\n *    inside `compute` to subscribe and `store.state.open` inside `apply`\n *    for the sync read.\n *\n * 4. `useMemo` for `reference` / `floating` bags collapses to plain\n *    object literals — Solid doesn't re-run component bodies, so the bag\n *    identity is already stable for the lifetime of the call site.\n *\n * 5. Event handlers receive native events directly (no `.nativeEvent`\n *    unwrap).\n *\n * 6. `MaybeAccessor<T>` applies to the reactive option fields\n *    (`activeIndex`, `selectedIndex`, `enabled`, `resetMs`) so consumers\n *    that mount the hook once can still flip values later — same\n *    convention as `useListNavigation`. Literal values also work.\n *\n * 7. Shadow-DOM-safe `contains()` from `src/internals/dom/contains.ts`\n *    replaces raw `node.contains(target)`.\n *\n * ### Reason strings\n *\n * `useTypeahead` does not call `store.setOpen` — it only invokes\n * `onMatch(index)` and the `onTypingChange(isTyping)` callback. No\n * `REASONS.*` strings are emitted from this hook. Matches React 1:1.\n */\n\nimport { untrack } from \"solid-js\";\nimport { contains } from \"../../dom/contains\";\nimport { type MaybeAccessor, readOption } from \"../../maybe-accessor\";\nimport { createStableCallback } from \"../../stable-callback\";\nimport { useIsoLayoutEffect } from \"../../use-iso-layout-effect\";\nimport { useTimeout } from \"../../use-timeout\";\nimport type {\n\tElementProps,\n\tFloatingContext,\n\tFloatingRootContext,\n\tMutableRef,\n} from \"../types\";\nimport { isElementVisible } from \"../utils/composite\";\nimport { stopEvent } from \"../utils/event\";\n\nexport interface UseTypeaheadProps {\n\t/**\n\t * A ref which contains an array of strings whose indices match the HTML\n\t * elements of the list.\n\t * @default empty list\n\t */\n\tlistRef: MutableRef<Array<string | null>>;\n\t/**\n\t * The index of the active (focused or highlighted) item in the list.\n\t * May be a literal or an accessor.\n\t * @default null\n\t */\n\tactiveIndex: MaybeAccessor<number | null>;\n\t/**\n\t * Callback invoked with the matching index if found as the user types.\n\t */\n\tonMatch?: ((index: number) => void) | undefined;\n\t/**\n\t * Optional list of item elements that correspond to `listRef` indices.\n\t * When an element exists for an index, typeahead skips it if it is\n\t * hidden via CSS (`display: none`).\n\t */\n\telementsRef?: MutableRef<Array<HTMLElement | null>> | undefined;\n\t/**\n\t * Callback invoked with the typing state as the user types.\n\t */\n\tonTypingChange?: ((isTyping: boolean) => void) | undefined;\n\t/**\n\t * Whether the Hook is enabled, including all internal Effects and\n\t * event handlers.\n\t * @default true\n\t */\n\tenabled?: MaybeAccessor<boolean> | undefined;\n\t/**\n\t * The number of milliseconds to wait before resetting the typed\n\t * string.\n\t * @default 750\n\t */\n\tresetMs?: MaybeAccessor<number> | undefined;\n\t/**\n\t * The index of the selected item in the list, if available.\n\t * @default null\n\t */\n\tselectedIndex?: MaybeAccessor<number | null | undefined> | undefined;\n}\n\n/**\n * Provides a matching callback that can be used to focus an item as the\n * user types, often used in tandem with `useListNavigation()`.\n * @see https://floating-ui.com/docs/useTypeahead\n */\nexport function useTypeahead(\n\tcontext: FloatingRootContext | FloatingContext,\n\tprops: UseTypeaheadProps,\n): ElementProps {\n\tconst store = \"rootStore\" in context ? context.rootStore : context;\n\tconst dataRef = store.context.dataRef;\n\n\t// Untrack the body-time destructure (see use-dismiss for the full\n\t// reasoning). These fields are not `MaybeAccessor` shapes.\n\tconst {\n\t\tlistRef,\n\t\telementsRef,\n\t\tonMatch: onMatchProp,\n\t\tonTypingChange,\n\t} = untrack(() => ({\n\t\tlistRef: props.listRef,\n\t\telementsRef: props.elementsRef,\n\t\tonMatch: props.onMatch,\n\t\tonTypingChange: props.onTypingChange,\n\t}));\n\n\t// Option readers — normalise literal + accessor shapes.\n\tconst getActiveIndex = (): number | null => readOption(props.activeIndex);\n\tconst getEnabled = (): boolean =>\n\t\tprops.enabled === undefined ? true : readOption(props.enabled);\n\tconst getResetMs = (): number =>\n\t\tprops.resetMs === undefined ? 750 : readOption(props.resetMs);\n\tconst getSelectedIndex = (): number | null => {\n\t\tconst v = props.selectedIndex;\n\t\tif (v === undefined) return null;\n\t\tconst read = readOption(v);\n\t\treturn read ?? null;\n\t};\n\n\tconst timeout = useTimeout();\n\tconst stringRef: MutableRef<string> = { current: \"\" };\n\t// One-shot seed: untrack so the body-time strict-read scope\n\t// established by `devComponent(...)` does not warn. Reactivity for\n\t// later updates flows through the `useIsoLayoutEffect` below.\n\tconst prevIndexRef: MutableRef<number | null> = {\n\t\tcurrent: untrack(() => getSelectedIndex() ?? getActiveIndex() ?? -1),\n\t};\n\tconst matchIndexRef: MutableRef<number | null> = { current: null };\n\n\t// Reset the typeahead accumulator when the floating element closes.\n\t// React's effect dep array is `[open, selectedIndex, timeout]` — the\n\t// Solid split form tracks `open` + `selectedIndex` in `compute`; the\n\t// `timeout` handle identity is stable for the owned scope's lifetime\n\t// (see `use-timeout.ts`) so we omit it from tracking.\n\tuseIsoLayoutEffect(\n\t\t() => ({\n\t\t\topen: store.state.open,\n\t\t\tselectedIndex: getSelectedIndex(),\n\t\t}),\n\t\t(snapshot) => {\n\t\t\tconst { open, selectedIndex } = snapshot;\n\n\t\t\tif (!open && selectedIndex !== null) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttimeout.clear();\n\t\t\tmatchIndexRef.current = null;\n\n\t\t\tif (stringRef.current !== \"\") {\n\t\t\t\tstringRef.current = \"\";\n\t\t\t}\n\t\t},\n\t);\n\n\t// Sync arrow-key navigation but not typeahead navigation — update the\n\t// `prevIndexRef` snapshot only when there's no active typing session.\n\tuseIsoLayoutEffect(\n\t\t() => ({\n\t\t\topen: store.state.open,\n\t\t\tselectedIndex: getSelectedIndex(),\n\t\t\tactiveIndex: getActiveIndex(),\n\t\t}),\n\t\t(snapshot) => {\n\t\t\tconst { open, selectedIndex, activeIndex } = snapshot;\n\t\t\tif (open && stringRef.current === \"\") {\n\t\t\t\tprevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n\t\t\t}\n\t\t},\n\t);\n\n\tconst setTypingChange = createStableCallback<(value: boolean) => void>(\n\t\t() => (value: boolean) => {\n\t\t\tif (value) {\n\t\t\t\tif (!dataRef.current.typing) {\n\t\t\t\t\tdataRef.current.typing = value;\n\t\t\t\t\tonTypingChange?.(value);\n\t\t\t\t}\n\t\t\t} else if (dataRef.current.typing) {\n\t\t\t\tdataRef.current.typing = value;\n\t\t\t\tonTypingChange?.(value);\n\t\t\t}\n\t\t},\n\t);\n\n\tconst onKeyDown = createStableCallback<(event: KeyboardEvent) => void>(\n\t\t() => (event: KeyboardEvent) => {\n\t\t\tif (!getEnabled()) return;\n\t\t\tfunction isVisible(index: number) {\n\t\t\t\tconst element = elementsRef?.current[index];\n\t\t\t\treturn !element || isElementVisible(element);\n\t\t\t}\n\n\t\t\tfunction getMatchingIndex(\n\t\t\t\tlist: Array<string | null>,\n\t\t\t\tstring: string,\n\t\t\t\tstartIndex = 0,\n\t\t\t) {\n\t\t\t\tif (list.length === 0) {\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\tconst normalizedStartIndex =\n\t\t\t\t\t((startIndex % list.length) + list.length) % list.length;\n\t\t\t\tconst lowerString = string.toLocaleLowerCase();\n\n\t\t\t\tfor (let offset = 0; offset < list.length; offset += 1) {\n\t\t\t\t\tconst index = (normalizedStartIndex + offset) % list.length;\n\t\t\t\t\tconst text = list[index];\n\t\t\t\t\tif (\n\t\t\t\t\t\t!text?.toLocaleLowerCase().startsWith(lowerString) ||\n\t\t\t\t\t\t!isVisible(index)\n\t\t\t\t\t) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\treturn index;\n\t\t\t\t}\n\t\t\t\treturn -1;\n\t\t\t}\n\n\t\t\tconst listContent = listRef.current;\n\t\t\tconst activeIndex = getActiveIndex();\n\t\t\tconst selectedIndex = getSelectedIndex();\n\t\t\tconst resetMs = getResetMs();\n\n\t\t\tif (stringRef.current.length > 0 && event.key === \" \") {\n\t\t\t\t// Space should continue the in-progress typeahead session.\n\t\t\t\tstopEvent(event);\n\t\t\t\tsetTypingChange(true);\n\t\t\t}\n\n\t\t\tif (stringRef.current.length > 0 && stringRef.current[0] !== \" \") {\n\t\t\t\tif (\n\t\t\t\t\tgetMatchingIndex(listContent, stringRef.current) === -1 &&\n\t\t\t\t\tevent.key !== \" \"\n\t\t\t\t) {\n\t\t\t\t\tsetTypingChange(false);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tlistContent == null ||\n\t\t\t\t// Character key.\n\t\t\t\tevent.key.length !== 1 ||\n\t\t\t\t// Modifier key.\n\t\t\t\tevent.ctrlKey ||\n\t\t\t\tevent.metaKey ||\n\t\t\t\tevent.altKey\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst open = store.state.open;\n\t\t\tif (open && event.key !== \" \") {\n\t\t\t\tstopEvent(event);\n\t\t\t\tsetTypingChange(true);\n\t\t\t}\n\n\t\t\t// Capture whether this is a new typing session before mutating\n\t\t\t// the string.\n\t\t\tconst isNewSession = stringRef.current === \"\";\n\t\t\tif (isNewSession) {\n\t\t\t\tprevIndexRef.current = selectedIndex ?? activeIndex ?? -1;\n\t\t\t}\n\n\t\t\t// Bail out if the list contains a word like \"llama\" or \"aaron\".\n\t\t\t// TODO: allow it in this case, too.\n\t\t\tconst allowRapidSuccessionOfFirstLetter = listContent.every((text) =>\n\t\t\t\ttext\n\t\t\t\t\t? text[0]?.toLocaleLowerCase() !== text[1]?.toLocaleLowerCase()\n\t\t\t\t\t: true,\n\t\t\t);\n\n\t\t\t// Allows the user to cycle through items that start with the\n\t\t\t// same letter in rapid succession.\n\t\t\tif (\n\t\t\t\tallowRapidSuccessionOfFirstLetter &&\n\t\t\t\tstringRef.current === event.key\n\t\t\t) {\n\t\t\t\tstringRef.current = \"\";\n\t\t\t\tprevIndexRef.current = matchIndexRef.current;\n\t\t\t}\n\n\t\t\tstringRef.current += event.key;\n\t\t\ttimeout.start(resetMs, () => {\n\t\t\t\tstringRef.current = \"\";\n\t\t\t\tprevIndexRef.current = matchIndexRef.current;\n\t\t\t\tsetTypingChange(false);\n\t\t\t});\n\n\t\t\t// Compute the starting index for this search. For a new session,\n\t\t\t// base it on the current selection/active item; otherwise\n\t\t\t// continue from the last matched index.\n\t\t\tconst prevIndex = isNewSession\n\t\t\t\t? (selectedIndex ?? activeIndex ?? -1)\n\t\t\t\t: prevIndexRef.current;\n\t\t\tconst startIndex = (prevIndex ?? 0) + 1;\n\n\t\t\tconst index = getMatchingIndex(\n\t\t\t\tlistContent,\n\t\t\t\tstringRef.current,\n\t\t\t\tstartIndex,\n\t\t\t);\n\n\t\t\tif (index !== -1) {\n\t\t\t\tonMatchProp?.(index);\n\t\t\t\tmatchIndexRef.current = index;\n\t\t\t} else if (event.key !== \" \") {\n\t\t\t\tstringRef.current = \"\";\n\t\t\t\tsetTypingChange(false);\n\t\t\t}\n\t\t},\n\t);\n\n\tconst onBlur = createStableCallback<(event: FocusEvent) => void>(\n\t\t() => (event: FocusEvent) => {\n\t\t\tif (!getEnabled()) return;\n\t\t\tconst next = event.relatedTarget as Element | null;\n\t\t\tconst currentDomReferenceElement = store.state.domReferenceElement;\n\t\t\tconst currentFloatingElement = store.state.floatingElement;\n\t\t\tconst withinReference = contains(currentDomReferenceElement, next);\n\t\t\tconst withinFloating = contains(currentFloatingElement, next);\n\n\t\t\t// Keep the session if focus moves within the composite\n\t\t\t// (reference <-> floating).\n\t\t\tif (withinReference || withinFloating) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// End the current typing session when focus leaves the composite.\n\t\t\ttimeout.clear();\n\t\t\tstringRef.current = \"\";\n\t\t\tprevIndexRef.current = matchIndexRef.current;\n\t\t\tsetTypingChange(false);\n\t\t},\n\t);\n\n\tconst reference: ElementProps[\"reference\"] = { onKeyDown, onBlur };\n\tconst floating: ElementProps[\"floating\"] = { onKeyDown, onBlur };\n\n\t// Signalled enablement: when `enabled` is a literal `false`, return\n\t// `{}` to match React. When it's an accessor, always return the bag\n\t// so handlers can short-circuit internally — matches the hover /\n\t// list-navigation enablement contract. Untrack the body-time check\n\t// so the strict-read scope established by `devComponent(...)` does\n\t// not warn — handlers re-read the accessor at event time inside\n\t// already-tracked scopes.\n\tconst isStaticallyDisabled = untrack(\n\t\t() => typeof props.enabled !== \"function\" && !getEnabled(),\n\t);\n\tif (isStaticallyDisabled) {\n\t\treturn {};\n\t}\n\n\treturn { reference, floating };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,UAAU;AAClC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAA6BC,UAAU,QAAQ,sBAAsB;AACrE,SAASC,oBAAoB,QAAQ,uBAAuB;AAC5D,SAASC,kBAAkB,QAAQ,6BAA6B;AAChE,SAASC,UAAU,QAAQ,mBAAmB;AAO9C,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,SAAS,QAAQ,gBAAgB;AAgD1C;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAC3BC,OAA8C,EAC9CC,KAAwB,EACT;EACf,MAAMC,KAAK,GAAG,WAAW,IAAIF,OAAO,GAAGA,OAAO,CAACG,SAAS,GAAGH,OAAO;EAClE,MAAMI,OAAO,GAAGF,KAAK,CAACF,OAAO,CAACI,OAAO;;EAErC;EACA;EACA,MAAM;IACLC,OAAO;IACPC,WAAW;IACXC,OAAO,EAAEC,WAAW;IACpBC;EACD,CAAC,GAAGlB,OAAO,CAAC,OAAO;IAClBc,OAAO,EAAEJ,KAAK,CAACI,OAAO;IACtBC,WAAW,EAAEL,KAAK,CAACK,WAAW;IAC9BC,OAAO,EAAEN,KAAK,CAACM,OAAO;IACtBE,cAAc,EAAER,KAAK,CAACQ;EACvB,CAAC,CAAC,CAAC;;EAEH;EACA,MAAMC,cAAc,GAAGA,CAAA,KAAqBjB,UAAU,CAACQ,KAAK,CAACU,WAAW,CAAC;EACzE,MAAMC,UAAU,GAAGA,CAAA,KAClBX,KAAK,CAACY,OAAO,KAAK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