// What the media bin's files are called, as last seen by whoever looked: one shared memory so a rename shows everywhere. export const names = new Map(); /** What each picture means when used as a reference (" is the woman in …"), as last seen. */ export const subjects = new Map(); /** What each file is (image, video, audio), as last seen: the kind decides which input a reference lands on. */ export const kinds = new Map(); /** Which videos carry a soundtrack, as last seen. */ export const sounds = new Set(); export const bin = { version: 0 }; /** Remember a listing (replacing what was known). */ export function learn(list) { names.clear(); subjects.clear(); kinds.clear(); sounds.clear(); list.forEach((m) => { names.set(m.id, m.name); kinds.set(m.id, m.kind); if (m.sound) sounds.add(m.id); if (m.subject) subjects.set(m.id, m.subject); }); bin.version += 1; }