@prose-reader/react-reader 1.202.0 → 1.204.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";
1
+ import { jsx as t, jsxs as d, Fragment as Z } from "react/jsx-runtime";
2
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";
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 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 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: be({ default: !1 })
21
- }), ft = 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 [, l] = xe({
28
+ const [, i] = ve({
29
29
  default: o
30
- }), i = Re(r), s = Pe(
30
+ }), l = Ee(r), s = be(
31
31
  () => ({
32
- quickMenuSignal: l,
33
- reader: t
32
+ quickMenuSignal: i,
33
+ reader: n
34
34
  }),
35
- [l, t]
35
+ [i, n]
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 J(() => {
38
+ i.setValue(o);
39
+ }, [o, i]), M(
40
+ () => i.subject.pipe(ce(l.current)),
41
+ [i, l]
42
+ ), /* @__PURE__ */ t(he.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
+ ), 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
- portalled: l = !0,
50
- portalRef: i,
49
+ portalled: i = !0,
50
+ portalRef: l,
51
51
  backdrop: s = !0,
52
- ...d
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 }) })
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
- }), N = A.forwardRef(function(t, o) {
59
- return /* @__PURE__ */ n(
60
- C.CloseTrigger,
58
+ }), N = A.forwardRef(function(n, o) {
59
+ return /* @__PURE__ */ t(
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(fn, { size: "sm", ref: o, children: t.children })
67
+ children: /* @__PURE__ */ t(Ct, { size: "sm", ref: o, children: n.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
+ }), F = y.Root, H = y.Footer, j = y.Header, V = y.Body;
71
+ y.Backdrop;
72
+ const G = y.Title;
73
+ y.Description;
74
+ y.Trigger;
75
+ const Y = y.ActionTrigger, C = () => {
76
+ const { reader: e } = xe(he);
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
+ }, 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 = v(), o = ye(t) ? t : void 0, r = b(
80
+ const n = C(), o = Te(n) ? n : void 0, r = x(
81
81
  () => o == null ? void 0 : o.annotations.highlights$.pipe(
82
- ie(
83
- (i) => o.pagination.locate(i)
82
+ Q(
83
+ (l) => o.locateResources(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 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(i.cfi ?? "");
94
+ e(), n == null || n.navigation.goToCfi(l.meta.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, {}) }),
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)" }) }) }),
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: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.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 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__ */ t(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
+ ), yt = m(
119
119
  ({
120
120
  open: e,
121
- setOpen: t,
121
+ setOpen: n,
122
122
  onNavigate: o
123
- }) => /* @__PURE__ */ n(
123
+ }) => /* @__PURE__ */ t(
124
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($, { 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__ */ 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
- ), Cn = m(() => {
141
- const e = v(), t = de(e) ? e : void 0, o = b(() => e == null ? void 0 : e.spine.element$, [e]), r = b(
142
- () => t == null ? void 0 : t.bookmarks.pages$,
143
- [t]
144
- ), l = b(
145
- () => t == null ? void 0 : t.bookmarks.bookmarks$,
146
- [t]
147
- ), i = b(
148
- () => e == null ? void 0 : e.pagination.locate(l ?? []),
149
- [e, l]
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
+ ), i = x(
145
+ () => n == null ? void 0 : n.bookmarks.bookmarks$,
146
+ [n]
147
+ ), l = x(
148
+ () => e == null ? void 0 : e.locateResources(i ?? []),
149
+ [e, i]
150
150
  );
151
- return o ? /* @__PURE__ */ n(Z, { children: Je(
151
+ return o ? /* @__PURE__ */ t(Z, { children: tt(
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: c, top: u, width: a } }, g) => {
154
+ const h = l == null ? void 0 : l.find(
155
+ (f) => {
156
+ var v;
157
+ return ((v = f == null ? void 0 : f.meta) == null ? void 0 : v.absolutePageIndex) === g;
158
158
  }
159
159
  );
160
- return s ? /* @__PURE__ */ n(
160
+ return s ? /* @__PURE__ */ t(
161
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
- z,
167
+ children: /* @__PURE__ */ t(
168
+ R,
169
169
  {
170
170
  "data-bookmark-area": !0,
171
171
  position: "absolute",
172
- left: d + a,
172
+ left: c + a,
173
173
  transform: "translateX(-100%)",
174
174
  top: u,
175
175
  p: 2,
176
- children: h ? /* @__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
- h && (t == null || t.bookmarks.delete(
184
- h == null ? void 0 : h.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(nn, {})
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 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__ */ t(nt, {})
206
206
  }
207
207
  )
208
208
  }
@@ -214,26 +214,26 @@ const Y = C.ActionTrigger, v = () => {
214
214
  ),
215
215
  o
216
216
  ) }) : null;
217
- }), vn = m(
217
+ }), kt = m(
218
218
  ({ onNavigate: e }) => {
219
- const t = v(), o = de(t) ? t : void 0, r = b(
219
+ const n = C(), o = ue(n) ? n : void 0, r = x(
220
220
  () => o == null ? void 0 : o.bookmarks.bookmarks$.pipe(
221
- ie((i) => o.pagination.locate(i))
221
+ Q((l) => o.locateResources(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: [
227
- /* @__PURE__ */ n(
228
- J,
224
+ ), i = (l, s) => {
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(i.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: ${((d = i.meta) == null ? void 0 : d.absolutePageIndex) !== void 0 ? i.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,237 +241,352 @@ 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 ? (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
- M,
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(i.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(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__ */ t(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
+ ), St = m(
269
269
  ({
270
270
  open: e,
271
- setOpen: t,
271
+ setOpen: n,
272
272
  onNavigate: o
273
- }) => /* @__PURE__ */ n(
273
+ }) => /* @__PURE__ */ t(
274
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($, { 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__ */ 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
- ), re = Fe({
290
+ ), ae = je({
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) => {
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, {}),
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 })
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(_.ActionTrigger, { children: e.action.label }),
302
- ((t = e.meta) == null ? void 0 : t.closable) && /* @__PURE__ */ n(_.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
- } }) }), Sn = m(
304
+ } }) }), Tt = {
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 Pt() {
315
+ const [e, n] = I(null), [o, r] = I(Tt), i = be(
316
+ () => new ResizeObserver((l) => {
317
+ if (l[0]) {
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
+ }
321
+ }),
322
+ []
323
+ );
324
+ return De(() => {
325
+ if (e)
326
+ return i.observe(e), () => {
327
+ i.disconnect();
328
+ };
329
+ }, [e, i]), [n, o, e];
330
+ }
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(
305
359
  ({
306
- open: e,
307
- setOpen: t
360
+ item: e,
361
+ onNavigated: n
308
362
  }) => {
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]
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
+ }
314
415
  );
315
- return K(() => {
316
- r && d && (r.innerHTML = "", r.appendChild(d));
317
- }, [d, r]), /* @__PURE__ */ n(
416
+ }
417
+ ), zt = m(
418
+ ({
419
+ open: e,
420
+ setOpen: n
421
+ }) => {
422
+ const o = C(), r = x(() => o == null ? void 0 : o.spineItemsManager.items$, [o]);
423
+ return /* @__PURE__ */ t(
318
424
  F,
319
425
  {
320
426
  lazyMount: !0,
321
427
  placement: "center",
322
428
  open: e,
323
- onOpenChange: (u) => t(u.open),
429
+ onOpenChange: (i) => n(i.open),
324
430
  size: { mdDown: "full", md: "lg" },
325
431
  scrollBehavior: "inside",
326
- children: /* @__PURE__ */ c($, { height: "100%", children: [
327
- /* @__PURE__ */ n(j, { children: /* @__PURE__ */ n(G, { children: "Gallery" }) }),
328
- /* @__PURE__ */ n(
329
- V,
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,
330
436
  {
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
- }
437
+ gridTemplateColumns: [
438
+ "repeat(2, minmax(0, 1fr))",
439
+ "repeat(3, minmax(0, 1fr))"
440
+ ],
441
+ display: "grid",
442
+ gap: [2, 4],
443
+ pt: 2,
444
+ "data-grid": !0,
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
+ ))
340
455
  }
341
- ),
342
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
343
- /* @__PURE__ */ n(N, {})
456
+ ) }),
457
+ /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(Y, { asChild: !0, children: /* @__PURE__ */ t(_, { variant: "outline", children: "Cancel" }) }) }),
458
+ /* @__PURE__ */ t(N, {})
344
459
  ] })
345
460
  }
346
461
  );
347
462
  }
348
- ), In = "@prose-reader/react-reader", wn = "1.201.0", Tn = m(
463
+ ), Dt = "@prose-reader/react-reader", Et = "1.203.0", At = m(
349
464
  ({
350
465
  open: e,
351
- setOpen: t
352
- }) => /* @__PURE__ */ n(
466
+ setOpen: n
467
+ }) => /* @__PURE__ */ t(
353
468
  F,
354
469
  {
355
470
  lazyMount: !0,
356
471
  placement: "center",
357
472
  open: e,
358
- onOpenChange: (o) => t(o.open),
473
+ onOpenChange: (o) => n(o.open),
359
474
  size: { mdDown: "full", md: "lg" },
360
475
  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, {}) }),
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, {}) }),
367
482
  " ",
368
- /* @__PURE__ */ n(p, { children: "Navigate to right page" })
483
+ /* @__PURE__ */ t(p, { children: "Navigate to right page" })
369
484
  ] }),
370
- /* @__PURE__ */ c(E, { mb: 1, children: [
371
- /* @__PURE__ */ n(pe, { children: /* @__PURE__ */ n(qe, {}) }),
485
+ /* @__PURE__ */ d(E, { mb: 1, children: [
486
+ /* @__PURE__ */ t(me, { children: /* @__PURE__ */ t(Ke, {}) }),
372
487
  " ",
373
- /* @__PURE__ */ n(p, { children: "Navigate to left page" })
488
+ /* @__PURE__ */ t(p, { children: "Navigate to left page" })
374
489
  ] }),
375
- /* @__PURE__ */ n(te, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
376
- /* @__PURE__ */ c(p, { children: [
377
- In,
490
+ /* @__PURE__ */ t(le, { mb: 2, mt: 4, as: "h3", size: "lg", children: "About" }),
491
+ /* @__PURE__ */ d(p, { children: [
492
+ Dt,
378
493
  " version: ",
379
- wn
494
+ Et
380
495
  ] })
381
496
  ] }),
382
- /* @__PURE__ */ n(H, { children: /* @__PURE__ */ n(Y, { asChild: !0, children: /* @__PURE__ */ n(M, { variant: "outline", children: "Cancel" }) }) }),
383
- /* @__PURE__ */ n(N, {})
497
+ /* @__PURE__ */ t(H, { children: /* @__PURE__ */ t(Y, { asChild: !0, children: /* @__PURE__ */ t(_, { variant: "outline", children: "Cancel" }) }) }),
498
+ /* @__PURE__ */ t(N, {})
384
499
  ] })
385
500
  }
386
501
  )
387
502
  ), 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) => {
503
+ const e = C();
504
+ return x(
505
+ () => e ? Le([e.pagination.state$, e.context.state$]).pipe(
506
+ te(([n, o]) => {
507
+ var i;
508
+ const r = (i = o.manifest) == null ? void 0 : i.spineItems.every(
509
+ (l) => {
395
510
  var s;
396
- return (s = i.mediaType) == null ? void 0 : s.startsWith("image/");
511
+ return (s = l.mediaType) == null ? void 0 : s.startsWith("image/");
397
512
  }
398
513
  );
399
514
  return {
400
- ...t,
515
+ ...n,
401
516
  hasChapters: !o.isFullyPrePaginated && !r
402
517
  };
403
518
  })
404
- ) : le,
519
+ ) : ee,
405
520
  [e]
406
521
  );
407
- }, Pn = () => {
408
- const e = U(), t = Math.floor(
522
+ }, Mt = () => {
523
+ const e = U(), n = Math.floor(
409
524
  ((e == null ? void 0 : e.percentageEstimateOfBook) ?? 0) * 100
410
- ), 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: [
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: [
412
527
  o,
413
528
  " %"
414
529
  ] }) });
415
- }, Rn = () => {
416
- const [e, t] = S(/* @__PURE__ */ new Date());
417
- return K(() => {
530
+ }, _t = () => {
531
+ const [e, n] = I(/* @__PURE__ */ new Date());
532
+ return J(() => {
418
533
  const o = setInterval(() => {
419
- t(/* @__PURE__ */ new Date());
534
+ n(/* @__PURE__ */ new Date());
420
535
  }, 6e4);
421
536
  return () => clearInterval(o);
422
537
  }, []), e;
423
- }, On = (e) => {
424
- const t = Rn();
425
- 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, {
426
541
  hour: "2-digit",
427
542
  minute: "2-digit"
428
543
  }) });
429
- }, he = () => {
430
- const { quickMenuSignal: e } = fe(ce);
431
- return [Oe(e), e.setValue, e];
432
- }, Dn = () => {
433
- const [e] = he();
434
- return /* @__PURE__ */ n(
435
- z,
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,
436
551
  {
437
552
  position: "absolute",
438
553
  left: 0,
439
554
  bottom: 0,
440
555
  p: 2,
441
556
  color: e ? void 0 : "colorPalette.contrast",
442
- children: /* @__PURE__ */ n(On, {})
557
+ children: /* @__PURE__ */ t(Lt, {})
443
558
  }
444
559
  );
445
- }, zn = () => {
446
- const e = v();
447
- L(
448
- () => e == null ? void 0 : e.links$.subscribe((t) => {
449
- if (t.type === "click" && on(t.target, "a")) {
450
- if (!t.target.href) return;
451
- const o = new URL(t.target.href);
560
+ }, $t = () => {
561
+ const e = C();
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);
452
567
  window.location.host !== o.host && confirm(
453
568
  "You are going to be redirected to external link"
454
- ) && window.open(t.target.href, "__blank");
569
+ ) && window.open(n.target.href, "__blank");
455
570
  }
456
571
  }),
457
572
  [e]
458
573
  );
459
- }, X = be({
574
+ }, X = Ce({
460
575
  default: void 0
461
- }), En = () => {
462
- const e = v();
463
- L(
576
+ }), Nt = () => {
577
+ const e = C();
578
+ M(
464
579
  () => e == null ? void 0 : e.zoom.isZooming$.pipe(
465
- ie((t) => {
466
- if (!t) return Ee;
467
- const o = new Ae();
580
+ Q((n) => {
581
+ if (!n) return Be;
582
+ const o = new $e();
468
583
  return X.setValue({
469
584
  key: "zoom",
470
585
  title: "Zooming",
471
586
  duration: 999999,
472
587
  abort: o
473
- }), le.pipe(
474
- ve(() => {
588
+ }), ee.pipe(
589
+ Se(() => {
475
590
  o.next(), o.complete();
476
591
  })
477
592
  );
@@ -479,69 +594,69 @@ const Y = C.ActionTrigger, v = () => {
479
594
  ),
480
595
  [e]
481
596
  );
482
- }, An = () => {
483
- const e = v();
484
- L(
597
+ }, Ft = () => {
598
+ const e = C();
599
+ M(
485
600
  () => e == null ? void 0 : e.settings.values$.pipe(
486
- se(({ fontScale: t }) => t),
487
- $e(),
488
- ne(1),
489
- Ce((t) => {
601
+ te(({ fontScale: n }) => n),
602
+ Ie(),
603
+ ie(1),
604
+ ce((n) => {
490
605
  X.setValue({
491
606
  key: "fontScaleChange",
492
607
  title: "Font size changed",
493
- description: `${t * 100} %`
608
+ description: `${n * 100} %`
494
609
  });
495
610
  })
496
611
  ),
497
612
  [e]
498
613
  );
499
- }, Mn = () => {
500
- An(), En(), L(
614
+ }, Ht = () => {
615
+ Ft(), Nt(), M(
501
616
  () => X.subject.pipe(
502
617
  // @todo implement Signal / BehaviorSignal / ReplaySignal
503
- ne(1),
504
- ge(De),
505
- Me((e) => {
506
- const t = e.duration ?? 3e3, o = re.create({
618
+ ie(1),
619
+ re(Me),
620
+ Ne((e) => {
621
+ const n = e.duration ?? 3e3, o = ae.create({
507
622
  title: e.title,
508
623
  description: e.description,
509
- duration: t
624
+ duration: n
510
625
  }), r = X.subject.pipe(
511
- ne(1),
512
- ge((l) => !!e.key && (l == null ? void 0 : l.key) === e.key)
626
+ ie(1),
627
+ re((i) => !!e.key && (i == null ? void 0 : i.key) === e.key)
513
628
  );
514
- return _e(
515
- Be(t),
516
- e.abort ?? le,
629
+ return Fe(
630
+ He(n),
631
+ e.abort ?? ee,
517
632
  r
518
633
  ).pipe(
519
- Le(),
520
- ve(() => {
521
- re.dismiss(o);
634
+ ke(),
635
+ Se(() => {
636
+ ae.dismiss(o);
522
637
  })
523
638
  );
524
639
  })
525
640
  )
526
641
  );
527
- }, _n = A.forwardRef(
528
- function(t, o) {
642
+ }, jt = A.forwardRef(
643
+ function(n, o) {
529
644
  const {
530
645
  showArrow: r,
531
- children: l,
532
- portalled: i = !0,
646
+ children: i,
647
+ portalled: l = !0,
533
648
  content: s,
534
- portalRef: d,
649
+ portalRef: c,
535
650
  ...u
536
- } = t;
537
- return /* @__PURE__ */ c(
651
+ } = n;
652
+ return /* @__PURE__ */ d(
538
653
  B.Root,
539
654
  {
540
655
  ...u,
541
656
  positioning: { ...u.positioning, gutter: 4 },
542
657
  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(
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(
545
660
  B.Content,
546
661
  {
547
662
  width: "auto",
@@ -551,7 +666,7 @@ const Y = C.ActionTrigger, v = () => {
551
666
  rounded: "sm",
552
667
  ref: o,
553
668
  children: [
554
- r && /* @__PURE__ */ n(B.Arrow, { children: /* @__PURE__ */ n(B.ArrowTip, {}) }),
669
+ r && /* @__PURE__ */ t(B.Arrow, { children: /* @__PURE__ */ t(B.ArrowTip, {}) }),
555
670
  s
556
671
  ]
557
672
  }
@@ -560,63 +675,63 @@ const Y = C.ActionTrigger, v = () => {
560
675
  }
561
676
  );
562
677
  }
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(
566
- 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,
567
682
  {
568
683
  variant: "ghost",
569
684
  "aria-label": "info",
570
685
  size: "2xs",
571
686
  colorPalette: "gray",
572
- children: /* @__PURE__ */ n(dn, {})
687
+ children: /* @__PURE__ */ t(gt, {})
573
688
  }
574
689
  ) });
575
- }), Ln = A.forwardRef(function(t, o) {
576
- return /* @__PURE__ */ n(Q.Track, { ...t, ref: o, children: /* @__PURE__ */ n(Q.Range, {}) });
690
+ }), Gt = A.forwardRef(function(n, o) {
691
+ return /* @__PURE__ */ t(K.Track, { ...n, ref: o, children: /* @__PURE__ */ t(K.Range, {}) });
577
692
  });
578
- A.forwardRef(function(t, o) {
579
- const { children: r, info: l, ...i } = t;
580
- return /* @__PURE__ */ c(Q.Label, { ...i, 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: [
581
696
  r,
582
- l && /* @__PURE__ */ n(Bn, { children: l })
697
+ i && /* @__PURE__ */ t(Vt, { children: i })
583
698
  ] });
584
699
  });
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
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] = [
702
+ i,
703
+ l
589
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;
590
705
  return {
591
- hasOnlyOnePage: t,
592
- beginPageIndex: l,
593
- endPageIndex: i,
706
+ hasOnlyOnePage: n,
707
+ beginPageIndex: i,
708
+ endPageIndex: l,
594
709
  isBeginWithinChapter: o,
595
710
  isEndWithinChapter: r,
596
711
  beginAndEndAreDifferent: u,
597
712
  totalApproximatePages: a,
598
713
  leftPageIndex: s,
599
- rightPageIndex: d
714
+ rightPageIndex: c
600
715
  };
601
- }, Fn = () => {
716
+ }, qt = () => {
602
717
  const e = U(), {
603
- hasOnlyOnePage: t,
718
+ hasOnlyOnePage: n,
604
719
  leftPageIndex: o,
605
720
  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);
609
- 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}%` })
721
+ totalApproximatePages: i,
722
+ beginAndEndAreDifferent: l
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}%` })
613
728
  ] }) }),
614
- /* @__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: [
618
- /* @__PURE__ */ n(p, { children: "-" }),
619
- /* @__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: [
620
735
  "(",
621
736
  ((e == null ? void 0 : e.beginAbsolutePageIndex) ?? 0) + 1,
622
737
  ")"
@@ -624,20 +739,20 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
624
739
  ] })
625
740
  ] })
626
741
  ] });
627
- }, Ie = m(
742
+ }, Re = m(
628
743
  ({
629
744
  children: e,
630
- position: t,
745
+ position: n,
631
746
  ...o
632
- }) => /* @__PURE__ */ n(
747
+ }) => /* @__PURE__ */ t(
633
748
  W,
634
749
  {
635
750
  display: "flex",
636
751
  flexDirection: "row",
637
752
  width: "100%",
638
753
  position: "absolute",
639
- ...t === "bottom" ? { bottom: 0 } : { top: 0 },
640
- animationName: t === "bottom" ? {
754
+ ...n === "bottom" ? { bottom: 0 } : { top: 0 },
755
+ animationName: n === "bottom" ? {
641
756
  _open: "slide-from-bottom, fade-in",
642
757
  _closed: "slide-to-bottom, fade-out"
643
758
  } : {
@@ -654,8 +769,8 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
654
769
  children: e
655
770
  }
656
771
  )
657
- ), Hn = Ve(hn), jn = m((e) => /* @__PURE__ */ n(
658
- z,
772
+ ), Qt = Ye(pt), Kt = m((e) => /* @__PURE__ */ t(
773
+ R,
659
774
  {
660
775
  display: "contents",
661
776
  css: {
@@ -663,8 +778,8 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
663
778
  "--bg-emphasized": "colors.bg.emphasized",
664
779
  "--color-solid": "colors.colorPalette.solid"
665
780
  },
666
- children: /* @__PURE__ */ n(
667
- Hn,
781
+ children: /* @__PURE__ */ t(
782
+ Qt,
668
783
  {
669
784
  keyboard: !1,
670
785
  style: {
@@ -708,64 +823,64 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
708
823
  }
709
824
  )
710
825
  }
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(
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({
828
+ default: i || 0
829
+ }), c = 0, u = Math.max(
715
830
  0,
716
- t ? Math.floor((r - 1) / 2) : r - 1
831
+ n ? Math.floor((r - 1) / 2) : r - 1
717
832
  );
718
- return K(() => {
719
- s.setValue(l || 0);
720
- }, [l, s]), {
721
- value: i,
833
+ return J(() => {
834
+ s.setValue(i || 0);
835
+ }, [i, s]), {
836
+ value: l,
722
837
  valueSignal: s,
723
- min: d,
838
+ min: c,
724
839
  max: u
725
840
  };
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(
728
- (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);
732
- a ? t == null || t.navigation.goToPageOfSpineItem({
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({
733
848
  pageIndex: D,
734
- spineItemId: t.pagination.getState().beginSpineItemIndex ?? 0,
849
+ spineItemId: n.pagination.getState().beginSpineItemIndex ?? 0,
735
850
  animation: !1
736
- }) : t == null || t.navigation.goToAbsolutePageIndex({
851
+ }) : n == null || n.navigation.goToAbsolutePageIndex({
737
852
  absolutePageIndex: D,
738
853
  animation: !1
739
854
  });
740
855
  },
741
- [t, i, h, a]
856
+ [n, l, h, a]
742
857
  );
743
- return L(
744
- () => t == null ? void 0 : t.navigation.throttleLock({
858
+ return M(
859
+ () => n == null ? void 0 : n.navigation.throttleLock({
745
860
  duration: 100,
746
861
  trigger: h.subject
747
862
  }),
748
- [t, h]
749
- ), s === 1 || i && s === 2 ? /* @__PURE__ */ n(z, { style: e.style }) : /* @__PURE__ */ n(
750
- jn,
863
+ [n, h]
864
+ ), s === 1 || l && s === 2 ? /* @__PURE__ */ t(R, { style: e.style }) : /* @__PURE__ */ t(
865
+ Kt,
751
866
  {
752
867
  value: [g],
753
- max: k,
754
- min: x,
755
- reverse: l,
868
+ max: v,
869
+ min: f,
870
+ reverse: i,
756
871
  step: u,
757
872
  onChange: w,
758
873
  ...e
759
874
  }
760
875
  );
761
- }, Yn = m(
876
+ }, Zt = m(
762
877
  ({
763
878
  open: e,
764
- onItemClick: t
879
+ onItemClick: n
765
880
  }) => {
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);
767
- return /* @__PURE__ */ c(
768
- Ie,
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,
769
884
  {
770
885
  present: e,
771
886
  position: "bottom",
@@ -774,9 +889,9 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
774
889
  overflow: "auto",
775
890
  pb: 8,
776
891
  children: [
777
- /* @__PURE__ */ c(E, { flex: 1, alignItems: "center", justifyContent: "center", children: [
778
- /* @__PURE__ */ n(
779
- f,
892
+ /* @__PURE__ */ d(E, { flex: 1, alignItems: "center", justifyContent: "center", children: [
893
+ /* @__PURE__ */ t(
894
+ b,
780
895
  {
781
896
  "aria-label": "left",
782
897
  size: "lg",
@@ -784,10 +899,10 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
784
899
  flexShrink: 0,
785
900
  onClick: () => o == null ? void 0 : o.navigation.goToLeftOrTopSpineItem(),
786
901
  disabled: !(r != null && r.canGoLeftSpineItem) && !(r != null && r.canGoTopSpineItem),
787
- children: i ? /* @__PURE__ */ n(ln, {}) : /* @__PURE__ */ n(sn, {})
902
+ children: l ? /* @__PURE__ */ t(ct, {}) : /* @__PURE__ */ t(dt, {})
788
903
  }
789
904
  ),
790
- /* @__PURE__ */ c(
905
+ /* @__PURE__ */ d(
791
906
  P,
792
907
  {
793
908
  flex: 1,
@@ -797,9 +912,9 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
797
912
  overflow: "auto",
798
913
  px: 4,
799
914
  children: [
800
- /* @__PURE__ */ n(Fn, {}),
801
- /* @__PURE__ */ n(
802
- Gn,
915
+ /* @__PURE__ */ t(qt, {}),
916
+ /* @__PURE__ */ t(
917
+ Xt,
803
918
  {
804
919
  style: {
805
920
  width: "100%",
@@ -811,8 +926,8 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
811
926
  ]
812
927
  }
813
928
  ),
814
- /* @__PURE__ */ n(
815
- f,
929
+ /* @__PURE__ */ t(
930
+ b,
816
931
  {
817
932
  "aria-label": "right",
818
933
  size: "lg",
@@ -822,28 +937,28 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
822
937
  onClick: () => {
823
938
  o == null || o.navigation.goToRightOrBottomSpineItem();
824
939
  },
825
- children: i ? /* @__PURE__ */ n(an, {}) : /* @__PURE__ */ n(cn, {})
940
+ children: l ? /* @__PURE__ */ t(ht, {}) : /* @__PURE__ */ t(ut, {})
826
941
  }
827
942
  )
828
943
  ] }),
829
- /* @__PURE__ */ n(E, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ c(
830
- ee.Root,
944
+ /* @__PURE__ */ t(E, { alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ d(
945
+ oe.Root,
831
946
  {
832
947
  open: s,
833
948
  flex: 1,
834
949
  onOpenChange: ({ open: u }) => {
835
- d(u);
950
+ c(u);
836
951
  },
837
952
  children: [
838
- /* @__PURE__ */ n(
839
- ee.Trigger,
953
+ /* @__PURE__ */ t(
954
+ oe.Trigger,
840
955
  {
841
956
  paddingY: "3",
842
957
  width: "100%",
843
958
  display: "flex",
844
959
  justifyContent: "center",
845
- children: /* @__PURE__ */ n(
846
- Qe,
960
+ children: /* @__PURE__ */ t(
961
+ We,
847
962
  {
848
963
  style: {
849
964
  transform: s ? "rotate(0deg)" : "rotate(180deg)"
@@ -852,59 +967,59 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
852
967
  )
853
968
  }
854
969
  ),
855
- /* @__PURE__ */ c(ee.Content, { display: "flex", justifyContent: "center", children: [
856
- /* @__PURE__ */ n(
857
- f,
970
+ /* @__PURE__ */ d(oe.Content, { display: "flex", justifyContent: "center", children: [
971
+ /* @__PURE__ */ t(
972
+ b,
858
973
  {
859
974
  "aria-label": "Help",
860
975
  size: "lg",
861
976
  variant: "ghost",
862
- onClick: () => t("help"),
863
- children: /* @__PURE__ */ n(Ke, {})
977
+ onClick: () => n("help"),
978
+ children: /* @__PURE__ */ t(Xe, {})
864
979
  }
865
980
  ),
866
- /* @__PURE__ */ n(
867
- f,
981
+ /* @__PURE__ */ t(
982
+ b,
868
983
  {
869
984
  "aria-label": "Table of contents",
870
985
  size: "lg",
871
986
  variant: "ghost",
872
- onClick: () => t("toc"),
873
- children: /* @__PURE__ */ n(We, {})
987
+ onClick: () => n("toc"),
988
+ children: /* @__PURE__ */ t(Ze, {})
874
989
  }
875
990
  ),
876
- ke(o) && /* @__PURE__ */ n(
877
- f,
991
+ we(o) && /* @__PURE__ */ t(
992
+ b,
878
993
  {
879
994
  "aria-label": "Search",
880
995
  size: "lg",
881
996
  variant: "ghost",
882
- onClick: () => t("search"),
883
- children: /* @__PURE__ */ n(Xe, {})
997
+ onClick: () => n("search"),
998
+ children: /* @__PURE__ */ t(Je, {})
884
999
  }
885
1000
  ),
886
- de(o) && /* @__PURE__ */ n(
887
- f,
1001
+ ue(o) && /* @__PURE__ */ t(
1002
+ b,
888
1003
  {
889
1004
  "aria-label": "Search",
890
1005
  size: "lg",
891
1006
  variant: "ghost",
892
- onClick: () => t("bookmarks"),
893
- children: /* @__PURE__ */ n(tn, {})
1007
+ onClick: () => n("bookmarks"),
1008
+ children: /* @__PURE__ */ t(rt, {})
894
1009
  }
895
1010
  ),
896
- ye(o) && /* @__PURE__ */ n(
897
- f,
1011
+ Te(o) && /* @__PURE__ */ t(
1012
+ b,
898
1013
  {
899
1014
  "aria-label": "Search",
900
1015
  size: "lg",
901
1016
  variant: "ghost",
902
- onClick: () => t("annotations"),
903
- children: /* @__PURE__ */ n(oe, {})
1017
+ onClick: () => n("annotations"),
1018
+ children: /* @__PURE__ */ t(se, {})
904
1019
  }
905
1020
  ),
906
- /* @__PURE__ */ n(
907
- f,
1021
+ /* @__PURE__ */ t(
1022
+ b,
908
1023
  {
909
1024
  "aria-label": "Thumbnails",
910
1025
  size: "lg",
@@ -914,17 +1029,17 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
914
1029
  viewportMode: (o == null ? void 0 : o.settings.values.viewportMode) === "normal" ? "thumbnails" : "normal"
915
1030
  });
916
1031
  },
917
- children: /* @__PURE__ */ n(Ze, {})
1032
+ children: /* @__PURE__ */ t(et, {})
918
1033
  }
919
1034
  ),
920
- Se(o) && /* @__PURE__ */ n(
921
- f,
1035
+ Pe(o) && /* @__PURE__ */ t(
1036
+ b,
922
1037
  {
923
1038
  "aria-label": "Gallery",
924
1039
  size: "lg",
925
1040
  variant: "ghost",
926
- onClick: () => t("gallery"),
927
- children: /* @__PURE__ */ n(rn, {})
1041
+ onClick: () => n("gallery"),
1042
+ children: /* @__PURE__ */ t(at, {})
928
1043
  }
929
1044
  )
930
1045
  ] })
@@ -935,15 +1050,15 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
935
1050
  }
936
1051
  );
937
1052
  }
938
- ), Un = () => {
939
- const [e, t] = S(!1), o = q(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
940
- t(!1);
1053
+ ), Jt = () => {
1054
+ const [e, n] = I(!1), o = q(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1055
+ n(!1);
941
1056
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
942
- t(!0);
1057
+ n(!0);
943
1058
  }), []);
944
- return K(() => {
1059
+ return J(() => {
945
1060
  function r() {
946
- t(!!document.fullscreenElement);
1061
+ n(!!document.fullscreenElement);
947
1062
  }
948
1063
  return document.addEventListener("fullscreenchange", r), () => {
949
1064
  document.removeEventListener("fullscreenchange", r);
@@ -952,32 +1067,32 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
952
1067
  isFullscreen: e,
953
1068
  onToggleFullscreenClick: o
954
1069
  };
955
- }, qn = m(
1070
+ }, en = m(
956
1071
  ({
957
1072
  open: e,
958
- onItemClick: t
1073
+ onItemClick: n
959
1074
  }) => {
960
- const o = v(), r = b(() => o == null ? void 0 : o.context.manifest$, [o]), { isFullscreen: l, onToggleFullscreenClick: i } = Un();
961
- return /* @__PURE__ */ c(
962
- Ie,
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,
963
1078
  {
964
1079
  present: e,
965
1080
  position: "top",
966
1081
  height: "80px",
967
1082
  justifyContent: "space-between",
968
1083
  children: [
969
- /* @__PURE__ */ n(
970
- f,
1084
+ /* @__PURE__ */ t(
1085
+ b,
971
1086
  {
972
1087
  "aria-label": "left",
973
1088
  size: "lg",
974
1089
  variant: "ghost",
975
1090
  flexShrink: 0,
976
- onClick: () => t("back"),
977
- children: /* @__PURE__ */ n(un, {})
1091
+ onClick: () => n("back"),
1092
+ children: /* @__PURE__ */ t(mt, {})
978
1093
  }
979
1094
  ),
980
- /* @__PURE__ */ n(
1095
+ /* @__PURE__ */ t(
981
1096
  P,
982
1097
  {
983
1098
  flex: 1,
@@ -986,30 +1101,30 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
986
1101
  alignItems: "center",
987
1102
  overflow: "auto",
988
1103
  px: 4,
989
- 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 })
990
1105
  }
991
1106
  ),
992
- /* @__PURE__ */ c(E, { children: [
993
- /* @__PURE__ */ n(
994
- f,
1107
+ /* @__PURE__ */ d(E, { children: [
1108
+ /* @__PURE__ */ t(
1109
+ b,
995
1110
  {
996
1111
  "aria-label": "right",
997
1112
  size: "lg",
998
1113
  flexShrink: 0,
999
1114
  variant: "ghost",
1000
- onClick: () => t("more"),
1001
- children: /* @__PURE__ */ n(gn, {})
1115
+ onClick: () => n("more"),
1116
+ children: /* @__PURE__ */ t(ft, {})
1002
1117
  }
1003
1118
  ),
1004
- /* @__PURE__ */ n(
1005
- f,
1119
+ /* @__PURE__ */ t(
1120
+ b,
1006
1121
  {
1007
1122
  "aria-label": "right",
1008
1123
  size: "lg",
1009
1124
  flexShrink: 0,
1010
1125
  variant: "ghost",
1011
- onClick: i,
1012
- children: l ? /* @__PURE__ */ n(pn, {}) : /* @__PURE__ */ n(mn, {})
1126
+ onClick: l,
1127
+ children: i ? /* @__PURE__ */ t(bt, {}) : /* @__PURE__ */ t(xt, {})
1013
1128
  }
1014
1129
  )
1015
1130
  ] })
@@ -1017,93 +1132,93 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1017
1132
  }
1018
1133
  );
1019
1134
  }
1020
- ), Qn = m(
1135
+ ), tn = m(
1021
1136
  ({
1022
1137
  onItemClick: e
1023
1138
  }) => {
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 })
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 })
1028
1143
  ] });
1029
1144
  }
1030
- ), Kn = m(
1145
+ ), nn = m(
1031
1146
  ({
1032
1147
  contextText: e = "",
1033
- startOffset: t = 0,
1148
+ startOffset: n = 0,
1034
1149
  text: o,
1035
1150
  cfi: r = "#",
1036
- onClick: l,
1037
- absolutePageIndex: i
1151
+ onClick: i,
1152
+ absolutePageIndex: l
1038
1153
  }) => {
1039
- const d = e.substring(
1040
- Math.max(t - 15, 0),
1041
- Math.max(t, 0)
1154
+ const c = e.substring(
1155
+ Math.max(n - 15, 0),
1156
+ Math.max(n, 0)
1042
1157
  ), u = e.substring(
1043
- Math.min(t + o.length, e.length - 1),
1158
+ Math.min(n + o.length, e.length - 1),
1044
1159
  Math.min(
1045
- t + o.length + 15,
1160
+ n + o.length + 15,
1046
1161
  e.length - 1
1047
1162
  )
1048
1163
  );
1049
- return /* @__PURE__ */ c(
1050
- J,
1164
+ return /* @__PURE__ */ d(
1165
+ ne,
1051
1166
  {
1052
1167
  href: r,
1053
1168
  style: { margin: 5, overflow: "hidden" },
1054
1169
  onClick: (a) => {
1055
- a.preventDefault(), l(r);
1170
+ a.preventDefault(), i(r);
1056
1171
  },
1057
1172
  display: "flex",
1058
1173
  flexDirection: "column",
1059
1174
  alignItems: "flex-start",
1060
1175
  gap: 0,
1061
1176
  children: [
1062
- /* @__PURE__ */ c(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1177
+ /* @__PURE__ */ d(p, { lineClamp: 1, as: "cite", style: { display: "block" }, children: [
1063
1178
  '"',
1064
- d,
1065
- /* @__PURE__ */ n("b", { children: o }),
1179
+ c,
1180
+ /* @__PURE__ */ t("b", { children: o }),
1066
1181
  u,
1067
1182
  '"'
1068
1183
  ] }),
1069
- /* @__PURE__ */ n(p, { fontSize: "sm", color: "gray.500", style: { textDecoration: "none" }, children: `Book page: ${i !== void 0 ? i + 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)"}` })
1070
1185
  ]
1071
1186
  }
1072
1187
  );
1073
1188
  }
1074
- ), Wn = m(
1189
+ ), on = m(
1075
1190
  ({
1076
1191
  onNavigate: e
1077
1192
  }) => {
1078
- const [t, o] = S(""), r = v(), l = ke(r) ? r : void 0, i = (h) => {
1193
+ const [n, o] = I(""), r = C(), i = we(r) ? r : void 0, l = (h) => {
1079
1194
  o(h.target.value);
1080
1195
  }, s = q(
1081
1196
  (h) => {
1082
1197
  e(), r == null || r.navigation.goToCfi(h);
1083
1198
  },
1084
1199
  [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" })
1200
+ ), c = x(
1201
+ () => i == null ? void 0 : i.search.search(n).pipe(
1202
+ te((h) => ({ type: "end", data: h })),
1203
+ ye({ type: "start" })
1089
1204
  ),
1090
- [r, t]
1091
- ), u = (d == null ? void 0 : d.type) === "start", a = (d == null ? void 0 : d.type) === "end" ? d.data : [], g = b(
1092
- () => 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.locateResources(a.slice(0, 100)),
1093
1208
  [a]
1094
1209
  );
1095
- return /* @__PURE__ */ c(P, { flex: 1, height: "100%", children: [
1096
- /* @__PURE__ */ n(z, { px: 4, children: /* @__PURE__ */ n(
1097
- Ge,
1210
+ return /* @__PURE__ */ d(P, { flex: 1, height: "100%", children: [
1211
+ /* @__PURE__ */ t(R, { px: 4, children: /* @__PURE__ */ t(
1212
+ Ue,
1098
1213
  {
1099
1214
  placeholder: "Type something...",
1100
- value: t,
1101
- onChange: i,
1215
+ value: n,
1216
+ onChange: l,
1102
1217
  borderRadius: 0
1103
1218
  }
1104
1219
  ) }),
1105
- /* @__PURE__ */ c(
1106
- z,
1220
+ /* @__PURE__ */ d(
1221
+ R,
1107
1222
  {
1108
1223
  px: 4,
1109
1224
  pb: 4,
@@ -1111,27 +1226,27 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1111
1226
  flex: 1,
1112
1227
  style: { overflow: "hidden", overflowY: "auto" },
1113
1228
  children: [
1114
- u && /* @__PURE__ */ n(p, { children: "Searching ..." }),
1115
- !u && a.length === 0 && /* @__PURE__ */ n("p", { children: "There are no results" }),
1116
- !u && a.length >= 0 && /* @__PURE__ */ c(P, { children: [
1117
- /* @__PURE__ */ c(te, { 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: [
1118
1233
  a.length,
1119
1234
  " result(s)"
1120
1235
  ] }),
1121
- /* @__PURE__ */ n(P, { gap: 0, children: g == null ? void 0 : g.map((h, x) => {
1122
- var k, w, O, R, y, D, T;
1123
- return /* @__PURE__ */ n(
1124
- Kn,
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,
1125
1240
  {
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,
1129
- text: t,
1130
- cfi: h.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,
1131
1246
  onClick: s,
1132
1247
  absolutePageIndex: (T = h.meta) == null ? void 0 : T.absolutePageIndex
1133
1248
  },
1134
- x
1249
+ f
1135
1250
  );
1136
1251
  }) })
1137
1252
  ] })
@@ -1140,61 +1255,61 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1140
1255
  )
1141
1256
  ] });
1142
1257
  }
1143
- ), Xn = m(
1258
+ ), rn = m(
1144
1259
  ({
1145
1260
  open: e,
1146
- setOpen: t,
1261
+ setOpen: n,
1147
1262
  onNavigate: o
1148
- }) => /* @__PURE__ */ n(
1263
+ }) => /* @__PURE__ */ t(
1149
1264
  F,
1150
1265
  {
1151
1266
  lazyMount: !0,
1152
1267
  placement: "center",
1153
1268
  open: e,
1154
- onOpenChange: (r) => t(r.open),
1269
+ onOpenChange: (r) => n(r.open),
1155
1270
  size: { mdDown: "full", md: "lg" },
1156
1271
  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, {})
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, {})
1162
1277
  ] })
1163
1278
  }
1164
1279
  )
1165
- ), Zn = m(
1280
+ ), ln = m(
1166
1281
  ({
1167
1282
  onNavigate: e
1168
1283
  }) => {
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;
1284
+ const n = C(), { manifest: o, assumedRenditionLayout: r } = x(() => n == null ? void 0 : n.context.state$, [n]) ?? {}, { nav: i } = o ?? {}, l = U();
1285
+ i != null && i.toc;
1286
+ const { beginSpineItemIndex: s, beginPageIndexInSpineItem: c } = l ?? {}, u = (r === "reflowable" ? c : s) || 0;
1172
1287
  console.log({ assumedRenditionLayout: r, currentSpineItemOrChapterPageIndex: u });
1173
- let a = i == null ? void 0 : i.beginChapterInfo;
1288
+ let a = l == null ? void 0 : l.beginChapterInfo;
1174
1289
  for (; a != null && a.subChapter; )
1175
1290
  a = a == null ? void 0 : a.subChapter;
1176
- const g = (h, x, k) => /* @__PURE__ */ c(we.Fragment, { children: [
1177
- /* @__PURE__ */ n(
1178
- I.Item,
1291
+ const g = (h, f, v) => /* @__PURE__ */ d(Oe.Fragment, { children: [
1292
+ /* @__PURE__ */ t(
1293
+ S.Item,
1179
1294
  {
1180
- pl: 4 * (k + 1),
1295
+ pl: 4 * (v + 1),
1181
1296
  style: {
1182
1297
  display: "flex",
1183
1298
  alignItems: "center"
1184
1299
  },
1185
- children: /* @__PURE__ */ c(
1186
- J,
1300
+ children: /* @__PURE__ */ d(
1301
+ ne,
1187
1302
  {
1188
1303
  onClick: () => {
1189
- e(), t == null || t.navigation.goToUrl(h.href);
1304
+ e(), n == null || n.navigation.goToUrl(h.href);
1190
1305
  },
1191
1306
  href: "#",
1192
1307
  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, {}) }),
1195
- /* @__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(
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(
1198
1313
  p,
1199
1314
  {
1200
1315
  fontStyle: "italic",
@@ -1209,108 +1324,108 @@ const $n = Q.Root, Nn = Q.ValueText, ue = () => {
1209
1324
  )
1210
1325
  }
1211
1326
  ),
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)
1327
+ h.contents.length > 0 && /* @__PURE__ */ t(S.Root, { as: "div", gap: 2, children: h.contents.map(
1328
+ (w, z) => g(w, z, v + 1)
1214
1329
  ) })
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)) });
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)) });
1217
1332
  }
1218
- ), Jn = m(
1333
+ ), sn = m(
1219
1334
  ({
1220
1335
  open: e,
1221
- setOpen: t,
1336
+ setOpen: n,
1222
1337
  onNavigate: o
1223
- }) => /* @__PURE__ */ n(
1338
+ }) => /* @__PURE__ */ t(
1224
1339
  F,
1225
1340
  {
1226
1341
  lazyMount: !0,
1227
1342
  placement: "center",
1228
1343
  open: e,
1229
- onOpenChange: (r) => t(r.open),
1344
+ onOpenChange: (r) => n(r.open),
1230
1345
  size: { mdDown: "full", md: "lg" },
1231
1346
  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, {})
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, {})
1237
1352
  ] })
1238
1353
  }
1239
1354
  )
1240
- ), bt = ({
1355
+ ), wn = ({
1241
1356
  enableFloatingTime: e = !0,
1242
- enableFloatingProgress: t = !0,
1357
+ enableFloatingProgress: n = !0,
1243
1358
  onItemClick: o
1244
1359
  }) => {
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(
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(
1248
1363
  (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);
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);
1250
1365
  },
1251
1366
  [o]
1252
1367
  );
1253
- return zn(), Mn(), /* @__PURE__ */ c(Z, { children: [
1254
- t && /* @__PURE__ */ n(
1368
+ return $t(), Ht(), /* @__PURE__ */ d(Z, { children: [
1369
+ n && /* @__PURE__ */ t(
1255
1370
  W,
1256
1371
  {
1257
- present: !O,
1372
+ present: !z,
1258
1373
  animationName: { _open: "fade-in", _closed: "fade-out" },
1259
1374
  animationDuration: "moderate",
1260
- children: /* @__PURE__ */ n(Pn, {})
1375
+ children: /* @__PURE__ */ t(Mt, {})
1261
1376
  }
1262
1377
  ),
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 }),
1267
- /* @__PURE__ */ n(
1268
- Jn,
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,
1269
1384
  {
1270
1385
  open: r,
1271
- setOpen: l,
1272
- onNavigate: y
1386
+ setOpen: i,
1387
+ onNavigate: k
1273
1388
  }
1274
1389
  ),
1275
- /* @__PURE__ */ n(
1276
- Xn,
1390
+ /* @__PURE__ */ t(
1391
+ rn,
1277
1392
  {
1278
- open: d,
1393
+ open: c,
1279
1394
  setOpen: u,
1280
- onNavigate: y
1395
+ onNavigate: k
1281
1396
  }
1282
1397
  ),
1283
- /* @__PURE__ */ n(
1284
- xn,
1398
+ /* @__PURE__ */ t(
1399
+ yt,
1285
1400
  {
1286
1401
  open: a,
1287
1402
  setOpen: g,
1288
- onNavigate: y
1403
+ onNavigate: k
1289
1404
  }
1290
1405
  ),
1291
- /* @__PURE__ */ n(
1292
- kn,
1406
+ /* @__PURE__ */ t(
1407
+ St,
1293
1408
  {
1294
1409
  open: h,
1295
- setOpen: x,
1296
- onNavigate: y
1410
+ setOpen: f,
1411
+ onNavigate: k
1297
1412
  }
1298
1413
  ),
1299
- /* @__PURE__ */ n(
1414
+ /* @__PURE__ */ t(
1300
1415
  W,
1301
1416
  {
1302
- present: e || O,
1417
+ present: e || z,
1303
1418
  animationName: { _open: "fade-in", _closed: "fade-out" },
1304
1419
  animationDuration: "slow",
1305
1420
  overflow: "hidden",
1306
- children: /* @__PURE__ */ n(Dn, {})
1421
+ children: /* @__PURE__ */ t(Bt, {})
1307
1422
  }
1308
1423
  ),
1309
- /* @__PURE__ */ n(yn, {})
1424
+ /* @__PURE__ */ t(wt, {})
1310
1425
  ] });
1311
1426
  };
1312
1427
  export {
1313
- bt as ReactReader,
1314
- ft as ReactReaderProvider
1428
+ wn as ReactReader,
1429
+ Sn as ReactReaderProvider
1315
1430
  };
1316
1431
  //# sourceMappingURL=index.js.map