
/**
 *   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 { n as f, k as N, V as M, a4 as F, _ as P, j as s, P as T, g as d, u as l, F as h, a5 as q, a1 as R, m as V, $ as O, Y as k, i as B, f as z } from "../sheerid.js";
import { u as L } from "./useCollectFieldsEndpoint-LiPgcPuU.js";
import { i as A } from "./FormFieldText-CPwStdCx.js";
import { C as w } from "./CountryComponentWrapper-DCc0WoEp.js";
import { F as W, L as H, B as K, P as Y, a as _, M as $, C as G } from "./CaptchaComponent-DJipDl-5.js";
import { E as J, P as Q } from "./PersonalInfoStepSubmitButton-q2ua_b8H.js";
import { S as U } from "./StatusComponent-3TC4ZCSc.js";
import { B as X, D as Z, A as S } from "./ActiveDutyStartDateComponent-ePBj1LAb.js";
import { A as v } from "./AddressComponent-DQhZnZaO.js";
import { C as aa } from "./City-Cfa2Pzsi.js";
import { S as ea } from "./StateSelectComponent-Bm90RcsV.js";
import { P as sa } from "./PostalCodeComponent-BCYXpkvf.js";
import { C as ta } from "./ChangeLocaleComponent-D317H5S8.js";
import { P as oa } from "./PersonalInfoStepWrapper-BCVAx0W6.js";
const da = (m, e, t, o) => {
  const r = t.viewModel;
  return f(r, (i) => {
    i[m] = e;
    const y = ["status"];
    i.fieldsToSkipValidation = (i.fieldsToSkipValidation || []).filter(
      (C) => !y.includes(C)
    ), (!o || o.length === 0) && i.fieldsToSkipValidation.push("status"), m === "status" && (i.organization = { id: 0, name: "" });
  });
}, la = ({ intl: m, verificationService: e }) => {
  const t = e.viewModel, { fieldValidationErrors: o } = e, r = e.verificationResponse, i = N(r), C = r.currentStep === M.collectInactiveMilitaryPersonalInfo || !!e.programTheme.transitionalMilitaryValidityDays ? [{ key: "dischargeDate" }] : [], {
    availableStatuses: j,
    isFieldRequired: D,
    isFieldOptional: p
  } = L({
    verificationId: r.verificationId,
    currentStep: M.collectMilitaryPersonalInfo,
    viewModel: t,
    defaultRequiredFields: C
  }), I = t.countryChoice?.value, x = A(
    e.programTheme,
    I
  ), g = F(
    m,
    j ?? r.availableStatuses ?? e.previousVerificationResponse?.availableStatuses
  ), b = t.localeChoice.value, c = z(), E = D("dischargeDate") || p("dischargeDate"), n = (a, u) => {
    e.updateViewModel(
      da(a, u, e, g)
    );
  };
  return P(), /* @__PURE__ */ s.jsxs(
    oa,
    {
      verificationService: e,
      step: r.currentStep,
      className: "sid-military-personal-info-container",
      children: [
        /* @__PURE__ */ s.jsx(
          T,
          {
            verificationService: e,
            classNameIdentifier: "active-military-personal-info"
          }
        ),
        /* @__PURE__ */ s.jsxs(s.Fragment, { children: [
          /* @__PURE__ */ s.jsx(ta, { verificationService: e }),
          /* @__PURE__ */ s.jsx(
            w,
            {
              verificationService: e,
              disabled: d("country")?.disabled
            }
          ),
          g.length > 0 ? /* @__PURE__ */ s.jsx(
            U,
            {
              segmentId: "military",
              value: {
                value: t.status,
                label: q(m, t.status)
              },
              isErrored: !!o.status,
              errorId: "invalidMilitaryStatus",
              options: g,
              disabled: x || d("status")?.disabled,
              explanation: x ? /* @__PURE__ */ s.jsx(h, { id: "chooseCountry", defaultMessage: "Choose a country first" }) : void 0,
              onChange: (a) => {
                n("status", a ? a.value : ""), l(
                  "status",
                  a ? a.value : "",
                  e
                );
              }
            }
          ) : null,
          /* @__PURE__ */ s.jsx(
            X,
            {
              isErrored: !!o.organization,
              onChange: (a) => {
                R(a, e), l("organization", a, e);
              },
              value: {
                value: t.organization.id,
                label: t.organization.name
              },
              verificationService: e,
              disabled: d("organization")?.disabled
            }
          ),
          /* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [
            /* @__PURE__ */ s.jsx(
              W,
              {
                value: t.firstName,
                isErrored: !!o.firstName,
                disabled: d("firstName")?.disabled,
                onChange: (a) => {
                  n("firstName", a), l("firstName", a, e);
                }
              }
            ),
            /* @__PURE__ */ s.jsx(
              H,
              {
                value: t.lastName,
                isErrored: !!o.lastName,
                disabled: d("lastName")?.disabled,
                onChange: (a) => {
                  n("lastName", a), l("lastName", a, e);
                }
              }
            )
          ] }),
          /* @__PURE__ */ s.jsx(
            K,
            {
              errorId: o.birthDate,
              locale: b,
              onChange: (a) => {
                n("birthDate", a), l("birthDate", a, e);
              },
              value: t.birthDate,
              disabled: d("birthDate")?.disabled
            }
          ),
          E && /* @__PURE__ */ s.jsx(
            Z,
            {
              mode: e.programTheme.transitionalMilitaryValidityDays ? "date" : "month",
              errorId: o.dischargeDate,
              onChange: (a) => {
                n("dischargeDate", a), l("dischargeDate", a, e);
              },
              value: t.dischargeDate,
              locale: b,
              disabled: d("dischargeDate")?.disabled,
              isRequired: D("dischargeDate")
            }
          ),
          e.programTheme.strictMilitaryValidationEnabled && /* @__PURE__ */ s.jsx(
            S,
            {
              errorId: o.activeDutyStartDate,
              locale: b,
              onChange: (a) => {
                n("activeDutyStartDate", a), l(
                  "activeDutyStartDate",
                  a,
                  e
                );
              },
              value: t.activeDutyStartDate,
              disabled: d("activeDutyStartDate")?.disabled,
              isRequired: d("activeDutyStartDate")?.requireIfOptional
            }
          ),
          /* @__PURE__ */ s.jsx(
            J,
            {
              value: t.email,
              isErrored: !!o.email,
              explanation: /* @__PURE__ */ s.jsx(
                h,
                {
                  id: "emailExplanation",
                  defaultMessage: "Personal email address is recommended"
                }
              ),
              onChange: (a) => {
                n("email", a), l("email", a, e);
              },
              onKeyDown: (a) => V(a),
              disabled: d("email")?.disabled
            }
          ),
          e.programTheme.isSmsNotifierConfigured || e.programTheme.smsLoopEnabled ? /* @__PURE__ */ s.jsx(
            Y,
            {
              isRequired: !!e.programTheme.smsLoopEnabled,
              value: t.phoneNumber,
              isErrored: !!o.phoneNumber,
              onChange: (a) => {
                n("phoneNumber", a), l("phoneNumber", a, e);
              },
              selectedCountryCode: t.countryChoice && t.countryChoice.value,
              disabled: d("phoneNumber")?.disabled
            }
          ) : null,
          p("address1") && /* @__PURE__ */ s.jsx(
            v,
            {
              value: t.address1,
              isErrored: !!o.address1,
              errorId: o.address1,
              disabled: d("address1")?.disabled,
              onChange: (a) => {
                n("address1", a), l("address1", a, e);
              },
              isRequired: d("address1")?.requireIfOptional
            }
          ),
          p("city") && /* @__PURE__ */ s.jsx(
            aa,
            {
              value: t.city,
              isErrored: !!o.city,
              errorId: o.city,
              disabled: d("city")?.disabled,
              onChange: (a) => {
                n("city", a), l("city", a, e);
              },
              isRequired: d("city")?.requireIfOptional
            }
          ),
          p("state") && /* @__PURE__ */ s.jsx(
            ea,
            {
              options: O(e.programTheme, m),
              value: t.state || void 0,
              isErrored: !!o.state,
              onChange: async (a) => {
                const u = a ? a.value : void 0;
                n("state", u), l("state", u, e);
              },
              label: /* @__PURE__ */ s.jsx(h, { id: "state", defaultMessage: "State" }),
              disabled: d("state")?.disabled,
              isRequired: d("state")?.requireIfOptional
            }
          ),
          p("postalCode") && /* @__PURE__ */ s.jsx(
            sa,
            {
              required: d("postalCode")?.requireIfOptional,
              isErrored: !!o.postalCode,
              onChange: (a) => {
                n("postalCode", a), l("postalCode", a, e);
              },
              value: t.postalCode,
              disabled: d("postalCode")?.disabled
            }
          ),
          c.customFormFields.map((a) => /* @__PURE__ */ s.jsx(_, { config: a, verificationService: e })),
          /* @__PURE__ */ s.jsx(
            $,
            {
              verificationService: e,
              isErrored: !!o.marketConsentValue,
              onChange: (a) => {
                n("metadata", {
                  ...e.viewModel.metadata,
                  marketConsentValue: a
                }), l(
                  "marketConsentValue",
                  a,
                  e
                );
              },
              viewModel: t,
              disabled: d("marketConsentValue")?.disabled
            }
          ),
          /* @__PURE__ */ s.jsx(k, { verificationService: e, suffix: "CollectAboveSubmit" }),
          /* @__PURE__ */ s.jsx(
            G,
            {
              verificationService: e,
              isErrored: !!o.captchaToken
            }
          ),
          /* @__PURE__ */ s.jsx(
            Q,
            {
              step: r.currentStep,
              verificationService: e,
              viewModel: t,
              failedInstantMatch: i,
              buttonText: /* @__PURE__ */ s.jsx(
                h,
                {
                  id: "step.personalInfo.submitButtonText",
                  defaultMessage: "Verify My Military Status"
                }
              )
            }
          )
        ] })
      ]
    }
  );
}, ja = B(la);
export {
  la as StepCollectMilitaryPersonalInfo,
  ja as StepCollectMilitaryPersonalInfoComponent,
  ja as default
};
