// IMVU product IDs in what people type or paste. /** IMVU product IDs: numbers, or shop links (`products_id=123`, `product-123`), separated by spaces, commas or lines. */ export function productIDs(text: string): number[] | undefined { const out = new Set(); for (const part of text.split(/[\s,]+/).filter(Boolean)) { const m = part.match(/(?:products_id=|product-)(\d+)/) ?? part.match(/^(\d+)$/); const n = m ? Number(m[1]) : NaN; if (!Number.isSafeInteger(n) || n <= 0) return undefined; out.add(n); } return [...out]; }