try {
	let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
	n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "b092b243-4cc6-420a-a827-80b36f2ffa5b", e._sentryDebugIdIdentifier = "sentry-dbid-b092b243-4cc6-420a-a827-80b36f2ffa5b");
} catch (e) {}
import { r as useTranslation } from "./translation-Br5wIPO-.js";
import { t as useDataset } from "./useDataset-BRZZoPVn.js";
import { t as datasetIdentifier } from "./datasetUtil-BZmNUckr.js";
import { t as Field } from "./Field-BEqknhTe.js";
import { t as Select } from "./Select-CMFHti4N.js";
import { useMemo } from "preact/hooks";
import { jsx } from "preact/jsx-runtime";
//#region src/components/Shared/fields/CountryField/CountryField.tsx
var COUNTRY_FIELD = ["country"];
function CountryField({ name = "country", data, valid, errors, labels, readonly, handleChangeFor, helperText, allowedCountries, handleBlur }) {
	const { t } = useTranslation("common");
	const { dataset: countriesFromApi } = useDataset(datasetIdentifier.country);
	const countries = useMemo(() => countriesFromApi.filter((country) => allowedCountries ? allowedCountries.includes(country.id) : true), [allowedCountries, countriesFromApi]);
	return /* @__PURE__ */ jsx(Field, {
		name,
		label: labels?.country || t(($) => $["country"]),
		errorMessage: errors.country,
		isValid: valid.country,
		helper: helperText,
		dataTestId: "country",
		children: (childProps) => /* @__PURE__ */ jsx(Select, {
			...childProps,
			name,
			placeholder: t(($) => $["selectCountryRegion"]),
			selected: data.country,
			items: countries,
			readonly: (countries.length === 1 || readonly) && !!data,
			onChange: handleChangeFor("country"),
			onBlur: handleBlur
		})
	});
}
//#endregion
export { CountryField as n, COUNTRY_FIELD as t };
