"use client" /** * Folder location picker — same search chrome + folder tree as Library secondary panel. * Used by `new-library-item-form` inspector (selection, not navigation). */ import * as React from "react" import { useLocation, useSearchParams } from "react-router-dom" import { Button } from "@/components/ui/button" import { SidebarNavLabel } from "@/components/ui/sidebar-nav-label" import { Tip } from "@/components/ui/tip" import { cn } from "@/lib/utils" import type { LibraryFolder } from "@/lib/mock/library-folders" import { LIBRARY_FOLDER_ICON_COLORS } from "@/lib/mock/library-folders" import { LibraryFolderTreeBranch } from "@/components/data-views/library-folder-tree-branch" import { outlineTreeBranchDepthStyle } from "@/components/data-views/outline-tree-menu" import { LIBRARY_FAVORITES_FOLDER_ID, coerceLibraryNav, parseLibraryNav, } from "@/lib/library-nav" function libraryFolderMatchesSearch( folder: LibraryFolder, folders: LibraryFolder[], query: string, ): boolean { const needle = query.trim().toLowerCase() if (!needle) return true if (folder.name.toLowerCase().includes(needle)) return true return folders.some( f => f.parentId === folder.id && libraryFolderMatchesSearch(f, folders, query), ) } function FolderPickerSearchInput({ value, onChange, }: { value: string onChange: (next: string) => void }) { return (