
/**
 *   VERSION: 2.240.0-alpha.1
 *   BUILD_TIMESTAMP: 1780360168537
 *   BUILD_DATE: Tue Jun 02 2026 00:29:28 GMT+0000 (Coordinated Universal Time)
 *   BUILD_COMMIT: 758cedd37e00f49a728d704d9ed36884f0f12d79
 */
import { i as h, j as p, F as w, l as m, w as f, z as I, g as x, R as F, A as E, n as c, B as V, C as j, u as T, D as B } from "../sheerid.js";
import { F as k } from "./FormFieldInputSelect-eZgsxRw0.js";
const z = ({
  value: o,
  isErrored: n,
  options: u,
  onChange: r,
  onKeyDown: y,
  intl: C,
  placeholder: i = "",
  isRequired: d = !0,
  suppressPlaceholder: M = !1,
  disabled: t = !1
}) => /* @__PURE__ */ p.jsx(
  k,
  {
    fieldId: "country",
    options: u,
    onChange: (l) => r(l),
    onKeyDown: y,
    placeholder: i || C.formatHTMLMessage({ id: "countryPlaceholder", defaultMessage: "Country" }),
    value: u.find((l) => l.value === (o && o.value)),
    isRequired: d,
    label: /* @__PURE__ */ p.jsx(w, { id: "country", defaultMessage: "Country" }),
    errorMessage: n && /* @__PURE__ */ p.jsx(w, { id: "errorId.invalidCountry", defaultMessage: "Invalid country" }),
    showPlaceholderAndHideLabel: !!i,
    suppressPlaceholder: M,
    disabled: t
  }
), H = h(z), R = ({
  verificationService: o,
  viewModelDraftDecorator: n = void 0,
  intl: u,
  viewModel: r = void 0,
  nextFocusField: y = void 0,
  disabled: C = !1
}) => {
  r && m.warn("viewModel prop is deprecated, use verificationService.viewModel instead"), y && m.warn("nextFocusField prop is deprecated");
  const i = f(() => r.localeChoice.value, "en-US"), d = I(
    o.programTheme,
    u,
    i
  ), { fieldValidationErrors: M } = o, t = d.length > 1, g = x("country")?.hidden, l = (e) => {
    const s = c(
      o.viewModel,
      (a) => {
        a.countryChoice = e || void 0, a.country = e ? e.value : void 0, n && n(a, e), a.organization && (a.organization = B.organization);
      }
    );
    o.updateViewModel(s);
  };
  return F.useEffect(() => {
    const e = d.some((s) => s.value === "US");
    if (!t && !e) {
      const s = o.viewModel.fieldsToSkipValidation ? [...o.viewModel.fieldsToSkipValidation, "country"] : ["country", "address1", "postalCode", "state", "city"];
      o.updateViewModel(
        E(
          o.viewModel,
          "fieldsToSkipValidation",
          s
        )
      );
    }
  }, [t]), F.useEffect(() => {
    const e = c(
      o.fieldValidationErrors,
      (s) => {
        s.country && (s.country = V(
          "country",
          o.viewModel.countryChoice,
          o.formValidationOptions
        )), "postalCode" in o.viewModel && o.viewModel.postalCode && (s.postalCode = V(
          "postalCode",
          o.viewModel.postalCode,
          o.formValidationOptions
        ));
      }
    );
    j(e, o);
  }, [o.viewModel.countryChoice]), !t || g ? null : /* @__PURE__ */ p.jsx(
    H,
    {
      isRequired: !0,
      options: d,
      value: o.viewModel.countryChoice,
      isErrored: !!M.country,
      disabled: C,
      onChange: async (e) => {
        const s = e ? e.value : void 0;
        l(e), T("country", s, o);
      }
    }
  );
}, O = h(R);
export {
  O as C
};
