• Synchronizes the in-memory manga cache with client-side localStorage caches. Merges manga cache and extracts manga from search cache into unified in-memory cache. Safe to call in non-browser environments.

    Returns void

    export function syncWithClientCache(): void {
    // Exit early if not in browser environment
    if (globalThis.window === undefined) {
    return;
    }

    try {
    // Process manga cache from localStorage
    const cachedMangaData = localStorage.getItem(MANGA_CACHE_KEY);
    if (cachedMangaData) {
    processMangaCache(cachedMangaData);
    }

    // Process search cache to extract manga data
    const cachedSearchData = localStorage.getItem(SEARCH_CACHE_KEY);
    if (cachedSearchData) {
    processSearchCache(cachedSearchData);
    }
    } catch (e) {
    console.error("[MangaSearchService] Error accessing localStorage:", e);
    }
    }