"use client"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { generateNames, scoreName, type Idea, type Style } from "@/lib/generate"; import { DEFAULT_TLDS, TLDS, UNVERIFIABLE_TLDS } from "@/lib/tlds"; import { DEFAULT_REGISTRAR, REGISTRARS, registerUrl } from "@/lib/registrars"; import { generateWithAi, loadAiSettings, type AiSettings } from "@/lib/ai"; import { generateWithPlatformAi } from "@/lib/platform-ai"; import { otmSsoUrl } from "@/lib/otm"; import { loadWishlist, saveWishlist, wishlistAsText, WISHLIST_MAX, type SavedName } from "@/lib/wishlist"; type Availability = "available" | "taken" | "unverified-available" | "unknown"; interface DomainCheck { domain: string; status: Availability; method: "rdap" | "dns" | "none"; detail?: string; } /** How many names to put on screen. Each one costs `selectedTlds.length` * registry lookups, so this is the main dial on how hard we lean on the * registries — keep it modest. */ const NAME_COUNT = 24; /** Domains per availability request. The route caps at 60; staying under it * means results paint in progressively instead of in one late lump. */ const BATCH = 40; const STYLES: Array<{ id: Style; label: string; note: string }> = [ { id: "balanced", label: "Balanced", note: "a bit of everything" }, { id: "real", label: "Real words", note: "northbakery, axlekit" }, { id: "coined", label: "Coined", note: "novault, tensora" }, { id: "short", label: "Short", note: "brevity first" }, ]; export default function Finder() { const [keywords, setKeywords] = useState(""); const [style, setStyle] = useState