import { jsx as e } from "../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { ShopperEmailField as A } from "./Fields/ShopperEmailField.js";
import { ShopperPhoneField as B } from "./Fields/ShopperPhoneField.js";
import { CountryRegionField as _ } from "./Fields/CountryRegionField.js";
import { LanguageField as R } from "./Fields/LanguageField.js";
import { BillingAndShippingCheckboxField as b } from "./Fields/BillingAndShippingCheckboxField.js";
import { FormTextInput as t } from "../../../../../internal/FormWrappers/FormTextInput.js";
import { DeliveryAddressSection as c } from "./Fields/Address/DeliveryAddressSection.js";
import { BillingAddressSection as x } from "./Fields/Address/BillingAddressSection.js";
/* empty css                         */
import { PAYMENT_LINK_CREATION_FIELD_LENGTHS as f } from "../../../constants.js";
import { useWizardFormContext as E } from "../../../../../../hooks/form/wizard/WizardFormContext.js";
import { useAddressChecker as O } from "./useAddressChecker.js";
import { useSameAddressCheckbox as F } from "./useSameAddressCheckbox.js";
import T from "../../../../../../core/Context/preact/useCoreContext.js";
import { Fragment as g } from "../../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/dist/preact.module.js";
const S = ({
  isSameAddress: i,
  setIsSameAddress: N,
  countriesData: l,
  isFetchingCountries: m,
  countryDatasetData: p,
  isFetchingCountryDataset: s
}) => {
  const { i18n: a } = T(), { fieldsConfig: o } = E(), { isAddressFieldRequired: d } = O(), { isSameAddressCopyEnabled: r, showBillingFirst: n } = F(), L = o["shopperName.firstName"]?.visible || o["shopperName.lastName"]?.visible, v = !o["billingAddress.street"]?.required, k = !o["deliveryAddress.street"]?.required, y = o["billingAddress.street"]?.visible, h = o["deliveryAddress.street"]?.visible;
  return /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-creation-form__fields-container", children: [
    /* @__PURE__ */ e(
      t,
      {
        fieldName: "shopperReference",
        label: a.get("payByLink.creation.fields.shopperReference.label"),
        maxLength: f.shopperReference.max,
        minLength: f.shopperReference.min
      }
    ),
    L && /* @__PURE__ */ e("div", { className: "adyen-pe-payment-link-creation-form__shopper-name-container", children: [
      /* @__PURE__ */ e(
        t,
        {
          fieldName: "shopperName.firstName",
          label: a.get("payByLink.creation.fields.shopperName.label"),
          maxLength: f.shopperName.firstName.max
        }
      ),
      /* @__PURE__ */ e(
        t,
        {
          maxLength: f.shopperName.lastName.max,
          fieldName: "shopperName.lastName",
          label: a.get("payByLink.creation.fields.shopperLastName.label")
        }
      )
    ] }),
    /* @__PURE__ */ e(A, {}),
    /* @__PURE__ */ e(B, {}),
    /* @__PURE__ */ e(
      _,
      {
        countriesData: l,
        isFetchingCountries: m,
        countryDatasetData: p,
        isFetchingCountryDataset: s
      }
    ),
    h && !n && /* @__PURE__ */ e(g, { children: [
      /* @__PURE__ */ e(
        c,
        {
          isSameAddress: i,
          isAddressFieldRequired: d,
          isOptional: k,
          isSameAddressCopyEnabled: r,
          countriesData: l,
          isFetchingCountries: m,
          countryDatasetData: p,
          isFetchingCountryDataset: s
        }
      ),
      r && /* @__PURE__ */ e(b, { isSameAddress: i, setIsSameAddress: N })
    ] }),
    !n && y && (!r || !i || !h) && /* @__PURE__ */ e(
      x,
      {
        isSameAddress: i,
        isAddressFieldRequired: d,
        isOptional: v,
        isSameAddressCopyEnabled: r,
        countriesData: l,
        isFetchingCountries: m,
        countryDatasetData: p,
        isFetchingCountryDataset: s
      }
    ),
    n && /* @__PURE__ */ e(g, { children: [
      /* @__PURE__ */ e(
        x,
        {
          isSameAddress: i,
          isAddressFieldRequired: d,
          showBillingFirst: n,
          isSameAddressCopyEnabled: r,
          countriesData: l,
          isFetchingCountries: m,
          countryDatasetData: p,
          isFetchingCountryDataset: s
        }
      ),
      r && /* @__PURE__ */ e(
        b,
        {
          isSameAddress: i,
          setIsSameAddress: N,
          showBillingFirst: n
        }
      ),
      (!r || !i) && /* @__PURE__ */ e(
        c,
        {
          isSameAddress: i,
          isAddressFieldRequired: d,
          isOptional: !0,
          isSameAddressCopyEnabled: r,
          countriesData: l,
          isFetchingCountries: m,
          countryDatasetData: p,
          isFetchingCountryDataset: s
        }
      )
    ] }),
    /* @__PURE__ */ e(R, {})
  ] });
};
export {
  S as CustomerDetailsForm
};
