import * as react_jsx_runtime from 'react/jsx-runtime';
import react__default, { ErrorInfo } from 'react';
import { FallbackProps } from 'react-error-boundary';
export { FallbackProps } from 'react-error-boundary';
import { createRouter } from '@btst/yar';

/**
 * Route type with optional components
 */
type RouteWithComponents = {
    PageComponent?: react__default.ComponentType;
    ErrorComponent?: react__default.ComponentType<FallbackProps>;
    LoadingComponent?: react__default.ComponentType;
} | null | undefined;
/**
 * Composes the route content with Suspense and Error Boundary
 * Resolves the route on the client-side where component references are available
 *
 * This is marked "use client" so it can access component references safely
 */
declare function RouteRenderer({ router, path, NotFoundComponent, onNotFound, onError, props, }: {
    router: ReturnType<typeof createRouter>;
    path: string;
    NotFoundComponent?: react__default.ComponentType<{
        message: string;
    }>;
    onNotFound?: () => never;
    onError: (error: Error, info: ErrorInfo) => void;
    props?: any;
}): react_jsx_runtime.JSX.Element;
/**
 * Renders a route with Suspense and ErrorBoundary wrappers.
 * Handles loading states, error boundaries, and not-found scenarios for a single route.
 *
 * @param path - The current route path
 * @param PageComponent - The page component to render
 * @param ErrorComponent - Optional error fallback component
 * @param LoadingComponent - Component to show during suspense
 * @param onNotFound - Optional callback when route is not found
 * @param NotFoundComponent - Optional component to show for 404s
 * @param props - Additional props to pass to the page component
 * @param onError - Error handler callback for the error boundary
 */
declare function ComposedRoute({ path, PageComponent, ErrorComponent, LoadingComponent, onNotFound, NotFoundComponent, props, onError, }: {
    path: string;
    PageComponent: react__default.ComponentType<any>;
    ErrorComponent?: react__default.ComponentType<FallbackProps>;
    LoadingComponent: react__default.ComponentType;
    onNotFound?: () => never;
    NotFoundComponent?: react__default.ComponentType<{
        message: string;
    }>;
    props?: any;
    onError: (error: Error, info: ErrorInfo) => void;
}): react_jsx_runtime.JSX.Element | undefined;

/**
 * Error boundary wrapper component for catching and handling React errors.
 * Wraps react-error-boundary with a simplified API.
 *
 * @param children - Child components to wrap with error boundary
 * @param FallbackComponent - Component to render when an error occurs
 * @param resetKeys - Array of values that will reset the error boundary when changed
 * @param onError - Callback invoked when an error is caught
 */
declare function ErrorBoundary({ children, FallbackComponent, resetKeys, onError, }: {
    children: React.ReactNode;
    FallbackComponent: React.ComponentType<FallbackProps>;
    resetKeys?: Array<string | number | boolean | null | undefined>;
    onError: (error: Error, info: ErrorInfo) => void;
}): react_jsx_runtime.JSX.Element;

export { ComposedRoute, ErrorBoundary, RouteRenderer };
export type { RouteWithComponents };
