;
{
  try {
    let e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}, n = new e.Error().stack;
    n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "17894158-664c-4fe5-a0b7-e865694f3b45", e._sentryDebugIdIdentifier = "sentry-dbid-17894158-664c-4fe5-a0b7-e865694f3b45");
  } catch (e) {
  }
}
;
import { jsxs, jsx } from "preact/jsx-runtime";
import { F as Field } from "./Field-BL3Mh7gm.js";
import { I as InputText } from "./InputText-DRSK56ma.js";
import { c as createFormUtils } from "./formUtils-CwOJPw6N.js";
import { u as useTranslation } from "./StoreProvider-CqQrndhS.js";
const nameFields = ["firstName", "lastName"];
function Name(props) {
  const { data, handleFieldChange, errors, valid, fieldValidationErrors } = props;
  const { t } = useTranslation("common");
  if (!handleFieldChange) {
    return;
  }
  const formUtils = createFormUtils(props, t);
  return /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-field-wrapper", children: [
    formUtils.isRequiredField("firstName") && /* @__PURE__ */ jsx(
      Field,
      {
        name: "firstName",
        label: formUtils.getLabel("firstName"),
        className: "adyen-kyc-u-width-half",
        errorMessage: formUtils.getErrorMessage("firstName", errors, fieldValidationErrors),
        isValid: valid?.firstName,
        helper: formUtils.getLabel("enterNameExactlyAsAppearInID"),
        children: (childProps) => /* @__PURE__ */ jsx(
          InputText,
          {
            ...childProps,
            name: "firstName",
            value: data?.firstName,
            readonly: formUtils.isReadOnly("firstName"),
            onInput: handleFieldChange("firstName", "input"),
            onBlur: handleFieldChange("firstName", "blur"),
            trimOnBlur: true,
            spellCheck: false,
            "aria-required": true,
            "aria-invalid": !valid?.firstName
          }
        )
      }
    ),
    formUtils.isRequiredField("lastName") && /* @__PURE__ */ jsx(
      Field,
      {
        name: "lastName",
        label: formUtils.getLabel("lastName"),
        className: "adyen-kyc-u-width-half",
        errorMessage: formUtils.getErrorMessage("lastName", errors, fieldValidationErrors),
        isValid: valid?.lastName,
        helper: formUtils.getLabel("enterLastNameExactlyAsAppearInID"),
        children: (childProps) => /* @__PURE__ */ jsx(
          InputText,
          {
            ...childProps,
            name: "lastName",
            value: data?.lastName,
            readonly: formUtils.isReadOnly("lastName"),
            onInput: handleFieldChange("lastName", "input"),
            onBlur: handleFieldChange("lastName", "blur"),
            trimOnBlur: true,
            spellCheck: false,
            "aria-required": true,
            "aria-invalid": !valid?.lastName
          }
        )
      }
    )
  ] });
}
export {
  Name as N,
  nameFields as n
};
