import { JSX } from "preact/jsx-runtime";
import { Main, render_and_copy, serverside_randirect } 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",
    "cool",
    "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",
    "egg",
].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",
    "bug",
].map(name => name[0].toUpperCase() + name.slice(1));

const ASPECTS = [
    "Space",
    "Time",
    "Mind",
    "Heart",
    "Hope",
    "Rage",
    "Breath",
    "Blood",
    "Life",
    "Doom",
    "Light",
    "Void",
];

// oh heck yeah we can totally layer clothes and stuff
// not gonna though
// link to http://www.farragofiction.com/DollSim/ why not

const CLASSES = [
    "Thief",
    "Rogue",
    "Bard",
    "Prince",
    "Heir",
    "Page",
    "Seer",
    "Maid",
    "Sylph",
    "Knight",
    "Witch",
    "Mage",
];

// if this was ruby i could just multiply that array grumble grumble

const LIKED_NOUNS = [
    "cats",
    "dogs",
    "computers",
    "keyboards",
    "eggbug",
    "homestuck",
    "websites",
    "paintbrushes",
    "randomness",
    "posts",
    "chairs",
    "wires",
    "audio",
    "sound",
    "music",
    "sound effects",
    "personal hygiene",
    "smells",
    "cars",
    "cdrs",
    "pairs",
    "atoms",
    "lists",
    "trees",
    "tasks",
    "smart devices",
    "dumb devices",
    "synthesizers",
    "violins",
    "pianos",
    "remotes",
    "earbuds",
    "eggbuds",
    "scented waxes",
    "cables",
    "cords",
    "love",
    "hate",
    "coolness",
    "radness",
    "gnarliness",
    "lameness",
    "sick-nastiness",
    "maximalism",
    "minimalism",
    "cohost",
    "html",
    "css",
    "javascript",
    "typescript",
    "deno",
    "dinos",
    "life",
    "yourself",
    "whatever is reading this",
    "fish",
    "sharks",
    "eevees",
    "seagulls",
].map(s => s.toUpperCase());

const LIKED_ACTIVITIES = [
    "playing the trombone",
    "playing the piano",
    "using the computer",
    "posting on the websites",
    "reading homestuck",
    "playing homestuck",
    "reading gamebro",
    "reading gamegrl",
    "helping others",
    "hindering others",
    "egging the bug",
    "coing the host",
    "making a javascript",
    "scheming (in the evil sense)",
    "scheming (in the algorithmic language sense)",
    "reading books (how exciting)",
    "reading blogs",
    "being kind :D",
    "being rude D:",
    "liking things",
    "loving things",
    "transforming",
    "refreshing this page to see different things",
    "writing blogs",
    "writing books",
    "writing visual novels",
    "reading visual novels",
    "playing visual novels",
    "gaming",
    "gaming so hard",
    "gaming so, so hard",
    "gaming so, so, so hard",
    "gaming a regular amount of hard",
    "flarping",
    "playing games for girls",
    "sweeping mines",
    "tetrising",
    "nixing operating systems",
    "emacsing",
    "using alternatives to discord",
    "internet relay chatting",
    "hypertexting",
    "decorating your room",
    "designing clothes",
    "wearing clothes",
    "being cool",
    "being rad",
    "being gnarly",
    "being lame",
    "making fun random generators by assembling a small set of primitives that, yes, could be more atomic",
    "making this text really squishy by liking doing something with a really long description like this",
    "finishing up a list",
    "writing activities that are actually homestuckish",
    "staying in your room",
    "staying anywhere but your room",
    "programming poorly",
    "shaving",
    "dressing in a spiffy manner",
    "watching crappy movies",
    "watching really good movies",
    "doing nothing in particular",
    "cleaning your room",
    "attempting to escape your absurd house",
    "attempting to make your house more absurd",
    "architecting",
    "visiting others",
    "visiting yourself",
    "doing enough",
].map(s => s.toUpperCase());

const HEADWEAR = [
    ...new Array(20).fill("nothing on top of your head"),
    "a dorky top hat",
    "a spiffy top hat",
    "a baseball cap",
    "a baseball helmet",
    "a football helmet",
    "a puppet on top of your head",
    "a smaller version of yourself on top of your head",
    "a headband with attached horns",
    "a headband",
    "a veil",
    "a fedora",
    "a comically small top hat",
    "a comically large top hat",
];

const FACEWEAR = [
    ...new Array(20).fill("nothing on your face"),
    "some sick shades",
    "some frankly lame shades",
    "heart-shaped shades",
    "circular shades",
    "circular glasses",
    "square glasses",
    "glasses that you would consider standard",
    "grey facepaint",
    "clown facepaint",
    "juggalo facepaint",
    "a clown nose",
    "Vriska's glasses (they aren't yours)",
    "Dave's shades (they aren't yours)",
];

const TOP = [
    "a tank top",
    "a collared shirt",
    "a polo shirt",
    "a generic t-shirt",
    "a non-generic t-shirt",
    "a red t-shirt",
    "a orange t-shirt",
    "a yellow t-shirt",
    "a green t-shirt",
    "a blue t-shirt",
    "a indigo t-shirt",
    "a violet t-shirt",
    "a teal t-shirt",
    "a Terezi t-shirt (what!!)",
    "a white shirt",
    "a pair of pants as a shirt",
    "a grey t-shirt",
    "a gray t-shirt",
    "a brown t-shirt",
    "a scratchy sweater",
    "an incredibly comfortable sweater",
    "a sweater",
    "a jacket",
    "a coat",
    "an appropriately-heavy coat",
    "an inappropriately-heavy coat",
    "a cargo shirt",
    "a cargo shirt that you added more pockets to",
];

const BOTTOM = [
    "pants",
    "shorts",
    "a skirt",
    "cargo pants",
    "cargo shorts",
    "a cargo skirt",
    "cargo pants that you added more pockets to",
    "cargo shorts that you added more pockets to",
    "a cargo skirt that you added more pockets to",
    "dress pants",
    "dress shorts",
    "a dress skirt",
    "a collared shirt",
    "a polo shirt",
    "a generic skirt",
    "a non-generic skirt",
    "a red skirt",
    "a orange skirt",
    "a yellow skirt",
    "a green skirt",
    "a blue skirt",
    "a indigo skirt",
    "a violet skirt",
    "a teal skirt",
    "a Terezi skirt (what!!)",
    "a white shirt",
    "a pair of pants as a skirt",
    "a grey skirt",
    "a gray skirt",
    "a brown skirt",
    "sweat pants",
    "sweat shorts",
    "Terezi pants (what!!)",
];

const FOOTWEAR = [
    "shoes",
    "boots",
    "cargo boots",
    "cargo boots that you added more pockets to",
    "sandals",
    "sneakers",
    "crocs",
    "red shoes",
    "orange shoes",
    "yellow shoes",
    "green shoes",
    "blue shoes",
    "indigo shoes",
    "violet shoes",
    "Terezi shoes (what!!)",
    "sandals with socks",
];

// has some defaults
export const Prngnoun = ({
    prns,
    alt,
    style = {},
}: {
    prns: string[];
    alt: string;
    style?: JSX.CSSProperties;
}) => (
    <img
        src={`https://pyrope.net/prngnouns?p=${prns.join("&p=")}`}
        alt={alt}
        style={{
            display: "inline",
            height: "0.5lh",
            margin: "0",
            ...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(
    // sort of a franken-introduction of name and other stuff
    <Main
        style={{
            fontFamily: "'courier-std', 'Courier New', courier, monospace",
            fontWeight: "bold",
            color: "black",
            backgroundColor: "#EFEFEF",
            textAlign: "center",
            margin: "0 auto",
            padding: "0.5rem 1rem",
        }}
    >
        <p>
            Your name is{" "}
            <Prngnoun
                alt="a four letter name. weird stuff, not very namey"
                prns={FIRST_NAMES}
            />{" "}
            <Prngnoun
                alt="a six or seven letter last name. weird stuff, not very namey"
                prns={LAST_NAMES}
            />
            . You like <Prngnoun alt="a random noun" prns={LIKED_NOUNS} />,{" "}
            {/* we add another thing so that it isn't the same url */}
            <Prngnoun
                alt="another random noun"
                prns={["SOME OTHER THING", ...LIKED_NOUNS]}
            />
            , and <Prngnoun alt="a random activity" prns={LIKED_ACTIVITIES} />.
        </p>
        <p>
            You feel a bit too shy to actually{" "}
            <a
                style={{ fontWeight: "bold" }}
                href={serverside_randirect(
                    "http://www.farragofiction.com/DollSim/",
                    "http://www.farragofiction.com/DollSim/index.html?type=2"
                )}
            >
                show yourself
            </a>{" "}
            in this post, but you are wearing{" "}
            <Prngnoun
                alt="a piece of headwear, or lack thereof"
                prns={HEADWEAR}
            />
            ,{" "}
            <Prngnoun
                alt="a piece of facewear, or lack thereof"
                prns={FACEWEAR}
            />
            , <Prngnoun alt="a top (clothing)" prns={TOP} />,{" "}
            <Prngnoun alt="a bottom (clothing)" prns={BOTTOM} />, and{" "}
            <Prngnoun alt="footwear" prns={FOOTWEAR} />.
            {/* you are wearing nothing on your head, some sick shades, a tank top, boots, and cargo pants */}
            {/* your expression changes {often,rarely,of course}, but it's typical for you to be {smiling,grinning,grimacing} */}
        </p>
        <p>
            You are a <Prngnoun alt="a class from homestuck" prns={CLASSES} />{" "}
            of <Prngnoun alt="an aspect from homestuck" prns={ASPECTS} />, but
            you don't really care about that&mdash;it's hard to god-tier when
            you are a randomly-filled out template!
        </p>
    </Main>
);
