/**
* Navigation menu runtime functions.
*
* These are called from templates to query menus and resolve URLs. All queries
* are locale-aware: when a locale is configured (or passed explicitly) items
* are filtered to that locale, and menu item references resolve against the
* referenced content's translation_group so the URL points at the right
* per-locale row.
*/
import type { Kysely } from "kysely";
import { sql } from "kysely";
import type { Database } from "../database/types.js";
import { validateIdentifier } from "../database/validate.js";
import { resolveLocale, resolveLocaleChain } from "../i18n/resolve.js";
import { getDb } from "../loader.js";
import { cachedQuery, CacheNamespace } from "../object-cache/index.js";
import { requestCached } from "../request-cache.js";
import { sanitizeHref } from "../utils/url.js";
import type { Menu, MenuItem, MenuItemRow } from "./types.js";
export interface MenuQueryOptions {
/** Override the locale used for the lookup. When omitted, the locale comes
* from the request context or the configured defaultLocale. */
locale?: string;
}
/**
* Get a menu by name with resolved URLs.
*
* @example
* ```ts
* const menu = await getMenu("primary");
* const menuEs = await getMenu("primary", { locale: "es" });
* ```
*/
export function getMenu(name: string, options: MenuQueryOptions = {}): Promise