/** * Converts value to an array. * If the value is a JSON string representing an array, it will be parsed. * If the value is already an array, it is returned. * If the value is undefined, it returns undefined. * @private * @param {any} value - The value to be converted. Can be a string, array, or undefined. * @returns {Array|undefined} - The converted array or undefined. * @throws {Error} - Throws an error if the value is not an array, undefined, * or if the value cannot be parsed into an array from a JSON string. */ export function arrayConverter(value: any): any[] | undefined; /** * Serializes a multi-select value array back into the String `value` property. * An empty (or missing) array collapses to `undefined` so an emptied selection * clears `value` rather than reflecting a `"[]"` attribute. * @private * @param {Array|undefined} values - The selected values. * @returns {string|undefined} JSON string of the values, or undefined when empty. */ export function serializeMultiSelectValue(values: Array | undefined): string | undefined; /** * Compare two arrays for equality. * @private * @param {Array} arr1 - First array to compare. * @param {Array} arr2 - Second array to compare. * @returns {boolean} True if arrays are equal. */ export function arraysAreEqual(arr1: any[], arr2: any[]): boolean; /** * Validates if an option can be interacted with. * @private * @param {HTMLElement} option - The option to check. * @returns {boolean} True if option is interactive. */ export function isOptionInteractive(option: HTMLElement): boolean; /** * Validates if an option may be selected by matching a programmatic value. * Unlike `isOptionInteractive`, `hidden` is allowed: the combobox toggles * `hidden` as its type-ahead filter, so a filtered-out option is still a * valid programmatic selection. Only disabled and static options — which are * never selectable — are rejected. * @param {HTMLElement} option - The option to check. * @returns {boolean} True if option can be selected by value. */ export function isSelectableByValue(option: HTMLElement): boolean; /** * Resolves the single selected option for a given `value`, preferring the * option tracked by `selectedKey` (a user-initiated selection) over a * first-by-value match. When multiple options share the same `value`, matching * by `value` alone cannot distinguish which one the user picked; the key * disambiguates it. * * The key is trusted only when it still resolves to an option whose `value` * matches the requested `value`. If the key is stale (option removed) or the * value was changed programmatically, resolution falls back to value matching — * preserving backward-compatible behavior for preselection and `selectByValue`. * @private * @param {Array} items - The menu's flat option list. * @param {string} value - The value to resolve. * @param {string|undefined} selectedKey - The `_optionKey` of the user-selected option, if any. * @returns {HTMLElement|undefined} The resolved option, or undefined when none match. */ export function resolveSelectedOption(items: Array, value: string, selectedKey: string | undefined): HTMLElement | undefined; /** * Resolves the selected options for a multi-select `value` array, preferring * options tracked by `selectedKeys` (user-initiated selections) and falling * back to value matching for any values not resolved by key. The result is * always sorted into DOM order regardless of selection sequence. * @private * @param {Array} items - The menu's flat option list. * @param {Array} valueArray - The selected values. * @param {Array|undefined} selectedKeys - The `_optionKey`s of the user-selected options, if any. * @returns {Array} The resolved options in DOM order. */ export function resolveSelectedOptions(items: Array, valueArray: Array, selectedKeys: Array | undefined): Array; /** * Helper method to dispatch custom events. * @param {HTMLElement} element - Element to dispatch event from. * @param {string} eventName - Name of the event to dispatch. * @param {Object} [detail] - Optional detail object to include with the event. */ export function dispatchMenuEvent(element: HTMLElement, eventName: string, detail?: Object): void;