//#region src/pick.ts
function readField(row, field, suffix, locale) {
	const key = `${field}${suffix(locale)}`;
	if (!Object.hasOwn(row, key)) return void 0;
	const val = row[key];
	if (val == null) return void 0;
	return typeof val === "string" ? val : String(val);
}
function pickLocalized(row, locale, opts) {
	const field = opts.field ?? "name";
	const locales = [locale, ...opts.fallbacks ?? []];
	for (const loc of locales) {
		const val = readField(row, field, opts.suffix, loc);
		if (val) return val;
	}
	return "";
}
//#endregion
export { pickLocalized };
