import { jsx as t } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
/* empty css                        */
import a from "../../../../internal/Typography/Typography.js";
import { TypographyVariant as d } from "../../../../internal/Typography/types.js";
import { TermsAndConditions as p } from "./TermsAndConditions.js";
import l from "../PaymentLinkSettingsContainer/context/context.js";
import { useState as y, useEffect as f } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import g from "classnames";
import { isTermsAndConditionsData as u } from "../PaymentLinkThemeContainer/types.js";
import h from "../PaymentLinkSettingsContainer/components/SettingsError/SettingsError.js";
import C from "../PaymentLinkSettingsContainer/components/LoadingSkeleton/LoadingSkeleton.js";
import k from "../../../../../core/Context/preact/useCoreContext.js";
const A = "payByLink.settings.termsAndConditions.errors.couldNotLoad", R = () => {
  const { i18n: i } = k(), { savedData: n, isLoadingContent: o, termsAndConditionsError: e, isShowingRequirements: m } = l(), [r, s] = y();
  return f(() => {
    if (!o && !e) {
      const c = n && typeof n == "object" && Object.keys(n).length > 0 ? n : { termsOfServiceUrl: "" };
      s(c);
    }
  }, [n, s, o, e]), e ? /* @__PURE__ */ t(h, { error: e, errorMessage: A }) : !u(n) || !r ? /* @__PURE__ */ t(C, { rowNumber: 2 }) : /* @__PURE__ */ t("section", { className: "adyen-pe-payment-link-settings-terms-and-conditions", children: [
    /* @__PURE__ */ t(
      "div",
      {
        className: g("adyen-pe-payment-link-settings-terms-and-conditions__content-header", {
          "adyen-pe-payment-link-settings-terms-and-conditions__content-header--hidden": m
        }),
        children: /* @__PURE__ */ t("div", { className: "adyen-pe-payment-link-settings-terms-and-conditions__content-header", children: [
          /* @__PURE__ */ t(a, { variant: d.TITLE, medium: !0, children: i.get("payByLink.settings.termsAndConditions.title") }),
          /* @__PURE__ */ t(a, { variant: d.BODY, wide: !0, className: "adyen-pe-payment-link-settings-terms-and-conditions-disclaimer", children: i.get("payByLink.settings.termsAndConditions.subtitle") })
        ] })
      }
    ),
    /* @__PURE__ */ t(p, { data: n, initialData: r })
  ] });
};
export {
  R as default
};
