import { R as RiverbankClient, S as SiteResponse } from './types-CAnC529E.js';
import * as react_jsx_runtime from 'react/jsx-runtime';
import * as React$1 from 'react';
import React__default, { ComponentType } from 'react';
import { P as PageOutline, S as SdkCustomBlock } from './schema-Bpy9N5ZI.js';
import { z } from 'zod';
import { T as Theme } from './types-5XdVD2J1.js';
import { R as ResolvedBlockData, D as DataLoaderOverrides } from './types-DSFvXKhO.js';

declare const colorTokens: readonly ["background/base", "background/elevated", "surface/base", "surface/subtle", "surface/inverted", "content/primary", "content/secondary", "accent/primary", "accent/secondary", "border/base"];
declare const typographyTokens: readonly ["display/hero", "display/section", "heading/large", "heading/medium", "heading/small", "body/normal", "body/small", "caption"];
declare const spacingTokens: readonly ["none", "3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
declare const radiusTokens: readonly ["none", "xs", "sm", "md", "lg", "pill", "full"];
declare const shadowTokens: readonly ["none", "soft", "medium", "strong"];
type ThemeTokens = {
    color: Record<(typeof colorTokens)[number], string>;
    typography: Record<(typeof typographyTokens)[number], {
        fontSize: string;
        lineHeight: string;
        fontWeight?: string;
    }>;
    spacing: Record<(typeof spacingTokens)[number], string>;
    radius: Record<(typeof radiusTokens)[number], string>;
    shadow: Record<(typeof shadowTokens)[number], string>;
    palette: Record<string, string>;
};

type RouteMapEntry = string | {
    path?: string | null;
    href?: string | null;
    url?: string | null;
    draftPath?: string | null;
    [key: string]: unknown;
};
type RouteMap = Record<string, RouteMapEntry>;
type TransformContext = {
    theme: ThemeTokens;
    locale?: string;
    routes?: RouteMap;
};
type TransformHandler<TOptions = unknown> = (value: unknown, options: TOptions, context: TransformContext) => unknown;
type TransformDefinition<TOptions = unknown> = {
    id: string;
    summary?: string;
    kind: "formatter" | "collection" | "string" | "html";
    schema?: z.ZodType<TOptions>;
    run: TransformHandler<TOptions>;
};
type TransformRegistry = Map<string, TransformDefinition<any>>;

type ViewModel = Record<string, unknown>;
type ComponentRegistry = Record<string, React__default.ComponentType<any>>;
type ResolverContext = {
    viewModel: ViewModel;
    registry: ComponentRegistry;
    transforms?: TransformRegistry;
    theme?: ThemeTokens;
    routes?: RouteMap;
    pathBase?: string;
    blockId?: string | null;
    blockKind?: string;
    blockContent?: unknown;
    blockBindings?: Record<string, unknown>;
    fragmentRegistry?: Record<string, any>;
};

type SystemBlockComponentProps<TContent = Record<string, unknown>> = {
    content: TContent;
    theme?: ThemeTokens;
    themeConfig?: Theme;
    registry?: ResolverContext["registry"];
    transforms?: TransformRegistry;
    viewModelOverrides?: Record<string, unknown>;
    data?: Record<string, unknown>;
    pathBase?: string;
    blockId?: string | null;
    blockKind?: string;
    blockBindings?: Record<string, unknown>;
    fragmentRegistry?: ResolverContext["fragmentRegistry"];
};
type SystemBlockComponent<TContent = Record<string, unknown>> = ComponentType<SystemBlockComponentProps<TContent>>;

/**
 * Occurrence context for event pages.
 * Passed through to blocks that need occurrence information (e.g., event-registration).
 */
type OccurrenceContextData = {
    id: string;
    seriesId: string;
    startsAt: string;
    endsAt: string;
    capacityOverride?: number | null;
    overrides?: Record<string, unknown> | null;
};
type PageRendererDataContext = {
    siteId?: string;
    pageId?: string;
    resolvedData?: Record<string, Record<string, unknown>>;
    previewStage?: 'published' | 'preview';
    routes?: RouteMap;
    occurrenceContext?: OccurrenceContextData | null;
    contentEntry?: Record<string, unknown> | null;
};
/**
 * Block override component type.
 * Override components receive the same props as default block components.
 *
 * Uses `any` for content type to allow typed components (e.g., SystemBlockComponentProps<HeroContent>)
 * to be used as overrides without type errors. The actual content type is validated at runtime
 * based on the block kind.
 */
type BlockOverrideComponent = SystemBlockComponent<any>;
/**
 * Map of block kinds to custom override components.
 * Keys can be either:
 * - Full block kind: "block.hero"
 * - Short form: "hero" (will match "block.hero")
 *
 * @example
 * ```tsx
 * const overrides: BlockOverrides = {
 *   'hero': CustomHero,        // CustomHero: SystemBlockComponentProps<HeroContent>
 *   'bodyText': CustomBodyText, // CustomBodyText: SystemBlockComponentProps<BodyTextContent>
 * };
 * ```
 */
type BlockOverrides = Record<string, BlockOverrideComponent>;
/**
 * SDK site configuration for custom block rendering.
 * Minimal type containing only what PageRenderer needs.
 */
type SdkConfigForRenderer = {
    customBlocks?: SdkCustomBlock[];
};
interface PageRendererProps {
    theme: Theme;
    page: PageOutline | null;
    usePlaceholders?: boolean;
    dataContext?: PageRendererDataContext;
    routeMap?: RouteMap;
    wrapBlock?: (blockId: string, rendered: React$1.ReactNode) => React$1.ReactNode;
    registry?: ResolverContext["registry"];
    themeTokens?: ThemeTokens;
    blockOverrides?: BlockOverrides;
    sdkConfig?: SdkConfigForRenderer | null;
}
declare function PageRenderer({ theme, page, usePlaceholders, dataContext, wrapBlock, registry, themeTokens: providedThemeTokens, routeMap, blockOverrides, sdkConfig, }: PageRendererProps): react_jsx_runtime.JSX.Element;

type PageProps = {
    page: PageOutline;
    theme: Theme;
    siteId: string;
    themeTokens?: ThemeTokens;
    resolvedData?: ResolvedBlockData;
    routeMap?: RouteMap;
    /**
     * SDK site configuration containing theme palette overrides.
     * When provided, the SDK palette tokens are merged into the theme tokens,
     * allowing blocks to use SDK-defined color tokens for section backgrounds.
     */
    sdkConfig?: RuntimeSdkConfig | null;
    /**
     * Additional context data for content entry pages.
     * Used to pass occurrence context and content entry data to blocks.
     */
    dataContext?: {
        /** Occurrence context for event pages (from URL like /events/yoga/2025-01-15) */
        occurrenceContext?: OccurrenceContextData | null;
        /** Content entry data for template pages */
        contentEntry?: Record<string, unknown> | null;
    };
    wrapBlock?: (blockId: string, rendered: React.ReactNode) => React.ReactNode;
    registry?: Parameters<typeof PageRenderer>[0]['registry'];
    usePlaceholders?: boolean;
    /**
     * Custom components to override default block rendering.
     * Keys can be full block kind ("block.hero") or short form ("hero").
     *
     * This is SSR-safe - no context or hooks required.
     *
     * @example
     * ```tsx
     * <Page
     *   {...pageData}
     *   blockOverrides={{
     *     'hero': MyCustomHero,
     *     'block.testimonials': MyCustomTestimonials,
     *   }}
     * />
     * ```
     */
    blockOverrides?: BlockOverrides;
};
/**
 * Pure renderer for Riverbank CMS pages.
 *
 * This component expects all data to be provided via props.
 * For data fetching, use:
 * - Server-side: `await loadPage({ client, siteId, path })`
 * - Client-side: `usePage({ client, siteId, path })`
 *
 * @example Server-side (Next.js App Router)
 * ```tsx
 * import { createRiverbankClient } from '@riverbankcms/sdk';
 * import { loadPage, Page } from '@riverbankcms/sdk/rendering';
 *
 * const client = createRiverbankClient({ apiKey, baseUrl });
 *
 * export default async function PageRoute({ params }) {
 *   const pageData = await loadPage({
 *     client,
 *     siteId: 'site-id',
 *     path: `/${params.slug}`,
 *   });
 *
 *   return <Page {...pageData} />;
 * }
 * ```
 *
 * @example Client-side
 * ```tsx
 * import { createRiverbankClient } from '@riverbankcms/sdk';
 * import { usePage, Page } from '@riverbankcms/sdk/rendering';
 *
 * const client = createRiverbankClient({ apiKey, baseUrl });
 *
 * function MyPage({ path }) {
 *   const pageData = usePage({ client, siteId: 'site-id', path });
 *
 *   if (pageData.loading) return <LoadingState />;
 *   if (pageData.error) return <ErrorState error={pageData.error} />;
 *   if (!pageData.page) return <NotFound />;
 *
 *   return <Page {...pageData} />;
 * }
 * ```
 */
declare function Page({ page, theme, themeTokens: providedTokens, siteId, resolvedData, routeMap, wrapBlock, registry, usePlaceholders, blockOverrides, sdkConfig, dataContext, }: PageProps): react_jsx_runtime.JSX.Element;

/**
 * Server-side helper to fetch all data needed for <Page> component.
 *
 * Use this in server components, getServerSideProps, or API routes.
 */

/**
 * SDK config from API response (without siteId which is stripped at storage).
 * This is the runtime representation - for defining configs, use RiverbankSiteConfig.
 */
type RuntimeSdkConfig = NonNullable<SiteResponse['sdkConfig']>;
type LoadPageParams = {
    client: RiverbankClient;
    siteId: string;
    path: string;
    pageId?: string;
    /**
     * If true, fetches draft/unpublished content instead of published content.
     * This affects both the page structure and block data loaders.
     * Requires API key with site access.
     *
     * @default false
     */
    preview?: boolean;
    /**
     * Code-based data loaders for custom blocks.
     *
     * Use this to fetch data from external APIs (not just whitelisted CMS endpoints).
     * Keys are block kinds (e.g., 'custom.featured-products').
     *
     * Config-based loaders (defined in riverbank.config.ts) run first.
     * Code loaders run second and take precedence on key conflicts.
     *
     * @example
     * ```typescript
     * const pageData = await loadPage({
     *   client,
     *   siteId: 'site-123',
     *   path: '/',
     *   dataLoaderOverrides: {
     *     'custom.featured-products': {
     *       products: async (ctx) => {
     *         const res = await fetch(`https://api.shop.com/products?category=${ctx.content.categoryId}`);
     *         return res.json();
     *       },
     *     },
     *   },
     * });
     * ```
     */
    dataLoaderOverrides?: DataLoaderOverrides;
};
type LoadPageResult = Omit<PageProps, 'registry' | 'wrapBlock' | 'usePlaceholders' | 'blockOverrides'> & {
    /**
     * SDK site configuration, if available.
     * Contains SDK-defined theme palette, section backgrounds, and style options.
     */
    sdkConfig: RuntimeSdkConfig | null;
};
/**
 * Server-side helper to fetch all data needed for <Page> component.
 *
 * Fetches site data, page data, and prefetches block data loaders in parallel.
 *
 * @example Next.js App Router (published content)
 * ```tsx
 * import { createRiverbankClient } from '@riverbankcms/sdk';
 * import { loadPage, Page } from '@riverbankcms/sdk/rendering';
 *
 * const client = createRiverbankClient({
 *   apiKey: process.env.RIVERBANK_API_KEY!,
 *   baseUrl: process.env.NEXT_PUBLIC_DASHBOARD_URL + '/api',
 * });
 *
 * export default async function PageRoute({ params }) {
 *   const pageData = await loadPage({
 *     client,
 *     siteId: 'site-123',
 *     path: `/${params.slug || ''}`,
 *   });
 *
 *   return <Page {...pageData} />;
 * }
 * ```
 *
 * @example Next.js App Router (preview/draft content)
 * ```tsx
 * export default async function PreviewRoute({ params, searchParams }) {
 *   const pageData = await loadPage({
 *     client,
 *     siteId: searchParams.siteId,
 *     path: `/${params.slug || ''}`,
 *     preview: true, // Fetch draft content
 *   });
 *
 *   return <Page {...pageData} />;
 * }
 * ```
 *
 * @example Next.js Pages Router (getServerSideProps)
 * ```tsx
 * export async function getServerSideProps({ params }) {
 *   const pageData = await loadPage({
 *     client,
 *     siteId: 'site-123',
 *     path: `/${params.slug || ''}`,
 *   });
 *
 *   return { props: pageData };
 * }
 *
 * export default function PageRoute(props) {
 *   return <Page {...props} />;
 * }
 * ```
 */
declare function loadPage(params: LoadPageParams): Promise<LoadPageResult>;

export { type BlockOverrides as B, type LoadPageParams as L, type PageProps as P, type RuntimeSdkConfig as R, type SystemBlockComponentProps as S, type ThemeTokens as T, type LoadPageResult as a, Page as b, PageRenderer as c, type RouteMap as d, type BlockOverrideComponent as e, loadPage as l };
