export function normalizeQrPayload(raw: string): string {
  const trimmed = raw.trim();
  try {
    const url = new URL(trimmed);
    const code = url.searchParams.get("qr") || url.pathname.split("/").pop();
    return (code || trimmed).trim();
  } catch {
    return trimmed;
  }
}
