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