import { R as RiverbankClient, e as ResolveEventOccurrenceResponse } from './types-BvcJU7zk.js';
import { a as LoadPageResult } from './loadPage-DP3nrHBi.js';
import { R as RiverbankSiteConfig } from './types-DLBhEPSt.js';
import './schema-Z6-afHJG.js';
import './types-CVykEqXN.js';
import '@riverbankcms/ai';
import 'zod';
import './link-DjxLyC82.js';
import '@riverbankcms/media-storage-supabase';
import '@riverbankcms/db';
import 'react/jsx-runtime';
import 'react';
import './core-DsNWrl3o.js';
import './types-DuQCNVV0.js';
import './blockKinds-B6MWzNWp.js';

/**
 * Route resolution helper for dynamic page routing
 *
 * Resolves URL paths to pages, entries, redirects, or 404s.
 */

type RouteResolution = {
    type: 'page';
    pageData: LoadPageResult;
} | {
    type: 'redirect';
    destination: string;
    permanent: boolean;
} | {
    type: 'not-found';
};
type ResolveRouteParams = {
    /**
     * Builder client instance
     */
    client: RiverbankClient;
    /**
     * Site ID
     */
    siteId: string;
    /**
     * URL path to resolve (e.g., '/about', '/blog/post-1')
     */
    path: string;
    /**
     * If true, fetches draft/unpublished content instead of published content.
     * @default false
     */
    preview?: boolean;
};
/**
 * Resolve a URL path to page data, redirect, or 404
 *
 * This helper attempts to fetch the page at the given path. If the page
 * is not found, it checks for configured redirects before returning 404.
 *
 * Returns a discriminated union indicating:
 * - `page`: Page was found, includes full page data
 * - `redirect`: Path has a redirect rule configured
 * - `not-found`: No page or redirect exists for this path
 *
 * @example
 * ```tsx
 * import { resolveRoute } from '@riverbankcms/sdk/routing';
 * import { notFound, redirect } from 'next/navigation';
 *
 * export default async function DynamicPage({ params }) {
 *   const path = `/${params.slug?.join('/') || ''}`;
 *   const resolution = await resolveRoute({
 *     client,
 *     siteId: 'your-site-id',
 *     path,
 *   });
 *
 *   if (resolution.type === 'redirect') {
 *     redirect(resolution.destination);
 *   }
 *
 *   if (resolution.type === 'not-found') {
 *     notFound();
 *   }
 *
 *   // resolution.type === 'page'
 *   return <Page {...resolution.pageData} />;
 * }
 * ```
 */
declare function resolveRoute(params: ResolveRouteParams): Promise<RouteResolution>;
/**
 * Batch resolve multiple routes in parallel
 *
 * Useful for pre-fetching multiple routes or validating a sitemap.
 *
 * @example
 * ```tsx
 * const resolutions = await resolveRoutes({
 *   client,
 *   siteId: 'your-site-id',
 *   paths: ['/', '/about', '/blog', '/contact'],
 * });
 *
 * resolutions.forEach(({ path, resolution }) => {
 *   if (resolution.type === 'page') {
 *     console.log(`${path} → Page: ${resolution.pageData.page.name}`);
 *   } else if (resolution.type === 'redirect') {
 *     console.log(`${path} → Redirect to ${resolution.destination}`);
 *   } else {
 *     console.log(`${path} → Not found`);
 *   }
 * });
 * ```
 */
declare function resolveRoutes(params: {
    client: RiverbankClient;
    siteId: string;
    paths: string[];
    preview?: boolean;
}): Promise<Array<{
    path: string;
    resolution: RouteResolution;
}>>;

/**
 * Content route matching utilities.
 *
 * Derive route matching from SDK config to determine whether a URL path
 * is a CMS page or a content entry, without duplicating route patterns.
 */

/**
 * Extract the first path segment from each routable content type's routePattern.
 *
 * Useful for simple prefix-based routing decisions. For more precise matching
 * that handles nested patterns, use `isContentEntryPath` instead.
 *
 * @param config - The SDK config object from defineConfig()
 * @returns Array of first path segments from content type routePatterns
 *
 * @example
 * ```typescript
 * import { getContentEntryPrefixes } from '@riverbankcms/sdk/routing';
 * import config from '../riverbank.config';
 *
 * // Config with routePatterns: '/blog/{slug}', '/work/projects/{slug}'
 * const prefixes = getContentEntryPrefixes(config);
 * // Returns ['blog', 'work']
 * ```
 */
declare function getContentEntryPrefixes(config: RiverbankSiteConfig): string[];
/**
 * Result of checking if a path matches a content entry route.
 */
type ContentEntryMatch = {
    /** Whether the path matches a content entry route pattern */
    isEntry: boolean;
    /** The content type key if matched (e.g., 'blog-post') */
    contentType?: string;
    /** The slug extracted from the path if matched */
    slug?: string;
};
/**
 * Check if a URL path matches any content entry route pattern.
 *
 * Supports nested patterns like '/work/projects/{slug}'. Returns the matched
 * content type key and extracted slug, useful for routing decisions.
 *
 * **Note:** Content types are checked in array order. If multiple patterns
 * could match a path, the first matching content type wins. Order more specific
 * patterns before generic ones in your config.
 *
 * @param config - The SDK config object from defineConfig()
 * @param path - URL path as string ('/blog/my-post') or segments ['blog', 'my-post']
 * @returns Match result with content type and slug if matched
 *
 * @example
 * ```typescript
 * import { isContentEntryPath } from '@riverbankcms/sdk/routing';
 * import config from '../riverbank.config';
 *
 * // Simple pattern: '/blog/{slug}'
 * isContentEntryPath(config, '/blog/my-post');
 * // Returns { isEntry: true, contentType: 'blog-post', slug: 'my-post' }
 *
 * // Nested pattern: '/work/projects/{slug}'
 * isContentEntryPath(config, '/work/projects/website-redesign');
 * // Returns { isEntry: true, contentType: 'project', slug: 'website-redesign' }
 *
 * // Non-matching path
 * isContentEntryPath(config, '/about');
 * // Returns { isEntry: false }
 * ```
 */
declare function isContentEntryPath(config: RiverbankSiteConfig, path: string | string[]): ContentEntryMatch;

/**
 * Event occurrence resolution for dynamic URLs
 *
 * Resolves URL segments like "2025-01-15" or "abc123-uuid" to event occurrence data.
 */

/**
 * Data for a resolved event occurrence
 */
type OccurrenceData = NonNullable<ResolveEventOccurrenceResponse['occurrence']>;
/**
 * Result of occurrence resolution
 */
type OccurrenceResolution = {
    found: true;
    occurrence: OccurrenceData;
} | {
    found: false;
    occurrence: null;
};
/**
 * Parameters for resolving an event occurrence
 */
type ResolveOccurrenceParams = {
    /**
     * SDK client instance
     */
    client: RiverbankClient;
    /**
     * Site ID
     */
    siteId: string;
    /**
     * Parent content entry ID (the event entry)
     */
    entryId: string;
    /**
     * URL segment to resolve - either a date (YYYY-MM-DD) or UUID
     */
    segment: string;
};
/**
 * Check if a string is a valid ISO date (YYYY-MM-DD)
 */
declare function isISODateString(str: string): boolean;
/**
 * Check if a string is a valid UUID
 */
declare function isUUID(str: string): boolean;
/**
 * Validate URL segment format before making API call
 */
declare function isValidSegment(segment: string): boolean;
/**
 * Resolve an event occurrence from a URL segment
 *
 * Supports two segment formats:
 * - Date format: "2025-01-15" → finds occurrence starting on that date
 * - UUID format: "abc123..." → finds occurrence by ID
 *
 * @example
 * ```tsx
 * import { resolveOccurrence } from '@riverbankcms/sdk/routing';
 *
 * // In a Next.js dynamic route: /events/[slug]/[occurrence]
 * export default async function EventOccurrencePage({ params }) {
 *   const result = await resolveOccurrence({
 *     client,
 *     siteId: 'your-site-id',
 *     entryId: eventEntry.id,
 *     segment: params.occurrence, // e.g., "2025-01-15"
 *   });
 *
 *   if (!result.found) {
 *     notFound();
 *   }
 *
 *   return <EventOccurrence occurrence={result.occurrence} />;
 * }
 * ```
 */
declare function resolveOccurrence(params: ResolveOccurrenceParams): Promise<OccurrenceResolution>;

/**
 * Redirect checking for 404 handling
 *
 * Check if a path has a configured redirect rule before returning 404.
 */

/**
 * Redirect rule data
 */
type RedirectRule = {
    /**
     * Destination URL to redirect to
     */
    destination: string;
    /**
     * Whether this is a permanent redirect (301/308) or temporary (302/307)
     */
    permanent: boolean;
};
/**
 * Result of redirect checking
 */
type RedirectResult = {
    hasRedirect: true;
    redirect: RedirectRule;
} | {
    hasRedirect: false;
    redirect: null;
};
/**
 * Parameters for checking redirects
 */
type CheckRedirectParams = {
    /**
     * SDK client instance
     */
    client: RiverbankClient;
    /**
     * Site ID
     */
    siteId: string;
    /**
     * URL path to check (e.g., '/old-page')
     */
    path: string;
};
/**
 * Check if a path has a configured redirect rule
 *
 * Use this when a page is not found to check if there's a redirect
 * configured for the path before returning a 404.
 *
 * @example
 * ```tsx
 * import { checkRedirectForPath } from '@riverbankcms/sdk/routing';
 * import { notFound, redirect } from 'next/navigation';
 *
 * export default async function Page({ params }) {
 *   const page = await getPage(params.path);
 *
 *   if (!page) {
 *     // Check for redirect before 404
 *     const result = await checkRedirectForPath({
 *       client,
 *       siteId: 'your-site-id',
 *       path: params.path,
 *     });
 *
 *     if (result.hasRedirect) {
 *       redirect(result.redirect.destination);
 *     }
 *
 *     notFound();
 *   }
 *
 *   return <PageContent page={page} />;
 * }
 * ```
 */
declare function checkRedirectForPath(params: CheckRedirectParams): Promise<RedirectResult>;

export { type CheckRedirectParams, type ContentEntryMatch, type OccurrenceData, type OccurrenceResolution, type RedirectResult, type RedirectRule, type ResolveOccurrenceParams, type ResolveRouteParams, type RouteResolution, checkRedirectForPath, getContentEntryPrefixes, isContentEntryPath, isISODateString, isUUID, isValidSegment, resolveOccurrence, resolveRoute, resolveRoutes };
