@m3ui-vue/m3ui-vue 1.7.0 → 1.8.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/dist/API.md +578 -3
- package/dist/{MColorPickerModal-BKM1CHxr.js → MColorPickerModal-H8nuX0Wu.js} +3 -4
- package/dist/{MColorPickerModal-BKM1CHxr.js.map → MColorPickerModal-H8nuX0Wu.js.map} +1 -1
- package/dist/MDialog-B42Mhn8W.js +331 -0
- package/dist/MDialog-B42Mhn8W.js.map +1 -0
- package/dist/{MListItem-BU5KDRCB.js → MListItem-DiOAxaN7.js} +102 -102
- package/dist/{MListItem-BU5KDRCB.js.map → MListItem-DiOAxaN7.js.map} +1 -1
- package/dist/{MLoadingIndicator-RykOo5tf.js → MLoadingIndicator-CuTZYFFj.js} +2 -2
- package/dist/{MLoadingIndicator-RykOo5tf.js.map → MLoadingIndicator-CuTZYFFj.js.map} +1 -1
- package/dist/{MSeekBar-B_Y3MpVz.js → MSeekBar-BCDQTx2t.js} +2 -2
- package/dist/{MSeekBar-B_Y3MpVz.js.map → MSeekBar-BCDQTx2t.js.map} +1 -1
- package/dist/{MSegmentedButton-CiOOY1-N.js → MSegmentedButton-BXzRsg1S.js} +2 -2
- package/dist/{MSegmentedButton-CiOOY1-N.js.map → MSegmentedButton-BXzRsg1S.js.map} +1 -1
- package/dist/MSignaturePad-BTqGaPXA.js +313 -0
- package/dist/MSignaturePad-BTqGaPXA.js.map +1 -0
- package/dist/{MSlider-BCeVIxcq.js → MSlider-D_O8J9YH.js} +3 -3
- package/dist/{MSlider-BCeVIxcq.js.map → MSlider-D_O8J9YH.js.map} +1 -1
- package/dist/{MSpinner-Cs03qoqE.js → MSpinner-UCdtSOHP.js} +2 -2
- package/dist/{MSpinner-Cs03qoqE.js.map → MSpinner-UCdtSOHP.js.map} +1 -1
- package/dist/{MTextField-NaFbMkjv.js → MTextField-CYk9yFvi.js} +3 -3
- package/dist/{MTextField-NaFbMkjv.js.map → MTextField-CYk9yFvi.js.map} +1 -1
- package/dist/{_useFieldValidation-Bz34IAQY.js → _useFieldValidation-B0B44M_t.js} +2 -2
- package/dist/{_useFieldValidation-Bz34IAQY.js.map → _useFieldValidation-B0B44M_t.js.map} +1 -1
- package/dist/api.json +1 -1
- package/dist/code-editor.js +2 -2
- package/dist/components/MFormBuilder.vue.d.ts +22 -0
- package/dist/components/MFormRenderer.vue.d.ts +151 -0
- package/dist/components/MMapRoute.vue.d.ts +13 -5
- package/dist/components/MPdfSigner.vue.d.ts +499 -0
- package/dist/components/MPdfViewer.vue.d.ts +12 -0
- package/dist/components/MPosKeypad.vue.d.ts +1 -1
- package/dist/components/MSpreadsheet.vue.d.ts +137 -0
- package/dist/components/MStack.vue.d.ts +1 -1
- package/dist/composables/pdfSign.d.ts +52 -0
- package/dist/composables/spreadsheetFormula.d.ts +55 -0
- package/dist/composables/useLocale.d.ts +154 -0
- package/dist/draw.js +2 -2
- package/dist/flow.js +1 -1
- package/dist/gantt.js +2 -2
- package/dist/index.d.ts +7 -0
- package/dist/locales/index.js +539 -0
- package/dist/locales/index.js.map +1 -1
- package/dist/m3ui-vue.css +1 -1
- package/dist/m3ui.js +16988 -15064
- package/dist/m3ui.js.map +1 -1
- package/dist/map.js +601 -585
- package/dist/map.js.map +1 -1
- package/dist/media.js +4 -4
- package/dist/pdf.d.ts +3 -0
- package/dist/pdf.js +1228 -687
- package/dist/pdf.js.map +1 -1
- package/dist/rich-text-editor.js +12 -13
- package/dist/rich-text-editor.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/{useLocale-Dh1xZZ8i.js → useLocale-DL96OFgr.js} +78 -1
- package/dist/useLocale-DL96OFgr.js.map +1 -0
- package/package.json +5 -1
- package/src/__tests__/MFormRenderer.test.ts +157 -0
- package/src/__tests__/MMapRoute.test.ts +34 -0
- package/src/__tests__/MPdfSigner.test.ts +175 -0
- package/src/__tests__/MSpreadsheet.test.ts +223 -0
- package/src/__tests__/spreadsheetFormula.test.ts +77 -0
- package/src/__tests__/ssr.test.ts +3 -0
- package/src/components/MFormBuilder.vue +417 -0
- package/src/components/MFormRenderer.vue +324 -0
- package/src/components/MMapRoute.vue +64 -11
- package/src/components/MPdfSigner.vue +433 -0
- package/src/components/MPdfViewer.vue +12 -0
- package/src/components/MSpreadsheet.vue +992 -0
- package/src/composables/pdfSign.ts +141 -0
- package/src/composables/spreadsheetFormula.ts +459 -0
- package/src/composables/useLocale.ts +231 -0
- package/src/index.ts +7 -0
- package/src/locales/de.ts +77 -0
- package/src/locales/es.ts +77 -0
- package/src/locales/fr.ts +77 -0
- package/src/locales/ja.ts +77 -0
- package/src/locales/ko.ts +77 -0
- package/src/locales/pt.ts +77 -0
- package/src/locales/zh.ts +77 -0
- package/src/pdf.ts +3 -0
- package/dist/MButton-CN3wYwIG.js +0 -171
- package/dist/MButton-CN3wYwIG.js.map +0 -1
- package/dist/MDialog-1LAk9WAO.js +0 -167
- package/dist/MDialog-1LAk9WAO.js.map +0 -1
- package/dist/MProgressBar-BWly1UKN.js +0 -179
- package/dist/MProgressBar-BWly1UKN.js.map +0 -1
- package/dist/useLocale-Dh1xZZ8i.js.map +0 -1
package/dist/pdf.js
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { i as e } from "./useLocale-
|
|
1
|
+
import { i as e } from "./useLocale-DL96OFgr.js";
|
|
2
2
|
import { t } from "./MIcon-DpajuUTJ.js";
|
|
3
3
|
import { t as n } from "./MIconButton-BBggVwBV.js";
|
|
4
4
|
import { n as r, t as i } from "./MMenuItem-BuxYoASE.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
8
|
-
import { t as
|
|
9
|
-
import {
|
|
5
|
+
import { n as a, t as o } from "./MSignaturePad-BTqGaPXA.js";
|
|
6
|
+
import { t as s } from "./MTextField-CYk9yFvi.js";
|
|
7
|
+
import { n as c, t as l } from "./MDialog-B42Mhn8W.js";
|
|
8
|
+
import { t as u } from "./MLoadingIndicator-CuTZYFFj.js";
|
|
9
|
+
import { t as d } from "./MSegmentedButton-BXzRsg1S.js";
|
|
10
|
+
import { Fragment as f, Transition as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, getCurrentScope as S, mergeProps as ee, nextTick as te, normalizeClass as C, normalizeStyle as w, onBeforeUnmount as ne, onMounted as re, onScopeDispose as T, openBlock as E, reactive as D, ref as O, renderList as k, renderSlot as ie, resolveDynamicComponent as ae, shallowRef as A, toDisplayString as j, toValue as M, unref as N, useId as P, vModelText as oe, watch as F, withCtx as I, withDirectives as L, withKeys as se, withModifiers as ce } from "vue";
|
|
10
11
|
// src/composables/usePdf.ts
|
|
11
|
-
var
|
|
12
|
-
function
|
|
13
|
-
|
|
12
|
+
var R;
|
|
13
|
+
function z(e) {
|
|
14
|
+
R = e;
|
|
14
15
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
return
|
|
18
|
-
let t = await import("pdfjs-dist"), n = e ??
|
|
16
|
+
var B = null;
|
|
17
|
+
function V(e) {
|
|
18
|
+
return B ??= (async () => {
|
|
19
|
+
let t = await import("pdfjs-dist"), n = e ?? R;
|
|
19
20
|
return n ? t.GlobalWorkerOptions.workerSrc = n : t.GlobalWorkerOptions.workerSrc || await import("pdfjs-dist/build/pdf.worker.min.mjs"), t;
|
|
20
|
-
})(),
|
|
21
|
+
})(), B;
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function H(e, t) {
|
|
23
24
|
let n = "";
|
|
24
25
|
for (let r of e) {
|
|
25
26
|
let e = r.normalize("NFD").replace(/\p{M}/gu, ""), i = e.length === 1 ? e : r;
|
|
@@ -27,41 +28,41 @@ function I(e, t) {
|
|
|
27
28
|
}
|
|
28
29
|
return n;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function U(e, t) {
|
|
31
32
|
return typeof t == "string" ? e.PDFDateString.toDateObject(t) ?? void 0 : void 0;
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
-
let n =
|
|
35
|
-
function
|
|
34
|
+
function le(e, t = {}) {
|
|
35
|
+
let n = A(null), r = A(null), i = O(!1), a = O(0), o = A(null), s = O(!1), c = O(!1), l = A([]), u = A([]), d = A({}), f = m(() => n.value?.numPages ?? 0), p = null, h = null, g = 0, _ = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
|
|
36
|
+
function y() {
|
|
36
37
|
for (let e of v.values()) e.then((e) => URL.revokeObjectURL(e), () => {});
|
|
37
38
|
v.clear(), _.clear();
|
|
38
|
-
let e =
|
|
39
|
-
|
|
39
|
+
let e = p;
|
|
40
|
+
p = null, e?.destroy(), n.value = null, l.value = [], u.value = [], d.value = {}, s.value = !1, c.value = !1, h = null;
|
|
40
41
|
}
|
|
41
|
-
async function
|
|
42
|
+
async function b(e) {
|
|
42
43
|
let u = ++g;
|
|
43
|
-
if (
|
|
44
|
+
if (y(), o.value = null, a.value = 0, !e || typeof window > "u") i.value = !1;
|
|
44
45
|
else {
|
|
45
46
|
i.value = !0;
|
|
46
47
|
try {
|
|
47
|
-
let o = await
|
|
48
|
+
let o = await V(t.workerSrc);
|
|
48
49
|
if (u !== g) return;
|
|
49
50
|
r.value = o;
|
|
50
51
|
let d, f;
|
|
51
52
|
if (typeof e == "string" || e instanceof URL ? f = String(e) : d = e instanceof Blob ? new Uint8Array(await e.arrayBuffer()) : new Uint8Array(e instanceof ArrayBuffer ? e.slice(0) : e.slice()), u !== g) return;
|
|
52
|
-
|
|
53
|
+
p = o.getDocument({
|
|
53
54
|
url: f,
|
|
54
55
|
data: d,
|
|
55
|
-
password:
|
|
56
|
+
password: M(t.password),
|
|
56
57
|
withCredentials: t.withCredentials
|
|
57
|
-
}),
|
|
58
|
+
}), p.onProgress = ({ loaded: e, total: t }) => {
|
|
58
59
|
u === g && t && (a.value = Math.min(1, e / t));
|
|
59
|
-
},
|
|
60
|
+
}, p.onPassword = (e, t) => {
|
|
60
61
|
u === g && (h = e, c.value = t === o.PasswordResponses.INCORRECT_PASSWORD, s.value = !0);
|
|
61
62
|
};
|
|
62
|
-
let
|
|
63
|
+
let m = p, _ = await m.promise;
|
|
63
64
|
if (u !== g) {
|
|
64
|
-
|
|
65
|
+
m.destroy();
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
68
|
s.value = !1, c.value = !1, a.value = 1;
|
|
@@ -69,14 +70,14 @@ function de(e, t = {}) {
|
|
|
69
70
|
l.value = Array.from({ length: _.numPages }, () => ({
|
|
70
71
|
width: v.width,
|
|
71
72
|
height: v.height
|
|
72
|
-
})), n.value = _, i.value = !1,
|
|
73
|
+
})), n.value = _, i.value = !1, x(_, u), te(_, u), C(_, o, u);
|
|
73
74
|
} catch (e) {
|
|
74
75
|
if (u !== g) return;
|
|
75
76
|
o.value = e instanceof Error ? e : Error(String(e)), i.value = !1;
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
async function
|
|
80
|
+
async function x(e, t) {
|
|
80
81
|
let n = l.value.slice(), r = !1;
|
|
81
82
|
for (let i = 2; i <= e.numPages; i++) {
|
|
82
83
|
if (t !== g) return;
|
|
@@ -87,7 +88,7 @@ function de(e, t = {}) {
|
|
|
87
88
|
}, r = !0), r && (i % 25 == 0 || i === e.numPages) && (l.value = n.slice(), r = !1);
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
|
-
async function
|
|
91
|
+
async function ee(e) {
|
|
91
92
|
let t = n.value;
|
|
92
93
|
if (!t || !e) return null;
|
|
93
94
|
try {
|
|
@@ -102,11 +103,11 @@ function de(e, t = {}) {
|
|
|
102
103
|
return null;
|
|
103
104
|
}
|
|
104
105
|
}
|
|
105
|
-
async function
|
|
106
|
+
async function te(e, t) {
|
|
106
107
|
let n = await e.getOutline().catch(() => null);
|
|
107
108
|
if (!n || t !== g) return;
|
|
108
109
|
let r = async (e) => Promise.all(e.map(async (e) => {
|
|
109
|
-
let t = e.dest ? await
|
|
110
|
+
let t = e.dest ? await ee(e.dest) : null;
|
|
110
111
|
return {
|
|
111
112
|
title: e.title,
|
|
112
113
|
page: t?.page,
|
|
@@ -117,28 +118,28 @@ function de(e, t = {}) {
|
|
|
117
118
|
})), i = await r(n);
|
|
118
119
|
t === g && (u.value = i);
|
|
119
120
|
}
|
|
120
|
-
async function
|
|
121
|
+
async function C(e, t, n) {
|
|
121
122
|
let r = await e.getMetadata().catch(() => null);
|
|
122
123
|
if (!r || n !== g) return;
|
|
123
124
|
let i = r.info, a = (e) => typeof e == "string" && e.trim() ? e : void 0;
|
|
124
|
-
|
|
125
|
+
d.value = {
|
|
125
126
|
title: a(r.metadata?.get("dc:title")) ?? a(i.Title),
|
|
126
127
|
author: a(r.metadata?.get("dc:creator")) ?? a(i.Author),
|
|
127
128
|
subject: a(i.Subject),
|
|
128
129
|
creator: a(i.Creator),
|
|
129
130
|
producer: a(i.Producer),
|
|
130
|
-
creationDate:
|
|
131
|
-
modificationDate:
|
|
131
|
+
creationDate: U(t, i.CreationDate),
|
|
132
|
+
modificationDate: U(t, i.ModDate)
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
|
-
async function
|
|
135
|
+
async function w(e) {
|
|
135
136
|
let t = n.value;
|
|
136
137
|
if (!t) throw Error("No document loaded");
|
|
137
138
|
return t.getPage(e);
|
|
138
139
|
}
|
|
139
|
-
function
|
|
140
|
+
function ne(e) {
|
|
140
141
|
let t = _.get(e);
|
|
141
|
-
return t || (t =
|
|
142
|
+
return t || (t = w(e).then(async (e) => {
|
|
142
143
|
let t = await e.getTextContent(), n = "", r = [];
|
|
143
144
|
for (let e of t.items) "str" in e && (r.push(n.length), n += e.str, e.hasEOL && (n += " "));
|
|
144
145
|
return {
|
|
@@ -147,11 +148,11 @@ function de(e, t = {}) {
|
|
|
147
148
|
};
|
|
148
149
|
}), _.set(e, t)), t;
|
|
149
150
|
}
|
|
150
|
-
async function
|
|
151
|
-
let r =
|
|
151
|
+
async function re(e, t = {}) {
|
|
152
|
+
let r = H(e.trim(), !!t.caseSensitive), i = [];
|
|
152
153
|
if (!r || !n.value) return i;
|
|
153
|
-
for (let e = 1; e <=
|
|
154
|
-
let { text: n } = await
|
|
154
|
+
for (let e = 1; e <= f.value && !t.signal?.aborted; e++) {
|
|
155
|
+
let { text: n } = await ne(e), a = H(n, !!t.caseSensitive), o = 0;
|
|
155
156
|
for (let t = a.indexOf(r); t >= 0; t = a.indexOf(r, t + r.length)) {
|
|
156
157
|
let a = Math.max(0, t - 40), s = Math.min(n.length, t + r.length + 40);
|
|
157
158
|
i.push({
|
|
@@ -165,9 +166,9 @@ function de(e, t = {}) {
|
|
|
165
166
|
}
|
|
166
167
|
return i;
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function E(e, t = 160) {
|
|
169
170
|
let n = typeof window < "u" ? Math.min(2, window.devicePixelRatio || 1) : 1, r = `${e}@${t}`, i = v.get(r);
|
|
170
|
-
return i || (i =
|
|
171
|
+
return i || (i = w(e).then(async (e) => {
|
|
171
172
|
let r = e.getViewport({ scale: 1 }), i = e.getViewport({ scale: t / r.width * n }), a = document.createElement("canvas");
|
|
172
173
|
a.width = Math.ceil(i.width), a.height = Math.ceil(i.height), await e.render({
|
|
173
174
|
canvas: a,
|
|
@@ -178,21 +179,21 @@ function de(e, t = {}) {
|
|
|
178
179
|
return URL.createObjectURL(o);
|
|
179
180
|
}), v.set(r, i)), i;
|
|
180
181
|
}
|
|
181
|
-
let
|
|
182
|
+
let D = async () => {
|
|
182
183
|
let e = n.value;
|
|
183
184
|
if (!e) throw Error("No document loaded");
|
|
184
185
|
return e.getData();
|
|
185
186
|
};
|
|
186
|
-
async function
|
|
187
|
-
let e = await
|
|
187
|
+
async function k() {
|
|
188
|
+
let e = await D();
|
|
188
189
|
return URL.createObjectURL(new Blob([e], { type: "application/pdf" }));
|
|
189
190
|
}
|
|
190
|
-
async function
|
|
191
|
-
let n = await
|
|
192
|
-
a.href = n, a.download = t ?? (r instanceof File ? r.name : i.toLowerCase().endsWith(".pdf") ? i : `${
|
|
191
|
+
async function ie(t) {
|
|
192
|
+
let n = await k(), r = M(e), i = typeof r == "string" ? decodeURIComponent(r.split(/[?#]/)[0].split("/").pop() ?? "") : "", a = document.createElement("a");
|
|
193
|
+
a.href = n, a.download = t ?? (r instanceof File ? r.name : i.toLowerCase().endsWith(".pdf") ? i : `${d.value.title ?? "document"}.pdf`), document.body.appendChild(a), a.click(), a.remove(), setTimeout(() => URL.revokeObjectURL(n), 3e4);
|
|
193
194
|
}
|
|
194
|
-
async function
|
|
195
|
-
let e = await
|
|
195
|
+
async function ae() {
|
|
196
|
+
let e = await k(), t = document.createElement("iframe");
|
|
196
197
|
t.style.cssText = "position:fixed;right:0;bottom:0;width:0;height:0;border:0;visibility:hidden", t.src = e, t.onload = () => {
|
|
197
198
|
try {
|
|
198
199
|
t.contentWindow?.focus(), t.contentWindow?.print();
|
|
@@ -208,10 +209,10 @@ function de(e, t = {}) {
|
|
|
208
209
|
let t = h;
|
|
209
210
|
t && (h = null, s.value = !1, t(e));
|
|
210
211
|
}
|
|
211
|
-
return
|
|
212
|
-
|
|
213
|
-
}, { immediate: !0 }),
|
|
214
|
-
g++,
|
|
212
|
+
return F(() => M(e), (e) => {
|
|
213
|
+
b(e);
|
|
214
|
+
}, { immediate: !0 }), S() && T(() => {
|
|
215
|
+
g++, y();
|
|
215
216
|
}), {
|
|
216
217
|
doc: n,
|
|
217
218
|
pdfjs: r,
|
|
@@ -221,42 +222,42 @@ function de(e, t = {}) {
|
|
|
221
222
|
needsPassword: s,
|
|
222
223
|
wrongPassword: c,
|
|
223
224
|
submitPassword: j,
|
|
224
|
-
numPages:
|
|
225
|
+
numPages: f,
|
|
225
226
|
pageSizes: l,
|
|
226
227
|
outline: u,
|
|
227
|
-
metadata:
|
|
228
|
-
getPage:
|
|
229
|
-
pageText:
|
|
230
|
-
search:
|
|
231
|
-
thumbnail:
|
|
232
|
-
resolveDest:
|
|
233
|
-
getData:
|
|
234
|
-
download:
|
|
235
|
-
print:
|
|
228
|
+
metadata: d,
|
|
229
|
+
getPage: w,
|
|
230
|
+
pageText: ne,
|
|
231
|
+
search: re,
|
|
232
|
+
thumbnail: E,
|
|
233
|
+
resolveDest: ee,
|
|
234
|
+
getData: D,
|
|
235
|
+
download: ie,
|
|
236
|
+
print: ae
|
|
236
237
|
};
|
|
237
238
|
}
|
|
238
239
|
// src/components/_MPdfPage.vue?vue&type=script&setup=true&lang.ts
|
|
239
|
-
var
|
|
240
|
+
var W = ["data-page"], ue = [
|
|
240
241
|
"href",
|
|
241
242
|
"target",
|
|
242
243
|
"rel",
|
|
243
244
|
"onClick"
|
|
244
|
-
],
|
|
245
|
+
], de = ["viewBox"], fe = ["onClick"], pe = [
|
|
245
246
|
"x",
|
|
246
247
|
"y",
|
|
247
248
|
"width",
|
|
248
249
|
"height",
|
|
249
250
|
"fill"
|
|
250
|
-
],
|
|
251
|
+
], G = [
|
|
251
252
|
"d",
|
|
252
253
|
"stroke",
|
|
253
254
|
"stroke-width",
|
|
254
255
|
"onClick"
|
|
255
|
-
], me = ["cx", "cy"],
|
|
256
|
+
], me = ["cx", "cy"], K = [
|
|
256
257
|
"d",
|
|
257
258
|
"stroke",
|
|
258
259
|
"stroke-width"
|
|
259
|
-
],
|
|
260
|
+
], he = ["aria-label", "onClick"], q = 16e6, J = 12, ge = /* @__PURE__ */ x({
|
|
260
261
|
__name: "_MPdfPage",
|
|
261
262
|
props: {
|
|
262
263
|
pdf: {},
|
|
@@ -282,25 +283,25 @@ var R = ["data-page"], fe = [
|
|
|
282
283
|
"rendered"
|
|
283
284
|
],
|
|
284
285
|
setup(e, { expose: n, emit: r }) {
|
|
285
|
-
let i = e, a = r, o =
|
|
286
|
-
function
|
|
286
|
+
let i = e, a = r, o = O(), s = O(), c = O(), l = A(null), u = A(null);
|
|
287
|
+
function d(e) {
|
|
287
288
|
return e.getViewport({
|
|
288
289
|
scale: i.scale,
|
|
289
290
|
rotation: (e.rotate + i.rotation) % 360
|
|
290
291
|
});
|
|
291
292
|
}
|
|
292
|
-
let
|
|
293
|
-
async function
|
|
293
|
+
let p = null, h = "";
|
|
294
|
+
async function y() {
|
|
294
295
|
if (!i.active) return;
|
|
295
|
-
let e =
|
|
296
|
+
let e = l.value ??= await i.pdf.getPage(i.page).catch(() => null);
|
|
296
297
|
if (!e || !i.active) return;
|
|
297
|
-
let t =
|
|
298
|
-
|
|
298
|
+
let t = d(e);
|
|
299
|
+
u.value = t;
|
|
299
300
|
let n = Math.min(2, window.devicePixelRatio || 1);
|
|
300
|
-
t.width * t.height * n * n >
|
|
301
|
+
t.width * t.height * n * n > q && (n = Math.sqrt(q / (t.width * t.height)));
|
|
301
302
|
let r = `${i.scale}|${i.rotation}|${n}`;
|
|
302
|
-
if (r ===
|
|
303
|
-
|
|
303
|
+
if (r === h) return;
|
|
304
|
+
p?.cancel();
|
|
304
305
|
let o = document.createElement("canvas");
|
|
305
306
|
o.width = Math.floor(t.width * n), o.height = Math.floor(t.height * n), o.className = "absolute inset-0 h-full w-full";
|
|
306
307
|
let c = e.render({
|
|
@@ -315,55 +316,55 @@ var R = ["data-page"], fe = [
|
|
|
315
316
|
0
|
|
316
317
|
]
|
|
317
318
|
});
|
|
318
|
-
|
|
319
|
+
p = c;
|
|
319
320
|
try {
|
|
320
321
|
await c.promise;
|
|
321
322
|
} catch {
|
|
322
323
|
return;
|
|
323
324
|
}
|
|
324
|
-
if (
|
|
325
|
-
|
|
326
|
-
let
|
|
327
|
-
|
|
325
|
+
if (p !== c) return;
|
|
326
|
+
p = null, h = r;
|
|
327
|
+
let f = s.value;
|
|
328
|
+
f && (f.replaceChildren(o), a("rendered", i.page), re(e, t), N(e, t));
|
|
328
329
|
}
|
|
329
|
-
function
|
|
330
|
-
|
|
330
|
+
function x() {
|
|
331
|
+
p?.cancel(), p = null, h = "";
|
|
331
332
|
let e = s.value?.querySelector("canvas");
|
|
332
|
-
e && (e.width = 0, e.height = 0), s.value?.replaceChildren(),
|
|
333
|
+
e && (e.width = 0, e.height = 0), s.value?.replaceChildren(), ee?.cancel(), ee = null, c.value?.replaceChildren(), j.value = [], l.value?.cleanup();
|
|
333
334
|
}
|
|
334
|
-
let
|
|
335
|
-
async function
|
|
335
|
+
let S, ee = null, te = null;
|
|
336
|
+
async function re(e, t) {
|
|
336
337
|
let n = i.pdf.pdfjs.value, r = c.value;
|
|
337
338
|
if (!n || !r) return;
|
|
338
|
-
|
|
339
|
+
ee?.cancel(), te ??= await e.getTextContent();
|
|
339
340
|
let a = document.createElement("div");
|
|
340
341
|
a.className = "textLayer";
|
|
341
342
|
let o = new n.TextLayer({
|
|
342
|
-
textContentSource:
|
|
343
|
+
textContentSource: te,
|
|
343
344
|
container: a,
|
|
344
345
|
viewport: t
|
|
345
346
|
});
|
|
346
|
-
|
|
347
|
+
ee = o;
|
|
347
348
|
try {
|
|
348
349
|
await o.render();
|
|
349
350
|
} catch {
|
|
350
351
|
return;
|
|
351
352
|
}
|
|
352
|
-
|
|
353
|
+
ee === o && (r.replaceChildren(a), ie());
|
|
353
354
|
}
|
|
354
|
-
let
|
|
355
|
+
let T = [], D = (e) => e.replace(/[&<>"]/g, (e) => ({
|
|
355
356
|
"&": "&",
|
|
356
357
|
"<": "<",
|
|
357
358
|
">": ">",
|
|
358
359
|
"\"": """
|
|
359
360
|
})[e]);
|
|
360
|
-
async function
|
|
361
|
-
let e =
|
|
361
|
+
async function ie() {
|
|
362
|
+
let e = ee;
|
|
362
363
|
if (!e) return;
|
|
363
|
-
for (let t of
|
|
364
|
-
if (
|
|
364
|
+
for (let t of T) e.textDivs[t] && (e.textDivs[t].textContent = e.textContentItemsStr[t] ?? "");
|
|
365
|
+
if (T = [], !i.hits.length) return;
|
|
365
366
|
let { starts: t } = await i.pdf.pageText(i.page);
|
|
366
|
-
if (e !==
|
|
367
|
+
if (e !== ee) return;
|
|
367
368
|
let n = /* @__PURE__ */ new Map();
|
|
368
369
|
for (let r of i.hits) for (let i = 0; i < t.length; i++) {
|
|
369
370
|
let a = t[i], o = e.textContentItemsStr[i] ?? "", s = Math.max(r.start, a), c = Math.min(r.end, a + o.length);
|
|
@@ -383,19 +384,19 @@ var R = ["data-page"], fe = [
|
|
|
383
384
|
i.sort((e, t) => e.a - t.a);
|
|
384
385
|
let o = "", s = 0;
|
|
385
386
|
for (let e of i) o += D(a.slice(s, e.a)) + `<span class="m3-pdf-hit${e.current ? " m3-pdf-hit-current" : ""}">${D(a.slice(e.a, e.b))}</span>`, s = e.b;
|
|
386
|
-
n.innerHTML = o + D(a.slice(s)),
|
|
387
|
+
n.innerHTML = o + D(a.slice(s)), T.push(t), i.some((e) => e.current) && (r ??= n.querySelector(".m3-pdf-hit-current"));
|
|
387
388
|
}
|
|
388
|
-
|
|
389
|
+
ae.value = r;
|
|
389
390
|
}
|
|
390
|
-
let
|
|
391
|
-
|
|
392
|
-
let
|
|
393
|
-
async function
|
|
394
|
-
|
|
391
|
+
let ae = A(null);
|
|
392
|
+
F(() => i.hits, ie);
|
|
393
|
+
let j = O([]), M = null;
|
|
394
|
+
async function N(e, t) {
|
|
395
|
+
M ??= (await e.getAnnotations().catch(() => [])).filter((e) => e.subtype === "Link" && (e.url || e.dest)).map((e) => ({
|
|
395
396
|
rect: e.rect,
|
|
396
397
|
url: e.url,
|
|
397
398
|
dest: e.dest
|
|
398
|
-
})),
|
|
399
|
+
})), j.value = M.map((e) => {
|
|
399
400
|
let [n, r] = t.convertToViewportPoint(e.rect[0], e.rect[1]), [i, a] = t.convertToViewportPoint(e.rect[2], e.rect[3]);
|
|
400
401
|
return {
|
|
401
402
|
left: Math.min(n, i),
|
|
@@ -407,11 +408,11 @@ var R = ["data-page"], fe = [
|
|
|
407
408
|
};
|
|
408
409
|
});
|
|
409
410
|
}
|
|
410
|
-
let
|
|
411
|
+
let P = m(() => u.value && h ? i.scale / Number(h.split("|")[0]) : 1), oe = (e, t) => u.value ? u.value.convertToViewportPoint(e, t) : [0, 0], I = (e, t) => u.value ? u.value.convertToPdfPoint(e, t) : [0, 0], L = m(() => (i.scale, i.rotation, i.annotations.map((e) => {
|
|
411
412
|
if (e.type === "highlight") return {
|
|
412
413
|
a: e,
|
|
413
414
|
rects: (e.rects ?? []).map(([e, t, n, r]) => {
|
|
414
|
-
let [i, a] =
|
|
415
|
+
let [i, a] = oe(e, t), [o, s] = oe(n, r);
|
|
415
416
|
return {
|
|
416
417
|
x: Math.min(i, o),
|
|
417
418
|
y: Math.min(a, s),
|
|
@@ -423,94 +424,94 @@ var R = ["data-page"], fe = [
|
|
|
423
424
|
if (e.type === "ink") return {
|
|
424
425
|
a: e,
|
|
425
426
|
d: (e.paths ?? []).map((e) => e.map(([e, t], n) => {
|
|
426
|
-
let [r, i] =
|
|
427
|
+
let [r, i] = oe(e, t);
|
|
427
428
|
return `${n ? "L" : "M"}${r.toFixed(1)},${i.toFixed(1)}`;
|
|
428
429
|
}).join("")).join(""),
|
|
429
430
|
w: (e.width ?? 2) * i.scale
|
|
430
431
|
};
|
|
431
|
-
let [t, n] =
|
|
432
|
+
let [t, n] = oe(e.at?.[0] ?? 0, e.at?.[1] ?? 0);
|
|
432
433
|
return {
|
|
433
434
|
a: e,
|
|
434
435
|
x: t,
|
|
435
436
|
y: n
|
|
436
437
|
};
|
|
437
438
|
})));
|
|
438
|
-
function
|
|
439
|
+
function se(e, t) {
|
|
439
440
|
i.tool === "select" && (e.stopPropagation(), a("select", {
|
|
440
441
|
id: t.id,
|
|
441
442
|
anchor: e.currentTarget.getBoundingClientRect()
|
|
442
443
|
}));
|
|
443
444
|
}
|
|
444
|
-
let
|
|
445
|
-
function
|
|
446
|
-
let t = o.value.getBoundingClientRect(), n =
|
|
445
|
+
let ce = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : `a${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`, R = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
446
|
+
function z(e) {
|
|
447
|
+
let t = o.value.getBoundingClientRect(), n = u.value;
|
|
447
448
|
return [(e.clientX - t.left) / (t.width || 1) * n.width, (e.clientY - t.top) / (t.height || 1) * n.height];
|
|
448
449
|
}
|
|
449
|
-
function
|
|
450
|
-
if (i.tool !== "note" || !
|
|
451
|
-
let [t, n] =
|
|
450
|
+
function B(e) {
|
|
451
|
+
if (i.tool !== "note" || !u.value) return;
|
|
452
|
+
let [t, n] = I(...z(e));
|
|
452
453
|
a("add", {
|
|
453
|
-
id:
|
|
454
|
+
id: ce(),
|
|
454
455
|
type: "note",
|
|
455
456
|
page: i.page,
|
|
456
457
|
color: i.color,
|
|
457
458
|
at: [t, n],
|
|
458
459
|
text: "",
|
|
459
|
-
createdAt:
|
|
460
|
+
createdAt: R()
|
|
460
461
|
});
|
|
461
462
|
}
|
|
462
|
-
let
|
|
463
|
-
function
|
|
464
|
-
let t =
|
|
465
|
-
|
|
466
|
-
let [n, r] =
|
|
463
|
+
let V = O(null), H = O(!1), U = O(null), le = -1, ge = (e) => e.pointerType === "pen" && (e.button === 5 || !!(e.buttons & 32));
|
|
464
|
+
function _e(e) {
|
|
465
|
+
let t = z(e);
|
|
466
|
+
U.value = t;
|
|
467
|
+
let [n, r] = I(t[0], t[1]);
|
|
467
468
|
a("erase-at", {
|
|
468
469
|
x: n,
|
|
469
470
|
y: r,
|
|
470
|
-
r:
|
|
471
|
+
r: J / i.scale
|
|
471
472
|
});
|
|
472
473
|
}
|
|
473
|
-
function
|
|
474
|
-
let t =
|
|
475
|
-
if (!(i.tool !== "ink" && i.tool !== "eraser" && !t || e.button !== 0 && !t || !
|
|
476
|
-
e.preventDefault(),
|
|
474
|
+
function Y(e) {
|
|
475
|
+
let t = ge(e);
|
|
476
|
+
if (!(i.tool !== "ink" && i.tool !== "eraser" && !t || e.button !== 0 && !t || !u.value)) {
|
|
477
|
+
e.preventDefault(), le = e.pointerId;
|
|
477
478
|
try {
|
|
478
479
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
479
480
|
} catch {}
|
|
480
|
-
i.tool === "eraser" || t ? (
|
|
481
|
+
i.tool === "eraser" || t ? (H.value = !0, a("erase-start"), _e(e)) : V.value = [z(e)];
|
|
481
482
|
}
|
|
482
483
|
}
|
|
483
|
-
function
|
|
484
|
-
if (i.tool === "eraser" && !
|
|
485
|
-
if (
|
|
486
|
-
if (!
|
|
487
|
-
let t =
|
|
488
|
-
Math.hypot(t[0] - n[0], t[1] - n[1]) >= 1.5 && (
|
|
489
|
-
}
|
|
490
|
-
function
|
|
491
|
-
if (e.pointerId !==
|
|
492
|
-
if (
|
|
493
|
-
|
|
484
|
+
function ve(e) {
|
|
485
|
+
if (i.tool === "eraser" && !H.value && e.pointerType !== "touch" && (U.value = z(e)), e.pointerId !== le) return;
|
|
486
|
+
if (H.value) return _e(e);
|
|
487
|
+
if (!V.value) return;
|
|
488
|
+
let t = z(e), n = V.value[V.value.length - 1];
|
|
489
|
+
Math.hypot(t[0] - n[0], t[1] - n[1]) >= 1.5 && (V.value = [...V.value, t]);
|
|
490
|
+
}
|
|
491
|
+
function ye(e) {
|
|
492
|
+
if (e.pointerId !== le) return;
|
|
493
|
+
if (le = -1, H.value) {
|
|
494
|
+
H.value = !1, e.pointerType === "touch" && (U.value = null);
|
|
494
495
|
return;
|
|
495
496
|
}
|
|
496
|
-
if (!
|
|
497
|
-
let t =
|
|
498
|
-
|
|
499
|
-
id:
|
|
497
|
+
if (!V.value) return;
|
|
498
|
+
let t = V.value;
|
|
499
|
+
V.value = null, t.length < 2 || a("add", {
|
|
500
|
+
id: ce(),
|
|
500
501
|
type: "ink",
|
|
501
502
|
page: i.page,
|
|
502
503
|
color: i.color,
|
|
503
504
|
width: i.inkWidth,
|
|
504
|
-
paths: [t.map(([e, t]) =>
|
|
505
|
-
createdAt:
|
|
505
|
+
paths: [t.map(([e, t]) => I(e, t).map((e) => Math.round(e * 100) / 100))],
|
|
506
|
+
createdAt: R()
|
|
506
507
|
});
|
|
507
508
|
}
|
|
508
|
-
let
|
|
509
|
-
function
|
|
510
|
-
let n =
|
|
509
|
+
let be = m(() => (V.value ?? []).map(([e, t], n) => `${n ? "L" : "M"}${e.toFixed(1)},${t.toFixed(1)}`).join(""));
|
|
510
|
+
function xe(e, t) {
|
|
511
|
+
let n = u.value;
|
|
511
512
|
if (!n || !o.value) return !1;
|
|
512
513
|
let r = o.value.getBoundingClientRect(), i = n.width / (r.width || 1), s = n.height / (r.height || 1), c = (e - r.left) * i, l = (t - r.top) * s;
|
|
513
|
-
for (let e of [...
|
|
514
|
+
for (let e of [...L.value].reverse()) {
|
|
514
515
|
if (!("rects" in e) || !e.rects) continue;
|
|
515
516
|
let t = e.rects.find((e) => c >= e.x - 2 && c <= e.x + e.w + 2 && l >= e.y - 2 && l <= e.y + e.h + 2);
|
|
516
517
|
if (t) return a("select", {
|
|
@@ -520,24 +521,24 @@ var R = ["data-page"], fe = [
|
|
|
520
521
|
}
|
|
521
522
|
return !1;
|
|
522
523
|
}
|
|
523
|
-
function
|
|
524
|
+
function Se(e) {
|
|
524
525
|
let t = e ? {
|
|
525
526
|
x: e.clientX,
|
|
526
527
|
y: e.clientY
|
|
527
528
|
} : null;
|
|
528
529
|
setTimeout(() => {
|
|
529
530
|
let e = window.getSelection(), n = c.value;
|
|
530
|
-
if (!e || e.isCollapsed || !e.rangeCount || !n || !
|
|
531
|
-
if (t && (i.tool === "select" || i.tool === "highlight") &&
|
|
531
|
+
if (!e || e.isCollapsed || !e.rangeCount || !n || !u.value) {
|
|
532
|
+
if (t && (i.tool === "select" || i.tool === "highlight") && xe(t.x, t.y)) return;
|
|
532
533
|
i.tool === "select" && a("text-selection", null);
|
|
533
534
|
return;
|
|
534
535
|
}
|
|
535
536
|
let r = e.getRangeAt(0);
|
|
536
537
|
if (!n.contains(r.commonAncestorContainer)) return;
|
|
537
|
-
let s = o.value.getBoundingClientRect(), l =
|
|
538
|
+
let s = o.value.getBoundingClientRect(), l = u.value, d = l.width / (s.width || 1), f = l.height / (s.height || 1), p = [];
|
|
538
539
|
for (let e of Array.from(r.getClientRects())) {
|
|
539
540
|
if (e.width < 1 || e.height < 1) continue;
|
|
540
|
-
let [t, n] =
|
|
541
|
+
let [t, n] = I((e.left - s.left) * d, (e.top - s.top) * f), [r, i] = I((e.right - s.left) * d, (e.bottom - s.top) * f);
|
|
541
542
|
p.push([
|
|
542
543
|
t,
|
|
543
544
|
n,
|
|
@@ -548,14 +549,14 @@ var R = ["data-page"], fe = [
|
|
|
548
549
|
if (!p.length) return;
|
|
549
550
|
let m = e.toString().replace(/\s+/g, " ").trim();
|
|
550
551
|
i.tool === "highlight" ? (a("add", {
|
|
551
|
-
id:
|
|
552
|
+
id: ce(),
|
|
552
553
|
type: "highlight",
|
|
553
554
|
page: i.page,
|
|
554
555
|
color: i.color,
|
|
555
556
|
rects: p,
|
|
556
557
|
quote: m,
|
|
557
558
|
text: "",
|
|
558
|
-
createdAt:
|
|
559
|
+
createdAt: R()
|
|
559
560
|
}), e.removeAllRanges()) : a("text-selection", {
|
|
560
561
|
page: i.page,
|
|
561
562
|
rects: p,
|
|
@@ -564,69 +565,69 @@ var R = ["data-page"], fe = [
|
|
|
564
565
|
});
|
|
565
566
|
});
|
|
566
567
|
}
|
|
567
|
-
return
|
|
568
|
-
|
|
568
|
+
return F(() => i.active, (e) => e ? y() : x(), { immediate: !0 }), F(() => [i.scale, i.rotation], () => {
|
|
569
|
+
l.value && (u.value = d(l.value)), clearTimeout(S), S = setTimeout(y, 140);
|
|
569
570
|
}), ne(() => {
|
|
570
|
-
clearTimeout(
|
|
571
|
+
clearTimeout(S), x();
|
|
571
572
|
}), n({
|
|
572
573
|
root: o,
|
|
573
|
-
currentHit:
|
|
574
|
-
}), (n, r) => (
|
|
574
|
+
currentHit: ae
|
|
575
|
+
}), (n, r) => (E(), _("div", {
|
|
575
576
|
ref_key: "root",
|
|
576
577
|
ref: o,
|
|
577
578
|
class: "m3-pdf-page relative bg-white shadow-elevation-1",
|
|
578
579
|
"data-page": e.page,
|
|
579
|
-
style:
|
|
580
|
+
style: w({
|
|
580
581
|
"--scale-factor": e.scale,
|
|
581
582
|
"--total-scale-factor": e.scale,
|
|
582
583
|
"--user-unit": 1,
|
|
583
584
|
"--scale-round-x": "1px",
|
|
584
585
|
"--scale-round-y": "1px"
|
|
585
586
|
}),
|
|
586
|
-
onClick:
|
|
587
|
+
onClick: B
|
|
587
588
|
}, [
|
|
588
|
-
|
|
589
|
+
v("div", {
|
|
589
590
|
ref_key: "canvasHost",
|
|
590
591
|
ref: s,
|
|
591
592
|
class: "absolute inset-0"
|
|
592
593
|
}, null, 512),
|
|
593
|
-
|
|
594
|
+
v("div", {
|
|
594
595
|
ref_key: "textHost",
|
|
595
596
|
ref: c,
|
|
596
|
-
class:
|
|
597
|
-
onPointerup:
|
|
597
|
+
class: C(["absolute inset-0 overflow-hidden", { "pointer-events-none": e.tool === "ink" || e.tool === "note" || e.tool === "eraser" }]),
|
|
598
|
+
onPointerup: Se
|
|
598
599
|
}, null, 34),
|
|
599
|
-
(
|
|
600
|
+
(E(!0), _(f, null, k(j.value, (t, n) => (E(), _("a", {
|
|
600
601
|
key: n,
|
|
601
602
|
href: t.url ?? "#",
|
|
602
603
|
target: t.url ? "_blank" : void 0,
|
|
603
604
|
rel: t.url ? "noopener noreferrer" : void 0,
|
|
604
|
-
class:
|
|
605
|
-
style:
|
|
606
|
-
left: `${t.left *
|
|
607
|
-
top: `${t.top *
|
|
608
|
-
width: `${t.width *
|
|
609
|
-
height: `${t.height *
|
|
605
|
+
class: C(["absolute rounded-xs hover:bg-primary/12", { "pointer-events-none": e.tool !== "select" }]),
|
|
606
|
+
style: w({
|
|
607
|
+
left: `${t.left * P.value}px`,
|
|
608
|
+
top: `${t.top * P.value}px`,
|
|
609
|
+
width: `${t.width * P.value}px`,
|
|
610
|
+
height: `${t.height * P.value}px`
|
|
610
611
|
}),
|
|
611
612
|
onClick: (e) => {
|
|
612
613
|
t.url ? a("link", { url: t.url }) : (e.preventDefault(), a("link", { dest: t.dest }));
|
|
613
614
|
}
|
|
614
|
-
}, null, 14,
|
|
615
|
-
(
|
|
616
|
-
class:
|
|
617
|
-
viewBox:
|
|
615
|
+
}, null, 14, ue))), 128)),
|
|
616
|
+
(E(), _("svg", {
|
|
617
|
+
class: C(["absolute inset-0 h-full w-full overflow-visible", e.tool === "ink" ? "cursor-crosshair touch-none" : e.tool === "eraser" ? "cursor-none touch-none" : "pointer-events-none"]),
|
|
618
|
+
viewBox: u.value ? `0 0 ${u.value.width} ${u.value.height}` : void 0,
|
|
618
619
|
preserveAspectRatio: "none",
|
|
619
|
-
onPointerdown:
|
|
620
|
-
onPointermove:
|
|
621
|
-
onPointerup:
|
|
622
|
-
onPointercancel:
|
|
623
|
-
onPointerleave: r[0] ||= (e) =>
|
|
620
|
+
onPointerdown: Y,
|
|
621
|
+
onPointermove: ve,
|
|
622
|
+
onPointerup: ye,
|
|
623
|
+
onPointercancel: ye,
|
|
624
|
+
onPointerleave: r[0] ||= (e) => U.value = H.value ? U.value : null
|
|
624
625
|
}, [
|
|
625
|
-
(
|
|
626
|
+
(E(!0), _(f, null, k(L.value, (t) => (E(), _(f, { key: t.a.id }, ["rects" in t ? (E(), _("g", {
|
|
626
627
|
key: 0,
|
|
627
|
-
class:
|
|
628
|
-
onClick: (e) =>
|
|
629
|
-
}, [(
|
|
628
|
+
class: C(["m3-pdf-highlight", { "m3-pdf-selected": t.a.id === e.selectedId }]),
|
|
629
|
+
onClick: (e) => se(e, t.a)
|
|
630
|
+
}, [(E(!0), _(f, null, k(t.rects, (e, n) => (E(), _("rect", {
|
|
630
631
|
key: n,
|
|
631
632
|
x: e.x,
|
|
632
633
|
y: e.y,
|
|
@@ -634,7 +635,7 @@ var R = ["data-page"], fe = [
|
|
|
634
635
|
height: e.h,
|
|
635
636
|
rx: "2",
|
|
636
637
|
fill: t.a.color
|
|
637
|
-
}, null, 8,
|
|
638
|
+
}, null, 8, pe))), 128))], 10, fe)) : "d" in t ? (E(), _("path", {
|
|
638
639
|
key: 1,
|
|
639
640
|
d: t.d,
|
|
640
641
|
fill: "none",
|
|
@@ -642,32 +643,32 @@ var R = ["data-page"], fe = [
|
|
|
642
643
|
"stroke-width": t.w,
|
|
643
644
|
"stroke-linecap": "round",
|
|
644
645
|
"stroke-linejoin": "round",
|
|
645
|
-
class:
|
|
646
|
-
onClick: (e) =>
|
|
647
|
-
}, null, 10,
|
|
648
|
-
|
|
646
|
+
class: C(["m3-pdf-ink", { "m3-pdf-selected": t.a.id === e.selectedId }]),
|
|
647
|
+
onClick: (e) => se(e, t.a)
|
|
648
|
+
}, null, 10, G)) : g("", !0)], 64))), 128)),
|
|
649
|
+
U.value && e.tool === "eraser" ? (E(), _("circle", {
|
|
649
650
|
key: 0,
|
|
650
|
-
cx:
|
|
651
|
-
cy:
|
|
652
|
-
r:
|
|
651
|
+
cx: U.value[0],
|
|
652
|
+
cy: U.value[1],
|
|
653
|
+
r: J,
|
|
653
654
|
class: "pointer-events-none fill-surface/40 stroke-on-surface",
|
|
654
655
|
"stroke-width": "1.5"
|
|
655
|
-
}, null, 8, me)) :
|
|
656
|
-
|
|
656
|
+
}, null, 8, me)) : g("", !0),
|
|
657
|
+
V.value ? (E(), _("path", {
|
|
657
658
|
key: 1,
|
|
658
|
-
d:
|
|
659
|
+
d: be.value,
|
|
659
660
|
fill: "none",
|
|
660
661
|
stroke: e.color,
|
|
661
662
|
"stroke-width": e.inkWidth * e.scale,
|
|
662
663
|
"stroke-linecap": "round",
|
|
663
664
|
"stroke-linejoin": "round"
|
|
664
|
-
}, null, 8,
|
|
665
|
-
], 42,
|
|
666
|
-
(
|
|
665
|
+
}, null, 8, K)) : g("", !0)
|
|
666
|
+
], 42, de)),
|
|
667
|
+
(E(!0), _(f, null, k(L.value, (n) => (E(), _(f, { key: `n-${n.a.id}` }, ["x" in n ? (E(), _("button", {
|
|
667
668
|
key: 0,
|
|
668
669
|
type: "button",
|
|
669
|
-
class:
|
|
670
|
-
style:
|
|
670
|
+
class: C(["m3-pdf-note absolute flex size-7 -translate-x-1/2 -translate-y-1/2 cursor-pointer items-center justify-center rounded-full shadow-elevation-2 outline-none focus-visible:ring-2 focus-visible:ring-primary", { "ring-2 ring-primary": n.a.id === e.selectedId }]),
|
|
671
|
+
style: w({
|
|
671
672
|
left: `${n.x}px`,
|
|
672
673
|
top: `${n.y}px`,
|
|
673
674
|
backgroundColor: n.a.color
|
|
@@ -679,74 +680,74 @@ var R = ["data-page"], fe = [
|
|
|
679
680
|
anchor: t.currentTarget.getBoundingClientRect()
|
|
680
681
|
});
|
|
681
682
|
}
|
|
682
|
-
}, [
|
|
683
|
+
}, [b(t, {
|
|
683
684
|
name: "sticky_note_2",
|
|
684
685
|
size: 16,
|
|
685
686
|
filled: "",
|
|
686
687
|
class: "text-black/70"
|
|
687
|
-
})], 14,
|
|
688
|
-
], 12,
|
|
688
|
+
})], 14, he)) : g("", !0)], 64))), 128))
|
|
689
|
+
], 12, W));
|
|
689
690
|
}
|
|
690
|
-
}),
|
|
691
|
+
}), _e = ["aria-label"], Y = {
|
|
691
692
|
key: 0,
|
|
692
693
|
class: "relative z-10 flex h-16 shrink-0 items-center gap-1 bg-surface-container px-1 sm:px-2"
|
|
693
|
-
},
|
|
694
|
+
}, ve = { class: "min-w-0 flex-1 truncate px-1 text-title-medium" }, ye = {
|
|
694
695
|
key: 0,
|
|
695
696
|
class: "flex items-center gap-1 text-body-medium text-on-surface-variant"
|
|
696
|
-
},
|
|
697
|
+
}, be = ["aria-label"], xe = { class: "tabular-nums" }, Se = {
|
|
697
698
|
key: 1,
|
|
698
699
|
class: "mx-1 flex items-center"
|
|
699
|
-
},
|
|
700
|
+
}, Ce = ["aria-label"], we = {
|
|
700
701
|
key: 0,
|
|
701
702
|
class: "m3-pdf-search z-10 flex shrink-0 items-center gap-1 bg-surface-container px-2 pb-2"
|
|
702
|
-
},
|
|
703
|
+
}, Te = { class: "flex h-12 min-w-0 flex-1 items-center gap-2 rounded-full bg-surface-container-highest pr-1 pl-4" }, Ee = ["placeholder", "aria-label"], De = {
|
|
703
704
|
class: "shrink-0 text-label-medium whitespace-nowrap text-on-surface-variant tabular-nums",
|
|
704
705
|
"aria-live": "polite"
|
|
705
|
-
},
|
|
706
|
+
}, Oe = { class: "relative flex min-h-0 flex-1" }, ke = { class: "flex shrink-0 gap-1 px-3 pt-1 pb-2" }, Ae = ["disabled", "onClick"], je = { class: "flex flex-col items-center gap-3" }, Me = [
|
|
706
707
|
"aria-label",
|
|
707
708
|
"aria-current",
|
|
708
709
|
"onClick"
|
|
709
|
-
],
|
|
710
|
+
], Ne = ["src"], Pe = ["aria-label"], Fe = ["aria-label", "onClick"], Ie = {
|
|
710
711
|
key: 1,
|
|
711
712
|
class: "w-8 shrink-0"
|
|
712
|
-
},
|
|
713
|
+
}, Le = { class: "min-w-0 flex-1 truncate" }, Re = {
|
|
713
714
|
key: 0,
|
|
714
715
|
class: "text-label-small text-on-surface-variant tabular-nums"
|
|
715
|
-
},
|
|
716
|
+
}, ze = { class: "relative min-w-0 flex-1" }, Be = {
|
|
716
717
|
key: 1,
|
|
717
718
|
class: "flex h-full items-center justify-center p-6"
|
|
718
|
-
},
|
|
719
|
+
}, Ve = { class: "text-title-medium" }, He = {
|
|
719
720
|
key: 2,
|
|
720
721
|
class: "flex h-full flex-col items-center justify-center gap-2 p-6 text-center text-on-surface-variant"
|
|
721
|
-
},
|
|
722
|
+
}, Ue = { class: "text-title-medium text-on-surface" }, We = { class: "text-body-medium" }, Ge = {
|
|
722
723
|
key: 3,
|
|
723
724
|
class: "flex h-full items-center justify-center"
|
|
724
|
-
},
|
|
725
|
+
}, Ke = {
|
|
725
726
|
key: 4,
|
|
726
727
|
class: "flex h-full items-center justify-center p-6"
|
|
727
|
-
},
|
|
728
|
+
}, qe = {
|
|
728
729
|
key: 0,
|
|
729
730
|
class: "pointer-events-none absolute inset-y-0 right-0 w-full"
|
|
730
|
-
},
|
|
731
|
+
}, Je = { class: "rounded-full bg-inverse-surface px-3 py-1 text-label-large text-inverse-on-surface tabular-nums shadow-elevation-1" }, Ye = {
|
|
731
732
|
key: 1,
|
|
732
733
|
class: "w-3"
|
|
733
|
-
},
|
|
734
|
+
}, Xe = ["aria-label"], Ze = {
|
|
734
735
|
key: 0,
|
|
735
736
|
class: "absolute inset-x-0 bottom-4 z-10 flex justify-center px-2"
|
|
736
|
-
},
|
|
737
|
+
}, Qe = ["aria-label"], $e = [
|
|
737
738
|
"aria-label",
|
|
738
739
|
"aria-pressed",
|
|
739
740
|
"onClick"
|
|
740
|
-
],
|
|
741
|
+
], et = [
|
|
741
742
|
"aria-label",
|
|
742
743
|
"aria-pressed",
|
|
743
744
|
"onClick"
|
|
744
|
-
],
|
|
745
|
+
], tt = { class: "flex items-center gap-1 rounded-full bg-surface-container-high p-1 shadow-elevation-2" }, nt = { class: "flex flex-col gap-3 rounded-lg bg-surface-container-high p-3 shadow-elevation-2" }, rt = { class: "flex items-center gap-1" }, it = [
|
|
745
746
|
"aria-label",
|
|
746
747
|
"aria-pressed",
|
|
747
748
|
"onClick"
|
|
748
749
|
];
|
|
749
|
-
function
|
|
750
|
+
function at(e, t) {
|
|
750
751
|
let { x: n, y: r, r: i } = t;
|
|
751
752
|
if (e.type === "note") {
|
|
752
753
|
let [t, a] = e.at ?? [0, 0];
|
|
@@ -770,7 +771,7 @@ function st(e, t) {
|
|
|
770
771
|
} : null : e;
|
|
771
772
|
}
|
|
772
773
|
// src/components/MPdfViewer.vue
|
|
773
|
-
var
|
|
774
|
+
var ot = /* @__PURE__ */ x({
|
|
774
775
|
inheritAttrs: !1,
|
|
775
776
|
__name: "MPdfViewer",
|
|
776
777
|
props: {
|
|
@@ -827,46 +828,46 @@ var W = /* @__PURE__ */ v({
|
|
|
827
828
|
"link",
|
|
828
829
|
"annotation-click"
|
|
829
830
|
],
|
|
830
|
-
setup(
|
|
831
|
-
let
|
|
832
|
-
password: () =>
|
|
833
|
-
workerSrc:
|
|
831
|
+
setup(o, { expose: l, emit: d }) {
|
|
832
|
+
let x = o, S = d, T = e(), M = le(() => x.src, {
|
|
833
|
+
password: () => x.password,
|
|
834
|
+
workerSrc: x.workerSrc
|
|
834
835
|
});
|
|
835
|
-
|
|
836
|
-
e &&
|
|
837
|
-
}),
|
|
838
|
-
e &&
|
|
836
|
+
F(M.doc, (e) => {
|
|
837
|
+
e && S("loaded", e);
|
|
838
|
+
}), F(M.error, (e) => {
|
|
839
|
+
e && S("error", e);
|
|
839
840
|
});
|
|
840
|
-
let
|
|
841
|
-
|
|
842
|
-
|
|
841
|
+
let P = O(), R = O(), z = O(800), B = O(600), V = O(800), H = m(() => V.value < 600), U = 96 / 72, W = O((x.rotation % 360 + 360) % 360);
|
|
842
|
+
F(() => x.rotation, (e) => {
|
|
843
|
+
W.value = (e % 360 + 360) % 360;
|
|
843
844
|
});
|
|
844
|
-
let
|
|
845
|
-
let e =
|
|
846
|
-
return
|
|
845
|
+
let ue = m(() => {
|
|
846
|
+
let e = W.value % 180 != 0;
|
|
847
|
+
return M.pageSizes.value.map((t) => e ? {
|
|
847
848
|
width: t.height,
|
|
848
849
|
height: t.width
|
|
849
850
|
} : t);
|
|
850
|
-
}),
|
|
851
|
-
|
|
852
|
-
e !==
|
|
851
|
+
}), de = O(x.zoom);
|
|
852
|
+
F(() => x.zoom, (e) => {
|
|
853
|
+
e !== de.value && X(e);
|
|
853
854
|
});
|
|
854
|
-
let
|
|
855
|
+
let fe = m(() => ue.value[Math.max(0, J.value - 1)] ?? ue.value[0] ?? {
|
|
855
856
|
width: 612,
|
|
856
857
|
height: 792
|
|
857
858
|
});
|
|
858
|
-
function
|
|
859
|
-
let t = (
|
|
860
|
-
return e === "fit-width" ? t : Math.min(t, (
|
|
861
|
-
}
|
|
862
|
-
let
|
|
863
|
-
let e =
|
|
864
|
-
return Math.max(
|
|
865
|
-
}),
|
|
866
|
-
let e =
|
|
859
|
+
function pe(e) {
|
|
860
|
+
let t = (z.value - 2 * (H.value ? 8 : 16)) / fe.value.width;
|
|
861
|
+
return e === "fit-width" ? t : Math.min(t, (B.value - 32) / fe.value.height);
|
|
862
|
+
}
|
|
863
|
+
let G = m(() => {
|
|
864
|
+
let e = de.value, t = typeof e == "number" ? e * U : pe(e);
|
|
865
|
+
return Math.max(x.minZoom * U, Math.min(x.maxZoom * U, t || U));
|
|
866
|
+
}), me = m(() => Math.round(G.value / U * 100)), K = m(() => {
|
|
867
|
+
let e = H.value ? 8 : 16, t = e, n = 0;
|
|
867
868
|
return {
|
|
868
|
-
boxes:
|
|
869
|
-
let r = Math.floor(e.width *
|
|
869
|
+
boxes: ue.value.map((e) => {
|
|
870
|
+
let r = Math.floor(e.width * G.value), i = Math.floor(e.height * G.value), a = {
|
|
870
871
|
top: t,
|
|
871
872
|
width: r,
|
|
872
873
|
height: i
|
|
@@ -877,56 +878,56 @@ var W = /* @__PURE__ */ v({
|
|
|
877
878
|
width: n + 2 * e,
|
|
878
879
|
pad: e
|
|
879
880
|
};
|
|
880
|
-
}),
|
|
881
|
-
function
|
|
882
|
-
let t =
|
|
881
|
+
}), he = O(0);
|
|
882
|
+
function q(e) {
|
|
883
|
+
let t = K.value.boxes, n = 0, r = t.length - 1;
|
|
883
884
|
for (; n < r;) {
|
|
884
885
|
let i = n + r + 1 >> 1;
|
|
885
886
|
t[i].top <= e ? n = i : r = i - 1;
|
|
886
887
|
}
|
|
887
888
|
return n;
|
|
888
889
|
}
|
|
889
|
-
let
|
|
890
|
-
function
|
|
891
|
-
if (!
|
|
892
|
-
let e =
|
|
893
|
-
e !==
|
|
890
|
+
let J = O(1);
|
|
891
|
+
function ot() {
|
|
892
|
+
if (!K.value.boxes.length) return;
|
|
893
|
+
let e = q(he.value + B.value / 3) + 1;
|
|
894
|
+
e !== J.value && (J.value = e, S("update:page", e));
|
|
894
895
|
}
|
|
895
|
-
let
|
|
896
|
-
if (!
|
|
897
|
-
let e =
|
|
896
|
+
let st = m(() => {
|
|
897
|
+
if (!K.value.boxes.length) return /* @__PURE__ */ new Set();
|
|
898
|
+
let e = q(Math.max(0, he.value - B.value)), t = q(he.value + B.value * 2), n = /* @__PURE__ */ new Set();
|
|
898
899
|
for (let r = e; r <= t; r++) n.add(r + 1);
|
|
899
900
|
return n;
|
|
900
|
-
}),
|
|
901
|
-
function
|
|
902
|
-
let e =
|
|
903
|
-
|
|
901
|
+
}), ct, lt = O(!1), ut = null;
|
|
902
|
+
function dt() {
|
|
903
|
+
let e = R.value;
|
|
904
|
+
he.value = e.scrollTop, ot(), ut !== null && Math.abs(e.scrollTop - ut) < 1 ? ut = null : (ut = null, lt.value = !0, clearTimeout(ct), ct = setTimeout(() => lt.value = !1, 1200));
|
|
904
905
|
}
|
|
905
|
-
function
|
|
906
|
-
let r =
|
|
906
|
+
function ft(e, t, n = !1) {
|
|
907
|
+
let r = R.value, i = K.value.boxes[e - 1];
|
|
907
908
|
if (!r || !i) return;
|
|
908
|
-
let a =
|
|
909
|
+
let a = ue.value[e - 1], o = t !== void 0 && W.value === 0 ? Math.max(0, (a.height - t) * G.value) : 0;
|
|
909
910
|
r.scrollTo({
|
|
910
|
-
top: i.top + o - (o ? 8 :
|
|
911
|
+
top: i.top + o - (o ? 8 : K.value.pad),
|
|
911
912
|
behavior: n ? "smooth" : "auto"
|
|
912
|
-
}),
|
|
913
|
+
}), J.value = e, S("update:page", e);
|
|
913
914
|
}
|
|
914
|
-
|
|
915
|
-
e && e !==
|
|
915
|
+
F(() => x.page, (e) => {
|
|
916
|
+
e && e !== J.value && ft(e);
|
|
916
917
|
});
|
|
917
|
-
function
|
|
918
|
-
let n =
|
|
919
|
-
if (!n || !
|
|
920
|
-
|
|
918
|
+
function X(e, t) {
|
|
919
|
+
let n = R.value, r = typeof e == "number" ? Math.max(x.minZoom, Math.min(x.maxZoom, e)) : e;
|
|
920
|
+
if (!n || !K.value.boxes.length) {
|
|
921
|
+
de.value = r, S("update:zoom", r);
|
|
921
922
|
return;
|
|
922
923
|
}
|
|
923
|
-
let i = n.getBoundingClientRect(), a = t ? t.x - i.left : n.clientWidth / 2, o = t ? t.y - i.top : n.clientHeight / 2, s = n.scrollTop + o, c =
|
|
924
|
-
|
|
925
|
-
let e =
|
|
926
|
-
n.scrollTop = e.top + u * e.height - o, n.scrollLeft = (t - e.width) / 2 + f * e.width - a,
|
|
924
|
+
let i = n.getBoundingClientRect(), a = t ? t.x - i.left : n.clientWidth / 2, o = t ? t.y - i.top : n.clientHeight / 2, s = n.scrollTop + o, c = q(s), l = K.value.boxes[c], u = (s - l.top) / l.height, d = (Math.max(K.value.width, n.clientWidth) - l.width) / 2, f = (n.scrollLeft + a - d) / l.width;
|
|
925
|
+
de.value = r, S("update:zoom", r), te(() => {
|
|
926
|
+
let e = K.value.boxes[c], t = Math.max(K.value.width, n.clientWidth);
|
|
927
|
+
n.scrollTop = e.top + u * e.height - o, n.scrollLeft = (t - e.width) / 2 + f * e.width - a, dt();
|
|
927
928
|
});
|
|
928
929
|
}
|
|
929
|
-
let
|
|
930
|
+
let pt = (e, t) => X(G.value / U * e, t), mt = [
|
|
930
931
|
.5,
|
|
931
932
|
.75,
|
|
932
933
|
1,
|
|
@@ -936,141 +937,141 @@ var W = /* @__PURE__ */ v({
|
|
|
936
937
|
3,
|
|
937
938
|
4
|
|
938
939
|
];
|
|
939
|
-
function
|
|
940
|
-
let t =
|
|
941
|
-
|
|
940
|
+
function ht(e) {
|
|
941
|
+
let t = G.value / U;
|
|
942
|
+
X(e > 0 ? mt.find((e) => e > t + .01) ?? x.maxZoom : [...mt].reverse().find((e) => e < t - .01) ?? x.minZoom);
|
|
942
943
|
}
|
|
943
|
-
function
|
|
944
|
-
(e.ctrlKey || e.metaKey) && (e.preventDefault(),
|
|
944
|
+
function gt(e) {
|
|
945
|
+
(e.ctrlKey || e.metaKey) && (e.preventDefault(), pt(Math.exp(-e.deltaY * (e.deltaMode === 1 ? .05 : .0025)), {
|
|
945
946
|
x: e.clientX,
|
|
946
947
|
y: e.clientY
|
|
947
948
|
}));
|
|
948
949
|
}
|
|
949
|
-
function
|
|
950
|
-
if (
|
|
951
|
-
let t =
|
|
952
|
-
|
|
950
|
+
function _t(e) {
|
|
951
|
+
if (x.tool !== "select" || e.target.closest("button, a, input, textarea")) return;
|
|
952
|
+
let t = pe("fit-width");
|
|
953
|
+
G.value > t * 1.05 ? X("fit-width", {
|
|
953
954
|
x: e.clientX,
|
|
954
955
|
y: e.clientY
|
|
955
|
-
}) :
|
|
956
|
+
}) : X(Math.min(x.maxZoom, t * 2 / U), {
|
|
956
957
|
x: e.clientX,
|
|
957
958
|
y: e.clientY
|
|
958
959
|
});
|
|
959
960
|
}
|
|
960
|
-
let
|
|
961
|
+
let vt = null, yt = 0, bt = 1, xt = {
|
|
961
962
|
x: 0,
|
|
962
963
|
y: 0
|
|
963
964
|
};
|
|
964
|
-
function
|
|
965
|
-
let e =
|
|
966
|
-
e && t && !
|
|
965
|
+
function St() {
|
|
966
|
+
let e = M.pdfjs.value, t = R.value;
|
|
967
|
+
e && t && !vt && (vt = new AbortController(), new e.TouchManager({
|
|
967
968
|
container: t,
|
|
968
|
-
isPinchingDisabled: () =>
|
|
969
|
+
isPinchingDisabled: () => x.tool === "ink",
|
|
969
970
|
onPinching: (e, t, n) => {
|
|
970
|
-
|
|
971
|
+
bt *= n / (t || n), xt = {
|
|
971
972
|
x: e[0],
|
|
972
973
|
y: e[1]
|
|
973
|
-
},
|
|
974
|
-
|
|
975
|
-
let e =
|
|
976
|
-
|
|
974
|
+
}, yt ||= requestAnimationFrame(() => {
|
|
975
|
+
yt = 0;
|
|
976
|
+
let e = bt;
|
|
977
|
+
bt = 1, pt(e, xt);
|
|
977
978
|
});
|
|
978
979
|
},
|
|
979
|
-
signal:
|
|
980
|
+
signal: vt.signal
|
|
980
981
|
}));
|
|
981
982
|
}
|
|
982
|
-
|
|
983
|
-
let
|
|
984
|
-
|
|
983
|
+
F(() => M.pdfjs.value, St);
|
|
984
|
+
let Ct;
|
|
985
|
+
F(M.doc, async (e) => {
|
|
985
986
|
if (!e) return;
|
|
986
|
-
await
|
|
987
|
-
let t =
|
|
988
|
-
|
|
987
|
+
await te();
|
|
988
|
+
let t = x.page && x.page <= e.numPages ? x.page : 1;
|
|
989
|
+
J.value = t, t > 1 ? ft(t) : R.value && (R.value.scrollTop = 0), St();
|
|
989
990
|
});
|
|
990
|
-
function
|
|
991
|
-
let e =
|
|
992
|
-
|
|
991
|
+
function wt() {
|
|
992
|
+
let e = J.value;
|
|
993
|
+
W.value = (W.value + 90) % 360, S("update:rotation", W.value), te(() => ft(e));
|
|
993
994
|
}
|
|
994
|
-
let
|
|
995
|
-
|
|
996
|
-
clearTimeout(
|
|
995
|
+
let Tt = O(!1), Et = O(""), Dt = A([]), Ot = O(-1), kt = O(!1), At = null, jt;
|
|
996
|
+
F(Et, (e) => {
|
|
997
|
+
clearTimeout(jt), jt = setTimeout(() => Mt(e), 250);
|
|
997
998
|
});
|
|
998
|
-
async function
|
|
999
|
-
if (
|
|
1000
|
-
let t =
|
|
1001
|
-
|
|
1002
|
-
let n = await
|
|
999
|
+
async function Mt(e) {
|
|
1000
|
+
if (At?.abort(), Dt.value = [], Ot.value = -1, !e.trim() || !M.doc.value) return;
|
|
1001
|
+
let t = At = new AbortController();
|
|
1002
|
+
kt.value = !0;
|
|
1003
|
+
let n = await M.search(e, { signal: t.signal });
|
|
1003
1004
|
if (t.signal.aborted) return;
|
|
1004
|
-
|
|
1005
|
-
let r = n.findIndex((e) => e.page >=
|
|
1006
|
-
n.length &&
|
|
1005
|
+
kt.value = !1, Dt.value = n;
|
|
1006
|
+
let r = n.findIndex((e) => e.page >= J.value);
|
|
1007
|
+
n.length && Nt(r < 0 ? 0 : r);
|
|
1007
1008
|
}
|
|
1008
|
-
function
|
|
1009
|
-
let t =
|
|
1009
|
+
function Nt(e) {
|
|
1010
|
+
let t = Dt.value.length;
|
|
1010
1011
|
if (!t) return;
|
|
1011
|
-
|
|
1012
|
-
let n =
|
|
1013
|
-
(!
|
|
1012
|
+
Ot.value = (e % t + t) % t;
|
|
1013
|
+
let n = Dt.value[Ot.value];
|
|
1014
|
+
(!st.value.has(n.page) || Math.abs(n.page - J.value) > 0) && ft(n.page), Pt = !0;
|
|
1014
1015
|
}
|
|
1015
|
-
let
|
|
1016
|
+
let Pt = !1, Ft = m(() => {
|
|
1016
1017
|
let e = /* @__PURE__ */ new Map();
|
|
1017
|
-
return
|
|
1018
|
+
return Dt.value.forEach((t, n) => {
|
|
1018
1019
|
let r = e.get(t.page) ?? [];
|
|
1019
1020
|
r.push({
|
|
1020
1021
|
start: t.start,
|
|
1021
1022
|
end: t.end,
|
|
1022
|
-
current: n ===
|
|
1023
|
+
current: n === Ot.value
|
|
1023
1024
|
}), e.set(t.page, r);
|
|
1024
1025
|
}), e;
|
|
1025
|
-
}),
|
|
1026
|
-
function
|
|
1027
|
-
t ?
|
|
1026
|
+
}), It = [], Lt = D(/* @__PURE__ */ new Map());
|
|
1027
|
+
function Rt(e, t) {
|
|
1028
|
+
t ? Lt.set(e, t) : Lt.delete(e);
|
|
1028
1029
|
}
|
|
1029
|
-
|
|
1030
|
-
let e =
|
|
1031
|
-
return e ?
|
|
1030
|
+
F(() => {
|
|
1031
|
+
let e = Dt.value[Ot.value];
|
|
1032
|
+
return e ? Lt.get(e.page)?.currentHit : null;
|
|
1032
1033
|
}, (e) => {
|
|
1033
|
-
if (!e || !
|
|
1034
|
-
|
|
1035
|
-
let t = e.getBoundingClientRect(), n =
|
|
1036
|
-
|
|
1034
|
+
if (!e || !Pt || !R.value) return;
|
|
1035
|
+
Pt = !1;
|
|
1036
|
+
let t = e.getBoundingClientRect(), n = R.value.getBoundingClientRect();
|
|
1037
|
+
R.value.scrollBy({
|
|
1037
1038
|
top: t.top - n.top - n.height / 2,
|
|
1038
1039
|
left: t.left < n.left || t.right > n.right ? t.left - n.left - n.width / 2 : 0
|
|
1039
1040
|
});
|
|
1040
1041
|
});
|
|
1041
|
-
function
|
|
1042
|
-
|
|
1042
|
+
function zt() {
|
|
1043
|
+
Tt.value = !0, te(() => P.value?.querySelector(".m3-pdf-search input")?.focus());
|
|
1043
1044
|
}
|
|
1044
|
-
function
|
|
1045
|
-
|
|
1045
|
+
function Bt() {
|
|
1046
|
+
Tt.value = !1, Et.value = "", At?.abort(), Dt.value = [], Ot.value = -1;
|
|
1046
1047
|
}
|
|
1047
|
-
let
|
|
1048
|
-
|
|
1049
|
-
|
|
1048
|
+
let Vt = m(() => Et.value.trim() ? kt.value ? "…" : Dt.value.length ? T.pdfMatchCount.replace("{current}", String(Ot.value + 1)).replace("{total}", String(Dt.value.length)) : T.pdfNoMatches : ""), Ht = O(x.sidebar);
|
|
1049
|
+
F(() => x.sidebar, (e) => {
|
|
1050
|
+
Ht.value = e;
|
|
1050
1051
|
});
|
|
1051
1052
|
function Ut(e) {
|
|
1052
|
-
|
|
1053
|
+
Ht.value = e, S("update:sidebar", e);
|
|
1053
1054
|
}
|
|
1054
|
-
let Wt =
|
|
1055
|
+
let Wt = D(/* @__PURE__ */ new Map()), Gt = O(), Kt = null;
|
|
1055
1056
|
function qt(e, t) {
|
|
1056
1057
|
e instanceof HTMLElement && (e.dataset.page = String(t), Kt?.observe(e));
|
|
1057
1058
|
}
|
|
1058
|
-
|
|
1059
|
-
Kt?.disconnect(), Wt.clear(), e === "thumbnails" && t && typeof IntersectionObserver < "u" && (await
|
|
1059
|
+
F([Ht, M.doc], async ([e, t]) => {
|
|
1060
|
+
Kt?.disconnect(), Wt.clear(), e === "thumbnails" && t && typeof IntersectionObserver < "u" && (await te(), Kt = new IntersectionObserver((e) => {
|
|
1060
1061
|
for (let t of e) {
|
|
1061
1062
|
if (!t.isIntersecting) continue;
|
|
1062
1063
|
let e = Number(t.target.dataset.page);
|
|
1063
|
-
Wt.has(e) || (Wt.set(e, ""),
|
|
1064
|
+
Wt.has(e) || (Wt.set(e, ""), M.thumbnail(e, 120).then((t) => Wt.set(e, t), () => {}));
|
|
1064
1065
|
}
|
|
1065
1066
|
}, {
|
|
1066
1067
|
root: Gt.value,
|
|
1067
1068
|
rootMargin: "200px"
|
|
1068
|
-
}), Gt.value?.querySelectorAll("[data-page]").forEach((e) => Kt.observe(e)), Gt.value?.querySelector(`[data-page="${
|
|
1069
|
+
}), Gt.value?.querySelectorAll("[data-page]").forEach((e) => Kt.observe(e)), Gt.value?.querySelector(`[data-page="${J.value}"]`)?.scrollIntoView({ block: "center" }));
|
|
1069
1070
|
});
|
|
1070
1071
|
function Jt(e, t) {
|
|
1071
|
-
|
|
1072
|
+
ft(e, t), H.value && Ut(null);
|
|
1072
1073
|
}
|
|
1073
|
-
let Yt =
|
|
1074
|
+
let Yt = D(/* @__PURE__ */ new Set()), Xt = m(() => {
|
|
1074
1075
|
let e = [], t = (n, r, i) => {
|
|
1075
1076
|
n.forEach((n, a) => {
|
|
1076
1077
|
let o = `${i}${a}`;
|
|
@@ -1085,28 +1086,28 @@ var W = /* @__PURE__ */ v({
|
|
|
1085
1086
|
}), n.children.length && Yt.has(o) && t(n.children, r + 1, `${o}.`);
|
|
1086
1087
|
});
|
|
1087
1088
|
};
|
|
1088
|
-
return t(
|
|
1089
|
+
return t(M.outline.value, 0, ""), e;
|
|
1089
1090
|
});
|
|
1090
1091
|
function Zt(e) {
|
|
1091
1092
|
Yt.has(e) ? Yt.delete(e) : Yt.add(e);
|
|
1092
1093
|
}
|
|
1093
1094
|
async function Qt(e) {
|
|
1094
1095
|
if (e.url) {
|
|
1095
|
-
|
|
1096
|
+
S("link", { url: e.url });
|
|
1096
1097
|
return;
|
|
1097
1098
|
}
|
|
1098
|
-
let t = await
|
|
1099
|
-
t && (
|
|
1099
|
+
let t = await M.resolveDest(e.dest);
|
|
1100
|
+
t && (ft(t.page, t.top), S("link", { page: t.page }));
|
|
1100
1101
|
}
|
|
1101
|
-
let $t =
|
|
1102
|
-
|
|
1102
|
+
let $t = O(x.tool);
|
|
1103
|
+
F(() => x.tool, (e) => {
|
|
1103
1104
|
$t.value = e;
|
|
1104
1105
|
});
|
|
1105
1106
|
function en(e) {
|
|
1106
|
-
$t.value = e,
|
|
1107
|
+
$t.value = e, S("update:tool", e), $.value = null, Z.value = null;
|
|
1107
1108
|
}
|
|
1108
|
-
let tn =
|
|
1109
|
-
|
|
1109
|
+
let tn = O(x.colors[0]), nn = O(x.inkWidths[1] ?? x.inkWidths[0] ?? 2), rn = O(!1);
|
|
1110
|
+
F(() => x.annotate, (e) => {
|
|
1110
1111
|
e || on();
|
|
1111
1112
|
});
|
|
1112
1113
|
function an() {
|
|
@@ -1115,48 +1116,48 @@ var W = /* @__PURE__ */ v({
|
|
|
1115
1116
|
function on() {
|
|
1116
1117
|
rn.value = !1, en("select");
|
|
1117
1118
|
}
|
|
1118
|
-
let sn =
|
|
1119
|
+
let sn = m(() => {
|
|
1119
1120
|
let e = /* @__PURE__ */ new Map();
|
|
1120
|
-
for (let t of
|
|
1121
|
+
for (let t of x.annotations) {
|
|
1121
1122
|
let n = e.get(t.page) ?? [];
|
|
1122
1123
|
n.push(t), e.set(t.page, n);
|
|
1123
1124
|
}
|
|
1124
1125
|
return e;
|
|
1125
1126
|
}), cn = [], ln = [];
|
|
1126
1127
|
function un(e) {
|
|
1127
|
-
ln.push(
|
|
1128
|
+
ln.push(x.annotations), ln.length > 50 && ln.shift(), dn.value = !0, S("update:annotations", e);
|
|
1128
1129
|
}
|
|
1129
|
-
let dn =
|
|
1130
|
+
let dn = O(!1);
|
|
1130
1131
|
function fn() {
|
|
1131
1132
|
let e = ln.pop();
|
|
1132
|
-
dn.value = ln.length > 0, e &&
|
|
1133
|
+
dn.value = ln.length > 0, e && S("update:annotations", e), Z.value = null;
|
|
1133
1134
|
}
|
|
1134
1135
|
function pn(e) {
|
|
1135
|
-
|
|
1136
|
+
x.author && (e.author = x.author), un([...x.annotations, e]), e.type === "note" && te(() => bn(e.id));
|
|
1136
1137
|
}
|
|
1137
1138
|
function mn(e) {
|
|
1138
|
-
un(
|
|
1139
|
+
un(x.annotations.filter((t) => t.id !== e)), Z.value?.id === e && (Z.value = null);
|
|
1139
1140
|
}
|
|
1140
1141
|
function hn() {
|
|
1141
|
-
ln.push(
|
|
1142
|
+
ln.push(x.annotations), ln.length > 50 && ln.shift(), dn.value = !0;
|
|
1142
1143
|
}
|
|
1143
1144
|
function gn(e, t) {
|
|
1144
1145
|
let n = !1, r = [];
|
|
1145
|
-
for (let i of
|
|
1146
|
-
let a = i.page === e ?
|
|
1146
|
+
for (let i of x.annotations) {
|
|
1147
|
+
let a = i.page === e ? at(i, t) : i;
|
|
1147
1148
|
a !== i && (n = !0), a && r.push(a);
|
|
1148
1149
|
}
|
|
1149
|
-
n && (Z.value && !r.some((e) => e.id === Z.value.id) && (Z.value = null),
|
|
1150
|
+
n && (Z.value && !r.some((e) => e.id === Z.value.id) && (Z.value = null), S("update:annotations", r));
|
|
1150
1151
|
}
|
|
1151
1152
|
function _n(e, t) {
|
|
1152
|
-
|
|
1153
|
+
S("update:annotations", x.annotations.map((n) => n.id === e ? {
|
|
1153
1154
|
...n,
|
|
1154
1155
|
...t
|
|
1155
1156
|
} : n));
|
|
1156
1157
|
}
|
|
1157
|
-
let Z =
|
|
1158
|
+
let Z = O(null), Q = m(() => x.annotations.find((e) => e.id === Z.value?.id) ?? null);
|
|
1158
1159
|
function vn(e) {
|
|
1159
|
-
let t =
|
|
1160
|
+
let t = P.value.getBoundingClientRect();
|
|
1160
1161
|
return {
|
|
1161
1162
|
x: Math.min(Math.max(8, e.left - t.left + e.width / 2), t.width - 8),
|
|
1162
1163
|
y: e.bottom - t.top + 8
|
|
@@ -1171,30 +1172,30 @@ var W = /* @__PURE__ */ v({
|
|
|
1171
1172
|
id: e.id,
|
|
1172
1173
|
...vn(e.anchor)
|
|
1173
1174
|
};
|
|
1174
|
-
let t =
|
|
1175
|
-
t &&
|
|
1175
|
+
let t = x.annotations.find((t) => t.id === e.id);
|
|
1176
|
+
t && S("annotation-click", t);
|
|
1176
1177
|
}
|
|
1177
1178
|
function bn(e) {
|
|
1178
|
-
let t =
|
|
1179
|
+
let t = P.value?.querySelector(".m3-pdf-note[aria-label]"), n = x.annotations.find((t) => t.id === e);
|
|
1179
1180
|
if (!n) return;
|
|
1180
|
-
let r = [...(
|
|
1181
|
+
let r = [...(Lt.get(n.page)?.root)?.querySelectorAll(".m3-pdf-note") ?? []].pop() ?? t;
|
|
1181
1182
|
r && (Z.value = {
|
|
1182
1183
|
id: e,
|
|
1183
1184
|
...vn(r.getBoundingClientRect())
|
|
1184
1185
|
});
|
|
1185
1186
|
}
|
|
1186
|
-
let xn =
|
|
1187
|
+
let xn = m(() => {
|
|
1187
1188
|
let e = Z.value ?? $.value;
|
|
1188
1189
|
if (!e) return {};
|
|
1189
|
-
let t = Math.min(300,
|
|
1190
|
+
let t = Math.min(300, V.value - 16);
|
|
1190
1191
|
return {
|
|
1191
|
-
left: `${Math.min(Math.max(8, e.x - t / 2),
|
|
1192
|
+
left: `${Math.min(Math.max(8, e.x - t / 2), V.value - t - 8)}px`,
|
|
1192
1193
|
top: `${e.y}px`,
|
|
1193
1194
|
width: `${t}px`
|
|
1194
1195
|
};
|
|
1195
|
-
}), $ =
|
|
1196
|
+
}), $ = O(null);
|
|
1196
1197
|
function Sn(e) {
|
|
1197
|
-
!e || !
|
|
1198
|
+
!e || !x.annotate ? $.value = null : (Z.value = null, $.value = {
|
|
1198
1199
|
page: e.page,
|
|
1199
1200
|
rects: e.rects,
|
|
1200
1201
|
quote: e.quote,
|
|
@@ -1218,415 +1219,415 @@ var W = /* @__PURE__ */ v({
|
|
|
1218
1219
|
let e = $.value;
|
|
1219
1220
|
e && await navigator.clipboard?.writeText(e.quote).catch(() => {}), window.getSelection()?.removeAllRanges(), $.value = null;
|
|
1220
1221
|
}
|
|
1221
|
-
|
|
1222
|
+
F(he, () => {
|
|
1222
1223
|
$.value = null, Q.value?.type !== "note" && (Z.value = null);
|
|
1223
1224
|
});
|
|
1224
|
-
let Tn = typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches, En =
|
|
1225
|
-
let e =
|
|
1226
|
-
return
|
|
1227
|
-
}), Dn =
|
|
1225
|
+
let Tn = typeof window < "u" && !!window.matchMedia?.("(pointer: coarse)").matches, En = m(() => {
|
|
1226
|
+
let e = R.value, t = K.value.height - B.value;
|
|
1227
|
+
return he.value, e && t > 0 ? he.value / t * (B.value - 48) : 0;
|
|
1228
|
+
}), Dn = O(!1);
|
|
1228
1229
|
function On(e) {
|
|
1229
1230
|
e.preventDefault(), Dn.value = !0, e.currentTarget.setPointerCapture(e.pointerId);
|
|
1230
|
-
let t = e.clientY, n =
|
|
1231
|
-
|
|
1231
|
+
let t = e.clientY, n = R.value.scrollTop, r = K.value.height - B.value, i = (e) => {
|
|
1232
|
+
R.value.scrollTop = n + (e.clientY - t) / Math.max(1, B.value - 48) * r;
|
|
1232
1233
|
}, a = () => {
|
|
1233
1234
|
Dn.value = !1, window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a);
|
|
1234
1235
|
};
|
|
1235
1236
|
window.addEventListener("pointermove", i), window.addEventListener("pointerup", a);
|
|
1236
1237
|
}
|
|
1237
|
-
let kn =
|
|
1238
|
+
let kn = O(!1);
|
|
1238
1239
|
async function An() {
|
|
1239
|
-
document.fullscreenElement ? await document.exitFullscreen().catch(() => {}) : await
|
|
1240
|
+
document.fullscreenElement ? await document.exitFullscreen().catch(() => {}) : await P.value?.requestFullscreen?.().catch(() => {});
|
|
1240
1241
|
}
|
|
1241
1242
|
let jn = () => {
|
|
1242
|
-
kn.value = document.fullscreenElement ===
|
|
1243
|
+
kn.value = document.fullscreenElement === P.value;
|
|
1243
1244
|
};
|
|
1244
1245
|
function Mn(e) {
|
|
1245
1246
|
let t = !!e.target.closest("input, textarea, [contenteditable]"), n = e.ctrlKey || e.metaKey;
|
|
1246
|
-
if (n && e.key.toLowerCase() === "f") e.preventDefault(),
|
|
1247
|
-
else if (n && (e.key === "=" || e.key === "+")) e.preventDefault(),
|
|
1248
|
-
else if (n && e.key === "-") e.preventDefault(),
|
|
1249
|
-
else if (n && e.key === "0") e.preventDefault(),
|
|
1250
|
-
else if (n && e.key.toLowerCase() === "z" && !t &&
|
|
1247
|
+
if (n && e.key.toLowerCase() === "f") e.preventDefault(), zt();
|
|
1248
|
+
else if (n && (e.key === "=" || e.key === "+")) e.preventDefault(), ht(1);
|
|
1249
|
+
else if (n && e.key === "-") e.preventDefault(), ht(-1);
|
|
1250
|
+
else if (n && e.key === "0") e.preventDefault(), X("fit-width");
|
|
1251
|
+
else if (n && e.key.toLowerCase() === "z" && !t && x.annotate) e.preventDefault(), fn();
|
|
1251
1252
|
else if (e.key === "Escape") {
|
|
1252
1253
|
if (Z.value || $.value) Z.value = null, $.value = null;
|
|
1253
|
-
else if (
|
|
1254
|
+
else if (Tt.value) Bt();
|
|
1254
1255
|
else if (rn.value) on();
|
|
1255
1256
|
else return;
|
|
1256
1257
|
e.stopPropagation();
|
|
1257
|
-
} else !t && (e.key === "Delete" || e.key === "Backspace") && Z.value ? mn(Z.value.id) : t || n || e.key !== "PageDown" && e.key !== "PageUp" || (e.preventDefault(),
|
|
1258
|
+
} else !t && (e.key === "Delete" || e.key === "Backspace") && Z.value ? mn(Z.value.id) : t || n || e.key !== "PageDown" && e.key !== "PageUp" || (e.preventDefault(), ft(Math.max(1, Math.min(M.numPages.value, J.value + (e.key === "PageDown" ? 1 : -1)))));
|
|
1258
1259
|
}
|
|
1259
|
-
let Nn =
|
|
1260
|
-
|
|
1260
|
+
let Nn = O("");
|
|
1261
|
+
F(J, (e) => {
|
|
1261
1262
|
Nn.value = String(e);
|
|
1262
1263
|
}, { immediate: !0 });
|
|
1263
1264
|
function Pn() {
|
|
1264
1265
|
let e = Math.round(Number(Nn.value));
|
|
1265
|
-
e >= 1 && e <=
|
|
1266
|
+
e >= 1 && e <= M.numPages.value ? ft(e) : Nn.value = String(J.value);
|
|
1266
1267
|
}
|
|
1267
|
-
let Fn =
|
|
1268
|
+
let Fn = O("");
|
|
1268
1269
|
function In() {
|
|
1269
|
-
|
|
1270
|
+
M.submitPassword(Fn.value), Fn.value = "";
|
|
1270
1271
|
}
|
|
1271
|
-
let Ln =
|
|
1272
|
+
let Ln = m(() => x.title ?? M.metadata.value.title ?? "");
|
|
1272
1273
|
re(() => {
|
|
1273
|
-
let e =
|
|
1274
|
-
e.addEventListener("wheel",
|
|
1275
|
-
let t =
|
|
1276
|
-
|
|
1277
|
-
let t =
|
|
1274
|
+
let e = R.value;
|
|
1275
|
+
e.addEventListener("wheel", gt, { passive: !1 }), Ct = new ResizeObserver(() => {
|
|
1276
|
+
let t = K.value.boxes, n = B.value / 3, r = t.length ? q(e.scrollTop + n) : -1, i = r >= 0 ? (e.scrollTop + n - t[r].top) / t[r].height : 0;
|
|
1277
|
+
z.value = e.clientWidth, B.value = e.clientHeight, V.value = P.value?.clientWidth ?? V.value, r < 0 || te(() => {
|
|
1278
|
+
let t = K.value.boxes[r];
|
|
1278
1279
|
if (!t) return;
|
|
1279
1280
|
let a = Math.round(t.top + i * t.height - n);
|
|
1280
|
-
Math.abs(a - e.scrollTop) < 1 || (e.scrollTop = a,
|
|
1281
|
+
Math.abs(a - e.scrollTop) < 1 || (e.scrollTop = a, he.value = e.scrollTop, ot(), ut = e.scrollTop);
|
|
1281
1282
|
});
|
|
1282
|
-
}),
|
|
1283
|
+
}), Ct.observe(e), Ct.observe(P.value), z.value = e.clientWidth || z.value, B.value = e.clientHeight || B.value, V.value = P.value.clientWidth || V.value, document.addEventListener("fullscreenchange", jn);
|
|
1283
1284
|
}), ne(() => {
|
|
1284
|
-
|
|
1285
|
-
}),
|
|
1286
|
-
pdf:
|
|
1287
|
-
goToPage: (e) =>
|
|
1288
|
-
setZoom: (e) =>
|
|
1285
|
+
Ct?.disconnect(), vt?.abort(), Kt?.disconnect(), At?.abort(), cancelAnimationFrame(yt), clearTimeout(ct), clearTimeout(jt), document.removeEventListener("fullscreenchange", jn);
|
|
1286
|
+
}), l({
|
|
1287
|
+
pdf: M,
|
|
1288
|
+
goToPage: (e) => ft(e),
|
|
1289
|
+
setZoom: (e) => X(e),
|
|
1289
1290
|
search: (e) => {
|
|
1290
|
-
|
|
1291
|
+
zt(), Et.value = e;
|
|
1291
1292
|
},
|
|
1292
1293
|
undo: fn
|
|
1293
1294
|
});
|
|
1294
|
-
let Rn =
|
|
1295
|
+
let Rn = m(() => [
|
|
1295
1296
|
{
|
|
1296
1297
|
id: "select",
|
|
1297
1298
|
icon: "arrow_selector_tool",
|
|
1298
|
-
label:
|
|
1299
|
+
label: T.pdfSelect
|
|
1299
1300
|
},
|
|
1300
1301
|
{
|
|
1301
1302
|
id: "highlight",
|
|
1302
1303
|
icon: "ink_highlighter",
|
|
1303
|
-
label:
|
|
1304
|
+
label: T.pdfHighlight
|
|
1304
1305
|
},
|
|
1305
1306
|
{
|
|
1306
1307
|
id: "note",
|
|
1307
1308
|
icon: "sticky_note_2",
|
|
1308
|
-
label:
|
|
1309
|
+
label: T.pdfNote
|
|
1309
1310
|
},
|
|
1310
1311
|
{
|
|
1311
1312
|
id: "ink",
|
|
1312
1313
|
icon: "draw",
|
|
1313
|
-
label:
|
|
1314
|
+
label: T.pdfDraw
|
|
1314
1315
|
},
|
|
1315
1316
|
{
|
|
1316
1317
|
id: "eraser",
|
|
1317
1318
|
icon: "ink_eraser",
|
|
1318
|
-
label:
|
|
1319
|
+
label: T.pdfEraser
|
|
1319
1320
|
}
|
|
1320
1321
|
]);
|
|
1321
|
-
return (e,
|
|
1322
|
+
return (e, l) => (E(), _("div", ee({
|
|
1322
1323
|
ref_key: "root",
|
|
1323
|
-
ref:
|
|
1324
|
+
ref: P
|
|
1324
1325
|
}, e.$attrs, {
|
|
1325
1326
|
role: "region",
|
|
1326
|
-
"aria-label": Ln.value ||
|
|
1327
|
+
"aria-label": Ln.value || N(T).pdfViewer,
|
|
1327
1328
|
class: "m3-pdf bg-surface-container text-on-surface",
|
|
1328
1329
|
onKeydown: Mn
|
|
1329
1330
|
}), [
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
icon:
|
|
1333
|
-
label:
|
|
1334
|
-
disabled: !
|
|
1335
|
-
onClick:
|
|
1331
|
+
o.toolbar ? (E(), _("div", Y, [
|
|
1332
|
+
b(n, {
|
|
1333
|
+
icon: Ht.value ? "left_panel_close" : "left_panel_open",
|
|
1334
|
+
label: N(T).pdfThumbnails,
|
|
1335
|
+
disabled: !N(M).doc.value,
|
|
1336
|
+
onClick: l[0] ||= (e) => Ut(Ht.value ? null : "thumbnails")
|
|
1336
1337
|
}, null, 8, [
|
|
1337
1338
|
"icon",
|
|
1338
1339
|
"label",
|
|
1339
1340
|
"disabled"
|
|
1340
1341
|
]),
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
"onUpdate:modelValue":
|
|
1342
|
+
v("p", ve, j(Ln.value), 1),
|
|
1343
|
+
N(M).doc.value ? (E(), _(f, { key: 0 }, [
|
|
1344
|
+
H.value ? g("", !0) : (E(), _("div", ye, [L(v("input", {
|
|
1345
|
+
"onUpdate:modelValue": l[1] ||= (e) => Nn.value = e,
|
|
1345
1346
|
inputmode: "numeric",
|
|
1346
1347
|
class: "h-8 w-11 rounded-sm bg-surface-container-highest text-center text-body-medium text-on-surface tabular-nums outline-none focus:ring-2 focus:ring-primary",
|
|
1347
|
-
"aria-label":
|
|
1348
|
-
onKeydown:
|
|
1348
|
+
"aria-label": N(T).pdfPage,
|
|
1349
|
+
onKeydown: se(Pn, ["enter"]),
|
|
1349
1350
|
onBlur: Pn
|
|
1350
|
-
}, null, 40,
|
|
1351
|
-
|
|
1352
|
-
|
|
1351
|
+
}, null, 40, be), [[oe, Nn.value]]), v("span", xe, "/ " + j(N(M).numPages.value), 1)])),
|
|
1352
|
+
H.value ? g("", !0) : (E(), _("div", Se, [
|
|
1353
|
+
b(n, {
|
|
1353
1354
|
icon: "remove",
|
|
1354
|
-
label:
|
|
1355
|
+
label: N(T).pdfZoomOut,
|
|
1355
1356
|
size: "xs",
|
|
1356
|
-
onClick:
|
|
1357
|
+
onClick: l[2] ||= (e) => ht(-1)
|
|
1357
1358
|
}, null, 8, ["label"]),
|
|
1358
|
-
|
|
1359
|
-
trigger:
|
|
1359
|
+
b(r, { align: "right" }, {
|
|
1360
|
+
trigger: I(() => [v("button", {
|
|
1360
1361
|
type: "button",
|
|
1361
1362
|
class: "h-8 min-w-14 cursor-pointer rounded-full px-2 text-label-large tabular-nums hover:bg-on-surface/8",
|
|
1362
|
-
"aria-label":
|
|
1363
|
-
},
|
|
1364
|
-
default:
|
|
1365
|
-
|
|
1363
|
+
"aria-label": N(T).pdfZoom
|
|
1364
|
+
}, j(me.value) + "%", 9, Ce)]),
|
|
1365
|
+
default: I(() => [
|
|
1366
|
+
b(i, {
|
|
1366
1367
|
icon: "fit_width",
|
|
1367
|
-
selected:
|
|
1368
|
-
onClick:
|
|
1368
|
+
selected: de.value === "fit-width",
|
|
1369
|
+
onClick: l[3] ||= (e) => X("fit-width")
|
|
1369
1370
|
}, {
|
|
1370
|
-
default:
|
|
1371
|
+
default: I(() => [y(j(N(T).pdfFitWidth), 1)]),
|
|
1371
1372
|
_: 1
|
|
1372
1373
|
}, 8, ["selected"]),
|
|
1373
|
-
|
|
1374
|
+
b(i, {
|
|
1374
1375
|
icon: "fit_page",
|
|
1375
|
-
selected:
|
|
1376
|
-
onClick:
|
|
1376
|
+
selected: de.value === "fit-page",
|
|
1377
|
+
onClick: l[4] ||= (e) => X("fit-page")
|
|
1377
1378
|
}, {
|
|
1378
|
-
default:
|
|
1379
|
+
default: I(() => [y(j(N(T).pdfFitPage), 1)]),
|
|
1379
1380
|
_: 1
|
|
1380
1381
|
}, 8, ["selected"]),
|
|
1381
|
-
(
|
|
1382
|
+
(E(), _(f, null, k(mt, (e) => b(i, {
|
|
1382
1383
|
key: e,
|
|
1383
|
-
selected:
|
|
1384
|
-
onClick: (t) =>
|
|
1384
|
+
selected: de.value === e,
|
|
1385
|
+
onClick: (t) => X(e)
|
|
1385
1386
|
}, {
|
|
1386
|
-
default:
|
|
1387
|
+
default: I(() => [y(j(e * 100) + "%", 1)]),
|
|
1387
1388
|
_: 2
|
|
1388
1389
|
}, 1032, ["selected", "onClick"])), 64))
|
|
1389
1390
|
]),
|
|
1390
1391
|
_: 1
|
|
1391
1392
|
}),
|
|
1392
|
-
|
|
1393
|
+
b(n, {
|
|
1393
1394
|
icon: "add",
|
|
1394
|
-
label:
|
|
1395
|
+
label: N(T).pdfZoomIn,
|
|
1395
1396
|
size: "xs",
|
|
1396
|
-
onClick:
|
|
1397
|
+
onClick: l[5] ||= (e) => ht(1)
|
|
1397
1398
|
}, null, 8, ["label"])
|
|
1398
1399
|
])),
|
|
1399
|
-
|
|
1400
|
+
b(n, {
|
|
1400
1401
|
icon: "search",
|
|
1401
|
-
label:
|
|
1402
|
-
checked:
|
|
1403
|
-
"onUpdate:checked":
|
|
1402
|
+
label: N(T).pdfSearch,
|
|
1403
|
+
checked: Tt.value,
|
|
1404
|
+
"onUpdate:checked": l[6] ||= (e) => e ? zt() : Bt()
|
|
1404
1405
|
}, null, 8, ["label", "checked"]),
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
trigger:
|
|
1406
|
+
ie(e.$slots, "actions", { pdf: N(M) }),
|
|
1407
|
+
b(r, { align: "right" }, {
|
|
1408
|
+
trigger: I(() => [b(n, {
|
|
1408
1409
|
icon: "more_vert",
|
|
1409
|
-
label:
|
|
1410
|
+
label: N(T).pdfMore
|
|
1410
1411
|
}, null, 8, ["label"])]),
|
|
1411
|
-
default:
|
|
1412
|
-
|
|
1413
|
-
|
|
1412
|
+
default: I(() => [
|
|
1413
|
+
H.value ? (E(), _(f, { key: 0 }, [
|
|
1414
|
+
b(i, {
|
|
1414
1415
|
icon: "zoom_in",
|
|
1415
|
-
onClick:
|
|
1416
|
+
onClick: l[7] ||= (e) => ht(1)
|
|
1416
1417
|
}, {
|
|
1417
|
-
default:
|
|
1418
|
+
default: I(() => [y(j(N(T).pdfZoomIn), 1)]),
|
|
1418
1419
|
_: 1
|
|
1419
1420
|
}),
|
|
1420
|
-
|
|
1421
|
+
b(i, {
|
|
1421
1422
|
icon: "zoom_out",
|
|
1422
|
-
onClick:
|
|
1423
|
+
onClick: l[8] ||= (e) => ht(-1)
|
|
1423
1424
|
}, {
|
|
1424
|
-
default:
|
|
1425
|
+
default: I(() => [y(j(N(T).pdfZoomOut), 1)]),
|
|
1425
1426
|
_: 1
|
|
1426
1427
|
}),
|
|
1427
|
-
|
|
1428
|
+
b(i, {
|
|
1428
1429
|
icon: "fit_width",
|
|
1429
|
-
onClick:
|
|
1430
|
+
onClick: l[9] ||= (e) => X("fit-width")
|
|
1430
1431
|
}, {
|
|
1431
|
-
default:
|
|
1432
|
+
default: I(() => [y(j(N(T).pdfFitWidth), 1)]),
|
|
1432
1433
|
_: 1
|
|
1433
1434
|
})
|
|
1434
|
-
], 64)) :
|
|
1435
|
-
|
|
1435
|
+
], 64)) : g("", !0),
|
|
1436
|
+
b(i, {
|
|
1436
1437
|
icon: "list",
|
|
1437
|
-
disabled: !
|
|
1438
|
-
onClick:
|
|
1438
|
+
disabled: !N(M).outline.value.length,
|
|
1439
|
+
onClick: l[10] ||= (e) => Ut("outline")
|
|
1439
1440
|
}, {
|
|
1440
|
-
default:
|
|
1441
|
+
default: I(() => [y(j(N(T).pdfOutline), 1)]),
|
|
1441
1442
|
_: 1
|
|
1442
1443
|
}, 8, ["disabled"]),
|
|
1443
|
-
|
|
1444
|
+
b(i, {
|
|
1444
1445
|
icon: "rotate_right",
|
|
1445
|
-
onClick:
|
|
1446
|
+
onClick: wt
|
|
1446
1447
|
}, {
|
|
1447
|
-
default:
|
|
1448
|
+
default: I(() => [y(j(N(T).pdfRotate), 1)]),
|
|
1448
1449
|
_: 1
|
|
1449
1450
|
}),
|
|
1450
|
-
|
|
1451
|
+
o.downloadable ? (E(), h(i, {
|
|
1451
1452
|
key: 1,
|
|
1452
1453
|
icon: "download",
|
|
1453
|
-
onClick:
|
|
1454
|
+
onClick: l[11] ||= (e) => N(M).download(o.fileName)
|
|
1454
1455
|
}, {
|
|
1455
|
-
default:
|
|
1456
|
+
default: I(() => [y(j(N(T).pdfDownload), 1)]),
|
|
1456
1457
|
_: 1
|
|
1457
|
-
})) :
|
|
1458
|
-
|
|
1458
|
+
})) : g("", !0),
|
|
1459
|
+
o.downloadable ? (E(), h(i, {
|
|
1459
1460
|
key: 2,
|
|
1460
1461
|
icon: "print",
|
|
1461
|
-
onClick:
|
|
1462
|
+
onClick: l[12] ||= (e) => N(M).print()
|
|
1462
1463
|
}, {
|
|
1463
|
-
default:
|
|
1464
|
+
default: I(() => [y(j(N(T).pdfPrint), 1)]),
|
|
1464
1465
|
_: 1
|
|
1465
|
-
})) :
|
|
1466
|
-
|
|
1466
|
+
})) : g("", !0),
|
|
1467
|
+
b(i, {
|
|
1467
1468
|
icon: kn.value ? "fullscreen_exit" : "fullscreen",
|
|
1468
1469
|
onClick: An
|
|
1469
1470
|
}, {
|
|
1470
|
-
default:
|
|
1471
|
+
default: I(() => [y(j(kn.value ? N(T).pdfExitFullscreen : N(T).pdfFullscreen), 1)]),
|
|
1471
1472
|
_: 1
|
|
1472
1473
|
}, 8, ["icon"])
|
|
1473
1474
|
]),
|
|
1474
1475
|
_: 1
|
|
1475
1476
|
})
|
|
1476
|
-
], 64)) :
|
|
1477
|
-
|
|
1477
|
+
], 64)) : g("", !0),
|
|
1478
|
+
N(M).loading.value ? (E(), h(a, {
|
|
1478
1479
|
key: 1,
|
|
1479
|
-
value:
|
|
1480
|
-
indeterminate: !
|
|
1480
|
+
value: N(M).progress.value ? N(M).progress.value * 100 : void 0,
|
|
1481
|
+
indeterminate: !N(M).progress.value,
|
|
1481
1482
|
class: "absolute inset-x-0 bottom-0"
|
|
1482
|
-
}, null, 8, ["value", "indeterminate"])) :
|
|
1483
|
-
])) :
|
|
1484
|
-
|
|
1485
|
-
default:
|
|
1486
|
-
|
|
1483
|
+
}, null, 8, ["value", "indeterminate"])) : g("", !0)
|
|
1484
|
+
])) : g("", !0),
|
|
1485
|
+
b(p, { name: "m3-pdf-drop" }, {
|
|
1486
|
+
default: I(() => [Tt.value ? (E(), _("div", we, [v("div", Te, [
|
|
1487
|
+
b(t, {
|
|
1487
1488
|
name: "search",
|
|
1488
1489
|
size: 20,
|
|
1489
1490
|
class: "text-on-surface-variant"
|
|
1490
1491
|
}),
|
|
1491
|
-
|
|
1492
|
-
"onUpdate:modelValue":
|
|
1492
|
+
L(v("input", {
|
|
1493
|
+
"onUpdate:modelValue": l[13] ||= (e) => Et.value = e,
|
|
1493
1494
|
type: "search",
|
|
1494
1495
|
class: "min-w-0 flex-1 bg-transparent text-body-large outline-none placeholder:text-on-surface-variant",
|
|
1495
|
-
placeholder:
|
|
1496
|
-
"aria-label":
|
|
1497
|
-
onKeydown:
|
|
1498
|
-
}, null, 40,
|
|
1499
|
-
|
|
1500
|
-
|
|
1496
|
+
placeholder: N(T).pdfSearch,
|
|
1497
|
+
"aria-label": N(T).pdfSearch,
|
|
1498
|
+
onKeydown: l[14] ||= se(ce((e) => Nt(Ot.value + (e.shiftKey ? -1 : 1)), ["prevent"]), ["enter"])
|
|
1499
|
+
}, null, 40, Ee), [[oe, Et.value]]),
|
|
1500
|
+
v("span", De, j(Vt.value), 1),
|
|
1501
|
+
b(n, {
|
|
1501
1502
|
icon: "keyboard_arrow_up",
|
|
1502
|
-
label:
|
|
1503
|
+
label: N(T).pdfSearchPrevious,
|
|
1503
1504
|
size: "xs",
|
|
1504
|
-
disabled: !
|
|
1505
|
-
onClick:
|
|
1505
|
+
disabled: !Dt.value.length,
|
|
1506
|
+
onClick: l[15] ||= (e) => Nt(Ot.value - 1)
|
|
1506
1507
|
}, null, 8, ["label", "disabled"]),
|
|
1507
|
-
|
|
1508
|
+
b(n, {
|
|
1508
1509
|
icon: "keyboard_arrow_down",
|
|
1509
|
-
label:
|
|
1510
|
+
label: N(T).pdfSearchNext,
|
|
1510
1511
|
size: "xs",
|
|
1511
|
-
disabled: !
|
|
1512
|
-
onClick:
|
|
1512
|
+
disabled: !Dt.value.length,
|
|
1513
|
+
onClick: l[16] ||= (e) => Nt(Ot.value + 1)
|
|
1513
1514
|
}, null, 8, ["label", "disabled"])
|
|
1514
|
-
]),
|
|
1515
|
+
]), b(n, {
|
|
1515
1516
|
icon: "close",
|
|
1516
|
-
label:
|
|
1517
|
-
onClick:
|
|
1518
|
-
}, null, 8, ["label"])])) :
|
|
1517
|
+
label: N(T).close,
|
|
1518
|
+
onClick: Bt
|
|
1519
|
+
}, null, 8, ["label"])])) : g("", !0)]),
|
|
1519
1520
|
_: 1
|
|
1520
1521
|
}),
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
default:
|
|
1522
|
+
v("div", Oe, [
|
|
1523
|
+
b(p, { name: "m3-pdf-fade" }, {
|
|
1524
|
+
default: I(() => [Ht.value && H.value ? (E(), _("div", {
|
|
1524
1525
|
key: 0,
|
|
1525
1526
|
class: "absolute inset-0 z-20 bg-scrim/32",
|
|
1526
|
-
onClick:
|
|
1527
|
-
})) :
|
|
1527
|
+
onClick: l[17] ||= (e) => Ut(null)
|
|
1528
|
+
})) : g("", !0)]),
|
|
1528
1529
|
_: 1
|
|
1529
1530
|
}),
|
|
1530
|
-
|
|
1531
|
-
default:
|
|
1531
|
+
b(p, { name: "m3-pdf-panel" }, {
|
|
1532
|
+
default: I(() => [Ht.value && N(M).doc.value ? (E(), _("aside", {
|
|
1532
1533
|
key: 0,
|
|
1533
|
-
class:
|
|
1534
|
-
}, [
|
|
1534
|
+
class: C(["flex w-56 shrink-0 flex-col bg-surface-container", H.value ? "absolute inset-y-0 left-0 z-30 rounded-r-lg shadow-elevation-2" : "relative"])
|
|
1535
|
+
}, [v("div", ke, [(E(), _(f, null, k(["thumbnails", "outline"], (e) => v("button", {
|
|
1535
1536
|
key: e,
|
|
1536
1537
|
type: "button",
|
|
1537
|
-
class:
|
|
1538
|
-
disabled: e === "outline" && !
|
|
1538
|
+
class: C(["h-8 flex-1 cursor-pointer rounded-full text-label-large transition-colors", Ht.value === e ? "bg-secondary-container text-on-secondary-container" : "text-on-surface-variant hover:bg-on-surface/8"]),
|
|
1539
|
+
disabled: e === "outline" && !N(M).outline.value.length,
|
|
1539
1540
|
onClick: (t) => Ut(e)
|
|
1540
|
-
},
|
|
1541
|
+
}, j(e === "thumbnails" ? N(T).pdfThumbnails : N(T).pdfOutline), 11, Ae)), 64))]), Ht.value === "thumbnails" ? (E(), _("div", {
|
|
1541
1542
|
key: 0,
|
|
1542
1543
|
ref_key: "thumbList",
|
|
1543
1544
|
ref: Gt,
|
|
1544
1545
|
class: "min-h-0 flex-1 overflow-y-auto px-3 pb-3"
|
|
1545
|
-
}, [
|
|
1546
|
+
}, [v("div", je, [(E(!0), _(f, null, k(N(M).numPages.value, (e) => (E(), _("button", {
|
|
1546
1547
|
key: e,
|
|
1547
1548
|
ref_for: !0,
|
|
1548
1549
|
ref: (t) => qt(t, e),
|
|
1549
1550
|
type: "button",
|
|
1550
1551
|
class: "group flex cursor-pointer flex-col items-center gap-1 outline-none",
|
|
1551
|
-
"aria-label": `${
|
|
1552
|
-
"aria-current": e ===
|
|
1552
|
+
"aria-label": `${N(T).pdfPage} ${e}`,
|
|
1553
|
+
"aria-current": e === J.value ? "page" : void 0,
|
|
1553
1554
|
onClick: (t) => Jt(e)
|
|
1554
|
-
}, [
|
|
1555
|
-
class:
|
|
1556
|
-
style:
|
|
1557
|
-
}, [Wt.get(e) ? (
|
|
1555
|
+
}, [v("span", {
|
|
1556
|
+
class: C(["block w-30 overflow-hidden rounded-sm bg-white shadow-elevation-1 ring-offset-2 ring-offset-surface-container transition-shadow group-focus-visible:ring-2 group-focus-visible:ring-secondary", e === J.value && "ring-3 ring-primary"]),
|
|
1557
|
+
style: w({ aspectRatio: `${ue.value[e - 1]?.width ?? 3} / ${ue.value[e - 1]?.height ?? 4}` })
|
|
1558
|
+
}, [Wt.get(e) ? (E(), _("img", {
|
|
1558
1559
|
key: 0,
|
|
1559
1560
|
src: Wt.get(e),
|
|
1560
1561
|
alt: "",
|
|
1561
1562
|
class: "h-full w-full object-contain",
|
|
1562
|
-
style:
|
|
1563
|
-
}, null, 12,
|
|
1563
|
+
style: w({ transform: W.value ? `rotate(${W.value}deg)` : void 0 })
|
|
1564
|
+
}, null, 12, Ne)) : g("", !0)], 6), v("span", { class: C(["text-label-medium tabular-nums", e === J.value ? "text-primary" : "text-on-surface-variant"]) }, j(e), 3)], 8, Me))), 128))])], 512)) : (E(), _("nav", {
|
|
1564
1565
|
key: 1,
|
|
1565
1566
|
class: "min-h-0 flex-1 overflow-y-auto px-2 pb-3",
|
|
1566
|
-
"aria-label":
|
|
1567
|
-
}, [(
|
|
1567
|
+
"aria-label": N(T).pdfOutline
|
|
1568
|
+
}, [(E(!0), _(f, null, k(Xt.value, (e) => (E(), _("div", {
|
|
1568
1569
|
key: e.key,
|
|
1569
1570
|
class: "flex items-center",
|
|
1570
|
-
style:
|
|
1571
|
-
}, [e.hasChildren ? (
|
|
1571
|
+
style: w({ paddingLeft: `${e.depth * 12}px` })
|
|
1572
|
+
}, [e.hasChildren ? (E(), _("button", {
|
|
1572
1573
|
key: 0,
|
|
1573
1574
|
type: "button",
|
|
1574
1575
|
class: "flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-full text-on-surface-variant hover:bg-on-surface/8",
|
|
1575
|
-
"aria-label": Yt.has(e.key) ?
|
|
1576
|
+
"aria-label": Yt.has(e.key) ? N(T).collapse : N(T).expand,
|
|
1576
1577
|
onClick: (t) => Zt(e.key)
|
|
1577
|
-
}, [
|
|
1578
|
+
}, [b(t, {
|
|
1578
1579
|
name: Yt.has(e.key) ? "expand_more" : "chevron_right",
|
|
1579
1580
|
size: 20
|
|
1580
|
-
}, null, 8, ["name"])], 8,
|
|
1581
|
+
}, null, 8, ["name"])], 8, Fe)) : (E(), _("span", Ie)), (E(), h(ae(e.url ? "a" : "button"), {
|
|
1581
1582
|
href: e.url,
|
|
1582
1583
|
target: e.url ? "_blank" : void 0,
|
|
1583
1584
|
type: e.url ? void 0 : "button",
|
|
1584
1585
|
class: "flex min-h-10 min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-full px-3 text-left text-label-large hover:bg-on-surface/8",
|
|
1585
1586
|
onClick: (t) => e.page && Jt(e.page, e.top)
|
|
1586
1587
|
}, {
|
|
1587
|
-
default:
|
|
1588
|
+
default: I(() => [v("span", Le, j(e.title), 1), e.page ? (E(), _("span", Re, j(e.page), 1)) : g("", !0)]),
|
|
1588
1589
|
_: 2
|
|
1589
1590
|
}, 1032, [
|
|
1590
1591
|
"href",
|
|
1591
1592
|
"target",
|
|
1592
1593
|
"type",
|
|
1593
1594
|
"onClick"
|
|
1594
|
-
]))], 4))), 128))], 8,
|
|
1595
|
+
]))], 4))), 128))], 8, Pe))], 2)) : g("", !0)]),
|
|
1595
1596
|
_: 1
|
|
1596
1597
|
}),
|
|
1597
|
-
|
|
1598
|
-
|
|
1598
|
+
v("div", ze, [
|
|
1599
|
+
v("div", {
|
|
1599
1600
|
ref_key: "scroller",
|
|
1600
|
-
ref:
|
|
1601
|
-
class:
|
|
1601
|
+
ref: R,
|
|
1602
|
+
class: C(["m3-pdf-scroller absolute inset-0 overflow-auto overscroll-contain bg-surface-container-highest outline-none", [$t.value === "select" ? "" : "m3-pdf-annotating", N(Tn) && "scrollbar-none"]]),
|
|
1602
1603
|
tabindex: "0",
|
|
1603
|
-
onScroll:
|
|
1604
|
-
onDblclick:
|
|
1605
|
-
}, [
|
|
1604
|
+
onScroll: dt,
|
|
1605
|
+
onDblclick: _t
|
|
1606
|
+
}, [N(M).doc.value ? (E(), _("div", {
|
|
1606
1607
|
key: 0,
|
|
1607
1608
|
class: "relative mx-auto",
|
|
1608
|
-
style:
|
|
1609
|
-
width: `${
|
|
1610
|
-
height: `${
|
|
1609
|
+
style: w({
|
|
1610
|
+
width: `${K.value.width}px`,
|
|
1611
|
+
height: `${K.value.height}px`
|
|
1611
1612
|
})
|
|
1612
|
-
}, [(
|
|
1613
|
-
key:
|
|
1613
|
+
}, [(E(!0), _(f, null, k(K.value.boxes, (t, n) => (E(), _("div", {
|
|
1614
|
+
key: n,
|
|
1614
1615
|
class: "absolute left-1/2 -translate-x-1/2",
|
|
1615
|
-
style:
|
|
1616
|
-
top: `${
|
|
1617
|
-
width: `${
|
|
1618
|
-
height: `${
|
|
1616
|
+
style: w({
|
|
1617
|
+
top: `${t.top}px`,
|
|
1618
|
+
width: `${t.width}px`,
|
|
1619
|
+
height: `${t.height}px`
|
|
1619
1620
|
})
|
|
1620
|
-
}, [
|
|
1621
|
+
}, [b(ge, {
|
|
1621
1622
|
ref_for: !0,
|
|
1622
|
-
ref: (e) =>
|
|
1623
|
-
pdf:
|
|
1624
|
-
page:
|
|
1625
|
-
scale:
|
|
1626
|
-
rotation:
|
|
1627
|
-
active:
|
|
1628
|
-
hits:
|
|
1629
|
-
annotations: sn.value.get(
|
|
1623
|
+
ref: (e) => Rt(n + 1, e),
|
|
1624
|
+
pdf: N(M),
|
|
1625
|
+
page: n + 1,
|
|
1626
|
+
scale: G.value,
|
|
1627
|
+
rotation: W.value,
|
|
1628
|
+
active: st.value.has(n + 1),
|
|
1629
|
+
hits: Ft.value.get(n + 1) ?? It,
|
|
1630
|
+
annotations: sn.value.get(n + 1) ?? cn,
|
|
1630
1631
|
tool: $t.value,
|
|
1631
1632
|
color: tn.value,
|
|
1632
1633
|
"ink-width": nn.value,
|
|
@@ -1636,7 +1637,7 @@ var W = /* @__PURE__ */ v({
|
|
|
1636
1637
|
onAdd: pn,
|
|
1637
1638
|
onErase: mn,
|
|
1638
1639
|
onEraseStart: hn,
|
|
1639
|
-
onEraseAt: (e) => gn(
|
|
1640
|
+
onEraseAt: (e) => gn(n + 1, e),
|
|
1640
1641
|
onSelect: yn,
|
|
1641
1642
|
onTextSelection: Sn
|
|
1642
1643
|
}, null, 8, [
|
|
@@ -1652,23 +1653,30 @@ var W = /* @__PURE__ */ v({
|
|
|
1652
1653
|
"ink-width",
|
|
1653
1654
|
"selected-id",
|
|
1654
1655
|
"onEraseAt"
|
|
1655
|
-
])
|
|
1656
|
+
]), ie(e.$slots, "page", {
|
|
1657
|
+
page: n + 1,
|
|
1658
|
+
width: t.width,
|
|
1659
|
+
height: t.height,
|
|
1660
|
+
scale: G.value,
|
|
1661
|
+
rotation: W.value,
|
|
1662
|
+
size: N(M).pageSizes.value[n]
|
|
1663
|
+
})], 4))), 128))], 4)) : N(M).needsPassword.value ? (E(), _("div", Be, [v("form", {
|
|
1656
1664
|
class: "flex w-full max-w-sm flex-col items-center gap-4 rounded-xl bg-surface-container-low p-6 text-center shadow-elevation-1",
|
|
1657
|
-
onSubmit:
|
|
1665
|
+
onSubmit: ce(In, ["prevent"])
|
|
1658
1666
|
}, [
|
|
1659
|
-
|
|
1667
|
+
b(t, {
|
|
1660
1668
|
name: "lock",
|
|
1661
1669
|
size: 32,
|
|
1662
1670
|
class: "text-primary"
|
|
1663
1671
|
}),
|
|
1664
|
-
|
|
1665
|
-
|
|
1672
|
+
v("p", Ve, j(N(T).pdfPassword), 1),
|
|
1673
|
+
b(s, {
|
|
1666
1674
|
modelValue: Fn.value,
|
|
1667
|
-
"onUpdate:modelValue":
|
|
1675
|
+
"onUpdate:modelValue": l[18] ||= (e) => Fn.value = e,
|
|
1668
1676
|
type: "password",
|
|
1669
|
-
label:
|
|
1670
|
-
error:
|
|
1671
|
-
"error-label":
|
|
1677
|
+
label: N(T).pdfPasswordLabel,
|
|
1678
|
+
error: N(M).wrongPassword.value,
|
|
1679
|
+
"error-label": N(M).wrongPassword.value ? N(T).pdfWrongPassword : void 0,
|
|
1672
1680
|
autocomplete: "off",
|
|
1673
1681
|
class: "w-full"
|
|
1674
1682
|
}, null, 8, [
|
|
@@ -1677,54 +1685,54 @@ var W = /* @__PURE__ */ v({
|
|
|
1677
1685
|
"error",
|
|
1678
1686
|
"error-label"
|
|
1679
1687
|
]),
|
|
1680
|
-
|
|
1688
|
+
b(c, {
|
|
1681
1689
|
type: "submit",
|
|
1682
1690
|
disabled: !Fn.value,
|
|
1683
1691
|
class: "self-end"
|
|
1684
1692
|
}, {
|
|
1685
|
-
default:
|
|
1693
|
+
default: I(() => [y(j(N(T).pdfOpen), 1)]),
|
|
1686
1694
|
_: 1
|
|
1687
1695
|
}, 8, ["disabled"])
|
|
1688
|
-
], 32)])) :
|
|
1689
|
-
|
|
1696
|
+
], 32)])) : N(M).error.value ? (E(), _("div", He, [
|
|
1697
|
+
b(t, {
|
|
1690
1698
|
name: "error",
|
|
1691
1699
|
size: 32,
|
|
1692
1700
|
class: "text-error"
|
|
1693
1701
|
}),
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
])) :
|
|
1697
|
-
|
|
1698
|
-
default:
|
|
1702
|
+
v("p", Ue, j(N(T).pdfError), 1),
|
|
1703
|
+
v("p", We, j(N(M).error.value.message), 1)
|
|
1704
|
+
])) : N(M).loading.value ? (E(), _("div", Ge, [b(u, { label: N(T).pdfLoading }, null, 8, ["label"])])) : (E(), _("div", Ke, [ie(e.$slots, "empty")]))], 34),
|
|
1705
|
+
b(p, { name: "m3-pdf-fade" }, {
|
|
1706
|
+
default: I(() => [N(M).doc.value && (lt.value || Dn.value) && N(M).numPages.value > 1 ? (E(), _("div", qe, [v("div", {
|
|
1699
1707
|
class: "absolute right-1 flex items-center gap-2",
|
|
1700
|
-
style:
|
|
1701
|
-
}, [
|
|
1708
|
+
style: w({ top: `${N(Tn) ? En.value : Math.min(B.value - 40, Math.max(8, En.value))}px` })
|
|
1709
|
+
}, [v("span", Je, j(J.value) + " / " + j(N(M).numPages.value), 1), N(Tn) ? (E(), _("span", {
|
|
1702
1710
|
key: 0,
|
|
1703
1711
|
class: "pointer-events-auto flex h-12 w-6 touch-none items-center justify-center",
|
|
1704
1712
|
onPointerdown: On
|
|
1705
|
-
}, [...
|
|
1713
|
+
}, [...l[23] ||= [v("span", { class: "h-12 w-1.5 rounded-full bg-on-surface-variant" }, null, -1)]], 32)) : (E(), _("span", Ye))], 4)])) : g("", !0)]),
|
|
1706
1714
|
_: 1
|
|
1707
1715
|
}),
|
|
1708
|
-
|
|
1709
|
-
default:
|
|
1716
|
+
b(p, { name: "m3-pdf-fade" }, {
|
|
1717
|
+
default: I(() => [o.annotate && N(M).doc.value && !rn.value ? (E(), _("button", {
|
|
1710
1718
|
key: 0,
|
|
1711
1719
|
type: "button",
|
|
1712
1720
|
class: "absolute right-4 bottom-4 flex size-14 cursor-pointer items-center justify-center rounded-lg bg-primary-container text-on-primary-container shadow-elevation-3 transition-shadow outline-none hover:shadow-elevation-4 focus-visible:ring-2 focus-visible:ring-primary",
|
|
1713
|
-
"aria-label":
|
|
1721
|
+
"aria-label": N(T).pdfAnnotate,
|
|
1714
1722
|
onClick: an
|
|
1715
|
-
}, [
|
|
1723
|
+
}, [b(t, {
|
|
1716
1724
|
name: "edit",
|
|
1717
1725
|
size: 24
|
|
1718
|
-
})], 8,
|
|
1726
|
+
})], 8, Xe)) : g("", !0)]),
|
|
1719
1727
|
_: 1
|
|
1720
1728
|
}),
|
|
1721
|
-
|
|
1722
|
-
default:
|
|
1729
|
+
b(p, { name: "m3-pdf-rise" }, {
|
|
1730
|
+
default: I(() => [o.annotate && rn.value ? (E(), _("div", Ze, [v("div", {
|
|
1723
1731
|
class: "flex max-w-full items-center gap-1 overflow-x-auto rounded-full bg-surface-container-high p-2 shadow-elevation-3 scrollbar-none",
|
|
1724
1732
|
role: "toolbar",
|
|
1725
|
-
"aria-label":
|
|
1733
|
+
"aria-label": N(T).pdfAnnotate
|
|
1726
1734
|
}, [
|
|
1727
|
-
(
|
|
1735
|
+
(E(!0), _(f, null, k(Rn.value, (e) => (E(), h(n, {
|
|
1728
1736
|
key: e.id,
|
|
1729
1737
|
icon: e.icon,
|
|
1730
1738
|
label: e.label,
|
|
@@ -1737,123 +1745,656 @@ var W = /* @__PURE__ */ v({
|
|
|
1737
1745
|
"checked",
|
|
1738
1746
|
"onUpdate:checked"
|
|
1739
1747
|
]))), 128)),
|
|
1740
|
-
|
|
1741
|
-
(
|
|
1748
|
+
l[25] ||= v("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
|
|
1749
|
+
(E(!0), _(f, null, k(o.colors, (e) => (E(), _("button", {
|
|
1742
1750
|
key: e,
|
|
1743
1751
|
type: "button",
|
|
1744
1752
|
class: "flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1745
|
-
"aria-label": `${
|
|
1753
|
+
"aria-label": `${N(T).pdfColor} ${e}`,
|
|
1746
1754
|
"aria-pressed": tn.value === e,
|
|
1747
1755
|
onClick: (t) => tn.value = e
|
|
1748
|
-
}, [
|
|
1749
|
-
class:
|
|
1750
|
-
style:
|
|
1751
|
-
}, null, 6)], 8,
|
|
1752
|
-
$t.value === "ink" &&
|
|
1756
|
+
}, [v("span", {
|
|
1757
|
+
class: C(["rounded-full border border-outline-variant transition-[width,height] duration-150", tn.value === e ? "size-[30px] ring-2 ring-on-surface ring-offset-2 ring-offset-surface-container-high" : "size-6"]),
|
|
1758
|
+
style: w({ backgroundColor: e })
|
|
1759
|
+
}, null, 6)], 8, $e))), 128)),
|
|
1760
|
+
$t.value === "ink" && o.inkWidths.length > 1 ? (E(), _(f, { key: 0 }, [l[24] ||= v("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1), (E(!0), _(f, null, k(o.inkWidths, (e) => (E(), _("button", {
|
|
1753
1761
|
key: e,
|
|
1754
1762
|
type: "button",
|
|
1755
|
-
class:
|
|
1756
|
-
"aria-label":
|
|
1763
|
+
class: C(["flex size-10 shrink-0 cursor-pointer items-center justify-center rounded-full outline-none hover:bg-on-surface/8 focus-visible:ring-2 focus-visible:ring-primary", nn.value === e && "bg-secondary-container"]),
|
|
1764
|
+
"aria-label": N(T).pdfInkWidth.replace("{n}", String(e)),
|
|
1757
1765
|
"aria-pressed": nn.value === e,
|
|
1758
1766
|
onClick: (t) => nn.value = e
|
|
1759
|
-
}, [
|
|
1767
|
+
}, [v("span", {
|
|
1760
1768
|
class: "rounded-full",
|
|
1761
|
-
style:
|
|
1769
|
+
style: w({
|
|
1762
1770
|
width: `${Math.min(22, 3 + e * 2)}px`,
|
|
1763
1771
|
height: `${Math.min(22, 3 + e * 2)}px`,
|
|
1764
1772
|
backgroundColor: tn.value
|
|
1765
1773
|
})
|
|
1766
|
-
}, null, 4)], 10,
|
|
1767
|
-
|
|
1768
|
-
|
|
1774
|
+
}, null, 4)], 10, et))), 128))], 64)) : g("", !0),
|
|
1775
|
+
l[26] ||= v("span", { class: "mx-1 h-6 w-px shrink-0 bg-outline-variant" }, null, -1),
|
|
1776
|
+
b(n, {
|
|
1769
1777
|
icon: "undo",
|
|
1770
|
-
label:
|
|
1778
|
+
label: N(T).pdfUndo,
|
|
1771
1779
|
disabled: !dn.value,
|
|
1772
1780
|
onClick: fn
|
|
1773
1781
|
}, null, 8, ["label", "disabled"]),
|
|
1774
|
-
|
|
1782
|
+
b(n, {
|
|
1775
1783
|
icon: "close",
|
|
1776
|
-
label:
|
|
1784
|
+
label: N(T).close,
|
|
1777
1785
|
onClick: on
|
|
1778
1786
|
}, null, 8, ["label"])
|
|
1779
|
-
], 8,
|
|
1787
|
+
], 8, Qe)])) : g("", !0)]),
|
|
1780
1788
|
_: 1
|
|
1781
1789
|
})
|
|
1782
1790
|
])
|
|
1783
1791
|
]),
|
|
1784
|
-
$.value ? (
|
|
1792
|
+
$.value ? (E(), _("div", {
|
|
1785
1793
|
key: 1,
|
|
1786
1794
|
class: "absolute z-40 flex justify-center",
|
|
1787
|
-
style:
|
|
1788
|
-
}, [
|
|
1795
|
+
style: w(xn.value)
|
|
1796
|
+
}, [v("div", tt, [b(c, {
|
|
1789
1797
|
variant: "text",
|
|
1790
1798
|
icon: "content_copy",
|
|
1791
1799
|
size: "sm",
|
|
1792
1800
|
onClick: wn
|
|
1793
1801
|
}, {
|
|
1794
|
-
default:
|
|
1802
|
+
default: I(() => [y(j(N(T).pdfCopy), 1)]),
|
|
1795
1803
|
_: 1
|
|
1796
|
-
}),
|
|
1804
|
+
}), b(c, {
|
|
1797
1805
|
variant: "text",
|
|
1798
1806
|
icon: "ink_highlighter",
|
|
1799
1807
|
size: "sm",
|
|
1800
1808
|
onClick: Cn
|
|
1801
1809
|
}, {
|
|
1802
|
-
default:
|
|
1810
|
+
default: I(() => [y(j(N(T).pdfHighlight), 1)]),
|
|
1803
1811
|
_: 1
|
|
1804
|
-
})])], 4)) :
|
|
1805
|
-
Z.value && Q.value ? (
|
|
1812
|
+
})])], 4)) : g("", !0),
|
|
1813
|
+
Z.value && Q.value ? (E(), _("div", {
|
|
1806
1814
|
key: 2,
|
|
1807
1815
|
class: "absolute z-40",
|
|
1808
|
-
style:
|
|
1809
|
-
onKeydown:
|
|
1810
|
-
}, [
|
|
1811
|
-
Q.value.quote ? (
|
|
1816
|
+
style: w(xn.value),
|
|
1817
|
+
onKeydown: l[22] ||= ce((e) => e.key === "Escape" && (Z.value = null), ["stop"])
|
|
1818
|
+
}, [v("div", nt, [
|
|
1819
|
+
Q.value.quote ? (E(), _("p", {
|
|
1812
1820
|
key: 0,
|
|
1813
1821
|
class: "line-clamp-3 border-l-4 pl-2 text-body-medium text-on-surface-variant",
|
|
1814
|
-
style:
|
|
1815
|
-
},
|
|
1816
|
-
|
|
1822
|
+
style: w({ borderColor: Q.value.color })
|
|
1823
|
+
}, j(Q.value.quote), 5)) : g("", !0),
|
|
1824
|
+
b(s, {
|
|
1817
1825
|
"model-value": Q.value.text ?? "",
|
|
1818
|
-
label: Q.value.type === "note" ?
|
|
1826
|
+
label: Q.value.type === "note" ? N(T).pdfNotePlaceholder : N(T).pdfAddComment,
|
|
1819
1827
|
multiline: "",
|
|
1820
1828
|
"auto-grow": "",
|
|
1821
1829
|
rows: 2,
|
|
1822
1830
|
"max-rows": 6,
|
|
1823
1831
|
variant: "outlined",
|
|
1824
1832
|
"field-bg": "var(--color-surface-container-high)",
|
|
1825
|
-
"onUpdate:modelValue":
|
|
1833
|
+
"onUpdate:modelValue": l[19] ||= (e) => _n(Q.value.id, { text: String(e) })
|
|
1826
1834
|
}, null, 8, ["model-value", "label"]),
|
|
1827
|
-
|
|
1828
|
-
(
|
|
1835
|
+
v("div", rt, [
|
|
1836
|
+
(E(!0), _(f, null, k(o.colors, (e) => (E(), _("button", {
|
|
1829
1837
|
key: e,
|
|
1830
1838
|
type: "button",
|
|
1831
1839
|
class: "flex size-8 cursor-pointer items-center justify-center rounded-full outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
1832
|
-
"aria-label": `${
|
|
1840
|
+
"aria-label": `${N(T).pdfColor} ${e}`,
|
|
1833
1841
|
"aria-pressed": Q.value.color === e,
|
|
1834
1842
|
onClick: (t) => _n(Q.value.id, { color: e })
|
|
1835
|
-
}, [
|
|
1836
|
-
class:
|
|
1837
|
-
style:
|
|
1838
|
-
}, null, 6)], 8,
|
|
1839
|
-
|
|
1840
|
-
|
|
1843
|
+
}, [v("span", {
|
|
1844
|
+
class: C(["size-5 rounded-full border border-outline-variant", Q.value.color === e && "ring-2 ring-on-surface ring-offset-1 ring-offset-surface-container-high"]),
|
|
1845
|
+
style: w({ backgroundColor: e })
|
|
1846
|
+
}, null, 6)], 8, it))), 128)),
|
|
1847
|
+
l[27] ||= v("span", { class: "flex-1" }, null, -1),
|
|
1848
|
+
b(n, {
|
|
1841
1849
|
icon: "delete",
|
|
1842
|
-
label:
|
|
1850
|
+
label: N(T).pdfDelete,
|
|
1843
1851
|
size: "xs",
|
|
1844
|
-
onClick:
|
|
1852
|
+
onClick: l[20] ||= (e) => mn(Q.value.id)
|
|
1845
1853
|
}, null, 8, ["label"]),
|
|
1846
|
-
|
|
1854
|
+
b(n, {
|
|
1847
1855
|
icon: "check",
|
|
1848
|
-
label:
|
|
1856
|
+
label: N(T).close,
|
|
1849
1857
|
size: "xs",
|
|
1850
|
-
onClick:
|
|
1858
|
+
onClick: l[21] ||= (e) => Z.value = null
|
|
1851
1859
|
}, null, 8, ["label"])
|
|
1852
1860
|
])
|
|
1853
|
-
])], 36)) :
|
|
1854
|
-
], 16,
|
|
1861
|
+
])], 36)) : g("", !0)
|
|
1862
|
+
], 16, _e));
|
|
1863
|
+
}
|
|
1864
|
+
}), st = (e) => (e.required ?? (e.type === "signature" || e.type === "initials")) && !e.value;
|
|
1865
|
+
function ct(e, t, n) {
|
|
1866
|
+
let r = (n % 360 + 360) % 360, i = e.x, a = e.y + e.height, o, s;
|
|
1867
|
+
return r === 90 ? (o = a, s = i) : r === 180 ? (o = t.width - i, s = a) : r === 270 ? (o = t.width - a, s = t.height - i) : (o = i, s = t.height - a), {
|
|
1868
|
+
x: t.x + o,
|
|
1869
|
+
y: t.y + s,
|
|
1870
|
+
rotate: r
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
async function lt(e, t, n, r) {
|
|
1874
|
+
if (!e.value) return null;
|
|
1875
|
+
if ((e.type === "signature" || e.type === "initials") && e.value.startsWith("data:image/png")) return ut(e.value);
|
|
1876
|
+
let i = document.createElement("canvas");
|
|
1877
|
+
i.width = Math.max(1, Math.round(t * 4)), i.height = Math.max(1, Math.round(n * 4));
|
|
1878
|
+
let a = i.getContext("2d");
|
|
1879
|
+
if (!a) return null;
|
|
1880
|
+
if (a.fillStyle = "#111", a.textBaseline = "middle", e.type === "checkbox") {
|
|
1881
|
+
if (e.value !== "true") return null;
|
|
1882
|
+
let t = Math.min(i.width, i.height);
|
|
1883
|
+
a.lineWidth = t * .12, a.lineCap = "round", a.lineJoin = "round", a.strokeStyle = "#111", a.beginPath(), a.moveTo(t * .2, t * .55), a.lineTo(t * .42, t * .76), a.lineTo(t * .82, t * .26), a.stroke();
|
|
1884
|
+
} else {
|
|
1885
|
+
let t = i.height * .62;
|
|
1886
|
+
for (a.font = `${t}px ${r}`; t > 6 && a.measureText(e.value).width > i.width * .96;) t *= .92, a.font = `${t}px ${r}`;
|
|
1887
|
+
a.fillText(e.value, i.width * .02, i.height / 2);
|
|
1888
|
+
}
|
|
1889
|
+
let o = await new Promise((e) => i.toBlob(e, "image/png"));
|
|
1890
|
+
return o ? new Uint8Array(await o.arrayBuffer()) : null;
|
|
1891
|
+
}
|
|
1892
|
+
function ut(e) {
|
|
1893
|
+
let t = e.slice(e.indexOf(",") + 1), n = atob(t), r = new Uint8Array(n.length);
|
|
1894
|
+
for (let e = 0; e < n.length; e++) r[e] = n.charCodeAt(e);
|
|
1895
|
+
return r;
|
|
1896
|
+
}
|
|
1897
|
+
async function dt(e, t, n = {}) {
|
|
1898
|
+
let { PDFDocument: r, degrees: i } = await import("pdf-lib"), a = await r.load(e), o = a.getPages(), s = n.font ?? "system-ui, sans-serif";
|
|
1899
|
+
for (let e of t) {
|
|
1900
|
+
let t = o[e.page - 1];
|
|
1901
|
+
if (!t || !e.value) continue;
|
|
1902
|
+
let n = t.getCropBox(), r = t.getRotation().angle, c = (r % 180 + 180) % 180 != 0, l = c ? n.height : n.width, u = c ? n.width : n.height, d = {
|
|
1903
|
+
x: e.x * l,
|
|
1904
|
+
y: e.y * u,
|
|
1905
|
+
width: e.width * l,
|
|
1906
|
+
height: e.height * u
|
|
1907
|
+
}, f = await lt(e, d.width, d.height, s);
|
|
1908
|
+
if (!f) continue;
|
|
1909
|
+
let p = await a.embedPng(f), { width: m, height: h } = d, g = 0, _ = 0;
|
|
1910
|
+
if (e.type === "signature" || e.type === "initials") {
|
|
1911
|
+
let e = Math.min(d.width / p.width, d.height / p.height);
|
|
1912
|
+
m = p.width * e, h = p.height * e, g = (d.width - m) / 2, _ = (d.height - h) / 2;
|
|
1913
|
+
}
|
|
1914
|
+
let v = ct({
|
|
1915
|
+
x: d.x + g,
|
|
1916
|
+
y: d.y + _,
|
|
1917
|
+
width: m,
|
|
1918
|
+
height: h
|
|
1919
|
+
}, {
|
|
1920
|
+
x: n.x,
|
|
1921
|
+
y: n.y,
|
|
1922
|
+
width: n.width,
|
|
1923
|
+
height: n.height
|
|
1924
|
+
}, r);
|
|
1925
|
+
t.drawImage(p, {
|
|
1926
|
+
x: v.x,
|
|
1927
|
+
y: v.y,
|
|
1928
|
+
width: m,
|
|
1929
|
+
height: h,
|
|
1930
|
+
rotate: i(v.rotate)
|
|
1931
|
+
});
|
|
1932
|
+
}
|
|
1933
|
+
return n.producer && a.setProducer(n.producer), a.setModificationDate(/* @__PURE__ */ new Date()), a.save();
|
|
1934
|
+
}
|
|
1935
|
+
// src/components/MPdfSigner.vue?vue&type=script&setup=true&lang.ts
|
|
1936
|
+
var ft = { class: "flex shrink-0 flex-wrap items-center gap-2 border-b border-outline-variant bg-surface-container px-3 py-2" }, X = {
|
|
1937
|
+
class: "text-body-medium text-on-surface",
|
|
1938
|
+
"aria-live": "polite"
|
|
1939
|
+
}, pt = { class: "mr-1 text-label-large text-on-surface-variant" }, mt = { class: "pointer-events-none absolute inset-0" }, ht = [
|
|
1940
|
+
"id",
|
|
1941
|
+
"data-field",
|
|
1942
|
+
"data-type",
|
|
1943
|
+
"tabindex",
|
|
1944
|
+
"aria-label",
|
|
1945
|
+
"onClick",
|
|
1946
|
+
"onPointerdown",
|
|
1947
|
+
"onKeydown"
|
|
1948
|
+
], gt = ["src"], _t = {
|
|
1949
|
+
key: 3,
|
|
1950
|
+
class: "flex min-w-0 items-center gap-1 truncate px-1 text-label-medium"
|
|
1951
|
+
}, vt = { class: "truncate" }, yt = ["onPointerdown"], bt = {
|
|
1952
|
+
key: 0,
|
|
1953
|
+
class: "flex flex-col gap-4"
|
|
1954
|
+
}, xt = "\"Segoe Script\", \"Brush Script MT\", \"Snell Roundhand\", \"URW Chancery L\", cursive", St = /* @__PURE__ */ x({
|
|
1955
|
+
inheritAttrs: !1,
|
|
1956
|
+
__name: "MPdfSigner",
|
|
1957
|
+
props: {
|
|
1958
|
+
src: { default: null },
|
|
1959
|
+
fields: { default: () => [] },
|
|
1960
|
+
mode: { default: "sign" },
|
|
1961
|
+
signer: {},
|
|
1962
|
+
signerName: {},
|
|
1963
|
+
dateFormat: { default: () => ({ dateStyle: "medium" }) },
|
|
1964
|
+
types: { default: () => [
|
|
1965
|
+
"signature",
|
|
1966
|
+
"initials",
|
|
1967
|
+
"name",
|
|
1968
|
+
"date",
|
|
1969
|
+
"text",
|
|
1970
|
+
"checkbox"
|
|
1971
|
+
] },
|
|
1972
|
+
workerSrc: {}
|
|
1973
|
+
},
|
|
1974
|
+
emits: [
|
|
1975
|
+
"update:fields",
|
|
1976
|
+
"complete",
|
|
1977
|
+
"finish",
|
|
1978
|
+
"loaded"
|
|
1979
|
+
],
|
|
1980
|
+
setup(r, { expose: i, emit: a }) {
|
|
1981
|
+
let u = r, p = a, x = e(), S = P(), ne = O(), re = {
|
|
1982
|
+
signature: {
|
|
1983
|
+
icon: "signature",
|
|
1984
|
+
key: "pdfSignSignature",
|
|
1985
|
+
w: .3,
|
|
1986
|
+
h: .06
|
|
1987
|
+
},
|
|
1988
|
+
initials: {
|
|
1989
|
+
icon: "draw",
|
|
1990
|
+
key: "pdfSignInitials",
|
|
1991
|
+
w: .1,
|
|
1992
|
+
h: .05
|
|
1993
|
+
},
|
|
1994
|
+
name: {
|
|
1995
|
+
icon: "badge",
|
|
1996
|
+
key: "pdfSignName",
|
|
1997
|
+
w: .3,
|
|
1998
|
+
h: .035
|
|
1999
|
+
},
|
|
2000
|
+
date: {
|
|
2001
|
+
icon: "calendar_today",
|
|
2002
|
+
key: "pdfSignDate",
|
|
2003
|
+
w: .2,
|
|
2004
|
+
h: .035
|
|
2005
|
+
},
|
|
2006
|
+
text: {
|
|
2007
|
+
icon: "text_fields",
|
|
2008
|
+
key: "pdfSignText",
|
|
2009
|
+
w: .3,
|
|
2010
|
+
h: .035
|
|
2011
|
+
},
|
|
2012
|
+
checkbox: {
|
|
2013
|
+
icon: "check_box",
|
|
2014
|
+
key: "pdfSignCheckbox",
|
|
2015
|
+
w: .03,
|
|
2016
|
+
h: .022
|
|
2017
|
+
}
|
|
2018
|
+
}, T = (e) => x[re[e].key], D = (e) => !u.signer || !e.signer || e.signer === u.signer, ie = m(() => {
|
|
2019
|
+
let e = /* @__PURE__ */ new Map();
|
|
2020
|
+
for (let t of u.fields) e.set(t.page, [...e.get(t.page) ?? [], t]);
|
|
2021
|
+
return e;
|
|
2022
|
+
}), ae = m(() => u.fields.filter((e) => D(e) && (e.required ?? (e.type === "signature" || e.type === "initials")))), A = m(() => ae.value.filter((e) => !st(e)).length), M = m(() => A.value === ae.value.length);
|
|
2023
|
+
F(M, (e, t) => {
|
|
2024
|
+
e && !t && u.mode === "sign" && p("complete");
|
|
2025
|
+
});
|
|
2026
|
+
let oe = m(() => x.pdfSignProgress.replace("{done}", String(A.value)).replace("{total}", String(ae.value.length)));
|
|
2027
|
+
function L(e, t) {
|
|
2028
|
+
p("update:fields", u.fields.map((n) => n.id === e ? {
|
|
2029
|
+
...n,
|
|
2030
|
+
...t
|
|
2031
|
+
} : n));
|
|
2032
|
+
}
|
|
2033
|
+
let R = O({}), z = O(null), B = O(), V = O(!0), H = O(), U = O(400);
|
|
2034
|
+
F(() => z.value?.tab, () => te(() => {
|
|
2035
|
+
H.value?.clientWidth && (U.value = H.value.clientWidth - 2);
|
|
2036
|
+
}));
|
|
2037
|
+
function le() {
|
|
2038
|
+
return new Intl.DateTimeFormat(void 0, u.dateFormat).format(/* @__PURE__ */ new Date());
|
|
2039
|
+
}
|
|
2040
|
+
function W(e, t = !1) {
|
|
2041
|
+
if (u.mode !== "sign" || !D(e)) return;
|
|
2042
|
+
if (e.type === "checkbox") return L(e.id, { value: e.value === "true" ? void 0 : "true" });
|
|
2043
|
+
if (e.type === "date" && !e.value) return L(e.id, { value: le() });
|
|
2044
|
+
if (e.type === "name" && !e.value && u.signerName) return L(e.id, { value: u.signerName });
|
|
2045
|
+
if ((e.type === "signature" || e.type === "initials") && !t) {
|
|
2046
|
+
let t = R.value[e.type];
|
|
2047
|
+
if (t && !e.value) return L(e.id, { value: t });
|
|
2048
|
+
}
|
|
2049
|
+
let n = e.type === "initials" ? ue(u.signerName ?? "") : u.signerName ?? "";
|
|
2050
|
+
z.value = {
|
|
2051
|
+
field: e,
|
|
2052
|
+
tab: e.type === "signature" || e.type === "initials" ? "draw" : "type",
|
|
2053
|
+
text: e.type === "signature" || e.type === "initials" ? n : e.value ?? (e.type === "name" ? n : "")
|
|
2054
|
+
}, V.value = !0;
|
|
2055
|
+
}
|
|
2056
|
+
let ue = (e) => e.split(/\s+/).filter(Boolean).map((e) => e[0].toUpperCase()).join("");
|
|
2057
|
+
function de(e) {
|
|
2058
|
+
let t = document.createElement("canvas"), n = t.getContext("2d");
|
|
2059
|
+
return n ? (n.font = `96px ${xt}`, t.width = Math.ceil(n.measureText(e).width) + 40, t.height = 96 * 1.6, n.font = `96px ${xt}`, n.fillStyle = "#1a237e", n.textBaseline = "middle", n.fillText(e, 20, t.height / 2), t.toDataURL("image/png")) : "";
|
|
2060
|
+
}
|
|
2061
|
+
let fe = m(() => z.value?.field.type === "signature" || z.value?.field.type === "initials"), pe = m(() => {
|
|
2062
|
+
let e = z.value;
|
|
2063
|
+
return e ? fe.value && e.tab === "draw" ? !V.value : e.text.trim() !== "" : !1;
|
|
2064
|
+
});
|
|
2065
|
+
async function G() {
|
|
2066
|
+
let e = z.value;
|
|
2067
|
+
if (!e || !pe.value) return;
|
|
2068
|
+
let t;
|
|
2069
|
+
fe.value ? (t = e.tab === "draw" ? await me(B.value?.toDataURL() ?? "") : de(e.text.trim()), R.value = {
|
|
2070
|
+
...R.value,
|
|
2071
|
+
[e.field.type]: t
|
|
2072
|
+
}) : t = e.text.trim(), L(e.field.id, { value: t }), z.value = null;
|
|
2073
|
+
}
|
|
2074
|
+
async function me(e) {
|
|
2075
|
+
if (!e || typeof document > "u") return e;
|
|
2076
|
+
let t = new Image();
|
|
2077
|
+
t.src = e;
|
|
2078
|
+
try {
|
|
2079
|
+
await t.decode();
|
|
2080
|
+
} catch {
|
|
2081
|
+
return e;
|
|
2082
|
+
}
|
|
2083
|
+
if (!t.width) return e;
|
|
2084
|
+
let n = document.createElement("canvas");
|
|
2085
|
+
n.width = t.width, n.height = t.height;
|
|
2086
|
+
let r = n.getContext("2d");
|
|
2087
|
+
if (!r) return e;
|
|
2088
|
+
r.drawImage(t, 0, 0);
|
|
2089
|
+
let { data: i, width: a, height: o } = r.getImageData(0, 0, n.width, n.height), s = a, c = o, l = -1, u = -1;
|
|
2090
|
+
for (let e = 0; e < o; e++) for (let t = 0; t < a; t++) i[(e * a + t) * 4 + 3] > 8 && (s = Math.min(s, t), l = Math.max(l, t), c = Math.min(c, e), u = Math.max(u, e));
|
|
2091
|
+
if (l < 0) return e;
|
|
2092
|
+
s = Math.max(0, s - 8), c = Math.max(0, c - 8), l = Math.min(a - 1, l + 8), u = Math.min(o - 1, u + 8);
|
|
2093
|
+
let d = document.createElement("canvas");
|
|
2094
|
+
return d.width = l - s + 1, d.height = u - c + 1, d.getContext("2d")?.drawImage(n, s, c, d.width, d.height, 0, 0, d.width, d.height), d.toDataURL("image/png");
|
|
2095
|
+
}
|
|
2096
|
+
function K() {
|
|
2097
|
+
let e = ae.value, t = e.find((e) => st(e)) ?? e[0];
|
|
2098
|
+
if (!t) return;
|
|
2099
|
+
let n = document.getElementById(he(t));
|
|
2100
|
+
n?.scrollIntoView({
|
|
2101
|
+
behavior: "smooth",
|
|
2102
|
+
block: "center"
|
|
2103
|
+
}), n?.focus({ preventScroll: !0 });
|
|
2104
|
+
}
|
|
2105
|
+
let he = (e) => `${S}-f-${e.id}`, q = O(null), J = 0;
|
|
2106
|
+
function ge(e) {
|
|
2107
|
+
let t = re[e], n = Ce.value, r = `${e}-${Date.now().toString(36)}-${++J}`, i = {
|
|
2108
|
+
id: r,
|
|
2109
|
+
type: e,
|
|
2110
|
+
page: n,
|
|
2111
|
+
x: .5 - t.w / 2,
|
|
2112
|
+
y: .45,
|
|
2113
|
+
width: t.w,
|
|
2114
|
+
height: t.h,
|
|
2115
|
+
label: T(e)
|
|
2116
|
+
};
|
|
2117
|
+
(e === "signature" || e === "initials") && (i.required = !0), p("update:fields", [...u.fields, i]), q.value = r;
|
|
2118
|
+
}
|
|
2119
|
+
function _e(e) {
|
|
2120
|
+
p("update:fields", u.fields.filter((t) => t.id !== e)), q.value === e && (q.value = null);
|
|
2121
|
+
}
|
|
2122
|
+
let Y = null;
|
|
2123
|
+
function ve(e, t, n, r) {
|
|
2124
|
+
u.mode === "prepare" && e.button === 0 && (e.preventDefault(), e.stopPropagation(), q.value = t.id, Y = {
|
|
2125
|
+
id: t.id,
|
|
2126
|
+
kind: n,
|
|
2127
|
+
x: e.clientX,
|
|
2128
|
+
y: e.clientY,
|
|
2129
|
+
start: { ...t },
|
|
2130
|
+
w: r.width,
|
|
2131
|
+
h: r.height
|
|
2132
|
+
}, e.currentTarget.setPointerCapture?.(e.pointerId));
|
|
2133
|
+
}
|
|
2134
|
+
function ye(e) {
|
|
2135
|
+
if (!Y) return;
|
|
2136
|
+
let t = (e.clientX - Y.x) / Y.w, n = (e.clientY - Y.y) / Y.h, r = Y.start;
|
|
2137
|
+
Y.kind === "move" ? L(Y.id, {
|
|
2138
|
+
x: xe(r.x + t, 0, 1 - r.width),
|
|
2139
|
+
y: xe(r.y + n, 0, 1 - r.height)
|
|
2140
|
+
}) : L(Y.id, {
|
|
2141
|
+
width: xe(r.width + t, .02, 1 - r.x),
|
|
2142
|
+
height: xe(r.height + n, .015, 1 - r.y)
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
function be() {
|
|
2146
|
+
Y = null;
|
|
2147
|
+
}
|
|
2148
|
+
let xe = (e, t, n) => Math.min(Math.max(e, t), n);
|
|
2149
|
+
function Se(e, t) {
|
|
2150
|
+
if (u.mode === "sign") {
|
|
2151
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), W(t));
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
let n = e.shiftKey ? .02 : .005, r = {
|
|
2155
|
+
ArrowLeft: [-n, 0],
|
|
2156
|
+
ArrowRight: [n, 0],
|
|
2157
|
+
ArrowUp: [0, -n],
|
|
2158
|
+
ArrowDown: [0, n]
|
|
2159
|
+
};
|
|
2160
|
+
if (r[e.key]) {
|
|
2161
|
+
e.preventDefault();
|
|
2162
|
+
let [n, i] = r[e.key];
|
|
2163
|
+
L(t.id, {
|
|
2164
|
+
x: xe(t.x + n, 0, 1 - t.width),
|
|
2165
|
+
y: xe(t.y + i, 0, 1 - t.height)
|
|
2166
|
+
});
|
|
2167
|
+
} else (e.key === "Delete" || e.key === "Backspace") && (e.preventDefault(), _e(t.id));
|
|
2168
|
+
}
|
|
2169
|
+
let Ce = O(1);
|
|
2170
|
+
function we(e) {
|
|
2171
|
+
let t = e.rotation, n = t % 180 != 0, r = n ? e.height : e.width, i = n ? e.width : e.height, a = t === 90 ? "rotate(90deg) translateY(-100%)" : t === 180 ? "rotate(180deg) translate(-100%, -100%)" : t === 270 ? "rotate(270deg) translateX(-100%)" : void 0;
|
|
2172
|
+
return {
|
|
2173
|
+
width: `${r}px`,
|
|
2174
|
+
height: `${i}px`,
|
|
2175
|
+
transform: a,
|
|
2176
|
+
transformOrigin: "top left"
|
|
2177
|
+
};
|
|
2178
|
+
}
|
|
2179
|
+
let Te = (e) => ({
|
|
2180
|
+
left: `${e.x * 100}%`,
|
|
2181
|
+
top: `${e.y * 100}%`,
|
|
2182
|
+
width: `${e.width * 100}%`,
|
|
2183
|
+
height: `${e.height * 100}%`
|
|
2184
|
+
});
|
|
2185
|
+
async function Ee(e) {
|
|
2186
|
+
if (e instanceof Uint8Array || e instanceof ArrayBuffer) return e;
|
|
2187
|
+
if (typeof Blob < "u" && e instanceof Blob) return e.arrayBuffer();
|
|
2188
|
+
let t = await fetch(String(e));
|
|
2189
|
+
if (!t.ok) throw Error(`PDF ${t.status}`);
|
|
2190
|
+
return t.arrayBuffer();
|
|
2191
|
+
}
|
|
2192
|
+
async function De(e) {
|
|
2193
|
+
if (!u.src) throw Error("No PDF");
|
|
2194
|
+
return dt(await Ee(u.src), u.fields, e);
|
|
2195
|
+
}
|
|
2196
|
+
return i({
|
|
2197
|
+
save: De,
|
|
2198
|
+
next: K,
|
|
2199
|
+
complete: M,
|
|
2200
|
+
viewer: ne
|
|
2201
|
+
}), (e, i) => (E(), _("div", ee({ class: "m3-pdf-signer" }, e.$attrs), [
|
|
2202
|
+
v("div", ft, [r.mode === "sign" ? (E(), _(f, { key: 0 }, [
|
|
2203
|
+
b(t, {
|
|
2204
|
+
name: M.value ? "task_alt" : "edit_document",
|
|
2205
|
+
size: 20,
|
|
2206
|
+
class: C(M.value ? "text-primary" : "text-on-surface-variant")
|
|
2207
|
+
}, null, 8, ["name", "class"]),
|
|
2208
|
+
v("span", X, j(M.value ? N(x).pdfSignComplete : oe.value), 1),
|
|
2209
|
+
i[12] ||= v("span", { class: "flex-1" }, null, -1),
|
|
2210
|
+
M.value ? g("", !0) : (E(), h(c, {
|
|
2211
|
+
key: 0,
|
|
2212
|
+
variant: "tonal",
|
|
2213
|
+
icon: "arrow_downward",
|
|
2214
|
+
onClick: K
|
|
2215
|
+
}, {
|
|
2216
|
+
default: I(() => [y(j(N(x).pdfSignNext), 1)]),
|
|
2217
|
+
_: 1
|
|
2218
|
+
})),
|
|
2219
|
+
b(c, {
|
|
2220
|
+
disabled: !M.value,
|
|
2221
|
+
icon: "check",
|
|
2222
|
+
onClick: i[0] ||= (e) => p("finish")
|
|
2223
|
+
}, {
|
|
2224
|
+
default: I(() => [y(j(N(x).pdfSignFinish), 1)]),
|
|
2225
|
+
_: 1
|
|
2226
|
+
}, 8, ["disabled"])
|
|
2227
|
+
], 64)) : (E(), _(f, { key: 1 }, [v("span", pt, j(N(x).pdfSignAddField), 1), (E(!0), _(f, null, k(r.types, (e) => (E(), h(c, {
|
|
2228
|
+
key: e,
|
|
2229
|
+
variant: "tonal",
|
|
2230
|
+
size: "sm",
|
|
2231
|
+
icon: re[e].icon,
|
|
2232
|
+
"data-add": e,
|
|
2233
|
+
onClick: (t) => ge(e)
|
|
2234
|
+
}, {
|
|
2235
|
+
default: I(() => [y(j(T(e)), 1)]),
|
|
2236
|
+
_: 2
|
|
2237
|
+
}, 1032, [
|
|
2238
|
+
"icon",
|
|
2239
|
+
"data-add",
|
|
2240
|
+
"onClick"
|
|
2241
|
+
]))), 128))], 64))]),
|
|
2242
|
+
b(ot, {
|
|
2243
|
+
ref_key: "viewer",
|
|
2244
|
+
ref: ne,
|
|
2245
|
+
src: r.src,
|
|
2246
|
+
"worker-src": r.workerSrc,
|
|
2247
|
+
class: "min-h-0 flex-1",
|
|
2248
|
+
"onUpdate:page": i[2] ||= (e) => Ce.value = e,
|
|
2249
|
+
onLoaded: i[3] ||= (e) => p("loaded", e)
|
|
2250
|
+
}, {
|
|
2251
|
+
page: I((e) => [v("div", mt, [v("div", {
|
|
2252
|
+
class: "absolute left-0 top-0",
|
|
2253
|
+
style: w(we(e))
|
|
2254
|
+
}, [(E(!0), _(f, null, k(ie.value.get(e.page) ?? [], (a) => (E(), _("div", {
|
|
2255
|
+
id: he(a),
|
|
2256
|
+
key: a.id,
|
|
2257
|
+
class: C(["m3-pdf-sign-field pointer-events-auto absolute flex items-center justify-center rounded-xs outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary", [
|
|
2258
|
+
r.mode === "prepare" ? "cursor-move" : D(a) ? "cursor-pointer" : "cursor-default opacity-40",
|
|
2259
|
+
a.value ? "m3-pdf-sign-filled" : "m3-pdf-sign-empty",
|
|
2260
|
+
r.mode === "sign" && D(a) && N(st)(a) ? "m3-pdf-sign-todo" : "",
|
|
2261
|
+
q.value === a.id && r.mode === "prepare" ? "m3-pdf-sign-selected" : ""
|
|
2262
|
+
]]),
|
|
2263
|
+
style: w(Te(a)),
|
|
2264
|
+
"data-field": a.id,
|
|
2265
|
+
"data-type": a.type,
|
|
2266
|
+
role: "button",
|
|
2267
|
+
tabindex: r.mode === "prepare" || D(a) ? 0 : -1,
|
|
2268
|
+
"aria-label": `${a.label ?? T(a.type)}${a.value ? "" : a.required ?? (a.type === "signature" || a.type === "initials") ? ` (${N(x).pdfSignRequired})` : ""}`,
|
|
2269
|
+
onClick: (e) => r.mode === "sign" ? W(a, !!a.value) : q.value = a.id,
|
|
2270
|
+
onPointerdown: (t) => ve(t, a, "move", {
|
|
2271
|
+
width: e.rotation % 180 ? e.height : e.width,
|
|
2272
|
+
height: e.rotation % 180 ? e.width : e.height
|
|
2273
|
+
}),
|
|
2274
|
+
onPointermove: ye,
|
|
2275
|
+
onPointerup: be,
|
|
2276
|
+
onPointercancel: be,
|
|
2277
|
+
onKeydown: (e) => Se(e, a)
|
|
2278
|
+
}, [a.value && (a.type === "signature" || a.type === "initials") ? (E(), _("img", {
|
|
2279
|
+
key: 0,
|
|
2280
|
+
src: a.value,
|
|
2281
|
+
alt: "",
|
|
2282
|
+
class: "h-full w-full object-contain",
|
|
2283
|
+
draggable: "false"
|
|
2284
|
+
}, null, 8, gt)) : a.type === "checkbox" && a.value === "true" ? (E(), h(t, {
|
|
2285
|
+
key: 1,
|
|
2286
|
+
name: "check",
|
|
2287
|
+
class: "text-on-surface",
|
|
2288
|
+
size: Math.max(12, e.height * a.height * .9)
|
|
2289
|
+
}, null, 8, ["size"])) : a.value ? (E(), _("span", {
|
|
2290
|
+
key: 2,
|
|
2291
|
+
class: "m3-pdf-sign-text w-full truncate px-1 text-left",
|
|
2292
|
+
style: w({ fontSize: `${Math.max(8, e.height * a.height * .6)}px` })
|
|
2293
|
+
}, j(a.value), 5)) : a.type === "checkbox" ? g("", !0) : (E(), _("span", _t, [b(t, {
|
|
2294
|
+
name: re[a.type].icon,
|
|
2295
|
+
size: 16
|
|
2296
|
+
}, null, 8, ["name"]), v("span", vt, j(a.type === "signature" && r.mode === "sign" ? N(x).pdfSignHere : a.label ?? T(a.type)), 1)])), r.mode === "prepare" && q.value === a.id ? (E(), _(f, { key: 4 }, [v("span", {
|
|
2297
|
+
class: "absolute -right-1.5 -bottom-1.5 h-3 w-3 cursor-nwse-resize rounded-full border-2 border-surface bg-primary touch-none",
|
|
2298
|
+
"aria-hidden": "true",
|
|
2299
|
+
onPointerdown: (t) => ve(t, a, "resize", {
|
|
2300
|
+
width: e.rotation % 180 ? e.height : e.width,
|
|
2301
|
+
height: e.rotation % 180 ? e.width : e.height
|
|
2302
|
+
})
|
|
2303
|
+
}, null, 40, yt), v("div", {
|
|
2304
|
+
class: "absolute -top-11 left-0 flex items-center gap-1 rounded-full bg-surface-container-high px-1 shadow-elevation-2",
|
|
2305
|
+
onPointerdown: i[1] ||= ce(() => {}, ["stop"])
|
|
2306
|
+
}, [b(c, {
|
|
2307
|
+
variant: a.required ?? (a.type === "signature" || a.type === "initials") ? "filled" : "text",
|
|
2308
|
+
size: "xs",
|
|
2309
|
+
onClick: ce((e) => L(a.id, { required: !(a.required ?? (a.type === "signature" || a.type === "initials")) }), ["stop"])
|
|
2310
|
+
}, {
|
|
2311
|
+
default: I(() => [y(j(N(x).pdfSignRequired), 1)]),
|
|
2312
|
+
_: 1
|
|
2313
|
+
}, 8, ["variant", "onClick"]), b(n, {
|
|
2314
|
+
icon: "delete",
|
|
2315
|
+
size: "xs",
|
|
2316
|
+
label: N(x).pdfSignDelete,
|
|
2317
|
+
onClick: ce((e) => _e(a.id), ["stop"])
|
|
2318
|
+
}, null, 8, ["label", "onClick"])], 32)], 64)) : g("", !0)], 46, ht))), 128))], 4)])]),
|
|
2319
|
+
_: 1
|
|
2320
|
+
}, 8, ["src", "worker-src"]),
|
|
2321
|
+
b(l, {
|
|
2322
|
+
"model-value": !!z.value,
|
|
2323
|
+
title: z.value ? z.value.field.label ?? T(z.value.field.type) : "",
|
|
2324
|
+
"max-width": "560px",
|
|
2325
|
+
"onUpdate:modelValue": i[11] ||= (e) => {
|
|
2326
|
+
e || (z.value = null);
|
|
2327
|
+
}
|
|
2328
|
+
}, {
|
|
2329
|
+
actions: I(() => [b(c, {
|
|
2330
|
+
variant: "text",
|
|
2331
|
+
onClick: i[10] ||= (e) => z.value = null
|
|
2332
|
+
}, {
|
|
2333
|
+
default: I(() => [y(j(N(x).cancel), 1)]),
|
|
2334
|
+
_: 1
|
|
2335
|
+
}), b(c, {
|
|
2336
|
+
disabled: !pe.value,
|
|
2337
|
+
onClick: G
|
|
2338
|
+
}, {
|
|
2339
|
+
default: I(() => [y(j(fe.value ? N(x).pdfSignAdopt : N(x).ok), 1)]),
|
|
2340
|
+
_: 1
|
|
2341
|
+
}, 8, ["disabled"])]),
|
|
2342
|
+
default: I(() => [z.value ? (E(), _("div", bt, [fe.value ? (E(), _(f, { key: 0 }, [b(d, {
|
|
2343
|
+
modelValue: z.value.tab,
|
|
2344
|
+
"onUpdate:modelValue": i[4] ||= (e) => z.value.tab = e,
|
|
2345
|
+
options: [{
|
|
2346
|
+
value: "draw",
|
|
2347
|
+
label: N(x).pdfSignDraw,
|
|
2348
|
+
icon: "draw"
|
|
2349
|
+
}, {
|
|
2350
|
+
value: "type",
|
|
2351
|
+
label: N(x).pdfSignTypeIt,
|
|
2352
|
+
icon: "keyboard"
|
|
2353
|
+
}],
|
|
2354
|
+
density: "compact"
|
|
2355
|
+
}, null, 8, ["modelValue", "options"]), z.value.tab === "draw" ? (E(), _("div", {
|
|
2356
|
+
key: 0,
|
|
2357
|
+
ref_key: "padBox",
|
|
2358
|
+
ref: H,
|
|
2359
|
+
class: "flex flex-col gap-2"
|
|
2360
|
+
}, [(E(), h(o, {
|
|
2361
|
+
ref_key: "pad",
|
|
2362
|
+
ref: B,
|
|
2363
|
+
key: U.value,
|
|
2364
|
+
width: U.value,
|
|
2365
|
+
height: 180,
|
|
2366
|
+
onEnd: i[5] ||= (e) => V.value = !1,
|
|
2367
|
+
onChange: i[6] ||= (e) => V.value = !!B.value?.isEmpty()
|
|
2368
|
+
}, null, 8, ["width"])), b(c, {
|
|
2369
|
+
variant: "text",
|
|
2370
|
+
icon: "ink_eraser",
|
|
2371
|
+
class: "self-start",
|
|
2372
|
+
onClick: i[7] ||= (e) => {
|
|
2373
|
+
B.value?.clear(), V.value = !0;
|
|
2374
|
+
}
|
|
2375
|
+
}, {
|
|
2376
|
+
default: I(() => [y(j(N(x).clear), 1)]),
|
|
2377
|
+
_: 1
|
|
2378
|
+
})], 512)) : (E(), _(f, { key: 1 }, [b(s, {
|
|
2379
|
+
modelValue: z.value.text,
|
|
2380
|
+
"onUpdate:modelValue": i[8] ||= (e) => z.value.text = e,
|
|
2381
|
+
label: T(z.value.field.type),
|
|
2382
|
+
autocomplete: "name"
|
|
2383
|
+
}, null, 8, ["modelValue", "label"]), v("div", {
|
|
2384
|
+
class: "flex h-24 items-center overflow-hidden rounded-lg bg-surface-container-highest px-4 text-[2.5rem] text-[#1a237e] dark:text-[#c5cae9]",
|
|
2385
|
+
style: w({ fontFamily: xt })
|
|
2386
|
+
}, j(z.value.text), 5)], 64))], 64)) : (E(), h(s, {
|
|
2387
|
+
key: 1,
|
|
2388
|
+
modelValue: z.value.text,
|
|
2389
|
+
"onUpdate:modelValue": i[9] ||= (e) => z.value.text = e,
|
|
2390
|
+
label: z.value.field.label ?? T(z.value.field.type),
|
|
2391
|
+
onKeydown: se(G, ["enter"])
|
|
2392
|
+
}, null, 8, ["modelValue", "label"]))])) : g("", !0)]),
|
|
2393
|
+
_: 1
|
|
2394
|
+
}, 8, ["model-value", "title"])
|
|
2395
|
+
], 16));
|
|
1855
2396
|
}
|
|
1856
2397
|
});
|
|
1857
|
-
export {
|
|
2398
|
+
export { St as MPdfSigner, ot as MPdfViewer, st as fieldMissing, z as setPdfWorker, ct as shownToUser, dt as signPdf, le as usePdf };
|
|
1858
2399
|
|
|
1859
2400
|
//# sourceMappingURL=pdf.js.map
|