import { jsx as s } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useState as u, useCallback as r } from "../../../../../external/.pnpm/preact@10.28.2/node_modules/preact/hooks/dist/hooks.module.js";
import { PaymentLinkDetails as f } from "../../../PaymentLinkDetails/components/PaymentLinkDetails/PaymentLinkDetails.js";
import c from "../../../../../core/Context/preact/useCoreContext.js";
import h from "../../../../internal/Modal/Modal.js";
const b = ({
  children: d,
  selectedDetail: i,
  resetDetails: e,
  onUpdate: t
}) => {
  const { i18n: m } = c(), [n, a] = u(!1), l = !!i, o = r(() => {
    n && (a(!1), t()), e();
  }, [n, t, e]), p = r(() => {
    a(!0);
  }, []);
  return /* @__PURE__ */ s("div", { children: [
    d,
    i && /* @__PURE__ */ s(
      h,
      {
        isOpen: l,
        "aria-label": m.get("payByLink.details.title"),
        onClose: o,
        isDismissible: !0,
        headerWithBorder: !1,
        size: i.modalSize || "large",
        children: /* @__PURE__ */ s(
          f,
          {
            id: i.selection.data,
            onUpdate: p,
            onDismiss: o,
            hideTitle: !0,
            isDismissButtonHidden: !0
          }
        )
      }
    )
  ] });
};
export {
  b as PaymentLinkDetailsModal
};
