import type { AppRoutes, Params, Path, RouteMatch, RoutesShape } from "./types"; /** * Converts a URL pattern with `:param` segments into a regex with named capture groups. * * @example * ```ts * patternToRegex("/users/:id"); * // /^\/users\/(?[^/]+)$/ * ``` */ export declare function patternToRegex(pattern: string): RegExp; /** * Matches a pathname against a URL pattern. Returns extracted params or `null`. * The wildcard `"*"` matches any pathname and returns an empty params object. * * @example * ```ts * matchPath("/users/42", "/users/:id"); * // { id: "42" } * ``` */ export declare function matchPath(pathname: string, pattern: string): Params | null; /** * Finds the first route that matches the given URL and returns the match * with extracted params. Returns `null` if no route matches. * * When {@link base} is provided the prefix is stripped from the pathname * before matching so route patterns stay root-relative (e.g. `"/"`). */ export declare function resolveMatch(url: URL, routes: Path[], base?: string): RouteMatch | null; /** * Strips a base path prefix from a pathname. * Returns `"/"` when the pathname equals the base exactly. */ export declare function stripBase(pathname: string, base: string): string; /** * Prepends a base path to a route-relative pathname. * Returns the pathname unchanged when no base is set. */ export declare function prefixBase(pathname: string, base: string): string; /** * Substitutes `:param` segments in a URL pattern with the provided values. * Throws if a required param is missing. * * @example * ```ts * buildUrl("/users/:id", { id: 42 }); * // "/users/42" * ``` */ export declare function buildUrl(pattern: string, params: Record): string; /** * Transforms a raw url-pattern map (the value passed to `Router({ urls })`) * into the built {@link AppRoutes} form — every entry becomes a callable * builder. Each builder retains its source pattern via `.pattern`. * * Pass `base` to bake the Router's base prefix into every builder result * so call sites get a ready-to-use href in one call. * * @example * ```ts * const url = makeUrls({ home: "/", user: "/users/:id" }); * url.home(); // "/" * url.user({ id: 42 }); // "/users/42" * url.user.pattern; // "/users/:id" * * const based = makeUrls({ home: "/" }, "/app"); * based.home(); // "/app/" * ``` */ export declare function makeUrls(urls: U, base?: string): AppRoutes;