@prose-reader/react-reader 1.202.0 → 1.203.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,109 +1,109 @@
1
- import { jsx as n, jsxs as c, Fragment as Z } from "react/jsx-runtime";
2
- import * as A from "react";
3
- import we, { createContext as Te, memo as m, useMemo as Pe, useEffect as K, useContext as fe, useState as S, useCallback as q } from "react";
4
- import { signal as be, useSignal as xe, useLiveRef as Re, useSubscribe as L, useObserve as b, useSignalValue as Oe, isDefined as De } from "reactjrx";
5
- import { tap as Ce, switchMap as ie, NEVER as le, combineLatest as ze, map as se, EMPTY as Ee, Subject as Ae, finalize as ve, skip as ne, filter as ge, mergeMap as Me, merge as _e, timer as Be, first as Le, distinctUntilChanged as $e, startWith as Ne } from "rxjs";
6
- import { IconButton as f, Portal as ae, Dialog as C, List as I, Link as J, Stack as P, Text as p, Button as M, Presence as W, Box as z, createToaster as Fe, Toaster as He, Toast as _, Spinner as je, Heading as te, HStack as E, Kbd as pe, Popover as B, Progress as Q, chakra as Ve, Collapsible as ee, Input as Ge } from "@chakra-ui/react";
7
- import { LuX as Ye, LuNotebookPen as oe, LuArrowBigRight as Ue, LuArrowBigLeft as qe, LuChevronDown as Qe, LuCircleHelp as Ke, LuTableOfContents as We, LuSearch as Xe, LuGalleryHorizontal as Ze, LuCircleCheck as me } from "react-icons/lu";
8
- import { createPortal as Je } from "react-dom";
9
- import { BsBookmarkPlus as en, BsBookmarkXFill as nn, BsBookmarks as tn } from "react-icons/bs";
10
- import { isHtmlTagElement as on } from "@prose-reader/core";
11
- import { RiGalleryView2 as rn } from "react-icons/ri";
12
- import { RxDoubleArrowUp as ln, RxDoubleArrowLeft as sn, RxDoubleArrowDown as an, RxDoubleArrowRight as cn } from "react-icons/rx";
13
- import { HiOutlineInformationCircle as dn } from "react-icons/hi";
14
- import hn from "rc-slider";
1
+ import { jsx as n, jsxs as c, Fragment as J } from "react/jsx-runtime";
2
+ import * as _ from "react";
3
+ import Pe, { createContext as Re, memo as m, useMemo as xe, useEffect as ee, useContext as Ce, useState as k, useLayoutEffect as Oe, useCallback as Q } from "react";
4
+ import { signal as ve, useSignal as ye, useLiveRef as ze, useSubscribe as D, useObserve as x, useSignalValue as De, isDefined as Ae } from "reactjrx";
5
+ import { tap as ce, switchMap as W, NEVER as E, filter as re, map as ne, distinctUntilChanged as ke, finalize as de, combineLatest as Ee, EMPTY as Me, Subject as _e, skip as ie, mergeMap as Le, merge as Be, timer as $e, first as Ne, startWith as Fe } from "rxjs";
6
+ import { IconButton as f, Portal as he, Dialog as y, List as S, Link as te, Stack as P, Text as p, Button as L, Presence as X, Box as O, createToaster as He, Toaster as je, Toast as B, Spinner as Ve, Heading as le, HStack as M, Kbd as fe, Popover as $, Progress as K, chakra as Ge, Collapsible as oe, Input as Ye } from "@chakra-ui/react";
7
+ import { LuX as Ue, LuNotebookPen as se, LuArrowBigRight as qe, LuArrowBigLeft as Qe, LuChevronDown as Ke, LuCircleHelp as We, LuTableOfContents as Xe, LuSearch as Ze, LuGalleryHorizontal as Je, LuCircleCheck as be } from "react-icons/lu";
8
+ import { createPortal as en } from "react-dom";
9
+ import { BsBookmarkPlus as nn, BsBookmarkXFill as tn, BsBookmarks as on } from "react-icons/bs";
10
+ import { isShallowEqual as rn, observeIntersection as ln, isHtmlTagElement as sn } from "@prose-reader/core";
11
+ import { RiGalleryView2 as an } from "react-icons/ri";
12
+ import { RxDoubleArrowUp as cn, RxDoubleArrowLeft as dn, RxDoubleArrowDown as hn, RxDoubleArrowRight as un } from "react-icons/rx";
13
+ import { HiOutlineInformationCircle as gn } from "react-icons/hi";
14
+ import pn from "rc-slider";
15
15
  import "rc-slider/assets/index.css";
16
- import { IoIosArrowBack as un, IoMdMore as gn } from "react-icons/io";
17
- import { MdFullscreenExit as pn, MdFullscreen as mn } from "react-icons/md";
18
- const ce = Te({
16
+ import { IoIosArrowBack as mn, IoMdMore as fn } from "react-icons/io";
17
+ import { MdFullscreenExit as bn, MdFullscreen as xn } from "react-icons/md";
18
+ const ue = Re({
19
19
  reader: void 0,
20
- quickMenuSignal: be({ default: !1 })
21
- }), ft = m(
20
+ quickMenuSignal: ve({ default: !1 })
21
+ }), It = m(
22
22
  ({
23
23
  children: e,
24
24
  reader: t,
25
25
  quickMenuOpen: o,
26
26
  onQuickMenuOpenChange: r
27
27
  }) => {
28
- const [, l] = xe({
28
+ const [, i] = ye({
29
29
  default: o
30
- }), i = Re(r), s = Pe(
30
+ }), l = ze(r), s = xe(
31
31
  () => ({
32
- quickMenuSignal: l,
32
+ quickMenuSignal: i,
33
33
  reader: t
34
34
  }),
35
- [l, t]
35
+ [i, t]
36
36
  );
37
- return K(() => {
38
- l.setValue(o);
39
- }, [o, l]), L(
40
- () => l.subject.pipe(Ce(i.current)),
41
- [l, i]
42
- ), /* @__PURE__ */ n(ce.Provider, { value: s, children: e });
37
+ return ee(() => {
38
+ i.setValue(o);
39
+ }, [o, i]), D(
40
+ () => i.subject.pipe(ce(l.current)),
41
+ [i, l]
42
+ ), /* @__PURE__ */ n(ue.Provider, { value: s, children: e });
43
43
  }
44
- ), fn = A.forwardRef(function(t, o) {
45
- return /* @__PURE__ */ n(f, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ n(Ye, {}) });
46
- }), $ = A.forwardRef(function(t, o) {
44
+ ), Cn = _.forwardRef(function(t, o) {
45
+ return /* @__PURE__ */ n(f, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ n(Ue, {}) });
46
+ }), N = _.forwardRef(function(t, o) {
47
47
  const {
48
48
  children: r,
49
- portalled: l = !0,
50
- portalRef: i,
49
+ portalled: i = !0,
50
+ portalRef: l,
51
51
  backdrop: s = !0,
52
- ...d
52
+ ...h
53
53
  } = t;
54
- return /* @__PURE__ */ c(ae, { disabled: !l, container: i, children: [
55
- s && /* @__PURE__ */ n(C.Backdrop, {}),
56
- /* @__PURE__ */ n(C.Positioner, { children: /* @__PURE__ */ n(C.Content, { ref: o, ...d, asChild: !1, children: r }) })
54
+ return /* @__PURE__ */ c(he, { disabled: !i, container: l, children: [
55
+ s && /* @__PURE__ */ n(y.Backdrop, {}),
56
+ /* @__PURE__ */ n(y.Positioner, { children: /* @__PURE__ */ n(y.Content, { ref: o, ...h, asChild: !1, children: r }) })
57
57
  ] });
58
- }), N = A.forwardRef(function(t, o) {
58
+ }), F = _.forwardRef(function(t, o) {
59
59
  return /* @__PURE__ */ n(
60
- C.CloseTrigger,
60
+ y.CloseTrigger,
61
61
  {
62
62
  position: "absolute",
63
63
  top: "2",
64
64
  insetEnd: "2",
65
65
  ...t,
66
66
  asChild: !0,
67
- children: /* @__PURE__ */ n(fn, { size: "sm", ref: o, children: t.children })
67
+ children: /* @__PURE__ */ n(Cn, { size: "sm", ref: o, children: t.children })
68
68
  }
69
69
  );
70
- }), F = C.Root, H = C.Footer, j = C.Header, V = C.Body;
71
- C.Backdrop;
72
- const G = C.Title;
73
- C.Description;
74
- C.Trigger;
75
- const Y = C.ActionTrigger, v = () => {
76
- const { reader: e } = fe(ce);
70
+ }), H = y.Root, j = y.Footer, V = y.Header, G = y.Body;
71
+ y.Backdrop;
72
+ const Y = y.Title;
73
+ y.Description;
74
+ y.Trigger;
75
+ const U = y.ActionTrigger, C = () => {
76
+ const { reader: e } = Ce(ue);
77
77
  return e;
78
- }, ke = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, de = (e) => !!e && "__PROSE_READER_ENHANCER_BOOKMARKS" in e, ye = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, Se = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, bn = m(
78
+ }, Ie = (e) => !!e && "__PROSE_READER_ENHANCER_SEARCH" in e, ge = (e) => !!e && "__PROSE_READER_ENHANCER_BOOKMARKS" in e, Se = (e) => !!e && "__PROSE_READER_ENHANCER_ANNOTATIONS" in e, we = (e) => !!e && "__PROSE_READER_ENHANCER_GALLERY" in e, vn = m(
79
79
  ({ onNavigate: e }) => {
80
- const t = v(), o = ye(t) ? t : void 0, r = b(
80
+ const t = C(), o = Se(t) ? t : void 0, r = x(
81
81
  () => o == null ? void 0 : o.annotations.highlights$.pipe(
82
- ie(
83
- (i) => o.pagination.locate(i)
82
+ W(
83
+ (l) => o.pagination.locate(l)
84
84
  )
85
85
  ),
86
86
  [o]
87
- ), l = (i, s) => {
88
- var d;
89
- return /* @__PURE__ */ n(I.Item, { children: /* @__PURE__ */ c(
90
- J,
87
+ ), i = (l, s) => {
88
+ var h;
89
+ return /* @__PURE__ */ n(S.Item, { children: /* @__PURE__ */ c(
90
+ te,
91
91
  {
92
92
  href: "#",
93
93
  onClick: () => {
94
- e(), t == null || t.navigation.goToCfi(i.cfi ?? "");
94
+ e(), t == null || t.navigation.goToCfi(l.cfi ?? "");
95
95
  },
96
96
  children: [
97
- (i.contents ?? [])[0] ? /* @__PURE__ */ n(I.Indicator, { asChild: !0, children: /* @__PURE__ */ n(oe, {}) }) : /* @__PURE__ */ n(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(oe, {}) }),
97
+ (l.contents ?? [])[0] ? /* @__PURE__ */ n(S.Indicator, { asChild: !0, children: /* @__PURE__ */ n(se, {}) }) : /* @__PURE__ */ n(S.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(se, {}) }),
98
98
  /* @__PURE__ */ c(P, { gap: 0, children: [
99
- /* @__PURE__ */ n(p, { lineClamp: 2, fontSize: "md", children: i.selectionAsText ? i.selectionAsText ?? "" : /* @__PURE__ */ n("i", { children: /* @__PURE__ */ n("b", { children: "unknown (not loaded)" }) }) }),
99
+ /* @__PURE__ */ n(p, { lineClamp: 2, fontSize: "md", children: l.selectionAsText ? l.selectionAsText ?? "" : /* @__PURE__ */ n("i", { children: /* @__PURE__ */ n("b", { children: "unknown (not loaded)" }) }) }),
100
100
  /* @__PURE__ */ n(
101
101
  p,
102
102
  {
103
103
  fontStyle: "italic",
104
104
  fontWeight: "bold",
105
105
  fontSize: "sm",
106
- children: `Book page: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
106
+ children: `Book page: ${((h = l.meta) == null ? void 0 : h.absolutePageIndex) !== void 0 ? l.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
107
107
  }
108
108
  )
109
109
  ] })
@@ -111,17 +111,17 @@ const Y = C.ActionTrigger, v = () => {
111
111
  }
112
112
  ) }, s);
113
113
  };
114
- return /* @__PURE__ */ n(I.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: r == null ? void 0 : r.map(
115
- (i, s) => l(i, s)
114
+ return /* @__PURE__ */ n(S.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: r == null ? void 0 : r.map(
115
+ (l, s) => i(l, s)
116
116
  ) });
117
117
  }
118
- ), xn = m(
118
+ ), yn = m(
119
119
  ({
120
120
  open: e,
121
121
  setOpen: t,
122
122
  onNavigate: o
123
123
  }) => /* @__PURE__ */ n(
124
- F,
124
+ H,
125
125
  {
126
126
  lazyMount: !0,
127
127
  placement: "center",
@@ -129,65 +129,65 @@ const Y = C.ActionTrigger, v = () => {
129
129
  onOpenChange: (r) => t(r.open),
130
130
  size: { mdDown: "full", md: "lg" },
131
131
  scrollBehavior: "inside",
132
- children: /* @__PURE__ */ c($, { height: "100%", children: [
133
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Annotations" }) }),
134
- /* @__PURE__ */ n(V, { flex: 1, children: /* @__PURE__ */ n(bn, { onNavigate: o }) }),
135
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
136
- /* @__PURE__ */ n(N, {})
132
+ children: /* @__PURE__ */ c(N, { height: "100%", children: [
133
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Y, { children: "Annotations" }) }),
134
+ /* @__PURE__ */ n(G, { flex: 1, children: /* @__PURE__ */ n(vn, { onNavigate: o }) }),
135
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(U, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "outline", children: "Cancel" }) }) }),
136
+ /* @__PURE__ */ n(F, {})
137
137
  ] })
138
138
  }
139
139
  )
140
- ), Cn = m(() => {
141
- const e = v(), t = de(e) ? e : void 0, o = b(() => e == null ? void 0 : e.spine.element$, [e]), r = b(
140
+ ), kn = m(() => {
141
+ const e = C(), t = ge(e) ? e : void 0, o = x(() => e == null ? void 0 : e.spine.element$, [e]), r = x(
142
142
  () => t == null ? void 0 : t.bookmarks.pages$,
143
143
  [t]
144
- ), l = b(
144
+ ), i = x(
145
145
  () => t == null ? void 0 : t.bookmarks.bookmarks$,
146
146
  [t]
147
- ), i = b(
148
- () => e == null ? void 0 : e.pagination.locate(l ?? []),
149
- [e, l]
147
+ ), l = x(
148
+ () => e == null ? void 0 : e.pagination.locate(i ?? []),
149
+ [e, i]
150
150
  );
151
- return o ? /* @__PURE__ */ n(Z, { children: Je(
151
+ return o ? /* @__PURE__ */ n(J, { children: en(
152
152
  r == null ? void 0 : r.map(
153
- ({ isBookmarkable: s, absolutePosition: { left: d, top: u, width: a } }, g) => {
154
- const h = i == null ? void 0 : i.find(
155
- (x) => {
156
- var k;
157
- return ((k = x.meta) == null ? void 0 : k.absolutePageIndex) === g;
153
+ ({ isBookmarkable: s, absolutePosition: { left: h, top: u, width: a } }, g) => {
154
+ const d = l == null ? void 0 : l.find(
155
+ (b) => {
156
+ var v;
157
+ return ((v = b.meta) == null ? void 0 : v.absolutePageIndex) === g;
158
158
  }
159
159
  );
160
160
  return s ? /* @__PURE__ */ n(
161
- W,
161
+ X,
162
162
  {
163
163
  present: !0,
164
164
  lazyMount: !0,
165
165
  animationName: { _open: "fade-in", _closed: "fade-out" },
166
166
  animationDuration: "moderate",
167
167
  children: /* @__PURE__ */ n(
168
- z,
168
+ O,
169
169
  {
170
170
  "data-bookmark-area": !0,
171
171
  position: "absolute",
172
- left: d + a,
172
+ left: h + a,
173
173
  transform: "translateX(-100%)",
174
174
  top: u,
175
175
  p: 2,
176
- children: h ? /* @__PURE__ */ n(
176
+ children: d ? /* @__PURE__ */ n(
177
177
  f,
178
178
  {
179
179
  "aria-label": "bookmark",
180
180
  opacity: 0.5,
181
181
  _hover: { opacity: 1 },
182
182
  onClick: () => {
183
- h && (t == null || t.bookmarks.delete(
184
- h == null ? void 0 : h.id
183
+ d && (t == null || t.bookmarks.delete(
184
+ d == null ? void 0 : d.id
185
185
  ));
186
186
  },
187
187
  size: "lg",
188
188
  variant: "ghost",
189
189
  _icon: { boxSize: "36px" },
190
- children: /* @__PURE__ */ n(nn, {})
190
+ children: /* @__PURE__ */ n(tn, {})
191
191
  }
192
192
  ) : /* @__PURE__ */ n(
193
193
  f,
@@ -202,7 +202,7 @@ const Y = C.ActionTrigger, v = () => {
202
202
  _hover: { opacity: 1 },
203
203
  variant: "ghost",
204
204
  _icon: { boxSize: "36px" },
205
- children: /* @__PURE__ */ n(en, {})
205
+ children: /* @__PURE__ */ n(nn, {})
206
206
  }
207
207
  )
208
208
  }
@@ -214,25 +214,25 @@ const Y = C.ActionTrigger, v = () => {
214
214
  ),
215
215
  o
216
216
  ) }) : null;
217
- }), vn = m(
217
+ }), In = m(
218
218
  ({ onNavigate: e }) => {
219
- const t = v(), o = de(t) ? t : void 0, r = b(
219
+ const t = C(), o = ge(t) ? t : void 0, r = x(
220
220
  () => o == null ? void 0 : o.bookmarks.bookmarks$.pipe(
221
- ie((i) => o.pagination.locate(i))
221
+ W((l) => o.pagination.locate(l))
222
222
  ),
223
223
  [o]
224
- ), l = (i, s) => {
225
- var d, u, a, g, h;
226
- return /* @__PURE__ */ c(I.Item, { justifyContent: "space-between", alignItems: "center", children: [
224
+ ), i = (l, s) => {
225
+ var h, u, a, g, d;
226
+ return /* @__PURE__ */ c(S.Item, { justifyContent: "space-between", alignItems: "center", children: [
227
227
  /* @__PURE__ */ n(
228
- J,
228
+ te,
229
229
  {
230
230
  href: "#",
231
231
  onClick: () => {
232
- e(), t == null || t.navigation.goToCfi(i.cfi ?? "");
232
+ e(), t == null || t.navigation.goToCfi(l.cfi ?? "");
233
233
  },
234
234
  children: /* @__PURE__ */ c(P, { gap: 0, children: [
235
- /* @__PURE__ */ n(p, { fontSize: "md", children: `Book page: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown"}` }),
235
+ /* @__PURE__ */ n(p, { fontSize: "md", children: `Book page: ${((h = l.meta) == null ? void 0 : h.absolutePageIndex) !== void 0 ? l.meta.absolutePageIndex + 1 : "unknown"}` }),
236
236
  /* @__PURE__ */ n(
237
237
  p,
238
238
  {
@@ -241,37 +241,37 @@ const Y = C.ActionTrigger, v = () => {
241
241
  fontSize: "sm",
242
242
  truncate: !0,
243
243
  lineClamp: 2,
244
- children: (a = (u = i.meta) == null ? void 0 : u.startNode) != null && a.textContent ? (h = (g = i.meta) == null ? void 0 : g.startNode) == null ? void 0 : h.textContent : "..."
244
+ children: (a = (u = l.meta) == null ? void 0 : u.startNode) != null && a.textContent ? (d = (g = l.meta) == null ? void 0 : g.startNode) == null ? void 0 : d.textContent : "..."
245
245
  }
246
246
  )
247
247
  ] })
248
248
  }
249
249
  ),
250
250
  /* @__PURE__ */ n(
251
- M,
251
+ L,
252
252
  {
253
253
  colorPalette: "red",
254
254
  variant: "solid",
255
255
  size: "xs",
256
256
  onClick: () => {
257
- o == null || o.bookmarks.delete(i.id);
257
+ o == null || o.bookmarks.delete(l.id);
258
258
  },
259
259
  children: "Delete"
260
260
  }
261
261
  )
262
262
  ] }, s);
263
263
  };
264
- return /* @__PURE__ */ n(I.Root, { overflowY: "auto", gap: 3, variant: "plain", overflow: "auto", children: r == null ? void 0 : r.map(
265
- (i, s) => l(i, s)
264
+ return /* @__PURE__ */ n(S.Root, { overflowY: "auto", gap: 3, variant: "plain", overflow: "auto", children: r == null ? void 0 : r.map(
265
+ (l, s) => i(l, s)
266
266
  ) });
267
267
  }
268
- ), kn = m(
268
+ ), Sn = m(
269
269
  ({
270
270
  open: e,
271
271
  setOpen: t,
272
272
  onNavigate: o
273
273
  }) => /* @__PURE__ */ n(
274
- F,
274
+ H,
275
275
  {
276
276
  lazyMount: !0,
277
277
  placement: "center",
@@ -279,78 +279,137 @@ const Y = C.ActionTrigger, v = () => {
279
279
  onOpenChange: (r) => t(r.open),
280
280
  size: { mdDown: "full", md: "lg" },
281
281
  scrollBehavior: "inside",
282
- children: /* @__PURE__ */ c($, { height: "100%", children: [
283
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Bookmarks" }) }),
284
- /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(vn, { onNavigate: o }) }),
285
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
286
- /* @__PURE__ */ n(N, {})
282
+ children: /* @__PURE__ */ c(N, { height: "100%", children: [
283
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Y, { children: "Bookmarks" }) }),
284
+ /* @__PURE__ */ n(G, { children: /* @__PURE__ */ n(In, { onNavigate: o }) }),
285
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(U, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "outline", children: "Cancel" }) }) }),
286
+ /* @__PURE__ */ n(F, {})
287
287
  ] })
288
288
  }
289
289
  )
290
- ), re = Fe({
290
+ ), ae = He({
291
291
  placement: "bottom-end",
292
292
  pauseOnPageIdle: !0
293
- }), yn = () => /* @__PURE__ */ n(ae, { children: /* @__PURE__ */ n(He, { toaster: re, insetInline: { mdDown: "4" }, children: (e) => {
293
+ }), wn = () => /* @__PURE__ */ n(he, { children: /* @__PURE__ */ n(je, { toaster: ae, insetInline: { mdDown: "4" }, children: (e) => {
294
294
  var t;
295
- return /* @__PURE__ */ c(_.Root, { width: { md: "sm" }, children: [
296
- e.type === "loading" ? /* @__PURE__ */ n(je, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ n(_.Indicator, {}),
295
+ return /* @__PURE__ */ c(B.Root, { width: { md: "sm" }, children: [
296
+ e.type === "loading" ? /* @__PURE__ */ n(Ve, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ n(B.Indicator, {}),
297
297
  /* @__PURE__ */ c(P, { gap: "1", flex: "1", maxWidth: "100%", children: [
298
- e.title && /* @__PURE__ */ n(_.Title, { children: e.title }),
299
- e.description && /* @__PURE__ */ n(_.Description, { children: e.description })
298
+ e.title && /* @__PURE__ */ n(B.Title, { children: e.title }),
299
+ e.description && /* @__PURE__ */ n(B.Description, { children: e.description })
300
300
  ] }),
301
- e.action && /* @__PURE__ */ n(_.ActionTrigger, { children: e.action.label }),
302
- ((t = e.meta) == null ? void 0 : t.closable) && /* @__PURE__ */ n(_.CloseTrigger, {})
301
+ e.action && /* @__PURE__ */ n(B.ActionTrigger, { children: e.action.label }),
302
+ ((t = e.meta) == null ? void 0 : t.closable) && /* @__PURE__ */ n(B.CloseTrigger, {})
303
303
  ] });
304
- } }) }), Sn = m(
304
+ } }) }), Tn = {
305
+ x: 0,
306
+ y: 0,
307
+ width: 0,
308
+ height: 0,
309
+ top: 0,
310
+ left: 0,
311
+ bottom: 0,
312
+ right: 0
313
+ };
314
+ function Pn() {
315
+ const [e, t] = k(null), [o, r] = k(Tn), i = xe(
316
+ () => new ResizeObserver((l) => {
317
+ if (l[0]) {
318
+ const { x: s, y: h, width: u, height: a, top: g, left: d, bottom: b, right: v } = l[0].contentRect;
319
+ r({ x: s, y: h, width: u, height: a, top: g, left: d, bottom: b, right: v });
320
+ }
321
+ }),
322
+ []
323
+ );
324
+ return Oe(() => {
325
+ if (e)
326
+ return i.observe(e), () => {
327
+ i.disconnect();
328
+ };
329
+ }, [e, i]), [t, o, e];
330
+ }
331
+ const Rn = (e, t, o) => {
332
+ const r = C(), i = we(r) ? r : void 0;
333
+ D(() => !i || !e ? E : t.isReady$.pipe(
334
+ re((s) => s),
335
+ ne(() => t.layout.layoutInfo),
336
+ ke(rn)
337
+ ).pipe(
338
+ W(
339
+ () => i == null ? void 0 : i.gallery.snapshot(t, o)
340
+ ),
341
+ ce((s) => {
342
+ e.innerHTML = "", e.appendChild(s);
343
+ })
344
+ ), [i, t, o, e]);
345
+ }, On = m(({ item: e }) => {
346
+ const t = C(), [o, r, i] = Pn();
347
+ return Rn(i, e, r), D(
348
+ () => (i ? ln(i, {}) : E).pipe(
349
+ W((l) => {
350
+ if (l.some((s) => s.isIntersecting)) {
351
+ const s = t == null ? void 0 : t.spine.spineItemsLoader.forceOpen([e]);
352
+ return E.pipe(de(() => s == null ? void 0 : s()));
353
+ }
354
+ return E;
355
+ })
356
+ ),
357
+ [e, t, i]
358
+ ), /* @__PURE__ */ n(
359
+ O,
360
+ {
361
+ ref: o,
362
+ width: "100%",
363
+ aspectRatio: "2/3",
364
+ border: "1px solid",
365
+ borderColor: "border",
366
+ borderRadius: "md",
367
+ "data-grid-item": !0
368
+ }
369
+ );
370
+ }), zn = m(
305
371
  ({
306
372
  open: e,
307
373
  setOpen: t
308
374
  }) => {
309
- const o = v(), [r, l] = S(null), i = Se(o) ? o : void 0, s = "prose-gallery-grid-item", d = b(
310
- () => i == null ? void 0 : i.gallery.create({
311
- gridItemClassName: s
312
- }),
313
- [i]
314
- );
315
- return K(() => {
316
- r && d && (r.innerHTML = "", r.appendChild(d));
317
- }, [d, r]), /* @__PURE__ */ n(
318
- F,
375
+ const o = C(), r = x(() => o == null ? void 0 : o.spineItemsManager.items$, [o]);
376
+ return /* @__PURE__ */ n(
377
+ H,
319
378
  {
320
379
  lazyMount: !0,
321
380
  placement: "center",
322
381
  open: e,
323
- onOpenChange: (u) => t(u.open),
382
+ onOpenChange: (i) => t(i.open),
324
383
  size: { mdDown: "full", md: "lg" },
325
384
  scrollBehavior: "inside",
326
- children: /* @__PURE__ */ c($, { height: "100%", children: [
327
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Gallery" }) }),
328
- /* @__PURE__ */ n(
329
- V,
385
+ children: /* @__PURE__ */ c(N, { height: "100%", children: [
386
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Y, { children: "Gallery" }) }),
387
+ /* @__PURE__ */ n(G, { children: /* @__PURE__ */ n(
388
+ O,
330
389
  {
331
- ref: l,
332
- css: {
333
- "--prose-gallery-columns": ["2", "3"],
334
- [`& .${s}`]: {
335
- border: "1px solid red",
336
- borderColor: "border",
337
- borderRadius: "md"
338
- }
339
- }
390
+ gridTemplateColumns: [
391
+ "repeat(2, minmax(0, 1fr))",
392
+ "repeat(3, minmax(0, 1fr))"
393
+ ],
394
+ display: "grid",
395
+ gap: [2, 4],
396
+ pt: 2,
397
+ "data-grid": !0,
398
+ children: r == null ? void 0 : r.map((i) => /* @__PURE__ */ n(On, { item: i }, i.item.id))
340
399
  }
341
- ),
342
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
343
- /* @__PURE__ */ n(N, {})
400
+ ) }),
401
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(U, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "outline", children: "Cancel" }) }) }),
402
+ /* @__PURE__ */ n(F, {})
344
403
  ] })
345
404
  }
346
405
  );
347
406
  }
348
- ), In = "@prose-reader/react-reader", wn = "1.201.0", Tn = m(
407
+ ), Dn = "@prose-reader/react-reader", An = "1.202.0", En = m(
349
408
  ({
350
409
  open: e,
351
410
  setOpen: t
352
411
  }) => /* @__PURE__ */ n(
353
- F,
412
+ H,
354
413
  {
355
414
  lazyMount: !0,
356
415
  placement: "center",
@@ -358,42 +417,42 @@ const Y = C.ActionTrigger, v = () => {
358
417
  onOpenChange: (o) => t(o.open),
359
418
  size: { mdDown: "full", md: "lg" },
360
419
  scrollBehavior: "inside",
361
- children: /* @__PURE__ */ c($, { children: [
362
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Help" }) }),
363
- /* @__PURE__ */ c(V, { overflowY: "auto", flex: 1, children: [
364
- /* @__PURE__ */ n(te, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
365
- /* @__PURE__ */ c(E, { mb: 1, children: [
366
- /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(Ue, {}) }),
420
+ children: /* @__PURE__ */ c(N, { children: [
421
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Y, { children: "Help" }) }),
422
+ /* @__PURE__ */ c(G, { overflowY: "auto", flex: 1, children: [
423
+ /* @__PURE__ */ n(le, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
424
+ /* @__PURE__ */ c(M, { mb: 1, children: [
425
+ /* @__PURE__ */ n(fe, { children: /* @__PURE__ */ n(qe, {}) }),
367
426
  " ",
368
427
  /* @__PURE__ */ n(p, { children: "Navigate to right page" })
369
428
  ] }),
370
- /* @__PURE__ */ c(E, { mb: 1, children: [
371
- /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(qe, {}) }),
429
+ /* @__PURE__ */ c(M, { mb: 1, children: [
430
+ /* @__PURE__ */ n(fe, { children: /* @__PURE__ */ n(Qe, {}) }),
372
431
  " ",
373
432
  /* @__PURE__ */ n(p, { children: "Navigate to left page" })
374
433
  ] }),
375
- /* @__PURE__ */ n(te, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
434
+ /* @__PURE__ */ n(le, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
376
435
  /* @__PURE__ */ c(p, { children: [
377
- In,
436
+ Dn,
378
437
  " version: ",
379
- wn
438
+ An
380
439
  ] })
381
440
  ] }),
382
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
383
- /* @__PURE__ */ n(N, {})
441
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(U, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "outline", children: "Cancel" }) }) }),
442
+ /* @__PURE__ */ n(F, {})
384
443
  ] })
385
444
  }
386
445
  )
387
- ), U = () => {
388
- const e = v();
389
- return b(
390
- () => e ? ze([e.pagination.state$, e.context.state$]).pipe(
391
- se(([t, o]) => {
392
- var l;
393
- const r = (l = o.manifest) == null ? void 0 : l.spineItems.every(
394
- (i) => {
446
+ ), q = () => {
447
+ const e = C();
448
+ return x(
449
+ () => e ? Ee([e.pagination.state$, e.context.state$]).pipe(
450
+ ne(([t, o]) => {
451
+ var i;
452
+ const r = (i = o.manifest) == null ? void 0 : i.spineItems.every(
453
+ (l) => {
395
454
  var s;
396
- return (s = i.mediaType) == null ? void 0 : s.startsWith("image/");
455
+ return (s = l.mediaType) == null ? void 0 : s.startsWith("image/");
397
456
  }
398
457
  );
399
458
  return {
@@ -401,52 +460,52 @@ const Y = C.ActionTrigger, v = () => {
401
460
  hasChapters: !o.isFullyPrePaginated && !r
402
461
  };
403
462
  })
404
- ) : le,
463
+ ) : E,
405
464
  [e]
406
465
  );
407
- }, Pn = () => {
408
- const e = U(), t = Math.floor(
466
+ }, Mn = () => {
467
+ const e = q(), t = Math.floor(
409
468
  ((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100
410
469
  ), o = t > 0 ? t : 1;
411
- return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ n(z, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ c(p, { fontSize: "sm", children: [
470
+ return (e == null ? void 0 : e.percentageEstimateOfBook) === void 0 ? null : /* @__PURE__ */ n(O, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ c(p, { fontSize: "sm", children: [
412
471
  o,
413
472
  " %"
414
473
  ] }) });
415
- }, Rn = () => {
416
- const [e, t] = S(/* @__PURE__ */ new Date());
417
- return K(() => {
474
+ }, _n = () => {
475
+ const [e, t] = k(/* @__PURE__ */ new Date());
476
+ return ee(() => {
418
477
  const o = setInterval(() => {
419
478
  t(/* @__PURE__ */ new Date());
420
479
  }, 6e4);
421
480
  return () => clearInterval(o);
422
481
  }, []), e;
423
- }, On = (e) => {
424
- const t = Rn();
482
+ }, Ln = (e) => {
483
+ const t = _n();
425
484
  return /* @__PURE__ */ n(p, { fontSize: "xs", ...e, children: t.toLocaleTimeString(navigator.language, {
426
485
  hour: "2-digit",
427
486
  minute: "2-digit"
428
487
  }) });
429
- }, he = () => {
430
- const { quickMenuSignal: e } = fe(ce);
431
- return [Oe(e), e.setValue, e];
432
- }, Dn = () => {
433
- const [e] = he();
488
+ }, pe = () => {
489
+ const { quickMenuSignal: e } = Ce(ue);
490
+ return [De(e), e.setValue, e];
491
+ }, Bn = () => {
492
+ const [e] = pe();
434
493
  return /* @__PURE__ */ n(
435
- z,
494
+ O,
436
495
  {
437
496
  position: "absolute",
438
497
  left: 0,
439
498
  bottom: 0,
440
499
  p: 2,
441
500
  color: e ? void 0 : "colorPalette.contrast",
442
- children: /* @__PURE__ */ n(On, {})
501
+ children: /* @__PURE__ */ n(Ln, {})
443
502
  }
444
503
  );
445
- }, zn = () => {
446
- const e = v();
447
- L(
504
+ }, $n = () => {
505
+ const e = C();
506
+ D(
448
507
  () => e == null ? void 0 : e.links$.subscribe((t) => {
449
- if (t.type === "click" && on(t.target, "a")) {
508
+ if (t.type === "click" && sn(t.target, "a")) {
450
509
  if (!t.target.href) return;
451
510
  const o = new URL(t.target.href);
452
511
  window.location.host !== o.host && confirm(
@@ -456,22 +515,22 @@ const Y = C.ActionTrigger, v = () => {
456
515
  }),
457
516
  [e]
458
517
  );
459
- }, X = be({
518
+ }, Z = ve({
460
519
  default: void 0
461
- }), En = () => {
462
- const e = v();
463
- L(
520
+ }), Nn = () => {
521
+ const e = C();
522
+ D(
464
523
  () => e == null ? void 0 : e.zoom.isZooming$.pipe(
465
- ie((t) => {
466
- if (!t) return Ee;
467
- const o = new Ae();
468
- return X.setValue({
524
+ W((t) => {
525
+ if (!t) return Me;
526
+ const o = new _e();
527
+ return Z.setValue({
469
528
  key: "zoom",
470
529
  title: "Zooming",
471
530
  duration: 999999,
472
531
  abort: o
473
- }), le.pipe(
474
- ve(() => {
532
+ }), E.pipe(
533
+ de(() => {
475
534
  o.next(), o.complete();
476
535
  })
477
536
  );
@@ -479,15 +538,15 @@ const Y = C.ActionTrigger, v = () => {
479
538
  ),
480
539
  [e]
481
540
  );
482
- }, An = () => {
483
- const e = v();
484
- L(
541
+ }, Fn = () => {
542
+ const e = C();
543
+ D(
485
544
  () => e == null ? void 0 : e.settings.values$.pipe(
486
- se(({ fontScale: t }) => t),
487
- $e(),
488
- ne(1),
489
- Ce((t) => {
490
- X.setValue({
545
+ ne(({ fontScale: t }) => t),
546
+ ke(),
547
+ ie(1),
548
+ ce((t) => {
549
+ Z.setValue({
491
550
  key: "fontScaleChange",
492
551
  title: "Font size changed",
493
552
  description: `${t * 100} %`
@@ -496,53 +555,53 @@ const Y = C.ActionTrigger, v = () => {
496
555
  ),
497
556
  [e]
498
557
  );
499
- }, Mn = () => {
500
- An(), En(), L(
501
- () => X.subject.pipe(
558
+ }, Hn = () => {
559
+ Fn(), Nn(), D(
560
+ () => Z.subject.pipe(
502
561
  // @todo implement Signal / BehaviorSignal / ReplaySignal
503
- ne(1),
504
- ge(De),
505
- Me((e) => {
506
- const t = e.duration ?? 3e3, o = re.create({
562
+ ie(1),
563
+ re(Ae),
564
+ Le((e) => {
565
+ const t = e.duration ?? 3e3, o = ae.create({
507
566
  title: e.title,
508
567
  description: e.description,
509
568
  duration: t
510
- }), r = X.subject.pipe(
511
- ne(1),
512
- ge((l) => !!e.key && (l == null ? void 0 : l.key) === e.key)
569
+ }), r = Z.subject.pipe(
570
+ ie(1),
571
+ re((i) => !!e.key && (i == null ? void 0 : i.key) === e.key)
513
572
  );
514
- return _e(
515
- Be(t),
516
- e.abort ?? le,
573
+ return Be(
574
+ $e(t),
575
+ e.abort ?? E,
517
576
  r
518
577
  ).pipe(
519
- Le(),
520
- ve(() => {
521
- re.dismiss(o);
578
+ Ne(),
579
+ de(() => {
580
+ ae.dismiss(o);
522
581
  })
523
582
  );
524
583
  })
525
584
  )
526
585
  );
527
- }, _n = A.forwardRef(
586
+ }, jn = _.forwardRef(
528
587
  function(t, o) {
529
588
  const {
530
589
  showArrow: r,
531
- children: l,
532
- portalled: i = !0,
590
+ children: i,
591
+ portalled: l = !0,
533
592
  content: s,
534
- portalRef: d,
593
+ portalRef: h,
535
594
  ...u
536
595
  } = t;
537
596
  return /* @__PURE__ */ c(
538
- B.Root,
597
+ $.Root,
539
598
  {
540
599
  ...u,
541
600
  positioning: { ...u.positioning, gutter: 4 },
542
601
  children: [
543
- /* @__PURE__ */ n(B.Trigger, { asChild: !0, children: l }),
544
- /* @__PURE__ */ n(ae, { disabled: !i, container: d, children: /* @__PURE__ */ n(B.Positioner, { children: /* @__PURE__ */ c(
545
- B.Content,
602
+ /* @__PURE__ */ n($.Trigger, { asChild: !0, children: i }),
603
+ /* @__PURE__ */ n(he, { disabled: !l, container: h, children: /* @__PURE__ */ n($.Positioner, { children: /* @__PURE__ */ c(
604
+ $.Content,
546
605
  {
547
606
  width: "auto",
548
607
  px: "2",
@@ -551,7 +610,7 @@ const Y = C.ActionTrigger, v = () => {
551
610
  rounded: "sm",
552
611
  ref: o,
553
612
  children: [
554
- r && /* @__PURE__ */ n(B.Arrow, { children: /* @__PURE__ */ n(B.ArrowTip, {}) }),
613
+ r && /* @__PURE__ */ n($.Arrow, { children: /* @__PURE__ */ n($.ArrowTip, {}) }),
555
614
  s
556
615
  ]
557
616
  }
@@ -560,61 +619,61 @@ const Y = C.ActionTrigger, v = () => {
560
619
  }
561
620
  );
562
621
  }
563
- ), Bn = A.forwardRef(function(t, o) {
564
- const { children: r, ...l } = t;
565
- return /* @__PURE__ */ n(_n, { content: r, ...l, ref: o, children: /* @__PURE__ */ n(
622
+ ), Vn = _.forwardRef(function(t, o) {
623
+ const { children: r, ...i } = t;
624
+ return /* @__PURE__ */ n(jn, { content: r, ...i, ref: o, children: /* @__PURE__ */ n(
566
625
  f,
567
626
  {
568
627
  variant: "ghost",
569
628
  "aria-label": "info",
570
629
  size: "2xs",
571
630
  colorPalette: "gray",
572
- children: /* @__PURE__ */ n(dn, {})
631
+ children: /* @__PURE__ */ n(gn, {})
573
632
  }
574
633
  ) });
575
- }), Ln = A.forwardRef(function(t, o) {
576
- return /* @__PURE__ */ n(Q.Track, { ...t, ref: o, children: /* @__PURE__ */ n(Q.Range, {}) });
634
+ }), Gn = _.forwardRef(function(t, o) {
635
+ return /* @__PURE__ */ n(K.Track, { ...t, ref: o, children: /* @__PURE__ */ n(K.Range, {}) });
577
636
  });
578
- A.forwardRef(function(t, o) {
579
- const { children: r, info: l, ...i } = t;
580
- return /* @__PURE__ */ c(Q.Label, { ...i, ref: o, children: [
637
+ _.forwardRef(function(t, o) {
638
+ const { children: r, info: i, ...l } = t;
639
+ return /* @__PURE__ */ c(K.Label, { ...l, ref: o, children: [
581
640
  r,
582
- l && /* @__PURE__ */ n(Bn, { children: l })
641
+ i && /* @__PURE__ */ n(Vn, { children: i })
583
642
  ] });
584
643
  });
585
- const $n = Q.Root, Nn = Q.ValueText, ue = () => {
586
- const e = U(), t = (e == null ? void 0 : e.numberOfTotalPages) === 1, o = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, r = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, l = (e != null && e.hasChapters ? e == null ? void 0 : e.beginPageIndexInSpineItem : e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0, i = (e != null && e.hasChapters ? e == null ? void 0 : e.endPageIndexInSpineItem : e == null ? void 0 : e.endAbsolutePageIndex) ?? 0, [s = 0, d = 0] = [
587
- l,
588
- i
589
- ].sort((g, h) => g - h), u = (e == null ? void 0 : e.beginPageIndexInSpineItem) !== (e == null ? void 0 : e.endPageIndexInSpineItem) || (e == null ? void 0 : e.beginSpineItemIndex) !== (e == null ? void 0 : e.endSpineItemIndex), a = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
644
+ const Yn = K.Root, Un = K.ValueText, me = () => {
645
+ const e = q(), t = (e == null ? void 0 : e.numberOfTotalPages) === 1, o = ((e == null ? void 0 : e.beginNumberOfPagesInSpineItem) ?? 0) > 1, r = ((e == null ? void 0 : e.endNumberOfPagesInSpineItem) ?? 0) > 1, i = (e != null && e.hasChapters ? e == null ? void 0 : e.beginPageIndexInSpineItem : e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0, l = (e != null && e.hasChapters ? e == null ? void 0 : e.endPageIndexInSpineItem : e == null ? void 0 : e.endAbsolutePageIndex) ?? 0, [s = 0, h = 0] = [
646
+ i,
647
+ l
648
+ ].sort((g, d) => g - d), u = (e == null ? void 0 : e.beginPageIndexInSpineItem) !== (e == null ? void 0 : e.endPageIndexInSpineItem) || (e == null ? void 0 : e.beginSpineItemIndex) !== (e == null ? void 0 : e.endSpineItemIndex), a = e != null && e.hasChapters ? e == null ? void 0 : e.beginNumberOfPagesInSpineItem : e == null ? void 0 : e.numberOfTotalPages;
590
649
  return {
591
650
  hasOnlyOnePage: t,
592
- beginPageIndex: l,
593
- endPageIndex: i,
651
+ beginPageIndex: i,
652
+ endPageIndex: l,
594
653
  isBeginWithinChapter: o,
595
654
  isEndWithinChapter: r,
596
655
  beginAndEndAreDifferent: u,
597
656
  totalApproximatePages: a,
598
657
  leftPageIndex: s,
599
- rightPageIndex: d
658
+ rightPageIndex: h
600
659
  };
601
- }, Fn = () => {
602
- const e = U(), {
660
+ }, qn = () => {
661
+ const e = q(), {
603
662
  hasOnlyOnePage: t,
604
663
  leftPageIndex: o,
605
664
  rightPageIndex: r,
606
- totalApproximatePages: l,
607
- beginAndEndAreDifferent: i
608
- } = ue(), s = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), d = (a) => a != null && a.subChapter ? `${a.title} / ${d(a.subChapter)}` : (a == null ? void 0 : a.title) || "", u = d(e == null ? void 0 : e.beginChapterInfo);
665
+ totalApproximatePages: i,
666
+ beginAndEndAreDifferent: l
667
+ } = me(), s = Math.round(((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100), h = (a) => a != null && a.subChapter ? `${a.title} / ${h(a.subChapter)}` : (a == null ? void 0 : a.title) || "", u = h(e == null ? void 0 : e.beginChapterInfo);
609
668
  return /* @__PURE__ */ c(P, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
610
- /* @__PURE__ */ n($n, { value: s, size: "xs", width: 150, children: /* @__PURE__ */ c(E, { justifyContent: "space-between", children: [
611
- /* @__PURE__ */ n(Ln, { width: 110 }),
612
- /* @__PURE__ */ n(Nn, { children: `${s}%` })
669
+ /* @__PURE__ */ n(Yn, { value: s, size: "xs", width: 150, children: /* @__PURE__ */ c(M, { justifyContent: "space-between", children: [
670
+ /* @__PURE__ */ n(Gn, { width: 110 }),
671
+ /* @__PURE__ */ n(Un, { children: `${s}%` })
613
672
  ] }) }),
614
673
  /* @__PURE__ */ n(p, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: u ? `Chapter: ${u}` : " " }),
615
- !t && /* @__PURE__ */ c(E, { children: [
616
- /* @__PURE__ */ n(p, { fontSize: "xs", children: i ? `${o + 1} - ${r + 1} of ${l}` : `${o + 1} of ${l}` }),
617
- !!(e != null && e.hasChapters) && /* @__PURE__ */ c(Z, { children: [
674
+ !t && /* @__PURE__ */ c(M, { children: [
675
+ /* @__PURE__ */ n(p, { fontSize: "xs", children: l ? `${o + 1} - ${r + 1} of ${i}` : `${o + 1} of ${i}` }),
676
+ !!(e != null && e.hasChapters) && /* @__PURE__ */ c(J, { children: [
618
677
  /* @__PURE__ */ n(p, { children: "-" }),
619
678
  /* @__PURE__ */ c(p, { fontSize: "xs", children: [
620
679
  "(",
@@ -624,13 +683,13 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
624
683
  ] })
625
684
  ] })
626
685
  ] });
627
- }, Ie = m(
686
+ }, Te = m(
628
687
  ({
629
688
  children: e,
630
689
  position: t,
631
690
  ...o
632
691
  }) => /* @__PURE__ */ n(
633
- W,
692
+ X,
634
693
  {
635
694
  display: "flex",
636
695
  flexDirection: "row",
@@ -654,8 +713,8 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
654
713
  children: e
655
714
  }
656
715
  )
657
- ), Hn = Ve(hn), jn = m((e) => /* @__PURE__ */ n(
658
- z,
716
+ ), Qn = Ge(pn), Kn = m((e) => /* @__PURE__ */ n(
717
+ O,
659
718
  {
660
719
  display: "contents",
661
720
  css: {
@@ -664,7 +723,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
664
723
  "--color-solid": "colors.colorPalette.solid"
665
724
  },
666
725
  children: /* @__PURE__ */ n(
667
- Hn,
726
+ Qn,
668
727
  {
669
728
  keyboard: !1,
670
729
  style: {
@@ -708,64 +767,64 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
708
767
  }
709
768
  )
710
769
  }
711
- )), Vn = () => {
712
- const e = U(), t = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = ue(), l = t ? Math.floor((o || 0) / 2) : o, [i, s] = xe({
713
- default: l || 0
714
- }), d = 0, u = Math.max(
770
+ )), Wn = () => {
771
+ const e = q(), t = e == null ? void 0 : e.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = me(), i = t ? Math.floor((o || 0) / 2) : o, [l, s] = ye({
772
+ default: i || 0
773
+ }), h = 0, u = Math.max(
715
774
  0,
716
775
  t ? Math.floor((r - 1) / 2) : r - 1
717
776
  );
718
- return K(() => {
719
- s.setValue(l || 0);
720
- }, [l, s]), {
721
- value: i,
777
+ return ee(() => {
778
+ s.setValue(i || 0);
779
+ }, [i, s]), {
780
+ value: l,
722
781
  valueSignal: s,
723
- min: d,
782
+ min: h,
724
783
  max: u
725
784
  };
726
- }, Gn = (e) => {
727
- const t = v(), o = U(), { manifest: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, l = (r == null ? void 0 : r.readingDirection) === "rtl", i = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: s = 0, isBeginWithinChapter: d } = ue(), u = 1, a = d, { value: g, valueSignal: h, min: x, max: k } = Vn(), w = q(
785
+ }, Xn = (e) => {
786
+ const t = C(), o = q(), { manifest: r } = x(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, i = (r == null ? void 0 : r.readingDirection) === "rtl", l = o == null ? void 0 : o.isUsingSpread, { totalApproximatePages: s = 0, isBeginWithinChapter: h } = me(), u = 1, a = h, { value: g, valueSignal: d, min: b, max: v } = Wn(), w = Q(
728
787
  (R) => {
729
- const [y = 0] = Array.isArray(R) ? R : [R];
730
- h.setValue(y);
731
- const D = i ? Math.floor(y) * 2 : Math.floor(y);
788
+ const [I = 0] = Array.isArray(R) ? R : [R];
789
+ d.setValue(I);
790
+ const A = l ? Math.floor(I) * 2 : Math.floor(I);
732
791
  a ? t == null || t.navigation.goToPageOfSpineItem({
733
- pageIndex: D,
792
+ pageIndex: A,
734
793
  spineItemId: t.pagination.getState().beginSpineItemIndex ?? 0,
735
794
  animation: !1
736
795
  }) : t == null || t.navigation.goToAbsolutePageIndex({
737
- absolutePageIndex: D,
796
+ absolutePageIndex: A,
738
797
  animation: !1
739
798
  });
740
799
  },
741
- [t, i, h, a]
800
+ [t, l, d, a]
742
801
  );
743
- return L(
802
+ return D(
744
803
  () => t == null ? void 0 : t.navigation.throttleLock({
745
804
  duration: 100,
746
- trigger: h.subject
805
+ trigger: d.subject
747
806
  }),
748
- [t, h]
749
- ), s === 1 || i && s === 2 ? /* @__PURE__ */ n(z, { style: e.style }) : /* @__PURE__ */ n(
750
- jn,
807
+ [t, d]
808
+ ), s === 1 || l && s === 2 ? /* @__PURE__ */ n(O, { style: e.style }) : /* @__PURE__ */ n(
809
+ Kn,
751
810
  {
752
811
  value: [g],
753
- max: k,
754
- min: x,
755
- reverse: l,
812
+ max: v,
813
+ min: b,
814
+ reverse: i,
756
815
  step: u,
757
816
  onChange: w,
758
817
  ...e
759
818
  }
760
819
  );
761
- }, Yn = m(
820
+ }, Zn = m(
762
821
  ({
763
822
  open: e,
764
823
  onItemClick: t
765
824
  }) => {
766
- const o = v(), 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", [s, d] = S(!0);
825
+ const o = C(), r = x(() => o == null ? void 0 : o.navigation.state$, [o]), i = x(() => o == null ? void 0 : o.settings.values$, [o]), l = (i == null ? void 0 : i.computedPageTurnDirection) === "vertical", [s, h] = k(!0);
767
826
  return /* @__PURE__ */ c(
768
- Ie,
827
+ Te,
769
828
  {
770
829
  present: e,
771
830
  position: "bottom",
@@ -774,7 +833,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
774
833
  overflow: "auto",
775
834
  pb: 8,
776
835
  children: [
777
- /* @__PURE__ */ c(E, { flex: 1, alignItems: "center", justifyContent: "center", children: [
836
+ /* @__PURE__ */ c(M, { flex: 1, alignItems: "center", justifyContent: "center", children: [
778
837
  /* @__PURE__ */ n(
779
838
  f,
780
839
  {
@@ -784,7 +843,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
784
843
  flexShrink: 0,
785
844
  onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
786
845
  disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
787
- children: i ? /* @__PURE__ */ n(ln, {}) : /* @__PURE__ */ n(sn, {})
846
+ children: l ? /* @__PURE__ */ n(cn, {}) : /* @__PURE__ */ n(dn, {})
788
847
  }
789
848
  ),
790
849
  /* @__PURE__ */ c(
@@ -797,9 +856,9 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
797
856
  overflow: "auto",
798
857
  px: 4,
799
858
  children: [
800
- /* @__PURE__ */ n(Fn, {}),
859
+ /* @__PURE__ */ n(qn, {}),
801
860
  /* @__PURE__ */ n(
802
- Gn,
861
+ Xn,
803
862
  {
804
863
  style: {
805
864
  width: "100%",
@@ -822,28 +881,28 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
822
881
  onClick: () => {
823
882
  o == null || o.navigation.goToRightOrBottomSpineItem();
824
883
  },
825
- children: i ? /* @__PURE__ */ n(an, {}) : /* @__PURE__ */ n(cn, {})
884
+ children: l ? /* @__PURE__ */ n(hn, {}) : /* @__PURE__ */ n(un, {})
826
885
  }
827
886
  )
828
887
  ] }),
829
- /* @__PURE__ */ n(E, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
830
- ee.Root,
888
+ /* @__PURE__ */ n(M, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
889
+ oe.Root,
831
890
  {
832
891
  open: s,
833
892
  flex: 1,
834
893
  onOpenChange: ({ open: u }) => {
835
- d(u);
894
+ h(u);
836
895
  },
837
896
  children: [
838
897
  /* @__PURE__ */ n(
839
- ee.Trigger,
898
+ oe.Trigger,
840
899
  {
841
900
  paddingY: "3",
842
901
  width: "100%",
843
902
  display: "flex",
844
903
  justifyContent: "center",
845
904
  children: /* @__PURE__ */ n(
846
- Qe,
905
+ Ke,
847
906
  {
848
907
  style: {
849
908
  transform: s ? "rotate(0deg)" : "rotate(180deg)"
@@ -852,7 +911,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
852
911
  )
853
912
  }
854
913
  ),
855
- /* @__PURE__ */ c(ee.Content, { display: "flex", justifyContent: "center", children: [
914
+ /* @__PURE__ */ c(oe.Content, { display: "flex", justifyContent: "center", children: [
856
915
  /* @__PURE__ */ n(
857
916
  f,
858
917
  {
@@ -860,7 +919,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
860
919
  size: "lg",
861
920
  variant: "ghost",
862
921
  onClick: () => t("help"),
863
- children: /* @__PURE__ */ n(Ke, {})
922
+ children: /* @__PURE__ */ n(We, {})
864
923
  }
865
924
  ),
866
925
  /* @__PURE__ */ n(
@@ -870,37 +929,37 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
870
929
  size: "lg",
871
930
  variant: "ghost",
872
931
  onClick: () => t("toc"),
873
- children: /* @__PURE__ */ n(We, {})
932
+ children: /* @__PURE__ */ n(Xe, {})
874
933
  }
875
934
  ),
876
- ke(o) && /* @__PURE__ */ n(
935
+ Ie(o) && /* @__PURE__ */ n(
877
936
  f,
878
937
  {
879
938
  "aria-label": "Search",
880
939
  size: "lg",
881
940
  variant: "ghost",
882
941
  onClick: () => t("search"),
883
- children: /* @__PURE__ */ n(Xe, {})
942
+ children: /* @__PURE__ */ n(Ze, {})
884
943
  }
885
944
  ),
886
- de(o) && /* @__PURE__ */ n(
945
+ ge(o) && /* @__PURE__ */ n(
887
946
  f,
888
947
  {
889
948
  "aria-label": "Search",
890
949
  size: "lg",
891
950
  variant: "ghost",
892
951
  onClick: () => t("bookmarks"),
893
- children: /* @__PURE__ */ n(tn, {})
952
+ children: /* @__PURE__ */ n(on, {})
894
953
  }
895
954
  ),
896
- ye(o) && /* @__PURE__ */ n(
955
+ Se(o) && /* @__PURE__ */ n(
897
956
  f,
898
957
  {
899
958
  "aria-label": "Search",
900
959
  size: "lg",
901
960
  variant: "ghost",
902
961
  onClick: () => t("annotations"),
903
- children: /* @__PURE__ */ n(oe, {})
962
+ children: /* @__PURE__ */ n(se, {})
904
963
  }
905
964
  ),
906
965
  /* @__PURE__ */ n(
@@ -914,17 +973,17 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
914
973
  viewportMode: (o == null ? void 0 : o.settings.values.viewportMode) === "normal" ? "thumbnails" : "normal"
915
974
  });
916
975
  },
917
- children: /* @__PURE__ */ n(Ze, {})
976
+ children: /* @__PURE__ */ n(Je, {})
918
977
  }
919
978
  ),
920
- Se(o) && /* @__PURE__ */ n(
979
+ we(o) && /* @__PURE__ */ n(
921
980
  f,
922
981
  {
923
982
  "aria-label": "Gallery",
924
983
  size: "lg",
925
984
  variant: "ghost",
926
985
  onClick: () => t("gallery"),
927
- children: /* @__PURE__ */ n(rn, {})
986
+ children: /* @__PURE__ */ n(an, {})
928
987
  }
929
988
  )
930
989
  ] })
@@ -935,13 +994,13 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
935
994
  }
936
995
  );
937
996
  }
938
- ), Un = () => {
939
- const [e, t] = S(!1), o = q(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
997
+ ), Jn = () => {
998
+ const [e, t] = k(!1), o = Q(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
940
999
  t(!1);
941
1000
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
942
1001
  t(!0);
943
1002
  }), []);
944
- return K(() => {
1003
+ return ee(() => {
945
1004
  function r() {
946
1005
  t(!!document.fullscreenElement);
947
1006
  }
@@ -952,14 +1011,14 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
952
1011
  isFullscreen: e,
953
1012
  onToggleFullscreenClick: o
954
1013
  };
955
- }, qn = m(
1014
+ }, et = m(
956
1015
  ({
957
1016
  open: e,
958
1017
  onItemClick: t
959
1018
  }) => {
960
- const o = v(), r = b(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: l, onToggleFullscreenClick: i } = Un();
1019
+ const o = C(), r = x(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: i, onToggleFullscreenClick: l } = Jn();
961
1020
  return /* @__PURE__ */ c(
962
- Ie,
1021
+ Te,
963
1022
  {
964
1023
  present: e,
965
1024
  position: "top",
@@ -974,7 +1033,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
974
1033
  variant: "ghost",
975
1034
  flexShrink: 0,
976
1035
  onClick: () => t("back"),
977
- children: /* @__PURE__ */ n(un, {})
1036
+ children: /* @__PURE__ */ n(mn, {})
978
1037
  }
979
1038
  ),
980
1039
  /* @__PURE__ */ n(
@@ -989,7 +1048,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
989
1048
  children: /* @__PURE__ */ n(p, { truncate: !0, maxWidth: "100%", children: r == null ? void 0 : r.title })
990
1049
  }
991
1050
  ),
992
- /* @__PURE__ */ c(E, { children: [
1051
+ /* @__PURE__ */ c(M, { children: [
993
1052
  /* @__PURE__ */ n(
994
1053
  f,
995
1054
  {
@@ -998,7 +1057,7 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
998
1057
  flexShrink: 0,
999
1058
  variant: "ghost",
1000
1059
  onClick: () => t("more"),
1001
- children: /* @__PURE__ */ n(gn, {})
1060
+ children: /* @__PURE__ */ n(fn, {})
1002
1061
  }
1003
1062
  ),
1004
1063
  /* @__PURE__ */ n(
@@ -1008,8 +1067,8 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1008
1067
  size: "lg",
1009
1068
  flexShrink: 0,
1010
1069
  variant: "ghost",
1011
- onClick: i,
1012
- children: l ? /* @__PURE__ */ n(pn, {}) : /* @__PURE__ */ n(mn, {})
1070
+ onClick: l,
1071
+ children: i ? /* @__PURE__ */ n(bn, {}) : /* @__PURE__ */ n(xn, {})
1013
1072
  }
1014
1073
  )
1015
1074
  ] })
@@ -1017,26 +1076,26 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1017
1076
  }
1018
1077
  );
1019
1078
  }
1020
- ), Qn = m(
1079
+ ), nt = m(
1021
1080
  ({
1022
1081
  onItemClick: e
1023
1082
  }) => {
1024
- const [t] = he();
1025
- return /* @__PURE__ */ c(Z, { children: [
1026
- /* @__PURE__ */ n(qn, { open: t, onItemClick: e }),
1027
- /* @__PURE__ */ n(Yn, { open: t, onItemClick: e })
1083
+ const [t] = pe();
1084
+ return /* @__PURE__ */ c(J, { children: [
1085
+ /* @__PURE__ */ n(et, { open: t, onItemClick: e }),
1086
+ /* @__PURE__ */ n(Zn, { open: t, onItemClick: e })
1028
1087
  ] });
1029
1088
  }
1030
- ), Kn = m(
1089
+ ), tt = m(
1031
1090
  ({
1032
1091
  contextText: e = "",
1033
1092
  startOffset: t = 0,
1034
1093
  text: o,
1035
1094
  cfi: r = "#",
1036
- onClick: l,
1037
- absolutePageIndex: i
1095
+ onClick: i,
1096
+ absolutePageIndex: l
1038
1097
  }) => {
1039
- const d = e.substring(
1098
+ const h = e.substring(
1040
1099
  Math.max(t - 15, 0),
1041
1100
  Math.max(t, 0)
1042
1101
  ), u = e.substring(
@@ -1047,12 +1106,12 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1047
1106
  )
1048
1107
  );
1049
1108
  return /* @__PURE__ */ c(
1050
- J,
1109
+ te,
1051
1110
  {
1052
1111
  href: r,
1053
1112
  style: { margin: 5, overflow: "hidden" },
1054
1113
  onClick: (a) => {
1055
- a.preventDefault(), l(r);
1114
+ a.preventDefault(), i(r);
1056
1115
  },
1057
1116
  display: "flex",
1058
1117
  flexDirection: "column",
@@ -1061,49 +1120,49 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1061
1120
  children: [
1062
1121
  /* @__PURE__ */ c(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1063
1122
  '"',
1064
- d,
1123
+ h,
1065
1124
  /* @__PURE__ */ n("b", { children: o }),
1066
1125
  u,
1067
1126
  '"'
1068
1127
  ] }),
1069
- /* @__PURE__ */ n(p, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${i !== void 0 ? i + 1 : "unknown (not loaded)"}` })
1128
+ /* @__PURE__ */ n(p, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${l !== void 0 ? l + 1 : "unknown (not loaded)"}` })
1070
1129
  ]
1071
1130
  }
1072
1131
  );
1073
1132
  }
1074
- ), Wn = m(
1133
+ ), ot = m(
1075
1134
  ({
1076
1135
  onNavigate: e
1077
1136
  }) => {
1078
- const [t, o] = S(""), r = v(), l = ke(r) ? r : void 0, i = (h) => {
1079
- o(h.target.value);
1080
- }, s = q(
1081
- (h) => {
1082
- e(), r == null || r.navigation.goToCfi(h);
1137
+ const [t, o] = k(""), r = C(), i = Ie(r) ? r : void 0, l = (d) => {
1138
+ o(d.target.value);
1139
+ }, s = Q(
1140
+ (d) => {
1141
+ e(), r == null || r.navigation.goToCfi(d);
1083
1142
  },
1084
1143
  [r, e]
1085
- ), d = b(
1086
- () => l == null ? void 0 : l.search.search(t).pipe(
1087
- se((h) => ({ type: "end", data: h })),
1088
- Ne({ type: "start" })
1144
+ ), h = x(
1145
+ () => i == null ? void 0 : i.search.search(t).pipe(
1146
+ ne((d) => ({ type: "end", data: d })),
1147
+ Fe({ type: "start" })
1089
1148
  ),
1090
1149
  [r, t]
1091
- ), u = (d == null ? void 0 : d.type) === "start", a = (d == null ? void 0 : d.type) === "end" ? d.data : [], g = b(
1150
+ ), u = (h == null ? void 0 : h.type) === "start", a = (h == null ? void 0 : h.type) === "end" ? h.data : [], g = x(
1092
1151
  () => r == null ? void 0 : r.pagination.locate(a.slice(0, 100)),
1093
1152
  [a]
1094
1153
  );
1095
1154
  return /* @__PURE__ */ c(P, { flex: 1, height: "100%", children: [
1096
- /* @__PURE__ */ n(z, { px: 4, children: /* @__PURE__ */ n(
1097
- Ge,
1155
+ /* @__PURE__ */ n(O, { px: 4, children: /* @__PURE__ */ n(
1156
+ Ye,
1098
1157
  {
1099
1158
  placeholder: "Type something...",
1100
1159
  value: t,
1101
- onChange: i,
1160
+ onChange: l,
1102
1161
  borderRadius: 0
1103
1162
  }
1104
1163
  ) }),
1105
1164
  /* @__PURE__ */ c(
1106
- z,
1165
+ O,
1107
1166
  {
1108
1167
  px: 4,
1109
1168
  pb: 4,
@@ -1114,24 +1173,24 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1114
1173
  u && /* @__PURE__ */ n(p, { children: "Searching ..." }),
1115
1174
  !u && a.length === 0 && /* @__PURE__ */ n("p", { children: "There are no results" }),
1116
1175
  !u && a.length >= 0 && /* @__PURE__ */ c(P, { children: [
1117
- /* @__PURE__ */ c(te, { as: "h2", size: "md", children: [
1176
+ /* @__PURE__ */ c(le, { as: "h2", size: "md", children: [
1118
1177
  a.length,
1119
1178
  " result(s)"
1120
1179
  ] }),
1121
- /* @__PURE__ */ n(P, { gap: 0, children: g == null ? void 0 : g.map((h, x) => {
1122
- var k, w, O, R, y, D, T;
1180
+ /* @__PURE__ */ n(P, { gap: 0, children: g == null ? void 0 : g.map((d, b) => {
1181
+ var v, w, z, R, I, A, T;
1123
1182
  return /* @__PURE__ */ n(
1124
- Kn,
1183
+ tt,
1125
1184
  {
1126
- contextText: ((O = (w = (k = h.meta) == null ? void 0 : k.range) == null ? void 0 : w.startContainer.parentElement) == null ? void 0 : O.textContent) ?? "",
1127
- pageIndex: (R = h.meta) == null ? void 0 : R.itemPageIndex,
1128
- startOffset: ((D = (y = h.meta) == null ? void 0 : y.range) == null ? void 0 : D.startOffset) ?? 0,
1185
+ contextText: ((z = (w = (v = d.meta) == null ? void 0 : v.range) == null ? void 0 : w.startContainer.parentElement) == null ? void 0 : z.textContent) ?? "",
1186
+ pageIndex: (R = d.meta) == null ? void 0 : R.itemPageIndex,
1187
+ startOffset: ((A = (I = d.meta) == null ? void 0 : I.range) == null ? void 0 : A.startOffset) ?? 0,
1129
1188
  text: t,
1130
- cfi: h.cfi,
1189
+ cfi: d.cfi,
1131
1190
  onClick: s,
1132
- absolutePageIndex: (T = h.meta) == null ? void 0 : T.absolutePageIndex
1191
+ absolutePageIndex: (T = d.meta) == null ? void 0 : T.absolutePageIndex
1133
1192
  },
1134
- x
1193
+ b
1135
1194
  );
1136
1195
  }) })
1137
1196
  ] })
@@ -1140,13 +1199,13 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1140
1199
  )
1141
1200
  ] });
1142
1201
  }
1143
- ), Xn = m(
1202
+ ), rt = m(
1144
1203
  ({
1145
1204
  open: e,
1146
1205
  setOpen: t,
1147
1206
  onNavigate: o
1148
1207
  }) => /* @__PURE__ */ n(
1149
- F,
1208
+ H,
1150
1209
  {
1151
1210
  lazyMount: !0,
1152
1211
  placement: "center",
@@ -1154,47 +1213,47 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1154
1213
  onOpenChange: (r) => t(r.open),
1155
1214
  size: { mdDown: "full", md: "lg" },
1156
1215
  scrollBehavior: "inside",
1157
- children: /* @__PURE__ */ c($, { height: "100%", children: [
1158
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Search" }) }),
1159
- /* @__PURE__ */ n(V, { flex: 1, children: /* @__PURE__ */ n(Wn, { onNavigate: o }) }),
1160
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
1161
- /* @__PURE__ */ n(N, {})
1216
+ children: /* @__PURE__ */ c(N, { height: "100%", children: [
1217
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Y, { children: "Search" }) }),
1218
+ /* @__PURE__ */ n(G, { flex: 1, children: /* @__PURE__ */ n(ot, { onNavigate: o }) }),
1219
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(U, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "outline", children: "Cancel" }) }) }),
1220
+ /* @__PURE__ */ n(F, {})
1162
1221
  ] })
1163
1222
  }
1164
1223
  )
1165
- ), Zn = m(
1224
+ ), it = m(
1166
1225
  ({
1167
1226
  onNavigate: e
1168
1227
  }) => {
1169
- const t = v(), { manifest: o, assumedRenditionLayout: r } = b(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: l } = o ?? {}, i = U();
1170
- l != null && l.toc;
1171
- const { beginSpineItemIndex: s, beginPageIndexInSpineItem: d } = i ?? {}, u = (r === "reflowable" ? d : s) || 0;
1228
+ const t = C(), { manifest: o, assumedRenditionLayout: r } = x(() => t == null ? void 0 : t.context.state$, [t]) ?? {}, { nav: i } = o ?? {}, l = q();
1229
+ i != null && i.toc;
1230
+ const { beginSpineItemIndex: s, beginPageIndexInSpineItem: h } = l ?? {}, u = (r === "reflowable" ? h : s) || 0;
1172
1231
  console.log({ assumedRenditionLayout: r, currentSpineItemOrChapterPageIndex: u });
1173
- let a = i == null ? void 0 : i.beginChapterInfo;
1232
+ let a = l == null ? void 0 : l.beginChapterInfo;
1174
1233
  for (; a != null && a.subChapter; )
1175
1234
  a = a == null ? void 0 : a.subChapter;
1176
- const g = (h, x, k) => /* @__PURE__ */ c(we.Fragment, { children: [
1235
+ const g = (d, b, v) => /* @__PURE__ */ c(Pe.Fragment, { children: [
1177
1236
  /* @__PURE__ */ n(
1178
- I.Item,
1237
+ S.Item,
1179
1238
  {
1180
- pl: 4 * (k + 1),
1239
+ pl: 4 * (v + 1),
1181
1240
  style: {
1182
1241
  display: "flex",
1183
1242
  alignItems: "center"
1184
1243
  },
1185
1244
  children: /* @__PURE__ */ c(
1186
- J,
1245
+ te,
1187
1246
  {
1188
1247
  onClick: () => {
1189
- e(), t == null || t.navigation.goToUrl(h.href);
1248
+ e(), t == null || t.navigation.goToUrl(d.href);
1190
1249
  },
1191
1250
  href: "#",
1192
1251
  children: [
1193
- (a == null ? void 0 : a.path) === h.path && /* @__PURE__ */ n(I.Indicator, { asChild: !0, children: /* @__PURE__ */ n(me, {}) }),
1194
- (a == null ? void 0 : a.path) !== h.path && /* @__PURE__ */ n(I.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(me, {}) }),
1252
+ (a == null ? void 0 : a.path) === d.path && /* @__PURE__ */ n(S.Indicator, { asChild: !0, children: /* @__PURE__ */ n(be, {}) }),
1253
+ (a == null ? void 0 : a.path) !== d.path && /* @__PURE__ */ n(S.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ n(be, {}) }),
1195
1254
  /* @__PURE__ */ c(P, { gap: 0, children: [
1196
- /* @__PURE__ */ n(p, { fontSize: "md", children: h.title || h.path }),
1197
- (a == null ? void 0 : a.path) === h.path && /* @__PURE__ */ n(
1255
+ /* @__PURE__ */ n(p, { fontSize: "md", children: d.title || d.path }),
1256
+ (a == null ? void 0 : a.path) === d.path && /* @__PURE__ */ n(
1198
1257
  p,
1199
1258
  {
1200
1259
  fontStyle: "italic",
@@ -1209,19 +1268,19 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1209
1268
  )
1210
1269
  }
1211
1270
  ),
1212
- h.contents.length > 0 && /* @__PURE__ */ n(I.Root, { as: "div", gap: 2, children: h.contents.map(
1213
- (w, O) => g(w, O, k + 1)
1271
+ d.contents.length > 0 && /* @__PURE__ */ n(S.Root, { as: "div", gap: 2, children: d.contents.map(
1272
+ (w, z) => g(w, z, v + 1)
1214
1273
  ) })
1215
- ] }, x);
1216
- return /* @__PURE__ */ n(I.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: l == null ? void 0 : l.toc.map((h, x) => g(h, x, 0)) });
1274
+ ] }, b);
1275
+ return /* @__PURE__ */ n(S.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: i == null ? void 0 : i.toc.map((d, b) => g(d, b, 0)) });
1217
1276
  }
1218
- ), Jn = m(
1277
+ ), lt = m(
1219
1278
  ({
1220
1279
  open: e,
1221
1280
  setOpen: t,
1222
1281
  onNavigate: o
1223
1282
  }) => /* @__PURE__ */ n(
1224
- F,
1283
+ H,
1225
1284
  {
1226
1285
  lazyMount: !0,
1227
1286
  placement: "center",
@@ -1229,88 +1288,88 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1229
1288
  onOpenChange: (r) => t(r.open),
1230
1289
  size: { mdDown: "full", md: "lg" },
1231
1290
  scrollBehavior: "inside",
1232
- children: /* @__PURE__ */ c($, { children: [
1233
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Table of Contents" }) }),
1234
- /* @__PURE__ */ n(V, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(Zn, { onNavigate: o }) }),
1235
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
1236
- /* @__PURE__ */ n(N, {})
1291
+ children: /* @__PURE__ */ c(N, { children: [
1292
+ /* @__PURE__ */ n(V, { children: /* @__PURE__ */ n(Y, { children: "Table of Contents" }) }),
1293
+ /* @__PURE__ */ n(G, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ n(it, { onNavigate: o }) }),
1294
+ /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(U, { asChild: !0, children: /* @__PURE__ */ n(L, { variant: "outline", children: "Cancel" }) }) }),
1295
+ /* @__PURE__ */ n(F, {})
1237
1296
  ] })
1238
1297
  }
1239
1298
  )
1240
- ), bt = ({
1299
+ ), St = ({
1241
1300
  enableFloatingTime: e = !0,
1242
1301
  enableFloatingProgress: t = !0,
1243
1302
  onItemClick: o
1244
1303
  }) => {
1245
- const [r, l] = S(!1), [i, s] = S(!1), [d, u] = S(!1), [a, g] = S(!1), [h, x] = S(!1), [k, w] = S(!1), [O, R] = he(), y = q(() => {
1246
- l(!1), s(!1), u(!1), g(!1), x(!1), R(!1), w(!1);
1247
- }, [R]), D = q(
1304
+ const [r, i] = k(!1), [l, s] = k(!1), [h, u] = k(!1), [a, g] = k(!1), [d, b] = k(!1), [v, w] = k(!1), [z, R] = pe(), I = Q(() => {
1305
+ i(!1), s(!1), u(!1), g(!1), b(!1), R(!1), w(!1);
1306
+ }, [R]), A = Q(
1248
1307
  (T) => {
1249
- T === "annotations" ? g(!0) : T === "search" ? u(!0) : T === "help" ? s(!0) : T === "toc" ? l(!0) : T === "bookmarks" ? x(!0) : T === "gallery" && w(!0), o == null || o(T);
1308
+ T === "annotations" ? g(!0) : T === "search" ? u(!0) : T === "help" ? s(!0) : T === "toc" ? i(!0) : T === "bookmarks" ? b(!0) : T === "gallery" && w(!0), o == null || o(T);
1250
1309
  },
1251
1310
  [o]
1252
1311
  );
1253
- return zn(), Mn(), /* @__PURE__ */ c(Z, { children: [
1312
+ return $n(), Hn(), /* @__PURE__ */ c(J, { children: [
1254
1313
  t && /* @__PURE__ */ n(
1255
- W,
1314
+ X,
1256
1315
  {
1257
- present: !O,
1316
+ present: !z,
1258
1317
  animationName: { _open: "fade-in", _closed: "fade-out" },
1259
1318
  animationDuration: "moderate",
1260
- children: /* @__PURE__ */ n(Pn, {})
1319
+ children: /* @__PURE__ */ n(Mn, {})
1261
1320
  }
1262
1321
  ),
1263
- /* @__PURE__ */ n(Sn, { open: k, setOpen: w }),
1264
- /* @__PURE__ */ n(Qn, { onItemClick: D }),
1265
- /* @__PURE__ */ n(Cn, {}),
1266
- /* @__PURE__ */ n(Tn, { open: i, setOpen: s }),
1322
+ /* @__PURE__ */ n(zn, { open: v, setOpen: w }),
1323
+ /* @__PURE__ */ n(nt, { onItemClick: A }),
1324
+ /* @__PURE__ */ n(kn, {}),
1325
+ /* @__PURE__ */ n(En, { open: l, setOpen: s }),
1267
1326
  /* @__PURE__ */ n(
1268
- Jn,
1327
+ lt,
1269
1328
  {
1270
1329
  open: r,
1271
- setOpen: l,
1272
- onNavigate: y
1330
+ setOpen: i,
1331
+ onNavigate: I
1273
1332
  }
1274
1333
  ),
1275
1334
  /* @__PURE__ */ n(
1276
- Xn,
1335
+ rt,
1277
1336
  {
1278
- open: d,
1337
+ open: h,
1279
1338
  setOpen: u,
1280
- onNavigate: y
1339
+ onNavigate: I
1281
1340
  }
1282
1341
  ),
1283
1342
  /* @__PURE__ */ n(
1284
- xn,
1343
+ yn,
1285
1344
  {
1286
1345
  open: a,
1287
1346
  setOpen: g,
1288
- onNavigate: y
1347
+ onNavigate: I
1289
1348
  }
1290
1349
  ),
1291
1350
  /* @__PURE__ */ n(
1292
- kn,
1351
+ Sn,
1293
1352
  {
1294
- open: h,
1295
- setOpen: x,
1296
- onNavigate: y
1353
+ open: d,
1354
+ setOpen: b,
1355
+ onNavigate: I
1297
1356
  }
1298
1357
  ),
1299
1358
  /* @__PURE__ */ n(
1300
- W,
1359
+ X,
1301
1360
  {
1302
- present: e || O,
1361
+ present: e || z,
1303
1362
  animationName: { _open: "fade-in", _closed: "fade-out" },
1304
1363
  animationDuration: "slow",
1305
1364
  overflow: "hidden",
1306
- children: /* @__PURE__ */ n(Dn, {})
1365
+ children: /* @__PURE__ */ n(Bn, {})
1307
1366
  }
1308
1367
  ),
1309
- /* @__PURE__ */ n(yn, {})
1368
+ /* @__PURE__ */ n(wn, {})
1310
1369
  ] });
1311
1370
  };
1312
1371
  export {
1313
- bt as ReactReader,
1314
- ft as ReactReaderProvider
1372
+ St as ReactReader,
1373
+ It as ReactReaderProvider
1315
1374
  };
1316
1375
  //# sourceMappingURL=index.js.map