teamsync-pdf-viewer 1.3.4 → 1.3.5
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/CHANGELOG.md +8 -0
- package/dist/src/components/DocumentViewer.d.ts +5 -1
- package/dist/src/components/PageRenderer.d.ts +3 -1
- package/dist/src/components/SideBySideViewer.d.ts +2 -1
- package/dist/src/components/TeamSyncViewer.d.ts +5 -0
- package/dist/src/core/types.d.ts +10 -0
- package/dist/src/utils/zoomUtils.d.ts +2 -2
- package/dist/teamsync-pdf-viewer.js +1197 -1165
- package/dist/teamsync-pdf-viewer.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useImperativeHandle as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
|
|
3
3
|
import u from "react-dom/client";
|
|
4
|
-
import { AlertCircle as d, ArrowUpRight as f, Bookmark as p, Brush as m, Check as h, CheckCircle2 as g, CheckSquare as _, ChevronDown as v, ChevronLeft as y, ChevronRight as b, ChevronUp as x, Circle as ee, Columns as S, Copy as
|
|
5
|
-
import { Fragment as
|
|
4
|
+
import { AlertCircle as d, ArrowUpRight as f, Bookmark as p, Brush as m, Check as h, CheckCircle2 as g, CheckSquare as _, ChevronDown as v, ChevronLeft as y, ChevronRight as b, ChevronUp as x, Circle as ee, Columns as S, Copy as te, Download as ne, Edit2 as re, Eraser as ie, Expand as ae, EyeOff as oe, File as C, FileCode2 as se, FileText as ce, FolderOpen as le, GripVertical as w, Hand as ue, Highlighter as T, Info as E, Layers as D, Link as O, List as k, Maximize as de, Maximize2 as fe, Menu as pe, MessageCircle as me, MessageSquare as he, MessageSquareQuote as ge, Minus as _e, MinusCircle as ve, MoreHorizontal as ye, MoveHorizontal as be, PanelLeft as xe, Pen as Se, Plus as A, PlusCircle as Ce, Printer as j, RotateCcw as we, RotateCw as Te, Save as Ee, ScanSearch as M, Search as De, Settings as Oe, ShieldCheck as ke, SlidersHorizontal as Ae, Square as je, Trash2 as Me, Type as Ne, X as N } from "lucide-react";
|
|
5
|
+
import { Fragment as P, jsx as F, jsxs as I } from "react/jsx-runtime";
|
|
6
6
|
import * as L from "pdfjs-dist";
|
|
7
|
-
import { BlendMode as
|
|
7
|
+
import { BlendMode as Pe, PDFDocument as Fe, StandardFonts as R, degrees as z, rgb as B } from "pdf-lib";
|
|
8
8
|
//#region src/core/busContext.ts
|
|
9
9
|
var Ie = t(null);
|
|
10
10
|
//#endregion
|
|
@@ -19,13 +19,46 @@ function Re(e, t) {
|
|
|
19
19
|
r.current = t, i(() => n.on(e, (e) => r.current(e)), [n, e]);
|
|
20
20
|
}
|
|
21
21
|
//#endregion
|
|
22
|
+
//#region src/utils/zoomUtils.ts
|
|
23
|
+
var ze = .1, Be = 8, Ve = () => typeof navigator < "u" && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet/i.test(navigator.userAgent) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), He = 4096, Ue = 2048, We = 8388608, Ge = 4194304;
|
|
24
|
+
function Ke(e, t = 8) {
|
|
25
|
+
return Math.min(t, Math.round((e + (e < 2 ? .25 : e < 5 ? .5 : 1)) * 100) / 100);
|
|
26
|
+
}
|
|
27
|
+
function qe(e, t = ze) {
|
|
28
|
+
return Math.max(t, Math.round((e - (e <= 2 ? .25 : e <= 5 ? .5 : 1)) * 100) / 100);
|
|
29
|
+
}
|
|
30
|
+
function Je(e, t = ze, n = 8) {
|
|
31
|
+
return Math.min(n, Math.max(t, Math.round(e * 100) / 100));
|
|
32
|
+
}
|
|
33
|
+
function Ye(e, t, n, r, i = Ve() ? Ue : He, a = Ve() ? Ge : We) {
|
|
34
|
+
let o = e * t;
|
|
35
|
+
return n * o > i && (o = i / n), r * o > i && (o = i / r), n * o * (r * o) > a && (o = Math.sqrt(a / (n * r))), o;
|
|
36
|
+
}
|
|
37
|
+
function Xe(e) {
|
|
38
|
+
let { prevScale: t, newScale: n, containerWidth: r, containerHeight: i, currentScrollLeft: a, currentScrollTop: o, basePageWidth: s, focusPoint: c, isProgrammatic: l = !1 } = e;
|
|
39
|
+
if (l) return {
|
|
40
|
+
scrollLeft: 0,
|
|
41
|
+
scrollTop: o <= 1 ? 0 : o
|
|
42
|
+
};
|
|
43
|
+
let u = c?.vx != null && c?.vy != null;
|
|
44
|
+
if (!u && o <= 0) return {
|
|
45
|
+
scrollLeft: 0,
|
|
46
|
+
scrollTop: 0
|
|
47
|
+
};
|
|
48
|
+
let d = u ? c.vx : r / 2, f = u ? c.vy : i / 2, p = d + a, m = f + o, h = Math.max(0, r / 2 - s * t / 2), g = Math.max(0, r / 2 - s * n / 2) + (p - h) * (n / t);
|
|
49
|
+
return {
|
|
50
|
+
scrollLeft: Math.max(0, g - d),
|
|
51
|
+
scrollTop: Math.max(0, n / t * m - f)
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
22
55
|
//#region src/components/Header.tsx
|
|
23
|
-
var
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
return Re("action-tool-changed", (e) =>
|
|
56
|
+
var Ze = ["View", "Annotate"];
|
|
57
|
+
function Qe({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarOpen: r, rightSidebarOpen: a, setRightSidebarOpen: o, sidebarTab: l, scale: u, onZoomIn: d, onZoomOut: f, onZoomSet: p, onOpenFile: m, onDownload: h, onFullScreen: g, onSaveAs: _, onPrint: y, onOpenSettings: b, onOpenAbout: ee, onOpenSidebarTab: S, pageTransition: re, setPageTransition: ie, pageLayout: oe, setPageLayout: w, rotation: T, setRotation: O, signatureCount: k = 0, enableAnnotations: me, enableSign: ge = !1, plugins: _e, permissions: ye }) {
|
|
58
|
+
let A = _e && _e.some((e) => e.id && e.id.toLowerCase().includes("sign")), Ae = ge === !0 && !!A, [je, Me] = c(!1), [Ne, N] = c(!1), [P, L] = c(!1), [Pe, Fe] = c("pan"), R = s(null), z = s(null), B = s(null), Ie = Le();
|
|
59
|
+
return Re("action-tool-changed", (e) => Fe(e?.tool ?? null)), i(() => {
|
|
27
60
|
function e(e) {
|
|
28
|
-
|
|
61
|
+
R.current && !R.current.contains(e.target) && Me(!1), z.current && !z.current.contains(e.target) && N(!1), B.current && !B.current.contains(e.target) && L(!1);
|
|
29
62
|
}
|
|
30
63
|
return document.addEventListener("mousedown", e), () => {
|
|
31
64
|
document.removeEventListener("mousedown", e);
|
|
@@ -55,14 +88,14 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
55
88
|
},
|
|
56
89
|
children: [
|
|
57
90
|
/* @__PURE__ */ I("div", {
|
|
58
|
-
ref:
|
|
91
|
+
ref: R,
|
|
59
92
|
style: { position: "relative" },
|
|
60
|
-
children: [/* @__PURE__ */ F(
|
|
61
|
-
icon: /* @__PURE__ */ F(
|
|
93
|
+
children: [/* @__PURE__ */ F($e, {
|
|
94
|
+
icon: /* @__PURE__ */ F(pe, { size: 18 }),
|
|
62
95
|
title: "Menu",
|
|
63
|
-
onClick: () =>
|
|
64
|
-
active:
|
|
65
|
-
}),
|
|
96
|
+
onClick: () => Me(!je),
|
|
97
|
+
active: je
|
|
98
|
+
}), je && /* @__PURE__ */ I("div", {
|
|
66
99
|
style: {
|
|
67
100
|
position: "absolute",
|
|
68
101
|
top: "100%",
|
|
@@ -80,39 +113,39 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
80
113
|
},
|
|
81
114
|
children: [
|
|
82
115
|
m && /* @__PURE__ */ F(V, {
|
|
83
|
-
icon: /* @__PURE__ */ F(
|
|
116
|
+
icon: /* @__PURE__ */ F(le, { size: 16 }),
|
|
84
117
|
label: "Open PDF...",
|
|
85
118
|
onClick: () => {
|
|
86
|
-
m(),
|
|
119
|
+
m(), Me(!1);
|
|
87
120
|
}
|
|
88
121
|
}),
|
|
89
122
|
/* @__PURE__ */ F(V, {
|
|
90
|
-
icon: /* @__PURE__ */ F(
|
|
123
|
+
icon: /* @__PURE__ */ F(ne, { size: 16 }),
|
|
91
124
|
label: "Download",
|
|
92
125
|
onClick: () => {
|
|
93
|
-
h(),
|
|
126
|
+
h(), Me(!1);
|
|
94
127
|
}
|
|
95
128
|
}),
|
|
96
129
|
/* @__PURE__ */ F(V, {
|
|
97
|
-
icon: /* @__PURE__ */ F(
|
|
130
|
+
icon: /* @__PURE__ */ F(de, { size: 16 }),
|
|
98
131
|
label: "Enter Full Screen",
|
|
99
132
|
onClick: () => {
|
|
100
|
-
g(),
|
|
133
|
+
g(), Me(!1);
|
|
101
134
|
}
|
|
102
135
|
}),
|
|
103
136
|
/* @__PURE__ */ F(V, {
|
|
104
|
-
icon: /* @__PURE__ */ F(
|
|
137
|
+
icon: /* @__PURE__ */ F(Ee, { size: 16 }),
|
|
105
138
|
label: "Save As",
|
|
106
139
|
onClick: () => {
|
|
107
|
-
_(),
|
|
140
|
+
_(), Me(!1);
|
|
108
141
|
}
|
|
109
142
|
}),
|
|
110
143
|
/* @__PURE__ */ F(V, {
|
|
111
|
-
icon: /* @__PURE__ */ F(
|
|
144
|
+
icon: /* @__PURE__ */ F(j, { size: 16 }),
|
|
112
145
|
label: "Print",
|
|
113
146
|
disabled: !y,
|
|
114
147
|
onClick: () => {
|
|
115
|
-
y?.(),
|
|
148
|
+
y?.(), Me(!1);
|
|
116
149
|
}
|
|
117
150
|
}),
|
|
118
151
|
/* @__PURE__ */ F("div", { style: {
|
|
@@ -121,7 +154,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
121
154
|
margin: "4px 0"
|
|
122
155
|
} }),
|
|
123
156
|
/* @__PURE__ */ F(V, {
|
|
124
|
-
icon: /* @__PURE__ */ F(
|
|
157
|
+
icon: /* @__PURE__ */ F(D, {
|
|
125
158
|
size: 16,
|
|
126
159
|
color: "#0284c7"
|
|
127
160
|
}),
|
|
@@ -131,21 +164,21 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
131
164
|
docA: "/sample_v1.pdf",
|
|
132
165
|
docB: "/sample_v2.pdf",
|
|
133
166
|
options: { mode: "overlay" }
|
|
134
|
-
} })),
|
|
167
|
+
} })), Me(!1);
|
|
135
168
|
}
|
|
136
169
|
}),
|
|
137
170
|
/* @__PURE__ */ F(V, {
|
|
138
|
-
icon: /* @__PURE__ */ F(
|
|
171
|
+
icon: /* @__PURE__ */ F(Oe, { size: 16 }),
|
|
139
172
|
label: "Settings",
|
|
140
173
|
onClick: () => {
|
|
141
|
-
b(),
|
|
174
|
+
b(), Me(!1);
|
|
142
175
|
}
|
|
143
176
|
})
|
|
144
177
|
]
|
|
145
178
|
})]
|
|
146
179
|
}),
|
|
147
|
-
/* @__PURE__ */ F(
|
|
148
|
-
icon: /* @__PURE__ */ F(
|
|
180
|
+
/* @__PURE__ */ F($e, {
|
|
181
|
+
icon: /* @__PURE__ */ F(xe, { size: 18 }),
|
|
149
182
|
title: "Toggle Left Panel",
|
|
150
183
|
active: n,
|
|
151
184
|
onClick: () => r(!n)
|
|
@@ -161,7 +194,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
161
194
|
style: { position: "relative" },
|
|
162
195
|
children: [/* @__PURE__ */ F("div", {
|
|
163
196
|
style: { position: "relative" },
|
|
164
|
-
children: /* @__PURE__ */ F(
|
|
197
|
+
children: /* @__PURE__ */ F($e, {
|
|
165
198
|
icon: /* @__PURE__ */ I("div", {
|
|
166
199
|
style: {
|
|
167
200
|
position: "relative",
|
|
@@ -169,7 +202,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
169
202
|
alignItems: "center",
|
|
170
203
|
justifyContent: "center"
|
|
171
204
|
},
|
|
172
|
-
children: [/* @__PURE__ */ F(
|
|
205
|
+
children: [/* @__PURE__ */ F(ce, { size: 18 }), /* @__PURE__ */ F("div", {
|
|
173
206
|
style: {
|
|
174
207
|
position: "absolute",
|
|
175
208
|
right: "-4px",
|
|
@@ -178,17 +211,17 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
178
211
|
borderRadius: "50%",
|
|
179
212
|
padding: "1px"
|
|
180
213
|
},
|
|
181
|
-
children: /* @__PURE__ */ F(
|
|
214
|
+
children: /* @__PURE__ */ F(Oe, {
|
|
182
215
|
size: 10,
|
|
183
216
|
color: "var(--primary)"
|
|
184
217
|
})
|
|
185
218
|
})]
|
|
186
219
|
}),
|
|
187
220
|
title: "View Settings",
|
|
188
|
-
active:
|
|
189
|
-
onClick: () => L(!
|
|
221
|
+
active: P,
|
|
222
|
+
onClick: () => L(!P)
|
|
190
223
|
})
|
|
191
|
-
}),
|
|
224
|
+
}), P && /* @__PURE__ */ I("div", {
|
|
192
225
|
style: {
|
|
193
226
|
position: "absolute",
|
|
194
227
|
top: "100%",
|
|
@@ -215,19 +248,19 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
215
248
|
children: "Page Transition"
|
|
216
249
|
}),
|
|
217
250
|
/* @__PURE__ */ F(V, {
|
|
218
|
-
icon: /* @__PURE__ */ F(
|
|
251
|
+
icon: /* @__PURE__ */ F(se, { size: 16 }),
|
|
219
252
|
label: "Continuous Page",
|
|
220
|
-
selected:
|
|
253
|
+
selected: re === "continuous",
|
|
221
254
|
onClick: () => {
|
|
222
|
-
|
|
255
|
+
ie("continuous"), L(!1);
|
|
223
256
|
}
|
|
224
257
|
}),
|
|
225
258
|
/* @__PURE__ */ F(V, {
|
|
226
|
-
icon: /* @__PURE__ */ F(
|
|
259
|
+
icon: /* @__PURE__ */ F(C, { size: 16 }),
|
|
227
260
|
label: "Page By Page",
|
|
228
|
-
selected:
|
|
261
|
+
selected: re === "page-by-page",
|
|
229
262
|
onClick: () => {
|
|
230
|
-
|
|
263
|
+
ie("page-by-page"), L(!1);
|
|
231
264
|
}
|
|
232
265
|
}),
|
|
233
266
|
/* @__PURE__ */ F("div", { style: {
|
|
@@ -245,17 +278,17 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
245
278
|
children: "Page Orientation"
|
|
246
279
|
}),
|
|
247
280
|
/* @__PURE__ */ F(V, {
|
|
248
|
-
icon: /* @__PURE__ */ F(
|
|
281
|
+
icon: /* @__PURE__ */ F(Te, { size: 16 }),
|
|
249
282
|
label: "Rotate Clockwise",
|
|
250
283
|
onClick: () => {
|
|
251
|
-
|
|
284
|
+
O((T + 90) % 360), L(!1);
|
|
252
285
|
}
|
|
253
286
|
}),
|
|
254
287
|
/* @__PURE__ */ F(V, {
|
|
255
|
-
icon: /* @__PURE__ */ F(
|
|
288
|
+
icon: /* @__PURE__ */ F(we, { size: 16 }),
|
|
256
289
|
label: "Rotate Counterclockwise",
|
|
257
290
|
onClick: () => {
|
|
258
|
-
|
|
291
|
+
O((T - 90 + 360) % 360), L(!1);
|
|
259
292
|
}
|
|
260
293
|
}),
|
|
261
294
|
/* @__PURE__ */ F("div", { style: {
|
|
@@ -273,27 +306,27 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
273
306
|
children: "Page Layout"
|
|
274
307
|
}),
|
|
275
308
|
/* @__PURE__ */ F(V, {
|
|
276
|
-
icon: /* @__PURE__ */ F(
|
|
309
|
+
icon: /* @__PURE__ */ F(C, { size: 16 }),
|
|
277
310
|
label: "Single Page",
|
|
278
|
-
selected:
|
|
311
|
+
selected: oe === "single",
|
|
279
312
|
onClick: () => {
|
|
280
|
-
|
|
313
|
+
w("single"), L(!1);
|
|
281
314
|
}
|
|
282
315
|
}),
|
|
283
316
|
/* @__PURE__ */ F(V, {
|
|
284
|
-
icon: /* @__PURE__ */ F(
|
|
317
|
+
icon: /* @__PURE__ */ F(te, { size: 16 }),
|
|
285
318
|
label: "Double Page",
|
|
286
|
-
selected:
|
|
319
|
+
selected: oe === "double",
|
|
287
320
|
onClick: () => {
|
|
288
|
-
|
|
321
|
+
w("double"), L(!1);
|
|
289
322
|
}
|
|
290
323
|
}),
|
|
291
324
|
/* @__PURE__ */ F(V, {
|
|
292
|
-
icon: /* @__PURE__ */ F(
|
|
325
|
+
icon: /* @__PURE__ */ F(ce, { size: 16 }),
|
|
293
326
|
label: "Cover Facing Page",
|
|
294
|
-
selected:
|
|
327
|
+
selected: oe === "cover-facing",
|
|
295
328
|
onClick: () => {
|
|
296
|
-
|
|
329
|
+
w("cover-facing"), L(!1);
|
|
297
330
|
}
|
|
298
331
|
}),
|
|
299
332
|
/* @__PURE__ */ F("div", { style: {
|
|
@@ -302,7 +335,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
302
335
|
margin: "4px 0"
|
|
303
336
|
} }),
|
|
304
337
|
/* @__PURE__ */ F(V, {
|
|
305
|
-
icon: /* @__PURE__ */ F(
|
|
338
|
+
icon: /* @__PURE__ */ F(ae, { size: 16 }),
|
|
306
339
|
label: "Enter Full Screen",
|
|
307
340
|
onClick: () => {
|
|
308
341
|
g(), L(!1);
|
|
@@ -319,7 +352,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
319
352
|
},
|
|
320
353
|
children: [
|
|
321
354
|
/* @__PURE__ */ I("div", {
|
|
322
|
-
ref:
|
|
355
|
+
ref: z,
|
|
323
356
|
style: {
|
|
324
357
|
position: "relative",
|
|
325
358
|
display: "flex",
|
|
@@ -331,13 +364,13 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
331
364
|
alignItems: "center",
|
|
332
365
|
backgroundColor: "#f3f4f6",
|
|
333
366
|
borderRadius: "4px",
|
|
334
|
-
border:
|
|
367
|
+
border: Ne ? "1px solid var(--primary)" : "1px solid transparent",
|
|
335
368
|
cursor: "pointer",
|
|
336
369
|
userSelect: "none",
|
|
337
370
|
height: "32px"
|
|
338
371
|
},
|
|
339
372
|
children: [/* @__PURE__ */ I("div", {
|
|
340
|
-
onClick: () =>
|
|
373
|
+
onClick: () => N(!Ne),
|
|
341
374
|
style: {
|
|
342
375
|
padding: "0 8px 0 12px",
|
|
343
376
|
fontSize: "13px",
|
|
@@ -348,18 +381,18 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
348
381
|
},
|
|
349
382
|
children: [Math.round(u * 100), "%"]
|
|
350
383
|
}), /* @__PURE__ */ F("div", {
|
|
351
|
-
onClick: () =>
|
|
384
|
+
onClick: () => N(!Ne),
|
|
352
385
|
style: {
|
|
353
386
|
padding: "0 8px",
|
|
354
387
|
display: "flex",
|
|
355
388
|
alignItems: "center",
|
|
356
389
|
height: "100%",
|
|
357
390
|
borderLeft: "1px solid #e5e7eb",
|
|
358
|
-
color:
|
|
391
|
+
color: Ne ? "var(--primary)" : "var(--text-color)"
|
|
359
392
|
},
|
|
360
|
-
children: F(
|
|
393
|
+
children: F(Ne ? x : v, { size: 14 })
|
|
361
394
|
})]
|
|
362
|
-
}),
|
|
395
|
+
}), Ne && /* @__PURE__ */ I("div", {
|
|
363
396
|
style: {
|
|
364
397
|
position: "absolute",
|
|
365
398
|
top: "100%",
|
|
@@ -378,17 +411,17 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
378
411
|
},
|
|
379
412
|
children: [
|
|
380
413
|
/* @__PURE__ */ F(V, {
|
|
381
|
-
icon: /* @__PURE__ */ F(
|
|
414
|
+
icon: /* @__PURE__ */ F(be, { size: 16 }),
|
|
382
415
|
label: "Fit To Width",
|
|
383
416
|
onClick: () => {
|
|
384
|
-
Ie.emit("action-fit-to-width"),
|
|
417
|
+
Ie.emit("action-fit-to-width"), N(!1);
|
|
385
418
|
}
|
|
386
419
|
}),
|
|
387
420
|
/* @__PURE__ */ F(V, {
|
|
388
|
-
icon: /* @__PURE__ */ F(
|
|
421
|
+
icon: /* @__PURE__ */ F(fe, { size: 16 }),
|
|
389
422
|
label: "Fit To Page",
|
|
390
423
|
onClick: () => {
|
|
391
|
-
Ie.emit("action-fit-to-page"),
|
|
424
|
+
Ie.emit("action-fit-to-page"), N(!1);
|
|
392
425
|
}
|
|
393
426
|
}),
|
|
394
427
|
/* @__PURE__ */ F("div", { style: {
|
|
@@ -407,11 +440,10 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
407
440
|
3,
|
|
408
441
|
4,
|
|
409
442
|
5,
|
|
410
|
-
8
|
|
411
|
-
10
|
|
443
|
+
8
|
|
412
444
|
].map((e) => /* @__PURE__ */ I("div", {
|
|
413
445
|
onClick: () => {
|
|
414
|
-
p && p(e),
|
|
446
|
+
p && p(e), N(!1);
|
|
415
447
|
},
|
|
416
448
|
style: {
|
|
417
449
|
padding: "6px 44px",
|
|
@@ -429,30 +461,30 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
429
461
|
margin: "4px 0"
|
|
430
462
|
} }),
|
|
431
463
|
/* @__PURE__ */ F(V, {
|
|
432
|
-
icon: /* @__PURE__ */ F(
|
|
464
|
+
icon: /* @__PURE__ */ F(M, { size: 16 }),
|
|
433
465
|
label: "Marquee Zoom",
|
|
434
|
-
onClick: () =>
|
|
466
|
+
onClick: () => N(!1)
|
|
435
467
|
})
|
|
436
468
|
]
|
|
437
469
|
})]
|
|
438
470
|
}),
|
|
439
|
-
/* @__PURE__ */ F(
|
|
440
|
-
icon: /* @__PURE__ */ F(
|
|
471
|
+
/* @__PURE__ */ F($e, {
|
|
472
|
+
icon: /* @__PURE__ */ F(ve, {
|
|
441
473
|
size: 18,
|
|
442
474
|
color: u <= .1 ? "var(--border-color)" : "var(--text-muted)"
|
|
443
475
|
}),
|
|
444
476
|
title: "Zoom Out",
|
|
445
477
|
onClick: f,
|
|
446
|
-
disabled: u <=
|
|
478
|
+
disabled: u <= ze
|
|
447
479
|
}),
|
|
448
|
-
/* @__PURE__ */ F(
|
|
449
|
-
icon: /* @__PURE__ */ F(
|
|
480
|
+
/* @__PURE__ */ F($e, {
|
|
481
|
+
icon: /* @__PURE__ */ F(Ce, {
|
|
450
482
|
size: 18,
|
|
451
|
-
color: u >=
|
|
483
|
+
color: u >= 8 ? "var(--border-color)" : "var(--text-muted)"
|
|
452
484
|
}),
|
|
453
485
|
title: "Zoom In",
|
|
454
486
|
onClick: d,
|
|
455
|
-
disabled: u >=
|
|
487
|
+
disabled: u >= 8
|
|
456
488
|
})
|
|
457
489
|
]
|
|
458
490
|
}),
|
|
@@ -462,10 +494,10 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
462
494
|
backgroundColor: "var(--border-color)",
|
|
463
495
|
margin: "0 4px"
|
|
464
496
|
} }),
|
|
465
|
-
/* @__PURE__ */ F(
|
|
466
|
-
icon: /* @__PURE__ */ F(
|
|
497
|
+
/* @__PURE__ */ F($e, {
|
|
498
|
+
icon: /* @__PURE__ */ F(ue, { size: 18 }),
|
|
467
499
|
title: "Pan Tool",
|
|
468
|
-
active:
|
|
500
|
+
active: Pe === "pan",
|
|
469
501
|
onClick: () => Ie.emit("action-set-tool", { tool: "pan" })
|
|
470
502
|
})
|
|
471
503
|
]
|
|
@@ -477,7 +509,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
477
509
|
height: "100%",
|
|
478
510
|
gap: "16px"
|
|
479
511
|
},
|
|
480
|
-
children:
|
|
512
|
+
children: Ze.filter((e) => e !== "Annotate" || me !== !1 && ye?.canAddAnnotations !== !1).map((n) => /* @__PURE__ */ F("div", {
|
|
481
513
|
onClick: () => t(n),
|
|
482
514
|
style: {
|
|
483
515
|
fontSize: "13px",
|
|
@@ -500,7 +532,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
500
532
|
gap: "8px"
|
|
501
533
|
},
|
|
502
534
|
children: [
|
|
503
|
-
|
|
535
|
+
Ae && /* @__PURE__ */ I("button", {
|
|
504
536
|
onClick: () => Ie.emit("action-sign"),
|
|
505
537
|
style: {
|
|
506
538
|
background: "#fff0f0",
|
|
@@ -517,13 +549,13 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
517
549
|
fontWeight: 600,
|
|
518
550
|
fontSize: "13px"
|
|
519
551
|
},
|
|
520
|
-
children: [/* @__PURE__ */ F(
|
|
552
|
+
children: [/* @__PURE__ */ F(Se, {
|
|
521
553
|
size: 14,
|
|
522
554
|
color: "#d32f2f",
|
|
523
555
|
fill: "#d32f2f"
|
|
524
556
|
}), "Sign"]
|
|
525
557
|
}),
|
|
526
|
-
|
|
558
|
+
k > 0 && /* @__PURE__ */ I("div", {
|
|
527
559
|
onClick: () => Ie.emit("action-verify"),
|
|
528
560
|
style: {
|
|
529
561
|
backgroundColor: "#10b981",
|
|
@@ -539,9 +571,9 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
539
571
|
},
|
|
540
572
|
title: "Verify Signatures",
|
|
541
573
|
children: [
|
|
542
|
-
/* @__PURE__ */ F(
|
|
574
|
+
/* @__PURE__ */ F(ke, { size: 16 }),
|
|
543
575
|
" Signed · ",
|
|
544
|
-
|
|
576
|
+
k
|
|
545
577
|
]
|
|
546
578
|
}),
|
|
547
579
|
/* @__PURE__ */ F("div", { style: {
|
|
@@ -550,19 +582,19 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
550
582
|
backgroundColor: "var(--border-color)",
|
|
551
583
|
margin: "0 4px"
|
|
552
584
|
} }),
|
|
553
|
-
/* @__PURE__ */ F(
|
|
554
|
-
icon: /* @__PURE__ */ F(
|
|
585
|
+
/* @__PURE__ */ F($e, {
|
|
586
|
+
icon: /* @__PURE__ */ F(E, { size: 18 }),
|
|
555
587
|
title: "About / Info",
|
|
556
588
|
onClick: ee
|
|
557
589
|
}),
|
|
558
|
-
/* @__PURE__ */ F(
|
|
559
|
-
icon: /* @__PURE__ */ F(
|
|
590
|
+
/* @__PURE__ */ F($e, {
|
|
591
|
+
icon: /* @__PURE__ */ F(De, { size: 18 }),
|
|
560
592
|
title: "Search",
|
|
561
593
|
active: a && l === "Search",
|
|
562
594
|
onClick: () => S("Search")
|
|
563
595
|
}),
|
|
564
|
-
/* @__PURE__ */ F(
|
|
565
|
-
icon: /* @__PURE__ */ F(
|
|
596
|
+
/* @__PURE__ */ F($e, {
|
|
597
|
+
icon: /* @__PURE__ */ F(he, { size: 18 }),
|
|
566
598
|
title: "Comments",
|
|
567
599
|
active: a && l === "Comments",
|
|
568
600
|
onClick: () => S("Comments")
|
|
@@ -573,7 +605,7 @@ function Be({ activeTab: e, setActiveTab: t, leftSidebarOpen: n, setLeftSidebarO
|
|
|
573
605
|
})
|
|
574
606
|
});
|
|
575
607
|
}
|
|
576
|
-
function
|
|
608
|
+
function $e({ icon: e, onClick: t, active: n = !1, disabled: r = !1, title: i }) {
|
|
577
609
|
return /* @__PURE__ */ F("button", {
|
|
578
610
|
title: i,
|
|
579
611
|
onClick: r ? void 0 : t,
|
|
@@ -627,7 +659,7 @@ function V({ icon: e, label: t, onClick: n, disabled: r = !1, selected: i = !1 }
|
|
|
627
659
|
}
|
|
628
660
|
//#endregion
|
|
629
661
|
//#region src/components/AnnotationContextMenu.tsx
|
|
630
|
-
function
|
|
662
|
+
function et({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor: i, onOpenLinkModal: a, permissions: o }) {
|
|
631
663
|
let s = o?.canAddAnnotations !== !1, c = o?.canEditAnnotations !== !1, l = o?.canDeleteAnnotations !== !1;
|
|
632
664
|
return /* @__PURE__ */ I("div", {
|
|
633
665
|
style: {
|
|
@@ -647,8 +679,8 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
|
|
|
647
679
|
},
|
|
648
680
|
onClick: (e) => e.stopPropagation(),
|
|
649
681
|
children: [
|
|
650
|
-
s && /* @__PURE__ */ I(
|
|
651
|
-
icon: /* @__PURE__ */ F(
|
|
682
|
+
s && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F(tt, {
|
|
683
|
+
icon: /* @__PURE__ */ F(te, { size: 16 }),
|
|
652
684
|
title: "Duplicate",
|
|
653
685
|
onClick: n
|
|
654
686
|
}), /* @__PURE__ */ F("div", { style: {
|
|
@@ -657,7 +689,7 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
|
|
|
657
689
|
backgroundColor: "#e5e7eb",
|
|
658
690
|
margin: "0 4px"
|
|
659
691
|
} })] }),
|
|
660
|
-
c && /* @__PURE__ */ I(
|
|
692
|
+
c && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
|
|
661
693
|
style: {
|
|
662
694
|
display: "flex",
|
|
663
695
|
alignItems: "center",
|
|
@@ -708,14 +740,14 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
|
|
|
708
740
|
},
|
|
709
741
|
onMouseEnter: (e) => e.currentTarget.style.backgroundColor = "#e0e7ff",
|
|
710
742
|
onMouseLeave: (e) => e.currentTarget.style.backgroundColor = "#eef2ff",
|
|
711
|
-
children: [/* @__PURE__ */ F(
|
|
712
|
-
}) : /* @__PURE__ */ F(
|
|
713
|
-
icon: /* @__PURE__ */ F(
|
|
743
|
+
children: [/* @__PURE__ */ F(re, { size: 14 }), "Edit Link"]
|
|
744
|
+
}) : /* @__PURE__ */ F(tt, {
|
|
745
|
+
icon: /* @__PURE__ */ F(O, { size: 16 }),
|
|
714
746
|
title: "Link URL or Page",
|
|
715
747
|
onClick: a
|
|
716
748
|
})),
|
|
717
|
-
l && /* @__PURE__ */ F(
|
|
718
|
-
icon: /* @__PURE__ */ F(
|
|
749
|
+
l && /* @__PURE__ */ F(tt, {
|
|
750
|
+
icon: /* @__PURE__ */ F(Me, { size: 16 }),
|
|
719
751
|
title: "Delete",
|
|
720
752
|
onClick: r,
|
|
721
753
|
color: "#ef4444"
|
|
@@ -723,7 +755,7 @@ function He({ annotation: e, position: t, onCopy: n, onDelete: r, onUpdateColor:
|
|
|
723
755
|
]
|
|
724
756
|
});
|
|
725
757
|
}
|
|
726
|
-
function
|
|
758
|
+
function tt({ icon: e, title: t, onClick: n, color: r = "#4b5563" }) {
|
|
727
759
|
return /* @__PURE__ */ F("button", {
|
|
728
760
|
title: t,
|
|
729
761
|
onClick: n,
|
|
@@ -746,7 +778,7 @@ function Ue({ icon: e, title: t, onClick: n, color: r = "#4b5563" }) {
|
|
|
746
778
|
}
|
|
747
779
|
//#endregion
|
|
748
780
|
//#region src/components/InsertLinkModal.tsx
|
|
749
|
-
function
|
|
781
|
+
function nt({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, onClose: r, onSave: i }) {
|
|
750
782
|
let a = e.startsWith("#page="), [o, s] = c(a ? "page" : "url"), [l, u] = c(a ? "" : e), [d, f] = c(a ? e.replace("#page=", "") : "1"), [p, m] = c(t), h = o === "url" ? !l.trim() : !d.trim(), g = () => {
|
|
751
783
|
if (h) return;
|
|
752
784
|
let e = o === "page" ? `#page=${d}` : l;
|
|
@@ -801,7 +833,7 @@ function We({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, on
|
|
|
801
833
|
cursor: "pointer",
|
|
802
834
|
color: "#6b7280"
|
|
803
835
|
},
|
|
804
|
-
children: /* @__PURE__ */ F(
|
|
836
|
+
children: /* @__PURE__ */ F(N, { size: 20 })
|
|
805
837
|
})]
|
|
806
838
|
}),
|
|
807
839
|
/* @__PURE__ */ I("div", {
|
|
@@ -974,7 +1006,7 @@ function We({ initialUrl: e = "", initialText: t = "", showTextInput: n = !1, on
|
|
|
974
1006
|
}
|
|
975
1007
|
//#endregion
|
|
976
1008
|
//#region src/hooks/useShortcuts.ts
|
|
977
|
-
var
|
|
1009
|
+
var rt = [
|
|
978
1010
|
{
|
|
979
1011
|
action: "ROTATE_CW",
|
|
980
1012
|
description: "Rotate the document clockwise",
|
|
@@ -1029,14 +1061,14 @@ var Ge = [
|
|
|
1029
1061
|
defaultCommand: "Delete",
|
|
1030
1062
|
command: "Delete"
|
|
1031
1063
|
}
|
|
1032
|
-
],
|
|
1033
|
-
function
|
|
1034
|
-
if (typeof window > "u" || !window.localStorage) return
|
|
1064
|
+
], it = "pdfviewer_shortcuts", H = "pdfviewer-shortcuts-changed", U = null, at = /* @__PURE__ */ new Set();
|
|
1065
|
+
function ot() {
|
|
1066
|
+
if (typeof window > "u" || !window.localStorage) return rt;
|
|
1035
1067
|
try {
|
|
1036
|
-
let e = window.localStorage.getItem(
|
|
1068
|
+
let e = window.localStorage.getItem(it);
|
|
1037
1069
|
if (e) {
|
|
1038
1070
|
let t = JSON.parse(e);
|
|
1039
|
-
if (Array.isArray(t)) return
|
|
1071
|
+
if (Array.isArray(t)) return rt.map((e) => {
|
|
1040
1072
|
let n = t.find((t) => t && t.action === e.action);
|
|
1041
1073
|
return n && typeof n.command == "string" ? {
|
|
1042
1074
|
...e,
|
|
@@ -1045,39 +1077,39 @@ function Xe() {
|
|
|
1045
1077
|
});
|
|
1046
1078
|
}
|
|
1047
1079
|
} catch {}
|
|
1048
|
-
return
|
|
1080
|
+
return rt;
|
|
1049
1081
|
}
|
|
1050
|
-
function
|
|
1051
|
-
|
|
1082
|
+
function st() {
|
|
1083
|
+
at.forEach((e) => e()), typeof window < "u" && window.dispatchEvent(new CustomEvent(H));
|
|
1052
1084
|
}
|
|
1053
|
-
function
|
|
1054
|
-
let [e, t] = c(() => (
|
|
1085
|
+
function ct() {
|
|
1086
|
+
let [e, t] = c(() => (U ||= ot(), U));
|
|
1055
1087
|
return i(() => {
|
|
1056
1088
|
let e = () => {
|
|
1057
|
-
|
|
1089
|
+
U = ot(), t(U);
|
|
1058
1090
|
};
|
|
1059
|
-
return
|
|
1060
|
-
|
|
1091
|
+
return at.add(e), typeof window < "u" && (window.addEventListener("storage", e), window.addEventListener(H, e)), () => {
|
|
1092
|
+
at.delete(e), typeof window < "u" && (window.removeEventListener("storage", e), window.removeEventListener(H, e));
|
|
1061
1093
|
};
|
|
1062
1094
|
}, []), {
|
|
1063
1095
|
shortcuts: e,
|
|
1064
1096
|
updateShortcut: n((e, n) => {
|
|
1065
|
-
let r = (
|
|
1097
|
+
let r = (U || ot()).map((t) => t.action === e ? {
|
|
1066
1098
|
...t,
|
|
1067
1099
|
command: n
|
|
1068
1100
|
} : t);
|
|
1069
|
-
|
|
1101
|
+
U = r, typeof window < "u" && window.localStorage && window.localStorage.setItem(it, JSON.stringify(r)), t(r), st();
|
|
1070
1102
|
}, []),
|
|
1071
1103
|
resetShortcuts: n(() => {
|
|
1072
|
-
|
|
1104
|
+
U = rt, typeof window < "u" && window.localStorage && window.localStorage.removeItem(it), t(rt), st();
|
|
1073
1105
|
}, []),
|
|
1074
1106
|
getCommand: n((t) => {
|
|
1075
|
-
let n = (
|
|
1107
|
+
let n = (U || e).find((e) => e.action === t);
|
|
1076
1108
|
return n ? n.command : "";
|
|
1077
1109
|
}, [e])
|
|
1078
1110
|
};
|
|
1079
1111
|
}
|
|
1080
|
-
function
|
|
1112
|
+
function lt(e) {
|
|
1081
1113
|
if (!e) return {
|
|
1082
1114
|
meta: !1,
|
|
1083
1115
|
shift: !1,
|
|
@@ -1096,16 +1128,16 @@ function $e(e) {
|
|
|
1096
1128
|
key: a.join("+").toLowerCase()
|
|
1097
1129
|
};
|
|
1098
1130
|
}
|
|
1099
|
-
function
|
|
1131
|
+
function ut(e, t) {
|
|
1100
1132
|
if (!t) return !1;
|
|
1101
|
-
let n =
|
|
1133
|
+
let n = lt(t), r = !!(e.metaKey || e.ctrlKey);
|
|
1102
1134
|
if (n.meta !== r || n.alt !== !!e.altKey) return !1;
|
|
1103
1135
|
let i = (e.key || "").toLowerCase(), a = n.key.toLowerCase();
|
|
1104
1136
|
return a === "delete" || a === "backspace" ? n.shift === !!e.shiftKey ? i === "delete" || i === "backspace" : !1 : a === "=" || a === "+" ? !(i !== "=" && i !== "+" && e.code !== "Equal" && e.code !== "NumpadAdd" || n.shift && !e.shiftKey || !n.shift && a === "=" && e.shiftKey) : a === "-" || a === "_" ? !(i !== "-" && i !== "_" && e.code !== "Minus" && e.code !== "NumpadSubtract" || n.shift && !e.shiftKey || !n.shift && a === "-" && e.shiftKey) : n.shift === !!e.shiftKey && !!(i === a || e.code && e.code.toLowerCase() === `key${a}` || e.code && e.code.toLowerCase() === `digit${a}`);
|
|
1105
1137
|
}
|
|
1106
1138
|
//#endregion
|
|
1107
1139
|
//#region src/hooks/usePdfSearch.ts
|
|
1108
|
-
async function
|
|
1140
|
+
async function dt(e, t, n = [], r) {
|
|
1109
1141
|
if (!e || !t.trim()) return [];
|
|
1110
1142
|
let i = [], a = t.toLowerCase(), o = e.numPages;
|
|
1111
1143
|
for (let s = 1; s <= o; s += 10) {
|
|
@@ -1182,7 +1214,7 @@ async function tt(e, t, n = [], r) {
|
|
|
1182
1214
|
}
|
|
1183
1215
|
return i;
|
|
1184
1216
|
}
|
|
1185
|
-
function
|
|
1217
|
+
function ft(e, t = []) {
|
|
1186
1218
|
let [r, i] = c(!1), [a, o] = c([]), [s, l] = c(0);
|
|
1187
1219
|
return {
|
|
1188
1220
|
search: n(async (n) => {
|
|
@@ -1192,7 +1224,7 @@ function nt(e, t = []) {
|
|
|
1192
1224
|
}
|
|
1193
1225
|
i(!0), l(0);
|
|
1194
1226
|
try {
|
|
1195
|
-
let r = await
|
|
1227
|
+
let r = await dt(e, n, t, (e) => l(e));
|
|
1196
1228
|
o(r);
|
|
1197
1229
|
} catch (e) {
|
|
1198
1230
|
console.error("Search error:", e);
|
|
@@ -1208,7 +1240,7 @@ function nt(e, t = []) {
|
|
|
1208
1240
|
}
|
|
1209
1241
|
//#endregion
|
|
1210
1242
|
//#region src/components/Sidebar.tsx
|
|
1211
|
-
function
|
|
1243
|
+
function pt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId: r, setSelectedAnnotationId: a, onSearch: o, searchResults: l, isSearching: u, searchProgress: d, onResultClick: f, activeTab: p, setActiveTab: m }) {
|
|
1212
1244
|
let [h, g] = c(""), [_, v] = c(320), [y, b] = c(!1), x = s(null);
|
|
1213
1245
|
i(() => {
|
|
1214
1246
|
let e = (e) => {
|
|
@@ -1309,7 +1341,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1309
1341
|
marginBottom: "16px"
|
|
1310
1342
|
},
|
|
1311
1343
|
children: [
|
|
1312
|
-
/* @__PURE__ */ F(
|
|
1344
|
+
/* @__PURE__ */ F(De, {
|
|
1313
1345
|
size: 16,
|
|
1314
1346
|
color: "#64748b",
|
|
1315
1347
|
style: {
|
|
@@ -1353,7 +1385,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1353
1385
|
color: "var(--text-muted)"
|
|
1354
1386
|
},
|
|
1355
1387
|
title: "Clear search",
|
|
1356
|
-
children: /* @__PURE__ */ F(
|
|
1388
|
+
children: /* @__PURE__ */ F(N, { size: 14 })
|
|
1357
1389
|
})
|
|
1358
1390
|
]
|
|
1359
1391
|
})]
|
|
@@ -1366,7 +1398,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1366
1398
|
flexDirection: "column",
|
|
1367
1399
|
gap: "8px"
|
|
1368
1400
|
},
|
|
1369
|
-
children: [p === "Comments" && /* @__PURE__ */ I(
|
|
1401
|
+
children: [p === "Comments" && /* @__PURE__ */ I(P, { children: [ee.length === 0 && /* @__PURE__ */ F("div", {
|
|
1370
1402
|
style: {
|
|
1371
1403
|
color: "var(--text-muted)",
|
|
1372
1404
|
fontSize: "13px",
|
|
@@ -1399,10 +1431,10 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1399
1431
|
color: "var(--text-muted)"
|
|
1400
1432
|
},
|
|
1401
1433
|
children: [
|
|
1402
|
-
e.type === "note" && /* @__PURE__ */ F(
|
|
1403
|
-
e.type === "callout" && /* @__PURE__ */ F(
|
|
1404
|
-
e.type === "text" && /* @__PURE__ */ F(
|
|
1405
|
-
e.type === "link" && /* @__PURE__ */ F(
|
|
1434
|
+
e.type === "note" && /* @__PURE__ */ F(he, { size: 14 }),
|
|
1435
|
+
e.type === "callout" && /* @__PURE__ */ F(me, { size: 14 }),
|
|
1436
|
+
e.type === "text" && /* @__PURE__ */ F(Ne, { size: 14 }),
|
|
1437
|
+
e.type === "link" && /* @__PURE__ */ F(O, { size: 14 }),
|
|
1406
1438
|
/* @__PURE__ */ F("span", {
|
|
1407
1439
|
style: {
|
|
1408
1440
|
fontSize: "12px",
|
|
@@ -1430,7 +1462,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1430
1462
|
padding: "4px"
|
|
1431
1463
|
},
|
|
1432
1464
|
title: "Delete Comment",
|
|
1433
|
-
children: /* @__PURE__ */ F(
|
|
1465
|
+
children: /* @__PURE__ */ F(Me, { size: 14 })
|
|
1434
1466
|
})]
|
|
1435
1467
|
}), /* @__PURE__ */ F("div", {
|
|
1436
1468
|
style: {
|
|
@@ -1462,7 +1494,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1462
1494
|
children: "Empty comment"
|
|
1463
1495
|
})
|
|
1464
1496
|
})]
|
|
1465
|
-
}, e.id))] }), p === "Search" && /* @__PURE__ */ I(
|
|
1497
|
+
}, e.id))] }), p === "Search" && /* @__PURE__ */ I(P, { children: [
|
|
1466
1498
|
u && /* @__PURE__ */ I("div", {
|
|
1467
1499
|
style: {
|
|
1468
1500
|
fontSize: "13px",
|
|
@@ -1589,7 +1621,7 @@ function rt({ isOpen: e, annotations: t, setAnnotations: n, selectedAnnotationId
|
|
|
1589
1621
|
}
|
|
1590
1622
|
//#endregion
|
|
1591
1623
|
//#region src/components/LeftSidebar.tsx
|
|
1592
|
-
var
|
|
1624
|
+
var mt = ({ pdfDoc: e, pageIndex: t, isActive: n, onClick: r, scale: a }) => {
|
|
1593
1625
|
let o = s(null), l = s(null), [u, d] = c(!1), [f, p] = c(.77);
|
|
1594
1626
|
i(() => {
|
|
1595
1627
|
let e = new IntersectionObserver((e) => {
|
|
@@ -1678,7 +1710,7 @@ var it = ({ pdfDoc: e, pageIndex: t, isActive: n, onClick: r, scale: a }) => {
|
|
|
1678
1710
|
})]
|
|
1679
1711
|
});
|
|
1680
1712
|
};
|
|
1681
|
-
function
|
|
1713
|
+
function ht({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
1682
1714
|
let [a, o] = c("Thumbnails"), [s, l] = c(250), [u, d] = c(!1), [f, m] = c(30), h = .1 + f / 100 * .3;
|
|
1683
1715
|
i(() => {
|
|
1684
1716
|
let e = (e) => {
|
|
@@ -1734,7 +1766,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1734
1766
|
justifyContent: "center"
|
|
1735
1767
|
},
|
|
1736
1768
|
title: "Page Thumbnails",
|
|
1737
|
-
children: /* @__PURE__ */ F(
|
|
1769
|
+
children: /* @__PURE__ */ F(te, { size: 16 })
|
|
1738
1770
|
}),
|
|
1739
1771
|
/* @__PURE__ */ F("button", {
|
|
1740
1772
|
onClick: () => o("Outline"),
|
|
@@ -1750,7 +1782,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1750
1782
|
justifyContent: "center"
|
|
1751
1783
|
},
|
|
1752
1784
|
title: "Document Outline",
|
|
1753
|
-
children: /* @__PURE__ */ F(
|
|
1785
|
+
children: /* @__PURE__ */ F(k, { size: 16 })
|
|
1754
1786
|
}),
|
|
1755
1787
|
/* @__PURE__ */ F("button", {
|
|
1756
1788
|
onClick: () => o("Bookmarks"),
|
|
@@ -1781,11 +1813,11 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1781
1813
|
justifyContent: "center"
|
|
1782
1814
|
},
|
|
1783
1815
|
title: "More Options",
|
|
1784
|
-
children: /* @__PURE__ */ F(
|
|
1816
|
+
children: /* @__PURE__ */ F(ye, { size: 16 })
|
|
1785
1817
|
})
|
|
1786
1818
|
]
|
|
1787
1819
|
}),
|
|
1788
|
-
a === "Thumbnails" && /* @__PURE__ */ I(
|
|
1820
|
+
a === "Thumbnails" && /* @__PURE__ */ I(P, { children: [
|
|
1789
1821
|
/* @__PURE__ */ I("div", {
|
|
1790
1822
|
style: {
|
|
1791
1823
|
display: "flex",
|
|
@@ -1796,7 +1828,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1796
1828
|
backgroundColor: "#fff"
|
|
1797
1829
|
},
|
|
1798
1830
|
children: [
|
|
1799
|
-
/* @__PURE__ */ F(
|
|
1831
|
+
/* @__PURE__ */ F(_e, {
|
|
1800
1832
|
size: 14,
|
|
1801
1833
|
color: "var(--text-muted)",
|
|
1802
1834
|
style: { cursor: "pointer" },
|
|
@@ -1814,7 +1846,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1814
1846
|
accentColor: "var(--primary)"
|
|
1815
1847
|
}
|
|
1816
1848
|
}),
|
|
1817
|
-
/* @__PURE__ */ F(
|
|
1849
|
+
/* @__PURE__ */ F(A, {
|
|
1818
1850
|
size: 14,
|
|
1819
1851
|
color: "var(--text-muted)",
|
|
1820
1852
|
style: { cursor: "pointer" },
|
|
@@ -1829,7 +1861,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1829
1861
|
padding: "8px 0",
|
|
1830
1862
|
backgroundColor: "#f1f1f1"
|
|
1831
1863
|
},
|
|
1832
|
-
children: [t && v.map((e) => /* @__PURE__ */ F(
|
|
1864
|
+
children: [t && v.map((e) => /* @__PURE__ */ F(mt, {
|
|
1833
1865
|
pdfDoc: t,
|
|
1834
1866
|
pageIndex: e,
|
|
1835
1867
|
isActive: e === n,
|
|
@@ -1921,7 +1953,7 @@ function at({ isOpen: e, pdfDoc: t, pageNum: n, setPageNum: r }) {
|
|
|
1921
1953
|
}
|
|
1922
1954
|
//#endregion
|
|
1923
1955
|
//#region src/utils/rotationUtils.ts
|
|
1924
|
-
function
|
|
1956
|
+
function gt(e, t, n, r, i) {
|
|
1925
1957
|
let a = (n % 360 + 360) % 360;
|
|
1926
1958
|
return a === 90 ? {
|
|
1927
1959
|
x: t,
|
|
@@ -1937,7 +1969,7 @@ function ot(e, t, n, r, i) {
|
|
|
1937
1969
|
y: t
|
|
1938
1970
|
};
|
|
1939
1971
|
}
|
|
1940
|
-
function
|
|
1972
|
+
function _t(e, t, n, r, i) {
|
|
1941
1973
|
let a = (n % 360 + 360) % 360;
|
|
1942
1974
|
return a === 90 ? {
|
|
1943
1975
|
x: i - t,
|
|
@@ -1953,7 +1985,7 @@ function st(e, t, n, r, i) {
|
|
|
1953
1985
|
y: t
|
|
1954
1986
|
};
|
|
1955
1987
|
}
|
|
1956
|
-
function
|
|
1988
|
+
function vt(e, t, n, r, i, a, o) {
|
|
1957
1989
|
let s = (i % 360 + 360) % 360;
|
|
1958
1990
|
return s === 90 ? {
|
|
1959
1991
|
x: o - (t + r),
|
|
@@ -1977,64 +2009,43 @@ function H(e, t, n, r, i, a, o) {
|
|
|
1977
2009
|
height: r
|
|
1978
2010
|
};
|
|
1979
2011
|
}
|
|
1980
|
-
function
|
|
2012
|
+
function yt(e, t, n) {
|
|
1981
2013
|
let r = (e % 360 + 360) % 360;
|
|
1982
2014
|
if (r === 90) return `translate(${n}, 0) rotate(90)`;
|
|
1983
2015
|
if (r === 180) return `translate(${t}, ${n}) rotate(180)`;
|
|
1984
2016
|
if (r === 270) return `translate(0, ${t}) rotate(270)`;
|
|
1985
2017
|
}
|
|
1986
|
-
function
|
|
2018
|
+
function bt(e) {
|
|
1987
2019
|
return (e % 360 + 360) % 360;
|
|
1988
2020
|
}
|
|
1989
2021
|
//#endregion
|
|
1990
|
-
//#region src/utils/zoomUtils.ts
|
|
1991
|
-
var ut = .1, dt = 10, ft = () => typeof navigator < "u" && (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Mobile|Tablet/i.test(navigator.userAgent) || /^((?!chrome|android).)*safari/i.test(navigator.userAgent)), pt = 4096, mt = 2048, ht = 8388608, gt = 4194304;
|
|
1992
|
-
function _t(e, t = 10) {
|
|
1993
|
-
return Math.min(t, Math.round((e + (e < 2 ? .25 : e < 5 ? .5 : 1)) * 100) / 100);
|
|
1994
|
-
}
|
|
1995
|
-
function vt(e, t = ut) {
|
|
1996
|
-
return Math.max(t, Math.round((e - (e <= 2 ? .25 : e <= 5 ? .5 : 1)) * 100) / 100);
|
|
1997
|
-
}
|
|
1998
|
-
function yt(e, t = ut, n = 10) {
|
|
1999
|
-
return Math.min(n, Math.max(t, Math.round(e * 100) / 100));
|
|
2000
|
-
}
|
|
2001
|
-
function bt(e, t, n, r, i = ft() ? mt : pt, a = ft() ? gt : ht) {
|
|
2002
|
-
let o = e * t;
|
|
2003
|
-
return n * o > i && (o = i / n), r * o > i && (o = i / r), n * o * (r * o) > a && (o = Math.sqrt(a / (n * r))), o;
|
|
2004
|
-
}
|
|
2005
|
-
function xt(e) {
|
|
2006
|
-
let { prevScale: t, newScale: n, containerWidth: r, containerHeight: i, currentScrollLeft: a, currentScrollTop: o, basePageWidth: s, focusPoint: c, isProgrammatic: l = !1 } = e;
|
|
2007
|
-
if (l) return {
|
|
2008
|
-
scrollLeft: 0,
|
|
2009
|
-
scrollTop: o <= 1 ? 0 : o
|
|
2010
|
-
};
|
|
2011
|
-
let u = c?.vx != null && c?.vy != null;
|
|
2012
|
-
if (!u && o <= 0) return {
|
|
2013
|
-
scrollLeft: 0,
|
|
2014
|
-
scrollTop: 0
|
|
2015
|
-
};
|
|
2016
|
-
let d = u ? c.vx : r / 2, f = u ? c.vy : i / 2, p = d + a, m = f + o, h = Math.max(0, r / 2 - s * t / 2), g = Math.max(0, r / 2 - s * n / 2) + (p - h) * (n / t);
|
|
2017
|
-
return {
|
|
2018
|
-
scrollLeft: Math.max(0, g - d),
|
|
2019
|
-
scrollTop: Math.max(0, n / t * m - f)
|
|
2020
|
-
};
|
|
2021
|
-
}
|
|
2022
|
-
//#endregion
|
|
2023
2022
|
//#region src/components/PageRenderer.tsx
|
|
2024
|
-
function
|
|
2025
|
-
let
|
|
2026
|
-
|
|
2027
|
-
let
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2023
|
+
function xt({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, containerHeight: l, scrollTop: u, scrollLeft: d, pageTop: f, pageLeft: p = 0, basePageWidth: m, basePageHeight: h, activeTab: g, activeTool: _, annotations: v, selectedAnnotationId: y, activeSearchResult: b, transientHighlights: x, onMouseDown: ee, onMouseMove: S, onMouseUp: te, onAnnotationClick: ne, onAnnotationMouseEnter: re, onClearSelection: ie, watermark: ae, watermarkText: oe, redactions: C, onDiscardRedaction: se, onRendered: ce, hideAnnotationsUntilPageRendered: le = !0 }) {
|
|
2024
|
+
let w = s(ce);
|
|
2025
|
+
w.current = ce;
|
|
2026
|
+
let ue = s(null), T = s(null), E = s(null), D = s(null), O = s(!1), [k, de] = c(!1), [fe, pe] = c(null), me = m * r, he = h * r, [ge, _e] = c({
|
|
2027
|
+
pdfDoc: n,
|
|
2028
|
+
pageNum: t,
|
|
2029
|
+
rotation: a
|
|
2030
|
+
});
|
|
2031
|
+
(ge.pdfDoc !== n || ge.pageNum !== t || ge.rotation !== a) && (_e({
|
|
2032
|
+
pdfDoc: n,
|
|
2033
|
+
pageNum: t,
|
|
2034
|
+
rotation: a
|
|
2035
|
+
}), de(!1)), i(() => {
|
|
2036
|
+
O.current = !1;
|
|
2037
|
+
}, [
|
|
2038
|
+
n,
|
|
2039
|
+
t,
|
|
2040
|
+
a
|
|
2041
|
+
]), i(() => {
|
|
2031
2042
|
let e = !1, i = null, o = async () => {
|
|
2032
|
-
if (!
|
|
2033
|
-
if (
|
|
2043
|
+
if (!ue.current || !n) return;
|
|
2044
|
+
if (E.current) {
|
|
2034
2045
|
try {
|
|
2035
|
-
|
|
2046
|
+
E.current.cancel();
|
|
2036
2047
|
} catch {}
|
|
2037
|
-
|
|
2048
|
+
E.current = null;
|
|
2038
2049
|
}
|
|
2039
2050
|
let i = null;
|
|
2040
2051
|
try {
|
|
@@ -2045,11 +2056,11 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2045
2056
|
} catch {}
|
|
2046
2057
|
return;
|
|
2047
2058
|
}
|
|
2048
|
-
i = o,
|
|
2049
|
-
let s = Math.min(window.devicePixelRatio || 1, 2), c =
|
|
2059
|
+
i = o, D.current = o;
|
|
2060
|
+
let s = Math.min(window.devicePixelRatio || 1, 2), c = bt(o.rotate + a), l = o.getViewport({
|
|
2050
2061
|
scale: 1,
|
|
2051
2062
|
rotation: c
|
|
2052
|
-
}), u =
|
|
2063
|
+
}), u = Ye(r, s, l.width, l.height), d = o.getViewport({
|
|
2053
2064
|
scale: u,
|
|
2054
2065
|
rotation: c
|
|
2055
2066
|
}), f = document.createElement("canvas");
|
|
@@ -2067,17 +2078,17 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2067
2078
|
canvas: f,
|
|
2068
2079
|
viewport: d
|
|
2069
2080
|
});
|
|
2070
|
-
if (
|
|
2081
|
+
if (E.current = g, await g.promise, E.current = null, C && C.length > 0) {
|
|
2071
2082
|
p.save(), p.setTransform(1, 0, 0, 1, 0, 0);
|
|
2072
2083
|
let e = a % 180 == 0 ? m : h, n = a % 180 == 0 ? h : m;
|
|
2073
|
-
for (let i of
|
|
2074
|
-
let t =
|
|
2084
|
+
for (let i of C) if (i.pageIndex === t) {
|
|
2085
|
+
let t = vt(i.x, i.y, i.width, i.height, a, e, n), o = t.x * u, s = t.y * u, c = t.width * u, l = t.height * u;
|
|
2075
2086
|
i.status === "applied" || i.status === void 0 ? (p.fillStyle = "#000000", p.fillRect(Math.floor(o), Math.floor(s), Math.ceil(c), Math.ceil(l))) : (p.fillStyle = "rgba(0, 0, 0, 0.45)", p.fillRect(Math.floor(o), Math.floor(s), Math.ceil(c), Math.ceil(l)), p.lineWidth = Math.max(1, u / (r || 1) * 2), p.strokeStyle = "#dc2626", p.strokeRect(Math.floor(o), Math.floor(s), Math.ceil(c), Math.ceil(l)));
|
|
2076
2087
|
}
|
|
2077
2088
|
p.restore();
|
|
2078
2089
|
}
|
|
2079
|
-
let _ =
|
|
2080
|
-
text:
|
|
2090
|
+
let _ = ae || (oe ? {
|
|
2091
|
+
text: oe,
|
|
2081
2092
|
opacity: .15,
|
|
2082
2093
|
size: 24,
|
|
2083
2094
|
mode: "tiled",
|
|
@@ -2099,11 +2110,11 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2099
2110
|
}
|
|
2100
2111
|
p.restore();
|
|
2101
2112
|
}
|
|
2102
|
-
let v =
|
|
2113
|
+
let v = ue.current;
|
|
2103
2114
|
if (v && !e) {
|
|
2104
2115
|
v.width = f.width, v.height = f.height;
|
|
2105
2116
|
let e = v.getContext("2d");
|
|
2106
|
-
e && e.drawImage(f, 0, 0),
|
|
2117
|
+
e && e.drawImage(f, 0, 0), O.current = !0, de(!0), w.current?.(t);
|
|
2107
2118
|
}
|
|
2108
2119
|
f.width = 0, f.height = 0;
|
|
2109
2120
|
} catch (e) {
|
|
@@ -2112,21 +2123,21 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2112
2123
|
if (i) try {
|
|
2113
2124
|
i.cleanup?.();
|
|
2114
2125
|
} catch {}
|
|
2115
|
-
|
|
2126
|
+
D.current === i && (D.current = null);
|
|
2116
2127
|
}
|
|
2117
|
-
}, s =
|
|
2128
|
+
}, s = O.current ? 150 : 0;
|
|
2118
2129
|
return i = setTimeout(o, s), () => {
|
|
2119
|
-
if (e = !0, i && clearTimeout(i),
|
|
2130
|
+
if (e = !0, i && clearTimeout(i), E.current) {
|
|
2120
2131
|
try {
|
|
2121
|
-
|
|
2132
|
+
E.current.cancel();
|
|
2122
2133
|
} catch {}
|
|
2123
|
-
|
|
2134
|
+
E.current = null;
|
|
2124
2135
|
}
|
|
2125
|
-
if (
|
|
2136
|
+
if (D.current) {
|
|
2126
2137
|
try {
|
|
2127
|
-
|
|
2138
|
+
D.current.cleanup?.();
|
|
2128
2139
|
} catch {}
|
|
2129
|
-
|
|
2140
|
+
D.current = null;
|
|
2130
2141
|
}
|
|
2131
2142
|
};
|
|
2132
2143
|
}, [
|
|
@@ -2136,16 +2147,16 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2136
2147
|
a,
|
|
2137
2148
|
m,
|
|
2138
2149
|
h,
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2150
|
+
ae,
|
|
2151
|
+
oe,
|
|
2152
|
+
C
|
|
2142
2153
|
]), i(() => {
|
|
2143
2154
|
let e = !1;
|
|
2144
2155
|
return (async () => {
|
|
2145
2156
|
try {
|
|
2146
2157
|
let r = await (await n.getPage(t)).getTextContent();
|
|
2147
|
-
if (
|
|
2148
|
-
let e =
|
|
2158
|
+
if (C && C.length > 0) {
|
|
2159
|
+
let e = C.filter((e) => e.pageIndex === t);
|
|
2149
2160
|
e.length > 0 && (r.items = r.items.filter((t) => {
|
|
2150
2161
|
if (t.str.trim() === "") return !0;
|
|
2151
2162
|
let n = t.transform[4], r = t.transform[5], i = t.width, a = t.height;
|
|
@@ -2156,7 +2167,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2156
2167
|
return !0;
|
|
2157
2168
|
}));
|
|
2158
2169
|
}
|
|
2159
|
-
e ||
|
|
2170
|
+
e || pe(r);
|
|
2160
2171
|
} catch {}
|
|
2161
2172
|
})(), () => {
|
|
2162
2173
|
e = !0;
|
|
@@ -2164,19 +2175,19 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2164
2175
|
}, [
|
|
2165
2176
|
n,
|
|
2166
2177
|
t,
|
|
2167
|
-
|
|
2178
|
+
C
|
|
2168
2179
|
]), i(() => {
|
|
2169
|
-
let e =
|
|
2170
|
-
!
|
|
2180
|
+
let e = T.current;
|
|
2181
|
+
!fe || !e || (async () => {
|
|
2171
2182
|
try {
|
|
2172
2183
|
let r = await n.getPage(t), i = r.getViewport({
|
|
2173
2184
|
scale: 1,
|
|
2174
|
-
rotation:
|
|
2175
|
-
}), o =
|
|
2176
|
-
if (
|
|
2177
|
-
let e =
|
|
2185
|
+
rotation: bt(r.rotate + a)
|
|
2186
|
+
}), o = fe;
|
|
2187
|
+
if (C && C.length > 0) {
|
|
2188
|
+
let e = C.filter((e) => e.pageIndex === t);
|
|
2178
2189
|
if (e.length > 0) {
|
|
2179
|
-
let t =
|
|
2190
|
+
let t = fe.items.filter((t) => {
|
|
2180
2191
|
if (!t.str || t.str.trim() === "") return !0;
|
|
2181
2192
|
let n = t.transform[4], r = t.transform[5], a = t.width, o = t.height || Math.abs(t.transform[3]), s = i.height - r - o;
|
|
2182
2193
|
for (let t of e) {
|
|
@@ -2186,7 +2197,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2186
2197
|
return !0;
|
|
2187
2198
|
});
|
|
2188
2199
|
o = {
|
|
2189
|
-
...
|
|
2200
|
+
...fe,
|
|
2190
2201
|
items: t
|
|
2191
2202
|
};
|
|
2192
2203
|
}
|
|
@@ -2201,32 +2212,32 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2201
2212
|
}
|
|
2202
2213
|
})();
|
|
2203
2214
|
}, [
|
|
2204
|
-
|
|
2215
|
+
fe,
|
|
2205
2216
|
n,
|
|
2206
2217
|
t,
|
|
2207
2218
|
a,
|
|
2208
|
-
|
|
2219
|
+
C
|
|
2209
2220
|
]);
|
|
2210
|
-
let
|
|
2221
|
+
let ve = v.filter((e) => e.pageIndex === t), ye = !le || k;
|
|
2211
2222
|
return /* @__PURE__ */ I("div", {
|
|
2212
2223
|
id: `pdf-page-${t}`,
|
|
2213
2224
|
className: "pdf-page-container",
|
|
2214
2225
|
onClick: () => {
|
|
2215
|
-
_ === null &&
|
|
2226
|
+
_ === null && ie();
|
|
2216
2227
|
},
|
|
2217
2228
|
style: {
|
|
2218
2229
|
position: "absolute",
|
|
2219
2230
|
top: `${f}px`,
|
|
2220
2231
|
left: p === void 0 ? "0px" : `${p}px`,
|
|
2221
|
-
width: `${
|
|
2222
|
-
height: `${
|
|
2232
|
+
width: `${me}px`,
|
|
2233
|
+
height: `${he}px`,
|
|
2223
2234
|
backgroundColor: "#fff",
|
|
2224
2235
|
boxShadow: "0 2px 10px rgba(0,0,0,0.1)",
|
|
2225
2236
|
marginBottom: "16px"
|
|
2226
2237
|
},
|
|
2227
2238
|
children: [
|
|
2228
2239
|
/* @__PURE__ */ F("canvas", {
|
|
2229
|
-
ref:
|
|
2240
|
+
ref: ue,
|
|
2230
2241
|
style: {
|
|
2231
2242
|
position: "absolute",
|
|
2232
2243
|
width: "100%",
|
|
@@ -2236,7 +2247,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2236
2247
|
}
|
|
2237
2248
|
}),
|
|
2238
2249
|
/* @__PURE__ */ F("div", {
|
|
2239
|
-
ref:
|
|
2250
|
+
ref: T,
|
|
2240
2251
|
className: "textLayer",
|
|
2241
2252
|
style: {
|
|
2242
2253
|
position: "absolute",
|
|
@@ -2244,8 +2255,9 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2244
2255
|
left: 0,
|
|
2245
2256
|
transform: `scale(${r})`,
|
|
2246
2257
|
transformOrigin: "top left",
|
|
2247
|
-
pointerEvents: "auto",
|
|
2248
|
-
opacity:
|
|
2258
|
+
pointerEvents: ye ? "auto" : "none",
|
|
2259
|
+
opacity: +!!ye,
|
|
2260
|
+
visibility: ye ? "visible" : "hidden",
|
|
2249
2261
|
width: `${m}px`,
|
|
2250
2262
|
height: `${h}px`
|
|
2251
2263
|
}
|
|
@@ -2260,12 +2272,14 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2260
2272
|
width: "100%",
|
|
2261
2273
|
height: "100%",
|
|
2262
2274
|
pointerEvents: "none",
|
|
2263
|
-
zIndex: 6
|
|
2275
|
+
zIndex: 6,
|
|
2276
|
+
visibility: ye ? "visible" : "hidden",
|
|
2277
|
+
opacity: +!!ye
|
|
2264
2278
|
},
|
|
2265
2279
|
children: [
|
|
2266
2280
|
/* @__PURE__ */ F("style", { children: "\n @keyframes tspdf-transient-pulse {\n 0% {\n box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.75), 0 0 8px rgba(234, 179, 8, 0.4);\n }\n 50% {\n box-shadow: 0 0 0 6px rgba(234, 179, 8, 0.25), 0 0 18px rgba(234, 179, 8, 0.7);\n }\n 100% {\n box-shadow: 0 0 0 0 rgba(234, 179, 8, 0.75), 0 0 8px rgba(234, 179, 8, 0.4);\n }\n }\n " }),
|
|
2267
2281
|
b && b.pageIndex === t && b.bounds.map((e, t) => {
|
|
2268
|
-
let o =
|
|
2282
|
+
let o = vt(e.x, i - e.y - e.height, e.width, e.height, a, n, i);
|
|
2269
2283
|
return /* @__PURE__ */ F("div", { style: {
|
|
2270
2284
|
position: "absolute",
|
|
2271
2285
|
left: `${o.x * r}px`,
|
|
@@ -2279,7 +2293,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2279
2293
|
} }, `search-${t}`);
|
|
2280
2294
|
}),
|
|
2281
2295
|
x && x.filter((e) => e.pageIndex === t).map((t, o) => /* @__PURE__ */ F(e.Fragment, { children: t.bounds.map((e, o) => {
|
|
2282
|
-
let s =
|
|
2296
|
+
let s = vt(e.x, i - e.y - e.height, e.width, e.height, a, n, i), c = t.color || "rgba(250, 204, 21, 0.45)", l = t.borderColor || "rgba(234, 179, 8, 0.85)";
|
|
2283
2297
|
return /* @__PURE__ */ F("div", {
|
|
2284
2298
|
style: {
|
|
2285
2299
|
position: "absolute",
|
|
@@ -2320,7 +2334,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2320
2334
|
});
|
|
2321
2335
|
})(),
|
|
2322
2336
|
(() => {
|
|
2323
|
-
let n =
|
|
2337
|
+
let n = yt(a, a % 180 == 0 ? m : h, a % 180 == 0 ? h : m);
|
|
2324
2338
|
return /* @__PURE__ */ F("svg", {
|
|
2325
2339
|
style: {
|
|
2326
2340
|
position: "absolute",
|
|
@@ -2329,26 +2343,28 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2329
2343
|
width: "100%",
|
|
2330
2344
|
height: "100%",
|
|
2331
2345
|
cursor: ["Annotate", "Shapes"].includes(g) && _ ? _ === "eraser" ? "cell" : "crosshair" : "default",
|
|
2332
|
-
pointerEvents: _ === null || _ === "pan" ? "none" : "auto",
|
|
2333
|
-
zIndex: 10
|
|
2346
|
+
pointerEvents: _ === null || _ === "pan" || !ye ? "none" : "auto",
|
|
2347
|
+
zIndex: 10,
|
|
2348
|
+
visibility: ye ? "visible" : "hidden",
|
|
2349
|
+
opacity: +!!ye
|
|
2334
2350
|
},
|
|
2335
2351
|
viewBox: `0 0 ${m} ${h}`,
|
|
2336
2352
|
onMouseDown: (e) => ee(e, t),
|
|
2337
2353
|
onMouseMove: (e) => S(e, t),
|
|
2338
|
-
onMouseUp: (e) =>
|
|
2339
|
-
onMouseLeave: (e) =>
|
|
2354
|
+
onMouseUp: (e) => te(e, t),
|
|
2355
|
+
onMouseLeave: (e) => te(e, t),
|
|
2340
2356
|
children: /* @__PURE__ */ F("g", {
|
|
2341
2357
|
transform: n,
|
|
2342
|
-
children: /* @__PURE__ */ I(e.Fragment, { children: [
|
|
2358
|
+
children: /* @__PURE__ */ I(e.Fragment, { children: [ve.map((t) => {
|
|
2343
2359
|
let n = t.type === "text" || t.type === "callout" ? "transparent" : `${t.color}${Math.floor(t.opacity * 255).toString(16).padStart(2, "0")}`, r = t.color, i = y === t.id, a = (t.type === "highlight" || t.opacity < 1) && ![
|
|
2344
2360
|
"text",
|
|
2345
2361
|
"note",
|
|
2346
2362
|
"callout",
|
|
2347
2363
|
"signature"
|
|
2348
2364
|
].includes(t.type) ? "multiply" : "normal", o = {
|
|
2349
|
-
onMouseEnter: () =>
|
|
2365
|
+
onMouseEnter: () => re(t.id),
|
|
2350
2366
|
onClick: (e) => {
|
|
2351
|
-
|
|
2367
|
+
ne(t.id, e);
|
|
2352
2368
|
},
|
|
2353
2369
|
style: {
|
|
2354
2370
|
pointerEvents: "all",
|
|
@@ -2667,10 +2683,10 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2667
2683
|
strokeDasharray: "4"
|
|
2668
2684
|
})]
|
|
2669
2685
|
}, t.id);
|
|
2670
|
-
}),
|
|
2686
|
+
}), C && C.filter((e) => e.pageIndex === t && e.status === "pending").map((e, t) => /* @__PURE__ */ I("g", {
|
|
2671
2687
|
style: { cursor: "pointer" },
|
|
2672
2688
|
onClick: (t) => {
|
|
2673
|
-
t.stopPropagation(),
|
|
2689
|
+
t.stopPropagation(), se?.(e);
|
|
2674
2690
|
},
|
|
2675
2691
|
children: [
|
|
2676
2692
|
/* @__PURE__ */ F("title", { children: "Click to discard this redaction" }),
|
|
@@ -2715,7 +2731,7 @@ function U({ pageNum: t, pdfDoc: n, scale: r, rotation: a, containerWidth: o, co
|
|
|
2715
2731
|
]
|
|
2716
2732
|
});
|
|
2717
2733
|
}
|
|
2718
|
-
var St = e.memo(
|
|
2734
|
+
var St = e.memo(xt, (e, t) => e.pageNum === t.pageNum && e.pdfDoc === t.pdfDoc && e.scale === t.scale && e.rotation === t.rotation && e.basePageWidth === t.basePageWidth && e.basePageHeight === t.basePageHeight && e.pageTop === t.pageTop && e.pageLeft === t.pageLeft && e.activeTab === t.activeTab && e.activeTool === t.activeTool && e.selectedAnnotationId === t.selectedAnnotationId && e.activeSearchResult === t.activeSearchResult && e.watermark === t.watermark && e.watermarkText === t.watermarkText && e.redactions === t.redactions && e.annotations === t.annotations && e.transientHighlights === t.transientHighlights && e.hideAnnotationsUntilPageRendered === t.hideAnnotationsUntilPageRendered);
|
|
2719
2735
|
//#endregion
|
|
2720
2736
|
//#region src/annotations/ids.ts
|
|
2721
2737
|
function Ct() {
|
|
@@ -2795,7 +2811,7 @@ function Dt(e, t, n, r = 16) {
|
|
|
2795
2811
|
total: o
|
|
2796
2812
|
};
|
|
2797
2813
|
}
|
|
2798
|
-
function
|
|
2814
|
+
function Ot(e, t, n = .5) {
|
|
2799
2815
|
if (e.length !== t.length) return !0;
|
|
2800
2816
|
for (let r = 0; r < e.length; r++) {
|
|
2801
2817
|
let i = e[r], a = t[r];
|
|
@@ -2805,30 +2821,30 @@ function W(e, t, n = .5) {
|
|
|
2805
2821
|
}
|
|
2806
2822
|
//#endregion
|
|
2807
2823
|
//#region src/core/pdfAssets.ts
|
|
2808
|
-
var
|
|
2809
|
-
function
|
|
2810
|
-
|
|
2811
|
-
...
|
|
2824
|
+
var W = {};
|
|
2825
|
+
function kt(e) {
|
|
2826
|
+
W = {
|
|
2827
|
+
...W,
|
|
2812
2828
|
...e
|
|
2813
2829
|
}, e.workerSrc && (L.GlobalWorkerOptions.workerSrc = e.workerSrc);
|
|
2814
2830
|
}
|
|
2815
|
-
function
|
|
2816
|
-
return
|
|
2831
|
+
function G() {
|
|
2832
|
+
return W;
|
|
2833
|
+
}
|
|
2834
|
+
function K() {
|
|
2835
|
+
return !!(W.workerSrc || L.GlobalWorkerOptions.workerSrc);
|
|
2817
2836
|
}
|
|
2818
2837
|
function At() {
|
|
2819
|
-
|
|
2838
|
+
if (!K()) throw Error("[teamsync-pdf-viewer] pdf.js worker not configured. Call configurePdfAssets({ workerSrc }) with the URL of pdf.worker.min.mjs (same pdfjs-dist version) before loading a document, or pass `assets={{ workerSrc }}` to <TeamSyncViewer>.");
|
|
2820
2839
|
}
|
|
2821
2840
|
function jt() {
|
|
2822
|
-
if (!At()) throw Error("[teamsync-pdf-viewer] pdf.js worker not configured. Call configurePdfAssets({ workerSrc }) with the URL of pdf.worker.min.mjs (same pdfjs-dist version) before loading a document, or pass `assets={{ workerSrc }}` to <TeamSyncViewer>.");
|
|
2823
|
-
}
|
|
2824
|
-
function Mt() {
|
|
2825
2841
|
let e = {};
|
|
2826
|
-
return
|
|
2842
|
+
return W.cMapUrl && (e.cMapUrl = W.cMapUrl, e.cMapPacked = !0), W.standardFontDataUrl && (e.standardFontDataUrl = W.standardFontDataUrl), W.wasmUrl && (e.wasmUrl = W.wasmUrl), W.iccUrl && (e.iccUrl = W.iccUrl), e;
|
|
2827
2843
|
}
|
|
2828
|
-
var
|
|
2844
|
+
var Mt = L.version;
|
|
2829
2845
|
//#endregion
|
|
2830
2846
|
//#region src/components/DiffHighlightOverlay.tsx
|
|
2831
|
-
function
|
|
2847
|
+
function Nt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onSelectDiff: i }) {
|
|
2832
2848
|
let [a, o] = c(null);
|
|
2833
2849
|
if (!e || e.length === 0) return null;
|
|
2834
2850
|
let s = e.filter((e) => n === "deletions" ? e.type === "deletion" || e.type === "modification" : n !== "additions" || e.type === "addition" || e.type === "modification");
|
|
@@ -2933,18 +2949,18 @@ function Pt({ boxes: e, scale: t, colorScheme: n = "all", selectedDiffId: r, onS
|
|
|
2933
2949
|
}
|
|
2934
2950
|
//#endregion
|
|
2935
2951
|
//#region src/components/SideBySideViewer.tsx
|
|
2936
|
-
function
|
|
2937
|
-
let
|
|
2952
|
+
function Pt({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePageDims: o, activeTab: l, activeTool: u, annotations: d, watermark: f, watermarkText: p, redactions: m, diffsA: h = [], diffsB: g = [], selectedDiffId: _, onSelectDiff: v, hideAnnotationsUntilPageRendered: y = !0 }) {
|
|
2953
|
+
let b = s(null), x = s(null), ee = s(!1);
|
|
2938
2954
|
i(() => {
|
|
2939
|
-
let e =
|
|
2955
|
+
let e = b.current, t = x.current;
|
|
2940
2956
|
if (!e || !t) return;
|
|
2941
2957
|
let n = () => {
|
|
2942
|
-
|
|
2943
|
-
|
|
2958
|
+
ee.current || (ee.current = !0, t.scrollTop = e.scrollTop, t.scrollLeft = e.scrollLeft, setTimeout(() => {
|
|
2959
|
+
ee.current = !1;
|
|
2944
2960
|
}, 10));
|
|
2945
2961
|
}, r = () => {
|
|
2946
|
-
|
|
2947
|
-
|
|
2962
|
+
ee.current || (ee.current = !0, e.scrollTop = t.scrollTop, e.scrollLeft = t.scrollLeft, setTimeout(() => {
|
|
2963
|
+
ee.current = !1;
|
|
2948
2964
|
}, 10));
|
|
2949
2965
|
};
|
|
2950
2966
|
return e.addEventListener("scroll", n), t.addEventListener("scroll", r), () => {
|
|
@@ -2953,9 +2969,9 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
2953
2969
|
}, []), i(() => {
|
|
2954
2970
|
if (!_) return;
|
|
2955
2971
|
let e = [...h || [], ...g || []].find((e) => e.id === _);
|
|
2956
|
-
if (e &&
|
|
2957
|
-
let t =
|
|
2958
|
-
|
|
2972
|
+
if (e && b.current) {
|
|
2973
|
+
let t = b.current.clientHeight || 600, n = e.y * r, i = Math.max(0, n - t / 3);
|
|
2974
|
+
b.current.scrollTo({
|
|
2959
2975
|
top: i,
|
|
2960
2976
|
behavior: "smooth"
|
|
2961
2977
|
});
|
|
@@ -2966,14 +2982,14 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
2966
2982
|
g,
|
|
2967
2983
|
r
|
|
2968
2984
|
]);
|
|
2969
|
-
let [
|
|
2985
|
+
let [S, te] = c(o), [ne, re] = c(o);
|
|
2970
2986
|
i(() => {
|
|
2971
2987
|
e && e.getPage(n).then((e) => {
|
|
2972
2988
|
let t = e.getViewport({
|
|
2973
2989
|
scale: 1,
|
|
2974
2990
|
rotation: (e.rotate + a) % 360
|
|
2975
2991
|
});
|
|
2976
|
-
|
|
2992
|
+
te({
|
|
2977
2993
|
width: t.width,
|
|
2978
2994
|
height: t.height
|
|
2979
2995
|
});
|
|
@@ -2988,7 +3004,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
2988
3004
|
scale: 1,
|
|
2989
3005
|
rotation: (e.rotate + a) % 360
|
|
2990
3006
|
});
|
|
2991
|
-
|
|
3007
|
+
re({
|
|
2992
3008
|
width: t.width,
|
|
2993
3009
|
height: t.height
|
|
2994
3010
|
});
|
|
@@ -2998,7 +3014,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
2998
3014
|
n,
|
|
2999
3015
|
a
|
|
3000
3016
|
]);
|
|
3001
|
-
let
|
|
3017
|
+
let ie = (S.width || 600) * r, ae = (S.height || 800) * r, oe = (ne.width || 600) * r, C = (ne.height || 800) * r;
|
|
3002
3018
|
return /* @__PURE__ */ I("div", {
|
|
3003
3019
|
style: {
|
|
3004
3020
|
flex: 1,
|
|
@@ -3009,7 +3025,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3009
3025
|
overflow: "hidden"
|
|
3010
3026
|
},
|
|
3011
3027
|
children: [/* @__PURE__ */ I("div", {
|
|
3012
|
-
ref:
|
|
3028
|
+
ref: b,
|
|
3013
3029
|
style: {
|
|
3014
3030
|
flex: 1,
|
|
3015
3031
|
height: "100%",
|
|
@@ -3035,8 +3051,8 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3035
3051
|
}), /* @__PURE__ */ I("div", {
|
|
3036
3052
|
style: {
|
|
3037
3053
|
position: "relative",
|
|
3038
|
-
width: `${
|
|
3039
|
-
height: `${
|
|
3054
|
+
width: `${ie}px`,
|
|
3055
|
+
height: `${ae}px`,
|
|
3040
3056
|
boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
|
|
3041
3057
|
},
|
|
3042
3058
|
children: [e && /* @__PURE__ */ F(St, {
|
|
@@ -3047,10 +3063,10 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3047
3063
|
scrollTop: 0,
|
|
3048
3064
|
scrollLeft: 0,
|
|
3049
3065
|
pageTop: 0,
|
|
3050
|
-
basePageWidth:
|
|
3051
|
-
basePageHeight:
|
|
3052
|
-
containerWidth:
|
|
3053
|
-
containerHeight:
|
|
3066
|
+
basePageWidth: S.width,
|
|
3067
|
+
basePageHeight: S.height,
|
|
3068
|
+
containerWidth: ie,
|
|
3069
|
+
containerHeight: ae,
|
|
3054
3070
|
activeTab: l,
|
|
3055
3071
|
activeTool: u,
|
|
3056
3072
|
annotations: d,
|
|
@@ -3064,8 +3080,9 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3064
3080
|
onClearSelection: () => {},
|
|
3065
3081
|
watermark: f,
|
|
3066
3082
|
watermarkText: p,
|
|
3067
|
-
redactions: m
|
|
3068
|
-
|
|
3083
|
+
redactions: m,
|
|
3084
|
+
hideAnnotationsUntilPageRendered: y
|
|
3085
|
+
}), /* @__PURE__ */ F(Nt, {
|
|
3069
3086
|
boxes: h,
|
|
3070
3087
|
scale: r,
|
|
3071
3088
|
colorScheme: "deletions",
|
|
@@ -3074,7 +3091,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3074
3091
|
})]
|
|
3075
3092
|
})]
|
|
3076
3093
|
}), /* @__PURE__ */ I("div", {
|
|
3077
|
-
ref:
|
|
3094
|
+
ref: x,
|
|
3078
3095
|
style: {
|
|
3079
3096
|
flex: 1,
|
|
3080
3097
|
height: "100%",
|
|
@@ -3099,8 +3116,8 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3099
3116
|
}), /* @__PURE__ */ I("div", {
|
|
3100
3117
|
style: {
|
|
3101
3118
|
position: "relative",
|
|
3102
|
-
width: `${
|
|
3103
|
-
height: `${
|
|
3119
|
+
width: `${oe}px`,
|
|
3120
|
+
height: `${C}px`,
|
|
3104
3121
|
boxShadow: "0 4px 12px rgba(0,0,0,0.15)"
|
|
3105
3122
|
},
|
|
3106
3123
|
children: [t && /* @__PURE__ */ F(St, {
|
|
@@ -3111,10 +3128,10 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3111
3128
|
scrollTop: 0,
|
|
3112
3129
|
scrollLeft: 0,
|
|
3113
3130
|
pageTop: 0,
|
|
3114
|
-
basePageWidth:
|
|
3115
|
-
basePageHeight:
|
|
3116
|
-
containerWidth:
|
|
3117
|
-
containerHeight:
|
|
3131
|
+
basePageWidth: ne.width,
|
|
3132
|
+
basePageHeight: ne.height,
|
|
3133
|
+
containerWidth: oe,
|
|
3134
|
+
containerHeight: C,
|
|
3118
3135
|
activeTab: l,
|
|
3119
3136
|
activeTool: u,
|
|
3120
3137
|
annotations: d,
|
|
@@ -3128,8 +3145,9 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3128
3145
|
onClearSelection: () => {},
|
|
3129
3146
|
watermark: f,
|
|
3130
3147
|
watermarkText: p,
|
|
3131
|
-
redactions: m
|
|
3132
|
-
|
|
3148
|
+
redactions: m,
|
|
3149
|
+
hideAnnotationsUntilPageRendered: y
|
|
3150
|
+
}), /* @__PURE__ */ F(Nt, {
|
|
3133
3151
|
boxes: g,
|
|
3134
3152
|
scale: r,
|
|
3135
3153
|
colorScheme: "additions",
|
|
@@ -3142,7 +3160,7 @@ function Ft({ pdfDocA: e, pdfDocB: t, pageNum: n, scale: r, rotation: a, basePag
|
|
|
3142
3160
|
}
|
|
3143
3161
|
//#endregion
|
|
3144
3162
|
//#region src/components/CompareToolbar.tsx
|
|
3145
|
-
function
|
|
3163
|
+
function Ft({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r, onPrevDiff: i, onNextDiff: a, onExit: o }) {
|
|
3146
3164
|
let { mode: s, colorA: c, colorB: l, showCurtain: u, diffItems: d, currentDiffIndex: f } = e;
|
|
3147
3165
|
return /* @__PURE__ */ I("div", {
|
|
3148
3166
|
style: {
|
|
@@ -3166,7 +3184,7 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
|
|
|
3166
3184
|
fontWeight: 600,
|
|
3167
3185
|
color: "#38bdf8"
|
|
3168
3186
|
},
|
|
3169
|
-
children: [/* @__PURE__ */ F(
|
|
3187
|
+
children: [/* @__PURE__ */ F(D, { size: 16 }), /* @__PURE__ */ F("span", { children: "Document Compare" })]
|
|
3170
3188
|
}),
|
|
3171
3189
|
/* @__PURE__ */ F("div", { style: {
|
|
3172
3190
|
width: "1px",
|
|
@@ -3197,7 +3215,7 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
|
|
|
3197
3215
|
fontWeight: 500
|
|
3198
3216
|
},
|
|
3199
3217
|
title: "Overlay Color Blend Diff",
|
|
3200
|
-
children: [/* @__PURE__ */ F(
|
|
3218
|
+
children: [/* @__PURE__ */ F(D, { size: 14 }), /* @__PURE__ */ F("span", { children: "Overlay Diff" })]
|
|
3201
3219
|
}),
|
|
3202
3220
|
/* @__PURE__ */ I("button", {
|
|
3203
3221
|
onClick: () => t("side-by-side"),
|
|
@@ -3233,11 +3251,11 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
|
|
|
3233
3251
|
fontWeight: 500
|
|
3234
3252
|
},
|
|
3235
3253
|
title: "Semantic Text & Structured Diff",
|
|
3236
|
-
children: [/* @__PURE__ */ F(
|
|
3254
|
+
children: [/* @__PURE__ */ F(ce, { size: 14 }), /* @__PURE__ */ F("span", { children: "Text Diff" })]
|
|
3237
3255
|
})
|
|
3238
3256
|
]
|
|
3239
3257
|
}),
|
|
3240
|
-
s === "overlay" && /* @__PURE__ */ I(
|
|
3258
|
+
s === "overlay" && /* @__PURE__ */ I(P, { children: [
|
|
3241
3259
|
/* @__PURE__ */ F("div", { style: {
|
|
3242
3260
|
width: "1px",
|
|
3243
3261
|
height: "20px",
|
|
@@ -3318,10 +3336,10 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
|
|
|
3318
3336
|
fontSize: "12px"
|
|
3319
3337
|
},
|
|
3320
3338
|
title: "Toggle Wipe Curtain Slider",
|
|
3321
|
-
children: [/* @__PURE__ */ F(
|
|
3339
|
+
children: [/* @__PURE__ */ F(Ae, { size: 14 }), /* @__PURE__ */ F("span", { children: "Curtain Slider" })]
|
|
3322
3340
|
})
|
|
3323
3341
|
] }),
|
|
3324
|
-
d.length > 0 && /* @__PURE__ */ I(
|
|
3342
|
+
d.length > 0 && /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", { style: {
|
|
3325
3343
|
width: "1px",
|
|
3326
3344
|
height: "20px",
|
|
3327
3345
|
backgroundColor: "#475569"
|
|
@@ -3391,14 +3409,14 @@ function It({ compareState: e, onSetMode: t, onSetColors: n, onToggleCurtain: r,
|
|
|
3391
3409
|
fontWeight: 600
|
|
3392
3410
|
},
|
|
3393
3411
|
title: "Exit Compare Mode",
|
|
3394
|
-
children: [/* @__PURE__ */ F(
|
|
3412
|
+
children: [/* @__PURE__ */ F(N, { size: 14 }), /* @__PURE__ */ F("span", { children: "Exit Compare" })]
|
|
3395
3413
|
})
|
|
3396
3414
|
]
|
|
3397
3415
|
});
|
|
3398
3416
|
}
|
|
3399
3417
|
//#endregion
|
|
3400
3418
|
//#region src/components/DiffSummarySidebar.tsx
|
|
3401
|
-
function
|
|
3419
|
+
function It({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSelectDiff: i, onJumpToPage: a }) {
|
|
3402
3420
|
return e ? /* @__PURE__ */ I("div", {
|
|
3403
3421
|
style: {
|
|
3404
3422
|
width: "320px",
|
|
@@ -3428,7 +3446,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
|
|
|
3428
3446
|
fontSize: "14px",
|
|
3429
3447
|
color: "#0f172a"
|
|
3430
3448
|
},
|
|
3431
|
-
children: [/* @__PURE__ */ F(
|
|
3449
|
+
children: [/* @__PURE__ */ F(D, {
|
|
3432
3450
|
size: 18,
|
|
3433
3451
|
color: "#0284c7"
|
|
3434
3452
|
}), /* @__PURE__ */ F("span", { children: "Compare Summary" })]
|
|
@@ -3460,7 +3478,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
|
|
|
3460
3478
|
alignItems: "center",
|
|
3461
3479
|
gap: "4px"
|
|
3462
3480
|
},
|
|
3463
|
-
children: [/* @__PURE__ */ F(
|
|
3481
|
+
children: [/* @__PURE__ */ F(D, { size: 14 }), /* @__PURE__ */ I("span", { children: [
|
|
3464
3482
|
"Differences on Page (",
|
|
3465
3483
|
t.length,
|
|
3466
3484
|
")"
|
|
@@ -3497,11 +3515,11 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
|
|
|
3497
3515
|
gap: "6px"
|
|
3498
3516
|
},
|
|
3499
3517
|
children: [
|
|
3500
|
-
o && /* @__PURE__ */ F(
|
|
3518
|
+
o && /* @__PURE__ */ F(ve, {
|
|
3501
3519
|
size: 13,
|
|
3502
3520
|
color: "#e11d48"
|
|
3503
3521
|
}),
|
|
3504
|
-
s && /* @__PURE__ */ F(
|
|
3522
|
+
s && /* @__PURE__ */ F(Ce, {
|
|
3505
3523
|
size: 13,
|
|
3506
3524
|
color: "#10b981"
|
|
3507
3525
|
}),
|
|
@@ -3554,7 +3572,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
|
|
|
3554
3572
|
alignItems: "center",
|
|
3555
3573
|
gap: "4px"
|
|
3556
3574
|
},
|
|
3557
|
-
children: [/* @__PURE__ */ F(
|
|
3575
|
+
children: [/* @__PURE__ */ F(ce, { size: 14 }), /* @__PURE__ */ F("span", { children: "Text Differences" })]
|
|
3558
3576
|
}), n.filter((e) => e.type !== "equal").map((e, t) => /* @__PURE__ */ I("div", {
|
|
3559
3577
|
onClick: () => a(e.pageIndex),
|
|
3560
3578
|
style: {
|
|
@@ -3629,7 +3647,7 @@ function Lt({ isOpen: e, diffItems: t, textDiffs: n, currentDiffIndex: r, onSele
|
|
|
3629
3647
|
}
|
|
3630
3648
|
//#endregion
|
|
3631
3649
|
//#region src/components/CompareCurtainSlider.tsx
|
|
3632
|
-
function
|
|
3650
|
+
function Lt({ positionPercent: e, onChangePosition: t, containerRef: n }) {
|
|
3633
3651
|
let [r, a] = c(!1), o = s(null);
|
|
3634
3652
|
return i(() => {
|
|
3635
3653
|
let e = (e) => {
|
|
@@ -3680,13 +3698,13 @@ function Rt({ positionPercent: e, onChangePosition: t, containerRef: n }) {
|
|
|
3680
3698
|
boxShadow: "0 2px 8px rgba(0,0,0,0.3)",
|
|
3681
3699
|
cursor: "ew-resize"
|
|
3682
3700
|
},
|
|
3683
|
-
children: /* @__PURE__ */ F(
|
|
3701
|
+
children: /* @__PURE__ */ F(w, { size: 16 })
|
|
3684
3702
|
})
|
|
3685
3703
|
});
|
|
3686
3704
|
}
|
|
3687
3705
|
//#endregion
|
|
3688
3706
|
//#region src/utils/pdfDiffEngine.ts
|
|
3689
|
-
async function
|
|
3707
|
+
async function Rt(e) {
|
|
3690
3708
|
let t = e.getViewport({
|
|
3691
3709
|
scale: 1,
|
|
3692
3710
|
rotation: e.rotate
|
|
@@ -3709,8 +3727,8 @@ async function zt(e) {
|
|
|
3709
3727
|
}
|
|
3710
3728
|
return r;
|
|
3711
3729
|
}
|
|
3712
|
-
async function
|
|
3713
|
-
let [r, i] = await Promise.all([e.getPage(n), t.getPage(Math.min(n, t.numPages))]), [a, o] = await Promise.all([
|
|
3730
|
+
async function zt(e, t, n) {
|
|
3731
|
+
let [r, i] = await Promise.all([e.getPage(n), t.getPage(Math.min(n, t.numPages))]), [a, o] = await Promise.all([Rt(r), Rt(i)]), s = a.map((e) => e.text), c = o.map((e) => e.text), l = s.length, u = c.length, d = l + u, f = new Int32Array(2 * d + 1);
|
|
3714
3732
|
f[1] = 0;
|
|
3715
3733
|
let p = [];
|
|
3716
3734
|
for (let e = 0; e <= d; e++) {
|
|
@@ -3733,7 +3751,7 @@ async function Bt(e, t, n) {
|
|
|
3733
3751
|
e > 0 && (m === i ? (_.push(h - 1), h--) : h === a && (g.push(m - 1), m--));
|
|
3734
3752
|
}
|
|
3735
3753
|
g.reverse(), _.reverse();
|
|
3736
|
-
let v =
|
|
3754
|
+
let v = Bt(g.map((e) => a[e]), n, "deletion"), y = Bt(_.map((e) => o[e]), n, "addition"), b = [];
|
|
3737
3755
|
for (let e of v) b.push({
|
|
3738
3756
|
id: e.id,
|
|
3739
3757
|
pageIndex: n,
|
|
@@ -3760,16 +3778,16 @@ async function Bt(e, t, n) {
|
|
|
3760
3778
|
summary: b
|
|
3761
3779
|
};
|
|
3762
3780
|
}
|
|
3763
|
-
function
|
|
3781
|
+
function Bt(e, t, n) {
|
|
3764
3782
|
if (e.length === 0) return [];
|
|
3765
3783
|
let r = [], i = [e[0]];
|
|
3766
3784
|
for (let a = 1; a < e.length; a++) {
|
|
3767
3785
|
let o = i[i.length - 1], s = e[a], c = Math.abs(s.y - o.y) < Math.max(o.height, s.height) * .6, l = s.x - (o.x + o.width) < 30;
|
|
3768
|
-
c && l ? i.push(s) : (r.push(
|
|
3786
|
+
c && l ? i.push(s) : (r.push(Vt(i, t, n, r.length + 1)), i = [s]);
|
|
3769
3787
|
}
|
|
3770
|
-
return i.length > 0 && r.push(
|
|
3788
|
+
return i.length > 0 && r.push(Vt(i, t, n, r.length + 1)), r;
|
|
3771
3789
|
}
|
|
3772
|
-
function
|
|
3790
|
+
function Vt(e, t, n, r) {
|
|
3773
3791
|
let i = Math.min(...e.map((e) => e.x)), a = Math.min(...e.map((e) => e.y)), o = Math.max(...e.map((e) => e.x + e.width)), s = Math.max(...e.map((e) => e.y + e.height)), c = e.map((e) => e.text).join(" ");
|
|
3774
3792
|
return {
|
|
3775
3793
|
id: `diff-box-${t}-${n}-${r}-${Math.round(i)}-${Math.round(a)}`,
|
|
@@ -3782,7 +3800,7 @@ function Ht(e, t, n, r) {
|
|
|
3782
3800
|
height: s - a + 2
|
|
3783
3801
|
};
|
|
3784
3802
|
}
|
|
3785
|
-
function
|
|
3803
|
+
function Ht(e, t, n) {
|
|
3786
3804
|
let r = e.split(/(\s+)/), i = t.split(/(\s+)/), a = r.length, o = i.length, s = a + o, c = new Int32Array(2 * s + 1);
|
|
3787
3805
|
c[1] = 0;
|
|
3788
3806
|
let l = [];
|
|
@@ -3793,7 +3811,7 @@ function Ut(e, t, n) {
|
|
|
3793
3811
|
u = t === -e || t !== e && c[t - 1 + s] < c[t + 1 + s] ? c[t + 1 + s] : c[t - 1 + s] + 1;
|
|
3794
3812
|
let d = u - t;
|
|
3795
3813
|
for (; u < a && d < o && r[u] === i[d];) u++, d++;
|
|
3796
|
-
if (c[t + s] = u, u >= a && d >= o) return
|
|
3814
|
+
if (c[t + s] = u, u >= a && d >= o) return Ut(l, r, i, n);
|
|
3797
3815
|
}
|
|
3798
3816
|
}
|
|
3799
3817
|
return [{
|
|
@@ -3806,7 +3824,7 @@ function Ut(e, t, n) {
|
|
|
3806
3824
|
pageIndex: n
|
|
3807
3825
|
}];
|
|
3808
3826
|
}
|
|
3809
|
-
function
|
|
3827
|
+
function Ut(e, t, n, r) {
|
|
3810
3828
|
let i = t.length, a = n.length, o = t.length + n.length, s = [];
|
|
3811
3829
|
for (let r = e.length - 1; r >= 0; r--) {
|
|
3812
3830
|
let c = e[r], l = i - a, u;
|
|
@@ -3832,10 +3850,10 @@ function Wt(e, t, n, r) {
|
|
|
3832
3850
|
});
|
|
3833
3851
|
return c;
|
|
3834
3852
|
}
|
|
3835
|
-
function
|
|
3853
|
+
function Wt(e, t, n, r, i = .75) {
|
|
3836
3854
|
e.save(), e.globalCompositeOperation = "source-atop", e.fillStyle = r, e.globalAlpha = i, e.fillRect(0, 0, t, n), e.restore();
|
|
3837
3855
|
}
|
|
3838
|
-
function
|
|
3856
|
+
function Gt(e, t, n, r) {
|
|
3839
3857
|
let i = Math.min(e.width, t.width), a = Math.min(e.height, t.height);
|
|
3840
3858
|
if (i === 0 || a === 0) return [];
|
|
3841
3859
|
let o = e.getContext("2d"), s = t.getContext("2d");
|
|
@@ -3862,8 +3880,8 @@ function Kt(e, t, n, r) {
|
|
|
3862
3880
|
}
|
|
3863
3881
|
//#endregion
|
|
3864
3882
|
//#region src/components/DocumentViewer.tsx
|
|
3865
|
-
function
|
|
3866
|
-
let
|
|
3883
|
+
function Kt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationManager: u, initialDoc: d, loadNonce: p = 0, withCredentials: h = !1, assets: g, sidebars: _ = !0, redactions: v, regexRedactions: x, scale: S, setScale: te, sidebarTab: ne, setSidebarTab: re, onAnnotationsChange: ae, onRedactionsChange: C, onDocumentLoaded: se, onLoadError: ce, onFirstPageRendered: le, onPageRendered: w, onPageChange: ue, pageTransition: E, pageLayout: D, rotation: k, setRotation: de, watermark: fe, watermarkText: pe, enableAnnotations: me, initialPage: he, page: ve, transientHighlights: ye, permissions: be, hideAnnotationsUntilPageRendered: xe = !0 }) {
|
|
3884
|
+
let A = s(null), Ce = Le(), [j, we] = c(null), [Te, Ee] = c(null), [M, De] = c(1), [Oe, Ae] = c([]), { getCommand: N } = ct(), [Pe, Fe] = c(null), [R, z] = c({
|
|
3867
3885
|
isActive: !1,
|
|
3868
3886
|
mode: "overlay",
|
|
3869
3887
|
colorA: "#e11d48",
|
|
@@ -3875,39 +3893,41 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
3875
3893
|
curtainPosition: 50,
|
|
3876
3894
|
diffItems: [],
|
|
3877
3895
|
currentDiffIndex: 0
|
|
3878
|
-
}), [
|
|
3879
|
-
onRedactionsChange:
|
|
3880
|
-
onDocumentLoaded:
|
|
3881
|
-
onLoadError:
|
|
3882
|
-
onFirstPageRendered:
|
|
3883
|
-
|
|
3896
|
+
}), [B, Ie] = c([]), [ze, Be] = c(!1), Ve = s({
|
|
3897
|
+
onRedactionsChange: C,
|
|
3898
|
+
onDocumentLoaded: se,
|
|
3899
|
+
onLoadError: ce,
|
|
3900
|
+
onFirstPageRendered: le,
|
|
3901
|
+
onPageRendered: w,
|
|
3902
|
+
onPageChange: ue
|
|
3884
3903
|
});
|
|
3885
|
-
|
|
3886
|
-
onRedactionsChange:
|
|
3887
|
-
onDocumentLoaded:
|
|
3888
|
-
onLoadError:
|
|
3889
|
-
onFirstPageRendered:
|
|
3890
|
-
|
|
3904
|
+
Ve.current = {
|
|
3905
|
+
onRedactionsChange: C,
|
|
3906
|
+
onDocumentLoaded: se,
|
|
3907
|
+
onLoadError: ce,
|
|
3908
|
+
onFirstPageRendered: le,
|
|
3909
|
+
onPageRendered: w,
|
|
3910
|
+
onPageChange: ue
|
|
3891
3911
|
};
|
|
3892
|
-
let
|
|
3893
|
-
|
|
3894
|
-
let
|
|
3912
|
+
let He = s(g);
|
|
3913
|
+
He.current = g;
|
|
3914
|
+
let Ue = n(async (e) => {
|
|
3895
3915
|
try {
|
|
3896
|
-
|
|
3916
|
+
At(), He.current && kt(He.current);
|
|
3897
3917
|
let t = typeof e == "string" ? { url: e } : { data: e };
|
|
3898
|
-
h && (t.withCredentials = !0), Object.assign(t,
|
|
3918
|
+
h && (t.withCredentials = !0), Object.assign(t, jt());
|
|
3899
3919
|
let n = await L.getDocument(t).promise;
|
|
3900
|
-
|
|
3920
|
+
we(n), Ve.current.onDocumentLoaded?.(n, typeof e == "string" ? e : "documentA.pdf");
|
|
3901
3921
|
} catch (e) {
|
|
3902
3922
|
console.error("Failed to load comparison document A:", e);
|
|
3903
3923
|
}
|
|
3904
|
-
}, [h]),
|
|
3924
|
+
}, [h]), We = n(async (e) => {
|
|
3905
3925
|
try {
|
|
3906
|
-
|
|
3926
|
+
At(), He.current && kt(He.current);
|
|
3907
3927
|
let t = typeof e == "string" ? { url: e } : { data: e };
|
|
3908
|
-
h && (t.withCredentials = !0), Object.assign(t,
|
|
3928
|
+
h && (t.withCredentials = !0), Object.assign(t, jt());
|
|
3909
3929
|
let n = await L.getDocument(t).promise;
|
|
3910
|
-
|
|
3930
|
+
Fe(n), z((e) => ({
|
|
3911
3931
|
...e,
|
|
3912
3932
|
isActive: !0,
|
|
3913
3933
|
diffItems: [{
|
|
@@ -3916,19 +3936,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
3916
3936
|
type: "modification",
|
|
3917
3937
|
description: "Page 1 Differences detected"
|
|
3918
3938
|
}]
|
|
3919
|
-
})),
|
|
3939
|
+
})), Be(!0);
|
|
3920
3940
|
} catch (e) {
|
|
3921
3941
|
console.error("Failed to load comparison document B:", e);
|
|
3922
3942
|
}
|
|
3923
3943
|
}, [h]);
|
|
3924
3944
|
i(() => {
|
|
3925
|
-
if (R.isActive &&
|
|
3945
|
+
if (R.isActive && j && Pe) {
|
|
3926
3946
|
let e = !1;
|
|
3927
3947
|
return (async () => {
|
|
3928
3948
|
try {
|
|
3929
|
-
let t = Math.min(
|
|
3949
|
+
let t = Math.min(j.numPages, Pe.numPages), n = [], r = {}, i = {};
|
|
3930
3950
|
for (let a = 1; a <= t; a++) {
|
|
3931
|
-
let { diffsA: t, diffsB: o, summary: s } = await
|
|
3951
|
+
let { diffsA: t, diffsB: o, summary: s } = await zt(j, Pe, a);
|
|
3932
3952
|
if (e) return;
|
|
3933
3953
|
r[a] = t, i[a] = o, n = n.concat(s);
|
|
3934
3954
|
}
|
|
@@ -3938,8 +3958,8 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
3938
3958
|
pageDiffsA: r,
|
|
3939
3959
|
pageDiffsB: i
|
|
3940
3960
|
}));
|
|
3941
|
-
let a = await
|
|
3942
|
-
e ||
|
|
3961
|
+
let a = await j.getPage(M), o = await Pe.getPage(Math.min(M, Pe.numPages)), s = await a.getTextContent(), c = await o.getTextContent(), l = Ht(s.items.map((e) => e.str).join(" "), c.items.map((e) => e.str).join(" "), M);
|
|
3962
|
+
e || Ie(l);
|
|
3943
3963
|
} catch (e) {
|
|
3944
3964
|
console.error("Error computing document diffs:", e);
|
|
3945
3965
|
}
|
|
@@ -3949,9 +3969,9 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
3949
3969
|
}
|
|
3950
3970
|
}, [
|
|
3951
3971
|
R.isActive,
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3972
|
+
j,
|
|
3973
|
+
Pe,
|
|
3974
|
+
M
|
|
3955
3975
|
]), i(() => {
|
|
3956
3976
|
let e = (e) => {
|
|
3957
3977
|
let { docA: t, docB: n, options: r } = e || {};
|
|
@@ -3963,12 +3983,12 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
3963
3983
|
opacityA: r.opacityA || e.opacityA,
|
|
3964
3984
|
opacityB: r.opacityB || e.opacityB,
|
|
3965
3985
|
blendMode: r.blendMode || e.blendMode
|
|
3966
|
-
})), t &&
|
|
3986
|
+
})), t && Ue(t), n && We(n);
|
|
3967
3987
|
}, t = () => {
|
|
3968
3988
|
z((e) => ({
|
|
3969
3989
|
...e,
|
|
3970
3990
|
isActive: !1
|
|
3971
|
-
})),
|
|
3991
|
+
})), Fe(null), Ie([]);
|
|
3972
3992
|
}, n = (e) => {
|
|
3973
3993
|
e && z((t) => ({
|
|
3974
3994
|
...t,
|
|
@@ -3980,46 +4000,46 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
3980
4000
|
colorA: e,
|
|
3981
4001
|
colorB: t
|
|
3982
4002
|
}));
|
|
3983
|
-
}, i =
|
|
4003
|
+
}, i = Ce.on("action-start-compare", e), a = Ce.on("action-stop-compare", t), o = Ce.on("action-set-compare-mode", (e) => e && n(e.mode)), s = Ce.on("action-set-compare-colors", (e) => e && r(e.colorA, e.colorB)), c = (t) => e(t.detail), l = () => t(), u = (e) => n(e.detail?.mode), d = (e) => r(e.detail?.colorA, e.detail?.colorB);
|
|
3984
4004
|
return window.addEventListener("action-start-compare", c), window.addEventListener("action-stop-compare", l), window.addEventListener("action-set-compare-mode", u), window.addEventListener("action-set-compare-colors", d), () => {
|
|
3985
4005
|
i(), a(), o(), s(), window.removeEventListener("action-start-compare", c), window.removeEventListener("action-stop-compare", l), window.removeEventListener("action-set-compare-mode", u), window.removeEventListener("action-set-compare-colors", d);
|
|
3986
4006
|
};
|
|
3987
4007
|
}, [
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
4008
|
+
Ce,
|
|
4009
|
+
Ue,
|
|
4010
|
+
We
|
|
3991
4011
|
]);
|
|
3992
|
-
let [
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
]), [
|
|
4012
|
+
let [Ge, Ke] = c(null), [qe, Ye] = c([]), Ze = qe[0] ?? Tt, Qe = n((e) => qe[e - 1] ?? Ze, [
|
|
4013
|
+
qe,
|
|
4014
|
+
Ze.width,
|
|
4015
|
+
Ze.height
|
|
4016
|
+
]), [$e, V] = c({
|
|
3997
4017
|
top: 0,
|
|
3998
4018
|
left: 0
|
|
3999
|
-
}), [
|
|
4019
|
+
}), [tt, rt] = c(!1), it = s(null), H = o(() => {
|
|
4000
4020
|
let e = [];
|
|
4001
|
-
if (!
|
|
4002
|
-
if (
|
|
4003
|
-
else if (
|
|
4004
|
-
else if (
|
|
4021
|
+
if (!j) return e;
|
|
4022
|
+
if (D === "single") for (let t = 1; t <= j.numPages; t++) e.push([t]);
|
|
4023
|
+
else if (D === "double") for (let t = 1; t <= j.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= j.numPages));
|
|
4024
|
+
else if (D === "cover-facing") {
|
|
4005
4025
|
e.push([1]);
|
|
4006
|
-
for (let t = 2; t <=
|
|
4026
|
+
for (let t = 2; t <= j.numPages; t += 2) e.push([t, t + 1].filter((e) => e <= j.numPages));
|
|
4007
4027
|
}
|
|
4008
4028
|
return e;
|
|
4009
|
-
}, [
|
|
4029
|
+
}, [j, D]), U = o(() => Dt(H, Qe, S, 16), [
|
|
4010
4030
|
H,
|
|
4011
4031
|
S,
|
|
4012
|
-
|
|
4013
|
-
]),
|
|
4014
|
-
|
|
4015
|
-
let
|
|
4016
|
-
|
|
4017
|
-
let
|
|
4018
|
-
|
|
4019
|
-
let
|
|
4020
|
-
|
|
4021
|
-
let
|
|
4022
|
-
let t =
|
|
4032
|
+
Qe
|
|
4033
|
+
]), at = s(H);
|
|
4034
|
+
at.current = H;
|
|
4035
|
+
let ot = s(S);
|
|
4036
|
+
ot.current = S;
|
|
4037
|
+
let st = s(U);
|
|
4038
|
+
st.current = U;
|
|
4039
|
+
let lt = s(E);
|
|
4040
|
+
lt.current = E;
|
|
4041
|
+
let dt = s(0), mt = n((e) => H.findIndex((t) => t.includes(e)), [H]), vt = n((e) => {
|
|
4042
|
+
let t = U.tops;
|
|
4023
4043
|
if (t.length === 0) return 0;
|
|
4024
4044
|
let n = 0, r = t.length - 1;
|
|
4025
4045
|
for (; n < r;) {
|
|
@@ -4027,40 +4047,40 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4027
4047
|
t[i] <= e ? n = i : r = i - 1;
|
|
4028
4048
|
}
|
|
4029
4049
|
return n;
|
|
4030
|
-
}, [
|
|
4031
|
-
let n =
|
|
4032
|
-
|
|
4033
|
-
let r =
|
|
4034
|
-
r >= 0 &&
|
|
4035
|
-
top:
|
|
4050
|
+
}, [U]), yt = n((e, t = {}) => {
|
|
4051
|
+
let n = j ? Math.max(1, Math.min(e, j.numPages)) : Math.max(1, e);
|
|
4052
|
+
De(n);
|
|
4053
|
+
let r = mt(n);
|
|
4054
|
+
r >= 0 && A.current && (t.smooth ? A.current.scrollTo({
|
|
4055
|
+
top: U.tops[r],
|
|
4036
4056
|
behavior: "smooth"
|
|
4037
|
-
}) :
|
|
4057
|
+
}) : A.current.scrollTop = U.tops[r]);
|
|
4038
4058
|
}, [
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4059
|
+
j,
|
|
4060
|
+
mt,
|
|
4061
|
+
U
|
|
4042
4062
|
]);
|
|
4043
4063
|
i(() => {
|
|
4044
4064
|
let e = (e) => {
|
|
4045
|
-
e?.page &&
|
|
4046
|
-
}, t =
|
|
4065
|
+
e?.page && yt(e.page, { smooth: e.smooth ?? !0 });
|
|
4066
|
+
}, t = Ce.on("action-go-to-page", (t) => e(t)), n = (t) => e(t.detail);
|
|
4047
4067
|
return window.addEventListener("action-go-to-page", n), () => {
|
|
4048
4068
|
t(), window.removeEventListener("action-go-to-page", n);
|
|
4049
4069
|
};
|
|
4050
|
-
}, [
|
|
4051
|
-
let
|
|
4052
|
-
|
|
4053
|
-
},
|
|
4070
|
+
}, [Ce, yt]);
|
|
4071
|
+
let xt = (e) => {
|
|
4072
|
+
De(e.pageIndex), Ke(e), yt(e.pageIndex);
|
|
4073
|
+
}, Ot = n((e, t) => {
|
|
4054
4074
|
let n = t || R.diffItems[e];
|
|
4055
4075
|
if (z((t) => ({
|
|
4056
4076
|
...t,
|
|
4057
4077
|
currentDiffIndex: e
|
|
4058
4078
|
})), !n) return;
|
|
4059
|
-
n.pageIndex && n.pageIndex !==
|
|
4079
|
+
n.pageIndex && n.pageIndex !== M && De(n.pageIndex);
|
|
4060
4080
|
let r = (n.y ?? 0) * S, i = (n.x ?? 0) * S;
|
|
4061
|
-
if (
|
|
4062
|
-
let e = n.pageIndex ||
|
|
4063
|
-
|
|
4081
|
+
if (A.current) {
|
|
4082
|
+
let e = n.pageIndex || M, t = mt(e), a = E === "continuous" && t >= 0 ? U.tops[t] ?? 0 : 0, o = A.current.clientHeight || 600, s = A.current.clientWidth || 800, c = Math.max(0, a + r - o / 3), l = Math.max(0, i - s / 4);
|
|
4083
|
+
A.current.scrollTo({
|
|
4064
4084
|
top: c,
|
|
4065
4085
|
left: l,
|
|
4066
4086
|
behavior: "smooth"
|
|
@@ -4068,68 +4088,68 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4068
4088
|
}
|
|
4069
4089
|
}, [
|
|
4070
4090
|
R.diffItems,
|
|
4071
|
-
|
|
4091
|
+
M,
|
|
4072
4092
|
S,
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
]),
|
|
4093
|
+
E,
|
|
4094
|
+
mt,
|
|
4095
|
+
U.tops
|
|
4096
|
+
]), W = l(u.subscribe, u.getSnapshot, u.getSnapshot), [G, K] = c("pan");
|
|
4077
4097
|
i(() => {
|
|
4078
|
-
a === "Annotate" ? (
|
|
4098
|
+
a === "Annotate" ? (K("highlight"), Rt("#fbc02d"), Wt(.5), Vt(16)) : a === "Shapes" ? (K("rectangle"), Wt(1), Vt(2)) : a === "Fill and Sign" ? K("signature") : a === "View" && K("pan");
|
|
4079
4099
|
}, [a]), i(() => {
|
|
4080
|
-
|
|
4081
|
-
}, [
|
|
4082
|
-
let [
|
|
4100
|
+
Ce.emit("action-tool-changed", { tool: G });
|
|
4101
|
+
}, [G, Ce]);
|
|
4102
|
+
let [Mt, Rt] = c("#d32f2f"), [Bt, Vt] = c(2), [Ut, Wt] = c(.8), [Gt, Kt] = c(!1), [Jt, Yt] = c(null), [q, Xt] = c({
|
|
4083
4103
|
x: 0,
|
|
4084
4104
|
y: 0
|
|
4085
|
-
}), [
|
|
4105
|
+
}), [J, Zt] = c({
|
|
4086
4106
|
x: 0,
|
|
4087
4107
|
y: 0
|
|
4088
|
-
}), [
|
|
4089
|
-
Re("action-set-tool", (e) =>
|
|
4090
|
-
let
|
|
4108
|
+
}), [Qt, $t] = c([]), [Y, en] = c(null), [tn, nn] = c(""), rn = s(null), [X, an] = c(null), [on, sn] = c(null), [cn, Z] = c(!1), ln = s(!1), un = s(null);
|
|
4109
|
+
Re("action-set-tool", (e) => K(e?.tool ?? null));
|
|
4110
|
+
let dn = s({
|
|
4091
4111
|
vx: null,
|
|
4092
4112
|
vy: null
|
|
4093
|
-
}),
|
|
4113
|
+
}), fn = s(S), pn = s(!1), mn = s(!1);
|
|
4094
4114
|
i(() => {
|
|
4095
|
-
|
|
4096
|
-
}, [
|
|
4097
|
-
if (
|
|
4098
|
-
let e =
|
|
4099
|
-
|
|
4100
|
-
let n =
|
|
4115
|
+
mn.current = !1;
|
|
4116
|
+
}, [j]), i(() => {
|
|
4117
|
+
if (fn.current !== S) {
|
|
4118
|
+
let e = fn.current, t = S;
|
|
4119
|
+
fn.current = S;
|
|
4120
|
+
let n = A.current;
|
|
4101
4121
|
if (!n) return;
|
|
4102
|
-
let r =
|
|
4103
|
-
|
|
4104
|
-
let i =
|
|
4122
|
+
let r = pn.current || !mn.current || An.current !== j;
|
|
4123
|
+
mn.current = !0, pn.current = !1;
|
|
4124
|
+
let i = Xe({
|
|
4105
4125
|
prevScale: e,
|
|
4106
4126
|
newScale: t,
|
|
4107
4127
|
containerWidth: n.clientWidth,
|
|
4108
4128
|
containerHeight: n.clientHeight,
|
|
4109
4129
|
currentScrollLeft: n.scrollLeft,
|
|
4110
4130
|
currentScrollTop: n.scrollTop,
|
|
4111
|
-
basePageWidth:
|
|
4112
|
-
focusPoint:
|
|
4131
|
+
basePageWidth: Qe(M).width,
|
|
4132
|
+
focusPoint: dn.current,
|
|
4113
4133
|
isProgrammatic: r
|
|
4114
4134
|
});
|
|
4115
|
-
if (
|
|
4135
|
+
if (dn.current = {
|
|
4116
4136
|
vx: null,
|
|
4117
4137
|
vy: null
|
|
4118
|
-
}, r &&
|
|
4119
|
-
let e =
|
|
4120
|
-
e >= 0 && (n.scrollTop =
|
|
4138
|
+
}, r && M > 1 && E === "continuous") {
|
|
4139
|
+
let e = mt(M);
|
|
4140
|
+
e >= 0 && (n.scrollTop = U.tops[e] ?? 0), n.scrollLeft = 0;
|
|
4121
4141
|
} else n.scrollLeft = i.scrollLeft, n.scrollTop = i.scrollTop;
|
|
4122
4142
|
}
|
|
4123
4143
|
}, [S]), i(() => {
|
|
4124
|
-
let e =
|
|
4144
|
+
let e = A.current;
|
|
4125
4145
|
if (!e) return;
|
|
4126
4146
|
let t = (t) => {
|
|
4127
4147
|
if (t.metaKey || t.ctrlKey) {
|
|
4128
4148
|
t.preventDefault();
|
|
4129
4149
|
let n = e.getBoundingClientRect(), r = t.clientX, i = t.clientY, a = Math.exp(-t.deltaY * .002);
|
|
4130
|
-
|
|
4131
|
-
let t =
|
|
4132
|
-
return t !== e && (
|
|
4150
|
+
te((e) => {
|
|
4151
|
+
let t = Je(e * a);
|
|
4152
|
+
return t !== e && (dn.current = {
|
|
4133
4153
|
vx: r - n.left,
|
|
4134
4154
|
vy: i - n.top
|
|
4135
4155
|
}), t;
|
|
@@ -4137,56 +4157,56 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4137
4157
|
}
|
|
4138
4158
|
};
|
|
4139
4159
|
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
4140
|
-
}, [
|
|
4160
|
+
}, [te]);
|
|
4141
4161
|
let Q = n((e) => {
|
|
4142
4162
|
u.commit(e);
|
|
4143
4163
|
}, [u]);
|
|
4144
4164
|
Re("action-commit-digital-signature-local", (e) => {
|
|
4145
|
-
e?.tempAnn && Q([...
|
|
4165
|
+
e?.tempAnn && Q([...W, e.tempAnn]);
|
|
4146
4166
|
});
|
|
4147
|
-
let
|
|
4167
|
+
let hn = n(() => {
|
|
4148
4168
|
u.undo();
|
|
4149
|
-
}, [u]),
|
|
4169
|
+
}, [u]), gn = n(() => {
|
|
4150
4170
|
u.redo();
|
|
4151
4171
|
}, [u]);
|
|
4152
4172
|
Re("viewer-keydown", (e) => {
|
|
4153
4173
|
let t = document.activeElement?.tagName === "TEXTAREA" || document.activeElement?.tagName === "INPUT";
|
|
4154
|
-
if (
|
|
4155
|
-
e.preventDefault(),
|
|
4174
|
+
if (ut(e, N("ROTATE_CW"))) {
|
|
4175
|
+
e.preventDefault(), de((e) => (e + 90) % 360);
|
|
4156
4176
|
return;
|
|
4157
4177
|
}
|
|
4158
|
-
if (
|
|
4159
|
-
e.preventDefault(),
|
|
4178
|
+
if (ut(e, N("ROTATE_CCW"))) {
|
|
4179
|
+
e.preventDefault(), de((e) => (e - 90) % 360);
|
|
4160
4180
|
return;
|
|
4161
4181
|
}
|
|
4162
|
-
if (
|
|
4163
|
-
e.preventDefault(),
|
|
4182
|
+
if (ut(e, N("UNDO"))) {
|
|
4183
|
+
e.preventDefault(), hn();
|
|
4164
4184
|
return;
|
|
4165
4185
|
}
|
|
4166
|
-
if (
|
|
4167
|
-
e.preventDefault(),
|
|
4186
|
+
if (ut(e, N("REDO"))) {
|
|
4187
|
+
e.preventDefault(), gn();
|
|
4168
4188
|
return;
|
|
4169
4189
|
}
|
|
4170
|
-
if (
|
|
4171
|
-
e.preventDefault(),
|
|
4190
|
+
if (ut(e, N("SEARCH"))) {
|
|
4191
|
+
e.preventDefault(), Ce.emit("action-open-search");
|
|
4172
4192
|
return;
|
|
4173
4193
|
}
|
|
4174
|
-
if (
|
|
4175
|
-
e.preventDefault(),
|
|
4194
|
+
if (ut(e, N("FILE_PICKER"))) {
|
|
4195
|
+
e.preventDefault(), Ce.emit("action-open-file-picker");
|
|
4176
4196
|
return;
|
|
4177
4197
|
}
|
|
4178
|
-
if (!t && !
|
|
4179
|
-
if (
|
|
4180
|
-
let t =
|
|
4181
|
-
t && (e.preventDefault(),
|
|
4198
|
+
if (!t && !Y) {
|
|
4199
|
+
if (ut(e, N("COPY")) && X) {
|
|
4200
|
+
let t = W.find((e) => e.id === X);
|
|
4201
|
+
t && (e.preventDefault(), un.current = t);
|
|
4182
4202
|
return;
|
|
4183
4203
|
}
|
|
4184
|
-
if (
|
|
4204
|
+
if (ut(e, N("PASTE")) && un.current) {
|
|
4185
4205
|
e.preventDefault();
|
|
4186
|
-
let t =
|
|
4206
|
+
let t = un.current, n = {
|
|
4187
4207
|
...t,
|
|
4188
4208
|
id: Ct(),
|
|
4189
|
-
pageIndex:
|
|
4209
|
+
pageIndex: M,
|
|
4190
4210
|
x: t.x + 20,
|
|
4191
4211
|
y: t.y + 20,
|
|
4192
4212
|
author: void 0,
|
|
@@ -4196,63 +4216,63 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4196
4216
|
readOnly: void 0,
|
|
4197
4217
|
xfdfExtras: void 0
|
|
4198
4218
|
};
|
|
4199
|
-
Q([...
|
|
4219
|
+
Q([...W, n]), an(n.id);
|
|
4200
4220
|
return;
|
|
4201
4221
|
}
|
|
4202
|
-
if (
|
|
4203
|
-
e.preventDefault(), Q(
|
|
4222
|
+
if (ut(e, N("DELETE")) && X) {
|
|
4223
|
+
e.preventDefault(), Q(W.filter((e) => e.id !== X)), an(null);
|
|
4204
4224
|
return;
|
|
4205
4225
|
}
|
|
4206
4226
|
}
|
|
4207
4227
|
}), i(() => {
|
|
4208
|
-
|
|
4209
|
-
|
|
4228
|
+
Y && rn.current && setTimeout(() => {
|
|
4229
|
+
rn.current?.focus();
|
|
4210
4230
|
}, 10);
|
|
4211
|
-
}, [
|
|
4212
|
-
|
|
4213
|
-
}, [
|
|
4214
|
-
let [
|
|
4231
|
+
}, [Y]), i(() => {
|
|
4232
|
+
ae && ae(W);
|
|
4233
|
+
}, [W, ae]);
|
|
4234
|
+
let [_n, vn] = c([]);
|
|
4215
4235
|
i(() => {
|
|
4216
|
-
if (
|
|
4236
|
+
if (j && x && x.length > 0) {
|
|
4217
4237
|
let e = !1;
|
|
4218
|
-
return wt(
|
|
4219
|
-
e ||
|
|
4238
|
+
return wt(j, x).then((t) => {
|
|
4239
|
+
e || vn(t);
|
|
4220
4240
|
}), () => {
|
|
4221
4241
|
e = !0;
|
|
4222
4242
|
};
|
|
4223
4243
|
}
|
|
4224
|
-
|
|
4225
|
-
}, [
|
|
4226
|
-
let [
|
|
4244
|
+
vn([]);
|
|
4245
|
+
}, [j, x]);
|
|
4246
|
+
let [yn, bn] = c(!1), $ = o(() => [
|
|
4227
4247
|
...v || [],
|
|
4228
|
-
...
|
|
4229
|
-
...
|
|
4248
|
+
..._n,
|
|
4249
|
+
...Oe
|
|
4230
4250
|
], [
|
|
4231
4251
|
v,
|
|
4232
|
-
|
|
4233
|
-
|
|
4252
|
+
_n,
|
|
4253
|
+
Oe
|
|
4234
4254
|
]);
|
|
4235
4255
|
i(() => {
|
|
4236
|
-
|
|
4237
|
-
}, [
|
|
4238
|
-
let
|
|
4239
|
-
|
|
4240
|
-
}, []),
|
|
4241
|
-
|
|
4242
|
-
}, []), { search:
|
|
4256
|
+
Ve.current.onRedactionsChange?.($);
|
|
4257
|
+
}, [$]);
|
|
4258
|
+
let xn = o(() => $.filter((e) => e.status === "pending").length, [$]), Sn = n(() => {
|
|
4259
|
+
Ae((e) => e.filter((e) => e.status === "applied")), vn((e) => e.filter((e) => e.status === "applied"));
|
|
4260
|
+
}, []), Cn = n((e) => {
|
|
4261
|
+
Ae((t) => t.filter((t) => t !== e && t.id !== e.id)), vn((t) => t.filter((t) => t !== e && t.id !== e.id));
|
|
4262
|
+
}, []), { search: wn, searchResults: Tn, isSearching: En, searchProgress: Dn } = ft(j, $);
|
|
4243
4263
|
i(() => {
|
|
4244
|
-
|
|
4245
|
-
}, [
|
|
4246
|
-
let
|
|
4264
|
+
Tn.length === 0 && Ke(null);
|
|
4265
|
+
}, [Tn]);
|
|
4266
|
+
let On = s(!1);
|
|
4247
4267
|
i(() => {
|
|
4248
|
-
if (
|
|
4268
|
+
if (we(null), Ee(null), De(1), Ye([]), On.current = !1, !d) return;
|
|
4249
4269
|
let e = d, t = !1, n = null;
|
|
4250
4270
|
return (async () => {
|
|
4251
4271
|
try {
|
|
4252
|
-
|
|
4272
|
+
He.current && kt(He.current), At(), n = L.getDocument({
|
|
4253
4273
|
url: e,
|
|
4254
4274
|
withCredentials: h,
|
|
4255
|
-
...
|
|
4275
|
+
...jt()
|
|
4256
4276
|
});
|
|
4257
4277
|
let r = await n.promise;
|
|
4258
4278
|
if (t) return;
|
|
@@ -4261,20 +4281,20 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4261
4281
|
if (!t) {
|
|
4262
4282
|
let t = e.getViewport({
|
|
4263
4283
|
scale: 1,
|
|
4264
|
-
rotation:
|
|
4284
|
+
rotation: bt(e.rotate + k)
|
|
4265
4285
|
});
|
|
4266
|
-
|
|
4286
|
+
Ye(Et(r.numPages, {
|
|
4267
4287
|
width: t.width,
|
|
4268
4288
|
height: t.height
|
|
4269
4289
|
}));
|
|
4270
4290
|
}
|
|
4271
4291
|
} catch {}
|
|
4272
4292
|
if (t) return;
|
|
4273
|
-
|
|
4293
|
+
we(r), Ve.current.onDocumentLoaded?.(r, e);
|
|
4274
4294
|
} catch (n) {
|
|
4275
4295
|
if (t) return;
|
|
4276
4296
|
let r = n instanceof Error ? n : Error(String(n?.message ?? n)), i = n?.name === "PasswordException";
|
|
4277
|
-
console.error("[teamsync-pdf-viewer] Error loading PDF:", r.message, r),
|
|
4297
|
+
console.error("[teamsync-pdf-viewer] Error loading PDF:", r.message, r), Ee(r), Ve.current.onLoadError?.(r, {
|
|
4278
4298
|
url: e,
|
|
4279
4299
|
passwordRequired: i
|
|
4280
4300
|
});
|
|
@@ -4286,31 +4306,31 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4286
4306
|
d,
|
|
4287
4307
|
p,
|
|
4288
4308
|
h,
|
|
4289
|
-
|
|
4309
|
+
k
|
|
4290
4310
|
]);
|
|
4291
|
-
let
|
|
4292
|
-
|
|
4311
|
+
let kn = n((e) => {
|
|
4312
|
+
Ve.current.onPageRendered?.(e), !On.current && (On.current = !0, Ve.current.onFirstPageRendered?.(e));
|
|
4293
4313
|
}, []);
|
|
4294
4314
|
i(() => {
|
|
4295
|
-
|
|
4296
|
-
}, [
|
|
4297
|
-
let
|
|
4315
|
+
j && Ve.current.onPageChange?.(M, j.numPages);
|
|
4316
|
+
}, [M, j]);
|
|
4317
|
+
let An = s(null), jn = s(void 0);
|
|
4298
4318
|
i(() => {
|
|
4299
|
-
let e =
|
|
4300
|
-
if (!
|
|
4301
|
-
let t =
|
|
4302
|
-
|
|
4303
|
-
let n = setTimeout(() =>
|
|
4319
|
+
let e = ve ?? he;
|
|
4320
|
+
if (!j || !e || An.current === j && jn.current === e || qe.length < Math.min(e, j.numPages)) return;
|
|
4321
|
+
let t = An.current !== j;
|
|
4322
|
+
An.current = j, jn.current = e;
|
|
4323
|
+
let n = setTimeout(() => yt(e, { smooth: !t }), 50);
|
|
4304
4324
|
return () => clearTimeout(n);
|
|
4305
4325
|
}, [
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4326
|
+
j,
|
|
4327
|
+
ve,
|
|
4328
|
+
he,
|
|
4329
|
+
qe.length,
|
|
4330
|
+
yt
|
|
4311
4331
|
]), i(() => {
|
|
4312
|
-
if (!
|
|
4313
|
-
let e = !1, t =
|
|
4332
|
+
if (!j) return;
|
|
4333
|
+
let e = !1, t = j;
|
|
4314
4334
|
return (async () => {
|
|
4315
4335
|
let n;
|
|
4316
4336
|
try {
|
|
@@ -4321,12 +4341,12 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4321
4341
|
if (e) return;
|
|
4322
4342
|
let r = n.getViewport({
|
|
4323
4343
|
scale: 1,
|
|
4324
|
-
rotation:
|
|
4344
|
+
rotation: bt(n.rotate + k)
|
|
4325
4345
|
}), i = {
|
|
4326
4346
|
width: r.width,
|
|
4327
4347
|
height: r.height
|
|
4328
4348
|
};
|
|
4329
|
-
if (
|
|
4349
|
+
if (Ye((e) => e.length === t.numPages && Math.abs((e[0]?.width ?? 0) - i.width) <= .5 && Math.abs((e[0]?.height ?? 0) - i.height) <= .5 ? e : Et(t.numPages, i)), t.numPages <= 1) return;
|
|
4330
4350
|
let a = Et(t.numPages, i), o = !1;
|
|
4331
4351
|
for (let n = 2; n <= t.numPages; n += 25) {
|
|
4332
4352
|
if (e) return;
|
|
@@ -4339,7 +4359,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4339
4359
|
if (e) return;
|
|
4340
4360
|
let s = r.getViewport({
|
|
4341
4361
|
scale: 1,
|
|
4342
|
-
rotation:
|
|
4362
|
+
rotation: bt(r.rotate + k)
|
|
4343
4363
|
});
|
|
4344
4364
|
(Math.abs(s.width - i.width) > .5 || Math.abs(s.height - i.height) > .5) && (o = !0), a[n - 1] = {
|
|
4345
4365
|
width: s.width,
|
|
@@ -4351,117 +4371,117 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4351
4371
|
await Promise.all(s);
|
|
4352
4372
|
}
|
|
4353
4373
|
if (!e && o) {
|
|
4354
|
-
let e =
|
|
4355
|
-
if (e && e.scrollTop > 0 &&
|
|
4356
|
-
let t =
|
|
4374
|
+
let e = A.current;
|
|
4375
|
+
if (e && e.scrollTop > 0 && lt.current === "continuous") {
|
|
4376
|
+
let t = dt.current, n = Dt(at.current, (e) => a[e - 1] ?? i, ot.current, 16), r = st.current.tops[t] ?? 0, o = (n.tops[t] ?? 0) - r;
|
|
4357
4377
|
o !== 0 && (e.scrollTop += o);
|
|
4358
4378
|
}
|
|
4359
|
-
|
|
4379
|
+
Ye(a);
|
|
4360
4380
|
}
|
|
4361
4381
|
})(), () => {
|
|
4362
4382
|
e = !0;
|
|
4363
4383
|
};
|
|
4364
|
-
}, [
|
|
4365
|
-
let
|
|
4366
|
-
let e =
|
|
4367
|
-
if (!
|
|
4368
|
-
let t =
|
|
4384
|
+
}, [j, k]);
|
|
4385
|
+
let Mn = n(() => {
|
|
4386
|
+
let e = Qe(M);
|
|
4387
|
+
if (!A.current || !e.width) return;
|
|
4388
|
+
let t = A.current.clientWidth - 48;
|
|
4369
4389
|
if (t > 0 && e.width > 0) {
|
|
4370
|
-
let n =
|
|
4371
|
-
|
|
4390
|
+
let n = Je(t / e.width);
|
|
4391
|
+
pn.current = !0, A.current && (M === 1 || A.current.scrollTop <= 1) && (A.current.scrollTop = 0, A.current.scrollLeft = 0), te(n);
|
|
4372
4392
|
}
|
|
4373
4393
|
}, [
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
]),
|
|
4378
|
-
let e =
|
|
4379
|
-
if (!
|
|
4380
|
-
let t =
|
|
4394
|
+
Qe,
|
|
4395
|
+
M,
|
|
4396
|
+
te
|
|
4397
|
+
]), Nn = n(() => {
|
|
4398
|
+
let e = Qe(M);
|
|
4399
|
+
if (!A.current || !e.width || !e.height) return;
|
|
4400
|
+
let t = A.current.clientWidth - 48, n = A.current.clientHeight - 48;
|
|
4381
4401
|
if (t > 0 && n > 0 && e.width > 0 && e.height > 0) {
|
|
4382
|
-
let r = t / e.width, i = n / e.height, a =
|
|
4383
|
-
|
|
4402
|
+
let r = t / e.width, i = n / e.height, a = Je(Math.min(r, i));
|
|
4403
|
+
pn.current = !0, A.current && (M === 1 || A.current.scrollTop <= 1) && (A.current.scrollTop = 0, A.current.scrollLeft = 0), te(a);
|
|
4384
4404
|
}
|
|
4385
4405
|
}, [
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4406
|
+
Qe,
|
|
4407
|
+
M,
|
|
4408
|
+
te
|
|
4389
4409
|
]);
|
|
4390
|
-
Re("action-fit-to-width", () =>
|
|
4391
|
-
let
|
|
4392
|
-
let n = e.currentTarget.getBoundingClientRect(), r = (e.clientX - n.left) / S, i = (e.clientY - n.top) / S, a =
|
|
4393
|
-
return
|
|
4394
|
-
},
|
|
4395
|
-
if (!
|
|
4396
|
-
let { x: n, y: r } =
|
|
4397
|
-
if (
|
|
4410
|
+
Re("action-fit-to-width", () => Mn()), Re("action-fit-to-page", () => Nn());
|
|
4411
|
+
let Pn = (e, t) => {
|
|
4412
|
+
let n = e.currentTarget.getBoundingClientRect(), r = (e.clientX - n.left) / S, i = (e.clientY - n.top) / S, a = Qe(t);
|
|
4413
|
+
return gt(r, i, k, k % 180 == 0 ? a.width : a.height, k % 180 == 0 ? a.height : a.width);
|
|
4414
|
+
}, Fn = (e, t) => {
|
|
4415
|
+
if (!G) return;
|
|
4416
|
+
let { x: n, y: r } = Pn(e, t);
|
|
4417
|
+
if (G === "text" || G === "note") {
|
|
4398
4418
|
e.preventDefault();
|
|
4399
4419
|
return;
|
|
4400
4420
|
}
|
|
4401
|
-
if (
|
|
4402
|
-
|
|
4421
|
+
if (G === "eraser") {
|
|
4422
|
+
Kt(!0);
|
|
4403
4423
|
return;
|
|
4404
4424
|
}
|
|
4405
|
-
|
|
4425
|
+
Xt({
|
|
4406
4426
|
x: n,
|
|
4407
4427
|
y: r
|
|
4408
|
-
}),
|
|
4428
|
+
}), Zt({
|
|
4409
4429
|
x: n,
|
|
4410
4430
|
y: r
|
|
4411
|
-
}),
|
|
4431
|
+
}), G === "freehand" ? (Kt(!0), $t([{
|
|
4412
4432
|
x: n,
|
|
4413
4433
|
y: r
|
|
4414
|
-
}]),
|
|
4434
|
+
}]), Yt(t)) : ([
|
|
4415
4435
|
"rectangle",
|
|
4416
4436
|
"ellipse",
|
|
4417
4437
|
"line",
|
|
4418
4438
|
"arrow",
|
|
4419
4439
|
"highlight",
|
|
4420
4440
|
"redaction"
|
|
4421
|
-
].includes(
|
|
4422
|
-
},
|
|
4423
|
-
if (
|
|
4424
|
-
if (
|
|
4441
|
+
].includes(G) || ["callout", "link"].includes(G)) && (Kt(!0), Yt(t));
|
|
4442
|
+
}, In = () => {
|
|
4443
|
+
if (Y && tn.trim()) {
|
|
4444
|
+
if (Y.annId) Q(W.map((e) => e.id === Y.annId ? {
|
|
4425
4445
|
...e,
|
|
4426
|
-
text:
|
|
4446
|
+
text: tn
|
|
4427
4447
|
} : e));
|
|
4428
4448
|
else {
|
|
4429
4449
|
let e = Ct();
|
|
4430
|
-
Q([...
|
|
4450
|
+
Q([...W, {
|
|
4431
4451
|
id: e,
|
|
4432
|
-
type:
|
|
4433
|
-
pageIndex:
|
|
4434
|
-
x:
|
|
4435
|
-
y:
|
|
4436
|
-
width: Math.max(100,
|
|
4452
|
+
type: Y.type,
|
|
4453
|
+
pageIndex: Y.pageIndex,
|
|
4454
|
+
x: Y.x,
|
|
4455
|
+
y: Y.y,
|
|
4456
|
+
width: Math.max(100, tn.length * 8 + 20),
|
|
4437
4457
|
height: 30,
|
|
4438
|
-
text:
|
|
4439
|
-
points:
|
|
4440
|
-
color:
|
|
4441
|
-
strokeWidth:
|
|
4442
|
-
opacity:
|
|
4458
|
+
text: tn,
|
|
4459
|
+
points: Y.points,
|
|
4460
|
+
color: Mt,
|
|
4461
|
+
strokeWidth: Bt,
|
|
4462
|
+
opacity: Ut
|
|
4443
4463
|
}]);
|
|
4444
4464
|
}
|
|
4445
4465
|
}
|
|
4446
|
-
|
|
4447
|
-
},
|
|
4448
|
-
if (!
|
|
4449
|
-
let { x: n, y: r } =
|
|
4450
|
-
|
|
4466
|
+
en(null), nn(""), G === "text" && K(null);
|
|
4467
|
+
}, Ln = (e, t) => {
|
|
4468
|
+
if (!Gt) return;
|
|
4469
|
+
let { x: n, y: r } = Pn(e, t);
|
|
4470
|
+
Zt({
|
|
4451
4471
|
x: n,
|
|
4452
4472
|
y: r
|
|
4453
|
-
}),
|
|
4473
|
+
}), G === "freehand" && $t((e) => [...e, {
|
|
4454
4474
|
x: n,
|
|
4455
4475
|
y: r
|
|
4456
4476
|
}]);
|
|
4457
|
-
},
|
|
4458
|
-
if (
|
|
4459
|
-
let { x: n, y: r } =
|
|
4460
|
-
if (
|
|
4461
|
-
let e = Math.abs(
|
|
4477
|
+
}, Rn = (e, t) => {
|
|
4478
|
+
if (G === "text" || G === "note" || G === "digital_signature" || G === "link") {
|
|
4479
|
+
let { x: n, y: r } = Pn(e, t);
|
|
4480
|
+
if (G === "link") {
|
|
4481
|
+
let e = Math.abs(J.x - q.x), i = Math.abs(J.y - q.y), a = Math.min(q.x, J.x), o = Math.min(q.y, J.y);
|
|
4462
4482
|
(e < 5 || i < 5) && (a = n, o = r, e = 120, i = 35);
|
|
4463
4483
|
let s = Ct();
|
|
4464
|
-
Q([...
|
|
4484
|
+
Q([...W, {
|
|
4465
4485
|
id: s,
|
|
4466
4486
|
type: "link",
|
|
4467
4487
|
pageIndex: t,
|
|
@@ -4474,55 +4494,55 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4474
4494
|
strokeWidth: 0,
|
|
4475
4495
|
opacity: 1,
|
|
4476
4496
|
text: ""
|
|
4477
|
-
}]),
|
|
4497
|
+
}]), Kt(!1), Yt(null), ln.current = !0, an(s), Z(!0), K(null);
|
|
4478
4498
|
return;
|
|
4479
4499
|
}
|
|
4480
|
-
(
|
|
4500
|
+
(G === "text" || G === "note") && (Y && In(), en({
|
|
4481
4501
|
x: n,
|
|
4482
4502
|
y: r,
|
|
4483
|
-
type:
|
|
4503
|
+
type: G,
|
|
4484
4504
|
pageIndex: t
|
|
4485
|
-
}),
|
|
4505
|
+
}), nn(""));
|
|
4486
4506
|
return;
|
|
4487
4507
|
}
|
|
4488
|
-
if (
|
|
4489
|
-
if (
|
|
4490
|
-
if (
|
|
4491
|
-
let e =
|
|
4492
|
-
Q([...
|
|
4508
|
+
if (Gt && (Kt(!1), Yt(null), G)) {
|
|
4509
|
+
if (G === "freehand") {
|
|
4510
|
+
if (Qt.length > 2) {
|
|
4511
|
+
let e = Qt.map((e) => e.x), n = Qt.map((e) => e.y), r = Math.min(...e), i = Math.max(...e), a = Math.min(...n), o = Math.max(...n);
|
|
4512
|
+
Q([...W, {
|
|
4493
4513
|
id: Ct(),
|
|
4494
|
-
type:
|
|
4514
|
+
type: G,
|
|
4495
4515
|
pageIndex: t,
|
|
4496
4516
|
x: r,
|
|
4497
4517
|
y: a,
|
|
4498
4518
|
width: i - r,
|
|
4499
4519
|
height: o - a,
|
|
4500
|
-
points: [...
|
|
4501
|
-
strokes: [[...
|
|
4502
|
-
color:
|
|
4503
|
-
strokeWidth:
|
|
4504
|
-
opacity:
|
|
4520
|
+
points: [...Qt],
|
|
4521
|
+
strokes: [[...Qt]],
|
|
4522
|
+
color: Mt,
|
|
4523
|
+
strokeWidth: Bt,
|
|
4524
|
+
opacity: Ut
|
|
4505
4525
|
}]);
|
|
4506
4526
|
}
|
|
4507
|
-
|
|
4527
|
+
$t([]);
|
|
4508
4528
|
} else {
|
|
4509
|
-
let e = Math.abs(
|
|
4529
|
+
let e = Math.abs(J.x - q.x), n = Math.abs(J.y - q.y);
|
|
4510
4530
|
if (e > 5 || n > 5) {
|
|
4511
|
-
let r = Math.min(
|
|
4512
|
-
if ((
|
|
4513
|
-
if (
|
|
4514
|
-
|
|
4515
|
-
x:
|
|
4516
|
-
y:
|
|
4531
|
+
let r = Math.min(q.x, J.x), i = Math.min(q.y, J.y), a = G === "line" || G === "arrow" || G === "callout" ? [q, J] : void 0;
|
|
4532
|
+
if ((G === "highlight" || G === "redaction") && n < 18 && (n = Math.max(18, n), i = q.y - 9), G === "callout") {
|
|
4533
|
+
if (be?.canAddAnnotations === !1) return;
|
|
4534
|
+
en({
|
|
4535
|
+
x: J.x,
|
|
4536
|
+
y: J.y,
|
|
4517
4537
|
type: "callout",
|
|
4518
4538
|
points: a,
|
|
4519
4539
|
pageIndex: t
|
|
4520
|
-
}),
|
|
4540
|
+
}), nn("");
|
|
4521
4541
|
return;
|
|
4522
4542
|
}
|
|
4523
|
-
if (
|
|
4524
|
-
if (
|
|
4525
|
-
|
|
4543
|
+
if (G === "redaction") {
|
|
4544
|
+
if (be?.canRedact === !1) return;
|
|
4545
|
+
Ae((a) => [...a, {
|
|
4526
4546
|
id: `manual-${Date.now()}-${Math.random().toString(36).substr(2, 6)}`,
|
|
4527
4547
|
pageIndex: t,
|
|
4528
4548
|
x: r,
|
|
@@ -4533,35 +4553,35 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4533
4553
|
}]);
|
|
4534
4554
|
return;
|
|
4535
4555
|
}
|
|
4536
|
-
if (
|
|
4537
|
-
Q([...
|
|
4556
|
+
if (be?.canAddAnnotations === !1) return;
|
|
4557
|
+
Q([...W, {
|
|
4538
4558
|
id: Ct(),
|
|
4539
|
-
type:
|
|
4559
|
+
type: G,
|
|
4540
4560
|
pageIndex: t,
|
|
4541
4561
|
x: r,
|
|
4542
4562
|
y: i,
|
|
4543
4563
|
width: e,
|
|
4544
4564
|
height: n,
|
|
4545
4565
|
points: a,
|
|
4546
|
-
color:
|
|
4547
|
-
strokeWidth:
|
|
4548
|
-
opacity:
|
|
4566
|
+
color: Mt,
|
|
4567
|
+
strokeWidth: Bt,
|
|
4568
|
+
opacity: Ut
|
|
4549
4569
|
}]);
|
|
4550
4570
|
}
|
|
4551
4571
|
}
|
|
4552
4572
|
}
|
|
4553
|
-
},
|
|
4554
|
-
|
|
4555
|
-
},
|
|
4556
|
-
if (t.stopPropagation(),
|
|
4557
|
-
if (
|
|
4558
|
-
Q(
|
|
4559
|
-
} else if (
|
|
4560
|
-
let n =
|
|
4573
|
+
}, zn = (e) => {
|
|
4574
|
+
G === "eraser" && Gt && Q(W.filter((t) => t.id !== e));
|
|
4575
|
+
}, Bn = (e, t) => {
|
|
4576
|
+
if (t.stopPropagation(), G === "eraser") {
|
|
4577
|
+
if (be?.canDeleteAnnotations === !1) return;
|
|
4578
|
+
Q(W.filter((t) => t.id !== e)), X === e && (an(null), sn(null));
|
|
4579
|
+
} else if (G === null || G === "pan") {
|
|
4580
|
+
let n = W.find((t) => t.id === e);
|
|
4561
4581
|
if (n && n.linkUrl && a === "View") {
|
|
4562
4582
|
if (n.linkUrl.startsWith("#page=")) {
|
|
4563
4583
|
let e = parseInt(n.linkUrl.split("=")[1]);
|
|
4564
|
-
|
|
4584
|
+
yt(e);
|
|
4565
4585
|
} else {
|
|
4566
4586
|
let e = n.linkUrl;
|
|
4567
4587
|
/^https?:\/\//i.test(e) || (e = "https://" + e);
|
|
@@ -4571,45 +4591,45 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4571
4591
|
return;
|
|
4572
4592
|
}
|
|
4573
4593
|
if (n && (n.type === "note" || n.type === "callout" || n.type === "text")) {
|
|
4574
|
-
if (
|
|
4575
|
-
|
|
4594
|
+
if (be?.canEditAnnotations === !1 || !u.canEdit(n)) {
|
|
4595
|
+
an(e);
|
|
4576
4596
|
return;
|
|
4577
4597
|
}
|
|
4578
|
-
|
|
4598
|
+
en({
|
|
4579
4599
|
x: n.x,
|
|
4580
4600
|
y: n.y,
|
|
4581
4601
|
type: n.type,
|
|
4582
4602
|
annId: n.id,
|
|
4583
4603
|
points: n.points,
|
|
4584
4604
|
pageIndex: n.pageIndex
|
|
4585
|
-
}),
|
|
4605
|
+
}), nn(n.text || ""), n.color && Rt(n.color);
|
|
4586
4606
|
} else if (n && n.type === "link") {
|
|
4587
|
-
if (
|
|
4588
|
-
|
|
4607
|
+
if (be?.canEditAnnotations === !1 || !u.canEdit(n)) {
|
|
4608
|
+
an(e);
|
|
4589
4609
|
return;
|
|
4590
4610
|
}
|
|
4591
|
-
|
|
4611
|
+
Z(!0);
|
|
4592
4612
|
}
|
|
4593
|
-
|
|
4594
|
-
let r =
|
|
4595
|
-
i && r &&
|
|
4613
|
+
an(e);
|
|
4614
|
+
let r = A.current, i = r?.getBoundingClientRect();
|
|
4615
|
+
i && r && sn({
|
|
4596
4616
|
top: t.clientY - i.top + r.scrollTop,
|
|
4597
4617
|
left: t.clientX - i.left + r.scrollLeft
|
|
4598
4618
|
});
|
|
4599
4619
|
}
|
|
4600
4620
|
};
|
|
4601
4621
|
return i(() => {
|
|
4602
|
-
if (
|
|
4603
|
-
let e =
|
|
4604
|
-
n !==
|
|
4622
|
+
if (j && A.current && E === "continuous") {
|
|
4623
|
+
let e = $e.top + A.current.clientHeight / 2, t = Math.max(0, Math.min(H.length - 1, vt(e))), n = H[t] ? H[t][0] : 1;
|
|
4624
|
+
n !== M && De(n);
|
|
4605
4625
|
}
|
|
4606
4626
|
}, [
|
|
4607
|
-
|
|
4627
|
+
$e.top,
|
|
4608
4628
|
S,
|
|
4629
|
+
j,
|
|
4609
4630
|
M,
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
O,
|
|
4631
|
+
vt,
|
|
4632
|
+
E,
|
|
4613
4633
|
H
|
|
4614
4634
|
]), /* @__PURE__ */ I("div", {
|
|
4615
4635
|
style: {
|
|
@@ -4620,11 +4640,11 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4620
4640
|
overflow: "hidden"
|
|
4621
4641
|
},
|
|
4622
4642
|
children: [
|
|
4623
|
-
_ && /* @__PURE__ */ F(
|
|
4643
|
+
_ && /* @__PURE__ */ F(ht, {
|
|
4624
4644
|
isOpen: t,
|
|
4625
|
-
pdfDoc:
|
|
4626
|
-
pageNum:
|
|
4627
|
-
setPageNum: (e) =>
|
|
4645
|
+
pdfDoc: j,
|
|
4646
|
+
pageNum: M,
|
|
4647
|
+
setPageNum: (e) => yt(e)
|
|
4628
4648
|
}),
|
|
4629
4649
|
/* @__PURE__ */ I("div", {
|
|
4630
4650
|
style: {
|
|
@@ -4637,7 +4657,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4637
4657
|
overflow: "hidden"
|
|
4638
4658
|
},
|
|
4639
4659
|
children: [
|
|
4640
|
-
R.isActive && /* @__PURE__ */ F(
|
|
4660
|
+
R.isActive && /* @__PURE__ */ F(Ft, {
|
|
4641
4661
|
compareState: R,
|
|
4642
4662
|
onSetMode: (e) => z((t) => ({
|
|
4643
4663
|
...t,
|
|
@@ -4655,18 +4675,18 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4655
4675
|
onPrevDiff: () => {
|
|
4656
4676
|
if (R.diffItems.length === 0) return;
|
|
4657
4677
|
let e = (R.currentDiffIndex - 1 + R.diffItems.length) % R.diffItems.length;
|
|
4658
|
-
|
|
4678
|
+
Ot(e);
|
|
4659
4679
|
},
|
|
4660
4680
|
onNextDiff: () => {
|
|
4661
4681
|
if (R.diffItems.length === 0) return;
|
|
4662
4682
|
let e = (R.currentDiffIndex + 1) % R.diffItems.length;
|
|
4663
|
-
|
|
4683
|
+
Ot(e);
|
|
4664
4684
|
},
|
|
4665
4685
|
onExit: () => {
|
|
4666
4686
|
z((e) => ({
|
|
4667
4687
|
...e,
|
|
4668
4688
|
isActive: !1
|
|
4669
|
-
})),
|
|
4689
|
+
})), Fe(null), Ie([]);
|
|
4670
4690
|
}
|
|
4671
4691
|
}),
|
|
4672
4692
|
a === "Annotate" && /* @__PURE__ */ I("div", {
|
|
@@ -4680,35 +4700,35 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4680
4700
|
height: "40px"
|
|
4681
4701
|
},
|
|
4682
4702
|
children: [
|
|
4683
|
-
/* @__PURE__ */ F(
|
|
4684
|
-
icon: /* @__PURE__ */ F(
|
|
4685
|
-
active:
|
|
4703
|
+
/* @__PURE__ */ F(qt, {
|
|
4704
|
+
icon: /* @__PURE__ */ F(T, { size: 16 }),
|
|
4705
|
+
active: G === "highlight",
|
|
4686
4706
|
onClick: () => {
|
|
4687
|
-
|
|
4707
|
+
K("highlight"), Rt("#fbc02d"), Wt(.5), Vt(16);
|
|
4688
4708
|
},
|
|
4689
4709
|
label: "Text Highlight"
|
|
4690
4710
|
}),
|
|
4691
|
-
/* @__PURE__ */ F(
|
|
4711
|
+
/* @__PURE__ */ F(qt, {
|
|
4692
4712
|
icon: /* @__PURE__ */ F(m, { size: 16 }),
|
|
4693
|
-
active:
|
|
4713
|
+
active: G === "freehand",
|
|
4694
4714
|
onClick: () => {
|
|
4695
|
-
|
|
4715
|
+
K("freehand"), Rt("#000000"), Wt(1), Vt(2);
|
|
4696
4716
|
},
|
|
4697
4717
|
label: "Marker"
|
|
4698
4718
|
}),
|
|
4699
|
-
/* @__PURE__ */ F(
|
|
4700
|
-
icon: /* @__PURE__ */ F(
|
|
4701
|
-
active:
|
|
4719
|
+
/* @__PURE__ */ F(qt, {
|
|
4720
|
+
icon: /* @__PURE__ */ F(Ne, { size: 16 }),
|
|
4721
|
+
active: G === "text",
|
|
4702
4722
|
onClick: () => {
|
|
4703
|
-
|
|
4723
|
+
K("text"), Rt("#000000"), Wt(1);
|
|
4704
4724
|
},
|
|
4705
4725
|
label: "Text"
|
|
4706
4726
|
}),
|
|
4707
|
-
|
|
4708
|
-
icon: /* @__PURE__ */ F(
|
|
4709
|
-
active:
|
|
4727
|
+
be?.canRedact !== !1 && /* @__PURE__ */ F(qt, {
|
|
4728
|
+
icon: /* @__PURE__ */ F(oe, { size: 16 }),
|
|
4729
|
+
active: G === "redaction",
|
|
4710
4730
|
onClick: () => {
|
|
4711
|
-
|
|
4731
|
+
K("redaction"), Rt("#000000"), Wt(1);
|
|
4712
4732
|
},
|
|
4713
4733
|
label: "Redact"
|
|
4714
4734
|
}),
|
|
@@ -4725,11 +4745,11 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4725
4745
|
borderRight: "1px solid var(--border-color)",
|
|
4726
4746
|
paddingRight: "8px"
|
|
4727
4747
|
},
|
|
4728
|
-
children: /* @__PURE__ */ F(
|
|
4729
|
-
icon: /* @__PURE__ */ F(
|
|
4730
|
-
active:
|
|
4748
|
+
children: /* @__PURE__ */ F(qt, {
|
|
4749
|
+
icon: /* @__PURE__ */ F(ge, { size: 16 }),
|
|
4750
|
+
active: G === "callout",
|
|
4731
4751
|
onClick: () => {
|
|
4732
|
-
|
|
4752
|
+
K("callout"), Wt(1), Vt(2);
|
|
4733
4753
|
},
|
|
4734
4754
|
label: "Callout"
|
|
4735
4755
|
})
|
|
@@ -4739,17 +4759,17 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4739
4759
|
display: "flex",
|
|
4740
4760
|
gap: "4px"
|
|
4741
4761
|
},
|
|
4742
|
-
children: [/* @__PURE__ */ F(
|
|
4743
|
-
icon: /* @__PURE__ */ F(
|
|
4744
|
-
active:
|
|
4762
|
+
children: [/* @__PURE__ */ F(qt, {
|
|
4763
|
+
icon: /* @__PURE__ */ F(Se, { size: 16 }),
|
|
4764
|
+
active: G === "freehand" && Ut === 1,
|
|
4745
4765
|
onClick: () => {
|
|
4746
|
-
|
|
4766
|
+
K("freehand"), Wt(1), Vt(2);
|
|
4747
4767
|
},
|
|
4748
4768
|
label: "Freehand"
|
|
4749
|
-
}),
|
|
4750
|
-
icon: /* @__PURE__ */ F(
|
|
4751
|
-
active:
|
|
4752
|
-
onClick: () =>
|
|
4769
|
+
}), be?.canDeleteAnnotations !== !1 && /* @__PURE__ */ F(qt, {
|
|
4770
|
+
icon: /* @__PURE__ */ F(ie, { size: 16 }),
|
|
4771
|
+
active: G === "eraser",
|
|
4772
|
+
onClick: () => K("eraser"),
|
|
4753
4773
|
label: "Eraser"
|
|
4754
4774
|
})]
|
|
4755
4775
|
}),
|
|
@@ -4765,34 +4785,34 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4765
4785
|
gap: "4px"
|
|
4766
4786
|
},
|
|
4767
4787
|
children: [
|
|
4768
|
-
/* @__PURE__ */ F(
|
|
4769
|
-
icon: /* @__PURE__ */ F(
|
|
4770
|
-
active:
|
|
4771
|
-
onClick: () =>
|
|
4788
|
+
/* @__PURE__ */ F(qt, {
|
|
4789
|
+
icon: /* @__PURE__ */ F(_e, { size: 16 }),
|
|
4790
|
+
active: G === "line",
|
|
4791
|
+
onClick: () => K("line"),
|
|
4772
4792
|
label: "Line"
|
|
4773
4793
|
}),
|
|
4774
|
-
/* @__PURE__ */ F(
|
|
4794
|
+
/* @__PURE__ */ F(qt, {
|
|
4775
4795
|
icon: /* @__PURE__ */ F(f, { size: 16 }),
|
|
4776
|
-
active:
|
|
4777
|
-
onClick: () =>
|
|
4796
|
+
active: G === "arrow",
|
|
4797
|
+
onClick: () => K("arrow"),
|
|
4778
4798
|
label: "Arrow"
|
|
4779
4799
|
}),
|
|
4780
|
-
/* @__PURE__ */ F(
|
|
4781
|
-
icon: /* @__PURE__ */ F(
|
|
4782
|
-
active:
|
|
4783
|
-
onClick: () =>
|
|
4800
|
+
/* @__PURE__ */ F(qt, {
|
|
4801
|
+
icon: /* @__PURE__ */ F(je, { size: 16 }),
|
|
4802
|
+
active: G === "rectangle",
|
|
4803
|
+
onClick: () => K("rectangle"),
|
|
4784
4804
|
label: "Rectangle"
|
|
4785
4805
|
}),
|
|
4786
|
-
/* @__PURE__ */ F(
|
|
4806
|
+
/* @__PURE__ */ F(qt, {
|
|
4787
4807
|
icon: /* @__PURE__ */ F(ee, { size: 16 }),
|
|
4788
|
-
active:
|
|
4789
|
-
onClick: () =>
|
|
4808
|
+
active: G === "ellipse",
|
|
4809
|
+
onClick: () => K("ellipse"),
|
|
4790
4810
|
label: "Ellipse"
|
|
4791
4811
|
}),
|
|
4792
|
-
/* @__PURE__ */ F(
|
|
4793
|
-
icon: /* @__PURE__ */ F(
|
|
4794
|
-
active:
|
|
4795
|
-
onClick: () =>
|
|
4812
|
+
/* @__PURE__ */ F(qt, {
|
|
4813
|
+
icon: /* @__PURE__ */ F(O, { size: 16 }),
|
|
4814
|
+
active: G === "link",
|
|
4815
|
+
onClick: () => K("link"),
|
|
4796
4816
|
label: "Link"
|
|
4797
4817
|
})
|
|
4798
4818
|
]
|
|
@@ -4812,7 +4832,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4812
4832
|
"ellipse",
|
|
4813
4833
|
"freehand",
|
|
4814
4834
|
"highlight"
|
|
4815
|
-
].includes(
|
|
4835
|
+
].includes(G || "") && /* @__PURE__ */ I("div", {
|
|
4816
4836
|
style: {
|
|
4817
4837
|
display: "flex",
|
|
4818
4838
|
alignItems: "center",
|
|
@@ -4826,16 +4846,16 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4826
4846
|
color: "#666",
|
|
4827
4847
|
minWidth: "85px"
|
|
4828
4848
|
},
|
|
4829
|
-
children: ["Thickness: ", /* @__PURE__ */ I("strong", { children: [
|
|
4849
|
+
children: ["Thickness: ", /* @__PURE__ */ I("strong", { children: [Bt, "px"] })]
|
|
4830
4850
|
}), /* @__PURE__ */ F("input", {
|
|
4831
4851
|
type: "range",
|
|
4832
4852
|
min: "1",
|
|
4833
4853
|
max: "24",
|
|
4834
|
-
value: Math.min(24, Math.max(1,
|
|
4854
|
+
value: Math.min(24, Math.max(1, Bt)),
|
|
4835
4855
|
onMouseDown: (e) => e.stopPropagation(),
|
|
4836
4856
|
onChange: (e) => {
|
|
4837
4857
|
let t = parseInt(e.target.value, 10);
|
|
4838
|
-
|
|
4858
|
+
Vt(t), X && !Y && Q(W.map((e) => e.id === X ? {
|
|
4839
4859
|
...e,
|
|
4840
4860
|
strokeWidth: t
|
|
4841
4861
|
} : e));
|
|
@@ -4862,7 +4882,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4862
4882
|
].map((e) => /* @__PURE__ */ F("button", {
|
|
4863
4883
|
onMouseDown: (e) => e.preventDefault(),
|
|
4864
4884
|
onClick: () => {
|
|
4865
|
-
|
|
4885
|
+
Rt(e), X && !Y && Q(W.map((t) => t.id === X ? {
|
|
4866
4886
|
...t,
|
|
4867
4887
|
color: e
|
|
4868
4888
|
} : t));
|
|
@@ -4872,14 +4892,14 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4872
4892
|
height: "18px",
|
|
4873
4893
|
borderRadius: "50%",
|
|
4874
4894
|
backgroundColor: e,
|
|
4875
|
-
border:
|
|
4895
|
+
border: Mt === e ? "2px solid #000" : "1px solid transparent",
|
|
4876
4896
|
cursor: "pointer",
|
|
4877
4897
|
outline: "none",
|
|
4878
4898
|
padding: 0
|
|
4879
4899
|
}
|
|
4880
4900
|
}, e))
|
|
4881
4901
|
}),
|
|
4882
|
-
|
|
4902
|
+
xn > 0 && /* @__PURE__ */ I("div", {
|
|
4883
4903
|
style: {
|
|
4884
4904
|
display: "flex",
|
|
4885
4905
|
alignItems: "center",
|
|
@@ -4887,7 +4907,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4887
4907
|
marginLeft: "8px"
|
|
4888
4908
|
},
|
|
4889
4909
|
children: [/* @__PURE__ */ I("button", {
|
|
4890
|
-
onClick: () =>
|
|
4910
|
+
onClick: () => bn(!0),
|
|
4891
4911
|
style: {
|
|
4892
4912
|
display: "flex",
|
|
4893
4913
|
alignItems: "center",
|
|
@@ -4904,13 +4924,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4904
4924
|
},
|
|
4905
4925
|
title: "Apply all marked redactions permanently",
|
|
4906
4926
|
children: [
|
|
4907
|
-
/* @__PURE__ */ F(
|
|
4927
|
+
/* @__PURE__ */ F(ke, { size: 16 }),
|
|
4908
4928
|
"Apply Redactions (",
|
|
4909
|
-
|
|
4929
|
+
xn,
|
|
4910
4930
|
")"
|
|
4911
4931
|
]
|
|
4912
4932
|
}), /* @__PURE__ */ I("button", {
|
|
4913
|
-
onClick:
|
|
4933
|
+
onClick: Sn,
|
|
4914
4934
|
style: {
|
|
4915
4935
|
display: "flex",
|
|
4916
4936
|
alignItems: "center",
|
|
@@ -4925,7 +4945,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4925
4945
|
cursor: "pointer"
|
|
4926
4946
|
},
|
|
4927
4947
|
title: "Discard all pending unapplied redactions",
|
|
4928
|
-
children: [/* @__PURE__ */ F(
|
|
4948
|
+
children: [/* @__PURE__ */ F(Me, {
|
|
4929
4949
|
size: 14,
|
|
4930
4950
|
color: "#dc2626"
|
|
4931
4951
|
}), "Discard Redactions"]
|
|
@@ -4935,7 +4955,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4935
4955
|
})
|
|
4936
4956
|
]
|
|
4937
4957
|
}),
|
|
4938
|
-
|
|
4958
|
+
yn && /* @__PURE__ */ F("div", {
|
|
4939
4959
|
style: {
|
|
4940
4960
|
position: "fixed",
|
|
4941
4961
|
top: 0,
|
|
@@ -4976,7 +4996,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
4976
4996
|
justifyContent: "center",
|
|
4977
4997
|
color: "#dc2626"
|
|
4978
4998
|
},
|
|
4979
|
-
children: /* @__PURE__ */ F(
|
|
4999
|
+
children: /* @__PURE__ */ F(ke, { size: 24 })
|
|
4980
5000
|
}), /* @__PURE__ */ I("div", { children: [/* @__PURE__ */ F("h3", {
|
|
4981
5001
|
style: {
|
|
4982
5002
|
margin: 0,
|
|
@@ -5003,7 +5023,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5003
5023
|
},
|
|
5004
5024
|
children: [
|
|
5005
5025
|
"You are about to permanently apply ",
|
|
5006
|
-
/* @__PURE__ */ I("strong", { children: [
|
|
5026
|
+
/* @__PURE__ */ I("strong", { children: [xn, " redaction(s)"] }),
|
|
5007
5027
|
". Marked areas will be blacked out and underlying text will be permanently removed. This action cannot be undone."
|
|
5008
5028
|
]
|
|
5009
5029
|
}),
|
|
@@ -5015,7 +5035,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5015
5035
|
},
|
|
5016
5036
|
children: [
|
|
5017
5037
|
/* @__PURE__ */ F("button", {
|
|
5018
|
-
onClick: () =>
|
|
5038
|
+
onClick: () => bn(!1),
|
|
5019
5039
|
style: {
|
|
5020
5040
|
padding: "8px 14px",
|
|
5021
5041
|
borderRadius: "6px",
|
|
@@ -5030,7 +5050,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5030
5050
|
}),
|
|
5031
5051
|
/* @__PURE__ */ F("button", {
|
|
5032
5052
|
onClick: () => {
|
|
5033
|
-
|
|
5053
|
+
Sn(), bn(!1);
|
|
5034
5054
|
},
|
|
5035
5055
|
style: {
|
|
5036
5056
|
padding: "8px 14px",
|
|
@@ -5046,13 +5066,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5046
5066
|
}),
|
|
5047
5067
|
/* @__PURE__ */ F("button", {
|
|
5048
5068
|
onClick: () => {
|
|
5049
|
-
|
|
5069
|
+
Ae((e) => e.map((e) => ({
|
|
5050
5070
|
...e,
|
|
5051
5071
|
status: "applied"
|
|
5052
|
-
}))),
|
|
5072
|
+
}))), vn((e) => e.map((e) => ({
|
|
5053
5073
|
...e,
|
|
5054
5074
|
status: "applied"
|
|
5055
|
-
}))),
|
|
5075
|
+
}))), bn(!1);
|
|
5056
5076
|
},
|
|
5057
5077
|
style: {
|
|
5058
5078
|
padding: "8px 14px",
|
|
@@ -5083,28 +5103,28 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5083
5103
|
overflow: "hidden",
|
|
5084
5104
|
position: "relative"
|
|
5085
5105
|
},
|
|
5086
|
-
children: [R.isActive && R.mode === "side-by-side" ? /* @__PURE__ */ F(
|
|
5087
|
-
pdfDocA:
|
|
5088
|
-
pdfDocB:
|
|
5089
|
-
pageNum:
|
|
5106
|
+
children: [R.isActive && R.mode === "side-by-side" ? /* @__PURE__ */ F(Pt, {
|
|
5107
|
+
pdfDocA: j,
|
|
5108
|
+
pdfDocB: Pe,
|
|
5109
|
+
pageNum: M,
|
|
5090
5110
|
scale: S,
|
|
5091
|
-
rotation:
|
|
5092
|
-
basePageDims:
|
|
5111
|
+
rotation: k,
|
|
5112
|
+
basePageDims: Qe(M),
|
|
5093
5113
|
activeTab: a,
|
|
5094
|
-
activeTool:
|
|
5095
|
-
annotations:
|
|
5096
|
-
permissions:
|
|
5097
|
-
watermark:
|
|
5098
|
-
watermarkText:
|
|
5099
|
-
redactions:
|
|
5100
|
-
diffsA: R.pageDiffsA?.[
|
|
5101
|
-
diffsB: R.pageDiffsB?.[
|
|
5114
|
+
activeTool: G,
|
|
5115
|
+
annotations: W,
|
|
5116
|
+
permissions: be,
|
|
5117
|
+
watermark: fe,
|
|
5118
|
+
watermarkText: pe,
|
|
5119
|
+
redactions: $,
|
|
5120
|
+
diffsA: R.pageDiffsA?.[M] || [],
|
|
5121
|
+
diffsB: R.pageDiffsB?.[M] || [],
|
|
5102
5122
|
selectedDiffId: R.diffItems[R.currentDiffIndex]?.id,
|
|
5103
5123
|
onSelectDiff: (e) => {
|
|
5104
5124
|
let t = R.diffItems.findIndex((t) => t.id === e);
|
|
5105
|
-
t !== -1 &&
|
|
5125
|
+
t !== -1 && Ot(t);
|
|
5106
5126
|
}
|
|
5107
|
-
}) : /* @__PURE__ */ I(
|
|
5127
|
+
}) : /* @__PURE__ */ I(P, { children: [G === "highlight" && /* @__PURE__ */ F("style", { children: "\n .pdf-viewer-area, .pdf-viewer-area * {\n cursor: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9ImJsYWNrIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PHBhdGggZD0iTTkgMTFsLTYgNnYzaDlsMy0zIi8+PHBhdGggZD0iTTIyIDEybC00LjYgNC42YTIgMiAwIDAgMS0yLjggMGwtNS4yLTUuMmEyIDIgMCAwIDEgMC0yLjhMMTQgNCIvPjwvc3ZnPg==') 0 24, auto !important;\n }\n " }), /* @__PURE__ */ I("div", {
|
|
5108
5128
|
className: "pdf-viewer-area",
|
|
5109
5129
|
style: {
|
|
5110
5130
|
flex: 1,
|
|
@@ -5115,28 +5135,28 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5115
5135
|
overflow: "hidden",
|
|
5116
5136
|
position: "relative",
|
|
5117
5137
|
backgroundColor: "var(--bg-color)",
|
|
5118
|
-
cursor:
|
|
5138
|
+
cursor: tt ? "grabbing" : G === "pan" || G === null ? "grab" : G === "eraser" ? "cell" : "crosshair"
|
|
5119
5139
|
},
|
|
5120
5140
|
onMouseMove: (e) => {
|
|
5121
|
-
if (
|
|
5141
|
+
if (tt && it.current && A.current) {
|
|
5122
5142
|
let t = e.clientX - it.current.x, n = e.clientY - it.current.y;
|
|
5123
|
-
|
|
5143
|
+
A.current.scrollLeft = it.current.scrollLeft - t, A.current.scrollTop = it.current.scrollTop - n;
|
|
5124
5144
|
}
|
|
5125
5145
|
},
|
|
5126
5146
|
onMouseLeave: () => {
|
|
5127
|
-
|
|
5147
|
+
tt && (rt(!1), it.current = null);
|
|
5128
5148
|
},
|
|
5129
5149
|
children: [
|
|
5130
5150
|
/* @__PURE__ */ F("div", {
|
|
5131
|
-
ref:
|
|
5151
|
+
ref: A,
|
|
5132
5152
|
onScroll: (e) => {
|
|
5133
|
-
|
|
5153
|
+
V({
|
|
5134
5154
|
top: e.currentTarget.scrollTop,
|
|
5135
5155
|
left: e.currentTarget.scrollLeft
|
|
5136
|
-
}),
|
|
5156
|
+
}), dt.current = vt(e.currentTarget.scrollTop);
|
|
5137
5157
|
},
|
|
5138
5158
|
onMouseDown: (e) => {
|
|
5139
|
-
(
|
|
5159
|
+
(G === "pan" || G === null) && e.button === 0 && (rt(!0), it.current = {
|
|
5140
5160
|
x: e.clientX,
|
|
5141
5161
|
y: e.clientY,
|
|
5142
5162
|
scrollLeft: e.currentTarget.scrollLeft,
|
|
@@ -5144,7 +5164,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5144
5164
|
});
|
|
5145
5165
|
},
|
|
5146
5166
|
onMouseUp: (e) => {
|
|
5147
|
-
|
|
5167
|
+
tt && (rt(!1), it.current = null);
|
|
5148
5168
|
},
|
|
5149
5169
|
onContextMenu: (e) => {
|
|
5150
5170
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -5157,46 +5177,46 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5157
5177
|
},
|
|
5158
5178
|
children: (() => {
|
|
5159
5179
|
let t = (t, n, r) => {
|
|
5160
|
-
let i = r ?
|
|
5161
|
-
if (r &&
|
|
5180
|
+
let i = r ? U.tops[n] ?? 0 : 0;
|
|
5181
|
+
if (r && A.current) {
|
|
5162
5182
|
let e = S >= 4 ? 1 : S >= 2 ? 2 : 4, t = S >= 4 ? 1 : S >= 2 ? 2 : 5;
|
|
5163
|
-
if (n <
|
|
5183
|
+
if (n < dt.current - e || n > dt.current + t) return null;
|
|
5164
5184
|
}
|
|
5165
|
-
let o =
|
|
5166
|
-
if (
|
|
5185
|
+
let o = Gt && Jt && G && G !== "eraser" ? (() => {
|
|
5186
|
+
if (G === "freehand") return {
|
|
5167
5187
|
id: "temp-live-drawing",
|
|
5168
5188
|
type: "freehand",
|
|
5169
|
-
pageIndex:
|
|
5189
|
+
pageIndex: Jt,
|
|
5170
5190
|
x: 0,
|
|
5171
5191
|
y: 0,
|
|
5172
5192
|
width: 0,
|
|
5173
5193
|
height: 0,
|
|
5174
|
-
points:
|
|
5175
|
-
color:
|
|
5176
|
-
strokeWidth:
|
|
5177
|
-
opacity:
|
|
5194
|
+
points: Qt,
|
|
5195
|
+
color: Mt,
|
|
5196
|
+
strokeWidth: Bt,
|
|
5197
|
+
opacity: Ut
|
|
5178
5198
|
};
|
|
5179
|
-
if (
|
|
5180
|
-
let e = Math.abs(
|
|
5181
|
-
return t < 18 && (t = Math.max(18, t), r =
|
|
5199
|
+
if (G === "highlight") {
|
|
5200
|
+
let e = Math.abs(J.x - q.x), t = Math.abs(J.y - q.y), n = Math.min(q.x, J.x), r = Math.min(q.y, J.y);
|
|
5201
|
+
return t < 18 && (t = Math.max(18, t), r = q.y - 9), {
|
|
5182
5202
|
id: "temp-live-drawing",
|
|
5183
5203
|
type: "highlight",
|
|
5184
|
-
pageIndex:
|
|
5204
|
+
pageIndex: Jt,
|
|
5185
5205
|
x: n,
|
|
5186
5206
|
y: r,
|
|
5187
5207
|
width: e,
|
|
5188
5208
|
height: t,
|
|
5189
|
-
color:
|
|
5190
|
-
strokeWidth:
|
|
5191
|
-
opacity:
|
|
5209
|
+
color: Mt,
|
|
5210
|
+
strokeWidth: Bt,
|
|
5211
|
+
opacity: Ut
|
|
5192
5212
|
};
|
|
5193
5213
|
}
|
|
5194
|
-
if (
|
|
5195
|
-
let e = Math.abs(
|
|
5196
|
-
return t < 18 && (t = Math.max(18, t), r =
|
|
5214
|
+
if (G === "redaction") {
|
|
5215
|
+
let e = Math.abs(J.x - q.x), t = Math.abs(J.y - q.y), n = Math.min(q.x, J.x), r = Math.min(q.y, J.y);
|
|
5216
|
+
return t < 18 && (t = Math.max(18, t), r = q.y - 9), {
|
|
5197
5217
|
id: "temp-live-drawing",
|
|
5198
5218
|
type: "rectangle",
|
|
5199
|
-
pageIndex:
|
|
5219
|
+
pageIndex: Jt,
|
|
5200
5220
|
x: n,
|
|
5201
5221
|
y: r,
|
|
5202
5222
|
width: e,
|
|
@@ -5213,66 +5233,67 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5213
5233
|
"rectangle",
|
|
5214
5234
|
"ellipse",
|
|
5215
5235
|
"link"
|
|
5216
|
-
].includes(
|
|
5217
|
-
let e = Math.abs(
|
|
5236
|
+
].includes(G)) {
|
|
5237
|
+
let e = Math.abs(J.x - q.x), t = Math.abs(J.y - q.y), n = Math.min(q.x, J.x), r = Math.min(q.y, J.y);
|
|
5218
5238
|
return {
|
|
5219
5239
|
id: "temp-live-drawing",
|
|
5220
|
-
type:
|
|
5221
|
-
pageIndex:
|
|
5240
|
+
type: G,
|
|
5241
|
+
pageIndex: Jt,
|
|
5222
5242
|
x: n,
|
|
5223
5243
|
y: r,
|
|
5224
5244
|
width: e,
|
|
5225
5245
|
height: t,
|
|
5226
|
-
points:
|
|
5227
|
-
color:
|
|
5228
|
-
strokeWidth:
|
|
5229
|
-
opacity:
|
|
5246
|
+
points: G === "line" || G === "arrow" || G === "callout" ? [q, J] : void 0,
|
|
5247
|
+
color: Mt,
|
|
5248
|
+
strokeWidth: Bt,
|
|
5249
|
+
opacity: Ut
|
|
5230
5250
|
};
|
|
5231
5251
|
}
|
|
5232
5252
|
})() : null;
|
|
5233
5253
|
return t.map((n, r) => {
|
|
5234
|
-
let s, c =
|
|
5254
|
+
let s, c = A.current?.clientWidth || 0, l = Qe(n), u = Qe(t[0]).width * S, d = l.width * S;
|
|
5235
5255
|
t.length === 2 ? (r === 0 && (s = Math.max(0, c / 2 - u)), r === 1 && (s = Math.max(u, c / 2))) : s = Math.max(0, c / 2 - d / 2);
|
|
5236
|
-
let f = o && o.pageIndex === n ? [...
|
|
5256
|
+
let f = o && o.pageIndex === n ? [...W, o] : W;
|
|
5237
5257
|
return /* @__PURE__ */ I(e.Fragment, { children: [
|
|
5238
5258
|
/* @__PURE__ */ F(St, {
|
|
5239
5259
|
pageNum: n,
|
|
5240
|
-
pdfDoc:
|
|
5260
|
+
pdfDoc: j,
|
|
5241
5261
|
scale: S,
|
|
5242
|
-
rotation:
|
|
5243
|
-
containerWidth:
|
|
5244
|
-
containerHeight:
|
|
5245
|
-
scrollTop:
|
|
5246
|
-
scrollLeft:
|
|
5262
|
+
rotation: k,
|
|
5263
|
+
containerWidth: A.current?.clientWidth || 0,
|
|
5264
|
+
containerHeight: A.current?.clientHeight || 0,
|
|
5265
|
+
scrollTop: $e.top,
|
|
5266
|
+
scrollLeft: $e.left,
|
|
5247
5267
|
pageTop: i,
|
|
5248
5268
|
pageLeft: s,
|
|
5249
5269
|
basePageWidth: l.width,
|
|
5250
5270
|
basePageHeight: l.height,
|
|
5251
5271
|
activeTab: a,
|
|
5252
|
-
activeTool:
|
|
5272
|
+
activeTool: G,
|
|
5253
5273
|
annotations: f,
|
|
5254
|
-
transientHighlights:
|
|
5255
|
-
selectedAnnotationId:
|
|
5256
|
-
activeSearchResult:
|
|
5257
|
-
onMouseDown:
|
|
5258
|
-
onMouseMove:
|
|
5259
|
-
onMouseUp:
|
|
5260
|
-
onAnnotationClick:
|
|
5261
|
-
onAnnotationMouseEnter:
|
|
5274
|
+
transientHighlights: ye?.filter((e) => e.pageIndex === n) || [],
|
|
5275
|
+
selectedAnnotationId: X,
|
|
5276
|
+
activeSearchResult: Ge,
|
|
5277
|
+
onMouseDown: Fn,
|
|
5278
|
+
onMouseMove: Ln,
|
|
5279
|
+
onMouseUp: Rn,
|
|
5280
|
+
onAnnotationClick: Bn,
|
|
5281
|
+
onAnnotationMouseEnter: zn,
|
|
5262
5282
|
onClearSelection: () => {
|
|
5263
|
-
if (
|
|
5264
|
-
|
|
5283
|
+
if (ln.current || cn) {
|
|
5284
|
+
ln.current = !1;
|
|
5265
5285
|
return;
|
|
5266
5286
|
}
|
|
5267
|
-
|
|
5287
|
+
an(null), sn(null);
|
|
5268
5288
|
},
|
|
5269
|
-
watermark:
|
|
5270
|
-
watermarkText:
|
|
5271
|
-
redactions:
|
|
5272
|
-
onDiscardRedaction:
|
|
5273
|
-
onRendered:
|
|
5289
|
+
watermark: fe,
|
|
5290
|
+
watermarkText: pe,
|
|
5291
|
+
redactions: $,
|
|
5292
|
+
onDiscardRedaction: Cn,
|
|
5293
|
+
onRendered: kn,
|
|
5294
|
+
hideAnnotationsUntilPageRendered: xe
|
|
5274
5295
|
}),
|
|
5275
|
-
R.isActive && R.mode === "overlay" &&
|
|
5296
|
+
R.isActive && R.mode === "overlay" && Pe && /* @__PURE__ */ F("div", {
|
|
5276
5297
|
style: {
|
|
5277
5298
|
position: "absolute",
|
|
5278
5299
|
top: `${i}px`,
|
|
@@ -5287,13 +5308,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5287
5308
|
},
|
|
5288
5309
|
children: /* @__PURE__ */ F(St, {
|
|
5289
5310
|
pageNum: n,
|
|
5290
|
-
pdfDoc:
|
|
5311
|
+
pdfDoc: Pe,
|
|
5291
5312
|
scale: S,
|
|
5292
|
-
rotation:
|
|
5293
|
-
containerWidth:
|
|
5294
|
-
containerHeight:
|
|
5295
|
-
scrollTop:
|
|
5296
|
-
scrollLeft:
|
|
5313
|
+
rotation: k,
|
|
5314
|
+
containerWidth: A.current?.clientWidth || 0,
|
|
5315
|
+
containerHeight: A.current?.clientHeight || 0,
|
|
5316
|
+
scrollTop: $e.top,
|
|
5317
|
+
scrollLeft: $e.left,
|
|
5297
5318
|
pageTop: 0,
|
|
5298
5319
|
pageLeft: 0,
|
|
5299
5320
|
basePageWidth: l.width,
|
|
@@ -5321,18 +5342,18 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5321
5342
|
pointerEvents: "none",
|
|
5322
5343
|
zIndex: 16
|
|
5323
5344
|
},
|
|
5324
|
-
children: /* @__PURE__ */ F(
|
|
5345
|
+
children: /* @__PURE__ */ F(Nt, {
|
|
5325
5346
|
boxes: [...R.pageDiffsA?.[n] || [], ...R.pageDiffsB?.[n] || []],
|
|
5326
5347
|
scale: S,
|
|
5327
5348
|
selectedDiffId: R.diffItems[R.currentDiffIndex]?.id,
|
|
5328
5349
|
onSelectDiff: (e) => {
|
|
5329
5350
|
let t = R.diffItems.findIndex((t) => t.id === e);
|
|
5330
|
-
t !== -1 &&
|
|
5351
|
+
t !== -1 && Ot(t);
|
|
5331
5352
|
}
|
|
5332
5353
|
})
|
|
5333
5354
|
}),
|
|
5334
|
-
|
|
5335
|
-
let e =
|
|
5355
|
+
Y && Y.pageIndex === n && (() => {
|
|
5356
|
+
let e = k % 180 == 0 ? l.width : l.height, t = k % 180 == 0 ? l.height : l.width, n = _t(Y.x, Y.y, k, e, t);
|
|
5336
5357
|
return /* @__PURE__ */ I("div", {
|
|
5337
5358
|
style: {
|
|
5338
5359
|
position: "absolute",
|
|
@@ -5346,19 +5367,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5346
5367
|
flexDirection: "column"
|
|
5347
5368
|
},
|
|
5348
5369
|
children: [/* @__PURE__ */ F("textarea", {
|
|
5349
|
-
ref:
|
|
5350
|
-
value:
|
|
5351
|
-
onChange: (e) =>
|
|
5370
|
+
ref: rn,
|
|
5371
|
+
value: tn,
|
|
5372
|
+
onChange: (e) => nn(e.target.value),
|
|
5352
5373
|
onBlur: (e) => {
|
|
5353
|
-
e.currentTarget.parentElement?.contains(e.relatedTarget) ||
|
|
5374
|
+
e.currentTarget.parentElement?.contains(e.relatedTarget) || In();
|
|
5354
5375
|
},
|
|
5355
5376
|
onKeyDown: (e) => {
|
|
5356
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(),
|
|
5377
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), In());
|
|
5357
5378
|
},
|
|
5358
5379
|
style: {
|
|
5359
5380
|
backgroundColor: "transparent",
|
|
5360
5381
|
border: "none",
|
|
5361
|
-
color:
|
|
5382
|
+
color: Mt,
|
|
5362
5383
|
fontSize: "16px",
|
|
5363
5384
|
fontFamily: "sans-serif",
|
|
5364
5385
|
minWidth: "150px",
|
|
@@ -5367,7 +5388,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5367
5388
|
resize: "both",
|
|
5368
5389
|
padding: "8px"
|
|
5369
5390
|
},
|
|
5370
|
-
placeholder:
|
|
5391
|
+
placeholder: Y.type === "note" ? "Note text..." : "Type text...",
|
|
5371
5392
|
autoFocus: !0
|
|
5372
5393
|
}), /* @__PURE__ */ F("div", {
|
|
5373
5394
|
style: {
|
|
@@ -5378,7 +5399,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5378
5399
|
},
|
|
5379
5400
|
children: /* @__PURE__ */ F("button", {
|
|
5380
5401
|
onMouseDown: (e) => {
|
|
5381
|
-
e.preventDefault(),
|
|
5402
|
+
e.preventDefault(), In();
|
|
5382
5403
|
},
|
|
5383
5404
|
style: {
|
|
5384
5405
|
padding: "4px 12px",
|
|
@@ -5397,28 +5418,28 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5397
5418
|
] }, n);
|
|
5398
5419
|
});
|
|
5399
5420
|
};
|
|
5400
|
-
if (
|
|
5421
|
+
if (E === "continuous") return /* @__PURE__ */ F("div", {
|
|
5401
5422
|
style: {
|
|
5402
5423
|
position: "relative",
|
|
5403
5424
|
width: "100%",
|
|
5404
|
-
height: `${
|
|
5425
|
+
height: `${U.total}px`
|
|
5405
5426
|
},
|
|
5406
5427
|
children: H.map((e, n) => t(e, n, !0))
|
|
5407
5428
|
});
|
|
5408
5429
|
{
|
|
5409
|
-
let e = Math.max(0, H.findIndex((e) => e.includes(
|
|
5430
|
+
let e = Math.max(0, H.findIndex((e) => e.includes(M))), n = H[e] || [];
|
|
5410
5431
|
return /* @__PURE__ */ F("div", {
|
|
5411
5432
|
style: {
|
|
5412
5433
|
position: "relative",
|
|
5413
5434
|
width: "100%",
|
|
5414
|
-
minHeight: `${
|
|
5435
|
+
minHeight: `${U.heights[e] ?? 0}px`
|
|
5415
5436
|
},
|
|
5416
5437
|
children: t(n, e, !1)
|
|
5417
5438
|
});
|
|
5418
5439
|
}
|
|
5419
5440
|
})()
|
|
5420
5441
|
}),
|
|
5421
|
-
|
|
5442
|
+
E === "page-by-page" && j && /* @__PURE__ */ I("div", {
|
|
5422
5443
|
style: {
|
|
5423
5444
|
position: "absolute",
|
|
5424
5445
|
bottom: "16px",
|
|
@@ -5436,13 +5457,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5436
5457
|
},
|
|
5437
5458
|
children: [
|
|
5438
5459
|
/* @__PURE__ */ F("button", {
|
|
5439
|
-
onClick: () =>
|
|
5440
|
-
disabled:
|
|
5460
|
+
onClick: () => De(Math.max(1, M - 1)),
|
|
5461
|
+
disabled: M <= 1,
|
|
5441
5462
|
style: {
|
|
5442
5463
|
background: "none",
|
|
5443
5464
|
border: "none",
|
|
5444
|
-
color:
|
|
5445
|
-
cursor:
|
|
5465
|
+
color: M <= 1 ? "#888" : "#fff",
|
|
5466
|
+
cursor: M <= 1 ? "default" : "pointer",
|
|
5446
5467
|
display: "flex",
|
|
5447
5468
|
alignItems: "center"
|
|
5448
5469
|
},
|
|
@@ -5455,19 +5476,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5455
5476
|
},
|
|
5456
5477
|
children: [
|
|
5457
5478
|
"Page ",
|
|
5458
|
-
|
|
5479
|
+
M,
|
|
5459
5480
|
" of ",
|
|
5460
|
-
|
|
5481
|
+
j.numPages
|
|
5461
5482
|
]
|
|
5462
5483
|
}),
|
|
5463
5484
|
/* @__PURE__ */ F("button", {
|
|
5464
|
-
onClick: () =>
|
|
5465
|
-
disabled:
|
|
5485
|
+
onClick: () => De(Math.min(j.numPages, M + 1)),
|
|
5486
|
+
disabled: M >= j.numPages,
|
|
5466
5487
|
style: {
|
|
5467
5488
|
background: "none",
|
|
5468
5489
|
border: "none",
|
|
5469
|
-
color:
|
|
5470
|
-
cursor:
|
|
5490
|
+
color: M >= j.numPages ? "#888" : "#fff",
|
|
5491
|
+
cursor: M >= j.numPages ? "default" : "pointer",
|
|
5471
5492
|
display: "flex",
|
|
5472
5493
|
alignItems: "center"
|
|
5473
5494
|
},
|
|
@@ -5475,7 +5496,7 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5475
5496
|
})
|
|
5476
5497
|
]
|
|
5477
5498
|
}),
|
|
5478
|
-
!
|
|
5499
|
+
!j && /* @__PURE__ */ F("div", {
|
|
5479
5500
|
style: {
|
|
5480
5501
|
position: "absolute",
|
|
5481
5502
|
top: 0,
|
|
@@ -5491,22 +5512,22 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5491
5512
|
padding: "24px",
|
|
5492
5513
|
textAlign: "center"
|
|
5493
5514
|
},
|
|
5494
|
-
children:
|
|
5515
|
+
children: Te ? /* @__PURE__ */ I(P, { children: [/* @__PURE__ */ F("div", {
|
|
5495
5516
|
style: {
|
|
5496
5517
|
fontWeight: 600,
|
|
5497
5518
|
color: "var(--text-color)"
|
|
5498
5519
|
},
|
|
5499
|
-
children:
|
|
5520
|
+
children: Te.name === "PasswordException" ? "This document is password protected." : "The document could not be loaded."
|
|
5500
5521
|
}), /* @__PURE__ */ F("div", {
|
|
5501
5522
|
style: {
|
|
5502
5523
|
fontSize: "12px",
|
|
5503
5524
|
maxWidth: "480px",
|
|
5504
5525
|
wordBreak: "break-word"
|
|
5505
5526
|
},
|
|
5506
|
-
children:
|
|
5527
|
+
children: Te.message
|
|
5507
5528
|
})] }) : d ? "Loading document…" : "No document loaded."
|
|
5508
5529
|
}),
|
|
5509
|
-
|
|
5530
|
+
j && /* @__PURE__ */ I("div", {
|
|
5510
5531
|
style: {
|
|
5511
5532
|
position: "absolute",
|
|
5512
5533
|
bottom: "24px",
|
|
@@ -5525,13 +5546,13 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5525
5546
|
},
|
|
5526
5547
|
children: [
|
|
5527
5548
|
/* @__PURE__ */ F("button", {
|
|
5528
|
-
onClick: () =>
|
|
5529
|
-
disabled:
|
|
5549
|
+
onClick: () => yt(Math.max(1, M - 1)),
|
|
5550
|
+
disabled: M <= 1,
|
|
5530
5551
|
style: {
|
|
5531
5552
|
background: "none",
|
|
5532
5553
|
border: "none",
|
|
5533
|
-
color:
|
|
5534
|
-
cursor:
|
|
5554
|
+
color: M <= 1 ? "rgba(255,255,255,0.3)" : "white",
|
|
5555
|
+
cursor: M <= 1 ? "default" : "pointer",
|
|
5535
5556
|
display: "flex",
|
|
5536
5557
|
padding: 0
|
|
5537
5558
|
},
|
|
@@ -5546,19 +5567,19 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5546
5567
|
},
|
|
5547
5568
|
children: [
|
|
5548
5569
|
"Page ",
|
|
5549
|
-
|
|
5570
|
+
M,
|
|
5550
5571
|
" / ",
|
|
5551
|
-
|
|
5572
|
+
j.numPages
|
|
5552
5573
|
]
|
|
5553
5574
|
}),
|
|
5554
5575
|
/* @__PURE__ */ F("button", {
|
|
5555
|
-
onClick: () =>
|
|
5556
|
-
disabled:
|
|
5576
|
+
onClick: () => yt(Math.min(j.numPages, M + 1)),
|
|
5577
|
+
disabled: M >= j.numPages,
|
|
5557
5578
|
style: {
|
|
5558
5579
|
background: "none",
|
|
5559
5580
|
border: "none",
|
|
5560
|
-
color:
|
|
5561
|
-
cursor:
|
|
5581
|
+
color: M >= j.numPages ? "rgba(255,255,255,0.3)" : "white",
|
|
5582
|
+
cursor: M >= j.numPages ? "default" : "pointer",
|
|
5562
5583
|
display: "flex",
|
|
5563
5584
|
padding: 0
|
|
5564
5585
|
},
|
|
@@ -5566,11 +5587,11 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5566
5587
|
})
|
|
5567
5588
|
]
|
|
5568
5589
|
}),
|
|
5569
|
-
|
|
5570
|
-
annotation:
|
|
5571
|
-
position:
|
|
5590
|
+
X && on && /* @__PURE__ */ F(et, {
|
|
5591
|
+
annotation: W.find((e) => e.id === X),
|
|
5592
|
+
position: on,
|
|
5572
5593
|
onCopy: () => {
|
|
5573
|
-
let e =
|
|
5594
|
+
let e = W.find((e) => e.id === X);
|
|
5574
5595
|
if (e) {
|
|
5575
5596
|
let t = {
|
|
5576
5597
|
...e,
|
|
@@ -5584,56 +5605,56 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5584
5605
|
x: e.x + 20,
|
|
5585
5606
|
y: e.y + 20
|
|
5586
5607
|
};
|
|
5587
|
-
Q([...
|
|
5608
|
+
Q([...W, t]);
|
|
5588
5609
|
}
|
|
5589
|
-
|
|
5610
|
+
an(null), sn(null);
|
|
5590
5611
|
},
|
|
5591
5612
|
onDelete: () => {
|
|
5592
|
-
Q(
|
|
5613
|
+
Q(W.filter((e) => e.id !== X)), an(null), sn(null);
|
|
5593
5614
|
},
|
|
5594
5615
|
onUpdateColor: (e) => {
|
|
5595
|
-
Q(
|
|
5616
|
+
Q(W.map((t) => t.id === X ? {
|
|
5596
5617
|
...t,
|
|
5597
5618
|
color: e
|
|
5598
5619
|
} : t));
|
|
5599
5620
|
},
|
|
5600
5621
|
onOpenLinkModal: () => {
|
|
5601
|
-
|
|
5622
|
+
Z(!0), sn(null);
|
|
5602
5623
|
},
|
|
5603
|
-
permissions:
|
|
5624
|
+
permissions: be
|
|
5604
5625
|
}),
|
|
5605
|
-
R.isActive && R.showCurtain && /* @__PURE__ */ F(
|
|
5626
|
+
R.isActive && R.showCurtain && /* @__PURE__ */ F(Lt, {
|
|
5606
5627
|
positionPercent: R.curtainPosition,
|
|
5607
5628
|
onChangePosition: (e) => z((t) => ({
|
|
5608
5629
|
...t,
|
|
5609
5630
|
curtainPosition: e
|
|
5610
5631
|
})),
|
|
5611
|
-
containerRef:
|
|
5632
|
+
containerRef: A
|
|
5612
5633
|
})
|
|
5613
5634
|
]
|
|
5614
|
-
})] }), R.isActive && /* @__PURE__ */ F(
|
|
5615
|
-
isOpen:
|
|
5616
|
-
onClose: () =>
|
|
5635
|
+
})] }), R.isActive && /* @__PURE__ */ F(It, {
|
|
5636
|
+
isOpen: ze,
|
|
5637
|
+
onClose: () => Be(!1),
|
|
5617
5638
|
diffItems: R.diffItems,
|
|
5618
|
-
textDiffs:
|
|
5639
|
+
textDiffs: B,
|
|
5619
5640
|
currentDiffIndex: R.currentDiffIndex,
|
|
5620
|
-
onSelectDiff: (e, t) =>
|
|
5621
|
-
onJumpToPage: (e) =>
|
|
5641
|
+
onSelectDiff: (e, t) => Ot(e, t),
|
|
5642
|
+
onJumpToPage: (e) => yt(e)
|
|
5622
5643
|
})]
|
|
5623
5644
|
})
|
|
5624
5645
|
]
|
|
5625
5646
|
}),
|
|
5626
|
-
|
|
5627
|
-
initialUrl:
|
|
5628
|
-
initialText:
|
|
5629
|
-
showTextInput: !
|
|
5647
|
+
cn && X && /* @__PURE__ */ F(nt, {
|
|
5648
|
+
initialUrl: W.find((e) => e.id === X)?.linkUrl || "",
|
|
5649
|
+
initialText: W.find((e) => e.id === X)?.text || "",
|
|
5650
|
+
showTextInput: !W.find((e) => e.id === X)?.width || W.find((e) => e.id === X)?.text === "" || W.find((e) => e.id === X)?.text !== void 0,
|
|
5630
5651
|
onClose: () => {
|
|
5631
|
-
let e =
|
|
5632
|
-
e && !e.linkUrl && Q(
|
|
5652
|
+
let e = W.find((e) => e.id === X);
|
|
5653
|
+
e && !e.linkUrl && Q(W.filter((e) => e.id !== X)), Z(!1), an(null);
|
|
5633
5654
|
},
|
|
5634
5655
|
onSave: (e, t) => {
|
|
5635
|
-
Q(
|
|
5636
|
-
if (n.id ===
|
|
5656
|
+
Q(W.map((n) => {
|
|
5657
|
+
if (n.id === X) {
|
|
5637
5658
|
let r = t === void 0 ? n.text : t, i = r ? Math.max(100, r.length * 8 + 20) : n.width;
|
|
5638
5659
|
return {
|
|
5639
5660
|
...n,
|
|
@@ -5643,27 +5664,27 @@ function qt({ leftSidebarOpen: t, rightSidebarOpen: r, activeTab: a, annotationM
|
|
|
5643
5664
|
};
|
|
5644
5665
|
}
|
|
5645
5666
|
return n;
|
|
5646
|
-
})),
|
|
5667
|
+
})), Z(!1), an(null);
|
|
5647
5668
|
}
|
|
5648
5669
|
}),
|
|
5649
|
-
_ && /* @__PURE__ */ F(
|
|
5670
|
+
_ && /* @__PURE__ */ F(pt, {
|
|
5650
5671
|
isOpen: r,
|
|
5651
|
-
activeTab:
|
|
5652
|
-
setActiveTab:
|
|
5653
|
-
annotations:
|
|
5672
|
+
activeTab: ne,
|
|
5673
|
+
setActiveTab: re,
|
|
5674
|
+
annotations: W,
|
|
5654
5675
|
setAnnotations: Q,
|
|
5655
|
-
selectedAnnotationId:
|
|
5656
|
-
setSelectedAnnotationId:
|
|
5657
|
-
onSearch:
|
|
5658
|
-
searchResults:
|
|
5659
|
-
isSearching:
|
|
5660
|
-
searchProgress:
|
|
5661
|
-
onResultClick:
|
|
5676
|
+
selectedAnnotationId: X,
|
|
5677
|
+
setSelectedAnnotationId: an,
|
|
5678
|
+
onSearch: wn,
|
|
5679
|
+
searchResults: Tn,
|
|
5680
|
+
isSearching: En,
|
|
5681
|
+
searchProgress: Dn,
|
|
5682
|
+
onResultClick: xt
|
|
5662
5683
|
})
|
|
5663
5684
|
]
|
|
5664
5685
|
});
|
|
5665
5686
|
}
|
|
5666
|
-
function
|
|
5687
|
+
function qt({ icon: e, active: t, onClick: n, label: r }) {
|
|
5667
5688
|
return /* @__PURE__ */ F("button", {
|
|
5668
5689
|
onClick: n,
|
|
5669
5690
|
title: r,
|
|
@@ -5690,8 +5711,8 @@ function Jt({ icon: e, active: t, onClick: n, label: r }) {
|
|
|
5690
5711
|
}
|
|
5691
5712
|
//#endregion
|
|
5692
5713
|
//#region src/components/SettingsModal.tsx
|
|
5693
|
-
function
|
|
5694
|
-
let { shortcuts: r, updateShortcut: i, resetShortcuts: a } =
|
|
5714
|
+
function Jt({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
5715
|
+
let { shortcuts: r, updateShortcut: i, resetShortcuts: a } = ct(), [s, l] = c("Keyboard Shortcuts"), [u, d] = c(null), [f, p] = c(""), m = (e, t) => {
|
|
5695
5716
|
if (e.preventDefault(), e.stopPropagation(), e.key === "Escape") {
|
|
5696
5717
|
d(null);
|
|
5697
5718
|
return;
|
|
@@ -5717,7 +5738,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
5717
5738
|
},
|
|
5718
5739
|
children: "None"
|
|
5719
5740
|
});
|
|
5720
|
-
let t =
|
|
5741
|
+
let t = lt(e), n = typeof navigator < "u" && /mac/i.test(navigator.platform || navigator.userAgent || ""), r = [];
|
|
5721
5742
|
if (t.meta && r.push(n ? "⌘" : "Ctrl"), t.alt && r.push(n ? "⌥" : "Alt"), t.shift && r.push(n ? "⇧" : "Shift"), t.key) {
|
|
5722
5743
|
let e = t.key.toUpperCase();
|
|
5723
5744
|
e === "DELETE" && (e = n ? "⌫ Delete" : "Del"), r.push(e);
|
|
@@ -5807,7 +5828,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
5807
5828
|
display: "flex",
|
|
5808
5829
|
padding: "4px"
|
|
5809
5830
|
},
|
|
5810
|
-
children: /* @__PURE__ */ F(
|
|
5831
|
+
children: /* @__PURE__ */ F(N, { size: 20 })
|
|
5811
5832
|
})]
|
|
5812
5833
|
}),
|
|
5813
5834
|
/* @__PURE__ */ F("div", {
|
|
@@ -5819,7 +5840,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
5819
5840
|
children: /* @__PURE__ */ I("div", {
|
|
5820
5841
|
style: { position: "relative" },
|
|
5821
5842
|
children: [
|
|
5822
|
-
/* @__PURE__ */ F(
|
|
5843
|
+
/* @__PURE__ */ F(De, {
|
|
5823
5844
|
size: 16,
|
|
5824
5845
|
color: "var(--text-muted)",
|
|
5825
5846
|
style: {
|
|
@@ -5860,7 +5881,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
5860
5881
|
padding: 0
|
|
5861
5882
|
},
|
|
5862
5883
|
title: "Clear search",
|
|
5863
|
-
children: /* @__PURE__ */ F(
|
|
5884
|
+
children: /* @__PURE__ */ F(N, { size: 15 })
|
|
5864
5885
|
})
|
|
5865
5886
|
]
|
|
5866
5887
|
})
|
|
@@ -5943,7 +5964,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
5943
5964
|
cursor: "pointer"
|
|
5944
5965
|
},
|
|
5945
5966
|
title: "Reset all shortcuts to defaults",
|
|
5946
|
-
children: [/* @__PURE__ */ F(
|
|
5967
|
+
children: [/* @__PURE__ */ F(we, { size: 13 }), "Reset to Defaults"]
|
|
5947
5968
|
})]
|
|
5948
5969
|
}), v.length === 0 ? /* @__PURE__ */ I("div", {
|
|
5949
5970
|
style: {
|
|
@@ -6066,7 +6087,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
6066
6087
|
padding: "2px"
|
|
6067
6088
|
},
|
|
6068
6089
|
title: "Cancel",
|
|
6069
|
-
children: /* @__PURE__ */ F(
|
|
6090
|
+
children: /* @__PURE__ */ F(N, { size: 14 })
|
|
6070
6091
|
})]
|
|
6071
6092
|
}) : g(e.command)
|
|
6072
6093
|
}),
|
|
@@ -6104,7 +6125,7 @@ function K({ onClose: e, watermarkText: t, setWatermarkText: n }) {
|
|
|
6104
6125
|
fontSize: "12px"
|
|
6105
6126
|
},
|
|
6106
6127
|
title: "Edit shortcut",
|
|
6107
|
-
children: [/* @__PURE__ */ F(
|
|
6128
|
+
children: [/* @__PURE__ */ F(re, { size: 13 }), " Edit"]
|
|
6108
6129
|
})
|
|
6109
6130
|
})
|
|
6110
6131
|
]
|
|
@@ -6263,7 +6284,7 @@ function Yt({ onClose: e }) {
|
|
|
6263
6284
|
alignItems: "center",
|
|
6264
6285
|
gap: "8px"
|
|
6265
6286
|
},
|
|
6266
|
-
children: [/* @__PURE__ */ F(
|
|
6287
|
+
children: [/* @__PURE__ */ F(E, {
|
|
6267
6288
|
size: 20,
|
|
6268
6289
|
color: "#2b76b9"
|
|
6269
6290
|
}), /* @__PURE__ */ F("h2", {
|
|
@@ -6283,7 +6304,7 @@ function Yt({ onClose: e }) {
|
|
|
6283
6304
|
cursor: "pointer",
|
|
6284
6305
|
color: "#6b7280"
|
|
6285
6306
|
},
|
|
6286
|
-
children: /* @__PURE__ */ F(
|
|
6307
|
+
children: /* @__PURE__ */ F(N, { size: 20 })
|
|
6287
6308
|
})]
|
|
6288
6309
|
}),
|
|
6289
6310
|
/* @__PURE__ */ I("div", {
|
|
@@ -6483,21 +6504,21 @@ var q = class {
|
|
|
6483
6504
|
return this.destroyed;
|
|
6484
6505
|
}
|
|
6485
6506
|
}, Xt = (e) => e === 0 ? 0 : e;
|
|
6486
|
-
function
|
|
6507
|
+
function J(e, t) {
|
|
6487
6508
|
return {
|
|
6488
6509
|
x: Xt(e.x * t[0] + e.y * t[2] + t[4]),
|
|
6489
6510
|
y: Xt(e.x * t[1] + e.y * t[3] + t[5])
|
|
6490
6511
|
};
|
|
6491
6512
|
}
|
|
6492
|
-
function
|
|
6513
|
+
function Zt(e, t) {
|
|
6493
6514
|
let n = t[0] * t[3] - t[1] * t[2];
|
|
6494
6515
|
return {
|
|
6495
6516
|
x: Xt((e.x * t[3] - e.y * t[2] + t[2] * t[5] - t[4] * t[3]) / n),
|
|
6496
6517
|
y: Xt((-e.x * t[1] + e.y * t[0] + t[4] * t[1] - t[5] * t[0]) / n)
|
|
6497
6518
|
};
|
|
6498
6519
|
}
|
|
6499
|
-
function
|
|
6500
|
-
let r =
|
|
6520
|
+
function Qt(e, t, n) {
|
|
6521
|
+
let r = bt(n), [i, a, o, s] = t, c = (o + i) / 2, l = (s + a) / 2, u, d, f, p;
|
|
6501
6522
|
switch (r) {
|
|
6502
6523
|
case 180:
|
|
6503
6524
|
u = -1, d = 0, f = 0, p = 1;
|
|
@@ -6536,31 +6557,31 @@ function J(e, t, n) {
|
|
|
6536
6557
|
}
|
|
6537
6558
|
function $t(e) {
|
|
6538
6559
|
let t = e.view;
|
|
6539
|
-
return
|
|
6560
|
+
return Qt(e.pageNumber, [
|
|
6540
6561
|
t[0],
|
|
6541
6562
|
t[1],
|
|
6542
6563
|
t[2],
|
|
6543
6564
|
t[3]
|
|
6544
6565
|
], e.rotate);
|
|
6545
6566
|
}
|
|
6546
|
-
function
|
|
6567
|
+
function Y(e) {
|
|
6547
6568
|
let t = /* @__PURE__ */ new Map();
|
|
6548
6569
|
return (n) => {
|
|
6549
6570
|
let r = Math.max(1, Math.min(e.numPages, n)), i = t.get(r);
|
|
6550
6571
|
return i || (i = e.getPage(r).then($t), t.set(r, i)), i;
|
|
6551
6572
|
};
|
|
6552
6573
|
}
|
|
6574
|
+
function en(e, t) {
|
|
6575
|
+
return Zt(t, e.transform);
|
|
6576
|
+
}
|
|
6553
6577
|
function tn(e, t) {
|
|
6554
|
-
return
|
|
6578
|
+
return J(t, e.transform);
|
|
6555
6579
|
}
|
|
6556
6580
|
function nn(e, t) {
|
|
6557
|
-
|
|
6558
|
-
}
|
|
6559
|
-
function Y(e, t) {
|
|
6560
|
-
let n = tn(e, {
|
|
6581
|
+
let n = en(e, {
|
|
6561
6582
|
x: t.x,
|
|
6562
6583
|
y: t.y
|
|
6563
|
-
}), r =
|
|
6584
|
+
}), r = en(e, {
|
|
6564
6585
|
x: t.x + t.width,
|
|
6565
6586
|
y: t.y + t.height
|
|
6566
6587
|
});
|
|
@@ -6571,11 +6592,11 @@ function Y(e, t) {
|
|
|
6571
6592
|
Math.max(n.y, r.y)
|
|
6572
6593
|
];
|
|
6573
6594
|
}
|
|
6574
|
-
function
|
|
6575
|
-
let n =
|
|
6595
|
+
function rn(e, t) {
|
|
6596
|
+
let n = tn(e, {
|
|
6576
6597
|
x: t[0],
|
|
6577
6598
|
y: t[1]
|
|
6578
|
-
}), r =
|
|
6599
|
+
}), r = tn(e, {
|
|
6579
6600
|
x: t[2],
|
|
6580
6601
|
y: t[3]
|
|
6581
6602
|
});
|
|
@@ -6586,14 +6607,14 @@ function X(e, t) {
|
|
|
6586
6607
|
height: Math.abs(r.y - n.y)
|
|
6587
6608
|
};
|
|
6588
6609
|
}
|
|
6589
|
-
function
|
|
6590
|
-
return t.map((t) =>
|
|
6610
|
+
function X(e, t) {
|
|
6611
|
+
return t.map((t) => en(e, t));
|
|
6591
6612
|
}
|
|
6592
6613
|
function an(e, t) {
|
|
6593
|
-
return t.map((t) =>
|
|
6614
|
+
return t.map((t) => tn(e, t));
|
|
6594
6615
|
}
|
|
6595
6616
|
function on(e, t) {
|
|
6596
|
-
let [n, r, i, a] =
|
|
6617
|
+
let [n, r, i, a] = nn(e, t);
|
|
6597
6618
|
return [
|
|
6598
6619
|
n,
|
|
6599
6620
|
a,
|
|
@@ -6619,7 +6640,7 @@ function sn(e, t) {
|
|
|
6619
6640
|
t[r + 5],
|
|
6620
6641
|
t[r + 7]
|
|
6621
6642
|
];
|
|
6622
|
-
n.push(
|
|
6643
|
+
n.push(rn(e, [
|
|
6623
6644
|
Math.min(...i),
|
|
6624
6645
|
Math.min(...a),
|
|
6625
6646
|
Math.max(...i),
|
|
@@ -6648,12 +6669,12 @@ var Z = (e) => (Math.round(e * 1e3) / 1e3).toString(), ln = 524288e3, un = (e) =
|
|
|
6648
6669
|
return B(n, r, i);
|
|
6649
6670
|
};
|
|
6650
6671
|
async function dn(e, t, n, r, i) {
|
|
6651
|
-
let a = un(r.color), o = r.opacity ?? 1, s = r.strokeWidth || 1, [c, l, u, d] =
|
|
6672
|
+
let a = un(r.color), o = r.opacity ?? 1, s = r.strokeWidth || 1, [c, l, u, d] = nn(n, {
|
|
6652
6673
|
x: r.x,
|
|
6653
6674
|
y: r.y,
|
|
6654
6675
|
width: r.width,
|
|
6655
6676
|
height: r.height
|
|
6656
|
-
}), f = u - c, p = d - l, m =
|
|
6677
|
+
}), f = u - c, p = d - l, m = z(n.rotate), h = (e, t, r) => en(n, {
|
|
6657
6678
|
x: e,
|
|
6658
6679
|
y: t + r
|
|
6659
6680
|
});
|
|
@@ -6692,7 +6713,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6692
6713
|
height: r.height
|
|
6693
6714
|
}];
|
|
6694
6715
|
for (let r of e) {
|
|
6695
|
-
let [e, i, s, c] =
|
|
6716
|
+
let [e, i, s, c] = nn(n, r);
|
|
6696
6717
|
t.drawRectangle({
|
|
6697
6718
|
x: e,
|
|
6698
6719
|
y: i,
|
|
@@ -6700,7 +6721,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6700
6721
|
height: c - i,
|
|
6701
6722
|
color: a,
|
|
6702
6723
|
opacity: o < 1 ? o : .5,
|
|
6703
|
-
blendMode:
|
|
6724
|
+
blendMode: Pe.Multiply
|
|
6704
6725
|
});
|
|
6705
6726
|
}
|
|
6706
6727
|
return;
|
|
@@ -6713,7 +6734,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6713
6734
|
}, {
|
|
6714
6735
|
x: r.x + r.width,
|
|
6715
6736
|
y: r.y + r.height
|
|
6716
|
-
}], [i, c] =
|
|
6737
|
+
}], [i, c] = X(n, [e[0], e[1]]);
|
|
6717
6738
|
if (t.drawLine({
|
|
6718
6739
|
start: i,
|
|
6719
6740
|
end: c,
|
|
@@ -6721,7 +6742,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6721
6742
|
opacity: o,
|
|
6722
6743
|
thickness: s
|
|
6723
6744
|
}), r.type === "arrow") {
|
|
6724
|
-
let r = e[0], i = e[1], l = Math.atan2(i.y - r.y, i.x - r.x), u = 15 + s, [d, f] =
|
|
6745
|
+
let r = e[0], i = e[1], l = Math.atan2(i.y - r.y, i.x - r.x), u = 15 + s, [d, f] = X(n, [{
|
|
6725
6746
|
x: i.x - u * Math.cos(l - Math.PI / 6),
|
|
6726
6747
|
y: i.y - u * Math.sin(l - Math.PI / 6)
|
|
6727
6748
|
}, {
|
|
@@ -6747,7 +6768,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6747
6768
|
case "freehand": {
|
|
6748
6769
|
let e = r.strokes && r.strokes.length > 0 ? r.strokes : r.points ? [r.points] : [];
|
|
6749
6770
|
for (let r of e) {
|
|
6750
|
-
let e =
|
|
6771
|
+
let e = X(n, r);
|
|
6751
6772
|
for (let n = 1; n < e.length; n++) t.drawLine({
|
|
6752
6773
|
start: e[n - 1],
|
|
6753
6774
|
end: e[n],
|
|
@@ -6773,7 +6794,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6773
6794
|
return;
|
|
6774
6795
|
}
|
|
6775
6796
|
case "note": {
|
|
6776
|
-
let [e, i, c, l] =
|
|
6797
|
+
let [e, i, c, l] = nn(n, {
|
|
6777
6798
|
x: r.x,
|
|
6778
6799
|
y: r.y,
|
|
6779
6800
|
width: 24,
|
|
@@ -6807,7 +6828,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6807
6828
|
}, {
|
|
6808
6829
|
x: r.x,
|
|
6809
6830
|
y: r.y
|
|
6810
|
-
}], [i, c] =
|
|
6831
|
+
}], [i, c] = X(n, [e[0], e[1]]);
|
|
6811
6832
|
if (t.drawLine({
|
|
6812
6833
|
start: i,
|
|
6813
6834
|
end: c,
|
|
@@ -6815,7 +6836,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6815
6836
|
opacity: o,
|
|
6816
6837
|
thickness: s
|
|
6817
6838
|
}), r.text) {
|
|
6818
|
-
let i = r.text.length * 8 + 20, [c, l, u, d] =
|
|
6839
|
+
let i = r.text.length * 8 + 20, [c, l, u, d] = nn(n, {
|
|
6819
6840
|
x: e[1].x,
|
|
6820
6841
|
y: e[1].y,
|
|
6821
6842
|
width: i,
|
|
@@ -6909,7 +6930,7 @@ async function dn(e, t, n, r, i) {
|
|
|
6909
6930
|
}
|
|
6910
6931
|
}
|
|
6911
6932
|
async function fn(e, t) {
|
|
6912
|
-
let n = un(t.color || "#737373"), r = t.opacity ?? .08, i = await e.embedFont(
|
|
6933
|
+
let n = un(t.color || "#737373"), r = t.opacity ?? .08, i = await e.embedFont(R.Helvetica), a = -Math.PI / 4, o = Math.cos(a), s = Math.sin(a);
|
|
6913
6934
|
for (let a of e.getPages()) {
|
|
6914
6935
|
let { width: e, height: c } = a.getSize();
|
|
6915
6936
|
if (t.mode === "single") {
|
|
@@ -6921,7 +6942,7 @@ async function fn(e, t) {
|
|
|
6921
6942
|
font: i,
|
|
6922
6943
|
color: n,
|
|
6923
6944
|
opacity: r,
|
|
6924
|
-
rotate:
|
|
6945
|
+
rotate: z(-45)
|
|
6925
6946
|
});
|
|
6926
6947
|
} else {
|
|
6927
6948
|
let l = t.size || 18, u = i.widthOfTextAtSize(t.text, l), d = u + 150, f = -u / 2, p = -l * .35, m = f * o - p * s, h = f * s + p * o;
|
|
@@ -6934,17 +6955,17 @@ async function fn(e, t) {
|
|
|
6934
6955
|
font: i,
|
|
6935
6956
|
color: n,
|
|
6936
6957
|
opacity: r,
|
|
6937
|
-
rotate:
|
|
6958
|
+
rotate: z(-45)
|
|
6938
6959
|
});
|
|
6939
6960
|
}
|
|
6940
6961
|
}
|
|
6941
6962
|
}
|
|
6942
6963
|
}
|
|
6943
|
-
async function
|
|
6964
|
+
async function pn(e, t) {
|
|
6944
6965
|
let n = await e.save(), r = L.getDocument({
|
|
6945
6966
|
data: n,
|
|
6946
|
-
...
|
|
6947
|
-
}), i = await r.promise, a = await
|
|
6967
|
+
...jt()
|
|
6968
|
+
}), i = await r.promise, a = await Fe.create();
|
|
6948
6969
|
try {
|
|
6949
6970
|
for (let n = 1; n <= i.numPages; n++) {
|
|
6950
6971
|
let r = t.filter((e) => e.pageIndex === n);
|
|
@@ -6980,18 +7001,18 @@ async function Q(e, t) {
|
|
|
6980
7001
|
}
|
|
6981
7002
|
return a;
|
|
6982
7003
|
}
|
|
6983
|
-
async function
|
|
7004
|
+
async function mn(e, t = {}) {
|
|
6984
7005
|
t.xfdfString && console.warn("[teamsync-pdf-viewer] getFileData({ xfdfString }) is ignored; import the XFDF through annotationManager.importAnnotations() first.");
|
|
6985
7006
|
let n = await e.getSourceBytes(), r = n instanceof Uint8Array ? n : new Uint8Array(n);
|
|
6986
7007
|
if (r.byteLength > 524288e3) {
|
|
6987
7008
|
let e = (r.byteLength / 1048576).toFixed(2);
|
|
6988
7009
|
throw Error(`File is too large (${e} MB) to save directly in the browser. Use exportAnnotations() to save annotation data and apply it on your server.`);
|
|
6989
7010
|
}
|
|
6990
|
-
let i = await
|
|
7011
|
+
let i = await Fe.load(r, { ignoreEncryption: !0 }), a = i.getPages(), o = t.explicitAnnotations || e.annotations, s = e.getPageGeometry, c = null;
|
|
6991
7012
|
!s && o.length > 0 && (c = L.getDocument({
|
|
6992
7013
|
data: r.slice(),
|
|
6993
|
-
...
|
|
6994
|
-
}), s =
|
|
7014
|
+
...jt()
|
|
7015
|
+
}), s = Y(await c.promise));
|
|
6995
7016
|
try {
|
|
6996
7017
|
for (let t of o) {
|
|
6997
7018
|
let n = Math.max(0, Math.min((t.pageIndex || 1) - 1, a.length - 1)), r = await s(n + 1);
|
|
@@ -7002,11 +7023,11 @@ async function pn(e, t = {}) {
|
|
|
7002
7023
|
}
|
|
7003
7024
|
e.watermark?.text && await fn(i, e.watermark);
|
|
7004
7025
|
let l = e.redactions || [];
|
|
7005
|
-
return await (l.length > 0 ? await
|
|
7026
|
+
return await (l.length > 0 ? await pn(i, l) : i).save();
|
|
7006
7027
|
}
|
|
7007
7028
|
//#endregion
|
|
7008
7029
|
//#region src/annotations/xfdf.ts
|
|
7009
|
-
var
|
|
7030
|
+
var Q = "http://ns.adobe.com/xfdf/", hn = "tspdf", gn = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
7010
7031
|
function _n(e, t = 2) {
|
|
7011
7032
|
return String(e).padStart(t, "0");
|
|
7012
7033
|
}
|
|
@@ -7097,7 +7118,7 @@ var Dn = /* @__PURE__ */ new Set([
|
|
|
7097
7118
|
"vertices"
|
|
7098
7119
|
]);
|
|
7099
7120
|
function kn(e, t, n, r) {
|
|
7100
|
-
let i = r ??
|
|
7121
|
+
let i = r ?? nn(t, {
|
|
7101
7122
|
x: e.x,
|
|
7102
7123
|
y: e.y,
|
|
7103
7124
|
width: e.width,
|
|
@@ -7134,7 +7155,7 @@ async function Fn(e, t, n = {}) {
|
|
|
7134
7155
|
}, {
|
|
7135
7156
|
x: e.x + e.width,
|
|
7136
7157
|
y: e.y + e.height
|
|
7137
|
-
}], [n, i] =
|
|
7158
|
+
}], [n, i] = X(r, [t[0], t[1]]), a = [
|
|
7138
7159
|
Math.min(n.x, i.x),
|
|
7139
7160
|
Math.min(n.y, i.y),
|
|
7140
7161
|
Math.max(n.x, i.x),
|
|
@@ -7143,8 +7164,8 @@ async function Fn(e, t, n = {}) {
|
|
|
7143
7164
|
return `<line${s(a)}${o} start="${Z(n.x)},${Z(n.y)}" end="${Z(i.x)},${Z(i.y)}"${l} subject="${e.type === "arrow" ? "Arrow" : "Line"}">${c()}</line>`;
|
|
7144
7165
|
}
|
|
7145
7166
|
case "freehand": {
|
|
7146
|
-
let t = e.strokes && e.strokes.length > 0 ? e.strokes : e.points ? [e.points] : [], n = t.map((e) => `<gesture>${Cn(
|
|
7147
|
-
return `<ink${s(i.length ?
|
|
7167
|
+
let t = e.strokes && e.strokes.length > 0 ? e.strokes : e.points ? [e.points] : [], n = t.map((e) => `<gesture>${Cn(X(r, e))}</gesture>`).join(""), i = t.flat();
|
|
7168
|
+
return `<ink${s(i.length ? nn(r, In(i, e.strokeWidth)) : void 0)}${o} subject="Free Hand"><inklist>${n}</inklist>${c()}</ink>`;
|
|
7148
7169
|
}
|
|
7149
7170
|
case "highlight": {
|
|
7150
7171
|
let t = e.rects && e.rects.length > 0 ? e.rects : [{
|
|
@@ -7153,7 +7174,7 @@ async function Fn(e, t, n = {}) {
|
|
|
7153
7174
|
width: e.width,
|
|
7154
7175
|
height: e.height
|
|
7155
7176
|
}], n = t.flatMap((e) => on(r, e)).map(Z).join(",");
|
|
7156
|
-
return `<highlight${s(
|
|
7177
|
+
return `<highlight${s(nn(r, cn(t)))}${$("color", a)} coords="${n}" subject="Highlight">${c()}</highlight>`;
|
|
7157
7178
|
}
|
|
7158
7179
|
case "text": return `<freetext${s()}${$("color", a)} subject="Free Text">${Nn(e.text)}${Pn(e, 16)}${c()}</freetext>`;
|
|
7159
7180
|
case "callout": {
|
|
@@ -7163,7 +7184,7 @@ async function Fn(e, t, n = {}) {
|
|
|
7163
7184
|
}, {
|
|
7164
7185
|
x: e.x,
|
|
7165
7186
|
y: e.y
|
|
7166
|
-
}], [n, i] =
|
|
7187
|
+
}], [n, i] = X(r, [t[0], t[1]]), a = nn(r, {
|
|
7167
7188
|
x: t[1].x,
|
|
7168
7189
|
y: t[1].y,
|
|
7169
7190
|
width: e.text ? e.text.length * 8 + 20 : 100,
|
|
@@ -7176,7 +7197,7 @@ async function Fn(e, t, n = {}) {
|
|
|
7176
7197
|
Math.max(i.y, a[3])
|
|
7177
7198
|
])}${o} IT="FreeTextCallout" callout="${Z(n.x)},${Z(n.y)},${Z(i.x)},${Z(i.y)}" subject="Callout">${Nn(e.text)}${Pn(e, 14)}${c({ box: a })}</freetext>`;
|
|
7178
7199
|
}
|
|
7179
|
-
case "note": return `<text${s(
|
|
7200
|
+
case "note": return `<text${s(nn(r, {
|
|
7180
7201
|
x: e.x,
|
|
7181
7202
|
y: e.y,
|
|
7182
7203
|
width: 24,
|
|
@@ -7210,7 +7231,7 @@ function In(e, t = 0) {
|
|
|
7210
7231
|
}
|
|
7211
7232
|
async function Ln(e, t, n = {}) {
|
|
7212
7233
|
let r = n.annotList ?? e;
|
|
7213
|
-
return `<?xml version="1.0" encoding="UTF-8"?><xfdf xmlns="${
|
|
7234
|
+
return `<?xml version="1.0" encoding="UTF-8"?><xfdf xmlns="${Q}" xml:space="preserve"><annots>${(await Promise.all(r.map((e) => Fn(e, t, n)))).filter(Boolean).join("")}</annots></xfdf>`;
|
|
7214
7235
|
}
|
|
7215
7236
|
function Rn(e) {
|
|
7216
7237
|
let t = {};
|
|
@@ -7234,7 +7255,7 @@ function zn(e, t) {
|
|
|
7234
7255
|
return Array.from(e.children).find((e) => e.localName === t)?.textContent ?? void 0;
|
|
7235
7256
|
}
|
|
7236
7257
|
function Bn(e, t) {
|
|
7237
|
-
let n = Tn(e.getAttribute("rect")), r = n.length === 4 ?
|
|
7258
|
+
let n = Tn(e.getAttribute("rect")), r = n.length === 4 ? rn(t, [
|
|
7238
7259
|
n[0],
|
|
7239
7260
|
n[1],
|
|
7240
7261
|
n[2],
|
|
@@ -7412,7 +7433,7 @@ async function Un(e, t) {
|
|
|
7412
7433
|
let n = Hn(e).trim();
|
|
7413
7434
|
if (!n) return [];
|
|
7414
7435
|
if (/<!DOCTYPE|<!ENTITY/i.test(n)) throw Error("[teamsync-pdf-viewer] invalid XFDF: DOCTYPE/ENTITY declarations are not allowed");
|
|
7415
|
-
let r = `<xfdf xmlns="${
|
|
7436
|
+
let r = `<xfdf xmlns="${Q}"><annots>${n}</annots></xfdf>`, i = new DOMParser().parseFromString(r, "application/xml"), a = i.getElementsByTagName("parsererror")[0];
|
|
7416
7437
|
if (a) throw Error(`[teamsync-pdf-viewer] invalid XFDF: ${a.textContent?.slice(0, 200)}`);
|
|
7417
7438
|
let o = /* @__PURE__ */ new Set([
|
|
7418
7439
|
"xfdf",
|
|
@@ -7440,7 +7461,7 @@ var Wn = 100, Gn = () => (/* @__PURE__ */ new Date()).toISOString(), Kn = class
|
|
|
7440
7461
|
canEditOthers = !1;
|
|
7441
7462
|
resolver = null;
|
|
7442
7463
|
setDocument(e) {
|
|
7443
|
-
this.resolver = e ?
|
|
7464
|
+
this.resolver = e ? Y(e) : null;
|
|
7444
7465
|
}
|
|
7445
7466
|
hasDocument() {
|
|
7446
7467
|
return this.resolver !== null;
|
|
@@ -7732,7 +7753,7 @@ var Wn = 100, Gn = () => (/* @__PURE__ */ new Date()).toISOString(), Kn = class
|
|
|
7732
7753
|
let t = this.getPdfDocument();
|
|
7733
7754
|
if (!t) return [];
|
|
7734
7755
|
let n = this.binding;
|
|
7735
|
-
return
|
|
7756
|
+
return dt(t, e, n ? n.getRedactions() : []);
|
|
7736
7757
|
}
|
|
7737
7758
|
getTransientHighlights() {
|
|
7738
7759
|
return this.binding?.getTransientHighlights() ?? [];
|
|
@@ -7771,14 +7792,14 @@ var Wn = 100, Gn = () => (/* @__PURE__ */ new Date()).toISOString(), Kn = class
|
|
|
7771
7792
|
async getFileData(e = {}) {
|
|
7772
7793
|
let t = this.binding ?? qn(), n = t.getPdfDocument(), r = t.getDocumentUrl();
|
|
7773
7794
|
if (!n && !r) throw Error("No document loaded");
|
|
7774
|
-
return
|
|
7795
|
+
return mn({
|
|
7775
7796
|
getSourceBytes: async () => {
|
|
7776
7797
|
if (n) return n.getData();
|
|
7777
7798
|
let e = await fetch(r);
|
|
7778
7799
|
if (!e.ok) throw Error(`Failed to fetch document (${e.status})`);
|
|
7779
7800
|
return e.arrayBuffer();
|
|
7780
7801
|
},
|
|
7781
|
-
getPageGeometry: n ?
|
|
7802
|
+
getPageGeometry: n ? Y(n) : void 0,
|
|
7782
7803
|
annotations: this.annotationManager.getAnnotationsList(),
|
|
7783
7804
|
redactions: t.getRedactions(),
|
|
7784
7805
|
watermark: t.getWatermark(),
|
|
@@ -7863,19 +7884,19 @@ async function Yn(e, t = {}) {
|
|
|
7863
7884
|
//#endregion
|
|
7864
7885
|
//#region src/components/TeamSyncViewer.tsx
|
|
7865
7886
|
var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, Zn = e.forwardRef(function(e, t) {
|
|
7866
|
-
let { fileUrl: r, initialDoc: l, initialScale: u, initialPage: d, page: f, transientHighlights: p, plugins: m, redactions: h, regexRedactions: g, enableAnnotations: _, enableSign: v = !1, watermark: y, permissions: b, enableRedactions: x, canAddAnnotations: ee, canEditAnnotations: S, canDeleteAnnotations:
|
|
7867
|
-
|
|
7868
|
-
let
|
|
7869
|
-
|
|
7870
|
-
let
|
|
7871
|
-
a(t, () =>
|
|
7872
|
-
let
|
|
7887
|
+
let { fileUrl: r, initialDoc: l, initialScale: u, initialPage: d, page: f, transientHighlights: p, plugins: m, redactions: h, regexRedactions: g, enableAnnotations: _, enableSign: v = !1, watermark: y, permissions: b, enableRedactions: x, canAddAnnotations: ee, canEditAnnotations: S, canDeleteAnnotations: te, readOnly: ne = !1, assets: re, withCredentials: ie = !1, toolbar: ae = !0, sidebars: oe = !0, leftPanelOpen: C = !0, className: se, style: ce, hideAnnotationsUntilPageRendered: le = !0 } = e, w = s(e);
|
|
7888
|
+
w.current = e;
|
|
7889
|
+
let ue = s(null), T = o(() => new q(), []), E = o(() => new Kn(), []), D = s(null);
|
|
7890
|
+
D.current ||= new Jn(T, E);
|
|
7891
|
+
let O = D.current;
|
|
7892
|
+
a(t, () => O, [O]);
|
|
7893
|
+
let k = r ?? l, [de, fe] = c(k), [pe, me] = c(0);
|
|
7873
7894
|
i(() => {
|
|
7874
|
-
|
|
7875
|
-
}, [
|
|
7876
|
-
let
|
|
7877
|
-
|
|
7878
|
-
}, []), [
|
|
7895
|
+
fe(k);
|
|
7896
|
+
}, [k]);
|
|
7897
|
+
let he = n((e) => {
|
|
7898
|
+
fe(e), me((e) => e + 1);
|
|
7899
|
+
}, []), [ge, _e] = c("View"), [ve, ye] = c(oe && C), [be, xe] = c(!1), [Se, A] = c("Comments"), [Ce, j] = c(typeof u == "number" ? u : 1), [we, Te] = c(!1), [Ee, M] = c(!1), [De, Oe] = c("continuous"), [ke, Ae] = c("single"), [je, Me] = c(0), [Ne, N] = c(""), P = o(() => ne ? {
|
|
7879
7900
|
canAddAnnotations: !1,
|
|
7880
7901
|
canEditAnnotations: !1,
|
|
7881
7902
|
canDeleteAnnotations: !1,
|
|
@@ -7883,109 +7904,109 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
|
|
|
7883
7904
|
} : {
|
|
7884
7905
|
canAddAnnotations: b?.canAddAnnotations ?? ee ?? _ !== !1,
|
|
7885
7906
|
canEditAnnotations: b?.canEditAnnotations ?? S ?? _ !== !1,
|
|
7886
|
-
canDeleteAnnotations: b?.canDeleteAnnotations ??
|
|
7907
|
+
canDeleteAnnotations: b?.canDeleteAnnotations ?? te ?? _ !== !1,
|
|
7887
7908
|
canRedact: b?.canRedact ?? x ?? !0
|
|
7888
7909
|
}, [
|
|
7889
|
-
|
|
7910
|
+
ne,
|
|
7890
7911
|
b,
|
|
7891
7912
|
ee,
|
|
7892
7913
|
S,
|
|
7893
|
-
|
|
7914
|
+
te,
|
|
7894
7915
|
_,
|
|
7895
7916
|
x
|
|
7896
|
-
]),
|
|
7917
|
+
]), L = !ne && _ !== !1, Pe = e.currentUser?.id, Fe = e.currentUser?.name;
|
|
7897
7918
|
i(() => {
|
|
7898
|
-
|
|
7899
|
-
id:
|
|
7900
|
-
name:
|
|
7919
|
+
E.setCurrentUserInfo(Pe || Fe ? {
|
|
7920
|
+
id: Pe,
|
|
7921
|
+
name: Fe
|
|
7901
7922
|
} : void 0);
|
|
7902
7923
|
}, [
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7924
|
+
E,
|
|
7925
|
+
Pe,
|
|
7926
|
+
Fe
|
|
7906
7927
|
]), i(() => {
|
|
7907
|
-
|
|
7908
|
-
}, [
|
|
7909
|
-
|
|
7910
|
-
}, [
|
|
7911
|
-
|
|
7912
|
-
}, [
|
|
7913
|
-
P.canAddAnnotations === !1 &&
|
|
7914
|
-
}, [P.canAddAnnotations,
|
|
7915
|
-
let
|
|
7928
|
+
E.setReadOnly(ne);
|
|
7929
|
+
}, [E, ne]), i(() => {
|
|
7930
|
+
E.setCanEditOthers(!!b?.canEditOthers);
|
|
7931
|
+
}, [E, b?.canEditOthers]), i(() => {
|
|
7932
|
+
E.clear(), E.setDocument(null);
|
|
7933
|
+
}, [E, de]), i(() => E.addEventListener("annotationChanged", (e) => T.emit("annotationChanged", e)), [E, T]), i(() => {
|
|
7934
|
+
P.canAddAnnotations === !1 && ge === "Annotate" && _e("View");
|
|
7935
|
+
}, [P.canAddAnnotations, ge]);
|
|
7936
|
+
let R = s([]), z = s(null), B = s({
|
|
7916
7937
|
current: 1,
|
|
7917
7938
|
count: 0
|
|
7918
|
-
}),
|
|
7919
|
-
|
|
7920
|
-
let
|
|
7921
|
-
|
|
7922
|
-
let
|
|
7923
|
-
Ve(e),
|
|
7939
|
+
}), Le = s(de);
|
|
7940
|
+
Le.current = de;
|
|
7941
|
+
let Re = s(null), ze = s(!1), [Be, Ve] = c([]), He = o(() => p ?? Be, [p, Be]), Ue = s(He);
|
|
7942
|
+
Ue.current = He;
|
|
7943
|
+
let We = n((e) => {
|
|
7944
|
+
Ve(e), w.current.onTransientHighlightsChange?.(e);
|
|
7924
7945
|
}, []);
|
|
7925
|
-
i(() => (
|
|
7926
|
-
getAnnotations: () =>
|
|
7927
|
-
getRedactions: () =>
|
|
7928
|
-
getWatermark: () =>
|
|
7929
|
-
getPdfDocument: () =>
|
|
7930
|
-
getDocumentUrl: () =>
|
|
7931
|
-
getFileName: () =>
|
|
7932
|
-
getCurrentUserName: () =>
|
|
7933
|
-
getCurrentPage: () =>
|
|
7934
|
-
getPageCount: () =>
|
|
7935
|
-
loadDocument:
|
|
7946
|
+
i(() => (O._bind({
|
|
7947
|
+
getAnnotations: () => E.getAnnotationsList(),
|
|
7948
|
+
getRedactions: () => R.current,
|
|
7949
|
+
getWatermark: () => w.current.watermark,
|
|
7950
|
+
getPdfDocument: () => z.current,
|
|
7951
|
+
getDocumentUrl: () => Le.current,
|
|
7952
|
+
getFileName: () => w.current.fileName,
|
|
7953
|
+
getCurrentUserName: () => w.current.currentUser?.name,
|
|
7954
|
+
getCurrentPage: () => B.current.current,
|
|
7955
|
+
getPageCount: () => B.current.count,
|
|
7956
|
+
loadDocument: he,
|
|
7936
7957
|
goToPage: (e, t) => {
|
|
7937
|
-
|
|
7958
|
+
T.emit("action-go-to-page", {
|
|
7938
7959
|
page: e,
|
|
7939
7960
|
smooth: t?.smooth
|
|
7940
7961
|
});
|
|
7941
7962
|
},
|
|
7942
|
-
getTransientHighlights: () =>
|
|
7943
|
-
setTransientHighlights:
|
|
7944
|
-
},
|
|
7945
|
-
A,
|
|
7946
|
-
k,
|
|
7947
|
-
pe,
|
|
7963
|
+
getTransientHighlights: () => Ue.current,
|
|
7964
|
+
setTransientHighlights: We
|
|
7965
|
+
}, ue.current), () => O._unbind()), [
|
|
7948
7966
|
O,
|
|
7949
|
-
|
|
7967
|
+
E,
|
|
7968
|
+
he,
|
|
7969
|
+
T,
|
|
7970
|
+
We
|
|
7950
7971
|
]);
|
|
7951
|
-
let
|
|
7972
|
+
let Ge = s(!1);
|
|
7952
7973
|
i(() => {
|
|
7953
|
-
|
|
7954
|
-
}, [
|
|
7974
|
+
Ge.current || (Ge.current = !0, w.current.autoFocus && ue.current?.focus({ preventScroll: !0 }), w.current.onReady?.(O));
|
|
7975
|
+
}, [O]), i(() => {
|
|
7955
7976
|
let e = (e) => {
|
|
7956
|
-
|
|
7977
|
+
xe(!0), A(e);
|
|
7957
7978
|
}, t = [
|
|
7958
|
-
|
|
7979
|
+
T.on("action-open-elements", (t) => {
|
|
7959
7980
|
let n = t?.elements ?? [];
|
|
7960
|
-
n.includes("leftPanel") &&
|
|
7981
|
+
n.includes("leftPanel") && ye(!0), n.includes("notesPanel") && e("Comments"), n.includes("searchPanel") && e("Search");
|
|
7961
7982
|
}),
|
|
7962
|
-
|
|
7983
|
+
T.on("action-close-elements", (e) => {
|
|
7963
7984
|
let t = e?.elements ?? [];
|
|
7964
|
-
t.includes("leftPanel") &&
|
|
7985
|
+
t.includes("leftPanel") && ye(!1), (t.includes("notesPanel") || t.includes("searchPanel")) && xe(!1);
|
|
7965
7986
|
}),
|
|
7966
|
-
|
|
7987
|
+
T.on("action-set-active-left-panel", (t) => {
|
|
7967
7988
|
let n = t?.panel;
|
|
7968
|
-
n === "notesPanel" ? e("Comments") : n === "searchPanel" ? e("Search") :
|
|
7989
|
+
n === "notesPanel" ? e("Comments") : n === "searchPanel" ? e("Search") : ye(!0);
|
|
7969
7990
|
}),
|
|
7970
|
-
|
|
7971
|
-
|
|
7991
|
+
T.on("action-tool-changed", (e) => T.emit("toolChanged", { tool: e?.tool ?? null })),
|
|
7992
|
+
T.on("action-print", async () => {
|
|
7972
7993
|
try {
|
|
7973
|
-
await Yn(await
|
|
7994
|
+
await Yn(await O.getFileData(), { title: w.current.fileName });
|
|
7974
7995
|
} catch (e) {
|
|
7975
|
-
console.error("[teamsync-pdf-viewer] print failed", e),
|
|
7996
|
+
console.error("[teamsync-pdf-viewer] print failed", e), T.emit("action-print-error", { error: e });
|
|
7976
7997
|
}
|
|
7977
7998
|
}),
|
|
7978
|
-
|
|
7999
|
+
T.on("action-download", async () => {
|
|
7979
8000
|
try {
|
|
7980
|
-
let e =
|
|
7981
|
-
if (e ?
|
|
8001
|
+
let e = Re.current;
|
|
8002
|
+
if (e ? Re.current = null : e = await O.getFileData(), !e) return;
|
|
7982
8003
|
let t = new Blob([e], { type: "application/pdf" }), n = URL.createObjectURL(t), r = document.createElement("a");
|
|
7983
|
-
r.href = n, r.download =
|
|
8004
|
+
r.href = n, r.download = w.current.fileName || "annotated_document.pdf", r.click(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
7984
8005
|
} catch (e) {
|
|
7985
|
-
console.error("[teamsync-pdf-viewer] download failed", e),
|
|
8006
|
+
console.error("[teamsync-pdf-viewer] download failed", e), T.emit("action-download-error", { error: e });
|
|
7986
8007
|
}
|
|
7987
8008
|
}),
|
|
7988
|
-
|
|
8009
|
+
T.on("action-process-digital-signature", async (e) => {
|
|
7989
8010
|
try {
|
|
7990
8011
|
let { pageIndex: t, x: n, y: r, width: i, height: a } = e, o = {
|
|
7991
8012
|
id: Xn(),
|
|
@@ -7998,185 +8019,194 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
|
|
|
7998
8019
|
color: "#0f172a",
|
|
7999
8020
|
strokeWidth: 1,
|
|
8000
8021
|
opacity: 1,
|
|
8001
|
-
signer:
|
|
8022
|
+
signer: w.current.currentUser?.name ?? "Unknown signer",
|
|
8002
8023
|
timestamp: Date.now()
|
|
8003
|
-
}, s = [...
|
|
8004
|
-
|
|
8005
|
-
let c = await
|
|
8006
|
-
if (
|
|
8007
|
-
|
|
8024
|
+
}, s = [...O.getAnnotations(), o];
|
|
8025
|
+
T.emit("action-waiting-for-pin-start");
|
|
8026
|
+
let c = await O.getFileData({ explicitAnnotations: s });
|
|
8027
|
+
if (T.emit("action-waiting-for-pin-end"), !c) return;
|
|
8028
|
+
Re.current = c, T.emit("action-commit-digital-signature", { tempAnn: o });
|
|
8008
8029
|
} catch (e) {
|
|
8009
|
-
|
|
8030
|
+
T.emit("action-waiting-for-pin-error", { error: e?.message ?? String(e) }), console.error("[teamsync-pdf-viewer] process signature failed", e);
|
|
8010
8031
|
}
|
|
8011
8032
|
}),
|
|
8012
|
-
|
|
8013
|
-
|
|
8033
|
+
T.on("action-set-transient-highlights", (e) => {
|
|
8034
|
+
We(e?.highlights ?? []);
|
|
8014
8035
|
}),
|
|
8015
|
-
|
|
8016
|
-
|
|
8036
|
+
T.on("action-clear-transient-highlights", () => {
|
|
8037
|
+
We([]);
|
|
8017
8038
|
}),
|
|
8018
|
-
|
|
8039
|
+
T.on("action-commit-digital-signature", (e) => T.emit("action-commit-digital-signature-local", e))
|
|
8019
8040
|
];
|
|
8020
8041
|
return () => t.forEach((e) => e());
|
|
8021
8042
|
}, [
|
|
8043
|
+
T,
|
|
8022
8044
|
O,
|
|
8023
|
-
|
|
8024
|
-
Ue
|
|
8045
|
+
We
|
|
8025
8046
|
]);
|
|
8026
|
-
let
|
|
8027
|
-
|
|
8047
|
+
let Ye = n((e, t) => {
|
|
8048
|
+
z.current = e, E.setDocument(e), B.current = {
|
|
8028
8049
|
current: 1,
|
|
8029
8050
|
count: e.numPages
|
|
8030
|
-
},
|
|
8051
|
+
}, ze.current = !1, T.emit("documentLoaded", {
|
|
8031
8052
|
url: t,
|
|
8032
8053
|
numPages: e.numPages
|
|
8033
|
-
}),
|
|
8054
|
+
}), w.current.onDocumentLoaded?.({
|
|
8034
8055
|
url: t,
|
|
8035
8056
|
numPages: e.numPages
|
|
8036
8057
|
});
|
|
8037
|
-
}, [
|
|
8038
|
-
|
|
8058
|
+
}, [T, E]), Xe = n((e, t) => {
|
|
8059
|
+
z.current = null, E.setDocument(null), T.emit("documentLoadError", {
|
|
8039
8060
|
url: t.url,
|
|
8040
8061
|
error: e,
|
|
8041
8062
|
passwordRequired: t.passwordRequired
|
|
8042
|
-
}), t.passwordRequired &&
|
|
8063
|
+
}), t.passwordRequired && w.current.onPasswordRequired?.({ url: t.url }), w.current.onDocumentLoadError?.(e, (e) => he(e ?? t.url), t);
|
|
8043
8064
|
}, [
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8047
|
-
]),
|
|
8048
|
-
let t =
|
|
8049
|
-
if (!
|
|
8050
|
-
|
|
8051
|
-
let e =
|
|
8052
|
-
e === "fit-width" ? setTimeout(() =>
|
|
8065
|
+
T,
|
|
8066
|
+
he,
|
|
8067
|
+
E
|
|
8068
|
+
]), Ze = n((e) => {
|
|
8069
|
+
let t = Le.current ?? "";
|
|
8070
|
+
if (!ze.current) {
|
|
8071
|
+
ze.current = !0;
|
|
8072
|
+
let e = w.current.initialScale;
|
|
8073
|
+
e === "fit-width" ? setTimeout(() => T.emit("action-fit-to-width"), 0) : e === "fit-page" && setTimeout(() => T.emit("action-fit-to-page"), 0);
|
|
8053
8074
|
}
|
|
8054
|
-
|
|
8075
|
+
T.emit("firstPageRendered", {
|
|
8076
|
+
url: t,
|
|
8077
|
+
pageNumber: e
|
|
8078
|
+
}), w.current.onFirstPageRendered?.({
|
|
8079
|
+
url: t,
|
|
8080
|
+
pageNumber: e
|
|
8081
|
+
});
|
|
8082
|
+
}, [T]), $e = n((e) => {
|
|
8083
|
+
let t = Le.current ?? "";
|
|
8084
|
+
T.emit("pageRendered", {
|
|
8055
8085
|
url: t,
|
|
8056
8086
|
pageNumber: e
|
|
8057
|
-
}),
|
|
8087
|
+
}), w.current.onPageRendered?.({
|
|
8058
8088
|
url: t,
|
|
8059
8089
|
pageNumber: e
|
|
8060
8090
|
});
|
|
8061
|
-
}, [
|
|
8062
|
-
|
|
8091
|
+
}, [T]), V = n((e, t) => {
|
|
8092
|
+
B.current = {
|
|
8063
8093
|
current: e,
|
|
8064
8094
|
count: t
|
|
8065
|
-
},
|
|
8095
|
+
}, T.emit("pageChanged", {
|
|
8066
8096
|
pageNumber: e,
|
|
8067
8097
|
numPages: t
|
|
8068
|
-
}),
|
|
8069
|
-
}, [
|
|
8070
|
-
|
|
8071
|
-
}, [
|
|
8072
|
-
|
|
8073
|
-
}, []), { getCommand:
|
|
8074
|
-
|
|
8075
|
-
}, [
|
|
8076
|
-
|
|
8098
|
+
}), w.current.onPageChange?.(e, t);
|
|
8099
|
+
}, [T]), et = n((e) => {
|
|
8100
|
+
T.emit("annotationsChanged", { annotations: e }), w.current.onAnnotationsChange?.(e);
|
|
8101
|
+
}, [T]), tt = n((e) => {
|
|
8102
|
+
R.current = e;
|
|
8103
|
+
}, []), { getCommand: nt } = ct(), rt = s(null), it = n(() => {
|
|
8104
|
+
oe && (xe(!0), A("Search"), setTimeout(() => T.emit("action-focus-search"), 50));
|
|
8105
|
+
}, [oe, T]), H = n(() => {
|
|
8106
|
+
rt.current?.click();
|
|
8077
8107
|
}, []);
|
|
8078
8108
|
return i(() => {
|
|
8079
|
-
let e =
|
|
8109
|
+
let e = T.on("action-open-search", it), t = T.on("action-open-file-picker", H);
|
|
8080
8110
|
return () => {
|
|
8081
8111
|
e(), t();
|
|
8082
8112
|
};
|
|
8083
8113
|
}, [
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8114
|
+
T,
|
|
8115
|
+
it,
|
|
8116
|
+
H
|
|
8087
8117
|
]), i(() => {
|
|
8088
|
-
|
|
8118
|
+
ue.current && (document.activeElement === document.body || !document.activeElement) && ue.current.focus({ preventScroll: !0 });
|
|
8089
8119
|
}, []), i(() => {
|
|
8090
8120
|
let e = (e) => {
|
|
8091
8121
|
let t = e.target;
|
|
8092
8122
|
if (t?.tagName === "INPUT" || t?.tagName === "TEXTAREA" || t?.isContentEditable) return;
|
|
8093
|
-
let n =
|
|
8123
|
+
let n = ue.current;
|
|
8094
8124
|
if (n && (document.activeElement === document.body || document.activeElement === document.documentElement || document.activeElement === null || n.contains(document.activeElement)) && !n.contains(document.activeElement)) {
|
|
8095
|
-
if (
|
|
8096
|
-
e.preventDefault(),
|
|
8125
|
+
if (ut(e, nt("SEARCH"))) {
|
|
8126
|
+
e.preventDefault(), it();
|
|
8097
8127
|
return;
|
|
8098
8128
|
}
|
|
8099
|
-
if (
|
|
8100
|
-
e.preventDefault(),
|
|
8129
|
+
if (ut(e, nt("FILE_PICKER"))) {
|
|
8130
|
+
e.preventDefault(), H();
|
|
8101
8131
|
return;
|
|
8102
8132
|
}
|
|
8103
|
-
|
|
8133
|
+
T.emit("viewer-keydown", e);
|
|
8104
8134
|
}
|
|
8105
8135
|
};
|
|
8106
8136
|
return window.addEventListener("keydown", e), () => {
|
|
8107
8137
|
window.removeEventListener("keydown", e);
|
|
8108
8138
|
};
|
|
8109
8139
|
}, [
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8140
|
+
T,
|
|
8141
|
+
nt,
|
|
8142
|
+
it,
|
|
8143
|
+
H
|
|
8114
8144
|
]), /* @__PURE__ */ F(Ie.Provider, {
|
|
8115
|
-
value:
|
|
8145
|
+
value: T,
|
|
8116
8146
|
children: /* @__PURE__ */ I("div", {
|
|
8117
|
-
ref:
|
|
8118
|
-
className: ["tspdf-root",
|
|
8119
|
-
style:
|
|
8147
|
+
ref: ue,
|
|
8148
|
+
className: ["tspdf-root", se].filter(Boolean).join(" "),
|
|
8149
|
+
style: ce,
|
|
8120
8150
|
tabIndex: -1,
|
|
8121
8151
|
"data-teamsync-pdf-viewer": "",
|
|
8122
8152
|
onKeyDownCapture: (e) => {
|
|
8123
|
-
if (
|
|
8124
|
-
e.preventDefault(),
|
|
8153
|
+
if (ut(e.nativeEvent, nt("SEARCH"))) {
|
|
8154
|
+
e.preventDefault(), it();
|
|
8125
8155
|
return;
|
|
8126
8156
|
}
|
|
8127
|
-
if (
|
|
8128
|
-
e.preventDefault(),
|
|
8157
|
+
if (ut(e.nativeEvent, nt("FILE_PICKER"))) {
|
|
8158
|
+
e.preventDefault(), H();
|
|
8129
8159
|
return;
|
|
8130
8160
|
}
|
|
8131
|
-
|
|
8161
|
+
T.emit("viewer-keydown", e.nativeEvent);
|
|
8132
8162
|
},
|
|
8133
8163
|
onMouseDownCapture: () => {
|
|
8134
|
-
let e =
|
|
8164
|
+
let e = ue.current;
|
|
8135
8165
|
e && !e.contains(document.activeElement) && e.focus({ preventScroll: !0 });
|
|
8136
8166
|
},
|
|
8137
8167
|
children: [
|
|
8138
|
-
|
|
8139
|
-
activeTab:
|
|
8168
|
+
ae && /* @__PURE__ */ F(Qe, {
|
|
8169
|
+
activeTab: ge,
|
|
8140
8170
|
setActiveTab: (e) => {
|
|
8141
|
-
(P.canAddAnnotations !== !1 || e !== "Annotate") &&
|
|
8171
|
+
(P.canAddAnnotations !== !1 || e !== "Annotate") && _e(e);
|
|
8142
8172
|
},
|
|
8143
|
-
leftSidebarOpen:
|
|
8173
|
+
leftSidebarOpen: ve,
|
|
8144
8174
|
setLeftSidebarOpen: (e) => {
|
|
8145
|
-
|
|
8175
|
+
oe && ye(e);
|
|
8146
8176
|
},
|
|
8147
|
-
rightSidebarOpen:
|
|
8148
|
-
setRightSidebarOpen:
|
|
8149
|
-
sidebarTab:
|
|
8150
|
-
scale:
|
|
8151
|
-
onZoomIn: () =>
|
|
8152
|
-
onZoomOut: () =>
|
|
8153
|
-
onZoomSet: (e) =>
|
|
8154
|
-
onOpenFile:
|
|
8155
|
-
onDownload: () =>
|
|
8177
|
+
rightSidebarOpen: be,
|
|
8178
|
+
setRightSidebarOpen: xe,
|
|
8179
|
+
sidebarTab: Se,
|
|
8180
|
+
scale: Ce,
|
|
8181
|
+
onZoomIn: () => j((e) => Ke(e)),
|
|
8182
|
+
onZoomOut: () => j((e) => qe(e)),
|
|
8183
|
+
onZoomSet: (e) => j(Je(e)),
|
|
8184
|
+
onOpenFile: H,
|
|
8185
|
+
onDownload: () => T.emit("action-download"),
|
|
8156
8186
|
onFullScreen: () => {
|
|
8157
|
-
let e =
|
|
8187
|
+
let e = ue.current ?? document.documentElement;
|
|
8158
8188
|
document.fullscreenElement ? document.exitFullscreen?.().catch(() => {}) : e.requestFullscreen?.().catch(() => {});
|
|
8159
8189
|
},
|
|
8160
|
-
onSaveAs: () =>
|
|
8161
|
-
onPrint: () =>
|
|
8162
|
-
onOpenSettings: () =>
|
|
8163
|
-
onOpenAbout: () =>
|
|
8190
|
+
onSaveAs: () => T.emit("action-download"),
|
|
8191
|
+
onPrint: () => T.emit("action-print"),
|
|
8192
|
+
onOpenSettings: () => Te(!0),
|
|
8193
|
+
onOpenAbout: () => M(!0),
|
|
8164
8194
|
onOpenSidebarTab: (e) => {
|
|
8165
|
-
|
|
8195
|
+
oe && (be && Se === e ? xe(!1) : (xe(!0), A(e), e === "Search" && setTimeout(() => T.emit("action-focus-search"), 50)));
|
|
8166
8196
|
},
|
|
8167
|
-
pageTransition:
|
|
8168
|
-
setPageTransition:
|
|
8169
|
-
pageLayout:
|
|
8170
|
-
setPageLayout:
|
|
8171
|
-
rotation:
|
|
8172
|
-
setRotation:
|
|
8173
|
-
enableAnnotations:
|
|
8197
|
+
pageTransition: De,
|
|
8198
|
+
setPageTransition: Oe,
|
|
8199
|
+
pageLayout: ke,
|
|
8200
|
+
setPageLayout: Ae,
|
|
8201
|
+
rotation: je,
|
|
8202
|
+
setRotation: Me,
|
|
8203
|
+
enableAnnotations: L,
|
|
8174
8204
|
enableSign: v,
|
|
8175
8205
|
plugins: m,
|
|
8176
8206
|
permissions: P
|
|
8177
8207
|
}),
|
|
8178
8208
|
/* @__PURE__ */ F("input", {
|
|
8179
|
-
ref:
|
|
8209
|
+
ref: rt,
|
|
8180
8210
|
type: "file",
|
|
8181
8211
|
accept: "application/pdf",
|
|
8182
8212
|
style: { display: "none" },
|
|
@@ -8184,7 +8214,7 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
|
|
|
8184
8214
|
let t = e.target.files?.[0];
|
|
8185
8215
|
if (t) {
|
|
8186
8216
|
let e = URL.createObjectURL(t);
|
|
8187
|
-
|
|
8217
|
+
he(e);
|
|
8188
8218
|
}
|
|
8189
8219
|
e.target.value = "";
|
|
8190
8220
|
},
|
|
@@ -8197,47 +8227,49 @@ var Xn = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID
|
|
|
8197
8227
|
minHeight: 0,
|
|
8198
8228
|
overflow: "hidden"
|
|
8199
8229
|
},
|
|
8200
|
-
children: /* @__PURE__ */ F(
|
|
8201
|
-
leftSidebarOpen:
|
|
8202
|
-
rightSidebarOpen:
|
|
8203
|
-
sidebarTab:
|
|
8204
|
-
setSidebarTab:
|
|
8205
|
-
sidebars:
|
|
8206
|
-
activeTab:
|
|
8207
|
-
annotationManager:
|
|
8208
|
-
initialDoc:
|
|
8209
|
-
loadNonce:
|
|
8210
|
-
withCredentials:
|
|
8211
|
-
assets:
|
|
8230
|
+
children: /* @__PURE__ */ F(Kt, {
|
|
8231
|
+
leftSidebarOpen: oe && ve,
|
|
8232
|
+
rightSidebarOpen: oe && be,
|
|
8233
|
+
sidebarTab: Se,
|
|
8234
|
+
setSidebarTab: A,
|
|
8235
|
+
sidebars: oe,
|
|
8236
|
+
activeTab: ge,
|
|
8237
|
+
annotationManager: E,
|
|
8238
|
+
initialDoc: de,
|
|
8239
|
+
loadNonce: pe,
|
|
8240
|
+
withCredentials: ie,
|
|
8241
|
+
assets: re,
|
|
8212
8242
|
redactions: h,
|
|
8213
8243
|
regexRedactions: g,
|
|
8214
|
-
scale:
|
|
8215
|
-
setScale:
|
|
8216
|
-
onAnnotationsChange:
|
|
8217
|
-
onRedactionsChange:
|
|
8218
|
-
onDocumentLoaded:
|
|
8219
|
-
onLoadError:
|
|
8220
|
-
onFirstPageRendered:
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8224
|
-
|
|
8225
|
-
|
|
8244
|
+
scale: Ce,
|
|
8245
|
+
setScale: j,
|
|
8246
|
+
onAnnotationsChange: et,
|
|
8247
|
+
onRedactionsChange: tt,
|
|
8248
|
+
onDocumentLoaded: Ye,
|
|
8249
|
+
onLoadError: Xe,
|
|
8250
|
+
onFirstPageRendered: Ze,
|
|
8251
|
+
onPageRendered: $e,
|
|
8252
|
+
onPageChange: V,
|
|
8253
|
+
pageTransition: De,
|
|
8254
|
+
pageLayout: ke,
|
|
8255
|
+
rotation: je,
|
|
8256
|
+
setRotation: Me,
|
|
8226
8257
|
watermark: y,
|
|
8227
|
-
watermarkText:
|
|
8228
|
-
enableAnnotations:
|
|
8258
|
+
watermarkText: Ne,
|
|
8259
|
+
enableAnnotations: L,
|
|
8229
8260
|
initialPage: d,
|
|
8230
8261
|
page: f,
|
|
8231
|
-
transientHighlights:
|
|
8232
|
-
permissions: P
|
|
8262
|
+
transientHighlights: He,
|
|
8263
|
+
permissions: P,
|
|
8264
|
+
hideAnnotationsUntilPageRendered: le
|
|
8233
8265
|
})
|
|
8234
8266
|
}),
|
|
8235
|
-
|
|
8236
|
-
onClose: () =>
|
|
8237
|
-
watermarkText:
|
|
8238
|
-
setWatermarkText:
|
|
8267
|
+
we && /* @__PURE__ */ F(Jt, {
|
|
8268
|
+
onClose: () => Te(!1),
|
|
8269
|
+
watermarkText: Ne,
|
|
8270
|
+
setWatermarkText: N
|
|
8239
8271
|
}),
|
|
8240
|
-
|
|
8272
|
+
Ee && /* @__PURE__ */ F(Yt, { onClose: () => M(!1) })
|
|
8241
8273
|
]
|
|
8242
8274
|
})
|
|
8243
8275
|
});
|
|
@@ -8261,6 +8293,6 @@ function Qn(e, t) {
|
|
|
8261
8293
|
}
|
|
8262
8294
|
var $n = Qn;
|
|
8263
8295
|
//#endregion
|
|
8264
|
-
export { Kn as AnnotationManager, Tt as DEFAULT_FALLBACK_DIMS, ln as MAX_EXPORT_BYTES,
|
|
8296
|
+
export { Kn as AnnotationManager, Tt as DEFAULT_FALLBACK_DIMS, ln as MAX_EXPORT_BYTES, Be as MAX_SCALE, ze as MIN_SCALE, Zn as TeamSyncViewer, q as ViewerBus, $n as WebViewer, Jn as WebViewerInstance, Q as XFDF_NS, Fn as annotationToXfdfFragment, Ln as annotationsToXfdf, mn as buildPdfBytes, Ke as calculateNextZoomIn, qe as calculateNextZoomOut, Xe as calculateScrollCompensation, Je as clampScale, Gt as computeCanvasPixelDiff, zt as computePageDiffBoxes, Dt as computeRowLayout, Ht as computeTextDiff, kt as configurePdfAssets, Y as createGeometryResolver, Qt as createPageGeometry, Qn as createWebViewer, Et as estimatePageDimensions, Rt as extractWordsFromPage, yn as fromPdfDate, tn as fromPdfPoint, $t as geometryFromPage, G as getPdfAssetPaths, Ot as hasDimensionMismatch, K as isWorkerConfigured, Ct as newAnnotationId, Un as parseXfdf, Mt as pdfjsVersion, Yn as printPdfBytes, sn as quadPointsToRects, rn as rectFromPdf, nn as rectToPdf, on as rectToQuadPoints, dt as searchPdfText, Wt as tintCanvas, vn as toPdfDate, en as toPdfPoint, ft as usePdfSearch };
|
|
8265
8297
|
|
|
8266
8298
|
//# sourceMappingURL=teamsync-pdf-viewer.js.map
|