// Simple slugifier with cyrillic transliteration for nice ЧПУ.
const MAP: Record<string, string> = {
  а:"a", б:"b", в:"v", г:"g", д:"d", е:"e", ё:"e", ж:"zh", з:"z", и:"i",
  й:"y", к:"k", л:"l", м:"m", н:"n", о:"o", п:"p", р:"r", с:"s", т:"t",
  у:"u", ф:"f", х:"h", ц:"c", ч:"ch", ш:"sh", щ:"sch", ы:"y", э:"e",
  ю:"yu", я:"ya", ъ:"", ь:"",
};

export function slugify(input: string): string {
  const lower = (input || "").toLowerCase().trim();
  let out = "";
  for (const ch of lower) out += MAP[ch] ?? ch;
  return out
    .replace(/[^a-z0-9]+/g, "-")
    .replace(/^-+|-+$/g, "")
    .slice(0, 80) || "game";
}
