/**
 * Client-side Router service
 *
 * Provides intra-app view toggling and cross-app HTML-fetch-based
 * content swapping so navigation between apps doesn't trigger full
 * page reloads.
 */
export type RouteParams = Record<string, string>;
export interface RouteMatch {
    pattern: string;
    params: RouteParams;
    path: string;
    appPrefix: string;
    view: string;
    navSection: string | undefined;
}
export interface RouteDefinition {
    /** e.g. '/forge/workflows/:id' */
    pattern: string;
    /** e.g. 'workflow-detail' */
    view: string;
    /** e.g. 'workflows' — used to highlight the correct sidebar item */
    navSection?: string;
}
export interface AppRouteConfig {
    /** e.g. '/forge' */
    prefix: string;
    /** e.g. 'data-forge-view' */
    viewAttribute: string;
    /** e.g. 'data-forge-nav' */
    navAttribute: string;
    activeViewClass?: string;
    activeNavClass?: string;
    routes: RouteDefinition[];
    defaultView?: string;
}
export interface AppModule {
    init: (params?: RouteParams) => void | Promise<void>;
    destroy?: () => void | Promise<void>;
}
export interface RouterConfig {
    /** Selector for the main content element. Default: '#app-content' */
    contentSelector?: string;
    /** Whether to intercept same-origin link clicks. Default: true */
    interceptLinks?: boolean;
    /** Called when a fetch returns 401/403 */
    onAuthError?: (status: number) => void;
    /** CSS class added during content swap transitions */
    transitionClass?: string;
    /**
     * Sanitize fetched same-origin HTML before swapping it into the DOM.
     * Default false preserves trusted server-rendered HTML behavior.
     */
    sanitizeFetchedHtml?: boolean;
    /** Called after cross-app swap to re-init shared components (sidebar, app-switcher) */
    onAfterSwap?: () => void | Promise<void>;
}
export interface NavigationEvent {
    from: RouteMatch | null;
    to: RouteMatch | null;
    path: string;
}
export declare class Router {
    private apps;
    private compiledRoutes;
    private moduleLoaders;
    private loadedModules;
    private currentRoute;
    private currentAppPrefix;
    private config;
    private listeners;
    private clickHandler;
    private popstateHandler;
    private started;
    constructor(config?: RouterConfig);
    registerApp(appConfig: AppRouteConfig): void;
    registerModule(prefix: string, loader: () => Promise<AppModule>): void;
    matchRoute(path: string): RouteMatch | null;
    getCurrentRoute(): RouteMatch | null;
    navigate(path: string, opts?: {
        pushState?: boolean;
        replace?: boolean;
    }): Promise<void>;
    private navigateIntraApp;
    private navigateCrossApp;
    private loadAndInitModule;
    showAppView(appConfig: AppRouteConfig, view: string, navSection?: string): void;
    start(): void;
    destroy(): void;
    on(event: 'navigate', handler: (e: NavigationEvent) => void): () => void;
    private emit;
    private pushOrReplace;
    private setCurrentRoute;
    private isSameOriginPath;
    private prepareFetchedHtml;
    private prepareFetchedElement;
    clearModuleCache(): void;
}
export declare function createRouter(config?: RouterConfig): Router;
//# sourceMappingURL=router.d.ts.map