import { jsx as n } from "../../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useWizardFormContext as p } from "../../../../../../../../hooks/form/wizard/WizardFormContext.js";
import { useCallback as m } from "../../../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { FormTextInput as f } from "../../../../../../../internal/FormWrappers/FormTextInput.js";
import { PAYMENT_LINK_CREATION_FIELD_LENGTHS as u } from "../../../../../constants.js";
import C from "../../../../../../../../core/Context/preact/useCoreContext.js";
const L = ({
  isSameAddress: e,
  isAddressFieldRequired: t,
  isSameAddressCopyEnabled: o = !1
}) => {
  const { i18n: s } = C(), { setValue: r, fieldsConfig: i } = p(), l = m(
    (a) => {
      o && e && r("billingAddress.postalCode", a.currentTarget.value);
    },
    [e, r, o]
  ), d = i["deliveryAddress.postalCode"]?.required || t("deliveryAddress.postalCode");
  return /* @__PURE__ */ n(
    f,
    {
      maxLength: u.deliveryAddress.postalCode.max,
      fieldName: "deliveryAddress.postalCode",
      label: s.get("payByLink.creation.fields.deliveryAddress.postalCode.label"),
      onInput: l,
      className: "adyen-pe-payment-link-creation-form__shipping-address-field--small",
      hideOptionalLabel: !0,
      isRequired: d
    }
  );
};
export {
  L as ShippingPostalCodeField
};
