/** * The content fingerprint of a message from a source with no ids of its own * (a WhatsApp `_chat.txt` export): cotton-rules' `fingerprint::message` * (crates/cotton-rules/src/fingerprint/message.rs), asked through the rules * module. Content only: the UTC minute, the whitespace-collapsed text, and * the occurrence among identical same-minute texts. The engine never makes * one for a new row; it recomputes the one an export row WOULD have had, to * find that row when a real id arrives. */import { rule, tryRule } from"../rules/index.ts";exportconst CONTENT_EXTERNAL_ID_PREFIX = "txt2:";/** `YYYY-MM-DDTHH:MM` in UTC, or null for a string that is not an instant. */exportfunction minuteBucket(iso: string): string | null {const answer = tryRule<string>("fingerprint.minute", iso);return"ok"in answer ? answer.ok : null;}exportfunction normalizeBodyForId(body: string): string {return rule<string>("fingerprint.body", body);}/** The fingerprint, or null where `sentAt` is not an instant. */exportfunction contentFingerprint(sentAt: string, body: string, occurrence: number): string | null {const answer = tryRule<string>("fingerprint.content", { sentAt, body, occurrence });return"ok"in answer ? answer.ok : null;}