UNPKG

@llselect/core

Version:

Low-level select: a minimal, flexible, framework-agnostic replacement for the native HTML select element.

3,588 lines • 207 kB
import { type LLSelectWidthPolicy } from './positioning.js';
import { type LLSelectScrollGesture, type LLSelectScrollGestureBehavior, type LLSelectZoomGesture, type LLSelectZoomGestureBehavior } from './behaviors.js';
import type { LLSelectUiTranslationPack } from './i18n.js';
import { type LLSelectColorScheme } from './color-scheme.js';
/**
 * What a click outside the select component does while the popup is open.
 *
 * - `'block'` (default): the popup closes, and the click does nothing else.
 *   - The click never reaches the element under it, so neither that
 *     element's handlers nor its default action run, such as following a
 *     link.
 *   - The browser moves no focus at the press, so focus that was in the
 *     select component stays there.
 *   - A handler of the page can still move focus during the press.
 *   - A user who only wants to close the popup cannot press a button or a
 *     link by mistake.
 * - `'pass-through'`: the popup closes, and the click also does what it
 *   would do without the popup, such as pressing a button.
 * - A preset of `@llselect/core/behavior-presets` sets this too.
 * @group Settings
 * @category Base
 */
export type LLSelectOutsideClickBehavior = 'pass-through' | 'block';
/**
 * Who initiated a chosen-state change, delivered to `onChange` as
 * `meta.source`.
 * - `'user'`: a pointer or keyboard interaction inside the select component -
 *   an option toggle, a tag's remove button, the clear button, the choose-all
 *   row, an action row's `onActivate`.
 * - `'api'`: any programmatic call - `setChosenItem` / `setChosenItems`,
 *   `toggleItem`, the `choose*` bulk ops, `setItems` reconciliation.
 * - Only the first chosen-state change of one interaction reports `'user'`.
 *   A later change in the same interaction reports `'api'`.
 * - One exception today: a `setItems` call inside an action row's
 *   `onActivate`, before any other chosen-state change, has its
 *   reconciliation report `'user'`.
 * @group Events
 */
export type LLSelectChangeSource = 'user' | 'api';
/**
 * What a chosen-state change did to the data, delivered to `onChange` as
 * `meta.reason`.
 * - It names the operation. `meta.source` names who started it.
 * - A single-item operation keeps its reason even when the result is empty.
 * - In multiple mode, a whole-value write or a bulk op reads its result:
 *   empty is `'clear'`, otherwise `'set'`.
 * - In single mode, setting an item is `'choose'` and the empty write is
 *   `'clear'`.
 * - `'choose'`: one item was added, or the single value was set to an item.
 * - `'unchoose'`: one item was removed, even when that empties the selection.
 * - `'clear'`: an empty whole-value write - the clear button,
 *   `setChosenItem(undefined)`, `setChosenItems([])`, or a bulk op whose
 *   result is empty.
 * - `'set'`: a whole-value write with items (`setChosenItems`), or a bulk op
 *   whose result is not empty (a `choose*` method, the choose-all row).
 * - `'items'`: a `setItems` call dropped or reordered chosen entries, even
 *   when that empties the selection.
 * - `meta.item` holds the one item of a `'choose'` or `'unchoose'`.
 * @group Events
 */
export type LLSelectChangeReason = 'choose' | 'unchoose' | 'clear' | 'set' | 'items';
/**
 * Why the popup opened: the value of `meta.reason` in {@link LLSelectOpenMeta}.
 * - `'toggle'`: a click in the trigger wrapper, or a `toggle()` call.
 * - `'keyboard'`: ArrowDown, ArrowUp, Enter or Space on the closed trigger.
 * - `'typeahead'`: a printable character typed on the closed trigger.
 * - `'api'`: an `open()` call.
 * @group Events
 */
export type LLSelectOpenReason = 'toggle' | 'keyboard' | 'typeahead' | 'api';
/**
 * `onOpen`'s argument.
 * @group Events
 */
export interface LLSelectOpenMeta {
    /** Why the popup opened. See {@link LLSelectOpenReason}. */
    reason: LLSelectOpenReason;
}
/**
 * Why the popup closed: the value of `meta.reason` in {@link LLSelectCloseMeta}.
 * - `'choose'`: a pick in single mode, vetoed or not; a veto stops the
 *   value, not the close.
 * - `'escape'`: Escape or Alt+ArrowUp on the trigger or the filter input,
 *   and Escape on a control the app placed in a header / footer slot.
 * - `'outside'`: a mousedown or click outside the select component.
 * - `'blur'`: DOM focus left the select component.
 * - `'trigger-buttons'`: DOM focus moved into the trigger buttons strip
 *   while the popup was open, by script or a screen reader's cursor. The
 *   strip is inside the select component, so `onBlur` does not fire.
 * - `'toggle'`: a click in the trigger wrapper, or a `toggle()` call.
 * - `'api'`: a `close()` call.
 * - `'disabled'`: `setDisabled(true)`.
 * - `'destroy'`: `destroy()`.
 * - `'hidden'`: the trigger scrolled out of view or was clipped, so the
 *   popup could not stay anchored.
 * - `'scroll-gesture'`: a wheel or a touch while the popup was open, for
 *   which `behaviorOfScrollGestureFn` picked a behavior that closes the
 *   popup, or an override of the protected `behaviorOfScrollGesture` did.
 *   `meta.scrollGesture` holds the gesture.
 * - `'zoom-gesture'`: a two-finger zoom, or a `wheel` with `ctrlKey`, while
 *   the popup was open, for which `behaviorOfZoomGestureFn` picked a behavior
 *   that closes the popup, or an override of the protected
 *   `behaviorOfZoomGesture` did. `meta.zoomGesture` holds the gesture.
 * @group Events
 */
export type LLSelectCloseReason = 'choose' | 'escape' | 'outside' | 'blur' | 'trigger-buttons' | 'toggle' | 'api' | 'disabled' | 'destroy' | 'hidden' | 'scroll-gesture' | 'zoom-gesture';
/**
 * `onClose`'s argument.
 * @group Events
 */
export interface LLSelectCloseMeta {
    /** Why the popup closed. See {@link LLSelectCloseReason}. */
    reason: LLSelectCloseReason;
    /**
     * The gesture that closed the popup, when `reason` is `'scroll-gesture'`.
     * - `undefined` for every other reason.
     */
    scrollGesture?: LLSelectScrollGesture;
    /**
     * The gesture that closed the popup, when `reason` is `'zoom-gesture'`.
     * - `undefined` for every other reason.
     */
    zoomGesture?: LLSelectZoomGesture;
}
/**
 * The part of `onChange`'s third argument that both shapes share: who started
 * the change and what it did. See {@link LLSelectChangeMeta} for the shapes.
 * @group Events
 */
export interface LLSelectBaseChangeMeta {
    /** Who started the change. See {@link LLSelectChangeSource}. */
    source: LLSelectChangeSource;
    /**
     * What the change did to the data, whoever started it.
     * - `'choose'`: one item was added, or the single value was set to an item.
     * - `'unchoose'`: one item was removed.
     * - `'clear'`: an empty whole-value write, or a bulk op whose result is empty.
     * - `'set'`: a whole-value write with items, or a bulk op whose result is not empty.
     * - `'items'`: a `setItems` call dropped or reordered chosen entries.
     * - See {@link LLSelectChangeReason} for which operation gets which value.
     */
    reason: LLSelectChangeReason;
}
/**
 * `onChange`'s third argument when one item was added or removed.
 * - `reason` is `'choose'` or `'unchoose'`.
 * - `item` is that one item, always present.
 * @group Events
 */
export interface LLSelectItemChangeMeta<T> extends LLSelectBaseChangeMeta {
    reason: 'choose' | 'unchoose';
    /**
     * The one item that was added or removed.
     * - On `'unchoose'` it is the stored entry, not an equal object the caller
     *   passed to `toggleItem`.
     */
    item: T;
}
/**
 * `onChange`'s third argument when the whole value changed at once.
 * - `reason` is `'clear'`, `'set'` or `'items'`.
 * - There is no single item, so `item` is never present.
 * @group Events
 */
export interface LLSelectWholeValueChangeMeta extends LLSelectBaseChangeMeta {
    reason: 'clear' | 'set' | 'items';
    /** Never present: these reasons concern the whole value. */
    item?: never;
}
/**
 * Extra facts about one `onChange` firing, as the callback's third argument.
 * - A discriminated union on `reason`: after `if (meta.reason === 'choose')`
 *   the type of `meta.item` is `T`, with no `undefined`.
 * - `T` is the item type. It defaults to `unknown`, so a bare
 *   `LLSelectChangeMeta` annotation keeps compiling.
 * - An object on purpose: future fields can be added without breaking the
 *   callback signature.
 * @group Events
 */
export type LLSelectChangeMeta<T = unknown> = LLSelectItemChangeMeta<T> | LLSelectWholeValueChangeMeta;
/**
 * The argument of `onBeforeChange` and `onChosenChanging`: what a user change
 * is about to do, and the way to stop it.
 * - The same facts as {@link LLSelectChangeMeta}, read-only: `source`,
 *   `reason`, and `item` for a `'choose'` or `'unchoose'`.
 * - After `if (event.reason === 'choose')` the type of `event.item` is `T`.
 * @group Events
 */
export type LLSelectBeforeChangeEvent<T = unknown> = Readonly<LLSelectChangeMeta<T>> & {
    /** Always `'user'`: only the library's own pointer and keyboard paths dispatch it. */
    readonly source: 'user';
    /** Never `'items'`: the `setItems` reconciliation is not a user change. */
    readonly reason: Exclude<LLSelectChangeReason, 'items'>;
    /** `true` once `preventDefault()` was called while the hook or the setting ran; a later call does nothing. */
    readonly defaultPrevented: boolean;
    /**
     * Stop the change: nothing is written, nothing re-renders, `onChange` does
     * not fire.
     * - Counts only while the hook and the setting run. A call after they
     *   returned does nothing.
     */
    preventDefault(): void;
};
/**
 * One app command rendered by the library as a `role="option"` row inside the
 * popup list: the entries of `popupListLeadingActionRows` /
 * `popupListTrailingActionRows`.
 * - The library builds the row element (id, `role="option"`, classes,
 *   `aria-label`, `aria-disabled`, click and Enter); this object supplies
 *   only the text, the optional rich content, the disabled state and what
 *   activation does.
 * - `textFn` is the accessible name, and the visible text when there is no
 *   custom content. It is re-read on every row render, so copy can follow
 *   app state or a language switch.
 * - `createContentElFn`: rich visible content; `null` / omitted = plain text
 *   from `textFn`. Put no focusable control inside: the row itself is the
 *   control.
 * - `disabledFn`: `null` / omitted = never disabled. Re-read on every row
 *   render and again at activation. A disabled row is skipped by the arrow
 *   keys and cannot be activated.
 * - `onActivate` runs on Enter, on Space while the filter is inactive, and on
 *   click. The library changes nothing else: choosing and closing are this
 *   callback's job (call `setChosenItems` / `close()` yourself). Synchronous
 *   work runs with the change source `'user'`; a change made after an
 *   `await` reports `'api'`.
 * - Rows are rebuilt on every list render and after every chosen change, so
 *   the three functions may read live state. They receive no parameters:
 *   close over your instance variable.
 * @group Action rows
 */
export interface LLSelectPopupListActionRow {
    textFn: () => string;
    createContentElFn?: (() => HTMLElement | null) | null;
    disabledFn?: (() => boolean) | null;
    onActivate: () => void;
}
/**
 * What a settings function may read while the instance is still being built.
 * - Only two settings functions receive it: `createPopupHeaderContentElFn`
 *   and `createPopupFooterContentElFn`. The trigger content functions also
 *   run during construction, but they get their own data instead and rerun
 *   on every render.
 * - `new` has not returned yet. The variable that will hold the instance is
 *   still empty. Do not read it here.
 * - `classIdMap`: the resolved class and id names.
 * - `uiTranslationPack`: the resolved translation pack.
 * - If you need the instance, do that work in an event handler on the element
 *   you return. Handlers run after `new` returns.
 * @group Popup slots
 */
export interface LLSelectConstructionContext {
    readonly classIdMap: Readonly<LLSelectClassIdMap>;
    readonly uiTranslationPack: Readonly<LLSelectUiTranslationPack>;
}
/**
 * Resolved (defaults applied) settings shared by all select component
 * variants. Subclasses (`LLSelectSingle`, `LLSelectMultiple`) extend this with
 * their mode-specific options such as `onChange`.
 *
 * Settings are frozen after the constructor. What still changes at runtime:
 * - State changes by method, and never was a setting: the items
 *   (`setItems`), the chosen value (`setChosenItem` / `setChosenItems`),
 *   `disabled` (`setDisabled`).
 * - Two settings have a setter, because they are text: `uiTranslationPack`
 *   (`setUiTranslationPack`) and `placeholder` (`setPlaceholder`).
 * - Every other setting is fixed for the instance's lifetime.
 * - To change a fixed setting, build a new instance. One build takes about
 *   0.2 ms.
 * - If a setting must vary at runtime, use its function form where one
 *   exists. `filterable: (items) => boolean` is re-evaluated on every open
 *   (and consulted by closed-state typeahead - see the setting).
 * - A function setting that builds content or decides something must not
 *   change the select component:
 *   - Such settings are the content functions, like
 *     `createPopupListItemContentElFn`, and the predicates and mappers, like
 *     `itemDisabledFn` and `itemToStringFn`.
 *   - The library calls them while it builds or checks something, so a
 *     change made there can leave outdated rows in the popup.
 *   - A change is a call of a method such as `close()`, `destroy()`,
 *     `setItems()`, `rerender()` or `setChosenItem()`.
 *   - To change the select component, use an event callback, a setting named
 *     `on...`, or call the method after the function has returned.
 *   - If such a function closes or destroys the select component during
 *     `open()` all the same, `open()` stops and leaves no listener behind.
 *   - The library promises nothing more for that case.
 * @group Settings
 * @category Base
 */
export interface LLSelectBaseSettings<T, GroupKey = string> {
    /**
     * Prefix used for every CSS class and DOM id the library generates
     * (default `'llselect'`). NOTE: the shipped themes target the default
     * prefix only - a custom prefix means bringing your own CSS. Reference the
     * resolved names via `instance.classIdMap` instead of hardcoding strings.
     * @group CSS
     */
    cssClassPrefix: string;
    /**
     * Text shown in the trigger when nothing is selected. App copy: an explicit
     * value always wins; when unset, the locale default
     * `uiTranslationPack.triggerPlaceholder` is used (`'Please select'` in English).
     * @group Trigger
     */
    placeholder: string;
    /**
     * Accessible name of the field, like the `<label>` text of a native
     * `<select>` (e.g. `'Country'`).
     * - Applied to the trigger, the popup listbox, and (while the filter is active)
     *   the filter input; per-mode wiring: `docs/llm/A11Y.md` "Accessible name".
     * - The name resolves by the FIRST set rung, mirroring the W3C
     *   accessible-name computation order:
     *   1. `ariaLabelledBy`.
     *   2. `ariaLabel` (this setting).
     *   3. `labelEl` - its element's id becomes the resolved `ariaLabelledBy`.
     *   4. None set: the field is unnamed. A combobox requires a name
     *      (WAI-ARIA 1.2), so one `console.warn` per page reports the first
     *      offender.
     * - `null` (default): this rung is skipped. An empty or whitespace-only
     *   string counts as unset too - the accname computation skips a blank
     *   `aria-label`, and so does the ladder.
     * @group Accessible name
     */
    ariaLabel: string | null;
    /**
     * Space-separated DOM id(s) of the visible label element(s) naming the
     * field; forwarded as `aria-labelledby` to the same elements as `ariaLabel`.
     * - Prefer this over `ariaLabel` when a visible label element exists: the
     *   spoken name then always matches the visible text.
     * - `null` (default): not forwarded; see `ariaLabel` for the naming
     *   requirement. An empty or whitespace-only string counts as unset too,
     *   same as `ariaLabel`.
     * - Rung 1 of the resolution order (the numbered list at `ariaLabel`): it
     *   wins whenever set, matching the ARIA name computation.
     * @group Accessible name
     */
    ariaLabelledBy: string | null;
    /**
     * The select component's visible label element - the one foreign element the library
     * touches. Emulates native `<label for>` (which cannot target these divs)
     * in both directions:
     * - Kept **by reference**: the library reads the element's `id` once, at construction, and, when neither `ariaLabel` nor `ariaLabelledBy` is given, points `aria-labelledby` at it; assistive technology then reads the element's current text, so later text changes stay correct, while a later `id` change does not.
     * - clicking it focuses the trigger (focus ONLY; native `<select>` does not
     *   open on label click, neither does this);
     * - it feeds the accessible name as rung 3 of the resolution order (the
     *   numbered list at `ariaLabel`): with neither aria setting given, the
     *   label's id becomes the resolved `ariaLabelledBy` (an id is minted from
     *   `classIdMap.labelId` if the element has none).
     * - `null` = no label element; the name ladder just skips this rung.
     * - `destroy()` removes the click listener and a minted id.
     * @group Accessible name
     */
    labelEl: HTMLElement | null;
    /**
     * Equality predicate for item values - return `true` when `a` and `b` are the
     * same item.
     * - Called **every** time the library compares two items; nothing is kept for a later call, except that the multiple select component reuses its `hideChosenRows` subtraction until the base visible list (gathered, then filtered) or the chosen list is replaced:
     *   - on each row render and in-place row rebuild (the chosen check: `isChosen` in the multiple select component, the `aria-selected` compare in the single select component), on each selection change, on open, on each active-row move between two item rows (the new active item is compared with the last reported one), on typeahead, in the `setItems` reconciliation, in `hideChosenRows` filtering, and in `'as-listed'` ordering;
     *   - a custom function pays this on every call; in the multiple select component the default is skipped by `Set`- and `Map`-based fast paths and by the duplicate-items warning, while the single select component calls it as given.
     * - Required for non-primitive `T`. The default compares by identity:
     *   `===`, except that `NaN` equals `NaN` (SameValueZero, the same rule
     *   `Set` uses), so every code path agrees on what "the same item" means.
     * - Used for selection, dedup, and matching the chosen item back to the list.
     * - Symmetric: the result must not depend on argument order.
     * @group Items
     */
    compareFn: (a: T, b: T) => boolean;
    /**
     * See {@link LLSelectOutsideClickBehavior}.
     * @group Behaviors
     */
    behaviorOfOutsideClick: LLSelectOutsideClickBehavior;
    /**
     * Decides what the select component does with a scroll gesture, a wheel or
     * a touch, while the popup is open.
     * - Called on **every** scroll gesture while the popup is open, through
     *   the protected `behaviorOfScrollGesture`; nothing is kept for a later
     *   call. A scroll gesture is each `wheel` event, and each `touchstart`
     *   and `touchmove` of a one-finger touch.
     *   - Inside the popup, a wheel or a drag that an element of the popup
     *     can still scroll is left to the browser, and the function is not
     *     called. A touch-down always reaches the function, since it has no
     *     direction yet.
     *   - Outside the select component, the function is called only while
     *     the protected `shouldListenForScrollGesturesOutside` returns `true`.
     *     By default, that is while this setting is not
     *     `defaultBehaviorOfScrollGesture`.
     *   - The function is never called for a `wheel` with `ctrlKey`, or for a
     *     touch from the moment a second finger lands. Those are zoom
     *     gestures, which `behaviorOfZoomGestureFn` answers.
     *   - So that a preset never changes its behavior because of a zoom that
     *     the user may not notice, the function is also called while the page
     *     is pinch-zoomed.
     *   - A pinch starts with one finger, so the function sees the touch-down
     *     of that finger. A preset that closes at a touch-down closes the
     *     popup there, before the zoom begins.
     *   - In a closed shadow root around the select component, the document
     *     sees no deeper than the shadow host. While the library listens
     *     outside, a gesture inside the select component then reaches the
     *     function as `'outside'` before the listeners inside see it.
     *   - A preset may then close the popup at a touch-down or a wheel inside
     *     the select component, and block a wheel that the list could scroll.
     *   - If `behaviorOfOutsideClick` is `'block'`, the default, the click of a
     *     tap whose touch-down closed the popup is swallowed, as for any
     *     outside press.
     *   - If it is `'pass-through'`, that click gets through. A tap on the
     *     trigger then reopens the popup, and the click of a tap inside the
     *     popup may reach the page under the closed popup.
     *   - An open shadow root does not have this limit.
     * - `gesture` says what the gesture is and where it happens. See
     *   {@link LLSelectScrollGesture}.
     * - The answer is one of four behaviors. See
     *   {@link LLSelectScrollGestureBehavior}.
     * - The default is `defaultBehaviorOfScrollGesture`. Inside the popup, the
     *   page behind does not scroll. Everywhere else, the page scrolls as it
     *   would without the select component, and the popup stays open.
     * - `@llselect/core/behavior-presets` holds other functions, as presets
     *   to spread into the settings, such as `behaviorPresetsOfFirefoxOnWindows`.
     * - The popup list also has the CSS property `overscroll-behavior: contain`.
     *   - It covers a touch scroll that has already started in the list. The
     *     browser no longer lets a script cancel such a touch, so the function
     *     cannot stop it.
     *   - The property asks the browser not to pass that scroll on to the page
     *     when the list reaches its end.
     *   - Over the list, the browser may still stop a scroll that the
     *     function allows, at the end of the list.
     *   - Safari supports the property from version 16.
     * @group Behaviors
     */
    behaviorOfScrollGestureFn: (gesture: LLSelectScrollGesture) => LLSelectScrollGestureBehavior;
    /**
     * Decides what the select component does with a zoom gesture while the
     * popup is open.
     * - Called through the protected `behaviorOfZoomGesture`, while the popup
     *   is open:
     *   - on a touchscreen, **once** per touch, when a second finger lands; the
     *     library keeps the answer until every finger lifts;
     *   - on **every** `wheel` with `ctrlKey`, which Ctrl with a mouse wheel
     *     gives, and a touchpad pinch in Chromium too; nothing is kept for the
     *     next wheel.
     *   - Outside the select component, the function is called only while
     *     the protected `shouldListenForZoomGesturesOutside` returns `true`.
     *     By default, that is while this setting is not
     *     `defaultBehaviorOfZoomGesture`.
     *   - The function is also called while the page is pinch-zoomed, so a
     *     zoom back out reaches it too.
     *   - A pinch starts with one finger, whose touch-down
     *     `behaviorOfScrollGestureFn` answers first. A preset that closes the
     *     popup at that touch-down closes it before the zoom begins, and this
     *     function is not called.
     * - `gesture` says where the zoom happens. See {@link LLSelectZoomGesture}.
     * - The answer is one of four behaviors. See
     *   {@link LLSelectZoomGestureBehavior}.
     * - The default is `defaultBehaviorOfZoomGesture`: every zoom zooms the
     *   page, and the popup stays open.
     * - Even with the default, the `touchstart` listeners on the popup and the
     *   root element are not passive, so that a zoom can cancel the touch-down
     *   of a further finger.
     * - A touch scroll that starts on the select component therefore waits for
     *   those listeners.
     * - `@llselect/core/behavior-presets` holds other functions, as presets
     *   to spread into the settings, such as `behaviorPresetsOfFirefoxOnWindows`.
     * @group Behaviors
     */
    behaviorOfZoomGestureFn: (gesture: LLSelectZoomGesture) => LLSelectZoomGestureBehavior;
    /**
     * Which color scheme the select component shows: light or dark.
     * - `'auto'`, the default: the library chooses the scheme from the two CSS sources below.
     * - `'light'` or `'dark'`: the select component shows that scheme. The CSS sources and the operating system do not matter. The bootstrap-5 theme still takes its colors from Bootstrap's own CSS variables, which turn dark only under `data-bs-theme="dark"`; see the README section "Dark color scheme".
     * - For `'auto'`, the library checks two sources in order. The root element is the element the select component is mounted on, class `llselect-root`.
     *   1. The CSS variable `--llselect-color-scheme`, from the root element's computed style. The root or any ancestor may set it. The root's own declaration wins; otherwise the nearest ancestor's value is inherited. The value `light` or `dark` is the answer. The value `auto` follows the operating system's color preference: dark when dark is preferred, otherwise light. If the variable is not set, or has any other value, the library checks the next source.
     *   2. The CSS property `color-scheme`, from the root element's computed style. If it does not list `dark`, the answer is light. If it lists `dark` without `light`, the answer is dark. If it lists both, the answer follows the operating system's color preference. This is the property that also drives native form controls.
     * - So the select component uses light when the variable is not set and the property does not list `dark`. This holds on a dark operating system too.
     * - The themes set `--llselect-color-scheme` for these classes: `dark`, `theme-dark`, `dark-mode`, `theme-light`, `light-mode`. They recognize the attributes `data-theme` and `data-bs-theme` with the value `light` or `dark`. They recognize `data-color-scheme` with the value `light`, `dark` or `auto`. These classes and attributes count on the root element or on any ancestor. If your page selects the scheme with another class or attribute, add one CSS rule, for example `.night { --llselect-color-scheme: dark; }`.
     * - The result is written to the root element as `data-llselect-color-scheme="light"` or `data-llselect-color-scheme="dark"`. The themes apply their dark colors when the value is `dark`. Do not write that attribute yourself. This attribute name and the `--llselect-*` variable names are fixed; `cssClassPrefix` does not change them.
     * - If `colorScheme` is `'auto'`, the library queues the first check during construction. The check runs after the current script finishes, before the browser paints again. If `colorScheme` is `'light'` or `'dark'`, the library writes that value to the attribute during construction.
     * - Until the first check runs, the attribute holds a provisional value. The value is the latest `'auto'` result in the same document, or `light` if there is none yet. Only a result for a root inside the document counts.
     * - The library also checks when `open()` or `refreshColorScheme()` runs. It checks when the operating system's color preference changes. It also checks when an attribute of `<html>` or `<body>` changes.
     * - If the select component is inside a shadow root, an operating-system change does not reach it, and neither does an attribute change on `<html>` or `<body>`. The select component still checks when `open()` or `refreshColorScheme()` runs.
     * - `getColorScheme()` returns the result. If the library has not checked this select component yet, `getColorScheme()` checks at once and returns the scheme.
     * - An early check does not cancel the first queued check.
     * - For a select component inside another select component's trigger or popup, the first queued check can still change the result.
     * @group Color scheme
     */
    colorScheme: LLSelectColorScheme;
    /**
     * The trigger arrow slot's content ELEMENT (typically a dropdown chevron or
     * triangle).
     * - Called on **every** open and close, and on **every** full trigger render (`renderTrigger`: construction in the shipped classes, a selection change, `rerender()`, `setPlaceholder()` with a changed argument, `setUiTranslationPack()`, and a `setItems` that drops or reorders chosen items); nothing is kept for a later call.
     *   - The returned element can vary with `isOpened`.
     *   - A `setItems` that leaves the selection as it is re-renders the trigger content only and does not call it.
     * - fn returns `null` - no arrow for that state.
     * - setting is `null` (default) - the library adds nothing to the arrow slot.
     * - The shipped themes turn the arrow half a turn while the popup is open.
     * - The shipped themes do not turn a returned element that carries the attribute `data-llselect-no-rotate`.
     *   - The built-in `createChevronUpDownSvgEl` and `createTriangleUpDownSvgEl` carry it, since an icon that points both up and down has no direction to turn.
     *   - To keep your own icon still, give the returned element that attribute.
     *   - The themes find the attribute with the CSS `:has()` selector.
     *   - Chrome before 105, Firefox before 121 and Safari before 15.4 lack `:has()`, so these browsers still turn the arrow.
     * @group Trigger
     */
    createTriggerArrowContentElFn: ((state: {
        isOpened: boolean;
    }) => HTMLElement | SVGElement | null) | null;
    /**
     * Whether the trigger shows a clear (x) button that empties the selection.
     * - Default `false`.
     * - Clearing sets the empty value: `undefined` for a single
     *   select component, `[]` for a multiple select component. It goes through
     *   the normal setters, so `onChange` fires with that empty value. There is
     *   no separate clear event.
     * - The empty value is not configurable, and no library makes it so:
     *   "nothing chosen" already exists before the first choice, so the value
     *   types carry `undefined` either way.
     * - If your model is a plain type like `string` and must never hold
     *   `undefined`, pick one of these:
     *   - Add a real "none" item (for example `''` shown as "(none)") and skip
     *     `clearable`. The model then stays `string` after the first choice,
     *     exactly like a native `<select>` with a placeholder option.
     *   - Keep `clearable` and coerce in `onChange`: `item ?? ''`.
     * - "Clear" means back to empty and the placeholder, never "back to some
     *   default option". If you want a default instead, set it yourself in
     *   `onChange`.
     * - The button sits in the trigger buttons strip, `triggerButtonsEl`,
     *   beside the trigger, so it never collides with `createTriggerContentElFn`
     *   and its name never enters the trigger's value.
     * - It carries an `aria-label`, and the strip makes it a Tab stop.
     * - The library hides the strip while nothing is selected.
     * @group Trigger
     */
    clearable: boolean;
    /**
     * Content ELEMENT of the clear button (its x icon), mirroring `createTriggerArrowContentElFn`.
     * - Called on **every** full trigger render (`renderTrigger`: construction in the shipped classes, a selection change, `rerender()`, `setPlaceholder()` with a changed argument, `setUiTranslationPack()`, and a `setItems` that drops or reorders chosen items) while `clearable` is on; nothing is kept for a later call. A `setItems` that leaves the selection as it is does not call it.
     * `null` (default) = the theme's CSS glyph. The library always owns the button,
     * its click (clears + stops propagation) and aria; this only fills the icon.
     * @group Trigger
     */
    createTriggerClearButtonContentElFn: (() => HTMLElement | SVGElement | null) | null;
    /**
     * Whether the popup includes a filter input.
     * - `false` (default): never.
     * - `true`: always.
     * - Predicate `(items) => boolean`: conditional. E.g. `filterable: (items) => items.length > 10`.
     *   - Called **once** at construction with the empty item list (`setItems` has not run yet), and at **every** open with the current full item list; never mid-open, so a `setItems` crossing the threshold applies on the next open.
     *   - A printable key pressed while closed also calls it, read-only, to decide whether prefix typeahead may take the key; keep it cheap and side-effect free.
     * - The value evaluated at an open sets the ARIA mode for that open cycle.
     *   - While the filter is active, the trigger has `role="button"`, and the open moves DOM focus to the filter input.
     *   - While the filter is inactive, the select component behaves as with `filterable: false`: the trigger keeps `role="combobox"`, and the library moves no DOM focus at the open.
     * - In either mode, while `open()` runs `showPopover()`, a browser with the Popover API focuses a control in a header or footer slot that has the `autofocus` attribute.
     *   - While the filter is active, the library then moves DOM focus on to the filter input.
     *   - While the filter is inactive, DOM focus stays on that control.
     * - See `docs/llm/A11Y.md` and `docs/llm/DESIGN.md`.
     * @group Filtering
     */
    filterable: boolean | ((items: readonly T[]) => boolean);
    /**
     * Chrome strings (AT labels + generated text): the i18n customization point. Resolved
     * against English: pass a language pack whole (`uiTranslationPack: zhTW` from
     * `@llselect/core/i18n`) or override single keys
     * (`uiTranslationPack: { ...zhTW, filterInputPlaceholder: '...' }`).
     * Key-by-key contract (incl. what `null` means where allowed):
     * {@link LLSelectUiTranslationPack}.
     * - Copied **once** at construction, as a shallow merge over the English defaults: later changes to your object do nothing, and `setUiTranslationPack()` replaces the copy. The pack's functions, such as `triggerContentCountText`, run at each render that needs them.
     * @group i18n
     */
    uiTranslationPack: LLSelectUiTranslationPack;
    /**
     * Predicate used by the filter input; return `true` to keep the item.
     * `null` (default) means the built-in case-insensitive substring match
     * against the item's resolved text (`itemToStringFn` / `itemToString`).
     * Pass a custom function for fuzzy / domain-specific matching.
     * - Called once per candidate item on **every** recompute of the filtered list with a non-empty query:
     *   - on each filter input event outside an IME composition, and at the composition's end;
     *   - on `setItems`, `rerender()` and a bulk selection write of the multiple select component (`setChosenItems` and the choose-all methods, which run `rerender()`) while the popup is open with a query;
     *   - never on open, which clears the query;
     *   - the matching subset is kept until the next recompute or the close that clears the query; nothing else is kept.
     * - `query` is the RAW input value: not trimmed and not lower-cased. Normalize
     *   it yourself (the built-in lower-cases both sides; it does not trim).
     * - Not called while the query is empty (an empty box shows every item), but a
     *   whitespace-only query (e.g. `"  "`) does call it.
     * @group Filtering
     */
    filterFn: ((item: T, query: string) => boolean) | null;
    /**
     * The no-results message's visible content ELEMENT, without subclassing.
     * Mirrors `createPopupListItemContentElFn`: the library owns the message container
     * (`role="status"`, class, show/hide), this fills its content only.
     * - Called **every** time a full list render (`renderPopupList`, only while the popup is open: on open, on each filter input event outside an IME composition, at the composition's end, and on the Esc that clears the query, on `setItems`, `rerender()` and a bulk selection write of the multiple select component (`setChosenItems` and the choose-all methods), and on `toggleItem` while `hideChosenRows` is on or when its choose-all row rebuild falls back to a full render) ends with no visible item, so the query may differ between calls; nothing is kept for a later call.
     * - The returned element replaces the message only when its text differs from the text shown: the status region is keyed on text, so while the message stays shown, unchanged text is neither re-rendered nor re-announced, and text that changes with the query is announced on each change; after the message hides, its next appearance renders again. Rich content whose markup varies while its text stays constant is therefore not re-rendered.
     * - `query` is the current filter query (`''` when the filter is inactive or
     *   the list is simply empty), so "Nothing matches <query>" is possible.
     * - Return an `HTMLElement`: inserted as the content (you own it; include
     *   real text - the status region announces its TEXT content).
     * - `null` (setting default, or returned): plain text from
     *   `uiTranslationPack.popupListNoResults`.
     * @group Filtering
     */
    createPopupListNoResultsContentElFn: ((query: string) => HTMLElement | null) | null;
    /**
     * Content for a pinned header above the option list, without subclassing.
     * - Called **once**, inside the constructor, before `new` returns.
     *   The variable that will hold the instance is still empty: do not read it
     *   in this function. Event handlers on the returned element may read it,
     *   because they run after `new` returns.
     * - `ctx` is a {@link LLSelectConstructionContext}: `classIdMap` (for the
     *   theme's classes) and `uiTranslationPack`. That is all this function can
     *   safely read.
     * - Return an `HTMLElement`: the library wraps it in the `popupHeaderEl`
     *   container (class `popupHeaderClass`, no ARIA role) and keeps that node
     *   until `destroy()`. `open()`, `rerender()` and `setUiTranslationPack()`
     *   never rebuild it. Update it yourself, from `onChange` or `onOpen`.
     * - `null` (setting default, or returned): no header element is built.
     * - Where it sits: between the filter input and the listbox, outside the
     *   scroll area, so it never scrolls with the items.
     * - To put it above the filter input, move it from a subclass constructor:
     *   `if (this.popupHeaderEl) { this.popupEl.prepend(this.popupHeaderEl) }`.
     *   The library never rewrites the popup's child list.
     * - While the filter is active, keep every control that Tab reaches out of
     *   a header above the filter input. Tab from the input would skip such a
     *   control, and Shift+Tab would enter it instead of leaving the select
     *   component.
     * - While the filter is active, `open()` warns once per page in the
     *   console when such a control sits before the filter input.
     *   - A control counts even while it is in one of these states, since Tab
     *     reaches it once the state ends:
     *     - hidden;
     *     - disabled;
     *     - inert;
     *     - not rendered by CSS.
     *   - An `input type="hidden"` never counts, whatever its `tabindex`, since
     *     it can never be shown.
     *   - A negative `tabindex` opts a control out.
     * - To offer a header control, keep the header below the filter input, or
     *   move the control to the footer.
     * - Pointer: a click inside does not move DOM focus (the popup `mousedown`
     *   rule), so a button works without stealing keyboard input. A text field
     *   inside must call `stopPropagation` on its own `mousedown`.
     * - If a control in the header has the `autofocus` attribute, a browser
     *   with the Popover API focuses that control at every open.
     *   - While the filter is active, the library then moves DOM focus on to
     *     the filter input.
     *   - While the filter is inactive, DOM focus stays on that control, and
     *     the arrow keys stay with it instead of moving the active row.
     * - Keep it compact: a long unwrapped line widens a `'fit-content'` popup,
     *   and a tall slot squeezes the list, the only child that flexes.
     * - Contract: `docs/llm/DESIGN.md` "Popup header / footer slots";
     *   keyboard and focus rules: `docs/llm/A11Y.md`.
     * @group Popup slots
     */
    createPopupHeaderContentElFn: ((ctx: LLSelectConstructionContext) => HTMLElement | null) | null;
    /**
     * Content for a pinned footer below the option list, without subclassing.
     * - Called **once**, inside the constructor, before `new` returns.
     * - Same contract as {@link createPopupHeaderContentElFn}: a
     *   {@link LLSelectConstructionContext} argument, the `popupFooterEl`
     *   container (class `popupFooterClass`, no ARIA role) around the result,
     *   never rebuilt by the library.
     * - `null` (setting default, or returned): no footer element is built.
     * - Where it sits: after the no-results message, at the bottom of the
     *   popup, outside the scroll area.
     * @group Popup slots
     */
    createPopupFooterContentElFn: ((ctx: LLSelectConstructionContext) => HTMLElement | null) | null;
    /**
     * Commands rendered as `role="option"` rows at the TOP of the option list,
     * after the choose-all row when there is one, in array order.
     * - Copied **once** at construction, as a shallow copy: later changes to your array do nothing. Default `[]`.
     *   - Each entry object stays yours: its `textFn`, `disabledFn` and `createContentElFn` run at every rebuild of the rows, which happens while the popup is open on each full list render, at the end of each committed selection change, and at the end of each `setItems`; one `setItems` may rebuild them more than once.
     *   - `disabledFn` runs once more when its row is activated.
     * - Each entry is a {@link LLSelectPopupListActionRow}. The library builds
     *   the row elements and wires them into the arrow-key ring: Home / End
     *   reach the ring's ends, disabled rows are skipped, and the popup opens
     *   with the active option on an item or the choose-all row, never on one
     *   of these rows.
     * - Rows scroll with the items unless their block is pinned
     *   (`popupListLeadingRowsPinned`). For content that is not a command, use
     *   `createPopupHeaderContentElFn` / `createPopupFooterContentElFn`.
     * - Assistive technology announces a row as an option, not as a button: its
     *   text, its position within its block of rows, and possibly "not
     *   selected", because the row carries `aria-selected="false"`.
     * - If screen reader users must know that a row is a command, put a button
     *   in a header or footer instead.
     * - If the command changes the selection, say so in the row text or a live
     *   region.
     * - A "select all" placed here is a command, not the choose-all row: call
     *   `toggleAllVisible()` from `onActivate` and count with
     *   `getVisibleEnabledItems()` (both on `LLSelectMultiple`). It is never
     *   marked selected and is never the active option when the popup opens.
     *   For a row with selection state, use `chooseAllRow`.
     * - Contract: `docs/llm/A11Y.md` "Action rows"; design: `docs/llm/DESIGN.md`.
     * @group Action rows
     */
    popupListLeadingActionRows: readonly LLSelectPopupListActionRow[];
    /**
     * Commands rendered as `role="option"` rows at the BOTTOM of the option
     * list, after the last item, in array order. Same contract as
     * {@link popupListLeadingActionRows}.
     * - Copied **once** at construction, as a shallow copy, with the leading rows' entry contract.
     * - While the filter is active, Home / End move the text caret, so a row
     *   down here is reached only by arrowing past every match: put commands
     *   keyboard users need often in the leading rows.
     * @group Action rows
     */
    popupListTrailingActionRows: readonly LLSelectPopupListActionRow[];
    /**
     * Keep the leading rows in view while the items scroll.
     * - The leading rows are the choose-all row (when on) plus
     *   `popupListLeadingActionRows`. With `true`, that whole block sticks to
     *   the top edge of the listbox and the items scroll under it.
     * - The rows stay in the arrow-key ring, keep their roles, and are still
     *   counted by assistive technology. Only their scrolling changes.
     * - The library wraps the block in a `div` with `role="presentation"`
     *   (`popupListPinnedLeadingRowsEl`, class
     *   `popupListPinnedLeadingRowsClass`) and sets `position: sticky` and
     *   `top: 0` on it inline, so the setting works in any theme. The shipped
     *   themes give the wrapper an opaque background and its edge line.
     * - When the block has no rows, for example when the choose-all row hides
     *   because nothing is selectable and there are no leading action rows,
     *   the wrapper is not in the listbox.
     * - Scrolling an item into view accounts for the wrapper's height. When the
     *   pinned blocks leave no room for the items, scrolling is best-effort.
     * - Default `false`: the rows scroll with the items.
     * - Pinning is per block, never per row. Why: `docs/llm/popup-rows-and-callbacks.md`
     *   section 5. Contract: `docs/llm/A11Y.md` "Action rows".
     * @group Action rows
     */
    popupListLeadingRowsPinned: boolean;
    /**
     * Keep the trailing rows in view while the items scroll.
     * - The trailing rows are `popupListTrailingActionRows`. With `true`, that
     *   block sticks to the bottom edge of the listbox.
     * - Same contract as {@link popupListLeadingRowsPinned}. The wrapper is
     *   `popupListPinnedTrailingRowsEl`, class
     *   `popupListPinnedTrailingRowsClass`, with `bottom: 0`.
     * - Default `false`.
     * @group Action rows
     */
    popupListTrailingRowsPinned: boolean;
    /**
     * How the popup decides its width. Does NOT affect the trigger - the width
     * of the trigger wrapper is always whatever your CSS says.
     *
     * - `'fit-content'` (default): popup width grows to its own content (items,
     *   filter input, ...) and never shrinks below the trigger wrapper's width -
     *   the native `<select>` dropdown behavior, minus its viewport overflow:
     *   auto-shifts and width-clamps when the natural width would not fit.
     *   Direction-aware: in an RTL context
     *   (`getComputedStyle(triggerWrapperEl).direction === 'rtl'`, read once per
     *   open) it right-aligns to the trigger wrapper and grows LEFTWARD, the
     *   mirror of LTR.
     * - `'match-trigger-wrapper'`: popup width equals the width of
     *   `triggerWrapperEl`, the box the themes draw; long item text wraps inside
     *   the popup.
     * @group Popup
     */
    popupWidthPolicy: LLSelectWidthPolicy;
    /**
     * The distance between the trigger wrapper and the popup, in CSS pixels.
     * - Default `4`.
     * - The distance lies between the edge of `triggerWrapperEl` and the edge of the popup next to it.
     * - The distance is the same when the popup opens below the trigger wrapper and when it opens above.
     * - Above the trigger wrapper, the distance is not exact, since the library reads the popup's height in whole pixels:
     *   - The distance can be off by up to half a pixel.
     *   - If the popup is less than two pixels taller than its height limit, the distance can be off by up to one and a half pixels.
     * - `0` makes the two edges touch.
     * - A negative number counts as `0`.
     * - If the trigger wrapper's edge next to the popup lies outside the viewport, the edge of the viewport takes its place:
     *   - The popup keeps the distance from that edge of the viewport.
     *   - If that side of the viewport has no room for the popup at all, the popup's edge stays inside the viewport.
     * - The viewport here is the visual viewport, the part of the page that the user sees.
     * - In a browser without the `visualViewport` API, the viewport is the layout viewport.
     * @group Popup
     */
    popupDistanceFromTriggerWrapper: number;
    /**
     * The room that the popup leaves to the edges of the viewport, in CSS pixels.
     * - Default `8`.
     * - The viewport here is the visual viewport, the part of the page that the user sees.
     * - In a browser without the `visualViewport` API, the viewport is the layout viewport.
     * - The setting limits the popup's height:
     *   - Below the trigger wrapper, the popup's room ends this far above the bottom edge of the viewport.
     *   - Above the trigger wrapper, the popup's room starts this far below the top edge of the viewport.
     *   - The popup's height is at most that room.
     *   - If a side has no room left, the height limit on that side is `0`.
     * - The library counts the same room when it picks the side of the popup.
     * - When `popupWidthPolicy` is `'fit-content'`, the setting also acts sideways:
     *   - The setting is the margin at the left and at the right edge of the viewport.
     *   - A margin is at most half the viewport's width, so the two margins never cross.
     *   - The popup's width is at most the viewport's width minus the two margins.
     *   - The popup shifts sideways to stay between the two margins.
     * - When `popupWidthPolicy` is `'match-trigger-wrapper'`, the setting does not act sideways.
     * - The popup's edge next to the trigger wrapper follows `popupDistanceFromTriggerWrapper`, not this setting.
     * - `0` lets the popup reach the edge of the viewport.
     * - A negative number counts as `0`.
     * @group Popup
     */
    popupDistanceFromViewportEdge: number;
    /**
     * Predicate deciding whether an individual item is disabled. `null` (default)
     * = nothing disabled. A disabled item is not selectable (click / Enter) and is
     * skipped by keyboard nav; it keeps `role="option"` plus `aria-disabled`.
     * For a generic `T` this is the only way to mark items - the library cannot
     * read a `disabled` field off an unknown type. See `docs/llm/DESIGN.md`.
     * - Called **every** time the library asks whether an item is disabled (`isItemEffectivelyDisabled`); nothing is kept for a later call:
     *   - for each item row on a full list render and on an in-place row rebuild;
     *   - for each item position tested by keyboard or typeahead navigation, and when the initial active row is picked on open;
     *   - on keyboard activation of a row;
     *   - in the choose-all operations and in `getVisibleEnabledItems()`;
     *   - for each tag chip and its remove button, and twice more on the remove button's click, before and after the focus it moves.
     * - When a chosen item becomes disabled, it stays chosen. The bullets below describe that state.
     * - For an `LLSelectSingle`:
     *   - `getChosenItem()` still returns the item.
     *   - The trigger shows the item's text by default.
     *   - Choosing another item replaces it, as in a native `<select>`.
     * - For an `LLSelectMultiple`:
     *   - `getChosenItems()` still includes the item.
     *   - When `triggerDisplay` is `'count'`, the default, the count text includes the item.
     *   - When `triggerDisplay` is `'tags'`:
     *     - The trigger shows a chip for the item.
     *     - The chip has `aria-disabled` set to true.
     *     - Clicking the chip's remove button does nothing.
     *   - `clearable` is off by default.
     *   - When `clearable` is off, no built-in user action removes the item.
     * - Your app can remove the disabled chosen item:
     *   - For a single select component, call `setChosenItem()` with another item or with `undefined`.
     *   - For a multiple select component, call `setChosenItems()` with a selection that excludes the item.
     *   - For a multiple select component, call `toggleItem()` with the item.
     *   - In both classes, call `setItems()` with a list that no longer contains the item.
     *   - For a multiple select component, if the item is outside the current
     *     item list:
     *     - `chooseAll()` removes it from the selection.
     *     - If the current item list has no enabled item, or an enabled item in it is unchosen, `toggleAll()` calls `chooseAll()`, which removes it as above.
     * - An action row you supply can make any of those calls.
     * - `setChosenItem()`, `setChosenItems()` and `toggleItem()` ignore the item's disabled state, like setting `option.selected` in script.
     * - If you supply a custom trigger content function, that function controls what the trigger shows.
     * - When the item's row is rendered:
     *   - The row has `aria-selected` and `aria-disabled` set to true.
     *   - Clicking the row does nothing.
     * - When `clearable` is on and the control is enabled:
     *   - Clicking the clear button clears the selection.
     *   - That also removes the disabled chosen item.
     * - When `clearable` is on, Tab reaches the clear button, so a keyboard user can clear too.
     * - A native `<select>` behaves the same way: a selected `<option>` keeps its selection when it is disabled.
     * - Removing the selected `<option>` removes that option from a native select's selection. `setItems()` with a list that excludes the chosen item removes the item here the same way.
     * - After the selected option is removed:
     *   - If a native single select has display size 1 and an enabled option remains, it selects its first enabled option.
     *   - An `LLSelectSingle` shows the placeholder.
     * - When a form submits, the browser omits selected options that are disabled.
     * - A native select's required check still counts those options as selections.
     * - llselect does not submit form values, so your app decides what to submit. The README section on form integration shows the hidden-input mirror, which does not exclude disabled items by itself.
     * @group Disabling
     */
    itemDisabledFn: ((item: T) => boolean) | null;
    /**
     * When the control is disabled via `setDisabled(true)`, whether the trigger
     * stays in the tab order (`tabindex="0"`). `false` (default) takes it out
     * (`-1`). Set `true` so keyboard / AT users can focus the disabled control to
     * read a "why disabled" tooltip.
     * - The buttons of the trigger buttons strip leave the tab order either way:
     *   they do nothing while the control is disabled.
     * @group Disabling
     */
    focusableWhenDisabled: boolean;
    /**
     * Item -> display string, without subclassing.
     * - Called **every** time the library needs an item's text; nothing is kept for a later call:
     *   - for each item row on a full list render or in-place rebuild;
     *   - on each trigger content render that shows item text: the single select component with a chosen item, once for the content unless `createTriggerContentElFn` returns an element, and once for the screen-reader text unless `triggerContextToScreenReaderTextFn` returns text; the multiple select component in `'tags'` mode, once per chosen item for the screen-reader text unless `triggerContextToScreenReaderTextFn` returns text, and, unless `createTriggerContentElFn` returns an element, once more for the chip's remove-button name and once more for the chip's text unless `createTagContentElFn` returns an element;
     *   - for each candidate on a recompute of the filtered list with the default filter;
     *   - on typeahead.
     * - `null` (default) = `String(item)`.
     * - Read by the `itemToString` method's default; used for list text, the
     *   single trigger text, the option's accessible name, and the default
     *   filter. Inserted as `textContent` (plain text, NOT parsed as HTML).
     * - For rich content (icons etc.), pass `createPopupListItemContentElFn`.
     * @group Items
     */
    itemToStringFn: ((item: T) => string) | null;
    /**
     * Item -> its BCP 47 language code, such as `'de'` or `'zh-TW'`, written as
     * the `lang` attribute. It is not a language name.
     * - Called **every** time the library writes an item's text; nothing is kept for a later call:
     *   - for each item row on a full list render or in-place rebuild;
     *   - on each trigger content render of the single select component with a chosen item, once for the content slot and once more for the screen-reader text while that text is the item's text;
     *   - for each chip in the multiple select component's `'tags'` mode, plus once for the screen-reader text while it is exactly one chosen item's text;
     *   - never for the count text.
     * - `null` (default) = the library writes no `lang` anywhere.
     * - A function returning `null` = the library writes no `lang` for that item;
     *   its own text then inherits the page's language, and your custom chip
     *   content keeps whatever `lang` it has.
     * - An empty string sets `lang=""`, which HTML reads as "language unknown".
     * - Why: a screen reader that switches voices by language reads an option
     *   in the voice of the `lang` in effect on its row.
     * - Without this setting every row inherits the page's language, so on an
     *   English page the rows of a language picker are read in the English voice.
     * - Example, a language picker on an English page:
     *   ```ts
     *   new LLSelectSingle(el, {
     *     itemToStringFn: (l) => l.name, // 'English', 'Deutsch', 'Francais'
     *     itemToLangFn: (l) => l.code,   // 'en', 'de', 'fr'
     *   })
     *   ```
     *   Without the setting the row is `<div role="option">Deutsch</div>`,
     *   read in the English voice. With it, `<div role="option" lang="de">Deutsch</div>`.
     * - Written where the library shows that item's text:
     *   - the option row;
     *   - the single select component's trigger content slot whenever an
     *     item is chosen, and its screen-reader text while that text is the
     *     item's text; custom trigger content inherits the slot's code, and
     *     its own `lang` wins;
     *   - a tag chip's text span, or its custom content.
     * - Not written on a chip's remove button, whose name mixes interface text
     *   with the item's text, nor on the multiple select component's count
     *   summary.
     * - The multiple select component's screen-reader text carries the code
     *   only while it is exactly one chosen item's text; the joined texts of
     *   several items carry none.
     * - Read by the `itemToLang` method's default.
     * @group Items
     */
    itemToLangFn: ((item: T) => string | null) | null;
    /**
     * Item -> the visible content ELEMENT of its popup list row, without subclassing.
     * - Called once per visible row; nothing is kept for a later call:
     *   - on **every** full list render (`renderPopupList`, only while the popup is open: on open, on each filter input event outside an IME composition, at the composition's end, and on the Esc that clears the query, on `setItems`, `rerender()` and a bulk selection write of the multiple select component (`setChosenItems` and the choose-all methods), and on `toggleItem` while `hideChosenRows` is on or when its choose-all row rebuild falls back to a full render);
     *   - for each row rebuilt in place by `setChosenItem` or `toggleItem` while the popup is open.
     * - The trigger never calls it: single mode has `createTriggerContentElFn`, tags have `createTagContentElFn`.
     * - When the select component is an `LLSelectMultiple`, read chosen state
     *   through `isChosen`.
     * - When the select component is an `LLSelectSingle`, compare with
     *   `getChosenItem()`.
     * - Never derive content from the chosen ORDER.
     * - When `toggleItem` changes one item, only that row is rebuilt, so
     *   sibling rows would keep an old position.
     * - While `hideChosenRows` is on, `toggleItem` rebuilds the whole list
     *   instead.
     * - Return an `HTMLElement` and the library inserts it as-is (you own the
     *   node); it becomes the row's visible content.
     * - `null` = plain `textContent` from `itemToString`. This is the default,
     *   both when the setting is unset and when your function returns `null` for
     *   a particular item.
     * - Fills the VISIBLE content only. You never touch `aria-*`: when this
     *   returns an element the library sets the option's `aria-label` from
     *   `itemToString`, so the accessible name + match text stay owned by
     *   `itemToString` no matter what you render (icon-only, reordered, ...).
     *   To make the spoken/matched text differ from the visible content, set the
     *   two independently: `itemToStringFn` for the name/matching,
     *   `createPopupListItemContentElFn` for the look.
     * - For full control of the option element (tag / wiring), subclass
     *   `createPopupListItemEl` instead.
     * - Content that reads selection state (e.g. a checkmark on the chosen row via
     *   `createCheckmarkSvgEl`) therefore stays fresh; keep the function cheap.
     *
     * @example
     *   // List shows an icon + the item text; screen readers announce just that text.
     *   itemToStringFn: (lang) => lang.name,
     *   createPopupListItemContentElFn: (lang) => {
     *     const row = document.createElement('span')
     *     const icon = document.createElement('i')
     *     icon.className = `mdi mdi-${lang.icon}`
     *     icon.setAttribute('aria-hidden', 'true') // decorative
     *     row.append(icon, lang.name)
     *     return row
     *   }
     * @group Popup
     */
    createPopupListItemContentElFn: ((item: T) => HTMLElement | null) | null;
    /**
     * Item -> its group's key (identity), enabling optgroup rendering.
     * - Called with nothing kept for a later call except the gathered order:
     *   - on **every** full list render (`renderPopupList`, only while the popup is open), once per visible item in the scan that splits the list into groups, plus one lookahead read of the item that ends a grouped run, so a run that closes at the end of the list costs no extra read;
     *   - in the group gather, once per item up to and including the first item whose non-null key recurs outside its own run (the whole list when it is contiguous), and once more per item when the list must be re-bucketed; the gathered order is kept until the next `setItems`, `rerender()` or bulk selection write of the multiple select component (`setChosenItems` and the choose-all methods); there is no gather while `gatherGroups` is `false`;
     *   - whenever the library asks whether an item is disabled and `itemDisabledFn` did not already disable it.
     * - `null` (setting, default): grouping off - flat list, no labels.
     * - fn returns `null`: this item is in no group; renders ungrouped.
     * - Contiguous items with an equal key (per `groupKeyCompareFn`) form one
     *   group. By default non-contiguous data is first gathered into display
     *   order (`gatherGroups`); with `gatherGroups: false` the data must be
     *   pre-sorted by group. See `docs/llm/DESIGN.md`.
     * @group Grouping
     */
    itemToGroupKeyFn: ((item: T) => GroupKey | null) | null;
    /**
     * Whether the library gathers non-contiguous groups before rendering
     * (`true`, default). Grouping renders contiguous runs, so scattered items
     * sharing a key would otherwise produce a duplicate label per gap.
     * - `true`: the DISPLAY order is derived via {@link gatherItemsByGroupKey}:
     *   groups in first-appearance order, within-group order kept, ungrouped
     *   (`null`-key) items in place. The data itself (`items` / `getItems()`)
     *   is never reordered, and already-contiguous data is detected in one
     *   scan and used as-is.
     * - `false`: strict mode - you guarantee the data is pre-sorted by group; a
     *   key reappearing after a gap renders a duplicate label and
     *   `console.warn`s, so a broken sort is surfaced instead of silently
     *   fixed.
     * No effect while grouping is off (every key `null`).
     * @group Grouping
     */
    gatherGroups: boolean;
    /**
     * Equality for two group keys; decides whether items share a group (both
     * the `gatherGroups` gather and the contiguous-run rendering use it).
     * - Called with nothing kept for a later call except the gathered order:
     *   - on **every** full list render (`renderPopupList`, only while the popup is open), in the scan that splits the list into groups: each item's key against the key that opened the current run, and each run's key against the runs already closed, stopping at the first match, to warn about a key that reappears;
     *   - in the group gather: each item's key against the key that opened the current run, and each run's opening key against every key seen so far, stopping at the first match, which is what detects a non-contiguous list; when the list must be re-bucketed, each key against the buckets' keys as well; the gathered order is kept until the next `setItems`, `rerender()` or bulk selection write of the multiple select component (`setChosenItems` and the choose-all methods); there is no gather while `gatherGroups` is `false`.
     * - `null` (default) = identity, the same rule as the default `compareFn`
     *   (`===`, plus `NaN` equals `NaN`); right for string / number keys.
     * - Supply only when `GroupKey` is an object without usable reference identity.
     * - Mirrors `compareFn`, one level up.
     * @group Grouping
     */
    groupKeyCompareFn: ((a: GroupKey, b: GroupKey) => boolean) | null;
    /**
     * Group key -> the label's display text. The i18n customization point: keep keys stable,
     * translate here.
     * - Called once per group on **every** full list render (`renderPopupList`, only while the popup is open), never on an in-place row rebuild; nothing is kept for a later call.
     * - `null` (default) = `String(groupKey)`.
     * @group Grouping
     */
    groupKeyToStringFn: ((groupKey: GroupKey) => string) | null;
    /**
     * Group key -> the group's BCP 47 language code, such as `'de'` or `'zh-TW'`,
     * written as the `lang` attribute of the group container. It is not a
     * language name.
     * - Called once per group on **every** full list render (`renderPopupList`, only while the popup is open), never on an in-place row rebuild; nothing is kept for a later call.
     * - `null` (default) = the library writes no `lang` on any group.
     * - A function returning `null` = no `lang` for that group; its label then
     *   inherits the page's language.
     * - An empty string sets `lang=""`, which HTML reads as "language unknown".
     * - Why: the group's accessible name is the container's `aria-label`, and a
     *   screen reader reads it in the voice of the `lang` in effect on that
     *   element. The visible label is `aria-hidden`, so the code goes on the
     *   container, where the name lives.
     * - The group's option rows inherit the code, unless `itemToLangFn` writes
     *   their own. Custom label content from `createGroupLabelContentElFn`
     *   inherits it too, and its own `lang` wins.
     * - Example, languages grouped under their own names on an English page:
     *   ```ts
     *   new LLSelectSingle(el, {
     *     itemToGroupKeyFn: (l) => l.code,      // 'de', 'fr'
     *     groupKeyToStringFn: (c) => NAMES[c],  // 'Deutsch', 'Francais'
     *     groupKeyToLangFn: (c) => c,
     *   })
     *   ```
     * - Read by the `groupKeyToLang` method's default. The sibling of
     *   {@link itemToLangFn}.
     * @group Grouping
     */
    groupKeyToLangFn: ((groupKey: GroupKey) => string | null) | null;
    /**
     * Predicate: is this whole group disabled?
     * - Called once per group on **every** full list render, and whenever the library asks whether an item in a group is disabled and `itemDisabledFn` did not already disable it; nothing is kept for a later call.
     * - `null` (default) = no group disabled.
     * - `true` = every item in the group is treated as disabled (layers on top of
     *   `itemDisabledFn`).
     * @group Grouping
     */
    groupDisabledFn: ((groupKey: GroupKey) => boolean) | null;
    /**
     * Group label -> its visible content ELEMENT (icon / count badge / rich
     * markup), without subclassing. Mirrors `createPopupListItemContentElFn`.
     * - Called once per group on **every** full list render (`renderPopupList`, only while the popup is open), never on an in-place row rebuild; nothing is kept for a later call.
     * - Return an `HTMLElement` and the library inserts it as the label's visible
     *   content; the group's accessible name stays `groupKeyToString` (on the
     *   container `aria-label`) and the label element stays `aria-hidden`.
     * - `null` (default, or returned for a group) = plain text from
     *   `groupKeyToString`.
     * - `itemsInGroup` is the group's items, so you can render "Fruits (4)" or a
     *   summary without recomputing the grouping.
     * @group Grouping
     */
    createGroupLabelContentElFn: ((groupKey: GroupKey, itemsInGroup: readonly T[]) => HTMLElement | null) | null;
    /**
     * Fired right **after** the popup opens.
     *
     * > No **before** counterpart: there is no `onBeforeOpen`.
     *
     * - `meta.reason` says why: `'toggle'`, `'keyboard'`, `'typeahead'` or
     *   `'api'`. See {@link LLSelectOpenReason}.
     * - An `open()` call that does nothing does not fire it. The `open()`
     *   docstring lists those cases.
     * - If a listener closes the select component while `open()` runs
     *   `showPopover()`, as an `onFocus` can after the `autofocus` move of the
     *   Popover API, this does not fire, while {@link onClose} does. The
     *   `open()` docstring describes that path.
     * - If a function that `open()` calls **before** this closes the select
     *   component, such as a content function of the list or an `onOpened`
     *   override, this does not fire either, while {@link onClose} does.
     * - If the browser refuses the `showPopover()` of `open()`, this does not
     *   fire. The `open()` docstring describes that path too.
     * - Fires in ADDITION to the protected `onOpened` hook, which runs first:
     *   the setting is for consumers, the hook for subclasses.
     * - `null` (default) = no consumer listener.
     * @group Events
     */
    onOpen: ((meta: LLSelectOpenMeta) => void) | null;
    /**
     * Fired right **after** the popup closes.
     *
     * > No **before** counterpart: there is no `onBeforeClose`.
     *
     * - `meta.reason` says why, one value per close path. See
     *   {@link LLSelectCloseReason}.
     * - A no-op `close()` does not fire it. The first close that takes effect
     *   reports its reason; a `close()` called while that close runs is a
     *   no-op.
     * - Additive with the protected `onClosed` hook, like {@link onOpen}: both run.
     * - When focus leaving the select component closes the popup, this fires **before**
     *   {@link onBlur}.
     * - While the popup is open, focus that arrives on the trigger buttons strip
     *   from outside the select component closes the popup, and this fires
     *   **before** {@link onFocus}.
     * - If a listener closes the select component while `open()` runs
     *   `showPopover()`, as an `onFocus` can after the `autofocus` move of the
     *   Popover API, this fires with no {@link onOpen} **before** it. The
     *   `open()` docstring describes that path.
     * - If a function that `open()` calls **before** {@link onOpen} closes the
     *   select component, such as a content function of the list, this fires
     *   with no {@link onOpen} **before** it as well.
     * - The close that `open()` runs to undo itself, when the browser refuses
     *   its `showPopover()`, does not fire this. The `open()` docstring
     *   describes that path too.
     * - `null` (default) = no consumer listener.
     * @group Events
     */
    onClose: ((meta: LLSelectCloseMeta) => void) | null;
    /**
     * Fired **after** DOM focus entered the select component.
     *
     * > No **before** counterpart: there is no `onBeforeFocus`, and the `focusin` / `focusout` events the library observes are not cancelable, so none could stop the move.
     *
     * - DOM focus is the element that receives keyboard input,
     *   `document.activeElement`. Inside the select component it can be the trigger, the
     *   filter input, a button of the trigger buttons strip, or a control the app
     *   placed in a header / footer slot.
     * - Fires once when focus comes from outside the select component or from nowhere:
     *   - Tab onto the trigger, a click on the trigger or on the label, or a
     *     programmatic `triggerEl.focus()`;
     *   - an `open()` call on an unfocused select component whose filter is
     *     active, which moves focus to the filter input **after** `onOpen`,
     *     when no `autofocus` control took focus first;
     *   - a click on the clear button or on a chip's remove button while the
     *     select component holds no focus, which focuses the trigger.
     * - If the browser has the Popover API and a control in a header or footer
     *   slot has the `autofocus` attribute, an `open()` call on an unfocused
     *   select component fires this **before** `onOpen`, in either filter
     *   mode: the browser focuses that control while `open()` runs
     *   `showPopover()`.
     *   - In that case, to open another select component from this callback,
     *     call its `open()` inside a `setTimeout` callback. The `open()`
     *     docstring says why.
     * - Does not fire for a move inside the select component, such as `open()` moving
     *   focus from the trigger to the filter input.
     * - While the popup is open, focus that arrives on the trigger buttons strip
     *   from outside the select component closes the popup, and {@link onClose}
     *   runs **before** this.
     * - Has no link to the active row, the row the arrow keys move inside the
     *   popup; that row never holds DOM focus.
     * - `null` (default) = no consumer listener; no `focusin` listener is
     *   attached.
     * @group Events
     */
    onFocus: (() => void) | null;
    /**
     * Fired **after** DOM focus left the select component.
     *
     * > No **before** counterpart: there is no `onBeforeBlur`, and the `focusin` / `focusout` events the library observes are not cancelable, so none could stop the move.
     *
     * - Fires once when focus moves to an element outside the select component or to
     *   nowhere: Tab away, a click on an element outside, a click on a
     *   non-focusable area.
     * - Does not fire for a move inside the select component.
     * - When focus leaving closes the popup, {@link onClose} fires first, so
     *   `isOpened()` is already `false` here.
     * - Does not fire from `destroy()` or from `setDisabled(true)`.
     *   `setDisabled(true)` closes an open popup, which returns focus to the
     *   trigger, inside the select component; `destroy()` detaches the focus listeners
     *   before its teardown can move focus.
     * - While the popup is open with `behaviorOfOutsideClick: 'block'`, the
     *   default, an outside mousedown is default-prevented, so the browser
     *   moves no focus, and this does not fire.
     * - A handler of the page that moves focus during that press still fires
     *   this.
     * - `null` (default) = no consumer listener.
     * @group Events
     */
    onBlur: (() => void) | null;
    /**
     * Fired **after** the active row changed to another item, or to no item.
     *
     * > No **before** counterpart: there is no `onBeforeActiveItemChange`.
     *
     * - The active row is the row of the popup list that the arrow keys move
     *   and that `aria-activedescendant` points to. It never holds DOM focus;
     *   {@link onFocus} reports DOM focus.
     * - `item` is the item of the new active row, or `undefined` when no item
     *   row is active:
     *   - the popup is closed;
     *   - the popup is open with no active row, for example after a filter
     *     keystroke that leaves no enabled visible item;
     *   - the choose-all row or an action row is the active row.
     * - Fires on open with the initial row, **after** {@link onOpen}; on every
     *   arrow, page, Home / End and typeahead move; on a click, **before** the
     *   change it requests; when a filter keystroke, `setItems()`, `rerender()`
     *   or a chosen-state re-render moves the row; and on close with
     *   `undefined`, **after** {@link onClose}.
     * - If the browser refuses the `showPopover()` of `open()`:
     *   - the close that undoes the open fires no {@link onClose};
     *   - this fires there with `undefined` only if a listener inside the
     *     refused show had moved the active row to an item;
     *   - an `open()` call made from this callback during that close is
     *     ignored.
     * - A listener may close or reopen the select component. The report is the last step
     *   of `open()` and of `close()`, so that nested transition runs after the
     *   outer one completed. A click or a filter keystroke whose listener closed
     *   the popup activates nothing and reports no query change.
     * - Fires only when the item changed under `compareFn`. A row rebuilt in
     *   place for the same item does not fire, and a move between the
     *   choose-all row and an action row does not fire either: both are "no
     *   item".
     * - Runs **after** the DOM reflects the new row, so `getVisibleItems()` is
     *   current. Never fires for a mouse hover: hovering does not move the
     *   active row.
     * - An item that is itself `undefined` cannot be told from "no item".
     * - `null` (default) = no consumer listener.
     * @group Events
     */
    onActiveItemChange: ((item: T | undefined) => void) | null;
    /**
     * Called **after** the filter text changed and the list was re-rendered.
     *
     * > No **before** counterpart: there is no `onBeforeFilterQueryChange`.
     *
     * - Fires on typing, when an IME composition ends, and when Esc clears a
     *   non-empty query. `query` is the new text.
     * - Does not fire when the text stays the same, when `close()` clears the
     *   query (use `onClose`), when `open()` starts with an empty query, or on
     *   `setItems()` / `rerender()`.
     * - Runs **after** the list is rebuilt, so `getVisibleItems()` already
     *   reflects the new text. Rewrite a header count from here, from `onOpen`
     *   and from `onChange`.
     * - `null` (default): nothing is called.
     * @group Events
     */
    onFilterQueryChange: ((query: string) => void) | null;
}
/**
 * Constructor input for a resolved settings bag `S`: every field optional,
 * and `uiTranslationPack` accepts a PARTIAL pack (missing keys fall back to
 * English). Shared by the base / single / multiple `*SettingsInput` types;
 * use it for a subclass wrapper that extends the settings bag.
 * @group Settings
 * @category Base
 */
export type LLSelectSettingsInputOf<S extends {
    uiTranslationPack: LLSelectUiTranslationPack;
}> = Partial<Omit<S, 'uiTranslationPack'>> & {
    uiTranslationPack?: Partial<LLSelectUiTranslationPack>;
};
/**
 * Constructor-time settings input - every field is optional and missing
 * fields fall back to the library defaults.
 * @group Settings
 * @category Base
 */
export type LLSelectBaseSettingsInput<T, GroupKey = string> = LLSelectSettingsInputOf<LLSelectBaseSettings<T, GroupKey>>;
/**
 * Resolved CSS class names and DOM ids for one instance. Exposed on
 * `instance.classIdMap` so callers can reuse them in their own CSS or query
 * selectors instead of hard-coding the strings.
 * @group CSS & DOM
 */
export interface LLSelectClassIdMap {
    /** Class on `rootEl` (the caller-passed mount element). */
    rootClass: string;
    /** Class on `triggerWrapperEl`, the box around the trigger, the trigger buttons strip and the arrow. */
    triggerWrapperClass: string;
    /**
     * Class on `triggerEl`, the element that takes focus and carries the field's role.
     * - Its `role` is `combobox` while the filter is inactive and `button` while it is active.
     * - See `docs/llm/A11Y.md`.
     */
    triggerClass: string;
    /** Class on `triggerContentEl`, the span inside the trigger that shows the value. */
    triggerContentClass: string;
    /**
     * Class on the visually hidden span inside the trigger that holds the
     * screen-reader text, the value assistive technology reads.
     * - The span exists for screen readers only. The trigger is a `combobox`
     *   while the filter is inactive, and WAI-ARIA 1.2 gives a combobox that
     *   is not a text field the value of its descendant content. The span is
     *   that descendant content, since `triggerContentEl` carries
     *   `aria-hidden="true"`.
     * - Inline styles hide it, so it needs no theme rule.
     */
    triggerScreenReaderTextClass: string;
    /** Class on the span at the end of the trigger wrapper where the optional dropdown arrow lives. */
    triggerArrowClass: string;
    /** Class on `triggerButtonsEl`, the strip that holds the clear button and the tag chips. */
    triggerButtonsClass: string;
    /** Class on the clear (x) button, the last child of the trigger buttons strip (`clearable`). */
    triggerClearButtonClass: string;
    /** Class on `popupEl`: the outer popup wrapper, a `dialog` while the filter is active and without an ARIA role otherwise. */
    popupClass: string;
    /** Class on `popupListEl` (the inner element with `role="listbox"`). */
    popupListClass: string;
    /**
     * Class on the no-results message element (`role="status"`), shown below
     * the (empty) listbox when the visible item list has zero entries.
     */
    popupListNoResultsClass: string;
    /**
     * Class on `popupHeaderEl`, the pinned header container between the filter
     * input and the listbox. The element exists only when header content was
     * built (`createPopupHeaderContentElFn`, or a `createPopupHeaderEl` override).
     */
    popupHeaderClass: string;
    /**
     * Class on `popupFooterEl`, the pinned footer container at the bottom of
     * the popup. Exists only when footer content was built.
     */
    popupFooterClass: string;
    /**
     * Class on every action row (`popupListLeadingActionRows` /
     * `popupListTrailingActionRows`). Also carries `popupListRowClass`, so hover /
     * focused / disabled styling comes from there.
     */
    popupListActionRowClass: string;
    /**
     * Class on `popupListPinnedLeadingRowsEl`, the sticky wrapper around the
     * leading rows when `popupListLeadingRowsPinned` is on.
     */
    popupListPinnedLeadingRowsClass: string;
    /**
     * Class on `popupListPinnedTrailingRowsEl`, the sticky wrapper around the
     * trailing rows when `popupListTrailingRowsPinned` is on.
     */
    popupListPinnedTrailingRowsClass: string;
    /**
     * Class on the choose-all row (`LLSelectMultiple`, `chooseAllRow`
     * setting). Also carries `popupListRowClass` plus `data-chosen-state="none|some|all"`
     * for the tri-state visual.
     */
    chooseAllRowClass: string;
    /** Class on every row of the popup list (`role="option"`): item rows, the choose-all row, and action rows. */
    popupListRowClass: string;
    /** Extra class on the active row: the row `aria-activedescendant` points to, which the arrow keys move. Style the active row with it. The row never holds DOM focus. */
    popupListRowFocusedClass: string;
    /** Class on a disabled row, which also carries `aria-disabled="true"`. A stable hook for styling and tooltip targeting. */
    popupListRowDisabledClass: string;
    /**
     * Class on a group container (`role="group"`). A disabled group's container
     * also carries `aria-disabled="true"` + `data-disabled="true"`.
     */
    groupClass: string;
    /**
     * Class on the visible group label element (`aria-hidden`), inside the group
     * container above its items. A hook for styling / sticky labels.
     */
    groupLabelClass: string;
    /** Class on the tag-list container in `triggerDisplay: 'tags'` mode (multi), inside the trigger buttons strip. */
    tagsClass: string;
    /** Class on one tag chip (`triggerDisplay: 'tags'`). */
    tagClass: string;
    /** Class on a tag's remove (x) button; its `aria-label` names the item. */
    tagRemoveButtonClass: string;
    /** Class on a tag's default text span (built when `createTagContentElFn` is unset or returns `null`); it carries the item's `lang` from `itemToLangFn` and `aria-hidden="true"`. */
    tagTextClass: string;
    /**
     * Class on a tag chip whose item is effectively disabled (which also carries
     * `aria-disabled="true"`, and whose x button no longer removes it). Mirrors
     * `popupListRowDisabledClass`; a stable hook for greying the inert chip.
     */
    tagDisabledClass: string;
    /**
     * Class added to `rootEl` while the popup is open. Use it as a CSS hook
     * for open-state styling (also available as `[data-state='open']` on the
     * trigger wrapper).
     */
    openClass: string;
    /** DOM `id` of `triggerEl`. Unique across instances. */
    triggerId: string;
    /**
     * DOM `id` minted onto the `labelEl` setting's element when it has none
     * (the resolved `ariaLabelledBy` then references it). Unique across
     * instances. Unused when `labelEl` is null or already carries an id.
     */
    labelId: string;
    /** DOM `id` of the trigger content span. Unique across instances. */
    triggerContentId: string;
    /**
     * DOM `id` of the visually hidden span inside the trigger that holds the
     * screen-reader text.
     * - Unique across instances.
     * - While the filter is active, the trigger is a `button`. A button takes
     *   its name from its content, which would leave out the field name, so
     *   the library names it through `aria-labelledby`. That chain ends at
     *   this id, so the button's name carries the value (see the `ariaLabel` /
     *   `ariaLabelledBy` settings).
     */
    triggerScreenReaderTextId: string;
    /**
     * DOM `id` of `popupEl`, the outer popup wrapper.
     * - Unique across instances.
     * - Referenced by the trigger's `aria-controls` while the filter is
     *   active, when the wrapper is a `dialog`.
     */
    popupId: string;
    /**
     * DOM `id` of `popupListEl`, the inner listbox.
     * - Unique across instances.
     * - Referenced by the `aria-controls` of the combobox: the trigger's while
     *   the filter is inactive, the filter input's while it is active.
     */
    popupListId: string;
    /** Class on the filter input element inside the popup. */
    filterInputClass: string;
    /** DOM `id` of the filter input. Unique across instances. */
    filterInputId: string;
}
/**
 * Package-internal (not re-exported): subclasses detect it to pick fast paths.
 * SameValueZero (`===` plus `NaN` equals `NaN`), matching the `Set` those fast
 * paths use - `===` alone let a `NaN` item be chosen twice (QUALITY-92).
 * Second job: the reference-swap check in both `onItemsChanged` ("same value?",
 * a different question from item identity). Keep it SameValueZero for that too.
 */
export declare function defaultCompareFn<T>(a: T, b: T): boolean;
/** Package-internal test hook (not re-exported): reset the once-per-page unnamed-name warning. */
export declare function resetUnnamedNameWarning(): void;
/** Package-internal test hook (not re-exported): reset the once-per-page duplicate-items warning. */
export declare function resetDuplicateItemsWarning(): void;
/** Package-internal test hook (not re-exported): reset the once-per-page focusable-before-the-filter-input warning. */
export declare function resetFocusableBeforeFilterInputWarning(): void;
/** Package-internal test hook (not re-exported): reset the once-per-page hidden-trigger warning. */
export declare function resetHiddenTriggerWarning(): void;
/**
 * Abstract base for all select component variants. Owns DOM scaffolding, ARIA
 * wiring, positioning, keyboard navigation, lazy popup-list rendering, and
 * outside-click handling. Subclasses (`LLSelectSingle`, `LLSelectMultiple`)
 * own chosen-state, decide what happens on item click, and customise the
 * trigger text via `renderTriggerContent`.
 *
 * @typeParam T - item value type. Use `unknown` (default) only when you
 *   intend to narrow inside templates / handlers; usually pass a concrete
 *   type like `string` or your domain object.
 * @typeParam GroupKey - the group key type `itemToGroupKeyFn` returns
 *   (`null` from that fn means "this item is in no group"). Defaults to
 *   `string`. Open it to objects only together with `groupKeyCompareFn`; see
 *   DESIGN.md "Data model".
 * @typeParam S - the resolved settings type, for subclasses that EXTEND the
 *   settings bag. Plain use never passes it. A subclass declares
 *   `extends LLSelectBase<T, GroupKey, MySettings>` and `this.settings` is
 *   typed `MySettings`; the constructor's `subclassSettings` param then only
 *   accepts exactly the extra fields.
 * @group Select component classes
 */
export declare abstract class LLSelectBase<T = unknown, GroupKey = string, S extends LLSelectBaseSettings<T, GroupKey> = LLSelectBaseSettings<T, GroupKey>> {
    /**
     * The caller-passed mount element, now decorated as the select component's
     * root. Library does not replace this node, so the caller's original
     * reference, id, and data-* attributes stay valid.
     * @group DOM elements
     */
    readonly rootEl: HTMLElement;
    /**
     * The box around the trigger, the element the themes draw as the field.
     * - It holds `triggerEl`, then `triggerButtonsEl` when that strip exists,
     *   then the arrow slot.
     * - It carries the CSS hooks `data-state="open|closed"`, `data-empty` and
     *   `data-disabled`.
     * - A click anywhere in it toggles the popup, except a click on a button of
     *   the strip.
     * - A mousedown in it outside the trigger and the strip's buttons moves
     *   focus to the trigger, as a press on a native select does.
     * - The popup is placed against it, and `popupWidthPolicy:
     *   'match-trigger-wrapper'` copies its width.
     * - It has no ARIA role.
     * @group DOM elements
     */
    readonly triggerWrapperEl: HTMLElement;
    /**
     * The trigger: the element that takes focus and represents the field to
     * assistive technology.
     * - While the filter is inactive it has `role="combobox"` and hosts
     *   `aria-activedescendant`.
     * - While the filter is active it has `role="button"`, and the filter input
     *   hosts `aria-activedescendant`.
     * - It carries `aria-expanded`, `aria-controls`, `aria-haspopup` and the
     *   field name, and it receives the keydown events.
     * - It holds text only: the visually hidden screen-reader text and
     *   `triggerContentEl`. WAI-ARIA 1.2 gives a combobox that is not a text
     *   field the value of its descendant content, so a control inside it
     *   would put its name into the value. The clear button and the tag chips
     *   therefore sit in {@link triggerButtonsEl}, beside it.
     * - Its `textContent` includes the screen-reader text. Read
     *   `triggerContentEl.textContent` for what the screen shows.
     * - See `docs/llm/A11Y.md`.
     * @group DOM elements
     */
    readonly triggerEl: HTMLElement;
    /**
     * The span inside the trigger that shows the value: the placeholder, the
     * chosen item's text, the count text or custom trigger content.
     * - It carries `aria-hidden="true"`. Assistive technology reads the
     *   screen-reader text beside it instead, so the value is not read twice.
     * - Subclasses' `renderTriggerContent` writes here through
     *   `commitTriggerContentToDom`.
     * - In tags mode it stays empty while chips show: the chips sit in
     *   {@link triggerButtonsEl}.
     * @group DOM elements
     */
    readonly triggerContentEl: HTMLElement;
    /**
     * The visually hidden span inside the trigger that holds the screen-reader
     * text: the value assistive technology reads, never shown.
     * - While the filter is inactive, the trigger is a `combobox`. WAI-ARIA 1.2
     *   gives a combobox that is not a text field the value of its descendant
     *   content, and `triggerContentEl` is `aria-hidden`, so this span is that
     *   value.
     * - While the filter is active, the trigger is a `button`, named through
     *   `aria-labelledby`. The chain ends at this span, so the name carries the
     *   value.
     * - Inline styles hide it, never `hidden` or `aria-hidden`: a hidden
     *   descendant adds nothing to the combobox value.
     * - The library writes it after every trigger content render, from
     *   `computeTriggerScreenReaderText`.
     */
    private readonly triggerScreenReaderTextEl;
    /**
     * The strip beside the trigger that holds the trigger's controls: the tag
     * chips in tags mode, then the clear button while `clearable` is on.
     * - `null` when neither setting asks for a control. Both settings are
     *   frozen at construction, so whether the strip exists never changes.
     * - The controls sit here, not inside the trigger. Inside a `combobox`
     *   their names would enter the value, and a `button` gives its children
     *   no roles.
     * - In tags mode it has `role="toolbar"`, named by
     *   `uiTranslationPack.triggerButtonsAriaLabel`. A lone clear button needs
     *   no toolbar, so the strip has no role otherwise.
     * - Only one of its buttons is a Tab stop, so Tab enters the strip once.
     *   Left and Right Arrow, Home and End move focus between the buttons. In
     *   right-to-left text, Left and Right swap.
     * - Only `button` elements take part in the Tab stop and the arrow keys.
     * - While the popup is open, none of its buttons is a Tab stop: Tab from
     *   the open popup reaches the popup's slot controls, then leaves.
     * - While the select component is disabled, none of its buttons is a Tab
     *   stop.
     * - It carries `hidden` while nothing is chosen, or while it is empty.
     * - Focus that enters it while the popup is open closes the popup, with the
     *   close reason `'trigger-buttons'`.
     * @group DOM elements
     */
    readonly triggerButtonsEl: HTMLElement | null;
    /**
     * The outer popup wrapper.
     * - It holds the filter input, the header and footer slots, the no-results
     *   message and the inner `popupListEl`.
     * - It is hidden through the `hidden` attribute while closed. While open,
     *   the positioner places it with inline styles.
     * - While the filter is active it is a `dialog` named like the field, and
     *   the trigger's `aria-controls` points to it, because the popup then
     *   holds a text field besides the listbox.
     * - While the filter is inactive the library gives it no ARIA role.
     * - In a browser with the Popover API it carries `popover="manual"`, and
     *   `open()` shows it in the top layer through `showPopover()`.
     * - Canceling its `beforetoggle` event is not supported.
     *   - The select component then still opens, but the popup stays outside
     *     the top layer, as in a browser without the Popover API.
     *   - Other content can then cover the popup.
     *   - An ancestor that creates a containing block for fixed-position
     *     elements, for example one with a `transform`, can then move the
     *     popup.
     * @group DOM elements
     */
    readonly popupEl: HTMLElement;
    /**
     * The inner element with `role="listbox"`.
     * - It sits inside `popupEl`, so the filter input, the header, the
     *   no-results message and the footer sit beside it, never inside.
     * - It holds only three kinds of child:
     *   - option rows: the item rows, the choose-all row, the action rows;
     *   - group containers, each holding its group label element and its item
     *     rows;
     *   - pinned-block wrappers, `role="presentation"`, each holding the rows
     *     of its pinned block.
     * - The combobox's `aria-controls` points to it: the trigger's while the
     *   filter is inactive, the filter input's while it is active.
     * @group DOM elements
     */
    readonly popupListEl: HTMLElement;
    /**
     * The pinned header container between the filter input and the listbox,
     * or `null` when no header content was built. No ARIA role; outside the
     * scroll area. Built once in the constructor (`createPopupHeaderEl`) and
     * kept until `destroy()`; the library never rebuilds or moves it.
     * @group DOM elements
     */
    readonly popupHeaderEl: HTMLElement | null;
    /**
     * The pinned footer container at the bottom of the popup, after the
     * no-results message, or `null` when no footer content was built. Same
     * lifecycle as {@link popupHeaderEl}.
     * @group DOM elements
     */
    readonly popupFooterEl: HTMLElement | null;
    /**
     * The wrapper around the pinned leading rows, or `null`.
     * - Built once in the constructor when `popupListLeadingRowsPinned` is
     *   `true`; `null` otherwise.
     * - A `div` with `role="presentation"` and class
     *   `popupListPinnedLeadingRowsClass`; the library sets `position: sticky`
     *   and `top: 0` on it inline.
     * - In the listbox only while the leading rows exist. The library moves it
     *   in and out on every list render. Its classes are yours to change after
     *   `new`.
     * - `data-edge-to-items` is set on every list render: `"true"` when that
     *   render lists items, `"false"` when it lists none; absent before the
     *   first render.
     * - It is a CSS hook for the themes: they draw the block's edge line only
     *   when it is true, so two blocks that touch draw no line between them.
     * @group DOM elements
     */
    readonly popupListPinnedLeadingRowsEl: HTMLElement | null;
    /**
     * The wrapper around the pinned trailing rows, or `null`.
     * - Same contract as {@link popupListPinnedLeadingRowsEl}, for
     *   `popupListTrailingRowsPinned`, with `bottom: 0`.
     * @group DOM elements
     */
    readonly popupListPinnedTrailingRowsEl: HTMLElement | null;
    /**
     * Resolved class names and ids for this instance.
     * @group DOM elements
     */
    readonly classIdMap: LLSelectClassIdMap;
    /**
     * Resolved settings (defaults applied) - ONE bag for the whole hierarchy.
     * Typed by the class's `S` param: a subclass that extends the settings
     * passes its resolved extra fields through the constructor's
     * `subclassSettings` param, and this field is `S` with no re-typing
     * (see `LLSelectSingle` / `LLSelectMultiple`).
     * @group State (protected)
     */
    protected readonly settings: S;
    /** Raw explicit `placeholder` (constructor or `setPlaceholder`); `setUiTranslationPack` re-resolves against it. */
    private explicitPlaceholder;
    /** True when the constructor minted `classIdMap.labelId` onto `labelEl`; `destroy()` then removes it. */
    private labelElIdMinted;
    /** Click handler bound to `labelEl`: focus the trigger, never open (native label parity). */
    private readonly handleLabelElClick;
    /**
     * Current item list. Defensive copy of what `setItems` was given.
     * @group State (protected)
     */
    protected items: T[];
    /** Whether the popup is currently open; public reader {@link isOpened}. */
    private opened;
    /** True while `close()` returns focus to the trigger, and while `clearOpenState()` runs; `open()` refuses during both. */
    private closing;
    /** True while `open()` runs `showPopover()`, and the undo after a refused show; a nested `open()` of this select component refuses during that time, since Chromium 156, Firefox 153 and WebKit 26.5 throw on a show during another show. */
    private opening;
    /** True while `open()` undoes itself through `close()` after `showPopover()` threw; that `close()` fires no `onClosed` / `onClose`, since the open fired neither of their mirrors. */
    private undoingOpen;
    /**
     * Position in `getVisibleItems()` (the rendered list, not `items`) of the
     * currently keyboard-focused item, or `-1` when no item is focused.
     * - "Focused" here means the active row, the row `aria-activedescendant`
     *   points to, not DOM focus.
     * - While the popup is open, the value is `-1` in two cases:
     *   - no row is active, for example after a filter keystroke that leaves
     *     no enabled visible item, or after an open that finds no enabled
     *     visible item;
     *   - the choose-all row or an action row is the active row.
     * - `close()` sets the value to `-1`.
     * - While the popup is closed, a `setFocusedIndex` call can store another
     *   value.
     * - `open()` sets the value to `-1` again before `focusInitial` places the
     *   initial row.
     * @group State (protected)
     */
    protected focusedIndex: number;
    /** Control-level disabled state (whole select component); toggled via `setDisabled`. */
    private disabled;
    /**
     * Becomes true in `destroy()` and stays true.
     * - The clear button's and the chip remove button's clicks check it after
     *   their focus step, since an `onFocus` listener may destroy the select component
     *   there.
     * - `open()` checks it, since a listener that `destroy()` runs, such as
     *   `onClose`, may call `open()`.
     * @internal
     */
    protected destroyed: boolean;
    /** The latest decision, or the provisional value before the first one; see `getColorScheme()`. */
    private resolvedColorScheme;
    /** True from construction until the first decision ran (batched into a microtask, see color-scheme.ts). */
    private colorSchemeDecisionPending;
    private readonly colorSchemeDecision;
    /**
     * Who the change being applied right now is attributed to; the variants'
     * `onChange` firing reads it. Set to `'user'` by `withUserChangeSource`
     * and consumed (reset to `'api'`) by the first chosen-state change, before
     * `onChosenChanged` runs, so a nested api-driven change inside an
     * `onChange` handler reports `'api'`.
     * @group State (protected)
     */
    protected changeSource: LLSelectChangeSource;
    /**
     * Bumped by every chosen-state change and every `setItems`. The
     * before-change gate drops a pending change when it moved during the
     * handlers, so a setter called inside them wins, even one that restores
     * the previous value.
     * @internal
     */
    protected changeRevision: number;
    private triggerArrowEl;
    /** The clear button once a trigger render has built it (`clearable` only), else `null`; every later trigger render swaps it through `createTriggerClearButtonEl` (or keeps it, if that override returns the same element). */
    private triggerClearButtonEl;
    /** The tag-list container in the trigger buttons strip, or `null` while no chip shows; see `commitTagsElToDom`. */
    private tagsEl;
    /** The strip's last Tab stop, kept while it stays in the strip, so Tab returns to the button that last held focus. */
    private triggerButtonsTabStopEl;
    /** Counts full trigger renders, so `setItems` writes the screen-reader text once even when `onItemsChanged` ran `renderTrigger`. */
    private triggerRenderCount;
    private positioner;
    /**
     * Whether the Popover API exists (feature-detected once per instance).
     * When true the popup renders in the top layer while open - above every
     * stacking context, immune to containing-block-creating ancestors - while
     * staying in place in the DOM. See `docs/llm/DESIGN.md` "In-place popup".
     */
    private readonly popoverSupported;
    private itemEls;
    private focusedEl;
    /**
     * The choose-all row element (`LLSelectMultiple` only) for the current
     * render, or `undefined` when absent. Never part of `itemEls`.
     */
    private chooseAllRowEl;
    /**
     * The non-item ring entry that holds the active option (the choose-all
     * row today), or `null` when an item does, or nothing does.
     * Mutually exclusive with `focusedIndex >= 0`.
     */
    private focusedRow;
    /** The last item reported to `onActiveItemChange`, or none; see `reportActiveItem`. */
    private reportedActiveItem;
    /** Above zero while `open()` renders and places the initial row; its tail reports once instead. A depth, so a nested open inside a content function cannot end the outer suspension early. */
    private activeItemReportSuspendDepth;
    /**
     * Bumped by `open`, `close`, `rerender` and `destroy`. With `changeRevision`
     * it forms the stamp a row click takes before its active-row move
     * (`captureStateStamp`); the click activates nothing when a listener moved
     * either counter, since a close, a reopen, a rebuild or a value change
     * under it leaves the row it meant in a popup state that is gone
     * (DESIGN.md "Active item change").
     */
    private transitionGeneration;
    /**
     * Counts the open cycles: `open()` bumps it when it marks the popup open.
     * - An `open()` call compares it with the value it took, to learn whether
     *   a function it ran closed the select component and opened it again.
     */
    private openCycle;
    /** The rendered action rows of the current render, in array order; empty while closed. Never part of `itemEls`. */
    private leadingActionRowEls;
    private trailingActionRowEls;
    private outsideHandler;
    /**
     * The reason the next `open()` / `close()` reports. An internal path sets
     * it right before the call (`openWithReason` / `closeWithReason`); the
     * method reads and resets it first thing, so a call from outside reports
     * `'api'` and a refused call leaves nothing behind.
     */
    private pendingOpenReason;
    private pendingCloseReason;
    /** The gesture of a `'scroll-gesture'` close, for `meta.scrollGesture`; see `pendingCloseReason`. */
    private pendingScrollGesture;
    /** The gesture of a `'zoom-gesture'` close, for `meta.zoomGesture`; see `pendingCloseReason`. */
    private pendingZoomGesture;
    /** Detaches the scroll-gesture and zoom-gesture listeners of the open cycle; set while the popup is open. */
    private detachGestures;
    private readonly touchHoldReleases;
    /** The whole-life focus listeners on `rootEl`; see `attachFocusListeners`. */
    private focusInHandler;
    private focusOutHandler;
    /**
     * Block-mode only. Suppresses the browser's default focus shift on outside
     * mousedown so the focusout-close path cannot race ahead of the click
     * capture and detach it before the click fires.
     */
    private blockMouseDownHandler;
    /** Block-mode only. Arms the swallow of the click of an outside press at its `pointerdown`. */
    private blockPointerDownHandler;
    /** Ends the swallow that an outside press armed under `'block'`; `null` while none is armed. */
    private disarmOutsidePressClickSwallow;
    /** The pointer type of the press whose swallow is armed; `null` while none is armed. */
    private outsidePressPointerType;
    /**
     * Element that owns `aria-activedescendant` and receives keydown for option
     * navigation. Equals the filter input while the filter is active, else the
     * trigger. Re-pointed by `syncFilterModeToDom` (constructor + every open).
     */
    private comboboxEl;
    /**
     * Filter input element. Always built into the popup DOM and always wired
     * (a `hidden` input receives no events); kept `hidden` while the filter is
     * inactive.
     */
    private filterInputEl;
    /**
     * No-results message element (`role="status"`). Always built (like the
     * filter input), sits AFTER the listbox inside `popupEl`, so the listbox
     * keeps holding only option rows, the group containers and the pinned-block
     * wrappers; `hidden` while the visible list has entries.
     */
    private popupListNoResultsEl;
    /**
     * Text last written into the no-results region, or `null` while it is hidden.
     * Guards a re-announcement: `role="status"` speaks on every content change, so
     * a keystroke that keeps the list empty must not rewrite identical text (A11Y.md:
     * announced once per appearance). Reset to `null` when the region hides, so the
     * next appearance announces again.
     */
    private lastNoResultsText;
    /**
     * Whether the filter input is active for the CURRENT open cycle. Evaluated
     * from the `filterable` setting (predicate form reads the current items) in
     * the constructor and on every `open()` - never re-evaluated mid-open, so
     * the focus host cannot be yanked while the popup is up.
     */
    private filterActive;
    private query;
    private filteredItems;
    private typeaheadBuffer;
    private typeaheadLastTime;
    /** Memoized display order of `items` (`gatherGroups` gather); `undefined` = recompute on next need. */
    private gatheredItems;
    private composing;
    /**
     * @param targetEl - mount element. Becomes `rootEl`; its existing children
     *   are wiped and replaced with the trigger + popup structure. Pre-set
     *   classes / id / data-* attributes on this element are preserved.
     * @param settings - optional partial settings. Missing fields use defaults
     *   ({@link LLSelectBaseSettings}).
     * @param subclassSettings - for subclasses that EXTEND the settings bag: their
     *   own fields, already resolved (defaults applied). Typed by the class's
     *   `S` param, so it accepts exactly the extra fields and nothing else.
     *   Merged into `this.settings` right here, so the bag is complete before
     *   any base construction code (e.g. `createFilterInputEl` reading the
     *   pack) can read it.
     * @group Lifecycle
     */
    constructor(targetEl: HTMLElement, settings?: LLSelectSettingsInputOf<S>, subclassSettings?: Omit<S, keyof LLSelectBaseSettings<T, GroupKey>>);
    /**
     * Evaluate the `filterable` setting against the current items: booleans
     * pass through, the predicate form is called with the full item list.
     */
    private computeFilterActive;
    /**
     * Mirror `filterActive` onto the DOM + wiring it decides: the trigger's
     * role (`button` while active, `combobox` while not), its `aria-haspopup`
     * and `aria-controls`, the popup wrapper's role, the filter input's
     * `hidden` flag, and which element `comboboxEl` points at (the
     * `aria-activedescendant` / focus host). Called from the constructor and
     * from `open()` after re-evaluation.
     */
    private syncFilterModeToDom;
    /**
     * Reflect the field's accessible name (`ariaLabel` / `ariaLabelledBy`) onto
     * the elements that carry it. Runs with `syncFilterModeToDom` (constructor +
     * every open) because the trigger's wiring depends on the mode:
     * - Trigger, filter inactive (`role="combobox"`): the name directly; the
     *   combobox VALUE already comes from the screen-reader text inside it.
     * - Trigger, filter active (`role="button"`): a button's name would
     *   otherwise be its content (the current value) with no field name, so
     *   `aria-labelledby` chains label + screen-reader text. With only `ariaLabel`
     *   there is no label element to reference, so the chain starts at the
     *   trigger itself - the accname algorithm substitutes its `aria-label`.
     * - Filter input: the field name replaces the `uiTranslationPack.filterInputAriaLabel`
     *   fallback (while the filter is active the input IS the field's combobox).
     * - Listbox: the field name, both modes.
     * - Popup wrapper: the field name while the filter is active (a dialog
     *   needs a name), nothing while it is inactive (no role).
     */
    private syncFieldNameToDom;
    /**
     * Warns once per page that `open()` refused a hidden trigger, naming the
     * trigger wrapper. A refusal is otherwise silent: the click or the key does
     * nothing (`FIXME.md` QUALITY-798).
     */
    private warnHiddenTriggerOnce;
    /**
     * Warn once per page when a control sits before the filter input in the
     * popup, which the prepend recipe of the header slot can cause (DESIGN.md
     * "Popup header / footer slots"): while the filter is active, Tab from the
     * input skips that control, and Shift+Tab enters it instead of leaving the
     * select component.
     * - Runs at the end of each `open()` while the filter is active, after
     *   `onOpen`, which may add or enable a header control. Never at
     *   construction: the recipe moves the header in a subclass constructor,
     *   after `super()`.
     * - A control counts when it is, or can become, a Tab stop (`canBeTabStop`).
     * - Walks only the popup children before the input, so the default order
     *   costs one sibling read.
     */
    private warnIfFocusableBeforeFilterInput;
    /**
     * Open the popup.
     * - Does nothing in each of these cases:
     *   - the popup is already open;
     *   - the select component is disabled;
     *   - `destroy()` has started, so an `open()` call from a listener that
     *     `destroy()` runs is ignored, such as an `onClose` that reopens the
     *     popup;
     *   - `close()` is returning focus to the trigger, so a focus handler that
     *     calls `open()` there is ignored;
     *   - the select component is putting its closed state back, in `close()`
     *     or in `destroy()`, so an `open()` call from code that the browser
     *     runs there is ignored, such as a `beforetoggle` listener of the
     *     popup or the reaction of a root that is a custom element;
     *   - this select component's own `showPopover()` is running, so an
     *     `open()` call from a listener there is ignored, for example after
     *     the listener closed the select component;
     *   - `open()` is undoing a show that the browser refused, so an `open()`
     *     call from a listener that the undo runs is ignored;
     *   - the trigger is hidden: fully outside the viewport, or fully clipped
     *     away by an ancestor.
     * - The first refusal for a hidden trigger on a page logs a console
     *   warning.
     * - Sets an initial active row, if an enabled item row exists.
     * - An action row is never the initial active row.
     * - While the filter is active, DOM focus moves to the filter input.
     * - In a browser with the Popover API, the popup shows through
     *   `showPopover()`.
     *   - The browser then focuses a control in a header or footer slot that
     *     has the `autofocus` attribute.
     *   - While the filter is active, the filter input takes DOM focus after
     *     that.
     * - If a listener closes the select component while `showPopover()` runs,
     *   such as an `onFocus` that the `autofocus` move fires, or a
     *   `beforetoggle` listener of the popup, the open stops there.
     *   - It attaches no positioner, no outside-click handler and no
     *     scroll-gesture listener.
     *   - It fires no `onOpen`.
     *   - A reopen from that listener is ignored, as the list above says.
     *   - A listener that only re-renders does not stop the open.
     * - If a function that `open()` calls closes or destroys the select
     *   component, the open stops there too.
     *   - Such functions are the `filterable` predicate, the group functions,
     *     the content functions of the arrow and of the list, and the
     *     overridable methods that `open()` runs: `isEmpty`, the two
     *     `shouldListenFor...` predicates, `focusInitial` and `onOpened`.
     *     `onOpen` is one too.
     *   - The open attaches nothing more, and what it had attached is detached.
     *   - Of `onOpened` and `onOpen`, the ones that have not run yet do not
     *     run. `onClose` has fired for that close.
     *   - If the function also opens the select component again, that newer
     *     open is the one that counts. The first call adds nothing to it.
     *   - Only the notifications among those functions are meant to do this.
     *     A function that builds or decides must not change the select
     *     component: the popup may then show outdated rows.
     * - If another popover of the same document is in the middle of its show
     *   or hide, `showPopover()` can throw an `InvalidStateError`, as
     *   Chromium 156, Firefox 153 and WebKit 26.5 do.
     *   - `open()` then undoes itself through `close()`, so the select
     *     component stays closed.
     *   - A `close()` override that throws before it calls `super.close()`
     *     leaves the select component marked open, with no list shown.
     *   - Neither `onOpen` nor `onClose` fires.
     *   - `open()` passes the browser's error on to its caller.
     *   - An error raised during that undo is dropped, for example an error
     *     of `createTriggerArrowContentElFn`, of an `onActiveItemChange`
     *     listener or of a `close()` override.
     *   - An error inside that `close()` skips the rest of it, such as the
     *     active-item report.
     *   - To open from a listener that runs during such a show or hide, call
     *     `open()` inside a `setTimeout` callback.
     *   - A `queueMicrotask` callback is not enough: when the browser itself
     *     started the show, as a `popovertarget` button does, that callback
     *     still runs inside it.
     * - The positioner closes the popup again, with the close reason
     *   `'hidden'`, when a scroll outside the popup finds the trigger hidden.
     * - Builds the item elements, which exist only while the popup is open.
     * - Attaches the positioner.
     * - Attaches the outside-click handler.
     * - Attaches the scroll-gesture and zoom-gesture listeners; see
     *   `behaviorOfScrollGestureFn` and `behaviorOfZoomGestureFn`.
     * - The initial active row comes from `focusInitial`, which a subclass can
     *   override.
     * @group Open & close
     */
    open(): void;
    /**
     * The steps of `open()` that run while the active-item report waits.
     * - They are the list render, the positioner, the outside-click handler,
     *   the gesture listeners and the initial active row.
     * - `superseded` is the test of `open()`: whether a function that the call
     *   ran has closed or destroyed the select component, or opened it again.
     * - Returns `false` as soon as a step finds the call superseded. Nothing
     *   that this call created is attached then.
     */
    private attachOpenPopup;
    /**
     * Close the popup.
     * - If the popup is already closed, does nothing.
     * - Detaches the positioner, the outside-click listener and the
     *   scroll-gesture and zoom-gesture listeners.
     * - If the library blocks the moves of a touch whose touch-down closed
     *   the popup, or swallows its click, that touch keeps its own listeners.
     *   - They go when the touch and its click are over, or when a second
     *     finger or a new touch lands.
     * - If a zoom closed the popup and blocks the zoom, the zoom keeps its own
     *   listeners, on its fingers and on the document.
     *   - They go when every finger has lifted.
     * - Clears the item DOM.
     * - Resets the focused-item state.
     *
     * Focus return is decided automatically: when DOM focus is still inside
     * the popup at the moment of close - the filter input (Esc on an empty
     * filter, a single-select pick, an outside press on a non-focusable area)
     * or a focusable control the app placed in a header / footer slot (Esc
     * there, or `close()` called from its own click) - focus is returned to
     * the trigger. Tab-away and outside clicks on focusable elements have
     * already moved focus elsewhere, so we leave it alone.
     * - The return happens before the popup is hidden and before `onClose`:
     *   hiding a focused element first would let the browser drop focus to
     *   `<body>`, a blur and focus pair the select component never meant.
     * - `open()` also calls `close()` to undo itself when the browser refuses
     *   its `showPopover()`.
     *   - That close fires neither `onClosed` nor `onClose`.
     *   - `open()` drops an error that this close raises, so that its caller
     *     gets the browser's error.
     * @group Open & close
     */
    close(): void;
    /**
     * Puts the popup and its list into the closed state.
     * - Detaches the positioner and the listeners of the open popup.
     * - Empties the list and hides the popup.
     * - Resets the active row and the filter query.
     * - It calls no content function, no predicate and no overridable method,
     *   and it fires none of the library's callbacks.
     * - The arrow of the closed state is not its work: `close()` renders that
     *   arrow right after it.
     * - The browser can still run app code inside its writes: the reaction of
     *   a root that is a custom element, a `beforetoggle` listener of the
     *   popup, and the reactions of custom elements in the rows it removes.
     * - `open()` does nothing while it runs.
     * - `close()` runs it, after the focus return.
     * - `open()` runs it when a function it called closed the select
     *   component, since that call may have written over the closed state
     *   afterwards.
     * - `destroy()` always runs it after its `close()` call, whatever that
     *   call did.
     * - A second run on a closed popup writes the same values again.
     */
    private clearOpenState;
    /** `open()` with a stated reason; see `pendingOpenReason`. */
    private openWithReason;
    /**
     * `close()` with a stated reason; see `pendingCloseReason`. Protected for
     * the single select component's pick, which closes with `'choose'`.
     * @internal
     */
    protected closeWithReason(reason: LLSelectCloseReason): void;
    /**
     * Picks what the select component does with one scroll gesture while the
     * popup is open.
     * - The library's scroll-gesture listeners call this method on every
     *   gesture that the docstring of `behaviorOfScrollGestureFn` lists.
     * - The listeners fill `gesture`: what the gesture is and where it
     *   happens. See {@link LLSelectScrollGesture}.
     * - The default returns `behaviorOfScrollGestureFn(gesture)`.
     * - Configure via `behaviorOfScrollGestureFn` (no subclass needed).
     * - An override replaces the setting, and
     *   `super.behaviorOfScrollGesture(gesture)` still reaches the setting.
     * - An override that answers gestures outside the select component also
     *   overrides {@link shouldListenForScrollGesturesOutside}. By default the
     *   library listens there only while the setting is not
     *   `defaultBehaviorOfScrollGesture`.
     * @group Subclassing: semantics
     */
    protected behaviorOfScrollGesture(gesture: LLSelectScrollGesture): LLSelectScrollGestureBehavior;
    /**
     * Whether the select component listens for scroll gestures outside
     * itself, on the document, while the popup is open.
     * - `open()` calls this method once per open, right after it attaches the
     *   outside-click listeners.
     * - The default returns `true` when `behaviorOfScrollGestureFn` is not
     *   `defaultBehaviorOfScrollGesture`.
     *   - The default function leaves every gesture outside the select
     *     component alone, so the library does not listen there for it.
     *   - `@llselect/core` and `@llselect/core/behavior-presets` each export a
     *     copy of the default function, and either copy counts as the default.
     * - A subclass whose `behaviorOfScrollGesture` answers gestures outside
     *   the select component overrides this method to return `true`.
     * - Listening there has a cost. A non-passive `wheel` or `touchmove`
     *   listener on the document makes every scroll of the page wait for
     *   script while the popup is open.
     * @group Subclassing: semantics
     */
    protected shouldListenForScrollGesturesOutside(): boolean;
    /**
     * Picks what the select component does with one zoom gesture while the
     * popup is open.
     * - The library's gesture listeners call this method on every zoom
     *   gesture that the docstring of `behaviorOfZoomGestureFn` lists.
     * - The listeners fill `gesture`: where the zoom happens. See
     *   {@link LLSelectZoomGesture}.
     * - The default returns `behaviorOfZoomGestureFn(gesture)`.
     * - Configure via `behaviorOfZoomGestureFn` (no subclass needed).
     * - An override replaces the setting, and
     *   `super.behaviorOfZoomGesture(gesture)` still reaches the setting.
     * - An override that may block or close a zoom also overrides
     *   {@link shouldListenForZoomGesturesOutside}, since a finger of a pinch
     *   may land outside the select component.
     * - By default the library listens there only while the setting is not
     *   `defaultBehaviorOfZoomGesture`.
     * @group Subclassing: semantics
     */
    protected behaviorOfZoomGesture(gesture: LLSelectZoomGesture): LLSelectZoomGestureBehavior;
    /**
     * Whether the select component listens for zoom gestures outside itself,
     * on the document, while the popup is open.
     * - `open()` calls this method once per open, right after it attaches the
     *   outside-click listeners.
     * - The default returns `true` when `behaviorOfZoomGestureFn` is not
     *   `defaultBehaviorOfZoomGesture`.
     *   - The default function leaves every zoom alone, so the library does
     *     not listen outside the select component for it.
     *   - `@llselect/core` and `@llselect/core/behavior-presets` each export a
     *     copy of the default function, and either copy counts as the default.
     * - A subclass whose `behaviorOfZoomGesture` may block or close a zoom
     *   overrides this method to return `true`: a finger of a pinch may land
     *   outside the select component, where only the document's listeners see
     *   its events and can cancel them.
     * - Listening there has a cost. Non-passive `wheel`, `touchstart` and
     *   `touchmove` listeners on the document make every scroll of the page
     *   wait for script while the popup is open.
     * @group Subclassing: semantics
     */
    protected shouldListenForZoomGesturesOutside(): boolean;
    /** Attaches the scroll-gesture and zoom-gesture listeners for this open cycle; `close()` detaches them. */
    private attachGestures;
    /**
     * Rebuild the trigger and (while open) the popup list from current state.
     * - Use it after mutating item OBJECTS in place (e.g.
     *   `users[0].name = 'X'`). The library cannot detect that on its own.
     * - Use it too when a function it reruns reads state that changed outside
     *   the items, such as the page language.
     * - It reruns `itemToStringFn` and every content function of the trigger
     *   and the popup list.
     * - It does not rerun the header and footer content functions.
     * - It cannot reach the pack-owned attributes of the filter input, its
     *   placeholder and fallback `aria-label`; `setUiTranslationPack` does.
     * - It re-derives the display order (the `gatherGroups` gather).
     * - While the filter is active, it re-runs the filter against the current
     *   item text.
     * - The refresh is purely visual: it does NOT fire `onChange` and does NOT
     *   run `onItemsChanged`.
     * - Orchestrator: composes `renderTrigger` + `renderPopupList`; touches no
     *   DOM directly.
     * @group Lifecycle
     */
    rerender(): void;
    /**
     * Tear down the instance.
     * - Closes the popup, which removes the document and window listeners of
     *   the open popup and stops the popup positioning.
     * - If a `close()` override does not close the popup, `destroy()` removes
     *   those listeners and stops the positioning itself. `onClose` does not
     *   fire then.
     * - If that close throws, in a `close()` override or in an `onClose`
     *   listener, `destroy()` still finishes every step below, and then passes
     *   the error on to its caller.
     * - Once `destroy()` has started, `open()` does nothing. So a listener
     *   that this close runs, such as an `onClose` that reopens the popup,
     *   cannot open it again.
     * - Removes the click listener from `labelEl`, and removes an id the
     *   library minted on it.
     * - Removes the library's class, its inline styles and the
     *   `data-llselect-color-scheme` attribute from the mount element, ends the
     *   automatic color-scheme checks, and empties the element.
     * - After `destroy()`, call no method except `destroy()` itself. Each
     *   `destroy()` call repeats the cleanup and empties the mount element. Do
     *   not call it again once the mount element has been reused, for other
     *   content or for a second instance.
     * - REQUIRED before discarding an instance whose popup might be open; a
     *   framework wrapper calls it on unmount. Skipping it there leaks the
     *   outside-click, scroll-gesture, zoom-gesture, focusout, scroll and
     *   resize listeners.
     * - Ends the library's handling of a touch whose touch-down closed the
     *   popup.
     *   - That handling blocks the moves of the touch or swallows its click.
     *   - Without `destroy()`, the handling lasts until the finger lifts, a
     *     second finger lands or a new touch starts, and the wait for the
     *     click up to a second after the lift.
     * - Ends the library's handling of a zoom that closed the popup and blocks
     *   the zoom.
     *   - That handling blocks the moves of the zoom and the touch-down of a
     *     further finger.
     *   - Without `destroy()`, the handling lasts until every finger has
     *     lifted.
     * - Once those handlings are over, discarding a CLOSED instance without
     *   `destroy()` leaks nothing: only
     *   its mount element and `labelEl` retain it, through its own DOM
     *   listeners. Once those elements leave the document and the application
     *   holds no reference to them, the instance is collectable. The root
     *   class, the `overflow-anchor` style and the
     *   `data-llselect-color-scheme` attribute stay on the mount. If the mount
     *   stays in the document outside a shadow root, the automatic checks
     *   continue for an `'auto'` instance: it decides again when the operating
     *   system's color preference changes, and when an attribute of `<html>`
     *   or `<body>` changes.
     * - Building a second instance on the same element replaces the first. The
     *   library drops the first instance's queued scheme decision and its
     *   automatic checks. Call `destroy()` on the first instance BEFORE
     *   building the second. After the rebuild, call no method of the first
     *   instance; its `destroy()` would empty the element under the new select component.
     * @group Lifecycle
     */
    destroy(): void;
    /**
     * Open if closed, close if open.
     * @group Open & close
     */
    toggle(): void;
    /**
     * Whether the popup is currently open.
     * - Read through a method, like `isDisabled()`.
     * - The same state is mirrored on the DOM as CSS hooks:
     *   `data-state="open|closed"` on the trigger wrapper,
     *   `classIdMap.openClass` on the root.
     * @group Open & close
     */
    isOpened(): boolean;
    /**
     * Return the full list the user chooses from, in data order (as passed to `setItems`).
     * - The chosen items are a subset of it.
     * - The rendered list may differ in order and content: see `getVisibleItems`.
     * - Returns the LIVE internal array, typed read-only. Do not mutate it
     *   (TS blocks it; plain-JS callers must treat it as frozen).
     * - Structural mutation would silently bypass chosen-state reconciliation,
     *   re-filtering, and re-render. Replace the list via `setItems` instead.
     * - Mutating item OBJECTS + `rerender()` is the supported in-place path.
     * @group Items
     */
    getItems(): readonly T[];
    /**
     * Return the resolved UI strings: the built-in English defaults merged
     * with the `uiTranslationPack` setting.
     * - Reuse these in your own UI instead of keeping a second translation
     *   source. For example, a tag remove button tooltip:
     *   `sel.getUiTranslationPack().tagRemoveButtonAriaLabel(label)`.
     * - Returns the LIVE object. Treat it as immutable, like `getItems`.
     * @group i18n
     */
    getUiTranslationPack(): Readonly<LLSelectUiTranslationPack>;
    /**
     * Replace the UI-translation pack at runtime, so switching language needs
     * no re-`new`.
     * - One of the two settings with a runtime setter (the other is
     *   `setPlaceholder`); both are copy. The rule: {@link LLSelectBaseSettings}.
     * - The pack is resolved exactly like the constructor's: merged over the
     *   built-in English pack, NOT over the previously set pack.
     * - An explicit constructor `placeholder` keeps winning over the new pack's
     *   `triggerPlaceholder`.
     * - Re-renders the trigger and the open popup.
     * - Also re-applies the pack-owned attributes `rerender()` cannot reach:
     *   the filter input placeholder and its fallback `aria-label`.
     * - The clear button needs no such step: `rerender()` rebuilds it, and the
     *   rebuild reads the new pack - unless a `createTriggerClearButtonEl`
     *   override returns the previous element, which then owns the label.
     * @group i18n
     */
    setUiTranslationPack(uiTranslationPack: Partial<LLSelectUiTranslationPack>): void;
    /**
     * Replace the trigger placeholder text at runtime. It is one of the two
     * settings with a runtime setter (the other is `setUiTranslationPack`);
     * both are copy. The rule: {@link LLSelectBaseSettings}.
     * - `null` = fall back to the pack default (`uiTranslationPack.triggerPlaceholder`),
     *   mirroring an unset constructor `placeholder`. An explicit value keeps
     *   winning over later `setUiTranslationPack` calls, exactly like the
     *   constructor input.
     * - Takes effect immediately. Visible only while nothing is chosen - the
     *   placeholder never renders otherwise (the trigger is still re-rendered,
     *   which also refreshes the screen-reader text).
     * @group Trigger
     */
    setPlaceholder(placeholder: string | null): void;
    /**
     * Replace the full list the user chooses from.
     * - A chosen item the new list does not hold is dropped.
     * - The input is shallow-copied; later external mutation does not affect
     *   the select component.
     * - Items MUST be unique under `compareFn` (it defines item identity, and the
     *   selection is a set). Duplicates render stale selection DOM; the default
     *   compareFn warns once per page, a custom compareFn is the caller's
     *   responsibility (not scanned, to keep large lists cheap).
     * - If the popup is open, it re-renders now. While closed, the DOM is
     *   built lazily on the next `open()`.
     * - `LLSelectMultiple` renders an open popup once more when this call
     *   drops or reorders chosen items, so rows see the final chosen list.
     * - Both shipped variants re-render the trigger content from `onItemsChanged`
     *   (the multiple count total, custom content that reads `items`).
     * - `LLSelectMultiple`'s `triggerDisplay: 'tags'` mode is opt-in; `'count'` is
     *   the default.
     * - When `triggerDisplay` is `'tags'`, that content render is one chip per
     *   chosen item, unless `createTriggerContentElFn` replaces the content.
     * - Subclasses may reconcile chosen-state via {@link onItemsChanged}
     *   (e.g. single mode drops a chosen value that is no longer in the list).
     * @group Items
     */
    setItems(items: readonly T[]): void;
    /**
     * Warn (once per page, never throw) when the item list has duplicates under
     * the DEFAULT compareFn - an O(n) Set check. A custom compareFn is documented
     * only: an O(n^2) scan would tax large lists (see PERFORMANCE-31), and keeping
     * its identity unique is the caller's responsibility.
     * - The Set is SameValueZero, and so is the default compareFn, so a repeated
     *   `NaN` item counts as a duplicate on both sides.
     */
    private warnOnDuplicateItems;
    /**
     * Enable or disable the whole control. Disabled: the trigger gets
     * `aria-disabled` and the trigger wrapper `data-disabled` (never the native
     * `disabled` attribute, which would suppress the hover / focus events a
     * tooltip needs), opening is blocked, an open popup closes, the trigger
     * leaves the tab order unless `focusableWhenDisabled` is set, and no button
     * of the trigger buttons strip is a Tab stop. Stored as state, mirroring `setItems` /
     * `setChosenItems` (this design keeps mutable state out of settings).
     * @group Disabling
     */
    setDisabled(value: boolean): void;
    /**
     * Whether the whole control is disabled.
     * @group Disabling
     */
    isDisabled(): boolean;
    /**
     * The color scheme the select component currently shows.
     * - Returns the result of the latest decision, `'light'` or `'dark'`. If the library has not decided for this select component yet, the method decides now and returns that result.
     * - A decision this early does not cancel the first queued decision.
     * - For a select component inside another select component's trigger or popup, the first queued decision can still change the result.
     * - Never `'auto'`. The `colorScheme` setting explains how `'auto'` resolves.
     * @group Color scheme
     */
    getColorScheme(): 'light' | 'dark';
    /**
     * Decide the color scheme again, now.
     * - Call it after replacing a stylesheet that affects the scheme.
     * - Call it after a class or attribute that selects the scheme changes on the root element or on an ancestor below `<body>`. The same holds for the variable `--llselect-color-scheme` set there.
     * - If you build the select component before inserting its element into the document, call it after the insertion. A detached element has no computed style, so an `'auto'` select component decided light.
     * - The library checks by itself when the popup opens. Outside a shadow root, it also checks when the operating system's color preference changes, and when an attribute of `<html>` or `<body>` changes.
     * - A select component inside a shadow root misses those two automatic checks. Call it after such a change.
     * - Changes nothing when the `colorScheme` setting is `'light'` or `'dark'`.
     * @group Color scheme
     */
    refreshColorScheme(): void;
    /** Run the decision and reflect it on the root attribute: the read step, then the write step. */
    private syncColorScheme;
    /** The read step: resolve the scheme from the page. In a batch, the roots outside other select components all read before any writes, so one style flush serves them (`decideBatch` in color-scheme.ts). */
    private readColorScheme;
    /** The write step: the root attribute, only when it changed (the root may itself be an observed element). */
    private applyColorScheme;
    /** Reflect `this.disabled` onto the trigger's ARIA and tabindex, the wrapper's `data-disabled` and the strip's Tab stop. */
    private syncDisabledStateToDom;
    /**
     * Recompute the trigger's tabindex from every input that owns it: disabled
     * state (with `focusableWhenDisabled`), and the filterable open cycle -
     * while the filter input is the focus host the trigger leaves the tab
     * order, so the open select component stays a single tab stop and Shift+Tab exits
     * instead of landing on the trigger with the popup still open
     * (`docs/llm/A11Y.md` "Focus").
     */
    private syncTriggerTabindex;
    /**
     * Subclass hook: called once **after** the popup finishes opening.
     *
     * > No **before** counterpart: there is no `onOpening`.
     *
     * - Default no-op.
     * - The `onOpen` setting fires right **after** this.
     * - The hook is for subclass logic, and the setting for consumer
     *   notification.
     * - If an override of this closes or destroys the select component, or
     *   opens it again, the `onOpen` setting does not fire for this `open()`
     *   call.
     * - If a listener closes the select component while `open()` runs
     *   `showPopover()`, this does not run, while {@link onClosed} does.
     * - If a function that `open()` calls **before** this closes the select
     *   component, such as a content function of the list, this does not run
     *   either.
     * - If the browser refuses the `showPopover()` of `open()`, neither this
     *   nor {@link onClosed} runs.
     * @group Subclassing: reactions
     */
    protected onOpened(): void;
    /**
     * Subclass hook: called once **after** the popup finishes closing.
     *
     * > No **before** counterpart: there is no `onClosing`.
     *
     * - The `onClose` setting fires right **after** this, and both run.
     * - If a listener closes the select component while `open()` runs
     *   `showPopover()`, this runs with no {@link onOpened} **before** it.
     * - If a function that `open()` calls **before** {@link onOpened} closes
     *   the select component, such as a content function of the list, this
     *   runs with no {@link onOpened} **before** it as well.
     * - If the browser refuses the `showPopover()` of `open()`, the close that
     *   undoes the open does not run this.
     * @group Subclassing: reactions
     */
    protected onClosed(): void;
    /**
     * Subclass hook: called **after** the chosen state actually changed, right
     * **before** the variant's `onChange` setting fires (the hook runs first and both run,
     * as with `onClosed`). Default no-op.
     *
     * > Pairs with the variant's `onChosenChanging`, which runs **before** a user change and can stop it.
     * @group Subclassing: reactions
     */
    protected onChosenChanged(): void;
    /**
     * Called inside `setItems`, **after** the new list is installed and an open
     * popup list re-rendered, and **before** the final action-row rebuild at the
     * end of the call. Override to reconcile state that depends on the item list
     * (e.g. clear a chosen value that disappeared). Default no-op.
     *
     * > No **before** counterpart: there is no `onItemsChanging`.
     * @group Subclassing: reactions
     */
    protected onItemsChanged(): void;
    /**
     * Orchestrator: composes the clear-button rebuild + `renderTriggerContent` +
     * `renderTriggerArrow` to (re)build the whole trigger from state, then
     * brings the trigger buttons strip in line (its `hidden` flag and its Tab
     * stop) and writes the screen-reader text from
     * {@link computeTriggerScreenReaderText}; touches no DOM directly.
     * Subclasses normally override {@link renderTriggerContent}, not this.
     * - Runs on every change of the chosen value, the placeholder or the pack.
     * - `rerender()` runs it too.
     * - While `clearable` is on, the first run builds the clear button and every
     *   later run swaps it for whatever `createTriggerClearButtonEl` returns: a
     *   fresh button from the base implementation, like the arrow. An override
     *   may return the previous element; it is then kept in place.
     * - If the button is rebuilt and the old one held focus - on it or inside
     *   its icon - the rebuilt BUTTON gets it.
     * - If the builder returned the same element, nothing was rebuilt, and focus
     *   goes back to the node that held it, if that node is still inside the
     *   button and can take focus; otherwise focus stays on the button.
     * - `setItems` runs `renderTriggerContent` alone, because only the content
     *   reads the list (the multiple count total, a custom
     *   `createTriggerContentElFn`'s `items`).
     * - A `setItems` that drops the chosen entry runs the whole trigger.
     * - Runs once from the `LLSelectSingle` / `LLSelectMultiple` constructor, right
     *   after `super()`.
     * - On that first run a FURTHER subclass's own fields are still `undefined`:
     *   JS runs a subclass's field initializers only after its super constructor
     *   returns (virtual-call-in-constructor). An override of a trigger method
     *   (`renderTriggerContent`, or a `create*El` it calls) that reads such a
     *   field sees `undefined` there.
     * - The recipe: put construction-time configuration in the typed
     *   `subclassSettings` constructor param. `this.settings` is complete before
     *   any construction code runs.
     * - For genuine instance state, tolerate defaults during construction, or call
     *   `rerender()` at the end of your own constructor.
     * - The popup-list methods do NOT run here; they wait for `open()`. See
     *   DESIGN.md "Customization model".
     * @group Subclassing: rendering
     */
    protected renderTrigger(): void;
    /**
     * Write the trigger's content slot (`triggerContentEl`), replacing whatever
     * was there. The single DOM-writing primitive behind every
     * `renderTriggerContent` path.
     * - Called by `renderTriggerContent`: the base default and the
     *   `LLSelectSingle` / `LLSelectMultiple` overrides.
     * - `string` -> set as `textContent` (plain text, NOT parsed as HTML). Used
     *   for the default placeholder / `itemToString` text / count text.
     * - `HTMLElement` -> inserted as-is via `replaceChildren`; caller owns the
     *   node. Used for whatever the `createTriggerContentElFn` setting returned.
     * - It writes what the screen shows only. Assistive technology reads the
     *   screen-reader text, which the library writes after the content render
     *   from {@link computeTriggerScreenReaderText}.
     * @group Subclassing: rendering
     */
    protected commitTriggerContentToDom(content: HTMLElement | string): void;
    /**
     * The screen-reader text: the value assistive technology reads for the
     * trigger, never shown.
     * - The library calls it after every trigger content render: every full
     *   trigger render (`renderTrigger`), plus every `setItems`. It writes the
     *   result as plain text into a visually hidden span inside the trigger.
     * - The span exists for screen readers. The trigger is a `combobox` while
     *   the filter is inactive, and WAI-ARIA 1.2 gives a combobox that is not
     *   a text field the value of its descendant content. The visible
     *   `triggerContentEl` carries `aria-hidden="true"`, so this text is the
     *   value.
     * - While the filter is active, the trigger is a `button`, named through
     *   `aria-labelledby`. The chain ends at the span, so the name carries
     *   this text.
     * - The usual override calls `super` and edits the returned string, or
     *   returns its own plain text.
     * - Base default: the placeholder. `LLSelectSingle` and `LLSelectMultiple`
     *   first try their `triggerContextToScreenReaderTextFn` setting, then
     *   read out the information the screen shows.
     * @group Subclassing: semantics
     */
    protected computeTriggerScreenReaderText(): string;
    /**
     * The `lang` of the screen-reader text, given the text
     * `computeTriggerScreenReaderText` returned: an item's code while the text
     * is exactly that item's text, else `null`, which writes none. Base: `null`.
     * @internal
     */
    protected computeTriggerScreenReaderTextLang(_text: string): string | null;
    /**
     * Write the screen-reader text and its `lang`. The base runs it after
     * every trigger content render, so a `renderTriggerContent` override never
     * has to.
     */
    private renderTriggerScreenReaderText;
    private commitTriggerScreenReaderTextToDom;
    /**
     * Mirror the empty/filled state onto the trigger wrapper's `data-empty`
     * attribute (`"true"` when `isEmpty()`, else `"false"`). A CSS styling
     * hook, independent of the rendered content. Called by the subclass
     * `renderTriggerContent` overrides.
     * @group Subclassing: rendering
     */
    protected syncEmptyStateToDom(): void;
    /**
     * Whether the control currently has no selection (drives `data-empty`).
     * Base default is always `true` (the base trigger only shows the
     * placeholder); `LLSelectSingle` / `LLSelectMultiple` override it.
     * @group Subclassing: semantics
     */
    protected isEmpty(): boolean;
    /**
     * Orchestrator: composes the `*ToDom` primitives to (re)build the trigger's
     * content slot from state; touches no DOM directly. Override in subclasses to
     * display the chosen value(s); this base default commits the placeholder and
     * the empty flag. Always write via `commitTriggerContentToDom` (content) and
     * `syncEmptyStateToDom` (the `data-empty` flag), never `triggerContentEl`
     * directly.
     * @group Subclassing: rendering
     */
    protected renderTriggerContent(): void;
    /**
     * Orchestrator: composes the `*ToDom` / `*El` primitives to (re)build the
     * trigger's arrow slot from state; touches no DOM directly. Calls
     * `createTriggerArrowContentEl` with the current `isOpened` and commits whatever it returns
     * (including `null` -> no arrow for this state).
     */
    private renderTriggerArrow;
    /**
     * Trigger arrow element for the given open state.
     * - Default reads `createTriggerArrowContentElFn`; `null` (setting unset, or returned for
     *   a state) = no arrow for that state.
     * - Override only when extending; for one-off arrows pass the setting.
     *   Mirrors `createTriggerClearButtonEl` / `createPopupListItemContentEl`.
     * @group Subclassing: rendering
     */
    protected createTriggerArrowContentEl(state: {
        isOpened: boolean;
    }): HTMLElement | SVGElement | null;
    /**
     * Write the trigger's arrow slot: clear it, then append `el` if non-null.
     * - `el = null`: clear only, leaving the slot empty (no arrow this state).
     * The sole mutator of the arrow slot; called by `renderTriggerArrow`.
     */
    private commitTriggerArrowContentElToDom;
    /**
     * Orchestrator: composes `createPopupListItemEl` (build) + `computePopupSegments` +
     * `commitPopupSegmentsToDom` (write) to rebuild the popup list from
     * `getVisibleItems()`; touches no DOM directly. Called by `open()` and by
     * `setItems()` while open. Also clamps `focusedIndex` if the list shrank and
     * re-applies focus visuals.
     * - Extend it by wrapping: override, do your work before or after, then
     *   call `super.renderPopupList()`. The ui-select bridge frees its row
     *   scopes this way. Or override one of the methods it calls through `this`:
     *   `createPopupListItemEl`, `createPopupListChooseAllRowEl`,
     *   `createPopupListLeadingActionRowEl` /
     *   `createPopupListTrailingActionRowEl`, `itemToGroupKey`,
     *   `getVisibleItems`.
     * - Its other internals stay private on purpose. They re-establish the
     *   `itemEls[i] <-> getVisibleItems()[i]` alignment as one unit, so no
     *   subclass can leave keyboard nav or `aria-activedescendant` half-synced.
     * @group Subclassing: rendering
     */
    protected renderPopupList(): void;
    /**
     * Split the flat visible list into render segments: ungrouped item elements
     * and contiguous same-key groups. Pure computation - resolves keys via
     * `itemToGroupKey` (the overridable method; all-`null` keys = flat list) and key
     * equality via `groupKeyCompareFn`, touches no DOM. Group labels are NOT
     * added to `itemEls`, so `itemEls[i]`
     * stays aligned with `getVisibleItems()[i]` and keyboard nav skips labels for
     * free. `console.warn`s once per non-contiguous key reappearance (unsorted
     * data would otherwise emit a duplicate label for the same group) -
     * reachable with `gatherGroups: false`; the default gather feeds this an
     * already-contiguous list.
     */
    private computePopupSegments;
    /**
     * Replace every popup-list child with the leading rows, the rendered
     * segments and the trailing rows. A pinned block goes inside its sticky
     * wrapper, and the wrapper is left out while the block has no rows.
     */
    private commitPopupSegmentsToDom;
    /**
     * Write `aria-posinset` / `aria-setsize` while the list holds a non-item
     * row, so the position a screen reader announces ("3 of 16") does not count
     * the choose-all row or the action rows. The browser's own count would.
     * - An item row outside a group counts among the item rows outside groups.
     * - An item row inside a group gets nothing: the browser counts the rows of
     *   its group, which holds item rows only.
     * - A row of the leading block (the choose-all row, then the leading action
     *   rows) or of the trailing block counts within its block.
     * Without a non-item row nothing is written, so such lists pay nothing. An
     * in-place row rebuild copies the two attributes from the row it replaces
     * (`copyRowPosition`).
     */
    private commitPopupListRowPositionsToDom;
    /**
     * Build the whole group container of the popup list: the label element followed by the group's item rows.
     * - The library calls it, once per group of the current render, on every
     *   list render. You never call it yourself.
     * - All four params come from the library. Forward them to `super` unchanged.
     * - `index` is the group's position among this render's groups, counted
     *   from 0. It only mints the group id. It is not an identity: it changes
     *   whenever the visible list changes.
     * - To change only the label's content, do not override this. Pass the
     *   `createGroupLabelContentElFn` setting instead.
     * - To change the element itself, override it, call `super.createGroupEl(...)`,
     *   and edit the returned element. Keep the `role` and `aria-label` the base set.
     * - Internals: the base sets the id, `role="group"` named by `groupKeyToString`
     *   (`aria-label`), `lang` from {@link groupKeyToLang} (none for `null`), an
     *   `aria-hidden` visible label element filled from
     *   {@link createGroupLabelContentEl} (else the plain label text), then the
     *   group's item elements; `aria-disabled` + `data-disabled` when the group
     *   is disabled.
     *
     * @param key - the group's key, supplied by the library
     * @param index - the group's position among this render's groups, supplied by the library
     * @param itemsInGroup - the group's items, supplied by the library (for counts / rich content)
     * @param itemEls - the group's already-built option elements, supplied by the library
     * @group Subclassing: rendering
     */
    protected createGroupEl(key: GroupKey, index: number, itemsInGroup: readonly T[], itemEls: HTMLElement[]): HTMLElement;
    /**
     * Group label -> its visible content element (icon / count badge / rich
     * markup). Mirrors `createPopupListItemContentEl`.
     * - Default reads `createGroupLabelContentElFn`, else `null` so `createGroupEl`
     *   uses plain text from `groupKeyToString`.
     * - The group's accessible name stays `groupKeyToString` (container `aria-label`);
     *   this fills only the visible, `aria-hidden` label content.
     * - Override only when extending; for one-off rich labels pass the setting.
     * @group Subclassing: rendering
     */
    protected createGroupLabelContentEl(key: GroupKey, itemsInGroup: readonly T[]): HTMLElement | null;
    /**
     * Re-render a single item's element in place instead of rebuilding the
     * whole popup list. The DOM work is O(1) regardless of list size, so
     * flipping one selection in a 10k-item list does not recreate 10k nodes
     * (the lookup to find the item is O(n), but that is a cheap comparison
     * loop next to DOM mutation). No-op if the popup is closed or the item is
     * not in the current list. Used by multi-select toggle.
     * @group Subclassing: rendering
     */
    protected replacePopupListItemElInDom(item: T): void;
    /**
     * Build the whole DOM element for one item row of the popup list.
     * - The library calls it, once per row of `getVisibleItems()`, on every
     *   list render. You never call it yourself.
     * - Both params come from the library. Forward them to `super` unchanged.
     * - `item` is the row's item.
     * - `index` is the row's position in `getVisibleItems()`, counted from 0.
     *   That is the list as rendered: grouped, filtered, minus hidden chosen
     *   rows. It is NOT the position in `items`.
     * - `index` is not an identity. It changes whenever the visible list
     *   changes. Item identity is `compareFn`. Never store it.
     * - To change only what a row shows, do not override this. Pass the
     *   `createPopupListItemContentElFn` setting instead.
     * - To change the element itself, override it, call
     *   `super.createPopupListItemEl(item, index)`, and edit the returned element: add a
     *   class, a `title`, a wrapper. Demo sections 9.1, 13.1 and 13.2 do this.
     * - Keep the `id` and `role` the base set. Do not put focusable controls
     *   inside the row. The row itself is the control.
     * - The element is rebuilt on every render. Do not keep a reference to it.
     * - After this returns, the library adds `aria-posinset` and `aria-setsize`
     *   to a row outside a group while the list holds a non-item row
     *   (`docs/llm/A11Y.md` "Action rows").
     * - Internals: the base sets `id` (`<listbox id>-item<index>`, the target of
     *   `aria-activedescendant`), `role="option"`, the visible content from
     *   {@link createPopupListItemContentEl} (else `textContent` from {@link itemToString}),
     *   `aria-label` = `itemToString` when the content is custom, `lang` from
     *   {@link itemToLang} when it returns one, `aria-disabled`
     *   plus the disabled class when {@link isItemEffectivelyDisabled}, and a
     *   click handler that focuses the row by `index`, then runs `onPopupListItemActivated`.
     *
     * @param item - the row's item, supplied by the library
     * @param index - the row's position in `getVisibleItems()`, supplied by the library
     * @group Subclassing: rendering
     */
    protected createPopupListItemEl(item: T, index: number): HTMLElement;
    /**
     * Map an item to its display string. The library calls this everywhere it
     * needs an item's text: list rows, the single trigger text, default filter.
     * - Default reads the `itemToStringFn` setting, else `String(item)`.
     * - Configure via `itemToStringFn` (no subclass needed).
     * - Override only when extending (a new kind of select component); your
     *   override replaces the default. For HTML content in a row, pass the
     *   `createPopupListItemContentElFn` setting.
     * @group Subclassing: semantics
     */
    protected itemToString(item: T): string;
    /**
     * Map an item to the value of its `lang` attribute, or `null` for none.
     * - Default reads the `itemToLangFn` setting; `null` while it is unset.
     * - The library writes the result where it shows that item's text; the
     *   `itemToLangFn` docstring lists the places.
     * - Configure via `itemToLangFn` (no subclass needed); override only when
     *   extending.
     * @group Subclassing: semantics
     */
    protected itemToLang(item: T): string | null;
    /**
     * Set or remove an element's `lang` attribute. `null` removes it; an empty
     * string sets `lang=""`, HTML's "language unknown".
     * @internal
     */
    protected commitLangToDom(el: HTMLElement, lang: string | null): void;
    /**
     * Item -> the visible content of its popup list row (icon + text etc.).
     * - Default reads `createPopupListItemContentElFn`, else `null` so `createPopupListItemEl` uses
     *   the plain-text default from `itemToString`.
     * - Override only when extending; for one-off rich content pass the setting.
     * @group Subclassing: rendering
     */
    protected createPopupListItemContentEl(item: T): HTMLElement | null;
    /**
     * Whether `item` is effectively disabled - by `itemDisabledFn`, or because
     * its group is disabled (`groupDisabledFn`). Group-disabled layers on top,
     * so every item-disabled behavior (no selection, keyboard skip, aria)
     * covers grouped items with no extra code. False when neither applies.
     * The whole-control disabled state (`isDisabled()`) is a separate layer,
     * not part of this answer.
     * @group Subclassing: semantics
     */
    protected isItemEffectivelyDisabled(item: T): boolean;
    /**
     * Map an item to its group key, or `null` when it belongs to no group.
     * The authoritative method: rendering, the `gatherGroups` gather, and the
     * disabled layer all resolve keys through this method, so an override
     * drives them all - returning keys turns grouping on even with the setting
     * unset (all-`null` keys = flat list). An override reading external state
     * must call `rerender()` after that state changes (same contract as
     * mutating item objects).
     * - Default reads `itemToGroupKeyFn`, else `null` (grouping off).
     * - Override only when extending; configure via the setting.
     * @group Subclassing: semantics
     */
    protected itemToGroupKey(item: T): GroupKey | null;
    /**
     * Map a group key to its label display text.
     * - Default reads `groupKeyToStringFn`, else `String(key)`.
     * @group Subclassing: semantics
     */
    protected groupKeyToString(key: GroupKey): string;
    /**
     * Map a group key to the value of the group's `lang` attribute, or `null`
     * for none.
     * - Default reads the `groupKeyToLangFn` setting; `null` while it is unset.
     * - `createGroupEl` writes the result on the group container.
     * - Configure via `groupKeyToLangFn` (no subclass needed); override only
     *   when extending. Mirrors `itemToLang`.
     * @group Subclassing: semantics
     */
    protected groupKeyToLang(key: GroupKey): string | null;
    /**
     * Whether the whole group `key` is disabled per `groupDisabledFn` (false when unset).
     * @group Subclassing: semantics
     */
    protected isGroupDisabled(key: GroupKey): boolean;
    /**
     * First enabled index scanning from `start` (inclusive) by `step` (+1 / -1).
     * Returns -1 if no enabled item lies in that direction. Used to skip disabled
     * items during keyboard nav and initial focus.
     * @group Subclassing: focus
     */
    protected findNextEnabledIndex(start: number, step: number, list: readonly T[]): number;
    /** Number of entries in the arrow-key ring for the current render. */
    private ringLength;
    /** Ring position of the active option, or -1 when nothing holds it. */
    private ringPosition;
    /** The ring entry at a position (caller keeps `0 <= position < ringLength()`). */
    private ringEntryAt;
    private isRingPositionEnabled;
    /** First enabled ring position from `start` walking in `direction`, or -1. */
    private findNextEnabledRingPosition;
    /** Ring twin of `findEnabledIndexForAction`: search in the travel direction, Page keys fall back the other way. */
    private findEnabledRingPositionForKeyboardAction;
    /** Move the active option to a ring position through the entry's own focus method. */
    private focusRingPosition;
    /** Move the active option onto an action row (mirrors `focusChooseAllRow`). */
    private focusActionRow;
    /** The element of the action row holding the active option, if one does. */
    private focusedActionRowEl;
    /** The descriptor of the action row holding the active option, if one does. */
    private focusedActionRow;
    /** Enter / click on an action row: re-check disabled, then run the hook as a user change. */
    private activatePopupListActionRow;
    /**
     * Called **after** the user's Enter on the active item row, Space on it while
     * the filter is inactive, or click on the row, as the library's response to
     * that input. Default no-op; subclasses implement their selection behaviour (single mode picks
     * and closes, multiple mode toggles and keeps the popup open).
     *
     * > No **before** counterpart: there is no `onPopupListItemActivating`.
     * @group Subclassing: reactions
     */
    protected onPopupListItemActivated(_item: T): void;
    /**
     * Build the whole DOM element for one leading action row (above the items).
     * - The library calls it, once per entry of `popupListLeadingActionRows`,
     *   on every list render and after every chosen change. You never call it.
     * - Both params come from the library. Forward them to `super` unchanged.
     *   `row` is the entry; `index` is its position in that array, counted from
     *   0, used to mint the id. It is not an identity.
     * - To change only what the row shows, do not override this: give the entry
     *   a `createContentElFn`.
     * - To change the element itself, override it, call
     *   `super.createPopupListLeadingActionRowEl(row, index)`, and edit the
     *   returned element. Keep the `id` and `role`; put no focusable control
     *   inside.
     * - After this returns, the library adds `aria-posinset` and
     *   `aria-setsize`, since a list with an action row always gets them.
     * - Internals: a `div` with `role="option"`, the id
     *   `<listbox id>-action-row-leading<index>`, `popupListRowClass` plus
     *   `popupListActionRowClass`, the visible content from
     *   {@link createPopupListActionRowContentEl} (else `textContent` from
     *   `textFn`), `aria-label` = `textFn()` when the content is custom, and
     *   either `aria-disabled` plus the disabled class
     *   ({@link isPopupListActionRowDisabled}) or a click handler that focuses
     *   the row, then runs {@link onPopupListActionRowActivated}.
     *   `aria-selected="false"`: every option needs the attribute, and a
     *   command is never selected.
     * @param row - the entry, supplied by the library
     * @param index - the entry's position in `popupListLeadingActionRows`, supplied by the library
     * @group Subclassing: rendering
     */
    protected createPopupListLeadingActionRowEl(row: LLSelectPopupListActionRow, index: number): HTMLElement;
    /**
     * Build the whole DOM element for one trailing action row (below the items).
     * - The library calls it, once per entry of `popupListTrailingActionRows`,
     *   on every list render and after every chosen change. You never call it.
     * - Both params come from the library. Forward them to `super` unchanged.
     *   `row` is the entry; `index` is its position in that array, counted from
     *   0, used to mint the id. It is not an identity.
     * - To change only what the row shows, do not override this: give the entry
     *   a `createContentElFn`.
     * - To change the element itself, override it, call
     *   `super.createPopupListTrailingActionRowEl(row, index)`, and edit the
     *   returned element. Keep the `id` and `role`; put no focusable control
     *   inside.
     * - After this returns, the library adds `aria-posinset` and
     *   `aria-setsize`, since a list with an action row always gets them.
     * - Internals: identical to {@link createPopupListLeadingActionRowEl}
     *   except the id, `<listbox id>-action-row-trailing<index>`.
     * @param row - the entry, supplied by the library
     * @param index - the entry's position in `popupListTrailingActionRows`, supplied by the library
     * @group Subclassing: rendering
     */
    protected createPopupListTrailingActionRowEl(row: LLSelectPopupListActionRow, index: number): HTMLElement;
    /** Shared body of the two action-row builders. */
    private createPopupListActionRowEl;
    /**
     * An action row's visible content element.
     * - The library calls it from the row builders, once per row render. You
     *   never call it. `row` comes from the library.
     * - Default reads the entry's `createContentElFn`; `null` (unset, or
     *   returned) = plain text from `textFn`.
     * - Override only when extending; for one-off content give the entry a
     *   `createContentElFn`.
     * @group Subclassing: rendering
     */
    protected createPopupListActionRowContentEl(row: LLSelectPopupListActionRow): HTMLElement | null;
    /**
     * Whether an action row is disabled right now.
     * - The library calls it from the row builders (once per row render) and
     *   again at activation. You never call it. `row` comes from the library.
     * - Default reads the entry's `disabledFn`; `null` / omitted = never disabled.
     * @group Subclassing: semantics
     */
    protected isPopupListActionRowDisabled(row: LLSelectPopupListActionRow): boolean;
    /**
     * Subclass hook: runs **after** Enter on the active action row, Space on it
     * while the filter is inactive, or a click on it, as the library's response
     * to that input.
     *
     * > No **before** counterpart: there is no `onPopupListActionRowActivating`.
     *
     * - The library calls it on Enter, on Space while the filter is inactive,
     *   and on click, **after** the disabled re-check, as a user change. You never
     *   call it. `row` comes from the library: the activated entry.
     * - Default calls the entry's `onActivate`. The library changes nothing
     *   else: choosing and closing are the entry's job.
     * - Override to react before the entry's `onActivate`: do your work, then
     *   call `super.onPopupListActionRowActivated(row)`. To react after it, call
     *   `super` first, then do your work. Without that call the entry's
     *   `onActivate` never runs.
     * @group Subclassing: reactions
     */
    protected onPopupListActionRowActivated(row: LLSelectPopupListActionRow): void;
    /**
     * Rebuild every rendered action row in place, so `textFn` / `disabledFn`
     * reflect the current state; the row holding the active option keeps it.
     * - The library calls it after every chosen change, right after `onChange`
     *   fired (a row's text may read what the handler wrote). Subclasses may
     *   call it after a state change of their own.
     * - No-op while closed, or when both row arrays are empty - instances
     *   without rows pay nothing.
     * - O(rows) DOM work; the item rows are untouched.
     * @group Subclassing: rendering
     */
    protected replacePopupListActionRowElsInDom(): void;
    private replaceActionRowElsInDom;
    /**
     * Optional non-item `role="option"` row placed first, at the TOP of the listbox:
     * inside the arrow-key ring (ArrowUp from the first item reaches it, Home
     * lands on it, up-actions clamp there) but never inside `itemEls`, so the
     * `itemEls[i] <-> getVisibleItems()[i]` alignment is untouched. Rebuilt on
     * every `renderPopupList`, and in place by `replaceChooseAllRowElInDom`.
     * Base default: `null` = no choose-all row.
     * `LLSelectMultiple` builds its choose-all row here (`chooseAllRow` setting).
     * @group Subclassing: rendering
     */
    protected createPopupListChooseAllRowEl(): HTMLElement | null;
    /**
     * Dispatch the before-change event of one user change and report whether
     * the change may proceed. The variants call it from their gate with a
     * closure that runs `onChosenChanging` and the `onBeforeChange` setting.
     * - `preventDefault()` counts only inside `dispatch`; the event is sealed
     *   afterwards.
     * @internal
     */
    protected dispatchBeforeChange(facts: {
        reason: 'choose' | 'unchoose';
        item: T;
    } | {
        reason: 'clear' | 'set';
    }, dispatch: (event: LLSelectBeforeChangeEvent<T>) => void): boolean;
    /**
     * Run `fn` with chosen-state changes attributed to the user.
     * - The library wraps exactly its pointer / keyboard entry points with it:
     *   option activation, the tag remove button, the clear button, the
     *   choose-all row, and an action row's `onActivate`.
     * - A change outside such a call reports `'api'`.
     * - The attribution is consumed by the first chosen-state change inside
     *   `fn`, before `onChosenChanged` runs.
     * - A second change inside the same `fn` reports `'api'`.
     * @group Subclassing: reactions
     */
    protected withUserChangeSource<R>(fn: () => R): R;
    /**
     * Subclass hook: runs **after** Enter on the active choose-all row, or Space
     * on it while the filter is inactive, as the library's response to that
     * input. Default no-op. `LLSelectMultiple`, which supplies the row, also
     * wires its click handler to this.
     *
     * > No **before** counterpart: there is no `onChooseAllRowActivating`.
     * @group Subclassing: reactions
     */
    protected onChooseAllRowActivated(): void;
    /**
     * Decide which row is active when the popup opens.
     * - The library calls it inside `open()`, once per open, after the rows
     *   are built. You never call it.
     * - To pick another row, such as the row of the chosen item or of the
     *   last-used item, override it and set the row with `setFocusedIndex` or
     *   `focusChooseAllRow`.
     * - To fall back to the default, call `super.focusInitial()`, but only when
     *   the override set no row.
     * - The active row is the `role="option"` row that `aria-activedescendant`
     *   names on the `role="combobox"` element: the trigger, or the filter
     *   input while the filter is active.
     * - "Focus" in the names `focusInitial`, `setFocusedIndex` and
     *   `focusChooseAllRow` means the active row, not DOM focus.
     * - DOM focus never moves to the active row. While the filter is active,
     *   the open moves DOM focus to the filter input.
     * - `open()` clears the active row before the call, so the popup opens
     *   with no active row unless this method sets one.
     * - Visible items are the items in `getVisibleItems()`, the items that
     *   have a row in the list.
     * - The default makes the first enabled visible item the active row,
     *   replacing any row set before it runs.
     * - The default does nothing when no visible item is enabled.
     * @group Subclassing: focus
     */
    protected focusInitial(): void;
    /**
     * Move keyboard focus to the item at `index`. The value is clamped to
     * `[-1, getVisibleItems().length - 1]`; pass `-1` to clear focus. Updates the focused
     * class, `aria-activedescendant`, and scrolls the item into view. No-op
     * if the clamped value equals the current focused index while no
     * choose-all row or action row is active. "Keyboard focus" here means the
     * active row; this method never moves DOM focus.
     * @group Subclassing: focus
     */
    protected setFocusedIndex(index: number): void;
    /**
     * Move keyboard focus onto the choose-all row. Returns whether the row is now
     * focused (`false` = none is rendered, nothing changed). The item focus is
     * cleared (`focusedIndex` becomes -1). "Keyboard focus" here means the
     * active row; this method never moves DOM focus. Protected so a subclass can wire its
     * choose-all row's click to focus-then-activate (mirroring how item clicks
     * call `setFocusedIndex` before `onPopupListItemActivated`) and use it in
     * `focusInitial` (the choose-all row is the listbox's FIRST option).
     * @group Subclassing: focus
     */
    protected focusChooseAllRow(): boolean;
    /**
     * Rebuild the choose-all row in place (tri-state / text refresh) without
     * touching the item elements - O(1) DOM work, mirroring
     * `replacePopupListItemElInDom`. Falls back to a full `renderPopupList`
     * when the row becomes inapplicable (builder returns `null`). No-op while
     * closed or when no choose-all row is rendered.
     * @group Subclassing: rendering
     */
    protected replaceChooseAllRowElInDom(): void;
    /**
     * Make the DOM reflect the active row, `focusedRow`, else `focusedIndex`.
     * - With an active row, it moves the focused class onto the row's element,
     *   points `aria-activedescendant` at it, and scrolls it into view.
     * - With no active row, it clears the class and the attribute.
     * - Then it reports the active item (`reportActiveItem`).
     * - It reads the row elements that the select component currently stores.
     * - Called after every active-row change (`setFocusedIndex`,
     *   `focusChooseAllRow`, `focusActionRow`).
     * - Called after the list is rebuilt (`renderPopupList`, whose clamp
     *   assigns `focusedIndex` directly).
     */
    private syncFocusedIndexToDom;
    /**
     * The element of the active row, or `undefined` when no rendered row is
     * active. An action row whose element is gone drops `focusedRow` to `null`
     * and falls through to the item at `focusedIndex`.
     */
    private resolveActiveRowEl;
    /**
     * Fire `onActiveItemChange` when the active item differs from the last
     * report. The tail of `syncFocusedIndexToDom`, which every active-row move
     * ends in, plus `close()`, which resets the row by assignment. Items are
     * compared with `compareFn`, never by index or element, so an in-place row
     * rebuild stays silent. The report is stored before the listener runs, so a
     * listener that closes or re-renders the select component re-enters with the right
     * baseline.
     */
    private reportActiveItem;
    /** The item of the active row; none while closed, on a non-item row, or with no row. */
    private resolveActiveItem;
    /**
     * Snapshot the window scroll position and return a function that restores
     * it. Opening the popup must never move the page, but Firefox auto-scrolls
     * the active option of a multiselectable listbox into view at the document
     * level when the popup is shown - even though the popup is `position: fixed`.
     * The returned restore runs synchronously and once more on the next frame,
     * since that accessibility scroll can land after the current layout flush.
     * No-op when nothing actually scrolled, so it never fights real user
     * scrolling (and stays silent under jsdom, which has no `window.scrollTo`).
     * Restores with `behavior: 'instant'`: the two-arg `scrollTo` obeys the
     * page's CSS `scroll-behavior`, so under `scroll-behavior: smooth` the
     * correction would render as a visible glide instead of a revert.
     * - The restore does nothing once the select component is destroyed, the
     *   one that waits for the next frame included: whoever destroyed it has
     *   taken over the page, a route change for one, and may have set a scroll
     *   position of its own.
     */
    private captureWindowScroll;
    /**
     * The element a pointer event actually hit. `ev.target` retargets to the shadow
     * host when llselect is hosted inside an app's shadow root, so an inside click
     * would read as outside and close the popup; `composedPath()[0]` pierces the
     * boundary. With no shadow tree (llselect uses none itself) this equals `ev.target`.
     * - Limitation: a CLOSED host shadow root truncates `composedPath()` at the root,
     *   so `[0]` is only the host and an inside click still reads as outside. A
     *   document-level listener cannot see into a closed root; hosting in an OPEN
     *   shadow root avoids it.
     */
    private eventTargetNode;
    private attachOutsideClick;
    private detachOutsideClick;
    /**
     * Swallows the click of an outside press under `'block'`, even when the
     * popup closed during that press.
     * - Called by the `pointerdown` and `mousedown` capture listeners of
     *   `'block'` for a press outside the select component, with the pointer
     *   type of the press and the place where it went down.
     * - The `mousedown` listener arms again as a mouse press, unless a press
     *   that is not a mouse press armed the swallow.
     * - While armed, the swallow also prevents the default of an outside
     *   `mousedown`, so the browser moves no focus, even after the popup
     *   closed at the `pointerdown`.
     * - Only the press's own click counts. The swallow lets every other click
     *   through and stays armed:
     *   - a pointer made the press's click, so its `detail` is not `0`, while
     *     a click from the keyboard or from `click()` has a `detail` of `0`;
     *   - after a press that is not a mouse press, such as a tap, the click
     *     lands within `TAP_CLICK_RADIUS` of the place where the press went
     *     down.
     * - The click of the press ends the swallow.
     * - After a mouse press, the task after its `pointerup` or `mouseup` ends
     *   the swallow too, since a browser dispatches the click of a mouse press
     *   in the same task as its release.
     * - After a tap, `CLICK_WAIT_MS` after its `pointerup` ends the swallow,
     *   since a browser can hold a tap's click back by about 300 ms.
     * - A `pointercancel`, the `pointerdown` of a new press, a new arm and
     *   `destroy()` end the swallow as well, so a press without a click leaves
     *   nothing armed for a later click.
     */
    private armOutsidePressClickSwallow;
    /**
     * The whole-life `focusin` / `focusout` pair on `rootEl`. Both bubble from
     * every descendant, so one listener each sees focus entering or leaving any
     * part of the select component. `relatedTarget` - the element focus comes from or goes
     * to - tells an outside move from an inside one; `null` counts as outside
     * (a click on a non-focusable area, focus from nowhere). The inside test is
     * `rootEl.contains`, not "the trigger", so the filter input and slot
     * controls keep the popup open while they hold focus.
     * - `focusout` is always attached: it closes an open popup when focus leaves
     *   (A11Y.md "Focus"), then fires `onBlur`, in that order.
     * - `focusin` is attached only when `onFocus` is set.
     * - `destroy()` detaches both before its own `close()` and
     *   `replaceChildren()`, so a parting event cannot reach a listener.
     */
    private attachFocusListeners;
    private detachFocusListeners;
    /** Whether `target` is a node inside `rootEl`; `null` counts as outside. */
    private isInsideRoot;
    /**
     * Esc pressed while DOM focus sits on app content inside a popup slot
     * (`popupHeaderEl` / `popupFooterEl`): close, and `close()` returns focus to
     * the trigger. Escape only; ignores IME composition, an event the app
     * already handled (`defaultPrevented` - a text field that owns Esc), and
     * the filter input's own events (its `handleKeydown` ran first and prevented
     * the default). `preventDefault` so an enclosing modal `<dialog>` does not
     * also close on the same key.
     */
    private handleSlotKeydown;
    private handleKeydown;
    /**
     * Native-`<select>`-style prefix typeahead for a printable-character
     * keydown on the trigger.
     * - Returns `true` when the event was consumed.
     * - Runs only while the filter is inactive. With the popup open the filter
     *   input owns typing; while closed, a would-be-filterable open cycle
     *   leaves the keys alone (the `filterable` predicate is evaluated fresh -
     *   the cached `filterActive` can be stale between opens).
     * - Space never joins the buffer; it stays the activate/open key (A11Y.md).
     * - While closed: opens the popup first, then searches relative to
     *   {@link computeTypeaheadClosedStartIndex} - NOT to the convenience focus
     *   `focusInitial` parked, which would skip the first match.
     * - Typing itself never changes the value and never fires `onChange`;
     *   activation stays Enter / Space / click.
     * - Match rule, cycling, and wrap: {@link findTypeaheadIndex}. No match
     *   leaves the active option and the buffer as they are.
     */
    private handleTypeaheadKeydown;
    /**
     * The option the closed-state typeahead treats as current, as an index into
     * `list`, when the typed character is the keystroke that opens the popup.
     * - The search starts AFTER this option: the opening keystroke is always a
     *   one-character buffer, because `close()` and a refused `open()` both
     *   empty the buffer.
     * - Default `-1`: no current option, so the first match from the top wins.
     * - The focus `focusInitial` parks on open is a convenience, not a
     *   selection - it must not shift this search.
     * - Single mode overrides this with the chosen item's index, so a typed
     *   initial cycles past the current selection like a native `<select>`.
     * - Search internals: `findTypeaheadIndex` in `keyboard.ts`.
     * @group Subclassing: focus
     */
    protected computeTypeaheadClosedStartIndex(_list: readonly T[]): number;
    private createTriggerWrapperEl;
    private createTriggerEl;
    /**
     * The trigger buttons strip, empty: the first trigger render builds the
     * clear button (`replaceTriggerClearButtonElInDom`), and each trigger
     * content render of tags mode builds the chips (`commitTagsElToDom`).
     */
    private createTriggerButtonsEl;
    /** The strip's `aria-label`, while it is a toolbar. Pack text: the constructor and `setUiTranslationPack` run it. */
    private syncTriggerButtonsNameToDom;
    /**
     * Whether the trigger shows one chip per chosen item: the multiple select
     * component's `triggerDisplay: 'tags'`.
     * - The base constructor calls it to decide whether the trigger buttons
     *   strip exists and whether it is a toolbar.
     * - Base default `false`; `LLSelectMultiple` reads its setting.
     * @internal
     */
    protected isTriggerDisplayTags(): boolean;
    /** The buttons of the trigger buttons strip, in DOM order: the chips' remove buttons, then the clear button. */
    private getTriggerButtonEls;
    /**
     * Bring the trigger buttons strip in line with the state, after each change
     * of its buttons, of the chosen state, of the disabled state, and on open
     * and close.
     * - It carries `hidden` while nothing is chosen or it is empty.
     *   Before hiding it, focus inside it moves to the trigger: hiding a
     *   focused element drops focus to `<body>`.
     * - One button is the Tab stop: the one holding focus, else the previous
     *   stop while it is still in the strip, else the first that is not
     *   `aria-disabled`, else the first.
     * - None is while the strip is hidden, while the select component is
     *   disabled, or while the popup is open. The strip precedes the popup in
     *   DOM order, so a stop there would take Tab from the open popup's host
     *   before the slot controls, and focus entering the strip closes the
     *   popup (A11Y.md "Trigger buttons strip").
     */
    private syncTriggerButtonsToDom;
    /**
     * Left / Right Arrow, Home and End inside the trigger buttons strip: move
     * focus to the previous, next, first or last button and make it the Tab
     * stop. Clamps at both ends. Left and Right swap in right-to-left text.
     * Keys with Alt, Ctrl or Meta stay with the browser.
     */
    private handleTriggerButtonsKeydown;
    /**
     * Focus the trigger for a mousedown in the trigger wrapper outside the
     * trigger: the wrapper is not focusable, so the press would move focus to
     * `<body>`, and the focusout guard would close an open popup.
     * - A press on the trigger itself takes focus natively.
     * - A mousedown already prevented is left alone. The strip's buttons
     *   prevent theirs to keep focus where it is.
     */
    private handleTriggerWrapperMousedown;
    /**
     * Put the tag-list container into the trigger buttons strip, before the
     * clear button, in place of the previous one; `null` removes it.
     * - Called by `LLSelectMultiple`'s `renderTriggerContent` on every trigger
     *   content render.
     * - If a remove button of the previous container held focus, the remove
     *   button at the same position in the new one gets it, else the last one,
     *   else the trigger. So removing a chip by keyboard focuses the next
     *   chip's button, and removing the last chip focuses the trigger.
     * - If focus sat elsewhere in the previous container, the trigger gets it.
     * - Focus moves before the previous container leaves the DOM: removing a
     *   focused element first drops focus to `<body>`, which the focusout
     *   guard reads as focus leaving the select component.
     * @internal
     */
    protected commitTagsElToDom(el: HTMLElement | null): void;
    /**
     * Build the clear (x) button, the last button of the trigger buttons strip
     * (`clearable`).
     * - The library owns the button, its click (stops propagation so it never
     *   toggles the popup, then `clearSelection`; a no-op while the control is
     *   disabled) and its `aria-label` (text from
     *   `uiTranslationPack.triggerClearButtonAriaLabel`).
     * - A click while focus is in the strip moves focus to the trigger first,
     *   so a clear by keyboard leaves focus on the trigger.
     * - The strip owns its `tabindex`: one button of the strip is the Tab stop.
     * - An override returns a `button` element: the strip's Tab stop and arrow
     *   keys reach `button` elements only.
     * - `createTriggerClearButtonContentElFn` optionally fills the icon; else the
     *   theme's CSS glyph draws it.
     * - The library hides the strip, and with it the button, while nothing is
     *   chosen.
     * - It runs on every trigger render (`renderTrigger`).
     * - The first run builds the button.
     * - For `LLSelectSingle` / `LLSelectMultiple` and their subclasses, that
     *   first run is the variant constructor's render, right after `super()`,
     *   so it happens before a FURTHER subclass's field initializers.
     * - A direct `LLSelectBase` subclass gets the button on its first trigger
     *   render (its own `renderTrigger()` call, or `rerender()` /
     *   `setPlaceholder`); until then the trigger is unrendered and there is no
     *   button.
     * - Every later run (a value change, `setPlaceholder`,
     *   `setUiTranslationPack`, `rerender()`) swaps the button in place, unless
     *   this method returns the previous element - then it stays in place.
     * - The base implementation returns a fresh element each run, so, like the
     *   arrow, nothing put on it from outside survives a render; customize it
     *   here.
     * - An override that returns the same element every time owns everything
     *   the rebuild would otherwise refresh on it, including its `aria-label`
     *   after `setUiTranslationPack`.
     * - An override that reads subclass fields calls `rerender()` at the end of
     *   its constructor, like every other trigger method.
     * @group Subclassing: rendering
     */
    protected createTriggerClearButtonEl(): HTMLElement;
    /**
     * The element holding DOM focus if that is `el` or a descendant, else `null`.
     * - Read from `el`'s own root: inside a shadow root `document.activeElement`
     *   is the shadow HOST, so the answer must come from the `ShadowRoot`'s
     *   `activeElement` (the `Document`'s otherwise).
     * - The result can sit inside an open shadow root under `el`, so
     *   `el.contains()` may reject it; use `containsComposed` for that check.
     * - A CLOSED shadow root is opaque, so its host is returned.
     */
    private focusedElementIn;
    /** Whether `node` is `el` or inside it, walking up through open shadow hosts. */
    private containsComposed;
    /** Whether DOM focus is on `el` or inside it (see `focusedElementIn`). */
    private isFocused;
    /**
     * Give the trigger DOM focus when no element inside the select component holds it.
     * - For the click of the clear button and of a chip's remove button: their
     *   `mousedown` keeps focus where it is, so a click on an unfocused select component
     *   would otherwise leave it unfocused, with no `onFocus` and no later
     *   `onBlur` for a form's touched state. A native control takes focus on a
     *   click inside it.
     * - While the trigger, the filter input or a slot control holds focus,
     *   nothing moves.
     * @internal
     */
    protected focusTriggerIfUnfocused(): void;
    /**
     * Take the stamp a row click compares after its active-row move.
     * - The three row clicks call it: the item row, the choose-all row, the
     *   action row.
     * - They call it right before `setFocusedIndex`, `focusChooseAllRow` or
     *   `focusActionRow`, whose report runs the app's `onActiveItemChange`.
     * - Returns the transition generation and the change revision as they
     *   stand.
     * - {@link stateMovedSince} reads them back.
     * @internal
     */
    protected captureStateStamp(): {
        generation: number;
        revision: number;
    };
    /**
     * Returns whether a listener moved the select component since `stamp` was taken.
     * - The three row clicks call it after their active-row move.
     * - `stamp` is what {@link captureStateStamp} returned before that move.
     * - True after an open, a close, a `rerender()`, a `destroy()`, a
     *   `setItems()` or a chosen-state change.
     * - The click then activates nothing: the row it meant belongs to a popup
     *   state that is gone.
     * - The other user paths re-check what they need instead:
     *   - the filter keystroke: the popup is open and its query still stands;
     *   - the clear button: the control is enabled and not destroyed;
     *   - the chip remove button checks all of the following:
     *     - the control is enabled and not destroyed;
     *     - the item is still chosen, read from the chosen entry as it stands
     *       now;
     *     - that entry is enabled.
     * @internal
     */
    protected stateMovedSince(stamp: {
        generation: number;
        revision: number;
    }): boolean;
    /**
     * Build the clear button on the first trigger render, and swap it for a fresh
     * one on every later render, always through `createTriggerClearButtonEl` (the
     * overridable builder) - so `rerender()` repairs an override that reads
     * subclass fields. Keeps DOM focus on the new button when the old one held it.
     * No-op without `clearable`.
     * The order of the steps is load-bearing:
     * 1. Read which node holds focus, if it is the old button or inside it.
     * 2. If one does, park focus on the old button itself. A content fn that
     *    hands back the same icon element each time reparents that icon into
     *    the new button, and the reparenting must not move the focused node.
     * 3. Build the new button.
     * 4. Insert it.
     * 5. If step 1 found focus, move focus to the new button - or, if that
     *    element cannot take focus, to the trigger.
     * 6. Only then remove the old one.
     * Why this order:
     * - Removing the old button first drops DOM focus to `<body>` in every
     *   engine.
     * - Where the engine also fires `focusout` on that removal, its
     *   `relatedTarget` is `null`. The open popup's focus-out guard reads that
     *   as focus leaving the select component.
     * - Moving focus first makes the new button the `relatedTarget`, inside the
     *   root.
     * A builder override that returns the SAME element every time is allowed:
     * the element is kept in place, and focus goes back to the node step 1
     * found, because nothing was rebuilt - unless the override detached that
     * node or moved it out of the button, in which case focus stays on the
     * button.
     */
    private replaceTriggerClearButtonElInDom;
    /**
     * Clear button's visible content (its x icon).
     * - Default reads `createTriggerClearButtonContentElFn`; `null` (setting
     *   unset, or returned) = no icon - the theme's CSS glyph draws the x.
     * - Override only when extending; for one-off icons pass the setting.
     * @group Subclassing: rendering
     */
    protected createTriggerClearButtonContentEl(): HTMLElement | SVGElement | null;
    /**
     * Empty the selection (invoked by the clear button). Base is a no-op; single
     * clears to `undefined`, multiple to `[]`. Goes through the normal setters, so
     * `onChange` fires with the empty value. The wipe is total - chosen disabled
     * items are cleared too (native `<select>` parity; `unchooseAll` is the
     * enabled-only bulk op).
     * @group Subclassing: semantics
     */
    protected clearSelection(): void;
    /**
     * The filter input lives inside the popup, above the listbox. Always built
     * (`hidden` when `filterable: false`) so a future runtime toggle is a CSS
     * flip rather than a DOM rebuild. See `docs/llm/DESIGN.md`.
     */
    private createFilterInputEl;
    /**
     * Return the items the popup list renders, in display order.
     *
     * ```text
     * items                (setItems)
     *   |  gather          (only with grouping on; result cached until setItems)
     *   v
     * display base list
     *   |  filter query    (only while a query is active)
     *   v
     * visible items        (this method's return value)
     *   |  render
     *   v
     * DOM rows
     * ```
     *
     * - If no filter query is active (including while closed), it returns the
     *   full list, gathered per `gatherGroups` when grouping is on.
     * - If a filter query is active, it returns the matching subset.
     * - Disabled items are included. They render (grayed); only actions skip
     *   them (keyboard focus, the choose-all row's subset).
     * - Returns the LIVE internal array, typed read-only. Never mutate it
     *   (see `getItems`).
     * - Subclasses use it too (e.g. for selection-by-index), and may override
     *   it to add a step: `LLSelectMultiple` does for `hideChosenRows`.
     * @group Items
     */
    getVisibleItems(): readonly T[];
    /**
     * The base list in DISPLAY order: `items` gathered per `gatherGroups`
     * (memoized until the next `setItems`), or `items` as-is while grouping is
     * off or `gatherGroups` is false. Filtering and rendering read this, never
     * `items` directly - so the gather runs lazily, at first need after a
     * `setItems`.
     */
    private getDisplayBaseItems;
    /**
     * Return the filter input's current query, exactly the string passed to
     * `filterFn`.
     * - It is `''` while the popup is closed, the filter is inactive, or the
     *   input is empty.
     * - It resets on close: each open cycle starts empty.
     * @group Filtering
     */
    getFilterQuery(): string;
    /**
     * Per-item match predicate for the filter input.
     * - Default reads `filterFn`; else case-insensitive substring on
     *   `itemToString`.
     * - Override only when extending (subclass-wide custom matching); for a
     *   one-off match rule pass the setting.
     * @group Subclassing: semantics
     */
    protected matchesQuery(item: T, query: string): boolean;
    /**
     * Recompute `filteredItems` from the current `items` and `query`. Pure state
     * update: does NOT touch the DOM (the caller re-renders the list separately).
     * No-op when `filterable: false`; an empty query keeps every item. Called from
     * `open()`, from `setItems()`, and on each filter-input event.
     */
    private recomputeFilteredItems;
    /**
     * Input event on the filter field: re-filter, re-render the list, move the
     * active option to the first match, then fire `onFilterQueryChange` when
     * the text actually changed. IME composition is guarded - we wait for
     * `compositionend` and filter once with the composed text. The Esc-clear
     * path comes through here too, so it fires the event as well.
     */
    private handleSearchInputEvent;
    /** Outer popup wrapper. Its role follows the filter mode (`syncFilterModeToDom`). */
    private createPopupEl;
    /**
     * Build the no-results message element.
     * - `role="status"` announces its appearance politely.
     * - It lives OUTSIDE the listbox, which holds only option rows, group
     *   containers and pinned-block wrappers.
     * - Its text comes from `uiTranslationPack.popupListNoResults`.
     */
    private createPopupListNoResultsEl;
    /**
     * The no-results message's visible content (rich empty-state).
     * - Default reads `createPopupListNoResultsContentElFn`; `null` (setting
     *   unset, or returned) = plain text from `uiTranslationPack.popupListNoResults`.
     * - Override only when extending; for one-off content pass the setting.
     * @group Subclassing: rendering
     */
    protected createPopupListNoResultsContentEl(query: string): HTMLElement | null;
    /**
     * Build the pinned header container between the filter input and the listbox.
     * - The library calls it once, inside the constructor. You never call it.
     * - It takes no params. The default asks {@link createPopupHeaderContentEl}
     *   for content; `null` content = no container, and `popupHeaderEl` stays `null`.
     * - To supply content without subclassing, pass `createPopupHeaderContentElFn`.
     * - To change the container itself, override it: call
     *   `super.createPopupHeaderEl()` and edit the returned element, or return
     *   your own `div`. Returning non-null builds the slot even without the
     *   setting. Keep it role-free: it is not part of the listbox.
     * - Internals: the base builds a `div` with `classIdMap.popupHeaderClass`
     *   and inline `flex: none` (the popup is a flex column and only the listbox
     *   may flex), then appends the content.
     * @group Subclassing: rendering
     */
    protected createPopupHeaderEl(): HTMLElement | null;
    /**
     * The pinned header's content element.
     * - The library calls it once, from {@link createPopupHeaderEl}, inside the
     *   constructor. You never call it.
     * - Default calls `createPopupHeaderContentElFn` with a
     *   {@link LLSelectConstructionContext}; `null` (setting unset, or
     *   returned) = no header at all.
     * - Override only when extending; for one-off content pass the setting.
     * @group Subclassing: rendering
     */
    protected createPopupHeaderContentEl(): HTMLElement | null;
    /**
     * Build the pinned footer container at the bottom of the popup.
     * - The library calls it once, inside the constructor. You never call it.
     * - It takes no params. The default asks {@link createPopupFooterContentEl}
     *   for content; `null` content = no container, and `popupFooterEl` stays `null`.
     * - To supply content without subclassing, pass `createPopupFooterContentElFn`.
     * - To change the container itself, override it: call
     *   `super.createPopupFooterEl()` and edit the returned element, or return
     *   your own `div`. Returning non-null builds the slot even without the
     *   setting. Keep it role-free: it is not part of the listbox.
     * - Internals: the base builds a `div` with `classIdMap.popupFooterClass`
     *   and inline `flex: none` (only the listbox may flex), then appends the
     *   content.
     * @group Subclassing: rendering
     */
    protected createPopupFooterEl(): HTMLElement | null;
    /**
     * The pinned footer's content element.
     * - The library calls it once, from {@link createPopupFooterEl}, inside the
     *   constructor. You never call it.
     * - Default calls `createPopupFooterContentElFn` with a
     *   {@link LLSelectConstructionContext}; `null` (setting unset, or
     *   returned) = no footer at all.
     * - Override only when extending; for one-off content pass the setting.
     * @group Subclassing: rendering
     */
    protected createPopupFooterContentEl(): HTMLElement | null;
    /** The read-only view a construction-time settings function receives. */
    private createConstructionContext;
    /**
     * Scroll a ring entry into view. A row inside a pinned wrapper is always in
     * view, so it is left alone. Every other entry, an item inside a group
     * container included, scrolls under the pinned blocks, so their measured
     * heights are handed to the scroll math as insets.
     */
    private scrollRingEntryIntoView;
    /** The height a pinned wrapper covers at its listbox edge; 0 when it is not in the listbox. */
    private pinnedWrapperHeight;
    /**
     * The sticky wrapper of a pinned block: presentational (the accessibility
     * tree sees only the rows inside), stuck to one edge of the listbox by
     * inline style so the setting works without theme support. Themes paint
     * its background and edge line.
     */
    private createPopupListPinnedRowsEl;
    /** Shared body of the two slot builders: `null` content = no container. */
    private createPopupSlotEl;
    /**
     * Mirror the visible-list-empty state onto the no-results message element:
     * `hidden` while there is at least one visible item; when shown, fill its
     * content - `createPopupListNoResultsContentEl(query)` first, else the plain
     * text from `uiTranslationPack.popupListNoResults`. Same null-branch shape as
     * `createPopupListItemEl` / `createGroupEl`.
     * - The write is SKIPPED when the resolved text matches what is already shown,
     *   so a still-empty next keystroke does not re-announce (see `lastNoResultsText`).
     */
    private syncPopupListNoResultsToDom;
    /** Inner element with `role="listbox"`. Holds item children. */
    private createPopupListEl;
}
//# sourceMappingURL=base.d.ts.map