export function collectEntryPaths(entryData, langs, { requireVirtualPage = false } = {}) {
    const hasVirtualPage = Boolean(entryData.virtualPage);
    return langs.reduce((acc, lang) => {
        if (!entryData[lang]?.path || (requireVirtualPage && !hasVirtualPage)) {
            return acc;
        }
        const path = entryData[lang].path === "/" ? "/" : `${entryData[lang]?.path}/`;
        return [...acc, { lang, path }];
    }, []);
}
export function collectChangedPaths(oldPaths, newPaths) {
    return oldPaths.filter((path) => {
        return newPaths.some((p) => {
            return p.path !== path.path;
        });
    });
}
export function emptyNode(id, path) {
    return {
        id,
        active: true,
        highlight: false,
        virtualPage: "",
        metadata: {},
        fr: {
            label: "",
            shortLabel: "",
            path,
            disabled: false,
            seo: {
                title: "",
                keywords: "",
                description: "",
                inSitemap: false,
                frequency: "",
                priority: 0,
                robots: "index, follow",
                canonical: "",
            },
        },
    };
}
export function buildNewPath(newNodeName, parentPath, virtualPage) {
    if (!virtualPage) {
        return `/${newNodeName}`;
    }
    const prefix = parentPath && parentPath.endsWith("/") ? parentPath : `${parentPath}/`;
    return `${prefix}${newNodeName}`;
}
