import { Abortable } from '../abortable/Abortable';
import type { AnyRecord, UnionToIntersection } from '../BaseTypes';
import type { EffectFactory } from '../effect/Types';
import type { Registry } from '../registry/Registry';
import type { RegistryInterface } from '../registry/RegistryInterface';
import type { NamedTask, Task, TaskParam, TaskReturn } from '../task/Types';
import type { Thread } from '../thread/Thread';
export type ContextualizedTask<C extends ExecutionContext<any, any>, S extends NamedTask<Task<any, any, any>>> = S extends NamedTask<Task<infer CC, any, any>> ? C extends CC ? S : CC extends ExecutionContext<infer E, infer RM> ? C extends ExecutionContext<infer CE, infer CRM> ? [CE, CRM] extends [E, RM] ? S : NamedTask<Task<C, any, any>> : never : never : NamedTask<Task<C, any, any>>;
export type AnyExecutionContext = ExecutionContext<any, any>;
type FactoriesEffects<T extends EffectFactory<ExecutionContext<AnyRecord, AnyRecord>, AnyRecord>[]> = FactoryEffect<T[number]>;
type FactoryEffect<T> = T extends EffectFactory<ExecutionContext<AnyRecord, AnyRecord>, infer V> ? V : never;
export declare class ExecutionContext<T extends AnyRecord, RegistryMap extends AnyRecord> {
    private readonly parentThread;
    private registryInstance;
    private readonly effectFactories;
    effects: T;
    private removeEffectFunctions;
    readonly abortSignal: AbortSignal;
    readonly registry: RegistryInterface<RegistryMap>;
    private readonly componentsToRemove;
    constructor(parentThread: Thread, registryInstance: Registry, effectFactories?: EffectFactory<AnyExecutionContext, any>[], parentContext?: ExecutionContext<Partial<T>, RegistryMap>);
    private getRegistryApi;
    private attachToThread;
    private applyEffects;
    using: <U extends EffectFactory<ExecutionContext<T, RegistryMap>, AnyRecord>[]>(...factories: U) => ExecutionContext<T & UnionToIntersection<FactoryEffect<U[number]>>, RegistryMap>;
    fork: <NP extends NamedTask<Task<any, any, any>>>(task: ContextualizedTask<ExecutionContext<T, RegistryMap>, NP>, parameter: TaskParam<NP>, handleError?: ((error: Error) => boolean) | undefined) => Abortable<TaskReturn<NP>>;
    branchDependencies(): ExecutionContext<T, RegistryMap>;
}
export {};
