import type { RedirectsConfig, RedirectConfig } from '@redocly/config'; import type { WildcardRedirectsTree } from '../../types'; /** * Finds a matching redirect configuration for a given slug. * * **IMPORTANT:** The `slug` parameter must be normalized before passing to this function. * This function does NOT perform normalization internally. * * - First checks for a direct match in the `redirects` configuration. * - If no direct match is found, searches for wildcard redirects (patterns ending with `*`). * - For wildcard matches, preserves the remaining path after the wildcard prefix if the redirect target also ends with `*`. * * @param slug - The normalized (lowercased) URL slug to find a redirect for. * @param redirects - The redirects configuration object. * @param wildcardRedirectsTree - The wildcard redirects converted to a tree structure to optimize the search. * @returns An object containing the redirect `to` URL and optional `type`, or `null` if no redirect is found. * * @example * // Direct redirect * findRedirect('/old-page', { '/old-page': { to: '/new-page', type: 301 } }, {}); * // Returns: { to: '/new-page', type: 301 } * * @example * // Wildcard redirect with path preservation * findRedirect('/docs/guide/intro', { '/docs/*': { to: '/documentation/*', type: 301 } }, { 'docs': { '*': '/docs/*' } }); * // Returns: { to: '/documentation/guide/intro', type: 301 } * * @example * // Wildcard redirect to fixed destination * findRedirect('/old/anything', { '/old/*': { to: '/new-home', type: 302 } }, { 'old': { '*': '/old/*' } }); * // Returns: { to: '/new-home', type: 302 } * * @example * // No match found * findRedirect('/some-page', {}, {}); * // Returns: null */ export declare function findRedirect(slug: string, redirects: RedirectsConfig, wildcardRedirectsTree: WildcardRedirectsTree): WithRequired | null; //# sourceMappingURL=find-redirect.d.ts.map