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