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