import { normalizeClassname } from "./classname"; export function indexLocalFurniture( rows: T[], ) { const index = new Map(); for (const row of rows) { const key = normalizeClassname(row.itemName); const matches = index.get(key) ?? []; matches.push(row); index.set(key, matches); } return index; } export function localFurnitureStatus( classname: string, local: Map>, furnidata: Set, catalogIds: Set, ) { const key = normalizeClassname(classname); const rows = local.get(key) ?? []; return { alreadyImported: rows.length > 0, localId: rows.length === 1 ? rows[0].id : undefined, hasFurnidata: furnidata.has(key), hasCatalogEntry: rows.some((row) => catalogIds.has(row.id)), }; }