import { JSX } from "preact/jsx-runtime";
import { render_and_copy } from "./common.tsx";

// let's do 100 first and last names OKAY
//
// cat ~/Documents/dictionary.txt | grep -e '^.\{6,7\}$' | shuf | head -n 100
// okay let's be a bit more selective yikes
// cat ~/Documents/dictionary.txt | grep -E '^....$'              | shuf | head -n 100 | awk 'BEGIN {print("[")} {print("    \"" $1 "\",")} END {print("]")}' | xsel -ib
// cat ~/Documents/dictionary.txt | grep -E '^[^n][^i][^g]....?$' | shuf | head -n 100 | awk 'BEGIN {print("[")} {print("    \"" $1 "\",")} END {print("]")}' | xsel -ib
// that is a COMPREHENSIVE dictionary D:

const FIRST_NAMES = [
    "tree",
    "saka",
    "pass",
    "kexy",
    "pici",
    "kurd",
    "xxii",
    "lide",
    "huke",
    "palm",
    "levi",
    "dago",
    "they",
    "smut",
    "filt",
    "cump",
    "upgo",
    "zoid",
    "army",
    "anta",
    "arbs",
    "ferv",
    "stan",
    "wabe",
    "jami",
    "purs",
    "deys",
    "vamp",
    "mese",
    "migs",
    "pile",
    "susu",
    "olio",
    "ipse",
    "gelt",
    "idem",
    "eden",
    "pont",
    "vica",
    "corv",
    "kell",
    "elul",
    "ecod",
    "maid",
    "kays",
    "fine",
    "taws",
    "coul",
    "shag",
    "aren",
    "ruse",
    "anre",
    "spex",
    "perp",
    "koff",
    "west",
    "sild",
    "vina",
    "itch",
    "neal",
    "jhow",
    "cozy",
    "moun",
    "copy",
    "fict",
    "gulp",
    "slon",
    "tuny",
    "tolt",
    "erns",
    "eyas",
    "thro",
    "reno",
    "warm",
    "lone",
    "erst",
    "koel",
    "vila",
    "rump",
    "kmet",
    "drow",
    "polt",
    "orts",
    "hlqn",
    "adib",
    "dabb",
    "dhak",
    "tyke",
    "arni",
    "bagh",
    "holt",
    "wart",
    "bull",
    "mayo",
    "tiam",
    "dose",
    "dogs",
    "dine",
    "wych",
    "poet",
    "meh",
].map(name => name[0].toUpperCase() + name.slice(1));

const LAST_NAMES = [
    "paragon",
    "phossy",
    "burghal",
    "templum",
    "osteome",
    "deicide",
    "lockrum",
    "inhale",
    "celoms",
    "outsit",
    "plaints",
    "stubby",
    "flabrum",
    "elcaja",
    "thrang",
    "caretta",
    "retune",
    "unplace",
    "adlumin",
    "garcon",
    "brainy",
    "slyest",
    "tsktsks",
    "bodock",
    "crummer",
    "actions",
    "wrapped",
    "emeril",
    "traneen",
    "wrought",
    "detinue",
    "ascarid",
    "swimbel",
    "leaped",
    "ericoid",
    "solano",
    "barware",
    "infarce",
    "bullets",
    "frankly",
    "euboean",
    "jymold",
    "besugo",
    "smaragd",
    "suiting",
    "muconic",
    "goujay",
    "caynard",
    "pupped",
    "verdict",
    "brangle",
    "potions",
    "touart",
    "fraena",
    "peising",
    "replial",
    "unbaste",
    "sandbug",
    "roosed",
    "refind",
    "illipe",
    "runner",
    "implate",
    "atoxyl",
    "favous",
    "opcode",
    "fuegian",
    "cadging",
    "soapbox",
    "fessed",
    "deworm",
    "browzer",
    "uncurl",
    "toelike",
    "posnet",
    "mortem",
    "whippa",
    "invests",
    "aphagia",
    "attent",
    "esopgi",
    "resorb",
    "succula",
    "levulic",
    "enlace",
    "busbars",
    "rocket",
    "sexuous",
    "provers",
    "condole",
    "caveman",
    "cattily",
    "buddie",
    "trikaya",
    "ladlers",
    "gorbet",
    "tarkani",
    "acquit",
    "shohjis",
    "shilloo",
    "bark",
].map(name => name[0].toUpperCase() + name.slice(1));

// has some defaults
export const Prngnoun = ({
    prns,
    style = {},
}: {
    prns: string[];
    style?: JSX.CSSProperties;
}) => (
    <img
        src={`https://pyrope.net/prngnouns?p=${prns.join("&p=")}`}
        style={{
            display: "inline",
            height: "0.9rem",
            ...style,
        }}
    />
);

// what is gained from having this on cohost... hm
// export const InlineRandImage
// because the randomly generated parts are so nicely integrated (if you have courier)
// i'm thinking i'll frame it like "your guy is ..." instead of "you are ..."
// idk

render_and_copy(
    <p
        style={{
            lineHeight: "1rem",
            fontFamily: "courier-std, courier, monospace",
            fontWeight: "bold",
        }}
    >
        Your name is <Prngnoun prns={FIRST_NAMES} />{" "}
        <Prngnoun prns={LAST_NAMES} />. You are{" "}
        <Prngnoun
            prns={Array.from({ length: 200 }).map((_, i) => i.toString())}
        />{" "}
        years old. Cool!
    </p>
);
