/**
 * Adds a Home item at the beginning of the main menu when needed.
 *
 * What it does:
 * - Returns the input untouched when hideHomeMenuItem is true
 * - Avoids adding a duplicate Home item if one already exists first in the list
 * - Otherwise prepends a synthetic Home item using the translated label
 */
export function prependHomeMenuItem(items, i18n, homeUrl, hideHomeMenuItem) {
    if (hideHomeMenuItem) {
        return items;
    }
    if (items[0]?.name === i18n.menuHomeButton) {
        return items;
    }
    return [
        {
            href: homeUrl,
            name: i18n.menuHomeButton,
            id: 'homelink',
            open: false,
            selected: false,
            children: [],
        },
        ...items,
    ];
}
/**
 * Creates a stable-ish tracking id for promoted menu items.
 *
 * This mirrors the old wrapper behavior and is used when rendering promoted links.
 */
export function promotedItemId(item) {
    return 'promo-' + item.linkText.replace(/[^A-Za-z0-9.\\\/]/gim, '');
}
//# sourceMappingURL=header-menu.js.map
