import * as React from 'react';
import React__default from 'react';
import { SimplifyDeep, Split, Tagged, IsStringLiteral, Simplify, IsUnknown, Merge as Merge$1, IsNever, IsLiteral, IsEmptyObject } from 'type-fest';
import { Context, Effect, Stream, ManagedRuntime, pipe, Layer, Scope } from 'effect';
import { MergeLeft } from 'effect/Types';
import { Call, Tuples, Booleans, Objects } from 'hotscript';
import * as effect_Scope from 'effect/Scope';
import { Tag, TagClass } from 'effect/Context';
import * as react_jsx_runtime from 'react/jsx-runtime';

type IsEffect<T> = T extends Effect.Effect<infer A, infer E, infer R> ? Effect.Effect<A, E, R> : never;
declare const createProxy: <T extends Record<PropertyKey, unknown>>(value: T) => Subscribable<NoInfer<T>> & T;
declare const createProxyStreamMap: <T extends Record<Exclude<PropertyKey, keyof Subscribable<NoInfer<T>>>, unknown>>(proxyState: Subscribable<T> & T, onKeyAccess?: (key: PropertyKey) => void) => Effect.Effect<{ [K in Exclude<keyof T & string, keyof ExtractStaticProps<T>> | Exclude<keyof T & number, keyof ExtractStaticProps<T>> | Exclude<keyof T & symbol, keyof ExtractStaticProps<T>>]: Stream.Stream<NonNullable<T[K]>, never, never>; } & { [K_1 in keyof ExtractStaticProps<T> & PropertyKey]: Stream.Stream<NonNullable<ExtractStaticProps<T>[K_1]>, never, never>; } extends infer T_1 ? { [KeyType in keyof T_1]: T_1[KeyType]; } : never, never, effect_Scope.Scope>;
type PropKey<K extends PropertyKey> = {
    __propKey: K;
};
declare const enhanceRuntime: <RProps>() => <R, E>(runtime: ManagedRuntime.ManagedRuntime<R, E>) => ManagedRuntime.ManagedRuntime<R | RProps, E>;
type PropService = Context.TagClassShape<'PropService', never>;
declare const createGetPropTag: <T extends (...args: any[]) => any>(tag: <const Id extends string>(id: Id) => T) => <C extends Record<PropertyKey, unknown>>() => {
    PropService: T extends (...args: any[]) => infer R ? R extends Context.TagClass<unknown, string, unknown> ? Context.TagClass<PropService, "PropService", { [K in Exclude<keyof C & string, keyof ExtractStaticProps<C>> | Exclude<keyof C & number, keyof ExtractStaticProps<C>> | Exclude<keyof C & symbol, keyof ExtractStaticProps<C>>]: Stream.Stream<NonNullable<C[K]>, never, never>; } & { [K_1 in keyof ExtractStaticProps<C> & PropertyKey]: Stream.Stream<NonNullable<ExtractStaticProps<C>[K_1]>, never, never>; } extends infer T_2 ? { [KeyType in keyof T_2]: T_2[KeyType]; } : never> : never : never;
};
declare const getPropTag: <C extends Record<PropertyKey, unknown>>() => {
    PropService: Context.TagClass<PropService, "PropService", { [K in Exclude<keyof C & string, keyof ExtractStaticProps<C>> | Exclude<keyof C & number, keyof ExtractStaticProps<C>> | Exclude<keyof C & symbol, keyof ExtractStaticProps<C>>]: Stream.Stream<NonNullable<C[K]>, never, never>; } & { [K_1 in keyof ExtractStaticProps<C> & PropertyKey]: Stream.Stream<NonNullable<ExtractStaticProps<C>[K_1]>, never, never>; } extends infer T_1 ? { [KeyType in keyof T_1]: T_1[KeyType]; } : never>;
};

declare const link: typeof pipe;
declare const isRuntimeContext: <T>(input: unknown) => input is RuntimeContext<T>;
declare const isRuntimeConfig: (input: unknown) => input is RuntimeConfig;
declare const isRuntimeInstance: <T>(input: unknown) => input is RuntimeInstance<T>;
declare const createRuntimeContext: (options: {
    name: string;
    providers?: () => ReturnType<typeof getProviders>;
}) => <R, E, A>(layer: Layer.Layer<R, E, A>) => RuntimeContext<R, E, A>;
declare const getProviders: <P extends Tag<any, any>[]>(callback: (from: <R>(runtime: RuntimeContext<R, never, PropService>) => {
    provide: <T extends Tag<any, any>>(service: T & Context.Tag.Service<T> extends R ? T : R) => T;
}) => [...P]) => {
    map: Map<string, RuntimeContext<any>>;
    from: SimplifyDeep<NestServices<[...P]>>;
};
type Nest<K extends string[], V> = K extends [
    infer Head extends string,
    ...infer Rest extends string[]
] ? {
    [P in Head]: Nest<Extract<Rest, string[]>, V>;
} : V;
type Merge<A, B> = {
    [K in keyof A | keyof B]: K extends keyof A ? K extends keyof B ? Merge<A[K], B[K]> : A[K] : K extends keyof B ? B[K] : never;
};
type StripAt<S extends string> = S extends `@${infer Rest}` ? Rest : S;
type NestServices<T extends readonly Context.Tag<any, any>[]> = T extends [
    infer First extends Context.Tag<any, any>,
    ...infer Rest extends Context.Tag<any, any>[]
] ? Merge<Nest<Split<StripAt<First['key']>, '/'>, First>, NestServices<Rest>> : object;

type InferSuccess<T> = T extends Effect.Effect<infer A, infer E, infer R> ? A : T extends Stream.Stream<infer A, infer E, infer R> ? A : T;
type InferContext<T extends Stream.Stream<any, any, any> | Effect.Effect<any, any, any>> = T extends Effect.Effect<infer A, infer E, infer R> ? R : T extends Stream.Stream<infer A, infer E, infer R> ? R : never;
type IsTag<T> = T extends Tag<infer I, infer V> ? Tag<I, V> : T extends TagClass<infer S, infer I, infer V> ? TagClass<S, I, V> : never;

declare const isStream: <U>(u: U) => u is U & Stream.Stream<InferSuccess<U>>;
declare const isStreamEffect: <A, E, R>(u: Effect.Effect<A, E, R>) => Effect.Effect<boolean>;
type IsStream<T> = T extends Stream.Stream<infer A, infer E, infer R> ? Stream.Stream<A, E, R> : never;

type ExpectFalse<T extends false> = T;
type Expect<T extends true> = T;
type Digit = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
type Alpha = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z' | 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O' | 'P' | 'Q' | 'R' | 'S' | 'T' | 'U' | 'V' | 'W' | 'X' | 'Y' | 'Z';
type AllowedChar = Alpha | Digit | '_' | '$';
declare const createKey: <T extends string>(key: IsValid<T> extends true ? T : "Error: use @Component/Name format") => IsValid<T> extends true ? T : "Error: use @Component/Name format";
type ValidSegment<S extends string, FirstChar extends boolean = true> = S extends `${infer First}${infer Rest}` ? FirstChar extends true ? First extends Digit ? false : First extends Alpha ? ValidSegment<Rest, false> : false : First extends AllowedChar ? ValidSegment<Rest, false> : false : true;
type FirstIsValid<S extends string> = S extends `@${infer Rest}` ? Rest extends '' ? false : ValidSegment<Rest> : false;
type ValidateRest<T extends string[]> = T extends [
    infer Segment extends string,
    ...infer Rest extends string[]
] ? Segment extends '' ? false : ValidSegment<Segment> extends true ? ValidateRest<Rest> : false : true;
type IsValid<S extends string> = Split<S, '/'> extends [
    infer First extends string,
    ...infer Rest extends string[]
] ? FirstIsValid<First> extends true ? Rest extends [] ? false : ValidateRest<Rest> : false : false;

declare const createUse: <R>(localContext: RuntimeContext<R, never, PropService>, instances: Map<RuntimeKey, RuntimeInstance<any>>) => <A, E>(effect: Effect.Effect<A, E, R> | Stream.Stream<A, E, R>, deps?: React.DependencyList) => NonNullable<InferSuccess<A>>;

type InferArgs$1<F> = F extends (...args: infer A) => any ? A : never;
type InferReturn$1<F> = F extends (...args: any[]) => infer R ? R : never;
declare function createFn<R>(localContext: RuntimeContext<R, never, PropService>, instance: Map<RuntimeKey, RuntimeInstance<any>>): {
    <Fn extends (...args: any[]) => Effect.Effect<any, any, any>>(target: Fn): (...args: InferArgs$1<Fn>) => InferReturn$1<Fn> extends Effect.Effect<infer A, any, any> ? Effect.Effect<A> : never;
};

declare const createRun: <R>(localContext: RuntimeContext<R, never, PropService>, instances: Map<RuntimeKey, RuntimeInstance<any>>) => <A, E>(effect: Effect.Effect<A, E, R | Scope.Scope>, deps?: React.DependencyList) => void;

type InferArgs<F> = F extends (...args: infer A) => any ? A : never;
type InferReturn<F> = F extends (...args: any[]) => infer R ? R : never;
declare function createPush<R>(localContext: RuntimeContext<R, never, PropService>, instance: Map<RuntimeKey, RuntimeInstance<any>>): {
    <Fn extends (...args: any[]) => Effect.Effect<any, any, any>>(target: Fn): (...args: InferArgs<Fn>) => Promise<InferReturn<Fn> extends Effect.Effect<infer A, any, any> ? A : never>;
};

type ScopeId = Tagged<string, 'ScopeId'>;
type InstId = Tagged<string, 'InstId'>;
type DeclId = Tagged<string, 'DeclId'>;
type DeclarationId = Tagged<string, 'DeclarationId'>;
type ComponentId = Tagged<string, 'ComponentId'>;
type RegisterId = Tagged<string, 'RegisterId'>;
type RuntimeKey = symbol;
type RuntimeId = Tagged<string, 'RuntimeId'>;
type ProviderId = Tagged<string, 'ProviderId'>;
type InstanceId = Tagged<string, 'InstanceId'>;
type ComponentMeta = {
    name: string;
};
declare const ID_PROP = "_id";
declare const DRYRUN_ID_PROP = "_dryRunId";
declare const PROVIDERS_PROP = "_providers";
declare const COMPONENT_PROP = "_component";
declare const PROPS_PROP = "_props";
declare const UPSTREAM_PROP = "_upstream";
declare const ERROR_PROP = "_error";
type RuntimeApi<R> = {
    instance: RuntimeInstance<R>['runtime'];
    use: ReturnType<typeof createUse<R>>;
    useFn: ReturnType<typeof createFn<R>>;
    usePush: ReturnType<typeof createPush<R>>;
    useRun: ReturnType<typeof createRun<R>>;
};
type RuntimeApiFactory<R> = {
    create: (module: RuntimeContext<R, never, PropService>, instances: Map<RuntimeKey, RuntimeInstance<any>>) => RuntimeApi<R>;
    createInert: (stub: unknown) => RuntimeApi<R>;
};
type RuntimeConfig = {
    debug: boolean;
    postUnmountTTL: number;
    env: 'prod' | 'dev';
    replace: boolean;
    cleanupPolicy: 'onUnmount' | 'immediate';
};
type RuntimeContext<R, E = never, A = never> = {
    key: RuntimeKey;
    name: string;
    layer: Layer.Layer<R, E, A>;
};
type RuntimePayload<R, P extends Record<string, unknown>> = {
    providerId: string;
    index: number;
    context: RuntimeContext<R, never, PropService>;
    config: Partial<RuntimeConfig>;
    props: P;
};
type RuntimeInstance<R, P = object> = {
    id: InstanceId;
    runtime: ManagedRuntime.ManagedRuntime<R, never>;
    config: RuntimeConfig;
    propProxy: Subscribable<NoInfer<P>> & P;
};
type IdProp = {
    readonly id: string;
};
type Extensible<T extends Record<PropertyKey, unknown>> = T & Record<PropertyKey, unknown>;
type SubscribeFn<T> = (value: T) => void;
type UnsubscribeFn = () => void;
type Subscribable<T> = {
    subscribe: (key: keyof T | PropertyKey, fn: SubscribeFn<T[keyof T]>) => UnsubscribeFn;
    value: T;
};
type IsPrimitiveString<T> = [T] extends [string] ? IsStringLiteral<T> extends true ? false : true : false;
type SafeKeys<T extends PropertyKey> = IsStringLiteral<T> extends true ? T : never;
type ResultProps<CProps, ExtraProps extends Record<PropertyKey, unknown>> = Readonly<Partial<IdProp & Pick<ExtraProps, keyof CProps>> & Omit<CProps, SafeKeys<keyof ExtraProps>>>;
type ExtensibleProps<CProps> = Extensible<Partial<IdProp & CProps>>;
type UpstreamProviderApi<P> = {
    inject: <R>(module: RuntimeContext<R, never, PropService>) => RuntimeApi<R>;
    props: P;
};
type UpstreamProviderFn<CProps, TResult = unknown> = (api: UpstreamProviderApi<MergeLeft<IdProp, CProps>>) => TResult;
type ProviderApi<R, P = object> = {
    configure: (config?: Partial<RuntimeConfig>) => RuntimeApi<R>;
    runtime: RuntimeApi<R>;
    inject: <R>(module: RuntimeContext<R, never, PropService>) => RuntimeApi<R>;
    props: P;
};
type ProviderFn<R, CProps, TResult = unknown> = (api: ProviderApi<R, MergeLeft<IdProp, CProps>>) => TResult;
type PropsFn<CProps, TResult = unknown> = (props: MergeLeft<IdProp, CProps>) => TResult;
type ProviderEntryType = 'runtime' | 'upstream' | 'props';
type ProviderEntry<R, C extends React__default.FC<any>, P = any> = {
    id: ProviderId;
    type: 'runtime';
    module: RuntimeContext<R, never, PropService>;
    fn?: ProviderFn<R, C, P> | ProviderFn<R, C, undefined> | undefined;
} | {
    id: ProviderId;
    type: 'upstream';
    module?: RuntimeContext<R, never, PropService> | undefined;
    fn: ProviderFn<R, C, P> | ProviderFn<R, C>;
} | {
    id: ProviderId;
    type: 'props';
    fn: PropsFn<C, P>;
};
type ResolvedProviderEntry<R, C extends React__default.FC<any>, P> = ProviderEntry<R, C, P> & {
    level: number;
    index: number;
};
type ExtractStaticComponent<T> = T extends {
    [COMPONENT_PROP]: infer C;
} ? C extends (props: infer P) => any ? React__default.FC<Simplify<P>> : never : T;
type ExtractStaticProviders<T> = T extends {
    [PROVIDERS_PROP]: infer R;
} ? R extends unknown[] ? R : never : [];
type ExtractStaticProps<T> = T extends {
    [PROPS_PROP]: infer P;
} ? P : Record<never, never>;
type ExtractProps<C extends React__default.FC<any>> = React__default.ComponentProps<C> & ExtractStaticProps<C>;
type ExtractStaticUpstream<T> = T extends {
    [UPSTREAM_PROP]: infer U;
} ? U extends unknown[] ? U : never : [];
type ExtractStaticError<T> = T extends {
    [ERROR_PROP]: infer U;
} ? U extends unknown[] ? U : never : [];
type UnwrapRuntime<T> = T extends {
    module: infer R;
} ? R : T;
type ExtractReference<T> = UnwrapRuntime<T> extends {
    reference: () => infer R;
} ? R : never;
declare const UpstreamSymbol: unique symbol;
type UpstreamBrand = {
    readonly [UpstreamSymbol]: never;
};
type Up<T> = T & UpstreamBrand;
type KeepUpstream<T> = Call<Tuples.Filter<Booleans.Extends<{
    [UpstreamSymbol]: true;
}>>, T>;
type DownstreamBrand = {
    readonly [UpstreamSymbol]: false;
};
type Down<T> = T & DownstreamBrand;
type FilterReference<T> = Call<Tuples.Map<Objects.Get<'type'>>, T>;
type ExtractProviders<T> = T extends {
    [PROVIDERS_PROP]?: infer R;
} ? R : never;
type Includes<T extends readonly unknown[], V> = T extends [
    infer Head,
    ...infer Rest
] ? [V] extends [Head] ? true : Includes<Rest, V> : false;
type PushUnique<T extends readonly unknown[], V> = Includes<T, V> extends true ? T : [...T, V];
type Reverse<T> = Call<Tuples.Reverse, T>;
type Unique<T extends any[], Acc extends any[] = []> = T extends [
    infer Head,
    ...infer Tail
] ? Head extends Acc[number] ? Unique<Tail, Acc> : Unique<Tail, [...Acc, Head]> : Acc;
type CollectProviders<Component, Seen extends unknown[] = [], Acc extends unknown[] = []> = ExtractProviders<Component> extends readonly [infer Head, ...infer Tail] ? ExtractReference<Head> extends infer Ref ? Ref extends object ? Ref extends Seen[number] ? CollectProviders<{
    [PROVIDERS_PROP]?: Tail;
}, Seen, PushUnique<Acc, Head>> : CollectProviders<{
    [PROVIDERS_PROP]?: Tail;
}, [
    ...Seen,
    Ref
], PushUnique<[
    ...Acc,
    ...CollectProviders<Ref, [...Seen, Ref], Acc>
], Head>> : CollectProviders<{
    [PROVIDERS_PROP]?: Tail;
}, Seen, PushUnique<Acc, Head>> : Acc : Acc;
type TraverseDeps<T> = Reverse<Unique<CollectProviders<T>>>;

type SketchStats = {
    total: number;
    host: number;
    declComposite: number;
    anonComposite: number;
    portals: number;
    textish: number;
    keyed: number;
};
type SketchQuality = 'weak' | 'ok' | 'strong';
type ChildrenSketch = {
    id: string;
    quality: SketchQuality;
    stats: SketchStats;
};
declare function createChildrenSketch(children: React.ReactNode, maxDepth?: number, ns?: string): ChildrenSketch;

declare function isReactNode(value: unknown): value is React.ReactNode;
declare function isReactContext2<T>(variable: unknown): variable is React.Context<T>;
declare const isReactContext: <T>(variable: any) => variable is typeof variable extends T ? T : never;
type ExtractMeta<T> = T extends React.FC<any> ? Omit<T, keyof React.FC> : never;
declare const getDisplayName: <C extends React.FC<any> | undefined>(Component: C, prefix?: string) => string;
declare function copyStaticProperties(base: Record<string, unknown>, target: unknown): void;
declare const createElement: <C extends React.FC<any> | undefined>(Component: C, mergedProps: C extends React.FC<any> ? React.ComponentProps<C> : Record<never, never>) => react_jsx_runtime.JSX.Element | null;
declare const extractMeta: <C extends React.FC<any>>(Component: C) => ExtractMeta<C>;
declare const isFunctionalComponent: (fn: (...args: any[]) => any) => boolean;

declare function WithRuntime<R, CProps, // component props static
TProps extends ExtensibleProps<CProps>, // local provider props (inferred)
PProps, // providerProps cumulative
PErrors>(module: RuntimeContext<R, never, PropService>, fn?: ProviderFn<R, PProps & Partial<CProps>, TProps>): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => IsUnknown<PErrors> extends true ? React.FC<Simplify<ResultProps<CProps, TProps>>> & StaticProperties$4<React.FC<Simplify<CProps>>, Readonly<Merge$1<PProps, IsLiteral<keyof TProps> extends true ? TProps : {}>>, PErrors> : // constraint widening on error with overlap
React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
declare function WithRuntime<R, CProps, TProps extends Partial<IdProp & Record<string, unknown>> | void, PProps, PErrors>(module: RuntimeContext<R, never, PropService>, fnVoid?: ProviderFn<R, PProps & Partial<CProps>, TProps & (TProps extends Record<string, unknown> ? Partial<IdProp & CProps> : void)>): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => IsUnknown<PErrors> extends true ? React.FC<Simplify<Partial<IdProp> & CProps>> & StaticProperties$4<React.FC<Simplify<CProps>>, PProps, PErrors> : React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
type StaticProperties$4<C, TProps, TErrors = unknown> = TErrors extends [string] ? Merge$1<ExtractMeta<C>, {
    [ERROR_PROP]: TErrors;
}> : Merge$1<ExtractMeta<C>, {
    [PROPS_PROP]: IsNever<TProps> extends false ? Merge$1<ExtractStaticProps<C>, TProps> : ExtractStaticProps<C>;
}>;

declare function WithUpstream<CProps, // component props static
TProps extends ExtensibleProps<CProps>, // local provider props (inferred)
PProps, // providerProps cumulative
PErrors>(fn: UpstreamProviderFn<Simplify<PProps & Partial<CProps>>, TProps>): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => [
    IsUnknown<PErrors>,
    IsLiteral<keyof TProps> & IsEmptyObject<TProps>
] extends [true, true] ? React.FC<Simplify<ResultProps<CProps, TProps>>> & StaticProperties$3<React.FC<Simplify<CProps>>, Readonly<Merge$1<PProps, IsLiteral<keyof TProps> extends true ? TProps : {}>>, PErrors> : // constraint widening on error with overlap
React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
declare function WithUpstream<CProps, TProps extends Partial<IdProp & Record<string, unknown>> | void, PProps, PErrors>(fnVoid: UpstreamProviderFn<PProps & Partial<CProps>, TProps & (TProps extends Record<string, unknown> ? Partial<IdProp & CProps> : void)>): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => IsUnknown<PErrors> extends true ? React.FC<Simplify<Partial<IdProp> & CProps>> & StaticProperties$3<React.FC<Simplify<CProps>>, PProps, PErrors> : React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
/**
 * @deprecated In the upcoming 2.0 release, we will remove support for runtime modules as argument. Instead, use the inject API from the function arguments.
 */
declare function WithUpstream<R, CProps, // component props static
TProps extends ExtensibleProps<CProps>, // local provider props (inferred)
PProps, // providerProps cumulative
PErrors>(module: RuntimeContext<R, never, PropService>, fn: ProviderFn<R, PProps & Partial<CProps>, TProps>, ..._deprecated: never[]): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => [
    IsUnknown<PErrors>,
    IsLiteral<keyof TProps> & IsEmptyObject<TProps>
] extends [true, true] ? React.FC<Simplify<ResultProps<CProps, TProps>>> & StaticProperties$3<React.FC<Simplify<CProps>>, Readonly<Merge$1<PProps, IsLiteral<keyof TProps> extends true ? TProps : {}>>, PErrors> : // constraint widening on error with overlap
React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
/**
 * @deprecated In the upcoming 2.0 release, we will remove support for runtime modules as argument. Instead, use the inject API from the function arguments.
 */
declare function WithUpstream<R, CProps, TProps extends Partial<IdProp & Record<string, unknown>> | void, PProps, PErrors>(module: RuntimeContext<R, never, PropService>, fnVoid: ProviderFn<R, PProps & Partial<CProps>, TProps & (TProps extends Record<string, unknown> ? Partial<IdProp & CProps> : void)>, ..._deprecated: never[]): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => IsUnknown<PErrors> extends true ? React.FC<Simplify<Partial<IdProp> & CProps>> & StaticProperties$3<React.FC<Simplify<CProps>>, PProps, PErrors> : React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
type StaticProperties$3<C, TProps, TErrors = unknown> = TErrors extends [string] ? Merge$1<ExtractMeta<C>, {
    [ERROR_PROP]: TErrors;
}> : Merge$1<ExtractMeta<C>, {
    [PROPS_PROP]: IsNever<TProps> extends false ? Merge$1<ExtractStaticProps<C>, TProps> : ExtractStaticProps<C>;
}>;

declare function WithProps<CProps, TProps extends ExtensibleProps<CProps>, PProps, PErrors>(fn: PropsFn<PProps & Partial<CProps>, TProps>): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | React.FC<CProps>) => IsUnknown<PErrors> extends true ? React.FC<Simplify<ResultProps<CProps, TProps>>> & StaticProperties$2<React.FC<Simplify<CProps>>, Readonly<Merge$1<PProps, IsLiteral<keyof TProps> extends true ? TProps : {}>>, PErrors> : // constraint widening on error with overlap
React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
type StaticProperties$2<C, TProps, TErrors = unknown> = TErrors extends [string] ? Merge$1<ExtractMeta<C>, {
    [ERROR_PROP]: TErrors;
}> : Merge$1<ExtractMeta<C>, {
    [PROPS_PROP]: IsNever<TProps> extends false ? Merge$1<ExtractStaticProps<C>, TProps> : ExtractStaticProps<C>;
}>;

declare function WithMock<C extends React.FC<any>, C1 extends React.FC<any>, TProps extends Partial<Extensible<React.ComponentProps<C>>>, TResult = Partial<IdProp> & React.ComponentProps<C>>(target: C1, props: React.ComponentProps<C1>): (Component: C) => React.FC<Simplify<TResult>> & StaticProperties$1<C, TProps>;
declare function WithMock<C extends React.FC<any>, TProps extends Partial<Extensible<React.ComponentProps<C>>>, TResult = Partial<IdProp> & React.ComponentProps<C>, R = unknown>(Context: RuntimeContext<R>, layer: Layer.Layer<R>): (Component: C) => React.FC<Simplify<TResult>> & StaticProperties$1<C, TProps>;
type StaticProperties$1<C, TProps> = Merge$1<ExtractMeta<C>, {
    [PROPS_PROP]: Merge$1<ExtractStaticProps<C>, TProps>;
    [ERROR_PROP]: ExtractStaticError<C>;
}>;

type PropsOrEmpty<P> = keyof P extends never ? Record<never, never> : P;
declare function WithProviderScope<C1 extends React.FC<any>, CProps, PProps, PErrors>(RootComponent: C1, rootProps?: PropsOrEmpty<React.ComponentProps<C1>>): (Component: ({
    [PROPS_PROP]: PProps;
} & React.FC<CProps>) | ({
    [ERROR_PROP]: PErrors;
} & React.FC<CProps>) | React.FC<CProps>) => IsUnknown<PErrors> extends true ? React.FC<Simplify<Partial<IdProp> & CProps>> & StaticProperties<React.FC<Simplify<CProps>>, PProps, PErrors> : React.FC<Simplify<CProps>> & {
    _error: ['Type mismatch on provided props'];
};
type StaticProperties<C, TProps, TErrors = unknown> = TErrors extends [string] ? Merge$1<ExtractMeta<C>, {
    [ERROR_PROP]: TErrors;
}> : Merge$1<ExtractMeta<C>, {
    [PROPS_PROP]: IsNever<TProps> extends false ? Merge$1<ExtractStaticProps<C>, TProps> : ExtractStaticProps<C>;
}>;

declare function CreateSystem<R, C extends React.FC<any>>(declarationId: DeclarationId, Component: C, target: React.FC<any>, name: string, provider?: ProviderEntry<R, C>, dryRunIdArg?: ScopeId): React.FC<Partial<IdProp & React.ComponentProps<C>>>;
declare const PropagateSystem: <C extends React.FC<any>>(declarationId: DeclarationId, dryRunId: ScopeId | null, Component: React.FC<any>, Wrapper: C, target: React.FC<any>, localProviders: ProviderEntry<any, any>[], targetName: string) => React.NamedExoticComponent<React.ComponentProps<C>>;

export { COMPONENT_PROP, CreateSystem, DRYRUN_ID_PROP, ERROR_PROP, ID_PROP, PROPS_PROP, PROVIDERS_PROP, PropagateSystem, UPSTREAM_PROP, copyStaticProperties, createChildrenSketch, createElement, createGetPropTag, createKey, createProxy, createProxyStreamMap, createRuntimeContext, enhanceRuntime, extractMeta, getDisplayName, getPropTag, getProviders, isFunctionalComponent, isReactContext, isReactContext2, isReactNode, isRuntimeConfig, isRuntimeContext, isRuntimeInstance, isStream, isStreamEffect, link, WithMock as withMock, WithProps as withProps, WithProviderScope as withProviderScope, WithRuntime as withRuntime, WithUpstream as withUpstream };
export type { CollectProviders, ComponentId, ComponentMeta, DeclId, DeclarationId, Down, Expect, ExpectFalse, Extensible, ExtensibleProps, ExtractMeta, ExtractProps, ExtractStaticComponent, ExtractStaticError, ExtractStaticProps, ExtractStaticProviders, ExtractStaticUpstream, FilterReference, IdProp, InferContext, InferSuccess, InstId, InstanceId, IsEffect, IsPrimitiveString, IsStream, IsTag, KeepUpstream, NestServices, PropKey, PropService, PropsFn, ProviderApi, ProviderEntry, ProviderEntryType, ProviderFn, ProviderId, RegisterId, ResolvedProviderEntry, ResultProps, RuntimeApi, RuntimeApiFactory, RuntimeConfig, RuntimeContext, RuntimeId, RuntimeInstance, RuntimeKey, RuntimePayload, SafeKeys, ScopeId, Subscribable, SubscribeFn, TraverseDeps, UnsubscribeFn, UnwrapRuntime, Up, UpstreamProviderApi, UpstreamProviderFn };
