code:
/**
 * @param {FC.HumanState} slave
 * @param {number|string} [seed=undefined]
 */
globalThis.nationalityToRace = function(slave, seed) {
	slave.race = hashChoice(App.Data.misc.raceSelector[slave.nationality] || App.Data.misc.raceSelector[""], seed);
};

/**
 * @param {FC.HumanState} slave
 * @param {number|string} [seed=undefined]
 */
globalThis.raceToNationality = function(slave, seed) {
	seed = seed ?? generateNewID();
	/* consider this placeholder until raceNationalities gets fixed up */
	slave.nationality = hashChoice(V.nationalities, seed);
	/* Maximum of 100 attempts */
	let i = 0;
	for (; App.Data.misc.raceSelector[slave.nationality] && !(slave.race in App.Data.misc.raceSelector[slave.nationality]) && i < 100; i++) {
		seed = iterateSeed(seed);
		slave.nationality = hashChoice(V.nationalities, seed);
	}
	/* No success after 100 attempts, so just randomize according to race */
	if (App.Data.misc.raceSelector[slave.nationality] && !(slave.race in App.Data.misc.raceSelector[slave.nationality]) && i === 100) {
		if (slave.race in App.Data.misc.nationalitiesByRace) {
			slave.nationality = hashChoice(App.Data.misc.nationalitiesByRace[slave.race], iterateSeed(seed));
		} else {
			slave.nationality = "Stateless";
		}
	}
};

/**
 * @param {string} nationality
 * @param {FC.Race} race
 * @param {boolean} male
 * @param {(name: string) => boolean} [filter] Default: allow all
 * @param {number|string} [seed=undefined]
 * @returns {string}
 */
globalThis.generateName = function(nationality, race, male, filter = _.stubTrue, seed) {
	const lookup = (male ? App.Data.misc.malenamePoolSelector : App.Data.misc.namePoolSelector);
	/** @type {string} */
	const result = jsSeededEither(
		seed,
		(lookup[`${nationality}.${race}`] || lookup[nationality] ||
			(male ? App.Data.misc.whiteAmericanMaleNames : App.Data.misc.whiteAmericanSlaveNames)).filter(filter));
	/* fallback for males without specific male name sets: return female name */
	if (male && !result) {
		return generateName(nationality, race, false, undefined, seed);
	}
	return result;
};

/**
 * @param {string} nationality
 * @param {FC.Race} race
 * @param {boolean} male
 * @param {(name: string) => boolean} [filter] Default: allow all
 * @param {number|string} [seed=undefined]
 * @returns {FC.Zeroable<string>}
 */
globalThis.generateSurname = function(nationality, race, male, filter = _.stubTrue, seed) {
	/** @type {string} */
	const result = jsSeededEither(
		seed,
		(App.Data.misc.surnamePoolSelector[`${nationality}.${race}`] ||
			App.Data.misc.surnamePoolSelector[nationality] ||
			App.Data.misc.whiteAmericanSlaveSurnames).filter(filter));
	if (male) {
		/* see if we have male equivalent of that surname, and return that if so */
		const maleLookup = App.Data.misc.maleSurnamePoolSelector[`${nationality}.${race}`] || App.Data.misc.maleSurnamePoolSelector[nationality];
		if (maleLookup && maleLookup[result]) {
			return maleLookup[result];
		}
	}
	return result || 0;
};

/**
 * @param {string} name
 * @param {string} nationality
 * @param {any} race
 * @returns {boolean}
 */
globalThis.isMaleName = function(name, nationality, race) {
	const names = App.Data.misc.malenamePoolSelector[`${nationality}.${race}`] ||
		App.Data.misc.malenamePoolSelector[nationality] ||
		App.Data.misc.whiteAmericanMaleNames;
	return names && names.includes(name);
};

/**
 * @param {FC.SlaveState} slave
 * @param {number|string} [nameSeed=undefined]
 * @param {number|string} [surnameSeed1=undefined]
 * @param {number|string} [surnameSeed2=undefined]
 */
globalThis.nationalityToName = function(slave, nameSeed, surnameSeed1, surnameSeed2) {
	function useDoubleSurname() {
		const hispanic = ["Spanish", "Catalan", "Andorran", "Mexican", "Costa Rican", "Salvadoran", "Guatemalan", "Honduran", "Nicaraguan", "Panamanian", "Cuban", "Dominican", "Puerto Rican", "Argentinian", "Bolivian", "Chilean", "Colombian", "Ecuadorian", "Paraguayan", "Peruvian", "Uruguayan", "Venezuelan", "Equatoguinean", "Filipina"].includes(slave.nationality);
		const lusitanic = ["Portuguese", "Brazilian", "Angolan", "Cape Verdean", "Bissau-Guinean", "Mozambican", "São Toméan", "East Timorese"].includes(slave.nationality);
		// keep original hispanic/lusitanian double surname if the slave probably had one, AND if the arcology uses them by convention
		// order doesn't matter for new slaves, just grab any two appropriate surnames
		return (hispanic || lusitanic) && (V.surnameScheme === 7 || V.surnameScheme === 8);
	}
	const male = (slave.genes === "XY");

	slave.birthName = generateName(slave.nationality, slave.race, male, undefined, nameSeed);
	slave.birthSurname = generateSurname(slave.nationality, slave.race, male, undefined, surnameSeed1);
	if (useDoubleSurname()) {
		slave.birthSurname += " " + generateSurname(slave.nationality, slave.race, male, undefined, surnameSeed2);
	}
	if (male && isMaleName(slave.birthName, slave.nationality, slave.race) && !V.allowMaleSlaveNames) {
		slave.slaveName = generateName(slave.nationality, slave.race, false, undefined, nameSeed);
	} else {
		slave.slaveName = slave.birthName;
	}
	slave.slaveSurname = slave.birthSurname;
	if (V.useFSNames === 1) {
		if (V.FSNamePref === 0) {
			if (V.arcologies[0].FSChattelReligionist > 20) {
				slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.chattelReligionistSlaveNames);
				slave.slaveSurname = 0;
			} else if (V.arcologies[0].FSRomanRevivalist > 20) {
				slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.romanSlaveNames);
				slave.slaveSurname = jsSeededEither(surnameSeed1, App.Data.misc.romanSlaveSurnames);
			} else if (V.arcologies[0].FSAztecRevivalist > 20) {
				slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.aztecSlaveNames);
				slave.slaveSurname = 0;
			} else if (V.arcologies[0].FSEgyptianRevivalist > 20) {
				slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.ancientEgyptianSlaveNames);
				slave.slaveSurname = 0;
			} else if (V.arcologies[0].FSEdoRevivalist > 20) {
				slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.edoSlaveNames);
				slave.slaveSurname = jsSeededEither(surnameSeed1, App.Data.misc.edoSlaveSurnames);
			} else if (V.arcologies[0].FSAntebellumRevivalist > 20) {
				slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.antebellumSlaveNames);
				slave.slaveSurname = jsSeededEither(surnameSeed1, App.Data.misc.antebellumSlaveSurnames);
			} else if (FutureSocieties.isActive('FSDegradationist')) {
				DegradingName(slave);
			}
		} else if (V.FSNamePref === 1) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.chattelReligionistSlaveNames);
			slave.slaveSurname = 0;
		} else if (V.FSNamePref === 2) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.romanSlaveNames);
			slave.slaveSurname = jsSeededEither(surnameSeed1, App.Data.misc.romanSlaveSurnames);
		} else if (V.FSNamePref === 3) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.aztecSlaveNames);
			slave.slaveSurname = 0;
		} else if (V.FSNamePref === 4) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.ancientEgyptianSlaveNames);
			slave.slaveSurname = 0;
		} else if (V.FSNamePref === 5) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.edoSlaveNames);
			slave.slaveSurname = jsSeededEither(surnameSeed1, App.Data.misc.edoSlaveSurnames);
		} else if (V.FSNamePref === 6) {
			DegradingName(slave);
		} else if (V.FSNamePref === 7) {
			PaternalistName(slave);
		} else if (V.FSNamePref === 8) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.bimboSlaveNames);
			slave.slaveSurname = 0;
		} else if (V.FSNamePref === 9) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.cowSlaveNames);
			slave.slaveSurname = 0;
		} else if (V.FSNamePref === 10) {
			slave.slaveName = jsSeededEither(nameSeed, App.Data.misc.antebellumSlaveNames);
			slave.slaveSurname = jsSeededEither(surnameSeed1, App.Data.misc.antebellumSlaveSurnames);
		}
	}
};

/**
 * @param {FC.SlaveState} slave
 * @param {number|string} [seed=undefined]
 */
globalThis.nationalityToAccent = function(slave, seed) {
	const naturalAccent = jsSeededEither(seed, [0, 1, 1, 2, 2, 2, 3, 3, 3, 3]);

	switch (slave.nationality) {
		case "Afghan":
			if (V.language === "Pashto") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Dari") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Persian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Albanian":
			slave.accent = naturalAccent;
			break;
		case "Algerian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "American":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1, 1, 2]);
			} else if (V.language === "Spanish" && slave.race === "latina") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Chinese" && slave.race === "asian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Arabic" && slave.race === "middle eastern") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Andorran":
			slave.accent = (V.language === "Catalan") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Angolan":
			slave.accent = (V.language === "Portuguese") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Antiguan":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Argentinian":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Armenian":
			if (V.language === "Russian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Aruban":
			if (V.language === "Dutch") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Portuguese") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Australian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Austrian":
			if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Serbian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Slovene") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Turkish" && slave.race === "indo-aryan") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Azerbaijani":
			slave.accent = naturalAccent;
			break;
		case "Bahamian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Bahraini":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Bangladeshi":
			if (V.language === "Bengali") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Hindi") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Barbadian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Belarusian":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Belgian":
			if (V.language === "Dutch") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Belizean":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Beninese":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Bermudian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Bhutanese":
			slave.accent = (V.language === "Dzongkha") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Bissau-Guinean":
			slave.accent = (V.language === "Portuguese") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Bolivian":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Bosnian":
			if (V.language === "Croatian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Serbian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Brazilian":
			if (V.language === "Portuguese") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Spanish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "British":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Hindi" && slave.race === "indo-aryan") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Bruneian":
			if (V.language === "Malay") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Bulgarian":
			slave.accent = naturalAccent;
			break;
		case "Burkinabé":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Burmese":
			slave.accent = naturalAccent;
			break;
		case "Burundian":
			slave.accent = (V.language === "Kirundi") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Cambodian":
			if (V.language === "Khmer") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Cham") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Cameroonian":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Canadian":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Cape Verdean":
			slave.accent = (V.language === "Portuguese") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Catalan":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Central African":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Chadian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Chilean":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Chinese":
			if (V.language === "Tibetan") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Korean") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Kazakh") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Colombian":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Comorian":
			if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Congolese":
			if (V.language === "Lingala") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Kikongo") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "a Cook Islander":
			if (V.language === "Cook Islands Māori") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Costa Rican":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Croatian":
			if (V.language === "Bosnian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Serbian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Cuban":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Curaçaoan":
			if (V.language === "Dutch") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Portuguese") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Cypriot":
			if (V.language === "Greek") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Turkish") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Czech":
			if (V.language === "Slovak") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Vietnamese" && slave.race === "asian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Danish":
			slave.accent = naturalAccent;
			break;
		case "Djiboutian":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Dominican":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Dominiquais":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Dutch":
			slave.accent = naturalAccent;
			break;
		case "East Timorese":
			if (V.language === "Tetum") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Portuguese") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Malay") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Ecuadorian":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Egyptian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Emirati":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Equatoguinean":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Eritrean":
			if (V.language === "Tigrinya") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Estonian":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Ethiopian":
			if (V.language === "Amharic") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Tigrinya") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Fijian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Filipina":
			if (V.language === "Filipino") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Tagalog") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Spanish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Finnish":
			slave.accent = (V.language === "Swedish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "French":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Spanish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Arabic" && slave.race === "middle eastern") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Catalan") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "French Guianan":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "French Polynesian":
			if (V.language === "Tahitian") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Chinese") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Gabonese":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Gambian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Georgian":
			slave.accent = (V.language === "Abkhaz") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "German":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Turkish" && slave.race === "indo-aryan") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Ghanan":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Hausa") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Greek":
			slave.accent = naturalAccent;
			break;
		case "Greenlandic":
			slave.accent = (V.language === "Danish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Grenadian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Guamanian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Guatemalan":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Guinean":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Guyanese":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Haitian":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Honduran":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Hungarian":
			if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "I-Kiribati":
			if (V.language === "Gilbertese") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Icelandic":
			if (V.language === "Danish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Indian":
			if (V.language === "Hindi") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Indonesian":
			if (V.language === "Javanese") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Malay") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Iranian":
			if (V.language === "Persian") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Iraqi":
			if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Kurdish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Irish":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Israeli":
			if (V.language === "Hebrew") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Yiddish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Italian":
			slave.accent = naturalAccent;
			break;
		case "Ivorian":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Jamaican":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Japanese":
			slave.accent = naturalAccent;
			break;
		case "Jordanian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Kazakh":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Kenyan":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Kittitian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Korean":
			slave.accent = (V.language === "Chinese") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Kosovan":
			if (V.language === "Albanian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Serbian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Kurdish":
			if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Turkish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Kuwaiti":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Kyrgyz":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Laotian":
			if (V.language === "Lao") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Khmu") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Latvian":
			slave.accent = naturalAccent;
			break;
		case "Lebanese":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Liberian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Libyan":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "a Liechtensteiner":
			slave.accent = (V.language === "German") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Lithuanian":
			slave.accent = naturalAccent;
			break;
		case "Luxembourgian":
			if (V.language === "Luxembourgish") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Macedonian":
			slave.accent = naturalAccent;
			break;
		case "Malagasy":
			if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Malawian":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Chichewa") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Malaysian":
			slave.accent = (V.language === "Malay") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Maldivian":
			slave.accent = naturalAccent;
			break;
		case "Malian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Maltese":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Italian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Marshallese":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Mauritanian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Mauritian":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Mexican":
			if (V.language === "Spanish") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Nahuatl" && slave.race === "amerindian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Micronesian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Moldovan":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Monégasque":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Mongolian":
			slave.accent = naturalAccent;
			break;
		case "Montenegrin":
			slave.accent = (V.language === "Serbian") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Moroccan":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Mosotho":
			slave.accent = (V.language === "Sesotho") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Motswana":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Mozambican":
			if (V.language === "Portuguese") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Makhuwa") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Sena") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Swahili") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Namibian":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Afrikaans") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Nauruan":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Nepalese":
			if (V.language === "Nepali") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Maithili") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Bhojpuri") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "New Caledonian":
			if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Nengone") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Drehu") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "a New Zealander":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Māori" && slave.race === "pacific islander") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Ni-Vanuatu":
			if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Nicaraguan":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Nigerian":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Hausa") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Nigerien":
			if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Hausa") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Niuean":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Norwegian":
			slave.accent = naturalAccent;
			break;
		case "Omani":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Pakistani":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Palauan":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Sonsorolese") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Tobian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Japanese") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Palestinian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Panamanian":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Papua New Guinean":
			slave.accent = naturalAccent;
			break;
		case "Paraguayan":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Peruvian":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Polish":
			slave.accent = naturalAccent;
			break;
		case "Portuguese":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Puerto Rican":
			if (V.language === "Spanish") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Qatari":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Romanian":
			slave.accent = naturalAccent;
			break;
		case "Russian":
			slave.accent = naturalAccent;
			break;
		case "Rwandan":
			slave.accent = (V.language === "Kinyarwanda") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Sahrawi":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Saint Lucian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Salvadoran":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Sammarinese":
			slave.accent = (V.language === "Italian") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Samoan":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "São Toméan":
			slave.accent = (V.language === "Portuguese") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Saudi":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Scottish":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Senegalese":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Serbian":
			if (V.language === "Bosnian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Serbian") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Seychellois":
			if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Sierra Leonean":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Singaporean":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Chinese") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Malay") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Tamil") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Slovak":
			slave.accent = (V.language === "Czech") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Slovene":
			slave.accent = naturalAccent;
			break;
		case "a Solomon Islander":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Somali":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "South African":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Afrikaans") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Dutch") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "South Sudanese":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Spanish":
			slave.accent = (V.language === "Catalan") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Sri Lankan":
			if (V.language === "Sinhalese") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Tamil") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Sudanese":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Surinamese":
			slave.accent = (V.language === "Dutch") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Swazi":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Afrikaans") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Tsonga") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Zulu") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Swedish":
			if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Finnish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Norwegian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Swiss":
			if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Italian") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Syrian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Taiwanese":
			slave.accent = (V.language === "Chinese") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Tajik":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Tanzanian":
			slave.accent = (V.language === "Swahili") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Thai":
			if (V.language === "Chinese") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Malay") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Khmer") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Tibetan":
			slave.accent = (V.language === "Chinese") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Togolese":
			slave.accent = (V.language === "French") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Tongan":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Trinidadian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Tunisian":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Turkish":
			if (V.language === "Arabic") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Kurdish") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "Zaza") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Turkmen":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Tuvaluan":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Ugandan":
			slave.accent = (V.language === "Swahili") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Ukrainian":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Uruguayan":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Uzbek":
			slave.accent = (V.language === "Russian") ? jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]) : naturalAccent;
			break;
		case "Vatican":
			if (V.language === "Italian") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Latin") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "German") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Venezuelan":
			slave.accent = (V.language === "Spanish") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Vietnamese":
			if (V.language === "Chinese") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 2, 2, 2, 3, 3]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Vincentian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Yemeni":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Zairian":
			if (V.language === "Lingala") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Kikongo") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Swahili") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "French") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Zambian":
			slave.accent = (V.language === "English") ? jsSeededEither(seed, [0, 1, 1, 1, 1, 2]) : naturalAccent;
			break;
		case "Zimbabwean":
			if (V.language === "Shona") {
				slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
			} else if (V.language === "Ndebele") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "Chewa") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else if (V.language === "English") {
				slave.accent = jsSeededEither(seed, [0, 1, 1, 1, 1, 2]);
			} else {
				slave.accent = naturalAccent;
			}
			break;
		case "Ancient Chinese Revivalist":
			slave.accent = (V.language === "Chinese") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Ancient Egyptian Revivalist":
			slave.accent = (V.language === "Ancient Egyptian") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Arabian Revivalist":
			slave.accent = (V.language === "Arabic") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Aztec Revivalist":
			slave.accent = (V.language === "Nahuatl") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Edo Revivalist":
			slave.accent = (V.language === "Japanese") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		case "Roman Revivalist":
			slave.accent = (V.language === "Latin") ? jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]) : naturalAccent;
			break;
		default:
			slave.accent = naturalAccent;
			break;
	}

	if (slave.nationality === V.language) {
		slave.accent = jsSeededEither(seed, [0, 0, 0, 0, 0, 0, 1]);
	}
};

/**
 * @param {FC.SlaveState} slave
 * @param {number|string} [seed=undefined]
 */
globalThis.randomizeAttraction = function(slave, seed) {
	const sexuality = jsRandom(0, 100, undefined, seed);
	let attraction = Math.clamp(slave.energy * 2, 60, 180);

	if (slave.balls > 0) {
		if (sexuality > 90) {
			slave.attrXY = Math.clamp(attraction, 0, 100);
			attraction -= slave.attrXY;
			slave.attrXX = Math.clamp(attraction, 0, 100);
		} else if (sexuality > 70) {
			seed = iterateSeed(seed);
			slave.attrXY = Math.clamp(attraction + jsRandom(-5, 5, undefined, seed), 0, 100);
			seed = iterateSeed(seed);
			slave.attrXX = Math.clamp(attraction + jsRandom(-5, 5, undefined, seed), 0, 100);
		} else {
			slave.attrXX = Math.clamp(attraction, 0, 100);
			attraction -= slave.attrXX;
			slave.attrXY = Math.clamp(attraction, 0, 100);
		}
	} else {
		if (sexuality > 90) {
			slave.attrXX = Math.clamp(attraction, 0, 100);
			attraction -= slave.attrXX;
			slave.attrXY = Math.clamp(attraction, 0, 100);
		} else if (sexuality > 60) {
			seed = iterateSeed(seed);
			slave.attrXY = Math.clamp(attraction + jsRandom(-5, 5, undefined, seed), 0, 100);
			seed = iterateSeed(seed);
			slave.attrXX = Math.clamp(attraction + jsRandom(-5, 5, undefined, seed), 0, 100);
		} else {
			slave.attrXY = Math.clamp(attraction, 0, 100);
			attraction -= slave.attrXY;
			slave.attrXX = Math.clamp(attraction, 0, 100);
		}
	}
	seed = iterateSeed(seed);
	slave.attrXX = Math.clamp(slave.attrXX + jsRandom(-5, 5, undefined, seed), 0, 100);
	seed = iterateSeed(seed);
	slave.attrXY = Math.clamp(slave.attrXY + jsRandom(-5, 5, undefined, seed), 0, 100);
};

/**
 * @param {number|string} [seed=undefined]
 * @returns {FC.SlaveState}
 */
globalThis.baseSlave = function(seed) {
	return new App.Entity.SlaveState(seed);
};

/**
 * @param {FC.SlaveState} slave*/
globalThis.generatePronouns = function(slave) {
	if (slave.fuckdoll > 0) {
		slave.pronoun = App.Data.Pronouns.Kind.toy;
	} else if (slave.dick > 0 && slave.vagina === -1 && V.diversePronouns === 1) {
		slave.pronoun = App.Data.Pronouns.Kind.male;
	} else {
		slave.pronoun = App.Data.Pronouns.Kind.female;
	}
};

/**
 * @param {FC.SlaveState} slave
 */
globalThis.generatePuberty = function(slave) {
	if (((slave.ovaries === 1 || slave.mpreg === 1) && slave.physicalAge >= slave.pubertyAgeXX) || slave.pubertyXX === 1) {
		slave.pubertyXX = 1;
		if (V.menstruation === 1 && slave.geneticQuirks.superfetation < 2) {
			slave.fertPeak = jsRandom(0, 3);
		}
	} else {
		if (slave.preg >= -1) {
			slave.preg = 0;
		}
		slave.pubertyXX = 0;
	}
	if ((slave.balls > 0 && slave.ballType !== "sterile" && slave.physicalAge >= slave.pubertyAgeXY) || slave.pubertyXY === 1) {
		slave.pubertyXY = 1;
	} else {
		slave.pubertyXY = 0;
	}
};

/**
 * Apply the effects of an age lift (make them appear younger than they do currently)
 * @param {FC.HumanState} slave
 */
globalThis.applyAgeImplant = function(slave) {
	if (slave.visualAge >= 25) {
		slave.ageImplant = 1;
		/* roughly: 25 -> 19, 35 -> 25, 50 -> 32, 80 -> 40, 130 -> 50 */
		slave.visualAge = Math.round(18.5 * Math.log(slave.visualAge) - 40);
	}
};

/**
 * Makes someone appear older than they do currently
 * @param {FC.HumanState} slave
 */
globalThis.applyAgeImplantOlder = function(slave) {
	if (slave.visualAge < 80) {
		// doesn't currently set ageImplant
		/* roughly: 5 -> 20, 35 -> 45, 50 -> 56, 60 -> 64, 79 -> 80 */
		slave.visualAge = Math.round(0.8 * slave.visualAge + 16);
	}
};

/**
 * Determine whether a given market should apply SMR laws or not.
 * @param {FC.Zeroable<FC.SlaveMarketName | FC.SpecialMarketName>} [market]
 * @returns {boolean}
 */
globalThis.applyLawCheck = function(market) {
	return (typeof market === "string" && !App.Data.misc.lawlessMarkets.includes(market));
};

repo_name: Nithhogg/fc

license: mit


code:
App.UI.SlaveInteract.importSlaveFromJson = () => {
	const el = new DocumentFragment();
	App.UI.DOM.appendNewElement("span", el, `Paste the code into the text box and press enter: `);
	el.append(
		App.UI.DOM.makeTextBox(
			"",
			v => {
				if (v) {
					App.Verify.Utils.verificationError = false;
					let div = App.UI.DOM.makeElement("div");
					App.UI.DOM.appendNewElement("h4", div, "An error occurred!");
					let slave = App.UI.SlaveInteract.importSlaveFromString(v, div);
					if (App.Verify.Utils.verificationError) {
						el.append(div);
					} else {
						newSlave(slave);
						V.temp.AS = slave.ID;
						Engine.play("Slave Interact");
					}
				}
			}
		)
	);
	return el;
};

App.UI.SlaveInteract.importSlaveFromCharacterCard = () => {
	const el = new DocumentFragment();
	App.UI.DOM.appendNewElement("span", el, `Select your character card: `);

	const form = document.createElement("form");
	form.addEventListener("submit", async (e) => {
		e.preventDefault();
		/**
		 * @type {File | undefined}
		 */
		// @ts-ignore
		const pngFile = form.querySelector('input[name="pngFile"]')?.files[0];

		if (!pngFile) {
			alert("No file found. Please contact the maintainers.");
			return;
		}

		const pngAb = await pngFile.arrayBuffer();
		const allTextContent = App.UI.SlaveInteract.SlaveBot.Png.Parse(pngAb);
		const slaveBotObj = Serial.parse(allTextContent);
		/**
		 * Parser returns the stuff we care about under "data".
		 * @type {FC.SlaveBot.CharacterBook}
		 */
		const slaveBotData = slaveBotObj.data;

		if (!slaveBotData?.extensions?.freecitiesJSON) {
			alert("No Free Cities data found from this character card. Maybe it is corrupted?");
			return;
		}
		const slaveString = slaveBotData.extensions.freecitiesJSON;
		let slave = App.UI.SlaveInteract.importSlaveFromString(slaveString);
		newSlave(slave);
		V.temp.AS = slave.ID;
		Engine.play("Slave Interact");
	});

	const input = document.createElement("input");
	input.type = 'file';
	input.accept = "image/png";
	input.name = "pngFile";

	const submitBtn = document.createElement("button");
	submitBtn.type = 'submit';
	submitBtn.innerText = "Submit";

	form.appendChild(input);
	form.appendChild(document.createElement("br"));
	form.appendChild(submitBtn);

	el.append(
		form
	);

	return el;
};

/**
 * @param {string} slaveSrc The output of App.UI.SlaveInteract.exportSlave
 * @param {HTMLDivElement} [div] an optional div, if provide any errors/validation info will be added to it
 * @returns {FC.SlaveState}
 * @see App.UI.SlaveInteract.exportSlave
 */
App.UI.SlaveInteract.importSlaveFromString = (slaveSrc, div) => {
	slaveSrc = slaveSrc.trim();
	// add curly braces if missing
	if (slaveSrc[0] !== "{") { slaveSrc = "{" + slaveSrc; }
	if (slaveSrc.slice(-1) !== "}") { slaveSrc += "}"; }
	// generate slave
	let slave = Serial.parse(slaveSrc);
	slave.ID = generateSlaveID();
	App.Verify.slaveState("<imported>", slave, "none", div);
	if (slave?.assignment) {
		removeJob(slave, slave.assignment);
	}
	return slave;
};

/**
 * @param {FC.SlaveState} slave
 * @returns {string} the json string representing the exported slave
 */
App.UI.SlaveInteract.exportSlave = function(slave) {
	const exportSlave = _.cloneDeep(slave);
	App.Verify.slaveState("<exported>", exportSlave, "none");
	exportSlave.ID = 0;
	return Serial.stringify(exportSlave, null, 2);
};

/**
 * @param {FC.SlaveState} slave
 * @returns {DocumentFragment}
 */
App.UI.SlaveInteract.exportSlaveDocument = function(slave) {
	const el = new DocumentFragment();
	App.UI.DOM.appendNewElement("p", el, `Copy the following block of code for importing: `, "note");
	App.UI.DOM.appendNewElement("textarea", el, App.UI.SlaveInteract.exportSlave(slave), ["export-field"]);
	return el;
};


code:
:: Customize Infant [nobr]

<<set $nextButton = "Continue">>

/* TODO: all of this */
You may enter custom descriptors for your child's hair color, hair style, tattoos, or anything else here. After typing, press enter to commit your change. These custom descriptors will appear in descriptions of your child, but will have no gameplay effect. Changing them is free.

<<if (def $activeChild.custom) && ($activeChild.custom.title != "")>>
	You have instructed $him to always refer to you as $activeChild.custom.title, which, should $he lisp, comes out as $activeChild.custom.titleLisp.
<<else>>
	You expect $him to refer to you as all the other <<if $nurseryChildren > 1>>children and <</if>>slaves do.
<</if>>

<<if def $activeChild.custom>>
	<<if $activeChild.custom.title == "">>
		<<link "Set a custom title for $him to address you as">>
			<<replace "#result">>
				Custom title: <<textbox "$activeChild.custom.title" $activeChild.custom.title>>
				<<link "Apply">>
					<<replace "#result">>
						$He'll try $his best to call you $activeChild.custom.title.
						<<set $activeChild.custom.titleLisp = lispReplace($activeChild.custom.title)>>
					<</replace>>
				<</link>>
			<</replace>>
		<</link>>
	<<else>>
		$He's trying $his best to call you <<textbox "$activeChild.custom.title" $activeChild.custom.title>>

		<<link "Apply">>
			<<replace "#result">>
				$He'll try $his best to call you $activeChild.custom.title.
				<<set $activeChild.custom.titleLisp = lispReplace($activeChild.custom.title)>>
			<</replace>>
		<</link>> |
		<<link "Stop using a custom title">>
			<<replace "#result">>
				$He will no longer refer to you with a special title.
				<<set $activeChild.custom.title = "">>
				<<set $activeChild.custom.titleLisp = "">>
			<</replace>>
		<</link>>
	<</if>>
<</if>>

Change $his given name: <<textbox "$activeChild.slaveName" $activeChild.slaveName>>
/*
<<link "Restore $his birth name">><<set $activeChild.slaveName = $activeChild.birthName>><</link>>
<<if $arcologies[0].FSPastoralist != null>>
	<<if $activeChild.lactation > 0>>
		| <<link "Give $him a random cow given name" "Rename">><<set $activeChild.slaveName = setup.cowSlaveNames.random()>><</link>>
	<</if>>
<</if>>
<<if child.race == "catgirl">>
	| <<link "Give $him a random cat given name" "Rename">><<set $activeChild.slaveName = setup.catSlaveNames.random()>><</link>>
<</if>>
<<if $arcologies[0].FSChattelReligionist != null>>
	| <<link "Give $him a random devotional given name" "Rename">><<set $activeChild.slaveName = setup.chattelReligionistSlaveNames.random()>><</link>>
<</if>>
*/

Change $his surname:
<<if $activeChild.slaveSurname>>
	<<textbox "$activeChild.slaveSurname" $activeChild.slaveSurname>>
<<else>>
	<<textbox "$activeChild.slaveSurname">>
<</if>>
/*
<<link "Restore $his birth surname">><<set $activeChild.slaveSurname = $activeChild.birthSurname>><</link>>
<<if $activeChild.slaveSurname>>
	| <<link "Take $his surname away">><<set $activeChild.slaveSurname = 0>><</link>>
<</if>>
*/
/*
<<if $activeChild.relationship >= 5>>
	<<for _i = 0; _i < $slaves.length; _i++>>
		<<if $activeChild.relationshipTarget == $slaves[_i].ID>>
			<<if $slaves[_i].slaveSurname>>
				<<if $activeChild.slaveSurname != $slaves[_i].slaveSurname>>
					| <<link "Give $him $his wife's surname">><<set $activeChild.slaveSurname = $slaves[_i].slaveSurname>><</link>>
					<<break>>
				<</if>>
			<</if>>
		<</if>>
	<</for>>
<</if>>
<<if $activeChild.relationship == -3>>
	<<if $PC.slaveSurname>>
		<<if $activeChild.slaveSurname != $PC.slaveSurname>>
			| <<link "Give $him your surname">><<set $activeChild.slaveSurname = $PC.slaveSurname>><</link>>
		<</if>>
	<</if>>
<</if>>
*/
/*
<<if $arcologies[0].FSRomanRevivalist != null>>
	| <<link "Give $him a random full Roman name">><<set $activeChild.slaveName = setup.romanSlaveNames.random(), $activeChild.slaveSurname = setup.romanSlaveSurnames.random()>><</link>>
<<elseif $arcologies[0].FSAztecRevivalist != null>>
	| <<link "Give $him a random full Aztec name">><<set $activeChild.slaveName = setup.aztecSlaveNames.random(), $activeChild.slaveSurname = 0>><</link>>
<<elseif $arcologies[0].FSEgyptianRevivalist != null>>
	| <<link "Give $him a random full ancient Egyptian name">><<set $activeChild.slaveName = setup.ancientEgyptianSlaveNames.random(), $activeChild.slaveSurname = 0>><</link>>
<<elseif $arcologies[0].FSEdoRevivalist != null>>
	| <<link "Give $him a random full feudal Japanese name">><<set $activeChild.slaveName = setup.edoSlaveNames.random(), $activeChild.slaveSurname = setup.edoSlaveSurnames.random()>><</link>>
<</if>>
<<if $arcologies[0].FSDegradationist != null>>
	| <<link "Give $him a degrading full name">><<run DegradingName($activeChild)>><</link>>
<</if>>
*/
/*

<<switch $activeChild.hStyle>>
<<case "tails" "dreadlocks" "cornrows">>
$His hair is in $activeChild.hStyle.
<<case "ponytail">>
$His hair is in a $activeChild.hStyle.
<<default>>
$His hair is $activeChild.hStyle.
<</switch>>
Custom hair description: <<textbox "$activeChild.hStyle" $activeChild.hStyle "Add custom descriptors">>

    //For best results, use a short, uncapitalized and unpunctuated description; for example: 'back in a ponytail'//
*/

$His hair is $activeChild.hColor in color.
Custom hair color: <<textbox "$activeChild.hColor" $activeChild.hColor "Add custom descriptors">>

    //For best results, use a short, uncapitalized and unpunctuated description; for example: 'black with purple highlights'//

<<if $activeChild.eyeColor != $activeChild.origEye>>
	$He is wearing $activeChild.eyeColor lenses.
<<else>>
	$He has $activeChild.eyeColor eyes.
<</if>>
Custom eye color: <<textbox "$activeChild.eyeColor" $activeChild.eyeColor "Add custom descriptors">>

    //For best results, use a short, uncapitalized and unpunctuated description; for example: 'blue'//

/*

Change $his origin story: <<textbox "$activeChild.origin" $activeChild.origin "Add custom descriptors">>

    //For best results, use complete, capitalized and punctuated sentences; for example: '$He followed you home from the pet store.'//
*/
/*

Change $his custom description: <<textbox "$activeChild.custom.desc" $activeChild.custom.desc "Add custom descriptors">>

    //For best results, use complete, capitalized and punctuated sentences; for example: '$He has a beauty mark above $his left nipple.'//

Change $his custom label: <<textbox "$activeChild.custom.label" $activeChild.custom.label "Add custom descriptors">>

    //For best results, use a short phrase; for example: 'Breeder.'//
*/
/*

Assign $him a custom image: <input id="customImageValue" type="text">
<<link "Reset" "Add custom descriptors">><<set $activeChild.custom.image = null>><</link>>

    //File must be in// <tt><select id="customImageFormatSelector" style="border: none;"><option value="png">PNG</option><option value="jpg">JPG</option><option value="gif">GIF</option><option value="webm">WEBM</option></select></tt> //format. Place file in the \resources folder. Enter the filename without the extension. For example, for a file with the path// <tt>\bin\resources\headgirl.png</tt>, //enter //<tt>headgirl</tt>.
<>
<<if $seeImages == 1 && $imageChoice == 1>>

	<<if ndef $activeChild.custom.hairVector>><<set $activeChild.custom.hairVector = 0>><</if>>
	Assign $him a custom hair SVG image:
	<<if $activeChild.custom.hairVector != 0>>
		<<textbox "$activeChild.custom.hairVector" $activeChild.custom.hairVector "Add custom descriptors">>
	<<else>>
		<<textbox "$activeChild.custom.hairVector" "" "Add custom descriptors">>
	<</if>>
	<<link "Reset" "Add custom descriptors">><<set $activeChild.custom.hairVector = 0>><</link>>
<</if>>
*/


code:
:: Infant Interact [nobr]

<<if $cheatMode>>
	//[[Cheat Edit Child Alternative|MOD_Edit Child Cheat New][$cheater = 1]]//
<</if>>

<<set $nextButton = "Confirm changes", $nextLink = "AC Dump", $returnTo = "Nursery", _SL = $slaves.length, _CL = $cribs.length>>
<<run App.Utils.setLocalPronouns($activeChild)>>
/* TODO: the encyclopedia will need to be updated for children as well */
<<set $encyclopedia = "Nursery">>

@@.cyan;[←,Q] @@

	<<link "Prev" "Previous Child In Line">><</link>>

    $activeChild.slaveName

	<<link "Next" "Next Child In Line">><</link>>

@@.cyan; [E,→]@@

<<if $seeDetails>>

		<<= App.Facilities.Nursery.LongInfantDescription($activeChild)>>

	[[Options][$nextLink = passage()]] |
	[[Hide descriptions|Infant Interact][$seeDetails = 0]] |
	[[Customize|Customize Infant]] |

	<<link "Update">>
		<<replace "#LCD">>
		<<= App.Facilities.Nursery.LongInfantDescription($activeChild)>>
		<</replace>>
	<</link>>

<<else>>
	//[[Show descriptions|Infant Interact][$seeDetails = 1]]//
<</if>>

Target destination: $activeChild.targetLocation.
<<link "Slavery">>
	<<set $activeChild.targetLocation = "slavery">>
	<<replace "#targetLocation">>$activeChild.targetLocation<</replace>>
<</link>> |
<<link "Freedom">>
	<<set $activeChild.targetLocation = "freedom">>
	<<replace "#targetLocation">>$activeChild.targetLocation<</replace>>
<</link>>