'use client';
import { usePathname } from 'next/navigation';
/**
 * Custom hook to generate breadcrumb segments from the current pathname.
 *
 * @param {Record<string, string>} pageTitles - A mapping of paths to their respective titles.
 * @returns {Segment[]} An array of Segment objects representing the breadcrumb segments.
 */
export function useSegments(pageTitles) {
    const pathname = usePathname() || '/lorem/ipsum';
    const segments = pathname.split('/').filter((segment) => segment);
    let accumulatedPath = '';
    return segments.map((segment) => {
        accumulatedPath += `/${segment}`;
        const name = pageTitles[accumulatedPath] || segment; // Get title from prop
        return {
            path: accumulatedPath,
            name,
        };
    });
}
//# sourceMappingURL=useSegments.js.map