
/**
 *   WARNING: This file is intended to be used within MySheerID.
 *   This file is not intended for use in other contexts and there are no guarantees about its behavior outside of MySheerID.
 */ 
/**
 *   VERSION: 2.240.0-alpha.1
 *   BUILD_TIMESTAMP: 1780360182346
 *   BUILD_DATE: Tue Jun 02 2026 00:29:42 GMT+0000 (Coordinated Universal Time)
 *   BUILD_COMMIT: 758cedd37e00f49a728d704d9ed36884f0f12d79
 */
import { i as I, h as F, a2 as P, a3 as M, t as c, R, u as d, j as o, P as D, g as r, e as A, F as u, Y as T, V, A as k, b as q } from "../_mysheerid-preview.js";
import { u as B } from "./useCollectFieldsEndpoint-CeZbL8AL.js";
import { F as L, L as U, B as W, P as w, a as H, M as K, C as O } from "./CaptchaComponent-BO7aZ1L_.js";
import { E as Y, P as z } from "./PersonalInfoStepSubmitButton-BYxvA1Od.js";
import { P as G } from "./PostalCodeComponent-CAw364H-.js";
import { C as J } from "./CountryComponentWrapper-CcxnPF_R.js";
import { C as Q } from "./City-ZWfRdxoz.js";
import { A as X } from "./AddressComponent-DUqzTLlm.js";
import { C as Z } from "./ChangeLocaleComponent-B5F9Azun.js";
import { P as _ } from "./PersonalInfoStepWrapper-dlBiMSvG.js";
const $ = ({ verificationService: s, intl: C }) => {
  const a = s.viewModel, { fieldValidationErrors: t } = s, l = s.verificationResponse, h = F(l), b = P(
    s.programTheme,
    C
  ), i = M(b), m = c(() => a.countryChoice.value, i.value), g = m === "US" ? [{ key: "postalCode" }] : [], x = m !== "US" || s.programTheme.isSmsNotifierConfigured || s.programTheme.smsLoopEnabled, N = m !== "US" || s.programTheme.smsLoopEnabled, y = a.localeChoice.value, j = q();
  !t.phoneNumber && l.errorIds && l.errorIds.includes("invalidPhoneNumber") && s.updateFieldValidationErrors({
    ...t,
    phoneNumber: "invalidPhoneNumber"
  });
  const n = (e, E) => {
    const f = k(a, e, E);
    s.updateViewModel(f);
  }, { isFieldRequired: p } = B({
    verificationId: l.verificationId,
    currentStep: l.currentStep,
    viewModel: a,
    defaultRequiredFields: g
  });
  return R.useEffect(() => {
    d("phoneNumber", a.phoneNumber, s);
  }, [a.country]), /* @__PURE__ */ o.jsxs(
    _,
    {
      verificationService: s,
      step: l.currentStep,
      children: [
        /* @__PURE__ */ o.jsx(D, { verificationService: s, classNameIdentifier: "age" }),
        /* @__PURE__ */ o.jsx(Z, { verificationService: s }),
        /* @__PURE__ */ o.jsx(
          J,
          {
            verificationService: s,
            disabled: r("country")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsxs("div", { className: "sid-names", children: [
          /* @__PURE__ */ o.jsx(
            L,
            {
              value: a.firstName,
              isErrored: !!t.firstName,
              disabled: r("firstName")?.disabled,
              onChange: (e) => {
                n("firstName", e), d("firstName", e, s);
              }
            }
          ),
          /* @__PURE__ */ o.jsx(
            U,
            {
              value: a.lastName,
              isErrored: !!t.lastName,
              disabled: r("lastName")?.disabled,
              onChange: (e) => {
                n("lastName", e), d("lastName", e, s);
              }
            }
          )
        ] }),
        /* @__PURE__ */ o.jsx(
          W,
          {
            errorId: t.birthDate,
            locale: y,
            onChange: (e) => {
              n("birthDate", e), d("birthDate", e, s);
            },
            value: a.birthDate,
            disabled: r("birthDate")?.disabled
          }
        ),
        p("city") && /* @__PURE__ */ o.jsx(
          Q,
          {
            value: a.city,
            isRequired: !0,
            isErrored: !!t.city,
            errorId: t.city,
            disabled: r("city")?.disabled,
            onChange: (e) => {
              n("city", e), d("city", e, s);
            }
          }
        ),
        p("address1") && /* @__PURE__ */ o.jsx(
          X,
          {
            value: a.address1,
            isRequired: !0,
            isErrored: !!t.address1,
            errorId: t.address1,
            onChange: (e) => {
              n("address1", e), d("address1", e, s);
            }
          }
        ),
        p("postalCode") && /* @__PURE__ */ o.jsx(
          G,
          {
            isErrored: !!t.postalCode,
            onChange: (e) => {
              n("postalCode", e), d("postalCode", e, s);
            },
            value: a.postalCode,
            disabled: r("postalCode")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(
          Y,
          {
            value: a.email,
            isErrored: !!t.email,
            explanation: /* @__PURE__ */ o.jsx(u, { id: "emailExplanation", defaultMessage: " " }),
            onChange: (e) => {
              n("email", e), d("email", e, s);
            },
            onKeyDown: (e) => A(e),
            disabled: r("email")?.disabled
          }
        ),
        x ? /* @__PURE__ */ o.jsx(
          w,
          {
            isRequired: N,
            value: a.phoneNumber,
            isErrored: !!t.phoneNumber,
            onChange: (e) => {
              n("phoneNumber", e), d("phoneNumber", e, s);
            },
            selectedCountryCode: a.countryChoice && a.countryChoice.value,
            disabled: r("phoneNumber")?.disabled
          }
        ) : null,
        j.customFormFields.map((e) => /* @__PURE__ */ o.jsx(H, { config: e, verificationService: s })),
        /* @__PURE__ */ o.jsx(
          K,
          {
            verificationService: s,
            isErrored: !!t.marketConsentValue,
            onChange: (e) => {
              n("metadata", {
                ...s.viewModel.metadata,
                marketConsentValue: e
              }), d("marketConsentValue", e, s);
            },
            viewModel: a,
            disabled: r("marketConsentValue")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(T, { verificationService: s, suffix: "CollectAboveSubmit" }),
        /* @__PURE__ */ o.jsx(
          O,
          {
            verificationService: s,
            isErrored: !!t.captchaToken
          }
        ),
        /* @__PURE__ */ o.jsx(
          z,
          {
            step: V.collectAgePersonalInfo,
            verificationService: s,
            viewModel: a,
            failedInstantMatch: h,
            buttonText: /* @__PURE__ */ o.jsx(
              u,
              {
                id: "step.personalInfo.submitButtonText",
                defaultMessage: "Verify and continue"
              }
            )
          }
        )
      ]
    }
  );
}, le = I($);
export {
  le as default
};
