html-flip-book-react 0.0.0-alpha.69 → 0.0.0-alpha.72
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/toolbar/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
import { createContext as
|
|
3
|
-
let
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { jsx as a, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as Ce, useContext as Te, useRef as Q, useReducer as je, useMemo as Ie, useCallback as I, useEffect as U, useState as D, useLayoutEffect as Be } from "react";
|
|
3
|
+
let Se = 4;
|
|
4
|
+
function we() {
|
|
5
|
+
return Se;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
7
|
+
const $e = {
|
|
8
8
|
id: "download",
|
|
9
9
|
enName: "Download",
|
|
10
10
|
enDescription: "Download entire book or page range",
|
|
@@ -17,51 +17,51 @@ const je = {
|
|
|
17
17
|
);
|
|
18
18
|
},
|
|
19
19
|
canExecute: (e) => typeof e.data?.onDownload == "function"
|
|
20
|
-
},
|
|
20
|
+
}, Ae = [
|
|
21
21
|
{ key: "ArrowRight" },
|
|
22
22
|
{ key: "PageDown" },
|
|
23
23
|
{ key: " " }
|
|
24
24
|
// Space
|
|
25
|
-
],
|
|
25
|
+
], le = {
|
|
26
26
|
id: "flipNext",
|
|
27
27
|
navKind: "flip",
|
|
28
28
|
enName: "Next Page",
|
|
29
29
|
enDescription: "Flip to the next page",
|
|
30
30
|
nameKey: "command.jumpToNextPage",
|
|
31
|
-
hotkeys:
|
|
31
|
+
hotkeys: Ae,
|
|
32
32
|
execute: (e) => {
|
|
33
33
|
e.handle?.flipNext();
|
|
34
34
|
},
|
|
35
35
|
canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) < (e.handle?.getTotalPages() ?? 0) - 1
|
|
36
|
-
},
|
|
36
|
+
}, Re = [{ key: "ArrowLeft" }, { key: "PageUp" }], se = {
|
|
37
37
|
id: "flipPrev",
|
|
38
38
|
navKind: "flip",
|
|
39
39
|
enName: "Previous Page",
|
|
40
40
|
enDescription: "Flip to the previous page",
|
|
41
41
|
nameKey: "command.jumpToPrevPage",
|
|
42
|
-
hotkeys:
|
|
42
|
+
hotkeys: Re,
|
|
43
43
|
execute: (e) => {
|
|
44
44
|
e.handle?.flipPrev();
|
|
45
45
|
},
|
|
46
46
|
canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
|
|
47
|
-
},
|
|
47
|
+
}, Ke = [{ key: "Home" }, { key: "ArrowLeft", modifiers: { ctrl: !0 } }], ie = {
|
|
48
48
|
id: "goToFirst",
|
|
49
49
|
navKind: "jump",
|
|
50
50
|
enName: "First Page",
|
|
51
51
|
enDescription: "Jump to the first page",
|
|
52
52
|
nameKey: "command.jumpToFirstPage",
|
|
53
|
-
hotkeys:
|
|
53
|
+
hotkeys: Ke,
|
|
54
54
|
execute: (e) => {
|
|
55
55
|
e.handle?.jumpToPage(0);
|
|
56
56
|
},
|
|
57
57
|
canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
|
|
58
|
-
},
|
|
58
|
+
}, He = [{ key: "End" }, { key: "ArrowRight", modifiers: { ctrl: !0 } }], ce = {
|
|
59
59
|
id: "goToLast",
|
|
60
60
|
navKind: "jump",
|
|
61
61
|
enName: "Last Page",
|
|
62
62
|
enDescription: "Jump to the last page",
|
|
63
63
|
nameKey: "command.jumpToLastPage",
|
|
64
|
-
hotkeys:
|
|
64
|
+
hotkeys: He,
|
|
65
65
|
execute: (e) => {
|
|
66
66
|
const t = e.handle?.getTotalPages() ?? 0;
|
|
67
67
|
e.handle?.jumpToPage(t - 1);
|
|
@@ -70,46 +70,46 @@ const je = {
|
|
|
70
70
|
const t = e.handle?.getCurrentPageIndex() ?? 0, o = e.handle?.getTotalPages() ?? 0;
|
|
71
71
|
return t !== o - 1;
|
|
72
72
|
}
|
|
73
|
-
},
|
|
73
|
+
}, Oe = [{ key: "t" }], de = {
|
|
74
74
|
id: "goToToc",
|
|
75
75
|
navKind: "jump",
|
|
76
76
|
enName: "Table of Contents",
|
|
77
77
|
enDescription: "Jump to the table of contents",
|
|
78
78
|
nameKey: "command.jumpToToc",
|
|
79
|
-
hotkeys:
|
|
79
|
+
hotkeys: Oe,
|
|
80
80
|
execute: (e) => {
|
|
81
|
-
const t = e.handle?.getTocPageIndex?.() ??
|
|
81
|
+
const t = e.handle?.getTocPageIndex?.() ?? we();
|
|
82
82
|
e.handle?.jumpToPage(t);
|
|
83
83
|
},
|
|
84
84
|
canExecute: (e) => {
|
|
85
|
-
const t = e.handle?.getTocPageIndex?.() ??
|
|
85
|
+
const t = e.handle?.getTocPageIndex?.() ?? we();
|
|
86
86
|
return e.handle?.getCurrentPageIndex() !== t;
|
|
87
87
|
}
|
|
88
|
-
},
|
|
88
|
+
}, Ue = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], ze = {
|
|
89
89
|
id: "toggleDebug",
|
|
90
90
|
enName: "Toggle Debug Toolbar",
|
|
91
91
|
enDescription: "Show or hide the debug toolbar (Ctrl+Alt+D)",
|
|
92
92
|
nameKey: "command.toggleDebug",
|
|
93
93
|
descriptionKey: "command.toggleDebugDesc",
|
|
94
|
-
hotkeys:
|
|
94
|
+
hotkeys: Ue,
|
|
95
95
|
execute: (e) => {
|
|
96
96
|
e.handle?.toggleDebugBar?.();
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, ee = () => document, xe = [
|
|
99
99
|
"fullscreenchange",
|
|
100
100
|
"webkitfullscreenchange",
|
|
101
101
|
"fullscreenerror",
|
|
102
102
|
"webkitfullscreenerror"
|
|
103
103
|
];
|
|
104
|
-
function
|
|
105
|
-
return typeof document > "u" ? null :
|
|
104
|
+
function ue() {
|
|
105
|
+
return typeof document > "u" ? null : ee().fullscreenElement ?? ee().webkitFullscreenElement ?? null;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function me(e) {
|
|
108
108
|
if (typeof document > "u") return !1;
|
|
109
|
-
const t = e ??
|
|
110
|
-
return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != "function" ? !1 : (
|
|
109
|
+
const t = e ?? ee().documentElement;
|
|
110
|
+
return typeof (t.requestFullscreen ?? t.webkitRequestFullscreen) != "function" ? !1 : (ee().fullscreenEnabled ?? ee().webkitFullscreenEnabled) !== !1;
|
|
111
111
|
}
|
|
112
|
-
async function
|
|
112
|
+
async function qe(e) {
|
|
113
113
|
const t = e;
|
|
114
114
|
if (t.requestFullscreen) {
|
|
115
115
|
await t.requestFullscreen();
|
|
@@ -121,37 +121,37 @@ async function Oe(e) {
|
|
|
121
121
|
}
|
|
122
122
|
throw new Error("Fullscreen API is not available");
|
|
123
123
|
}
|
|
124
|
-
async function
|
|
125
|
-
const e =
|
|
124
|
+
async function We() {
|
|
125
|
+
const e = ee();
|
|
126
126
|
if (e.exitFullscreen) {
|
|
127
127
|
await e.exitFullscreen();
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
e.webkitExitFullscreen && e.webkitExitFullscreen();
|
|
131
131
|
}
|
|
132
|
-
const
|
|
132
|
+
const Ve = [{ key: "F11" }], te = {
|
|
133
133
|
id: "toggleFullscreen",
|
|
134
134
|
kind: "toggle",
|
|
135
135
|
enName: "Toggle Fullscreen",
|
|
136
136
|
enDescription: "Enter or exit fullscreen mode",
|
|
137
137
|
nameKey: "command.toggleFullscreen",
|
|
138
138
|
descriptionKey: "command.toggleFullscreenDesc",
|
|
139
|
-
hotkeys:
|
|
140
|
-
canExecute: (e) =>
|
|
141
|
-
isActive: () =>
|
|
139
|
+
hotkeys: Ve,
|
|
140
|
+
canExecute: (e) => me(e.data?.getFullscreenTarget?.()),
|
|
141
|
+
isActive: () => ue() !== null,
|
|
142
142
|
setActive: (e, t) => {
|
|
143
|
-
const o =
|
|
143
|
+
const o = ue();
|
|
144
144
|
if (t) {
|
|
145
145
|
if (o) return;
|
|
146
146
|
const n = e.data?.getFullscreenTarget?.() ?? document.documentElement;
|
|
147
|
-
if (!
|
|
148
|
-
|
|
147
|
+
if (!me(n)) return !1;
|
|
148
|
+
qe(n).catch(console.warn);
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
o &&
|
|
151
|
+
o && We().catch(console.warn);
|
|
152
152
|
},
|
|
153
|
-
execute: (e) =>
|
|
154
|
-
},
|
|
153
|
+
execute: (e) => te.setActive(e, !te.isActive(e))
|
|
154
|
+
}, ne = {
|
|
155
155
|
id: "toggleTextSelection",
|
|
156
156
|
kind: "toggle",
|
|
157
157
|
enName: "Select Text",
|
|
@@ -165,32 +165,32 @@ const ze = [{ key: "F11" }], Y = {
|
|
|
165
165
|
e.transient ? e.handle.setMouseMode(o, { persist: !1 }) : e.handle.setMouseMode(o);
|
|
166
166
|
},
|
|
167
167
|
execute: (e) => {
|
|
168
|
-
const t =
|
|
168
|
+
const t = ne.setActive(
|
|
169
169
|
e,
|
|
170
|
-
!
|
|
170
|
+
!ne.isActive(e)
|
|
171
171
|
);
|
|
172
172
|
return t !== !1 && window.getSelection()?.removeAllRanges(), t;
|
|
173
173
|
}
|
|
174
|
-
},
|
|
175
|
-
ne,
|
|
176
|
-
re,
|
|
177
|
-
ae,
|
|
174
|
+
}, Je = [
|
|
178
175
|
le,
|
|
179
176
|
se,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
ie,
|
|
178
|
+
ce,
|
|
179
|
+
de,
|
|
180
|
+
te,
|
|
181
|
+
ze,
|
|
182
|
+
ne,
|
|
183
|
+
$e
|
|
184
184
|
];
|
|
185
|
-
function
|
|
185
|
+
function De(e, t) {
|
|
186
186
|
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
if (
|
|
188
|
+
function Ge(e, t, o) {
|
|
189
|
+
if (De(t.key, o) !== e.key) return !1;
|
|
190
190
|
const n = e.modifiers ?? {};
|
|
191
191
|
return !(e.key !== "Control" && !!n.ctrl !== t.ctrlKey || e.key !== "Shift" && !!n.shift !== t.shiftKey || e.key !== "Alt" && !!n.alt !== t.altKey || e.key !== "Meta" && !!n.meta !== t.metaKey);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function _e(e, t) {
|
|
194
194
|
const o = e.modifiers ?? {};
|
|
195
195
|
return [
|
|
196
196
|
o.ctrl && !t.ctrlKey,
|
|
@@ -199,11 +199,11 @@ function Ve(e, t) {
|
|
|
199
199
|
o.meta && !t.metaKey
|
|
200
200
|
].some(Boolean);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
const n =
|
|
204
|
-
return n === e.key || n.length === 1 && n.toLowerCase() === e.key.toLowerCase() ? !0 :
|
|
202
|
+
function Qe(e, t, o) {
|
|
203
|
+
const n = De(t.key, o);
|
|
204
|
+
return n === e.key || n.length === 1 && n.toLowerCase() === e.key.toLowerCase() ? !0 : _e(e, t);
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function Xe(e, t) {
|
|
207
207
|
const o = e.modifiers ?? {}, n = t.modifiers ?? {};
|
|
208
208
|
return [
|
|
209
209
|
!!o.ctrl == !!n.ctrl,
|
|
@@ -212,17 +212,17 @@ function Ge(e, t) {
|
|
|
212
212
|
!!o.meta == !!n.meta
|
|
213
213
|
].every(Boolean);
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) &&
|
|
215
|
+
function ke(e, t) {
|
|
216
|
+
return e.key === t.key && e.mode === t.mode && (e.active ?? !0) === (t.active ?? !0) && Xe(e, t);
|
|
217
217
|
}
|
|
218
|
-
class
|
|
218
|
+
class Ye {
|
|
219
219
|
held = /* @__PURE__ */ new Map();
|
|
220
220
|
has(t) {
|
|
221
221
|
return this.held.has(t);
|
|
222
222
|
}
|
|
223
223
|
press(t, o, n) {
|
|
224
224
|
const r = this.held.get(t.id);
|
|
225
|
-
if (r?.bindings.some((i) =>
|
|
225
|
+
if (r?.bindings.some((i) => ke(i, o))) return !1;
|
|
226
226
|
const s = r ?? {
|
|
227
227
|
command: t,
|
|
228
228
|
context: { ...n, transient: !0 },
|
|
@@ -232,7 +232,7 @@ class _e {
|
|
|
232
232
|
return t.setActive(s.context, o.active ?? !0) === !1 ? !1 : (s.bindings.push(o), this.held.set(t.id, s), !0);
|
|
233
233
|
}
|
|
234
234
|
release(t, o) {
|
|
235
|
-
return this.removeBindings((n) =>
|
|
235
|
+
return this.removeBindings((n) => Qe(n, t, o));
|
|
236
236
|
}
|
|
237
237
|
/** Restore removed/disabled bindings without interrupting holds on ordinary rerenders. */
|
|
238
238
|
reconcile(t, o) {
|
|
@@ -240,7 +240,7 @@ class _e {
|
|
|
240
240
|
}
|
|
241
241
|
isRegistered(t, o, n) {
|
|
242
242
|
const r = n[o.command.id];
|
|
243
|
-
return !r || r.options.disableHotkeys || r.command !== o.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((s) =>
|
|
243
|
+
return !r || r.options.disableHotkeys || r.command !== o.command ? !1 : (r.options.hotkeys ?? r.command.hotkeys ?? []).some((s) => ke(s, t));
|
|
244
244
|
}
|
|
245
245
|
clear() {
|
|
246
246
|
return this.removeBindings(() => !0);
|
|
@@ -257,25 +257,25 @@ class _e {
|
|
|
257
257
|
return o;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
const
|
|
261
|
-
function
|
|
260
|
+
const Ee = Ce(null);
|
|
261
|
+
function Ze(e) {
|
|
262
262
|
return e instanceof HTMLElement ? !!(e.isContentEditable || e.closest('input, textarea, select, [contenteditable="true"], [contenteditable=""]')) : !1;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function et(e) {
|
|
265
265
|
return e.options.disableHotkeys ? [] : e.options.hotkeys ?? e.command.hotkeys ?? [];
|
|
266
266
|
}
|
|
267
|
-
function
|
|
267
|
+
function tt(e, t, o) {
|
|
268
268
|
return t.mode !== "hold" ? !0 : e.kind !== "toggle" ? !1 : !e.canExecute || e.canExecute(o(e));
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function ot(e, t, o, n) {
|
|
271
271
|
for (const r of Object.values(e)) {
|
|
272
|
-
const s =
|
|
273
|
-
(i) =>
|
|
272
|
+
const s = et(r).find(
|
|
273
|
+
(i) => Ge(i, t, o) && tt(r.command, i, n)
|
|
274
274
|
);
|
|
275
275
|
if (s) return { command: r.command, binding: s };
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
const
|
|
278
|
+
const nt = ({
|
|
279
279
|
flipBookRef: e,
|
|
280
280
|
currentPage: t,
|
|
281
281
|
totalPages: o,
|
|
@@ -285,90 +285,90 @@ const et = ({
|
|
|
285
285
|
disableHotkeys: i = !1,
|
|
286
286
|
children: c
|
|
287
287
|
}) => {
|
|
288
|
-
const
|
|
288
|
+
const g = Q(new Ye()).current, [, w] = je((d) => d + 1, 0), f = Ie(() => {
|
|
289
289
|
const d = {};
|
|
290
|
-
for (const
|
|
291
|
-
d[
|
|
292
|
-
command:
|
|
293
|
-
options: s[
|
|
290
|
+
for (const m of Je)
|
|
291
|
+
d[m.id] = {
|
|
292
|
+
command: m,
|
|
293
|
+
options: s[m.id] ?? {}
|
|
294
294
|
};
|
|
295
|
-
for (const
|
|
296
|
-
d[
|
|
297
|
-
command:
|
|
298
|
-
options: s[
|
|
295
|
+
for (const m of r)
|
|
296
|
+
d[m.id] = {
|
|
297
|
+
command: m,
|
|
298
|
+
options: s[m.id] ?? {}
|
|
299
299
|
};
|
|
300
300
|
return d;
|
|
301
|
-
}, [r, s]),
|
|
302
|
-
(d,
|
|
303
|
-
const
|
|
301
|
+
}, [r, s]), p = I(
|
|
302
|
+
(d, m) => {
|
|
303
|
+
const y = f[d.id]?.options ?? {}, $ = m ? { ...y.data, ...m } : y.data;
|
|
304
304
|
return {
|
|
305
305
|
handle: e.current,
|
|
306
|
-
data:
|
|
306
|
+
data: $
|
|
307
307
|
};
|
|
308
308
|
},
|
|
309
|
-
[e,
|
|
310
|
-
), N =
|
|
311
|
-
(d,
|
|
312
|
-
if (
|
|
313
|
-
const
|
|
314
|
-
d.canExecute && !d.canExecute(
|
|
309
|
+
[e, f]
|
|
310
|
+
), N = I(
|
|
311
|
+
(d, m) => {
|
|
312
|
+
if (g.has(d.id)) return;
|
|
313
|
+
const y = p(d, m);
|
|
314
|
+
d.canExecute && !d.canExecute(y) || (d.execute(y), w());
|
|
315
315
|
},
|
|
316
|
-
[
|
|
317
|
-
),
|
|
316
|
+
[p, g]
|
|
317
|
+
), E = I(
|
|
318
318
|
(d) => {
|
|
319
|
-
if (
|
|
320
|
-
const
|
|
321
|
-
return d.canExecute ? d.canExecute(
|
|
319
|
+
if (g.has(d.id)) return !1;
|
|
320
|
+
const m = p(d);
|
|
321
|
+
return d.canExecute ? d.canExecute(m) : !0;
|
|
322
322
|
},
|
|
323
|
-
[
|
|
324
|
-
),
|
|
325
|
-
(d) => d.isActive(
|
|
326
|
-
[
|
|
327
|
-
),
|
|
328
|
-
() => Object.values(
|
|
329
|
-
[
|
|
330
|
-
),
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}, [
|
|
334
|
-
const d = (
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
const { registry:
|
|
340
|
-
if (
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
},
|
|
344
|
-
|
|
345
|
-
},
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
document.hidden &&
|
|
323
|
+
[p, g]
|
|
324
|
+
), M = I(
|
|
325
|
+
(d) => d.isActive(p(d)),
|
|
326
|
+
[p]
|
|
327
|
+
), j = I(
|
|
328
|
+
() => Object.values(f).map((d) => d.command),
|
|
329
|
+
[f]
|
|
330
|
+
), v = Q({ registry: f, execute: N, createCommandContext: p, direction: n, disableHotkeys: i });
|
|
331
|
+
v.current = { registry: f, execute: N, createCommandContext: p, direction: n, disableHotkeys: i }, U(() => {
|
|
332
|
+
g.reconcile(f, i) && w();
|
|
333
|
+
}, [g, f, i]), U(() => {
|
|
334
|
+
const d = (b, F, k) => {
|
|
335
|
+
if (b.kind !== "toggle") return;
|
|
336
|
+
const S = v.current.createCommandContext(b);
|
|
337
|
+
!k.repeat && g.press(b, F, S) && w(), ["Control", "Shift", "Alt", "Meta"].includes(F.key) || k.preventDefault();
|
|
338
|
+
}, m = (b) => {
|
|
339
|
+
const { registry: F, execute: k, direction: S, disableHotkeys: K, createCommandContext: V } = v.current;
|
|
340
|
+
if (K || b.defaultPrevented || Ze(b.target)) return;
|
|
341
|
+
const P = ot(F, b, S, V);
|
|
342
|
+
P && (P.binding.mode === "hold" ? d(P.command, P.binding, b) : (b.preventDefault(), k(P.command)));
|
|
343
|
+
}, y = (b) => {
|
|
344
|
+
g.release(b, v.current.direction) && w();
|
|
345
|
+
}, $ = () => {
|
|
346
|
+
g.clear() && w();
|
|
347
|
+
}, O = () => {
|
|
348
|
+
document.hidden && $();
|
|
349
349
|
};
|
|
350
|
-
return document.addEventListener("keydown",
|
|
351
|
-
document.removeEventListener("keydown",
|
|
350
|
+
return document.addEventListener("keydown", m), document.addEventListener("keyup", y), window.addEventListener("blur", $), document.addEventListener("visibilitychange", O), () => {
|
|
351
|
+
document.removeEventListener("keydown", m), document.removeEventListener("keyup", y), window.removeEventListener("blur", $), document.removeEventListener("visibilitychange", O), g.clear();
|
|
352
352
|
};
|
|
353
|
-
}, [
|
|
354
|
-
const
|
|
355
|
-
return /* @__PURE__ */ a(
|
|
356
|
-
},
|
|
357
|
-
const e =
|
|
353
|
+
}, [g]);
|
|
354
|
+
const B = { execute: N, canExecute: E, isActive: M, getAllCommands: j };
|
|
355
|
+
return /* @__PURE__ */ a(Ee.Provider, { value: B, children: c });
|
|
356
|
+
}, X = () => {
|
|
357
|
+
const e = Te(Ee);
|
|
358
358
|
if (!e)
|
|
359
359
|
throw new Error("useCommands must be used within a CommandProvider");
|
|
360
360
|
return e;
|
|
361
361
|
};
|
|
362
|
-
function
|
|
362
|
+
function rt(e) {
|
|
363
363
|
let t = "";
|
|
364
364
|
for (const o of new TextEncoder().encode(e))
|
|
365
365
|
t += String.fromCharCode(o);
|
|
366
366
|
return btoa(t);
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
return { ext: "json", data:
|
|
368
|
+
function ve(e) {
|
|
369
|
+
return { ext: "json", data: rt(JSON.stringify(e, null, " ")) };
|
|
370
370
|
}
|
|
371
|
-
function
|
|
371
|
+
function yt(e) {
|
|
372
372
|
const { pagesCount: t, pageSemantics: o } = e, n = (r) => {
|
|
373
373
|
const s = o?.indexToSemanticName(r) ?? "", i = o?.indexToTitle(r) ?? "";
|
|
374
374
|
return o ? { pageIndex: r, semanticName: s, title: i } : { pageIndex: r, semanticName: String(r + 1), title: `Page ${r + 1}` };
|
|
@@ -380,12 +380,12 @@ function xt(e) {
|
|
|
380
380
|
const i = n(s);
|
|
381
381
|
(i.semanticName || i.title) && r.push(i);
|
|
382
382
|
}
|
|
383
|
-
return Promise.resolve(
|
|
383
|
+
return Promise.resolve(ve(r));
|
|
384
384
|
},
|
|
385
|
-
onDownloadPageRange: (r) => Promise.resolve(
|
|
385
|
+
onDownloadPageRange: (r) => Promise.resolve(ve(r.map(n)))
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
|
-
const z = { size: 24 },
|
|
388
|
+
const z = { size: 24 }, at = ({ size: e = z.size, className: t }) => /* @__PURE__ */ a(
|
|
389
389
|
"svg",
|
|
390
390
|
{
|
|
391
391
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -401,7 +401,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
401
401
|
"aria-hidden": "true",
|
|
402
402
|
children: /* @__PURE__ */ a("path", { d: "m15 18-6-6 6-6" })
|
|
403
403
|
}
|
|
404
|
-
),
|
|
404
|
+
), lt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ a(
|
|
405
405
|
"svg",
|
|
406
406
|
{
|
|
407
407
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -417,7 +417,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
417
417
|
"aria-hidden": "true",
|
|
418
418
|
children: /* @__PURE__ */ a("path", { d: "m9 18 6-6-6-6" })
|
|
419
419
|
}
|
|
420
|
-
),
|
|
420
|
+
), st = ({ size: e = z.size, className: t }) => /* @__PURE__ */ L(
|
|
421
421
|
"svg",
|
|
422
422
|
{
|
|
423
423
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -436,7 +436,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
436
436
|
/* @__PURE__ */ a("path", { d: "M7 6v12" })
|
|
437
437
|
]
|
|
438
438
|
}
|
|
439
|
-
),
|
|
439
|
+
), it = ({ size: e = z.size, className: t }) => /* @__PURE__ */ L(
|
|
440
440
|
"svg",
|
|
441
441
|
{
|
|
442
442
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -455,7 +455,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
455
455
|
/* @__PURE__ */ a("path", { d: "M17 6v12" })
|
|
456
456
|
]
|
|
457
457
|
}
|
|
458
|
-
),
|
|
458
|
+
), ct = ({ size: e = z.size, className: t }) => /* @__PURE__ */ L(
|
|
459
459
|
"svg",
|
|
460
460
|
{
|
|
461
461
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -476,7 +476,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
476
476
|
/* @__PURE__ */ a("path", { d: "M16 21h3a2 2 0 0 0 2-2v-3" })
|
|
477
477
|
]
|
|
478
478
|
}
|
|
479
|
-
),
|
|
479
|
+
), dt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ L(
|
|
480
480
|
"svg",
|
|
481
481
|
{
|
|
482
482
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -497,10 +497,10 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
497
497
|
/* @__PURE__ */ a("path", { d: "M16 21v-3a2 2 0 0 1 2-2h3" })
|
|
498
498
|
]
|
|
499
499
|
}
|
|
500
|
-
),
|
|
500
|
+
), ut = ({
|
|
501
501
|
size: e = z.size,
|
|
502
502
|
className: t
|
|
503
|
-
}) => /* @__PURE__ */
|
|
503
|
+
}) => /* @__PURE__ */ L(
|
|
504
504
|
"svg",
|
|
505
505
|
{
|
|
506
506
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -523,7 +523,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
523
523
|
/* @__PURE__ */ a("path", { d: "M21 19h.01" })
|
|
524
524
|
]
|
|
525
525
|
}
|
|
526
|
-
),
|
|
526
|
+
), Pt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ L(
|
|
527
527
|
"svg",
|
|
528
528
|
{
|
|
529
529
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -545,7 +545,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
545
545
|
/* @__PURE__ */ a("rect", { x: "16", y: "6", width: "4", height: "15", rx: "0.5" })
|
|
546
546
|
]
|
|
547
547
|
}
|
|
548
|
-
),
|
|
548
|
+
), mt = ({ size: e = z.size, className: t }) => /* @__PURE__ */ L(
|
|
549
549
|
"svg",
|
|
550
550
|
{
|
|
551
551
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -585,7 +585,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
585
585
|
className: `flipbook-toolbar-button ${s}`.trim(),
|
|
586
586
|
children: r
|
|
587
587
|
}
|
|
588
|
-
),
|
|
588
|
+
), Ct = ({
|
|
589
589
|
onClick: e,
|
|
590
590
|
ariaLabel: t,
|
|
591
591
|
children: o,
|
|
@@ -600,7 +600,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
600
600
|
className: `flipbook-toolbar-action ${r ?? ""}`.trim(),
|
|
601
601
|
children: o
|
|
602
602
|
}
|
|
603
|
-
),
|
|
603
|
+
), Tt = ({
|
|
604
604
|
enabled: e,
|
|
605
605
|
onChange: t,
|
|
606
606
|
ariaLabel: o,
|
|
@@ -623,7 +623,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
623
623
|
}
|
|
624
624
|
) })
|
|
625
625
|
}
|
|
626
|
-
),
|
|
626
|
+
), gt = {
|
|
627
627
|
align: "left",
|
|
628
628
|
direction: "ltr",
|
|
629
629
|
translations: {
|
|
@@ -632,6 +632,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
632
632
|
"toolbarItem.download.from": "From",
|
|
633
633
|
"toolbarItem.download.to": "To",
|
|
634
634
|
"toolbarItem.download.download": "Download",
|
|
635
|
+
"toolbarItem.download.error": "Download failed — try again",
|
|
635
636
|
"command.downloadEntireBook": "Download entire book",
|
|
636
637
|
"command.jumpToToc": "Table of contents",
|
|
637
638
|
"command.jumpToFirstPage": "First page",
|
|
@@ -649,7 +650,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
649
650
|
"toolbarItem.exitFullscreen": "Exit fullscreen",
|
|
650
651
|
"toolbarItem.fullscreenUnsupported": "Fullscreen is not supported by this browser"
|
|
651
652
|
}
|
|
652
|
-
},
|
|
653
|
+
}, ft = {
|
|
653
654
|
align: "right",
|
|
654
655
|
direction: "rtl",
|
|
655
656
|
translations: {
|
|
@@ -658,6 +659,7 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
658
659
|
"toolbarItem.download.from": "מ",
|
|
659
660
|
"toolbarItem.download.to": "עד",
|
|
660
661
|
"toolbarItem.download.download": "הורד",
|
|
662
|
+
"toolbarItem.download.error": "ההורדה נכשלה — נסו שוב",
|
|
661
663
|
"command.downloadEntireBook": "הורד את כל הספר",
|
|
662
664
|
"command.jumpToToc": "תוכן העניינים",
|
|
663
665
|
"command.jumpToFirstPage": "עמוד ראשון",
|
|
@@ -675,10 +677,10 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
675
677
|
"toolbarItem.exitFullscreen": "יציאה ממסך מלא",
|
|
676
678
|
"toolbarItem.fullscreenUnsupported": "מסך מלא אינו נתמך בדפדפן זה"
|
|
677
679
|
}
|
|
678
|
-
},
|
|
679
|
-
"en-US":
|
|
680
|
-
"he-IL":
|
|
681
|
-
},
|
|
680
|
+
}, ge = {
|
|
681
|
+
"en-US": gt,
|
|
682
|
+
"he-IL": ft
|
|
683
|
+
}, he = "en-US", ht = {
|
|
682
684
|
"toolbarItem.download": "Download",
|
|
683
685
|
"toolbarItem.downloadPageRange": "Download page range…",
|
|
684
686
|
"toolbarItem.download.from": "From",
|
|
@@ -699,43 +701,39 @@ const z = { size: 24 }, ot = ({ size: e = z.size, className: t }) => /* @__PURE_
|
|
|
699
701
|
"toolbarItem.exitFullscreen": "Exit fullscreen",
|
|
700
702
|
"toolbarItem.fullscreenUnsupported": "Fullscreen is not supported by this browser"
|
|
701
703
|
};
|
|
702
|
-
function
|
|
703
|
-
return
|
|
704
|
+
function Le(e) {
|
|
705
|
+
return ge[e] ?? ge[he];
|
|
704
706
|
}
|
|
705
|
-
function
|
|
706
|
-
return
|
|
707
|
+
function fe(e) {
|
|
708
|
+
return Le(e).direction === "rtl";
|
|
707
709
|
}
|
|
708
|
-
function
|
|
709
|
-
return
|
|
710
|
+
function pt(e) {
|
|
711
|
+
return fe(e) ? "rtl" : "ltr";
|
|
710
712
|
}
|
|
711
713
|
function C(e, t) {
|
|
712
|
-
const o =
|
|
714
|
+
const o = Le(t).translations[e];
|
|
713
715
|
if (o !== void 0 && o !== "") return o;
|
|
714
|
-
const n =
|
|
715
|
-
return n !== void 0 && n !== "" ? n :
|
|
716
|
+
const n = ge[he].translations[e];
|
|
717
|
+
return n !== void 0 && n !== "" ? n : ht[e] ?? e;
|
|
716
718
|
}
|
|
717
|
-
const
|
|
719
|
+
const Ne = Ce(null);
|
|
718
720
|
function W() {
|
|
719
|
-
const e =
|
|
721
|
+
const e = Te(Ne);
|
|
720
722
|
if (!e)
|
|
721
723
|
throw new Error("Toolbar components must be used within a Toolbar");
|
|
722
724
|
return e;
|
|
723
725
|
}
|
|
724
|
-
function
|
|
726
|
+
function ye(e) {
|
|
725
727
|
return e.replace(/[׳'״"]/g, "");
|
|
726
728
|
}
|
|
727
|
-
function
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
i.href = s, i.download = `${t}.${e.ext}`, i.click(), URL.revokeObjectURL(s);
|
|
734
|
-
} catch (o) {
|
|
735
|
-
console.error("Download failed:", o);
|
|
736
|
-
}
|
|
729
|
+
function Pe(e, t) {
|
|
730
|
+
const o = atob(e.data), n = new Uint8Array(o.length);
|
|
731
|
+
for (let c = 0; c < o.length; c++)
|
|
732
|
+
n[c] = o.charCodeAt(c);
|
|
733
|
+
const r = new Blob([n]), s = URL.createObjectURL(r), i = document.createElement("a");
|
|
734
|
+
i.href = s, i.download = `${t}.${e.ext}`, i.click(), URL.revokeObjectURL(s);
|
|
737
735
|
}
|
|
738
|
-
function
|
|
736
|
+
function bt(e, t) {
|
|
739
737
|
const o = [];
|
|
740
738
|
for (let n = 0; n < e; n++) {
|
|
741
739
|
const r = t?.indexToSemanticName(n) ?? "", s = t?.indexToTitle(n) ?? "";
|
|
@@ -751,7 +749,7 @@ function ft(e, t) {
|
|
|
751
749
|
}
|
|
752
750
|
return o;
|
|
753
751
|
}
|
|
754
|
-
const
|
|
752
|
+
const It = ({
|
|
755
753
|
ariaLabel: e = "Download",
|
|
756
754
|
className: t
|
|
757
755
|
}) => {
|
|
@@ -762,140 +760,152 @@ const Pt = ({
|
|
|
762
760
|
openDownloadMenuRef: s,
|
|
763
761
|
downloadExecutorRef: i,
|
|
764
762
|
flipBookRef: c
|
|
765
|
-
} = W(),
|
|
766
|
-
U(() => (s.current = () =>
|
|
763
|
+
} = W(), g = c.current?.getDownloadConfig?.() ?? void 0, [w, f] = D(!1);
|
|
764
|
+
U(() => (s.current = () => f(!0), () => {
|
|
767
765
|
s.current = null;
|
|
768
766
|
}), [s]);
|
|
769
|
-
const [
|
|
770
|
-
() =>
|
|
767
|
+
const [p, N] = D("entire"), [E, M] = D(0), [j, v] = D(0), [B, d] = D(null), [m, y] = D(null), [$, O] = D(!1), b = Q(null), F = Q(null), k = Ie(
|
|
768
|
+
() => bt(o, n),
|
|
771
769
|
[o, n]
|
|
772
|
-
),
|
|
770
|
+
), S = !!g?.onDownloadSefer, K = !!g?.onDownloadPageRange, V = S || K, P = k[0]?.pageIndex ?? 0, Y = k[k.length - 1]?.pageIndex ?? 0;
|
|
773
771
|
U(() => {
|
|
774
|
-
|
|
775
|
-
}, [
|
|
776
|
-
const
|
|
777
|
-
|
|
778
|
-
}, [])
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
772
|
+
w && (N(S ? "entire" : "range"), M(P), v(Y));
|
|
773
|
+
}, [w, S, P, Y]);
|
|
774
|
+
const H = I(() => {
|
|
775
|
+
f(!1), y(null);
|
|
776
|
+
}, []), x = I(
|
|
777
|
+
(l) => {
|
|
778
|
+
const h = c.current?.getDownloadConfig?.()?.onDownloadError?.(l);
|
|
779
|
+
y(
|
|
780
|
+
typeof h == "string" && h ? h : C("toolbarItem.download.error", r)
|
|
781
|
+
);
|
|
782
|
+
},
|
|
783
|
+
[c, r]
|
|
784
|
+
);
|
|
785
|
+
Be(() => {
|
|
786
|
+
if (!w || !F.current || !b.current) return;
|
|
787
|
+
const l = F.current, u = b.current.querySelector(".flipbook-toolbar-download-trigger"), h = () => {
|
|
788
|
+
const T = u?.getBoundingClientRect();
|
|
789
|
+
if (!T) return;
|
|
790
|
+
const R = 8, _ = 6, re = window.innerHeight - T.bottom - _ - R, pe = T.top - _ - R, be = Math.min(l.scrollHeight, window.innerHeight * 0.7, 480), ae = re < be && pe > re;
|
|
791
|
+
l.style.maxHeight = `${Math.max(0, Math.min(be, ae ? pe : re))}px`;
|
|
792
|
+
const oe = l.getBoundingClientRect(), Fe = fe(r) ? T.left : T.right - oe.width;
|
|
793
|
+
l.style.left = `${Math.max(R, Math.min(Fe, window.innerWidth - oe.width - R))}px`;
|
|
794
|
+
const Me = ae ? T.top - _ - oe.height : T.bottom + _;
|
|
795
|
+
l.style.top = `${Math.max(R, Math.min(Me, window.innerHeight - oe.height - R))}px`, O(ae);
|
|
790
796
|
};
|
|
791
|
-
|
|
792
|
-
const
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
return
|
|
796
|
-
|
|
797
|
+
h();
|
|
798
|
+
const Z = new ResizeObserver(h);
|
|
799
|
+
Z.observe(l);
|
|
800
|
+
const G = b.current.closest('[role="toolbar"]');
|
|
801
|
+
return G && Z.observe(G), window.addEventListener("resize", h), window.addEventListener("scroll", h, !0), () => {
|
|
802
|
+
Z.disconnect(), window.removeEventListener("resize", h), window.removeEventListener("scroll", h, !0);
|
|
797
803
|
};
|
|
798
|
-
}, [
|
|
799
|
-
if (!
|
|
800
|
-
const l = (
|
|
801
|
-
|
|
804
|
+
}, [w, r]), U(() => {
|
|
805
|
+
if (!w) return;
|
|
806
|
+
const l = (u) => {
|
|
807
|
+
b.current && !b.current.contains(u.target) && H();
|
|
802
808
|
};
|
|
803
809
|
return document.addEventListener("mousedown", l), () => document.removeEventListener("mousedown", l);
|
|
804
|
-
}, [
|
|
805
|
-
const
|
|
810
|
+
}, [w, H]);
|
|
811
|
+
const A = I(async () => {
|
|
806
812
|
const l = c.current?.getDownloadConfig?.();
|
|
807
813
|
if (l?.onDownloadSefer) {
|
|
808
|
-
d("sefer");
|
|
814
|
+
d("sefer"), y(null);
|
|
809
815
|
try {
|
|
810
|
-
const
|
|
811
|
-
|
|
816
|
+
const u = await l.onDownloadSefer();
|
|
817
|
+
u && Pe(u, l.entireBookFilename ?? "book"), H();
|
|
818
|
+
} catch (u) {
|
|
819
|
+
x(u);
|
|
812
820
|
} finally {
|
|
813
821
|
d(null);
|
|
814
822
|
}
|
|
815
823
|
}
|
|
816
|
-
}, [c,
|
|
817
|
-
async (l,
|
|
818
|
-
const
|
|
819
|
-
if (!
|
|
820
|
-
const
|
|
821
|
-
for (let
|
|
822
|
-
|
|
823
|
-
const R =
|
|
824
|
-
R &&
|
|
824
|
+
}, [c, H, x]), J = I(
|
|
825
|
+
async (l, u) => {
|
|
826
|
+
const h = c.current?.getDownloadConfig?.();
|
|
827
|
+
if (!h?.onDownloadPageRange) return;
|
|
828
|
+
const Z = [], G = [];
|
|
829
|
+
for (let T = l; T <= u; T++) {
|
|
830
|
+
Z.push(T);
|
|
831
|
+
const R = k.find((_) => _.pageIndex === T);
|
|
832
|
+
R && G.push(R);
|
|
825
833
|
}
|
|
826
|
-
d("range");
|
|
834
|
+
d("range"), y(null);
|
|
827
835
|
try {
|
|
828
|
-
const
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
836
|
+
const T = await h.onDownloadPageRange(
|
|
837
|
+
Z,
|
|
838
|
+
G,
|
|
839
|
+
h.downloadContext
|
|
832
840
|
);
|
|
833
|
-
if (
|
|
834
|
-
const R =
|
|
835
|
-
|
|
841
|
+
if (T) {
|
|
842
|
+
const R = ye(G[0]?.semanticName ?? String(l)), _ = ye(
|
|
843
|
+
G[G.length - 1]?.semanticName ?? String(u)
|
|
836
844
|
);
|
|
837
|
-
|
|
845
|
+
Pe(T, `${h.rangeFilename ?? "pages"}-${R}-${_}`);
|
|
838
846
|
}
|
|
839
|
-
|
|
847
|
+
H();
|
|
848
|
+
} catch (T) {
|
|
849
|
+
x(T);
|
|
840
850
|
} finally {
|
|
841
851
|
d(null);
|
|
842
852
|
}
|
|
843
853
|
},
|
|
844
|
-
[c,
|
|
854
|
+
[c, k, H, x]
|
|
845
855
|
);
|
|
846
|
-
return U(() => (i.current = (l,
|
|
847
|
-
l === void 0 &&
|
|
856
|
+
return U(() => (i.current = (l, u) => {
|
|
857
|
+
l === void 0 && u === void 0 ? A() : l !== void 0 && u !== void 0 && J(l, u);
|
|
848
858
|
}, () => {
|
|
849
859
|
i.current = null;
|
|
850
|
-
}), [i,
|
|
860
|
+
}), [i, A, J]), V ? /* @__PURE__ */ L("div", { className: `flipbook-toolbar-download-wrap ${t ?? ""}`.trim(), ref: b, children: [
|
|
851
861
|
/* @__PURE__ */ a(
|
|
852
862
|
"button",
|
|
853
863
|
{
|
|
854
864
|
type: "button",
|
|
855
865
|
className: "flipbook-toolbar-button flipbook-toolbar-download-trigger",
|
|
856
|
-
onClick: () =>
|
|
866
|
+
onClick: () => f((l) => !l),
|
|
857
867
|
"aria-label": e ?? C("toolbarItem.download", r),
|
|
858
|
-
"aria-expanded":
|
|
868
|
+
"aria-expanded": w,
|
|
859
869
|
"aria-haspopup": "true",
|
|
860
|
-
disabled:
|
|
861
|
-
children: /* @__PURE__ */ a(
|
|
870
|
+
disabled: B !== null,
|
|
871
|
+
children: /* @__PURE__ */ a(mt, { size: 18 })
|
|
862
872
|
}
|
|
863
873
|
),
|
|
864
|
-
|
|
874
|
+
w && /* @__PURE__ */ L(
|
|
865
875
|
"div",
|
|
866
876
|
{
|
|
867
|
-
ref:
|
|
868
|
-
className: `flipbook-toolbar-download-menu ${
|
|
877
|
+
ref: F,
|
|
878
|
+
className: `flipbook-toolbar-download-menu ${$ ? "flipbook-toolbar-download-menu--open-up" : ""}`.trim(),
|
|
869
879
|
role: "menu",
|
|
870
|
-
dir:
|
|
880
|
+
dir: fe(r) ? "rtl" : "ltr",
|
|
871
881
|
children: [
|
|
872
|
-
/* @__PURE__ */
|
|
882
|
+
/* @__PURE__ */ L(
|
|
873
883
|
"fieldset",
|
|
874
884
|
{
|
|
875
885
|
className: "flipbook-toolbar-download-mode",
|
|
876
886
|
"aria-label": C("toolbarItem.download", r),
|
|
877
887
|
children: [
|
|
878
|
-
|
|
888
|
+
S && /* @__PURE__ */ L("label", { className: "flipbook-toolbar-download-radio-label", children: [
|
|
879
889
|
/* @__PURE__ */ a(
|
|
880
890
|
"input",
|
|
881
891
|
{
|
|
882
892
|
type: "radio",
|
|
883
893
|
name: "download-mode",
|
|
884
894
|
className: "flipbook-toolbar-download-radio",
|
|
885
|
-
checked:
|
|
895
|
+
checked: p === "entire",
|
|
886
896
|
onChange: () => N("entire")
|
|
887
897
|
}
|
|
888
898
|
),
|
|
889
899
|
/* @__PURE__ */ a("span", { children: C("command.downloadEntireBook", r) })
|
|
890
900
|
] }),
|
|
891
|
-
|
|
901
|
+
K && /* @__PURE__ */ L("label", { className: "flipbook-toolbar-download-radio-label", children: [
|
|
892
902
|
/* @__PURE__ */ a(
|
|
893
903
|
"input",
|
|
894
904
|
{
|
|
895
905
|
type: "radio",
|
|
896
906
|
name: "download-mode",
|
|
897
907
|
className: "flipbook-toolbar-download-radio",
|
|
898
|
-
checked:
|
|
908
|
+
checked: p === "range",
|
|
899
909
|
onChange: () => N("range")
|
|
900
910
|
}
|
|
901
911
|
),
|
|
@@ -904,32 +914,33 @@ const Pt = ({
|
|
|
904
914
|
]
|
|
905
915
|
}
|
|
906
916
|
),
|
|
907
|
-
|
|
908
|
-
/* @__PURE__ */
|
|
917
|
+
p === "range" && /* @__PURE__ */ L("div", { className: "flipbook-toolbar-download-range", children: [
|
|
918
|
+
/* @__PURE__ */ L("label", { className: "flipbook-toolbar-download-range-label", children: [
|
|
909
919
|
C("toolbarItem.download.from", r),
|
|
910
920
|
/* @__PURE__ */ a(
|
|
911
921
|
"select",
|
|
912
922
|
{
|
|
913
|
-
value:
|
|
914
|
-
onChange: (l) =>
|
|
923
|
+
value: E,
|
|
924
|
+
onChange: (l) => M(Number(l.target.value)),
|
|
915
925
|
className: "flipbook-toolbar-download-range-select",
|
|
916
|
-
children:
|
|
926
|
+
children: k.map((l) => /* @__PURE__ */ a("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
|
|
917
927
|
}
|
|
918
928
|
)
|
|
919
929
|
] }),
|
|
920
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ L("label", { className: "flipbook-toolbar-download-range-label", children: [
|
|
921
931
|
C("toolbarItem.download.to", r),
|
|
922
932
|
/* @__PURE__ */ a(
|
|
923
933
|
"select",
|
|
924
934
|
{
|
|
925
|
-
value:
|
|
926
|
-
onChange: (l) =>
|
|
935
|
+
value: j,
|
|
936
|
+
onChange: (l) => v(Number(l.target.value)),
|
|
927
937
|
className: "flipbook-toolbar-download-range-select",
|
|
928
|
-
children:
|
|
938
|
+
children: k.map((l) => /* @__PURE__ */ a("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
|
|
929
939
|
}
|
|
930
940
|
)
|
|
931
941
|
] })
|
|
932
942
|
] }),
|
|
943
|
+
m && /* @__PURE__ */ a("div", { role: "alert", className: "flipbook-toolbar-download-error", children: m }),
|
|
933
944
|
/* @__PURE__ */ a(
|
|
934
945
|
"button",
|
|
935
946
|
{
|
|
@@ -937,39 +948,39 @@ const Pt = ({
|
|
|
937
948
|
role: "menuitem",
|
|
938
949
|
className: "flipbook-toolbar-download-menuitem flipbook-toolbar-download-primary",
|
|
939
950
|
onClick: () => {
|
|
940
|
-
if (
|
|
941
|
-
|
|
951
|
+
if (p === "entire")
|
|
952
|
+
A();
|
|
942
953
|
else {
|
|
943
|
-
const l = c.current?.getTotalPages?.() ?? o,
|
|
944
|
-
let
|
|
945
|
-
if (l > 0 &&
|
|
946
|
-
|
|
954
|
+
const l = c.current?.getTotalPages?.() ?? o, u = Math.min(E, j);
|
|
955
|
+
let h = Math.max(E, j);
|
|
956
|
+
if (l > 0 && h >= l && (h = l - 1), h < u) return;
|
|
957
|
+
J(u, h);
|
|
947
958
|
}
|
|
948
959
|
},
|
|
949
|
-
disabled:
|
|
950
|
-
children:
|
|
960
|
+
disabled: B !== null,
|
|
961
|
+
children: B === "sefer" || B === "range" ? "…" : C("toolbarItem.download.download", r)
|
|
951
962
|
}
|
|
952
963
|
)
|
|
953
964
|
]
|
|
954
965
|
}
|
|
955
966
|
)
|
|
956
967
|
] }) : null;
|
|
957
|
-
},
|
|
958
|
-
const { locale: o } = W(), { execute: n, canExecute: r } =
|
|
959
|
-
n(
|
|
960
|
-
}, i = /* @__PURE__ */ a(
|
|
968
|
+
}, Dt = ({ children: e, className: t }) => {
|
|
969
|
+
const { locale: o } = W(), { execute: n, canExecute: r } = X(), s = () => {
|
|
970
|
+
n(ie);
|
|
971
|
+
}, i = /* @__PURE__ */ a(st, { size: 18 }), c = C("command.jumpToFirstPage", o);
|
|
961
972
|
return /* @__PURE__ */ a(
|
|
962
973
|
q,
|
|
963
974
|
{
|
|
964
975
|
onClick: s,
|
|
965
976
|
ariaLabel: c,
|
|
966
977
|
title: c,
|
|
967
|
-
disabled: !r(
|
|
978
|
+
disabled: !r(ie),
|
|
968
979
|
className: `flipbook-toolbar-first ${t ?? ""}`.trim(),
|
|
969
980
|
children: e ?? i
|
|
970
981
|
}
|
|
971
982
|
);
|
|
972
|
-
},
|
|
983
|
+
}, Et = ({
|
|
973
984
|
targetRef: e,
|
|
974
985
|
enterIcon: t,
|
|
975
986
|
exitIcon: o,
|
|
@@ -978,61 +989,61 @@ const Pt = ({
|
|
|
978
989
|
unsupportedBehavior: s = "hide",
|
|
979
990
|
className: i
|
|
980
991
|
}) => {
|
|
981
|
-
const c = W(), { execute:
|
|
992
|
+
const c = W(), { execute: g, canExecute: w } = X(), f = e ?? c.fullscreenTargetRef, [p, N] = D(!1), [E, M] = D(!1);
|
|
982
993
|
U(() => {
|
|
983
994
|
const d = () => {
|
|
984
|
-
N(
|
|
995
|
+
N(ue() !== null), M(me(f?.current));
|
|
985
996
|
};
|
|
986
997
|
d();
|
|
987
|
-
for (const
|
|
988
|
-
document.addEventListener(
|
|
998
|
+
for (const m of xe)
|
|
999
|
+
document.addEventListener(m, d);
|
|
989
1000
|
return () => {
|
|
990
|
-
for (const
|
|
991
|
-
document.removeEventListener(
|
|
1001
|
+
for (const m of xe)
|
|
1002
|
+
document.removeEventListener(m, d);
|
|
992
1003
|
};
|
|
993
|
-
}, [
|
|
994
|
-
const
|
|
995
|
-
e ?
|
|
1004
|
+
}, [f]);
|
|
1005
|
+
const j = () => {
|
|
1006
|
+
e ? g(te, {
|
|
996
1007
|
getFullscreenTarget: () => e.current ?? null
|
|
997
|
-
}) :
|
|
1008
|
+
}) : g(te);
|
|
998
1009
|
};
|
|
999
|
-
if (!
|
|
1000
|
-
const
|
|
1010
|
+
if (!E && s === "hide") return null;
|
|
1011
|
+
const v = p ? r ?? C("toolbarItem.exitFullscreen", c.locale) : n ?? C("toolbarItem.enterFullscreen", c.locale), B = p ? o ?? /* @__PURE__ */ a(dt, { size: 18 }) : t ?? /* @__PURE__ */ a(ct, { size: 18 });
|
|
1001
1012
|
return /* @__PURE__ */ a(
|
|
1002
1013
|
q,
|
|
1003
1014
|
{
|
|
1004
|
-
onClick:
|
|
1005
|
-
ariaLabel:
|
|
1006
|
-
ariaPressed:
|
|
1007
|
-
disabled: !
|
|
1008
|
-
title:
|
|
1009
|
-
className: `flipbook-toolbar-fullscreen ${
|
|
1010
|
-
children:
|
|
1015
|
+
onClick: j,
|
|
1016
|
+
ariaLabel: v,
|
|
1017
|
+
ariaPressed: p,
|
|
1018
|
+
disabled: !E || !w(te),
|
|
1019
|
+
title: E ? v : C("toolbarItem.fullscreenUnsupported", c.locale),
|
|
1020
|
+
className: `flipbook-toolbar-fullscreen ${p ? "flipbook-toolbar-fullscreen--active" : ""} ${i ?? ""}`.trim(),
|
|
1021
|
+
children: B
|
|
1011
1022
|
}
|
|
1012
1023
|
);
|
|
1013
|
-
},
|
|
1014
|
-
const { locale: o } = W(), { execute: n, canExecute: r } =
|
|
1015
|
-
n(
|
|
1016
|
-
}, i = /* @__PURE__ */ a(
|
|
1024
|
+
}, Lt = ({ children: e, className: t }) => {
|
|
1025
|
+
const { locale: o } = W(), { execute: n, canExecute: r } = X(), s = () => {
|
|
1026
|
+
n(ce);
|
|
1027
|
+
}, i = /* @__PURE__ */ a(it, { size: 18 }), c = C("command.jumpToLastPage", o);
|
|
1017
1028
|
return /* @__PURE__ */ a(
|
|
1018
1029
|
q,
|
|
1019
1030
|
{
|
|
1020
1031
|
onClick: s,
|
|
1021
1032
|
ariaLabel: c,
|
|
1022
1033
|
title: c,
|
|
1023
|
-
disabled: !r(
|
|
1034
|
+
disabled: !r(ce),
|
|
1024
1035
|
className: `flipbook-toolbar-last ${t ?? ""}`.trim(),
|
|
1025
1036
|
children: e ?? i
|
|
1026
1037
|
}
|
|
1027
1038
|
);
|
|
1028
|
-
},
|
|
1039
|
+
}, wt = ({
|
|
1029
1040
|
command: e,
|
|
1030
1041
|
ariaLabel: t,
|
|
1031
1042
|
children: o,
|
|
1032
1043
|
disabled: n = !1,
|
|
1033
1044
|
className: r
|
|
1034
1045
|
}) => {
|
|
1035
|
-
const { execute: s, canExecute: i, isActive: c } =
|
|
1046
|
+
const { execute: s, canExecute: i, isActive: c } = X();
|
|
1036
1047
|
return /* @__PURE__ */ a(
|
|
1037
1048
|
q,
|
|
1038
1049
|
{
|
|
@@ -1044,40 +1055,40 @@ const Pt = ({
|
|
|
1044
1055
|
children: o
|
|
1045
1056
|
}
|
|
1046
1057
|
);
|
|
1047
|
-
},
|
|
1058
|
+
}, Nt = ({
|
|
1048
1059
|
letters: e,
|
|
1049
1060
|
ariaLabel: t,
|
|
1050
1061
|
className: o
|
|
1051
1062
|
}) => {
|
|
1052
1063
|
const { locale: n } = W(), r = t ?? C("toolbarItem.selectText", n);
|
|
1053
1064
|
return /* @__PURE__ */ a(
|
|
1054
|
-
|
|
1065
|
+
wt,
|
|
1055
1066
|
{
|
|
1056
|
-
command:
|
|
1067
|
+
command: ne,
|
|
1057
1068
|
ariaLabel: r,
|
|
1058
1069
|
className: `flipbook-toolbar-mouse-mode ${o ?? ""}`.trim(),
|
|
1059
|
-
children: /* @__PURE__ */
|
|
1070
|
+
children: /* @__PURE__ */ L("span", { className: "flipbook-toolbar-mouse-mode-icon", "aria-hidden": "true", children: [
|
|
1060
1071
|
/* @__PURE__ */ a("span", { className: "flipbook-toolbar-mouse-mode-caret" }),
|
|
1061
1072
|
/* @__PURE__ */ a("span", { children: e ?? C("toolbarItem.selectionLetters", n) })
|
|
1062
1073
|
] })
|
|
1063
1074
|
}
|
|
1064
1075
|
);
|
|
1065
|
-
},
|
|
1066
|
-
const { locale: o } = W(), { execute: n, canExecute: r } =
|
|
1067
|
-
n(
|
|
1068
|
-
}, i = C("command.jumpToNextPage", o), c = /* @__PURE__ */ a(
|
|
1076
|
+
}, Ft = ({ children: e, className: t }) => {
|
|
1077
|
+
const { locale: o } = W(), { execute: n, canExecute: r } = X(), s = () => {
|
|
1078
|
+
n(le);
|
|
1079
|
+
}, i = C("command.jumpToNextPage", o), c = /* @__PURE__ */ a(lt, { size: 20 });
|
|
1069
1080
|
return /* @__PURE__ */ a(
|
|
1070
1081
|
q,
|
|
1071
1082
|
{
|
|
1072
1083
|
onClick: s,
|
|
1073
1084
|
ariaLabel: i,
|
|
1074
1085
|
title: i,
|
|
1075
|
-
disabled: !r(
|
|
1086
|
+
disabled: !r(le),
|
|
1076
1087
|
className: `flipbook-toolbar-next ${t ?? ""}`.trim(),
|
|
1077
1088
|
children: e ?? c
|
|
1078
1089
|
}
|
|
1079
1090
|
);
|
|
1080
|
-
},
|
|
1091
|
+
}, Mt = ({
|
|
1081
1092
|
mode: e,
|
|
1082
1093
|
showTotal: t = !0,
|
|
1083
1094
|
placeholder: o = "—",
|
|
@@ -1086,58 +1097,58 @@ const Pt = ({
|
|
|
1086
1097
|
ariaLabel: s = "Go to page",
|
|
1087
1098
|
maxLength: i = 10
|
|
1088
1099
|
}) => {
|
|
1089
|
-
const { flipBookRef: c, pageSemantics:
|
|
1090
|
-
(
|
|
1091
|
-
[
|
|
1092
|
-
),
|
|
1093
|
-
const
|
|
1094
|
-
let
|
|
1095
|
-
return !
|
|
1096
|
-
}, [
|
|
1100
|
+
const { flipBookRef: c, pageSemantics: g, direction: w, currentPage: f, totalPages: p, of: N } = W(), E = e ?? (g ? "semantic" : "index"), M = n ?? (E === "semantic" && !!g), [j, v] = D(""), [B, d] = D(!1), m = Q(!1), y = Q(f), $ = f, O = f + 1 < p ? f + 1 : null, b = I(
|
|
1101
|
+
(l) => E === "semantic" && g ? g.indexToSemanticName(l) || "" : String(l + 1),
|
|
1102
|
+
[E, g]
|
|
1103
|
+
), F = b($), k = O != null ? b(O) : "", S = I(() => String(N), [N]), K = I(() => {
|
|
1104
|
+
const l = F, u = k;
|
|
1105
|
+
let h;
|
|
1106
|
+
return !l && !u ? h = o : l ? u ? l === u ? h = l : h = `${l} - ${u}` : h = l : h = u, t ? `${h} / ${S()}` : h;
|
|
1107
|
+
}, [F, k, o, t, S]), V = w === "rtl" ? k || F : F || k, P = K();
|
|
1097
1108
|
U(() => {
|
|
1098
|
-
const
|
|
1099
|
-
|
|
1100
|
-
}, [
|
|
1101
|
-
const
|
|
1102
|
-
(
|
|
1103
|
-
if (
|
|
1104
|
-
d(!0),
|
|
1105
|
-
const
|
|
1106
|
-
typeof requestAnimationFrame < "u" ? requestAnimationFrame(
|
|
1109
|
+
const l = f !== y.current;
|
|
1110
|
+
y.current = f, l && (m.current = !1), !B && !m.current && v(P);
|
|
1111
|
+
}, [P, B, f]);
|
|
1112
|
+
const Y = I(
|
|
1113
|
+
(l) => {
|
|
1114
|
+
if (M) {
|
|
1115
|
+
d(!0), v(V), m.current = !1;
|
|
1116
|
+
const u = () => l.target.select();
|
|
1117
|
+
typeof requestAnimationFrame < "u" ? requestAnimationFrame(u) : u();
|
|
1107
1118
|
}
|
|
1108
1119
|
},
|
|
1109
|
-
[
|
|
1110
|
-
),
|
|
1111
|
-
d(!1),
|
|
1112
|
-
}, [
|
|
1113
|
-
(
|
|
1114
|
-
if (
|
|
1115
|
-
if (
|
|
1116
|
-
const
|
|
1117
|
-
|
|
1120
|
+
[M, V]
|
|
1121
|
+
), H = I(() => {
|
|
1122
|
+
d(!1), m.current || v(P);
|
|
1123
|
+
}, [P]), x = I(
|
|
1124
|
+
(l) => {
|
|
1125
|
+
if (l.key === "Enter") {
|
|
1126
|
+
if (g && j.trim()) {
|
|
1127
|
+
const u = g.semanticNameToIndex(j.trim());
|
|
1128
|
+
u != null && u >= 0 && u < p && (c.current?.jumpToPage(u), m.current = !0);
|
|
1118
1129
|
}
|
|
1119
|
-
|
|
1120
|
-
} else
|
|
1130
|
+
l.currentTarget.blur();
|
|
1131
|
+
} else l.key === "Escape" && l.currentTarget.blur();
|
|
1121
1132
|
},
|
|
1122
|
-
[
|
|
1123
|
-
),
|
|
1124
|
-
|
|
1133
|
+
[j, g, p, c]
|
|
1134
|
+
), A = I((l) => {
|
|
1135
|
+
v(l.target.value);
|
|
1125
1136
|
}, []);
|
|
1126
|
-
return
|
|
1137
|
+
return M ? /* @__PURE__ */ a(
|
|
1127
1138
|
"input",
|
|
1128
1139
|
{
|
|
1129
1140
|
type: "text",
|
|
1130
|
-
className: `flipbook-toolbar-indicator ${
|
|
1131
|
-
value:
|
|
1132
|
-
onFocus:
|
|
1133
|
-
onBlur:
|
|
1134
|
-
onKeyDown:
|
|
1135
|
-
onChange:
|
|
1141
|
+
className: `flipbook-toolbar-indicator ${B ? "flipbook-toolbar-indicator--editing" : ""} ${r ?? ""}`.trim(),
|
|
1142
|
+
value: j,
|
|
1143
|
+
onFocus: Y,
|
|
1144
|
+
onBlur: H,
|
|
1145
|
+
onKeyDown: x,
|
|
1146
|
+
onChange: A,
|
|
1136
1147
|
"aria-label": s,
|
|
1137
1148
|
"aria-live": "polite",
|
|
1138
1149
|
"aria-atomic": "true",
|
|
1139
1150
|
maxLength: i,
|
|
1140
|
-
readOnly: !
|
|
1151
|
+
readOnly: !M
|
|
1141
1152
|
}
|
|
1142
1153
|
) : /* @__PURE__ */ a(
|
|
1143
1154
|
"span",
|
|
@@ -1145,39 +1156,39 @@ const Pt = ({
|
|
|
1145
1156
|
className: `flipbook-toolbar-indicator ${r ?? ""}`.trim(),
|
|
1146
1157
|
"aria-live": "polite",
|
|
1147
1158
|
"aria-atomic": "true",
|
|
1148
|
-
children:
|
|
1159
|
+
children: P
|
|
1149
1160
|
}
|
|
1150
1161
|
);
|
|
1151
|
-
},
|
|
1152
|
-
const { locale: o } = W(), { execute: n, canExecute: r } =
|
|
1153
|
-
n(
|
|
1154
|
-
}, i = C("command.jumpToPrevPage", o), c = /* @__PURE__ */ a(
|
|
1162
|
+
}, jt = ({ children: e, className: t }) => {
|
|
1163
|
+
const { locale: o } = W(), { execute: n, canExecute: r } = X(), s = () => {
|
|
1164
|
+
n(se);
|
|
1165
|
+
}, i = C("command.jumpToPrevPage", o), c = /* @__PURE__ */ a(at, { size: 20 });
|
|
1155
1166
|
return /* @__PURE__ */ a(
|
|
1156
1167
|
q,
|
|
1157
1168
|
{
|
|
1158
1169
|
onClick: s,
|
|
1159
1170
|
ariaLabel: i,
|
|
1160
1171
|
title: i,
|
|
1161
|
-
disabled: !r(
|
|
1172
|
+
disabled: !r(se),
|
|
1162
1173
|
className: `flipbook-toolbar-prev ${t ?? ""}`.trim(),
|
|
1163
1174
|
children: e ?? c
|
|
1164
1175
|
}
|
|
1165
1176
|
);
|
|
1166
|
-
},
|
|
1167
|
-
const { locale: n } = W(), { execute: r, canExecute: s } =
|
|
1168
|
-
r(
|
|
1169
|
-
},
|
|
1177
|
+
}, Bt = ({ children: e, ariaLabel: t, className: o }) => {
|
|
1178
|
+
const { locale: n } = W(), { execute: r, canExecute: s } = X(), i = t ?? C("command.jumpToToc", n), c = () => {
|
|
1179
|
+
r(de);
|
|
1180
|
+
}, g = !s(de);
|
|
1170
1181
|
return /* @__PURE__ */ a(
|
|
1171
1182
|
q,
|
|
1172
1183
|
{
|
|
1173
1184
|
onClick: c,
|
|
1174
1185
|
ariaLabel: i,
|
|
1175
|
-
disabled:
|
|
1186
|
+
disabled: g,
|
|
1176
1187
|
className: `flipbook-toolbar-toc ${o ?? ""}`.trim(),
|
|
1177
|
-
children: e ?? /* @__PURE__ */ a(
|
|
1188
|
+
children: e ?? /* @__PURE__ */ a(ut, { size: 18 })
|
|
1178
1189
|
}
|
|
1179
1190
|
);
|
|
1180
|
-
},
|
|
1191
|
+
}, xt = {
|
|
1181
1192
|
id: "openDownloadMenu",
|
|
1182
1193
|
enName: "Open download menu",
|
|
1183
1194
|
enDescription: "Open the download menu",
|
|
@@ -1187,7 +1198,7 @@ const Pt = ({
|
|
|
1187
1198
|
e.data?.open?.();
|
|
1188
1199
|
},
|
|
1189
1200
|
canExecute: (e) => typeof e.data?.open == "function"
|
|
1190
|
-
},
|
|
1201
|
+
}, St = ({
|
|
1191
1202
|
flipBookRef: e,
|
|
1192
1203
|
direction: t,
|
|
1193
1204
|
locale: o,
|
|
@@ -1196,14 +1207,14 @@ const Pt = ({
|
|
|
1196
1207
|
children: s,
|
|
1197
1208
|
enableHotkeys: i = !0,
|
|
1198
1209
|
commands: c,
|
|
1199
|
-
commandOptions:
|
|
1200
|
-
fullscreenTargetRef:
|
|
1210
|
+
commandOptions: g,
|
|
1211
|
+
fullscreenTargetRef: w
|
|
1201
1212
|
}) => {
|
|
1202
|
-
const
|
|
1203
|
-
...
|
|
1213
|
+
const f = t ?? pt(o ?? he), p = o ?? (f === "rtl" ? "he-IL" : "en-US"), N = Q(null), E = Q(null), [M, j] = D(0), [v, B] = D(0), [d, m] = D(0), [y, $] = D(!0), [O, b] = D(!1), [F, k] = D("turn"), S = {
|
|
1214
|
+
...w ? {
|
|
1204
1215
|
toggleFullscreen: {
|
|
1205
1216
|
data: {
|
|
1206
|
-
getFullscreenTarget: () =>
|
|
1217
|
+
getFullscreenTarget: () => w.current ?? null
|
|
1207
1218
|
}
|
|
1208
1219
|
}
|
|
1209
1220
|
} : {},
|
|
@@ -1212,112 +1223,112 @@ const Pt = ({
|
|
|
1212
1223
|
},
|
|
1213
1224
|
download: {
|
|
1214
1225
|
data: {
|
|
1215
|
-
onDownload: (
|
|
1226
|
+
onDownload: (x, A) => E.current?.(x, A)
|
|
1216
1227
|
}
|
|
1217
1228
|
}
|
|
1218
|
-
},
|
|
1219
|
-
for (const [
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1229
|
+
}, K = new Map(Object.entries(g ?? {}));
|
|
1230
|
+
for (const [x, A] of Object.entries(S)) {
|
|
1231
|
+
const J = K.get(x);
|
|
1232
|
+
K.set(
|
|
1233
|
+
x,
|
|
1234
|
+
J ? { ...A, ...J, data: { ...A.data, ...J.data } } : A
|
|
1224
1235
|
);
|
|
1225
1236
|
}
|
|
1226
|
-
const
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1237
|
+
const V = Object.fromEntries(K), P = I(() => {
|
|
1238
|
+
const x = e.current;
|
|
1239
|
+
x && (j(x.getCurrentPageIndex()), B(x.getTotalPages()), m(x.getOf()), $(x.isFirstPage()), b(x.isLastPage()), k(x.getMouseMode?.() ?? "turn"));
|
|
1229
1240
|
}, [e]);
|
|
1230
1241
|
U(() => {
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
return () => clearInterval(
|
|
1234
|
-
}, [
|
|
1235
|
-
const
|
|
1236
|
-
|
|
1242
|
+
P();
|
|
1243
|
+
const x = setInterval(P, 200);
|
|
1244
|
+
return () => clearInterval(x);
|
|
1245
|
+
}, [P]);
|
|
1246
|
+
const Y = /* @__PURE__ */ a(
|
|
1247
|
+
Ne.Provider,
|
|
1237
1248
|
{
|
|
1238
1249
|
value: {
|
|
1239
1250
|
flipBookRef: e,
|
|
1240
|
-
direction:
|
|
1241
|
-
locale:
|
|
1251
|
+
direction: f,
|
|
1252
|
+
locale: p,
|
|
1242
1253
|
pageSemantics: n,
|
|
1243
|
-
currentPage:
|
|
1244
|
-
totalPages:
|
|
1254
|
+
currentPage: M,
|
|
1255
|
+
totalPages: v,
|
|
1245
1256
|
of: d,
|
|
1246
|
-
isFirstPage:
|
|
1247
|
-
isLastPage:
|
|
1248
|
-
mouseMode:
|
|
1257
|
+
isFirstPage: y,
|
|
1258
|
+
isLastPage: O,
|
|
1259
|
+
mouseMode: F,
|
|
1249
1260
|
openDownloadMenuRef: N,
|
|
1250
|
-
downloadExecutorRef:
|
|
1251
|
-
fullscreenTargetRef:
|
|
1261
|
+
downloadExecutorRef: E,
|
|
1262
|
+
fullscreenTargetRef: w
|
|
1252
1263
|
},
|
|
1253
1264
|
children: /* @__PURE__ */ a(
|
|
1254
1265
|
"div",
|
|
1255
1266
|
{
|
|
1256
|
-
className: `flipbook-toolbar ${
|
|
1267
|
+
className: `flipbook-toolbar ${f === "rtl" ? "flipbook-toolbar--rtl" : ""} ${r}`.trim(),
|
|
1257
1268
|
role: "toolbar",
|
|
1258
1269
|
"aria-label": "FlipBook navigation",
|
|
1259
|
-
dir:
|
|
1270
|
+
dir: f,
|
|
1260
1271
|
children: s
|
|
1261
1272
|
}
|
|
1262
1273
|
)
|
|
1263
1274
|
}
|
|
1264
|
-
),
|
|
1275
|
+
), H = [xt, ...c ?? []];
|
|
1265
1276
|
return /* @__PURE__ */ a(
|
|
1266
|
-
|
|
1277
|
+
nt,
|
|
1267
1278
|
{
|
|
1268
1279
|
flipBookRef: e,
|
|
1269
|
-
currentPage:
|
|
1270
|
-
totalPages:
|
|
1271
|
-
direction:
|
|
1272
|
-
commands:
|
|
1273
|
-
commandOptions:
|
|
1280
|
+
currentPage: M,
|
|
1281
|
+
totalPages: v,
|
|
1282
|
+
direction: f,
|
|
1283
|
+
commands: H,
|
|
1284
|
+
commandOptions: V,
|
|
1274
1285
|
disableHotkeys: !i,
|
|
1275
|
-
children:
|
|
1286
|
+
children: Y
|
|
1276
1287
|
}
|
|
1277
1288
|
);
|
|
1278
1289
|
};
|
|
1279
1290
|
export {
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1291
|
+
Ct as ActionButton,
|
|
1292
|
+
Tt as BookmarkToggleButton,
|
|
1293
|
+
Pt as BookshelfIcon,
|
|
1294
|
+
st as ChevronFirstIcon,
|
|
1295
|
+
it as ChevronLastIcon,
|
|
1296
|
+
at as ChevronLeftIcon,
|
|
1297
|
+
lt as ChevronRightIcon,
|
|
1298
|
+
It as DownloadDropdown,
|
|
1299
|
+
mt as DownloadIcon,
|
|
1300
|
+
Dt as FirstPageButton,
|
|
1301
|
+
Et as FullscreenButton,
|
|
1302
|
+
Lt as LastPageButton,
|
|
1303
|
+
ct as MaximizeIcon,
|
|
1304
|
+
dt as MinimizeIcon,
|
|
1305
|
+
Nt as MouseModeButton,
|
|
1306
|
+
Ft as NextButton,
|
|
1307
|
+
Mt as PageIndicator,
|
|
1308
|
+
jt as PrevButton,
|
|
1309
|
+
Mt as SemanticPageIndicator,
|
|
1310
|
+
ut as TableOfContentsIcon,
|
|
1311
|
+
Bt as TocButton,
|
|
1312
|
+
wt as ToggleButton,
|
|
1313
|
+
St as Toolbar,
|
|
1303
1314
|
q as ToolbarButton,
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1315
|
+
me as canUseFullscreen,
|
|
1316
|
+
yt as createDefaultDownloadConfig,
|
|
1317
|
+
Je as defaultCommands,
|
|
1318
|
+
$e as downloadCommand,
|
|
1319
|
+
We as exitFullscreen,
|
|
1320
|
+
le as flipNextCommand,
|
|
1321
|
+
se as flipPrevCommand,
|
|
1322
|
+
xe as fullscreenStateEvents,
|
|
1323
|
+
ue as getFullscreenElement,
|
|
1324
|
+
ie as goToFirstCommand,
|
|
1325
|
+
ce as goToLastCommand,
|
|
1326
|
+
de as goToTocCommand,
|
|
1327
|
+
qe as requestFullscreen,
|
|
1328
|
+
ze as toggleDebugCommand,
|
|
1329
|
+
te as toggleFullscreenCommand,
|
|
1330
|
+
ne as toggleTextSelectionCommand,
|
|
1331
|
+
X as useCommands,
|
|
1321
1332
|
W as useToolbar
|
|
1322
1333
|
};
|
|
1323
1334
|
//# sourceMappingURL=index.js.map
|