/** Keep only ASCII digits (maps Persian/Arabic numerals). */
export function normalizeOtpInput(value: string): string {
  const persian = "۰۱۲۳۴۵۶۷۸۹";
  const arabic = "٠١٢٣٤٥٦٧٨٩";
  let out = "";
  for (const ch of value) {
    if (ch >= "0" && ch <= "9") out += ch;
    else {
      const pi = persian.indexOf(ch);
      if (pi >= 0) {
        out += String(pi);
        continue;
      }
      const ai = arabic.indexOf(ch);
      if (ai >= 0) out += String(ai);
    }
  }
  return out.slice(0, 6);
}
