"""Identifier helpers for arXiv IDs."""

from __future__ import annotations

import re


def normalize_arxiv_id(raw_id: str) -> str:
    """Normalize an arXiv ID by stripping URLs and version suffixes."""
    raw_id = raw_id.strip()
    raw_id = re.sub(r"^https?://arxiv\.org/abs/", "", raw_id)
    raw_id = re.sub(r"v\d+$", "", raw_id)
    return raw_id
