
import { AtomicState } from "../types/StateAxis.js";
import { PossibleStatesWithRest } from "../types/ComponentConfig.js";

//#region ../automated-config/dist/utils/canonicalizeStateKey.d.ts
//#region src/utils/canonicalizeStateKey.d.ts
/**
 * Returns the canonical state-key string for a list of atomic states.
 *
 * Canonical ordering rules:
 * 1. Modifier atomics come first, sorted by `STATE_PRIORITY` (weakest first).
 * 2. Interactive atomics come last, also sorted by `STATE_PRIORITY`. Multiple
 *    interactives can co-occur (e.g. `focus-within` + `hover`), so a key may
 *    carry more than one.
 *    Sorting by priority — not alphabetically — keeps a key's atom order aligned
 *    with the emission/cascade order in `resolvePropertyStates` and
 *    `resolveSlotByCascade`, so one ordering convention holds end-to-end. (For
 *    Input the two orders coincide; they diverge only for atoms like `visited`,
 *    `autofill`, or `focus-visible` whose priority rank differs from their
 *    alphabetical position.)
 * 3. Duplicates are removed.
 * 4. Unknown atoms throw. Every caller passes atoms already validated via
 *    `isModifierAtomic`/`isInteractiveAtomic` (or pulled from
 *    `MODIFIER_ATOMICS`/`INTERACTIVE_ATOMICS`), so an unrecognized atom signals
 *    a caller bug and fails loudly rather than producing a silent bad key.
 *
 * Examples:
 *   canonicalizeStateKey(['hover', 'invalid'])   // 'invalid&hover'
 *   canonicalizeStateKey(['invalid', 'hover'])   // 'invalid&hover' (same)
 *   canonicalizeStateKey(['hover'])              // 'hover'
 *   canonicalizeStateKey([])                     // 'rest'
 *
 * The narrow public overload returns `PossibleStatesWithRest` so callers
 * passing known atomics get a usable state-key type back without having to
 * cast the result at the call site. The looser overload remains for callers
 * that may pass unvalidated strings; its return is widened to `string` since
 * those inputs can't guarantee a canonical-key result. The runtime body
 * type-checks against the loose overload and validates atoms at runtime.
 */
declare function canonicalizeStateKey(atoms: readonly AtomicState[]): PossibleStatesWithRest;
declare function canonicalizeStateKey(atoms: readonly string[]): string;
/**
 * Splits a canonical (or legacy) state key into its atomic parts.
 * `'rest'` and `''` produce an empty array.
 */
declare function splitStateKey(stateKey: string): string[]; //#endregion
//#endregion
export { canonicalizeStateKey, splitStateKey };