{"version":3,"names":["createContext","createMemo","runWithOwner","untrack","useContext","readOption","SNAPSHOT_KEYS","snapshotKeys","createCollatorItemFilter","createSingleSelectionCollatorFilter","getFilter","defaultItemEquality","selectedValueIncludes","isGroupedItems","stringifyAsLabel","ComboboxContext","useCombobox","ctx","Error","createCombobox","options","isMultipleAtInit","multiple","selectionMode","name","isSingle","disabled","Boolean","readOnly","itemToStringLabel","isItemEqualToValue","emptyArray","value","v","undefined","inputValue","iv","sv","Array","isArray","open","items","isGrouped","query","trim","collatorFilter","locale","resolvedFilter","userFilter","filter","coll","queryChangedAfterOpen","filterQuery","q","selectedLabelString","shouldBypassFiltering","length","contains","filteredItems","list","filt","label","groups","out","g","candidates","item","push","flatFilteredItems","fi","flatMap","isItemSelected","setValue","next","reason","onValueChange","setInputValue","onInputValueChange","setOpen","onOpenChange","api","Provider","props","children","COMBOBOX_SNAPSHOT_KEYS"],"sources":["create-combobox.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\nimport {\n\ttype Accessor,\n\tcreateContext,\n\tcreateMemo,\n\trunWithOwner,\n\tuntrack,\n\tuseContext,\n} from \"solid-js\";\nimport { type MaybeAccessor, readOption } from \"../internals/maybe-accessor\";\nimport {\n\tSNAPSHOT_KEYS,\n\ttype Snapshottable,\n\tsnapshotKeys,\n} from \"../internals/observability/snapshot\";\nimport {\n\tcreateCollatorItemFilter,\n\tcreateSingleSelectionCollatorFilter,\n\ttype Filter,\n\tgetFilter,\n} from \"./internals/filter\";\nimport {\n\tdefaultItemEquality,\n\ttype ItemEqualityComparer,\n\tselectedValueIncludes,\n} from \"./internals/item-equality\";\nimport {\n\ttype Group,\n\tisGroupedItems,\n\tstringifyAsLabel,\n} from \"./internals/resolve-value-label\";\n\n// ---------------------------------------------------------------------------\n// Public types\n// ---------------------------------------------------------------------------\n\nexport type ComboboxSelectionMode = \"none\" | \"single\" | \"multiple\";\n\nexport type ComboboxChangeReason =\n\t| \"item-press\"\n\t| \"clear-press\"\n\t| \"input-change\"\n\t| \"escape-key\"\n\t| \"outside-press\"\n\t| \"imperative\";\n\nexport interface CreateComboboxOptions<Value = unknown> {\n\t/**\n\t * Current selected value. Consumer-owned signal. Writes happen via\n\t * `onValueChange` — the primitive does NOT keep an internal copy.\n\t */\n\tvalue: MaybeAccessor<Value | Value[] | null | undefined>;\n\tonValueChange?: (\n\t\tvalue: Value | Value[] | null,\n\t\treason: ComboboxChangeReason,\n\t) => void;\n\n\t/**\n\t * Current input text. Consumer-owned signal. When omitted, a computed\n\t * default derives the display text from the selected value's label in\n\t * single-select mode.\n\t */\n\tinputValue?: MaybeAccessor<string | undefined>;\n\tonInputValueChange?: (value: string, reason: ComboboxChangeReason) => void;\n\n\t/** Open state. Consumer-owned signal. */\n\topen: MaybeAccessor<boolean>;\n\tonOpenChange?: (open: boolean, reason: ComboboxChangeReason) => void;\n\n\t/** Items to filter. Flat array or grouped (`{ items: [...] }`). */\n\titems?: MaybeAccessor<readonly Value[] | readonly Group<Value>[] | undefined>;\n\n\t/**\n\t * Filter function. Pass `null` to disable filtering. Defaults to an\n\t * `Intl.Collator`-backed \"contains\" filter.\n\t */\n\tfilter?:\n\t\t| MaybeAccessor<\n\t\t\t\t| ((\n\t\t\t\t\t\titem: Value,\n\t\t\t\t\t\tquery: string,\n\t\t\t\t\t\titemToStringLabel?: (item: Value) => string,\n\t\t\t\t  ) => boolean)\n\t\t\t\t| null\n\t\t\t\t| undefined\n\t\t  >\n\t\t| undefined;\n\n\t/** Locale for the default `Intl.Collator`. */\n\tlocale?: MaybeAccessor<Intl.LocalesArgument | undefined>;\n\n\t/** Selection mode. @default \"single\" */\n\tselectionMode?: MaybeAccessor<ComboboxSelectionMode | undefined>;\n\t/** `true` is shorthand for `selectionMode: \"multiple\"`. */\n\tmultiple?: MaybeAccessor<boolean | undefined>;\n\n\tdisabled?: MaybeAccessor<boolean | undefined>;\n\treadOnly?: MaybeAccessor<boolean | undefined>;\n\n\t/**\n\t * Whether the user has typed anything since the popup last opened. When\n\t * `false` in single-select mode, opening with a committed value shows the\n\t * full list (filtering is bypassed) instead of just the matching item.\n\t * @default false\n\t */\n\tqueryChangedAfterOpen?: MaybeAccessor<boolean | undefined>;\n\n\t/** Converts object items to a display string. */\n\titemToStringLabel?: MaybeAccessor<((item: Value) => string) | undefined>;\n\t/** Converts object items to a form-submission string. */\n\titemToStringValue?: MaybeAccessor<((item: Value) => string) | undefined>;\n\t/** Custom item equality. Defaults to `Object.is`. */\n\tisItemEqualToValue?: MaybeAccessor<\n\t\t((item: Value, value: Value) => boolean) | undefined\n\t>;\n}\n\nexport interface ComboboxApi<Value = unknown> {\n\t/** Reactive accessor for the current selected value. */\n\tvalue: Accessor<Value | Value[] | null>;\n\t/** Reactive accessor for the current input text. */\n\tinputValue: Accessor<string>;\n\t/** Reactive accessor for the open state. */\n\topen: Accessor<boolean>;\n\n\t/** Current selection mode. */\n\tselectionMode: Accessor<ComboboxSelectionMode>;\n\tdisabled: Accessor<boolean>;\n\treadOnly: Accessor<boolean>;\n\n\t/** All items (before filtering). */\n\titems: Accessor<readonly Value[] | readonly Group<Value>[] | undefined>;\n\t/** Items after applying the filter against the current query. */\n\tfilteredItems: Accessor<readonly Value[] | readonly Group<Value>[]>;\n\t/** Flat version of `filteredItems` (groups are unwrapped). */\n\tflatFilteredItems: Accessor<readonly Value[]>;\n\t/** Trimmed query string used for filtering. */\n\tquery: Accessor<string>;\n\n\t/** Whether the items list is grouped. */\n\tisGrouped: Accessor<boolean>;\n\n\t/** Check whether a given item value is currently selected. */\n\tisItemSelected: (item: Value) => boolean;\n\n\t/** Pure event-emitter — fire `onValueChange`. Consumer owns the signal write. */\n\tsetValue: (\n\t\tnext: Value | Value[] | null,\n\t\treason?: ComboboxChangeReason,\n\t) => void;\n\t/** Pure event-emitter — fire `onInputValueChange`. */\n\tsetInputValue: (next: string, reason?: ComboboxChangeReason) => void;\n\t/** Pure event-emitter — fire `onOpenChange`. */\n\tsetOpen: (next: boolean, reason?: ComboboxChangeReason) => void;\n\n\t/**\n\t * Context provider. Wrap a subtree to make the api discoverable via\n\t * `useCombobox()` without prop-drilling.\n\t */\n\tProvider: (props: { children: JSX.Element }) => JSX.Element;\n}\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\nconst ComboboxContext = createContext<ComboboxApi<unknown> | null>(null);\n\nexport function useCombobox<Value = unknown>(): ComboboxApi<Value> {\n\tconst ctx = useContext(ComboboxContext);\n\tif (ctx == null) {\n\t\tthrow new Error(\n\t\t\t\"Base UI: useCombobox() must be called inside a <c.Provider>.\",\n\t\t);\n\t}\n\treturn ctx as ComboboxApi<Value>;\n}\n\n// ---------------------------------------------------------------------------\n// Primitive\n// ---------------------------------------------------------------------------\n\n/**\n * Solid 2-native headless primitive for the combobox selection + filtering\n * logic. Owns: value / inputValue / open state, items / filteredItems /\n * query derivation, and `isItemSelected`. DOM concerns (floating-ui\n * positioning, input element, keyboard nav, portal) live in the structural\n * `<Combobox.Root>` wrapper that composes this primitive.\n */\nexport function createCombobox<Value = unknown>(\n\toptions: CreateComboboxOptions<Value>,\n): ComboboxApi<Value> {\n\t// Freeze multi-select at init — the scalar vs. array value shape cannot\n\t// flip after mount (same pattern as the structural wrapper).\n\tconst isMultipleAtInit = untrack(\n\t\t() =>\n\t\t\treadOption(options.multiple) === true ||\n\t\t\treadOption(options.selectionMode) === \"multiple\",\n\t);\n\n\tconst selectionMode = createMemo<ComboboxSelectionMode>(\n\t\t() => {\n\t\t\tif (readOption(options.multiple) === true) return \"multiple\";\n\t\t\treturn (readOption(options.selectionMode) ??\n\t\t\t\t\"single\") as ComboboxSelectionMode;\n\t\t},\n\t\t{ name: \"combobox.selectionMode\" },\n\t);\n\n\tconst isSingle = createMemo<boolean>(() => selectionMode() === \"single\", {\n\t\tname: \"combobox.isSingle\",\n\t});\n\n\tconst disabled = createMemo<boolean>(\n\t\t() => Boolean(readOption(options.disabled)),\n\t\t{ name: \"combobox.disabled\" },\n\t);\n\n\tconst readOnly = createMemo<boolean>(\n\t\t() => Boolean(readOption(options.readOnly)),\n\t\t{ name: \"combobox.readOnly\" },\n\t);\n\n\tconst itemToStringLabel = createMemo<((item: Value) => string) | undefined>(\n\t\t() => readOption(options.itemToStringLabel),\n\t\t{ name: \"combobox.itemToStringLabel\" },\n\t);\n\n\tconst isItemEqualToValue = createMemo<ItemEqualityComparer<Value, Value>>(\n\t\t() =>\n\t\t\t(readOption(options.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\t{ name: \"combobox.isItemEqualToValue\" },\n\t);\n\n\t// Value — reads through the consumer's accessor.\n\tconst emptyArray: Value[] = [];\n\tconst value = createMemo<Value | Value[] | null>(\n\t\t() => {\n\t\t\tconst v = readOption(options.value);\n\t\t\tif (v === undefined)\n\t\t\t\treturn isMultipleAtInit ? (emptyArray as Value[]) : null;\n\t\t\treturn v ?? null;\n\t\t},\n\t\t{ name: \"combobox.value\" },\n\t);\n\n\t// inputValue — reads through the consumer's accessor if provided; otherwise\n\t// derives from the selected value label in single mode (computed default,\n\t// NOT internal state).\n\tconst inputValue = createMemo<string>(\n\t\t() => {\n\t\t\tconst iv = readOption(options.inputValue);\n\t\t\tif (iv !== undefined) return iv;\n\t\t\tif (isSingle()) {\n\t\t\t\tconst sv = readOption(options.value);\n\t\t\t\tif (sv === undefined || sv === null) return \"\";\n\t\t\t\tif (Array.isArray(sv)) return \"\";\n\t\t\t\treturn stringifyAsLabel(\n\t\t\t\t\tsv as Value,\n\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn \"\";\n\t\t},\n\t\t{ name: \"combobox.inputValue\" },\n\t);\n\n\t// Open — reads through the consumer's accessor.\n\tconst open = createMemo<boolean>(() => Boolean(readOption(options.open)), {\n\t\tname: \"combobox.open\",\n\t});\n\n\t// Items\n\tconst items = createMemo<\n\t\treadonly Value[] | readonly Group<Value>[] | undefined\n\t>(() => readOption(options.items), { name: \"combobox.items\" });\n\n\tconst isGrouped = createMemo<boolean>(\n\t\t() => isGroupedItems(items() as unknown[]),\n\t\t{ name: \"combobox.isGrouped\" },\n\t);\n\n\tconst query = createMemo<string>(() => inputValue().trim(), {\n\t\tname: \"combobox.query\",\n\t});\n\n\t// Filtering\n\tconst collatorFilter = createMemo<Filter>(\n\t\t() => getFilter({ locale: readOption(options.locale) }),\n\t\t{ name: \"combobox.collatorFilter\" },\n\t);\n\n\tconst resolvedFilter = createMemo<\n\t\t(\n\t\t\titem: Value,\n\t\t\tquery: string,\n\t\t\titemToStringLabel?: (item: Value) => string,\n\t\t) => boolean\n\t>(\n\t\t() => {\n\t\t\tconst userFilter = readOption(options.filter) as\n\t\t\t\t| ((item: Value, q: string) => boolean)\n\t\t\t\t| null\n\t\t\t\t| undefined;\n\t\t\tif (userFilter === null) return () => true;\n\t\t\tif (userFilter !== undefined) return userFilter;\n\t\t\tconst coll = collatorFilter();\n\t\t\tif (isSingle() && !readOption(options.queryChangedAfterOpen)) {\n\t\t\t\t// Read `value()` reactively so the filter re-derives when the\n\t\t\t\t// single selection changes (mirrors React's `selectedValue` dep).\n\t\t\t\tconst v = value();\n\t\t\t\treturn createSingleSelectionCollatorFilter(\n\t\t\t\t\tcoll,\n\t\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t\t\tArray.isArray(v) ? null : v,\n\t\t\t\t) as (item: Value, q: string) => boolean;\n\t\t\t}\n\t\t\treturn createCollatorItemFilter(\n\t\t\t\tcoll,\n\t\t\t\titemToStringLabel() as ((item: unknown) => string) | undefined,\n\t\t\t) as (item: Value, q: string) => boolean;\n\t\t},\n\t\t{ name: \"combobox.resolvedFilter\" },\n\t);\n\n\t// Mirrors React's `shouldBypassFiltering` + `filterQuery`: in single-select\n\t// mode, when the user hasn't typed since opening and the query exactly equals\n\t// the selected label, blank the effective query so the full list is shown.\n\tconst filterQuery = createMemo<string>(\n\t\t() => {\n\t\t\tconst q = query();\n\t\t\tif (q === \"\") return q;\n\t\t\tif (!isSingle() || readOption(options.queryChangedAfterOpen)) return q;\n\t\t\tconst v = value();\n\t\t\tconst selectedLabelString =\n\t\t\t\tv == null || Array.isArray(v)\n\t\t\t\t\t? \"\"\n\t\t\t\t\t: stringifyAsLabel(\n\t\t\t\t\t\t\tv 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\tconst shouldBypassFiltering =\n\t\t\t\tselectedLabelString !== \"\" &&\n\t\t\t\tselectedLabelString.length === q.length &&\n\t\t\t\tcollatorFilter().contains(selectedLabelString, q);\n\t\t\treturn shouldBypassFiltering ? \"\" : q;\n\t\t},\n\t\t{ name: \"combobox.filterQuery\" },\n\t);\n\n\tconst filteredItems = createMemo<readonly Value[] | readonly Group<Value>[]>(\n\t\t() => {\n\t\t\tconst list = items();\n\t\t\tif (!list) return [];\n\t\t\tconst filt = resolvedFilter();\n\t\t\tconst q = filterQuery();\n\t\t\tconst label = itemToStringLabel();\n\t\t\tif (isGrouped()) {\n\t\t\t\tconst groups = list as ReadonlyArray<Group<Value>>;\n\t\t\t\tconst out: Group<Value>[] = [];\n\t\t\t\tfor (const g of groups) {\n\t\t\t\t\tconst candidates =\n\t\t\t\t\t\tq === \"\" ? g.items : g.items.filter((item) => filt(item, q, label));\n\t\t\t\t\tif (candidates.length > 0) {\n\t\t\t\t\t\tout.push({ ...g, items: candidates });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\tif (q === \"\") return list as readonly Value[];\n\t\t\treturn (list as readonly Value[]).filter((item) => filt(item, q, label));\n\t\t},\n\t\t{ name: \"combobox.filteredItems\" },\n\t);\n\n\tconst flatFilteredItems = createMemo<readonly Value[]>(\n\t\t() => {\n\t\t\tconst fi = filteredItems();\n\t\t\tif (isGrouped()) {\n\t\t\t\treturn (fi as ReadonlyArray<Group<Value>>).flatMap(\n\t\t\t\t\t(g) => g.items as Value[],\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn fi as readonly Value[];\n\t\t},\n\t\t{ name: \"combobox.flatFilteredItems\" },\n\t);\n\n\t// isItemSelected — pure derivation, no reactive subscription needed.\n\tconst isItemSelected = (item: Value): boolean => {\n\t\tconst sv = value();\n\t\tif (sv == null) return false;\n\t\tif (Array.isArray(sv)) {\n\t\t\treturn selectedValueIncludes(\n\t\t\t\tsv as Value[],\n\t\t\t\titem,\n\t\t\t\tisItemEqualToValue() as ItemEqualityComparer<Value, Value>,\n\t\t\t);\n\t\t}\n\t\treturn isItemEqualToValue()(item, sv as Value);\n\t};\n\n\t// Pure event-emitters — fire onXxxChange; the consumer is the only writer\n\t// of their signal. runWithOwner(null, ...) escapes the reactive owner so\n\t// signal writes inside the callback don't trigger SIGNAL_WRITE_IN_OWNED_SCOPE.\n\tconst setValue = (\n\t\tnext: Value | Value[] | null,\n\t\treason: ComboboxChangeReason = \"imperative\",\n\t): void => {\n\t\trunWithOwner(null, () => options.onValueChange?.(next, reason));\n\t};\n\n\tconst setInputValue = (\n\t\tnext: string,\n\t\treason: ComboboxChangeReason = \"imperative\",\n\t): void => {\n\t\trunWithOwner(null, () => options.onInputValueChange?.(next, reason));\n\t};\n\n\tconst setOpen = (\n\t\tnext: boolean,\n\t\treason: ComboboxChangeReason = \"imperative\",\n\t): void => {\n\t\trunWithOwner(null, () => options.onOpenChange?.(next, reason));\n\t};\n\n\tconst api: ComboboxApi<Value> = {\n\t\tvalue,\n\t\tinputValue,\n\t\topen,\n\t\tselectionMode,\n\t\tdisabled,\n\t\treadOnly,\n\t\titems,\n\t\tfilteredItems,\n\t\tflatFilteredItems,\n\t\tquery,\n\t\tisGrouped,\n\t\tisItemSelected,\n\t\tsetValue,\n\t\tsetInputValue,\n\t\tsetOpen,\n\t\tProvider: (props) => (\n\t\t\t<ComboboxContext value={api as ComboboxApi<unknown>}>\n\t\t\t\t{props.children}\n\t\t\t</ComboboxContext>\n\t\t),\n\t};\n\n\t(api as ComboboxApi<Value> & Snapshottable)[SNAPSHOT_KEYS] =\n\t\tCOMBOBOX_SNAPSHOT_KEYS;\n\n\treturn api;\n}\n\nconst COMBOBOX_SNAPSHOT_KEYS = snapshotKeys<ComboboxApi>(\n\t\"value\",\n\t\"inputValue\",\n\t\"open\",\n\t\"selectionMode\",\n\t\"disabled\",\n\t\"readOnly\",\n\t\"query\",\n);\n"],"mappings":"AACA,SAECA,aAAa,EACbC,UAAU,EACVC,YAAY,EACZC,OAAO,EACPC,UAAU,QACJ,UAAU;AACjB,SAA6BC,UAAU,QAAQ,6BAA6B;AAC5E,SACCC,aAAa,EAEbC,YAAY,QACN,qCAAqC;AAC5C,SACCC,wBAAwB,EACxBC,mCAAmC,EAEnCC,SAAS,QACH,oBAAoB;AAC3B,SACCC,mBAAmB,EAEnBC,qBAAqB,QACf,2BAA2B;AAClC,SAECC,cAAc,EACdC,gBAAgB,QACV,iCAAiC;;AAExC;AACA;AACA;;AAgIA;AACA;AACA;;AAEA,MAAMC,eAAe,GAAGf,aAAa,CAA8B,IAAI,CAAC;AAExE,OAAO,SAASgB,WAAWA,CAAA,EAAwC;EAClE,MAAMC,GAAG,GAAGb,UAAU,CAACW,eAAe,CAAC;EACvC,IAAIE,GAAG,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIC,KAAK,CACd,8DACD,CAAC;EACF;EACA,OAAOD,GAAG;AACX;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,cAAcA,CAC7BC,OAAqC,EAChB;EACrB;EACA;EACA,MAAMC,gBAAgB,GAAGlB,OAAO,CAC/B,MACCE,UAAU,CAACe,OAAO,CAACE,QAAQ,CAAC,KAAK,IAAI,IACrCjB,UAAU,CAACe,OAAO,CAACG,aAAa,CAAC,KAAK,UACxC,CAAC;EAED,MAAMA,aAAa,GAAGtB,UAAU,CAC/B,MAAM;IACL,IAAII,UA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