import type { SidebarSectionId } from "@/shared/constants/sidebarVisibility"; export function hydrateExpandedSections( storedExpanded: readonly SidebarSectionId[], pinned: ReadonlySet ): Set { return new Set([...storedExpanded, ...pinned]); } export function toggleExpandedSection( expanded: ReadonlySet, pinned: ReadonlySet, sectionId: SidebarSectionId ): Set { if (expanded.has(sectionId)) { const next = new Set(expanded); next.delete(sectionId); return next; } return new Set([...pinned, sectionId]); } export function expandActiveSection( pinned: ReadonlySet, sectionId: SidebarSectionId ): Set { return new Set([...pinned, sectionId]); }