/**
 * @module state-action-refs
 *
 * This module exports various React hooks and TypeScript interfaces to create references for state,
 * actions, and functions. These references allow you to store and manipulate values and functions,
 * as well as dynamically inject additional behavior (using prepend and append methods) into their call chains.
 *
 * The provided hooks include:
 * - useStateRef: A state reference with event dispatching and validation.
 * - useActionRef: A reference for an action (a function with no arguments).
 * - useArgActionRef: A reference for an action that accepts an argument.
 * - useFuncRef: A reference for a function returning a value.
 * - useAsyncFuncRef: A reference for an asynchronous function.
 * - useArgFuncRef: A reference for a function that accepts an argument and returns a value.
 */
/**
 * Interface for a state reference.
 * Provides methods to get, set, and confirm the current state.
 */
export interface StateRef<T> {
    /**
     * Returns the current state value.
     */
    get(): T;
    /**
     * Updates the state to the provided value.
     * @param value - The new state value.
     */
    set(value: T): void;
    /**
     * Confirms the current state (potentially applying a confirmation transformation).
     */
    confirm(): void;
}
export interface StateRefresher {
    refresh: () => void;
}
export declare function useRefresher(): StateRefresher;
/**
 * A custom hook that creates a state reference.
 * The reference provides access to the state, along with event dispatching, validation, and confirmation logic.
 *
 * @param initialValue - The initial state value.
 * @returns An object implementing StateRef along with additional helper hooks.
 */
export declare function useStateRef<T>(initialValue: T | (() => T)): {
    /**
     * Returns the current state value.
     */
    get(): T;
    set: (value: T) => void;
    /**
     * Confirms the current state by applying the confirm function and updating the state.
     */
    confirm(): void;
    /**
     * Registers a callback to be invoked when the state changes.
     * Accepts a sync function, a cleanup function, or a function returning a Promise<void> (which will be ignored).
     *
     * @param on - The callback function that receives the new state value.
     */
    useOnChange(on: (value: T) => void | (() => void) | Promise<void>): void;
    /**
     * Memoizes a value based on the current state and additional dependencies.
     * @param on - A function that computes a value based on the current state.
     * @param deps - Optional additional dependencies.
     * @returns The memoized value.
     */
    useMemo<TOut>(on: (value: T) => TOut, deps?: any[]): TOut;
    /**
     * Sets a validation function to process any new state value before updating.
     * @param on - A function that validates (and optionally transforms) the new state value.
     */
    useValidate(on: (value: T) => T): void;
    /**
     * Sets a confirmation function to process the state value during confirmation.
     * @param on - A function that confirms (and optionally transforms) the current state value.
     */
    useConfirm(on: (value: T) => T): void;
};
/**
 * Interface for an action reference (a function with no arguments).
 * Provides methods to call, get, set, and inject code before or after the stored function.
 */
export interface ActionRef {
    /**
     * Invokes the stored action.
     */
    call(): void;
    /**
     * Retrieves the current action function.
     * @returns The stored action function.
     */
    get(): () => void;
    /**
     * Sets the stored action function.
     * @param fn - The new action function.
     */
    set(fn: () => void): void;
    /**
     * Prepends a function to be executed before the stored action.
     * @param fn - The function to run before the original action.
     */
    prepend(fn: () => void): void;
    /**
     * Appends a function to be executed after the stored action.
     * @param fn - The function to run after the original action.
     */
    append(fn: () => void): void;
}
/**
 * Custom hook to create an action reference.
 *
 * @param action - The initial action function.
 * @returns An object implementing ActionRef.
 */
export declare function useActionRef(action: () => void): ActionRef;
/**
 * Interface for an action reference that accepts an argument.
 * Provides methods to call with an argument, get, set, and inject code before or after the stored function.
 */
export interface ArgActionRef<T> {
    /**
     * Invokes the stored action with the provided argument.
     * @param arg - The argument to pass to the action.
     */
    call(arg: T): void;
    /**
     * Retrieves the current action function.
     * @returns The stored action function.
     */
    get(): (arg: T) => void;
    /**
     * Sets the stored action function.
     * @param fn - The new action function.
     */
    set(fn: (arg: T) => void): void;
    /**
     * Prepends a function to be executed before the stored action.
     * @param fn - The function to run before the original action.
     */
    prepend(fn: (arg: T) => void): void;
    /**
     * Appends a function to be executed after the stored action.
     * @param fn - The function to run after the original action.
     */
    append(fn: (arg: T) => void): void;
}
/**
 * Custom hook to create an argument-based action reference.
 *
 * @param action - The initial action function that accepts an argument.
 * @returns An object implementing ArgActionRef.
 */
export declare function useArgActionRef<T>(action: (arg: T) => void): ArgActionRef<T>;
/**
 * Interface for a function reference that returns a value.
 * Provides methods to call, get, set, and inject code before or after the stored function.
 */
export interface FuncRef<T> {
    /**
     * Invokes the stored function and returns its value.
     * @returns The result of the function call.
     */
    call(): T;
    /**
     * Retrieves the current function.
     * @returns The stored function.
     */
    get(): () => T;
    /**
     * Sets the stored function.
     * @param fn - The new function.
     */
    set(fn: () => T): void;
    /**
     * Prepends a function to be executed before the stored function.
     * @param fn - The function to run before the original function.
     */
    prepend(fn: () => void): void;
    /**
     * Appends a function to be executed after the stored function.
     * @param fn - The function to run after the original function.
     */
    append(fn: () => void): void;
}
/**
 * Custom hook to create a function reference.
 *
 * @param fn - The initial function.
 * @returns An object implementing FuncRef.
 */
export declare function useFuncRef<T>(fn: () => T): FuncRef<T>;
/**
 * Interface for an asynchronous function reference.
 * Provides methods to call, get, set, and inject code before or after the stored async function.
 */
export interface AsyncFuncRef<T> {
    /**
     * Invokes the stored asynchronous function and returns a promise of its result.
     * @returns A promise resolving to the result of the async function.
     */
    call(): Promise<T>;
    /**
     * Retrieves the current asynchronous function.
     * @returns The stored async function.
     */
    get(): () => Promise<T>;
    /**
     * Sets the stored asynchronous function.
     * @param fn - The new async function.
     */
    set(fn: () => Promise<T>): void;
    /**
     * Prepends a function to be executed before the stored async function.
     * @param fn - The function to run before the original async function.
     */
    prepend(fn: () => Promise<void> | void): void;
    /**
     * Appends a function to be executed after the stored async function.
     * @param fn - The function to run after the original async function.
     */
    append(fn: () => Promise<void> | void): void;
}
/**
 * Custom hook to create an asynchronous function reference.
 *
 * @param fn - The initial asynchronous function.
 * @returns An object implementing AsyncFuncRef.
 */
export declare function useAsyncFuncRef<T>(fn: () => Promise<T>): AsyncFuncRef<T>;
/**
 * Interface for a function reference that accepts an argument and returns a result.
 * Provides methods to call, get, set, and inject code before or after the stored function.
 */
export interface ArgFuncRef<TArg, TResult> {
    /**
     * Invokes the stored function with the provided argument.
     * @param arg - The argument to pass to the function.
     * @returns The result of the function call.
     */
    call(arg: TArg): TResult;
    /**
     * Retrieves the current function.
     * @returns The stored function.
     */
    get(): (arg: TArg) => TResult;
    /**
     * Sets the stored function.
     * @param fn - The new function.
     */
    set(fn: (arg: TArg) => TResult): void;
    /**
     * Prepends a function to be executed before the stored function.
     * @param fn - The function to run before the original function.
     */
    prepend(fn: (arg: TArg) => void): void;
    /**
     * Appends a function to be executed after the stored function.
     * @param fn - The function to run after the original function.
     */
    append(fn: (arg: TArg) => void): void;
}
/**
 * Custom hook to create an argument-based function reference.
 *
 * @param fn - The initial function that accepts an argument and returns a result.
 * @returns An object implementing ArgFuncRef.
 */
export declare function useArgFuncRef<TArg, TResult>(fn: (arg: TArg) => TResult): ArgFuncRef<TArg, TResult>;
