/**
 * Managed Router — orchestrates module mount/unmount on route changes.
 *
 * When the router navigates to a route:
 * 1. Unmounts the previous module (destroy instance, unregister from GlobalContext)
 * 2. Mounts the new module (create instance with namespaced state, register)
 *
 * Module names are used as state prefixes (lowercased) for isolation.
 */
import type { IEngine, HypenModuleDefinition } from "./app.js";
import { HypenModuleInstance, HypenApp } from "./app.js";
import type { HypenRouter } from "./router.js";
import type { HypenGlobalContext } from "./context.js";
export interface RouteDefinition {
    /** Route path pattern (e.g., "/", "/profile/:id") */
    path: string;
    /** Component name — used to look up in app registry */
    component: string;
    /** Inline module definition (alternative to registry lookup) */
    module?: HypenModuleDefinition;
}
export declare class ManagedRouter {
    private router;
    private engine;
    private registry;
    private globalContext;
    private routes;
    private activeModule;
    private activeRoute;
    private unsubscribe;
    /** Cached instances for modules with persist=true */
    private persistedModules;
    constructor(router: HypenRouter, engine: IEngine, registry: HypenApp, globalContext: HypenGlobalContext);
    /**
     * Add a route definition.
     */
    addRoute(route: RouteDefinition): this;
    /**
     * Start listening for route changes and mount the initial route.
     */
    start(): void;
    /**
     * Stop listening and unmount the active module.
     * Also destroys all persisted modules.
     */
    stop(): void;
    /**
     * Get the currently active module instance.
     */
    getActiveModule(): HypenModuleInstance | null;
    /**
     * Get the currently active route.
     */
    getActiveRoute(): RouteDefinition | null;
    private handleRouteChange;
    private matchRoute;
    private mount;
    private unmountActive;
}
