@peeekpage/viewer 0.3.13 → 0.3.15
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/index.d.ts +1 -0
- package/dist/index.js +487 -360
- package/dist/peeekviewer.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
1
|
+
import { jsxs as y, jsx as a, Fragment as Ze } from "react/jsx-runtime";
|
|
2
|
+
import { useState as w, useRef as O, useEffect as T, useCallback as F, useMemo as Ue } from "react";
|
|
3
|
+
const je = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
4
|
+
function B(t) {
|
|
5
5
|
if (typeof t != "string") return null;
|
|
6
6
|
const e = t.trim();
|
|
7
7
|
if (e === "" || e.includes(" ")) return null;
|
|
@@ -12,23 +12,23 @@ function Z(t) {
|
|
|
12
12
|
} catch {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return je.has(r.protocol) ? r.href : null;
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
function
|
|
17
|
+
const He = /^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, Ve = /^rgba?\([ \t]*\d{1,3}[ \t]*,[ \t]*\d{1,3}[ \t]*,[ \t]*\d{1,3}[ \t]*(?:,[ \t]*(?:0|1|0?\.\d+)[ \t]*)?\)$/;
|
|
18
|
+
function ge(t) {
|
|
19
19
|
if (typeof t != "string") return null;
|
|
20
20
|
const e = t.trim();
|
|
21
|
-
return
|
|
21
|
+
return He.test(e) || Ve.test(e) ? e : null;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const Xe = /url\(|image\(|image-set\(|element\(|expression|@|\/\*|;|\{|\}|<|>|\\/i, Ge = /^(repeating-)?(linear|radial|conic)-gradient\([a-z0-9#.,%()\/\s-]*\)$/i, Ye = /^hsla?\([a-z0-9.,%\/\s-]*\)$/i;
|
|
24
|
+
function We(t) {
|
|
25
25
|
if (typeof t != "string") return null;
|
|
26
26
|
const e = t.trim();
|
|
27
|
-
if (e === "" ||
|
|
28
|
-
const n =
|
|
27
|
+
if (e === "" || Xe.test(e)) return null;
|
|
28
|
+
const n = ge(e);
|
|
29
29
|
return n !== null ? n : Ye.test(e) || Ge.test(e) ? e : null;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const qe = ["en", "pt-BR"], pe = {
|
|
32
32
|
prev: "Previous page",
|
|
33
33
|
next: "Next page",
|
|
34
34
|
zoom: "Zoom level",
|
|
@@ -41,8 +41,16 @@ const We = ["en", "pt-BR"], ge = {
|
|
|
41
41
|
page: "page",
|
|
42
42
|
pages: "pages",
|
|
43
43
|
loading: "Loading document…",
|
|
44
|
-
error: "Could not load this document."
|
|
45
|
-
|
|
44
|
+
error: "Could not load this document.",
|
|
45
|
+
about: "About",
|
|
46
|
+
aboutTagline: "Embeddable document viewer by Peeek Page",
|
|
47
|
+
aboutDescription: "Peeek Viewer shows document pages that live in your own storage, so your files stay yours.",
|
|
48
|
+
aboutLearnMore: "Learn more",
|
|
49
|
+
aboutDocs: "Documentation",
|
|
50
|
+
aboutReport: "Report a problem",
|
|
51
|
+
aboutLegal: "Legal",
|
|
52
|
+
aboutClose: "Close"
|
|
53
|
+
}, Ke = {
|
|
46
54
|
prev: "Página anterior",
|
|
47
55
|
next: "Próxima página",
|
|
48
56
|
zoom: "Nível de zoom",
|
|
@@ -55,88 +63,97 @@ const We = ["en", "pt-BR"], ge = {
|
|
|
55
63
|
page: "página",
|
|
56
64
|
pages: "páginas",
|
|
57
65
|
loading: "Carregando documento…",
|
|
58
|
-
error: "Não foi possível carregar este documento."
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
error: "Não foi possível carregar este documento.",
|
|
67
|
+
about: "Sobre",
|
|
68
|
+
aboutTagline: "Visualizador de documentos incorporável do Peeek Page",
|
|
69
|
+
aboutDescription: "O Peeek Viewer exibe as páginas de documentos que ficam no seu próprio armazenamento, então seus arquivos continuam seus.",
|
|
70
|
+
aboutLearnMore: "Saiba mais",
|
|
71
|
+
aboutDocs: "Documentação",
|
|
72
|
+
aboutReport: "Relatar um problema",
|
|
73
|
+
aboutLegal: "Aviso legal",
|
|
74
|
+
aboutClose: "Fechar"
|
|
75
|
+
}, Je = { en: pe, "pt-BR": Ke };
|
|
76
|
+
function Qe(t) {
|
|
77
|
+
return Je[t] ?? pe;
|
|
62
78
|
}
|
|
63
|
-
const
|
|
64
|
-
function
|
|
79
|
+
const et = "#6E79D6";
|
|
80
|
+
function I(t, e) {
|
|
65
81
|
return typeof t == "boolean" ? t : e;
|
|
66
82
|
}
|
|
67
|
-
function
|
|
83
|
+
function H(t, e, n) {
|
|
68
84
|
return e.includes(t) ? t : n;
|
|
69
85
|
}
|
|
70
|
-
function
|
|
86
|
+
function tt(t) {
|
|
71
87
|
return {
|
|
72
88
|
src: typeof t.src == "string" ? t.src : "",
|
|
73
|
-
mode:
|
|
74
|
-
logo:
|
|
75
|
-
logoLink:
|
|
76
|
-
accentColor:
|
|
77
|
-
background:
|
|
78
|
-
backgroundColor:
|
|
79
|
-
backgroundImage:
|
|
80
|
-
layout:
|
|
81
|
-
fillHeight:
|
|
82
|
-
pageShadows:
|
|
83
|
-
rtl:
|
|
84
|
-
animateInteractions:
|
|
85
|
-
skin:
|
|
86
|
-
language:
|
|
87
|
-
autoTransition:
|
|
89
|
+
mode: H(t.mode, ["flip", "coverflow"], "flip"),
|
|
90
|
+
logo: B(t.logo),
|
|
91
|
+
logoLink: B(t.logoLink),
|
|
92
|
+
accentColor: ge(t.accentColor) ?? et,
|
|
93
|
+
background: H(t.background, ["color", "image", "transparent"], "color"),
|
|
94
|
+
backgroundColor: We(t.backgroundColor),
|
|
95
|
+
backgroundImage: B(t.backgroundImage),
|
|
96
|
+
layout: H(t.layout, ["single", "double"], "double"),
|
|
97
|
+
fillHeight: I(t.fillHeight, !1),
|
|
98
|
+
pageShadows: I(t.pageShadows, !0),
|
|
99
|
+
rtl: I(t.rtl, !1),
|
|
100
|
+
animateInteractions: I(t.animateInteractions, !0),
|
|
101
|
+
skin: H(t.skin, ["classic", "minimal", "showcase"], "classic"),
|
|
102
|
+
language: H(t.language, qe, "en"),
|
|
103
|
+
autoTransition: I(t.autoTransition, !1),
|
|
88
104
|
autoTransitionInterval: typeof t.autoTransitionInterval == "number" && t.autoTransitionInterval > 0 ? t.autoTransitionInterval : 5e3,
|
|
89
|
-
navigationControls:
|
|
90
|
-
fullscreen:
|
|
91
|
-
arrows:
|
|
92
|
-
navigationBar:
|
|
93
|
-
pagesOverview:
|
|
94
|
-
downloadUrl:
|
|
105
|
+
navigationControls: I(t.navigationControls, !0),
|
|
106
|
+
fullscreen: I(t.fullscreen, !0),
|
|
107
|
+
arrows: I(t.arrows, !0),
|
|
108
|
+
navigationBar: I(t.navigationBar, !0),
|
|
109
|
+
pagesOverview: I(t.pagesOverview, !0),
|
|
110
|
+
downloadUrl: B(t.downloadUrl),
|
|
111
|
+
aboutButton: I(t.aboutButton, !0),
|
|
95
112
|
pollInterval: typeof t.pollInterval == "number" && t.pollInterval > 0 ? t.pollInterval : 2e3,
|
|
96
113
|
className: typeof t.className == "string" ? t.className : ""
|
|
97
114
|
};
|
|
98
115
|
}
|
|
99
|
-
const
|
|
100
|
-
function
|
|
116
|
+
const ae = 5e3;
|
|
117
|
+
function V(t) {
|
|
101
118
|
return typeof t == "string" ? t : "";
|
|
102
119
|
}
|
|
103
|
-
function
|
|
120
|
+
function nt(t) {
|
|
104
121
|
if (t === null || typeof t != "object" || Array.isArray(t))
|
|
105
122
|
return { ok: !1, error: "manifest is not an object" };
|
|
106
123
|
const e = t;
|
|
107
124
|
if (!Array.isArray(e.pages))
|
|
108
125
|
return { ok: !1, error: "manifest.pages is missing or not an array" };
|
|
109
|
-
if (e.pages.length >
|
|
126
|
+
if (e.pages.length > ae)
|
|
110
127
|
return { ok: !1, error: "manifest.pages exceeds the maximum" };
|
|
111
128
|
const n = e.total_pages, r = typeof n == "number" && Number.isFinite(n) && n >= 0 ? n : e.pages.length;
|
|
112
|
-
if (r >
|
|
129
|
+
if (r > ae)
|
|
113
130
|
return { ok: !1, error: "manifest.total_pages exceeds the maximum" };
|
|
114
131
|
const l = [];
|
|
115
|
-
for (const
|
|
116
|
-
if (
|
|
117
|
-
const
|
|
118
|
-
|
|
132
|
+
for (const d of e.pages) {
|
|
133
|
+
if (d === null || typeof d != "object") continue;
|
|
134
|
+
const c = B(d.url);
|
|
135
|
+
c && l.push(c);
|
|
119
136
|
}
|
|
120
137
|
if (l.length === 0)
|
|
121
138
|
return { ok: !1, error: "manifest has no usable pages" };
|
|
122
|
-
const
|
|
123
|
-
fileId:
|
|
124
|
-
filename:
|
|
125
|
-
creationDate:
|
|
126
|
-
fileSize:
|
|
127
|
-
mimeType:
|
|
139
|
+
const i = e.status === "wip" ? "wip" : "done", p = e.metadata && typeof e.metadata == "object" ? e.metadata : {}, b = {
|
|
140
|
+
fileId: V(p.file_id),
|
|
141
|
+
filename: V(p.filename),
|
|
142
|
+
creationDate: V(p.creation_date),
|
|
143
|
+
fileSize: V(p.file_size),
|
|
144
|
+
mimeType: V(p.mime_type)
|
|
128
145
|
};
|
|
129
146
|
return {
|
|
130
147
|
ok: !0,
|
|
131
|
-
value: { status:
|
|
148
|
+
value: { status: i, totalPages: r, pages: l, metadata: b }
|
|
132
149
|
};
|
|
133
150
|
}
|
|
134
|
-
function
|
|
135
|
-
if (!Array.isArray(t) || t.length >
|
|
151
|
+
function at(t, e) {
|
|
152
|
+
if (!Array.isArray(t) || t.length > ae) return null;
|
|
136
153
|
const n = [];
|
|
137
154
|
for (const l of t) {
|
|
138
|
-
const
|
|
139
|
-
|
|
155
|
+
const i = B(l);
|
|
156
|
+
i && n.push(i);
|
|
140
157
|
}
|
|
141
158
|
return n.length === 0 ? null : {
|
|
142
159
|
status: "done",
|
|
@@ -152,43 +169,43 @@ function nt(t, e) {
|
|
|
152
169
|
};
|
|
153
170
|
}
|
|
154
171
|
function rt(t, e) {
|
|
155
|
-
const [n, r] =
|
|
156
|
-
return
|
|
157
|
-
let
|
|
158
|
-
if (r("loading"),
|
|
159
|
-
const
|
|
160
|
-
|
|
161
|
-
},
|
|
172
|
+
const [n, r] = w("loading"), [l, i] = w(null), [p, b] = w(null), d = O(null);
|
|
173
|
+
return T(() => {
|
|
174
|
+
let c = !1;
|
|
175
|
+
if (r("loading"), i(null), b(null), !t) return;
|
|
176
|
+
const h = () => {
|
|
177
|
+
d.current !== null && (clearTimeout(d.current), d.current = null);
|
|
178
|
+
}, _ = async () => {
|
|
162
179
|
let u;
|
|
163
180
|
try {
|
|
164
|
-
const
|
|
165
|
-
if (!
|
|
166
|
-
u = await
|
|
167
|
-
} catch (
|
|
168
|
-
if (
|
|
169
|
-
|
|
181
|
+
const s = await fetch(t);
|
|
182
|
+
if (!s.ok) throw new Error(`HTTP ${s.status}`);
|
|
183
|
+
u = await s.json();
|
|
184
|
+
} catch (s) {
|
|
185
|
+
if (c) return;
|
|
186
|
+
b(s instanceof Error ? s.message : "fetch failed"), r("error");
|
|
170
187
|
return;
|
|
171
188
|
}
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
if (!
|
|
175
|
-
|
|
189
|
+
if (c) return;
|
|
190
|
+
const f = nt(u);
|
|
191
|
+
if (!f.ok) {
|
|
192
|
+
b(f.error), r("error");
|
|
176
193
|
return;
|
|
177
194
|
}
|
|
178
|
-
|
|
195
|
+
i(f.value), r("ready"), f.value.status === "wip" && (d.current = setTimeout(_, e));
|
|
179
196
|
};
|
|
180
|
-
return
|
|
181
|
-
|
|
197
|
+
return _(), () => {
|
|
198
|
+
c = !0, h();
|
|
182
199
|
};
|
|
183
|
-
}, [t, e]), { state: n, manifest: l, error:
|
|
200
|
+
}, [t, e]), { state: n, manifest: l, error: p };
|
|
184
201
|
}
|
|
185
|
-
function
|
|
186
|
-
const [e, n] =
|
|
187
|
-
|
|
202
|
+
function ot(t) {
|
|
203
|
+
const [e, n] = w(!1);
|
|
204
|
+
T(() => {
|
|
188
205
|
const l = () => n(document.fullscreenElement != null);
|
|
189
206
|
return document.addEventListener("fullscreenchange", l), () => document.removeEventListener("fullscreenchange", l);
|
|
190
207
|
}, []);
|
|
191
|
-
const r =
|
|
208
|
+
const r = F(async () => {
|
|
192
209
|
const l = t.current;
|
|
193
210
|
if (l)
|
|
194
211
|
try {
|
|
@@ -199,12 +216,12 @@ function at(t) {
|
|
|
199
216
|
return { isFullscreen: e, toggle: r };
|
|
200
217
|
}
|
|
201
218
|
const fe = "(prefers-reduced-motion: reduce)";
|
|
202
|
-
function
|
|
203
|
-
const [t, e] =
|
|
219
|
+
function be() {
|
|
220
|
+
const [t, e] = w(() => {
|
|
204
221
|
var n;
|
|
205
222
|
return ((n = matchMedia == null ? void 0 : matchMedia(fe)) == null ? void 0 : n.matches) ?? !1;
|
|
206
223
|
});
|
|
207
|
-
return
|
|
224
|
+
return T(() => {
|
|
208
225
|
const n = typeof matchMedia == "function" ? matchMedia(fe) : void 0;
|
|
209
226
|
if (!(n != null && n.addEventListener)) return;
|
|
210
227
|
const r = () => e(n.matches);
|
|
@@ -214,7 +231,7 @@ function pe() {
|
|
|
214
231
|
function re(t, e) {
|
|
215
232
|
return t <= 0 ? 0 : e === "single" ? t : 1 + Math.ceil((t - 1) / 2);
|
|
216
233
|
}
|
|
217
|
-
function
|
|
234
|
+
function lt(t, e) {
|
|
218
235
|
return e === "single" ? t : t <= 0 ? 0 : Math.floor((t - 1) / 2) + 1;
|
|
219
236
|
}
|
|
220
237
|
function Y(t, e, n) {
|
|
@@ -227,84 +244,85 @@ function Y(t, e, n) {
|
|
|
227
244
|
return { left: r < e ? r : -1, right: l < e ? l : -1 };
|
|
228
245
|
}
|
|
229
246
|
function he(t, e, n) {
|
|
230
|
-
const { left: r, right: l } = Y(t, e, n),
|
|
231
|
-
return r >= 0 &&
|
|
247
|
+
const { left: r, right: l } = Y(t, e, n), i = [];
|
|
248
|
+
return r >= 0 && i.push(r), l >= 0 && i.push(l), i;
|
|
232
249
|
}
|
|
233
|
-
function
|
|
250
|
+
function ee(t, e, n) {
|
|
234
251
|
const r = re(e, n) - 1;
|
|
235
252
|
return t < 0 ? 0 : t > r ? r : t;
|
|
236
253
|
}
|
|
237
|
-
function
|
|
254
|
+
function st(t) {
|
|
238
255
|
const {
|
|
239
256
|
strings: e,
|
|
240
257
|
label: n,
|
|
241
258
|
progress: r,
|
|
242
259
|
zoom: l,
|
|
243
|
-
minZoom:
|
|
244
|
-
maxZoom:
|
|
245
|
-
thumbsOpen:
|
|
246
|
-
isFullscreen:
|
|
247
|
-
downloadUrl:
|
|
248
|
-
show:
|
|
249
|
-
onZoomIn:
|
|
260
|
+
minZoom: i,
|
|
261
|
+
maxZoom: p,
|
|
262
|
+
thumbsOpen: b,
|
|
263
|
+
isFullscreen: d,
|
|
264
|
+
downloadUrl: c,
|
|
265
|
+
show: h,
|
|
266
|
+
onZoomIn: _,
|
|
250
267
|
onZoomOut: u,
|
|
251
|
-
onZoomSet:
|
|
252
|
-
onToggleThumbs:
|
|
253
|
-
onToggleFullscreen:
|
|
268
|
+
onZoomSet: f,
|
|
269
|
+
onToggleThumbs: s,
|
|
270
|
+
onToggleFullscreen: P,
|
|
271
|
+
onAbout: Z
|
|
254
272
|
} = t;
|
|
255
|
-
return /* @__PURE__ */
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
|
|
258
|
-
/* @__PURE__ */
|
|
273
|
+
return /* @__PURE__ */ y("div", { className: "peeek__toolbar", children: [
|
|
274
|
+
/* @__PURE__ */ a("span", { className: "peeek__label", children: n }),
|
|
275
|
+
h.bar && /* @__PURE__ */ a("div", { className: "peeek__scrubber", "aria-hidden": !0, children: /* @__PURE__ */ a("div", { className: "peeek__scrubber-fill", style: { width: `${r}%` } }) }),
|
|
276
|
+
/* @__PURE__ */ a(
|
|
259
277
|
"button",
|
|
260
278
|
{
|
|
261
279
|
type: "button",
|
|
262
280
|
className: "peeek__btn",
|
|
263
281
|
"aria-label": e.zoomOut,
|
|
264
|
-
disabled: l <=
|
|
282
|
+
disabled: l <= i,
|
|
265
283
|
onClick: u,
|
|
266
284
|
children: "−"
|
|
267
285
|
}
|
|
268
286
|
),
|
|
269
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ a(
|
|
270
288
|
"input",
|
|
271
289
|
{
|
|
272
290
|
type: "range",
|
|
273
291
|
"aria-label": e.zoom,
|
|
274
|
-
min:
|
|
275
|
-
max:
|
|
292
|
+
min: i,
|
|
293
|
+
max: p,
|
|
276
294
|
step: 0.25,
|
|
277
295
|
value: l,
|
|
278
|
-
onChange: (
|
|
296
|
+
onChange: (N) => f(Number(N.target.value))
|
|
279
297
|
}
|
|
280
298
|
),
|
|
281
|
-
/* @__PURE__ */
|
|
299
|
+
/* @__PURE__ */ a(
|
|
282
300
|
"button",
|
|
283
301
|
{
|
|
284
302
|
type: "button",
|
|
285
303
|
className: "peeek__btn",
|
|
286
304
|
"aria-label": e.zoomIn,
|
|
287
|
-
disabled: l >=
|
|
288
|
-
onClick:
|
|
305
|
+
disabled: l >= p,
|
|
306
|
+
onClick: _,
|
|
289
307
|
children: "+"
|
|
290
308
|
}
|
|
291
309
|
),
|
|
292
|
-
|
|
310
|
+
h.thumbnails && /* @__PURE__ */ a(
|
|
293
311
|
"button",
|
|
294
312
|
{
|
|
295
313
|
type: "button",
|
|
296
|
-
className: `peeek__btn${
|
|
314
|
+
className: `peeek__btn${b ? " peeek__btn--active" : ""}`,
|
|
297
315
|
"aria-label": e.thumbnails,
|
|
298
|
-
"aria-pressed":
|
|
299
|
-
onClick:
|
|
316
|
+
"aria-pressed": b,
|
|
317
|
+
onClick: s,
|
|
300
318
|
children: "▦"
|
|
301
319
|
}
|
|
302
320
|
),
|
|
303
|
-
|
|
321
|
+
c && /* @__PURE__ */ a(
|
|
304
322
|
"a",
|
|
305
323
|
{
|
|
306
324
|
className: "peeek__btn",
|
|
307
|
-
href:
|
|
325
|
+
href: c,
|
|
308
326
|
"aria-label": e.download,
|
|
309
327
|
target: "_blank",
|
|
310
328
|
rel: "noopener noreferrer",
|
|
@@ -312,200 +330,211 @@ function lt(t) {
|
|
|
312
330
|
children: "↓"
|
|
313
331
|
}
|
|
314
332
|
),
|
|
315
|
-
|
|
333
|
+
h.fullscreen && /* @__PURE__ */ a(
|
|
316
334
|
"button",
|
|
317
335
|
{
|
|
318
336
|
type: "button",
|
|
319
|
-
className: `peeek__btn${
|
|
337
|
+
className: `peeek__btn${d ? " peeek__btn--active" : ""}`,
|
|
320
338
|
"aria-label": e.fullscreen,
|
|
321
|
-
"aria-pressed":
|
|
322
|
-
onClick:
|
|
339
|
+
"aria-pressed": d,
|
|
340
|
+
onClick: P,
|
|
323
341
|
children: "⛶"
|
|
324
342
|
}
|
|
343
|
+
),
|
|
344
|
+
h.about && /* @__PURE__ */ a(
|
|
345
|
+
"button",
|
|
346
|
+
{
|
|
347
|
+
type: "button",
|
|
348
|
+
className: "peeek__btn",
|
|
349
|
+
"aria-label": e.about,
|
|
350
|
+
onClick: Z,
|
|
351
|
+
children: "?"
|
|
352
|
+
}
|
|
325
353
|
)
|
|
326
354
|
] });
|
|
327
355
|
}
|
|
328
|
-
function
|
|
329
|
-
const
|
|
330
|
-
return /* @__PURE__ */
|
|
331
|
-
const
|
|
332
|
-
return /* @__PURE__ */
|
|
333
|
-
|
|
334
|
-
let
|
|
335
|
-
return
|
|
356
|
+
function it({ pages: t, layout: e, rtl: n, activePages: r, onJump: l }) {
|
|
357
|
+
const i = t.length, p = new Set(r), b = re(i, e);
|
|
358
|
+
return /* @__PURE__ */ a("div", { className: "peeek__thumbs", role: "group", "aria-label": "Pages", children: Array.from({ length: b }, (d, c) => {
|
|
359
|
+
const h = he(c, i, e), _ = h.length === 2;
|
|
360
|
+
return /* @__PURE__ */ y("div", { className: "peeek__thumb-group", children: [
|
|
361
|
+
h.map((u, f) => {
|
|
362
|
+
let s = "";
|
|
363
|
+
return _ && (s = (n ? f === 1 : f === 0) ? " peeek__thumb--flat-right" : " peeek__thumb--flat-left"), /* @__PURE__ */ a(
|
|
336
364
|
"button",
|
|
337
365
|
{
|
|
338
366
|
type: "button",
|
|
339
367
|
"aria-label": `Go to page ${u + 1}`,
|
|
340
|
-
"aria-current":
|
|
341
|
-
className: `peeek__thumb${
|
|
368
|
+
"aria-current": p.has(u),
|
|
369
|
+
className: `peeek__thumb${p.has(u) ? " peeek__thumb--active" : ""}${s}`,
|
|
342
370
|
onClick: () => l(u),
|
|
343
|
-
children: /* @__PURE__ */
|
|
371
|
+
children: /* @__PURE__ */ a("img", { src: t[u], alt: "", loading: "lazy", referrerPolicy: "no-referrer" })
|
|
344
372
|
},
|
|
345
373
|
u
|
|
346
374
|
);
|
|
347
375
|
}),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
] },
|
|
376
|
+
/* @__PURE__ */ a("span", { className: "peeek__thumb-badge", "aria-hidden": !0, children: h.map((u) => u + 1).join("-") })
|
|
377
|
+
] }, c);
|
|
350
378
|
}) });
|
|
351
379
|
}
|
|
352
|
-
const
|
|
353
|
-
function
|
|
380
|
+
const te = 1, ne = 2, me = 0.25;
|
|
381
|
+
function ct(t) {
|
|
354
382
|
const {
|
|
355
383
|
pages: e,
|
|
356
384
|
strings: n,
|
|
357
385
|
layout: r,
|
|
358
386
|
rtl: l,
|
|
359
|
-
pageShadows:
|
|
360
|
-
animateInteractions:
|
|
361
|
-
autoTransition:
|
|
362
|
-
autoTransitionInterval:
|
|
363
|
-
show:
|
|
364
|
-
downloadUrl:
|
|
365
|
-
isFullscreen:
|
|
366
|
-
onToggleFullscreen: u
|
|
367
|
-
|
|
368
|
-
$(()
|
|
387
|
+
pageShadows: i,
|
|
388
|
+
animateInteractions: p,
|
|
389
|
+
autoTransition: b,
|
|
390
|
+
autoTransitionInterval: d,
|
|
391
|
+
show: c,
|
|
392
|
+
downloadUrl: h,
|
|
393
|
+
isFullscreen: _,
|
|
394
|
+
onToggleFullscreen: u,
|
|
395
|
+
onAbout: f
|
|
396
|
+
} = t, s = e.length, P = re(s, r), N = be() || !p, [W, S] = w(0), [C, U] = w(1), [X, v] = w(!1), [g, $] = w({ x: 0, y: 0 }), [M, R] = w(!1), G = O(null), oe = O(null), [k, le] = w(null), se = O(null), [_e, ke] = w(0.707);
|
|
397
|
+
T(() => {
|
|
369
398
|
if (!e[0]) return;
|
|
370
|
-
const
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
},
|
|
399
|
+
const o = new globalThis.Image();
|
|
400
|
+
o.onload = () => {
|
|
401
|
+
o.naturalWidth && o.naturalHeight && ke(o.naturalWidth / o.naturalHeight);
|
|
402
|
+
}, o.src = e[0];
|
|
374
403
|
}, [e]);
|
|
375
|
-
const
|
|
376
|
-
(
|
|
377
|
-
k ||
|
|
378
|
-
const
|
|
379
|
-
return
|
|
404
|
+
const L = ee(W, s, r), ye = L <= 0, q = L >= P - 1, z = F(
|
|
405
|
+
(o) => {
|
|
406
|
+
k || S((m) => {
|
|
407
|
+
const x = ee(m + o, s, r);
|
|
408
|
+
return x === m ? m : N ? x : (le({ dir: o, to: x }), m);
|
|
380
409
|
});
|
|
381
410
|
},
|
|
382
|
-
[
|
|
383
|
-
),
|
|
384
|
-
|
|
411
|
+
[s, r, N, k]
|
|
412
|
+
), ve = F(() => {
|
|
413
|
+
le((o) => (o && S(o.to), null));
|
|
385
414
|
}, []);
|
|
386
|
-
|
|
415
|
+
T(() => {
|
|
387
416
|
if (!k) return;
|
|
388
|
-
const
|
|
389
|
-
if (!
|
|
390
|
-
|
|
391
|
-
let
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
|
|
417
|
+
const o = se.current;
|
|
418
|
+
if (!o) return;
|
|
419
|
+
o.style.transform = "rotateY(0deg)";
|
|
420
|
+
let m = 0;
|
|
421
|
+
const x = requestAnimationFrame(() => {
|
|
422
|
+
m = requestAnimationFrame(() => {
|
|
423
|
+
o.style.transform = `rotateY(${k.dir === 1 ? -180 : 180}deg)`;
|
|
395
424
|
});
|
|
396
425
|
});
|
|
397
426
|
return () => {
|
|
398
|
-
cancelAnimationFrame(
|
|
427
|
+
cancelAnimationFrame(x), cancelAnimationFrame(m);
|
|
399
428
|
};
|
|
400
429
|
}, [k]);
|
|
401
|
-
const
|
|
402
|
-
(
|
|
403
|
-
|
|
430
|
+
const we = F(
|
|
431
|
+
(o) => {
|
|
432
|
+
S(ee(lt(o, r), s, r));
|
|
404
433
|
},
|
|
405
|
-
[
|
|
406
|
-
),
|
|
407
|
-
(
|
|
408
|
-
|
|
434
|
+
[s, r]
|
|
435
|
+
), Ne = F(
|
|
436
|
+
(o) => {
|
|
437
|
+
o.key === "ArrowRight" ? z(l ? -1 : 1) : o.key === "ArrowLeft" && z(l ? 1 : -1);
|
|
409
438
|
},
|
|
410
|
-
[
|
|
439
|
+
[z, l]
|
|
411
440
|
);
|
|
412
|
-
|
|
413
|
-
if (!
|
|
414
|
-
const
|
|
415
|
-
return () => clearTimeout(
|
|
416
|
-
}, [
|
|
417
|
-
const Te = () =>
|
|
418
|
-
const
|
|
419
|
-
if (!
|
|
420
|
-
const
|
|
421
|
-
return { x: Math.max(-
|
|
441
|
+
T(() => {
|
|
442
|
+
if (!b || q) return;
|
|
443
|
+
const o = setTimeout(() => z(1), d);
|
|
444
|
+
return () => clearTimeout(o);
|
|
445
|
+
}, [b, d, q, L, z]);
|
|
446
|
+
const Te = () => U((o) => Math.min(ne, o + me)), Ce = () => U((o) => Math.max(te, o - me)), K = F((o, m, x) => {
|
|
447
|
+
const Q = oe.current;
|
|
448
|
+
if (!Q || x <= 1) return { x: 0, y: 0 };
|
|
449
|
+
const ue = (x - 1) * Q.clientWidth / 2, de = (x - 1) * Q.clientHeight / 2;
|
|
450
|
+
return { x: Math.max(-ue, Math.min(ue, o)), y: Math.max(-de, Math.min(de, m)) };
|
|
422
451
|
}, []);
|
|
423
|
-
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
},
|
|
427
|
-
const
|
|
428
|
-
|
|
429
|
-
},
|
|
452
|
+
T(() => $((o) => K(o.x, o.y, C)), [C, K]), T(() => $({ x: 0, y: 0 }), [L]);
|
|
453
|
+
const xe = (o) => {
|
|
454
|
+
C <= 1 || (G.current = { x: o.clientX, y: o.clientY, px: g.x, py: g.y }, R(!0), o.currentTarget.setPointerCapture(o.pointerId));
|
|
455
|
+
}, Ie = (o) => {
|
|
456
|
+
const m = G.current;
|
|
457
|
+
m && $(K(m.px + (o.clientX - m.x), m.py + (o.clientY - m.y), C));
|
|
458
|
+
}, ie = (o) => {
|
|
430
459
|
if (G.current) {
|
|
431
|
-
G.current = null,
|
|
460
|
+
G.current = null, R(!1);
|
|
432
461
|
try {
|
|
433
|
-
|
|
462
|
+
o.currentTarget.releasePointerCapture(o.pointerId);
|
|
434
463
|
} catch {
|
|
435
464
|
}
|
|
436
465
|
}
|
|
437
|
-
},
|
|
438
|
-
["left",
|
|
439
|
-
["right",
|
|
466
|
+
}, j = he(L, s, r), J = j[0] ?? 0, Pe = r === "double" && j.length === 2 ? `${j[0] + 1} - ${j[1] + 1} / ${s}` : `${J + 1} / ${s}`, $e = P <= 1 ? 100 : L / (P - 1) * 100, Me = n.prev, Le = n.next, Ae = k ? k.to : L, E = Y(Ae, s, r), Fe = E.left < 0 && E.right >= 0, Se = E.left >= 0 && E.right < 0, ze = E.left >= 0 && E.right >= 0, Ee = Fe ? "-25%" : Se ? "25%" : "0%", A = Y(L, s, r), D = k ? Y(k.to, s, r) : A, Oe = k ? k.dir === 1 ? A.right >= 0 ? A.right : A.left : A.left >= 0 ? A.left : A.right : J, Re = k ? k.dir === 1 ? D.left >= 0 ? D.left : D.right : D.right >= 0 ? D.right : D.left : J, De = k ? k.dir === 1 ? "left" : "right" : null, ce = (o) => o === De ? A[o] : E[o], Be = [
|
|
467
|
+
["left", ce("left")],
|
|
468
|
+
["right", ce("right")]
|
|
440
469
|
];
|
|
441
|
-
return /* @__PURE__ */
|
|
442
|
-
/* @__PURE__ */
|
|
470
|
+
return /* @__PURE__ */ y(Ze, { children: [
|
|
471
|
+
/* @__PURE__ */ y(
|
|
443
472
|
"div",
|
|
444
473
|
{
|
|
445
|
-
ref:
|
|
474
|
+
ref: oe,
|
|
446
475
|
className: "peeek__stage",
|
|
447
476
|
tabIndex: 0,
|
|
448
|
-
onKeyDown:
|
|
449
|
-
style: { "--peeek-aspect": `${
|
|
477
|
+
onKeyDown: Ne,
|
|
478
|
+
style: { "--peeek-aspect": `${_e}` },
|
|
450
479
|
children: [
|
|
451
|
-
|
|
480
|
+
c.arrows && /* @__PURE__ */ a(
|
|
452
481
|
"button",
|
|
453
482
|
{
|
|
454
483
|
type: "button",
|
|
455
484
|
className: "peeek__arrow peeek__arrow--prev",
|
|
456
|
-
"aria-label":
|
|
457
|
-
disabled:
|
|
458
|
-
onClick: () =>
|
|
485
|
+
"aria-label": Me,
|
|
486
|
+
disabled: ye,
|
|
487
|
+
onClick: () => z(-1),
|
|
459
488
|
children: "‹"
|
|
460
489
|
}
|
|
461
490
|
),
|
|
462
|
-
/* @__PURE__ */
|
|
491
|
+
/* @__PURE__ */ a(
|
|
463
492
|
"div",
|
|
464
493
|
{
|
|
465
|
-
className: `peeek__zoom${
|
|
494
|
+
className: `peeek__zoom${C > 1 ? " peeek__zoom--pannable" : ""}`,
|
|
466
495
|
style: {
|
|
467
|
-
transform: `translate(${
|
|
468
|
-
transition:
|
|
496
|
+
transform: `translate(${g.x}px, ${g.y}px) scale(${C})`,
|
|
497
|
+
transition: N || M ? "none" : void 0
|
|
469
498
|
},
|
|
470
|
-
onPointerDown:
|
|
471
|
-
onPointerMove:
|
|
472
|
-
onPointerUp:
|
|
473
|
-
onPointerCancel:
|
|
474
|
-
children: /* @__PURE__ */
|
|
499
|
+
onPointerDown: xe,
|
|
500
|
+
onPointerMove: Ie,
|
|
501
|
+
onPointerUp: ie,
|
|
502
|
+
onPointerCancel: ie,
|
|
503
|
+
children: /* @__PURE__ */ y(
|
|
475
504
|
"div",
|
|
476
505
|
{
|
|
477
|
-
className: `peeek__spread${
|
|
506
|
+
className: `peeek__spread${i ? " peeek--shadows" : ""}${ze ? " peeek__spread--pair" : ""}`,
|
|
478
507
|
style: { transform: `translateX(${Ee})` },
|
|
479
508
|
children: [
|
|
480
|
-
|
|
481
|
-
const
|
|
482
|
-
return /* @__PURE__ */
|
|
509
|
+
Be.map(([o, m]) => {
|
|
510
|
+
const x = m >= 0 && c.fullscreen && !_ && !k && C === 1;
|
|
511
|
+
return /* @__PURE__ */ a(
|
|
483
512
|
"div",
|
|
484
513
|
{
|
|
485
|
-
className: `peeek__page peeek__page--${
|
|
486
|
-
children:
|
|
514
|
+
className: `peeek__page peeek__page--${o}${m < 0 ? " peeek__page--empty" : ""}`,
|
|
515
|
+
children: m >= 0 && (x ? /* @__PURE__ */ a(
|
|
487
516
|
"button",
|
|
488
517
|
{
|
|
489
518
|
type: "button",
|
|
490
519
|
className: "peeek__page-btn",
|
|
491
520
|
"aria-label": n.openFullscreen,
|
|
492
521
|
onClick: u,
|
|
493
|
-
children: /* @__PURE__ */
|
|
522
|
+
children: /* @__PURE__ */ a("img", { src: e[m], alt: `Page ${m + 1}`, loading: "lazy", referrerPolicy: "no-referrer" })
|
|
494
523
|
}
|
|
495
|
-
) : /* @__PURE__ */
|
|
524
|
+
) : /* @__PURE__ */ a("img", { src: e[m], alt: `Page ${m + 1}`, loading: "lazy", referrerPolicy: "no-referrer" }))
|
|
496
525
|
},
|
|
497
|
-
|
|
526
|
+
o
|
|
498
527
|
);
|
|
499
528
|
}),
|
|
500
|
-
k && /* @__PURE__ */
|
|
529
|
+
k && /* @__PURE__ */ y(
|
|
501
530
|
"div",
|
|
502
531
|
{
|
|
503
|
-
ref:
|
|
532
|
+
ref: se,
|
|
504
533
|
className: `peeek__leaf peeek__leaf--${k.dir === 1 ? "fwd" : "back"}`,
|
|
505
|
-
onTransitionEnd:
|
|
534
|
+
onTransitionEnd: ve,
|
|
506
535
|
children: [
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
536
|
+
/* @__PURE__ */ a("div", { className: "peeek__leaf-face peeek__leaf-face--front", children: /* @__PURE__ */ a("img", { src: e[Oe], alt: "", referrerPolicy: "no-referrer" }) }),
|
|
537
|
+
/* @__PURE__ */ a("div", { className: "peeek__leaf-face peeek__leaf-face--back", children: /* @__PURE__ */ a("img", { src: e[Re], alt: "", referrerPolicy: "no-referrer" }) })
|
|
509
538
|
]
|
|
510
539
|
}
|
|
511
540
|
)
|
|
@@ -514,44 +543,45 @@ function it(t) {
|
|
|
514
543
|
)
|
|
515
544
|
}
|
|
516
545
|
),
|
|
517
|
-
|
|
546
|
+
c.arrows && /* @__PURE__ */ a(
|
|
518
547
|
"button",
|
|
519
548
|
{
|
|
520
549
|
type: "button",
|
|
521
550
|
className: "peeek__arrow peeek__arrow--next",
|
|
522
|
-
"aria-label":
|
|
523
|
-
disabled:
|
|
524
|
-
onClick: () =>
|
|
551
|
+
"aria-label": Le,
|
|
552
|
+
disabled: q,
|
|
553
|
+
onClick: () => z(1),
|
|
525
554
|
children: "›"
|
|
526
555
|
}
|
|
527
556
|
)
|
|
528
557
|
]
|
|
529
558
|
}
|
|
530
559
|
),
|
|
531
|
-
|
|
532
|
-
|
|
560
|
+
c.toolbar && /* @__PURE__ */ a(
|
|
561
|
+
st,
|
|
533
562
|
{
|
|
534
563
|
strings: n,
|
|
535
|
-
label:
|
|
564
|
+
label: Pe,
|
|
536
565
|
progress: $e,
|
|
537
|
-
zoom:
|
|
538
|
-
minZoom:
|
|
539
|
-
maxZoom:
|
|
540
|
-
thumbsOpen:
|
|
541
|
-
isFullscreen:
|
|
542
|
-
downloadUrl:
|
|
543
|
-
show: { bar:
|
|
566
|
+
zoom: C,
|
|
567
|
+
minZoom: te,
|
|
568
|
+
maxZoom: ne,
|
|
569
|
+
thumbsOpen: X,
|
|
570
|
+
isFullscreen: _,
|
|
571
|
+
downloadUrl: h,
|
|
572
|
+
show: { bar: c.bar, fullscreen: c.fullscreen, thumbnails: c.thumbnails && c.overview, about: c.about },
|
|
544
573
|
onZoomIn: Te,
|
|
545
|
-
onZoomOut:
|
|
546
|
-
onZoomSet: (
|
|
547
|
-
onToggleThumbs: () =>
|
|
548
|
-
onToggleFullscreen: u
|
|
574
|
+
onZoomOut: Ce,
|
|
575
|
+
onZoomSet: (o) => U(Math.min(ne, Math.max(te, o))),
|
|
576
|
+
onToggleThumbs: () => v((o) => !o),
|
|
577
|
+
onToggleFullscreen: u,
|
|
578
|
+
onAbout: f
|
|
549
579
|
}
|
|
550
580
|
),
|
|
551
|
-
|
|
581
|
+
c.overview && X && /* @__PURE__ */ a(it, { pages: e, layout: r, rtl: l, activePages: j, onJump: we })
|
|
552
582
|
] });
|
|
553
583
|
}
|
|
554
|
-
function
|
|
584
|
+
function ut(t, e) {
|
|
555
585
|
const n = e.toLowerCase();
|
|
556
586
|
if (n.includes("pdf")) return "PDF";
|
|
557
587
|
if (n.includes("wordprocessingml")) return "DOCX";
|
|
@@ -559,7 +589,7 @@ function ct(t, e) {
|
|
|
559
589
|
const r = t.toLowerCase().split(".").pop() ?? "";
|
|
560
590
|
return r ? r.toUpperCase().slice(0, 4) : "FILE";
|
|
561
591
|
}
|
|
562
|
-
function
|
|
592
|
+
function dt(t, e) {
|
|
563
593
|
if (t === 0) return { transform: "translateX(0) scale(1)", zIndex: 30, opacity: 1 };
|
|
564
594
|
const n = t < 0 ? -1 : 1, r = e ? -1 : 1;
|
|
565
595
|
return {
|
|
@@ -574,52 +604,53 @@ function ft(t) {
|
|
|
574
604
|
strings: n,
|
|
575
605
|
filename: r,
|
|
576
606
|
mimeType: l,
|
|
577
|
-
rtl:
|
|
578
|
-
autoTransition:
|
|
579
|
-
autoTransitionInterval:
|
|
580
|
-
downloadUrl:
|
|
581
|
-
isFullscreen:
|
|
582
|
-
onToggleFullscreen:
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
607
|
+
rtl: i,
|
|
608
|
+
autoTransition: p,
|
|
609
|
+
autoTransitionInterval: b,
|
|
610
|
+
downloadUrl: d,
|
|
611
|
+
isFullscreen: c,
|
|
612
|
+
onToggleFullscreen: h,
|
|
613
|
+
onAbout: _,
|
|
614
|
+
show: u
|
|
615
|
+
} = t, f = e.length, [s, P] = w(0), Z = be(), N = F(
|
|
616
|
+
(v) => P((g) => Math.max(0, Math.min(f - 1, g + v))),
|
|
617
|
+
[f]
|
|
618
|
+
), W = s <= 0, S = s >= f - 1, C = O([]);
|
|
619
|
+
T(() => {
|
|
620
|
+
var v, g;
|
|
621
|
+
(g = (v = C.current[s]) == null ? void 0 : v.scrollIntoView) == null || g.call(v, { behavior: "smooth", inline: "center", block: "nearest" });
|
|
622
|
+
}, [s]), T(() => {
|
|
623
|
+
if (!p || Z || S) return;
|
|
624
|
+
const v = setTimeout(() => N(1), b);
|
|
625
|
+
return () => clearTimeout(v);
|
|
626
|
+
}, [p, b, Z, S, s, N]);
|
|
627
|
+
const U = F(
|
|
628
|
+
(v) => {
|
|
629
|
+
v.key === "ArrowRight" ? N(i ? -1 : 1) : v.key === "ArrowLeft" && N(i ? 1 : -1);
|
|
599
630
|
},
|
|
600
|
-
[
|
|
601
|
-
),
|
|
602
|
-
return /* @__PURE__ */
|
|
603
|
-
/* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */
|
|
605
|
-
/* @__PURE__ */
|
|
606
|
-
/* @__PURE__ */
|
|
607
|
-
/* @__PURE__ */
|
|
608
|
-
|
|
631
|
+
[N, i]
|
|
632
|
+
), X = ut(r, l);
|
|
633
|
+
return /* @__PURE__ */ y("div", { className: "peeek__cf", children: [
|
|
634
|
+
/* @__PURE__ */ y("div", { className: "peeek__cf-header", children: [
|
|
635
|
+
/* @__PURE__ */ a("span", { className: "peeek__cf-badge", children: X }),
|
|
636
|
+
/* @__PURE__ */ y("div", { className: "peeek__cf-meta", children: [
|
|
637
|
+
/* @__PURE__ */ a("span", { className: "peeek__cf-name", children: r }),
|
|
638
|
+
/* @__PURE__ */ y("span", { className: "peeek__cf-count", children: [
|
|
639
|
+
f,
|
|
609
640
|
" ",
|
|
610
|
-
|
|
641
|
+
f === 1 ? n.page : n.pages
|
|
611
642
|
] })
|
|
612
643
|
] }),
|
|
613
|
-
/* @__PURE__ */
|
|
614
|
-
|
|
644
|
+
/* @__PURE__ */ y("span", { className: "peeek__cf-indicator", children: [
|
|
645
|
+
s + 1,
|
|
615
646
|
" / ",
|
|
616
|
-
|
|
647
|
+
f
|
|
617
648
|
] }),
|
|
618
|
-
|
|
649
|
+
d && /* @__PURE__ */ a(
|
|
619
650
|
"a",
|
|
620
651
|
{
|
|
621
652
|
className: "peeek__btn",
|
|
622
|
-
href:
|
|
653
|
+
href: d,
|
|
623
654
|
"aria-label": n.download,
|
|
624
655
|
target: "_blank",
|
|
625
656
|
rel: "noopener noreferrer",
|
|
@@ -627,113 +658,206 @@ function ft(t) {
|
|
|
627
658
|
children: "↓"
|
|
628
659
|
}
|
|
629
660
|
),
|
|
630
|
-
|
|
661
|
+
u.fullscreen && /* @__PURE__ */ a(
|
|
631
662
|
"button",
|
|
632
663
|
{
|
|
633
664
|
type: "button",
|
|
634
|
-
className: `peeek__btn${
|
|
665
|
+
className: `peeek__btn${c ? " peeek__btn--active" : ""}`,
|
|
635
666
|
"aria-label": n.fullscreen,
|
|
636
|
-
"aria-pressed":
|
|
637
|
-
onClick:
|
|
667
|
+
"aria-pressed": c,
|
|
668
|
+
onClick: h,
|
|
638
669
|
children: "⛶"
|
|
639
670
|
}
|
|
671
|
+
),
|
|
672
|
+
u.about && /* @__PURE__ */ a(
|
|
673
|
+
"button",
|
|
674
|
+
{
|
|
675
|
+
type: "button",
|
|
676
|
+
className: "peeek__btn",
|
|
677
|
+
"aria-label": n.about,
|
|
678
|
+
onClick: _,
|
|
679
|
+
children: "?"
|
|
680
|
+
}
|
|
640
681
|
)
|
|
641
682
|
] }),
|
|
642
|
-
/* @__PURE__ */
|
|
683
|
+
/* @__PURE__ */ y(
|
|
643
684
|
"div",
|
|
644
685
|
{
|
|
645
686
|
className: "peeek__cf-stage",
|
|
646
687
|
tabIndex: 0,
|
|
647
|
-
onKeyDown:
|
|
688
|
+
onKeyDown: U,
|
|
648
689
|
children: [
|
|
649
|
-
|
|
690
|
+
u.arrows && /* @__PURE__ */ a(
|
|
650
691
|
"button",
|
|
651
692
|
{
|
|
652
693
|
type: "button",
|
|
653
694
|
className: "peeek__arrow peeek__arrow--prev",
|
|
654
695
|
"aria-label": n.prev,
|
|
655
|
-
disabled:
|
|
656
|
-
onClick: () =>
|
|
696
|
+
disabled: W,
|
|
697
|
+
onClick: () => N(-1),
|
|
657
698
|
children: "‹"
|
|
658
699
|
}
|
|
659
700
|
),
|
|
660
|
-
e.map((
|
|
661
|
-
const
|
|
662
|
-
if (Math.abs(
|
|
663
|
-
const
|
|
664
|
-
return /* @__PURE__ */
|
|
701
|
+
e.map((v, g) => {
|
|
702
|
+
const $ = g - s;
|
|
703
|
+
if (Math.abs($) > 1) return null;
|
|
704
|
+
const M = $ === 0, R = M && u.fullscreen;
|
|
705
|
+
return /* @__PURE__ */ a(
|
|
665
706
|
"button",
|
|
666
707
|
{
|
|
667
708
|
type: "button",
|
|
668
|
-
className: `peeek__cf-card${
|
|
669
|
-
style:
|
|
670
|
-
tabIndex:
|
|
671
|
-
"aria-label":
|
|
672
|
-
onClick: () =>
|
|
673
|
-
children: /* @__PURE__ */
|
|
709
|
+
className: `peeek__cf-card${M ? " peeek__cf-card--center" : ""}${R ? " peeek__cf-card--zoom" : ""}`,
|
|
710
|
+
style: dt($, i),
|
|
711
|
+
tabIndex: M ? 0 : -1,
|
|
712
|
+
"aria-label": R ? n.openFullscreen : `Go to page ${g + 1}`,
|
|
713
|
+
onClick: () => R ? h() : P(g),
|
|
714
|
+
children: /* @__PURE__ */ a("img", { src: v, alt: M ? `Page ${g + 1}` : "", loading: "lazy", referrerPolicy: "no-referrer" })
|
|
674
715
|
},
|
|
675
|
-
|
|
716
|
+
g
|
|
676
717
|
);
|
|
677
718
|
}),
|
|
678
|
-
|
|
719
|
+
u.arrows && /* @__PURE__ */ a(
|
|
679
720
|
"button",
|
|
680
721
|
{
|
|
681
722
|
type: "button",
|
|
682
723
|
className: "peeek__arrow peeek__arrow--next",
|
|
683
724
|
"aria-label": n.next,
|
|
684
|
-
disabled:
|
|
685
|
-
onClick: () =>
|
|
725
|
+
disabled: S,
|
|
726
|
+
onClick: () => N(1),
|
|
686
727
|
children: "›"
|
|
687
728
|
}
|
|
688
729
|
)
|
|
689
730
|
]
|
|
690
731
|
}
|
|
691
732
|
),
|
|
692
|
-
|
|
693
|
-
const
|
|
694
|
-
return /* @__PURE__ */
|
|
733
|
+
u.thumbnails && /* @__PURE__ */ a("div", { className: "peeek__cf-thumbs", role: "group", "aria-label": "Pages", children: e.map((v, g) => {
|
|
734
|
+
const $ = g === s;
|
|
735
|
+
return /* @__PURE__ */ y(
|
|
695
736
|
"button",
|
|
696
737
|
{
|
|
697
|
-
ref: (
|
|
698
|
-
|
|
738
|
+
ref: (M) => {
|
|
739
|
+
C.current[g] = M;
|
|
699
740
|
},
|
|
700
741
|
type: "button",
|
|
701
|
-
className: `peeek__cf-thumb${
|
|
702
|
-
"aria-label": `Go to page ${
|
|
703
|
-
"aria-current":
|
|
704
|
-
onClick: () =>
|
|
742
|
+
className: `peeek__cf-thumb${$ ? " peeek__cf-thumb--active" : ""}`,
|
|
743
|
+
"aria-label": `Go to page ${g + 1}`,
|
|
744
|
+
"aria-current": $ ? "page" : void 0,
|
|
745
|
+
onClick: () => P(g),
|
|
705
746
|
children: [
|
|
706
|
-
/* @__PURE__ */
|
|
707
|
-
/* @__PURE__ */
|
|
747
|
+
/* @__PURE__ */ a("img", { src: v, alt: "", loading: "lazy", referrerPolicy: "no-referrer" }),
|
|
748
|
+
/* @__PURE__ */ a("span", { className: "peeek__cf-thumb-num", children: String(g + 1).padStart(2, "0") })
|
|
708
749
|
]
|
|
709
750
|
},
|
|
710
|
-
|
|
751
|
+
g
|
|
711
752
|
);
|
|
712
753
|
}) })
|
|
713
754
|
] });
|
|
714
755
|
}
|
|
715
|
-
function
|
|
756
|
+
function mt({ logo: t, logoLink: e }) {
|
|
716
757
|
if (!t) return null;
|
|
717
|
-
const n = /* @__PURE__ */
|
|
718
|
-
return /* @__PURE__ */
|
|
758
|
+
const n = /* @__PURE__ */ a("img", { src: t, alt: "Logo", loading: "lazy", referrerPolicy: "no-referrer" });
|
|
759
|
+
return /* @__PURE__ */ a("div", { className: "peeek__branding", children: e ? /* @__PURE__ */ a("a", { href: e, target: "_blank", rel: "noopener noreferrer", children: n }) : n });
|
|
719
760
|
}
|
|
720
|
-
function
|
|
721
|
-
const
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
761
|
+
function gt({ strings: t, onClose: e }) {
|
|
762
|
+
const n = O(null);
|
|
763
|
+
T(() => {
|
|
764
|
+
var l;
|
|
765
|
+
(l = n.current) == null || l.focus();
|
|
766
|
+
}, []), T(() => {
|
|
767
|
+
const l = (i) => {
|
|
768
|
+
i.key === "Escape" && e();
|
|
769
|
+
};
|
|
770
|
+
return document.addEventListener("keydown", l), () => document.removeEventListener("keydown", l);
|
|
771
|
+
}, [e]);
|
|
772
|
+
const r = [
|
|
773
|
+
{ label: t.aboutLearnMore, href: "https://peeek.page" },
|
|
774
|
+
{ label: t.aboutDocs, href: "https://peeek.page/docs" },
|
|
775
|
+
{ label: t.aboutReport, href: "mailto:hello@cidral.dev" },
|
|
776
|
+
{ label: t.aboutLegal, href: "https://peeek.page/legal/tos" }
|
|
777
|
+
];
|
|
778
|
+
return /* @__PURE__ */ a("div", { className: "peeek__about-backdrop", onClick: e, children: /* @__PURE__ */ y(
|
|
779
|
+
"div",
|
|
780
|
+
{
|
|
781
|
+
role: "dialog",
|
|
782
|
+
"aria-modal": "true",
|
|
783
|
+
"aria-label": "Peeek Viewer",
|
|
784
|
+
className: "peeek__about",
|
|
785
|
+
onClick: (l) => l.stopPropagation(),
|
|
786
|
+
children: [
|
|
787
|
+
/* @__PURE__ */ a(
|
|
788
|
+
"button",
|
|
789
|
+
{
|
|
790
|
+
ref: n,
|
|
791
|
+
type: "button",
|
|
792
|
+
className: "peeek__about-close",
|
|
793
|
+
"aria-label": t.aboutClose,
|
|
794
|
+
onClick: e,
|
|
795
|
+
children: "×"
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
/* @__PURE__ */ y(
|
|
799
|
+
"svg",
|
|
800
|
+
{
|
|
801
|
+
className: "peeek__about-mark",
|
|
802
|
+
width: "40",
|
|
803
|
+
height: "40",
|
|
804
|
+
viewBox: "0 0 24 24",
|
|
805
|
+
fill: "none",
|
|
806
|
+
stroke: "currentColor",
|
|
807
|
+
strokeWidth: "1.6",
|
|
808
|
+
strokeLinecap: "round",
|
|
809
|
+
strokeLinejoin: "round",
|
|
810
|
+
"aria-hidden": "true",
|
|
811
|
+
children: [
|
|
812
|
+
/* @__PURE__ */ a("path", { d: "M7 3h7l4 4v11a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z" }),
|
|
813
|
+
/* @__PURE__ */ a("path", { d: "M14 3v4h4" }),
|
|
814
|
+
/* @__PURE__ */ a("path", { d: "M4 7v13a1 1 0 0 0 1 1h11" })
|
|
815
|
+
]
|
|
816
|
+
}
|
|
817
|
+
),
|
|
818
|
+
/* @__PURE__ */ a("div", { className: "peeek__about-name", children: "Peeek Viewer" }),
|
|
819
|
+
/* @__PURE__ */ a("div", { className: "peeek__about-tagline", children: t.aboutTagline }),
|
|
820
|
+
/* @__PURE__ */ y("div", { className: "peeek__about-version", children: [
|
|
821
|
+
"v",
|
|
822
|
+
"0.3.15"
|
|
823
|
+
] }),
|
|
824
|
+
/* @__PURE__ */ a("p", { className: "peeek__about-desc", children: t.aboutDescription }),
|
|
825
|
+
/* @__PURE__ */ a("div", { className: "peeek__about-links", children: r.map((l) => /* @__PURE__ */ y(
|
|
826
|
+
"a",
|
|
827
|
+
{
|
|
828
|
+
className: "peeek__about-link",
|
|
829
|
+
href: l.href,
|
|
830
|
+
target: "_blank",
|
|
831
|
+
rel: "noopener noreferrer",
|
|
832
|
+
children: [
|
|
833
|
+
/* @__PURE__ */ a("span", { children: l.label }),
|
|
834
|
+
/* @__PURE__ */ a("span", { className: "peeek__about-link-arrow", "aria-hidden": "true", children: "›" })
|
|
835
|
+
]
|
|
836
|
+
},
|
|
837
|
+
l.href
|
|
838
|
+
)) })
|
|
839
|
+
]
|
|
840
|
+
}
|
|
841
|
+
) });
|
|
842
|
+
}
|
|
843
|
+
function ht(t) {
|
|
844
|
+
const e = tt(t), n = Qe(e.language), r = O(null), { isFullscreen: l, toggle: i } = ot(r), [p, b] = w(!1), d = t.pages !== void 0, c = Ue(
|
|
845
|
+
() => d ? at(t.pages, { filename: t.filename, mimeType: t.mimeType }) : null,
|
|
846
|
+
[d, t.pages, t.filename, t.mimeType]
|
|
847
|
+
), h = rt(d ? null : e.src, e.pollInterval), _ = d ? c : h.manifest, u = d ? c ? "ready" : "loading" : h.state, f = {
|
|
725
848
|
"--peeek-accent": e.accentColor
|
|
726
849
|
};
|
|
727
|
-
e.background === "transparent" ?
|
|
728
|
-
const
|
|
850
|
+
e.background === "transparent" ? f["--peeek-bg"] = "transparent" : e.background === "color" && e.backgroundColor ? f["--peeek-bg"] = e.backgroundColor : e.background === "image" && e.backgroundImage && (f["--peeek-bg"] = `center / cover no-repeat url("${e.backgroundImage}")`);
|
|
851
|
+
const s = {
|
|
729
852
|
toolbar: e.navigationControls,
|
|
730
853
|
bar: e.navigationBar,
|
|
731
854
|
fullscreen: e.fullscreen,
|
|
732
855
|
thumbnails: e.pagesOverview,
|
|
733
856
|
arrows: e.arrows,
|
|
734
|
-
overview: e.pagesOverview
|
|
857
|
+
overview: e.pagesOverview,
|
|
858
|
+
about: e.aboutButton
|
|
735
859
|
};
|
|
736
|
-
return /* @__PURE__ */
|
|
860
|
+
return /* @__PURE__ */ y(
|
|
737
861
|
"div",
|
|
738
862
|
{
|
|
739
863
|
ref: r,
|
|
@@ -741,31 +865,32 @@ function pt(t) {
|
|
|
741
865
|
"data-skin": e.skin,
|
|
742
866
|
"data-layout": e.layout,
|
|
743
867
|
dir: e.rtl ? "rtl" : void 0,
|
|
744
|
-
style:
|
|
868
|
+
style: f,
|
|
745
869
|
children: [
|
|
746
|
-
/* @__PURE__ */
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
870
|
+
/* @__PURE__ */ a(mt, { logo: e.logo, logoLink: e.logoLink }),
|
|
871
|
+
u === "loading" && /* @__PURE__ */ a("div", { className: "peeek__state", children: n.loading }),
|
|
872
|
+
u === "error" && /* @__PURE__ */ a("div", { className: "peeek__state", children: n.error }),
|
|
873
|
+
u === "ready" && _ && e.mode === "coverflow" && /* @__PURE__ */ a(
|
|
750
874
|
ft,
|
|
751
875
|
{
|
|
752
|
-
pages:
|
|
876
|
+
pages: _.pages,
|
|
753
877
|
strings: n,
|
|
754
|
-
filename:
|
|
755
|
-
mimeType:
|
|
878
|
+
filename: _.metadata.filename,
|
|
879
|
+
mimeType: _.metadata.mimeType,
|
|
756
880
|
rtl: e.rtl,
|
|
757
881
|
autoTransition: e.autoTransition,
|
|
758
882
|
autoTransitionInterval: e.autoTransitionInterval,
|
|
759
883
|
downloadUrl: e.downloadUrl,
|
|
760
884
|
isFullscreen: l,
|
|
761
|
-
onToggleFullscreen:
|
|
762
|
-
|
|
885
|
+
onToggleFullscreen: i,
|
|
886
|
+
onAbout: () => b(!0),
|
|
887
|
+
show: { arrows: e.arrows, thumbnails: e.pagesOverview, fullscreen: e.fullscreen, about: e.aboutButton }
|
|
763
888
|
}
|
|
764
889
|
),
|
|
765
|
-
|
|
766
|
-
|
|
890
|
+
u === "ready" && _ && e.mode === "flip" && /* @__PURE__ */ a(
|
|
891
|
+
ct,
|
|
767
892
|
{
|
|
768
|
-
pages:
|
|
893
|
+
pages: _.pages,
|
|
769
894
|
strings: n,
|
|
770
895
|
layout: e.layout,
|
|
771
896
|
rtl: e.rtl,
|
|
@@ -773,16 +898,18 @@ function pt(t) {
|
|
|
773
898
|
animateInteractions: e.animateInteractions,
|
|
774
899
|
autoTransition: e.autoTransition,
|
|
775
900
|
autoTransitionInterval: e.autoTransitionInterval,
|
|
776
|
-
show:
|
|
901
|
+
show: s,
|
|
777
902
|
downloadUrl: e.downloadUrl,
|
|
778
903
|
isFullscreen: l,
|
|
779
|
-
onToggleFullscreen:
|
|
904
|
+
onToggleFullscreen: i,
|
|
905
|
+
onAbout: () => b(!0)
|
|
780
906
|
}
|
|
781
|
-
)
|
|
907
|
+
),
|
|
908
|
+
p && /* @__PURE__ */ a(gt, { strings: n, onClose: () => b(!1) })
|
|
782
909
|
]
|
|
783
910
|
}
|
|
784
911
|
);
|
|
785
912
|
}
|
|
786
913
|
export {
|
|
787
|
-
|
|
914
|
+
ht as PeeekViewer
|
|
788
915
|
};
|