const ELLIPSIS = '...';
const SEPARATOR = ' / ';
function limitPath(path, pathLimit) {
    if (path.length <= pathLimit) return path.join(SEPARATOR);
    if (1 === pathLimit && path.length > 1) return [
        ELLIPSIS,
        path[path.length - 1]
    ].join(SEPARATOR);
    const ellipsedPath = [
        path[0],
        ELLIPSIS,
        ...path.slice(-(pathLimit - 1))
    ];
    return ellipsedPath.join(SEPARATOR);
}
function joinBreadcrumbValues(breadcrumb) {
    return Array.isArray(breadcrumb.formattedValue) ? breadcrumb.formattedValue.join(SEPARATOR) : breadcrumb.formattedValue;
}
function getFirstBreadcrumbValue(breadcrumb, pathLimit) {
    return Array.isArray(breadcrumb.formattedValue) ? limitPath(breadcrumb.formattedValue, pathLimit) : breadcrumb.formattedValue;
}
export { getFirstBreadcrumbValue, joinBreadcrumbValues };
