export function filterPageSelectorHistory(query, history, limit = 6) {
    const normalizedQuery = query.trim().toLowerCase();
    if (!normalizedQuery)
        return [];
    return history
        .filter((item) => item.name.toLowerCase().includes(normalizedQuery) ||
        item.path.toLowerCase().includes(normalizedQuery))
        .sort((a, b) => {
        const dateA = a.visitedAt ? new Date(a.visitedAt).getTime() : 0;
        const dateB = b.visitedAt ? new Date(b.visitedAt).getTime() : 0;
        return dateB - dateA;
    })
        .slice(0, limit);
}
//# sourceMappingURL=pageSelectorHistoryFilter.js.map