import './globals-CNhVJIBu.js';
import { KubbFile } from '@kubb/core/fs';
import { Logger } from '@kubb/core/logger';
import * as react from 'react';
import { ReactNode, Key } from 'react';
export { createContext, createElement, use, useContext, useEffect, useReducer, useRef, useState } from 'react';
import * as react_jsx_runtime from 'react/jsx-runtime';
import { FileMetaBase, PluginManager, Plugin, PluginFactoryOptions, FileManager } from '@kubb/core';
import { K as KubbNode, J as JSDoc } from './types-Jc5o8Ldu.js';
export { F as FunctionParams, c as createFunctionParams } from './types-Jc5o8Ldu.js';

type RootContextProps<Meta extends Record<string, unknown> = Record<string, unknown>> = {
    /**
     * Exit (unmount) the whole Ink app.
     */
    readonly exit: (error?: Error) => void;
    readonly meta: Meta;
};

type RendererResult = {
    output: string;
    imports: Array<KubbFile.Import>;
    exports: Array<KubbFile.Export>;
    files: Array<KubbFile.File>;
};

type ReactTemplateOptions = {
    stdout?: NodeJS.WriteStream;
    stdin?: NodeJS.ReadStream;
    stderr?: NodeJS.WriteStream;
    logger?: Logger;
    /**
     * Set this to true to always see the result of the render in the console(line per render)
     */
    debug?: boolean;
};
type Context = Omit<RootContextProps, 'exit'>;
declare class ReactTemplate {
    #private;
    constructor(options: ReactTemplateOptions);
    get output(): string;
    get files(): Array<KubbFile.File>;
    resolveExitPromise: (result: RendererResult) => void;
    rejectExitPromise: (reason?: Error) => void;
    unsubscribeExit: () => void;
    onRender: () => void;
    onError(error: Error): void;
    onExit(error?: Error): void;
    render(node: ReactNode, context?: Context): RendererResult;
    renderToString(node: ReactNode, context?: Context): Promise<string>;
    unmount(error?: Error | number | null): void;
    waitUntilExit(): Promise<RendererResult>;
}

declare function createRoot(options?: ReactTemplateOptions): ReactTemplate;

type FileContextProps<TMeta extends FileMetaBase = FileMetaBase> = {
    /**
     * Name to be used to dynamicly create the baseName(based on input.path).
     * Based on UNIX basename
     * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
     */
    baseName: KubbFile.BaseName;
    /**
     * Path will be full qualified path to a specified file.
     */
    path: KubbFile.Path;
    meta?: TMeta;
};
type BasePropsWithBaseName = {
    /**
     * Name to be used to dynamicly create the baseName(based on input.path).
     * Based on UNIX basename
     * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
     */
    baseName: KubbFile.BaseName;
    /**
     * Path will be full qualified path to a specified file.
     */
    path: KubbFile.Path;
};
type BasePropsWithoutBaseName = {
    baseName?: never;
    /**
     * Path will be full qualified path to a specified file.
     */
    path?: KubbFile.Path;
};
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
type Props$5<TMeta extends FileMetaBase = FileMetaBase> = BaseProps & {
    key?: Key;
    meta?: TMeta;
    banner?: string;
    footer?: string;
    children?: KubbNode;
};
declare function File<TMeta extends FileMetaBase = FileMetaBase>({ children, ...rest }: Props$5<TMeta>): react_jsx_runtime.JSX.Element;
declare namespace File {
    var displayName: string;
    var Export: typeof FileExport;
    var Import: typeof FileImport;
    var Source: typeof FileSource;
    var Context: react.Context<FileContextProps<FileMetaBase>>;
}
type FileSourceProps = Omit<KubbFile.Source, 'value'> & {
    key?: Key;
    children?: KubbNode;
};
declare function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }: FileSourceProps): react_jsx_runtime.JSX.Element;
declare namespace FileSource {
    var displayName: string;
}
type FileExportProps = KubbFile.Export & {
    key?: Key;
};
declare function FileExport({ name, path, isTypeOnly, asAlias }: FileExportProps): react_jsx_runtime.JSX.Element;
declare namespace FileExport {
    var displayName: string;
}
type FileImportProps = KubbFile.Import & {
    key?: Key;
};
declare function FileImport({ name, root, path, isTypeOnly, isNameSpace }: FileImportProps): react_jsx_runtime.JSX.Element;
declare namespace FileImport {
    var displayName: string;
}

type Props$4 = {
    key?: Key;
    /**
     * Name of the function.
     */
    name: string;
    /**
     * Add default when export is being used
     */
    default?: boolean;
    /**
     * Parameters/options/props that need to be used.
     */
    params?: string;
    /**
     * Does this function need to be exported.
     */
    export?: boolean;
    /**
     * Does the function has async/promise behaviour.
     * This will also add `Promise<returnType>` as the returnType.
     */
    async?: boolean;
    /**
     * Generics that needs to be added for TypeScript.
     */
    generics?: string | string[];
    /**
     * ReturnType(see async for adding Promise type).
     */
    returnType?: string;
    /**
     * Options for JSdocs.
     */
    JSDoc?: JSDoc;
    children?: KubbNode;
};
declare function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }: Props$4): react_jsx_runtime.JSX.Element;
declare namespace Function {
    var displayName: string;
    var Arrow: typeof ArrowFunction;
}
type ArrowFunctionProps = Props$4 & {
    /**
     * Create Arrow function in one line
     */
    singleLine?: boolean;
};
declare function ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }: ArrowFunctionProps): react_jsx_runtime.JSX.Element;
declare namespace ArrowFunction {
    var displayName: string;
}

type Props$3 = {
    key?: Key;
    /**
     * Change the indent.
     * @default 0
     */
    indentSize?: number;
    children?: KubbNode;
};
declare function Text({ indentSize, children }: Props$3): react_jsx_runtime.JSX.Element;
declare namespace Text {
    var displayName: string;
    var Space: typeof Space;
}
type SpaceProps = {
    /**
     * Change the indent
     * @default 1
     */
    size?: number;
};
declare function Space({ size }: SpaceProps): react_jsx_runtime.JSX.Element;
declare namespace Space {
    var displayName: string;
}

type Props$2 = {
    key?: Key;
    /**
     * Name of the type, this needs to start with a capital letter.
     */
    name: string;
    /**
     * Does this type need to be exported.
     */
    export?: boolean;
    /**
     * Options for JSdocs.
     */
    JSDoc?: JSDoc;
    children?: KubbNode;
};
declare function Type({ name, export: canExport, JSDoc, children }: Props$2): react_jsx_runtime.JSX.Element;
declare namespace Type {
    var displayName: string;
}

type Props$1 = {
    key?: Key;
    /**
     * Name of the const
     */
    name: string;
    /**
     * Does this type need to be exported.
     */
    export?: boolean;
    /**
     * Type to make the const being typed
     */
    type?: string;
    /**
     * Options for JSdocs.
     */
    JSDoc?: JSDoc;
    /**
     * Use of `const` assertions
     */
    asConst?: boolean;
    children?: KubbNode;
};
declare function Const({ name, export: canExport, type, JSDoc, asConst, children }: Props$1): react_jsx_runtime.JSX.Element;
declare namespace Const {
    var displayName: string;
}

type AppContextProps = {
    /**
     * Exit (unmount)
     */
    readonly exit: (error?: Error) => void;
    readonly mode: KubbFile.Mode;
    readonly pluginManager: PluginManager;
    readonly plugin: Plugin;
};
type Props = {
    readonly mode: KubbFile.Mode;
    readonly pluginManager: PluginManager;
    readonly plugin: Plugin;
    readonly children?: KubbNode;
};
declare function App({ plugin, pluginManager, mode, children }: Props): react_jsx_runtime.JSX.Element;
declare namespace App {
    var Context: react.Context<AppContextProps | undefined>;
    var displayName: string;
}

/**
 * `useFile` will return the current file when <File/> is used.
 */
declare function useFile<TMeta extends FileMetaBase = FileMetaBase>(): FileContextProps<TMeta>;

type AppResult<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
    /**
     * Exit (unmount)
     */
    readonly exit: (error?: Error) => void;
    readonly plugin: Plugin<TOptions>;
    readonly mode: KubbFile.Mode;
    readonly pluginManager: PluginManager;
    readonly fileManager: FileManager;
    readonly getFile: PluginManager['getFile'];
};
/**
 * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
 */
declare function useApp<TOptions extends PluginFactoryOptions = PluginFactoryOptions>(): AppResult<TOptions>;

/**
 * `useLifecycle` will return some helpers to exit/restart the generation.
 */
declare function useLifecycle(): {
    exit: (error?: Error) => void;
};

export { App, Const, File, Function, Text, Type, createRoot, useApp, useFile, useLifecycle };
