import s from "./html2canvas.esm-d2sM-0Wm.js";
import { E as w } from "./jspdf.es.min-C660YX78.js";
function H({ domElement: p, fileName: l }) {
  if (p) {
    const t = {
      height: 851.89,
      width: 595.28
    }, e = new w("", "pt", "a4");
    let h, g, d, a, o;
    return s(p).then((n) => {
      h = n.width, g = n.height;
      let i = g;
      const f = h / t.width * t.height;
      let m = 0;
      if (d = t.width, a = 582.28 / h * g, o = n.toDataURL("image/png", 1), i < f)
        e.addImage(
          o,
          "PNG",
          33,
          24,
          d * 0.9,
          a * 0.9,
          "",
          "FAST"
        );
      else
        for (; i > 0; )
          e.addImage(
            o,
            "PNG",
            33,
            m,
            d * 0.9,
            a * 0.9,
            "",
            "FAST"
          ), i -= f, m -= t.height - 24, i > 0 && e.addPage();
      e.save(`${l}.pdf`);
    });
  }
}
export {
  H as p
};
