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.
@@ -1,10 +1,10 @@
1
- import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
- import { createContext as pe, useContext as fe, useMemo as ee, useCallback as P, useEffect as W, useState as D, useRef as _, useLayoutEffect as Pe } from "react";
3
- let Te = 4;
4
- function ue() {
5
- return Te;
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 ye = {
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
- }, Ce = [
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: Ce,
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
- }, Ie = [{ 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: Ie,
42
+ hotkeys: Se,
43
43
  execute: (e) => {
44
44
  e.handle?.flipPrev();
45
45
  },
46
46
  canExecute: (e) => (e.handle?.getCurrentPageIndex() ?? 0) > 0
47
- }, De = [{ 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: De,
53
+ hotkeys: $e,
54
54
  execute: (e) => {
55
55
  e.handle?.jumpToPage(0);
56
56
  },
57
57
  canExecute: (e) => e.handle?.getCurrentPageIndex() !== 0
58
- }, Ne = [{ 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: Ne,
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
- }, Le = [{ 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: Le,
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
- }, Ee = [{ key: "d", modifiers: { ctrl: !0, alt: !0 } }], Fe = {
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: Ee,
94
+ hotkeys: Ke,
95
95
  execute: (e) => {
96
96
  e.handle?.toggleDebugBar?.();
97
97
  }
98
- }, je = [{ key: "F11" }], Me = {
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: je,
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
- }, $e = [
110
- oe,
111
- te,
174
+ }, qe = [
112
175
  ne,
113
- ae,
114
176
  re,
115
- Me,
116
- Fe,
117
- ye
177
+ ae,
178
+ le,
179
+ se,
180
+ Y,
181
+ He,
182
+ ee,
183
+ je
118
184
  ];
119
- function Be(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;
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
- function Se(e, o, a) {
123
- if (Be(o.key, a) !== e.key) return !1;
124
- const r = e.modifiers ?? {};
125
- return !(!!r.ctrl !== o.ctrlKey || !!r.shift !== o.shiftKey || !!r.alt !== o.altKey || !!r.meta !== o.metaKey);
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
- const be = pe(null), Re = ({
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,
131
- direction: r = "ltr",
132
- commands: n = [],
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 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 $e)
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 n)
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
- }, [n, s]), 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 (Se(M, d, r)) {
183
- d.preventDefault(), g(w.command);
184
- return;
185
- }
186
- }
187
- },
188
- [h, g, r]
189
- );
190
- W(() => {
191
- if (!i)
192
- return document.addEventListener("keydown", T), () => document.removeEventListener("keydown", T);
193
- }, [i, 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(be.Provider, { value: I, children: c });
203
- }, X = () => {
204
- const e = fe(be);
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 Ke(e) {
210
- let o = "";
211
- for (const a of new TextEncoder().encode(e))
212
- o += String.fromCharCode(a);
213
- return btoa(o);
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 me(e) {
216
- return { ext: "json", data: Ke(JSON.stringify(e, null, " ")) };
368
+ function we(e) {
369
+ return { ext: "json", data: tt(JSON.stringify(e, null, " ")) };
217
370
  }
218
- function oo(e) {
219
- const { pagesCount: o, pageSemantics: a } = e, r = (n) => {
220
- const s = a?.indexToSemanticName(n) ?? "", i = a?.indexToTitle(n) ?? "";
221
- return a ? { pageIndex: n, semanticName: s, title: i } : { pageIndex: n, semanticName: String(n + 1), title: `Page ${n + 1}` };
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 n = [];
226
- for (let s = 0; s < o; s++) {
227
- const i = r(s);
228
- (i.semanticName || i.title) && n.push(i);
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(me(n));
383
+ return Promise.resolve(we(r));
231
384
  },
232
- onDownloadPageRange: (n) => Promise.resolve(me(n.map(r)))
385
+ onDownloadPageRange: (r) => Promise.resolve(we(r.map(n)))
233
386
  };
234
387
  }
235
- const K = { size: 24 }, Ae = ({ size: e = K.size, className: o }) => /* @__PURE__ */ t(
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: o,
400
+ className: t,
248
401
  "aria-hidden": "true",
249
- children: /* @__PURE__ */ t("path", { d: "m15 18-6-6 6-6" })
402
+ children: /* @__PURE__ */ a("path", { d: "m15 18-6-6 6-6" })
250
403
  }
251
- ), ze = ({ size: e = K.size, className: o }) => /* @__PURE__ */ t(
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: o,
416
+ className: t,
264
417
  "aria-hidden": "true",
265
- children: /* @__PURE__ */ t("path", { d: "m9 18 6-6-6-6" })
418
+ children: /* @__PURE__ */ a("path", { d: "m9 18 6-6-6-6" })
266
419
  }
267
- ), He = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
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: o,
432
+ className: t,
280
433
  "aria-hidden": "true",
281
434
  children: [
282
- /* @__PURE__ */ t("path", { d: "m17 18-6-6 6-6" }),
283
- /* @__PURE__ */ t("path", { d: "M7 6v12" })
435
+ /* @__PURE__ */ a("path", { d: "m17 18-6-6 6-6" }),
436
+ /* @__PURE__ */ a("path", { d: "M7 6v12" })
284
437
  ]
285
438
  }
286
- ), Oe = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
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: o,
451
+ className: t,
299
452
  "aria-hidden": "true",
300
453
  children: [
301
- /* @__PURE__ */ t("path", { d: "m7 18 6-6-6-6" }),
302
- /* @__PURE__ */ t("path", { d: "M17 6v12" })
454
+ /* @__PURE__ */ a("path", { d: "m7 18 6-6-6-6" }),
455
+ /* @__PURE__ */ a("path", { d: "M17 6v12" })
303
456
  ]
304
457
  }
305
- ), Ue = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
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: o,
470
+ className: t,
318
471
  "aria-hidden": "true",
319
472
  children: [
320
- /* @__PURE__ */ t("path", { d: "M8 3H5a2 2 0 0 0-2 2v3" }),
321
- /* @__PURE__ */ t("path", { d: "M21 8V5a2 2 0 0 0-2-2h-3" }),
322
- /* @__PURE__ */ t("path", { d: "M3 16v3a2 2 0 0 0 2 2h3" }),
323
- /* @__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" })
324
477
  ]
325
478
  }
326
- ), We = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
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: o,
491
+ className: t,
339
492
  "aria-hidden": "true",
340
493
  children: [
341
- /* @__PURE__ */ t("path", { d: "M8 3v3a2 2 0 0 1-2 2H3" }),
342
- /* @__PURE__ */ t("path", { d: "M21 8h-3a2 2 0 0 1-2-2V3" }),
343
- /* @__PURE__ */ t("path", { d: "M3 16h3a2 2 0 0 1 2 2v3" }),
344
- /* @__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" })
345
498
  ]
346
499
  }
347
- ), qe = ({
348
- size: e = K.size,
349
- className: o
350
- }) => /* @__PURE__ */ y(
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: o,
515
+ className: t,
363
516
  "aria-hidden": "true",
364
517
  children: [
365
- /* @__PURE__ */ t("path", { d: "M16 5H3" }),
366
- /* @__PURE__ */ t("path", { d: "M16 12H3" }),
367
- /* @__PURE__ */ t("path", { d: "M16 19H3" }),
368
- /* @__PURE__ */ t("path", { d: "M21 5h.01" }),
369
- /* @__PURE__ */ t("path", { d: "M21 12h.01" }),
370
- /* @__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" })
371
524
  ]
372
525
  }
373
- ), to = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
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: o,
538
+ className: t,
386
539
  "aria-hidden": "true",
387
540
  children: [
388
- /* @__PURE__ */ t("path", { d: "M3 21h18" }),
389
- /* @__PURE__ */ t("rect", { x: "4", y: "7", width: "3", height: "14", rx: "0.5" }),
390
- /* @__PURE__ */ t("rect", { x: "8", y: "5", width: "3", height: "16", rx: "0.5" }),
391
- /* @__PURE__ */ t("rect", { x: "12", y: "9", width: "3", height: "12", rx: "0.5" }),
392
- /* @__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" })
393
546
  ]
394
547
  }
395
- ), Je = ({ size: e = K.size, className: o }) => /* @__PURE__ */ y(
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: o,
560
+ className: t,
408
561
  "aria-hidden": "true",
409
562
  children: [
410
- /* @__PURE__ */ t("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
411
- /* @__PURE__ */ t("polyline", { points: "7 10 12 15 17 10" }),
412
- /* @__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" })
413
566
  ]
414
567
  }
415
- ), A = ({
568
+ ), q = ({
416
569
  onClick: e,
417
- ariaLabel: o,
418
- ariaPressed: a,
419
- disabled: r = !1,
420
- children: n,
570
+ ariaLabel: t,
571
+ ariaPressed: o,
572
+ disabled: n = !1,
573
+ children: r,
421
574
  className: s = "",
422
575
  title: i
423
- }) => /* @__PURE__ */ t(
576
+ }) => /* @__PURE__ */ a(
424
577
  "button",
425
578
  {
426
579
  type: "button",
427
580
  onClick: e,
428
- "aria-label": o,
429
- "aria-pressed": a,
430
- disabled: r,
431
- title: i ?? o,
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: n
586
+ children: r
434
587
  }
435
- ), no = ({
588
+ ), vt = ({
436
589
  onClick: e,
437
- ariaLabel: o,
438
- children: a,
439
- disabled: r = !1,
440
- className: n
441
- }) => /* @__PURE__ */ t(
442
- A,
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: o,
446
- disabled: r,
447
- className: `flipbook-toolbar-action ${n ?? ""}`.trim(),
448
- children: a
598
+ ariaLabel: t,
599
+ disabled: n,
600
+ className: `flipbook-toolbar-action ${r ?? ""}`.trim(),
601
+ children: o
449
602
  }
450
- ), ao = ({
603
+ ), yt = ({
451
604
  enabled: e,
452
- onChange: o,
453
- ariaLabel: a,
454
- className: r
455
- }) => /* @__PURE__ */ t(
456
- A,
605
+ onChange: t,
606
+ ariaLabel: o,
607
+ className: n
608
+ }) => /* @__PURE__ */ a(
609
+ q,
457
610
  {
458
- onClick: () => o(!e),
459
- ariaLabel: a ?? (e ? "Hide bookmarks" : "Show bookmarks"),
611
+ onClick: () => t(!e),
612
+ ariaLabel: o ?? (e ? "Hide bookmarks" : "Show bookmarks"),
460
613
  ariaPressed: e,
461
- className: `flipbook-toolbar-bookmarks ${r ?? ""}`.trim(),
462
- children: /* @__PURE__ */ t("svg", { width: "18", height: "18", viewBox: "0 0 20 20", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ t(
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
- ), Ve = {
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
- }, Ge = {
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
- }, le = {
520
- "en-US": Ve,
521
- "he-IL": Ge
522
- }, se = "en-US", _e = {
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 we(e) {
541
- return le[e] ?? le[se];
702
+ function Ie(e) {
703
+ return de[e] ?? de[me];
542
704
  }
543
- function ie(e) {
544
- return we(e).direction === "rtl";
705
+ function ue(e) {
706
+ return Ie(e).direction === "rtl";
545
707
  }
546
- function Xe(e) {
547
- return ie(e) ? "rtl" : "ltr";
708
+ function gt(e) {
709
+ return ue(e) ? "rtl" : "ltr";
548
710
  }
549
- function E(e, o) {
550
- const a = we(o).translations[e];
551
- if (a !== void 0 && a !== "") return a;
552
- const r = le[se].translations[e];
553
- return r !== void 0 && r !== "" ? r : _e[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;
554
716
  }
555
- const xe = pe(null);
556
- function z() {
557
- const e = fe(xe);
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 ge(e) {
724
+ function xe(e) {
563
725
  return e.replace(/[׳'״"]/g, "");
564
726
  }
565
- function he(e, o) {
727
+ function ke(e, t) {
566
728
  try {
567
- const a = atob(e.data), r = new Uint8Array(a.length);
568
- for (let c = 0; c < a.length; c++)
569
- r[c] = a.charCodeAt(c);
570
- const n = new Blob([r]), s = URL.createObjectURL(n), i = document.createElement("a");
571
- i.href = s, i.download = `${o}.${e.ext}`, i.click(), URL.revokeObjectURL(s);
572
- } catch (a) {
573
- 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);
574
736
  }
575
737
  }
576
- function Qe(e, o) {
577
- const a = [];
578
- for (let r = 0; r < e; r++) {
579
- const n = o?.indexToSemanticName(r) ?? "", s = o?.indexToTitle(r) ?? "";
580
- if (!n && !s) {
581
- o || a.push({ pageIndex: r, semanticName: String(r + 1), title: `Page ${r + 1}` });
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
- a.push({
585
- pageIndex: r,
586
- semanticName: n || String(r + 1),
587
- title: s || n
746
+ o.push({
747
+ pageIndex: n,
748
+ semanticName: r || String(n + 1),
749
+ title: s || r
588
750
  });
589
751
  }
590
- return a;
752
+ return o;
591
753
  }
592
- const ro = ({
754
+ const Pt = ({
593
755
  ariaLabel: e = "Download",
594
- className: o
756
+ className: t
595
757
  }) => {
596
758
  const {
597
- totalPages: a,
598
- pageSemantics: r,
599
- locale: n,
759
+ totalPages: o,
760
+ pageSemantics: n,
761
+ locale: r,
600
762
  openDownloadMenuRef: s,
601
763
  downloadExecutorRef: i,
602
764
  flipBookRef: c
603
- } = z(), h = c.current?.getDownloadConfig?.() ?? void 0, [b, g] = D(!1);
604
- W(() => (s.current = () => g(!0), () => {
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 [C, N] = D("entire"), [T, I] = D(0), [d, u] = D(0), [w, F] = D(null), [M, V] = D(!1), S = _(null), H = _(null), j = ee(
608
- () => Qe(a, r),
609
- [a, r]
610
- ), $ = !!h?.onDownloadSefer, R = !!h?.onDownloadPageRange, G = $ || R, O = j[0]?.pageIndex ?? 0, q = j[j.length - 1]?.pageIndex ?? 0;
611
- W(() => {
612
- b && (N($ ? "entire" : "range"), I(O), u(q));
613
- }, [b, $, O, q]);
614
- const L = P(() => {
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
- Pe(() => {
618
- if (!b || !H.current || !S.current) return;
619
- const l = H.current, x = S.current.querySelector(".flipbook-toolbar-download-trigger"), v = () => {
620
- const p = x?.getBoundingClientRect();
621
- if (!p) return;
622
- const B = 8, U = 6, Y = window.innerHeight - p.bottom - U - B, ce = p.top - U - B, de = Math.min(l.scrollHeight, window.innerHeight * 0.7, 480), Z = Y < de && ce > Y;
623
- l.style.maxHeight = `${Math.max(0, Math.min(de, Z ? ce : Y))}px`;
624
- const Q = l.getBoundingClientRect(), ke = ie(n) ? p.left : p.right - Q.width;
625
- l.style.left = `${Math.max(B, Math.min(ke, window.innerWidth - Q.width - B))}px`;
626
- const ve = Z ? p.top - U - Q.height : p.bottom + U;
627
- l.style.top = `${Math.max(B, Math.min(ve, window.innerHeight - Q.height - B))}px`, V(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);
628
790
  };
629
- v();
630
- const m = new ResizeObserver(v);
631
- m.observe(l);
632
- const f = S.current.closest('[role="toolbar"]');
633
- return f && m.observe(f), window.addEventListener("resize", v), window.addEventListener("scroll", v, !0), () => {
634
- 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);
635
797
  };
636
- }, [b, n]), W(() => {
637
- if (!b) return;
638
- const l = (x) => {
639
- S.current && !S.current.contains(x.target) && L();
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
- }, [b, L]);
643
- const k = P(async () => {
804
+ }, [x, k]);
805
+ const G = L(async () => {
644
806
  const l = c.current?.getDownloadConfig?.();
645
807
  if (l?.onDownloadSefer) {
646
- F("sefer");
808
+ d("sefer");
647
809
  try {
648
- const x = await l.onDownloadSefer();
649
- x && he(x, l.entireBookFilename ?? "book"), L();
810
+ const b = await l.onDownloadSefer();
811
+ b && ke(b, l.entireBookFilename ?? "book"), k();
650
812
  } finally {
651
- F(null);
813
+ d(null);
652
814
  }
653
815
  }
654
- }, [c, L]), J = P(
655
- async (l, x) => {
656
- const v = c.current?.getDownloadConfig?.();
657
- if (!v?.onDownloadPageRange) return;
658
- const m = [], f = [];
659
- for (let p = l; p <= x; p++) {
660
- m.push(p);
661
- const B = j.find((U) => U.pageIndex === p);
662
- 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);
663
825
  }
664
- F("range");
826
+ d("range");
665
827
  try {
666
- const p = await v.onDownloadPageRange(
667
- m,
828
+ const w = await y.onDownloadPageRange(
668
829
  f,
669
- v.downloadContext
830
+ v,
831
+ y.downloadContext
670
832
  );
671
- if (p) {
672
- const B = ge(f[0]?.semanticName ?? String(l)), U = ge(
673
- f[f.length - 1]?.semanticName ?? String(x)
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
- he(p, `${v.rangeFilename ?? "pages"}-${B}-${U}`);
837
+ ke(w, `${y.rangeFilename ?? "pages"}-${R}-${V}`);
676
838
  }
677
- L();
839
+ k();
678
840
  } finally {
679
- F(null);
841
+ d(null);
680
842
  }
681
843
  },
682
- [c, j, L]
844
+ [c, p, k]
683
845
  );
684
- return W(() => (i.current = (l, x) => {
685
- l === void 0 && x === void 0 ? k() : l !== void 0 && x !== void 0 && J(l, x);
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, k, J]), G ? /* @__PURE__ */ y("div", { className: `flipbook-toolbar-download-wrap ${o ?? ""}`.trim(), ref: S, children: [
689
- /* @__PURE__ */ t(
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 ?? E("toolbarItem.download", n),
696
- "aria-expanded": b,
857
+ "aria-label": e ?? C("toolbarItem.download", r),
858
+ "aria-expanded": x,
697
859
  "aria-haspopup": "true",
698
- disabled: w !== null,
699
- children: /* @__PURE__ */ t(Je, { size: 18 })
860
+ disabled: S !== null,
861
+ children: /* @__PURE__ */ a(ct, { size: 18 })
700
862
  }
701
863
  ),
702
- b && /* @__PURE__ */ y(
864
+ x && /* @__PURE__ */ E(
703
865
  "div",
704
866
  {
705
- ref: H,
706
- 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(),
707
869
  role: "menu",
708
- dir: ie(n) ? "rtl" : "ltr",
870
+ dir: ue(r) ? "rtl" : "ltr",
709
871
  children: [
710
- /* @__PURE__ */ y(
872
+ /* @__PURE__ */ E(
711
873
  "fieldset",
712
874
  {
713
875
  className: "flipbook-toolbar-download-mode",
714
- "aria-label": E("toolbarItem.download", n),
876
+ "aria-label": C("toolbarItem.download", r),
715
877
  children: [
716
- $ && /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-radio-label", children: [
717
- /* @__PURE__ */ t(
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: C === "entire",
885
+ checked: h === "entire",
724
886
  onChange: () => N("entire")
725
887
  }
726
888
  ),
727
- /* @__PURE__ */ t("span", { children: E("command.downloadEntireBook", n) })
889
+ /* @__PURE__ */ a("span", { children: C("command.downloadEntireBook", r) })
728
890
  ] }),
729
- R && /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-radio-label", children: [
730
- /* @__PURE__ */ t(
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: C === "range",
898
+ checked: h === "range",
737
899
  onChange: () => N("range")
738
900
  }
739
901
  ),
740
- /* @__PURE__ */ t("span", { children: E("toolbarItem.downloadPageRange", n) })
902
+ /* @__PURE__ */ a("span", { children: C("toolbarItem.downloadPageRange", r) })
741
903
  ] })
742
904
  ]
743
905
  }
744
906
  ),
745
- C === "range" && /* @__PURE__ */ y("div", { className: "flipbook-toolbar-download-range", children: [
746
- /* @__PURE__ */ y("label", { className: "flipbook-toolbar-download-range-label", children: [
747
- E("toolbarItem.download.from", n),
748
- /* @__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(
749
911
  "select",
750
912
  {
751
913
  value: T,
752
- onChange: (l) => I(Number(l.target.value)),
914
+ onChange: (l) => j(Number(l.target.value)),
753
915
  className: "flipbook-toolbar-download-range-select",
754
- children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
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__ */ y("label", { className: "flipbook-toolbar-download-range-label", children: [
759
- E("toolbarItem.download.to", n),
760
- /* @__PURE__ */ t(
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: d,
764
- onChange: (l) => u(Number(l.target.value)),
925
+ value: B,
926
+ onChange: (l) => P(Number(l.target.value)),
765
927
  className: "flipbook-toolbar-download-range-select",
766
- children: j.map((l) => /* @__PURE__ */ t("option", { value: l.pageIndex, children: l.semanticName || l.title || `Page ${l.pageIndex + 1}` }, l.pageIndex))
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__ */ t(
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 (C === "entire")
779
- k();
940
+ if (h === "entire")
941
+ G();
780
942
  else {
781
- const l = c.current?.getTotalPages?.() ?? a, x = Math.min(T, d);
782
- let v = Math.max(T, d);
783
- if (l > 0 && v >= l && (v = l - 1), v < x) return;
784
- J(x, 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);
785
947
  }
786
948
  },
787
- disabled: w !== null,
788
- children: w === "sefer" || w === "range" ? "…" : E("toolbarItem.download.download", n)
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
- }, lo = ({ children: e, className: o }) => {
796
- const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
797
- r(ne);
798
- }, i = /* @__PURE__ */ t(He, { size: 18 }), c = E("command.jumpToFirstPage", a);
799
- return /* @__PURE__ */ t(
800
- 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,
801
963
  {
802
964
  onClick: s,
803
965
  ariaLabel: c,
804
966
  title: c,
805
- disabled: !n(ne),
806
- className: `flipbook-toolbar-first ${o ?? ""}`.trim(),
967
+ disabled: !r(ae),
968
+ className: `flipbook-toolbar-first ${t ?? ""}`.trim(),
807
969
  children: e ?? i
808
970
  }
809
971
  );
810
- }, io = ({
972
+ }, Tt = ({
811
973
  targetRef: e,
812
- enterIcon: o,
813
- exitIcon: a,
814
- ariaLabelEnter: r = "Enter fullscreen",
815
- ariaLabelExit: n = "Exit fullscreen",
816
- className: s
974
+ enterIcon: t,
975
+ exitIcon: o,
976
+ ariaLabelEnter: n,
977
+ ariaLabelExit: r,
978
+ unsupportedBehavior: s = "hide",
979
+ className: i
817
980
  }) => {
818
- const [i, c] = D(!1), h = z(), b = e ?? h.fullscreenTargetRef, g = P(() => {
819
- c(!!document.fullscreenElement);
820
- }, []);
821
- W(() => (document.addEventListener("fullscreenchange", g), () => {
822
- document.removeEventListener("fullscreenchange", g);
823
- }), [g]);
824
- const C = async () => {
825
- try {
826
- i ? await document.exitFullscreen() : await (b?.current ?? document.documentElement).requestFullscreen();
827
- } catch (I) {
828
- console.warn("Fullscreen request failed:", I);
829
- }
830
- }, N = i ? n : r, T = i ? a ?? /* @__PURE__ */ t(We, { size: 18 }) : o ?? /* @__PURE__ */ t(Ue, { size: 18 });
831
- return /* @__PURE__ */ t(
832
- 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,
833
1003
  {
834
- onClick: C,
835
- ariaLabel: N,
836
- className: `flipbook-toolbar-fullscreen ${i ? "flipbook-toolbar-fullscreen--active" : ""} ${s ?? ""}`.trim(),
837
- 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
838
1011
  }
839
1012
  );
840
- }, so = ({ children: e, className: o }) => {
841
- const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
842
- r(ae);
843
- }, i = /* @__PURE__ */ t(Oe, { size: 18 }), c = E("command.jumpToLastPage", a);
844
- return /* @__PURE__ */ t(
845
- 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,
846
1019
  {
847
1020
  onClick: s,
848
1021
  ariaLabel: c,
849
1022
  title: c,
850
- disabled: !n(ae),
851
- className: `flipbook-toolbar-last ${o ?? ""}`.trim(),
1023
+ disabled: !r(le),
1024
+ className: `flipbook-toolbar-last ${t ?? ""}`.trim(),
852
1025
  children: e ?? i
853
1026
  }
854
1027
  );
855
- }, co = ({
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: o,
858
- className: a
1049
+ ariaLabel: t,
1050
+ className: o
859
1051
  }) => {
860
- const { flipBookRef: r, locale: n, mouseMode: s } = z(), i = o ?? E("toolbarItem.selectText", n);
861
- return /* @__PURE__ */ t(
862
- A,
1052
+ const { locale: n } = W(), r = t ?? C("toolbarItem.selectText", n);
1053
+ return /* @__PURE__ */ a(
1054
+ ht,
863
1055
  {
864
- onClick: () => {
865
- r.current?.setMouseMode(s === "turn" ? "select" : "turn"), window.getSelection()?.removeAllRanges();
866
- },
867
- ariaLabel: i,
868
- ariaPressed: s === "select",
869
- className: `flipbook-toolbar-mouse-mode ${a ?? ""}`.trim(),
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
- }, uo = ({ children: e, className: o }) => {
877
- const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
878
- r(oe);
879
- }, i = E("command.jumpToNextPage", a), c = /* @__PURE__ */ t(ze, { size: 20 });
880
- return /* @__PURE__ */ t(
881
- 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,
882
1071
  {
883
1072
  onClick: s,
884
1073
  ariaLabel: i,
885
1074
  title: i,
886
- disabled: !n(oe),
887
- className: `flipbook-toolbar-next ${o ?? ""}`.trim(),
1075
+ disabled: !r(ne),
1076
+ className: `flipbook-toolbar-next ${t ?? ""}`.trim(),
888
1077
  children: e ?? c
889
1078
  }
890
1079
  );
891
- }, mo = ({
1080
+ }, Lt = ({
892
1081
  mode: e,
893
- showTotal: o = !0,
894
- placeholder: a = "—",
895
- editable: r,
896
- className: n,
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: h, direction: b, currentPage: g, totalPages: C, of: N } = z(), T = e ?? (h ? "semantic" : "index"), I = r ?? (T === "semantic" && !!h), [d, u] = D(""), [w, F] = D(!1), M = _(!1), V = _(g), S = g, H = g + 1 < C ? g + 1 : null, j = P(
901
- (m) => T === "semantic" && h ? h.indexToSemanticName(m) || "" : String(m + 1),
902
- [T, h]
903
- ), $ = j(S), R = H != null ? j(H) : "", G = P(() => String(N), [N]), O = P(() => {
904
- const m = $, f = R;
905
- let p;
906
- return !m && !f ? p = a : m ? f ? m === f ? p = m : p = `${m} - ${f}` : p = m : p = f, o ? `${p} / ${G()}` : p;
907
- }, [$, R, a, o, G]), q = b === "rtl" ? R || $ : $ || R, L = O();
908
- W(() => {
909
- const m = g !== V.current;
910
- V.current = g, m && (M.current = !1), !w && !M.current && u(L);
911
- }, [L, w, g]);
912
- const k = P(
913
- (m) => {
914
- if (I) {
915
- F(!0), u(q), M.current = !1;
916
- const f = () => m.target.select();
917
- 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();
918
1107
  }
919
1108
  },
920
- [I, q]
921
- ), J = P(() => {
922
- F(!1), M.current || u(L);
923
- }, [L]), l = P(
924
- (m) => {
925
- if (m.key === "Enter") {
926
- if (h && d.trim()) {
927
- const f = h.semanticNameToIndex(d.trim());
928
- 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);
929
1118
  }
930
- m.currentTarget.blur();
931
- } else m.key === "Escape" && m.currentTarget.blur();
1119
+ f.currentTarget.blur();
1120
+ } else f.key === "Escape" && f.currentTarget.blur();
932
1121
  },
933
- [d, h, C, c]
934
- ), x = P((m) => {
935
- u(m.target.value);
1122
+ [B, m, h, c]
1123
+ ), b = L((f) => {
1124
+ P(f.target.value);
936
1125
  }, []);
937
- return I ? /* @__PURE__ */ t(
1126
+ return j ? /* @__PURE__ */ a(
938
1127
  "input",
939
1128
  {
940
1129
  type: "text",
941
- className: `flipbook-toolbar-indicator ${w ? "flipbook-toolbar-indicator--editing" : ""} ${n ?? ""}`.trim(),
942
- value: d,
943
- onFocus: k,
944
- onBlur: J,
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: x,
1135
+ onChange: b,
947
1136
  "aria-label": s,
948
1137
  "aria-live": "polite",
949
1138
  "aria-atomic": "true",
950
1139
  maxLength: i,
951
- readOnly: !I
1140
+ readOnly: !j
952
1141
  }
953
- ) : /* @__PURE__ */ t(
1142
+ ) : /* @__PURE__ */ a(
954
1143
  "span",
955
1144
  {
956
- className: `flipbook-toolbar-indicator ${n ?? ""}`.trim(),
1145
+ className: `flipbook-toolbar-indicator ${r ?? ""}`.trim(),
957
1146
  "aria-live": "polite",
958
1147
  "aria-atomic": "true",
959
- children: L
1148
+ children: k
960
1149
  }
961
1150
  );
962
- }, go = ({ children: e, className: o }) => {
963
- const { locale: a } = z(), { execute: r, canExecute: n } = X(), s = () => {
964
- r(te);
965
- }, i = E("command.jumpToPrevPage", a), c = /* @__PURE__ */ t(Ae, { size: 20 });
966
- return /* @__PURE__ */ t(
967
- 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,
968
1157
  {
969
1158
  onClick: s,
970
1159
  ariaLabel: i,
971
1160
  title: i,
972
- disabled: !n(te),
973
- className: `flipbook-toolbar-prev ${o ?? ""}`.trim(),
1161
+ disabled: !r(re),
1162
+ className: `flipbook-toolbar-prev ${t ?? ""}`.trim(),
974
1163
  children: e ?? c
975
1164
  }
976
1165
  );
977
- }, ho = ({ children: e, ariaLabel: o, className: a }) => {
978
- const { locale: r } = z(), { execute: n, canExecute: s } = X(), i = o ?? E("command.jumpToToc", r), c = () => {
979
- n(re);
980
- }, h = !s(re);
981
- return /* @__PURE__ */ t(
982
- 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,
983
1172
  {
984
1173
  onClick: c,
985
1174
  ariaLabel: i,
986
- disabled: h,
987
- className: `flipbook-toolbar-toc ${a ?? ""}`.trim(),
988
- children: e ?? /* @__PURE__ */ t(qe, { size: 18 })
1175
+ disabled: m,
1176
+ className: `flipbook-toolbar-toc ${o ?? ""}`.trim(),
1177
+ children: e ?? /* @__PURE__ */ a(it, { size: 18 })
989
1178
  }
990
1179
  );
991
- }, Ye = {
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
- }, po = ({
1190
+ }, Mt = ({
1002
1191
  flipBookRef: e,
1003
- direction: o,
1004
- locale: a,
1005
- pageSemantics: r,
1006
- className: n = "",
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: h,
1011
- fullscreenTargetRef: b
1199
+ commandOptions: m,
1200
+ fullscreenTargetRef: x
1012
1201
  }) => {
1013
- const g = o ?? Xe(a ?? se), C = a ?? (g === "rtl" ? "he-IL" : "en-US"), N = _(null), T = _(null), [I, d] = D(0), [u, w] = D(0), [F, M] = D(0), [V, S] = D(!0), [H, j] = D(!1), [$, R] = D("turn"), G = {
1014
- ...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 ? {
1015
1204
  toggleFullscreen: {
1016
1205
  data: {
1017
- getFullscreenTarget: () => b.current ?? null
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: (k, J) => T.current?.(k, J)
1215
+ onDownload: (l, b) => T.current?.(l, b)
1027
1216
  }
1028
- },
1029
- ...h
1030
- }, O = P(() => {
1031
- const k = e.current;
1032
- k && (d(k.getCurrentPageIndex()), w(k.getTotalPages()), M(k.getOf()), S(k.isFirstPage()), j(k.isLastPage()), R(k.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"));
1033
1229
  }, [e]);
1034
- W(() => {
1035
- O();
1036
- const k = setInterval(O, 200);
1037
- return () => clearInterval(k);
1038
- }, [O]);
1039
- const q = /* @__PURE__ */ t(
1040
- xe.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,
1041
1237
  {
1042
1238
  value: {
1043
1239
  flipBookRef: e,
1044
1240
  direction: g,
1045
- locale: C,
1046
- pageSemantics: r,
1047
- currentPage: I,
1048
- totalPages: u,
1049
- of: F,
1050
- isFirstPage: V,
1051
- isLastPage: H,
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: b
1251
+ fullscreenTargetRef: x
1056
1252
  },
1057
- children: /* @__PURE__ */ t(
1253
+ children: /* @__PURE__ */ a(
1058
1254
  "div",
1059
1255
  {
1060
- className: `flipbook-toolbar ${g === "rtl" ? "flipbook-toolbar--rtl" : ""} ${n}`.trim(),
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
- ), L = [Ye, ...c ?? []];
1069
- return /* @__PURE__ */ t(
1070
- Re,
1264
+ ), _ = [pt, ...c ?? []];
1265
+ return /* @__PURE__ */ a(
1266
+ et,
1071
1267
  {
1072
1268
  flipBookRef: e,
1073
- currentPage: I,
1074
- totalPages: u,
1269
+ currentPage: j,
1270
+ totalPages: P,
1075
1271
  direction: g,
1076
- commands: L,
1077
- commandOptions: G,
1272
+ commands: _,
1273
+ commandOptions: O,
1078
1274
  disableHotkeys: !i,
1079
- children: q
1275
+ children: G
1080
1276
  }
1081
1277
  );
1082
1278
  };
1083
1279
  export {
1084
- no as ActionButton,
1085
- ao as BookmarkToggleButton,
1086
- to as BookshelfIcon,
1087
- He as ChevronFirstIcon,
1088
- Oe as ChevronLastIcon,
1089
- Ae as ChevronLeftIcon,
1090
- ze as ChevronRightIcon,
1091
- ro as DownloadDropdown,
1092
- Je as DownloadIcon,
1093
- lo as FirstPageButton,
1094
- io as FullscreenButton,
1095
- so as LastPageButton,
1096
- Ue as MaximizeIcon,
1097
- We as MinimizeIcon,
1098
- co as MouseModeButton,
1099
- uo as NextButton,
1100
- mo as PageIndicator,
1101
- go as PrevButton,
1102
- mo as SemanticPageIndicator,
1103
- qe as TableOfContentsIcon,
1104
- ho as TocButton,
1105
- po as Toolbar,
1106
- A as ToolbarButton,
1107
- oo as createDefaultDownloadConfig,
1108
- $e as defaultCommands,
1109
- ye as downloadCommand,
1110
- oe as flipNextCommand,
1111
- te as flipPrevCommand,
1112
- ne as goToFirstCommand,
1113
- ae as goToLastCommand,
1114
- re as goToTocCommand,
1115
- Fe as toggleDebugCommand,
1116
- Me as toggleFullscreenCommand,
1117
- X as useCommands,
1118
- 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
1119
1322
  };
1120
1323
  //# sourceMappingURL=index.js.map