import { MutationObserverSlimmer } from './mutation-observer-slimmer';
import { Nullable } from '../../../types/general';
export declare type AriaAttrDependency = {
  dependency: string[];
  defaultValue?: Nullable<string>;
};
export declare type AriaAttributesMap = Record<string, AriaAttrDependency>;
/**
 * Maps component attributes/properties to aria-XXX attributes on an inner native element.
 * Observes attribute changes on host and updates the target element accordingly.
 */
export declare class AriaAttributesValueMapper extends MutationObserverSlimmer {
  private readonly targetGetter;
  private readonly ariaMap;
  /**
   * Component lifecycle - [componentDidLoad]
   */
  componentDidLoad(): void;
  /**
   * Run mapping after each component render to ensure refs assigned and
   * attributes/properties are up-to-date. This guarantees the mapper runs
   * even when attribute changes are observed before the inner target ref
   * is available.
   */
  componentDidRender(): void;
  /**
   * The constructor initializes a class instance with a targetGetter function and an ariaMap.
   *
   * @param {() => HTMLElement} targetGetter - a function that returns the target element to set aria attributes on
   * @param {AriaAttributesMap} ariaMap - a map where the key is the aria attribute to set on the target element, and the value is an object that defines the dependencies (attributes/properties on host to check for value) and an optional default value
   */
  constructor(targetGetter: () => HTMLElement, ariaMap: AriaAttributesMap);
  /**
   * The `handleMutations` function processes an array of `MutationRecord` objects to determine which attributes have changed and then calls the `performMapping` function to update the corresponding aria attributes on the target element. It collects the names of the changed attributes into a set and passes it to the `performMapping` function, which uses this information to decide which aria attributes need to be updated based on their defined dependencies.
   *
   * @param {MutationRecord[]} mutations - an array of MutationRecord objects that represent the changes observed by the MutationObserver. Each MutationRecord contains information about the type of mutation, the target element that was mutated, and any relevant attribute names if the mutation was an attribute change.
   */
  private handleMutations;
  /**
   * The `performMapping` function updates the aria attributes on the target element based on the defined dependencies in the `ariaMap`. It checks which attributes have changed (if provided) and only updates the aria attributes that depend on those changed attributes. For each aria attribute defined in the `ariaMap`, it looks for the first non-empty value among its dependencies (checking both attributes and properties on the host element) and sets that as the value of the aria attribute on the target element. If all dependencies are empty or undefined, it uses the default value specified in the `ariaMap`. The function also includes error handling when setting attributes on the target element.
   *
   * @param {Set<string>} changedAttrs - a set of attribute names that have changed on the host element
   */
  private performMapping;
}
