epochs-pdf 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -485,11 +485,11 @@ function yr({
485
485
  pendingFieldValue: vt = null,
486
486
  onPlaceFieldValue: E,
487
487
  texts: ct = [],
488
- onAddText: ut,
488
+ onAddText: ht,
489
489
  onUpdateText: gt,
490
490
  onRemoveText: tt,
491
- selectedTextId: kt = null,
492
- onSelectText: dt,
491
+ selectedTextId: Pt = null,
492
+ onSelectText: ut,
493
493
  textFields: te = [],
494
494
  selectedTextFieldId: ye = null,
495
495
  onSelectTextField: Vt,
@@ -497,7 +497,7 @@ function yr({
497
497
  editingTextId: Kt = null,
498
498
  onEditingTextIdChange: G
499
499
  }) {
500
- const $t = xt(null), yt = xt(null), bt = xt(null), it = xt(null), Wt = xt(null), st = xt(null), [mt, It] = O(null), ee = xt(null), ht = xt(!1);
500
+ const $t = xt(null), yt = xt(null), bt = xt(null), it = xt(null), Wt = xt(null), st = xt(null), [mt, It] = O(null), ee = xt(null), dt = xt(!1);
501
501
  Dt(() => {
502
502
  if (!t || !yt.current || !bt.current || !it.current)
503
503
  return;
@@ -574,7 +574,7 @@ function yr({
574
574
  }), (Z = window.getSelection()) == null || Z.removeAllRanges(), !0;
575
575
  }, v = (P) => {
576
576
  var lt;
577
- if (!g || !ut) return !1;
577
+ if (!g || !ht) return !1;
578
578
  const F = an(a, n);
579
579
  if (!F) return !1;
580
580
  const N = cn(F.rects);
@@ -597,8 +597,8 @@ function yr({
597
597
  fontSize: j.fontSize,
598
598
  color: me
599
599
  };
600
- return ut(R), dt == null || dt(R.id), G == null || G(R.id), (lt = window.getSelection()) == null || lt.removeAllRanges(), ht.current = !0, window.setTimeout(() => {
601
- ht.current = !1;
600
+ return ht(R), ut == null || ut(R.id), G == null || G(R.id), (lt = window.getSelection()) == null || lt.removeAllRanges(), dt.current = !0, window.setTimeout(() => {
601
+ dt.current = !1;
602
602
  }, 0), !0;
603
603
  }, M = () => {
604
604
  if (d === "highlight" || d === "underline") {
@@ -637,9 +637,9 @@ function yr({
637
637
  d,
638
638
  u,
639
639
  g,
640
- ut,
640
+ ht,
641
641
  G,
642
- dt,
642
+ ut,
643
643
  e,
644
644
  n
645
645
  ]), Dt(() => {
@@ -657,8 +657,8 @@ function yr({
657
657
  lt - mt.startY,
658
658
  et,
659
659
  n
660
- ) : { dx: 0, dy: 0 }, Ht = ft.width - X.x, At = ft.height - X.y, St = Math.min(Ht, Math.max(40, mt.startW + Ft)), Pt = Math.min(At, Math.max(20, mt.startH + Rt));
661
- I(mt.id, { width: St, height: Pt });
660
+ ) : { dx: 0, dy: 0 }, Ht = ft.width - X.x, At = ft.height - X.y, St = Math.min(Ht, Math.max(40, mt.startW + Ft)), Nt = Math.min(At, Math.max(20, mt.startH + Rt));
661
+ I(mt.id, { width: St, height: Nt });
662
662
  }, F = (R, lt) => {
663
663
  var Ut;
664
664
  if (mt.kind !== "signature" || !I || pt) return;
@@ -680,8 +680,8 @@ function yr({
680
680
  10
681
681
  ), Rt = We(R, lt, ft, n), Ht = Ce(ft, n);
682
682
  let At = Rt.x - mt.offsetX, St = Rt.y - mt.offsetY;
683
- const Pt = Math.max(0, Ht.width - X.width), _t = Math.max(0, Ht.height - X.height);
684
- At = Math.min(Math.max(0, At), Pt), St = Math.min(Math.max(0, St), _t), I(mt.id, {
683
+ const Nt = Math.max(0, Ht.width - X.width), _t = Math.max(0, Ht.height - X.height);
684
+ At = Math.min(Math.max(0, At), Nt), St = Math.min(Math.max(0, St), _t), I(mt.id, {
685
685
  pageNumber: Ft,
686
686
  x: At,
687
687
  y: St
@@ -735,7 +735,7 @@ function yr({
735
735
  }, [Kt]);
736
736
  const ne = (a) => {
737
737
  $t.current = a, r == null || r(a);
738
- }, Nt = m.filter((a) => a.pageNumber === e), oe = y.filter((a) => a.pageNumber === e), f = nt.filter((a) => a.pageNumber === e), L = ct.filter((a) => a.pageNumber === e), U = (a, w) => {
738
+ }, kt = m.filter((a) => a.pageNumber === e), oe = y.filter((a) => a.pageNumber === e), p = nt.filter((a) => a.pageNumber === e), L = ct.filter((a) => a.pageNumber === e), U = (a, w) => {
739
739
  const v = w.trim();
740
740
  if (!v) {
741
741
  tt == null || tt(a.id), G == null || G(null);
@@ -748,7 +748,7 @@ function yr({
748
748
  height: M.height
749
749
  }), G == null || G(null);
750
750
  }, rt = (a, w) => {
751
- if (!ut) return;
751
+ if (!ht) return;
752
752
  const v = it.current, M = bt.current;
753
753
  if (!v || !M) return;
754
754
  let D = qi(
@@ -768,7 +768,7 @@ function yr({
768
768
  if (!Z) return;
769
769
  const R = ct.find((lt) => lt.fieldId === Z.id);
770
770
  if (R) {
771
- dt == null || dt(R.id), Vt == null || Vt(Z.id), G == null || G(R.id);
771
+ ut == null || ut(R.id), Vt == null || Vt(Z.id), G == null || G(R.id);
772
772
  return;
773
773
  }
774
774
  P = Z.id, D = {
@@ -789,20 +789,20 @@ function yr({
789
789
  fontSize: D.fontSize,
790
790
  color: F
791
791
  };
792
- ut(j), dt == null || dt(j.id), G == null || G(j.id);
792
+ ht(j), ut == null || ut(j.id), G == null || G(j.id);
793
793
  }, Lt = (a) => {
794
794
  var v;
795
795
  if (d !== "text" || a.target.closest(".epochs-pdf-viewer__inline-text"))
796
796
  return;
797
- if (ht.current) {
798
- ht.current = !1;
797
+ if (dt.current) {
798
+ dt.current = !1;
799
799
  return;
800
800
  }
801
801
  const w = window.getSelection();
802
802
  if (!(w && !w.isCollapsed && w.toString().trim())) {
803
803
  if (a.detail >= 2 && tr(a.clientX, a.clientY, bt.current)) {
804
804
  const D = it.current;
805
- if (D && g && ut) {
805
+ if (D && g && ht) {
806
806
  const P = an(D, n);
807
807
  if (P) {
808
808
  g({
@@ -824,7 +824,7 @@ function yr({
824
824
  fontSize: F.fontSize,
825
825
  color: me
826
826
  };
827
- ut(j), dt == null || dt(j.id), G == null || G(j.id), (v = window.getSelection()) == null || v.removeAllRanges(), ht.current = !0;
827
+ ht(j), ut == null || ut(j.id), G == null || G(j.id), (v = window.getSelection()) == null || v.removeAllRanges(), dt.current = !0;
828
828
  }
829
829
  }
830
830
  return;
@@ -901,7 +901,7 @@ function yr({
901
901
  ) : a.value.trim() ? /* @__PURE__ */ s(
902
902
  "span",
903
903
  {
904
- className: kt === a.id ? "epochs-pdf-viewer__inline-text epochs-pdf-viewer__inline-text--selected" : "epochs-pdf-viewer__inline-text",
904
+ className: Pt === a.id ? "epochs-pdf-viewer__inline-text epochs-pdf-viewer__inline-text--selected" : "epochs-pdf-viewer__inline-text",
905
905
  style: {
906
906
  left: a.x * n,
907
907
  top: a.y * n,
@@ -913,7 +913,7 @@ function yr({
913
913
  tt == null || tt(a.id);
914
914
  return;
915
915
  }
916
- d === "text" && (dt == null || dt(a.id), G == null || G(a.id));
916
+ d === "text" && (ut == null || ut(a.id), G == null || G(a.id));
917
917
  },
918
918
  children: a.value
919
919
  },
@@ -933,7 +933,7 @@ function yr({
933
933
  onClick: Zt,
934
934
  children: [
935
935
  /* @__PURE__ */ s("canvas", { ref: yt, className: "epochs-pdf-viewer__canvas" }),
936
- /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__markup-layer", "aria-hidden": "true", children: Nt.map(
936
+ /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__markup-layer", "aria-hidden": "true", children: kt.map(
937
937
  (a) => a.kind === "redact" ? null : a.rects.map((w, v) => a.kind === "highlight" ? /* @__PURE__ */ s(
938
938
  "div",
939
939
  {
@@ -969,7 +969,7 @@ function yr({
969
969
  ))
970
970
  ) }),
971
971
  /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__signature-layer", children: [
972
- f.map((a) => {
972
+ p.map((a) => {
973
973
  const w = a.type ?? "sign", v = Mt[a.id] ?? a.value ?? "", M = w === "date" || w === "text" ? !!v.trim() : oe.some((D) => D.fieldId === a.id);
974
974
  return /* @__PURE__ */ s(
975
975
  "button",
@@ -1110,7 +1110,7 @@ function yr({
1110
1110
  onClick: Lt
1111
1111
  }
1112
1112
  ),
1113
- /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children: Nt.map(
1113
+ /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children: kt.map(
1114
1114
  (a) => a.kind === "redact" ? a.rects.map((w, v) => /* @__PURE__ */ s(
1115
1115
  "div",
1116
1116
  {
@@ -1416,7 +1416,7 @@ function Cr({
1416
1416
  rememberedByType: g,
1417
1417
  onRememberFill: _
1418
1418
  }) {
1419
- const y = xt(null), b = xt(!1), x = xt(null), I = xt([]), S = xt([]), H = xt(null), W = r ?? "sign", [A, C] = O(W), [nt, at] = O(""), [q, pt] = O(""), [J, Mt] = O("draw"), [K, Et] = O(""), [vt, E] = O(""), [ct, ut] = O(!1), [gt, tt] = O("signature"), [kt, dt] = O("#111827"), [te, ye] = O("dancing-script"), [Vt, qt] = O(!1), [Kt, G] = O(!1), $t = Ue.find((f) => f.id === te) ?? Ue[0], yt = gt === "initials" ? vt.trim() : K.trim(), bt = yt || (gt === "initials" ? "AB" : "Signature");
1419
+ const y = xt(null), b = xt(!1), x = xt(null), I = xt([]), S = xt([]), H = xt(null), W = r ?? "sign", [A, C] = O(W), [nt, at] = O(""), [q, pt] = O(""), [J, Mt] = O("draw"), [K, Et] = O(""), [vt, E] = O(""), [ct, ht] = O(!1), [gt, tt] = O("signature"), [Pt, ut] = O("#111827"), [te, ye] = O("dancing-script"), [Vt, qt] = O(!1), [Kt, G] = O(!1), $t = Ue.find((p) => p.id === te) ?? Ue[0], yt = gt === "initials" ? vt.trim() : K.trim(), bt = yt || (gt === "initials" ? "AB" : "Signature");
1420
1420
  if (Dt(() => {
1421
1421
  var U, rt;
1422
1422
  if (!t) return;
@@ -1430,91 +1430,91 @@ function Cr({
1430
1430
  pt(u || ((rt = g == null ? void 0 : g.text) == null ? void 0 : rt.value) || "");
1431
1431
  return;
1432
1432
  }
1433
- const f = g == null ? void 0 : g.sign;
1434
- if (!f) {
1435
- Mt("draw"), Et(""), E(""), ut(!1), tt("signature"), dt("#111827"), ye("dancing-script"), H.current = null, G(!1);
1433
+ const p = g == null ? void 0 : g.sign;
1434
+ if (!p) {
1435
+ Mt("draw"), Et(""), E(""), ht(!1), tt("signature"), ut("#111827"), ye("dancing-script"), H.current = null, G(!1);
1436
1436
  return;
1437
1437
  }
1438
- Mt(f.mode), Et(f.typedName ?? ""), E(f.typedInitials ?? ""), ut(!!f.typedInitials), tt(f.typeKind ?? "signature"), dt(f.inkColor ?? "#111827");
1439
- const L = Ue.find((Lt) => Lt.id === f.fontId);
1440
- L && ye(L.id), f.mode === "draw" ? (H.current = {
1441
- imageDataUrl: f.imageDataUrl,
1442
- width: f.width,
1443
- height: f.height
1438
+ Mt(p.mode), Et(p.typedName ?? ""), E(p.typedInitials ?? ""), ht(!!p.typedInitials), tt(p.typeKind ?? "signature"), ut(p.inkColor ?? "#111827");
1439
+ const L = Ue.find((Lt) => Lt.id === p.fontId);
1440
+ L && ye(L.id), p.mode === "draw" ? (H.current = {
1441
+ imageDataUrl: p.imageDataUrl,
1442
+ width: p.width,
1443
+ height: p.height
1444
1444
  }, G(!0)) : (H.current = null, G(!1));
1445
1445
  }, [t, W, g, u]), Dt(() => {
1446
1446
  if (!t || A !== "sign") return;
1447
- const f = y.current;
1448
- if (!f) return;
1449
- const L = f.getContext("2d");
1450
- if (!L || (f.width = 560, f.height = 200, L.fillStyle = "#ffffff", L.fillRect(0, 0, f.width, f.height), L.lineCap = "round", L.lineJoin = "round", L.strokeStyle = kt, L.lineWidth = 2.5, x.current = null, b.current = !1, I.current = [], S.current = [], J !== "draw")) return;
1447
+ const p = y.current;
1448
+ if (!p) return;
1449
+ const L = p.getContext("2d");
1450
+ if (!L || (p.width = 560, p.height = 200, L.fillStyle = "#ffffff", L.fillRect(0, 0, p.width, p.height), L.lineCap = "round", L.lineJoin = "round", L.strokeStyle = Pt, L.lineWidth = 2.5, x.current = null, b.current = !1, I.current = [], S.current = [], J !== "draw")) return;
1451
1451
  const U = H.current;
1452
1452
  if (!(U != null && U.imageDataUrl)) return;
1453
1453
  const rt = new Image();
1454
1454
  rt.onload = () => {
1455
1455
  const Lt = Math.min(
1456
- f.width / Math.max(1, U.width),
1457
- f.height / Math.max(1, U.height),
1456
+ p.width / Math.max(1, U.width),
1457
+ p.height / Math.max(1, U.height),
1458
1458
  1
1459
1459
  ), Zt = U.width * Lt, ie = U.height * Lt;
1460
- L.drawImage(rt, (f.width - Zt) / 2, (f.height - ie) / 2, Zt, ie);
1460
+ L.drawImage(rt, (p.width - Zt) / 2, (p.height - ie) / 2, Zt, ie);
1461
1461
  }, rt.src = U.imageDataUrl;
1462
1462
  }, [t, A, J]), Dt(() => {
1463
1463
  if (!t) return;
1464
- let f = !1;
1464
+ let p = !1;
1465
1465
  return qt(!1), Ir().then(() => {
1466
- f || qt(!0);
1466
+ p || qt(!0);
1467
1467
  }), () => {
1468
- f = !0;
1468
+ p = !0;
1469
1469
  };
1470
1470
  }, [t]), Dt(() => {
1471
- const f = y.current, L = f == null ? void 0 : f.getContext("2d");
1472
- L && (L.strokeStyle = kt, L.fillStyle = kt);
1473
- }, [kt]), Dt(() => {
1471
+ const p = y.current, L = p == null ? void 0 : p.getContext("2d");
1472
+ L && (L.strokeStyle = Pt, L.fillStyle = Pt);
1473
+ }, [Pt]), Dt(() => {
1474
1474
  if (!t || J !== "type") return;
1475
- const f = y.current, L = f == null ? void 0 : f.getContext("2d");
1476
- if (!f || !L || (L.fillStyle = "#ffffff", L.fillRect(0, 0, f.width, f.height), !yt)) return;
1475
+ const p = y.current, L = p == null ? void 0 : p.getContext("2d");
1476
+ if (!p || !L || (L.fillStyle = "#ffffff", L.fillRect(0, 0, p.width, p.height), !yt)) return;
1477
1477
  const U = Dn(gt, $t.family);
1478
- L.fillStyle = kt, L.textAlign = "center", L.textBaseline = "middle", L.font = `${U}px "${$t.family}", cursive`, L.fillText(yt, f.width / 2, f.height / 2);
1478
+ L.fillStyle = Pt, L.textAlign = "center", L.textBaseline = "middle", L.font = `${U}px "${$t.family}", cursive`, L.fillText(yt, p.width / 2, p.height / 2);
1479
1479
  }, [
1480
1480
  yt,
1481
1481
  gt,
1482
1482
  J,
1483
- kt,
1483
+ Pt,
1484
1484
  t,
1485
1485
  $t,
1486
1486
  Vt
1487
1487
  ]), !t) return null;
1488
- const it = (f) => {
1488
+ const it = (p) => {
1489
1489
  const L = y.current, U = L.getBoundingClientRect();
1490
1490
  return {
1491
- x: (f.clientX - U.left) / U.width * L.width,
1492
- y: (f.clientY - U.top) / U.height * L.height
1491
+ x: (p.clientX - U.left) / U.width * L.width,
1492
+ y: (p.clientY - U.top) / U.height * L.height
1493
1493
  };
1494
- }, Wt = (f) => {
1494
+ }, Wt = (p) => {
1495
1495
  if (J !== "draw") return;
1496
1496
  if (H.current) {
1497
1497
  H.current = null, G(!1);
1498
1498
  const U = y.current, rt = U == null ? void 0 : U.getContext("2d");
1499
- U && rt && (rt.fillStyle = "#ffffff", rt.fillRect(0, 0, U.width, U.height), rt.strokeStyle = kt, rt.lineWidth = 2.5, rt.lineCap = "round", rt.lineJoin = "round"), I.current = [];
1499
+ U && rt && (rt.fillStyle = "#ffffff", rt.fillRect(0, 0, U.width, U.height), rt.strokeStyle = Pt, rt.lineWidth = 2.5, rt.lineCap = "round", rt.lineJoin = "round"), I.current = [];
1500
1500
  }
1501
- f.currentTarget.setPointerCapture(f.pointerId), b.current = !0;
1502
- const L = it(f);
1501
+ p.currentTarget.setPointerCapture(p.pointerId), b.current = !0;
1502
+ const L = it(p);
1503
1503
  x.current = L, S.current = [L];
1504
- }, st = (f) => {
1504
+ }, st = (p) => {
1505
1505
  if (!b.current || J !== "draw") return;
1506
1506
  const L = y.current, U = L == null ? void 0 : L.getContext("2d"), rt = x.current;
1507
1507
  if (!U || !rt) return;
1508
- const Lt = it(f);
1508
+ const Lt = it(p);
1509
1509
  U.beginPath(), U.moveTo(rt.x, rt.y), U.lineTo(Lt.x, Lt.y), U.stroke(), x.current = Lt, S.current.push(Lt);
1510
1510
  }, mt = () => {
1511
1511
  S.current.length > 1 && I.current.push([...S.current]), S.current = [], b.current = !1, x.current = null;
1512
1512
  }, It = () => {
1513
- const f = y.current, L = f == null ? void 0 : f.getContext("2d");
1514
- !f || !L || (L.fillStyle = "#ffffff", L.fillRect(0, 0, f.width, f.height), I.current = [], S.current = [], H.current = null, G(!1), Et(""), E(""), ut(!1));
1515
- }, ee = (f) => {
1516
- Et(f), ct || E(Tr(f));
1517
- }, ht = () => {
1513
+ const p = y.current, L = p == null ? void 0 : p.getContext("2d");
1514
+ !p || !L || (L.fillStyle = "#ffffff", L.fillRect(0, 0, p.width, p.height), I.current = [], S.current = [], H.current = null, G(!1), Et(""), E(""), ht(!1));
1515
+ }, ee = (p) => {
1516
+ Et(p), ct || E(Tr(p));
1517
+ }, dt = () => {
1518
1518
  if (J === "draw") {
1519
1519
  const X = I.current, et = H.current;
1520
1520
  if (X.length === 0) {
@@ -1524,7 +1524,7 @@ function Cr({
1524
1524
  imageDataUrl: et.imageDataUrl,
1525
1525
  width: et.width,
1526
1526
  height: et.height,
1527
- inkColor: kt
1527
+ inkColor: Pt
1528
1528
  }), n(et.imageDataUrl, et.width, et.height);
1529
1529
  return;
1530
1530
  }
@@ -1534,23 +1534,23 @@ function Cr({
1534
1534
  Qt.x < ft && (ft = Qt.x), Qt.y < Ft && (Ft = Qt.y), Qt.x > Rt && (Rt = Qt.x), Qt.y > Ht && (Ht = Qt.y);
1535
1535
  const At = 8;
1536
1536
  ft = Math.max(0, ft - At), Ft = Math.max(0, Ft - At), Rt += At, Ht += At;
1537
- const St = Rt - ft, Pt = Ht - Ft, _t = X.map((_e) => "M" + _e.map((ae) => ({ x: ae.x - ft, y: ae.y - Ft })).map((ae) => `${ae.x.toFixed(1)},${ae.y.toFixed(1)}`).join("L")).join(" "), Ut = Math.max(1, (m == null ? void 0 : m.width) ?? St), Yt = Math.max(1, (m == null ? void 0 : m.height) ?? Pt), Gt = Math.min(Ut / St, Yt / Pt), be = St * Gt, se = Pt * Gt, Ve = (Ut - be) / 2, de = (Yt - se) / 2, qe = `<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${Ut} ${Yt}"><g transform="translate(${Ve.toFixed(2)} ${de.toFixed(2)}) scale(${Gt.toFixed(4)})"><path d="${_t}" fill="none" stroke="${kt}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></g></svg>`, he = `data:image/svg+xml;base64,${btoa(qe)}`;
1537
+ const St = Rt - ft, Nt = Ht - Ft, _t = X.map((_e) => "M" + _e.map((ae) => ({ x: ae.x - ft, y: ae.y - Ft })).map((ae) => `${ae.x.toFixed(1)},${ae.y.toFixed(1)}`).join("L")).join(" "), Ut = Math.max(1, (m == null ? void 0 : m.width) ?? St), Yt = Math.max(1, (m == null ? void 0 : m.height) ?? Nt), Gt = Math.min(Ut / St, Yt / Nt), be = St * Gt, se = Nt * Gt, Ve = (Ut - be) / 2, de = (Yt - se) / 2, qe = `<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${Ut} ${Yt}"><g transform="translate(${Ve.toFixed(2)} ${de.toFixed(2)}) scale(${Gt.toFixed(4)})"><path d="${_t}" fill="none" stroke="${Pt}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></g></svg>`, he = `data:image/svg+xml;base64,${btoa(qe)}`;
1538
1538
  _ == null || _("sign", {
1539
1539
  mode: "draw",
1540
1540
  imageDataUrl: he,
1541
1541
  width: Ut,
1542
1542
  height: Yt,
1543
- inkColor: kt
1543
+ inkColor: Pt
1544
1544
  }), n(he, Ut, Yt);
1545
1545
  return;
1546
1546
  }
1547
1547
  if (!yt) return;
1548
- const f = 3, L = Dn(gt, $t.family), rt = document.createElement("canvas").getContext("2d");
1548
+ const p = 3, L = Dn(gt, $t.family), rt = document.createElement("canvas").getContext("2d");
1549
1549
  rt.font = `${L}px "${$t.family}", cursive`;
1550
- const Lt = rt.measureText(yt), Zt = 8, ie = Math.ceil(Lt.width) + Zt * 2, a = L + Zt * 2, w = Math.max(1, (m == null ? void 0 : m.width) ?? ie), v = Math.max(1, (m == null ? void 0 : m.height) ?? a), M = Math.min(w / ie, v / a), D = Math.max(8, L * M), P = Math.max(1, Math.round(w * f)), F = Math.max(1, Math.round(v * f)), N = document.createElement("canvas");
1550
+ const Lt = rt.measureText(yt), Zt = 8, ie = Math.ceil(Lt.width) + Zt * 2, a = L + Zt * 2, w = Math.max(1, (m == null ? void 0 : m.width) ?? ie), v = Math.max(1, (m == null ? void 0 : m.height) ?? a), M = Math.min(w / ie, v / a), D = Math.max(8, L * M), P = Math.max(1, Math.round(w * p)), F = Math.max(1, Math.round(v * p)), N = document.createElement("canvas");
1551
1551
  N.width = P, N.height = F;
1552
1552
  const j = N.getContext("2d");
1553
- j.fillStyle = "#ffffff", j.fillRect(0, 0, P, F), j.font = `${D * f}px "${$t.family}", cursive`, j.fillStyle = kt, j.textAlign = "center", j.textBaseline = "middle", j.fillText(yt, P / 2, F / 2);
1553
+ j.fillStyle = "#ffffff", j.fillRect(0, 0, P, F), j.font = `${D * p}px "${$t.family}", cursive`, j.fillStyle = Pt, j.textAlign = "center", j.textBaseline = "middle", j.fillText(yt, P / 2, F / 2);
1554
1554
  const Z = N.toDataURL("image/png"), R = `<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 ${w} ${v}"><image href="${Z}" width="${w}" height="${v}" preserveAspectRatio="xMidYMid meet"/></svg>`, lt = `data:image/svg+xml;base64,${btoa(R)}`;
1555
1555
  _ == null || _("sign", {
1556
1556
  mode: "type",
@@ -1560,14 +1560,14 @@ function Cr({
1560
1560
  typedName: K,
1561
1561
  typedInitials: vt,
1562
1562
  fontId: te,
1563
- inkColor: kt,
1563
+ inkColor: Pt,
1564
1564
  typeKind: gt
1565
1565
  }), n(lt, w, v);
1566
1566
  }, ne = () => {
1567
1567
  if (A !== "date" && A !== "text") return;
1568
- const f = A === "date" ? nt : q.trim();
1569
- f && (_ == null || _(A, { value: f }), i == null || i(f, A));
1570
- }, Nt = A === "sign";
1568
+ const p = A === "date" ? nt : q.trim();
1569
+ p && (_ == null || _(A, { value: p }), i == null || i(p, A));
1570
+ }, kt = A === "sign";
1571
1571
  return /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal", role: "dialog", "aria-modal": "true", children: [
1572
1572
  /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__modal-backdrop", onClick: e }),
1573
1573
  /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-card", children: [
@@ -1584,19 +1584,19 @@ function Cr({
1584
1584
  }
1585
1585
  )
1586
1586
  ] }),
1587
- o && !r ? /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__field-type-tabs", role: "tablist", children: ["sign", "date", "text"].map((f) => /* @__PURE__ */ s(
1587
+ o && !r ? /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__field-type-tabs", role: "tablist", children: ["sign", "date", "text"].map((p) => /* @__PURE__ */ s(
1588
1588
  "button",
1589
1589
  {
1590
1590
  type: "button",
1591
1591
  role: "tab",
1592
- "aria-selected": A === f,
1593
- className: A === f ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1594
- onClick: () => C(f),
1595
- children: f === "sign" ? "Sign" : f === "date" ? "Date" : "Text"
1592
+ "aria-selected": A === p,
1593
+ className: A === p ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
1594
+ onClick: () => C(p),
1595
+ children: p === "sign" ? "Sign" : p === "date" ? "Date" : "Text"
1596
1596
  },
1597
- f
1597
+ p
1598
1598
  )) }) : null,
1599
- Nt ? /* @__PURE__ */ T(je, { children: [
1599
+ kt ? /* @__PURE__ */ T(je, { children: [
1600
1600
  /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__sign-modes", children: [
1601
1601
  /* @__PURE__ */ s(
1602
1602
  "button",
@@ -1617,18 +1617,7 @@ function Cr({
1617
1617
  onClick: () => Mt("type"),
1618
1618
  children: "Type"
1619
1619
  }
1620
- ),
1621
- /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-ink", children: [
1622
- "Ink",
1623
- /* @__PURE__ */ s(
1624
- "input",
1625
- {
1626
- type: "color",
1627
- value: kt,
1628
- onChange: (f) => dt(f.target.value)
1629
- }
1630
- )
1631
- ] })
1620
+ )
1632
1621
  ] }),
1633
1622
  J === "type" ? /* @__PURE__ */ T(je, { children: [
1634
1623
  /* @__PURE__ */ s(
@@ -1637,17 +1626,17 @@ function Cr({
1637
1626
  className: "epochs-pdf-viewer__sign-fonts",
1638
1627
  role: "group",
1639
1628
  "aria-label": "Handwriting style",
1640
- children: Ue.map((f) => /* @__PURE__ */ s(
1629
+ children: Ue.map((p) => /* @__PURE__ */ s(
1641
1630
  "button",
1642
1631
  {
1643
1632
  type: "button",
1644
- className: te === f.id ? "epochs-pdf-viewer__sign-font epochs-pdf-viewer__sign-font--active" : "epochs-pdf-viewer__sign-font",
1645
- style: { fontFamily: `"${f.family}", cursive` },
1646
- onClick: () => ye(f.id),
1647
- title: f.label,
1633
+ className: te === p.id ? "epochs-pdf-viewer__sign-font epochs-pdf-viewer__sign-font--active" : "epochs-pdf-viewer__sign-font",
1634
+ style: { fontFamily: `"${p.family}", cursive` },
1635
+ onClick: () => ye(p.id),
1636
+ title: p.label,
1648
1637
  children: bt
1649
1638
  },
1650
- f.id
1639
+ p.id
1651
1640
  ))
1652
1641
  }
1653
1642
  ),
@@ -1660,7 +1649,7 @@ function Cr({
1660
1649
  className: "epochs-pdf-viewer__sign-type-input",
1661
1650
  type: "text",
1662
1651
  value: K,
1663
- onChange: (f) => ee(f.target.value),
1652
+ onChange: (p) => ee(p.target.value),
1664
1653
  onFocus: () => tt("signature"),
1665
1654
  placeholder: "Type your full name",
1666
1655
  style: { fontFamily: `"${$t.family}", cursive` },
@@ -1676,8 +1665,8 @@ function Cr({
1676
1665
  className: "epochs-pdf-viewer__sign-type-input",
1677
1666
  type: "text",
1678
1667
  value: vt,
1679
- onChange: (f) => {
1680
- ut(!0), E(f.target.value.toUpperCase());
1668
+ onChange: (p) => {
1669
+ ht(!0), E(p.target.value.toUpperCase());
1681
1670
  },
1682
1671
  onFocus: () => tt("initials"),
1683
1672
  placeholder: "e.g. JD",
@@ -1735,7 +1724,7 @@ function Cr({
1735
1724
  className: "epochs-pdf-viewer__sign-type-input",
1736
1725
  type: "date",
1737
1726
  value: nt,
1738
- onChange: (f) => at(f.target.value),
1727
+ onChange: (p) => at(p.target.value),
1739
1728
  autoFocus: !0
1740
1729
  }
1741
1730
  )
@@ -1747,14 +1736,14 @@ function Cr({
1747
1736
  className: "epochs-pdf-viewer__sign-type-input",
1748
1737
  type: "text",
1749
1738
  value: q,
1750
- onChange: (f) => pt(f.target.value),
1739
+ onChange: (p) => pt(p.target.value),
1751
1740
  placeholder: d ?? "Enter text",
1752
1741
  autoFocus: !0
1753
1742
  }
1754
1743
  )
1755
1744
  ] }),
1756
1745
  /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-actions", children: [
1757
- Nt ? /* @__PURE__ */ s(
1746
+ kt ? /* @__PURE__ */ s(
1758
1747
  "button",
1759
1748
  {
1760
1749
  type: "button",
@@ -1777,9 +1766,9 @@ function Cr({
1777
1766
  {
1778
1767
  type: "button",
1779
1768
  className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
1780
- onClick: Nt ? ht : ne,
1769
+ onClick: kt ? dt : ne,
1781
1770
  disabled: A === "date" ? !nt : A === "text" ? !q.trim() : !1,
1782
- children: Nt ? "Use signature" : "Place on page"
1771
+ children: kt ? "Use signature" : "Place on page"
1783
1772
  }
1784
1773
  )
1785
1774
  ] })
@@ -2281,17 +2270,17 @@ function oo({
2281
2270
  signatureFields: vt = [],
2282
2271
  textFields: E = [],
2283
2272
  onSignatureComplete: ct,
2284
- onSignatureFieldsChange: ut,
2273
+ onSignatureFieldsChange: ht,
2285
2274
  applySignatureToSameTag: gt = !1,
2286
2275
  onFieldValueComplete: tt,
2287
- openSignaturePad: kt = !1,
2288
- onSignaturePadClose: dt,
2276
+ openSignaturePad: Pt = !1,
2277
+ onSignaturePadClose: ut,
2289
2278
  onSubmit: te,
2290
2279
  submitLabel: ye = "Submit",
2291
2280
  submitLoading: Vt = !1
2292
2281
  }) {
2293
2282
  var Mn, kn;
2294
- const qt = xt(null), Kt = xt(null), G = xt(/* @__PURE__ */ new Map()), $t = xt(!1), yt = Pe(() => t && typeof t != "string" ? t : null, [t]), bt = Pe(() => yt ? "" : xr(typeof t == "string" ? t : void 0, e, n), [yt, t, e, n]), [it, Wt] = O("idle"), [st, mt] = O(null), [It, ee] = O(0), [ht, ne] = O(1), [Nt, oe] = O(d), [f, L] = O(0), [U, rt] = O(null), [Lt, Zt] = O(!1), [ie, a] = O(!1), [w, v] = O(!1), [M, D] = O("none"), [P, F] = O([]), [N, j] = O([]), [Z, R] = O([]), [lt, X] = O(!1), [et, ft] = O(void 0), [Ft, Rt] = O({}), [Ht, At] = O(null), [St, Pt] = O(
2283
+ const qt = xt(null), Kt = xt(null), G = xt(/* @__PURE__ */ new Map()), $t = xt(!1), yt = Pe(() => t && typeof t != "string" ? t : null, [t]), bt = Pe(() => yt ? "" : xr(typeof t == "string" ? t : void 0, e, n), [yt, t, e, n]), [it, Wt] = O("idle"), [st, mt] = O(null), [It, ee] = O(0), [dt, ne] = O(1), [kt, oe] = O(d), [p, L] = O(0), [U, rt] = O(null), [Lt, Zt] = O(!1), [ie, a] = O(!1), [w, v] = O(!1), [M, D] = O("none"), [P, F] = O([]), [N, j] = O([]), [Z, R] = O([]), [lt, X] = O(!1), [et, ft] = O(void 0), [Ft, Rt] = O({}), [Ht, At] = O(null), [St, Nt] = O(
2295
2284
  null
2296
2285
  ), [_t, Ut] = O(
2297
2286
  null
@@ -2300,8 +2289,8 @@ function oo({
2300
2289
  ve.current = vt, Ke(vt), Ye((c) => {
2301
2290
  const h = { ...c };
2302
2291
  for (const l of vt) {
2303
- const p = l.type ?? "sign";
2304
- (p === "date" || p === "text") && l.value != null && l.value !== "" && (h[l.id] = l.value);
2292
+ const f = l.type ?? "sign";
2293
+ (f === "date" || f === "text") && l.value != null && l.value !== "" && (h[l.id] = l.value);
2305
2294
  }
2306
2295
  return h;
2307
2296
  });
@@ -2309,8 +2298,8 @@ function oo({
2309
2298
  const jt = B.length > 0, De = Y(
2310
2299
  (c, h, l) => {
2311
2300
  var k;
2312
- const p = c.type ?? "sign";
2313
- return p === "date" || p === "text" ? !!((k = l[c.id] ?? c.value) != null && k.trim()) : h.some(($) => $.fieldId === c.id) || !!c.signatureDataUrl;
2301
+ const f = c.type ?? "sign";
2302
+ return f === "date" || f === "text" ? !!((k = l[c.id] ?? c.value) != null && k.trim()) : h.some(($) => $.fieldId === c.id) || !!c.signatureDataUrl;
2314
2303
  },
2315
2304
  []
2316
2305
  ), pn = Y(
@@ -2318,7 +2307,7 @@ function oo({
2318
2307
  const l = new Set(c), k = ve.current.map(
2319
2308
  ($) => l.has($.id) ? { ...$, value: h } : $
2320
2309
  );
2321
- ve.current = k, Ke(k), ut == null || ut(k), Ye(($) => {
2310
+ ve.current = k, Ke(k), ht == null || ht(k), Ye(($) => {
2322
2311
  const z = { ...$ };
2323
2312
  for (const ot of c) z[ot] = h;
2324
2313
  return z;
@@ -2326,13 +2315,13 @@ function oo({
2326
2315
  for (const $ of c)
2327
2316
  tt == null || tt($, h);
2328
2317
  },
2329
- [tt, ut]
2318
+ [tt, ht]
2330
2319
  ), Le = Y(
2331
2320
  (c, h, l) => {
2332
- const p = ve.current, k = c == null ? null : Array.isArray(c) ? c : [c], $ = k ? new Set(k) : null, z = $ ? p.map(
2321
+ const f = ve.current, k = c == null ? null : Array.isArray(c) ? c : [c], $ = k ? new Set(k) : null, z = $ ? f.map(
2333
2322
  (ot) => $.has(ot.id) ? { ...ot, signatureDataUrl: h.imageDataUrl } : ot
2334
2323
  ) : [
2335
- ...p,
2324
+ ...f,
2336
2325
  {
2337
2326
  id: h.id,
2338
2327
  pageNumber: h.pageNumber,
@@ -2344,7 +2333,7 @@ function oo({
2344
2333
  signatureDataUrl: h.imageDataUrl
2345
2334
  }
2346
2335
  ];
2347
- if (ve.current = z, Ke(z), ut == null || ut(z), !k || k.length === 0) {
2336
+ if (ve.current = z, Ke(z), ht == null || ht(z), !k || k.length === 0) {
2348
2337
  ct == null || ct(void 0, h);
2349
2338
  return;
2350
2339
  }
@@ -2354,11 +2343,11 @@ function oo({
2354
2343
  (l == null ? void 0 : l.get(ot)) ?? h
2355
2344
  );
2356
2345
  },
2357
- [ct, ut]
2346
+ [ct, ht]
2358
2347
  );
2359
2348
  Dt(() => {
2360
- kt && X(!0);
2361
- }, [kt]);
2349
+ Pt && X(!0);
2350
+ }, [Pt]);
2362
2351
  const ue = Pe(
2363
2352
  () => Ar(b, {
2364
2353
  enableThumbnails: x,
@@ -2408,7 +2397,7 @@ function oo({
2408
2397
  Kt.current && (URL.revokeObjectURL(Kt.current), Kt.current = null);
2409
2398
  }, []), Qe = Y(async () => {
2410
2399
  if (!(!yt && !bt)) {
2411
- vr(y), Wt("loading"), mt(null), ee(0), ne(1), F([]), j([]), R([]), At(null), Pt(null), Ut(null), Gt(null), se(null), de(null), he(null), D("none");
2400
+ vr(y), Wt("loading"), mt(null), ee(0), ne(1), F([]), j([]), R([]), At(null), Nt(null), Ut(null), Gt(null), se(null), de(null), he(null), D("none");
2412
2401
  try {
2413
2402
  const c = yt ? await In(yt, i) : await In(bt, i), h = new Blob([c], { type: "application/pdf" }), l = URL.createObjectURL(h);
2414
2403
  Fe(), Kt.current = l, rt(l);
@@ -2459,10 +2448,10 @@ function oo({
2459
2448
  h && ($t.current = !0, ne(c.pageNumber));
2460
2449
  const l = () => {
2461
2450
  var k;
2462
- const p = (k = qt.current) == null ? void 0 : k.querySelector(
2451
+ const f = (k = qt.current) == null ? void 0 : k.querySelector(
2463
2452
  `[data-signature-field-id="${CSS.escape(c.id)}"]`
2464
2453
  );
2465
- p ? p.scrollIntoView({ behavior: "smooth", block: "center" }) : h && h.scrollIntoView({ behavior: "smooth", block: "start" }), window.setTimeout(() => {
2454
+ f ? f.scrollIntoView({ behavior: "smooth", block: "center" }) : h && h.scrollIntoView({ behavior: "smooth", block: "start" }), window.setTimeout(() => {
2466
2455
  $t.current = !1;
2467
2456
  }, 500);
2468
2457
  };
@@ -2477,16 +2466,16 @@ function oo({
2477
2466
  const c = qt.current, h = new IntersectionObserver(
2478
2467
  (l) => {
2479
2468
  if ($t.current) return;
2480
- let p = null;
2469
+ let f = null;
2481
2470
  for (const k of l) {
2482
2471
  if (!k.isIntersecting) continue;
2483
2472
  const $ = Number.parseInt(
2484
2473
  k.target.dataset.pageNumber || "0",
2485
2474
  10
2486
2475
  );
2487
- $ && (!p || k.intersectionRatio > p.ratio) && (p = { page: $, ratio: k.intersectionRatio });
2476
+ $ && (!f || k.intersectionRatio > f.ratio) && (f = { page: $, ratio: k.intersectionRatio });
2488
2477
  }
2489
- p && ne(p.page);
2478
+ f && ne(f.page);
2490
2479
  },
2491
2480
  {
2492
2481
  root: c,
@@ -2494,16 +2483,16 @@ function oo({
2494
2483
  }
2495
2484
  );
2496
2485
  for (let l = 1; l <= It; l += 1) {
2497
- const p = G.current.get(l);
2498
- p && h.observe(p);
2486
+ const f = G.current.get(l);
2487
+ f && h.observe(f);
2499
2488
  }
2500
2489
  return () => h.disconnect();
2501
2490
  }, [it, It]);
2502
- const Je = ht > 1, tn = It ? ht < It : !1, hi = Y(() => {
2503
- Je && xe(ht - 1);
2504
- }, [Je, ht, xe]), ui = Y(() => {
2505
- tn && xe(ht + 1);
2506
- }, [tn, ht, xe]), fi = Y(() => {
2491
+ const Je = dt > 1, tn = It ? dt < It : !1, hi = Y(() => {
2492
+ Je && xe(dt - 1);
2493
+ }, [Je, dt, xe]), ui = Y(() => {
2494
+ tn && xe(dt + 1);
2495
+ }, [tn, dt, xe]), fi = Y(() => {
2507
2496
  L((c) => (c + 90) % 360);
2508
2497
  }, []), pi = Y(() => {
2509
2498
  oe((c) => Math.max(0.25, Math.round((c - 0.1) * 100) / 100));
@@ -2512,14 +2501,14 @@ function oo({
2512
2501
  }, []), en = Y(async () => {
2513
2502
  if (!(!st || !qt.current))
2514
2503
  try {
2515
- const h = (await st.getPage(ht)).getViewport({ scale: 1, rotation: f }), p = window.matchMedia("(max-width: 720px)").matches ? 16 : 24, $ = Math.max(
2504
+ const h = (await st.getPage(dt)).getViewport({ scale: 1, rotation: p }), f = window.matchMedia("(max-width: 720px)").matches ? 16 : 24, $ = Math.max(
2516
2505
  0,
2517
- qt.current.clientWidth - p
2506
+ qt.current.clientWidth - f
2518
2507
  ) / h.width;
2519
2508
  oe(Math.max(0.25, Math.min(5, Math.round($ * 100) / 100)));
2520
2509
  } catch {
2521
2510
  }
2522
- }, [st, ht, f]);
2511
+ }, [st, dt, p]);
2523
2512
  Dt(() => {
2524
2513
  if (it !== "ready" || !st || !window.matchMedia("(max-width: 720px)").matches) return;
2525
2514
  let c = !1;
@@ -2527,21 +2516,21 @@ function oo({
2527
2516
  c || en();
2528
2517
  };
2529
2518
  h();
2530
- const l = qt.current, p = typeof ResizeObserver < "u" && l ? new ResizeObserver(() => h()) : null;
2531
- p == null || p.observe(l);
2519
+ const l = qt.current, f = typeof ResizeObserver < "u" && l ? new ResizeObserver(() => h()) : null;
2520
+ f == null || f.observe(l);
2532
2521
  const k = window.matchMedia("(max-width: 720px)"), $ = () => {
2533
2522
  k.matches && h();
2534
2523
  };
2535
2524
  return k.addEventListener("change", $), () => {
2536
- c = !0, p == null || p.disconnect(), k.removeEventListener("change", $);
2525
+ c = !0, f == null || f.disconnect(), k.removeEventListener("change", $);
2537
2526
  };
2538
- }, [it, st, Lt, f, en]);
2527
+ }, [it, st, Lt, p, en]);
2539
2528
  const bn = Pe(() => B.flatMap((c) => {
2540
2529
  const h = c.type ?? "sign";
2541
2530
  if (h !== "date" && h !== "text") return [];
2542
2531
  const l = (Xt[c.id] ?? c.value ?? "").trim();
2543
2532
  if (!l) return [];
2544
- const p = Math.max(
2533
+ const f = Math.max(
2545
2534
  10,
2546
2535
  Math.min(we, c.height * 0.55)
2547
2536
  );
@@ -2551,11 +2540,11 @@ function oo({
2551
2540
  pageNumber: c.pageNumber,
2552
2541
  fieldId: c.id,
2553
2542
  x: c.x + 4,
2554
- y: c.y + Math.max(2, (c.height - p) / 2),
2543
+ y: c.y + Math.max(2, (c.height - f) / 2),
2555
2544
  width: Math.max(12, c.width - 8),
2556
- height: Math.max(p * 1.2, c.height - 4),
2545
+ height: Math.max(f * 1.2, c.height - 4),
2557
2546
  value: l,
2558
- fontSize: p,
2547
+ fontSize: f,
2559
2548
  color: me
2560
2549
  }
2561
2550
  ];
@@ -2569,16 +2558,16 @@ function oo({
2569
2558
  try {
2570
2559
  const h = await Cn(st, {
2571
2560
  scale: 1.5,
2572
- rotation: f,
2561
+ rotation: p,
2573
2562
  annotations: P,
2574
2563
  signatures: N,
2575
2564
  texts: ke,
2576
2565
  mimeType: "image/png"
2577
2566
  }), l = document.createElement("iframe");
2578
2567
  l.style.position = "fixed", l.style.right = "0", l.style.bottom = "0", l.style.width = "0", l.style.height = "0", l.style.border = "0", l.setAttribute("aria-hidden", "true"), document.body.appendChild(l);
2579
- const p = (c = l.contentWindow) == null ? void 0 : c.document;
2580
- if (!p) throw new Error("print iframe not available");
2581
- p.open(), p.write(`<!doctype html>
2568
+ const f = (c = l.contentWindow) == null ? void 0 : c.document;
2569
+ if (!f) throw new Error("print iframe not available");
2570
+ f.open(), f.write(`<!doctype html>
2582
2571
  <html>
2583
2572
  <head>
2584
2573
  <meta charset="utf-8" />
@@ -2592,12 +2581,12 @@ function oo({
2592
2581
  </style>
2593
2582
  </head>
2594
2583
  <body></body>
2595
- </html>`), p.close();
2596
- const k = p.body;
2584
+ </html>`), f.close();
2585
+ const k = f.body;
2597
2586
  for (const $ of h) {
2598
- const z = p.createElement("img");
2587
+ const z = f.createElement("img");
2599
2588
  z.src = $.dataUrl;
2600
- const ot = p.createElement("div");
2589
+ const ot = f.createElement("div");
2601
2590
  ot.className = "page", ot.appendChild(z), k.appendChild(ot);
2602
2591
  }
2603
2592
  await Promise.all(
@@ -2630,7 +2619,7 @@ function oo({
2630
2619
  a(!1);
2631
2620
  }
2632
2621
  }
2633
- }, [st, it, f, o, U, bt, P, N, ke]), wi = Y(async () => {
2622
+ }, [st, it, p, o, U, bt, P, N, ke]), wi = Y(async () => {
2634
2623
  if (!st || it !== "ready") return;
2635
2624
  const c = `${o.replace(/[^\w.-]+/g, "_") || "document"}.pdf`;
2636
2625
  if (!(P.length > 0 || N.length > 0 || ke.length > 0) && U) {
@@ -2644,14 +2633,14 @@ function oo({
2644
2633
  try {
2645
2634
  const l = await Cn(st, {
2646
2635
  scale: 2,
2647
- rotation: f,
2636
+ rotation: p,
2648
2637
  annotations: P,
2649
2638
  signatures: N,
2650
2639
  texts: ke,
2651
2640
  mimeType: "image/jpeg",
2652
2641
  quality: 0.92
2653
- }), p = Pr(l), k = new Uint8Array(p.byteLength);
2654
- k.set(p), hn(
2642
+ }), f = Pr(l), k = new Uint8Array(f.byteLength);
2643
+ k.set(f), hn(
2655
2644
  new Blob([k], { type: "application/pdf" }),
2656
2645
  c
2657
2646
  );
@@ -2663,24 +2652,24 @@ function oo({
2663
2652
  } finally {
2664
2653
  v(!1);
2665
2654
  }
2666
- }, [st, it, f, o, U, P, N, ke]), yi = Y((c) => {
2655
+ }, [st, it, p, o, U, P, N, ke]), yi = Y((c) => {
2667
2656
  D((h) => h === c ? "none" : c);
2668
2657
  }, []), bi = M === "highlight" || M === "underline" ? Un(M === "highlight" ? _e : M === "underline" ? ae : null, M) : void 0, Ne = St != null ? N.find((c) => c.id === St) ?? null : null, _i = Y((c) => {
2669
2658
  F((h) => [...h, c]);
2670
2659
  }, []), vi = Y((c) => {
2671
2660
  F((h) => h.filter((l) => l.id !== c));
2672
2661
  }, []), xi = Y(() => {
2673
- F([]), j([]), R([]), Pt(null), se(null), de(null), he(null);
2662
+ F([]), j([]), R([]), Nt(null), se(null), de(null), he(null);
2674
2663
  }, []), Be = Y(
2675
2664
  (c, h) => {
2676
2665
  const l = B.findIndex(
2677
2666
  (k) => k.id === c
2678
- ), p = B.slice(l + 1).find((k) => !h.has(k.id)) ?? B.slice(0, Math.max(0, l)).find((k) => !h.has(k.id));
2679
- if (!p) {
2667
+ ), f = B.slice(l + 1).find((k) => !h.has(k.id)) ?? B.slice(0, Math.max(0, l)).find((k) => !h.has(k.id));
2668
+ if (!f) {
2680
2669
  X(!1), Gt(null);
2681
2670
  return;
2682
2671
  }
2683
- Ut(p.id), Pt(null), Gt(null), ft(p.type ?? "sign"), Me(p), window.setTimeout(() => {
2672
+ Ut(f.id), Nt(null), Gt(null), ft(f.type ?? "sign"), Me(f), window.setTimeout(() => {
2684
2673
  X(!0);
2685
2674
  }, 350);
2686
2675
  },
@@ -2696,17 +2685,17 @@ function oo({
2696
2685
  (c) => {
2697
2686
  const h = Xt[c];
2698
2687
  h && (tt == null || tt(c, h));
2699
- const l = B.findIndex(($) => $.id === c), p = new Set(
2688
+ const l = B.findIndex(($) => $.id === c), f = new Set(
2700
2689
  Object.keys(Xt).filter(($) => {
2701
2690
  var z;
2702
2691
  return (z = Xt[$]) == null ? void 0 : z.trim();
2703
2692
  })
2704
2693
  );
2705
- p.add(c);
2694
+ f.add(c);
2706
2695
  const k = B.slice(l + 1).find(
2707
- ($) => !p.has($.id) && !N.some((z) => z.fieldId === $.id)
2696
+ ($) => !f.has($.id) && !N.some((z) => z.fieldId === $.id)
2708
2697
  ) ?? B.slice(0, Math.max(0, l)).find(
2709
- ($) => !p.has($.id) && !N.some((z) => z.fieldId === $.id)
2698
+ ($) => !f.has($.id) && !N.some((z) => z.fieldId === $.id)
2710
2699
  );
2711
2700
  k && (Ut(k.id), Me(k));
2712
2701
  },
@@ -2714,15 +2703,15 @@ function oo({
2714
2703
  ), Pi = Y(
2715
2704
  (c, h, l) => {
2716
2705
  var pe;
2717
- const p = Xi(h, l);
2706
+ const f = Xi(h, l);
2718
2707
  if (Yt) {
2719
2708
  j(
2720
2709
  (Q) => Q.map(
2721
2710
  (Ct) => Ct.id === Yt ? {
2722
2711
  ...Ct,
2723
2712
  imageDataUrl: c,
2724
- width: Ct.fieldId ? Ct.width : p.width,
2725
- height: Ct.fieldId ? Ct.height : p.height
2713
+ width: Ct.fieldId ? Ct.width : f.width,
2714
+ height: Ct.fieldId ? Ct.height : f.height
2726
2715
  } : Ct
2727
2716
  )
2728
2717
  ), At(null), D("none"), X(!1), Gt(null);
@@ -2761,7 +2750,7 @@ function oo({
2761
2750
  Ct.map((V) => V.id),
2762
2751
  Tt[0],
2763
2752
  ge
2764
- ), At(null), D("none"), Pt(((pe = Tt[0]) == null ? void 0 : pe.id) ?? null);
2753
+ ), At(null), D("none"), Nt(((pe = Tt[0]) == null ? void 0 : pe.id) ?? null);
2765
2754
  const wt = new Set(
2766
2755
  B.filter(
2767
2756
  (V) => De(
@@ -2775,32 +2764,32 @@ function oo({
2775
2764
  Be(Q.id, wt);
2776
2765
  return;
2777
2766
  }
2778
- const k = G.current.get(ht), $ = k == null ? void 0 : k.querySelector(
2767
+ const k = G.current.get(dt), $ = k == null ? void 0 : k.querySelector(
2779
2768
  ".epochs-pdf-viewer__surface"
2780
2769
  );
2781
2770
  let z = 24, ot = 24;
2782
2771
  if ($) {
2783
- const Q = Ce($, Nt), Ct = $.closest(".epochs-pdf-viewer__body");
2772
+ const Q = Ce($, kt), Ct = $.closest(".epochs-pdf-viewer__body");
2784
2773
  if (Ct) {
2785
2774
  const Tt = Pn(
2786
2775
  Ct.getBoundingClientRect(),
2787
2776
  $,
2788
- Nt
2777
+ kt
2789
2778
  ), re = Math.max(0, Tt.top), ge = Math.min(Q.height, Tt.bottom), wt = Math.max(0, Tt.left), V = Math.min(Q.width, Tt.right);
2790
- z = Math.max(0, (wt + V) / 2 - p.width / 2), ot = Math.max(0, (re + ge) / 2 - p.height / 2), z = Math.min(z, Math.max(0, Q.width - p.width)), ot = Math.min(ot, Math.max(0, Q.height - p.height));
2779
+ z = Math.max(0, (wt + V) / 2 - f.width / 2), ot = Math.max(0, (re + ge) / 2 - f.height / 2), z = Math.min(z, Math.max(0, Q.width - f.width)), ot = Math.min(ot, Math.max(0, Q.height - f.height));
2791
2780
  } else
2792
- z = Math.max(0, (Q.width - p.width) / 2), ot = Math.max(0, (Q.height - p.height) / 2);
2781
+ z = Math.max(0, (Q.width - f.width) / 2), ot = Math.max(0, (Q.height - f.height) / 2);
2793
2782
  }
2794
2783
  const Ot = {
2795
2784
  id: Se(),
2796
- pageNumber: ht,
2785
+ pageNumber: dt,
2797
2786
  x: z,
2798
2787
  y: ot,
2799
- width: p.width,
2800
- height: p.height,
2788
+ width: f.width,
2789
+ height: f.height,
2801
2790
  imageDataUrl: c
2802
2791
  };
2803
- j((Q) => [...Q, Ot]), Le(void 0, Ot), Pt(Ot.id), At(null), D("none"), X(!1), Gt(null);
2792
+ j((Q) => [...Q, Ot]), Le(void 0, Ot), Nt(Ot.id), At(null), D("none"), X(!1), Gt(null);
2804
2793
  },
2805
2794
  [
2806
2795
  Be,
@@ -2809,8 +2798,8 @@ function oo({
2809
2798
  Xt,
2810
2799
  jt,
2811
2800
  De,
2812
- ht,
2813
- Nt,
2801
+ dt,
2802
+ kt,
2814
2803
  _t,
2815
2804
  B,
2816
2805
  N,
@@ -2840,30 +2829,30 @@ function oo({
2840
2829
  Be(Q.id, ge);
2841
2830
  return;
2842
2831
  }
2843
- const l = we, p = Math.max(80, c.length * l * 0.55), k = l * 1.25;
2832
+ const l = we, f = Math.max(80, c.length * l * 0.55), k = l * 1.25;
2844
2833
  let $ = 24, z = 24;
2845
- const ot = G.current.get(ht), Ot = ot == null ? void 0 : ot.querySelector(
2834
+ const ot = G.current.get(dt), Ot = ot == null ? void 0 : ot.querySelector(
2846
2835
  ".epochs-pdf-viewer__surface"
2847
2836
  );
2848
2837
  if (Ot) {
2849
- const Q = Ce(Ot, Nt), Ct = Ot.closest(
2838
+ const Q = Ce(Ot, kt), Ct = Ot.closest(
2850
2839
  ".epochs-pdf-viewer__body"
2851
2840
  );
2852
2841
  if (Ct) {
2853
2842
  const Tt = Pn(
2854
2843
  Ct.getBoundingClientRect(),
2855
2844
  Ot,
2856
- Nt
2845
+ kt
2857
2846
  ), re = Math.max(0, Tt.top), ge = Math.min(Q.height, Tt.bottom), wt = Math.max(0, Tt.left), V = Math.min(Q.width, Tt.right);
2858
- $ = Math.max(0, (wt + V) / 2 - p / 2), z = Math.max(0, (re + ge) / 2 - k / 2), $ = Math.min($, Math.max(0, Q.width - p)), z = Math.min(z, Math.max(0, Q.height - k));
2847
+ $ = Math.max(0, (wt + V) / 2 - f / 2), z = Math.max(0, (re + ge) / 2 - k / 2), $ = Math.min($, Math.max(0, Q.width - f)), z = Math.min(z, Math.max(0, Q.height - k));
2859
2848
  }
2860
2849
  }
2861
2850
  const pe = {
2862
2851
  id: Ge(),
2863
- pageNumber: ht,
2852
+ pageNumber: dt,
2864
2853
  x: $,
2865
2854
  y: z,
2866
- width: p,
2855
+ width: f,
2867
2856
  height: k,
2868
2857
  value: c,
2869
2858
  fontSize: l,
@@ -2877,34 +2866,34 @@ function oo({
2877
2866
  Xt,
2878
2867
  jt,
2879
2868
  De,
2880
- ht,
2881
- Nt,
2869
+ dt,
2870
+ kt,
2882
2871
  _t,
2883
2872
  B,
2884
2873
  N,
2885
2874
  pn
2886
2875
  ]
2887
2876
  ), Ii = Y((c) => {
2888
- j((h) => [...h, c]), Le(void 0, c), Pt(c.id), At(null), D("none");
2877
+ j((h) => [...h, c]), Le(void 0, c), Nt(c.id), At(null), D("none");
2889
2878
  }, [Le]), Ci = Y(
2890
2879
  (c, h) => {
2891
2880
  j(
2892
- (l) => l.map((p) => p.id === c ? { ...p, ...h } : p)
2881
+ (l) => l.map((f) => f.id === c ? { ...f, ...h } : f)
2893
2882
  );
2894
2883
  },
2895
2884
  []
2896
2885
  ), Ti = Y((c) => {
2897
2886
  const h = N.find((l) => l.id === c);
2898
- j((l) => l.filter((p) => p.id !== c)), Pt((l) => l === c ? null : l), h != null && h.fieldId && Ut(h.fieldId);
2887
+ j((l) => l.filter((f) => f.id !== c)), Nt((l) => l === c ? null : l), h != null && h.fieldId && Ut(h.fieldId);
2899
2888
  }, [N]), Di = Y((c) => {
2900
2889
  const h = c ? N.find((Ot) => Ot.id === c) ?? null : Ne;
2901
2890
  if (!h) return;
2902
- const l = G.current.get(h.pageNumber), p = l == null ? void 0 : l.querySelector(
2891
+ const l = G.current.get(h.pageNumber), f = l == null ? void 0 : l.querySelector(
2903
2892
  ".epochs-pdf-viewer__surface"
2904
2893
  ), k = 18;
2905
2894
  let $ = h.x + k, z = h.y + k;
2906
- if (p) {
2907
- const Ot = p.clientWidth / Nt, pe = p.clientHeight / Nt;
2895
+ if (f) {
2896
+ const Ot = f.clientWidth / kt, pe = f.clientHeight / kt;
2908
2897
  $ = Math.min(
2909
2898
  Math.max(0, $),
2910
2899
  Math.max(0, Ot - h.width)
@@ -2919,30 +2908,30 @@ function oo({
2919
2908
  x: $,
2920
2909
  y: z
2921
2910
  };
2922
- j((Ot) => [...Ot, ot]), Pt(ot.id), At(null), D("none");
2923
- }, [Nt, Ne, N]), Li = Y((c) => {
2911
+ j((Ot) => [...Ot, ot]), Nt(ot.id), At(null), D("none");
2912
+ }, [kt, Ne, N]), Li = Y((c) => {
2924
2913
  const h = c ?? (Ne == null ? void 0 : Ne.id);
2925
2914
  if (!h) return;
2926
- const l = N.find((k) => k.id === h), p = l != null && l.fieldId ? B.find((k) => k.id === l.fieldId) : void 0;
2927
- ft((p == null ? void 0 : p.type) ?? "sign"), Pt(h), Gt(h), X(!0);
2915
+ const l = N.find((k) => k.id === h), f = l != null && l.fieldId ? B.find((k) => k.id === l.fieldId) : void 0;
2916
+ ft((f == null ? void 0 : f.type) ?? "sign"), Nt(h), Gt(h), X(!0);
2928
2917
  }, [Ne, N, B]), Fi = Y((c) => {
2929
2918
  R((h) => c.fieldId ? [...h.filter((l) => l.fieldId !== c.fieldId), c] : [...h, c]), se(c.id), c.fieldId && de(c.fieldId);
2930
2919
  }, []), Ri = Y(
2931
2920
  (c, h) => {
2932
2921
  R(
2933
- (l) => l.map((p) => p.id === c ? { ...p, ...h } : p)
2922
+ (l) => l.map((f) => f.id === c ? { ...f, ...h } : f)
2934
2923
  );
2935
2924
  },
2936
2925
  []
2937
2926
  ), Ai = Y((c) => {
2938
2927
  const h = Z.find((l) => l.id === c);
2939
- R((l) => l.filter((p) => p.id !== c)), se((l) => l === c ? null : l), he((l) => l === c ? null : l), h != null && h.fieldId && de(h.fieldId);
2928
+ R((l) => l.filter((f) => f.id !== c)), se((l) => l === c ? null : l), he((l) => l === c ? null : l), h != null && h.fieldId && de(h.fieldId);
2940
2929
  }, [Z]);
2941
2930
  Dt(() => {
2942
2931
  Te && R(
2943
2932
  (c) => c.map((h) => {
2944
2933
  if (!h.fieldId) return h;
2945
- const l = E.find((p) => p.id === h.fieldId);
2934
+ const l = E.find((f) => f.id === h.fieldId);
2946
2935
  return l ? {
2947
2936
  ...h,
2948
2937
  pageNumber: l.pageNumber,
@@ -2963,10 +2952,10 @@ function oo({
2963
2952
  const h = _t != null ? B.findIndex(($) => $.id === _t) : -1, l = Math.min(
2964
2953
  B.length - 1,
2965
2954
  Math.max(0, (h < 0 ? 0 : h) + c)
2966
- ), p = B[l];
2967
- p && (Ut(p.id), Pt(
2968
- ((k = N.find(($) => $.fieldId === p.id)) == null ? void 0 : k.id) ?? null
2969
- ), Me(p));
2955
+ ), f = B[l];
2956
+ f && (Ut(f.id), Nt(
2957
+ ((k = N.find(($) => $.fieldId === f.id)) == null ? void 0 : k.id) ?? null
2958
+ ), Me(f));
2970
2959
  },
2971
2960
  [
2972
2961
  Me,
@@ -2994,10 +2983,10 @@ function oo({
2994
2983
  canGoNext: tn,
2995
2984
  handlePrev: hi,
2996
2985
  handleNext: ui,
2997
- pageNumber: ht,
2986
+ pageNumber: dt,
2998
2987
  numPages: It,
2999
2988
  scrollToPage: xe,
3000
- scale: Nt,
2989
+ scale: kt,
3001
2990
  handleZoomOut: pi,
3002
2991
  handleZoomIn: gi,
3003
2992
  handleFitWidth: en,
@@ -3033,7 +3022,7 @@ function oo({
3033
3022
  return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__toolbar-group" });
3034
3023
  if (l.length === 0)
3035
3024
  return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" });
3036
- const p = l.map((k, $) => {
3025
+ const f = l.map((k, $) => {
3037
3026
  const z = l[$ - 1], ot = Rn(k) && (!z || !Rn(z));
3038
3027
  return /* @__PURE__ */ s(Wi, { children: Fr(k, vn, { showMarkupSep: ot }) }, k);
3039
3028
  });
@@ -3042,7 +3031,7 @@ function oo({
3042
3031
  {
3043
3032
  className: h ? "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" : "epochs-pdf-viewer__toolbar-group",
3044
3033
  children: [
3045
- p,
3034
+ f,
3046
3035
  Rr(vn, new Set(l))
3047
3036
  ]
3048
3037
  }
@@ -3060,12 +3049,12 @@ function oo({
3060
3049
  xn(ue.left),
3061
3050
  xn(ue.right, !0)
3062
3051
  ] }) : null,
3063
- Ze || kt || jt ? /* @__PURE__ */ s(
3052
+ Ze || Pt || jt ? /* @__PURE__ */ s(
3064
3053
  Cr,
3065
3054
  {
3066
3055
  open: lt,
3067
3056
  onClose: () => {
3068
- X(!1), Gt(null), ft(void 0), dt == null || dt();
3057
+ X(!1), Gt(null), ft(void 0), ut == null || ut();
3069
3058
  },
3070
3059
  onSave: Pi,
3071
3060
  onSaveFieldValue: $i,
@@ -3102,8 +3091,8 @@ function oo({
3102
3091
  {
3103
3092
  pdfDoc: st,
3104
3093
  pageNumber: l,
3105
- isActive: l === ht,
3106
- rotation: f,
3094
+ isActive: l === dt,
3095
+ rotation: p,
3107
3096
  onSelect: xe,
3108
3097
  width: m,
3109
3098
  annotations: P,
@@ -3147,8 +3136,8 @@ function oo({
3147
3136
  {
3148
3137
  pdfDoc: st,
3149
3138
  pageNumber: l,
3150
- scale: Nt,
3151
- rotation: f,
3139
+ scale: kt,
3140
+ rotation: p,
3152
3141
  markupTool: at ? M : "none",
3153
3142
  markupColor: bi,
3154
3143
  annotations: P,
@@ -3162,7 +3151,7 @@ function oo({
3162
3151
  onEditSignature: Li,
3163
3152
  onDuplicateSignature: Di,
3164
3153
  selectedSignatureId: St,
3165
- onSelectSignature: Pt,
3154
+ onSelectSignature: Nt,
3166
3155
  signatureFields: B,
3167
3156
  selectedSignatureFieldId: _t,
3168
3157
  onSelectSignatureField: Ut,
@@ -3183,8 +3172,8 @@ function oo({
3183
3172
  hasFixedTextFields: Te,
3184
3173
  editingTextId: qe,
3185
3174
  onEditingTextIdChange: he,
3186
- pageRef: (p) => {
3187
- p && G.current.set(l, p);
3175
+ pageRef: (f) => {
3176
+ f && G.current.set(l, f);
3188
3177
  }
3189
3178
  },
3190
3179
  l
@@ -3465,7 +3454,7 @@ function ci(t, e, n, i, r) {
3465
3454
  const b = o.flexDirection ?? "column", x = o.gap ?? 0, I = [];
3466
3455
  let S = m + u.left, H = g + u.top, W = 0, A = 0;
3467
3456
  for (let E = 0; E < t.children.length; E++) {
3468
- const ct = t.children[E], ut = b === "row" ? Math.max(0, y - W - (E > 0 ? x : 0)) : y, gt = b === "column" ? Math.max(0, r - (H - n) - d.bottom) : r, tt = ci(ct, S, H, ut, gt);
3457
+ const ct = t.children[E], ht = b === "row" ? Math.max(0, y - W - (E > 0 ? x : 0)) : y, gt = b === "column" ? Math.max(0, r - (H - n) - d.bottom) : r, tt = ci(ct, S, H, ht, gt);
3469
3458
  I.push(tt), b === "row" ? (W += tt.width + Ae(ct.props.style ?? {}).left + Ae(ct.props.style ?? {}).right, E < t.children.length - 1 && (W += x), S = m + u.left + W, A = Math.max(A, tt.height)) : (W += tt.height + Ae(ct.props.style ?? {}).top + Ae(ct.props.style ?? {}).bottom, E < t.children.length - 1 && (W += x), H = g + u.top + W, A = Math.max(A, tt.width));
3470
3459
  }
3471
3460
  const C = $e(