declare type AnyMachine<Event extends Typed, State extends Typed, Ctx extends unknown[] = [], DerivedLocal = object, Derived = object> = {
    derive?: ((s: Prettify<DerivedLocal & State>) => Derived) | Derived;
    init: Init<Sendable<State>, any>;
    states: AnyStates<Event, State, Ctx, DerivedLocal, Derived>;
};

declare type AnyStates<Event extends Typed, State extends Typed, Ctx extends unknown[], DerivedLocal, Derived> = {
    [StateType in State['type']]: {
        always?: (<S extends {
            type: StateType;
        } & Derived & DerivedLocal & State>(state: S) => Sendable<State> | undefined) | Sendable<State>;
        events?: Partial<{
            [EventType in Event['type']]: (<E extends {
                type: EventType;
            } & Event, S extends {
                type: StateType;
            } & Derived & DerivedLocal & State>(event: E, state: S, ...args: Ctx) => Sendable<State> | undefined | void) | Sendable<State>;
        }>;
        wildcard?: (<E extends {
            type: Event;
        } & Event, S extends {
            type: StateType;
        } & Derived & DerivedLocal & State>(event: E, state: S, ...args: Ctx) => Sendable<State> | undefined | void) | Sendable<State>;
    };
} & (DerivedLocal extends {
    [K in keyof DerivedLocal]: never;
} ? {
    [StateType in State['type']]: object;
} : {
    [StateType in State['type']]: {
        derive: ((state: Prettify<{
            type: StateType;
        } & State>) => DerivedLocal) | DerivedLocal;
    };
});

export declare function append<T>(x: T, xs: T[]): T[];

export declare function apply<P, Q>(f: (p: P) => Q, p: P): Q;

export declare type AreEqual<T> = (a: T, b: T) => boolean;

declare type ArgOfInit<T> = T extends (p: infer R) => any ? R : void;

export declare function at<X>(index: number): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<X, Mega, FL | undefined, typeof REMOVE, never>;

declare type Com<Part, Whole> = (p: Part, w: Whole) => Whole;

export declare class COptic<Part, Whole, Fail, Command, S> implements IOptic<Part, Whole, Fail, Command, S> {
    com: Com<Command, Whole>;
    getter?: Getter<Part, Whole, Fail>;
    isCommand: (v: unknown) => v is Command;
    isFailure: (v: unknown) => v is Fail;
    mapper: Mapper<Part, Whole>;
    refold: <Acc>(fold: FoldFn<Part, Acc, Ctx>) => FoldFn<Whole, Acc, Ctx>;
    setter?: Setter<Part, Whole, S>;
    constructor(opts: {
        com: Com<Command, Whole>;
        getter?: Getter<Part, Whole, Fail>;
        isCommand: (v: unknown) => v is Command;
        isFailure: (v: unknown) => v is Fail;
        mapper: Mapper<Part, Whole>;
        refold: <Acc>(fold: FoldFn<Part, Acc, Ctx>) => FoldFn<Whole, Acc, Ctx>;
        setter?: Setter<Part, Whole, S>;
    });
    static eq<Whole>(): COptic<Whole, Whole, never, never, unknown>;
    command(token: Command, whole: Whole): Whole;
    fold<Acc>(form: FoldForm<Part, Acc, Ctx>, whole: Whole): Acc;
    modify(mod: Modify<Part>, whole: Whole): Whole;
    put(part: Part, whole: S | Whole): Whole;
    update(arg: ((p: Part) => Part) | Command | Part): (whole: Whole) => Whole;
    view<A = undefined>(whole: Whole, or?: Init<A, Fail>): (Fail extends never ? never : A) | Part;
}

export declare type Ctx = {
    close: () => void;
};

export declare const ctxNull: Ctx;

export declare function curry<P extends unknown[], Q extends unknown[], R>(f: (...args: [...P, ...Q]) => R, ...args: P): (...args2: Q) => R;

export declare function curry1<A, Args extends unknown[], R>(f: (...args: [A, ...Args]) => R): (a: A) => (...args: Args) => R;

export declare function dedupe<Whole>(areEqual?: (a: Whole, b: Whole) => unknown): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Whole, Mega, FL, never, never>;

export declare function disabled<Part>(value: ((p: Part) => Part) | Part): <Whole, Fail, Command, S>(o: COptic<Part, Whole, Fail, Command, S>) => COptic<boolean, Whole, never, never, never>;

export declare type EffectsHandlers<Event, SubState> = SubState extends {
    effects?: unknown;
} ? {
    [Key in keyof Exclude<SubState['effects'], undefined>]: (e: Exclude<Exclude<SubState['effects'], undefined>[Key], undefined>, send: (event: Event) => void) => (() => void) | void;
} : never;

export declare function elems<X>(): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<X, Mega, FL | undefined, never, never>;

declare type ExtractEvent<Transition> = Transition extends (e: infer E, ...args: any[]) => any ? E : void;

declare type ExtractEventObject<Transitions extends Record<string, unknown>> = {
    [K in keyof Transitions]: {
        type: K;
    } & ExtractEvent<Transitions[K]>;
};

declare type ExtractEvents<Transitions extends Record<PropertyKey, unknown>> = UnionValues<ExtractEventObject<Transitions>>;

declare type Final<State extends Typed, States extends Record<string, unknown>> = FinalStates<States> & State;

declare type FinalStates<States extends Record<string, unknown>> = FinalStatesByKey<States>[keyof States & string];

declare type FinalStatesByKey<States extends Record<string, unknown>> = {
    [Type in keyof States & string]: IsFinal<Type, States>;
};

export declare function findMany<X, Y extends X>(p: (x: X) => x is Y): <A, F, C, S>(o: IOptic<X[], A, F, C, S>) => COptic<Y[], A, F, never, NON_PRISM>;

export declare function findMany<X>(p: (x: X) => unknown): <A, F, C, S>(o: IOptic<X[], A, F, C, S>) => COptic<X[], A, F, never, NON_PRISM>;

export declare function findOne<X, Y extends X>(p: (x: X) => x is Y): <Mega, F2, C2, S>(o: IOptic<X[], Mega, F2, C2, S>) => COptic<Y, Mega, F2 | undefined, typeof REMOVE, NON_PRISM>;

export declare function findOne<X>(p: (x: X) => unknown): <Mega, F2, C2, S>(o: IOptic<X[], Mega, F2, C2, S>) => COptic<X, Mega, F2 | undefined, typeof REMOVE, NON_PRISM>;

export declare function flow<TArgs, R1, R2, R3, R4, R5, R6, R7>(args: TArgs, f1: (args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): R7;

export declare function flow<TArgs, R1, R2, R3, R4, R5, R6>(args: TArgs, f1: (args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): R6;

export declare function flow<TArgs, R1, R2, R3, R4, R5>(args: TArgs, f1: (args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): R5;

export declare function flow<TArgs, R1, R2, R3, R4>(args: TArgs, f1: (args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): R4;

export declare function flow<TArgs, R1, R2, R3>(args: TArgs, f1: (args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): R3;

export declare function flow<TArgs, R1, R2>(args: TArgs, f1: (args: TArgs) => R1, f2: (a: R1) => R2): R2;

export declare function flow<TArgs, R1>(args: TArgs, f1: (args: TArgs) => R1): R1;

export declare type Focus<Part, Whole, Fail, Command, T> = (eq: COptic<Whole, Whole, never, never, void>) => COptic<Part, Whole, Fail, Command, T>;

export declare function focus<Whole>(): <Part, Fail, Command, S>(o: Focus<Part, Whole, Fail, Command, S>) => COptic<Part, Whole, Fail, Command, S>;

export declare type FoldFn<Part, Acc, Ctx> = (p: Part, acc: Acc, ctx: Ctx) => Acc;

export declare interface FoldForm<Part, Acc, C> {
    foldFn: FoldFn<Part, Acc, C>;
    init: Init<Acc>;
}

export declare function forbidden<Part, Whole>(_part: Part, _whole: Whole): Whole;

export declare const fromArray: <T>(xs: T[]) => UnfoldForm<T, number>;

export declare function fromInit<T>(init: Init<T, void>): T;

export declare function fromSendable<Event extends Typed>(event: Sendable<Event>): Event;

declare type Getter<Part, Whole, Fail> = (w: Whole) => Fail | Part;

export declare function head<X>(): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<X, Mega, FL | undefined, typeof REMOVE, never>;

export declare interface ICtx<Whole, Index> {
    close: () => void;
    index: Index;
    whole: Whole;
}

export declare function id<T>(t: T): T;

export declare interface IMachine<Event, State, RWCtx extends unknown[], Transformed, SubState, Final> {
    getFinal: (transformed: Transformed) => Final | undefined;
    init: () => State;
    reducer: (event: Event, transformed: Transformed, ...args: RWCtx) => State | undefined;
    transform: (state: State) => Transformed;
    visit: <Acc>(acc: Acc, fold: (subState: SubState, acc: Acc, index: string) => Acc, transformed: Transformed) => Acc;
}

export declare function includes<X>(x: X): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<boolean, Mega, FL, never, never>;

export declare type Init<T, P = void> = ((p: P) => T) | T;

export declare function insert<T>(index: number, x: T, xs: T[]): T[];

export declare function insertValue<X>(element: X, xs: X[]): X[];

export declare interface IOptic<Part, Whole, Fail, Command, S> {
    com: Com<Command, Whole>;
    getter?: Getter<Part, Whole, Fail>;
    isCommand: (v: unknown) => v is Command;
    isFailure: (v: unknown) => v is Fail;
    mapper: Mapper<Part, Whole>;
    refold: <Acc>(fold: FoldFn<Part, Acc, Ctx>) => FoldFn<Whole, Acc, Ctx>;
    setter?: Setter<Part, Whole, S>;
}

declare type IOpticArgs<Part, Whole, Fail, Command, S> = IOptional<Part, Whole, Fail, Command, S> | ITraversal<Part, Whole, Fail, Command>;

declare interface IOpticBase<Part, Whole, Fail, Command, S> {
    command: Com<Command, Whole>;
    getter?: Getter<Part, Whole, Fail>;
    isCommand: (v: unknown) => v is Command;
    isFailure: (v: unknown) => v is Fail;
    mapper?: Mapper<Part, Whole>;
    refold?: <Acc>(mod: FoldFn<Part, Acc, Ctx>) => FoldFn<Whole, Acc, Ctx>;
    setter?: Setter<Part, Whole, S>;
}

declare interface IOptional<Part, Whole, Fail, Command, S> extends IOpticBase<Part, Whole, Fail, Command, S> {
    getter: Getter<Part, Whole, Fail>;
    setter: Setter<Part, Whole, S>;
}

export declare function isDisabled<Event, State, Message extends Typed, Transformed, SubState, Final>(machine: IMachine<Event, State, MessageCtx<Message>, Transformed, SubState, Final>, transformed: Transformed, event: Event): boolean;

export declare function isEmpty(obj?: object): boolean;

export declare type IsFinal<Type extends string, States extends Record<Type, unknown>> = States[Type] extends {
    always: unknown;
} ? never : States[Type] extends {
    wildcard: unknown;
} ? never : States[Type] extends {
    events: unknown;
} ? keyof States[Type]['events'] extends never ? {
    type: Type;
} : never : {
    type: Type;
};

export declare function isFunction<T>(x: T): x is ((...args: any[]) => any) & T;

export declare function isNever(_v: unknown): _v is never;

export declare function iso<Part, Whole>({ getter, mapper, setter, }: {
    getter: (whole: Whole) => Part;
    mapper?: Mapper<Part, Whole>;
    setter: (part: Part) => Whole;
}): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, FL, never, void & SL>;

export declare function isUndefined(v: unknown): v is undefined;

declare interface ITraversal<Part, Whole, Fail, Command> extends IOpticBase<Part, Whole, Fail, Command, NON_PRISM> {
    mapper: Mapper<Part, Whole>;
    refold: <Acc>(foldPart: FoldFn<Part, Acc, Ctx>) => FoldFn<Whole, Acc, Ctx>;
}

export declare function lens<Part, Whole>({ getter, mapper, setter, }: {
    getter: (whole: Whole) => Part;
    mapper?: Mapper<Part, Whole>;
    setter: (part: Part, whole: Whole) => Whole;
}): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, FL, never, never>;

export declare function linear(m: number, b?: number): <Mega, FL, CL, SL>(l: IOptic<number, Mega, FL, CL, SL>) => COptic<number, Mega, FL, never, void & SL>;

export declare type Listener<Message extends Typed> = ((message: Message) => void) | {
    [K in Message['type']]: (message: {
        type: K;
    } & Message) => void;
};

export declare class MachineEffects<Event, SubState> {
    private effectsHandlers;
    private last;
    constructor(effectsHandlers: EffectsHandlers<Event, SubState>);
    private foldSubState;
    flush(indices?: Set<string>): void;
    update(visit: (f: (subState: SubState, acc: Set<string>, index: string) => Set<string>, acc: Set<string>) => Set<string>, send: (event: Event) => void): void;
}

declare type Mapper<Part, Whole> = (mod: (p: Part) => Part, w: Whole) => Whole;

export declare type MessageCtx<Message extends Typed> = [
(emit: Sendable<Message>) => void
];

export declare type Modify<Value> = (value: Value) => Value;

export declare function multiStateBaseMachine<Event extends Typed, State extends Typed, DerivedLocal, Derived, Ctx extends unknown[]>(): <Machine extends AnyMachine<Event, State, Ctx, DerivedLocal, Derived>>({ derive, init, states }: Machine) => (initialArg: ArgOfInit<Machine["init"]>) => IMachine<Sendable<Event>, State, Ctx, Derived & DerivedLocal & State, Derived & DerivedLocal & State, Prettify<Final<State, Machine["states"]>>>;

export declare function multiStateMachine<Event extends Typed, State extends Typed, DerivedLocal = object, Derived = object, Message extends Typed = {
    type: never;
}>(): <Machine extends AnyMachine<Event, State, MessageCtx<Message>, DerivedLocal, Derived>>({ derive, init, states }: Machine) => (initialArg: ArgOfInit<Machine["init"]>) => IMachine<Sendable<Event>, State, MessageCtx<Message>, Derived & DerivedLocal & State, Derived & DerivedLocal & State, Final<State, Machine["states"]> extends infer T ? { [Key in keyof T]: Final<State, Machine["states"]>[Key]; } : never>;

export declare function nextState<Event, State, Message extends Typed, Transformed, SubState, Final>(machine: IMachine<Event, State, MessageCtx<Message>, Transformed, SubState, Final>, transformed: Transformed, event: Event): Transformed;

export declare type NON_PRISM = never;

export declare const noop: () => void;

export declare function nth<Index extends keyof O & number, O extends unknown[]>(index: Index): <Mega, FL, CL, SL>(l: IOptic<O, Mega, FL, CL, SL>) => COptic<O[Index], Mega, FL, never, never>;

declare class ObjectMachine<Event, State, Message extends Typed, Transformed, SubState, Final> {
    private machine;
    private effects;
    private onFinal?;
    private onMessage;
    private queue;
    final: Final | undefined;
    state: Transformed;
    constructor(machine: IMachine<Event, State, MessageCtx<Message>, Transformed, SubState, Final>, opts?: {
        events?: EffectsHandlers<Event, SubState>;
        onFinal?: (final: Final) => void;
        onMessage?: Listener<Message>;
    });
    private onChange;
    flush(): void;
    isDisabled(event: Event): boolean;
    next(event: Event): Transformed;
    send(event: Event): void;
    visit<Acc>(fold: (subState: SubState, acc: Acc, index: string) => Acc, acc: Acc): Acc;
}

export declare function objectMachine<Event, State, Message extends Typed, Transformed, SubState, Final>(machine: IMachine<Event, State, MessageCtx<Message>, Transformed, SubState, Final>, opts?: {
    events?: EffectsHandlers<Event, SubState>;
    onFinal?: (final: Final) => void;
    onMessage?: Listener<Message>;
}): ObjectMachine<Event, State, Message, Transformed, SubState, Final>;

export declare function opticNonPrism<Part, Whole, Fail, Command>(r: IOpticArgs<Part, Whole, Fail, Command, NON_PRISM>): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, Fail | FL, Command, never>;

export declare function opticPrism<Part, Whole, Fail, Command>(r: IOptional<Part, Whole, Fail, Command, PRISM>): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, Fail | FL, Command, void & SL>;

export declare function optional<Part, Whole>({ getter, mapper, setter, }: {
    getter: Getter<Part, Whole, undefined>;
    mapper?: Mapper<Part, Whole>;
    setter: Setter<Part, Whole, NON_PRISM>;
}): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, FL | undefined, never, never>;

declare type OptionalKeys<T> = {
    [K in keyof T]: object extends Pick<T, K> ? K : never;
}[keyof T];

export declare function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7, TResult>(...funcs: [
f1: (...args: TArgs) => R1,
f2: (a: R1) => R2,
f3: (a: R2) => R3,
f4: (a: R3) => R4,
f5: (a: R4) => R5,
f6: (a: R5) => R6,
f7: (a: R6) => R7,
...func: Array<(a: any) => any>,
fnLast: (a: any) => TResult
]): (...args: TArgs) => TResult;

export declare function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7>(f1: (...args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6, f7: (a: R6) => R7): (...args: TArgs) => R7;

export declare function pipe<TArgs extends any[], R1, R2, R3, R4, R5, R6>(f1: (...args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5, f6: (a: R5) => R6): (...args: TArgs) => R6;

export declare function pipe<TArgs extends any[], R1, R2, R3, R4, R5>(f1: (...args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4, f5: (a: R4) => R5): (...args: TArgs) => R5;

export declare function pipe<TArgs extends any[], R1, R2, R3, R4>(f1: (...args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3, f4: (a: R3) => R4): (...args: TArgs) => R4;

export declare function pipe<TArgs extends any[], R1, R2, R3>(f1: (...args: TArgs) => R1, f2: (a: R1) => R2, f3: (a: R2) => R3): (...args: TArgs) => R3;

export declare function pipe<TArgs extends any[], R1, R2>(f1: (...args: TArgs) => R1, f2: (a: R1) => R2): (...args: TArgs) => R2;

export declare function pipe<TArgs extends any[], R1>(f1: (...args: TArgs) => R1): (...args: TArgs) => R1;

export declare function pipe2<P, Q, R>(f: (p: P) => Q, g: (q: Q) => R): (p: P) => R;

export declare function prepend<T>(x: T, xs: T[]): T[];

export declare type Prettify<Type> = {
    [Key in keyof Type]: Type[Key];
} & {};

export declare type PRISM = void;

export declare function prism<Part, Whole>({ getter, mapper, setter, }: {
    getter: Getter<Part, Whole, undefined>;
    mapper?: Mapper<Part, Whole>;
    setter: Setter<Part, Whole, PRISM>;
}): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, FL | undefined, never, void & SL>;

export declare function promiseMachine<Event, State, Transformed, SubState, Final>(machine: IMachine<Event, State, MessageCtx<{
    type: never;
}>, Transformed, SubState, Final>, events: EffectsHandlers<Event, SubState>): Promise<Final>;

export declare function prop<Key extends keyof O, O extends object>(key: Key): <A, F1, C, S>(p: IOptic<O, A, F1, C, S>) => COptic<Exclude<O[Key], undefined>, A, F1 | (Key extends OptionalKeys<O> ? undefined : never), Key extends OptionalKeys<O> ? typeof REMOVE : never, NON_PRISM>;

export declare function queue<X>(): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<X, Mega, FL | undefined, typeof REMOVE, never>;

export declare type Reducer<Event, Acc> = (t: Event, acc: Acc) => Acc;

export declare type Refold<Part, Whole, C> = <Acc>(fold: FoldFn<Part, Acc, C>) => FoldFn<Whole, Acc, C>;

export declare function removable<Part, Whole>({ getter, mapper, remover, setter, }: {
    getter: Getter<Part, Whole, undefined>;
    mapper?: Mapper<Part, Whole>;
    remover: Modify<Whole>;
    setter: Setter<Part, Whole, never>;
}): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, FL | undefined, typeof REMOVE, never>;

export declare const REMOVE: unique symbol;

export declare function remove<T>(index: number, xs: T[]): T[];

export declare function removeValue<X>(element: X, xs: X[]): X[];

export declare function replace<T>(x: T, index: number, xs: T[]): T[];

export declare function reread<Whole>(mod: (a: Whole) => Whole): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Whole, Mega, FL, never, void & SL>;

export declare function rewrite<Whole>(setter: (next: Whole, last: Whole) => Whole): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Whole, Mega, FL, never, never>;

export declare type Sendable<T extends Typed> = T | (T extends {
    type: infer U;
} ? {
    type: U;
} extends T ? U : never : T extends void ? void : never);

declare type Setter<Part, Whole, S> = (p: Part, w: S | Whole) => Whole;

export declare function shallowEqual(a: any, b: any): boolean;

export declare function simpleStateBaseMachine<RWCtx extends unknown[]>(): <State, T extends Transitions<State, Transformed, RWCtx>, Transformed = State, InitialArg = void, Final = never>({ events, init, transform, }: {
    events: T;
    init: Init<State, InitialArg>;
    transform?: (s: State) => Transformed;
}, getFinal?: (s: Transformed) => Final | undefined) => (initialArg: InitialArg) => IMachine<Sendable<Prettify<ExtractEvents<T>> & Typed>, State, RWCtx, Transformed, Transformed, Final>;

export declare function simpleStateMachine<Message extends Typed = {
    type: never;
}>(): <State, T extends Transitions<State, Transformed, MessageCtx<Message>>, Transformed = State, InitialArg = void, Final = never>({ events, init, transform, }: {
    events: T;
    init: Init<State, InitialArg>;
    transform?: ((s: State) => Transformed) | undefined;
}, getFinal?: ((s: Transformed) => Final | undefined) | undefined) => (initialArg: InitialArg) => IMachine<Sendable<(UnionValues<ExtractEventObject<T>> extends infer T_1 ? { [Key in keyof T_1]: UnionValues<ExtractEventObject<T>>[Key]; } : never) & Typed>, State, MessageCtx<Message>, Transformed, Transformed, Final>;

export declare function stack<X>(): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<X, Mega, FL | undefined, typeof REMOVE, never>;

export declare function strToNum(): <Mega, FL, CL, SL>(l: IOptic<string, Mega, FL, CL, SL>) => COptic<number, Mega, FL | undefined, never, void & SL>;

export declare function tail<X>(): <Mega, FL, CL, SL>(l: IOptic<X[], Mega, FL, CL, SL>) => COptic<X[], Mega, FL | undefined, typeof REMOVE, never>;

export declare function to<Micro, Part>(getter: (v: Part) => Micro): <Mega, FL, CL, SL>(l: IOptic<Part, Mega, FL, CL, SL>) => COptic<Micro, Mega, FL, never, SL>;

export declare function to<Micro, Part>(getter: (v: Part) => Micro | undefined): <Mega, FL, CL, SL>(l: IOptic<Part, Mega, FL, CL, SL>) => COptic<Micro, Mega, FL | undefined, never, SL>;

export declare function toArray<V>(): FoldForm<V, V[], Ctx>;

export declare function toFirst<Part, Fail, Ctx extends {
    close: () => void;
}>(fail: Fail): FoldForm<Part, Fail | Part, Ctx>;

export declare function toInit<T, P = void>(init: Init<T, P>): (p: P) => T;

export declare function toListener<Message extends Typed>(listener: Listener<Message>): (message: Sendable<Message>) => void;

declare type Transition<State, Transformed, Ctx extends unknown[]> = ((e: any, s: Transformed, ...args: Ctx) => State | undefined) | State;

declare type Transitions<State, Transformed, Ctx extends unknown[]> = Record<any, Transition<State, Transformed, Ctx>>;

export declare function traversal<Part, Whole, Index>({ coll, form, }: {
    coll: Unfolder<Part, Whole, Index>;
    form: () => FoldForm<Part, Whole, Ctx>;
}): <Mega, FL, CL, SL>(l: IOptic<Whole, Mega, FL, CL, SL>) => COptic<Part, Mega, FL | undefined, never, never>;

export declare type Typed = {
    type: string;
};

export declare type Unfolder<Part, Whole, Index> = (w: Whole) => UnfoldForm<Part, Index>;

export declare type UnfoldForm<Part, Index> = () => {
    index: Index;
    part: Part;
} | undefined;

declare type UnionValues<T> = T extends Record<string, unknown> ? T[keyof T] : never;

export declare type Updater<Value, Command> = ((value: Value) => Value) | Command | Value;

export declare function valueOr<Part>(value: Init<Part>): <Whole, Fail, Command, S>(o: IOptic<Part, Whole, Fail, Command, S>) => COptic<Part, Whole, never, Command, S>;

export declare function when<Part, Micro extends Part>(p: (v: Part) => v is Micro): <Mega, FL, CL, SL>(l: IOptic<Part, Mega, FL, CL, SL>) => COptic<Micro, Mega, FL | undefined, never, SL & void>;

export declare function when<Part>(p: (v: Part) => unknown): <Mega, FL, CL, SL>(l: IOptic<Part, Mega, FL, CL, SL>) => COptic<Part, Mega, FL | undefined, never, SL & void>;

export declare function withSend<Event extends Typed>(emit: (event: Event) => void): (e: Sendable<Event>) => undefined;

export { }
