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