{"version":3,"names":["createEffect","createMemo","createSignal","createUniqueId","onCleanup","untrack","createChangeEventDetails","createGenericEventDetails","REASONS","createControlledState","useFieldRootContext","FloatingTree","useFloatingParentNodeId","useClick","useDismiss","useFloatingRootContext","useInteractions","useListNavigation","useRole","readOption","useOpenChangeComplete","useFieldControlValidation","useTransitionStatus","createCombobox","INITIAL_LAST_HIGHLIGHT","getFilter","defaultItemEquality","findItemIndex","removeItem","selectedValueIncludes","stringifyAsLabel","stringifyAsValue","ComboboxRootContext","useComboboxRootContext","ComboboxRootComponent","props","selectionMode","multiple","single","field","fieldName","name","disabled","readOnly","required","modal","loopFocus","openOnInputClick","highlightItemOnHover","grid","virtualized","submitOnItemClick","fillInputOnItemPress","itemToStringLabel","itemToStringValue","isItemEqualToValue","autoHighlightMode","v","autoHighlight","isMultipleAtInit","emptyArray","selectedValue","setUncontrolledSelectedValue","controlled","value","default","defaultValue","fallback","state","hasInputValueProp","inputValue","undefined","defaultInputValue","setUncontrolledInputValue","sv","Array","isArray","open","setUncontrolledOpen","Boolean","defaultOpen","closeQuery","setCloseQuery","ownedWrite","queryChangedAfterOpen","setQueryChangedAfterOpen","mounted","transitionStatus","setMounted","labelId","setLabelId","fallbackId","id","triggerElement","setTriggerElementInternal","inputElement","setInputElementInternal","listElement","setListElementInternal","positionerElement","setPositionerElementInternal","popupSide","setPopupSide","listRef","current","labelsRef","popupRef","inputRef","emptyRef","clearRef","valuesRef","allValuesRef","keyboardActiveRef","chipsContainerRef","activeIndex","setActiveIndex","selectedIndex","setSelectedIndex","lastHighlightRef","setIndices","options","type","onItemHighlighted","index","activeValue","_primitive","frozen","items","filter","locale","isGrouped","query","filteredItems","flatFilteredItems","flatItems","list","flatMap","g","staticCollator","matchesQuery","q","trim","userFilter","contains","visibleItemTokens","Set","visibleItemTick","setVisibleItemTick","setItemVisible","token","visible","had","has","add","delete","t","visibleItemCount","size","hasItems","flat","length","map","item","setOpen","nextOpen","details","onOpenChange","isCanceled","setInputValue","next","onInputValueChange","reason","inputChange","setSelectedValue","normalized","onValueChange","itemPress","none","clearPress","event","handleSelection","passedValue","itemValue","ai","currentArr","isSelected","nextArr","wasFiltering","formEl","form","closest","requestSubmit","handleUnmount","onOpenChangeComplete","inputClear","stringVal","ref","onComplete","comparer","snap","registry","arr","last","idx","prevSelectedForInputSync","Object","is","nextInputValue","fieldRawValue","fieldStringValue","mode","raw","itv","fieldControlRef","validation","controlRef","getValue","el","initialDirtyValue","present","initial","validityData","initialValue","setDirty","shouldValidateOnChange","commit","iv","setFilled","floatingRootContext","openValue","reference","floating","status","update","referenceElement","domReferenceElement","floatingElement","role","click","enabled","toggle","dismiss","outsidePressEvent","mouse","touch","outsidePress","target","chipsEl","listNavigation","virtual","allowEscape","focusItemOnOpen","focusItemOnHover","resetOnPointerLeave","cols","orientation","onNavigate","nextActiveIndex","interactions","ff","virt","len","openV","actions","unmount","actionsRef","contextValue","setTriggerElement","setInputElement","setListElement","setPositionerElement","forceMount","children","n","ComboboxRoot"],"sources":["combobox-root.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\n/**\n * `<Combobox.Root>` — Solid 2 port of Base UI React's `ComboboxRoot` +\n * `AriaCombobox` (~1600 LOC combined). The port scope is narrowed to the\n * single-select, list-autocomplete path that matches ~95% of combobox\n * usage; the deferred features are flagged in `remaining-work.md`.\n *\n * ### Shipped scope\n *\n * - Single-select + `selectionMode: \"none\"` (free-text autocomplete)\n * - Controlled + uncontrolled `value` / `inputValue` / `open`\n * - Synchronous client-side filtering via `items` + `Intl.Collator`\n * - Consumer-supplied `filter` function override\n * - `autoHighlight` (\"input-change\" / \"always\" modes)\n * - `loopFocus`, `openOnInputClick`, `highlightItemOnHover`, `modal`\n * - Keyboard navigation via `useListNavigation` (virtual focus,\n *   `aria-activedescendant`)\n * - `useTypeahead` integration on the list\n * - `useDismiss` (Escape + outside-press) and `useClick`\n * - `onOpenChange`, `onInputValueChange`, `onValueChange`,\n *   `onItemHighlighted` callbacks with `BaseUIChangeEventDetails`\n * - `onOpenChangeComplete` + `useTransitionStatus` exit-animation deferral\n * - `<Combobox.Portal>` + `<Combobox.Positioner>` + `<Combobox.Popup>` +\n *   `<Combobox.List>` + `<Combobox.Item>` + `<Combobox.ItemIndicator>` +\n *   `<Combobox.Empty>` + `<Combobox.Group>` + `<Combobox.Clear>` +\n *   `<Combobox.Trigger>` + `<Combobox.Input>` + `<Combobox.Arrow>`\n *\n * ### Deferred\n *\n * - **Multi-select mode** + `chips` / `chip` / `chip-remove` / `row` /\n *   `input-group` / `collection` / `backdrop` / `value` / `label` /\n *   `status` / `icon` sub-parts\n * - **Grid navigation** (`grid={true}` + `<Combobox.Row>` + `cols`/`orientation` on list-nav) — landed.\n * - **Virtualized lists** (`virtualized={true}`) — stable-index override landed.\n * - **Input-inside-popup layout** (the \"select-shaped\" combobox where the\n *   input is mounted inside the popup + `<Combobox.Trigger>` is the\n *   anchor)\n * - **Form integration** — full field-context write-through\n *   (`setDirty` / `setFilled` / `validation.commit`) is a no-op here;\n *   field registration is wired but validation does not flow.\n * - **`fillInputOnItemPress` / `submitOnItemClick`** — landed.\n * - **`inline` mode** (no popup — inline autocomplete within the input)\n * - **IME / composition handling** — the basic `change` handler is wired\n *   but the full Android/IME-composition path is not ported.\n * - **Live-region announcement** (`<Combobox.Empty>` renders the\n *   `role=\"status\"` container but without the \"initial text mutation\" hack)\n * - **`closeQuery` / `queryChangedAfterOpen` machinery** — landed.\n * - **`allValuesRef` stable index tracking** — simplified: items\n *   registered via `<CompositeList>` only.\n *\n * Positioning math (happy-dom returns 0 rects) and full pointer flows\n * (focus restoration ordering, iOS touch-open delay) need real browser\n * coverage.\n */\n\nimport {\n\tcreateEffect,\n\tcreateMemo,\n\tcreateSignal,\n\tcreateUniqueId,\n\tonCleanup,\n\tuntrack,\n} from \"solid-js\";\nimport {\n\tcreateChangeEventDetails,\n\tcreateGenericEventDetails,\n\tREASONS,\n} from \"../../internals/change-event-details\";\nimport { createControlledState } from \"../../internals/create-controlled-state\";\nimport { useFieldRootContext } from \"../../internals/field-context\";\nimport type { FloatingRootStore } from \"../../internals/floating-ui/components/floating-root-store\";\nimport {\n\tFloatingTree,\n\tuseFloatingParentNodeId,\n} from \"../../internals/floating-ui/components/floating-tree\";\nimport { useClick } from \"../../internals/floating-ui/hooks/use-click\";\nimport { useDismiss } from \"../../internals/floating-ui/hooks/use-dismiss\";\nimport { useFloatingRootContext } from \"../../internals/floating-ui/hooks/use-floating-root-context\";\nimport {\n\ttype UseInteractionsReturn,\n\tuseInteractions,\n} from \"../../internals/floating-ui/hooks/use-interactions\";\nimport { useListNavigation } from \"../../internals/floating-ui/hooks/use-list-navigation\";\nimport { useRole } from \"../../internals/floating-ui/hooks/use-role\";\nimport type { MutableRef } from \"../../internals/floating-ui/types\";\nimport { type MaybeAccessor, readOption } from \"../../internals/maybe-accessor\";\nimport { useOpenChangeComplete } from \"../../internals/popups/use-open-change-complete\";\nimport { useFieldControlValidation } from \"../../internals/use-field-control-validation/use-field-control-validation\";\nimport { useTransitionStatus } from \"../../internals/use-transition-status/use-transition-status\";\nimport { createCombobox } from \"../create-combobox\";\nimport { INITIAL_LAST_HIGHLIGHT } from \"../internals/constants\";\nimport { type Filter, getFilter } from \"../internals/filter\";\nimport {\n\tdefaultItemEquality,\n\tfindItemIndex,\n\ttype ItemEqualityComparer,\n\tremoveItem,\n\tselectedValueIncludes,\n} from \"../internals/item-equality\";\nimport {\n\ttype Group,\n\tstringifyAsLabel,\n\tstringifyAsValue,\n} from \"../internals/resolve-value-label\";\nimport type { ComboboxSide } from \"../positioner/positioner-context\";\nimport {\n\ttype ComboboxRootChangeEventDetails,\n\ttype ComboboxRootChangeEventReason,\n\tComboboxRootContext,\n\ttype ComboboxRootContextValue,\n\ttype ComboboxRootHighlightEventDetails,\n\ttype ComboboxRootHighlightEventReason,\n\tuseComboboxRootContext,\n} from \"./combobox-root-context\";\n\nexport type {\n\tComboboxRootChangeEventDetails,\n\tComboboxRootChangeEventReason,\n\tComboboxRootHighlightEventDetails,\n\tComboboxRootHighlightEventReason,\n};\n\nimport type { ComboboxSelectionMode } from \"../create-combobox\";\n\nexport type { ComboboxSelectionMode };\n\nexport interface ComboboxRootActions {\n\t/** Force-unmount the combobox popup immediately. */\n\tunmount: () => void;\n}\n\nexport interface ComboboxRootProps<Value = unknown> {\n\t/**\n\t * Items to filter. When provided, `<Combobox.List>` filters them\n\t * against the current input value using the active filter. When\n\t * omitted, consumers must render `<Combobox.Item>` children manually\n\t * — typeahead still works via labels registered through the\n\t * composite list.\n\t */\n\titems?: readonly Value[] | readonly Group<Value>[] | undefined;\n\t/**\n\t * Custom filter function. Receives `(item, query, itemToStringLabel)`\n\t * and returns a boolean. Pass `null` to render every item\n\t * unfiltered. When omitted, uses an `Intl.Collator`-backed\n\t * case/diacritics-insensitive \"contains\" filter.\n\t */\n\tfilter?:\n\t\t| ((\n\t\t\t\titem: Value,\n\t\t\t\tquery: string,\n\t\t\t\titemToStringLabel?: (item: Value) => string,\n\t\t  ) => boolean)\n\t\t| null\n\t\t| undefined;\n\t/** Locale for the default `Intl.Collator`. */\n\tlocale?: Intl.LocalesArgument | undefined;\n\n\t/**\n\t * Controlled selected value. When provided (resolved value not\n\t * `undefined` — `null` IS controlled, meaning \"cleared\"), the consumer\n\t * owns the state — pair with {@link onValueChange}. When omitted, the\n\t * combobox manages its own selected value (seeded from\n\t * {@link defaultValue}). In multi-select mode pass an array.\n\t */\n\tvalue?: MaybeAccessor<Value | Value[] | null | undefined>;\n\t/**\n\t * Initial selected value when uncontrolled. Read once at mount.\n\t * @default null (normalized to `[]` in multi-select mode)\n\t */\n\tdefaultValue?: MaybeAccessor<Value | Value[] | null | undefined>;\n\t/**\n\t * Fires on every selection request. Calling `eventDetails.cancel()`\n\t * keeps the combobox's own (uncontrolled) value unchanged, mirroring\n\t * React Base UI; controlled consumers simply don't update their signal.\n\t */\n\tonValueChange?:\n\t\t| ((\n\t\t\t\tvalue: Value | Value[] | null,\n\t\t\t\tdetails: ComboboxRootChangeEventDetails,\n\t\t  ) => void)\n\t\t| undefined;\n\t/**\n\t * When `true`, the combobox accepts multiple selections (chips). Pairs\n\t * with an array-valued `value` / `defaultValue`. When omitted or `false`\n\t * the combobox is single-select.\n\t * @default false\n\t */\n\tmultiple?: boolean | undefined;\n\t/**\n\t * Identifies the field when submitted in a form. Threaded into the\n\t * hidden input(s) generated for multi-select mode.\n\t */\n\tname?: string | undefined;\n\t/** Identifies the owning form for the hidden submission inputs. */\n\tform?: string | undefined;\n\n\t/**\n\t * Controlled input value. When provided (resolved value not\n\t * `undefined` — the empty string IS controlled), the consumer owns the\n\t * state — pair with {@link onInputValueChange}. When omitted, the\n\t * combobox manages its own input value (seeded from\n\t * {@link defaultInputValue}, else — in single-select mode — from the\n\t * initial selected value's label, mirroring React Base UI).\n\t */\n\tinputValue?: MaybeAccessor<string | undefined>;\n\t/**\n\t * Initial input value when uncontrolled. Read once at mount.\n\t * @default \"\" (single-select: the initial selected value's label)\n\t */\n\tdefaultInputValue?: MaybeAccessor<string | undefined>;\n\t/**\n\t * Fires on every input-value change request. Calling\n\t * `eventDetails.cancel()` keeps the combobox's own (uncontrolled) input\n\t * value unchanged, mirroring React Base UI; controlled consumers simply\n\t * don't update their signal.\n\t */\n\tonInputValueChange?:\n\t\t| ((value: string, details: ComboboxRootChangeEventDetails) => void)\n\t\t| undefined;\n\n\t/**\n\t * Controlled open state. When provided (resolved value not\n\t * `undefined`), the consumer owns the state — pair with\n\t * {@link onOpenChange}. When omitted, the combobox manages its own open\n\t * state (seeded from {@link defaultOpen}).\n\t */\n\topen?: MaybeAccessor<boolean | undefined>;\n\t/**\n\t * Initial open state when uncontrolled. Read once at mount.\n\t * @default false\n\t */\n\tdefaultOpen?: MaybeAccessor<boolean | undefined>;\n\t/**\n\t * Fires on every open/close request. Calling `eventDetails.cancel()`\n\t * keeps the combobox's own (uncontrolled) state unchanged, mirroring\n\t * React Base UI; controlled consumers simply don't update their signal.\n\t */\n\tonOpenChange?:\n\t\t| ((open: boolean, details: ComboboxRootChangeEventDetails) => void)\n\t\t| undefined;\n\t/** Fires once the open/close transition has settled. */\n\tonOpenChangeComplete?: ((open: boolean) => void) | undefined;\n\n\t/** Fires when an item gets / loses highlight. */\n\tonItemHighlighted?:\n\t\t| ((\n\t\t\t\tvalue: Value | undefined,\n\t\t\t\tdetails: ComboboxRootHighlightEventDetails,\n\t\t  ) => void)\n\t\t| undefined;\n\n\t/**\n\t * Selection mode. `\"single\"` (default) = single selection; `\"none\"` =\n\t * free-text autocomplete (the input value is the source of truth,\n\t * items just drive the dropdown).\n\t */\n\tselectionMode?: ComboboxSelectionMode | undefined;\n\n\t/** When `true`, the first matching item is highlighted on filter. */\n\tautoHighlight?: boolean | \"always\" | undefined;\n\t/** Whether pointer-over items highlights them. @default true */\n\thighlightItemOnHover?: boolean | undefined;\n\t/** Whether arrow-key navigation loops at list ends. @default true */\n\tloopFocus?: boolean | undefined;\n\t/** Whether clicking the input opens the popup. @default true */\n\topenOnInputClick?: boolean | undefined;\n\t/** Whether the combobox is disabled. */\n\tdisabled?: boolean | undefined;\n\t/** Whether the combobox is read-only. */\n\treadOnly?: boolean | undefined;\n\t/** Whether the combobox is required. */\n\trequired?: boolean | undefined;\n\t/** Whether the popup is modal. @default false */\n\tmodal?: boolean | undefined;\n\t/**\n\t * Whether list items are presented in a grid layout.\n\t *\n\t * **Solid port scope:** accepted at the prop boundary and\n\t * threaded through the root context + input's `aria-haspopup=\"grid\"`.\n\t * Grid-specific keyboard navigation (multi-column traversal via\n\t * `<Combobox.Row>` + `cols > 1` in `useListNavigation`) is not yet\n\t * wired — the list still navigates as a flat 1-D listbox. `<Combobox.Row>`\n\t * is not ported.\n\t * @default false\n\t */\n\tgrid?: boolean | undefined;\n\t/**\n\t * Whether the items are externally virtualized (e.g. TanStack Virtual).\n\t * When `true`, the list indices are consumer-managed and item\n\t * registrations are kept flat even as DOM elements come and go.\n\t *\n\t * **Solid port scope:** accepted at the prop boundary and\n\t * threaded through the root context. The React `<Combobox.Item>` has\n\t * virtualization-aware index tracking that avoids stale refs; the\n\t * Solid port's `<CompositeList>` observes DOM mutations for reordering\n\t * but does not implement the virtualized \"stable index override\" path.\n\t * Consumers should pass an explicit `index` prop on each\n\t * `<Combobox.Item>` until that lands.\n\t * @default false\n\t */\n\tvirtualized?: boolean | undefined;\n\t/**\n\t * When `selectionMode: \"none\"` and `submitOnItemClick` is `true`, clicking\n\t * an item submits the closest enclosing form via `form.requestSubmit()`.\n\t * @default false\n\t */\n\tsubmitOnItemClick?: boolean | undefined;\n\t/**\n\t * When `true` (default) and `selectionMode: \"single\"` or `\"none\"`, pressing\n\t * an item writes its label into the input. Set to `false` to leave the\n\t * input value untouched on selection.\n\t * @default true\n\t */\n\tfillInputOnItemPress?: boolean | undefined;\n\n\t/** Converts object item values to a string label for display / typeahead. */\n\titemToStringLabel?: ((item: Value) => string) | undefined;\n\t/** Converts object item values to a string for form submission. */\n\titemToStringValue?: ((item: Value) => string) | undefined;\n\t/** Custom item equality. */\n\tisItemEqualToValue?: ((item: Value, value: Value) => boolean) | undefined;\n\n\t/** Optional id (flows to the input's aria-labelledby hook). */\n\tid?: string | undefined;\n\n\t/** Imperative handle slot. */\n\tactionsRef?:\n\t\t| ((actions: ComboboxRootActions | null) => void)\n\t\t| { current: ComboboxRootActions | null }\n\t\t| undefined;\n\n\tchildren?: JSX.Element;\n}\n\n// -----------------------------------------------------------------------\n// Inner implementation — assumes `<FloatingTree>` is in scope.\n// -----------------------------------------------------------------------\n\nfunction ComboboxRootComponent<Value>(\n\tprops: ComboboxRootProps<Value>,\n): JSX.Element {\n\t// -------------------------------------------------------------------\n\t// Normalised props\n\t// -------------------------------------------------------------------\n\t// `multiple` wins when explicitly set; otherwise fall back to\n\t// `selectionMode`. This mirrors React's `ComboboxRoot` wrapper which\n\t// converts `multiple={true}` → `selectionMode=\"multiple\"` and leaves\n\t// `selectionMode` in place otherwise.\n\tconst selectionMode = (): ComboboxSelectionMode => {\n\t\tif (props.multiple === true) return \"multiple\";\n\t\treturn props.selectionMode ?? \"single\";\n\t};\n\tconst single = (): boolean => selectionMode() === \"single\";\n\tconst multiple = (): boolean => selectionMode() === \"multiple\";\n\tconst field = useFieldRootContext();\n\tconst fieldName = (): string | undefined => field.name() ?? props.name;\n\tconst disabled = (): boolean => field.disabled() || (props.disabled ?? false);\n\tconst readOnly = (): boolean => props.readOnly ?? false;\n\tconst required = (): boolean => props.required ?? false;\n\tconst modal = (): boolean => props.modal ?? false;\n\tconst loopFocus = (): boolean => props.loopFocus ?? true;\n\tconst openOnInputClick = (): boolean => props.openOnInputClick ?? true;\n\tconst highlightItemOnHover = (): boolean =>\n\t\tprops.highlightItemOnHover ?? true;\n\tconst grid = (): boolean => props.grid ?? false;\n\tconst virtualized = (): boolean => props.virtualized ?? false;\n\tconst submitOnItemClick = (): boolean => props.submitOnItemClick ?? false;\n\tconst fillInputOnItemPress = (): boolean =>\n\t\tprops.fillInputOnItemPress ?? true;\n\tconst itemToStringLabel = (): ((item: Value) => string) | undefined =>\n\t\tprops.itemToStringLabel;\n\tconst itemToStringValue = (): ((item: Value) => string) | undefined =>\n\t\tprops.itemToStringValue;\n\tconst isItemEqualToValue = (): ItemEqualityComparer<Value, Value> =>\n\t\t(props.isItemEqualToValue as ItemEqualityComparer<Value, Value>) ??\n\t\t(defaultItemEquality as ItemEqualityComparer<Value, Value>);\n\n\tconst autoHighlightMode = (): false | \"input-change\" | \"always\" => {\n\t\tconst v = props.autoHighlight;\n\t\tif (v === \"always\") return \"always\";\n\t\treturn v ? \"input-change\" : false;\n\t};\n\n\t// -------------------------------------------------------------------\n\t// Controlled / uncontrolled state (Base UI `useControlled` contract,\n\t// applied to all THREE axes like React's `AriaCombobox`):\n\t// - `value` is controlled while its resolved value is not `undefined` —\n\t//   `value={null}` IS controlled. Uncontrolled fallback is `null`\n\t//   (`[]` in multi-select, matching React's\n\t//   `multiple ? defaultSelectedValue ?? EMPTY_ARRAY : defaultSelectedValue`).\n\t// - `inputValue` is controlled while not `undefined` (\"\" IS controlled).\n\t//   The uncontrolled seed mirrors React's `initialDefaultInputValue`:\n\t//   `defaultInputValue`, else the initial selected value's label in\n\t//   single mode, else \"\".\n\t// - `open` is controlled while not `undefined`, seeded from `defaultOpen`.\n\t// -------------------------------------------------------------------\n\t// Freeze the multi-select latch at setup — the selection-mode decision\n\t// cannot flip after mount (the scalar vs. array value shape would\n\t// diverge from the consumer). This mirrors React's controlled-vs-uncontrolled\n\t// branch freezing (see solidify.md §6).\n\tconst isMultipleAtInit = untrack(\n\t\t() => props.multiple === true || props.selectionMode === \"multiple\",\n\t);\n\n\tconst emptyArray: Value[] = [];\n\n\tconst [selectedValue, setUncontrolledSelectedValue] = createControlledState<\n\t\tValue | Value[] | null\n\t>({\n\t\tcontrolled: () =>\n\t\t\treadOption(props.value) as Value | Value[] | null | undefined,\n\t\tdefault: () =>\n\t\t\treadOption(props.defaultValue) as Value | Value[] | null | undefined,\n\t\tfallback: isMultipleAtInit ? (emptyArray as Value[]) : null,\n\t\tname: \"<Combobox.Root>\",\n\t\tstate: \"value\",\n\t});\n\n\t// Whether the consumer engaged the inputValue axis at all (controlled\n\t// prop OR default). When neither is supplied, the input display follows\n\t// the selection in single mode (seed below + the selectedValue→input\n\t// sync effect), mirroring React's `hasInputValue`.\n\tconst hasInputValueProp = (): boolean =>\n\t\treadOption(props.inputValue) !== undefined ||\n\t\treadOption(props.defaultInputValue) !== undefined;\n\n\tconst [inputValue, setUncontrolledInputValue] = createControlledState<string>(\n\t\t{\n\t\t\tcontrolled: () => readOption(props.inputValue),\n\t\t\tdefault: () => readOption(props.defaultInputValue),\n\t\t\t// React's `initialDefaultInputValue`: when neither `inputValue` nor\n\t\t\t// `defaultInputValue` is provided, derive the seed from the initial\n\t\t\t// selected value's label in single mode so the input reflects the\n\t\t\t// selection on mount.\n\t\t\tfallback: untrack(() => {\n\t\t\t\tif (hasInputValueProp()) return \"\";\n\t\t\t\tif (single()) {\n\t\t\t\t\tconst sv = selectedValue();\n\t\t\t\t\tif (sv === null || Array.isArray(sv)) return \"\";\n\t\t\t\t\treturn stringifyAsLabel(\n\t\t\t\t\t\tsv as Value,\n\t\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn \"\";\n\t\t\t}),\n\t\t\tname: \"<Combobox.Root>\",\n\t\t\tstate: \"inputValue\",\n\t\t},\n\t);\n\n\tconst [open, setUncontrolledOpen] = createControlledState<boolean>({\n\t\tcontrolled: () => {\n\t\t\tconst controlled = readOption(props.open);\n\t\t\treturn controlled === undefined ? undefined : Boolean(controlled);\n\t\t},\n\t\tdefault: () => readOption(props.defaultOpen),\n\t\tfallback: false,\n\t\tname: \"<Combobox.Root>\",\n\t\tstate: \"open\",\n\t});\n\n\t// React's \"mid-close filter freeze\": when the popup is closing we snapshot\n\t// the last query into `closeQuery`, and the `query` memo below prefers the\n\t// snapshot while `closeQuery !== null`. Cleared on unmount (post-close) or\n\t// when a fresh open transitions false→true. `queryChangedAfterOpen` is set\n\t// once the user has typed anything after opening so the freeze only\n\t// activates when there's an actual filtered view to keep stable.\n\tconst [closeQuery, setCloseQuery] = createSignal<string | null>(null, {\n\t\townedWrite: true,\n\t});\n\tconst [queryChangedAfterOpen, setQueryChangedAfterOpen] = createSignal(\n\t\tfalse,\n\t\t{ ownedWrite: true },\n\t);\n\n\t// Mount / transition machinery.\n\tconst { mounted, transitionStatus, setMounted } = useTransitionStatus(\n\t\topen,\n\t\t() => true,\n\t\t() => false,\n\t);\n\n\t// Identity\n\tconst [labelId, setLabelId] = createSignal<string | undefined>(undefined, {\n\t\townedWrite: true,\n\t});\n\t// Base UI's React root auto-generates a stable `useId()` when the consumer\n\t// passes no `id`. Without that, item ids (`${root.id()}-${index}`) collapse\n\t// to the literal `\"undefined-0\"` and the input's `aria-activedescendant`\n\t// points at a nonexistent node — virtual focus / arrow-nav into the list\n\t// silently breaks (e.g. the gitcafe Command palette, which supplies no id).\n\t// Mirror that here with a `createUniqueId()` fallback, stable for the\n\t// lifetime of the root, only used when the consumer omits `id`.\n\tconst fallbackId = createUniqueId();\n\tconst id = (): string | undefined =>\n\t\ttypeof props.id === \"string\" ? props.id : fallbackId;\n\n\t// -------------------------------------------------------------------\n\t// Element slots\n\t// -------------------------------------------------------------------\n\tconst [triggerElement, setTriggerElementInternal] =\n\t\tcreateSignal<HTMLElement | null>(null, { ownedWrite: true });\n\tconst [inputElement, setInputElementInternal] =\n\t\tcreateSignal<HTMLInputElement | null>(null, { ownedWrite: true });\n\tconst [listElement, setListElementInternal] =\n\t\tcreateSignal<HTMLElement | null>(null, { ownedWrite: true });\n\tconst [positionerElement, setPositionerElementInternal] =\n\t\tcreateSignal<HTMLElement | null>(null, { ownedWrite: true });\n\tconst [popupSide, setPopupSide] = createSignal<ComboboxSide | null>(null, {\n\t\townedWrite: true,\n\t});\n\n\t// Refs\n\tconst listRef: MutableRef<Array<HTMLElement | null>> = { current: [] };\n\tconst labelsRef: MutableRef<Array<string | null>> = { current: [] };\n\tconst popupRef: MutableRef<HTMLElement | null> = { current: null };\n\tconst inputRef: MutableRef<HTMLInputElement | null> = { current: null };\n\tconst emptyRef: MutableRef<HTMLElement | null> = { current: null };\n\tconst clearRef: MutableRef<HTMLButtonElement | null> = { current: null };\n\tconst valuesRef: MutableRef<Value[]> = { current: [] };\n\tconst allValuesRef: MutableRef<Value[]> = { current: [] };\n\tconst keyboardActiveRef: MutableRef<boolean> = { current: true };\n\tconst chipsContainerRef: MutableRef<HTMLDivElement | null> = {\n\t\tcurrent: null,\n\t};\n\n\t// -------------------------------------------------------------------\n\t// Active / selected indices\n\t// -------------------------------------------------------------------\n\tconst [activeIndex, setActiveIndex] = createSignal<number | null>(null, {\n\t\townedWrite: true,\n\t});\n\tconst [selectedIndex, setSelectedIndex] = createSignal<number | null>(null, {\n\t\townedWrite: true,\n\t});\n\tconst lastHighlightRef: MutableRef<{ value: unknown; index: number }> = {\n\t\tcurrent: INITIAL_LAST_HIGHLIGHT,\n\t};\n\n\tconst setIndices = (options: {\n\t\tactiveIndex?: number | null | undefined;\n\t\tselectedIndex?: number | null | undefined;\n\t\ttype?: ComboboxRootHighlightEventReason | undefined;\n\t}): void => {\n\t\tif (options.activeIndex !== undefined) {\n\t\t\tsetActiveIndex(options.activeIndex);\n\t\t}\n\t\tif (options.selectedIndex !== undefined) {\n\t\t\tsetSelectedIndex(options.selectedIndex);\n\t\t}\n\t\tconst type: ComboboxRootHighlightEventReason = options.type ?? \"none\";\n\t\tif (options.activeIndex === undefined) return;\n\t\tif (options.activeIndex === null) {\n\t\t\tif (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {\n\t\t\t\tlastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;\n\t\t\t\tprops.onItemHighlighted?.(\n\t\t\t\t\tundefined,\n\t\t\t\t\tcreateGenericEventDetails(type, undefined, {\n\t\t\t\t\t\tindex: -1,\n\t\t\t\t\t}) as ComboboxRootHighlightEventDetails,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst activeValue = valuesRef.current[options.activeIndex] as\n\t\t\t\t| Value\n\t\t\t\t| undefined;\n\t\t\tlastHighlightRef.current = {\n\t\t\t\tvalue: activeValue,\n\t\t\t\tindex: options.activeIndex,\n\t\t\t};\n\t\t\tprops.onItemHighlighted?.(\n\t\t\t\tactiveValue,\n\t\t\t\tcreateGenericEventDetails(type, undefined, {\n\t\t\t\t\tindex: options.activeIndex,\n\t\t\t\t}) as ComboboxRootHighlightEventDetails,\n\t\t\t);\n\t\t}\n\t};\n\n\t// -------------------------------------------------------------------\n\t// Filtering — delegated to the createCombobox primitive.\n\t// The primitive owns items, isGrouped, filteredItems, flatFilteredItems,\n\t// and the base query derivation. The wrapper layers the mid-close\n\t// \"closeQuery\" freeze on top of the primitive's query so the popup's\n\t// filtered view stays stable while the exit animation plays.\n\t// -------------------------------------------------------------------\n\tconst _primitive = createCombobox<Value>({\n\t\tvalue: selectedValue,\n\t\tinputValue: () => {\n\t\t\t// Pass closeQuery as a frozen inputValue when in the closing freeze,\n\t\t\t// so the primitive's query (and filteredItems) use the frozen string.\n\t\t\tconst frozen = closeQuery();\n\t\t\tif (frozen !== null) return frozen;\n\t\t\treturn inputValue();\n\t\t},\n\t\topen,\n\t\titems: () => props.items,\n\t\tfilter: () => props.filter,\n\t\tlocale: () => props.locale,\n\t\tqueryChangedAfterOpen: () => queryChangedAfterOpen(),\n\t\tselectionMode,\n\t\titemToStringLabel,\n\t\titemToStringValue,\n\t\tisItemEqualToValue: () =>\n\t\t\t(props.isItemEqualToValue as\n\t\t\t\t| ItemEqualityComparer<Value, Value>\n\t\t\t\t| undefined) ??\n\t\t\t(defaultItemEquality as ItemEqualityComparer<Value, Value>),\n\t});\n\n\tconst items = _primitive.items;\n\tconst isGrouped = _primitive.isGrouped;\n\t// query: prefer the close-query freeze; otherwise use the primitive's query.\n\tconst query = createMemo<string>(() => {\n\t\tconst frozen = closeQuery();\n\t\tif (frozen !== null) return frozen;\n\t\treturn _primitive.query();\n\t});\n\tconst filteredItems = _primitive.filteredItems;\n\tconst flatFilteredItems = _primitive.flatFilteredItems;\n\n\tconst flatItems = createMemo<readonly Value[]>(() => {\n\t\tconst list = items();\n\t\tif (!list) return [];\n\t\tif (isGrouped()) {\n\t\t\treturn (list as ReadonlyArray<Group<Value>>).flatMap(\n\t\t\t\t(g) => g.items as Value[],\n\t\t\t);\n\t\t}\n\t\treturn list as readonly Value[];\n\t});\n\n\t// -------------------------------------------------------------------\n\t// Static-children filtering (no `items` prop — the cmdk pattern)\n\t// -------------------------------------------------------------------\n\t// When `items` is omitted the consumer renders `<Combobox.Item>` children\n\t// directly, so there is no `flatFilteredItems` to drive empty-state /\n\t// per-item visibility. We filter the registered children against the live\n\t// query here using the same default `Intl.Collator` \"contains\" filter as\n\t// items-mode (honoring a custom `filter` / `filter={null}`). Each\n\t// `<Combobox.Item>` reports its visibility via `setItemVisible`;\n\t// `visibleItemCount` is the reactive total `<Combobox.Empty>` /\n\t// `<Combobox.List>` read. Inert in items-mode.\n\tconst staticCollator = createMemo<Filter>(() =>\n\t\tgetFilter({ locale: props.locale as Intl.LocalesArgument | undefined }),\n\t);\n\tconst matchesQuery = (value: Value): boolean => {\n\t\tconst q = query().trim();\n\t\tif (q === \"\") return true;\n\t\tconst userFilter = props.filter;\n\t\tif (userFilter === null) return true;\n\t\tif (userFilter !== undefined) {\n\t\t\treturn userFilter(\n\t\t\t\tvalue,\n\t\t\t\tq,\n\t\t\t\titemToStringLabel() as ((item: Value) => string) | undefined,\n\t\t\t);\n\t\t}\n\t\treturn staticCollator().contains(\n\t\t\tvalue,\n\t\t\tq,\n\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t);\n\t};\n\n\tconst visibleItemTokens = new Set<symbol>();\n\tconst [visibleItemTick, setVisibleItemTick] = createSignal(0, {\n\t\townedWrite: true,\n\t});\n\tconst setItemVisible = (token: symbol, visible: boolean): void => {\n\t\tconst had = visibleItemTokens.has(token);\n\t\tif (visible === had) return;\n\t\tif (visible) visibleItemTokens.add(token);\n\t\telse visibleItemTokens.delete(token);\n\t\tsetVisibleItemTick((t) => t + 1);\n\t};\n\tconst visibleItemCount = createMemo<number>(() => {\n\t\tvisibleItemTick();\n\t\treturn visibleItemTokens.size;\n\t});\n\n\t// Keep `valuesRef` / `listRef` in sync with the filtered flat list when\n\t// `items` is supplied. When `items` is omitted, the <CompositeList>-driven\n\t// item registration path owns these.\n\tcreateEffect(\n\t\t() => ({ hasItems: items() !== undefined, flat: flatFilteredItems() }),\n\t\t({ hasItems, flat }) =>\n\t\t\tuntrack(() => {\n\t\t\t\tif (!hasItems) return;\n\t\t\t\tvaluesRef.current = flat as Value[];\n\t\t\t\tlistRef.current.length = flat.length;\n\t\t\t\tlabelsRef.current = flat.map((item) =>\n\t\t\t\t\tstringifyAsLabel(\n\t\t\t\t\t\titem,\n\t\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}),\n\t);\n\n\t// -------------------------------------------------------------------\n\t// setOpen / setInputValue / setSelectedValue — the core write path.\n\t// -------------------------------------------------------------------\n\t// Imperative write-paths. These may be invoked from inside an effect's\n\t// apply scope (e.g. floating-ui's onOpenChange callback fired from\n\t// `useDismiss` / `useClick` apply, or onNavigate fired from\n\t// `useListNavigation`). The reads below are snapshots — there's no\n\t// subscription contract here — so wrap the body in `untrack` to keep\n\t// `[STRICT_READ_UNTRACKED]` quiet while preserving semantics.\n\t// Each setter mirrors React's `AriaCombobox` change flow exactly: fire\n\t// the `onXChange` callback FIRST, honor `details.cancel()`, THEN write\n\t// the uncontrolled state (a no-op for reads while the matching prop is\n\t// controlled — the consumer's signal write is the source of truth) and\n\t// run the downstream bookkeeping.\n\tconst setOpen = (\n\t\tnextOpen: boolean,\n\t\tdetails: ComboboxRootChangeEventDetails,\n\t): void =>\n\t\tuntrack(() => {\n\t\t\tif (open() === nextOpen) return;\n\t\t\tprops.onOpenChange?.(nextOpen, details);\n\t\t\tif (details.isCanceled) return;\n\t\t\tif (!nextOpen && queryChangedAfterOpen()) {\n\t\t\t\t// Snapshot the current typed query so the popup's filter view stays\n\t\t\t\t// stable while the exit transition plays. Cleared in handleUnmount.\n\t\t\t\tconst q = inputValue().trim();\n\t\t\t\tsetCloseQuery(q);\n\t\t\t\tif (q === \"\") setQueryChangedAfterOpen(false);\n\t\t\t}\n\t\t\tif (nextOpen) {\n\t\t\t\tsetCloseQuery(null);\n\t\t\t\tsetQueryChangedAfterOpen(false);\n\t\t\t}\n\t\t\tsetUncontrolledOpen(nextOpen);\n\t\t});\n\n\tconst setInputValue = (\n\t\tnext: string,\n\t\tdetails: ComboboxRootChangeEventDetails,\n\t): void =>\n\t\tuntrack(() => {\n\t\t\tprops.onInputValueChange?.(next, details);\n\t\t\tif (details.isCanceled) return;\n\t\t\t// Typed input after open marks the filter as dirty so the mid-close\n\t\t\t// freeze can latch on close. Non-typed sources (programmatic resets,\n\t\t\t// item-press fill) are exempt.\n\t\t\tif (\n\t\t\t\tdetails.reason === REASONS.inputChange &&\n\t\t\t\topen() &&\n\t\t\t\tnext.trim() !== \"\"\n\t\t\t) {\n\t\t\t\tsetQueryChangedAfterOpen(true);\n\t\t\t}\n\t\t\tsetUncontrolledInputValue(next);\n\t\t});\n\n\tconst setSelectedValue = (\n\t\tnext: Value | Value[] | null,\n\t\tdetails: ComboboxRootChangeEventDetails,\n\t): void =>\n\t\tuntrack(() => {\n\t\t\tconst normalized = (next ?? (isMultipleAtInit ? emptyArray : null)) as\n\t\t\t\t| Value\n\t\t\t\t| Value[]\n\t\t\t\t| null;\n\t\t\tprops.onValueChange?.(normalized, details);\n\t\t\tif (details.isCanceled) return;\n\t\t\tsetUncontrolledSelectedValue(normalized);\n\t\t\t// In single mode, sync the input to the selected label (unless the\n\t\t\t// caller is currently mid-type). React gates this behind the same\n\t\t\t// cancel check — a canceled selection leaves the input untouched.\n\t\t\tif (\n\t\t\t\tsingle() &&\n\t\t\t\t!Array.isArray(normalized) &&\n\t\t\t\t(details.reason === REASONS.itemPress ||\n\t\t\t\t\tdetails.reason === REASONS.none ||\n\t\t\t\t\tdetails.reason === REASONS.clearPress)\n\t\t\t) {\n\t\t\t\tsetInputValue(\n\t\t\t\t\tstringifyAsLabel(\n\t\t\t\t\t\tnormalized as Value | null,\n\t\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t\t),\n\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\tdetails.reason as ComboboxRootChangeEventReason,\n\t\t\t\t\t\tdetails.event,\n\t\t\t\t\t) as ComboboxRootChangeEventDetails,\n\t\t\t\t);\n\t\t\t}\n\t\t});\n\n\tconst handleSelection = (\n\t\tevent: MouseEvent | PointerEvent | KeyboardEvent,\n\t\tpassedValue?: Value,\n\t): void =>\n\t\tuntrack(() => {\n\t\t\tlet itemValue = passedValue;\n\t\t\tif (itemValue === undefined) {\n\t\t\t\tconst ai = activeIndex();\n\t\t\t\tif (ai === null) return;\n\t\t\t\titemValue = valuesRef.current[ai] as Value;\n\t\t\t}\n\t\t\tconst details = createChangeEventDetails(\n\t\t\t\tREASONS.itemPress,\n\t\t\t\tevent,\n\t\t\t) as ComboboxRootChangeEventDetails;\n\t\t\tif (multiple()) {\n\t\t\t\tconst current = selectedValue();\n\t\t\t\tconst currentArr = Array.isArray(current) ? (current as Value[]) : [];\n\t\t\t\tconst isSelected = selectedValueIncludes(\n\t\t\t\t\tcurrentArr,\n\t\t\t\t\titemValue as Value,\n\t\t\t\t\tisItemEqualToValue() as ItemEqualityComparer<Value, Value>,\n\t\t\t\t);\n\t\t\t\tconst nextArr = isSelected\n\t\t\t\t\t? removeItem(\n\t\t\t\t\t\t\tcurrentArr,\n\t\t\t\t\t\t\titemValue as Value,\n\t\t\t\t\t\t\tisItemEqualToValue() as ItemEqualityComparer<Value, Value>,\n\t\t\t\t\t\t)\n\t\t\t\t\t: [...currentArr, itemValue as Value];\n\t\t\t\tsetSelectedValue(nextArr, details);\n\t\t\t\t// Clear the typed filter if the user was filtering — next open\n\t\t\t\t// starts fresh. Keep the popup open so multiple items can be\n\t\t\t\t// toggled.\n\t\t\t\tconst wasFiltering = inputRef.current\n\t\t\t\t\t? inputRef.current.value.trim() !== \"\"\n\t\t\t\t\t: false;\n\t\t\t\tif (wasFiltering) {\n\t\t\t\t\tsetOpen(false, details);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (selectionMode() === \"none\") {\n\t\t\t\t// Free-text mode: items just project their label into the input;\n\t\t\t\t// the selected-value state is untouched unless fillInputOnItemPress.\n\t\t\t\tif (fillInputOnItemPress()) {\n\t\t\t\t\tsetInputValue(\n\t\t\t\t\t\tstringifyAsLabel(\n\t\t\t\t\t\t\titemValue as Value,\n\t\t\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t\t\t),\n\t\t\t\t\t\tdetails,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tsetOpen(false, details);\n\t\t\t\tif (submitOnItemClick()) {\n\t\t\t\t\tconst formEl =\n\t\t\t\t\t\tinputRef.current?.form ??\n\t\t\t\t\t\t(inputRef.current?.closest(\"form\") as HTMLFormElement | null);\n\t\t\t\t\tif (formEl && typeof formEl.requestSubmit === \"function\") {\n\t\t\t\t\t\tformEl.requestSubmit();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetSelectedValue(itemValue as Value | null, details);\n\t\t\tsetOpen(false, details);\n\t\t});\n\n\t// -------------------------------------------------------------------\n\t// Post-close side effects\n\t// -------------------------------------------------------------------\n\tconst handleUnmount = (): void => {\n\t\tsetMounted(false);\n\t\tprops.onOpenChangeComplete?.(false);\n\t\tsetCloseQuery(null);\n\t\tsetQueryChangedAfterOpen(false);\n\t\tsetIndices({ activeIndex: null, selectedIndex: null });\n\t\t// Multi-select: clear the typed filter after close so the next open\n\t\t// starts fresh. Single: sync the input to the current selected label.\n\t\tif (multiple()) {\n\t\t\tif (inputRef.current && inputRef.current.value !== \"\") {\n\t\t\t\tsetInputValue(\n\t\t\t\t\t\"\",\n\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\tREASONS.inputClear,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t) as ComboboxRootChangeEventDetails,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (single()) {\n\t\t\tconst sv = selectedValue();\n\t\t\tconst stringVal = stringifyAsLabel(\n\t\t\t\tArray.isArray(sv) ? null : (sv as Value | null),\n\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t);\n\t\t\tif (inputRef.current && inputRef.current.value !== stringVal) {\n\t\t\t\t// React uses `inputClear` when no selection was made (treats the\n\t\t\t\t// close as clearing the typed filter), `none` otherwise.\n\t\t\t\tsetInputValue(\n\t\t\t\t\tstringVal,\n\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\tstringVal === \"\" ? REASONS.inputClear : REASONS.none,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t) as ComboboxRootChangeEventDetails,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n\n\tuseOpenChangeComplete({\n\t\topen,\n\t\tref: popupRef,\n\t\tonComplete: () => {\n\t\t\tif (!open()) handleUnmount();\n\t\t\telse props.onOpenChangeComplete?.(true);\n\t\t},\n\t});\n\n\t// Sync selectedIndex when `selectedValue` changes. Capture all reactive\n\t// inputs in compute (snapshot pattern). The apply runs in an\n\t// unowned/untracked scope — wrap in `untrack` so any nested signal reads\n\t// stay quiet.\n\tcreateEffect(\n\t\t() => ({\n\t\t\tsv: selectedValue(),\n\t\t\tlist: flatItems(),\n\t\t\thasItems: items() !== undefined,\n\t\t\tcomparer: isItemEqualToValue() as ItemEqualityComparer<Value, Value>,\n\t\t}),\n\t\t(snap) =>\n\t\t\tuntrack(() => {\n\t\t\t\tconst { sv, list, hasItems, comparer } = snap;\n\t\t\t\tif (sv == null) {\n\t\t\t\t\tsetSelectedIndex(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst registry = hasItems ? list : allValuesRef.current;\n\t\t\t\tif (Array.isArray(sv)) {\n\t\t\t\t\tconst arr = sv as Value[];\n\t\t\t\t\tif (arr.length === 0) {\n\t\t\t\t\t\tsetSelectedIndex(null);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst last = arr[arr.length - 1] as Value;\n\t\t\t\t\tconst idx = findItemIndex(registry, last, comparer);\n\t\t\t\t\tsetSelectedIndex(idx === -1 ? null : idx);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst idx = findItemIndex(registry, sv as Value, comparer);\n\t\t\t\tsetSelectedIndex(idx === -1 ? null : idx);\n\t\t\t}),\n\t);\n\n\t// Mirror React's `useValueChanged(selectedValue, …)` input sync: when the\n\t// consumer engages neither `inputValue` nor `defaultInputValue`, the\n\t// visible input follows the selection in single mode — external `value`\n\t// writes update the display text (this replaces the old reactive\n\t// \"computed default\" memo; selection-by-item-press is already handled\n\t// inside `setSelectedValue`).\n\tlet prevSelectedForInputSync = untrack(selectedValue);\n\tcreateEffect(\n\t\t() => selectedValue(),\n\t\t(sv) =>\n\t\t\tuntrack(() => {\n\t\t\t\tif (Object.is(sv, prevSelectedForInputSync)) return;\n\t\t\t\tprevSelectedForInputSync = sv;\n\t\t\t\tif (!single()) return;\n\t\t\t\tif (hasInputValueProp()) return;\n\t\t\t\tconst nextInputValue = stringifyAsLabel(\n\t\t\t\t\tArray.isArray(sv) ? null : (sv as Value | null),\n\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t);\n\t\t\t\tif (inputValue() !== nextInputValue) {\n\t\t\t\t\tsetInputValue(\n\t\t\t\t\t\tnextInputValue,\n\t\t\t\t\t\tcreateChangeEventDetails(\n\t\t\t\t\t\t\tREASONS.none,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t) as ComboboxRootChangeEventDetails,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}),\n\t);\n\n\t// -------------------------------------------------------------------\n\t// Field-context integration\n\t// -------------------------------------------------------------------\n\t// The value that a `<Field.Root>` should validate against.\n\t// - selectionMode \"none\": the input string\n\t// - selectionMode \"single\": the selected scalar value\n\t// - selectionMode \"multiple\": the selected array\n\tconst fieldRawValue = createMemo<unknown>(() => {\n\t\tif (selectionMode() === \"none\") return inputValue();\n\t\treturn selectedValue();\n\t});\n\t// Projected to a string / string[] for form submission.\n\tconst fieldStringValue = createMemo<unknown>(() => {\n\t\tconst mode = selectionMode();\n\t\tconst raw = fieldRawValue();\n\t\tif (mode === \"none\") return raw;\n\t\tif (Array.isArray(raw)) {\n\t\t\tconst itv = itemToStringValue();\n\t\t\treturn (raw as Value[]).map((v) =>\n\t\t\t\tstringifyAsValue(v, itv as ((item: unknown) => string) | undefined),\n\t\t\t);\n\t\t}\n\t\tconst itv = itemToStringValue();\n\t\treturn stringifyAsValue(\n\t\t\traw as Value | null,\n\t\t\titv as ((item: unknown) => string) | undefined,\n\t\t);\n\t});\n\tconst fieldControlRef: MutableRef<HTMLElement | null> = { current: null };\n\tconst validation = useFieldControlValidation({\n\t\tvalue: fieldRawValue,\n\t\tid,\n\t\tcontrolRef: fieldControlRef,\n\t\tgetValue: () => fieldStringValue(),\n\t});\n\t// Keep `fieldControlRef` synced to the live input element so the\n\t// registration carries a real control reference.\n\tcreateEffect(\n\t\t() => inputElement(),\n\t\t(el) => {\n\t\t\tfieldControlRef.current = el as HTMLElement | null;\n\t\t},\n\t);\n\t// Mirror React's `useValueChanged(selectedValue, …)` / `useValueChanged(inputValue, …)`\n\t// — push `setDirty` + run validation on each change.\n\tlet initialDirtyValue = untrack(fieldRawValue);\n\tcreateEffect(\n\t\t() => fieldRawValue(),\n\t\t(v) =>\n\t\t\tuntrack(() => {\n\t\t\t\tif (!field.present) return;\n\t\t\t\t// Avoid firing on the initial mount cycle (no value change yet).\n\t\t\t\tif (Object.is(v, initialDirtyValue)) return;\n\t\t\t\tinitialDirtyValue = v;\n\t\t\t\tconst initial = field.validityData().initialValue;\n\t\t\t\tfield.setDirty(v !== initial);\n\t\t\t\tif (field.shouldValidateOnChange()) {\n\t\t\t\t\tvoid validation.commit(v);\n\t\t\t\t} else {\n\t\t\t\t\tvoid validation.commit(v, true);\n\t\t\t\t}\n\t\t\t}),\n\t);\n\t// `setFilled` — reflects whether the control has a user-visible value.\n\tcreateEffect(\n\t\t() => ({ mode: selectionMode(), iv: inputValue(), sv: selectedValue() }),\n\t\t({ mode, iv, sv }) =>\n\t\t\tuntrack(() => {\n\t\t\t\tif (!field.present) return;\n\t\t\t\tif (mode === \"none\") {\n\t\t\t\t\tfield.setFilled(iv !== \"\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (Array.isArray(sv)) {\n\t\t\t\t\tfield.setFilled(sv.length > 0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tfield.setFilled(sv != null);\n\t\t\t}),\n\t);\n\n\t// -------------------------------------------------------------------\n\t// Floating-UI integration\n\t// -------------------------------------------------------------------\n\tconst floatingRootContext: FloatingRootStore = useFloatingRootContext({\n\t\topen: untrack(open),\n\t\tonOpenChange: (nextOpen, details) => {\n\t\t\tsetOpen(nextOpen, details as ComboboxRootChangeEventDetails);\n\t\t},\n\t});\n\n\tcreateEffect(\n\t\t() => ({\n\t\t\topenValue: open(),\n\t\t\treference: inputElement() ?? triggerElement(),\n\t\t\tfloating: positionerElement(),\n\t\t\tstatus: transitionStatus(),\n\t\t}),\n\t\t({ openValue, reference, floating, status }) =>\n\t\t\tuntrack(() => {\n\t\t\t\tfloatingRootContext.update({\n\t\t\t\t\topen: openValue,\n\t\t\t\t\treferenceElement: reference,\n\t\t\t\t\tdomReferenceElement: reference,\n\t\t\t\t\tfloatingElement: floating,\n\t\t\t\t\ttransitionStatus: status,\n\t\t\t\t});\n\t\t\t}),\n\t);\n\n\t// Floating-UI interaction hooks read accessor inputs once at body\n\t// time to seed local state — wrap in `untrack` so the component-body\n\t// strict-read shell stays quiet. Reactivity flows through the\n\t// accessor closures the hooks retain for subsequent updates.\n\tconst role = untrack(() => useRole(floatingRootContext, { role: \"listbox\" }));\n\n\tconst click = untrack(() =>\n\t\tuseClick(floatingRootContext, {\n\t\t\tenabled: () => !readOnly() && !disabled() && openOnInputClick(),\n\t\t\tevent: \"mousedown-only\",\n\t\t\ttoggle: false,\n\t\t}),\n\t);\n\n\tconst dismiss = untrack(() =>\n\t\tuseDismiss(floatingRootContext, {\n\t\t\tenabled: () => !readOnly() && !disabled(),\n\t\t\toutsidePressEvent: {\n\t\t\t\tmouse: \"sloppy\",\n\t\t\t\ttouch: \"intentional\",\n\t\t\t},\n\t\t\toutsidePress: (event) => {\n\t\t\t\t// Don't dismiss when clicking inside the chips container (e.g. on\n\t\t\t\t// a `<Combobox.ChipRemove>` button).\n\t\t\t\tconst target = event.target as Node | null;\n\t\t\t\tconst chipsEl = chipsContainerRef.current;\n\t\t\t\tif (chipsEl && target && chipsEl.contains(target)) return false;\n\t\t\t\treturn true;\n\t\t\t},\n\t\t}),\n\t);\n\n\tconst listNavigation = untrack(() =>\n\t\tuseListNavigation(floatingRootContext, {\n\t\t\tenabled: () => !readOnly() && !disabled(),\n\t\t\tid,\n\t\t\tlistRef,\n\t\t\tactiveIndex,\n\t\t\tselectedIndex,\n\t\t\tvirtual: true,\n\t\t\tloopFocus,\n\t\t\tallowEscape: () => loopFocus() && !autoHighlightMode(),\n\t\t\tfocusItemOnOpen: () => (autoHighlightMode() ? (\"auto\" as const) : false),\n\t\t\tfocusItemOnHover: highlightItemOnHover,\n\t\t\tresetOnPointerLeave: true,\n\t\t\tcols: () => (grid() ? 2 : 1),\n\t\t\torientation: () => (grid() ? \"horizontal\" : \"vertical\"),\n\t\t\t// onNavigate is invoked from `useListNavigation`'s effect-apply scope.\n\t\t\t// `open()` / `transitionStatus()` reads are snapshots, not subscriptions,\n\t\t\t// so wrap in `untrack` to silence `[STRICT_READ_UNTRACKED]`.\n\t\t\tonNavigate: (nextActiveIndex, event) =>\n\t\t\t\tuntrack(() => {\n\t\t\t\t\tif (!event && !open()) return;\n\t\t\t\t\tif (transitionStatus() === \"ending\") return;\n\t\t\t\t\tsetIndices({\n\t\t\t\t\t\tactiveIndex: nextActiveIndex,\n\t\t\t\t\t\ttype: event\n\t\t\t\t\t\t\t? keyboardActiveRef.current\n\t\t\t\t\t\t\t\t? \"keyboard\"\n\t\t\t\t\t\t\t\t: \"pointer\"\n\t\t\t\t\t\t\t: \"none\",\n\t\t\t\t\t});\n\t\t\t\t}),\n\t\t}),\n\t);\n\n\tconst interactions: UseInteractionsReturn = untrack(() =>\n\t\tuseInteractions([role, click, dismiss, listNavigation]),\n\t);\n\n\t// Auto-highlight on input change.\n\tcreateEffect(\n\t\t() => ({\n\t\t\tiv: inputValue(),\n\t\t\tmode: autoHighlightMode(),\n\t\t\tff: flatFilteredItems(),\n\t\t\tq: query(),\n\t\t\tai: activeIndex(),\n\t\t}),\n\t\t({ mode, ff, q, ai }) =>\n\t\t\tuntrack(() => {\n\t\t\t\tif (!mode) return;\n\t\t\t\tif (ff.length === 0) {\n\t\t\t\t\tsetActiveIndex(null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (mode === \"always\" || (mode === \"input-change\" && q !== \"\")) {\n\t\t\t\t\tif (ai == null) setActiveIndex(0);\n\t\t\t\t}\n\t\t\t}),\n\t);\n\n\t// Virtualized stable-index override: when the consumer renders a windowed\n\t// subset of `listRef`, the sliced array mutates as the viewport scrolls\n\t// and the active index would otherwise be clamped to the visible range.\n\t// React's active-index effect skips the `>= candidateItems.length` reset\n\t// when `virtualized` is on so the logical index is preserved across\n\t// slice shifts. Mirror that here by not clamping when virtualized.\n\tcreateEffect(\n\t\t() => ({\n\t\t\tvirt: virtualized(),\n\t\t\tai: activeIndex(),\n\t\t\tlen: flatFilteredItems().length,\n\t\t\topenV: open(),\n\t\t}),\n\t\t({ virt, ai, len, openV }) => {\n\t\t\tif (!openV) return;\n\t\t\tif (ai == null) return;\n\t\t\tif (virt) return;\n\t\t\tif (ai >= len) {\n\t\t\t\tsetActiveIndex(null);\n\t\t\t}\n\t\t},\n\t);\n\n\t// Imperative actions.\n\tconst actions: ComboboxRootActions = {\n\t\tunmount: () => setMounted(false),\n\t};\n\tconst ref = props.actionsRef;\n\tif (typeof ref === \"function\") {\n\t\tref(actions);\n\t\tonCleanup(() => ref(null));\n\t} else if (ref && typeof ref === \"object\") {\n\t\tref.current = actions;\n\t\tonCleanup(() => {\n\t\t\tref.current = null;\n\t\t});\n\t}\n\n\t// -------------------------------------------------------------------\n\t// Context value\n\t// -------------------------------------------------------------------\n\tconst contextValue: ComboboxRootContextValue<Value> = {\n\t\tid,\n\t\tlabelId,\n\t\tsetLabelId,\n\t\topen,\n\t\tmounted,\n\t\ttransitionStatus,\n\t\tinputValue,\n\t\tsetInputValue,\n\t\tselectedValue,\n\t\tsetSelectedValue,\n\t\tselectionMode,\n\t\tactiveIndex,\n\t\tselectedIndex,\n\t\tsetIndices,\n\t\tdisabled,\n\t\treadOnly,\n\t\trequired,\n\t\tautoHighlightMode,\n\t\thighlightItemOnHover,\n\t\tmodal,\n\t\tloopFocus,\n\t\topenOnInputClick,\n\t\tgrid,\n\t\tvirtualized,\n\t\titemToStringLabel,\n\t\titemToStringValue,\n\t\tisItemEqualToValue,\n\t\titems,\n\t\tfilteredItems,\n\t\tflatFilteredItems,\n\t\tquery,\n\t\tmatchesQuery,\n\t\tsetItemVisible,\n\t\tvisibleItemCount,\n\t\tlistRef,\n\t\tlabelsRef,\n\t\tpopupRef,\n\t\tinputRef,\n\t\temptyRef,\n\t\tclearRef,\n\t\tvaluesRef,\n\t\tallValuesRef,\n\t\tchipsContainerRef,\n\t\ttriggerElement,\n\t\tsetTriggerElement: setTriggerElementInternal,\n\t\tinputElement,\n\t\tsetInputElement: (el) => {\n\t\t\tinputRef.current = el;\n\t\t\tsetInputElementInternal(el);\n\t\t},\n\t\tlistElement,\n\t\tsetListElement: setListElementInternal,\n\t\tpositionerElement,\n\t\tsetPositionerElement: setPositionerElementInternal,\n\t\tpopupSide,\n\t\tsetPopupSide,\n\t\tsetOpen,\n\t\thandleSelection,\n\t\tforceMount: () => {\n\t\t\t// No-op for now. In React this is used to pre-populate the labels\n\t\t\t// ref from `items`; our port does that eagerly in the\n\t\t\t// `items` / `flatFilteredItems` effect above.\n\t\t},\n\t\tfloatingRootContext,\n\t\tinteractions,\n\t\tkeyboardActiveRef,\n\t};\n\n\treturn (\n\t\t<ComboboxRootContext\n\t\t\tvalue={contextValue as ComboboxRootContextValue<unknown>}\n\t\t>\n\t\t\t{props.children}\n\t\t\t{multiple() && fieldName()\n\t\t\t\t? (() => {\n\t\t\t\t\t\tconst sv = selectedValue();\n\t\t\t\t\t\tif (!Array.isArray(sv)) return null;\n\t\t\t\t\t\tconst itv = itemToStringValue();\n\t\t\t\t\t\tconst n = fieldName();\n\t\t\t\t\t\treturn sv.map((v) => (\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\ttype=\"hidden\"\n\t\t\t\t\t\t\t\tname={n}\n\t\t\t\t\t\t\t\tform={props.form}\n\t\t\t\t\t\t\t\tvalue={stringifyAsValue(\n\t\t\t\t\t\t\t\t\tv as Value,\n\t\t\t\t\t\t\t\t\titv as ((item: unknown) => string) | undefined,\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t));\n\t\t\t\t\t})()\n\t\t\t\t: null}\n\t\t</ComboboxRootContext>\n\t);\n}\n\n/**\n * Groups all parts of the combobox. Doesn't render its own HTML element.\n */\nexport function ComboboxRoot<Value = unknown>(\n\tprops: ComboboxRootProps<Value>,\n): JSX.Element {\n\tif (\n\t\tuseComboboxRootContext(true) != null ||\n\t\tuseFloatingParentNodeId() != null\n\t) {\n\t\treturn <ComboboxRootComponent<Value> {...props} />;\n\t}\n\treturn (\n\t\t<FloatingTree>\n\t\t\t<ComboboxRootComponent<Value> {...props} />\n\t\t</FloatingTree>\n\t);\n}\n"],"mappings":"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;AACA;AACA;AACA;AACA;;AAEA,SACCA,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,cAAc,EACdC,SAAS,EACTC,OAAO,QACD,UAAU;AACjB,SACCC,wBAAwB,EACxBC,yBAAyB,EACzBC,OAAO,QACD,sCAAsC;AAC7C,SAASC,qBAAqB,QAAQ,yCAAyC;AAC/E,SAASC,mBAAmB,QAAQ,+BAA+B;AAEnE,SACCC,YAAY,EACZC,uBAAuB,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