Drop every reference for which referrerFilePath is the source —
called when re-processing a note after it's been edited.
Collects the now-empty tag keys first and deletes them after the walk. Per ECMA-262 24.1.5 deleting the current entry of a Map during for…of iteration is actually safe (the iterator just skips empty slots), but writing it as a two-pass keeps the code easier to reason about and protects against future edits that might delete other entries in the loop body.
Tracks
#tagmentions across the notebook as global metadata (independent of the file system).Tags are stored case-folded so
#MyTagand#mytagcollapse to one entry, matching how most note tools behave. Original casing is preserved on the Reference token for display.Conceptually parallel to ReferenceMap but with a flat tag → notes shape — there is no "target file" for a tag, only a name.