epochs-pdf 0.1.7 → 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.
- package/dist/epochs-pdf.cjs +18 -18
- package/dist/epochs-pdf.cjs.map +1 -1
- package/dist/epochs-pdf.css +1 -1
- package/dist/epochs-pdf.js +1352 -1340
- package/dist/epochs-pdf.js.map +1 -1
- package/package.json +1 -1
package/dist/epochs-pdf.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useRef as xt, useState as
|
|
5
|
-
import { jsxs as T, jsx as s, Fragment as
|
|
6
|
-
import * as
|
|
1
|
+
var ji = Object.defineProperty;
|
|
2
|
+
var Bi = (t, e, n) => e in t ? ji(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var on = (t, e, n) => Bi(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { useRef as xt, useState as O, useEffect as Dt, useMemo as Pe, useCallback as Y, Fragment as Wi } from "react";
|
|
5
|
+
import { jsxs as T, jsx as s, Fragment as je } from "react/jsx-runtime";
|
|
6
|
+
import * as Ie from "pdfjs-dist";
|
|
7
7
|
import { TextLayer as Oi } from "pdfjs-dist";
|
|
8
|
-
const
|
|
8
|
+
const He = "#ffffff", An = [
|
|
9
9
|
{ id: "yellow", label: "Yellow", hex: "#facc15" },
|
|
10
10
|
{ id: "green", label: "Green", hex: "#4ade80" },
|
|
11
11
|
{ id: "pink", label: "Pink", hex: "#f472b6" },
|
|
12
12
|
{ id: "blue", label: "Blue", hex: "#60a5fa" },
|
|
13
13
|
{ id: "orange", label: "Orange", hex: "#fb923c" },
|
|
14
14
|
{ id: "purple", label: "Purple", hex: "#c084fc" }
|
|
15
|
-
],
|
|
15
|
+
], En = [
|
|
16
16
|
{ id: "blue", label: "Blue", hex: "#2563eb" },
|
|
17
17
|
{ id: "red", label: "Red", hex: "#dc2626" },
|
|
18
18
|
{ id: "green", label: "Green", hex: "#16a34a" },
|
|
19
19
|
{ id: "orange", label: "Orange", hex: "#ea580c" },
|
|
20
20
|
{ id: "purple", label: "Purple", hex: "#7c3aed" },
|
|
21
21
|
{ id: "black", label: "Black", hex: "#111827" }
|
|
22
|
-
],
|
|
23
|
-
|
|
24
|
-
function
|
|
22
|
+
], Hn = An[0].hex, zi = En[0].hex;
|
|
23
|
+
Un(Hn, "highlight");
|
|
24
|
+
function sn() {
|
|
25
25
|
return `m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function le(t) {
|
|
28
28
|
const e = t.trim();
|
|
29
29
|
if (/^#[0-9a-fA-F]{6}$/.test(e)) return e.toLowerCase();
|
|
30
30
|
if (/^#[0-9a-fA-F]{3}$/.test(e)) {
|
|
@@ -33,15 +33,15 @@ function ce(t) {
|
|
|
33
33
|
}
|
|
34
34
|
return e;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const i =
|
|
36
|
+
function Un(t, e, n = 0.45) {
|
|
37
|
+
const i = le(t);
|
|
38
38
|
if (e === "underline" || e === "redact") return i;
|
|
39
39
|
const r = /^#([0-9a-f]{6})$/i.exec(i);
|
|
40
40
|
if (!r) return `rgba(250, 204, 21, ${n})`;
|
|
41
41
|
const o = Number.parseInt(r[1], 16), d = o >> 16 & 255, u = o >> 8 & 255, m = o & 255;
|
|
42
42
|
return `rgba(${d}, ${u}, ${m}, ${n})`;
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function an(t, e) {
|
|
45
45
|
const n = window.getSelection();
|
|
46
46
|
if (!n || n.isCollapsed || n.rangeCount === 0)
|
|
47
47
|
return null;
|
|
@@ -60,7 +60,7 @@ function en(t, e) {
|
|
|
60
60
|
h: r.height > 0 ? _.height / r.height * (m / d) : 0
|
|
61
61
|
})), text: n.toString() };
|
|
62
62
|
}
|
|
63
|
-
function
|
|
63
|
+
function Nn(t) {
|
|
64
64
|
const n = [...t].sort((i, r) => i.y - r.y || i.x - r.x)[0] ?? { x: 0, y: 0, h: 14 };
|
|
65
65
|
return {
|
|
66
66
|
x: n.x,
|
|
@@ -68,7 +68,7 @@ function xn(t) {
|
|
|
68
68
|
fontSize: Math.max(8, Math.round(n.h * 0.9) || 14)
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
71
|
+
function cn(t, e = 2) {
|
|
72
72
|
return t.map((n) => ({
|
|
73
73
|
x: Math.max(0, n.x - e),
|
|
74
74
|
y: Math.max(0, n.y - e),
|
|
@@ -76,26 +76,26 @@ function nn(t, e = 2) {
|
|
|
76
76
|
h: n.h + e * 2
|
|
77
77
|
}));
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function jn(t, e, n) {
|
|
80
80
|
for (const i of e)
|
|
81
81
|
for (const r of i.rects) {
|
|
82
82
|
const o = r.x * n, d = r.y * n, u = r.w * n, m = r.h * n;
|
|
83
83
|
if (i.kind === "highlight")
|
|
84
84
|
t.save(), t.globalCompositeOperation = "multiply", t.fillStyle = i.color, t.fillRect(o, d, u, m), t.restore();
|
|
85
85
|
else if (i.kind === "redact")
|
|
86
|
-
t.fillStyle = i.color ||
|
|
86
|
+
t.fillStyle = i.color || He, t.fillRect(o, d, u, m);
|
|
87
87
|
else {
|
|
88
88
|
const g = Math.max(2, n * 1.5);
|
|
89
89
|
t.fillStyle = i.color, t.fillRect(o, d + m - g, u, g);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function Se() {
|
|
94
94
|
return `s_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
95
95
|
}
|
|
96
|
-
async function
|
|
96
|
+
async function Bn(t, e, n) {
|
|
97
97
|
for (const i of e) {
|
|
98
|
-
const r = await
|
|
98
|
+
const r = await Gi(i.imageDataUrl);
|
|
99
99
|
t.drawImage(
|
|
100
100
|
r,
|
|
101
101
|
i.x * n,
|
|
@@ -105,7 +105,7 @@ async function Un(t, e, n) {
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function Si(t, e, n, i) {
|
|
109
109
|
t.save();
|
|
110
110
|
for (const r of e) {
|
|
111
111
|
const o = n.has(r.id), d = r.x * i, u = r.y * i, m = r.width * i, g = r.height * i;
|
|
@@ -113,7 +113,7 @@ function zi(t, e, n, i) {
|
|
|
113
113
|
}
|
|
114
114
|
t.restore();
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function Gi(t) {
|
|
117
117
|
return new Promise((e, n) => {
|
|
118
118
|
const i = new Image();
|
|
119
119
|
i.onload = () => e(i), i.onerror = () => n(new Error("Failed to load signature image")), i.src = t;
|
|
@@ -128,28 +128,28 @@ function Xi(t, e, n = 180, i = 64) {
|
|
|
128
128
|
height: Math.max(20, e * r)
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function We(t, e, n, i) {
|
|
132
132
|
const r = n.getBoundingClientRect(), o = n.clientWidth || r.width, d = n.clientHeight || r.height;
|
|
133
133
|
return r.width <= 0 || r.height <= 0 || i <= 0 ? { x: 0, y: 0 } : {
|
|
134
134
|
x: (t - r.left) / r.width * (o / i),
|
|
135
135
|
y: (e - r.top) / r.height * (d / i)
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Ce(t, e) {
|
|
139
139
|
return {
|
|
140
140
|
width: t.clientWidth / e,
|
|
141
141
|
height: t.clientHeight / e
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Vi(t, e, n, i) {
|
|
145
145
|
const r = n.getBoundingClientRect(), o = n.clientWidth || r.width, d = n.clientHeight || r.height;
|
|
146
146
|
return r.width <= 0 || r.height <= 0 || i <= 0 ? { dx: 0, dy: 0 } : {
|
|
147
147
|
dx: t / r.width * (o / i),
|
|
148
148
|
dy: e / r.height * (d / i)
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
const i = e.getBoundingClientRect(), { width: r, height: o } =
|
|
151
|
+
function Pn(t, e, n) {
|
|
152
|
+
const i = e.getBoundingClientRect(), { width: r, height: o } = Ce(e, n);
|
|
153
153
|
return i.width <= 0 || i.height <= 0 ? { left: 0, top: 0, right: r, bottom: o } : {
|
|
154
154
|
left: (t.left - i.left) / i.width * r,
|
|
155
155
|
top: (t.top - i.top) / i.height * o,
|
|
@@ -157,60 +157,60 @@ function Mn(t, e, n) {
|
|
|
157
157
|
bottom: (t.bottom - i.top) / i.height * o
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
const
|
|
161
|
-
function
|
|
160
|
+
const we = 14, me = "#111827", ln = 24, dn = 20;
|
|
161
|
+
function Ge() {
|
|
162
162
|
return `t_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function Re(t, e) {
|
|
165
165
|
if (typeof document > "u")
|
|
166
166
|
return {
|
|
167
|
-
width: Math.max(
|
|
168
|
-
height: Math.max(
|
|
167
|
+
width: Math.max(ln, t.length * e * 0.55),
|
|
168
|
+
height: Math.max(dn, e * 1.25)
|
|
169
169
|
};
|
|
170
170
|
const i = document.createElement("canvas").getContext("2d");
|
|
171
171
|
if (!i)
|
|
172
172
|
return {
|
|
173
|
-
width: Math.max(
|
|
174
|
-
height: Math.max(
|
|
173
|
+
width: Math.max(ln, t.length * e * 0.55),
|
|
174
|
+
height: Math.max(dn, e * 1.25)
|
|
175
175
|
};
|
|
176
176
|
i.font = `${e}px sans-serif`;
|
|
177
177
|
const r = t.split(`
|
|
178
178
|
`), o = e * 1.25;
|
|
179
|
-
let d =
|
|
179
|
+
let d = ln;
|
|
180
180
|
for (const u of r)
|
|
181
181
|
d = Math.max(d, i.measureText(u || " ").width + 4);
|
|
182
182
|
return {
|
|
183
183
|
width: d,
|
|
184
|
-
height: Math.max(
|
|
184
|
+
height: Math.max(dn, r.length * o)
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
187
|
function qi(t, e, n, i, r) {
|
|
188
|
-
var
|
|
189
|
-
const o = n.getBoundingClientRect(), d = n.clientWidth || o.width, u = n.clientHeight || o.height, m = (
|
|
190
|
-
const at =
|
|
191
|
-
return at > 0 ?
|
|
188
|
+
var A;
|
|
189
|
+
const o = n.getBoundingClientRect(), d = n.clientWidth || o.width, u = n.clientHeight || o.height, m = (C) => o.width > 0 ? (C - o.left) / o.width * (d / r) : 0, g = (C) => o.height > 0 ? (C - o.top) / o.height * (u / r) : 0, _ = (C, nt) => {
|
|
190
|
+
const at = nt === "x" ? o.width : o.height, q = nt === "x" ? d : u;
|
|
191
|
+
return at > 0 ? C / at * (q / r) : 0;
|
|
192
192
|
};
|
|
193
|
-
let
|
|
194
|
-
const
|
|
195
|
-
if (
|
|
193
|
+
let y = m(t), b = g(e), x = we;
|
|
194
|
+
const I = Yi(t, e, i);
|
|
195
|
+
if (I)
|
|
196
196
|
return {
|
|
197
|
-
x: m(
|
|
198
|
-
y: g(
|
|
199
|
-
fontSize: Math.max(8, Math.round(_(
|
|
197
|
+
x: m(I.x),
|
|
198
|
+
y: g(I.y),
|
|
199
|
+
fontSize: Math.max(8, Math.round(_(I.fontSize, "y") * 10) / 10)
|
|
200
200
|
};
|
|
201
|
-
const S = document, H = (
|
|
201
|
+
const S = document, H = (A = S.caretRangeFromPoint) == null ? void 0 : A.call(S, t, e);
|
|
202
202
|
if (H && i.contains(H.startContainer)) {
|
|
203
|
-
const
|
|
204
|
-
if (
|
|
205
|
-
b = g(
|
|
206
|
-
const at = m(
|
|
207
|
-
return Math.abs(at -
|
|
203
|
+
const C = H.getClientRects(), nt = C.length > 0 ? C[0] : H.getBoundingClientRect();
|
|
204
|
+
if (nt.height > 0) {
|
|
205
|
+
b = g(nt.top), x = Zi(H.startContainer, r, n);
|
|
206
|
+
const at = m(nt.left);
|
|
207
|
+
return Math.abs(at - y) < _(8, "x") && (y = at), { x: y, y: b, fontSize: x };
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
|
-
const
|
|
211
|
-
return
|
|
210
|
+
const W = Ki(t, e, i);
|
|
211
|
+
return W && (b = g(W.top), x = Math.max(8, Math.round(_(W.height, "y") * 10) / 10)), { x: y, y: b, fontSize: x };
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function Yi(t, e, n) {
|
|
214
214
|
var o;
|
|
215
215
|
const i = Array.from(
|
|
216
216
|
n.querySelectorAll("span")
|
|
@@ -240,7 +240,7 @@ function Vi(t, e, n) {
|
|
|
240
240
|
}
|
|
241
241
|
return null;
|
|
242
242
|
}
|
|
243
|
-
function
|
|
243
|
+
function Ki(t, e, n) {
|
|
244
244
|
var o;
|
|
245
245
|
const i = Array.from(
|
|
246
246
|
n.querySelectorAll("span")
|
|
@@ -255,11 +255,11 @@ function Yi(t, e, n) {
|
|
|
255
255
|
}
|
|
256
256
|
return r ? { top: r.top, height: r.height } : null;
|
|
257
257
|
}
|
|
258
|
-
function
|
|
258
|
+
function Zi(t, e, n) {
|
|
259
259
|
const i = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement;
|
|
260
|
-
return i ?
|
|
260
|
+
return i ? Qi(i, e, n) : we;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function Qi(t, e, n) {
|
|
263
263
|
const i = t.getBoundingClientRect().height;
|
|
264
264
|
if (i > 0) {
|
|
265
265
|
if (n) {
|
|
@@ -273,15 +273,15 @@ function Zi(t, e, n) {
|
|
|
273
273
|
return Math.max(8, Math.round(i / e * 10) / 10);
|
|
274
274
|
}
|
|
275
275
|
const r = window.getComputedStyle(t).fontSize, o = Number.parseFloat(r);
|
|
276
|
-
return Number.isFinite(o) && o > 0 ? Math.max(8, Math.round(o / e * 10) / 10) :
|
|
276
|
+
return Number.isFinite(o) && o > 0 ? Math.max(8, Math.round(o / e * 10) / 10) : we;
|
|
277
277
|
}
|
|
278
|
-
function
|
|
278
|
+
function Ji(t, e, n, i) {
|
|
279
279
|
for (const r of n)
|
|
280
280
|
if (r.pageNumber === i && t >= r.x && t <= r.x + r.width && e >= r.y && e <= r.y + r.height)
|
|
281
281
|
return r;
|
|
282
282
|
return null;
|
|
283
283
|
}
|
|
284
|
-
function
|
|
284
|
+
function tr(t, e, n) {
|
|
285
285
|
var x;
|
|
286
286
|
if (!n) return null;
|
|
287
287
|
const i = document, r = (x = i.caretRangeFromPoint) == null ? void 0 : x.call(i, t, e);
|
|
@@ -291,17 +291,17 @@ function Ji(t, e, n) {
|
|
|
291
291
|
const d = o.textContent;
|
|
292
292
|
let u = r.startOffset;
|
|
293
293
|
u = Math.min(Math.max(0, u), d.length);
|
|
294
|
-
const m = (
|
|
294
|
+
const m = (I) => /[\p{L}\p{N}_'-]/u.test(I);
|
|
295
295
|
let g = u, _ = u;
|
|
296
296
|
for (; g > 0 && m(d[g - 1]); ) g -= 1;
|
|
297
297
|
for (; _ < d.length && m(d[_]); ) _ += 1;
|
|
298
298
|
if (g === _) return null;
|
|
299
|
-
const
|
|
300
|
-
|
|
299
|
+
const y = document.createRange();
|
|
300
|
+
y.setStart(o, g), y.setEnd(o, _);
|
|
301
301
|
const b = window.getSelection();
|
|
302
|
-
return b == null || b.removeAllRanges(), b == null || b.addRange(
|
|
302
|
+
return b == null || b.removeAllRanges(), b == null || b.addRange(y), d.slice(g, _);
|
|
303
303
|
}
|
|
304
|
-
function
|
|
304
|
+
function Wn(t, e, n) {
|
|
305
305
|
t.save();
|
|
306
306
|
for (const i of e) {
|
|
307
307
|
if (!i.value.trim()) continue;
|
|
@@ -315,7 +315,7 @@ function Hn(t, e, n) {
|
|
|
315
315
|
}
|
|
316
316
|
t.restore();
|
|
317
317
|
}
|
|
318
|
-
function
|
|
318
|
+
function er(t, e, n, i) {
|
|
319
319
|
t.save();
|
|
320
320
|
for (const r of e) {
|
|
321
321
|
const o = n.has(r.id), d = r.x * i, u = r.y * i, m = r.width * i, g = r.height * i;
|
|
@@ -346,27 +346,27 @@ function Bt({
|
|
|
346
346
|
}
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
349
|
+
function nr(t) {
|
|
350
350
|
return /* @__PURE__ */ s(Bt, { ...t, children: /* @__PURE__ */ s("polyline", { points: "15 18 9 12 15 6" }) });
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function ir(t) {
|
|
353
353
|
return /* @__PURE__ */ s(Bt, { ...t, children: /* @__PURE__ */ s("polyline", { points: "9 18 15 12 9 6" }) });
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function rr(t) {
|
|
356
356
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
357
357
|
/* @__PURE__ */ s("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
358
358
|
/* @__PURE__ */ s("polyline", { points: "7 10 12 15 17 10" }),
|
|
359
359
|
/* @__PURE__ */ s("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
360
360
|
] });
|
|
361
361
|
}
|
|
362
|
-
function
|
|
362
|
+
function or(t) {
|
|
363
363
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
364
364
|
/* @__PURE__ */ s("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" }),
|
|
365
365
|
/* @__PURE__ */ s("polyline", { points: "15 3 21 3 21 9" }),
|
|
366
366
|
/* @__PURE__ */ s("line", { x1: "10", y1: "14", x2: "21", y2: "3" })
|
|
367
367
|
] });
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function sr(t) {
|
|
370
370
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
371
371
|
/* @__PURE__ */ s("rect", { x: "3", y: "3", width: "7", height: "7" }),
|
|
372
372
|
/* @__PURE__ */ s("rect", { x: "14", y: "3", width: "7", height: "7" }),
|
|
@@ -374,55 +374,55 @@ function or(t) {
|
|
|
374
374
|
/* @__PURE__ */ s("rect", { x: "3", y: "14", width: "7", height: "7" })
|
|
375
375
|
] });
|
|
376
376
|
}
|
|
377
|
-
function
|
|
377
|
+
function ar(t) {
|
|
378
378
|
return /* @__PURE__ */ s(Bt, { ...t, children: /* @__PURE__ */ s("line", { x1: "5", y1: "12", x2: "19", y2: "12" }) });
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function cr(t) {
|
|
381
381
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
382
382
|
/* @__PURE__ */ s("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
383
383
|
/* @__PURE__ */ s("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
384
384
|
] });
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function lr(t) {
|
|
387
387
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
388
388
|
/* @__PURE__ */ s("polyline", { points: "6 9 6 2 18 2 18 9" }),
|
|
389
389
|
/* @__PURE__ */ s("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
|
|
390
390
|
/* @__PURE__ */ s("rect", { x: "6", y: "14", width: "12", height: "8" })
|
|
391
391
|
] });
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function dr(t) {
|
|
394
394
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
395
395
|
/* @__PURE__ */ s("polyline", { points: "23 4 23 10 17 10" }),
|
|
396
396
|
/* @__PURE__ */ s("polyline", { points: "1 20 1 14 7 14" }),
|
|
397
397
|
/* @__PURE__ */ s("path", { d: "M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15" })
|
|
398
398
|
] });
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function hr(t) {
|
|
401
401
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
402
402
|
/* @__PURE__ */ s("polyline", { points: "23 4 23 10 17 10" }),
|
|
403
403
|
/* @__PURE__ */ s("path", { d: "M20.49 15a9 9 0 1 1-2.12-9.36L23 10" })
|
|
404
404
|
] });
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function ur(t) {
|
|
407
407
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
408
408
|
/* @__PURE__ */ s("path", { d: "M12 20h9" }),
|
|
409
409
|
/* @__PURE__ */ s("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
410
410
|
] });
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function fr(t) {
|
|
413
413
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
414
414
|
/* @__PURE__ */ s("path", { d: "M6 3v7a6 6 0 0 0 12 0V3" }),
|
|
415
415
|
/* @__PURE__ */ s("line", { x1: "4", y1: "21", x2: "20", y2: "21" })
|
|
416
416
|
] });
|
|
417
417
|
}
|
|
418
|
-
function
|
|
418
|
+
function pr(t) {
|
|
419
419
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
420
420
|
/* @__PURE__ */ s("path", { d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21" }),
|
|
421
421
|
/* @__PURE__ */ s("path", { d: "M22 21H7" }),
|
|
422
422
|
/* @__PURE__ */ s("path", { d: "m5 11 9 9" })
|
|
423
423
|
] });
|
|
424
424
|
}
|
|
425
|
-
function
|
|
425
|
+
function gr({ size: t = 16, className: e }) {
|
|
426
426
|
return /* @__PURE__ */ s(
|
|
427
427
|
"svg",
|
|
428
428
|
{
|
|
@@ -440,20 +440,20 @@ function pr({ size: t = 16, className: e }) {
|
|
|
440
440
|
}
|
|
441
441
|
);
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function mr(t) {
|
|
444
444
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
445
445
|
/* @__PURE__ */ s("path", { d: "M12 20h9" }),
|
|
446
446
|
/* @__PURE__ */ s("path", { d: "M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z" })
|
|
447
447
|
] });
|
|
448
448
|
}
|
|
449
|
-
function
|
|
449
|
+
function wr(t) {
|
|
450
450
|
return /* @__PURE__ */ T(Bt, { ...t, children: [
|
|
451
451
|
/* @__PURE__ */ s("polyline", { points: "4 7 4 4 20 4 20 7" }),
|
|
452
452
|
/* @__PURE__ */ s("line", { x1: "9", y1: "20", x2: "15", y2: "20" }),
|
|
453
453
|
/* @__PURE__ */ s("line", { x1: "12", y1: "4", x2: "12", y2: "20" })
|
|
454
454
|
] });
|
|
455
455
|
}
|
|
456
|
-
function
|
|
456
|
+
function yr({
|
|
457
457
|
pdfDoc: t,
|
|
458
458
|
pageNumber: e,
|
|
459
459
|
scale: n,
|
|
@@ -465,148 +465,148 @@ function wr({
|
|
|
465
465
|
annotations: m = [],
|
|
466
466
|
onAddAnnotation: g,
|
|
467
467
|
onRemoveAnnotation: _,
|
|
468
|
-
signatures:
|
|
468
|
+
signatures: y = [],
|
|
469
469
|
pendingSignature: b = null,
|
|
470
470
|
onAddSignature: x,
|
|
471
|
-
onUpdateSignature:
|
|
471
|
+
onUpdateSignature: I,
|
|
472
472
|
onRemoveSignature: S,
|
|
473
473
|
onEditSignature: H,
|
|
474
|
-
onDuplicateSignature:
|
|
475
|
-
selectedSignatureId:
|
|
476
|
-
onSelectSignature:
|
|
477
|
-
signatureFields:
|
|
474
|
+
onDuplicateSignature: W,
|
|
475
|
+
selectedSignatureId: A = null,
|
|
476
|
+
onSelectSignature: C,
|
|
477
|
+
signatureFields: nt = [],
|
|
478
478
|
selectedSignatureFieldId: at = null,
|
|
479
|
-
onSelectSignatureField:
|
|
479
|
+
onSelectSignatureField: q,
|
|
480
480
|
hasFixedSignatureFields: pt = !1,
|
|
481
481
|
onOpenSignaturePad: J,
|
|
482
482
|
fieldValues: Mt = {},
|
|
483
|
-
onFieldValueChange:
|
|
484
|
-
onFieldValueCommit:
|
|
485
|
-
pendingFieldValue:
|
|
486
|
-
onPlaceFieldValue:
|
|
483
|
+
onFieldValueChange: K,
|
|
484
|
+
onFieldValueCommit: Et,
|
|
485
|
+
pendingFieldValue: vt = null,
|
|
486
|
+
onPlaceFieldValue: E,
|
|
487
487
|
texts: ct = [],
|
|
488
|
-
onAddText:
|
|
488
|
+
onAddText: ht,
|
|
489
489
|
onUpdateText: gt,
|
|
490
490
|
onRemoveText: tt,
|
|
491
|
-
selectedTextId:
|
|
492
|
-
onSelectText:
|
|
491
|
+
selectedTextId: Pt = null,
|
|
492
|
+
onSelectText: ut,
|
|
493
493
|
textFields: te = [],
|
|
494
|
-
selectedTextFieldId:
|
|
495
|
-
onSelectTextField:
|
|
496
|
-
hasFixedTextFields:
|
|
497
|
-
editingTextId:
|
|
498
|
-
onEditingTextIdChange:
|
|
494
|
+
selectedTextFieldId: ye = null,
|
|
495
|
+
onSelectTextField: Vt,
|
|
496
|
+
hasFixedTextFields: qt = !1,
|
|
497
|
+
editingTextId: Kt = null,
|
|
498
|
+
onEditingTextIdChange: G
|
|
499
499
|
}) {
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
if (!t || !
|
|
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
|
+
Dt(() => {
|
|
502
|
+
if (!t || !yt.current || !bt.current || !it.current)
|
|
503
503
|
return;
|
|
504
504
|
let a = !1;
|
|
505
|
-
const
|
|
505
|
+
const w = yt.current, v = bt.current, M = it.current, D = w.getContext("2d");
|
|
506
506
|
return D ? ((async () => {
|
|
507
507
|
try {
|
|
508
|
-
if (
|
|
508
|
+
if (Wt.current) {
|
|
509
509
|
try {
|
|
510
|
-
|
|
510
|
+
Wt.current.cancel();
|
|
511
511
|
} catch {
|
|
512
512
|
}
|
|
513
|
-
|
|
513
|
+
Wt.current = null;
|
|
514
514
|
}
|
|
515
|
-
if (
|
|
515
|
+
if (st.current) {
|
|
516
516
|
try {
|
|
517
|
-
|
|
517
|
+
st.current.cancel();
|
|
518
518
|
} catch {
|
|
519
519
|
}
|
|
520
|
-
|
|
520
|
+
st.current = null;
|
|
521
521
|
}
|
|
522
|
-
const
|
|
522
|
+
const F = await t.getPage(e);
|
|
523
523
|
if (a) return;
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
if (
|
|
528
|
-
v.replaceChildren(), v.style.setProperty("--scale-factor", String(
|
|
529
|
-
const
|
|
524
|
+
const N = F.getViewport({ scale: n, rotation: i }), j = Math.floor(N.width), Z = Math.floor(N.height);
|
|
525
|
+
w.width = j, w.height = Z, M.style.width = `${j}px`, M.style.height = `${Z}px`;
|
|
526
|
+
const R = F.render({ canvasContext: D, viewport: N });
|
|
527
|
+
if (Wt.current = R, await R.promise, a) return;
|
|
528
|
+
v.replaceChildren(), v.style.setProperty("--scale-factor", String(N.scale));
|
|
529
|
+
const lt = await F.getTextContent();
|
|
530
530
|
if (a) return;
|
|
531
|
-
const
|
|
532
|
-
textContentSource:
|
|
531
|
+
const X = new Oi({
|
|
532
|
+
textContentSource: lt,
|
|
533
533
|
container: v,
|
|
534
|
-
viewport:
|
|
534
|
+
viewport: N
|
|
535
535
|
});
|
|
536
|
-
if (
|
|
536
|
+
if (st.current = X, await X.render(), a) return;
|
|
537
537
|
o == null || o(e);
|
|
538
538
|
} catch {
|
|
539
539
|
}
|
|
540
540
|
})(), () => {
|
|
541
|
-
if (a = !0,
|
|
541
|
+
if (a = !0, Wt.current) {
|
|
542
542
|
try {
|
|
543
|
-
|
|
543
|
+
Wt.current.cancel();
|
|
544
544
|
} catch {
|
|
545
545
|
}
|
|
546
|
-
|
|
546
|
+
Wt.current = null;
|
|
547
547
|
}
|
|
548
|
-
if (
|
|
548
|
+
if (st.current) {
|
|
549
549
|
try {
|
|
550
|
-
|
|
550
|
+
st.current.cancel();
|
|
551
551
|
} catch {
|
|
552
552
|
}
|
|
553
|
-
|
|
553
|
+
st.current = null;
|
|
554
554
|
}
|
|
555
555
|
}) : void 0;
|
|
556
|
-
}, [t, e, n, i, o]),
|
|
557
|
-
const a =
|
|
556
|
+
}, [t, e, n, i, o]), Dt(() => {
|
|
557
|
+
const a = it.current;
|
|
558
558
|
if (!a) return;
|
|
559
|
-
const
|
|
560
|
-
var
|
|
559
|
+
const w = (P) => {
|
|
560
|
+
var Z;
|
|
561
561
|
if (!g) return !1;
|
|
562
|
-
const
|
|
563
|
-
if (!
|
|
564
|
-
const
|
|
565
|
-
if (!
|
|
566
|
-
const
|
|
562
|
+
const F = P === "redact" ? He : u;
|
|
563
|
+
if (!F) return !1;
|
|
564
|
+
const N = an(a, n);
|
|
565
|
+
if (!N) return !1;
|
|
566
|
+
const j = P === "redact" ? cn(N.rects) : N.rects;
|
|
567
567
|
return g({
|
|
568
|
-
id:
|
|
568
|
+
id: sn(),
|
|
569
569
|
pageNumber: e,
|
|
570
570
|
kind: P,
|
|
571
|
-
color:
|
|
572
|
-
rects:
|
|
573
|
-
text:
|
|
574
|
-
}), (
|
|
571
|
+
color: F,
|
|
572
|
+
rects: j,
|
|
573
|
+
text: N.text
|
|
574
|
+
}), (Z = window.getSelection()) == null || Z.removeAllRanges(), !0;
|
|
575
575
|
}, v = (P) => {
|
|
576
|
-
var
|
|
577
|
-
if (!g || !
|
|
578
|
-
const
|
|
579
|
-
if (!
|
|
580
|
-
const
|
|
576
|
+
var lt;
|
|
577
|
+
if (!g || !ht) return !1;
|
|
578
|
+
const F = an(a, n);
|
|
579
|
+
if (!F) return !1;
|
|
580
|
+
const N = cn(F.rects);
|
|
581
581
|
g({
|
|
582
|
-
id:
|
|
582
|
+
id: sn(),
|
|
583
583
|
pageNumber: e,
|
|
584
584
|
kind: "redact",
|
|
585
|
-
color:
|
|
586
|
-
rects:
|
|
587
|
-
text:
|
|
585
|
+
color: He,
|
|
586
|
+
rects: N,
|
|
587
|
+
text: F.text
|
|
588
588
|
});
|
|
589
|
-
const
|
|
590
|
-
id:
|
|
589
|
+
const j = Nn(F.rects), Z = Re(P || " ", j.fontSize), R = {
|
|
590
|
+
id: Ge(),
|
|
591
591
|
pageNumber: e,
|
|
592
|
-
x:
|
|
593
|
-
y:
|
|
594
|
-
width:
|
|
595
|
-
height:
|
|
592
|
+
x: j.x,
|
|
593
|
+
y: j.y,
|
|
594
|
+
width: Z.width,
|
|
595
|
+
height: Z.height,
|
|
596
596
|
value: P,
|
|
597
|
-
fontSize:
|
|
598
|
-
color:
|
|
597
|
+
fontSize: j.fontSize,
|
|
598
|
+
color: me
|
|
599
599
|
};
|
|
600
|
-
return
|
|
601
|
-
|
|
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") {
|
|
605
|
-
|
|
605
|
+
w(d);
|
|
606
606
|
return;
|
|
607
607
|
}
|
|
608
608
|
if (d === "erase") {
|
|
609
|
-
|
|
609
|
+
w("redact");
|
|
610
610
|
return;
|
|
611
611
|
}
|
|
612
612
|
if (d === "text") {
|
|
@@ -614,13 +614,13 @@ function wr({
|
|
|
614
614
|
P && !P.isCollapsed && P.toString().trim() && P.anchorNode && a.contains(P.anchorNode) && v(P.toString());
|
|
615
615
|
}
|
|
616
616
|
}, D = (P) => {
|
|
617
|
-
const
|
|
618
|
-
if (
|
|
617
|
+
const F = P.target;
|
|
618
|
+
if (F != null && F.closest("[contenteditable='true']") || F != null && F.closest("[contenteditable='']") || F != null && F.isContentEditable)
|
|
619
619
|
return;
|
|
620
|
-
const
|
|
621
|
-
if (d === "text" &&
|
|
620
|
+
const N = window.getSelection(), j = N != null && !N.isCollapsed && N.toString().trim().length > 0 && N.anchorNode != null && a.contains(N.anchorNode);
|
|
621
|
+
if (d === "text" && j) {
|
|
622
622
|
if (P.key === "Enter" && !P.shiftKey) {
|
|
623
|
-
P.preventDefault(), v(
|
|
623
|
+
P.preventDefault(), v(N.toString());
|
|
624
624
|
return;
|
|
625
625
|
}
|
|
626
626
|
if (P.key.length === 1 && !P.ctrlKey && !P.metaKey && !P.altKey) {
|
|
@@ -628,7 +628,7 @@ function wr({
|
|
|
628
628
|
return;
|
|
629
629
|
}
|
|
630
630
|
}
|
|
631
|
-
d !== "text" && d !== "erase" || P.key !== "Backspace" && P.key !== "Delete" ||
|
|
631
|
+
d !== "text" && d !== "erase" || P.key !== "Backspace" && P.key !== "Delete" || j && (P.preventDefault(), w("redact"));
|
|
632
632
|
};
|
|
633
633
|
return a.addEventListener("mouseup", M), window.addEventListener("keydown", D), () => {
|
|
634
634
|
a.removeEventListener("mouseup", M), window.removeEventListener("keydown", D);
|
|
@@ -637,225 +637,225 @@ function wr({
|
|
|
637
637
|
d,
|
|
638
638
|
u,
|
|
639
639
|
g,
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
640
|
+
ht,
|
|
641
|
+
G,
|
|
642
|
+
ut,
|
|
643
643
|
e,
|
|
644
644
|
n
|
|
645
|
-
]),
|
|
646
|
-
if (!
|
|
647
|
-
let a = 0,
|
|
645
|
+
]), Dt(() => {
|
|
646
|
+
if (!mt) return;
|
|
647
|
+
let a = 0, w = 0, v = 0, M = 0;
|
|
648
648
|
const D = () => {
|
|
649
|
-
var
|
|
650
|
-
return (
|
|
651
|
-
}, P = (
|
|
652
|
-
if (
|
|
653
|
-
const
|
|
654
|
-
if (!
|
|
655
|
-
const
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
649
|
+
var R;
|
|
650
|
+
return (R = $t.current) == null ? void 0 : R.closest(".epochs-pdf-viewer__body");
|
|
651
|
+
}, P = (R, lt) => {
|
|
652
|
+
if (mt.kind !== "resize" || !I || pt) return;
|
|
653
|
+
const X = y.find((_t) => _t.id === mt.id);
|
|
654
|
+
if (!X) return;
|
|
655
|
+
const et = it.current, ft = et ? Ce(et, n) : { width: 1 / 0, height: 1 / 0 }, { dx: Ft, dy: Rt } = et ? Vi(
|
|
656
|
+
R - mt.startX,
|
|
657
|
+
lt - mt.startY,
|
|
658
|
+
et,
|
|
659
659
|
n
|
|
660
|
-
) : { dx: 0, dy: 0 },
|
|
661
|
-
|
|
662
|
-
},
|
|
663
|
-
var
|
|
664
|
-
if (
|
|
665
|
-
const
|
|
666
|
-
if (!
|
|
667
|
-
let
|
|
668
|
-
if (
|
|
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
|
+
}, F = (R, lt) => {
|
|
663
|
+
var Ut;
|
|
664
|
+
if (mt.kind !== "signature" || !I || pt) return;
|
|
665
|
+
const X = y.find((Yt) => Yt.id === mt.id);
|
|
666
|
+
if (!X) return;
|
|
667
|
+
let et = (Ut = document.elementFromPoint(R, lt)) == null ? void 0 : Ut.closest("[data-page-number]");
|
|
668
|
+
if (et || (et = Array.from(
|
|
669
669
|
document.querySelectorAll(".epochs-pdf-viewer__page[data-page-number]")
|
|
670
670
|
).find((Gt) => {
|
|
671
|
-
const
|
|
672
|
-
return
|
|
673
|
-
}) ?? null),
|
|
674
|
-
const
|
|
671
|
+
const be = Gt.getBoundingClientRect();
|
|
672
|
+
return lt >= be.top && lt <= be.bottom;
|
|
673
|
+
}) ?? null), et || (et = $t.current), !et) return;
|
|
674
|
+
const ft = et.querySelector(
|
|
675
675
|
".epochs-pdf-viewer__surface"
|
|
676
676
|
);
|
|
677
|
-
if (!
|
|
678
|
-
const
|
|
679
|
-
|
|
677
|
+
if (!ft) return;
|
|
678
|
+
const Ft = Number.parseInt(
|
|
679
|
+
et.getAttribute("data-page-number") || String(X.pageNumber),
|
|
680
680
|
10
|
|
681
|
-
),
|
|
682
|
-
let At =
|
|
683
|
-
const
|
|
684
|
-
At = Math.min(Math.max(0, At),
|
|
685
|
-
pageNumber:
|
|
681
|
+
), Rt = We(R, lt, ft, n), Ht = Ce(ft, n);
|
|
682
|
+
let At = Rt.x - mt.offsetX, St = Rt.y - mt.offsetY;
|
|
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
|
+
pageNumber: Ft,
|
|
686
686
|
x: At,
|
|
687
|
-
y:
|
|
687
|
+
y: St
|
|
688
688
|
});
|
|
689
|
-
},
|
|
689
|
+
}, N = () => {
|
|
690
690
|
if (a = 0, !M) return;
|
|
691
|
-
const
|
|
692
|
-
if (!
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
696
|
-
let
|
|
697
|
-
if (M < 0 &&
|
|
698
|
-
|
|
699
|
-
else if (M > 0 &&
|
|
700
|
-
|
|
691
|
+
const R = D();
|
|
692
|
+
if (!R) return;
|
|
693
|
+
const lt = R.scrollHeight - R.clientHeight;
|
|
694
|
+
if (lt <= 0) return;
|
|
695
|
+
const X = 56, et = R.getBoundingClientRect(), ft = v - et.top, Ft = et.bottom - v;
|
|
696
|
+
let Rt = 0;
|
|
697
|
+
if (M < 0 && ft < X)
|
|
698
|
+
Rt = -Math.max(6, (X - ft) / X * 28);
|
|
699
|
+
else if (M > 0 && Ft < X)
|
|
700
|
+
Rt = Math.max(6, (X - Ft) / X * 28);
|
|
701
701
|
else {
|
|
702
702
|
M = 0;
|
|
703
703
|
return;
|
|
704
704
|
}
|
|
705
|
-
const
|
|
706
|
-
|
|
707
|
-
},
|
|
708
|
-
|
|
709
|
-
const
|
|
710
|
-
if (
|
|
711
|
-
const
|
|
712
|
-
|
|
705
|
+
const Ht = R.scrollTop;
|
|
706
|
+
R.scrollTop = Math.min(lt, Math.max(0, Ht + Rt)), R.scrollTop !== Ht && F(w, v), Rt < 0 && R.scrollTop > 0 || Rt > 0 && R.scrollTop < lt ? a = window.requestAnimationFrame(N) : M = 0;
|
|
707
|
+
}, j = (R) => {
|
|
708
|
+
w = R.clientX, v = R.clientY;
|
|
709
|
+
const lt = D();
|
|
710
|
+
if (lt) {
|
|
711
|
+
const et = lt.getBoundingClientRect(), ft = R.clientY - et.top, Ft = et.bottom - R.clientY;
|
|
712
|
+
ft < 56 ? (M = -1, a || (a = window.requestAnimationFrame(N))) : Ft < 56 ? (M = 1, a || (a = window.requestAnimationFrame(N))) : M = 0;
|
|
713
713
|
}
|
|
714
|
-
|
|
715
|
-
},
|
|
716
|
-
M = 0, a && (window.cancelAnimationFrame(a), a = 0),
|
|
714
|
+
mt.kind === "resize" ? P(R.clientX, R.clientY) : F(R.clientX, R.clientY);
|
|
715
|
+
}, Z = () => {
|
|
716
|
+
M = 0, a && (window.cancelAnimationFrame(a), a = 0), It(null);
|
|
717
717
|
};
|
|
718
|
-
return window.addEventListener("pointermove",
|
|
719
|
-
M = 0, a && window.cancelAnimationFrame(a), window.removeEventListener("pointermove",
|
|
718
|
+
return window.addEventListener("pointermove", j), window.addEventListener("pointerup", Z), window.addEventListener("pointercancel", Z), () => {
|
|
719
|
+
M = 0, a && window.cancelAnimationFrame(a), window.removeEventListener("pointermove", j), window.removeEventListener("pointerup", Z), window.removeEventListener("pointercancel", Z);
|
|
720
720
|
};
|
|
721
721
|
}, [
|
|
722
|
-
|
|
722
|
+
mt,
|
|
723
723
|
pt,
|
|
724
|
-
|
|
724
|
+
I,
|
|
725
725
|
n,
|
|
726
|
-
|
|
727
|
-
]),
|
|
728
|
-
if (!
|
|
729
|
-
const a = ee.current,
|
|
730
|
-
a.textContent = (
|
|
726
|
+
y
|
|
727
|
+
]), Dt(() => {
|
|
728
|
+
if (!Kt || !ee.current) return;
|
|
729
|
+
const a = ee.current, w = ct.find((D) => D.id === Kt);
|
|
730
|
+
a.textContent = (w == null ? void 0 : w.value) ?? "", a.focus();
|
|
731
731
|
const v = document.createRange();
|
|
732
732
|
v.selectNodeContents(a), v.collapse(!1);
|
|
733
733
|
const M = window.getSelection();
|
|
734
734
|
M == null || M.removeAllRanges(), M == null || M.addRange(v);
|
|
735
|
-
}, [
|
|
736
|
-
const
|
|
737
|
-
|
|
738
|
-
},
|
|
739
|
-
const v =
|
|
735
|
+
}, [Kt]);
|
|
736
|
+
const ne = (a) => {
|
|
737
|
+
$t.current = a, r == null || r(a);
|
|
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
|
+
const v = w.trim();
|
|
740
740
|
if (!v) {
|
|
741
|
-
tt == null || tt(a.id),
|
|
741
|
+
tt == null || tt(a.id), G == null || G(null);
|
|
742
742
|
return;
|
|
743
743
|
}
|
|
744
|
-
const M =
|
|
744
|
+
const M = Re(v, a.fontSize);
|
|
745
745
|
gt == null || gt(a.id, {
|
|
746
746
|
value: v,
|
|
747
747
|
width: M.width,
|
|
748
748
|
height: M.height
|
|
749
|
-
}),
|
|
750
|
-
},
|
|
751
|
-
if (!
|
|
752
|
-
const v =
|
|
749
|
+
}), G == null || G(null);
|
|
750
|
+
}, rt = (a, w) => {
|
|
751
|
+
if (!ht) return;
|
|
752
|
+
const v = it.current, M = bt.current;
|
|
753
753
|
if (!v || !M) return;
|
|
754
754
|
let D = qi(
|
|
755
755
|
a,
|
|
756
|
-
|
|
756
|
+
w,
|
|
757
757
|
v,
|
|
758
758
|
M,
|
|
759
759
|
n
|
|
760
|
-
), P,
|
|
761
|
-
if (
|
|
762
|
-
const
|
|
760
|
+
), P, F = me;
|
|
761
|
+
if (qt) {
|
|
762
|
+
const Z = Ji(
|
|
763
763
|
D.x,
|
|
764
764
|
D.y,
|
|
765
765
|
te,
|
|
766
766
|
e
|
|
767
767
|
);
|
|
768
|
-
if (!
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
|
|
768
|
+
if (!Z) return;
|
|
769
|
+
const R = ct.find((lt) => lt.fieldId === Z.id);
|
|
770
|
+
if (R) {
|
|
771
|
+
ut == null || ut(R.id), Vt == null || Vt(Z.id), G == null || G(R.id);
|
|
772
772
|
return;
|
|
773
773
|
}
|
|
774
|
-
P =
|
|
775
|
-
x:
|
|
776
|
-
y:
|
|
777
|
-
fontSize:
|
|
778
|
-
},
|
|
774
|
+
P = Z.id, D = {
|
|
775
|
+
x: Z.x,
|
|
776
|
+
y: Z.y,
|
|
777
|
+
fontSize: Z.fontSize ?? we
|
|
778
|
+
}, F = Z.color ?? me, Vt == null || Vt(Z.id);
|
|
779
779
|
}
|
|
780
|
-
const
|
|
781
|
-
id:
|
|
780
|
+
const N = Re("", D.fontSize), j = {
|
|
781
|
+
id: Ge(),
|
|
782
782
|
fieldId: P,
|
|
783
783
|
pageNumber: e,
|
|
784
784
|
x: D.x,
|
|
785
785
|
y: D.y,
|
|
786
|
-
width:
|
|
787
|
-
height:
|
|
786
|
+
width: N.width,
|
|
787
|
+
height: N.height,
|
|
788
788
|
value: "",
|
|
789
789
|
fontSize: D.fontSize,
|
|
790
|
-
color:
|
|
790
|
+
color: F
|
|
791
791
|
};
|
|
792
|
-
|
|
793
|
-
},
|
|
792
|
+
ht(j), ut == null || ut(j.id), G == null || G(j.id);
|
|
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 (
|
|
798
|
-
|
|
797
|
+
if (dt.current) {
|
|
798
|
+
dt.current = !1;
|
|
799
799
|
return;
|
|
800
800
|
}
|
|
801
|
-
const
|
|
802
|
-
if (!(
|
|
803
|
-
if (a.detail >= 2 &&
|
|
804
|
-
const D =
|
|
805
|
-
if (D && g &&
|
|
806
|
-
const P =
|
|
801
|
+
const w = window.getSelection();
|
|
802
|
+
if (!(w && !w.isCollapsed && w.toString().trim())) {
|
|
803
|
+
if (a.detail >= 2 && tr(a.clientX, a.clientY, bt.current)) {
|
|
804
|
+
const D = it.current;
|
|
805
|
+
if (D && g && ht) {
|
|
806
|
+
const P = an(D, n);
|
|
807
807
|
if (P) {
|
|
808
808
|
g({
|
|
809
|
-
id:
|
|
809
|
+
id: sn(),
|
|
810
810
|
pageNumber: e,
|
|
811
811
|
kind: "redact",
|
|
812
|
-
color:
|
|
813
|
-
rects:
|
|
812
|
+
color: He,
|
|
813
|
+
rects: cn(P.rects),
|
|
814
814
|
text: P.text
|
|
815
815
|
});
|
|
816
|
-
const
|
|
817
|
-
id:
|
|
816
|
+
const F = Nn(P.rects), N = Re(P.text || " ", F.fontSize), j = {
|
|
817
|
+
id: Ge(),
|
|
818
818
|
pageNumber: e,
|
|
819
|
-
x:
|
|
820
|
-
y:
|
|
821
|
-
width:
|
|
822
|
-
height:
|
|
819
|
+
x: F.x,
|
|
820
|
+
y: F.y,
|
|
821
|
+
width: N.width,
|
|
822
|
+
height: N.height,
|
|
823
823
|
value: P.text,
|
|
824
|
-
fontSize:
|
|
825
|
-
color:
|
|
824
|
+
fontSize: F.fontSize,
|
|
825
|
+
color: me
|
|
826
826
|
};
|
|
827
|
-
|
|
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;
|
|
831
831
|
}
|
|
832
|
-
a.stopPropagation(),
|
|
832
|
+
a.stopPropagation(), rt(a.clientX, a.clientY);
|
|
833
833
|
}
|
|
834
|
-
},
|
|
835
|
-
const
|
|
836
|
-
if (!(
|
|
834
|
+
}, Zt = (a) => {
|
|
835
|
+
const w = a.target;
|
|
836
|
+
if (!(w.closest(".epochs-pdf-viewer__signature") || w.closest(".epochs-pdf-viewer__signature-field") || w.closest(".epochs-pdf-viewer__inline-text"))) {
|
|
837
837
|
if (d === "text") {
|
|
838
|
-
|
|
838
|
+
rt(a.clientX, a.clientY);
|
|
839
839
|
return;
|
|
840
840
|
}
|
|
841
|
-
if (!pt && d === "sign" &&
|
|
842
|
-
const v =
|
|
841
|
+
if (!pt && d === "sign" && vt && E) {
|
|
842
|
+
const v = it.current;
|
|
843
843
|
if (!v) return;
|
|
844
|
-
const M =
|
|
845
|
-
|
|
844
|
+
const M = We(a.clientX, a.clientY, v, n);
|
|
845
|
+
E(e, Math.max(0, M.x - 75), Math.max(0, M.y - 12));
|
|
846
846
|
return;
|
|
847
847
|
}
|
|
848
848
|
if (!pt && d === "sign" && b && x) {
|
|
849
|
-
const v =
|
|
849
|
+
const v = it.current;
|
|
850
850
|
if (!v) return;
|
|
851
|
-
const M =
|
|
852
|
-
let P = D.x - b.width / 2,
|
|
853
|
-
const
|
|
854
|
-
P = Math.min(Math.max(0, P),
|
|
855
|
-
id:
|
|
851
|
+
const M = Ce(v, n), D = We(a.clientX, a.clientY, v, n);
|
|
852
|
+
let P = D.x - b.width / 2, F = D.y - b.height / 2;
|
|
853
|
+
const N = Math.max(0, M.width - b.width), j = Math.max(0, M.height - b.height);
|
|
854
|
+
P = Math.min(Math.max(0, P), N), F = Math.min(Math.max(0, F), j), x({
|
|
855
|
+
id: Se(),
|
|
856
856
|
pageNumber: e,
|
|
857
857
|
x: P,
|
|
858
|
-
y:
|
|
858
|
+
y: F,
|
|
859
859
|
width: b.width,
|
|
860
860
|
height: b.height,
|
|
861
861
|
imageDataUrl: b.imageDataUrl
|
|
@@ -863,7 +863,7 @@ function wr({
|
|
|
863
863
|
return;
|
|
864
864
|
}
|
|
865
865
|
}
|
|
866
|
-
},
|
|
866
|
+
}, ie = (a) => Kt === a.id ? /* @__PURE__ */ s(
|
|
867
867
|
"span",
|
|
868
868
|
{
|
|
869
869
|
ref: ee,
|
|
@@ -883,7 +883,7 @@ function wr({
|
|
|
883
883
|
onClick: (v) => v.stopPropagation(),
|
|
884
884
|
onPointerDown: (v) => v.stopPropagation(),
|
|
885
885
|
onInput: (v) => {
|
|
886
|
-
const M = v.currentTarget.textContent ?? "", D =
|
|
886
|
+
const M = v.currentTarget.textContent ?? "", D = Re(M || " ", a.fontSize);
|
|
887
887
|
gt == null || gt(a.id, {
|
|
888
888
|
value: M,
|
|
889
889
|
width: D.width,
|
|
@@ -891,7 +891,7 @@ function wr({
|
|
|
891
891
|
});
|
|
892
892
|
},
|
|
893
893
|
onBlur: (v) => {
|
|
894
|
-
|
|
894
|
+
U(a, v.currentTarget.textContent ?? "");
|
|
895
895
|
},
|
|
896
896
|
onKeyDown: (v) => {
|
|
897
897
|
v.stopPropagation(), v.key === "Escape" && (v.preventDefault(), v.currentTarget.blur()), v.key === "Enter" && !v.shiftKey && (v.preventDefault(), v.currentTarget.blur());
|
|
@@ -901,7 +901,7 @@ function wr({
|
|
|
901
901
|
) : a.value.trim() ? /* @__PURE__ */ s(
|
|
902
902
|
"span",
|
|
903
903
|
{
|
|
904
|
-
className:
|
|
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 wr({
|
|
|
913
913
|
tt == null || tt(a.id);
|
|
914
914
|
return;
|
|
915
915
|
}
|
|
916
|
-
d === "text" && (
|
|
916
|
+
d === "text" && (ut == null || ut(a.id), G == null || G(a.id));
|
|
917
917
|
},
|
|
918
918
|
children: a.value
|
|
919
919
|
},
|
|
@@ -922,27 +922,27 @@ function wr({
|
|
|
922
922
|
return /* @__PURE__ */ s(
|
|
923
923
|
"div",
|
|
924
924
|
{
|
|
925
|
-
ref:
|
|
925
|
+
ref: ne,
|
|
926
926
|
"data-page-number": e,
|
|
927
927
|
className: "epochs-pdf-viewer__page",
|
|
928
928
|
children: /* @__PURE__ */ T(
|
|
929
929
|
"div",
|
|
930
930
|
{
|
|
931
|
-
ref:
|
|
931
|
+
ref: it,
|
|
932
932
|
className: `epochs-pdf-viewer__surface epochs-pdf-viewer__surface--tool-${d}`,
|
|
933
|
-
onClick:
|
|
933
|
+
onClick: Zt,
|
|
934
934
|
children: [
|
|
935
|
-
/* @__PURE__ */ s("canvas", { ref:
|
|
936
|
-
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__markup-layer", "aria-hidden": "true", children:
|
|
937
|
-
(a) => a.kind === "redact" ? null : a.rects.map((
|
|
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: kt.map(
|
|
937
|
+
(a) => a.kind === "redact" ? null : a.rects.map((w, v) => a.kind === "highlight" ? /* @__PURE__ */ s(
|
|
938
938
|
"div",
|
|
939
939
|
{
|
|
940
940
|
className: "epochs-pdf-viewer__markup epochs-pdf-viewer__markup--highlight",
|
|
941
941
|
style: {
|
|
942
|
-
left:
|
|
943
|
-
top:
|
|
944
|
-
width:
|
|
945
|
-
height:
|
|
942
|
+
left: w.x * n,
|
|
943
|
+
top: w.y * n,
|
|
944
|
+
width: w.w * n,
|
|
945
|
+
height: w.h * n,
|
|
946
946
|
background: a.color
|
|
947
947
|
},
|
|
948
948
|
onClick: (M) => {
|
|
@@ -955,9 +955,9 @@ function wr({
|
|
|
955
955
|
{
|
|
956
956
|
className: "epochs-pdf-viewer__markup epochs-pdf-viewer__markup--underline",
|
|
957
957
|
style: {
|
|
958
|
-
left:
|
|
959
|
-
top: (
|
|
960
|
-
width:
|
|
958
|
+
left: w.x * n,
|
|
959
|
+
top: (w.y + w.h) * n - Math.max(2, n * 1.5),
|
|
960
|
+
width: w.w * n,
|
|
961
961
|
height: Math.max(2, n * 1.5),
|
|
962
962
|
background: a.color
|
|
963
963
|
},
|
|
@@ -969,8 +969,8 @@ function wr({
|
|
|
969
969
|
))
|
|
970
970
|
) }),
|
|
971
971
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__signature-layer", children: [
|
|
972
|
-
|
|
973
|
-
const
|
|
972
|
+
p.map((a) => {
|
|
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",
|
|
976
976
|
{
|
|
@@ -984,42 +984,42 @@ function wr({
|
|
|
984
984
|
height: a.height * n
|
|
985
985
|
},
|
|
986
986
|
onClick: (D) => {
|
|
987
|
-
if (D.stopPropagation(),
|
|
988
|
-
|
|
987
|
+
if (D.stopPropagation(), q == null || q(a.id), w === "date" || w === "text") {
|
|
988
|
+
C == null || C(null), J == null || J(w);
|
|
989
989
|
return;
|
|
990
990
|
}
|
|
991
|
-
const P =
|
|
992
|
-
|
|
991
|
+
const P = oe.find((F) => F.fieldId === a.id);
|
|
992
|
+
C == null || C((P == null ? void 0 : P.id) ?? null), P ? H == null || H(P.id) : J == null || J(w);
|
|
993
993
|
},
|
|
994
|
-
title: M ? "Completed field" :
|
|
995
|
-
children:
|
|
994
|
+
title: M ? "Completed field" : w === "date" ? "Date field" : w === "text" ? "Text field" : "Signature field",
|
|
995
|
+
children: w === "date" || w === "text" ? v.trim() ? /* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__signature-field-value", children: v }) : w === "date" ? /* @__PURE__ */ s("span", { children: "Date here" }) : /* @__PURE__ */ s("span", { children: a.placeholder ?? "Enter text" }) : M ? null : /* @__PURE__ */ s("span", { children: "Sign here" })
|
|
996
996
|
},
|
|
997
997
|
a.id
|
|
998
998
|
);
|
|
999
999
|
}),
|
|
1000
|
-
|
|
1000
|
+
oe.map((a) => /* @__PURE__ */ T(
|
|
1001
1001
|
"div",
|
|
1002
1002
|
{
|
|
1003
|
-
className:
|
|
1003
|
+
className: A === a.id ? "epochs-pdf-viewer__signature epochs-pdf-viewer__signature--selected" : "epochs-pdf-viewer__signature",
|
|
1004
1004
|
style: {
|
|
1005
1005
|
left: a.x * n,
|
|
1006
1006
|
top: a.y * n,
|
|
1007
1007
|
width: a.width * n,
|
|
1008
1008
|
height: a.height * n
|
|
1009
1009
|
},
|
|
1010
|
-
onPointerDown: (
|
|
1011
|
-
if (
|
|
1010
|
+
onPointerDown: (w) => {
|
|
1011
|
+
if (w.stopPropagation(), w.preventDefault(), C == null || C(a.id), d === "erase" && !pt) {
|
|
1012
1012
|
S == null || S(a.id);
|
|
1013
1013
|
return;
|
|
1014
1014
|
}
|
|
1015
1015
|
if (pt) {
|
|
1016
|
-
|
|
1016
|
+
q == null || q(a.fieldId ?? null), H == null || H(a.id);
|
|
1017
1017
|
return;
|
|
1018
1018
|
}
|
|
1019
|
-
const v =
|
|
1019
|
+
const v = it.current;
|
|
1020
1020
|
if (!v) return;
|
|
1021
|
-
const M =
|
|
1022
|
-
|
|
1021
|
+
const M = We(w.clientX, w.clientY, v, n);
|
|
1022
|
+
It({
|
|
1023
1023
|
kind: "signature",
|
|
1024
1024
|
id: a.id,
|
|
1025
1025
|
offsetX: M.x - a.x,
|
|
@@ -1034,16 +1034,16 @@ function wr({
|
|
|
1034
1034
|
className: "epochs-pdf-viewer__signature-edit",
|
|
1035
1035
|
title: "Edit signature",
|
|
1036
1036
|
"aria-label": "Edit signature",
|
|
1037
|
-
onPointerDown: (
|
|
1038
|
-
|
|
1037
|
+
onPointerDown: (w) => {
|
|
1038
|
+
w.stopPropagation();
|
|
1039
1039
|
},
|
|
1040
|
-
onClick: (
|
|
1041
|
-
|
|
1040
|
+
onClick: (w) => {
|
|
1041
|
+
w.stopPropagation(), C == null || C(a.id), H == null || H(a.id);
|
|
1042
1042
|
},
|
|
1043
|
-
children: /* @__PURE__ */ s(
|
|
1043
|
+
children: /* @__PURE__ */ s(mr, { size: 12 })
|
|
1044
1044
|
}
|
|
1045
1045
|
),
|
|
1046
|
-
pt ? null : /* @__PURE__ */ T(
|
|
1046
|
+
pt ? null : /* @__PURE__ */ T(je, { children: [
|
|
1047
1047
|
/* @__PURE__ */ s(
|
|
1048
1048
|
"button",
|
|
1049
1049
|
{
|
|
@@ -1051,11 +1051,11 @@ function wr({
|
|
|
1051
1051
|
className: "epochs-pdf-viewer__signature-duplicate",
|
|
1052
1052
|
title: "Duplicate signature",
|
|
1053
1053
|
"aria-label": "Duplicate signature",
|
|
1054
|
-
onPointerDown: (
|
|
1055
|
-
|
|
1054
|
+
onPointerDown: (w) => {
|
|
1055
|
+
w.stopPropagation();
|
|
1056
1056
|
},
|
|
1057
|
-
onClick: (
|
|
1058
|
-
|
|
1057
|
+
onClick: (w) => {
|
|
1058
|
+
w.stopPropagation(), C == null || C(a.id), W == null || W(a.id);
|
|
1059
1059
|
},
|
|
1060
1060
|
children: "⧉"
|
|
1061
1061
|
}
|
|
@@ -1067,11 +1067,11 @@ function wr({
|
|
|
1067
1067
|
className: "epochs-pdf-viewer__signature-remove",
|
|
1068
1068
|
title: "Remove signature",
|
|
1069
1069
|
"aria-label": "Remove signature",
|
|
1070
|
-
onPointerDown: (
|
|
1071
|
-
|
|
1070
|
+
onPointerDown: (w) => {
|
|
1071
|
+
w.stopPropagation();
|
|
1072
1072
|
},
|
|
1073
|
-
onClick: (
|
|
1074
|
-
|
|
1073
|
+
onClick: (w) => {
|
|
1074
|
+
w.stopPropagation(), S == null || S(a.id);
|
|
1075
1075
|
},
|
|
1076
1076
|
children: "×"
|
|
1077
1077
|
}
|
|
@@ -1083,12 +1083,12 @@ function wr({
|
|
|
1083
1083
|
{
|
|
1084
1084
|
className: "epochs-pdf-viewer__signature-resize",
|
|
1085
1085
|
title: "Resize",
|
|
1086
|
-
onPointerDown: (
|
|
1087
|
-
|
|
1086
|
+
onPointerDown: (w) => {
|
|
1087
|
+
w.stopPropagation(), w.preventDefault(), C == null || C(a.id), It({
|
|
1088
1088
|
kind: "resize",
|
|
1089
1089
|
id: a.id,
|
|
1090
|
-
startX:
|
|
1091
|
-
startY:
|
|
1090
|
+
startX: w.clientX,
|
|
1091
|
+
startY: w.clientY,
|
|
1092
1092
|
startW: a.width,
|
|
1093
1093
|
startH: a.height
|
|
1094
1094
|
});
|
|
@@ -1101,26 +1101,26 @@ function wr({
|
|
|
1101
1101
|
a.id
|
|
1102
1102
|
))
|
|
1103
1103
|
] }),
|
|
1104
|
-
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__text-layer-overlay", children:
|
|
1104
|
+
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__text-layer-overlay", children: L.map((a) => ie(a)) }),
|
|
1105
1105
|
/* @__PURE__ */ s(
|
|
1106
1106
|
"div",
|
|
1107
1107
|
{
|
|
1108
|
-
ref:
|
|
1108
|
+
ref: bt,
|
|
1109
1109
|
className: "textLayer epochs-pdf-viewer__text-layer",
|
|
1110
|
-
onClick:
|
|
1110
|
+
onClick: Lt
|
|
1111
1111
|
}
|
|
1112
1112
|
),
|
|
1113
|
-
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children:
|
|
1114
|
-
(a) => a.kind === "redact" ? a.rects.map((
|
|
1113
|
+
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__redact-layer", "aria-hidden": "true", children: kt.map(
|
|
1114
|
+
(a) => a.kind === "redact" ? a.rects.map((w, v) => /* @__PURE__ */ s(
|
|
1115
1115
|
"div",
|
|
1116
1116
|
{
|
|
1117
1117
|
className: "epochs-pdf-viewer__markup epochs-pdf-viewer__markup--redact",
|
|
1118
1118
|
style: {
|
|
1119
|
-
left:
|
|
1120
|
-
top:
|
|
1121
|
-
width:
|
|
1122
|
-
height:
|
|
1123
|
-
background: a.color ||
|
|
1119
|
+
left: w.x * n,
|
|
1120
|
+
top: w.y * n,
|
|
1121
|
+
width: w.w * n,
|
|
1122
|
+
height: w.h * n,
|
|
1123
|
+
background: a.color || He
|
|
1124
1124
|
},
|
|
1125
1125
|
onClick: (M) => {
|
|
1126
1126
|
d === "erase" && (M.stopPropagation(), _ == null || _(a.id));
|
|
@@ -1135,7 +1135,7 @@ function wr({
|
|
|
1135
1135
|
}
|
|
1136
1136
|
);
|
|
1137
1137
|
}
|
|
1138
|
-
function
|
|
1138
|
+
function br({
|
|
1139
1139
|
pdfDoc: t,
|
|
1140
1140
|
pageNumber: e,
|
|
1141
1141
|
isActive: n,
|
|
@@ -1148,41 +1148,41 @@ function yr({
|
|
|
1148
1148
|
texts: g = [],
|
|
1149
1149
|
textFields: _ = []
|
|
1150
1150
|
}) {
|
|
1151
|
-
const
|
|
1152
|
-
return
|
|
1153
|
-
if (!t || !
|
|
1151
|
+
const y = xt(null);
|
|
1152
|
+
return Dt(() => {
|
|
1153
|
+
if (!t || !y.current) return;
|
|
1154
1154
|
let b = !1;
|
|
1155
|
-
const x =
|
|
1156
|
-
if (!
|
|
1155
|
+
const x = y.current, I = x.getContext("2d");
|
|
1156
|
+
if (!I) return;
|
|
1157
1157
|
let S = null;
|
|
1158
1158
|
return (async () => {
|
|
1159
1159
|
try {
|
|
1160
|
-
const
|
|
1160
|
+
const W = await t.getPage(e);
|
|
1161
1161
|
if (b) return;
|
|
1162
|
-
const
|
|
1163
|
-
x.width = Math.floor(
|
|
1164
|
-
const at = d.filter((
|
|
1165
|
-
at.length > 0 &&
|
|
1166
|
-
const
|
|
1167
|
-
(
|
|
1162
|
+
const A = W.getViewport({ scale: 1, rotation: i }), C = o / A.width, nt = W.getViewport({ scale: C, rotation: i });
|
|
1163
|
+
x.width = Math.floor(nt.width), x.height = Math.floor(nt.height), S = W.render({ canvasContext: I, viewport: nt }), await S.promise;
|
|
1164
|
+
const at = d.filter((K) => K.pageNumber === e);
|
|
1165
|
+
at.length > 0 && jn(I, at, C);
|
|
1166
|
+
const q = u.filter((K) => K.pageNumber === e), pt = m.filter(
|
|
1167
|
+
(K) => K.pageNumber === e
|
|
1168
1168
|
);
|
|
1169
|
-
pt.length > 0 &&
|
|
1170
|
-
|
|
1169
|
+
pt.length > 0 && Si(
|
|
1170
|
+
I,
|
|
1171
1171
|
pt,
|
|
1172
|
-
new Set(
|
|
1173
|
-
|
|
1174
|
-
),
|
|
1175
|
-
const J = g.filter((
|
|
1176
|
-
(
|
|
1172
|
+
new Set(q.map((K) => K.fieldId).filter(Boolean)),
|
|
1173
|
+
C
|
|
1174
|
+
), q.length > 0 && await Bn(I, q, C);
|
|
1175
|
+
const J = g.filter((K) => K.pageNumber === e), Mt = _.filter(
|
|
1176
|
+
(K) => K.pageNumber === e
|
|
1177
1177
|
);
|
|
1178
|
-
Mt.length > 0 &&
|
|
1179
|
-
|
|
1178
|
+
Mt.length > 0 && er(
|
|
1179
|
+
I,
|
|
1180
1180
|
Mt,
|
|
1181
1181
|
new Set(
|
|
1182
|
-
J.filter((
|
|
1182
|
+
J.filter((K) => K.fieldId && K.value.trim()).map((K) => K.fieldId)
|
|
1183
1183
|
),
|
|
1184
|
-
|
|
1185
|
-
), J.length > 0 &&
|
|
1184
|
+
C
|
|
1185
|
+
), J.length > 0 && Wn(I, J, C);
|
|
1186
1186
|
} catch {
|
|
1187
1187
|
}
|
|
1188
1188
|
})(), () => {
|
|
@@ -1210,42 +1210,42 @@ function yr({
|
|
|
1210
1210
|
className: n ? "epochs-pdf-viewer__thumb epochs-pdf-viewer__thumb--active" : "epochs-pdf-viewer__thumb",
|
|
1211
1211
|
title: `Page ${e}`,
|
|
1212
1212
|
children: [
|
|
1213
|
-
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__thumb-frame", children: /* @__PURE__ */ s("canvas", { ref:
|
|
1213
|
+
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__thumb-frame", children: /* @__PURE__ */ s("canvas", { ref: y }) }),
|
|
1214
1214
|
/* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__thumb-label", children: e })
|
|
1215
1215
|
]
|
|
1216
1216
|
}
|
|
1217
1217
|
);
|
|
1218
1218
|
}
|
|
1219
|
-
const
|
|
1220
|
-
let
|
|
1221
|
-
function
|
|
1222
|
-
|
|
1219
|
+
const _r = /^(blob:|https?:|data:)/i;
|
|
1220
|
+
let On = !1;
|
|
1221
|
+
function $n(t) {
|
|
1222
|
+
Ie.GlobalWorkerOptions.workerSrc = t, On = !0;
|
|
1223
1223
|
}
|
|
1224
|
-
function
|
|
1224
|
+
function vr(t) {
|
|
1225
1225
|
if (t) {
|
|
1226
|
-
|
|
1226
|
+
$n(t);
|
|
1227
1227
|
return;
|
|
1228
1228
|
}
|
|
1229
|
-
|
|
1230
|
-
`https://unpkg.com/pdfjs-dist@${
|
|
1229
|
+
On || Ie.GlobalWorkerOptions.workerSrc || $n(
|
|
1230
|
+
`https://unpkg.com/pdfjs-dist@${Ie.version}/build/pdf.worker.min.mjs`
|
|
1231
1231
|
);
|
|
1232
1232
|
}
|
|
1233
|
-
function
|
|
1233
|
+
function xr(t, e, n = "") {
|
|
1234
1234
|
const i = e || t;
|
|
1235
1235
|
if (!i) return "";
|
|
1236
|
-
if (
|
|
1236
|
+
if (_r.test(i)) return i;
|
|
1237
1237
|
const r = i.startsWith("/") ? i : `/${i}`;
|
|
1238
1238
|
return n ? `${n.replace(/\/$/, "")}${r}` : r;
|
|
1239
1239
|
}
|
|
1240
|
-
async function
|
|
1240
|
+
async function Mr(t, e) {
|
|
1241
1241
|
const n = await fetch(t, e);
|
|
1242
1242
|
if (!n.ok)
|
|
1243
1243
|
throw new Error(`Failed to fetch PDF (${n.status})`);
|
|
1244
1244
|
return n.arrayBuffer();
|
|
1245
1245
|
}
|
|
1246
|
-
async function
|
|
1246
|
+
async function In(t, e) {
|
|
1247
1247
|
if (typeof t == "string")
|
|
1248
|
-
return
|
|
1248
|
+
return Mr(t, e);
|
|
1249
1249
|
if (t instanceof ArrayBuffer) return t.slice(0);
|
|
1250
1250
|
if (t instanceof Uint8Array) {
|
|
1251
1251
|
const n = new Uint8Array(t.byteLength);
|
|
@@ -1253,7 +1253,7 @@ async function Nn(t, e) {
|
|
|
1253
1253
|
}
|
|
1254
1254
|
return t.arrayBuffer();
|
|
1255
1255
|
}
|
|
1256
|
-
async function
|
|
1256
|
+
async function kr(t, e, n) {
|
|
1257
1257
|
const {
|
|
1258
1258
|
scale: i,
|
|
1259
1259
|
rotation: r,
|
|
@@ -1262,35 +1262,35 @@ async function Mr(t, e, n) {
|
|
|
1262
1262
|
texts: u = [],
|
|
1263
1263
|
mimeType: m = "image/jpeg",
|
|
1264
1264
|
quality: g = 0.92
|
|
1265
|
-
} = n, _ = await t.getPage(e),
|
|
1266
|
-
if (!
|
|
1265
|
+
} = n, _ = await t.getPage(e), y = _.getViewport({ scale: i, rotation: r }), b = _.getViewport({ scale: 1, rotation: r }), x = document.createElement("canvas"), I = x.getContext("2d", { alpha: !1 });
|
|
1266
|
+
if (!I)
|
|
1267
1267
|
throw new Error("Could not create canvas context");
|
|
1268
|
-
const S = Math.floor(
|
|
1269
|
-
x.width = S, x.height = H,
|
|
1270
|
-
const
|
|
1271
|
-
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1268
|
+
const S = Math.floor(y.width), H = Math.floor(y.height);
|
|
1269
|
+
x.width = S, x.height = H, I.fillStyle = "#ffffff", I.fillRect(0, 0, S, H), await _.render({ canvasContext: I, viewport: y }).promise;
|
|
1270
|
+
const W = o.filter((q) => q.pageNumber === e);
|
|
1271
|
+
W.length > 0 && jn(I, W, i);
|
|
1272
|
+
const A = d.filter((q) => q.pageNumber === e);
|
|
1273
|
+
A.length > 0 && await Bn(I, A, i);
|
|
1274
|
+
const C = u.filter((q) => q.pageNumber === e);
|
|
1275
|
+
C.length > 0 && Wn(I, C, i);
|
|
1276
|
+
const nt = x.toDataURL(m, g), at = Nr(nt);
|
|
1277
1277
|
return x.width = 0, x.height = 0, {
|
|
1278
1278
|
pageNumber: e,
|
|
1279
1279
|
width: S,
|
|
1280
1280
|
height: H,
|
|
1281
1281
|
pageWidth: b.width,
|
|
1282
1282
|
pageHeight: b.height,
|
|
1283
|
-
dataUrl:
|
|
1283
|
+
dataUrl: nt,
|
|
1284
1284
|
jpegBytes: at
|
|
1285
1285
|
};
|
|
1286
1286
|
}
|
|
1287
|
-
async function
|
|
1287
|
+
async function Cn(t, e) {
|
|
1288
1288
|
const n = [];
|
|
1289
1289
|
for (let i = 1; i <= t.numPages; i += 1)
|
|
1290
|
-
n.push(await
|
|
1290
|
+
n.push(await kr(t, i, e));
|
|
1291
1291
|
return n;
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1293
|
+
function Nr(t) {
|
|
1294
1294
|
const e = t.split(",")[1] ?? "", n = atob(e), i = new Uint8Array(n.length);
|
|
1295
1295
|
for (let r = 0; r < n.length; r += 1)
|
|
1296
1296
|
i[r] = n.charCodeAt(r);
|
|
@@ -1299,17 +1299,17 @@ function kr(t) {
|
|
|
1299
1299
|
function Jt(t) {
|
|
1300
1300
|
return new TextEncoder().encode(t);
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1302
|
+
function Tn(...t) {
|
|
1303
1303
|
const e = t.reduce((r, o) => r + o.byteLength, 0), n = new Uint8Array(e);
|
|
1304
1304
|
let i = 0;
|
|
1305
1305
|
for (const r of t)
|
|
1306
1306
|
n.set(r, i), i += r.byteLength;
|
|
1307
1307
|
return n;
|
|
1308
1308
|
}
|
|
1309
|
-
function
|
|
1309
|
+
function Pr(t) {
|
|
1310
1310
|
const e = [], n = (b) => (e.push(b), e.length), i = [];
|
|
1311
1311
|
for (const b of t) {
|
|
1312
|
-
const x =
|
|
1312
|
+
const x = Tn(
|
|
1313
1313
|
Jt(
|
|
1314
1314
|
`<< /Type /XObject /Subtype /Image /Width ${b.width} /Height ${b.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode /Length ${b.jpegBytes.byteLength} >>
|
|
1315
1315
|
stream
|
|
@@ -1318,7 +1318,7 @@ stream
|
|
|
1318
1318
|
b.jpegBytes,
|
|
1319
1319
|
Jt(`
|
|
1320
1320
|
endstream`)
|
|
1321
|
-
),
|
|
1321
|
+
), I = n(x), S = `q
|
|
1322
1322
|
${b.pageWidth.toFixed(2)} 0 0 ${b.pageHeight.toFixed(2)} 0 0 cm
|
|
1323
1323
|
/Im0 Do
|
|
1324
1324
|
Q`, H = n(
|
|
@@ -1326,12 +1326,12 @@ Q`, H = n(
|
|
|
1326
1326
|
stream
|
|
1327
1327
|
${S}
|
|
1328
1328
|
endstream`)
|
|
1329
|
-
),
|
|
1329
|
+
), W = n(
|
|
1330
1330
|
Jt(
|
|
1331
|
-
`<< /Type /Page /Parent __PAGES__ 0 R /MediaBox [0 0 ${b.pageWidth.toFixed(2)} ${b.pageHeight.toFixed(2)}] /Contents ${H} 0 R /Resources << /XObject << /Im0 ${
|
|
1331
|
+
`<< /Type /Page /Parent __PAGES__ 0 R /MediaBox [0 0 ${b.pageWidth.toFixed(2)} ${b.pageHeight.toFixed(2)}] /Contents ${H} 0 R /Resources << /XObject << /Im0 ${I} 0 R >> >> >>`
|
|
1332
1332
|
)
|
|
1333
1333
|
);
|
|
1334
|
-
i.push(
|
|
1334
|
+
i.push(W);
|
|
1335
1335
|
}
|
|
1336
1336
|
const r = i.map((b) => `${b} 0 R`).join(" "), o = n(
|
|
1337
1337
|
Jt(`<< /Type /Pages /Kids [${r}] /Count ${i.length} >>`)
|
|
@@ -1348,50 +1348,60 @@ endstream`)
|
|
|
1348
1348
|
for (let b = 0; b < e.length; b += 1) {
|
|
1349
1349
|
m.push(g);
|
|
1350
1350
|
const x = Jt(`${b + 1} 0 obj
|
|
1351
|
-
`),
|
|
1351
|
+
`), I = Jt(`
|
|
1352
1352
|
endobj
|
|
1353
1353
|
`);
|
|
1354
|
-
u.push(x, e[b],
|
|
1354
|
+
u.push(x, e[b], I), g += x.byteLength + e[b].byteLength + I.byteLength;
|
|
1355
1355
|
}
|
|
1356
1356
|
const _ = g;
|
|
1357
|
-
let
|
|
1357
|
+
let y = `xref
|
|
1358
1358
|
0 ${e.length + 1}
|
|
1359
1359
|
`;
|
|
1360
|
-
|
|
1360
|
+
y += `0000000000 65535 f
|
|
1361
1361
|
`;
|
|
1362
1362
|
for (let b = 1; b <= e.length; b += 1)
|
|
1363
|
-
|
|
1363
|
+
y += `${String(m[b]).padStart(10, "0")} 00000 n
|
|
1364
1364
|
`;
|
|
1365
|
-
return
|
|
1365
|
+
return y += `trailer
|
|
1366
1366
|
<< /Size ${e.length + 1} /Root ${d} 0 R >>
|
|
1367
|
-
`,
|
|
1367
|
+
`, y += `startxref
|
|
1368
1368
|
${_}
|
|
1369
|
-
%%EOF`, u.push(Jt(
|
|
1369
|
+
%%EOF`, u.push(Jt(y)), Tn(...u);
|
|
1370
1370
|
}
|
|
1371
|
-
function
|
|
1371
|
+
function hn(t, e) {
|
|
1372
1372
|
const n = URL.createObjectURL(t), i = document.createElement("a");
|
|
1373
1373
|
i.href = n, i.download = e, i.click(), URL.revokeObjectURL(n);
|
|
1374
1374
|
}
|
|
1375
|
-
const
|
|
1376
|
-
{ id: "
|
|
1377
|
-
{ id: "
|
|
1378
|
-
{ id: "
|
|
1379
|
-
{ id: "
|
|
1380
|
-
{ id: "
|
|
1381
|
-
];
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1375
|
+
const Ue = [
|
|
1376
|
+
{ id: "dancing-script", label: "Dancing Script", family: "Dancing Script" },
|
|
1377
|
+
{ id: "great-vibes", label: "Great Vibes", family: "Great Vibes" },
|
|
1378
|
+
{ id: "pacifico", label: "Pacifico", family: "Pacifico" },
|
|
1379
|
+
{ id: "satisfy", label: "Satisfy", family: "Satisfy" },
|
|
1380
|
+
{ id: "allura", label: "Allura", family: "Allura" }
|
|
1381
|
+
], $r = "https://fonts.googleapis.com/css2?family=Allura&family=Dancing+Script:wght@500;600&family=Great+Vibes&family=Pacifico&family=Satisfy&display=swap";
|
|
1382
|
+
let Oe = null;
|
|
1383
|
+
function Ir() {
|
|
1384
|
+
return typeof document > "u" ? Promise.resolve() : Oe || (Oe = new Promise((t) => {
|
|
1385
|
+
var i;
|
|
1386
|
+
if (!document.querySelector(
|
|
1387
|
+
'link[data-epochs-signature-fonts="true"]'
|
|
1388
|
+
)) {
|
|
1389
|
+
const r = document.createElement("link");
|
|
1390
|
+
r.rel = "stylesheet", r.href = $r, r.dataset.epochsSignatureFonts = "true", document.head.appendChild(r);
|
|
1391
|
+
}
|
|
1392
|
+
const n = () => Promise.all(
|
|
1393
|
+
Ue.map(
|
|
1394
|
+
(r) => document.fonts.load(`48px "${r.family}"`)
|
|
1395
|
+
)
|
|
1396
|
+
).then(() => {
|
|
1397
|
+
});
|
|
1398
|
+
(i = document.fonts) != null && i.ready ? document.fonts.ready.then(n).then(t).catch(() => t()) : window.setTimeout(() => {
|
|
1399
|
+
n().then(t).catch(() => t());
|
|
1400
|
+
}, 300);
|
|
1401
|
+
}), Oe);
|
|
1392
1402
|
}
|
|
1393
|
-
function
|
|
1394
|
-
return t === "initials" ?
|
|
1403
|
+
function Dn(t, e) {
|
|
1404
|
+
return t === "initials" ? 72 : e === "Great Vibes" || e === "Allura" ? 56 : e === "Pacifico" ? 44 : 48;
|
|
1395
1405
|
}
|
|
1396
1406
|
function Cr({
|
|
1397
1407
|
open: t,
|
|
@@ -1406,150 +1416,163 @@ function Cr({
|
|
|
1406
1416
|
rememberedByType: g,
|
|
1407
1417
|
onRememberFill: _
|
|
1408
1418
|
}) {
|
|
1409
|
-
const
|
|
1410
|
-
if (
|
|
1411
|
-
var
|
|
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
|
+
if (Dt(() => {
|
|
1421
|
+
var U, rt;
|
|
1412
1422
|
if (!t) return;
|
|
1413
|
-
if (
|
|
1423
|
+
if (C(W), W === "date") {
|
|
1414
1424
|
at(
|
|
1415
|
-
u || ((
|
|
1425
|
+
u || ((U = g == null ? void 0 : g.date) == null ? void 0 : U.value) || (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
|
|
1416
1426
|
);
|
|
1417
1427
|
return;
|
|
1418
1428
|
}
|
|
1419
|
-
if (
|
|
1420
|
-
pt(u || ((
|
|
1429
|
+
if (W === "text") {
|
|
1430
|
+
pt(u || ((rt = g == null ? void 0 : g.text) == null ? void 0 : rt.value) || "");
|
|
1421
1431
|
return;
|
|
1422
1432
|
}
|
|
1423
|
-
const
|
|
1424
|
-
if (!
|
|
1425
|
-
Mt("draw"),
|
|
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);
|
|
1426
1436
|
return;
|
|
1427
1437
|
}
|
|
1428
|
-
Mt(
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1431
|
-
imageDataUrl:
|
|
1432
|
-
width:
|
|
1433
|
-
height:
|
|
1434
|
-
},
|
|
1435
|
-
}, [t,
|
|
1436
|
-
if (!t ||
|
|
1437
|
-
const
|
|
1438
|
-
if (!
|
|
1439
|
-
const
|
|
1440
|
-
if (!
|
|
1441
|
-
const
|
|
1442
|
-
if (!(
|
|
1443
|
-
const
|
|
1444
|
-
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1447
|
-
|
|
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
|
+
}, G(!0)) : (H.current = null, G(!1));
|
|
1445
|
+
}, [t, W, g, u]), Dt(() => {
|
|
1446
|
+
if (!t || A !== "sign") 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
|
+
const U = H.current;
|
|
1452
|
+
if (!(U != null && U.imageDataUrl)) return;
|
|
1453
|
+
const rt = new Image();
|
|
1454
|
+
rt.onload = () => {
|
|
1455
|
+
const Lt = Math.min(
|
|
1456
|
+
p.width / Math.max(1, U.width),
|
|
1457
|
+
p.height / Math.max(1, U.height),
|
|
1448
1458
|
1
|
|
1449
|
-
),
|
|
1450
|
-
|
|
1451
|
-
},
|
|
1452
|
-
}, [t,
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1459
|
+
), Zt = U.width * Lt, ie = U.height * Lt;
|
|
1460
|
+
L.drawImage(rt, (p.width - Zt) / 2, (p.height - ie) / 2, Zt, ie);
|
|
1461
|
+
}, rt.src = U.imageDataUrl;
|
|
1462
|
+
}, [t, A, J]), Dt(() => {
|
|
1463
|
+
if (!t) return;
|
|
1464
|
+
let p = !1;
|
|
1465
|
+
return qt(!1), Ir().then(() => {
|
|
1466
|
+
p || qt(!0);
|
|
1467
|
+
}), () => {
|
|
1468
|
+
p = !0;
|
|
1469
|
+
};
|
|
1470
|
+
}, [t]), 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(() => {
|
|
1456
1474
|
if (!t || J !== "type") return;
|
|
1457
|
-
const
|
|
1458
|
-
if (!
|
|
1459
|
-
const
|
|
1460
|
-
|
|
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
|
+
const U = Dn(gt, $t.family);
|
|
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);
|
|
1461
1479
|
}, [
|
|
1462
|
-
|
|
1480
|
+
yt,
|
|
1463
1481
|
gt,
|
|
1464
1482
|
J,
|
|
1465
|
-
|
|
1483
|
+
Pt,
|
|
1466
1484
|
t,
|
|
1467
|
-
|
|
1485
|
+
$t,
|
|
1486
|
+
Vt
|
|
1468
1487
|
]), !t) return null;
|
|
1469
|
-
const
|
|
1470
|
-
const
|
|
1488
|
+
const it = (p) => {
|
|
1489
|
+
const L = y.current, U = L.getBoundingClientRect();
|
|
1471
1490
|
return {
|
|
1472
|
-
x: (
|
|
1473
|
-
y: (
|
|
1491
|
+
x: (p.clientX - U.left) / U.width * L.width,
|
|
1492
|
+
y: (p.clientY - U.top) / U.height * L.height
|
|
1474
1493
|
};
|
|
1475
|
-
},
|
|
1494
|
+
}, Wt = (p) => {
|
|
1476
1495
|
if (J !== "draw") return;
|
|
1477
1496
|
if (H.current) {
|
|
1478
|
-
H.current = null,
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1497
|
+
H.current = null, G(!1);
|
|
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 = Pt, rt.lineWidth = 2.5, rt.lineCap = "round", rt.lineJoin = "round"), I.current = [];
|
|
1481
1500
|
}
|
|
1482
|
-
|
|
1483
|
-
const
|
|
1484
|
-
x.current =
|
|
1485
|
-
}, st = (
|
|
1501
|
+
p.currentTarget.setPointerCapture(p.pointerId), b.current = !0;
|
|
1502
|
+
const L = it(p);
|
|
1503
|
+
x.current = L, S.current = [L];
|
|
1504
|
+
}, st = (p) => {
|
|
1486
1505
|
if (!b.current || J !== "draw") return;
|
|
1487
|
-
const
|
|
1488
|
-
if (!
|
|
1489
|
-
const
|
|
1490
|
-
|
|
1491
|
-
},
|
|
1492
|
-
S.current.length > 1 &&
|
|
1493
|
-
},
|
|
1494
|
-
const
|
|
1495
|
-
!
|
|
1496
|
-
},
|
|
1497
|
-
|
|
1498
|
-
},
|
|
1506
|
+
const L = y.current, U = L == null ? void 0 : L.getContext("2d"), rt = x.current;
|
|
1507
|
+
if (!U || !rt) return;
|
|
1508
|
+
const Lt = it(p);
|
|
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
|
+
}, mt = () => {
|
|
1511
|
+
S.current.length > 1 && I.current.push([...S.current]), S.current = [], b.current = !1, x.current = null;
|
|
1512
|
+
}, It = () => {
|
|
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 = () => {
|
|
1499
1518
|
if (J === "draw") {
|
|
1500
|
-
const
|
|
1501
|
-
if (
|
|
1502
|
-
if (!
|
|
1519
|
+
const X = I.current, et = H.current;
|
|
1520
|
+
if (X.length === 0) {
|
|
1521
|
+
if (!et) return;
|
|
1503
1522
|
_ == null || _("sign", {
|
|
1504
1523
|
mode: "draw",
|
|
1505
|
-
imageDataUrl:
|
|
1506
|
-
width:
|
|
1507
|
-
height:
|
|
1508
|
-
inkColor:
|
|
1509
|
-
}), n(
|
|
1524
|
+
imageDataUrl: et.imageDataUrl,
|
|
1525
|
+
width: et.width,
|
|
1526
|
+
height: et.height,
|
|
1527
|
+
inkColor: Pt
|
|
1528
|
+
}), n(et.imageDataUrl, et.width, et.height);
|
|
1510
1529
|
return;
|
|
1511
1530
|
}
|
|
1512
|
-
let
|
|
1513
|
-
for (const
|
|
1514
|
-
for (const
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1518
|
-
const
|
|
1531
|
+
let ft = 1 / 0, Ft = 1 / 0, Rt = -1 / 0, Ht = -1 / 0;
|
|
1532
|
+
for (const _e of X)
|
|
1533
|
+
for (const Qt of _e)
|
|
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
|
+
const At = 8;
|
|
1536
|
+
ft = Math.max(0, ft - At), Ft = Math.max(0, Ft - At), Rt += At, Ht += At;
|
|
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)}`;
|
|
1519
1538
|
_ == null || _("sign", {
|
|
1520
1539
|
mode: "draw",
|
|
1521
|
-
imageDataUrl:
|
|
1522
|
-
width:
|
|
1523
|
-
height:
|
|
1524
|
-
inkColor:
|
|
1525
|
-
}), n(
|
|
1540
|
+
imageDataUrl: he,
|
|
1541
|
+
width: Ut,
|
|
1542
|
+
height: Yt,
|
|
1543
|
+
inkColor: Pt
|
|
1544
|
+
}), n(he, Ut, Yt);
|
|
1526
1545
|
return;
|
|
1527
1546
|
}
|
|
1528
|
-
if (!
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
const
|
|
1547
|
+
if (!yt) return;
|
|
1548
|
+
const p = 3, L = Dn(gt, $t.family), rt = document.createElement("canvas").getContext("2d");
|
|
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 * p)), F = Math.max(1, Math.round(v * p)), N = document.createElement("canvas");
|
|
1551
|
+
N.width = P, N.height = F;
|
|
1552
|
+
const j = N.getContext("2d");
|
|
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
|
+
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)}`;
|
|
1532
1555
|
_ == null || _("sign", {
|
|
1533
1556
|
mode: "type",
|
|
1534
|
-
imageDataUrl:
|
|
1535
|
-
width:
|
|
1536
|
-
height:
|
|
1537
|
-
typedName:
|
|
1538
|
-
typedInitials:
|
|
1557
|
+
imageDataUrl: lt,
|
|
1558
|
+
width: w,
|
|
1559
|
+
height: v,
|
|
1560
|
+
typedName: K,
|
|
1561
|
+
typedInitials: vt,
|
|
1539
1562
|
fontId: te,
|
|
1540
|
-
inkColor:
|
|
1563
|
+
inkColor: Pt,
|
|
1541
1564
|
typeKind: gt
|
|
1542
|
-
}), n(
|
|
1543
|
-
},
|
|
1544
|
-
if (
|
|
1545
|
-
const
|
|
1546
|
-
|
|
1547
|
-
},
|
|
1565
|
+
}), n(lt, w, v);
|
|
1566
|
+
}, ne = () => {
|
|
1567
|
+
if (A !== "date" && A !== "text") return;
|
|
1568
|
+
const p = A === "date" ? nt : q.trim();
|
|
1569
|
+
p && (_ == null || _(A, { value: p }), i == null || i(p, A));
|
|
1570
|
+
}, kt = A === "sign";
|
|
1548
1571
|
return /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal", role: "dialog", "aria-modal": "true", children: [
|
|
1549
1572
|
/* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__modal-backdrop", onClick: e }),
|
|
1550
1573
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-card", children: [
|
|
1551
1574
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-header", children: [
|
|
1552
|
-
/* @__PURE__ */ s("h3", { children:
|
|
1575
|
+
/* @__PURE__ */ s("h3", { children: A === "date" ? "Pick a date" : A === "text" ? "Enter text" : "Create e-signature" }),
|
|
1553
1576
|
/* @__PURE__ */ s(
|
|
1554
1577
|
"button",
|
|
1555
1578
|
{
|
|
@@ -1561,19 +1584,19 @@ function Cr({
|
|
|
1561
1584
|
}
|
|
1562
1585
|
)
|
|
1563
1586
|
] }),
|
|
1564
|
-
o && !r ? /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__field-type-tabs", role: "tablist", children: ["sign", "date", "text"].map((
|
|
1587
|
+
o && !r ? /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__field-type-tabs", role: "tablist", children: ["sign", "date", "text"].map((p) => /* @__PURE__ */ s(
|
|
1565
1588
|
"button",
|
|
1566
1589
|
{
|
|
1567
1590
|
type: "button",
|
|
1568
1591
|
role: "tab",
|
|
1569
|
-
"aria-selected":
|
|
1570
|
-
className:
|
|
1571
|
-
onClick: () =>
|
|
1572
|
-
children:
|
|
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"
|
|
1573
1596
|
},
|
|
1574
|
-
|
|
1597
|
+
p
|
|
1575
1598
|
)) }) : null,
|
|
1576
|
-
|
|
1599
|
+
kt ? /* @__PURE__ */ T(je, { children: [
|
|
1577
1600
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__sign-modes", children: [
|
|
1578
1601
|
/* @__PURE__ */ s(
|
|
1579
1602
|
"button",
|
|
@@ -1581,7 +1604,7 @@ function Cr({
|
|
|
1581
1604
|
type: "button",
|
|
1582
1605
|
className: J === "draw" ? "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--active" : "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
1583
1606
|
onClick: () => {
|
|
1584
|
-
Mt("draw"),
|
|
1607
|
+
Mt("draw"), It();
|
|
1585
1608
|
},
|
|
1586
1609
|
children: "Draw"
|
|
1587
1610
|
}
|
|
@@ -1594,37 +1617,26 @@ function Cr({
|
|
|
1594
1617
|
onClick: () => Mt("type"),
|
|
1595
1618
|
children: "Type"
|
|
1596
1619
|
}
|
|
1597
|
-
)
|
|
1598
|
-
/* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-ink", children: [
|
|
1599
|
-
"Ink",
|
|
1600
|
-
/* @__PURE__ */ s(
|
|
1601
|
-
"input",
|
|
1602
|
-
{
|
|
1603
|
-
type: "color",
|
|
1604
|
-
value: kt,
|
|
1605
|
-
onChange: (f) => lt(f.target.value)
|
|
1606
|
-
}
|
|
1607
|
-
)
|
|
1608
|
-
] })
|
|
1620
|
+
)
|
|
1609
1621
|
] }),
|
|
1610
|
-
J === "type" ? /* @__PURE__ */ T(
|
|
1622
|
+
J === "type" ? /* @__PURE__ */ T(je, { children: [
|
|
1611
1623
|
/* @__PURE__ */ s(
|
|
1612
1624
|
"div",
|
|
1613
1625
|
{
|
|
1614
1626
|
className: "epochs-pdf-viewer__sign-fonts",
|
|
1615
1627
|
role: "group",
|
|
1616
1628
|
"aria-label": "Handwriting style",
|
|
1617
|
-
children:
|
|
1629
|
+
children: Ue.map((p) => /* @__PURE__ */ s(
|
|
1618
1630
|
"button",
|
|
1619
1631
|
{
|
|
1620
1632
|
type: "button",
|
|
1621
|
-
className: te ===
|
|
1622
|
-
style: { fontFamily:
|
|
1623
|
-
onClick: () =>
|
|
1624
|
-
title:
|
|
1625
|
-
children:
|
|
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,
|
|
1637
|
+
children: bt
|
|
1626
1638
|
},
|
|
1627
|
-
|
|
1639
|
+
p.id
|
|
1628
1640
|
))
|
|
1629
1641
|
}
|
|
1630
1642
|
),
|
|
@@ -1636,11 +1648,11 @@ function Cr({
|
|
|
1636
1648
|
{
|
|
1637
1649
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1638
1650
|
type: "text",
|
|
1639
|
-
value:
|
|
1640
|
-
onChange: (
|
|
1651
|
+
value: K,
|
|
1652
|
+
onChange: (p) => ee(p.target.value),
|
|
1641
1653
|
onFocus: () => tt("signature"),
|
|
1642
1654
|
placeholder: "Type your full name",
|
|
1643
|
-
style: { fontFamily:
|
|
1655
|
+
style: { fontFamily: `"${$t.family}", cursive` },
|
|
1644
1656
|
autoFocus: !0
|
|
1645
1657
|
}
|
|
1646
1658
|
)
|
|
@@ -1652,14 +1664,14 @@ function Cr({
|
|
|
1652
1664
|
{
|
|
1653
1665
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1654
1666
|
type: "text",
|
|
1655
|
-
value:
|
|
1656
|
-
onChange: (
|
|
1657
|
-
|
|
1667
|
+
value: vt,
|
|
1668
|
+
onChange: (p) => {
|
|
1669
|
+
ht(!0), E(p.target.value.toUpperCase());
|
|
1658
1670
|
},
|
|
1659
1671
|
onFocus: () => tt("initials"),
|
|
1660
1672
|
placeholder: "e.g. JD",
|
|
1661
1673
|
maxLength: 4,
|
|
1662
|
-
style: { fontFamily:
|
|
1674
|
+
style: { fontFamily: `"${$t.family}", cursive` }
|
|
1663
1675
|
}
|
|
1664
1676
|
)
|
|
1665
1677
|
] })
|
|
@@ -1692,27 +1704,27 @@ function Cr({
|
|
|
1692
1704
|
]
|
|
1693
1705
|
}
|
|
1694
1706
|
)
|
|
1695
|
-
] }) : /* @__PURE__ */ s("p", { className: "epochs-pdf-viewer__sign-hint", children:
|
|
1707
|
+
] }) : /* @__PURE__ */ s("p", { className: "epochs-pdf-viewer__sign-hint", children: Kt ? "Previous signature loaded — submit to reuse, or draw a new one" : "Draw your signature below" }),
|
|
1696
1708
|
/* @__PURE__ */ s(
|
|
1697
1709
|
"canvas",
|
|
1698
1710
|
{
|
|
1699
|
-
ref:
|
|
1711
|
+
ref: y,
|
|
1700
1712
|
className: J === "draw" ? "epochs-pdf-viewer__sign-canvas" : "epochs-pdf-viewer__sign-canvas epochs-pdf-viewer__sign-canvas--preview",
|
|
1701
|
-
onPointerDown:
|
|
1713
|
+
onPointerDown: Wt,
|
|
1702
1714
|
onPointerMove: st,
|
|
1703
|
-
onPointerUp:
|
|
1704
|
-
onPointerLeave:
|
|
1715
|
+
onPointerUp: mt,
|
|
1716
|
+
onPointerLeave: mt
|
|
1705
1717
|
}
|
|
1706
1718
|
)
|
|
1707
|
-
] }) :
|
|
1719
|
+
] }) : A === "date" ? /* @__PURE__ */ T("label", { className: "epochs-pdf-viewer__sign-type-field", style: { padding: "1rem" }, children: [
|
|
1708
1720
|
/* @__PURE__ */ s("span", { children: "Date" }),
|
|
1709
1721
|
/* @__PURE__ */ s(
|
|
1710
1722
|
"input",
|
|
1711
1723
|
{
|
|
1712
1724
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1713
1725
|
type: "date",
|
|
1714
|
-
value:
|
|
1715
|
-
onChange: (
|
|
1726
|
+
value: nt,
|
|
1727
|
+
onChange: (p) => at(p.target.value),
|
|
1716
1728
|
autoFocus: !0
|
|
1717
1729
|
}
|
|
1718
1730
|
)
|
|
@@ -1723,20 +1735,20 @@ function Cr({
|
|
|
1723
1735
|
{
|
|
1724
1736
|
className: "epochs-pdf-viewer__sign-type-input",
|
|
1725
1737
|
type: "text",
|
|
1726
|
-
value:
|
|
1727
|
-
onChange: (
|
|
1738
|
+
value: q,
|
|
1739
|
+
onChange: (p) => pt(p.target.value),
|
|
1728
1740
|
placeholder: d ?? "Enter text",
|
|
1729
1741
|
autoFocus: !0
|
|
1730
1742
|
}
|
|
1731
1743
|
)
|
|
1732
1744
|
] }),
|
|
1733
1745
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__modal-actions", children: [
|
|
1734
|
-
|
|
1746
|
+
kt ? /* @__PURE__ */ s(
|
|
1735
1747
|
"button",
|
|
1736
1748
|
{
|
|
1737
1749
|
type: "button",
|
|
1738
1750
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
1739
|
-
onClick:
|
|
1751
|
+
onClick: It,
|
|
1740
1752
|
children: "Clear"
|
|
1741
1753
|
}
|
|
1742
1754
|
) : null,
|
|
@@ -1754,66 +1766,66 @@ function Cr({
|
|
|
1754
1766
|
{
|
|
1755
1767
|
type: "button",
|
|
1756
1768
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
|
|
1757
|
-
onClick:
|
|
1758
|
-
disabled:
|
|
1759
|
-
children:
|
|
1769
|
+
onClick: kt ? dt : ne,
|
|
1770
|
+
disabled: A === "date" ? !nt : A === "text" ? !q.trim() : !1,
|
|
1771
|
+
children: kt ? "Use signature" : "Place on page"
|
|
1760
1772
|
}
|
|
1761
1773
|
)
|
|
1762
1774
|
] })
|
|
1763
1775
|
] })
|
|
1764
1776
|
] });
|
|
1765
1777
|
}
|
|
1766
|
-
function
|
|
1778
|
+
function Tr(t) {
|
|
1767
1779
|
const e = t.trim().split(/\s+/).filter(Boolean);
|
|
1768
1780
|
return e.length === 0 ? "" : e.length === 1 ? e[0].slice(0, 2).toUpperCase() : e.slice(0, 3).map((n) => {
|
|
1769
1781
|
var i;
|
|
1770
1782
|
return ((i = n[0]) == null ? void 0 : i.toUpperCase()) ?? "";
|
|
1771
1783
|
}).join("");
|
|
1772
1784
|
}
|
|
1773
|
-
const
|
|
1774
|
-
function
|
|
1785
|
+
const Xe = "__epochsToolbarToolId";
|
|
1786
|
+
function zt(t, e) {
|
|
1775
1787
|
const n = (() => null);
|
|
1776
|
-
return n.displayName = e, Object.defineProperty(n,
|
|
1788
|
+
return n.displayName = e, Object.defineProperty(n, Xe, {
|
|
1777
1789
|
value: t,
|
|
1778
1790
|
enumerable: !0
|
|
1779
1791
|
}), n;
|
|
1780
1792
|
}
|
|
1781
|
-
function
|
|
1782
|
-
return t[
|
|
1793
|
+
function Ln(t) {
|
|
1794
|
+
return t[Xe];
|
|
1783
1795
|
}
|
|
1784
|
-
function
|
|
1785
|
-
return typeof t == "function" &&
|
|
1796
|
+
function Dr(t) {
|
|
1797
|
+
return typeof t == "function" && Xe in t && typeof t[Xe] == "string";
|
|
1786
1798
|
}
|
|
1787
|
-
const
|
|
1788
|
-
Bn,
|
|
1789
|
-
On,
|
|
1790
|
-
Wn,
|
|
1799
|
+
const zn = zt("thumbnail", "Thumbnail"), Sn = zt("navigation", "Navigation"), Gn = zt("zoom", "Zoom"), Xn = zt("rotate", "Rotate"), Vn = zt("reload", "Reload"), qn = zt("print", "Print"), Yn = zt("open", "Open"), Kn = zt("download", "Download"), Zn = zt("highlight", "Highlight"), Qn = zt("underline", "Underline"), Jn = zt("signature", "Signature"), ti = zt("text", "AddText"), ei = zt("erase", "Erase"), ni = zt("clear", "Clear"), ro = [
|
|
1791
1800
|
zn,
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1801
|
+
Sn,
|
|
1802
|
+
Gn,
|
|
1803
|
+
Xn,
|
|
1795
1804
|
Zn,
|
|
1796
1805
|
Qn,
|
|
1797
1806
|
Jn,
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1807
|
+
ti,
|
|
1808
|
+
ei,
|
|
1809
|
+
ni,
|
|
1810
|
+
Vn,
|
|
1811
|
+
qn,
|
|
1812
|
+
Yn,
|
|
1813
|
+
Kn
|
|
1814
|
+
], Fn = [
|
|
1815
|
+
[zn, Sn],
|
|
1804
1816
|
[
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
Vn,
|
|
1808
|
-
Yn,
|
|
1809
|
-
Kn,
|
|
1817
|
+
Gn,
|
|
1818
|
+
Xn,
|
|
1810
1819
|
Zn,
|
|
1811
1820
|
Qn,
|
|
1812
1821
|
Jn,
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1822
|
+
ti,
|
|
1823
|
+
ei,
|
|
1824
|
+
ni,
|
|
1825
|
+
Vn,
|
|
1826
|
+
qn,
|
|
1827
|
+
Yn,
|
|
1828
|
+
Kn
|
|
1817
1829
|
]
|
|
1818
1830
|
], Lr = [
|
|
1819
1831
|
"highlight",
|
|
@@ -1823,10 +1835,10 @@ const Bn = Wt("thumbnail", "Thumbnail"), On = Wt("navigation", "Navigation"), Wn
|
|
|
1823
1835
|
"erase",
|
|
1824
1836
|
"clear"
|
|
1825
1837
|
];
|
|
1826
|
-
function
|
|
1838
|
+
function Rn(t) {
|
|
1827
1839
|
return Lr.includes(t);
|
|
1828
1840
|
}
|
|
1829
|
-
function
|
|
1841
|
+
function Fr(t, e, n) {
|
|
1830
1842
|
const i = [];
|
|
1831
1843
|
switch (n != null && n.showMarkupSep && i.push(
|
|
1832
1844
|
/* @__PURE__ */ s(
|
|
@@ -1847,7 +1859,7 @@ function Dr(t, e, n) {
|
|
|
1847
1859
|
className: "epochs-pdf-viewer__btn",
|
|
1848
1860
|
onClick: () => e.setShowThumbnails((r) => !r),
|
|
1849
1861
|
title: e.showThumbnails ? "Hide thumbnails" : "Show thumbnails",
|
|
1850
|
-
children: /* @__PURE__ */ s(
|
|
1862
|
+
children: /* @__PURE__ */ s(sr, {})
|
|
1851
1863
|
},
|
|
1852
1864
|
"thumbnail"
|
|
1853
1865
|
)
|
|
@@ -1863,7 +1875,7 @@ function Dr(t, e, n) {
|
|
|
1863
1875
|
onClick: e.handlePrev,
|
|
1864
1876
|
disabled: !e.canGoPrev || e.status !== "ready",
|
|
1865
1877
|
title: "Previous page",
|
|
1866
|
-
children: /* @__PURE__ */ s(
|
|
1878
|
+
children: /* @__PURE__ */ s(nr, {})
|
|
1867
1879
|
},
|
|
1868
1880
|
"nav-prev"
|
|
1869
1881
|
),
|
|
@@ -1898,7 +1910,7 @@ function Dr(t, e, n) {
|
|
|
1898
1910
|
onClick: e.handleNext,
|
|
1899
1911
|
disabled: !e.canGoNext || e.status !== "ready",
|
|
1900
1912
|
title: "Next page",
|
|
1901
|
-
children: /* @__PURE__ */ s(
|
|
1913
|
+
children: /* @__PURE__ */ s(ir, {})
|
|
1902
1914
|
},
|
|
1903
1915
|
"nav-next"
|
|
1904
1916
|
)
|
|
@@ -1914,7 +1926,7 @@ function Dr(t, e, n) {
|
|
|
1914
1926
|
onClick: e.handleZoomOut,
|
|
1915
1927
|
disabled: e.status !== "ready",
|
|
1916
1928
|
title: "Zoom out",
|
|
1917
|
-
children: /* @__PURE__ */ s(
|
|
1929
|
+
children: /* @__PURE__ */ s(ar, {})
|
|
1918
1930
|
},
|
|
1919
1931
|
"zoom-out"
|
|
1920
1932
|
),
|
|
@@ -1930,7 +1942,7 @@ function Dr(t, e, n) {
|
|
|
1930
1942
|
onClick: e.handleZoomIn,
|
|
1931
1943
|
disabled: e.status !== "ready",
|
|
1932
1944
|
title: "Zoom in",
|
|
1933
|
-
children: /* @__PURE__ */ s(
|
|
1945
|
+
children: /* @__PURE__ */ s(cr, {})
|
|
1934
1946
|
},
|
|
1935
1947
|
"zoom-in"
|
|
1936
1948
|
),
|
|
@@ -1958,7 +1970,7 @@ function Dr(t, e, n) {
|
|
|
1958
1970
|
onClick: e.handleRotate,
|
|
1959
1971
|
disabled: e.status !== "ready",
|
|
1960
1972
|
title: "Rotate",
|
|
1961
|
-
children: /* @__PURE__ */ s(
|
|
1973
|
+
children: /* @__PURE__ */ s(hr, {})
|
|
1962
1974
|
},
|
|
1963
1975
|
"rotate"
|
|
1964
1976
|
)
|
|
@@ -1974,7 +1986,7 @@ function Dr(t, e, n) {
|
|
|
1974
1986
|
onClick: () => e.toggleMarkupTool("highlight"),
|
|
1975
1987
|
disabled: e.status !== "ready",
|
|
1976
1988
|
title: "Highlight text — select text to highlight",
|
|
1977
|
-
children: /* @__PURE__ */ s(
|
|
1989
|
+
children: /* @__PURE__ */ s(ur, {})
|
|
1978
1990
|
},
|
|
1979
1991
|
"highlight"
|
|
1980
1992
|
)
|
|
@@ -1990,7 +2002,7 @@ function Dr(t, e, n) {
|
|
|
1990
2002
|
onClick: () => e.toggleMarkupTool("underline"),
|
|
1991
2003
|
disabled: e.status !== "ready",
|
|
1992
2004
|
title: "Underline text — select text to underline",
|
|
1993
|
-
children: /* @__PURE__ */ s(
|
|
2005
|
+
children: /* @__PURE__ */ s(fr, {})
|
|
1994
2006
|
},
|
|
1995
2007
|
"underline"
|
|
1996
2008
|
)
|
|
@@ -2012,7 +2024,7 @@ function Dr(t, e, n) {
|
|
|
2012
2024
|
},
|
|
2013
2025
|
disabled: e.status !== "ready",
|
|
2014
2026
|
title: e.hasFixedSignatureFields ? "Create e-signature for a fixed field" : e.pendingSignature ? "Place signature — click on the page, then drag to move" : "Create e-signature",
|
|
2015
|
-
children: /* @__PURE__ */ s(
|
|
2027
|
+
children: /* @__PURE__ */ s(gr, {})
|
|
2016
2028
|
},
|
|
2017
2029
|
"signature"
|
|
2018
2030
|
)
|
|
@@ -2028,7 +2040,7 @@ function Dr(t, e, n) {
|
|
|
2028
2040
|
onClick: () => e.toggleMarkupTool("text"),
|
|
2029
2041
|
disabled: e.status !== "ready",
|
|
2030
2042
|
title: e.hasFixedTextFields ? "Edit text in predefined areas — click to type" : "Edit PDF text — select words, then change them",
|
|
2031
|
-
children: /* @__PURE__ */ s(
|
|
2043
|
+
children: /* @__PURE__ */ s(wr, {})
|
|
2032
2044
|
},
|
|
2033
2045
|
"text"
|
|
2034
2046
|
)
|
|
@@ -2044,7 +2056,7 @@ function Dr(t, e, n) {
|
|
|
2044
2056
|
onClick: () => e.toggleMarkupTool("erase"),
|
|
2045
2057
|
disabled: e.status !== "ready",
|
|
2046
2058
|
title: "Remove text — select PDF words to cover them, or click added markup",
|
|
2047
|
-
children: /* @__PURE__ */ s(
|
|
2059
|
+
children: /* @__PURE__ */ s(pr, {})
|
|
2048
2060
|
},
|
|
2049
2061
|
"erase"
|
|
2050
2062
|
)
|
|
@@ -2075,7 +2087,7 @@ function Dr(t, e, n) {
|
|
|
2075
2087
|
className: "epochs-pdf-viewer__btn",
|
|
2076
2088
|
onClick: () => void e.loadDocument(),
|
|
2077
2089
|
title: "Reload",
|
|
2078
|
-
children: /* @__PURE__ */ s(
|
|
2090
|
+
children: /* @__PURE__ */ s(dr, {})
|
|
2079
2091
|
},
|
|
2080
2092
|
"reload"
|
|
2081
2093
|
)
|
|
@@ -2091,7 +2103,7 @@ function Dr(t, e, n) {
|
|
|
2091
2103
|
onClick: () => void e.handlePrint(),
|
|
2092
2104
|
disabled: e.status !== "ready" || !e.pdfDoc || e.isPrinting,
|
|
2093
2105
|
title: e.isPrinting ? "Preparing print…" : "Print (includes highlights & underlines)",
|
|
2094
|
-
children: /* @__PURE__ */ s(
|
|
2106
|
+
children: /* @__PURE__ */ s(lr, {})
|
|
2095
2107
|
},
|
|
2096
2108
|
"print"
|
|
2097
2109
|
)
|
|
@@ -2107,7 +2119,7 @@ function Dr(t, e, n) {
|
|
|
2107
2119
|
target: "_blank",
|
|
2108
2120
|
rel: "noopener noreferrer",
|
|
2109
2121
|
title: "Open in new tab",
|
|
2110
|
-
children: /* @__PURE__ */ s(
|
|
2122
|
+
children: /* @__PURE__ */ s(or, {})
|
|
2111
2123
|
},
|
|
2112
2124
|
"open"
|
|
2113
2125
|
)
|
|
@@ -2123,7 +2135,7 @@ function Dr(t, e, n) {
|
|
|
2123
2135
|
onClick: () => void e.handleDownload(),
|
|
2124
2136
|
disabled: e.status !== "ready" || !e.pdfDoc || e.isDownloading,
|
|
2125
2137
|
title: e.isDownloading ? "Preparing download…" : e.annotationsLength > 0 || e.signaturesLength > 0 || e.textsLength > 0 ? "Download PDF with markup" : "Download PDF",
|
|
2126
|
-
children: /* @__PURE__ */ s(
|
|
2138
|
+
children: /* @__PURE__ */ s(rr, {})
|
|
2127
2139
|
},
|
|
2128
2140
|
"download"
|
|
2129
2141
|
)
|
|
@@ -2132,7 +2144,7 @@ function Dr(t, e, n) {
|
|
|
2132
2144
|
}
|
|
2133
2145
|
return i.length > 0 ? i : null;
|
|
2134
2146
|
}
|
|
2135
|
-
function
|
|
2147
|
+
function Rr(t, e) {
|
|
2136
2148
|
const n = [];
|
|
2137
2149
|
if (t.markupTool === "sign" && t.pendingSignature && !t.hasFixedSignatureFields && e.has("signature") && n.push(
|
|
2138
2150
|
/* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__markup-hint", children: "Click page to place duplicate/new signature" }, "sign-hint")
|
|
@@ -2141,7 +2153,7 @@ function Fr(t, e) {
|
|
|
2141
2153
|
), t.markupTool === "erase" && e.has("erase") && n.push(
|
|
2142
2154
|
/* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__markup-hint", children: "Select PDF words to remove · click added text/markup to erase" }, "erase-hint")
|
|
2143
2155
|
), t.markupTool === "highlight" && e.has("highlight") || t.markupTool === "underline" && e.has("underline")) {
|
|
2144
|
-
const i = t.markupTool === "highlight" ? t.highlightHex : t.underlineHex, r = t.markupTool === "highlight" ? t.setHighlightHex : t.setUnderlineHex, o = t.markupTool === "highlight" ?
|
|
2156
|
+
const i = t.markupTool === "highlight" ? t.highlightHex : t.underlineHex, r = t.markupTool === "highlight" ? t.setHighlightHex : t.setUnderlineHex, o = t.markupTool === "highlight" ? An : En;
|
|
2145
2157
|
n.push(
|
|
2146
2158
|
/* @__PURE__ */ T(
|
|
2147
2159
|
"div",
|
|
@@ -2154,12 +2166,12 @@ function Fr(t, e) {
|
|
|
2154
2166
|
"button",
|
|
2155
2167
|
{
|
|
2156
2168
|
type: "button",
|
|
2157
|
-
className:
|
|
2169
|
+
className: le(i) === le(d.hex) ? "epochs-pdf-viewer__swatch epochs-pdf-viewer__swatch--active" : "epochs-pdf-viewer__swatch",
|
|
2158
2170
|
style: { background: d.hex },
|
|
2159
2171
|
title: d.label,
|
|
2160
2172
|
"aria-label": d.label,
|
|
2161
|
-
"aria-pressed":
|
|
2162
|
-
onClick: () => r(
|
|
2173
|
+
"aria-pressed": le(i) === le(d.hex),
|
|
2174
|
+
onClick: () => r(le(d.hex))
|
|
2163
2175
|
},
|
|
2164
2176
|
d.id
|
|
2165
2177
|
)),
|
|
@@ -2180,8 +2192,8 @@ function Fr(t, e) {
|
|
|
2180
2192
|
"input",
|
|
2181
2193
|
{
|
|
2182
2194
|
type: "color",
|
|
2183
|
-
value:
|
|
2184
|
-
onChange: (d) => r(
|
|
2195
|
+
value: le(i),
|
|
2196
|
+
onChange: (d) => r(le(d.target.value)),
|
|
2185
2197
|
"aria-label": "Custom color"
|
|
2186
2198
|
}
|
|
2187
2199
|
)
|
|
@@ -2196,16 +2208,16 @@ function Fr(t, e) {
|
|
|
2196
2208
|
}
|
|
2197
2209
|
return n.length > 0 ? n : null;
|
|
2198
2210
|
}
|
|
2199
|
-
function
|
|
2211
|
+
function Ar(t, e) {
|
|
2200
2212
|
if (!t) return null;
|
|
2201
2213
|
if (Array.isArray(t)) {
|
|
2202
|
-
const o = (d) => (d ?? []).filter(
|
|
2214
|
+
const o = (d) => (d ?? []).filter(Dr).map(Ln);
|
|
2203
2215
|
return {
|
|
2204
2216
|
left: o(t[0]),
|
|
2205
2217
|
right: o(t[1])
|
|
2206
2218
|
};
|
|
2207
2219
|
}
|
|
2208
|
-
const n = e.enableThumbnails, i = (o, d) => o.map(
|
|
2220
|
+
const n = e.enableThumbnails, i = (o, d) => o.map(Ln).filter((u) => d[u] !== !1), r = {
|
|
2209
2221
|
thumbnail: n,
|
|
2210
2222
|
navigation: e.enableNavigation,
|
|
2211
2223
|
zoom: e.enableZoom,
|
|
@@ -2222,11 +2234,11 @@ function Rr(t, e) {
|
|
|
2222
2234
|
clear: e.enableClear
|
|
2223
2235
|
};
|
|
2224
2236
|
return {
|
|
2225
|
-
left: i(
|
|
2226
|
-
right: i(
|
|
2237
|
+
left: i(Fn[0], r),
|
|
2238
|
+
right: i(Fn[1], r)
|
|
2227
2239
|
};
|
|
2228
2240
|
}
|
|
2229
|
-
function
|
|
2241
|
+
function oo({
|
|
2230
2242
|
file: t,
|
|
2231
2243
|
fileUrl: e,
|
|
2232
2244
|
baseUrl: n = "",
|
|
@@ -2238,78 +2250,78 @@ function ro({
|
|
|
2238
2250
|
thumbnailWidth: m = 140,
|
|
2239
2251
|
maxThumbnails: g = 60,
|
|
2240
2252
|
className: _,
|
|
2241
|
-
workerSrc:
|
|
2253
|
+
workerSrc: y,
|
|
2242
2254
|
enableToolbar: b = !1,
|
|
2243
2255
|
enableThumbnails: x,
|
|
2244
|
-
enableNavigation:
|
|
2256
|
+
enableNavigation: I = !0,
|
|
2245
2257
|
enableZoom: S = !0,
|
|
2246
2258
|
enableRotate: H = !0,
|
|
2247
|
-
enableReload:
|
|
2248
|
-
enablePrint:
|
|
2249
|
-
enableOpen:
|
|
2250
|
-
enableDownload:
|
|
2259
|
+
enableReload: W = !0,
|
|
2260
|
+
enablePrint: A = !0,
|
|
2261
|
+
enableOpen: C = !0,
|
|
2262
|
+
enableDownload: nt = !0,
|
|
2251
2263
|
enableMarkup: at = !0,
|
|
2252
|
-
enableHighlight:
|
|
2264
|
+
enableHighlight: q = !0,
|
|
2253
2265
|
enableUnderline: pt = !0,
|
|
2254
2266
|
enableSignature: J = !0,
|
|
2255
2267
|
enableText: Mt = !0,
|
|
2256
|
-
enableErase:
|
|
2257
|
-
enableClear:
|
|
2258
|
-
signatureFields:
|
|
2259
|
-
textFields:
|
|
2268
|
+
enableErase: K = !0,
|
|
2269
|
+
enableClear: Et = !0,
|
|
2270
|
+
signatureFields: vt = [],
|
|
2271
|
+
textFields: E = [],
|
|
2260
2272
|
onSignatureComplete: ct,
|
|
2261
|
-
onSignatureFieldsChange:
|
|
2273
|
+
onSignatureFieldsChange: ht,
|
|
2262
2274
|
applySignatureToSameTag: gt = !1,
|
|
2263
2275
|
onFieldValueComplete: tt,
|
|
2264
|
-
openSignaturePad:
|
|
2265
|
-
onSignaturePadClose:
|
|
2276
|
+
openSignaturePad: Pt = !1,
|
|
2277
|
+
onSignaturePadClose: ut,
|
|
2266
2278
|
onSubmit: te,
|
|
2267
|
-
submitLabel:
|
|
2268
|
-
submitLoading:
|
|
2279
|
+
submitLabel: ye = "Submit",
|
|
2280
|
+
submitLoading: Vt = !1
|
|
2269
2281
|
}) {
|
|
2270
|
-
var
|
|
2271
|
-
const
|
|
2282
|
+
var Mn, kn;
|
|
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(
|
|
2272
2284
|
null
|
|
2273
|
-
), [
|
|
2285
|
+
), [_t, Ut] = O(
|
|
2274
2286
|
null
|
|
2275
|
-
), [
|
|
2276
|
-
|
|
2277
|
-
|
|
2287
|
+
), [Yt, Gt] = O(null), [be, se] = O(null), [Ve, de] = O(null), [qe, he] = O(null), [_e, Qt] = O(Hn), [ae, di] = O(zi), Te = E.length > 0, [Xt, Ye] = O({}), [B, Ke] = O(vt), ve = xt(B);
|
|
2288
|
+
ve.current = B, Dt(() => {
|
|
2289
|
+
ve.current = vt, Ke(vt), Ye((c) => {
|
|
2278
2290
|
const h = { ...c };
|
|
2279
|
-
for (const l of
|
|
2280
|
-
const
|
|
2281
|
-
(
|
|
2291
|
+
for (const l of vt) {
|
|
2292
|
+
const f = l.type ?? "sign";
|
|
2293
|
+
(f === "date" || f === "text") && l.value != null && l.value !== "" && (h[l.id] = l.value);
|
|
2282
2294
|
}
|
|
2283
2295
|
return h;
|
|
2284
2296
|
});
|
|
2285
|
-
}, [
|
|
2286
|
-
const jt =
|
|
2297
|
+
}, [vt]);
|
|
2298
|
+
const jt = B.length > 0, De = Y(
|
|
2287
2299
|
(c, h, l) => {
|
|
2288
|
-
var
|
|
2289
|
-
const
|
|
2290
|
-
return
|
|
2300
|
+
var k;
|
|
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;
|
|
2291
2303
|
},
|
|
2292
2304
|
[]
|
|
2293
|
-
),
|
|
2305
|
+
), pn = Y(
|
|
2294
2306
|
(c, h) => {
|
|
2295
|
-
const l = new Set(c),
|
|
2307
|
+
const l = new Set(c), k = ve.current.map(
|
|
2296
2308
|
($) => l.has($.id) ? { ...$, value: h } : $
|
|
2297
2309
|
);
|
|
2298
|
-
|
|
2299
|
-
const
|
|
2300
|
-
for (const ot of c)
|
|
2301
|
-
return
|
|
2310
|
+
ve.current = k, Ke(k), ht == null || ht(k), Ye(($) => {
|
|
2311
|
+
const z = { ...$ };
|
|
2312
|
+
for (const ot of c) z[ot] = h;
|
|
2313
|
+
return z;
|
|
2302
2314
|
});
|
|
2303
2315
|
for (const $ of c)
|
|
2304
2316
|
tt == null || tt($, h);
|
|
2305
2317
|
},
|
|
2306
|
-
[tt,
|
|
2307
|
-
),
|
|
2318
|
+
[tt, ht]
|
|
2319
|
+
), Le = Y(
|
|
2308
2320
|
(c, h, l) => {
|
|
2309
|
-
const
|
|
2321
|
+
const f = ve.current, k = c == null ? null : Array.isArray(c) ? c : [c], $ = k ? new Set(k) : null, z = $ ? f.map(
|
|
2310
2322
|
(ot) => $.has(ot.id) ? { ...ot, signatureDataUrl: h.imageDataUrl } : ot
|
|
2311
2323
|
) : [
|
|
2312
|
-
...
|
|
2324
|
+
...f,
|
|
2313
2325
|
{
|
|
2314
2326
|
id: h.id,
|
|
2315
2327
|
pageNumber: h.pageNumber,
|
|
@@ -2321,126 +2333,126 @@ function ro({
|
|
|
2321
2333
|
signatureDataUrl: h.imageDataUrl
|
|
2322
2334
|
}
|
|
2323
2335
|
];
|
|
2324
|
-
if (
|
|
2336
|
+
if (ve.current = z, Ke(z), ht == null || ht(z), !k || k.length === 0) {
|
|
2325
2337
|
ct == null || ct(void 0, h);
|
|
2326
2338
|
return;
|
|
2327
2339
|
}
|
|
2328
|
-
for (const ot of
|
|
2340
|
+
for (const ot of k)
|
|
2329
2341
|
ct == null || ct(
|
|
2330
2342
|
ot,
|
|
2331
2343
|
(l == null ? void 0 : l.get(ot)) ?? h
|
|
2332
2344
|
);
|
|
2333
2345
|
},
|
|
2334
|
-
[ct,
|
|
2346
|
+
[ct, ht]
|
|
2335
2347
|
);
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
}, [
|
|
2339
|
-
const
|
|
2340
|
-
() =>
|
|
2348
|
+
Dt(() => {
|
|
2349
|
+
Pt && X(!0);
|
|
2350
|
+
}, [Pt]);
|
|
2351
|
+
const ue = Pe(
|
|
2352
|
+
() => Ar(b, {
|
|
2341
2353
|
enableThumbnails: x,
|
|
2342
|
-
enableNavigation:
|
|
2354
|
+
enableNavigation: I,
|
|
2343
2355
|
enableZoom: S,
|
|
2344
2356
|
enableRotate: H,
|
|
2345
|
-
enableReload:
|
|
2346
|
-
enablePrint:
|
|
2347
|
-
enableOpen:
|
|
2348
|
-
enableDownload:
|
|
2349
|
-
enableHighlight:
|
|
2357
|
+
enableReload: W,
|
|
2358
|
+
enablePrint: A,
|
|
2359
|
+
enableOpen: C,
|
|
2360
|
+
enableDownload: nt,
|
|
2361
|
+
enableHighlight: q,
|
|
2350
2362
|
enableUnderline: pt,
|
|
2351
2363
|
enableSignature: J,
|
|
2352
2364
|
enableText: Mt,
|
|
2353
|
-
enableErase:
|
|
2354
|
-
enableClear:
|
|
2365
|
+
enableErase: K,
|
|
2366
|
+
enableClear: Et
|
|
2355
2367
|
}),
|
|
2356
2368
|
[
|
|
2357
2369
|
b,
|
|
2358
2370
|
x,
|
|
2359
|
-
|
|
2371
|
+
I,
|
|
2360
2372
|
S,
|
|
2361
2373
|
H,
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2374
|
+
W,
|
|
2375
|
+
A,
|
|
2376
|
+
C,
|
|
2377
|
+
nt,
|
|
2378
|
+
q,
|
|
2367
2379
|
pt,
|
|
2368
2380
|
J,
|
|
2369
2381
|
Mt,
|
|
2370
|
-
|
|
2371
|
-
|
|
2382
|
+
K,
|
|
2383
|
+
Et
|
|
2372
2384
|
]
|
|
2373
|
-
),
|
|
2374
|
-
|
|
2375
|
-
if (!
|
|
2376
|
-
|
|
2385
|
+
), fe = Pe(() => ue ? /* @__PURE__ */ new Set([...ue.left, ...ue.right]) : /* @__PURE__ */ new Set(), [ue]);
|
|
2386
|
+
Dt(() => {
|
|
2387
|
+
if (!fe.has("thumbnail")) {
|
|
2388
|
+
Zt(!1);
|
|
2377
2389
|
return;
|
|
2378
2390
|
}
|
|
2379
2391
|
const h = window.matchMedia("(max-width: 720px)"), l = () => {
|
|
2380
|
-
|
|
2392
|
+
Zt(h.matches ? !1 : u);
|
|
2381
2393
|
};
|
|
2382
2394
|
return l(), h.addEventListener("change", l), () => h.removeEventListener("change", l);
|
|
2383
|
-
}, [
|
|
2384
|
-
const
|
|
2385
|
-
|
|
2386
|
-
}, []),
|
|
2387
|
-
if (!(!
|
|
2388
|
-
|
|
2395
|
+
}, [fe, u]);
|
|
2396
|
+
const gn = !jt && fe.has("highlight"), mn = !jt && fe.has("underline"), Ze = fe.has("signature") || jt, wn = fe.has("text") || Te, yn = !jt && fe.has("erase"), Fe = Y(() => {
|
|
2397
|
+
Kt.current && (URL.revokeObjectURL(Kt.current), Kt.current = null);
|
|
2398
|
+
}, []), Qe = Y(async () => {
|
|
2399
|
+
if (!(!yt && !bt)) {
|
|
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");
|
|
2389
2401
|
try {
|
|
2390
|
-
const c =
|
|
2391
|
-
|
|
2392
|
-
const
|
|
2402
|
+
const c = yt ? await In(yt, i) : await In(bt, i), h = new Blob([c], { type: "application/pdf" }), l = URL.createObjectURL(h);
|
|
2403
|
+
Fe(), Kt.current = l, rt(l);
|
|
2404
|
+
const k = await Ie.getDocument({
|
|
2393
2405
|
data: c,
|
|
2394
|
-
cMapUrl: `https://unpkg.com/pdfjs-dist@${
|
|
2406
|
+
cMapUrl: `https://unpkg.com/pdfjs-dist@${Ie.version}/cmaps/`,
|
|
2395
2407
|
cMapPacked: !0,
|
|
2396
|
-
standardFontDataUrl: `https://unpkg.com/pdfjs-dist@${
|
|
2408
|
+
standardFontDataUrl: `https://unpkg.com/pdfjs-dist@${Ie.version}/standard_fonts/`
|
|
2397
2409
|
}).promise;
|
|
2398
|
-
|
|
2410
|
+
mt(k), ee(k.numPages), Wt("ready");
|
|
2399
2411
|
} catch {
|
|
2400
|
-
|
|
2412
|
+
Wt("error");
|
|
2401
2413
|
}
|
|
2402
2414
|
}
|
|
2403
2415
|
}, [
|
|
2404
|
-
|
|
2405
|
-
|
|
2416
|
+
yt,
|
|
2417
|
+
bt,
|
|
2406
2418
|
i,
|
|
2407
|
-
|
|
2408
|
-
|
|
2419
|
+
Fe,
|
|
2420
|
+
y
|
|
2409
2421
|
]);
|
|
2410
|
-
|
|
2411
|
-
if (!
|
|
2412
|
-
|
|
2422
|
+
Dt(() => {
|
|
2423
|
+
if (!yt && !bt) {
|
|
2424
|
+
Wt("idle"), mt(null), ee(0), rt(null), Fe();
|
|
2413
2425
|
return;
|
|
2414
2426
|
}
|
|
2415
|
-
return
|
|
2416
|
-
|
|
2427
|
+
return Qe(), () => {
|
|
2428
|
+
Fe();
|
|
2417
2429
|
};
|
|
2418
|
-
}, [
|
|
2419
|
-
(M === "highlight" && !
|
|
2420
|
-
}, [
|
|
2421
|
-
const
|
|
2430
|
+
}, [yt, bt, Qe, Fe]), Dt(() => {
|
|
2431
|
+
(M === "highlight" && !gn || M === "underline" && !mn || M === "sign" && !Ze || M === "text" && !wn || M === "erase" && !yn) && D("none");
|
|
2432
|
+
}, [gn, mn, Ze, wn, yn, M]);
|
|
2433
|
+
const xe = Y(
|
|
2422
2434
|
(c) => {
|
|
2423
|
-
const h = Math.max(1, Math.min(
|
|
2435
|
+
const h = Math.max(1, Math.min(It || 1, c)), l = G.current.get(h);
|
|
2424
2436
|
if (!l) {
|
|
2425
|
-
|
|
2437
|
+
ne(h);
|
|
2426
2438
|
return;
|
|
2427
2439
|
}
|
|
2428
|
-
|
|
2429
|
-
|
|
2440
|
+
$t.current = !0, l.scrollIntoView({ behavior: "smooth", block: "start" }), ne(h), window.setTimeout(() => {
|
|
2441
|
+
$t.current = !1;
|
|
2430
2442
|
}, 500);
|
|
2431
2443
|
},
|
|
2432
|
-
[
|
|
2433
|
-
),
|
|
2444
|
+
[It]
|
|
2445
|
+
), Me = Y(
|
|
2434
2446
|
(c) => {
|
|
2435
|
-
const h =
|
|
2436
|
-
h && (
|
|
2447
|
+
const h = G.current.get(c.pageNumber);
|
|
2448
|
+
h && ($t.current = !0, ne(c.pageNumber));
|
|
2437
2449
|
const l = () => {
|
|
2438
|
-
var
|
|
2439
|
-
const
|
|
2450
|
+
var k;
|
|
2451
|
+
const f = (k = qt.current) == null ? void 0 : k.querySelector(
|
|
2440
2452
|
`[data-signature-field-id="${CSS.escape(c.id)}"]`
|
|
2441
2453
|
);
|
|
2442
|
-
|
|
2443
|
-
|
|
2454
|
+
f ? f.scrollIntoView({ behavior: "smooth", block: "center" }) : h && h.scrollIntoView({ behavior: "smooth", block: "start" }), window.setTimeout(() => {
|
|
2455
|
+
$t.current = !1;
|
|
2444
2456
|
}, 500);
|
|
2445
2457
|
};
|
|
2446
2458
|
window.requestAnimationFrame(() => {
|
|
@@ -2449,78 +2461,78 @@ function ro({
|
|
|
2449
2461
|
},
|
|
2450
2462
|
[]
|
|
2451
2463
|
);
|
|
2452
|
-
|
|
2453
|
-
if (
|
|
2454
|
-
const c =
|
|
2464
|
+
Dt(() => {
|
|
2465
|
+
if (it !== "ready" || !qt.current || !It) return;
|
|
2466
|
+
const c = qt.current, h = new IntersectionObserver(
|
|
2455
2467
|
(l) => {
|
|
2456
|
-
if (
|
|
2457
|
-
let
|
|
2458
|
-
for (const
|
|
2459
|
-
if (!
|
|
2468
|
+
if ($t.current) return;
|
|
2469
|
+
let f = null;
|
|
2470
|
+
for (const k of l) {
|
|
2471
|
+
if (!k.isIntersecting) continue;
|
|
2460
2472
|
const $ = Number.parseInt(
|
|
2461
|
-
|
|
2473
|
+
k.target.dataset.pageNumber || "0",
|
|
2462
2474
|
10
|
|
2463
2475
|
);
|
|
2464
|
-
$ && (!
|
|
2476
|
+
$ && (!f || k.intersectionRatio > f.ratio) && (f = { page: $, ratio: k.intersectionRatio });
|
|
2465
2477
|
}
|
|
2466
|
-
|
|
2478
|
+
f && ne(f.page);
|
|
2467
2479
|
},
|
|
2468
2480
|
{
|
|
2469
2481
|
root: c,
|
|
2470
2482
|
threshold: [0.25, 0.5, 0.75]
|
|
2471
2483
|
}
|
|
2472
2484
|
);
|
|
2473
|
-
for (let l = 1; l <=
|
|
2474
|
-
const
|
|
2475
|
-
|
|
2485
|
+
for (let l = 1; l <= It; l += 1) {
|
|
2486
|
+
const f = G.current.get(l);
|
|
2487
|
+
f && h.observe(f);
|
|
2476
2488
|
}
|
|
2477
2489
|
return () => h.disconnect();
|
|
2478
|
-
}, [
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
}, [
|
|
2482
|
-
|
|
2483
|
-
}, [
|
|
2484
|
-
|
|
2485
|
-
}, []),
|
|
2486
|
-
|
|
2487
|
-
}, []),
|
|
2488
|
-
|
|
2489
|
-
}, []),
|
|
2490
|
-
if (!(!
|
|
2490
|
+
}, [it, It]);
|
|
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(() => {
|
|
2496
|
+
L((c) => (c + 90) % 360);
|
|
2497
|
+
}, []), pi = Y(() => {
|
|
2498
|
+
oe((c) => Math.max(0.25, Math.round((c - 0.1) * 100) / 100));
|
|
2499
|
+
}, []), gi = Y(() => {
|
|
2500
|
+
oe((c) => Math.min(5, Math.round((c + 0.1) * 100) / 100));
|
|
2501
|
+
}, []), en = Y(async () => {
|
|
2502
|
+
if (!(!st || !qt.current))
|
|
2491
2503
|
try {
|
|
2492
|
-
const h = (await
|
|
2504
|
+
const h = (await st.getPage(dt)).getViewport({ scale: 1, rotation: p }), f = window.matchMedia("(max-width: 720px)").matches ? 16 : 24, $ = Math.max(
|
|
2493
2505
|
0,
|
|
2494
|
-
|
|
2506
|
+
qt.current.clientWidth - f
|
|
2495
2507
|
) / h.width;
|
|
2496
|
-
|
|
2508
|
+
oe(Math.max(0.25, Math.min(5, Math.round($ * 100) / 100)));
|
|
2497
2509
|
} catch {
|
|
2498
2510
|
}
|
|
2499
|
-
}, [
|
|
2500
|
-
|
|
2501
|
-
if (
|
|
2511
|
+
}, [st, dt, p]);
|
|
2512
|
+
Dt(() => {
|
|
2513
|
+
if (it !== "ready" || !st || !window.matchMedia("(max-width: 720px)").matches) return;
|
|
2502
2514
|
let c = !1;
|
|
2503
2515
|
const h = () => {
|
|
2504
|
-
c ||
|
|
2516
|
+
c || en();
|
|
2505
2517
|
};
|
|
2506
2518
|
h();
|
|
2507
|
-
const l =
|
|
2508
|
-
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2519
|
+
const l = qt.current, f = typeof ResizeObserver < "u" && l ? new ResizeObserver(() => h()) : null;
|
|
2520
|
+
f == null || f.observe(l);
|
|
2521
|
+
const k = window.matchMedia("(max-width: 720px)"), $ = () => {
|
|
2522
|
+
k.matches && h();
|
|
2511
2523
|
};
|
|
2512
|
-
return
|
|
2513
|
-
c = !0,
|
|
2524
|
+
return k.addEventListener("change", $), () => {
|
|
2525
|
+
c = !0, f == null || f.disconnect(), k.removeEventListener("change", $);
|
|
2514
2526
|
};
|
|
2515
|
-
}, [
|
|
2516
|
-
const
|
|
2527
|
+
}, [it, st, Lt, p, en]);
|
|
2528
|
+
const bn = Pe(() => B.flatMap((c) => {
|
|
2517
2529
|
const h = c.type ?? "sign";
|
|
2518
2530
|
if (h !== "date" && h !== "text") return [];
|
|
2519
|
-
const l = (
|
|
2531
|
+
const l = (Xt[c.id] ?? c.value ?? "").trim();
|
|
2520
2532
|
if (!l) return [];
|
|
2521
|
-
const
|
|
2533
|
+
const f = Math.max(
|
|
2522
2534
|
10,
|
|
2523
|
-
Math.min(
|
|
2535
|
+
Math.min(we, c.height * 0.55)
|
|
2524
2536
|
);
|
|
2525
2537
|
return [
|
|
2526
2538
|
{
|
|
@@ -2528,34 +2540,34 @@ function ro({
|
|
|
2528
2540
|
pageNumber: c.pageNumber,
|
|
2529
2541
|
fieldId: c.id,
|
|
2530
2542
|
x: c.x + 4,
|
|
2531
|
-
y: c.y + Math.max(2, (c.height -
|
|
2543
|
+
y: c.y + Math.max(2, (c.height - f) / 2),
|
|
2532
2544
|
width: Math.max(12, c.width - 8),
|
|
2533
|
-
height: Math.max(
|
|
2545
|
+
height: Math.max(f * 1.2, c.height - 4),
|
|
2534
2546
|
value: l,
|
|
2535
|
-
fontSize:
|
|
2536
|
-
color:
|
|
2547
|
+
fontSize: f,
|
|
2548
|
+
color: me
|
|
2537
2549
|
}
|
|
2538
2550
|
];
|
|
2539
|
-
}), [
|
|
2540
|
-
() => [...
|
|
2541
|
-
[
|
|
2542
|
-
),
|
|
2551
|
+
}), [B, Xt]), ke = Pe(
|
|
2552
|
+
() => [...Z, ...bn],
|
|
2553
|
+
[Z, bn]
|
|
2554
|
+
), mi = Y(async () => {
|
|
2543
2555
|
var c;
|
|
2544
|
-
if (!(!
|
|
2556
|
+
if (!(!st || it !== "ready")) {
|
|
2545
2557
|
a(!0);
|
|
2546
2558
|
try {
|
|
2547
|
-
const h = await
|
|
2559
|
+
const h = await Cn(st, {
|
|
2548
2560
|
scale: 1.5,
|
|
2549
|
-
rotation:
|
|
2561
|
+
rotation: p,
|
|
2550
2562
|
annotations: P,
|
|
2551
|
-
signatures:
|
|
2552
|
-
texts:
|
|
2563
|
+
signatures: N,
|
|
2564
|
+
texts: ke,
|
|
2553
2565
|
mimeType: "image/png"
|
|
2554
2566
|
}), l = document.createElement("iframe");
|
|
2555
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);
|
|
2556
|
-
const
|
|
2557
|
-
if (!
|
|
2558
|
-
|
|
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>
|
|
2559
2571
|
<html>
|
|
2560
2572
|
<head>
|
|
2561
2573
|
<meta charset="utf-8" />
|
|
@@ -2569,26 +2581,26 @@ function ro({
|
|
|
2569
2581
|
</style>
|
|
2570
2582
|
</head>
|
|
2571
2583
|
<body></body>
|
|
2572
|
-
</html>`),
|
|
2573
|
-
const
|
|
2584
|
+
</html>`), f.close();
|
|
2585
|
+
const k = f.body;
|
|
2574
2586
|
for (const $ of h) {
|
|
2575
|
-
const
|
|
2576
|
-
|
|
2577
|
-
const ot =
|
|
2578
|
-
ot.className = "page", ot.appendChild(
|
|
2587
|
+
const z = f.createElement("img");
|
|
2588
|
+
z.src = $.dataUrl;
|
|
2589
|
+
const ot = f.createElement("div");
|
|
2590
|
+
ot.className = "page", ot.appendChild(z), k.appendChild(ot);
|
|
2579
2591
|
}
|
|
2580
2592
|
await Promise.all(
|
|
2581
|
-
Array.from(
|
|
2593
|
+
Array.from(k.querySelectorAll("img")).map(
|
|
2582
2594
|
($) => {
|
|
2583
|
-
var
|
|
2584
|
-
return ((
|
|
2595
|
+
var z;
|
|
2596
|
+
return ((z = $.decode) == null ? void 0 : z.call($).catch(() => {
|
|
2585
2597
|
})) ?? Promise.resolve();
|
|
2586
2598
|
}
|
|
2587
2599
|
)
|
|
2588
2600
|
), setTimeout(() => {
|
|
2589
|
-
var $,
|
|
2601
|
+
var $, z;
|
|
2590
2602
|
try {
|
|
2591
|
-
($ = l.contentWindow) == null || $.focus(), (
|
|
2603
|
+
($ = l.contentWindow) == null || $.focus(), (z = l.contentWindow) == null || z.print();
|
|
2592
2604
|
} finally {
|
|
2593
2605
|
setTimeout(() => {
|
|
2594
2606
|
try {
|
|
@@ -2600,125 +2612,125 @@ function ro({
|
|
|
2600
2612
|
}, 50);
|
|
2601
2613
|
} catch {
|
|
2602
2614
|
try {
|
|
2603
|
-
|
|
2615
|
+
U ? window.open(U, "_blank", "noopener,noreferrer") : bt && window.open(bt, "_blank", "noopener,noreferrer");
|
|
2604
2616
|
} catch {
|
|
2605
2617
|
}
|
|
2606
2618
|
} finally {
|
|
2607
2619
|
a(!1);
|
|
2608
2620
|
}
|
|
2609
2621
|
}
|
|
2610
|
-
}, [
|
|
2611
|
-
if (!
|
|
2622
|
+
}, [st, it, p, o, U, bt, P, N, ke]), wi = Y(async () => {
|
|
2623
|
+
if (!st || it !== "ready") return;
|
|
2612
2624
|
const c = `${o.replace(/[^\w.-]+/g, "_") || "document"}.pdf`;
|
|
2613
|
-
if (!(P.length > 0 ||
|
|
2614
|
-
|
|
2615
|
-
await fetch(
|
|
2625
|
+
if (!(P.length > 0 || N.length > 0 || ke.length > 0) && U) {
|
|
2626
|
+
hn(
|
|
2627
|
+
await fetch(U).then((l) => l.blob()),
|
|
2616
2628
|
c
|
|
2617
2629
|
);
|
|
2618
2630
|
return;
|
|
2619
2631
|
}
|
|
2620
2632
|
v(!0);
|
|
2621
2633
|
try {
|
|
2622
|
-
const l = await
|
|
2634
|
+
const l = await Cn(st, {
|
|
2623
2635
|
scale: 2,
|
|
2624
|
-
rotation:
|
|
2636
|
+
rotation: p,
|
|
2625
2637
|
annotations: P,
|
|
2626
|
-
signatures:
|
|
2627
|
-
texts:
|
|
2638
|
+
signatures: N,
|
|
2639
|
+
texts: ke,
|
|
2628
2640
|
mimeType: "image/jpeg",
|
|
2629
2641
|
quality: 0.92
|
|
2630
|
-
}),
|
|
2631
|
-
|
|
2632
|
-
new Blob([
|
|
2642
|
+
}), f = Pr(l), k = new Uint8Array(f.byteLength);
|
|
2643
|
+
k.set(f), hn(
|
|
2644
|
+
new Blob([k], { type: "application/pdf" }),
|
|
2633
2645
|
c
|
|
2634
2646
|
);
|
|
2635
2647
|
} catch {
|
|
2636
|
-
|
|
2637
|
-
await fetch(
|
|
2648
|
+
U && hn(
|
|
2649
|
+
await fetch(U).then((l) => l.blob()),
|
|
2638
2650
|
c
|
|
2639
2651
|
);
|
|
2640
2652
|
} finally {
|
|
2641
2653
|
v(!1);
|
|
2642
2654
|
}
|
|
2643
|
-
}, [
|
|
2655
|
+
}, [st, it, p, o, U, P, N, ke]), yi = Y((c) => {
|
|
2644
2656
|
D((h) => h === c ? "none" : c);
|
|
2645
|
-
}, []),
|
|
2646
|
-
|
|
2647
|
-
}, []),
|
|
2648
|
-
|
|
2649
|
-
}, []),
|
|
2650
|
-
|
|
2651
|
-
}, []),
|
|
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) => {
|
|
2658
|
+
F((h) => [...h, c]);
|
|
2659
|
+
}, []), vi = Y((c) => {
|
|
2660
|
+
F((h) => h.filter((l) => l.id !== c));
|
|
2661
|
+
}, []), xi = Y(() => {
|
|
2662
|
+
F([]), j([]), R([]), Nt(null), se(null), de(null), he(null);
|
|
2663
|
+
}, []), Be = Y(
|
|
2652
2664
|
(c, h) => {
|
|
2653
|
-
const l =
|
|
2654
|
-
(
|
|
2655
|
-
),
|
|
2656
|
-
if (!
|
|
2657
|
-
|
|
2665
|
+
const l = B.findIndex(
|
|
2666
|
+
(k) => k.id === c
|
|
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) {
|
|
2669
|
+
X(!1), Gt(null);
|
|
2658
2670
|
return;
|
|
2659
2671
|
}
|
|
2660
|
-
|
|
2661
|
-
|
|
2672
|
+
Ut(f.id), Nt(null), Gt(null), ft(f.type ?? "sign"), Me(f), window.setTimeout(() => {
|
|
2673
|
+
X(!0);
|
|
2662
2674
|
}, 350);
|
|
2663
2675
|
},
|
|
2664
|
-
[
|
|
2665
|
-
),
|
|
2676
|
+
[Me, B]
|
|
2677
|
+
), Mi = Y(
|
|
2666
2678
|
(c) => {
|
|
2667
|
-
|
|
2679
|
+
ft(c), X(!0);
|
|
2668
2680
|
},
|
|
2669
2681
|
[]
|
|
2670
|
-
),
|
|
2671
|
-
|
|
2672
|
-
}, []),
|
|
2682
|
+
), ki = Y((c, h) => {
|
|
2683
|
+
Ye((l) => ({ ...l, [c]: h }));
|
|
2684
|
+
}, []), Ni = Y(
|
|
2673
2685
|
(c) => {
|
|
2674
|
-
const h =
|
|
2686
|
+
const h = Xt[c];
|
|
2675
2687
|
h && (tt == null || tt(c, h));
|
|
2676
|
-
const l =
|
|
2677
|
-
Object.keys(
|
|
2678
|
-
var
|
|
2679
|
-
return (
|
|
2688
|
+
const l = B.findIndex(($) => $.id === c), f = new Set(
|
|
2689
|
+
Object.keys(Xt).filter(($) => {
|
|
2690
|
+
var z;
|
|
2691
|
+
return (z = Xt[$]) == null ? void 0 : z.trim();
|
|
2680
2692
|
})
|
|
2681
2693
|
);
|
|
2682
|
-
|
|
2683
|
-
const
|
|
2684
|
-
($) => !
|
|
2685
|
-
) ??
|
|
2686
|
-
($) => !
|
|
2694
|
+
f.add(c);
|
|
2695
|
+
const k = B.slice(l + 1).find(
|
|
2696
|
+
($) => !f.has($.id) && !N.some((z) => z.fieldId === $.id)
|
|
2697
|
+
) ?? B.slice(0, Math.max(0, l)).find(
|
|
2698
|
+
($) => !f.has($.id) && !N.some((z) => z.fieldId === $.id)
|
|
2687
2699
|
);
|
|
2688
|
-
|
|
2700
|
+
k && (Ut(k.id), Me(k));
|
|
2689
2701
|
},
|
|
2690
|
-
[
|
|
2691
|
-
),
|
|
2702
|
+
[B, Xt, N, Me, tt]
|
|
2703
|
+
), Pi = Y(
|
|
2692
2704
|
(c, h, l) => {
|
|
2693
|
-
var
|
|
2694
|
-
const
|
|
2695
|
-
if (
|
|
2696
|
-
|
|
2705
|
+
var pe;
|
|
2706
|
+
const f = Xi(h, l);
|
|
2707
|
+
if (Yt) {
|
|
2708
|
+
j(
|
|
2697
2709
|
(Q) => Q.map(
|
|
2698
|
-
(
|
|
2699
|
-
...
|
|
2710
|
+
(Ct) => Ct.id === Yt ? {
|
|
2711
|
+
...Ct,
|
|
2700
2712
|
imageDataUrl: c,
|
|
2701
|
-
width:
|
|
2702
|
-
height:
|
|
2703
|
-
} :
|
|
2713
|
+
width: Ct.fieldId ? Ct.width : f.width,
|
|
2714
|
+
height: Ct.fieldId ? Ct.height : f.height
|
|
2715
|
+
} : Ct
|
|
2704
2716
|
)
|
|
2705
|
-
), At(null), D("none"),
|
|
2717
|
+
), At(null), D("none"), X(!1), Gt(null);
|
|
2706
2718
|
return;
|
|
2707
2719
|
}
|
|
2708
2720
|
if (jt) {
|
|
2709
|
-
const Q =
|
|
2710
|
-
(V) => V.id ===
|
|
2711
|
-
) ??
|
|
2712
|
-
(V) => (V.type ?? "sign") === "sign" && !
|
|
2721
|
+
const Q = B.find(
|
|
2722
|
+
(V) => V.id === _t && (V.type ?? "sign") === "sign" && !N.some((ce) => ce.fieldId === V.id)
|
|
2723
|
+
) ?? B.find(
|
|
2724
|
+
(V) => (V.type ?? "sign") === "sign" && !N.some((ce) => ce.fieldId === V.id)
|
|
2713
2725
|
);
|
|
2714
2726
|
if (!Q) {
|
|
2715
|
-
|
|
2727
|
+
X(!1);
|
|
2716
2728
|
return;
|
|
2717
2729
|
}
|
|
2718
|
-
const
|
|
2719
|
-
(V) => (V.type ?? "sign") === "sign" && V.signature_tag === Q.signature_tag && !
|
|
2720
|
-
) : [Q],
|
|
2721
|
-
id:
|
|
2730
|
+
const Ct = gt && Q.signature_tag ? B.filter(
|
|
2731
|
+
(V) => (V.type ?? "sign") === "sign" && V.signature_tag === Q.signature_tag && !N.some((ce) => ce.fieldId === V.id)
|
|
2732
|
+
) : [Q], Tt = Ct.map((V) => ({
|
|
2733
|
+
id: Se(),
|
|
2722
2734
|
fieldId: V.id,
|
|
2723
2735
|
pageNumber: V.pageNumber,
|
|
2724
2736
|
x: V.x,
|
|
@@ -2726,200 +2738,200 @@ function ro({
|
|
|
2726
2738
|
width: V.width,
|
|
2727
2739
|
height: V.height,
|
|
2728
2740
|
imageDataUrl: c
|
|
2729
|
-
})),
|
|
2730
|
-
|
|
2731
|
-
...V.filter((
|
|
2732
|
-
|
|
2741
|
+
})), re = new Set(Ct.map((V) => V.id));
|
|
2742
|
+
j((V) => [
|
|
2743
|
+
...V.filter((ce) => !ce.fieldId || !re.has(ce.fieldId)),
|
|
2744
|
+
...Tt
|
|
2733
2745
|
]);
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2746
|
+
const ge = new Map(
|
|
2747
|
+
Tt.map((V) => [V.fieldId, V])
|
|
2736
2748
|
);
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
), At(null), D("none"),
|
|
2742
|
-
const
|
|
2743
|
-
|
|
2744
|
-
(V) =>
|
|
2749
|
+
Le(
|
|
2750
|
+
Ct.map((V) => V.id),
|
|
2751
|
+
Tt[0],
|
|
2752
|
+
ge
|
|
2753
|
+
), At(null), D("none"), Nt(((pe = Tt[0]) == null ? void 0 : pe.id) ?? null);
|
|
2754
|
+
const wt = new Set(
|
|
2755
|
+
B.filter(
|
|
2756
|
+
(V) => De(
|
|
2745
2757
|
V,
|
|
2746
|
-
[...
|
|
2747
|
-
|
|
2758
|
+
[...N, ...Tt],
|
|
2759
|
+
Xt
|
|
2748
2760
|
)
|
|
2749
2761
|
).map((V) => V.id)
|
|
2750
2762
|
);
|
|
2751
|
-
for (const V of
|
|
2752
|
-
|
|
2763
|
+
for (const V of re) wt.add(V);
|
|
2764
|
+
Be(Q.id, wt);
|
|
2753
2765
|
return;
|
|
2754
2766
|
}
|
|
2755
|
-
const
|
|
2767
|
+
const k = G.current.get(dt), $ = k == null ? void 0 : k.querySelector(
|
|
2756
2768
|
".epochs-pdf-viewer__surface"
|
|
2757
2769
|
);
|
|
2758
|
-
let
|
|
2770
|
+
let z = 24, ot = 24;
|
|
2759
2771
|
if ($) {
|
|
2760
|
-
const Q =
|
|
2761
|
-
if (
|
|
2762
|
-
const
|
|
2763
|
-
|
|
2772
|
+
const Q = Ce($, kt), Ct = $.closest(".epochs-pdf-viewer__body");
|
|
2773
|
+
if (Ct) {
|
|
2774
|
+
const Tt = Pn(
|
|
2775
|
+
Ct.getBoundingClientRect(),
|
|
2764
2776
|
$,
|
|
2765
|
-
|
|
2766
|
-
),
|
|
2767
|
-
|
|
2777
|
+
kt
|
|
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);
|
|
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));
|
|
2768
2780
|
} else
|
|
2769
|
-
|
|
2781
|
+
z = Math.max(0, (Q.width - f.width) / 2), ot = Math.max(0, (Q.height - f.height) / 2);
|
|
2770
2782
|
}
|
|
2771
2783
|
const Ot = {
|
|
2772
|
-
id:
|
|
2773
|
-
pageNumber:
|
|
2774
|
-
x:
|
|
2784
|
+
id: Se(),
|
|
2785
|
+
pageNumber: dt,
|
|
2786
|
+
x: z,
|
|
2775
2787
|
y: ot,
|
|
2776
|
-
width:
|
|
2777
|
-
height:
|
|
2788
|
+
width: f.width,
|
|
2789
|
+
height: f.height,
|
|
2778
2790
|
imageDataUrl: c
|
|
2779
2791
|
};
|
|
2780
|
-
|
|
2792
|
+
j((Q) => [...Q, Ot]), Le(void 0, Ot), Nt(Ot.id), At(null), D("none"), X(!1), Gt(null);
|
|
2781
2793
|
},
|
|
2782
2794
|
[
|
|
2783
|
-
|
|
2795
|
+
Be,
|
|
2784
2796
|
gt,
|
|
2785
|
-
|
|
2786
|
-
|
|
2797
|
+
Yt,
|
|
2798
|
+
Xt,
|
|
2787
2799
|
jt,
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2800
|
+
De,
|
|
2801
|
+
dt,
|
|
2802
|
+
kt,
|
|
2803
|
+
_t,
|
|
2804
|
+
B,
|
|
2805
|
+
N,
|
|
2806
|
+
Le
|
|
2795
2807
|
]
|
|
2796
|
-
),
|
|
2808
|
+
), $i = Y(
|
|
2797
2809
|
(c, h) => {
|
|
2798
2810
|
if (jt) {
|
|
2799
|
-
const Q =
|
|
2800
|
-
(
|
|
2801
|
-
) ??
|
|
2811
|
+
const Q = B.find(
|
|
2812
|
+
(wt) => wt.id === _t && (wt.type ?? "sign") === h
|
|
2813
|
+
) ?? B.find((wt) => (wt.type ?? "sign") === h);
|
|
2802
2814
|
if (!Q) {
|
|
2803
|
-
|
|
2815
|
+
X(!1);
|
|
2804
2816
|
return;
|
|
2805
2817
|
}
|
|
2806
|
-
const
|
|
2807
|
-
(
|
|
2808
|
-
) : [Q]).map((
|
|
2809
|
-
|
|
2810
|
-
const
|
|
2811
|
-
for (const
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2814
|
-
(
|
|
2815
|
-
).map((
|
|
2818
|
+
const Tt = (gt && Q.signature_tag ? B.filter(
|
|
2819
|
+
(wt) => (wt.type ?? "sign") === h && wt.signature_tag === Q.signature_tag
|
|
2820
|
+
) : [Q]).map((wt) => wt.id);
|
|
2821
|
+
pn(Tt, c);
|
|
2822
|
+
const re = { ...Xt };
|
|
2823
|
+
for (const wt of Tt) re[wt] = c;
|
|
2824
|
+
const ge = new Set(
|
|
2825
|
+
B.filter(
|
|
2826
|
+
(wt) => De(wt, N, re)
|
|
2827
|
+
).map((wt) => wt.id)
|
|
2816
2828
|
);
|
|
2817
|
-
|
|
2829
|
+
Be(Q.id, ge);
|
|
2818
2830
|
return;
|
|
2819
2831
|
}
|
|
2820
|
-
const l =
|
|
2821
|
-
let $ = 24,
|
|
2822
|
-
const ot =
|
|
2832
|
+
const l = we, f = Math.max(80, c.length * l * 0.55), k = l * 1.25;
|
|
2833
|
+
let $ = 24, z = 24;
|
|
2834
|
+
const ot = G.current.get(dt), Ot = ot == null ? void 0 : ot.querySelector(
|
|
2823
2835
|
".epochs-pdf-viewer__surface"
|
|
2824
2836
|
);
|
|
2825
2837
|
if (Ot) {
|
|
2826
|
-
const Q =
|
|
2838
|
+
const Q = Ce(Ot, kt), Ct = Ot.closest(
|
|
2827
2839
|
".epochs-pdf-viewer__body"
|
|
2828
2840
|
);
|
|
2829
|
-
if (
|
|
2830
|
-
const
|
|
2831
|
-
|
|
2841
|
+
if (Ct) {
|
|
2842
|
+
const Tt = Pn(
|
|
2843
|
+
Ct.getBoundingClientRect(),
|
|
2832
2844
|
Ot,
|
|
2833
|
-
|
|
2834
|
-
),
|
|
2835
|
-
$ = Math.max(0, (
|
|
2845
|
+
kt
|
|
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);
|
|
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));
|
|
2836
2848
|
}
|
|
2837
2849
|
}
|
|
2838
|
-
const
|
|
2839
|
-
id:
|
|
2840
|
-
pageNumber:
|
|
2850
|
+
const pe = {
|
|
2851
|
+
id: Ge(),
|
|
2852
|
+
pageNumber: dt,
|
|
2841
2853
|
x: $,
|
|
2842
|
-
y:
|
|
2843
|
-
width:
|
|
2844
|
-
height:
|
|
2854
|
+
y: z,
|
|
2855
|
+
width: f,
|
|
2856
|
+
height: k,
|
|
2845
2857
|
value: c,
|
|
2846
2858
|
fontSize: l,
|
|
2847
|
-
color:
|
|
2859
|
+
color: me
|
|
2848
2860
|
};
|
|
2849
|
-
|
|
2861
|
+
R((Q) => [...Q, pe]), se(pe.id), X(!1), D("none");
|
|
2850
2862
|
},
|
|
2851
2863
|
[
|
|
2852
|
-
|
|
2864
|
+
Be,
|
|
2853
2865
|
gt,
|
|
2854
|
-
|
|
2866
|
+
Xt,
|
|
2855
2867
|
jt,
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2868
|
+
De,
|
|
2869
|
+
dt,
|
|
2870
|
+
kt,
|
|
2871
|
+
_t,
|
|
2872
|
+
B,
|
|
2873
|
+
N,
|
|
2874
|
+
pn
|
|
2863
2875
|
]
|
|
2864
|
-
),
|
|
2865
|
-
|
|
2866
|
-
}, [
|
|
2876
|
+
), Ii = Y((c) => {
|
|
2877
|
+
j((h) => [...h, c]), Le(void 0, c), Nt(c.id), At(null), D("none");
|
|
2878
|
+
}, [Le]), Ci = Y(
|
|
2867
2879
|
(c, h) => {
|
|
2868
|
-
|
|
2869
|
-
(l) => l.map((
|
|
2880
|
+
j(
|
|
2881
|
+
(l) => l.map((f) => f.id === c ? { ...f, ...h } : f)
|
|
2870
2882
|
);
|
|
2871
2883
|
},
|
|
2872
2884
|
[]
|
|
2873
|
-
),
|
|
2874
|
-
const h =
|
|
2875
|
-
|
|
2876
|
-
}, [
|
|
2877
|
-
const h = c ?
|
|
2885
|
+
), Ti = Y((c) => {
|
|
2886
|
+
const h = N.find((l) => l.id === c);
|
|
2887
|
+
j((l) => l.filter((f) => f.id !== c)), Nt((l) => l === c ? null : l), h != null && h.fieldId && Ut(h.fieldId);
|
|
2888
|
+
}, [N]), Di = Y((c) => {
|
|
2889
|
+
const h = c ? N.find((Ot) => Ot.id === c) ?? null : Ne;
|
|
2878
2890
|
if (!h) return;
|
|
2879
|
-
const l =
|
|
2891
|
+
const l = G.current.get(h.pageNumber), f = l == null ? void 0 : l.querySelector(
|
|
2880
2892
|
".epochs-pdf-viewer__surface"
|
|
2881
|
-
),
|
|
2882
|
-
let $ = h.x +
|
|
2883
|
-
if (
|
|
2884
|
-
const Ot =
|
|
2893
|
+
), k = 18;
|
|
2894
|
+
let $ = h.x + k, z = h.y + k;
|
|
2895
|
+
if (f) {
|
|
2896
|
+
const Ot = f.clientWidth / kt, pe = f.clientHeight / kt;
|
|
2885
2897
|
$ = Math.min(
|
|
2886
2898
|
Math.max(0, $),
|
|
2887
2899
|
Math.max(0, Ot - h.width)
|
|
2888
|
-
),
|
|
2889
|
-
Math.max(0,
|
|
2890
|
-
Math.max(0,
|
|
2900
|
+
), z = Math.min(
|
|
2901
|
+
Math.max(0, z),
|
|
2902
|
+
Math.max(0, pe - h.height)
|
|
2891
2903
|
);
|
|
2892
2904
|
}
|
|
2893
2905
|
const ot = {
|
|
2894
2906
|
...h,
|
|
2895
|
-
id:
|
|
2907
|
+
id: Se(),
|
|
2896
2908
|
x: $,
|
|
2897
|
-
y:
|
|
2909
|
+
y: z
|
|
2898
2910
|
};
|
|
2899
|
-
|
|
2900
|
-
}, [
|
|
2901
|
-
const h = c ?? (
|
|
2911
|
+
j((Ot) => [...Ot, ot]), Nt(ot.id), At(null), D("none");
|
|
2912
|
+
}, [kt, Ne, N]), Li = Y((c) => {
|
|
2913
|
+
const h = c ?? (Ne == null ? void 0 : Ne.id);
|
|
2902
2914
|
if (!h) return;
|
|
2903
|
-
const l =
|
|
2904
|
-
|
|
2905
|
-
}, [
|
|
2906
|
-
|
|
2907
|
-
}, []),
|
|
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);
|
|
2917
|
+
}, [Ne, N, B]), Fi = Y((c) => {
|
|
2918
|
+
R((h) => c.fieldId ? [...h.filter((l) => l.fieldId !== c.fieldId), c] : [...h, c]), se(c.id), c.fieldId && de(c.fieldId);
|
|
2919
|
+
}, []), Ri = Y(
|
|
2908
2920
|
(c, h) => {
|
|
2909
|
-
|
|
2910
|
-
(l) => l.map((
|
|
2921
|
+
R(
|
|
2922
|
+
(l) => l.map((f) => f.id === c ? { ...f, ...h } : f)
|
|
2911
2923
|
);
|
|
2912
2924
|
},
|
|
2913
2925
|
[]
|
|
2914
|
-
),
|
|
2915
|
-
const h =
|
|
2916
|
-
|
|
2917
|
-
}, [
|
|
2918
|
-
|
|
2919
|
-
|
|
2926
|
+
), Ai = Y((c) => {
|
|
2927
|
+
const h = Z.find((l) => l.id === c);
|
|
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);
|
|
2929
|
+
}, [Z]);
|
|
2930
|
+
Dt(() => {
|
|
2931
|
+
Te && R(
|
|
2920
2932
|
(c) => c.map((h) => {
|
|
2921
2933
|
if (!h.fieldId) return h;
|
|
2922
|
-
const l =
|
|
2934
|
+
const l = E.find((f) => f.id === h.fieldId);
|
|
2923
2935
|
return l ? {
|
|
2924
2936
|
...h,
|
|
2925
2937
|
pageNumber: l.pageNumber,
|
|
@@ -2927,32 +2939,32 @@ function ro({
|
|
|
2927
2939
|
y: l.y,
|
|
2928
2940
|
width: l.width,
|
|
2929
2941
|
height: l.height,
|
|
2930
|
-
fontSize: l.fontSize ?? h.fontSize ??
|
|
2931
|
-
color: l.color ?? h.color ??
|
|
2942
|
+
fontSize: l.fontSize ?? h.fontSize ?? we,
|
|
2943
|
+
color: l.color ?? h.color ?? me
|
|
2932
2944
|
} : h;
|
|
2933
2945
|
})
|
|
2934
2946
|
);
|
|
2935
|
-
}, [
|
|
2936
|
-
const
|
|
2947
|
+
}, [Te, E]);
|
|
2948
|
+
const _n = Y(
|
|
2937
2949
|
(c) => {
|
|
2938
|
-
var
|
|
2939
|
-
if (!
|
|
2940
|
-
const h =
|
|
2941
|
-
|
|
2950
|
+
var k;
|
|
2951
|
+
if (!B.length) return;
|
|
2952
|
+
const h = _t != null ? B.findIndex(($) => $.id === _t) : -1, l = Math.min(
|
|
2953
|
+
B.length - 1,
|
|
2942
2954
|
Math.max(0, (h < 0 ? 0 : h) + c)
|
|
2943
|
-
),
|
|
2944
|
-
|
|
2945
|
-
((
|
|
2946
|
-
),
|
|
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));
|
|
2947
2959
|
},
|
|
2948
2960
|
[
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2961
|
+
Me,
|
|
2962
|
+
_t,
|
|
2963
|
+
B,
|
|
2964
|
+
N
|
|
2953
2965
|
]
|
|
2954
2966
|
);
|
|
2955
|
-
if (!
|
|
2967
|
+
if (!yt && !bt)
|
|
2956
2968
|
return /* @__PURE__ */ s(
|
|
2957
2969
|
"div",
|
|
2958
2970
|
{
|
|
@@ -2961,66 +2973,66 @@ function ro({
|
|
|
2961
2973
|
children: "No PDF file provided."
|
|
2962
2974
|
}
|
|
2963
2975
|
);
|
|
2964
|
-
const
|
|
2976
|
+
const Ei = {
|
|
2965
2977
|
height: r
|
|
2966
|
-
},
|
|
2967
|
-
status:
|
|
2968
|
-
showThumbnails:
|
|
2969
|
-
setShowThumbnails:
|
|
2970
|
-
canGoPrev:
|
|
2971
|
-
canGoNext:
|
|
2972
|
-
handlePrev:
|
|
2973
|
-
handleNext:
|
|
2974
|
-
pageNumber:
|
|
2975
|
-
numPages:
|
|
2976
|
-
scrollToPage:
|
|
2977
|
-
scale:
|
|
2978
|
-
handleZoomOut:
|
|
2979
|
-
handleZoomIn:
|
|
2980
|
-
handleFitWidth:
|
|
2981
|
-
handleRotate:
|
|
2978
|
+
}, vn = {
|
|
2979
|
+
status: it,
|
|
2980
|
+
showThumbnails: Lt,
|
|
2981
|
+
setShowThumbnails: Zt,
|
|
2982
|
+
canGoPrev: Je,
|
|
2983
|
+
canGoNext: tn,
|
|
2984
|
+
handlePrev: hi,
|
|
2985
|
+
handleNext: ui,
|
|
2986
|
+
pageNumber: dt,
|
|
2987
|
+
numPages: It,
|
|
2988
|
+
scrollToPage: xe,
|
|
2989
|
+
scale: kt,
|
|
2990
|
+
handleZoomOut: pi,
|
|
2991
|
+
handleZoomIn: gi,
|
|
2992
|
+
handleFitWidth: en,
|
|
2993
|
+
handleRotate: fi,
|
|
2982
2994
|
markupTool: M,
|
|
2983
|
-
toggleMarkupTool: (c) =>
|
|
2995
|
+
toggleMarkupTool: (c) => yi(c),
|
|
2984
2996
|
hasFixedSignatureFields: jt,
|
|
2985
|
-
hasFixedTextFields:
|
|
2986
|
-
pendingSignature:
|
|
2997
|
+
hasFixedTextFields: Te,
|
|
2998
|
+
pendingSignature: Ht,
|
|
2987
2999
|
setMarkupTool: D,
|
|
2988
|
-
setSignaturePadOpen:
|
|
3000
|
+
setSignaturePadOpen: X,
|
|
2989
3001
|
annotationsLength: P.length,
|
|
2990
|
-
signaturesLength:
|
|
2991
|
-
textsLength:
|
|
2992
|
-
handleClearAnnotations:
|
|
2993
|
-
highlightHex:
|
|
2994
|
-
underlineHex:
|
|
2995
|
-
setHighlightHex:
|
|
2996
|
-
setUnderlineHex:
|
|
2997
|
-
loadDocument:
|
|
2998
|
-
handlePrint:
|
|
2999
|
-
isPrinting:
|
|
3000
|
-
pdfDoc:
|
|
3001
|
-
displayUrl:
|
|
3002
|
-
resolvedUrl:
|
|
3003
|
-
handleDownload:
|
|
3004
|
-
isDownloading:
|
|
3005
|
-
},
|
|
3006
|
-
(c) =>
|
|
3007
|
-
).length,
|
|
3008
|
-
const l =
|
|
3002
|
+
signaturesLength: N.length,
|
|
3003
|
+
textsLength: Z.length,
|
|
3004
|
+
handleClearAnnotations: xi,
|
|
3005
|
+
highlightHex: _e,
|
|
3006
|
+
underlineHex: ae,
|
|
3007
|
+
setHighlightHex: Qt,
|
|
3008
|
+
setUnderlineHex: di,
|
|
3009
|
+
loadDocument: Qe,
|
|
3010
|
+
handlePrint: mi,
|
|
3011
|
+
isPrinting: ie,
|
|
3012
|
+
pdfDoc: st,
|
|
3013
|
+
displayUrl: U,
|
|
3014
|
+
resolvedUrl: bt,
|
|
3015
|
+
handleDownload: wi,
|
|
3016
|
+
isDownloading: w
|
|
3017
|
+
}, Hi = (c) => c.filter((h) => !(jt && (h === "highlight" || h === "underline" || h === "erase"))), nn = _t ? B.findIndex((c) => c.id === _t) : 0, Ui = B.filter(
|
|
3018
|
+
(c) => De(c, N, Xt)
|
|
3019
|
+
).length, rn = B.length > 0 ? Math.round(Ui / B.length * 100) : 0, xn = (c, h = !1) => {
|
|
3020
|
+
const l = Hi(c);
|
|
3009
3021
|
if (l.length === 0 && !h)
|
|
3010
3022
|
return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__toolbar-group" });
|
|
3011
3023
|
if (l.length === 0)
|
|
3012
3024
|
return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" });
|
|
3013
|
-
const
|
|
3014
|
-
const
|
|
3015
|
-
return /* @__PURE__ */ s(
|
|
3025
|
+
const f = l.map((k, $) => {
|
|
3026
|
+
const z = l[$ - 1], ot = Rn(k) && (!z || !Rn(z));
|
|
3027
|
+
return /* @__PURE__ */ s(Wi, { children: Fr(k, vn, { showMarkupSep: ot }) }, k);
|
|
3016
3028
|
});
|
|
3017
3029
|
return /* @__PURE__ */ T(
|
|
3018
3030
|
"div",
|
|
3019
3031
|
{
|
|
3020
3032
|
className: h ? "epochs-pdf-viewer__toolbar-group epochs-pdf-viewer__toolbar-group--end" : "epochs-pdf-viewer__toolbar-group",
|
|
3021
3033
|
children: [
|
|
3022
|
-
|
|
3023
|
-
|
|
3034
|
+
f,
|
|
3035
|
+
Rr(vn, new Set(l))
|
|
3024
3036
|
]
|
|
3025
3037
|
}
|
|
3026
3038
|
);
|
|
@@ -3029,69 +3041,69 @@ function ro({
|
|
|
3029
3041
|
"div",
|
|
3030
3042
|
{
|
|
3031
3043
|
"data-testid": "pdf-viewer",
|
|
3032
|
-
"data-file-url":
|
|
3044
|
+
"data-file-url": bt || void 0,
|
|
3033
3045
|
className: `epochs-pdf-viewer ${_ ?? ""}`.trim(),
|
|
3034
|
-
style:
|
|
3046
|
+
style: Ei,
|
|
3035
3047
|
children: [
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3048
|
+
ue ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__toolbar", children: [
|
|
3049
|
+
xn(ue.left),
|
|
3050
|
+
xn(ue.right, !0)
|
|
3039
3051
|
] }) : null,
|
|
3040
|
-
|
|
3052
|
+
Ze || Pt || jt ? /* @__PURE__ */ s(
|
|
3041
3053
|
Cr,
|
|
3042
3054
|
{
|
|
3043
|
-
open:
|
|
3055
|
+
open: lt,
|
|
3044
3056
|
onClose: () => {
|
|
3045
|
-
|
|
3057
|
+
X(!1), Gt(null), ft(void 0), ut == null || ut();
|
|
3046
3058
|
},
|
|
3047
|
-
onSave:
|
|
3048
|
-
onSaveFieldValue:
|
|
3049
|
-
fieldType:
|
|
3059
|
+
onSave: Pi,
|
|
3060
|
+
onSaveFieldValue: $i,
|
|
3061
|
+
fieldType: et,
|
|
3050
3062
|
showFieldTypeTabs: !jt,
|
|
3051
|
-
textPlaceholder: (
|
|
3052
|
-
initialFieldValue:
|
|
3063
|
+
textPlaceholder: (Mn = B.find((c) => c.id === _t)) == null ? void 0 : Mn.placeholder,
|
|
3064
|
+
initialFieldValue: _t ? Xt[_t] ?? ((kn = B.find((c) => c.id === _t)) == null ? void 0 : kn.value) : void 0,
|
|
3053
3065
|
targetSize: (() => {
|
|
3054
|
-
const c =
|
|
3055
|
-
(h) => h.id ===
|
|
3066
|
+
const c = B.find(
|
|
3067
|
+
(h) => h.id === _t
|
|
3056
3068
|
);
|
|
3057
3069
|
if (!(!c || (c.type ?? "sign") !== "sign"))
|
|
3058
3070
|
return { width: c.width, height: c.height };
|
|
3059
3071
|
})(),
|
|
3060
|
-
rememberedByType:
|
|
3072
|
+
rememberedByType: Ft,
|
|
3061
3073
|
onRememberFill: (c, h) => {
|
|
3062
|
-
|
|
3074
|
+
Rt((l) => c === "sign" ? { ...l, sign: h } : c === "date" ? { ...l, date: h } : { ...l, text: h });
|
|
3063
3075
|
}
|
|
3064
3076
|
}
|
|
3065
3077
|
) : null,
|
|
3066
3078
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__content", children: [
|
|
3067
|
-
|
|
3079
|
+
Lt ? /* @__PURE__ */ s(
|
|
3068
3080
|
"div",
|
|
3069
3081
|
{
|
|
3070
3082
|
className: "epochs-pdf-viewer__thumbnails",
|
|
3071
3083
|
style: { width: m + 24 },
|
|
3072
|
-
children:
|
|
3084
|
+
children: it === "ready" && st ? /* @__PURE__ */ T(je, { children: [
|
|
3073
3085
|
Array.from({
|
|
3074
|
-
length: Math.min(
|
|
3086
|
+
length: Math.min(It || 0, g)
|
|
3075
3087
|
}).map((c, h) => {
|
|
3076
3088
|
const l = h + 1;
|
|
3077
3089
|
return /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__thumb-wrap", children: /* @__PURE__ */ s(
|
|
3078
|
-
|
|
3090
|
+
br,
|
|
3079
3091
|
{
|
|
3080
|
-
pdfDoc:
|
|
3092
|
+
pdfDoc: st,
|
|
3081
3093
|
pageNumber: l,
|
|
3082
|
-
isActive: l ===
|
|
3083
|
-
rotation:
|
|
3084
|
-
onSelect:
|
|
3094
|
+
isActive: l === dt,
|
|
3095
|
+
rotation: p,
|
|
3096
|
+
onSelect: xe,
|
|
3085
3097
|
width: m,
|
|
3086
3098
|
annotations: P,
|
|
3087
|
-
signatures:
|
|
3088
|
-
signatureFields:
|
|
3089
|
-
texts:
|
|
3090
|
-
textFields:
|
|
3099
|
+
signatures: N,
|
|
3100
|
+
signatureFields: B,
|
|
3101
|
+
texts: ke,
|
|
3102
|
+
textFields: E
|
|
3091
3103
|
}
|
|
3092
3104
|
) }, l);
|
|
3093
3105
|
}),
|
|
3094
|
-
|
|
3106
|
+
It > g ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__thumb-more", children: [
|
|
3095
3107
|
"Showing first ",
|
|
3096
3108
|
g,
|
|
3097
3109
|
" pages"
|
|
@@ -3099,69 +3111,69 @@ function ro({
|
|
|
3099
3111
|
] }) : /* @__PURE__ */ s("div", { className: "epochs-pdf-viewer__muted", children: "Thumbnails" })
|
|
3100
3112
|
}
|
|
3101
3113
|
) : null,
|
|
3102
|
-
/* @__PURE__ */ T("div", { ref:
|
|
3103
|
-
|
|
3114
|
+
/* @__PURE__ */ T("div", { ref: qt, className: "epochs-pdf-viewer__body", children: [
|
|
3115
|
+
it === "loading" ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__muted", children: [
|
|
3104
3116
|
"Loading PDF…",
|
|
3105
3117
|
/* @__PURE__ */ s("span", { className: "epochs-pdf-viewer__spinner" })
|
|
3106
3118
|
] }) : null,
|
|
3107
|
-
|
|
3119
|
+
it === "error" ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__overlay epochs-pdf-viewer__error", children: [
|
|
3108
3120
|
"Unable to load PDF.",
|
|
3109
|
-
|
|
3121
|
+
bt ? /* @__PURE__ */ s(
|
|
3110
3122
|
"a",
|
|
3111
3123
|
{
|
|
3112
3124
|
className: "epochs-pdf-viewer__open-link",
|
|
3113
|
-
href:
|
|
3125
|
+
href: bt,
|
|
3114
3126
|
target: "_blank",
|
|
3115
3127
|
rel: "noopener noreferrer",
|
|
3116
3128
|
children: "Open file"
|
|
3117
3129
|
}
|
|
3118
3130
|
) : null
|
|
3119
3131
|
] }) : null,
|
|
3120
|
-
|
|
3132
|
+
it === "ready" && st ? /* @__PURE__ */ s("div", { children: Array.from({ length: It }).map((c, h) => {
|
|
3121
3133
|
const l = h + 1;
|
|
3122
3134
|
return /* @__PURE__ */ s(
|
|
3123
|
-
|
|
3135
|
+
yr,
|
|
3124
3136
|
{
|
|
3125
|
-
pdfDoc:
|
|
3137
|
+
pdfDoc: st,
|
|
3126
3138
|
pageNumber: l,
|
|
3127
|
-
scale:
|
|
3128
|
-
rotation:
|
|
3139
|
+
scale: kt,
|
|
3140
|
+
rotation: p,
|
|
3129
3141
|
markupTool: at ? M : "none",
|
|
3130
|
-
markupColor:
|
|
3142
|
+
markupColor: bi,
|
|
3131
3143
|
annotations: P,
|
|
3132
|
-
onAddAnnotation:
|
|
3133
|
-
onRemoveAnnotation:
|
|
3134
|
-
signatures:
|
|
3135
|
-
pendingSignature:
|
|
3136
|
-
onAddSignature:
|
|
3144
|
+
onAddAnnotation: _i,
|
|
3145
|
+
onRemoveAnnotation: vi,
|
|
3146
|
+
signatures: N,
|
|
3147
|
+
pendingSignature: Ht,
|
|
3148
|
+
onAddSignature: Ii,
|
|
3137
3149
|
onUpdateSignature: Ci,
|
|
3138
|
-
onRemoveSignature:
|
|
3150
|
+
onRemoveSignature: Ti,
|
|
3139
3151
|
onEditSignature: Li,
|
|
3140
|
-
onDuplicateSignature:
|
|
3141
|
-
selectedSignatureId:
|
|
3142
|
-
onSelectSignature:
|
|
3143
|
-
signatureFields:
|
|
3144
|
-
selectedSignatureFieldId:
|
|
3145
|
-
onSelectSignatureField:
|
|
3152
|
+
onDuplicateSignature: Di,
|
|
3153
|
+
selectedSignatureId: St,
|
|
3154
|
+
onSelectSignature: Nt,
|
|
3155
|
+
signatureFields: B,
|
|
3156
|
+
selectedSignatureFieldId: _t,
|
|
3157
|
+
onSelectSignatureField: Ut,
|
|
3146
3158
|
hasFixedSignatureFields: jt,
|
|
3147
|
-
onOpenSignaturePad:
|
|
3148
|
-
fieldValues:
|
|
3149
|
-
onFieldValueChange:
|
|
3150
|
-
onFieldValueCommit:
|
|
3151
|
-
texts:
|
|
3152
|
-
onAddText:
|
|
3153
|
-
onUpdateText:
|
|
3154
|
-
onRemoveText:
|
|
3155
|
-
selectedTextId:
|
|
3156
|
-
onSelectText:
|
|
3157
|
-
textFields:
|
|
3158
|
-
selectedTextFieldId:
|
|
3159
|
-
onSelectTextField:
|
|
3160
|
-
hasFixedTextFields:
|
|
3161
|
-
editingTextId:
|
|
3162
|
-
onEditingTextIdChange:
|
|
3163
|
-
pageRef: (
|
|
3164
|
-
|
|
3159
|
+
onOpenSignaturePad: Mi,
|
|
3160
|
+
fieldValues: Xt,
|
|
3161
|
+
onFieldValueChange: ki,
|
|
3162
|
+
onFieldValueCommit: Ni,
|
|
3163
|
+
texts: Z,
|
|
3164
|
+
onAddText: Fi,
|
|
3165
|
+
onUpdateText: Ri,
|
|
3166
|
+
onRemoveText: Ai,
|
|
3167
|
+
selectedTextId: be,
|
|
3168
|
+
onSelectText: se,
|
|
3169
|
+
textFields: E,
|
|
3170
|
+
selectedTextFieldId: Ve,
|
|
3171
|
+
onSelectTextField: de,
|
|
3172
|
+
hasFixedTextFields: Te,
|
|
3173
|
+
editingTextId: qe,
|
|
3174
|
+
onEditingTextIdChange: he,
|
|
3175
|
+
pageRef: (f) => {
|
|
3176
|
+
f && G.current.set(l, f);
|
|
3165
3177
|
}
|
|
3166
3178
|
},
|
|
3167
3179
|
l
|
|
@@ -3170,15 +3182,15 @@ function ro({
|
|
|
3170
3182
|
] })
|
|
3171
3183
|
] }),
|
|
3172
3184
|
jt || te ? /* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer", role: "navigation", "aria-label": "Viewer actions", children: [
|
|
3173
|
-
jt ? /* @__PURE__ */ T(
|
|
3185
|
+
jt ? /* @__PURE__ */ T(je, { children: [
|
|
3174
3186
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer-nav", children: [
|
|
3175
3187
|
/* @__PURE__ */ s(
|
|
3176
3188
|
"button",
|
|
3177
3189
|
{
|
|
3178
3190
|
type: "button",
|
|
3179
3191
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
3180
|
-
disabled:
|
|
3181
|
-
onClick: () =>
|
|
3192
|
+
disabled: B.length <= 1 || nn <= 0,
|
|
3193
|
+
onClick: () => _n(-1),
|
|
3182
3194
|
children: "Prev"
|
|
3183
3195
|
}
|
|
3184
3196
|
),
|
|
@@ -3187,8 +3199,8 @@ function ro({
|
|
|
3187
3199
|
{
|
|
3188
3200
|
type: "button",
|
|
3189
3201
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text",
|
|
3190
|
-
disabled:
|
|
3191
|
-
onClick: () =>
|
|
3202
|
+
disabled: B.length <= 1 || nn >= B.length - 1,
|
|
3203
|
+
onClick: () => _n(1),
|
|
3192
3204
|
children: "Next"
|
|
3193
3205
|
}
|
|
3194
3206
|
)
|
|
@@ -3196,9 +3208,9 @@ function ro({
|
|
|
3196
3208
|
/* @__PURE__ */ T("div", { className: "epochs-pdf-viewer__footer-center", children: [
|
|
3197
3209
|
/* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__footer-label", children: [
|
|
3198
3210
|
"Field ",
|
|
3199
|
-
Math.max(1,
|
|
3211
|
+
Math.max(1, nn + 1),
|
|
3200
3212
|
" of ",
|
|
3201
|
-
|
|
3213
|
+
B.length
|
|
3202
3214
|
] }),
|
|
3203
3215
|
/* @__PURE__ */ s(
|
|
3204
3216
|
"div",
|
|
@@ -3207,19 +3219,19 @@ function ro({
|
|
|
3207
3219
|
role: "progressbar",
|
|
3208
3220
|
"aria-valuemin": 0,
|
|
3209
3221
|
"aria-valuemax": 100,
|
|
3210
|
-
"aria-valuenow":
|
|
3222
|
+
"aria-valuenow": rn,
|
|
3211
3223
|
"aria-label": "Signature progress",
|
|
3212
3224
|
children: /* @__PURE__ */ s(
|
|
3213
3225
|
"div",
|
|
3214
3226
|
{
|
|
3215
3227
|
className: "epochs-pdf-viewer__footer-progress-bar",
|
|
3216
|
-
style: { width: `${
|
|
3228
|
+
style: { width: `${rn}%` }
|
|
3217
3229
|
}
|
|
3218
3230
|
)
|
|
3219
3231
|
}
|
|
3220
3232
|
),
|
|
3221
3233
|
/* @__PURE__ */ T("span", { className: "epochs-pdf-viewer__footer-percent", children: [
|
|
3222
|
-
|
|
3234
|
+
rn,
|
|
3223
3235
|
"%"
|
|
3224
3236
|
] })
|
|
3225
3237
|
] })
|
|
@@ -3230,17 +3242,17 @@ function ro({
|
|
|
3230
3242
|
type: "button",
|
|
3231
3243
|
className: "epochs-pdf-viewer__btn epochs-pdf-viewer__btn--text epochs-pdf-viewer__btn--primary",
|
|
3232
3244
|
onClick: te,
|
|
3233
|
-
disabled:
|
|
3234
|
-
"aria-busy":
|
|
3245
|
+
disabled: Vt,
|
|
3246
|
+
"aria-busy": Vt || void 0,
|
|
3235
3247
|
children: [
|
|
3236
|
-
|
|
3248
|
+
Vt ? /* @__PURE__ */ s(
|
|
3237
3249
|
"span",
|
|
3238
3250
|
{
|
|
3239
3251
|
className: "epochs-pdf-viewer__spinner epochs-pdf-viewer__spinner--btn",
|
|
3240
3252
|
"aria-hidden": "true"
|
|
3241
3253
|
}
|
|
3242
3254
|
) : null,
|
|
3243
|
-
|
|
3255
|
+
ye
|
|
3244
3256
|
]
|
|
3245
3257
|
}
|
|
3246
3258
|
) : null
|
|
@@ -3249,30 +3261,30 @@ function ro({
|
|
|
3249
3261
|
}
|
|
3250
3262
|
);
|
|
3251
3263
|
}
|
|
3252
|
-
function
|
|
3264
|
+
function Er(t) {
|
|
3253
3265
|
return null;
|
|
3254
3266
|
}
|
|
3255
|
-
|
|
3256
|
-
function
|
|
3267
|
+
Er.displayName = "Document";
|
|
3268
|
+
function Hr(t) {
|
|
3257
3269
|
return null;
|
|
3258
3270
|
}
|
|
3259
|
-
|
|
3271
|
+
Hr.displayName = "Page";
|
|
3260
3272
|
function Ur(t) {
|
|
3261
3273
|
return null;
|
|
3262
3274
|
}
|
|
3263
3275
|
Ur.displayName = "View";
|
|
3264
|
-
function Hr(t) {
|
|
3265
|
-
return null;
|
|
3266
|
-
}
|
|
3267
|
-
Hr.displayName = "Text";
|
|
3268
3276
|
function jr(t) {
|
|
3269
3277
|
return null;
|
|
3270
3278
|
}
|
|
3271
|
-
jr.displayName = "
|
|
3279
|
+
jr.displayName = "Text";
|
|
3272
3280
|
function Br(t) {
|
|
3273
3281
|
return null;
|
|
3274
3282
|
}
|
|
3275
|
-
Br.displayName = "
|
|
3283
|
+
Br.displayName = "Image";
|
|
3284
|
+
function Wr(t) {
|
|
3285
|
+
return null;
|
|
3286
|
+
}
|
|
3287
|
+
Wr.displayName = "Link";
|
|
3276
3288
|
const Or = {
|
|
3277
3289
|
Document: "DOCUMENT",
|
|
3278
3290
|
Page: "PAGE",
|
|
@@ -3281,7 +3293,7 @@ const Or = {
|
|
|
3281
3293
|
Image: "IMAGE",
|
|
3282
3294
|
Link: "LINK"
|
|
3283
3295
|
};
|
|
3284
|
-
function
|
|
3296
|
+
function zr(t) {
|
|
3285
3297
|
if (typeof t == "string") return t;
|
|
3286
3298
|
if (typeof t == "function") {
|
|
3287
3299
|
const e = t;
|
|
@@ -3289,7 +3301,7 @@ function Wr(t) {
|
|
|
3289
3301
|
}
|
|
3290
3302
|
return null;
|
|
3291
3303
|
}
|
|
3292
|
-
function
|
|
3304
|
+
function ii(t) {
|
|
3293
3305
|
const e = [], n = (i) => {
|
|
3294
3306
|
if (!(i == null || typeof i == "boolean")) {
|
|
3295
3307
|
if (Array.isArray(i)) {
|
|
@@ -3301,11 +3313,11 @@ function ti(t) {
|
|
|
3301
3313
|
};
|
|
3302
3314
|
return n(t), e;
|
|
3303
3315
|
}
|
|
3304
|
-
function
|
|
3305
|
-
return
|
|
3316
|
+
function ri(t) {
|
|
3317
|
+
return ii(t).map((e) => typeof e == "string" || typeof e == "number" ? String(e) : e && typeof e == "object" && "props" in e ? ri(e.props.children) : "").join("");
|
|
3306
3318
|
}
|
|
3307
|
-
function
|
|
3308
|
-
const e =
|
|
3319
|
+
function oi(t) {
|
|
3320
|
+
const e = zr(t.type), n = e ? Or[e] : void 0;
|
|
3309
3321
|
if (!n)
|
|
3310
3322
|
throw new Error(
|
|
3311
3323
|
`[epochs-pdf] Unsupported element "${e ?? "unknown"}". Use Document, Page, View, Text, Image, or Link.`
|
|
@@ -3316,27 +3328,27 @@ function ni(t) {
|
|
|
3316
3328
|
type: n,
|
|
3317
3329
|
props: i,
|
|
3318
3330
|
children: [],
|
|
3319
|
-
text:
|
|
3331
|
+
text: ri(r)
|
|
3320
3332
|
};
|
|
3321
|
-
const o =
|
|
3333
|
+
const o = ii(r).filter(
|
|
3322
3334
|
(d) => !!d && typeof d == "object" && "type" in d
|
|
3323
|
-
).map(
|
|
3335
|
+
).map(oi);
|
|
3324
3336
|
return {
|
|
3325
3337
|
type: n,
|
|
3326
3338
|
props: i,
|
|
3327
3339
|
children: o
|
|
3328
3340
|
};
|
|
3329
3341
|
}
|
|
3330
|
-
const
|
|
3342
|
+
const Sr = {
|
|
3331
3343
|
A4: [595.28, 841.89],
|
|
3332
3344
|
LETTER: [612, 792],
|
|
3333
3345
|
LEGAL: [612, 1008]
|
|
3334
3346
|
};
|
|
3335
|
-
function
|
|
3336
|
-
const [n, i] = Array.isArray(t) ? t :
|
|
3347
|
+
function Gr(t = "A4", e = "portrait") {
|
|
3348
|
+
const [n, i] = Array.isArray(t) ? t : Sr[t];
|
|
3337
3349
|
return e === "landscape" ? [i, n] : [n, i];
|
|
3338
3350
|
}
|
|
3339
|
-
function
|
|
3351
|
+
function si(t = {}) {
|
|
3340
3352
|
const e = t.padding ?? 0;
|
|
3341
3353
|
return {
|
|
3342
3354
|
top: t.paddingTop ?? e,
|
|
@@ -3345,7 +3357,7 @@ function ii(t = {}) {
|
|
|
3345
3357
|
left: t.paddingLeft ?? e
|
|
3346
3358
|
};
|
|
3347
3359
|
}
|
|
3348
|
-
function
|
|
3360
|
+
function Ae(t = {}) {
|
|
3349
3361
|
const e = t.margin ?? 0;
|
|
3350
3362
|
return {
|
|
3351
3363
|
top: t.marginTop ?? e,
|
|
@@ -3354,7 +3366,7 @@ function De(t = {}) {
|
|
|
3354
3366
|
left: t.marginLeft ?? e
|
|
3355
3367
|
};
|
|
3356
3368
|
}
|
|
3357
|
-
function
|
|
3369
|
+
function ze(t) {
|
|
3358
3370
|
if (!t) return null;
|
|
3359
3371
|
const e = t.trim();
|
|
3360
3372
|
if (e.startsWith("#")) {
|
|
@@ -3377,7 +3389,7 @@ function Be(t) {
|
|
|
3377
3389
|
Math.min(1, Number(n[3]) / 255)
|
|
3378
3390
|
] : null;
|
|
3379
3391
|
}
|
|
3380
|
-
function
|
|
3392
|
+
function $e(t, e, n = 0) {
|
|
3381
3393
|
if (t == null) return n;
|
|
3382
3394
|
if (typeof t == "number") return t;
|
|
3383
3395
|
if (t.endsWith("%")) {
|
|
@@ -3387,19 +3399,19 @@ function Me(t, e, n = 0) {
|
|
|
3387
3399
|
const i = Number.parseFloat(t);
|
|
3388
3400
|
return Number.isFinite(i) ? i : n;
|
|
3389
3401
|
}
|
|
3390
|
-
function
|
|
3402
|
+
function un(t) {
|
|
3391
3403
|
return t === "bold" ? !0 : typeof t == "number" ? t >= 600 : !1;
|
|
3392
3404
|
}
|
|
3393
|
-
const Xr = 12,
|
|
3394
|
-
function
|
|
3395
|
-
const i = e.fontSize ?? Xr, r = (e.lineHeight ??
|
|
3405
|
+
const Xr = 12, Vr = 1.4, qr = 0.5;
|
|
3406
|
+
function ai(t, e, n) {
|
|
3407
|
+
const i = e.fontSize ?? Xr, r = (e.lineHeight ?? Vr) * i, o = i * (un(e.fontWeight) ? 0.55 : qr);
|
|
3396
3408
|
if (!t)
|
|
3397
3409
|
return { width: 0, height: r, lines: [""] };
|
|
3398
3410
|
const d = t.split(/\s+/), u = [];
|
|
3399
3411
|
let m = "";
|
|
3400
3412
|
for (const _ of d) {
|
|
3401
|
-
const
|
|
3402
|
-
|
|
3413
|
+
const y = m ? `${m} ${_}` : _;
|
|
3414
|
+
y.length * o <= n || !m ? m = y : (u.push(m), m = _);
|
|
3403
3415
|
}
|
|
3404
3416
|
m && u.push(m);
|
|
3405
3417
|
const g = Math.max(...u.map((_) => _.length * o), 0);
|
|
@@ -3409,13 +3421,13 @@ function ri(t, e, n) {
|
|
|
3409
3421
|
lines: u
|
|
3410
3422
|
};
|
|
3411
3423
|
}
|
|
3412
|
-
function
|
|
3413
|
-
const o = t.props.style ?? {}, d =
|
|
3424
|
+
function ci(t, e, n, i, r) {
|
|
3425
|
+
const o = t.props.style ?? {}, d = Ae(o), u = si(o), m = e + d.left, g = n + d.top, _ = Math.max(
|
|
3414
3426
|
0,
|
|
3415
|
-
|
|
3416
|
-
),
|
|
3427
|
+
$e(o.width, i, i) - d.left - d.right
|
|
3428
|
+
), y = Math.max(0, _ - u.left - u.right);
|
|
3417
3429
|
if (t.type === "TEXT" || t.type === "LINK") {
|
|
3418
|
-
const
|
|
3430
|
+
const E = ai(t.text ?? "", o, y), ct = $e(o.height, r, E.height + u.top + u.bottom);
|
|
3419
3431
|
return {
|
|
3420
3432
|
x: m,
|
|
3421
3433
|
y: g,
|
|
@@ -3428,51 +3440,51 @@ function oi(t, e, n, i, r) {
|
|
|
3428
3440
|
};
|
|
3429
3441
|
}
|
|
3430
3442
|
if (t.type === "IMAGE") {
|
|
3431
|
-
const
|
|
3443
|
+
const E = $e(o.width, i, Math.min(200, i)), ct = $e(o.height, r, 120);
|
|
3432
3444
|
return {
|
|
3433
3445
|
x: m,
|
|
3434
3446
|
y: g,
|
|
3435
|
-
width:
|
|
3447
|
+
width: E - d.left - d.right,
|
|
3436
3448
|
height: ct,
|
|
3437
3449
|
node: t,
|
|
3438
3450
|
children: [],
|
|
3439
3451
|
style: o
|
|
3440
3452
|
};
|
|
3441
3453
|
}
|
|
3442
|
-
const b = o.flexDirection ?? "column", x = o.gap ?? 0,
|
|
3443
|
-
let S = m + u.left, H = g + u.top,
|
|
3444
|
-
for (let
|
|
3445
|
-
const ct = t.children[
|
|
3446
|
-
|
|
3454
|
+
const b = o.flexDirection ?? "column", x = o.gap ?? 0, I = [];
|
|
3455
|
+
let S = m + u.left, H = g + u.top, W = 0, A = 0;
|
|
3456
|
+
for (let E = 0; E < t.children.length; E++) {
|
|
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);
|
|
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));
|
|
3447
3459
|
}
|
|
3448
|
-
const
|
|
3460
|
+
const C = $e(
|
|
3449
3461
|
o.height,
|
|
3450
3462
|
r,
|
|
3451
|
-
b === "column" ?
|
|
3452
|
-
),
|
|
3453
|
-
let
|
|
3454
|
-
at === "center" && (
|
|
3455
|
-
let
|
|
3456
|
-
for (const
|
|
3457
|
-
b === "column" ? (
|
|
3463
|
+
b === "column" ? W + u.top + u.bottom : A + u.top + u.bottom
|
|
3464
|
+
), nt = b === "row" ? $e(o.width, i, W + u.left + u.right) : _, at = o.justifyContent ?? "flex-start", q = o.alignItems ?? "stretch", pt = b === "column" ? C - u.top - u.bottom : nt - u.left - u.right, Mt = Math.max(0, pt - W);
|
|
3465
|
+
let K = 0, Et = x;
|
|
3466
|
+
at === "center" && (K = Mt / 2), at === "flex-end" && (K = Mt), at === "space-between" && I.length > 1 && (Et = x + Mt / (I.length - 1)), at === "space-around" && I.length > 0 && (Et = x + Mt / I.length, K = Et / 2);
|
|
3467
|
+
let vt = 0;
|
|
3468
|
+
for (const E of I)
|
|
3469
|
+
b === "column" ? (E.y = g + u.top + K + vt, q === "center" ? E.x = m + u.left + Math.max(0, (y - E.width) / 2) : q === "flex-end" ? E.x = m + u.left + Math.max(0, y - E.width) : q === "stretch" && E.style.width == null && (E.width = y), vt += E.height + Et) : (E.x = m + u.left + K + vt, q === "center" ? E.y = g + u.top + Math.max(0, (C - u.top - u.bottom - E.height) / 2) : q === "flex-end" ? E.y = g + u.top + Math.max(0, C - u.top - u.bottom - E.height) : q === "stretch" && E.style.height == null && (E.height = C - u.top - u.bottom), vt += E.width + Et);
|
|
3458
3470
|
return {
|
|
3459
3471
|
x: m,
|
|
3460
3472
|
y: g,
|
|
3461
|
-
width:
|
|
3462
|
-
height:
|
|
3473
|
+
width: nt,
|
|
3474
|
+
height: C,
|
|
3463
3475
|
node: t,
|
|
3464
|
-
children:
|
|
3476
|
+
children: I,
|
|
3465
3477
|
style: o
|
|
3466
3478
|
};
|
|
3467
3479
|
}
|
|
3468
|
-
function
|
|
3480
|
+
function Yr(t) {
|
|
3469
3481
|
if (t.type !== "DOCUMENT")
|
|
3470
3482
|
throw new Error("[epochs-pdf] Root element must be <Document>.");
|
|
3471
3483
|
const e = [];
|
|
3472
3484
|
for (const n of t.children) {
|
|
3473
3485
|
if (n.type !== "PAGE")
|
|
3474
3486
|
throw new Error("[epochs-pdf] Direct children of <Document> must be <Page>.");
|
|
3475
|
-
const i = n.props.size, r = n.props.orientation ?? "portrait", [o, d] =
|
|
3487
|
+
const i = n.props.size, r = n.props.orientation ?? "portrait", [o, d] = Gr(i, r), u = n.props.style ?? {}, m = si(u), g = {
|
|
3476
3488
|
type: "VIEW",
|
|
3477
3489
|
props: {
|
|
3478
3490
|
style: {
|
|
@@ -3486,7 +3498,7 @@ function Vr(t) {
|
|
|
3486
3498
|
}
|
|
3487
3499
|
},
|
|
3488
3500
|
children: n.children
|
|
3489
|
-
}, _ =
|
|
3501
|
+
}, _ = ci(g, 0, 0, o, d);
|
|
3490
3502
|
e.push({
|
|
3491
3503
|
width: o,
|
|
3492
3504
|
height: d,
|
|
@@ -3504,44 +3516,44 @@ function Vr(t) {
|
|
|
3504
3516
|
pages: e
|
|
3505
3517
|
};
|
|
3506
3518
|
}
|
|
3507
|
-
function
|
|
3519
|
+
function Ee(t) {
|
|
3508
3520
|
return t.replace(/\\/g, "\\\\").replace(/\(/g, "\\(").replace(/\)/g, "\\)").replace(/\r/g, "\\r").replace(/\n/g, "\\n");
|
|
3509
3521
|
}
|
|
3510
|
-
class
|
|
3522
|
+
class Kr {
|
|
3511
3523
|
constructor() {
|
|
3512
|
-
|
|
3513
|
-
|
|
3524
|
+
on(this, "objects", [null]);
|
|
3525
|
+
on(this, "offsets", [0]);
|
|
3514
3526
|
}
|
|
3515
3527
|
addObject(e) {
|
|
3516
3528
|
return this.objects.push(e), this.objects.length - 1;
|
|
3517
3529
|
}
|
|
3518
3530
|
build(e) {
|
|
3519
3531
|
const n = this.addObject(
|
|
3520
|
-
`<< /Title (${
|
|
3532
|
+
`<< /Title (${Ee(e.meta.title)}) /Author (${Ee(e.meta.author)}) /Subject (${Ee(e.meta.subject)}) /Creator (${Ee(e.meta.creator)}) /Producer (epochs-pdf) >>`
|
|
3521
3533
|
), i = this.addObject(
|
|
3522
3534
|
"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>"
|
|
3523
3535
|
), r = this.addObject(
|
|
3524
3536
|
"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold >>"
|
|
3525
3537
|
), o = [];
|
|
3526
|
-
for (const
|
|
3538
|
+
for (const y of e.pages) {
|
|
3527
3539
|
const b = this.renderPageContent(
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3540
|
+
y.boxes,
|
|
3541
|
+
y.width,
|
|
3542
|
+
y.height,
|
|
3543
|
+
y.style
|
|
3532
3544
|
), x = this.addObject(
|
|
3533
3545
|
`<< /Length ${b.length} >>
|
|
3534
3546
|
stream
|
|
3535
3547
|
${b}
|
|
3536
3548
|
endstream`
|
|
3537
|
-
),
|
|
3538
|
-
o.push(
|
|
3549
|
+
), I = this.addObject("");
|
|
3550
|
+
o.push(I), this.objects[I] = `<< /Type /Page /Parent 0 0 R /MediaBox [0 0 ${y.width.toFixed(2)} ${y.height.toFixed(2)}] /Contents ${x} 0 R /Resources << /Font << /F1 ${i} 0 R /F2 ${r} 0 R >> >> >>`;
|
|
3539
3551
|
}
|
|
3540
|
-
const d = o.map((
|
|
3552
|
+
const d = o.map((y) => `${y} 0 R`).join(" "), u = this.addObject(
|
|
3541
3553
|
`<< /Type /Pages /Kids [${d}] /Count ${o.length} >>`
|
|
3542
3554
|
);
|
|
3543
|
-
for (const
|
|
3544
|
-
this.objects[
|
|
3555
|
+
for (const y of o)
|
|
3556
|
+
this.objects[y] = this.objects[y].replace(
|
|
3545
3557
|
"/Parent 0 0 R",
|
|
3546
3558
|
`/Parent ${u} 0 R`
|
|
3547
3559
|
);
|
|
@@ -3551,9 +3563,9 @@ endstream`
|
|
|
3551
3563
|
let g = `%PDF-1.4
|
|
3552
3564
|
`;
|
|
3553
3565
|
this.offsets = [0];
|
|
3554
|
-
for (let
|
|
3555
|
-
this.offsets[
|
|
3556
|
-
${this.objects[
|
|
3566
|
+
for (let y = 1; y < this.objects.length; y++)
|
|
3567
|
+
this.offsets[y] = g.length, g += `${y} 0 obj
|
|
3568
|
+
${this.objects[y]}
|
|
3557
3569
|
endobj
|
|
3558
3570
|
`;
|
|
3559
3571
|
const _ = g.length;
|
|
@@ -3561,8 +3573,8 @@ endobj
|
|
|
3561
3573
|
0 ${this.objects.length}
|
|
3562
3574
|
`, g += `0000000000 65535 f
|
|
3563
3575
|
`;
|
|
3564
|
-
for (let
|
|
3565
|
-
g += `${String(this.offsets[
|
|
3576
|
+
for (let y = 1; y < this.objects.length; y++)
|
|
3577
|
+
g += `${String(this.offsets[y]).padStart(10, "0")} 00000 n
|
|
3566
3578
|
`;
|
|
3567
3579
|
return g += `trailer
|
|
3568
3580
|
<< /Size ${this.objects.length} /Root ${m} 0 R /Info ${n} 0 R >>
|
|
@@ -3571,33 +3583,33 @@ ${_}
|
|
|
3571
3583
|
%%EOF`, new TextEncoder().encode(g);
|
|
3572
3584
|
}
|
|
3573
3585
|
renderPageContent(e, n, i, r) {
|
|
3574
|
-
const o = [], d =
|
|
3586
|
+
const o = [], d = ze(r.backgroundColor);
|
|
3575
3587
|
d && (o.push("q"), o.push(
|
|
3576
3588
|
`${d[0].toFixed(3)} ${d[1].toFixed(3)} ${d[2].toFixed(3)} rg`
|
|
3577
3589
|
), o.push(
|
|
3578
3590
|
`0 0 ${n.toFixed(2)} ${i.toFixed(2)} re f`
|
|
3579
3591
|
), o.push("Q"));
|
|
3580
3592
|
const u = (m) => {
|
|
3581
|
-
const { x: g, y: _, width:
|
|
3582
|
-
if (
|
|
3583
|
-
const
|
|
3584
|
-
o.push("q"), o.push(`${x.borderWidth} w`), o.push(`${
|
|
3593
|
+
const { x: g, y: _, width: y, height: b, style: x, node: I, text: S } = m, H = i - _ - b, W = ze(x.backgroundColor);
|
|
3594
|
+
if (W && (o.push("q"), o.push(`${W[0].toFixed(3)} ${W[1].toFixed(3)} ${W[2].toFixed(3)} rg`), o.push(`${g.toFixed(2)} ${H.toFixed(2)} ${y.toFixed(2)} ${b.toFixed(2)} re f`), o.push("Q")), x.borderWidth && x.borderWidth > 0) {
|
|
3595
|
+
const A = ze(x.borderColor) ?? [0, 0, 0];
|
|
3596
|
+
o.push("q"), o.push(`${x.borderWidth} w`), o.push(`${A[0].toFixed(3)} ${A[1].toFixed(3)} ${A[2].toFixed(3)} RG`), o.push(`${g.toFixed(2)} ${H.toFixed(2)} ${y.toFixed(2)} ${b.toFixed(2)} re S`), o.push("Q");
|
|
3585
3597
|
}
|
|
3586
|
-
if ((
|
|
3587
|
-
const
|
|
3588
|
-
o.push("q"), o.push("BT"), o.push(`/${
|
|
3589
|
-
let
|
|
3590
|
-
const
|
|
3591
|
-
x.textAlign === "center" ?
|
|
3592
|
-
const ct = i - _ -
|
|
3593
|
-
o.push(`1 0 0 1 ${
|
|
3598
|
+
if ((I.type === "TEXT" || I.type === "LINK") && S != null) {
|
|
3599
|
+
const A = x.fontSize ?? 12, C = ze(x.color) ?? [0, 0, 0], nt = un(x.fontWeight) ? "F2" : "F1", at = x.paddingLeft ?? x.padding ?? 0, q = x.paddingTop ?? x.padding ?? 0, pt = Math.max(0, y - at - (x.paddingRight ?? x.padding ?? 0)), J = ai(S, x, pt || y), Mt = (x.lineHeight ?? 1.4) * A;
|
|
3600
|
+
o.push("q"), o.push("BT"), o.push(`/${nt} ${A} Tf`), o.push(`${C[0].toFixed(3)} ${C[1].toFixed(3)} ${C[2].toFixed(3)} rg`), J.lines.forEach((K, Et) => {
|
|
3601
|
+
let vt = g + at;
|
|
3602
|
+
const E = K.length * A * (un(x.fontWeight) ? 0.55 : 0.5);
|
|
3603
|
+
x.textAlign === "center" ? vt = g + (y - E) / 2 : x.textAlign === "right" && (vt = g + y - E - (x.paddingRight ?? x.padding ?? 0));
|
|
3604
|
+
const ct = i - _ - q - A - Et * Mt;
|
|
3605
|
+
o.push(`1 0 0 1 ${vt.toFixed(2)} ${ct.toFixed(2)} Tm`), o.push(`(${Ee(K)}) Tj`);
|
|
3594
3606
|
}), o.push("ET"), o.push("Q");
|
|
3595
3607
|
}
|
|
3596
|
-
|
|
3608
|
+
I.type === "IMAGE" && (o.push("q"), o.push("0.85 0.85 0.85 rg"), o.push(`${g.toFixed(2)} ${H.toFixed(2)} ${y.toFixed(2)} ${b.toFixed(2)} re f`), o.push("0.6 0.6 0.6 RG 1 w"), o.push(`${g.toFixed(2)} ${H.toFixed(2)} ${y.toFixed(2)} ${b.toFixed(2)} re S`), o.push(
|
|
3597
3609
|
`BT /F1 10 Tf 0.4 0.4 0.4 rg 1 0 0 1 ${(g + 8).toFixed(2)} ${(H + b / 2 - 4).toFixed(2)} Tm (Image) Tj ET`
|
|
3598
3610
|
), o.push("Q"));
|
|
3599
|
-
for (const
|
|
3600
|
-
u(
|
|
3611
|
+
for (const A of m.children)
|
|
3612
|
+
u(A);
|
|
3601
3613
|
};
|
|
3602
3614
|
for (const m of e)
|
|
3603
3615
|
u(m);
|
|
@@ -3605,69 +3617,69 @@ ${_}
|
|
|
3605
3617
|
`);
|
|
3606
3618
|
}
|
|
3607
3619
|
}
|
|
3608
|
-
function
|
|
3609
|
-
return new
|
|
3620
|
+
function Zr(t) {
|
|
3621
|
+
return new Kr().build(t);
|
|
3610
3622
|
}
|
|
3611
|
-
function
|
|
3612
|
-
const e =
|
|
3613
|
-
return
|
|
3623
|
+
function fn(t) {
|
|
3624
|
+
const e = oi(t), n = Yr(e);
|
|
3625
|
+
return Zr(n);
|
|
3614
3626
|
}
|
|
3615
|
-
function
|
|
3616
|
-
return
|
|
3627
|
+
function so(t) {
|
|
3628
|
+
return fn(t);
|
|
3617
3629
|
}
|
|
3618
|
-
function
|
|
3619
|
-
const e =
|
|
3630
|
+
function li(t) {
|
|
3631
|
+
const e = fn(t), n = new Uint8Array(e.byteLength);
|
|
3620
3632
|
return n.set(e), new Blob([n], { type: "application/pdf" });
|
|
3621
3633
|
}
|
|
3622
|
-
function
|
|
3623
|
-
return URL.createObjectURL(
|
|
3634
|
+
function Qr(t) {
|
|
3635
|
+
return URL.createObjectURL(li(t));
|
|
3624
3636
|
}
|
|
3625
|
-
function
|
|
3626
|
-
const n =
|
|
3637
|
+
function ao(t, e = "document.pdf") {
|
|
3638
|
+
const n = Qr(t), i = document.createElement("a");
|
|
3627
3639
|
i.href = n, i.download = e, i.click(), URL.revokeObjectURL(n);
|
|
3628
3640
|
}
|
|
3629
|
-
async function ao(t) {
|
|
3630
|
-
return cn(t);
|
|
3631
|
-
}
|
|
3632
3641
|
async function co(t) {
|
|
3633
|
-
return
|
|
3642
|
+
return fn(t);
|
|
3643
|
+
}
|
|
3644
|
+
async function lo(t) {
|
|
3645
|
+
return li(t);
|
|
3634
3646
|
}
|
|
3635
3647
|
export {
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3648
|
+
ro as ALL_TOOLBAR_TOOLS,
|
|
3649
|
+
ti as AddText,
|
|
3650
|
+
ni as Clear,
|
|
3651
|
+
Fn as DEFAULT_TOOLBAR_LAYOUT,
|
|
3652
|
+
Er as Document,
|
|
3653
|
+
Kn as Download,
|
|
3654
|
+
ei as Erase,
|
|
3655
|
+
An as HIGHLIGHT_PRESETS,
|
|
3656
|
+
Zn as Highlight,
|
|
3657
|
+
Br as Image,
|
|
3658
|
+
Wr as Link,
|
|
3659
|
+
Sn as Navigation,
|
|
3660
|
+
Yn as Open,
|
|
3661
|
+
Sr as PAGE_SIZES,
|
|
3662
|
+
Hr as Page,
|
|
3663
|
+
oo as PdfViewer,
|
|
3664
|
+
qn as Print,
|
|
3665
|
+
Vn as Reload,
|
|
3666
|
+
Xn as Rotate,
|
|
3667
|
+
Jn as Signature,
|
|
3668
|
+
jr as Text,
|
|
3669
|
+
zn as Thumbnail,
|
|
3670
|
+
En as UNDERLINE_PRESETS,
|
|
3671
|
+
Qn as Underline,
|
|
3660
3672
|
Ur as View,
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3673
|
+
Gn as Zoom,
|
|
3674
|
+
oo as default,
|
|
3675
|
+
ao as download,
|
|
3676
|
+
Un as hexToMarkupColor,
|
|
3677
|
+
so as pdf,
|
|
3678
|
+
lo as renderToBlob,
|
|
3679
|
+
co as renderToBuffer,
|
|
3680
|
+
Gr as resolvePageSize,
|
|
3681
|
+
$n as setPdfWorkerSrc,
|
|
3682
|
+
li as toBlob,
|
|
3683
|
+
Qr as toUrl
|
|
3672
3684
|
};
|
|
3673
3685
|
//# sourceMappingURL=epochs-pdf.js.map
|