import { jsx as i } from "../../../../../preact@10.29.0/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useMemo as b } from "../../../../../preact@10.29.0/node_modules/preact/hooks/dist/hooks.module.js";
import { F as g } from "./Field-CPoHG0G-.js";
import { S as h } from "./Select-seF9rM5K.js";
import { u as I, ap as D, aq as T } from "./StoreProvider-CBB99upB.js";
try {
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "8824f389-661f-4a0d-bcc9-8982254ec333", e._sentryDebugIdIdentifier = "sentry-dbid-8824f389-661f-4a0d-bcc9-8982254ec333");
} catch {
}
function M({
  name: e = "country",
  data: t,
  valid: d,
  errors: a,
  labels: u,
  readonly: l,
  handleChangeFor: f,
  helperText: y,
  allowedCountries: n,
  handleBlur: m
}) {
  const { t: o } = I("common"), { dataset: s } = D(T.country), c = b(
    () => s.filter(
      (r) => n ? n.includes(r.id) : !0
    ),
    [n, s]
  );
  return /* @__PURE__ */ i(
    g,
    {
      name: e,
      label: u?.country || o((r) => r.country),
      errorMessage: a.country,
      isValid: d.country,
      helper: y,
      dataTestId: "country",
      children: (r) => /* @__PURE__ */ i(
        h,
        {
          ...r,
          name: e,
          placeholder: o((p) => p.selectCountryRegion),
          selected: t.country,
          items: c,
          readonly: (c.length === 1 || l) && !!t,
          onChange: f("country"),
          onBlur: m
        }
      )
    }
  );
}
export {
  M as C
};
