import { primitive, record } from '@synnaxlabs/x';
export type State = Exclude<primitive.Value, undefined> | record.Unknown | void;
export type SetFunc<S, PS = S> = (prev: PS) => S;
export declare const isSetter: <S extends State, PS = S>(arg: SetArg<S, PS>) => arg is SetFunc<S, PS>;
export type SetArg<NextState extends State, PrevState = NextState> = NextState | SetFunc<NextState, PrevState>;
export type Setter<NextState extends State, PrevState = NextState> = (value: SetArg<NextState, PrevState>) => void;
export type PureSetter<NextState extends State> = (value: NextState) => void;
export type Initial<InitialState extends State> = InitialState | (() => InitialState);
export declare const executeSetter: <NextState extends State, PrevState extends State = NextState>(setter: SetArg<NextState, PrevState>, prev: PrevState) => NextState;
export declare const skipNull: <NextState extends State, PrevState extends State = NextState>(f: SetFunc<NextState, PrevState>) => SetFunc<NextState | undefined, PrevState | undefined>;
export declare const executeInitialSetter: <InitialState extends State>(setter: Initial<InitialState>) => InitialState;
export declare const isInitialSetter: <InitialState extends State>(arg: Initial<InitialState>) => arg is () => InitialState;
export type UseReturn<NextState extends State> = [NextState, Setter<NextState>];
export type Use = <NextState extends State>(initial: Initial<NextState>) => UseReturn<NextState>;
export type PureUseReturn<NextState extends State> = [NextState, PureSetter<NextState>];
export type PureUse<NextState extends State> = (initial: NextState) => PureUseReturn<NextState>;
export interface UsePassthroughProps<NextState extends State> {
    initial: Initial<NextState>;
    value?: NextState;
    onChange?: Setter<NextState>;
}
export declare const usePassthrough: <NextState extends State>({ initial, value, onChange, }: UsePassthroughProps<NextState>) => UseReturn<NextState>;
export interface UsePurePassthroughProps<NextState extends State> {
    initial: Initial<NextState>;
    value?: NextState;
    onChange?: PureSetter<NextState>;
    callOnChangeIfValueIsUndefined?: boolean;
}
export declare const usePurePassthrough: <NextState extends State>({ initial, value, onChange, }: UsePurePassthroughProps<NextState>) => PureUseReturn<NextState>;
export declare const usePersisted: <S extends State>(initial: Initial<S>, key: string) => UseReturn<S>;
//# sourceMappingURL=state.d.ts.map