@tawqi3i/pdf-viewer 0.1.0
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/README.md +162 -0
- package/dist/index.js +1717 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/index.d.ts +350 -0
- package/package.json +71 -0
- package/vite-plugin.d.ts +18 -0
- package/vite-plugin.js +50 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1717 @@
|
|
|
1
|
+
import { jsxs as a, jsx as e, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import { memo as ve, useRef as F, useState as W, useEffect as $, useCallback as U } from "react";
|
|
3
|
+
import { GemBoxPdfViewer as fe } from "@gembox/pdfviewer";
|
|
4
|
+
import "@gembox/pdfviewer/dist/es/pdfviewer.css";
|
|
5
|
+
import { PDFDocument as pe, StandardFonts as ye, rgb as ge, degrees as ke } from "pdf-lib";
|
|
6
|
+
if (typeof window < "u" && !window["pdfjs-dist/build/pdf"]) {
|
|
7
|
+
const t = globalThis["pdfjs-dist/build/pdf"] ?? globalThis.pdfjsLib;
|
|
8
|
+
t && (window["pdfjs-dist/build/pdf"] = t);
|
|
9
|
+
}
|
|
10
|
+
let le = !1;
|
|
11
|
+
function Se(t) {
|
|
12
|
+
le || (fe.setLicense(t), le = !0);
|
|
13
|
+
}
|
|
14
|
+
function Ne({
|
|
15
|
+
fileUrl: t = null,
|
|
16
|
+
fileBlob: n = null,
|
|
17
|
+
height: o = "600px",
|
|
18
|
+
width: i = "100%",
|
|
19
|
+
className: l,
|
|
20
|
+
licenseKey: p = "FREE-LIMITED-KEY",
|
|
21
|
+
theme: m = null,
|
|
22
|
+
readOnly: g = !1,
|
|
23
|
+
visibility: u = null,
|
|
24
|
+
onLoad: x,
|
|
25
|
+
onError: S
|
|
26
|
+
}) {
|
|
27
|
+
const c = F(null), y = F(null), d = F(x), N = F(S), T = F({ url: t, blob: n }), [A, E] = W(null);
|
|
28
|
+
if ($(() => {
|
|
29
|
+
d.current = x;
|
|
30
|
+
}, [x]), $(() => {
|
|
31
|
+
N.current = S;
|
|
32
|
+
}, [S]), $(() => {
|
|
33
|
+
T.current = { url: t, blob: n }, E(null);
|
|
34
|
+
const w = y.current;
|
|
35
|
+
if (!w) return;
|
|
36
|
+
let D = !1;
|
|
37
|
+
return (async () => {
|
|
38
|
+
try {
|
|
39
|
+
const f = n ? await n.arrayBuffer() : t;
|
|
40
|
+
f && !D && (await w.open(f), d.current?.());
|
|
41
|
+
} catch (f) {
|
|
42
|
+
D || (E(f), N.current?.(f));
|
|
43
|
+
}
|
|
44
|
+
})(), () => {
|
|
45
|
+
D = !0;
|
|
46
|
+
};
|
|
47
|
+
}, [t, n]), $(() => {
|
|
48
|
+
const w = c.current;
|
|
49
|
+
if (!w) return;
|
|
50
|
+
const D = document.createElement("div");
|
|
51
|
+
D.style.width = "100%", D.style.height = "100%", w.appendChild(D);
|
|
52
|
+
let f = !1;
|
|
53
|
+
const v = g ? { open: !1, download: !1, print: !1, ...u } : u, B = {};
|
|
54
|
+
if (m && (B.theme = m), v) {
|
|
55
|
+
const r = {};
|
|
56
|
+
v.open !== void 0 && (r.openButton = { isVisible: v.open }), v.download !== void 0 && (r.downloadButton = { isVisible: v.download }), v.print !== void 0 && (r.printButton = { isVisible: v.print }), Object.keys(r).length && (B.toolbar = r);
|
|
57
|
+
}
|
|
58
|
+
return (async () => {
|
|
59
|
+
try {
|
|
60
|
+
Se(p);
|
|
61
|
+
const r = await fe.create({
|
|
62
|
+
container: D,
|
|
63
|
+
...Object.keys(B).length ? { ui: B } : {}
|
|
64
|
+
});
|
|
65
|
+
if (f) return;
|
|
66
|
+
y.current = r;
|
|
67
|
+
const { url: b, blob: h } = T.current, C = h ? await h.arrayBuffer() : b;
|
|
68
|
+
C && !f && (await r.open(C), d.current?.());
|
|
69
|
+
} catch (r) {
|
|
70
|
+
f || (E(r), N.current?.(r));
|
|
71
|
+
}
|
|
72
|
+
})(), () => {
|
|
73
|
+
f = !0, y.current = null, w.innerHTML = "";
|
|
74
|
+
};
|
|
75
|
+
}, []), A) {
|
|
76
|
+
const w = A?.message || String(A);
|
|
77
|
+
return /* @__PURE__ */ a(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: `flex flex-col items-center justify-center gap-2 border border-danger/30 rounded-md bg-danger/10 text-danger-dark text-sm p-4 ${l ?? ""}`,
|
|
81
|
+
style: { width: i, height: o, boxSizing: "border-box" },
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ e("span", { className: "font-medium", children: "Failed to load PDF" }),
|
|
84
|
+
w && /* @__PURE__ */ e("span", { className: "text-xs text-danger text-center max-w-sm wrap-break-word", children: w })
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ e("div", { ref: c, className: l, style: { width: i, height: o } });
|
|
90
|
+
}
|
|
91
|
+
const Ce = ve(Ne), k = { TEXT: "text", STAMP: "stamp", SIGNATURE: "Esig" }, oe = [
|
|
92
|
+
{ id: "approved", label: "APPROVED", color: "#15803d", bg: "#f0fdf4" },
|
|
93
|
+
{ id: "rejected", label: "REJECTED", color: "#dc2626", bg: "#fef2f2" },
|
|
94
|
+
{ id: "reviewed", label: "REVIEWED", color: "#0369a1", bg: "#f0f9ff" },
|
|
95
|
+
{ id: "void", label: "VOID", color: "#9f1239", bg: "#fff1f2" }
|
|
96
|
+
], Te = 220, Ee = 80, Me = 160, Le = 44, Ae = 120, De = 120, se = 8, Ie = `url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="1.5"><line x1="12" y1="2" x2="12" y2="22"/><line x1="2" y1="12" x2="22" y2="12"/><circle cx="12" cy="12" r="1.5" fill="black"/></svg>') 12 12, crosshair`;
|
|
97
|
+
let Re = 0;
|
|
98
|
+
const re = () => `ann-${++Re}`, O = (t, n) => Math.min(Math.max(t, 0), Math.max(0, 1 - n));
|
|
99
|
+
function ie(t, n) {
|
|
100
|
+
return document.elementsFromPoint(t, n).find((i) => i?.dataset?.pageNumber != null) ?? null;
|
|
101
|
+
}
|
|
102
|
+
function ce(t) {
|
|
103
|
+
return document.querySelector(`[data-page-number="${t + 1}"]`);
|
|
104
|
+
}
|
|
105
|
+
function Pe({
|
|
106
|
+
ann: t,
|
|
107
|
+
pos: n,
|
|
108
|
+
onDelete: o,
|
|
109
|
+
onDragStart: i,
|
|
110
|
+
onResizeStart: l,
|
|
111
|
+
onTextChange: p
|
|
112
|
+
}) {
|
|
113
|
+
const [m, g] = W(
|
|
114
|
+
t.type === k.TEXT && !t.content
|
|
115
|
+
), u = F(null);
|
|
116
|
+
if ($(() => {
|
|
117
|
+
m && u.current && u.current.focus();
|
|
118
|
+
}, [m]), !n) return null;
|
|
119
|
+
const x = (d) => {
|
|
120
|
+
m || (d.stopPropagation(), i(d, t.id));
|
|
121
|
+
}, S = /* @__PURE__ */ e(
|
|
122
|
+
"button",
|
|
123
|
+
{
|
|
124
|
+
onMouseDown: (d) => {
|
|
125
|
+
d.stopPropagation(), o(t.id);
|
|
126
|
+
},
|
|
127
|
+
className: "absolute -top-2.5 -right-2.5 w-5 h-5 rounded-full bg-danger text-white text-xs leading-none flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity shadow-md z-10",
|
|
128
|
+
children: "×"
|
|
129
|
+
}
|
|
130
|
+
), c = /* @__PURE__ */ e(
|
|
131
|
+
"div",
|
|
132
|
+
{
|
|
133
|
+
onMouseDown: (d) => {
|
|
134
|
+
d.stopPropagation(), l(d, t.id);
|
|
135
|
+
},
|
|
136
|
+
title: "Drag to resize",
|
|
137
|
+
style: { cursor: "nwse-resize" },
|
|
138
|
+
className: "absolute -bottom-1 -right-1 w-3.5 h-3.5 rounded-sm bg-brand border-2 border-white opacity-0 group-hover:opacity-100 transition-opacity shadow-md z-10"
|
|
139
|
+
}
|
|
140
|
+
), y = {
|
|
141
|
+
position: "absolute",
|
|
142
|
+
left: n.x,
|
|
143
|
+
top: n.y,
|
|
144
|
+
width: n.w,
|
|
145
|
+
height: n.h,
|
|
146
|
+
userSelect: m ? "text" : "none",
|
|
147
|
+
cursor: m ? "text" : "grab",
|
|
148
|
+
zIndex: 10,
|
|
149
|
+
pointerEvents: "auto"
|
|
150
|
+
};
|
|
151
|
+
if (t.type === k.TEXT)
|
|
152
|
+
return /* @__PURE__ */ a(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
style: y,
|
|
156
|
+
onMouseDown: x,
|
|
157
|
+
onClick: (d) => d.stopPropagation(),
|
|
158
|
+
className: "group",
|
|
159
|
+
children: [
|
|
160
|
+
m ? /* @__PURE__ */ e(
|
|
161
|
+
"textarea",
|
|
162
|
+
{
|
|
163
|
+
ref: u,
|
|
164
|
+
defaultValue: t.content,
|
|
165
|
+
onChange: (d) => p(t.id, d.target.value),
|
|
166
|
+
onBlur: () => g(!1),
|
|
167
|
+
onKeyDown: (d) => {
|
|
168
|
+
d.key === "Escape" && d.target.blur();
|
|
169
|
+
},
|
|
170
|
+
placeholder: "Type here…",
|
|
171
|
+
className: "w-full h-full rounded-md border-2 border-brand bg-yellow-50 text-ink shadow-lg outline-none resize-none",
|
|
172
|
+
style: {
|
|
173
|
+
boxSizing: "border-box",
|
|
174
|
+
fontSize: n.h / 5,
|
|
175
|
+
padding: `${n.h * 0.125}px ${n.w * 0.05}px`
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
) : /* @__PURE__ */ e(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
onDoubleClick: () => g(!0),
|
|
182
|
+
className: "w-full h-full rounded-md border-2 border-yellow-400 bg-yellow-50 text-ink shadow-md whitespace-pre-wrap overflow-hidden",
|
|
183
|
+
style: {
|
|
184
|
+
boxSizing: "border-box",
|
|
185
|
+
fontSize: n.h / 5,
|
|
186
|
+
padding: `${n.h * 0.125}px ${n.w * 0.05}px`
|
|
187
|
+
},
|
|
188
|
+
children: t.content || /* @__PURE__ */ e("span", { className: "text-ink-muted italic text-xs", children: "Double-click to edit" })
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
S,
|
|
192
|
+
c
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
if (t.type === k.STAMP) {
|
|
197
|
+
const d = se * Math.PI / 180, N = Math.cos(d), T = Math.sin(d), A = Math.min(
|
|
198
|
+
n.w / (n.w * N + n.h * T),
|
|
199
|
+
n.h / (n.w * T + n.h * N)
|
|
200
|
+
), E = t.stamp.label || "", f = E.length * 0.65 + Math.max(0, E.length - 1) * 0.18, v = f > 0 ? n.w * 0.82 / f : n.h * 0.42, B = Math.max(8, Math.min(v, n.h * 0.42));
|
|
201
|
+
return /* @__PURE__ */ a(
|
|
202
|
+
"div",
|
|
203
|
+
{
|
|
204
|
+
style: y,
|
|
205
|
+
onMouseDown: x,
|
|
206
|
+
onClick: (r) => r.stopPropagation(),
|
|
207
|
+
className: "group",
|
|
208
|
+
children: [
|
|
209
|
+
t.stamp.imageUrl ? /* @__PURE__ */ e(
|
|
210
|
+
"img",
|
|
211
|
+
{
|
|
212
|
+
src: t.stamp.imageUrl,
|
|
213
|
+
alt: "Stamp",
|
|
214
|
+
style: { width: "100%", height: "100%", objectFit: "contain" },
|
|
215
|
+
className: "select-none rounded shadow-md",
|
|
216
|
+
draggable: !1
|
|
217
|
+
}
|
|
218
|
+
) : /* @__PURE__ */ e(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
style: {
|
|
222
|
+
width: "100%",
|
|
223
|
+
height: "100%",
|
|
224
|
+
color: t.stamp.color,
|
|
225
|
+
borderColor: t.stamp.color,
|
|
226
|
+
backgroundColor: t.stamp.bg,
|
|
227
|
+
transform: `rotate(-${se}deg) scale(${A})`,
|
|
228
|
+
transformOrigin: "center",
|
|
229
|
+
boxSizing: "border-box",
|
|
230
|
+
display: "flex",
|
|
231
|
+
alignItems: "center",
|
|
232
|
+
justifyContent: "center",
|
|
233
|
+
fontSize: B,
|
|
234
|
+
whiteSpace: "nowrap",
|
|
235
|
+
overflow: "hidden"
|
|
236
|
+
},
|
|
237
|
+
className: "border-[3px] rounded-lg font-black tracking-[0.18em] uppercase shadow-md select-none",
|
|
238
|
+
children: E
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
S,
|
|
242
|
+
c
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
return t.type === k.SIGNATURE ? /* @__PURE__ */ a(
|
|
248
|
+
"div",
|
|
249
|
+
{
|
|
250
|
+
style: y,
|
|
251
|
+
onMouseDown: x,
|
|
252
|
+
onClick: (d) => d.stopPropagation(),
|
|
253
|
+
className: "group",
|
|
254
|
+
children: [
|
|
255
|
+
/* @__PURE__ */ e(
|
|
256
|
+
"img",
|
|
257
|
+
{
|
|
258
|
+
src: t.imageData,
|
|
259
|
+
alt: "Signature",
|
|
260
|
+
style: { width: "100%", height: "100%" },
|
|
261
|
+
className: "select-none",
|
|
262
|
+
draggable: !1
|
|
263
|
+
}
|
|
264
|
+
),
|
|
265
|
+
S,
|
|
266
|
+
c
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
) : null;
|
|
270
|
+
}
|
|
271
|
+
function Ue({
|
|
272
|
+
annotations: t,
|
|
273
|
+
activeTool: n,
|
|
274
|
+
pendingSignature: o,
|
|
275
|
+
onPlace: i,
|
|
276
|
+
onDelete: l,
|
|
277
|
+
onMove: p,
|
|
278
|
+
onResize: m,
|
|
279
|
+
onTextChange: g
|
|
280
|
+
}) {
|
|
281
|
+
const u = F(null), x = F(null), S = F(t), c = F({}), [, y] = W(0), [d, N] = W(null), T = n === k.SIGNATURE && !!o;
|
|
282
|
+
$(() => {
|
|
283
|
+
T || N(null);
|
|
284
|
+
}, [T]);
|
|
285
|
+
const A = U(
|
|
286
|
+
(r) => {
|
|
287
|
+
if (!T) return;
|
|
288
|
+
const b = u.current;
|
|
289
|
+
if (!b) return;
|
|
290
|
+
const h = b.getBoundingClientRect();
|
|
291
|
+
N({ x: r.clientX - h.left, y: r.clientY - h.top });
|
|
292
|
+
},
|
|
293
|
+
[T]
|
|
294
|
+
), E = U(() => N(null), []);
|
|
295
|
+
$(() => {
|
|
296
|
+
S.current = t;
|
|
297
|
+
}, [t]);
|
|
298
|
+
const w = t.length > 0;
|
|
299
|
+
$(() => {
|
|
300
|
+
if (!w) {
|
|
301
|
+
c.current = {};
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
let r, b = "";
|
|
305
|
+
const h = () => {
|
|
306
|
+
const C = u.current;
|
|
307
|
+
if (C) {
|
|
308
|
+
const L = C.getBoundingClientRect(), M = {};
|
|
309
|
+
let I = "";
|
|
310
|
+
for (const R of S.current) {
|
|
311
|
+
const X = ce(R.pageIndex);
|
|
312
|
+
if (!X) {
|
|
313
|
+
I += `${R.id}:none|`;
|
|
314
|
+
continue;
|
|
315
|
+
}
|
|
316
|
+
const s = X.getBoundingClientRect(), j = {
|
|
317
|
+
x: s.left - L.left + R.normX * s.width,
|
|
318
|
+
y: s.top - L.top + R.normY * s.height,
|
|
319
|
+
w: R.normW * s.width,
|
|
320
|
+
h: R.normH * s.height
|
|
321
|
+
};
|
|
322
|
+
M[R.id] = j, I += `${R.id}:${j.x.toFixed(1)},${j.y.toFixed(1)},${j.w.toFixed(1)},${j.h.toFixed(1)}|`;
|
|
323
|
+
}
|
|
324
|
+
I !== b && (b = I, c.current = M, y((R) => R + 1));
|
|
325
|
+
}
|
|
326
|
+
r = requestAnimationFrame(h);
|
|
327
|
+
};
|
|
328
|
+
return r = requestAnimationFrame(h), () => cancelAnimationFrame(r);
|
|
329
|
+
}, [w]);
|
|
330
|
+
const D = c.current, f = U(
|
|
331
|
+
(r) => {
|
|
332
|
+
if (!n || x.current) return;
|
|
333
|
+
const b = ie(r.clientX, r.clientY);
|
|
334
|
+
if (!b) return;
|
|
335
|
+
const h = b.getBoundingClientRect(), C = parseInt(b.dataset.pageNumber, 10) - 1, L = (r.clientX - h.left) / h.width, M = (r.clientY - h.top) / h.height;
|
|
336
|
+
i(C, L, M, h.width, h.height);
|
|
337
|
+
},
|
|
338
|
+
[n, i]
|
|
339
|
+
), v = U(
|
|
340
|
+
(r, b) => {
|
|
341
|
+
const h = u.current, C = c.current[b];
|
|
342
|
+
if (!h || !C) return;
|
|
343
|
+
const L = h.getBoundingClientRect(), M = C.x + L.left, I = C.y + L.top, R = r.clientX - M, X = r.clientY - I;
|
|
344
|
+
x.current = { id: b, offsetX: R, offsetY: X };
|
|
345
|
+
const s = (Y) => {
|
|
346
|
+
const z = x.current;
|
|
347
|
+
if (!z) return;
|
|
348
|
+
const G = c.current[z.id];
|
|
349
|
+
if (!G) return;
|
|
350
|
+
const V = S.current.find((H) => H.id === z.id);
|
|
351
|
+
if (!V) return;
|
|
352
|
+
const K = Y.clientX - z.offsetX, q = Y.clientY - z.offsetY, _ = K + G.w / 2, te = q + G.h / 2, J = ie(_, te) ?? ie(Y.clientX, Y.clientY);
|
|
353
|
+
if (!J) return;
|
|
354
|
+
const Q = J.getBoundingClientRect(), ne = parseInt(J.dataset.pageNumber, 10) - 1, P = O(
|
|
355
|
+
(K - Q.left) / Q.width,
|
|
356
|
+
V.normW
|
|
357
|
+
), Z = O(
|
|
358
|
+
(q - Q.top) / Q.height,
|
|
359
|
+
V.normH
|
|
360
|
+
);
|
|
361
|
+
p(z.id, ne, P, Z);
|
|
362
|
+
}, j = () => {
|
|
363
|
+
x.current = null, window.removeEventListener("mousemove", s), window.removeEventListener("mouseup", j);
|
|
364
|
+
};
|
|
365
|
+
window.addEventListener("mousemove", s), window.addEventListener("mouseup", j);
|
|
366
|
+
},
|
|
367
|
+
[p]
|
|
368
|
+
), B = U(
|
|
369
|
+
(r, b) => {
|
|
370
|
+
const h = S.current.find((_) => _.id === b), C = h ? ce(h.pageIndex) : null;
|
|
371
|
+
if (!h || !C) return;
|
|
372
|
+
const L = C.getBoundingClientRect(), M = L.width, I = L.height, R = r.clientX, X = r.clientY, s = h.normW * M, j = h.normH * I, Y = M - h.normX * M, z = I - h.normY * I, G = 40, V = 28, K = (_) => {
|
|
373
|
+
const te = Math.max(
|
|
374
|
+
G,
|
|
375
|
+
Math.min(Y, s + _.clientX - R)
|
|
376
|
+
), J = Math.max(
|
|
377
|
+
V,
|
|
378
|
+
Math.min(z, j + _.clientY - X)
|
|
379
|
+
);
|
|
380
|
+
m(b, te / M, J / I);
|
|
381
|
+
}, q = () => {
|
|
382
|
+
window.removeEventListener("mousemove", K), window.removeEventListener("mouseup", q);
|
|
383
|
+
};
|
|
384
|
+
window.addEventListener("mousemove", K), window.addEventListener("mouseup", q);
|
|
385
|
+
},
|
|
386
|
+
[m]
|
|
387
|
+
);
|
|
388
|
+
return /* @__PURE__ */ a(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
ref: u,
|
|
392
|
+
onClick: f,
|
|
393
|
+
onMouseMove: A,
|
|
394
|
+
onMouseLeave: E,
|
|
395
|
+
style: {
|
|
396
|
+
position: "absolute",
|
|
397
|
+
inset: 0,
|
|
398
|
+
zIndex: 5,
|
|
399
|
+
pointerEvents: n ? "auto" : "none",
|
|
400
|
+
cursor: T ? "none" : n ? Ie : "default"
|
|
401
|
+
},
|
|
402
|
+
children: [
|
|
403
|
+
/* @__PURE__ */ e("div", { style: { position: "absolute", inset: 0, pointerEvents: "none" }, children: t.map((r) => /* @__PURE__ */ e(
|
|
404
|
+
Pe,
|
|
405
|
+
{
|
|
406
|
+
ann: r,
|
|
407
|
+
pos: D[r.id],
|
|
408
|
+
onDelete: l,
|
|
409
|
+
onDragStart: v,
|
|
410
|
+
onResizeStart: B,
|
|
411
|
+
onTextChange: g
|
|
412
|
+
},
|
|
413
|
+
r.id
|
|
414
|
+
)) }),
|
|
415
|
+
T && d && /* @__PURE__ */ e(
|
|
416
|
+
"img",
|
|
417
|
+
{
|
|
418
|
+
src: o.imageData,
|
|
419
|
+
alt: "",
|
|
420
|
+
draggable: !1,
|
|
421
|
+
style: {
|
|
422
|
+
position: "absolute",
|
|
423
|
+
left: d.x - o.w / 2,
|
|
424
|
+
top: d.y - o.h / 2,
|
|
425
|
+
width: o.w,
|
|
426
|
+
height: o.h,
|
|
427
|
+
opacity: 0.65,
|
|
428
|
+
pointerEvents: "none",
|
|
429
|
+
filter: "drop-shadow(0 1px 2px rgba(0,0,0,0.25))"
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
)
|
|
433
|
+
]
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
function dt({ className: t }) {
|
|
438
|
+
return /* @__PURE__ */ a(
|
|
439
|
+
"svg",
|
|
440
|
+
{
|
|
441
|
+
className: t,
|
|
442
|
+
viewBox: "0 0 24 24",
|
|
443
|
+
fill: "none",
|
|
444
|
+
stroke: "currentColor",
|
|
445
|
+
strokeWidth: 2,
|
|
446
|
+
strokeLinecap: "round",
|
|
447
|
+
strokeLinejoin: "round",
|
|
448
|
+
children: [
|
|
449
|
+
/* @__PURE__ */ e("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
450
|
+
/* @__PURE__ */ e("polyline", { points: "14 2 14 8 20 8" }),
|
|
451
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "13", x2: "15", y2: "13" }),
|
|
452
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "17", x2: "15", y2: "17" }),
|
|
453
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "9", x2: "11", y2: "9" })
|
|
454
|
+
]
|
|
455
|
+
}
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
function je({ className: t }) {
|
|
459
|
+
return /* @__PURE__ */ a(
|
|
460
|
+
"svg",
|
|
461
|
+
{
|
|
462
|
+
className: t,
|
|
463
|
+
viewBox: "0 0 24 24",
|
|
464
|
+
fill: "none",
|
|
465
|
+
stroke: "currentColor",
|
|
466
|
+
strokeWidth: 2,
|
|
467
|
+
strokeLinecap: "round",
|
|
468
|
+
strokeLinejoin: "round",
|
|
469
|
+
children: [
|
|
470
|
+
/* @__PURE__ */ e("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
471
|
+
/* @__PURE__ */ e("polyline", { points: "17 8 12 3 7 8" }),
|
|
472
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
}
|
|
477
|
+
function ae({ className: t }) {
|
|
478
|
+
return /* @__PURE__ */ a(
|
|
479
|
+
"svg",
|
|
480
|
+
{
|
|
481
|
+
className: t,
|
|
482
|
+
viewBox: "0 0 24 24",
|
|
483
|
+
fill: "none",
|
|
484
|
+
stroke: "currentColor",
|
|
485
|
+
strokeWidth: 2,
|
|
486
|
+
strokeLinecap: "round",
|
|
487
|
+
strokeLinejoin: "round",
|
|
488
|
+
children: [
|
|
489
|
+
/* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
490
|
+
/* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
491
|
+
]
|
|
492
|
+
}
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
function Be({ className: t }) {
|
|
496
|
+
return /* @__PURE__ */ a(
|
|
497
|
+
"svg",
|
|
498
|
+
{
|
|
499
|
+
className: t,
|
|
500
|
+
viewBox: "0 0 24 24",
|
|
501
|
+
fill: "none",
|
|
502
|
+
stroke: "currentColor",
|
|
503
|
+
strokeWidth: 1.5,
|
|
504
|
+
strokeLinecap: "round",
|
|
505
|
+
strokeLinejoin: "round",
|
|
506
|
+
children: [
|
|
507
|
+
/* @__PURE__ */ e("path", { d: "M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242" }),
|
|
508
|
+
/* @__PURE__ */ e("path", { d: "M12 12v9" }),
|
|
509
|
+
/* @__PURE__ */ e("path", { d: "m8 17 4-4 4 4" })
|
|
510
|
+
]
|
|
511
|
+
}
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
function xe({ className: t }) {
|
|
515
|
+
return /* @__PURE__ */ a(
|
|
516
|
+
"svg",
|
|
517
|
+
{
|
|
518
|
+
className: t,
|
|
519
|
+
viewBox: "0 0 24 24",
|
|
520
|
+
fill: "none",
|
|
521
|
+
stroke: "currentColor",
|
|
522
|
+
strokeWidth: 2,
|
|
523
|
+
strokeLinecap: "round",
|
|
524
|
+
strokeLinejoin: "round",
|
|
525
|
+
children: [
|
|
526
|
+
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
527
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
528
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
529
|
+
]
|
|
530
|
+
}
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
function Fe({ className: t }) {
|
|
534
|
+
return /* @__PURE__ */ a(
|
|
535
|
+
"svg",
|
|
536
|
+
{
|
|
537
|
+
className: t,
|
|
538
|
+
viewBox: "0 0 24 24",
|
|
539
|
+
fill: "none",
|
|
540
|
+
stroke: "currentColor",
|
|
541
|
+
strokeWidth: 2,
|
|
542
|
+
strokeLinecap: "round",
|
|
543
|
+
strokeLinejoin: "round",
|
|
544
|
+
children: [
|
|
545
|
+
/* @__PURE__ */ e("polyline", { points: "4 7 4 4 20 4 20 7" }),
|
|
546
|
+
/* @__PURE__ */ e("line", { x1: "9", y1: "20", x2: "15", y2: "20" }),
|
|
547
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "4", x2: "12", y2: "20" })
|
|
548
|
+
]
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
function We({ className: t }) {
|
|
553
|
+
return /* @__PURE__ */ a(
|
|
554
|
+
"svg",
|
|
555
|
+
{
|
|
556
|
+
className: t,
|
|
557
|
+
viewBox: "0 0 24 24",
|
|
558
|
+
fill: "none",
|
|
559
|
+
stroke: "currentColor",
|
|
560
|
+
strokeWidth: 2,
|
|
561
|
+
strokeLinecap: "round",
|
|
562
|
+
strokeLinejoin: "round",
|
|
563
|
+
children: [
|
|
564
|
+
/* @__PURE__ */ e("path", { d: "M5 22h14" }),
|
|
565
|
+
/* @__PURE__ */ e("path", { d: "M19.27 13.73A2.5 2.5 0 0 0 17 13h-1a2 2 0 0 1-2-2v-1a4 4 0 0 0-8 0v1a2 2 0 0 1-2 2H3a2.5 2.5 0 0 0-1.77 4.26" }),
|
|
566
|
+
/* @__PURE__ */ e("path", { d: "M5 18h14a1 1 0 0 0 1-1v-1a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1z" })
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
function Xe({ className: t }) {
|
|
572
|
+
return /* @__PURE__ */ a(
|
|
573
|
+
"svg",
|
|
574
|
+
{
|
|
575
|
+
className: t,
|
|
576
|
+
viewBox: "0 0 24 24",
|
|
577
|
+
fill: "none",
|
|
578
|
+
stroke: "currentColor",
|
|
579
|
+
strokeWidth: 2,
|
|
580
|
+
strokeLinecap: "round",
|
|
581
|
+
strokeLinejoin: "round",
|
|
582
|
+
children: [
|
|
583
|
+
/* @__PURE__ */ e("path", { d: "M3 17c3.333-4 6-6 7-6s1 2-1 4 0 4 2 2 4-4 5-4 2 1 1 3" }),
|
|
584
|
+
/* @__PURE__ */ e("line", { x1: "3", y1: "21", x2: "21", y2: "21" })
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
);
|
|
588
|
+
}
|
|
589
|
+
function ze({ className: t }) {
|
|
590
|
+
return /* @__PURE__ */ a(
|
|
591
|
+
"svg",
|
|
592
|
+
{
|
|
593
|
+
className: t,
|
|
594
|
+
viewBox: "0 0 24 24",
|
|
595
|
+
fill: "none",
|
|
596
|
+
stroke: "currentColor",
|
|
597
|
+
strokeWidth: 2,
|
|
598
|
+
strokeLinecap: "round",
|
|
599
|
+
strokeLinejoin: "round",
|
|
600
|
+
children: [
|
|
601
|
+
/* @__PURE__ */ e("polyline", { points: "3 6 5 6 21 6" }),
|
|
602
|
+
/* @__PURE__ */ e("path", { d: "M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6" }),
|
|
603
|
+
/* @__PURE__ */ e("path", { d: "M10 11v6" }),
|
|
604
|
+
/* @__PURE__ */ e("path", { d: "M14 11v6" }),
|
|
605
|
+
/* @__PURE__ */ e("path", { d: "M9 6V4h6v2" })
|
|
606
|
+
]
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
function $e({ className: t }) {
|
|
611
|
+
return /* @__PURE__ */ a(
|
|
612
|
+
"svg",
|
|
613
|
+
{
|
|
614
|
+
className: t,
|
|
615
|
+
viewBox: "0 0 24 24",
|
|
616
|
+
fill: "none",
|
|
617
|
+
stroke: "currentColor",
|
|
618
|
+
strokeWidth: 2,
|
|
619
|
+
strokeLinecap: "round",
|
|
620
|
+
strokeLinejoin: "round",
|
|
621
|
+
children: [
|
|
622
|
+
/* @__PURE__ */ e("path", { d: "M3 7v6h6" }),
|
|
623
|
+
/* @__PURE__ */ e("path", { d: "M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13" })
|
|
624
|
+
]
|
|
625
|
+
}
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
function He({ className: t }) {
|
|
629
|
+
return /* @__PURE__ */ a(
|
|
630
|
+
"svg",
|
|
631
|
+
{
|
|
632
|
+
className: t,
|
|
633
|
+
viewBox: "0 0 24 24",
|
|
634
|
+
fill: "none",
|
|
635
|
+
stroke: "currentColor",
|
|
636
|
+
strokeWidth: 2,
|
|
637
|
+
strokeLinecap: "round",
|
|
638
|
+
strokeLinejoin: "round",
|
|
639
|
+
children: [
|
|
640
|
+
/* @__PURE__ */ e("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
641
|
+
/* @__PURE__ */ e("circle", { cx: "8.5", cy: "8.5", r: "1.5" }),
|
|
642
|
+
/* @__PURE__ */ e("polyline", { points: "21 15 16 10 5 21" })
|
|
643
|
+
]
|
|
644
|
+
}
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
function Ye({ className: t }) {
|
|
648
|
+
return /* @__PURE__ */ a(
|
|
649
|
+
"svg",
|
|
650
|
+
{
|
|
651
|
+
className: t,
|
|
652
|
+
viewBox: "0 0 24 24",
|
|
653
|
+
fill: "none",
|
|
654
|
+
stroke: "currentColor",
|
|
655
|
+
strokeWidth: 2,
|
|
656
|
+
strokeLinecap: "round",
|
|
657
|
+
strokeLinejoin: "round",
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ e("path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
|
|
660
|
+
/* @__PURE__ */ e("polyline", { points: "17 21 17 13 7 13 7 21" }),
|
|
661
|
+
/* @__PURE__ */ e("polyline", { points: "7 3 7 8 15 8" })
|
|
662
|
+
]
|
|
663
|
+
}
|
|
664
|
+
);
|
|
665
|
+
}
|
|
666
|
+
function _e({ className: t }) {
|
|
667
|
+
return /* @__PURE__ */ a(
|
|
668
|
+
"svg",
|
|
669
|
+
{
|
|
670
|
+
className: t,
|
|
671
|
+
viewBox: "0 0 24 24",
|
|
672
|
+
fill: "none",
|
|
673
|
+
stroke: "currentColor",
|
|
674
|
+
strokeWidth: 2,
|
|
675
|
+
strokeLinecap: "round",
|
|
676
|
+
strokeLinejoin: "round",
|
|
677
|
+
children: [
|
|
678
|
+
/* @__PURE__ */ e("path", { d: "M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
679
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
680
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
681
|
+
]
|
|
682
|
+
}
|
|
683
|
+
);
|
|
684
|
+
}
|
|
685
|
+
function Oe({ className: t }) {
|
|
686
|
+
return /* @__PURE__ */ e(
|
|
687
|
+
"svg",
|
|
688
|
+
{
|
|
689
|
+
className: t,
|
|
690
|
+
viewBox: "0 0 24 24",
|
|
691
|
+
fill: "none",
|
|
692
|
+
stroke: "currentColor",
|
|
693
|
+
strokeWidth: 2,
|
|
694
|
+
strokeLinecap: "round",
|
|
695
|
+
strokeLinejoin: "round",
|
|
696
|
+
children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" })
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
function Ge({ className: t }) {
|
|
701
|
+
return /* @__PURE__ */ a(
|
|
702
|
+
"svg",
|
|
703
|
+
{
|
|
704
|
+
className: t,
|
|
705
|
+
viewBox: "0 0 24 24",
|
|
706
|
+
fill: "none",
|
|
707
|
+
stroke: "currentColor",
|
|
708
|
+
strokeWidth: 2,
|
|
709
|
+
strokeLinecap: "round",
|
|
710
|
+
strokeLinejoin: "round",
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
|
|
713
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "16", x2: "12", y2: "12" }),
|
|
714
|
+
/* @__PURE__ */ e("line", { x1: "12", y1: "8", x2: "12.01", y2: "8" })
|
|
715
|
+
]
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
function Ve({ className: t }) {
|
|
720
|
+
return /* @__PURE__ */ a(
|
|
721
|
+
"svg",
|
|
722
|
+
{
|
|
723
|
+
className: t,
|
|
724
|
+
viewBox: "0 0 24 24",
|
|
725
|
+
fill: "none",
|
|
726
|
+
stroke: "currentColor",
|
|
727
|
+
strokeWidth: 2,
|
|
728
|
+
strokeLinecap: "round",
|
|
729
|
+
strokeLinejoin: "round",
|
|
730
|
+
children: [
|
|
731
|
+
/* @__PURE__ */ e("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
|
|
732
|
+
/* @__PURE__ */ e("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
|
|
733
|
+
]
|
|
734
|
+
}
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
function de({ className: t }) {
|
|
738
|
+
return /* @__PURE__ */ e(
|
|
739
|
+
"svg",
|
|
740
|
+
{
|
|
741
|
+
className: t,
|
|
742
|
+
viewBox: "0 0 24 24",
|
|
743
|
+
fill: "none",
|
|
744
|
+
stroke: "currentColor",
|
|
745
|
+
strokeWidth: 2,
|
|
746
|
+
strokeLinecap: "round",
|
|
747
|
+
strokeLinejoin: "round",
|
|
748
|
+
children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
|
|
749
|
+
}
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
function Ke({
|
|
753
|
+
selected: t,
|
|
754
|
+
onSelect: n,
|
|
755
|
+
customStamps: o,
|
|
756
|
+
onImageUpload: i,
|
|
757
|
+
stamps: l = oe
|
|
758
|
+
}) {
|
|
759
|
+
const p = F(null), m = (g) => t?.id === g.id;
|
|
760
|
+
return /* @__PURE__ */ a("div", { className: "absolute right-11 top-0 z-30 w-64 bg-surface border border-stroke rounded-xl shadow-lg overflow-hidden", children: [
|
|
761
|
+
/* @__PURE__ */ a("div", { className: "px-5 pt-4 pb-3 border-b border-stroke", children: [
|
|
762
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-semibold text-ink", children: "Stamp" }),
|
|
763
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] text-ink-muted mt-1", children: "Choose a preset or upload your own" })
|
|
764
|
+
] }),
|
|
765
|
+
/* @__PURE__ */ a("div", { className: "p-4 flex flex-col gap-4", children: [
|
|
766
|
+
/* @__PURE__ */ a("div", { children: [
|
|
767
|
+
/* @__PURE__ */ e("p", { className: "text-[9px] text-ink-muted uppercase tracking-widest font-semibold mb-3 px-0.5", children: "Presets" }),
|
|
768
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-2", children: l.map((g) => /* @__PURE__ */ e(
|
|
769
|
+
"button",
|
|
770
|
+
{
|
|
771
|
+
onClick: () => n(g),
|
|
772
|
+
style: {
|
|
773
|
+
color: g.color,
|
|
774
|
+
borderColor: g.color,
|
|
775
|
+
backgroundColor: g.bg
|
|
776
|
+
},
|
|
777
|
+
className: [
|
|
778
|
+
"py-[2.5px] text-[11px] font-black tracking-widest uppercase border-2 rounded-md transition-all text-center leading-none",
|
|
779
|
+
m(g) ? "ring-2 ring-offset-1 ring-offset-surface ring-current scale-105 shadow-md" : "opacity-70 hover:opacity-100 hover:scale-[1.03]"
|
|
780
|
+
].join(" "),
|
|
781
|
+
children: g.label
|
|
782
|
+
},
|
|
783
|
+
g.id
|
|
784
|
+
)) })
|
|
785
|
+
] }),
|
|
786
|
+
/* @__PURE__ */ e("div", { className: "h-px bg-stroke" }),
|
|
787
|
+
/* @__PURE__ */ a("div", { children: [
|
|
788
|
+
/* @__PURE__ */ e("p", { className: "text-[9px] text-ink-muted uppercase tracking-widest font-semibold mb-3 p-4 text-center", children: "Custom image" }),
|
|
789
|
+
o.length > 0 && /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-2 mb-3", children: o.map((g) => /* @__PURE__ */ e(
|
|
790
|
+
"button",
|
|
791
|
+
{
|
|
792
|
+
onClick: () => n(g),
|
|
793
|
+
title: g.label,
|
|
794
|
+
className: [
|
|
795
|
+
"w-16 h-16 rounded-md overflow-hidden border-2 transition-all bg-surface",
|
|
796
|
+
m(g) ? "border-brand scale-105 shadow-md" : "border-stroke hover:border-ink-muted"
|
|
797
|
+
].join(" "),
|
|
798
|
+
children: /* @__PURE__ */ e(
|
|
799
|
+
"img",
|
|
800
|
+
{
|
|
801
|
+
src: g.imageUrl,
|
|
802
|
+
alt: g.label,
|
|
803
|
+
className: "w-full h-full object-contain p-1"
|
|
804
|
+
}
|
|
805
|
+
)
|
|
806
|
+
},
|
|
807
|
+
g.id
|
|
808
|
+
)) }),
|
|
809
|
+
/* @__PURE__ */ a(
|
|
810
|
+
"button",
|
|
811
|
+
{
|
|
812
|
+
onClick: () => p.current?.click(),
|
|
813
|
+
className: "w-full flex items-center justify-center gap-2 py-3 text-xs text-ink-muted border border-dashed border-stroke rounded-md hover:border-brand hover:text-brand hover:bg-brand-subtle transition-all",
|
|
814
|
+
children: [
|
|
815
|
+
/* @__PURE__ */ e(He, { className: "w-4 h-4" }),
|
|
816
|
+
"Upload image…"
|
|
817
|
+
]
|
|
818
|
+
}
|
|
819
|
+
),
|
|
820
|
+
/* @__PURE__ */ e(
|
|
821
|
+
"input",
|
|
822
|
+
{
|
|
823
|
+
ref: p,
|
|
824
|
+
type: "file",
|
|
825
|
+
accept: "image/*",
|
|
826
|
+
onChange: i,
|
|
827
|
+
className: "hidden"
|
|
828
|
+
}
|
|
829
|
+
)
|
|
830
|
+
] })
|
|
831
|
+
] })
|
|
832
|
+
] });
|
|
833
|
+
}
|
|
834
|
+
function ee({
|
|
835
|
+
active: t,
|
|
836
|
+
onClick: n,
|
|
837
|
+
title: o,
|
|
838
|
+
disabled: i = !1,
|
|
839
|
+
danger: l = !1,
|
|
840
|
+
primary: p = !1,
|
|
841
|
+
children: m
|
|
842
|
+
}) {
|
|
843
|
+
return /* @__PURE__ */ e(
|
|
844
|
+
"button",
|
|
845
|
+
{
|
|
846
|
+
onClick: n,
|
|
847
|
+
title: o,
|
|
848
|
+
disabled: i,
|
|
849
|
+
className: [
|
|
850
|
+
"w-10 h-10 flex items-center justify-center rounded-md transition-all",
|
|
851
|
+
t ? "bg-brand text-white shadow-md" : p ? "text-success hover:text-success-dark hover:bg-success/10 disabled:opacity-25 disabled:cursor-not-allowed" : l ? "text-ink-muted hover:text-danger hover:bg-danger/10 disabled:opacity-25 disabled:cursor-not-allowed" : "text-ink-muted hover:text-ink hover:bg-surface-muted disabled:opacity-25 disabled:cursor-not-allowed"
|
|
852
|
+
].join(" "),
|
|
853
|
+
children: m
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
function qe({
|
|
858
|
+
activeTool: t,
|
|
859
|
+
onToolSelect: n,
|
|
860
|
+
selectedStamp: o,
|
|
861
|
+
onStampSelect: i,
|
|
862
|
+
onUndo: l,
|
|
863
|
+
onClearAll: p,
|
|
864
|
+
onSave: m,
|
|
865
|
+
count: g,
|
|
866
|
+
saveAlwaysEnabled: u = !1,
|
|
867
|
+
isSigned: x = !1,
|
|
868
|
+
stamps: S = oe
|
|
869
|
+
}) {
|
|
870
|
+
const [c, y] = W(!1), [d, N] = W([]), T = F(null);
|
|
871
|
+
$(() => {
|
|
872
|
+
if (!c) return;
|
|
873
|
+
const w = setTimeout(() => {
|
|
874
|
+
const D = (f) => {
|
|
875
|
+
T.current?.contains(f.target) || y(!1);
|
|
876
|
+
};
|
|
877
|
+
return document.addEventListener("mousedown", D), () => document.removeEventListener("mousedown", D);
|
|
878
|
+
}, 0);
|
|
879
|
+
return () => clearTimeout(w);
|
|
880
|
+
}, [c]);
|
|
881
|
+
const A = (w) => {
|
|
882
|
+
const D = w.target.files[0];
|
|
883
|
+
if (!D) return;
|
|
884
|
+
const f = new FileReader();
|
|
885
|
+
f.onload = (v) => {
|
|
886
|
+
const B = {
|
|
887
|
+
id: `custom-${Date.now()}`,
|
|
888
|
+
label: D.name,
|
|
889
|
+
imageUrl: v.target.result
|
|
890
|
+
};
|
|
891
|
+
N((r) => [...r, B]), i(B), n(k.STAMP), y(!1);
|
|
892
|
+
}, f.readAsDataURL(D), w.target.value = "";
|
|
893
|
+
}, E = (w) => {
|
|
894
|
+
w === k.STAMP ? (y((D) => !D), n(t === w ? null : w)) : (y(!1), n(t === w ? null : w));
|
|
895
|
+
};
|
|
896
|
+
return /* @__PURE__ */ a(
|
|
897
|
+
"div",
|
|
898
|
+
{
|
|
899
|
+
ref: T,
|
|
900
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 z-20 flex flex-col items-center gap-1.5 bg-surface/95 backdrop-blur-md border border-stroke rounded-xl p-3 shadow-lg",
|
|
901
|
+
children: [
|
|
902
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-ink-disabled uppercase tracking-widest mb-1 font-semibold select-none", children: "Tools" }),
|
|
903
|
+
/* @__PURE__ */ e(
|
|
904
|
+
ee,
|
|
905
|
+
{
|
|
906
|
+
active: t === k.TEXT,
|
|
907
|
+
onClick: () => E(k.TEXT),
|
|
908
|
+
title: "Text field",
|
|
909
|
+
children: /* @__PURE__ */ e(Fe, { className: "w-4 h-4" })
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
/* @__PURE__ */ a("div", { className: "relative", children: [
|
|
913
|
+
/* @__PURE__ */ e(
|
|
914
|
+
ee,
|
|
915
|
+
{
|
|
916
|
+
active: t === k.STAMP,
|
|
917
|
+
onClick: () => E(k.STAMP),
|
|
918
|
+
title: "Stamp",
|
|
919
|
+
children: /* @__PURE__ */ e(We, { className: "w-4 h-4" })
|
|
920
|
+
}
|
|
921
|
+
),
|
|
922
|
+
c && /* @__PURE__ */ e(
|
|
923
|
+
Ke,
|
|
924
|
+
{
|
|
925
|
+
selected: o,
|
|
926
|
+
customStamps: d,
|
|
927
|
+
onImageUpload: A,
|
|
928
|
+
stamps: S,
|
|
929
|
+
onSelect: (w) => {
|
|
930
|
+
i(w), y(!1), n(k.STAMP);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
)
|
|
934
|
+
] }),
|
|
935
|
+
/* @__PURE__ */ e(
|
|
936
|
+
ee,
|
|
937
|
+
{
|
|
938
|
+
active: t === k.SIGNATURE,
|
|
939
|
+
onClick: () => E(k.SIGNATURE),
|
|
940
|
+
title: "Signature",
|
|
941
|
+
children: /* @__PURE__ */ e(Xe, { className: "w-4 h-4" })
|
|
942
|
+
}
|
|
943
|
+
),
|
|
944
|
+
/* @__PURE__ */ e("div", { className: "w-6 h-px bg-stroke my-1.5" }),
|
|
945
|
+
/* @__PURE__ */ e(
|
|
946
|
+
ee,
|
|
947
|
+
{
|
|
948
|
+
active: !1,
|
|
949
|
+
onClick: l,
|
|
950
|
+
title: "Undo last",
|
|
951
|
+
disabled: g === 0,
|
|
952
|
+
children: /* @__PURE__ */ e($e, { className: "w-4 h-4" })
|
|
953
|
+
}
|
|
954
|
+
),
|
|
955
|
+
/* @__PURE__ */ e(
|
|
956
|
+
ee,
|
|
957
|
+
{
|
|
958
|
+
active: !1,
|
|
959
|
+
onClick: p,
|
|
960
|
+
title: "Clear all fields",
|
|
961
|
+
disabled: g === 0,
|
|
962
|
+
danger: !0,
|
|
963
|
+
children: /* @__PURE__ */ e(ze, { className: "w-4 h-4" })
|
|
964
|
+
}
|
|
965
|
+
),
|
|
966
|
+
/* @__PURE__ */ e("div", { className: "w-6 h-px bg-stroke my-1.5" }),
|
|
967
|
+
/* @__PURE__ */ e(
|
|
968
|
+
ee,
|
|
969
|
+
{
|
|
970
|
+
active: !1,
|
|
971
|
+
onClick: m,
|
|
972
|
+
title: x ? "Save the signed document" : "Save a copy with your fields (not yet signed)",
|
|
973
|
+
primary: !0,
|
|
974
|
+
children: /* @__PURE__ */ e(Ye, { className: "w-4 h-4" })
|
|
975
|
+
}
|
|
976
|
+
)
|
|
977
|
+
]
|
|
978
|
+
}
|
|
979
|
+
);
|
|
980
|
+
}
|
|
981
|
+
function Je({ onConfirm: t, onClose: n }) {
|
|
982
|
+
const o = F(null), i = F(!1), l = F(!1);
|
|
983
|
+
$(() => {
|
|
984
|
+
const c = o.current.getContext("2d");
|
|
985
|
+
c.strokeStyle = "#111827", c.lineWidth = 2.5, c.lineCap = "round", c.lineJoin = "round";
|
|
986
|
+
}, []);
|
|
987
|
+
const p = (c, y) => {
|
|
988
|
+
const d = y.getBoundingClientRect(), N = c.touches ? c.touches[0] : c;
|
|
989
|
+
return { x: N.clientX - d.left, y: N.clientY - d.top };
|
|
990
|
+
}, m = (c) => {
|
|
991
|
+
c.preventDefault();
|
|
992
|
+
const y = o.current, { x: d, y: N } = p(c, y);
|
|
993
|
+
y.getContext("2d").beginPath(), y.getContext("2d").moveTo(d, N), i.current = !0, l.current = !0;
|
|
994
|
+
}, g = (c) => {
|
|
995
|
+
if (c.preventDefault(), !i.current) return;
|
|
996
|
+
const y = o.current, { x: d, y: N } = p(c, y), T = y.getContext("2d");
|
|
997
|
+
T.lineTo(d, N), T.stroke();
|
|
998
|
+
}, u = () => {
|
|
999
|
+
i.current = !1;
|
|
1000
|
+
};
|
|
1001
|
+
return /* @__PURE__ */ e("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-ink/40 backdrop-blur-sm", children: /* @__PURE__ */ a("div", { className: "bg-surface rounded-xl shadow-2xl p-8 w-130 max-w-[95vw] border border-stroke", children: [
|
|
1002
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between mb-6", children: [
|
|
1003
|
+
/* @__PURE__ */ a("div", { children: [
|
|
1004
|
+
/* @__PURE__ */ e("h3", { className: "font-semibold text-ink text-base", children: "Draw your signature" }),
|
|
1005
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-ink-muted mt-1", children: "Use your mouse or touch to sign below" })
|
|
1006
|
+
] }),
|
|
1007
|
+
/* @__PURE__ */ e(
|
|
1008
|
+
"button",
|
|
1009
|
+
{
|
|
1010
|
+
onClick: n,
|
|
1011
|
+
className: "w-8 h-8 flex items-center justify-center rounded-md text-ink-muted hover:text-ink hover:bg-surface-muted transition-colors",
|
|
1012
|
+
children: /* @__PURE__ */ e(ae, { className: "w-5 h-5" })
|
|
1013
|
+
}
|
|
1014
|
+
)
|
|
1015
|
+
] }),
|
|
1016
|
+
/* @__PURE__ */ a("div", { className: "border-2 border-dashed border-stroke rounded-md overflow-hidden bg-surface-muted relative mb-3", children: [
|
|
1017
|
+
/* @__PURE__ */ e(
|
|
1018
|
+
"canvas",
|
|
1019
|
+
{
|
|
1020
|
+
ref: o,
|
|
1021
|
+
width: 464,
|
|
1022
|
+
height: 200,
|
|
1023
|
+
onMouseDown: m,
|
|
1024
|
+
onMouseMove: g,
|
|
1025
|
+
onMouseUp: u,
|
|
1026
|
+
onMouseLeave: u,
|
|
1027
|
+
onTouchStart: m,
|
|
1028
|
+
onTouchMove: g,
|
|
1029
|
+
onTouchEnd: u,
|
|
1030
|
+
style: {
|
|
1031
|
+
display: "block",
|
|
1032
|
+
cursor: "crosshair",
|
|
1033
|
+
touchAction: "none"
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
),
|
|
1037
|
+
/* @__PURE__ */ e("div", { className: "absolute bottom-2 left-1/2 -translate-x-1/2 w-32 h-px bg-stroke" })
|
|
1038
|
+
] }),
|
|
1039
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-ink-muted text-center mb-6", children: "Sign above the line" }),
|
|
1040
|
+
/* @__PURE__ */ a("div", { className: "flex gap-3 justify-end", children: [
|
|
1041
|
+
/* @__PURE__ */ e(
|
|
1042
|
+
"button",
|
|
1043
|
+
{
|
|
1044
|
+
onClick: () => {
|
|
1045
|
+
const c = o.current;
|
|
1046
|
+
c.getContext("2d").clearRect(0, 0, c.width, c.height), l.current = !1;
|
|
1047
|
+
},
|
|
1048
|
+
className: "px-5 py-2.5 text-sm text-ink border border-stroke rounded-md hover:bg-surface-muted transition-colors",
|
|
1049
|
+
children: "Clear"
|
|
1050
|
+
}
|
|
1051
|
+
),
|
|
1052
|
+
/* @__PURE__ */ e(
|
|
1053
|
+
"button",
|
|
1054
|
+
{
|
|
1055
|
+
onClick: () => {
|
|
1056
|
+
if (!l.current) return;
|
|
1057
|
+
const c = o.current;
|
|
1058
|
+
t(
|
|
1059
|
+
c.toDataURL("image/png"),
|
|
1060
|
+
c.width / 2,
|
|
1061
|
+
c.height / 2
|
|
1062
|
+
);
|
|
1063
|
+
},
|
|
1064
|
+
className: "px-5 py-2.5 text-sm font-medium bg-brand hover:bg-brand-dark text-white rounded-md transition-colors",
|
|
1065
|
+
children: "Place signature"
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
] })
|
|
1069
|
+
] }) });
|
|
1070
|
+
}
|
|
1071
|
+
const ue = {
|
|
1072
|
+
success: {
|
|
1073
|
+
accent: "#43a047",
|
|
1074
|
+
outline: "#81c784",
|
|
1075
|
+
icon: Oe,
|
|
1076
|
+
title: "Success"
|
|
1077
|
+
},
|
|
1078
|
+
warning: {
|
|
1079
|
+
accent: "#ffb300",
|
|
1080
|
+
outline: "#ffd54f",
|
|
1081
|
+
icon: _e,
|
|
1082
|
+
title: "Warning"
|
|
1083
|
+
},
|
|
1084
|
+
error: {
|
|
1085
|
+
accent: "#e53935",
|
|
1086
|
+
outline: "#e57373",
|
|
1087
|
+
icon: xe,
|
|
1088
|
+
title: "Error"
|
|
1089
|
+
},
|
|
1090
|
+
info: {
|
|
1091
|
+
accent: "#1e88e5",
|
|
1092
|
+
outline: "#64b5f6",
|
|
1093
|
+
icon: Ge,
|
|
1094
|
+
title: "Info"
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
function Qe({ snackbar: t, onDismiss: n }) {
|
|
1098
|
+
if ($(() => {
|
|
1099
|
+
if (!t) return;
|
|
1100
|
+
const p = setTimeout(n, t.duration ?? 5e3);
|
|
1101
|
+
return () => clearTimeout(p);
|
|
1102
|
+
}, [t, n]), !t) return null;
|
|
1103
|
+
const o = ue[t.severity] ?? ue.info, i = o.icon, l = t.title ?? o.title;
|
|
1104
|
+
return /* @__PURE__ */ e(
|
|
1105
|
+
"div",
|
|
1106
|
+
{
|
|
1107
|
+
role: "alert",
|
|
1108
|
+
style: {
|
|
1109
|
+
border: `0.5px solid ${o.outline}`,
|
|
1110
|
+
borderLeft: `3px solid ${o.accent}`,
|
|
1111
|
+
boxShadow: "0 0 10px rgba(0,0,0,0.25)"
|
|
1112
|
+
},
|
|
1113
|
+
className: "fixed top-2 right-6 rtl:right-auto rtl:left-6 z-50 w-80 max-w-80 rounded bg-surface",
|
|
1114
|
+
children: /* @__PURE__ */ a("div", { className: "flex flex-row items-start py-2.5 px-2 rounded bg-surface", children: [
|
|
1115
|
+
/* @__PURE__ */ e(
|
|
1116
|
+
"div",
|
|
1117
|
+
{
|
|
1118
|
+
className: "flex items-start justify-start h-full max-w-fit mr-2 rtl:mr-0 rtl:ml-2",
|
|
1119
|
+
style: { color: o.accent },
|
|
1120
|
+
children: /* @__PURE__ */ e(i, { className: "w-7 h-7" })
|
|
1121
|
+
}
|
|
1122
|
+
),
|
|
1123
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col flex-auto w-full h-full min-w-0", children: [
|
|
1124
|
+
/* @__PURE__ */ e("div", { className: "flex w-full py-1 mb-0.5 overflow-hidden max-h-8", children: /* @__PURE__ */ e("span", { className: "overflow-hidden font-semibold leading-normal tracking-normal text-sm text-[#424242] truncate", children: l }) }),
|
|
1125
|
+
/* @__PURE__ */ e("div", { className: "flex flex-1 w-full overflow-x-hidden overflow-y-auto max-h-40", children: /* @__PURE__ */ e("span", { className: "font-normal wrap-break-word text-[11px] text-ink-muted whitespace-pre-wrap", children: t.message }) })
|
|
1126
|
+
] }),
|
|
1127
|
+
/* @__PURE__ */ e("div", { className: "flex items-start justify-start h-full mx-1 mt-0.5 max-w-fit", children: /* @__PURE__ */ e(
|
|
1128
|
+
"button",
|
|
1129
|
+
{
|
|
1130
|
+
onClick: n,
|
|
1131
|
+
title: "Dismiss",
|
|
1132
|
+
className: "p-0.5 rounded text-ink-muted opacity-60 hover:opacity-100 hover:bg-ink/10 transition-colors",
|
|
1133
|
+
children: /* @__PURE__ */ e(ae, { className: "w-4.5 h-4.5" })
|
|
1134
|
+
}
|
|
1135
|
+
) })
|
|
1136
|
+
] })
|
|
1137
|
+
},
|
|
1138
|
+
t.key
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
function Ze({
|
|
1142
|
+
isDragging: t,
|
|
1143
|
+
error: n,
|
|
1144
|
+
onDrop: o,
|
|
1145
|
+
onDragOver: i,
|
|
1146
|
+
onDragLeave: l,
|
|
1147
|
+
onBrowse: p
|
|
1148
|
+
}) {
|
|
1149
|
+
return /* @__PURE__ */ a("div", { className: "flex-1 flex flex-col items-center justify-center p-6 bg-page", children: [
|
|
1150
|
+
/* @__PURE__ */ a(
|
|
1151
|
+
"div",
|
|
1152
|
+
{
|
|
1153
|
+
onDrop: o,
|
|
1154
|
+
onDragOver: i,
|
|
1155
|
+
onDragLeave: l,
|
|
1156
|
+
onClick: p,
|
|
1157
|
+
className: [
|
|
1158
|
+
"w-full max-w-md rounded-xl border-2 border-dashed transition-all duration-200 cursor-pointer",
|
|
1159
|
+
"flex flex-col items-center justify-center gap-4 p-12",
|
|
1160
|
+
t ? "border-brand bg-brand-subtle scale-[1.02]" : "border-stroke bg-surface hover:border-brand hover:bg-surface-muted"
|
|
1161
|
+
].join(" "),
|
|
1162
|
+
children: [
|
|
1163
|
+
/* @__PURE__ */ e(
|
|
1164
|
+
"div",
|
|
1165
|
+
{
|
|
1166
|
+
className: [
|
|
1167
|
+
"w-16 h-16 rounded-xl flex items-center justify-center transition-colors",
|
|
1168
|
+
t ? "bg-brand" : "bg-surface-muted"
|
|
1169
|
+
].join(" "),
|
|
1170
|
+
children: /* @__PURE__ */ e(
|
|
1171
|
+
Be,
|
|
1172
|
+
{
|
|
1173
|
+
className: [
|
|
1174
|
+
"w-8 h-8 transition-colors",
|
|
1175
|
+
t ? "text-white" : "text-ink-muted"
|
|
1176
|
+
].join(" ")
|
|
1177
|
+
}
|
|
1178
|
+
)
|
|
1179
|
+
}
|
|
1180
|
+
),
|
|
1181
|
+
/* @__PURE__ */ a("div", { className: "text-center space-y-1", children: [
|
|
1182
|
+
/* @__PURE__ */ e("p", { className: "font-semibold text-ink", children: t ? "Drop it here" : "Drop your PDF here" }),
|
|
1183
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-ink-muted", children: [
|
|
1184
|
+
"or",
|
|
1185
|
+
" ",
|
|
1186
|
+
/* @__PURE__ */ e("span", { className: "text-brand hover:text-brand-dark underline underline-offset-2", children: "click to browse" })
|
|
1187
|
+
] })
|
|
1188
|
+
] }),
|
|
1189
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-ink-muted bg-surface-muted px-3 py-1 rounded-full", children: "PDF only" })
|
|
1190
|
+
]
|
|
1191
|
+
}
|
|
1192
|
+
),
|
|
1193
|
+
n && /* @__PURE__ */ a("div", { className: "mt-4 flex items-center gap-2 text-sm text-danger-dark bg-danger/10 border border-danger/30 px-4 py-2.5 rounded-md", children: [
|
|
1194
|
+
/* @__PURE__ */ e(xe, { className: "w-4 h-4 shrink-0" }),
|
|
1195
|
+
n
|
|
1196
|
+
] })
|
|
1197
|
+
] });
|
|
1198
|
+
}
|
|
1199
|
+
function et({ stamps: t = oe } = {}) {
|
|
1200
|
+
const [n, o] = W([]), [i, l] = W(null), [p, m] = W(t[0] ?? null), [g, u] = W(!1), [x, S] = W(null), c = U(
|
|
1201
|
+
(r) => {
|
|
1202
|
+
r === k.SIGNATURE ? i === k.SIGNATURE ? (l(null), S(null)) : (l(null), u(!0)) : l(r);
|
|
1203
|
+
},
|
|
1204
|
+
[i]
|
|
1205
|
+
), y = U((r, b, h) => {
|
|
1206
|
+
u(!1), S({ imageData: r, w: b, h }), l(k.SIGNATURE);
|
|
1207
|
+
}, []), d = U(
|
|
1208
|
+
(r, b, h, C, L) => {
|
|
1209
|
+
if (i === k.TEXT) {
|
|
1210
|
+
const M = Te / C, I = Ee / L;
|
|
1211
|
+
o((R) => [
|
|
1212
|
+
...R,
|
|
1213
|
+
{
|
|
1214
|
+
id: re(),
|
|
1215
|
+
type: k.TEXT,
|
|
1216
|
+
pageIndex: r,
|
|
1217
|
+
normX: O(b - M / 2, M),
|
|
1218
|
+
normY: O(h - I / 2, I),
|
|
1219
|
+
normW: M,
|
|
1220
|
+
normH: I,
|
|
1221
|
+
content: ""
|
|
1222
|
+
}
|
|
1223
|
+
]), l(null);
|
|
1224
|
+
} else if (i === k.STAMP) {
|
|
1225
|
+
const M = !!p.imageUrl, I = (M ? Ae : Me) / C, R = (M ? De : Le) / L;
|
|
1226
|
+
o((X) => [
|
|
1227
|
+
...X,
|
|
1228
|
+
{
|
|
1229
|
+
id: re(),
|
|
1230
|
+
type: k.STAMP,
|
|
1231
|
+
pageIndex: r,
|
|
1232
|
+
normX: O(b - I / 2, I),
|
|
1233
|
+
normY: O(h - R / 2, R),
|
|
1234
|
+
normW: I,
|
|
1235
|
+
normH: R,
|
|
1236
|
+
stamp: p
|
|
1237
|
+
}
|
|
1238
|
+
]), l(null);
|
|
1239
|
+
} else if (i === k.SIGNATURE && x) {
|
|
1240
|
+
const M = x.w / C, I = x.h / L;
|
|
1241
|
+
o((R) => [
|
|
1242
|
+
...R,
|
|
1243
|
+
{
|
|
1244
|
+
id: re(),
|
|
1245
|
+
type: k.SIGNATURE,
|
|
1246
|
+
pageIndex: r,
|
|
1247
|
+
normX: O(b - M / 2, M),
|
|
1248
|
+
normY: O(h - I / 2, I),
|
|
1249
|
+
normW: M,
|
|
1250
|
+
normH: I,
|
|
1251
|
+
imageData: x.imageData
|
|
1252
|
+
}
|
|
1253
|
+
]), l(null), S(null);
|
|
1254
|
+
}
|
|
1255
|
+
},
|
|
1256
|
+
[i, p, x]
|
|
1257
|
+
), N = U(
|
|
1258
|
+
(r) => o((b) => b.filter((h) => h.id !== r)),
|
|
1259
|
+
[]
|
|
1260
|
+
), T = U(
|
|
1261
|
+
(r, b, h, C) => o(
|
|
1262
|
+
(L) => L.map((M) => M.id === r ? { ...M, pageIndex: b, normX: h, normY: C } : M)
|
|
1263
|
+
),
|
|
1264
|
+
[]
|
|
1265
|
+
), A = U(
|
|
1266
|
+
(r, b, h) => o(
|
|
1267
|
+
(C) => C.map((L) => L.id === r ? { ...L, normW: b, normH: h } : L)
|
|
1268
|
+
),
|
|
1269
|
+
[]
|
|
1270
|
+
), E = U(
|
|
1271
|
+
(r, b) => o(
|
|
1272
|
+
(h) => h.map((C) => C.id === r ? { ...C, content: b } : C)
|
|
1273
|
+
),
|
|
1274
|
+
[]
|
|
1275
|
+
), w = U(
|
|
1276
|
+
() => o((r) => r.slice(0, -1)),
|
|
1277
|
+
[]
|
|
1278
|
+
), D = U(() => o([]), []), f = U(() => {
|
|
1279
|
+
o([]), l(null), S(null), u(!1);
|
|
1280
|
+
}, []);
|
|
1281
|
+
$(() => {
|
|
1282
|
+
const r = (b) => {
|
|
1283
|
+
b.key === "Escape" && (l(null), S(null), u(!1));
|
|
1284
|
+
};
|
|
1285
|
+
return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
|
|
1286
|
+
}, []);
|
|
1287
|
+
const v = n.filter(
|
|
1288
|
+
(r) => r.type === k.TEXT && !r.content?.trim()
|
|
1289
|
+
).length, B = i === k.TEXT ? "Click on a page to place a text box · ESC to cancel" : i === k.STAMP ? p?.imageUrl ? "Click to place image stamp · ESC to cancel" : `Click to stamp "${p?.label}" · ESC to cancel` : i === k.SIGNATURE ? "Click to place your signature · ESC to cancel" : null;
|
|
1290
|
+
return {
|
|
1291
|
+
annotations: n,
|
|
1292
|
+
setAnnotations: o,
|
|
1293
|
+
activeTool: i,
|
|
1294
|
+
selectedStamp: p,
|
|
1295
|
+
setSelectedStamp: m,
|
|
1296
|
+
showSignatureModal: g,
|
|
1297
|
+
setShowSignatureModal: u,
|
|
1298
|
+
pendingSignature: x,
|
|
1299
|
+
handleToolSelect: c,
|
|
1300
|
+
handleSignatureConfirm: y,
|
|
1301
|
+
handlePlace: d,
|
|
1302
|
+
handleDelete: N,
|
|
1303
|
+
handleMove: T,
|
|
1304
|
+
handleResize: A,
|
|
1305
|
+
handleTextChange: E,
|
|
1306
|
+
handleUndo: w,
|
|
1307
|
+
handleClearAll: D,
|
|
1308
|
+
reset: f,
|
|
1309
|
+
unsignedCount: v,
|
|
1310
|
+
hint: B
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1313
|
+
function tt(t) {
|
|
1314
|
+
const n = parseInt(t.slice(1, 3), 16) / 255, o = parseInt(t.slice(3, 5), 16) / 255, i = parseInt(t.slice(5, 7), 16) / 255;
|
|
1315
|
+
return ge(n, o, i);
|
|
1316
|
+
}
|
|
1317
|
+
function me(t) {
|
|
1318
|
+
const n = t.split(",")[1], o = atob(n), i = new Uint8Array(o.length);
|
|
1319
|
+
for (let l = 0; l < o.length; l++) i[l] = o.charCodeAt(l);
|
|
1320
|
+
return i;
|
|
1321
|
+
}
|
|
1322
|
+
function ut(t) {
|
|
1323
|
+
return new Promise((n, o) => {
|
|
1324
|
+
const i = new FileReader();
|
|
1325
|
+
i.onload = () => {
|
|
1326
|
+
const l = String(i.result);
|
|
1327
|
+
n(l.slice(l.indexOf(",") + 1));
|
|
1328
|
+
}, i.onerror = () => o(i.error), i.readAsDataURL(t);
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
function he(t) {
|
|
1332
|
+
return t ? t.startsWith("data:") ? t.slice(t.indexOf(",") + 1) : t : null;
|
|
1333
|
+
}
|
|
1334
|
+
function nt(t, n, o = "application/pdf") {
|
|
1335
|
+
const i = atob(t), l = new Uint8Array(i.length);
|
|
1336
|
+
for (let p = 0; p < i.length; p++) l[p] = i.charCodeAt(p);
|
|
1337
|
+
return new File([l], n, { type: o });
|
|
1338
|
+
}
|
|
1339
|
+
function mt() {
|
|
1340
|
+
if (typeof crypto < "u") {
|
|
1341
|
+
if (crypto.randomUUID) return crypto.randomUUID();
|
|
1342
|
+
if (crypto.getRandomValues) {
|
|
1343
|
+
const t = crypto.getRandomValues(new Uint8Array(16));
|
|
1344
|
+
t[6] = t[6] & 15 | 64, t[8] = t[8] & 63 | 128;
|
|
1345
|
+
const n = Array.from(t, (o) => o.toString(16).padStart(2, "0")).join("");
|
|
1346
|
+
return `${n.slice(0, 8)}-${n.slice(8, 12)}-${n.slice(12, 16)}-${n.slice(16, 20)}-${n.slice(20)}`;
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
throw new Error("Cannot generate UUID: crypto API unavailable");
|
|
1350
|
+
}
|
|
1351
|
+
async function ot(t, n) {
|
|
1352
|
+
const o = await t.arrayBuffer(), i = await pe.load(o), l = i.getPages(), p = await i.embedFont(ye.HelveticaBold);
|
|
1353
|
+
for (const u of n) {
|
|
1354
|
+
const x = l[u.pageIndex];
|
|
1355
|
+
if (!x) continue;
|
|
1356
|
+
const S = x.getWidth(), c = x.getHeight(), y = u.normX * S, d = u.normW * S, N = u.normH * c, T = c - u.normY * c - N;
|
|
1357
|
+
if (u.type === k.TEXT) {
|
|
1358
|
+
const A = u.content ?? "";
|
|
1359
|
+
if (!A.trim()) continue;
|
|
1360
|
+
const E = Math.max(6, N / 5);
|
|
1361
|
+
x.drawText(A, {
|
|
1362
|
+
x: y + d * 0.05,
|
|
1363
|
+
y: T + N * 0.35,
|
|
1364
|
+
size: E,
|
|
1365
|
+
color: ge(0.07, 0.09, 0.15),
|
|
1366
|
+
maxWidth: d * 0.9
|
|
1367
|
+
});
|
|
1368
|
+
} else if (u.type === k.STAMP)
|
|
1369
|
+
if (u.stamp.imageUrl) {
|
|
1370
|
+
const A = me(u.stamp.imageUrl), E = u.stamp.imageUrl.includes("image/png") ? await i.embedPng(A) : await i.embedJpg(A);
|
|
1371
|
+
x.drawImage(E, { x: y, y: T, width: d, height: N });
|
|
1372
|
+
} else {
|
|
1373
|
+
const A = u.stamp.label || "", E = tt(u.stamp.color), w = Math.max(
|
|
1374
|
+
6,
|
|
1375
|
+
Math.min(N * 0.42, d * 0.8 / Math.max(1, A.length * 0.6))
|
|
1376
|
+
), D = A.length * w * 0.6;
|
|
1377
|
+
x.drawText(A, {
|
|
1378
|
+
x: y + (d - D) / 2,
|
|
1379
|
+
y: T + (N - w) / 2,
|
|
1380
|
+
size: w,
|
|
1381
|
+
font: p,
|
|
1382
|
+
color: E,
|
|
1383
|
+
rotate: ke(-se)
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
else if (u.type === k.SIGNATURE) {
|
|
1387
|
+
const A = me(u.imageData), E = await i.embedPng(A);
|
|
1388
|
+
x.drawImage(E, { x: y, y: T, width: d, height: N });
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
const m = await i.save();
|
|
1392
|
+
let g = "";
|
|
1393
|
+
return m.forEach((u) => {
|
|
1394
|
+
g += String.fromCharCode(u);
|
|
1395
|
+
}), btoa(g);
|
|
1396
|
+
}
|
|
1397
|
+
async function ht(t, n) {
|
|
1398
|
+
const o = await t.arrayBuffer(), l = (await pe.load(o)).getPages(), p = [];
|
|
1399
|
+
for (const m of n) {
|
|
1400
|
+
const g = l[m.pageIndex];
|
|
1401
|
+
if (!g) continue;
|
|
1402
|
+
const u = g.getWidth(), x = g.getHeight();
|
|
1403
|
+
let S = null;
|
|
1404
|
+
m.type === k.TEXT ? S = m.content ?? "" : m.type === k.STAMP ? S = m.stamp.imageUrl ? he(m.stamp.imageUrl) : m.stamp.label : m.type === k.SIGNATURE && (S = he(m.imageData)), p.push({
|
|
1405
|
+
top: m.normY * x,
|
|
1406
|
+
left: m.normX * u,
|
|
1407
|
+
width: m.normW * u,
|
|
1408
|
+
height: m.normH * x,
|
|
1409
|
+
pageNumber: m.pageIndex + 1,
|
|
1410
|
+
type: m.type,
|
|
1411
|
+
value: S
|
|
1412
|
+
});
|
|
1413
|
+
}
|
|
1414
|
+
return p;
|
|
1415
|
+
}
|
|
1416
|
+
const rt = {
|
|
1417
|
+
completeButton: "Complete",
|
|
1418
|
+
completeSending: "Sending…",
|
|
1419
|
+
completeSuccess: "Completed successfully.",
|
|
1420
|
+
completeErrorPrefix: "Failed to complete: ",
|
|
1421
|
+
noFileOpen: "No file open",
|
|
1422
|
+
loadingDocument: "Loading document…",
|
|
1423
|
+
openFile: "Open PDF",
|
|
1424
|
+
changeFile: "Change file",
|
|
1425
|
+
renderError: "Failed to render this PDF.",
|
|
1426
|
+
saveUnavailable: "You can't download the document right now."
|
|
1427
|
+
};
|
|
1428
|
+
function ft({
|
|
1429
|
+
fileBlob: t = null,
|
|
1430
|
+
fileUrl: n = null,
|
|
1431
|
+
allowFileUpload: o = !0,
|
|
1432
|
+
header: i = null,
|
|
1433
|
+
loading: l = !1,
|
|
1434
|
+
stamps: p = oe,
|
|
1435
|
+
licenseKey: m = "FREE-LIMITED-KEY",
|
|
1436
|
+
theme: g = null,
|
|
1437
|
+
visibility: u = { open: !1, download: !1, print: !1 },
|
|
1438
|
+
readOnly: x = !1,
|
|
1439
|
+
isSigned: S = !1,
|
|
1440
|
+
saveAlwaysEnabled: c = !1,
|
|
1441
|
+
documentTitle: y = null,
|
|
1442
|
+
errorMessage: d = null,
|
|
1443
|
+
labels: N = {},
|
|
1444
|
+
onFileChange: T,
|
|
1445
|
+
onSave: A,
|
|
1446
|
+
onComplete: E,
|
|
1447
|
+
onError: w,
|
|
1448
|
+
className: D = ""
|
|
1449
|
+
}) {
|
|
1450
|
+
const f = { ...rt, ...N }, [v, B] = W(t), [r, b] = W(!1), [h, C] = W(null), [L, M] = W(!1), [I, R] = W(null), X = F(null), s = et({ stamps: p });
|
|
1451
|
+
$(() => {
|
|
1452
|
+
B(t);
|
|
1453
|
+
}, [t]);
|
|
1454
|
+
const j = U(
|
|
1455
|
+
(P, Z = "info", H = 5e3) => {
|
|
1456
|
+
R({ message: P, severity: Z, duration: H, key: Date.now() });
|
|
1457
|
+
},
|
|
1458
|
+
[]
|
|
1459
|
+
), Y = U(() => R(null), []), z = U(
|
|
1460
|
+
(P) => {
|
|
1461
|
+
if (P) {
|
|
1462
|
+
if (P.type !== "application/pdf") {
|
|
1463
|
+
C("Only PDF files are supported.");
|
|
1464
|
+
return;
|
|
1465
|
+
}
|
|
1466
|
+
C(null), B(P), s.reset(), T?.(P);
|
|
1467
|
+
}
|
|
1468
|
+
},
|
|
1469
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1470
|
+
[s.reset, T]
|
|
1471
|
+
), G = U(() => {
|
|
1472
|
+
B(null), C(null), s.reset(), X.current && (X.current.value = ""), T?.(null);
|
|
1473
|
+
}, [s.reset, T]), V = U(
|
|
1474
|
+
(P) => z(P.target.files[0]),
|
|
1475
|
+
[z]
|
|
1476
|
+
), K = U(
|
|
1477
|
+
(P) => {
|
|
1478
|
+
P.preventDefault(), b(!1), z(P.dataTransfer.files[0]);
|
|
1479
|
+
},
|
|
1480
|
+
[z]
|
|
1481
|
+
), q = U((P) => {
|
|
1482
|
+
P.preventDefault(), b(!0);
|
|
1483
|
+
}, []), _ = U(() => b(!1), []), te = U(async () => {
|
|
1484
|
+
if (A) {
|
|
1485
|
+
A(v, s.annotations);
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
if (!v) {
|
|
1489
|
+
j(f.saveUnavailable, "warning", 5e3);
|
|
1490
|
+
return;
|
|
1491
|
+
}
|
|
1492
|
+
try {
|
|
1493
|
+
let P = v;
|
|
1494
|
+
if (s.annotations.length > 0) {
|
|
1495
|
+
const be = await ot(v, s.annotations);
|
|
1496
|
+
P = nt(be, v.name);
|
|
1497
|
+
}
|
|
1498
|
+
const Z = URL.createObjectURL(P), H = document.createElement("a");
|
|
1499
|
+
H.href = Z, H.download = v.name || "document.pdf", document.body.appendChild(H), H.click(), document.body.removeChild(H), URL.revokeObjectURL(Z);
|
|
1500
|
+
} catch (P) {
|
|
1501
|
+
j(f.saveUnavailable, "error", 5e3), w?.(P);
|
|
1502
|
+
}
|
|
1503
|
+
}, [A, v, s.annotations, j, f.saveUnavailable, w]), J = U(async () => {
|
|
1504
|
+
if (!(!v || s.annotations.length === 0 || L || !E)) {
|
|
1505
|
+
M(!0);
|
|
1506
|
+
try {
|
|
1507
|
+
await E(v, s.annotations), s.reset(), C(null), j(f.completeSuccess, "success");
|
|
1508
|
+
} catch (P) {
|
|
1509
|
+
j(
|
|
1510
|
+
f.completeErrorPrefix + (P?.message ?? String(P)),
|
|
1511
|
+
"error",
|
|
1512
|
+
8e3
|
|
1513
|
+
);
|
|
1514
|
+
} finally {
|
|
1515
|
+
M(!1);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
}, [
|
|
1519
|
+
v,
|
|
1520
|
+
s.annotations,
|
|
1521
|
+
s.reset,
|
|
1522
|
+
L,
|
|
1523
|
+
E,
|
|
1524
|
+
j,
|
|
1525
|
+
f.completeSuccess,
|
|
1526
|
+
f.completeErrorPrefix
|
|
1527
|
+
]), Q = !!v || !!n, ne = L ? f.completeSending : s.hint;
|
|
1528
|
+
return /* @__PURE__ */ a("div", { className: `h-full bg-page text-ink flex flex-col ${D}`, children: [
|
|
1529
|
+
/* @__PURE__ */ a("header", { className: "h-16 bg-surface border-b border-stroke flex items-center px-6 gap-4 shrink-0 shadow-sm", children: [
|
|
1530
|
+
i && /* @__PURE__ */ a(we, { children: [
|
|
1531
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-2.5", children: i }),
|
|
1532
|
+
/* @__PURE__ */ e("div", { className: "h-5 w-px bg-stroke mx-1" })
|
|
1533
|
+
] }),
|
|
1534
|
+
v ? /* @__PURE__ */ a("div", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
|
|
1535
|
+
/* @__PURE__ */ e(
|
|
1536
|
+
"span",
|
|
1537
|
+
{
|
|
1538
|
+
className: "text-xs text-ink-muted truncate",
|
|
1539
|
+
title: y ?? void 0,
|
|
1540
|
+
children: v.name
|
|
1541
|
+
}
|
|
1542
|
+
),
|
|
1543
|
+
/* @__PURE__ */ a("span", { className: "text-xs text-ink-disabled shrink-0", children: [
|
|
1544
|
+
"(",
|
|
1545
|
+
(v.size / 1024).toFixed(0),
|
|
1546
|
+
" KB)"
|
|
1547
|
+
] }),
|
|
1548
|
+
s.annotations.length > 0 && /* @__PURE__ */ a("span", { className: "text-xs text-brand bg-brand-subtle border border-brand-light/40 px-2.5 py-1 rounded-full shrink-0 font-medium", children: [
|
|
1549
|
+
s.annotations.length,
|
|
1550
|
+
" field",
|
|
1551
|
+
s.annotations.length !== 1 ? "s" : ""
|
|
1552
|
+
] }),
|
|
1553
|
+
s.unsignedCount > 0 && /* @__PURE__ */ a("span", { className: "text-xs text-warning-dark bg-warning/15 border border-warning/40 px-2.5 py-1 rounded-full shrink-0 font-medium", children: [
|
|
1554
|
+
s.unsignedCount,
|
|
1555
|
+
" unsigned"
|
|
1556
|
+
] })
|
|
1557
|
+
] }) : /* @__PURE__ */ e("span", { className: "text-xs text-ink-muted flex-1", children: l ? f.loadingDocument : f.noFileOpen }),
|
|
1558
|
+
v && E && !x && /* @__PURE__ */ a(
|
|
1559
|
+
"button",
|
|
1560
|
+
{
|
|
1561
|
+
onClick: J,
|
|
1562
|
+
disabled: s.annotations.length === 0 || s.unsignedCount > 0 || L,
|
|
1563
|
+
title: L ? f.completeSending : s.annotations.length === 0 ? "Add at least one field to complete" : s.unsignedCount > 0 ? `${s.unsignedCount} unsigned field${s.unsignedCount !== 1 ? "s" : ""} remaining` : "Complete and send",
|
|
1564
|
+
className: "ml-auto shrink-0 flex items-center gap-2 text-xs font-medium bg-success hover:bg-success-dark active:bg-success-dark disabled:bg-surface-muted disabled:text-ink-disabled disabled:cursor-not-allowed text-white px-4 py-2 rounded-md transition-colors cursor-pointer",
|
|
1565
|
+
children: [
|
|
1566
|
+
L ? /* @__PURE__ */ e(de, { className: "w-3.5 h-3.5 animate-spin" }) : /* @__PURE__ */ e(Ve, { className: "w-3.5 h-3.5" }),
|
|
1567
|
+
L ? f.completeSending : f.completeButton
|
|
1568
|
+
]
|
|
1569
|
+
}
|
|
1570
|
+
),
|
|
1571
|
+
o && /* @__PURE__ */ a(
|
|
1572
|
+
"button",
|
|
1573
|
+
{
|
|
1574
|
+
onClick: () => X.current?.click(),
|
|
1575
|
+
disabled: l,
|
|
1576
|
+
className: `${v && E && !x ? "" : "ml-auto "}shrink-0 flex items-center gap-2 text-xs font-medium bg-brand hover:bg-brand-dark active:bg-brand-dark disabled:bg-surface-muted disabled:text-ink-disabled disabled:cursor-not-allowed text-white px-4 py-2 rounded-md transition-colors cursor-pointer`,
|
|
1577
|
+
children: [
|
|
1578
|
+
/* @__PURE__ */ e(je, { className: "w-3.5 h-3.5" }),
|
|
1579
|
+
v ? f.changeFile : f.openFile
|
|
1580
|
+
]
|
|
1581
|
+
}
|
|
1582
|
+
),
|
|
1583
|
+
o && v && /* @__PURE__ */ e(
|
|
1584
|
+
"button",
|
|
1585
|
+
{
|
|
1586
|
+
onClick: G,
|
|
1587
|
+
title: "Close file",
|
|
1588
|
+
className: "shrink-0 w-9 h-9 flex items-center justify-center rounded-md text-ink-muted hover:text-ink hover:bg-surface-muted transition-colors cursor-pointer",
|
|
1589
|
+
children: /* @__PURE__ */ e(ae, { className: "w-4 h-4" })
|
|
1590
|
+
}
|
|
1591
|
+
),
|
|
1592
|
+
o && /* @__PURE__ */ e(
|
|
1593
|
+
"input",
|
|
1594
|
+
{
|
|
1595
|
+
ref: X,
|
|
1596
|
+
type: "file",
|
|
1597
|
+
accept: "application/pdf",
|
|
1598
|
+
onChange: V,
|
|
1599
|
+
className: "hidden"
|
|
1600
|
+
}
|
|
1601
|
+
)
|
|
1602
|
+
] }),
|
|
1603
|
+
/* @__PURE__ */ e("main", { className: "flex-1 flex flex-col overflow-hidden", children: Q ? /* @__PURE__ */ a("div", { className: "relative flex-1 min-h-0", children: [
|
|
1604
|
+
/* @__PURE__ */ e(
|
|
1605
|
+
Ce,
|
|
1606
|
+
{
|
|
1607
|
+
fileBlob: v,
|
|
1608
|
+
fileUrl: v ? null : n,
|
|
1609
|
+
height: "100%",
|
|
1610
|
+
width: "100%",
|
|
1611
|
+
licenseKey: m,
|
|
1612
|
+
theme: g,
|
|
1613
|
+
visibility: u,
|
|
1614
|
+
readOnly: x,
|
|
1615
|
+
onError: (P) => {
|
|
1616
|
+
j(f.renderError, "error"), w?.(P);
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
),
|
|
1620
|
+
!x && /* @__PURE__ */ e(
|
|
1621
|
+
Ue,
|
|
1622
|
+
{
|
|
1623
|
+
annotations: s.annotations,
|
|
1624
|
+
activeTool: s.activeTool,
|
|
1625
|
+
pendingSignature: s.pendingSignature,
|
|
1626
|
+
onPlace: s.handlePlace,
|
|
1627
|
+
onDelete: s.handleDelete,
|
|
1628
|
+
onMove: s.handleMove,
|
|
1629
|
+
onResize: s.handleResize,
|
|
1630
|
+
onTextChange: s.handleTextChange
|
|
1631
|
+
}
|
|
1632
|
+
),
|
|
1633
|
+
!x && /* @__PURE__ */ e(
|
|
1634
|
+
qe,
|
|
1635
|
+
{
|
|
1636
|
+
activeTool: s.activeTool,
|
|
1637
|
+
onToolSelect: s.handleToolSelect,
|
|
1638
|
+
selectedStamp: s.selectedStamp,
|
|
1639
|
+
onStampSelect: s.setSelectedStamp,
|
|
1640
|
+
onUndo: s.handleUndo,
|
|
1641
|
+
onClearAll: s.handleClearAll,
|
|
1642
|
+
onSave: te,
|
|
1643
|
+
count: s.annotations.length,
|
|
1644
|
+
saveAlwaysEnabled: c,
|
|
1645
|
+
isSigned: S,
|
|
1646
|
+
stamps: p
|
|
1647
|
+
}
|
|
1648
|
+
),
|
|
1649
|
+
ne && /* @__PURE__ */ e("div", { className: "absolute bottom-6 left-1/2 -translate-x-1/2 z-20 bg-surface/95 backdrop-blur border border-stroke text-ink text-xs px-5 py-2.5 rounded-full shadow-md pointer-events-none whitespace-nowrap", children: ne })
|
|
1650
|
+
] }) : l ? /* @__PURE__ */ a("div", { className: "flex-1 flex flex-col items-center justify-center gap-3 p-6 bg-page", children: [
|
|
1651
|
+
/* @__PURE__ */ e(de, { className: "w-8 h-8 text-brand animate-spin" }),
|
|
1652
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-ink-muted", children: f.loadingDocument })
|
|
1653
|
+
] }) : o ? /* @__PURE__ */ e(
|
|
1654
|
+
Ze,
|
|
1655
|
+
{
|
|
1656
|
+
isDragging: r,
|
|
1657
|
+
error: h ?? d,
|
|
1658
|
+
onDrop: K,
|
|
1659
|
+
onDragOver: q,
|
|
1660
|
+
onDragLeave: _,
|
|
1661
|
+
onBrowse: () => X.current?.click()
|
|
1662
|
+
}
|
|
1663
|
+
) : /* @__PURE__ */ e("div", { className: "flex-1 flex items-center justify-center p-6 bg-page", children: /* @__PURE__ */ e("p", { className: "text-sm text-ink-muted", children: f.noFileOpen }) }) }),
|
|
1664
|
+
s.showSignatureModal && /* @__PURE__ */ e(
|
|
1665
|
+
Je,
|
|
1666
|
+
{
|
|
1667
|
+
onConfirm: s.handleSignatureConfirm,
|
|
1668
|
+
onClose: () => s.setShowSignatureModal(!1)
|
|
1669
|
+
}
|
|
1670
|
+
),
|
|
1671
|
+
/* @__PURE__ */ e(Qe, { snackbar: I, onDismiss: Y })
|
|
1672
|
+
] });
|
|
1673
|
+
}
|
|
1674
|
+
export {
|
|
1675
|
+
Pe as AnnotationItem,
|
|
1676
|
+
Ue as AnnotationLayer,
|
|
1677
|
+
qe as AnnotationToolbar,
|
|
1678
|
+
Oe as CheckIcon,
|
|
1679
|
+
ae as CloseIcon,
|
|
1680
|
+
oe as DEFAULT_STAMPS,
|
|
1681
|
+
Be as DropIcon,
|
|
1682
|
+
Ze as EmptyState,
|
|
1683
|
+
xe as ErrorIcon,
|
|
1684
|
+
He as ImageIcon,
|
|
1685
|
+
Ge as InfoIcon,
|
|
1686
|
+
ft as PdfAnnotator,
|
|
1687
|
+
dt as PdfIcon,
|
|
1688
|
+
Ce as PdfViewer,
|
|
1689
|
+
ue as SNACKBAR_VARIANTS,
|
|
1690
|
+
Ye as SaveIcon,
|
|
1691
|
+
Ve as SendIcon,
|
|
1692
|
+
Xe as SignatureIcon,
|
|
1693
|
+
Je as SignatureModal,
|
|
1694
|
+
Qe as Snackbar,
|
|
1695
|
+
de as SpinnerIcon,
|
|
1696
|
+
We as StampIcon,
|
|
1697
|
+
Ke as StampPicker,
|
|
1698
|
+
k as TOOL,
|
|
1699
|
+
Fe as TextIcon,
|
|
1700
|
+
ee as ToolBtn,
|
|
1701
|
+
ze as TrashIcon,
|
|
1702
|
+
$e as UndoIcon,
|
|
1703
|
+
je as UploadIcon,
|
|
1704
|
+
_e as WarningIcon,
|
|
1705
|
+
ht as annotationsToFields,
|
|
1706
|
+
ot as bakeAnnotationsToBase64,
|
|
1707
|
+
nt as base64ToFile,
|
|
1708
|
+
ut as blobToBase64,
|
|
1709
|
+
me as dataUrlToBytes,
|
|
1710
|
+
ie as findPageElementAt,
|
|
1711
|
+
ce as findPageElementByIndex,
|
|
1712
|
+
tt as hexToRgb01,
|
|
1713
|
+
mt as makeUuid,
|
|
1714
|
+
he as stripDataUrl,
|
|
1715
|
+
et as useAnnotations
|
|
1716
|
+
};
|
|
1717
|
+
//# sourceMappingURL=index.js.map
|