
/**
 *   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.239.0-alpha.0
 *   BUILD_TIMESTAMP: 1780013005605
 *   BUILD_DATE: Fri May 29 2026 00:03:25 GMT+0000 (Coordinated Universal Time)
 *   BUILD_COMMIT: 3344b6c0fd9fa858907db310cfb1ef5e0d224da2
 */
import { i as P, G as x, q as I, h as L, a4 as c, R as F, N as V, j as o, P as w, g as d, k as E, D as O, u as n, F as i, a5 as B, I as R, a1 as k, $ as z, e as D, V as A, b as q } from "../_mysheerid-preview.js";
import { F as _, L as S, B as G, P as H, a as W, M as K, C as U } from "./CaptchaComponent-D-uHsjvA.js";
import { E as Y, P as $ } from "./PersonalInfoStepSubmitButton-Z9sp6sjQ.js";
import { S as J } from "./StatusComponent-SifKfxUA.js";
import { E as Q, L as X } from "./EBTCardNumberComponent-C2Ie_9Ee.js";
import { P as Z } from "./PostalCodeComponent-CAw364H-.js";
import { C as v } from "./ChangeLocaleComponent-B5F9Azun.js";
import { C as ss } from "./CountryComponentWrapper-CE7M9L4O.js";
import { A as es } from "./AddressComponent-DUqzTLlm.js";
import { C as as } from "./City-ZWfRdxoz.js";
import { S as os } from "./StateSelectComponent-DJIfavwM.js";
import { P as ts } from "./PersonalInfoStepWrapper-DgSuVlBj.js";
import { u as ds } from "./useCollectFieldsEndpoint-BI8aEDFI.js";
import { i as ns } from "./FormFieldText-BEmRFdkH.js";
const rs = ({
  intl: C,
  verificationService: e
}) => {
  const { viewModel: a } = e, N = q();
  if (!x(a))
    return I.error("Expected LowIncomePersonalInfoViewModel"), null;
  const { fieldValidationErrors: t } = e, { verificationResponse: m } = e, j = L(
    m
  ), { availableStatuses: y } = ds({
    verificationId: m.verificationId,
    currentStep: m.currentStep,
    viewModel: a
  }), M = a.countryChoice?.value, h = ns(
    e.programTheme,
    M
  ), f = c(
    C,
    y ?? m.availableStatuses
  ), T = a.localeChoice.value, u = a.statuses[0] ? a.statuses[0] : void 0, g = u === "SNAP_BENEFITS", r = (s, l) => {
    if (!x(a)) {
      I.error("Expected LowIncomePersonalInfoViewModel");
      return;
    }
    const b = E(
      a,
      (p) => {
        p[s] = l;
      }
    );
    e.updateViewModel(b);
  };
  return F.useEffect(() => {
    g && V({ fieldsToSkipValidation: ["organization"] });
  }, [g]), /* @__PURE__ */ o.jsxs(
    ts,
    {
      verificationService: e,
      step: m.currentStep,
      children: [
        /* @__PURE__ */ o.jsx(
          w,
          {
            verificationService: e,
            classNameIdentifier: "low-income"
          }
        ),
        /* @__PURE__ */ o.jsx(v, { verificationService: e }),
        /* @__PURE__ */ o.jsx(
          ss,
          {
            verificationService: e,
            disabled: d("country")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(
          J,
          {
            segmentId: "low-income",
            value: {
              value: a.statuses ? a.statuses[0] : "",
              label: a.statuses ? B(C, a.statuses[0]) : ""
            },
            isErrored: !!t.statuses,
            disabled: h || d("status")?.disabled,
            options: f,
            explanation: h ? /* @__PURE__ */ o.jsx(i, { id: "chooseCountry", defaultMessage: "Choose a country first" }) : void 0,
            onChange: (s) => {
              const l = s ? [s.value] : [], b = E(
                a,
                (p) => {
                  a.statuses[0] !== l[0] && (p.organization = O.organization), p.statuses = l;
                }
              );
              e.updateViewModel(b), n(
                "statuses",
                s ? s.value : "",
                e
              );
            }
          }
        ),
        u === "SNAP_BENEFITS" && /* @__PURE__ */ o.jsx(
          Q,
          {
            value: a.ebtCardNumber,
            isErrored: !!t.ebtCardNumber,
            disabled: d("ebtCardNumber")?.disabled,
            onChange: (s) => {
              r("ebtCardNumber", s), n("ebtCardNumber", s, e);
            }
          }
        ),
        (u === "OTHER_GOVERNMENT_ASSISTANCE" || u === "COMMUNITY_ELIGIBILITY_PROVISION") && /* @__PURE__ */ o.jsx(
          X,
          {
            isErrored: !!t.organization,
            onChange: (s) => {
              k(s, e), n("organization", s, e);
            },
            value: R(e.viewModel.organization),
            verificationService: e,
            isRequired: !0,
            disabled: d("organization")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsxs("div", { className: "sid-names", children: [
          /* @__PURE__ */ o.jsx(
            _,
            {
              value: a.firstName,
              isErrored: !!t.firstName,
              disabled: d("firstName")?.disabled,
              onChange: (s) => {
                r("firstName", s), n("firstName", s, e);
              }
            }
          ),
          /* @__PURE__ */ o.jsx(
            S,
            {
              value: a.lastName,
              isErrored: !!t.lastName,
              disabled: d("lastName")?.disabled,
              onChange: (s) => {
                r("lastName", s), n("lastName", s, e);
              }
            }
          )
        ] }),
        /* @__PURE__ */ o.jsx(
          G,
          {
            errorId: t.birthDate,
            locale: T,
            disabled: d("birthDate")?.disabled,
            onChange: (s) => {
              r("birthDate", s), n("birthDate", s, e);
            },
            value: a.birthDate
          }
        ),
        /* @__PURE__ */ o.jsx(
          es,
          {
            isErrored: !!t.address1,
            errorId: t.address1,
            disabled: d("address1")?.disabled,
            onChange: (s) => {
              r("address1", s), n("address1", s, e);
            },
            value: a.address1,
            isRequired: !0,
            explanation: /* @__PURE__ */ o.jsx(i, { id: "addressExplanation", defaultMessage: "Use your home address" })
          }
        ),
        /* @__PURE__ */ o.jsxs("div", { className: "sid-address-extra-fields sid-thirds", children: [
          /* @__PURE__ */ o.jsx(
            as,
            {
              isErrored: !!t.city,
              errorId: t.city,
              onChange: (s) => {
                r("city", s), n("city", s, e);
              },
              value: a.city,
              isRequired: !0,
              disabled: d("city")?.disabled
            }
          ),
          /* @__PURE__ */ o.jsx(
            os,
            {
              isRequired: !0,
              options: z(e.programTheme, C),
              value: a.state || void 0,
              isErrored: !!t.state,
              disabled: d("state")?.disabled,
              onChange: async (s) => {
                const l = s ? s.value : void 0;
                r("state", l), n("state", l, e);
              }
            }
          ),
          /* @__PURE__ */ o.jsx(
            Z,
            {
              isErrored: !!t.postalCode,
              onChange: (s) => {
                r("postalCode", s), n("postalCode", s, e);
              },
              value: a.postalCode,
              disabled: d("postalCode")?.disabled
            }
          )
        ] }),
        /* @__PURE__ */ o.jsx(
          Y,
          {
            value: a.email,
            isErrored: !!t.email,
            explanation: /* @__PURE__ */ o.jsx(i, { id: "emailExplanation", defaultMessage: " " }),
            onChange: (s) => {
              r("email", s), n("email", s, e);
            },
            onKeyDown: (s) => D(s),
            disabled: d("email")?.disabled
          }
        ),
        e.programTheme.isSmsNotifierConfigured || e.programTheme.smsLoopEnabled ? /* @__PURE__ */ o.jsx(
          H,
          {
            isRequired: !!e.programTheme.smsLoopEnabled,
            value: a.phoneNumber,
            isErrored: !!t.phoneNumber,
            onChange: (s) => {
              r("phoneNumber", s), n("phoneNumber", s, e);
            },
            selectedCountryCode: a.countryChoice && a.countryChoice.value,
            disabled: d("phoneNumber")?.disabled
          }
        ) : null,
        (N.customFormFields || []).map((s) => /* @__PURE__ */ o.jsx(W, { config: s, verificationService: e })),
        " ",
        /* @__PURE__ */ o.jsx(
          K,
          {
            verificationService: e,
            isErrored: !!t.marketConsentValue,
            onChange: (s) => {
              r("metadata", {
                ...e.viewModel.metadata,
                marketConsentValue: s
              }), n("marketConsentValue", s, e);
            },
            viewModel: a,
            disabled: d("marketConsentValue")?.disabled
          }
        ),
        /* @__PURE__ */ o.jsx(
          U,
          {
            verificationService: e,
            isErrored: !!t.captchaToken
          }
        ),
        /* @__PURE__ */ o.jsx(
          $,
          {
            step: A.collectLowIncomePersonalInfo,
            verificationService: e,
            viewModel: a,
            failedInstantMatch: j,
            buttonText: /* @__PURE__ */ o.jsx(
              i,
              {
                id: "step.personalInfo.submitButtonText",
                defaultMessage: "Verify Status"
              }
            )
          }
        )
      ]
    }
  );
}, ys = P(rs);
export {
  ys as default
};
