@prose-reader/react-reader 1.188.0 → 1.190.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,118 +1,119 @@
1
- import { jsx as e, jsxs as a, Fragment as X } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as c, Fragment as U } from "react/jsx-runtime";
2
2
  import * as D from "react";
3
- import fe, { createContext as me, memo as f, useMemo as be, useEffect as Y, useContext as ie, useState as w, useCallback as B } from "react";
4
- import { signal as xe, useSignal as le, useLiveRef as Ce, useSubscribe as se, useObserve as P, useSignalValue as ve } from "reactjrx";
5
- import { tap as Ie, switchMap as ae, NEVER as Se, combineLatest as ke, map as ce, startWith as Pe } from "rxjs";
6
- import { IconButton as C, Portal as de, Dialog as b, List as I, Link as q, Stack as k, Text as g, Button as z, Heading as Q, HStack as O, Kbd as oe, Box as M, Popover as A, Progress as L, Presence as G, chakra as Te, Collapsible as U, Input as we } from "@chakra-ui/react";
7
- import { LuX as ye, LuNotebookPen as K, LuArrowBigRight as Re, LuArrowBigLeft as Oe, LuChevronDown as De, LuCircleHelp as Ae, LuTableOfContents as ze, LuSearch as Ee, LuCircleCheck as re } from "react-icons/lu";
8
- import { BsBookmarks as Be } from "react-icons/bs";
9
- import { RxDoubleArrowUp as Me, RxDoubleArrowLeft as Le, RxDoubleArrowDown as _e, RxDoubleArrowRight as $e } from "react-icons/rx";
10
- import { HiOutlineInformationCircle as Ne } from "react-icons/hi";
11
- import Fe from "rc-slider";
3
+ import fe, { createContext as me, memo as f, useMemo as be, useEffect as Q, useContext as le, useState as y, useCallback as M } from "react";
4
+ import { signal as xe, useSignal as se, useLiveRef as Ce, useSubscribe as ae, useObserve as b, useSignalValue as ve } from "reactjrx";
5
+ import { tap as ke, switchMap as ce, NEVER as Ie, combineLatest as Se, map as de, startWith as Pe } from "rxjs";
6
+ import { IconButton as m, Portal as he, Dialog as k, List as S, Link as G, Stack as P, Text as p, Button as E, Presence as q, Box as A, Heading as W, HStack as O, Kbd as re, Popover as z, Progress as _, chakra as we, Collapsible as K, Input as ye } from "@chakra-ui/react";
7
+ import { LuX as Te, LuNotebookPen as X, LuArrowBigRight as Re, LuArrowBigLeft as Oe, LuChevronDown as De, LuCircleHelp as ze, LuTableOfContents as Ae, LuSearch as Ee, LuCircleCheck as ie } from "react-icons/lu";
8
+ import { createPortal as Be } from "react-dom";
9
+ import { BsBookmarkPlus as Me, BsBookmarkXFill as _e, BsBookmarks as Le } from "react-icons/bs";
10
+ import { RxDoubleArrowUp as $e, RxDoubleArrowLeft as Ne, RxDoubleArrowDown as Fe, RxDoubleArrowRight as He } from "react-icons/rx";
11
+ import { HiOutlineInformationCircle as je } from "react-icons/hi";
12
+ import Ve from "rc-slider";
12
13
  import "rc-slider/assets/index.css";
13
- import { IoIosArrowBack as He, IoMdMore as je } from "react-icons/io";
14
- import { MdFullscreenExit as Ve, MdFullscreen as We } from "react-icons/md";
14
+ import { IoIosArrowBack as Ye, IoMdMore as qe } from "react-icons/io";
15
+ import { MdFullscreenExit as Ue, MdFullscreen as Qe } from "react-icons/md";
15
16
  const J = me({
16
17
  reader: void 0,
17
18
  quickMenuSignal: xe({ default: !1 })
18
- }), Ln = f(
19
+ }), Hn = f(
19
20
  ({
20
21
  children: n,
21
22
  reader: t,
22
23
  quickMenuOpen: o,
23
24
  onQuickMenuOpenChange: r
24
25
  }) => {
25
- const [, l] = le({
26
+ const [, l] = se({
26
27
  default: o
27
- }), i = Ce(r), c = be(
28
+ }), i = Ce(r), a = be(
28
29
  () => ({
29
30
  quickMenuSignal: l,
30
31
  reader: t
31
32
  }),
32
33
  [l, t]
33
34
  );
34
- return Y(() => {
35
+ return Q(() => {
35
36
  l.setValue(o);
36
- }, [o, l]), se(
37
- () => l.subject.pipe(Ie(i.current)),
37
+ }, [o, l]), ae(
38
+ () => l.subject.pipe(ke(i.current)),
38
39
  [l, i]
39
- ), /* @__PURE__ */ e(J.Provider, { value: c, children: n });
40
+ ), /* @__PURE__ */ e(J.Provider, { value: a, children: n });
40
41
  }
41
- ), Ye = D.forwardRef(function(t, o) {
42
- return /* @__PURE__ */ e(C, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ e(ye, {}) });
43
- }), _ = D.forwardRef(function(t, o) {
42
+ ), Ge = D.forwardRef(function(t, o) {
43
+ return /* @__PURE__ */ e(m, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ e(Te, {}) });
44
+ }), L = D.forwardRef(function(t, o) {
44
45
  const {
45
46
  children: r,
46
47
  portalled: l = !0,
47
48
  portalRef: i,
48
- backdrop: c = !0,
49
- ...d
49
+ backdrop: a = !0,
50
+ ...h
50
51
  } = t;
51
- return /* @__PURE__ */ a(de, { disabled: !l, container: i, children: [
52
- c && /* @__PURE__ */ e(b.Backdrop, {}),
53
- /* @__PURE__ */ e(b.Positioner, { children: /* @__PURE__ */ e(b.Content, { ref: o, ...d, asChild: !1, children: r }) })
52
+ return /* @__PURE__ */ c(he, { disabled: !l, container: i, children: [
53
+ a && /* @__PURE__ */ e(k.Backdrop, {}),
54
+ /* @__PURE__ */ e(k.Positioner, { children: /* @__PURE__ */ e(k.Content, { ref: o, ...h, asChild: !1, children: r }) })
54
55
  ] });
55
56
  }), $ = D.forwardRef(function(t, o) {
56
57
  return /* @__PURE__ */ e(
57
- b.CloseTrigger,
58
+ k.CloseTrigger,
58
59
  {
59
60
  position: "absolute",
60
61
  top: "2",
61
62
  insetEnd: "2",
62
63
  ...t,
63
64
  asChild: !0,
64
- children: /* @__PURE__ */ e(Ye, { size: "sm", ref: o, children: t.children })
65
+ children: /* @__PURE__ */ e(Ge, { size: "sm", ref: o, children: t.children })
65
66
  }
66
67
  );
67
- }), N = b.Root, F = b.Footer, H = b.Header, j = b.Body;
68
- b.Backdrop;
69
- const V = b.Title;
70
- b.Description;
71
- b.Trigger;
72
- const W = b.ActionTrigger, R = () => {
73
- const { reader: n } = ie(J);
68
+ }), N = k.Root, F = k.Footer, H = k.Header, j = k.Body;
69
+ k.Backdrop;
70
+ const V = k.Title;
71
+ k.Description;
72
+ k.Trigger;
73
+ const Y = k.ActionTrigger, T = () => {
74
+ const { reader: n } = le(J);
74
75
  return n;
75
- }, he = (n) => !!n && "__PROSE_READER_ENHANCER_SEARCH" in n, ue = (n) => !!n && "__PROSE_READER_ENHANCER_BOOKMARKS" in n, ge = (n) => !!n && "__PROSE_READER_ENHANCER_ANNOTATIONS" in n, qe = f(
76
+ }, ue = (n) => !!n && "__PROSE_READER_ENHANCER_SEARCH" in n, Z = (n) => !!n && "__PROSE_READER_ENHANCER_BOOKMARKS" in n, ge = (n) => !!n && "__PROSE_READER_ENHANCER_ANNOTATIONS" in n, Ke = f(
76
77
  ({ onNavigate: n }) => {
77
- const t = R(), o = ge(t) ? t : void 0, r = P(
78
+ const t = T(), o = ge(t) ? t : void 0, r = b(
78
79
  () => o == null ? void 0 : o.annotations.highlights$.pipe(
79
- ae(
80
+ ce(
80
81
  (i) => o.pagination.locate(i)
81
82
  )
82
83
  ),
83
84
  [o]
84
- ), l = (i, c) => {
85
- var d;
86
- return /* @__PURE__ */ e(I.Item, { children: /* @__PURE__ */ a(
87
- q,
85
+ ), l = (i, a) => {
86
+ var h;
87
+ return /* @__PURE__ */ e(S.Item, { children: /* @__PURE__ */ c(
88
+ G,
88
89
  {
89
90
  href: "#",
90
91
  onClick: () => {
91
92
  n(), t == null || t.navigation.goToCfi(i.cfi ?? "");
92
93
  },
93
94
  children: [
94
- (i.contents ?? [])[0] ? /* @__PURE__ */ e(I.Indicator, { asChild: !0, children: /* @__PURE__ */ e(K, {}) }) : /* @__PURE__ */ e(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(K, {}) }),
95
- /* @__PURE__ */ a(k, { gap: 0, children: [
96
- /* @__PURE__ */ e(g, { lineClamp: 2, fontSize: "md", children: i.selectionAsText ? i.selectionAsText ?? "" : /* @__PURE__ */ e("i", { children: /* @__PURE__ */ e("b", { children: "unknown (not loaded)" }) }) }),
95
+ (i.contents ?? [])[0] ? /* @__PURE__ */ e(S.Indicator, { asChild: !0, children: /* @__PURE__ */ e(X, {}) }) : /* @__PURE__ */ e(S.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(X, {}) }),
96
+ /* @__PURE__ */ c(P, { gap: 0, children: [
97
+ /* @__PURE__ */ e(p, { lineClamp: 2, fontSize: "md", children: i.selectionAsText ? i.selectionAsText ?? "" : /* @__PURE__ */ e("i", { children: /* @__PURE__ */ e("b", { children: "unknown (not loaded)" }) }) }),
97
98
  /* @__PURE__ */ e(
98
- g,
99
+ p,
99
100
  {
100
101
  fontStyle: "italic",
101
102
  fontWeight: "bold",
102
103
  fontSize: "sm",
103
- children: `Book page: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
104
+ children: `Book page: ${((h = i.meta) == null ? void 0 : h.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
104
105
  }
105
106
  )
106
107
  ] })
107
108
  ]
108
109
  }
109
- ) }, c);
110
+ ) }, a);
110
111
  };
111
- return /* @__PURE__ */ e(I.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: r == null ? void 0 : r.map(
112
- (i, c) => l(i, c)
112
+ return /* @__PURE__ */ e(S.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: r == null ? void 0 : r.map(
113
+ (i, a) => l(i, a)
113
114
  ) });
114
115
  }
115
- ), Ue = f(
116
+ ), We = f(
116
117
  ({
117
118
  open: n,
118
119
  setOpen: t,
@@ -126,49 +127,126 @@ const W = b.ActionTrigger, R = () => {
126
127
  onOpenChange: (r) => t(r.open),
127
128
  size: { mdDown: "full", md: "lg" },
128
129
  scrollBehavior: "inside",
129
- children: /* @__PURE__ */ a(_, { height: "100%", children: [
130
+ children: /* @__PURE__ */ c(L, { height: "100%", children: [
130
131
  /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(V, { children: "Annotations" }) }),
131
- /* @__PURE__ */ e(j, { flex: 1, children: /* @__PURE__ */ e(qe, { onNavigate: o }) }),
132
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ e(z, { variant: "outline", children: "Cancel" }) }) }),
132
+ /* @__PURE__ */ e(j, { flex: 1, children: /* @__PURE__ */ e(Ke, { onNavigate: o }) }),
133
+ /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Y, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "outline", children: "Cancel" }) }) }),
133
134
  /* @__PURE__ */ e($, {})
134
135
  ] })
135
136
  }
136
137
  )
137
- ), Qe = f(
138
+ ), Xe = f(() => {
139
+ const n = T(), t = Z(n) ? n : void 0, o = b(() => n == null ? void 0 : n.spine.element$, [n]), r = b(
140
+ () => t == null ? void 0 : t.bookmarks.pages$,
141
+ [t]
142
+ ), l = b(
143
+ () => t == null ? void 0 : t.bookmarks.bookmarks$,
144
+ [t]
145
+ ), i = b(
146
+ () => n == null ? void 0 : n.pagination.locate(l ?? []),
147
+ [n, l]
148
+ );
149
+ return o ? /* @__PURE__ */ e(U, { children: Be(
150
+ r == null ? void 0 : r.map(
151
+ ({ isBookmarkable: a, absolutePosition: { left: h, top: u, width: s } }, g) => {
152
+ const d = i == null ? void 0 : i.find(
153
+ (x) => {
154
+ var C;
155
+ return ((C = x.meta) == null ? void 0 : C.absolutePageIndex) === g;
156
+ }
157
+ );
158
+ return a ? /* @__PURE__ */ e(
159
+ q,
160
+ {
161
+ present: !0,
162
+ lazyMount: !0,
163
+ animationName: { _open: "fade-in", _closed: "fade-out" },
164
+ animationDuration: "moderate",
165
+ children: /* @__PURE__ */ e(
166
+ A,
167
+ {
168
+ "data-bookmark-area": !0,
169
+ position: "absolute",
170
+ left: h + s,
171
+ transform: "translateX(-100%)",
172
+ top: u,
173
+ p: 2,
174
+ children: d ? /* @__PURE__ */ e(
175
+ m,
176
+ {
177
+ "aria-label": "bookmark",
178
+ opacity: 0.5,
179
+ _hover: { opacity: 1 },
180
+ onClick: () => {
181
+ d && (t == null || t.bookmarks.delete(
182
+ d == null ? void 0 : d.id
183
+ ));
184
+ },
185
+ size: "lg",
186
+ variant: "ghost",
187
+ _icon: { boxSize: "36px" },
188
+ children: /* @__PURE__ */ e(_e, {})
189
+ }
190
+ ) : /* @__PURE__ */ e(
191
+ m,
192
+ {
193
+ "aria-label": "bookmark",
194
+ onClick: () => {
195
+ t == null || t.bookmarks.bookmark(g);
196
+ },
197
+ size: "lg",
198
+ bgColor: "white",
199
+ opacity: 0.5,
200
+ _hover: { opacity: 1 },
201
+ variant: "ghost",
202
+ _icon: { boxSize: "36px" },
203
+ children: /* @__PURE__ */ e(Me, {})
204
+ }
205
+ )
206
+ }
207
+ )
208
+ },
209
+ g
210
+ ) : null;
211
+ }
212
+ ),
213
+ o
214
+ ) }) : null;
215
+ }), Je = f(
138
216
  ({ onNavigate: n }) => {
139
- const t = R(), o = ue(t) ? t : void 0, r = P(
217
+ const t = T(), o = Z(t) ? t : void 0, r = b(
140
218
  () => o == null ? void 0 : o.bookmarks.bookmarks$.pipe(
141
- ae((i) => o.pagination.locate(i))
219
+ ce((i) => o.pagination.locate(i))
142
220
  ),
143
221
  [o]
144
- ), l = (i, c) => {
145
- var d, u, s, p, h;
146
- return /* @__PURE__ */ a(I.Item, { justifyContent: "space-between", alignItems: "center", children: [
222
+ ), l = (i, a) => {
223
+ var h, u, s, g, d;
224
+ return /* @__PURE__ */ c(S.Item, { justifyContent: "space-between", alignItems: "center", children: [
147
225
  /* @__PURE__ */ e(
148
- q,
226
+ G,
149
227
  {
150
228
  href: "#",
151
229
  onClick: () => {
152
230
  n(), t == null || t.navigation.goToCfi(i.cfi ?? "");
153
231
  },
154
- children: /* @__PURE__ */ a(k, { gap: 0, children: [
155
- /* @__PURE__ */ e(g, { fontSize: "md", children: `Book page: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown"}` }),
232
+ children: /* @__PURE__ */ c(P, { gap: 0, children: [
233
+ /* @__PURE__ */ e(p, { fontSize: "md", children: `Book page: ${((h = i.meta) == null ? void 0 : h.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown"}` }),
156
234
  /* @__PURE__ */ e(
157
- g,
235
+ p,
158
236
  {
159
237
  fontStyle: "italic",
160
238
  fontWeight: "bold",
161
239
  fontSize: "sm",
162
240
  truncate: !0,
163
241
  lineClamp: 2,
164
- children: (s = (u = i.meta) == null ? void 0 : u.startNode) != null && s.textContent ? (h = (p = i.meta) == null ? void 0 : p.startNode) == null ? void 0 : h.textContent : "..."
242
+ children: (s = (u = i.meta) == null ? void 0 : u.startNode) != null && s.textContent ? (d = (g = i.meta) == null ? void 0 : g.startNode) == null ? void 0 : d.textContent : "..."
165
243
  }
166
244
  )
167
245
  ] })
168
246
  }
169
247
  ),
170
248
  /* @__PURE__ */ e(
171
- z,
249
+ E,
172
250
  {
173
251
  colorPalette: "red",
174
252
  variant: "solid",
@@ -179,13 +257,13 @@ const W = b.ActionTrigger, R = () => {
179
257
  children: "Delete"
180
258
  }
181
259
  )
182
- ] }, c);
260
+ ] }, a);
183
261
  };
184
- return /* @__PURE__ */ e(I.Root, { overflowY: "auto", gap: 3, variant: "plain", overflow: "auto", children: r == null ? void 0 : r.map(
185
- (i, c) => l(i, c)
262
+ return /* @__PURE__ */ e(S.Root, { overflowY: "auto", gap: 3, variant: "plain", overflow: "auto", children: r == null ? void 0 : r.map(
263
+ (i, a) => l(i, a)
186
264
  ) });
187
265
  }
188
- ), Ge = f(
266
+ ), Ze = f(
189
267
  ({
190
268
  open: n,
191
269
  setOpen: t,
@@ -199,15 +277,15 @@ const W = b.ActionTrigger, R = () => {
199
277
  onOpenChange: (r) => t(r.open),
200
278
  size: { mdDown: "full", md: "lg" },
201
279
  scrollBehavior: "inside",
202
- children: /* @__PURE__ */ a(_, { height: "100%", children: [
280
+ children: /* @__PURE__ */ c(L, { height: "100%", children: [
203
281
  /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(V, { children: "Bookmarks" }) }),
204
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Qe, { onNavigate: o }) }),
205
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ e(z, { variant: "outline", children: "Cancel" }) }) }),
282
+ /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Je, { onNavigate: o }) }),
283
+ /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Y, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "outline", children: "Cancel" }) }) }),
206
284
  /* @__PURE__ */ e($, {})
207
285
  ] })
208
286
  }
209
287
  )
210
- ), Ke = "@prose-reader/react-reader", Xe = "1.187.0", Je = f(
288
+ ), en = "@prose-reader/react-reader", nn = "1.189.0", tn = f(
211
289
  ({
212
290
  open: n,
213
291
  setOpen: t
@@ -220,42 +298,42 @@ const W = b.ActionTrigger, R = () => {
220
298
  onOpenChange: (o) => t(o.open),
221
299
  size: { mdDown: "full", md: "lg" },
222
300
  scrollBehavior: "inside",
223
- children: /* @__PURE__ */ a(_, { children: [
301
+ children: /* @__PURE__ */ c(L, { children: [
224
302
  /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(V, { children: "Help" }) }),
225
- /* @__PURE__ */ a(j, { overflowY: "auto", flex: 1, children: [
226
- /* @__PURE__ */ e(Q, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
227
- /* @__PURE__ */ a(O, { mb: 1, children: [
228
- /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(Re, {}) }),
303
+ /* @__PURE__ */ c(j, { overflowY: "auto", flex: 1, children: [
304
+ /* @__PURE__ */ e(W, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
305
+ /* @__PURE__ */ c(O, { mb: 1, children: [
306
+ /* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(Re, {}) }),
229
307
  " ",
230
- /* @__PURE__ */ e(g, { children: "Navigate to right page" })
308
+ /* @__PURE__ */ e(p, { children: "Navigate to right page" })
231
309
  ] }),
232
- /* @__PURE__ */ a(O, { mb: 1, children: [
233
- /* @__PURE__ */ e(oe, { children: /* @__PURE__ */ e(Oe, {}) }),
310
+ /* @__PURE__ */ c(O, { mb: 1, children: [
311
+ /* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(Oe, {}) }),
234
312
  " ",
235
- /* @__PURE__ */ e(g, { children: "Navigate to left page" })
313
+ /* @__PURE__ */ e(p, { children: "Navigate to left page" })
236
314
  ] }),
237
- /* @__PURE__ */ e(Q, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
238
- /* @__PURE__ */ a(g, { children: [
239
- Ke,
315
+ /* @__PURE__ */ e(W, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
316
+ /* @__PURE__ */ c(p, { children: [
317
+ en,
240
318
  " version: ",
241
- Xe
319
+ nn
242
320
  ] })
243
321
  ] }),
244
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ e(z, { variant: "outline", children: "Cancel" }) }) }),
322
+ /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Y, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "outline", children: "Cancel" }) }) }),
245
323
  /* @__PURE__ */ e($, {})
246
324
  ] })
247
325
  }
248
326
  )
249
- ), E = () => {
250
- const n = R();
251
- return P(
252
- () => n ? ke([n.pagination.state$, n.context.state$]).pipe(
253
- ce(([t, o]) => {
327
+ ), B = () => {
328
+ const n = T();
329
+ return b(
330
+ () => n ? Se([n.pagination.state$, n.context.state$]).pipe(
331
+ de(([t, o]) => {
254
332
  var l;
255
333
  const r = (l = o.manifest) == null ? void 0 : l.spineItems.every(
256
334
  (i) => {
257
- var c;
258
- return (c = i.mediaType) == null ? void 0 : c.startsWith("image/");
335
+ var a;
336
+ return (a = i.mediaType) == null ? void 0 : a.startsWith("image/");
259
337
  }
260
338
  );
261
339
  return {
@@ -263,66 +341,66 @@ const W = b.ActionTrigger, R = () => {
263
341
  hasChapters: !o.isFullyPrePaginated && !r
264
342
  };
265
343
  })
266
- ) : Se,
344
+ ) : Ie,
267
345
  [n]
268
346
  );
269
- }, Ze = () => {
270
- const n = E(), t = Math.floor(
347
+ }, on = () => {
348
+ const n = B(), t = Math.floor(
271
349
  ((n == null ? void 0 : n.percentageEstimateOfBook) ?? 0) * 100
272
350
  ), o = t > 0 ? t : 1;
273
- return (n == null ? void 0 : n.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ e(M, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ a(g, { fontSize: "sm", children: [
351
+ return (n == null ? void 0 : n.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ e(A, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ c(p, { fontSize: "sm", children: [
274
352
  o,
275
353
  " %"
276
354
  ] }) });
277
- }, en = () => {
278
- const [n, t] = w(/* @__PURE__ */ new Date());
279
- return Y(() => {
355
+ }, rn = () => {
356
+ const [n, t] = y(/* @__PURE__ */ new Date());
357
+ return Q(() => {
280
358
  const o = setInterval(() => {
281
359
  t(/* @__PURE__ */ new Date());
282
360
  }, 6e4);
283
361
  return () => clearInterval(o);
284
362
  }, []), n;
285
- }, nn = (n) => {
286
- const t = en();
287
- return /* @__PURE__ */ e(g, { fontSize: "xs", ...n, children: t.toLocaleTimeString(navigator.language, {
363
+ }, ln = (n) => {
364
+ const t = rn();
365
+ return /* @__PURE__ */ e(p, { fontSize: "xs", ...n, children: t.toLocaleTimeString(navigator.language, {
288
366
  hour: "2-digit",
289
367
  minute: "2-digit"
290
368
  }) });
291
- }, Z = () => {
292
- const { quickMenuSignal: n } = ie(J);
369
+ }, ee = () => {
370
+ const { quickMenuSignal: n } = le(J);
293
371
  return [ve(n), n.setValue, n];
294
- }, tn = () => {
295
- const [n] = Z();
372
+ }, sn = () => {
373
+ const [n] = ee();
296
374
  return /* @__PURE__ */ e(
297
- M,
375
+ A,
298
376
  {
299
377
  position: "absolute",
300
378
  left: 0,
301
379
  bottom: 0,
302
380
  p: 2,
303
381
  color: n ? void 0 : "colorPalette.contrast",
304
- children: /* @__PURE__ */ e(nn, {})
382
+ children: /* @__PURE__ */ e(ln, {})
305
383
  }
306
384
  );
307
- }, on = D.forwardRef(
385
+ }, an = D.forwardRef(
308
386
  function(t, o) {
309
387
  const {
310
388
  showArrow: r,
311
389
  children: l,
312
390
  portalled: i = !0,
313
- content: c,
314
- portalRef: d,
391
+ content: a,
392
+ portalRef: h,
315
393
  ...u
316
394
  } = t;
317
- return /* @__PURE__ */ a(
318
- A.Root,
395
+ return /* @__PURE__ */ c(
396
+ z.Root,
319
397
  {
320
398
  ...u,
321
399
  positioning: { ...u.positioning, gutter: 4 },
322
400
  children: [
323
- /* @__PURE__ */ e(A.Trigger, { asChild: !0, children: l }),
324
- /* @__PURE__ */ e(de, { disabled: !i, container: d, children: /* @__PURE__ */ e(A.Positioner, { children: /* @__PURE__ */ a(
325
- A.Content,
401
+ /* @__PURE__ */ e(z.Trigger, { asChild: !0, children: l }),
402
+ /* @__PURE__ */ e(he, { disabled: !i, container: h, children: /* @__PURE__ */ e(z.Positioner, { children: /* @__PURE__ */ c(
403
+ z.Content,
326
404
  {
327
405
  width: "auto",
328
406
  px: "2",
@@ -331,8 +409,8 @@ const W = b.ActionTrigger, R = () => {
331
409
  rounded: "sm",
332
410
  ref: o,
333
411
  children: [
334
- r && /* @__PURE__ */ e(A.Arrow, { children: /* @__PURE__ */ e(A.ArrowTip, {}) }),
335
- c
412
+ r && /* @__PURE__ */ e(z.Arrow, { children: /* @__PURE__ */ e(z.ArrowTip, {}) }),
413
+ a
336
414
  ]
337
415
  }
338
416
  ) }) })
@@ -340,33 +418,33 @@ const W = b.ActionTrigger, R = () => {
340
418
  }
341
419
  );
342
420
  }
343
- ), rn = D.forwardRef(function(t, o) {
421
+ ), cn = D.forwardRef(function(t, o) {
344
422
  const { children: r, ...l } = t;
345
- return /* @__PURE__ */ e(on, { content: r, ...l, ref: o, children: /* @__PURE__ */ e(
346
- C,
423
+ return /* @__PURE__ */ e(an, { content: r, ...l, ref: o, children: /* @__PURE__ */ e(
424
+ m,
347
425
  {
348
426
  variant: "ghost",
349
427
  "aria-label": "info",
350
428
  size: "2xs",
351
429
  colorPalette: "gray",
352
- children: /* @__PURE__ */ e(Ne, {})
430
+ children: /* @__PURE__ */ e(je, {})
353
431
  }
354
432
  ) });
355
- }), ln = D.forwardRef(function(t, o) {
356
- return /* @__PURE__ */ e(L.Track, { ...t, ref: o, children: /* @__PURE__ */ e(L.Range, {}) });
433
+ }), dn = D.forwardRef(function(t, o) {
434
+ return /* @__PURE__ */ e(_.Track, { ...t, ref: o, children: /* @__PURE__ */ e(_.Range, {}) });
357
435
  });
358
436
  D.forwardRef(function(t, o) {
359
437
  const { children: r, info: l, ...i } = t;
360
- return /* @__PURE__ */ a(L.Label, { ...i, ref: o, children: [
438
+ return /* @__PURE__ */ c(_.Label, { ...i, ref: o, children: [
361
439
  r,
362
- l && /* @__PURE__ */ e(rn, { children: l })
440
+ l && /* @__PURE__ */ e(cn, { children: l })
363
441
  ] });
364
442
  });
365
- const sn = L.Root, an = L.ValueText, ee = () => {
366
- const n = E(), t = (n == null ? void 0 : n.numberOfTotalPages) === 1, o = ((n == null ? void 0 : n.beginNumberOfPagesInSpineItem) ?? 0) > 1, r = ((n == null ? void 0 : n.endNumberOfPagesInSpineItem) ?? 0) > 1, l = (n != null && n.hasChapters ? n == null ? void 0 : n.beginPageIndexInSpineItem : n == null ? void 0 : n.beginAbsolutePageIndex) ?? 0, i = (n != null && n.hasChapters ? n == null ? void 0 : n.endPageIndexInSpineItem : n == null ? void 0 : n.endAbsolutePageIndex) ?? 0, [c = 0, d = 0] = [
443
+ const hn = _.Root, un = _.ValueText, ne = () => {
444
+ const n = B(), t = (n == null ? void 0 : n.numberOfTotalPages) === 1, o = ((n == null ? void 0 : n.beginNumberOfPagesInSpineItem) ?? 0) > 1, r = ((n == null ? void 0 : n.endNumberOfPagesInSpineItem) ?? 0) > 1, l = (n != null && n.hasChapters ? n == null ? void 0 : n.beginPageIndexInSpineItem : n == null ? void 0 : n.beginAbsolutePageIndex) ?? 0, i = (n != null && n.hasChapters ? n == null ? void 0 : n.endPageIndexInSpineItem : n == null ? void 0 : n.endAbsolutePageIndex) ?? 0, [a = 0, h = 0] = [
367
445
  l,
368
446
  i
369
- ].sort((p, h) => p - h), u = (n == null ? void 0 : n.beginPageIndexInSpineItem) !== (n == null ? void 0 : n.endPageIndexInSpineItem) || (n == null ? void 0 : n.beginSpineItemIndex) !== (n == null ? void 0 : n.endSpineItemIndex), s = n != null && n.hasChapters ? n == null ? void 0 : n.beginNumberOfPagesInSpineItem : n == null ? void 0 : n.numberOfTotalPages;
447
+ ].sort((g, d) => g - d), u = (n == null ? void 0 : n.beginPageIndexInSpineItem) !== (n == null ? void 0 : n.endPageIndexInSpineItem) || (n == null ? void 0 : n.beginSpineItemIndex) !== (n == null ? void 0 : n.endSpineItemIndex), s = n != null && n.hasChapters ? n == null ? void 0 : n.beginNumberOfPagesInSpineItem : n == null ? void 0 : n.numberOfTotalPages;
370
448
  return {
371
449
  hasOnlyOnePage: t,
372
450
  beginPageIndex: l,
@@ -375,28 +453,28 @@ const sn = L.Root, an = L.ValueText, ee = () => {
375
453
  isEndWithinChapter: r,
376
454
  beginAndEndAreDifferent: u,
377
455
  totalApproximatePages: s,
378
- leftPageIndex: c,
379
- rightPageIndex: d
456
+ leftPageIndex: a,
457
+ rightPageIndex: h
380
458
  };
381
- }, cn = () => {
382
- const n = E(), {
459
+ }, gn = () => {
460
+ const n = B(), {
383
461
  hasOnlyOnePage: t,
384
462
  leftPageIndex: o,
385
463
  rightPageIndex: r,
386
464
  totalApproximatePages: l,
387
465
  beginAndEndAreDifferent: i
388
- } = ee(), c = Math.round(((n == null ? void 0 : n.percentageEstimateOfBook) ?? 0) * 100), d = (s) => s != null && s.subChapter ? `${s.title} / ${d(s.subChapter)}` : (s == null ? void 0 : s.title) || "", u = d(n == null ? void 0 : n.beginChapterInfo);
389
- return /* @__PURE__ */ a(k, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
390
- /* @__PURE__ */ e(sn, { value: c, size: "xs", width: 150, children: /* @__PURE__ */ a(O, { justifyContent: "space-between", children: [
391
- /* @__PURE__ */ e(ln, { width: 110 }),
392
- /* @__PURE__ */ e(an, { children: `${c}%` })
466
+ } = ne(), a = Math.round(((n == null ? void 0 : n.percentageEstimateOfBook) ?? 0) * 100), h = (s) => s != null && s.subChapter ? `${s.title} / ${h(s.subChapter)}` : (s == null ? void 0 : s.title) || "", u = h(n == null ? void 0 : n.beginChapterInfo);
467
+ return /* @__PURE__ */ c(P, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
468
+ /* @__PURE__ */ e(hn, { value: a, size: "xs", width: 150, children: /* @__PURE__ */ c(O, { justifyContent: "space-between", children: [
469
+ /* @__PURE__ */ e(dn, { width: 110 }),
470
+ /* @__PURE__ */ e(un, { children: `${a}%` })
393
471
  ] }) }),
394
- /* @__PURE__ */ e(g, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: u ? `Chapter: ${u}` : " " }),
395
- !t && /* @__PURE__ */ a(O, { children: [
396
- /* @__PURE__ */ e(g, { fontSize: "xs", children: i ? `${o + 1} - ${r + 1} of ${l}` : `${o + 1} of ${l}` }),
397
- !!(n != null && n.hasChapters) && /* @__PURE__ */ a(X, { children: [
398
- /* @__PURE__ */ e(g, { children: "-" }),
399
- /* @__PURE__ */ a(g, { fontSize: "xs", children: [
472
+ /* @__PURE__ */ e(p, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: u ? `Chapter: ${u}` : " " }),
473
+ !t && /* @__PURE__ */ c(O, { children: [
474
+ /* @__PURE__ */ e(p, { fontSize: "xs", children: i ? `${o + 1} - ${r + 1} of ${l}` : `${o + 1} of ${l}` }),
475
+ !!(n != null && n.hasChapters) && /* @__PURE__ */ c(U, { children: [
476
+ /* @__PURE__ */ e(p, { children: "-" }),
477
+ /* @__PURE__ */ c(p, { fontSize: "xs", children: [
400
478
  "(",
401
479
  ((n == null ? void 0 : n.beginAbsolutePageIndex) ?? 0) + 1,
402
480
  ")"
@@ -410,7 +488,7 @@ const sn = L.Root, an = L.ValueText, ee = () => {
410
488
  position: t,
411
489
  ...o
412
490
  }) => /* @__PURE__ */ e(
413
- G,
491
+ q,
414
492
  {
415
493
  display: "flex",
416
494
  flexDirection: "row",
@@ -434,8 +512,8 @@ const sn = L.Root, an = L.ValueText, ee = () => {
434
512
  children: n
435
513
  }
436
514
  )
437
- ), dn = Te(Fe), hn = f((n) => /* @__PURE__ */ e(
438
- M,
515
+ ), pn = we(Ve), fn = f((n) => /* @__PURE__ */ e(
516
+ A,
439
517
  {
440
518
  display: "contents",
441
519
  css: {
@@ -444,7 +522,7 @@ const sn = L.Root, an = L.ValueText, ee = () => {
444
522
  "--color-solid": "colors.colorPalette.solid"
445
523
  },
446
524
  children: /* @__PURE__ */ e(
447
- dn,
525
+ pn,
448
526
  {
449
527
  keyboard: !1,
450
528
  style: {
@@ -488,66 +566,66 @@ const sn = L.Root, an = L.ValueText, ee = () => {
488
566
  }
489
567
  )
490
568
  }
491
- )), un = () => {
492
- const n = E(), t = n == null ? void 0 : n.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = ee(), l = t ? Math.floor((o || 0) / 2) : o, [i, c] = le({
569
+ )), mn = () => {
570
+ const n = B(), t = n == null ? void 0 : n.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = ne(), l = t ? Math.floor((o || 0) / 2) : o, [i, a] = se({
493
571
  default: l || 0
494
- }), d = 0, u = Math.max(
572
+ }), h = 0, u = Math.max(
495
573
  0,
496
574
  t ? Math.floor((r - 1) / 2) : r - 1
497
575
  );
498
- return Y(() => {
499
- c.setValue(l || 0);
500
- }, [l, c]), {
576
+ return Q(() => {
577
+ a.setValue(l || 0);
578
+ }, [l, a]), {
501
579
  value: i,
502
- valueSignal: c,
503
- min: d,
580
+ valueSignal: a,
581
+ min: h,
504
582
  max: u
505
583
  };
506
- }, gn = (n) => {
507
- const t = R(), o = E(), { manifest: r } = P(() => t == null ? void 0 : t.context.state$, []) ?? {}, l = (r == null ? void 0 : r.readingDirection) === "rtl", i = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: c = 0, isBeginWithinChapter: d } = ee(), u = 1, s = d, { value: p, valueSignal: h, min: v, max: S } = un(), T = B(
508
- (m) => {
509
- const [y = 0] = Array.isArray(m) ? m : [m];
510
- h.setValue(y);
511
- const x = i ? Math.floor(y) * 2 : Math.floor(y);
584
+ }, bn = (n) => {
585
+ const t = T(), o = B(), { manifest: r } = b(() => t == null ? void 0 : t.context.state$, []) ?? {}, l = (r == null ? void 0 : r.readingDirection) === "rtl", i = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: a = 0, isBeginWithinChapter: h } = ne(), u = 1, s = h, { value: g, valueSignal: d, min: x, max: C } = mn(), w = M(
586
+ (v) => {
587
+ const [R = 0] = Array.isArray(v) ? v : [v];
588
+ d.setValue(R);
589
+ const I = i ? Math.floor(R) * 2 : Math.floor(R);
512
590
  s ? t == null || t.navigation.goToPageOfSpineItem({
513
- pageIndex: x,
591
+ pageIndex: I,
514
592
  spineItemId: t.pagination.getState().beginSpineItemIndex ?? 0,
515
593
  animation: !1
516
594
  }) : t == null || t.navigation.goToAbsolutePageIndex({
517
- absolutePageIndex: x,
595
+ absolutePageIndex: I,
518
596
  animation: !1
519
597
  });
520
598
  },
521
- [t, i, h, s]
599
+ [t, i, d, s]
522
600
  );
523
- return se(
601
+ return ae(
524
602
  () => t == null ? void 0 : t.navigation.throttleLock({
525
603
  duration: 100,
526
- trigger: h.subject
604
+ trigger: d.subject
527
605
  }),
528
- [t, h]
529
- ), c === 1 || i && c === 2 ? null : /* @__PURE__ */ e(
530
- hn,
606
+ [t, d]
607
+ ), a === 1 || i && a === 2 ? null : /* @__PURE__ */ e(
608
+ fn,
531
609
  {
532
- value: [p],
533
- max: S,
534
- min: v,
610
+ value: [g],
611
+ max: C,
612
+ min: x,
535
613
  reverse: l,
536
614
  step: u,
537
- onChange: T,
615
+ onChange: w,
538
616
  ...n
539
617
  }
540
618
  );
541
- }, pn = f(
619
+ }, xn = f(
542
620
  ({
543
621
  open: n,
544
622
  onItemClick: t
545
623
  }) => {
546
- const o = R(), r = P(() => o == null ? void 0 : o.navigation.state$, [o]), l = P(() => o == null ? void 0 : o.settings.values$, [o]), i = (l == null ? void 0 : l.computedPageTurnDirection) === "vertical", [c, d] = w(!0);
547
- return /* @__PURE__ */ e(pe, { present: n, position: "bottom", children: /* @__PURE__ */ a(k, { flex: 1, overflow: "auto", children: [
548
- /* @__PURE__ */ a(O, { flex: 1, alignItems: "center", justifyContent: "center", children: [
624
+ const o = T(), r = b(() => o == null ? void 0 : o.navigation.state$, [o]), l = b(() => o == null ? void 0 : o.settings.values$, [o]), i = (l == null ? void 0 : l.computedPageTurnDirection) === "vertical", [a, h] = y(!0);
625
+ return /* @__PURE__ */ e(pe, { present: n, position: "bottom", children: /* @__PURE__ */ c(P, { flex: 1, overflow: "auto", children: [
626
+ /* @__PURE__ */ c(O, { flex: 1, alignItems: "center", justifyContent: "center", children: [
549
627
  /* @__PURE__ */ e(
550
- C,
628
+ m,
551
629
  {
552
630
  "aria-label": "left",
553
631
  size: "lg",
@@ -555,11 +633,11 @@ const sn = L.Root, an = L.ValueText, ee = () => {
555
633
  flexShrink: 0,
556
634
  onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
557
635
  disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
558
- children: i ? /* @__PURE__ */ e(Me, {}) : /* @__PURE__ */ e(Le, {})
636
+ children: i ? /* @__PURE__ */ e($e, {}) : /* @__PURE__ */ e(Ne, {})
559
637
  }
560
638
  ),
561
- /* @__PURE__ */ a(
562
- k,
639
+ /* @__PURE__ */ c(
640
+ P,
563
641
  {
564
642
  flex: 1,
565
643
  maxW: 400,
@@ -568,9 +646,9 @@ const sn = L.Root, an = L.ValueText, ee = () => {
568
646
  overflow: "auto",
569
647
  px: 4,
570
648
  children: [
571
- /* @__PURE__ */ e(cn, {}),
649
+ /* @__PURE__ */ e(gn, {}),
572
650
  /* @__PURE__ */ e(
573
- gn,
651
+ bn,
574
652
  {
575
653
  style: {
576
654
  width: "100%",
@@ -583,7 +661,7 @@ const sn = L.Root, an = L.ValueText, ee = () => {
583
661
  }
584
662
  ),
585
663
  /* @__PURE__ */ e(
586
- C,
664
+ m,
587
665
  {
588
666
  "aria-label": "right",
589
667
  size: "lg",
@@ -593,21 +671,21 @@ const sn = L.Root, an = L.ValueText, ee = () => {
593
671
  onClick: () => {
594
672
  o == null || o.navigation.goToRightOrBottomSpineItem();
595
673
  },
596
- children: i ? /* @__PURE__ */ e(_e, {}) : /* @__PURE__ */ e($e, {})
674
+ children: i ? /* @__PURE__ */ e(Fe, {}) : /* @__PURE__ */ e(He, {})
597
675
  }
598
676
  )
599
677
  ] }),
600
- /* @__PURE__ */ e(O, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ a(
601
- U.Root,
678
+ /* @__PURE__ */ e(O, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
679
+ K.Root,
602
680
  {
603
- open: c,
681
+ open: a,
604
682
  flex: 1,
605
683
  onOpenChange: ({ open: u }) => {
606
- d(u);
684
+ h(u);
607
685
  },
608
686
  children: [
609
687
  /* @__PURE__ */ e(
610
- U.Trigger,
688
+ K.Trigger,
611
689
  {
612
690
  paddingY: "3",
613
691
  width: "100%",
@@ -617,35 +695,35 @@ const sn = L.Root, an = L.ValueText, ee = () => {
617
695
  De,
618
696
  {
619
697
  style: {
620
- transform: c ? "rotate(0deg)" : "rotate(180deg)"
698
+ transform: a ? "rotate(0deg)" : "rotate(180deg)"
621
699
  }
622
700
  }
623
701
  )
624
702
  }
625
703
  ),
626
- /* @__PURE__ */ a(U.Content, { display: "flex", justifyContent: "center", children: [
704
+ /* @__PURE__ */ c(K.Content, { display: "flex", justifyContent: "center", children: [
627
705
  /* @__PURE__ */ e(
628
- C,
706
+ m,
629
707
  {
630
708
  "aria-label": "Help",
631
709
  size: "lg",
632
710
  variant: "ghost",
633
711
  onClick: () => t("help"),
634
- children: /* @__PURE__ */ e(Ae, {})
712
+ children: /* @__PURE__ */ e(ze, {})
635
713
  }
636
714
  ),
637
715
  /* @__PURE__ */ e(
638
- C,
716
+ m,
639
717
  {
640
718
  "aria-label": "Table of contents",
641
719
  size: "lg",
642
720
  variant: "ghost",
643
721
  onClick: () => t("toc"),
644
- children: /* @__PURE__ */ e(ze, {})
722
+ children: /* @__PURE__ */ e(Ae, {})
645
723
  }
646
724
  ),
647
- he(o) && /* @__PURE__ */ e(
648
- C,
725
+ ue(o) && /* @__PURE__ */ e(
726
+ m,
649
727
  {
650
728
  "aria-label": "Search",
651
729
  size: "lg",
@@ -654,24 +732,24 @@ const sn = L.Root, an = L.ValueText, ee = () => {
654
732
  children: /* @__PURE__ */ e(Ee, {})
655
733
  }
656
734
  ),
657
- ue(o) && /* @__PURE__ */ e(
658
- C,
735
+ Z(o) && /* @__PURE__ */ e(
736
+ m,
659
737
  {
660
738
  "aria-label": "Search",
661
739
  size: "lg",
662
740
  variant: "ghost",
663
741
  onClick: () => t("bookmarks"),
664
- children: /* @__PURE__ */ e(Be, {})
742
+ children: /* @__PURE__ */ e(Le, {})
665
743
  }
666
744
  ),
667
745
  ge(o) && /* @__PURE__ */ e(
668
- C,
746
+ m,
669
747
  {
670
748
  "aria-label": "Search",
671
749
  size: "lg",
672
750
  variant: "ghost",
673
751
  onClick: () => t("annotations"),
674
- children: /* @__PURE__ */ e(K, {})
752
+ children: /* @__PURE__ */ e(X, {})
675
753
  }
676
754
  )
677
755
  ] })
@@ -680,13 +758,13 @@ const sn = L.Root, an = L.ValueText, ee = () => {
680
758
  ) })
681
759
  ] }) });
682
760
  }
683
- ), fn = () => {
684
- const [n, t] = w(!1), o = B(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
761
+ ), Cn = () => {
762
+ const [n, t] = y(!1), o = M(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
685
763
  t(!1);
686
764
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
687
765
  t(!0);
688
766
  }), []);
689
- return Y(() => {
767
+ return Q(() => {
690
768
  function r() {
691
769
  t(!!document.fullscreenElement);
692
770
  }
@@ -697,13 +775,13 @@ const sn = L.Root, an = L.ValueText, ee = () => {
697
775
  isFullscreen: n,
698
776
  onToggleFullscreenClick: o
699
777
  };
700
- }, mn = f(
778
+ }, vn = f(
701
779
  ({
702
780
  open: n,
703
781
  onItemClick: t
704
782
  }) => {
705
- const o = R(), r = P(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: l, onToggleFullscreenClick: i } = fn();
706
- return /* @__PURE__ */ a(
783
+ const o = T(), r = b(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: l, onToggleFullscreenClick: i } = Cn();
784
+ return /* @__PURE__ */ c(
707
785
  pe,
708
786
  {
709
787
  present: n,
@@ -712,18 +790,18 @@ const sn = L.Root, an = L.ValueText, ee = () => {
712
790
  justifyContent: "space-between",
713
791
  children: [
714
792
  /* @__PURE__ */ e(
715
- C,
793
+ m,
716
794
  {
717
795
  "aria-label": "left",
718
796
  size: "lg",
719
797
  variant: "ghost",
720
798
  flexShrink: 0,
721
799
  onClick: () => t("back"),
722
- children: /* @__PURE__ */ e(He, {})
800
+ children: /* @__PURE__ */ e(Ye, {})
723
801
  }
724
802
  ),
725
803
  /* @__PURE__ */ e(
726
- k,
804
+ P,
727
805
  {
728
806
  flex: 1,
729
807
  maxW: 600,
@@ -731,30 +809,30 @@ const sn = L.Root, an = L.ValueText, ee = () => {
731
809
  alignItems: "center",
732
810
  overflow: "auto",
733
811
  px: 4,
734
- children: /* @__PURE__ */ e(g, { truncate: !0, maxWidth: "100%", children: r == null ? void 0 : r.title })
812
+ children: /* @__PURE__ */ e(p, { truncate: !0, maxWidth: "100%", children: r == null ? void 0 : r.title })
735
813
  }
736
814
  ),
737
- /* @__PURE__ */ a(O, { children: [
815
+ /* @__PURE__ */ c(O, { children: [
738
816
  /* @__PURE__ */ e(
739
- C,
817
+ m,
740
818
  {
741
819
  "aria-label": "right",
742
820
  size: "lg",
743
821
  flexShrink: 0,
744
822
  variant: "ghost",
745
823
  onClick: () => t("more"),
746
- children: /* @__PURE__ */ e(je, {})
824
+ children: /* @__PURE__ */ e(qe, {})
747
825
  }
748
826
  ),
749
827
  /* @__PURE__ */ e(
750
- C,
828
+ m,
751
829
  {
752
830
  "aria-label": "right",
753
831
  size: "lg",
754
832
  flexShrink: 0,
755
833
  variant: "ghost",
756
834
  onClick: i,
757
- children: l ? /* @__PURE__ */ e(Ve, {}) : /* @__PURE__ */ e(We, {})
835
+ children: l ? /* @__PURE__ */ e(Ue, {}) : /* @__PURE__ */ e(Qe, {})
758
836
  }
759
837
  )
760
838
  ] })
@@ -762,17 +840,17 @@ const sn = L.Root, an = L.ValueText, ee = () => {
762
840
  }
763
841
  );
764
842
  }
765
- ), bn = f(
843
+ ), kn = f(
766
844
  ({
767
845
  onItemClick: n
768
846
  }) => {
769
- const [t] = Z();
770
- return /* @__PURE__ */ a(X, { children: [
771
- /* @__PURE__ */ e(mn, { open: t, onItemClick: n }),
772
- /* @__PURE__ */ e(pn, { open: t, onItemClick: n })
847
+ const [t] = ee();
848
+ return /* @__PURE__ */ c(U, { children: [
849
+ /* @__PURE__ */ e(vn, { open: t, onItemClick: n }),
850
+ /* @__PURE__ */ e(xn, { open: t, onItemClick: n })
773
851
  ] });
774
852
  }
775
- ), xn = f(
853
+ ), In = f(
776
854
  ({
777
855
  contextText: n = "",
778
856
  startOffset: t = 0,
@@ -781,7 +859,7 @@ const sn = L.Root, an = L.ValueText, ee = () => {
781
859
  onClick: l,
782
860
  absolutePageIndex: i
783
861
  }) => {
784
- const d = n.substring(
862
+ const h = n.substring(
785
863
  Math.max(t - 15, 0),
786
864
  Math.max(t, 0)
787
865
  ), u = n.substring(
@@ -791,8 +869,8 @@ const sn = L.Root, an = L.ValueText, ee = () => {
791
869
  n.length - 1
792
870
  )
793
871
  );
794
- return /* @__PURE__ */ a(
795
- q,
872
+ return /* @__PURE__ */ c(
873
+ G,
796
874
  {
797
875
  href: r,
798
876
  style: { margin: 5, overflow: "hidden" },
@@ -804,42 +882,42 @@ const sn = L.Root, an = L.ValueText, ee = () => {
804
882
  alignItems: "flex-start",
805
883
  gap: 0,
806
884
  children: [
807
- /* @__PURE__ */ a(g, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
885
+ /* @__PURE__ */ c(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
808
886
  '"',
809
- d,
887
+ h,
810
888
  /* @__PURE__ */ e("b", { children: o }),
811
889
  u,
812
890
  '"'
813
891
  ] }),
814
- /* @__PURE__ */ e(g, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${i !== void 0 ? i + 1 : "unknown (not loaded)"}` })
892
+ /* @__PURE__ */ e(p, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${i !== void 0 ? i + 1 : "unknown (not loaded)"}` })
815
893
  ]
816
894
  }
817
895
  );
818
896
  }
819
- ), Cn = f(
897
+ ), Sn = f(
820
898
  ({
821
899
  onNavigate: n
822
900
  }) => {
823
- const [t, o] = w(""), r = R(), l = he(r) ? r : void 0, i = (h) => {
824
- o(h.target.value);
825
- }, c = B(
826
- (h) => {
827
- n(), r == null || r.navigation.goToCfi(h);
901
+ const [t, o] = y(""), r = T(), l = ue(r) ? r : void 0, i = (d) => {
902
+ o(d.target.value);
903
+ }, a = M(
904
+ (d) => {
905
+ n(), r == null || r.navigation.goToCfi(d);
828
906
  },
829
907
  [r, n]
830
- ), d = P(
908
+ ), h = b(
831
909
  () => l == null ? void 0 : l.search.search(t).pipe(
832
- ce((h) => ({ type: "end", data: h })),
910
+ de((d) => ({ type: "end", data: d })),
833
911
  Pe({ type: "start" })
834
912
  ),
835
913
  [r, t]
836
- ), u = (d == null ? void 0 : d.type) === "start", s = (d == null ? void 0 : d.type) === "end" ? d.data : [], p = P(
914
+ ), u = (h == null ? void 0 : h.type) === "start", s = (h == null ? void 0 : h.type) === "end" ? h.data : [], g = b(
837
915
  () => r == null ? void 0 : r.pagination.locate(s.slice(0, 100)),
838
916
  [s]
839
917
  );
840
- return /* @__PURE__ */ a(k, { flex: 1, height: "100%", children: [
841
- /* @__PURE__ */ e(M, { px: 4, children: /* @__PURE__ */ e(
842
- we,
918
+ return /* @__PURE__ */ c(P, { flex: 1, height: "100%", children: [
919
+ /* @__PURE__ */ e(A, { px: 4, children: /* @__PURE__ */ e(
920
+ ye,
843
921
  {
844
922
  placeholder: "Type something...",
845
923
  value: t,
@@ -847,8 +925,8 @@ const sn = L.Root, an = L.ValueText, ee = () => {
847
925
  borderRadius: 0
848
926
  }
849
927
  ) }),
850
- /* @__PURE__ */ a(
851
- M,
928
+ /* @__PURE__ */ c(
929
+ A,
852
930
  {
853
931
  px: 4,
854
932
  pb: 4,
@@ -856,27 +934,27 @@ const sn = L.Root, an = L.ValueText, ee = () => {
856
934
  flex: 1,
857
935
  style: { overflow: "hidden", overflowY: "auto" },
858
936
  children: [
859
- u && /* @__PURE__ */ e(g, { children: "Searching ..." }),
937
+ u && /* @__PURE__ */ e(p, { children: "Searching ..." }),
860
938
  !u && s.length === 0 && /* @__PURE__ */ e("p", { children: "There are no results" }),
861
- !u && s.length >= 0 && /* @__PURE__ */ a(k, { children: [
862
- /* @__PURE__ */ a(Q, { as: "h2", size: "md", children: [
939
+ !u && s.length >= 0 && /* @__PURE__ */ c(P, { children: [
940
+ /* @__PURE__ */ c(W, { as: "h2", size: "md", children: [
863
941
  s.length,
864
942
  " result(s)"
865
943
  ] }),
866
- /* @__PURE__ */ e(k, { gap: 0, children: p == null ? void 0 : p.map((h, v) => {
867
- var S, T, m, y, x, ne, te;
944
+ /* @__PURE__ */ e(P, { gap: 0, children: g == null ? void 0 : g.map((d, x) => {
945
+ var C, w, v, R, I, te, oe;
868
946
  return /* @__PURE__ */ e(
869
- xn,
947
+ In,
870
948
  {
871
- contextText: ((m = (T = (S = h.meta) == null ? void 0 : S.range) == null ? void 0 : T.startContainer.parentElement) == null ? void 0 : m.textContent) ?? "",
872
- pageIndex: (y = h.meta) == null ? void 0 : y.itemPageIndex,
873
- startOffset: ((ne = (x = h.meta) == null ? void 0 : x.range) == null ? void 0 : ne.startOffset) ?? 0,
949
+ contextText: ((v = (w = (C = d.meta) == null ? void 0 : C.range) == null ? void 0 : w.startContainer.parentElement) == null ? void 0 : v.textContent) ?? "",
950
+ pageIndex: (R = d.meta) == null ? void 0 : R.itemPageIndex,
951
+ startOffset: ((te = (I = d.meta) == null ? void 0 : I.range) == null ? void 0 : te.startOffset) ?? 0,
874
952
  text: t,
875
- cfi: h.cfi,
876
- onClick: c,
877
- absolutePageIndex: (te = h.meta) == null ? void 0 : te.absolutePageIndex
953
+ cfi: d.cfi,
954
+ onClick: a,
955
+ absolutePageIndex: (oe = d.meta) == null ? void 0 : oe.absolutePageIndex
878
956
  },
879
- v
957
+ x
880
958
  );
881
959
  }) })
882
960
  ] })
@@ -885,7 +963,7 @@ const sn = L.Root, an = L.ValueText, ee = () => {
885
963
  )
886
964
  ] });
887
965
  }
888
- ), vn = f(
966
+ ), Pn = f(
889
967
  ({
890
968
  open: n,
891
969
  setOpen: t,
@@ -899,48 +977,48 @@ const sn = L.Root, an = L.ValueText, ee = () => {
899
977
  onOpenChange: (r) => t(r.open),
900
978
  size: { mdDown: "full", md: "lg" },
901
979
  scrollBehavior: "inside",
902
- children: /* @__PURE__ */ a(_, { height: "100%", children: [
980
+ children: /* @__PURE__ */ c(L, { height: "100%", children: [
903
981
  /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(V, { children: "Search" }) }),
904
- /* @__PURE__ */ e(j, { flex: 1, children: /* @__PURE__ */ e(Cn, { onNavigate: o }) }),
905
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ e(z, { variant: "outline", children: "Cancel" }) }) }),
982
+ /* @__PURE__ */ e(j, { flex: 1, children: /* @__PURE__ */ e(Sn, { onNavigate: o }) }),
983
+ /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Y, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "outline", children: "Cancel" }) }) }),
906
984
  /* @__PURE__ */ e($, {})
907
985
  ] })
908
986
  }
909
987
  )
910
- ), In = f(
988
+ ), wn = f(
911
989
  ({
912
990
  onNavigate: n
913
991
  }) => {
914
- const t = R(), { manifest: o, assumedRenditionLayout: r } = P(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: l } = o ?? {}, i = E();
992
+ const t = T(), { manifest: o, assumedRenditionLayout: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: l } = o ?? {}, i = B();
915
993
  l != null && l.toc;
916
- const { beginSpineItemIndex: c, beginPageIndexInSpineItem: d } = i ?? {}, u = (r === "reflowable" ? d : c) || 0;
994
+ const { beginSpineItemIndex: a, beginPageIndexInSpineItem: h } = i ?? {}, u = (r === "reflowable" ? h : a) || 0;
917
995
  console.log({ assumedRenditionLayout: r, currentSpineItemOrChapterPageIndex: u });
918
996
  let s = i == null ? void 0 : i.beginChapterInfo;
919
997
  for (; s != null && s.subChapter; )
920
998
  s = s == null ? void 0 : s.subChapter;
921
- const p = (h, v, S) => /* @__PURE__ */ a(fe.Fragment, { children: [
999
+ const g = (d, x, C) => /* @__PURE__ */ c(fe.Fragment, { children: [
922
1000
  /* @__PURE__ */ e(
923
- I.Item,
1001
+ S.Item,
924
1002
  {
925
- pl: 4 * (S + 1),
1003
+ pl: 4 * (C + 1),
926
1004
  style: {
927
1005
  display: "flex",
928
1006
  alignItems: "center"
929
1007
  },
930
- children: /* @__PURE__ */ a(
931
- q,
1008
+ children: /* @__PURE__ */ c(
1009
+ G,
932
1010
  {
933
1011
  onClick: () => {
934
- n(), t == null || t.navigation.goToUrl(h.href);
1012
+ n(), t == null || t.navigation.goToUrl(d.href);
935
1013
  },
936
1014
  href: "#",
937
1015
  children: [
938
- (s == null ? void 0 : s.path) === h.path && /* @__PURE__ */ e(I.Indicator, { asChild: !0, children: /* @__PURE__ */ e(re, {}) }),
939
- (s == null ? void 0 : s.path) !== h.path && /* @__PURE__ */ e(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(re, {}) }),
940
- /* @__PURE__ */ a(k, { gap: 0, children: [
941
- /* @__PURE__ */ e(g, { fontSize: "md", children: h.title || h.path }),
942
- (s == null ? void 0 : s.path) === h.path && /* @__PURE__ */ e(
943
- g,
1016
+ (s == null ? void 0 : s.path) === d.path && /* @__PURE__ */ e(S.Indicator, { asChild: !0, children: /* @__PURE__ */ e(ie, {}) }),
1017
+ (s == null ? void 0 : s.path) !== d.path && /* @__PURE__ */ e(S.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(ie, {}) }),
1018
+ /* @__PURE__ */ c(P, { gap: 0, children: [
1019
+ /* @__PURE__ */ e(p, { fontSize: "md", children: d.title || d.path }),
1020
+ (s == null ? void 0 : s.path) === d.path && /* @__PURE__ */ e(
1021
+ p,
944
1022
  {
945
1023
  fontStyle: "italic",
946
1024
  fontWeight: "bold",
@@ -954,13 +1032,13 @@ const sn = L.Root, an = L.ValueText, ee = () => {
954
1032
  )
955
1033
  }
956
1034
  ),
957
- h.contents.length > 0 && /* @__PURE__ */ e(I.Root, { as: "div", gap: 2, children: h.contents.map(
958
- (T, m) => p(T, m, S + 1)
1035
+ d.contents.length > 0 && /* @__PURE__ */ e(S.Root, { as: "div", gap: 2, children: d.contents.map(
1036
+ (w, v) => g(w, v, C + 1)
959
1037
  ) })
960
- ] }, v);
961
- return /* @__PURE__ */ e(I.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: l == null ? void 0 : l.toc.map((h, v) => p(h, v, 0)) });
1038
+ ] }, x);
1039
+ return /* @__PURE__ */ e(S.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: l == null ? void 0 : l.toc.map((d, x) => g(d, x, 0)) });
962
1040
  }
963
- ), Sn = f(
1041
+ ), yn = f(
964
1042
  ({
965
1043
  open: n,
966
1044
  setOpen: t,
@@ -974,85 +1052,86 @@ const sn = L.Root, an = L.ValueText, ee = () => {
974
1052
  onOpenChange: (r) => t(r.open),
975
1053
  size: { mdDown: "full", md: "lg" },
976
1054
  scrollBehavior: "inside",
977
- children: /* @__PURE__ */ a(_, { children: [
1055
+ children: /* @__PURE__ */ c(L, { children: [
978
1056
  /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(V, { children: "Table of Contents" }) }),
979
- /* @__PURE__ */ e(j, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ e(In, { onNavigate: o }) }),
980
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(W, { asChild: !0, children: /* @__PURE__ */ e(z, { variant: "outline", children: "Cancel" }) }) }),
1057
+ /* @__PURE__ */ e(j, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ e(wn, { onNavigate: o }) }),
1058
+ /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(Y, { asChild: !0, children: /* @__PURE__ */ e(E, { variant: "outline", children: "Cancel" }) }) }),
981
1059
  /* @__PURE__ */ e($, {})
982
1060
  ] })
983
1061
  }
984
1062
  )
985
- ), _n = ({
1063
+ ), jn = ({
986
1064
  enableFloatingTime: n = !0,
987
1065
  enableFloatingProgress: t = !0,
988
1066
  onItemClick: o
989
1067
  }) => {
990
- const [r, l] = w(!1), [i, c] = w(!1), [d, u] = w(!1), [s, p] = w(!1), [h, v] = w(!1), [S, T] = Z(), m = B(() => {
991
- l(!1), c(!1), u(!1), p(!1), v(!1), T(!1);
992
- }, [T]), y = B(
993
- (x) => {
994
- x === "annotations" ? p(!0) : x === "search" ? u(!0) : x === "help" ? c(!0) : x === "toc" ? l(!0) : x === "bookmarks" && v(!0), o == null || o(x);
1068
+ const [r, l] = y(!1), [i, a] = y(!1), [h, u] = y(!1), [s, g] = y(!1), [d, x] = y(!1), [C, w] = ee(), v = M(() => {
1069
+ l(!1), a(!1), u(!1), g(!1), x(!1), w(!1);
1070
+ }, [w]), R = M(
1071
+ (I) => {
1072
+ I === "annotations" ? g(!0) : I === "search" ? u(!0) : I === "help" ? a(!0) : I === "toc" ? l(!0) : I === "bookmarks" && x(!0), o == null || o(I);
995
1073
  },
996
1074
  [o]
997
1075
  );
998
- return /* @__PURE__ */ a(X, { children: [
1076
+ return /* @__PURE__ */ c(U, { children: [
999
1077
  t && /* @__PURE__ */ e(
1000
- G,
1078
+ q,
1001
1079
  {
1002
- present: !S,
1080
+ present: !C,
1003
1081
  animationName: { _open: "fade-in", _closed: "fade-out" },
1004
1082
  animationDuration: "moderate",
1005
- children: /* @__PURE__ */ e(Ze, {})
1083
+ children: /* @__PURE__ */ e(on, {})
1006
1084
  }
1007
1085
  ),
1008
- /* @__PURE__ */ e(bn, { onItemClick: y }),
1009
- /* @__PURE__ */ e(Je, { open: i, setOpen: c }),
1086
+ /* @__PURE__ */ e(kn, { onItemClick: R }),
1087
+ /* @__PURE__ */ e(Xe, {}),
1088
+ /* @__PURE__ */ e(tn, { open: i, setOpen: a }),
1010
1089
  /* @__PURE__ */ e(
1011
- Sn,
1090
+ yn,
1012
1091
  {
1013
1092
  open: r,
1014
1093
  setOpen: l,
1015
- onNavigate: m
1094
+ onNavigate: v
1016
1095
  }
1017
1096
  ),
1018
1097
  /* @__PURE__ */ e(
1019
- vn,
1098
+ Pn,
1020
1099
  {
1021
- open: d,
1100
+ open: h,
1022
1101
  setOpen: u,
1023
- onNavigate: m
1102
+ onNavigate: v
1024
1103
  }
1025
1104
  ),
1026
1105
  /* @__PURE__ */ e(
1027
- Ue,
1106
+ We,
1028
1107
  {
1029
1108
  open: s,
1030
- setOpen: p,
1031
- onNavigate: m
1109
+ setOpen: g,
1110
+ onNavigate: v
1032
1111
  }
1033
1112
  ),
1034
1113
  /* @__PURE__ */ e(
1035
- Ge,
1114
+ Ze,
1036
1115
  {
1037
- open: h,
1038
- setOpen: v,
1039
- onNavigate: m
1116
+ open: d,
1117
+ setOpen: x,
1118
+ onNavigate: v
1040
1119
  }
1041
1120
  ),
1042
1121
  /* @__PURE__ */ e(
1043
- G,
1122
+ q,
1044
1123
  {
1045
- present: n || S,
1124
+ present: n || C,
1046
1125
  animationName: { _open: "fade-in", _closed: "fade-out" },
1047
1126
  animationDuration: "slow",
1048
1127
  overflow: "hidden",
1049
- children: /* @__PURE__ */ e(tn, {})
1128
+ children: /* @__PURE__ */ e(sn, {})
1050
1129
  }
1051
1130
  )
1052
1131
  ] });
1053
1132
  };
1054
1133
  export {
1055
- _n as ReactReader,
1056
- Ln as ReactReaderProvider
1134
+ jn as ReactReader,
1135
+ Hn as ReactReaderProvider
1057
1136
  };
1058
1137
  //# sourceMappingURL=index.js.map