import { N as NavigationMenuWithItems } from './types-CVykEqXN.js';
export { L as LinkPayload, a as NavigationItemRecord } from './types-CVykEqXN.js';
import { R as RouteMap } from './core-DsNWrl3o.js';
import './schema-Z6-afHJG.js';
import '@riverbankcms/ai';
import 'zod';
import './link-DjxLyC82.js';
import '@riverbankcms/media-storage-supabase';
import '@riverbankcms/db';

/**
 * Navigation helper utilities for SDK sites.
 *
 * Provides helpers to transform CMS navigation data into render-ready structures.
 * Supports both simple NavItem arrays and full MenuViewModels for block rendering.
 *
 * @example Simple usage
 * ```ts
 * import { getPrimaryNavItems } from '@riverbankcms/sdk/navigation';
 *
 * const headerNav = getPrimaryNavItems(siteData.navigation);
 * // [{ href: '/', label: 'Home', isExternal: false }, ...]
 * ```
 *
 * @example Block rendering usage
 * ```ts
 * import { buildMenuViewModel, buildLogoViewModel } from '@riverbankcms/sdk/navigation';
 *
 * const menu = buildMenuViewModel(siteData.navigation);
 * const logo = buildLogoViewModel(siteData.layout.logo, siteData.site.title);
 *
 * renderBlock(siteHeaderManifest, layout.header, {
 *   viewModelOverrides: { menu, content: { logo } },
 * });
 * ```
 *
 * @packageDocumentation
 */

/**
 * Link value types matching @riverbankcms/blocks
 */
type InternalLinkValue = {
    kind: 'internal';
    routeId: string;
    entityId: string;
    entityType: 'page' | 'content';
    href: string;
    title: string;
    typeLabel: string;
    contentTypeKey?: string | null;
    contentTypeName?: string | null;
    updatedAt?: string | null;
};
type ExternalLinkValue = {
    kind: 'external';
    href: string;
};
type CustomLinkValue = {
    kind: 'url';
    href: string;
};
type LinkValue = InternalLinkValue | ExternalLinkValue | CustomLinkValue;
/**
 * Menu link view model for block rendering
 */
type MenuLinkViewModel = {
    id: string;
    label: string;
    link: LinkValue | null;
    target: string | null;
    rel: string | null;
    active?: boolean;
};
/**
 * CTA link view model (extends MenuLinkViewModel with variant)
 */
type MenuCtaViewModel = MenuLinkViewModel & {
    variant: string;
};
/**
 * Complete menu view model for header/footer blocks
 */
type MenuViewModel = {
    items: MenuLinkViewModel[];
    ctaItem: MenuCtaViewModel | null;
};
/**
 * Logo source data from site layout
 */
type LogoSource = {
    url: string | null;
    alt: string | null;
    assetId?: string | null;
    width?: number | null;
    height?: number | null;
    storagePath?: string | null;
    storageBucket?: string | null;
} | null;
/**
 * Logo view model for block rendering
 */
type LogoViewModel = {
    type: 'image';
    src: string;
    alt: string;
    assetId?: string;
    width?: number | null;
    height?: number | null;
    storagePath?: string;
    storageBucket?: string;
} | null;
/**
 * A simplified navigation item structure for component rendering.
 */
type NavItem = {
    /** The URL to navigate to */
    href: string;
    /** Display text for the navigation link */
    label: string;
    /** Whether link should open in new tab (external links) */
    isExternal: boolean;
};
/**
 * A navigation link item with a direct URL.
 * Use `kind` discriminator for type-safe narrowing.
 *
 * @example
 * ```ts
 * if (item.kind === 'link') {
 *   console.log(item.href);  // TypeScript knows href exists
 * }
 * ```
 */
type NavLink = {
    /** Discriminator for type narrowing */
    kind: 'link';
    /** Unique identifier from CMS */
    id: string;
    /** Display text for the navigation link */
    label: string;
    /** The URL to navigate to */
    href: string;
    /** Whether link should open in new tab (external links) */
    isExternal: boolean;
};
/**
 * A dropdown container holding child navigation items.
 * Clicking reveals children instead of navigating.
 * Max 1 level of nesting (children are always NavLink, not NavDropdown).
 */
type NavDropdown = {
    /** Discriminator for type narrowing */
    kind: 'dropdown';
    /** Unique identifier from CMS */
    id: string;
    /** Display text for the dropdown trigger */
    label: string;
    /** Child navigation links */
    children: NavLink[];
};
/**
 * Unified navigation item supporting both links and dropdowns.
 * Use `kind` property for type-safe discrimination.
 *
 * @example
 * ```ts
 * const items = getNestedPrimaryNavItems(navigation);
 * items.forEach(item => {
 *   if (item.kind === 'link') {
 *     console.log(item.href);
 *   } else {
 *     console.log(item.children.length);
 *   }
 * });
 * ```
 */
type NestedNavItem = NavLink | NavDropdown;
/**
 * Type guard to check if a navigation item is a link.
 */
declare function isNavLink(item: NestedNavItem): item is NavLink;
/**
 * Type guard to check if a navigation item is a dropdown.
 */
declare function isNavDropdown(item: NestedNavItem): item is NavDropdown;
/**
 * Simple nav link with pre-resolved href for block rendering.
 */
type SimpleNavLink = {
    id: string;
    label: string;
    href: string;
    isExternal: boolean;
};
/**
 * Simple menu view model with pre-resolved hrefs.
 * Use this instead of MenuViewModel for cleaner data flow.
 */
type SimpleMenuViewModel = {
    items: SimpleNavLink[];
    ctaItem: SimpleNavLink | null;
};
/**
 * Simple nested nav link with pre-resolved href.
 */
type SimpleNestedNavLink = {
    kind: 'link';
    id: string;
    label: string;
    href: string;
    isExternal: boolean;
};
/**
 * Simple nested dropdown with pre-resolved children.
 */
type SimpleNestedNavDropdown = {
    kind: 'dropdown';
    id: string;
    label: string;
    children: SimpleNestedNavLink[];
};
/**
 * Unified simple nested navigation item.
 */
type SimpleNestedNavItem = SimpleNestedNavLink | SimpleNestedNavDropdown;
/**
 * Simple menu view model with nested navigation support.
 */
type SimpleNestedMenuViewModel = {
    items: SimpleNestedNavItem[];
    ctaItem: SimpleNestedNavLink | null;
};
/**
 * Simple logo data for block rendering.
 */
type SimpleLogo = {
    type: 'image';
    src: string;
    alt: string;
    width?: number;
    height?: number;
} | null;
/**
 * Get the primary navigation menu object.
 * Returns menu marked as isPrimary, or first menu if none marked.
 *
 * @example
 * ```ts
 * const menu = getPrimaryNavigation(siteData.navigation);
 * console.log(menu?.title); // "Main Navigation"
 * ```
 */
declare function getPrimaryNavigation(navigation: NavigationMenuWithItems[]): NavigationMenuWithItems | null;
/**
 * Get a navigation menu by name/slug.
 *
 * @example
 * ```ts
 * const footerMenu = getNavigationBySlug(siteData.navigation, 'footer');
 * ```
 */
declare function getNavigationBySlug(navigation: NavigationMenuWithItems[], slug: string): NavigationMenuWithItems | null;
/**
 * Get nav items from the primary menu (marked isPrimary, or first menu).
 * Returns empty array if no navigation configured.
 *
 * @example
 * ```ts
 * const headerNav = getPrimaryNavItems(siteData.navigation);
 * // [{ href: '/', label: 'Home', isExternal: false }, ...]
 * ```
 */
declare function getPrimaryNavItems(navigation: NavigationMenuWithItems[]): NavItem[];
/**
 * Get nav items from a specific menu by slug.
 * Useful for footer nav, secondary nav, etc.
 * Returns empty array if menu not found.
 *
 * @example
 * ```ts
 * const footerNav = getNavItemsBySlug(siteData.navigation, 'footer');
 * ```
 */
declare function getNavItemsBySlug(navigation: NavigationMenuWithItems[], slug: string): NavItem[];
/**
 * Transform a menu into simple NavItem array.
 */
declare function transformToNavItems(menu: NavigationMenuWithItems | null): NavItem[];
/**
 * Transform a menu into nested NestedNavItem array.
 * Builds tree structure from flat items, supporting dropdowns with children.
 *
 * @example
 * ```ts
 * const nav = transformToNestedNavItems(menu);
 * // [
 * //   { kind: 'link', href: '/', label: 'Home', ... },
 * //   { kind: 'dropdown', label: 'Services', children: [...] },
 * // ]
 * ```
 */
declare function transformToNestedNavItems(menu: NavigationMenuWithItems | null): NestedNavItem[];
/**
 * Get nested nav items from the primary menu.
 * Supports dropdowns with children for complex navigation structures.
 *
 * @example
 * ```ts
 * const nav = getNestedPrimaryNavItems(siteData.navigation);
 * nav.forEach(item => {
 *   if (item.kind === 'dropdown') {
 *     console.log(`${item.label} has ${item.children.length} children`);
 *   }
 * });
 * ```
 */
declare function getNestedPrimaryNavItems(navigation: NavigationMenuWithItems[]): NestedNavItem[];
/**
 * Get nested nav items from a specific menu by slug.
 *
 * @example
 * ```ts
 * const footerNav = getNestedNavItemsBySlug(siteData.navigation, 'footer');
 * ```
 */
declare function getNestedNavItemsBySlug(navigation: NavigationMenuWithItems[], slug: string): NestedNavItem[];
/**
 * Build a MenuViewModel from navigation data for block rendering.
 * Extracts CTA item separately and preserves full link data.
 *
 * @example
 * ```ts
 * const menuViewModel = buildMenuViewModel(siteData.navigation);
 *
 * renderBlock(siteHeaderManifest, layout.header, {
 *   viewModelOverrides: { menu: menuViewModel },
 * });
 * ```
 */
declare function buildMenuViewModel(navigation: NavigationMenuWithItems[]): MenuViewModel;
/**
 * Build a LogoViewModel from site layout data.
 *
 * @param logo - Logo source from siteData.layout.logo
 * @param fallbackTitle - Site title to use as alt text fallback
 *
 * @example
 * ```ts
 * const logoViewModel = buildLogoViewModel(siteData.layout.logo, siteData.site.title);
 *
 * renderBlock(siteHeaderManifest, layout.header, {
 *   viewModelOverrides: { content: { logo: logoViewModel } },
 * });
 * ```
 */
declare function buildLogoViewModel(logo: LogoSource, fallbackTitle: string | null | undefined): LogoViewModel;
/**
 * Build a SimpleMenuViewModel from navigation data with pre-resolved hrefs.
 * Use this instead of buildMenuViewModel for cleaner data flow.
 *
 * @param navigation - Navigation menus from site data
 * @param routes - Route map for resolving internal links
 *
 * @example
 * ```ts
 * const menu = buildSimpleMenu(siteData.navigation, siteData.routes);
 * // { items: [{ id, label, href: '/', isExternal: false }], cta: null }
 * ```
 */
declare function buildSimpleMenu(navigation: NavigationMenuWithItems[], routes: RouteMap): SimpleMenuViewModel;
/**
 * Build a SimpleNestedMenuViewModel with pre-resolved hrefs.
 * Supports dropdown containers with nested children.
 *
 * @example
 * ```ts
 * const menu = buildSimpleNestedMenu(siteData.navigation, siteData.routes);
 * menu.items.forEach(item => {
 *   if (item.kind === 'dropdown') {
 *     console.log(item.children);
 *   }
 * });
 * ```
 */
declare function buildSimpleNestedMenu(navigation: NavigationMenuWithItems[], routes: RouteMap): SimpleNestedMenuViewModel;
/**
 * Build a SimpleLogo from site layout data.
 *
 * @param logo - Logo data from site layout
 * @param fallbackAlt - Fallback alt text (usually site title)
 *
 * @example
 * ```ts
 * const logo = buildSimpleLogo(siteData.layout.logo, siteData.site.title);
 * // { src: 'https://...', alt: 'Site Name', width: 200, height: 50 }
 * ```
 */
declare function buildSimpleLogo(logo: {
    url?: string | null;
    alt?: string | null;
    width?: number | null;
    height?: number | null;
} | null, fallbackAlt: string | null | undefined): SimpleLogo;
/**
 * @deprecated Use `transformToNavItems` instead.
 * This alias is maintained for backwards compatibility only.
 */
declare const transformNavItems: typeof transformToNavItems;
/**
 * @deprecated Use `getPrimaryNavigation` instead.
 * This alias is maintained for backwards compatibility only.
 */
declare const selectPrimaryMenu: typeof getPrimaryNavigation;

export { type CustomLinkValue, type ExternalLinkValue, type InternalLinkValue, type LinkValue, type LogoSource, type LogoViewModel, type MenuCtaViewModel, type MenuLinkViewModel, type MenuViewModel, type NavDropdown, type NavItem, type NavLink, NavigationMenuWithItems, type NestedNavItem, type SimpleLogo, type SimpleMenuViewModel, type SimpleNavLink, type SimpleNestedMenuViewModel, type SimpleNestedNavDropdown, type SimpleNestedNavItem, type SimpleNestedNavLink, buildLogoViewModel, buildMenuViewModel, buildSimpleLogo, buildSimpleMenu, buildSimpleNestedMenu, getNavItemsBySlug, getNavigationBySlug, getNestedNavItemsBySlug, getNestedPrimaryNavItems, getPrimaryNavItems, getPrimaryNavigation, isNavDropdown, isNavLink, selectPrimaryMenu, transformNavItems, transformToNavItems, transformToNestedNavItems };
