@prose-reader/react-reader 1.249.0 → 1.251.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,122 +1,134 @@
1
- import { jsx as e, jsxs as s, Fragment as ce } from "react/jsx-runtime";
2
- import * as y from "react";
3
- import He, { createContext as Ne, memo as m, useMemo as Pe, useEffect as ne, useContext as Ve, useState as R, useLayoutEffect as je, useCallback as X } from "react";
4
- import { signal as J, useConstant as re, useLiveRef as Ge, useSubscribe as D, useObserve as b, isDefined as Ae, useSignalValue as be, useSignalState as Ye } from "reactjrx";
5
- import { Subject as xe, tap as ve, map as B, filter as ie, switchMap as z, EMPTY as fe, of as ae, withLatestFrom as Ue, NEVER as de, startWith as qe, distinctUntilChanged as Ce, throttleTime as Qe, first as Oe, combineLatest as Ze, finalize as Ee, mergeMap as Ke, skip as Me, merge as ze, timer as De, BehaviorSubject as Xe } from "rxjs";
6
- import { IconButton as x, Portal as ke, Dialog as S, List as w, Link as Se, Stack as C, Text as p, Tabs as M, Button as F, Presence as se, Box as O, createToaster as Je, Toaster as et, Toast as _, Spinner as tt, Heading as he, HStack as A, Kbd as Te, Popover as $, Progress as ee, chakra as nt, Collapsible as ge, Field as Z, RadioGroup as K, Slider as I, For as ot, Fieldset as pe, Input as rt } from "@chakra-ui/react";
7
- import { LuX as it, LuNotebookPen as le, LuBookmark as at, LuArrowBigRight as st, LuArrowBigLeft as lt, LuChevronDown as ct, LuCircleHelp as dt, LuTableOfContents as ut, LuSearch as ht, LuGalleryHorizontal as gt, LuCircleCheck as we } from "react-icons/lu";
8
- import { createPortal as pt } from "react-dom";
9
- import { isPositionInArea as ft } from "@prose-reader/enhancer-gestures";
10
- import { isShallowEqual as mt, observeIntersection as bt, isHtmlTagElement as xt, watchKeys as vt } from "@prose-reader/core";
11
- import { BsBookmarks as Ct } from "react-icons/bs";
12
- import { MdOutlineFitScreen as kt, MdFullscreenExit as St, MdFullscreen as It } from "react-icons/md";
13
- import { RiGalleryView2 as Rt } from "react-icons/ri";
14
- import { RxDoubleArrowUp as yt, RxDoubleArrowLeft as Tt, RxDoubleArrowDown as wt, RxDoubleArrowRight as Pt } from "react-icons/rx";
15
- import { HiOutlineInformationCircle as At } from "react-icons/hi";
16
- import Ot from "rc-slider";
1
+ import { jsx as e, jsxs as s, Fragment as be } from "react/jsx-runtime";
2
+ import * as T from "react";
3
+ import Ne, { createContext as Ve, memo as f, useMemo as Pe, useEffect as H, useContext as Ge, useState as y, useLayoutEffect as je, useCallback as te, useRef as qe } from "react";
4
+ import { signal as L, useConstant as ee, useLiveRef as Ye, useSubscribe as N, useObserve as b, isDefined as Be, useSignalValue as ue, useSignalState as Ue } from "reactjrx";
5
+ import { Subject as Ae, tap as xe, map as _, filter as le, switchMap as W, EMPTY as ye, of as ce, withLatestFrom as Ze, NEVER as ve, startWith as Qe, distinctUntilChanged as Ce, throttleTime as Ke, first as ze, combineLatest as Xe, mergeMap as Je, skip as Oe, merge as Me, timer as Ee, finalize as en, BehaviorSubject as nn } from "rxjs";
6
+ import { IconButton as v, Portal as ke, Dialog as k, List as P, Link as Se, Stack as C, Text as p, Tabs as D, Button as V, Presence as oe, Box as B, createToaster as tn, Toaster as on, Toast as $, Spinner as rn, Heading as ge, HStack as O, Kbd as Te, Popover as F, Progress as re, chakra as an, Collapsible as pe, Field as J, RadioGroup as ne, Slider as R, For as sn, Fieldset as fe, Input as ln } from "@chakra-ui/react";
7
+ import { LuX as cn, LuNotebookPen as de, LuBookmark as dn, LuArrowBigRight as un, LuArrowBigLeft as hn, LuChevronDown as gn, LuCircleHelp as pn, LuTableOfContents as fn, LuSearch as mn, LuZoomOut as bn, LuZoomIn as xn, LuGalleryHorizontal as vn, LuCircleCheck as we } from "react-icons/lu";
8
+ import { createPortal as Cn } from "react-dom";
9
+ import { isPositionInArea as kn } from "@prose-reader/enhancer-gestures";
10
+ import { isShallowEqual as Sn, observeIntersection as In, isHtmlTagElement as Rn } from "@prose-reader/core";
11
+ import { BsBookmarks as yn } from "react-icons/bs";
12
+ import { MdOutlineFitScreen as Tn, MdFullscreenExit as wn, MdFullscreen as Pn } from "react-icons/md";
13
+ import { RiGalleryView2 as Bn } from "react-icons/ri";
14
+ import { RxDoubleArrowUp as An, RxDoubleArrowLeft as zn, RxDoubleArrowDown as On, RxDoubleArrowRight as Mn } from "react-icons/rx";
15
+ import { HiOutlineInformationCircle as En } from "react-icons/hi";
16
+ import Dn from "rc-slider";
17
17
  import "rc-slider/assets/index.css";
18
- import { IoIosArrowBack as Et, IoMdMore as Mt } from "react-icons/io";
19
- const zt = "data-bookmark-area", Be = Ne({
18
+ import { IoIosArrowBack as Ln, IoMdMore as _n } from "react-icons/io";
19
+ const $n = "data-bookmark-area", De = Ve({
20
20
  reader: void 0,
21
- quickMenuSignal: J({ default: !1 }),
22
- notificationsSubject: new xe(),
23
- refitMenuSignal: J({ default: !1 })
24
- }), oo = m(
21
+ quickMenuSignal: L({ default: !1 }),
22
+ quickMenuBottomBarBoundingBox: L({ default: void 0 }),
23
+ notificationsSubject: new Ae(),
24
+ refitMenuSignal: L({ default: !1 })
25
+ }), ao = f(
25
26
  ({
26
- children: t,
27
- reader: n,
27
+ children: n,
28
+ reader: t,
28
29
  quickMenuOpen: o,
29
- onQuickMenuOpenChange: i
30
+ onQuickMenuOpenChange: r
30
31
  }) => {
31
- const r = re(
32
- () => J({
32
+ const i = ee(
33
+ () => L({
33
34
  default: o
34
35
  })
35
- ), a = re(
36
- () => new xe()
37
- ), l = re(
38
- () => J({
36
+ ), a = ee(
37
+ () => new Ae()
38
+ ), l = ee(
39
+ () => L({
40
+ default: void 0
41
+ })
42
+ ), c = ee(
43
+ () => L({
39
44
  default: !1
40
45
  })
41
- ), c = Ge(i), d = Pe(
46
+ ), d = Ye(r), u = Pe(
42
47
  () => ({
43
- quickMenuSignal: r,
44
- reader: n,
48
+ quickMenuSignal: i,
49
+ reader: t,
45
50
  notificationsSubject: a,
46
- refitMenuSignal: l
51
+ refitMenuSignal: c,
52
+ quickMenuBottomBarBoundingBox: l
47
53
  }),
48
- [r, n, a, l]
54
+ [
55
+ i,
56
+ t,
57
+ a,
58
+ c,
59
+ l
60
+ ]
49
61
  );
50
- return ne(() => {
51
- r.next(o);
52
- }, [o, r]), D(
53
- () => r.pipe(ve(c.current)),
54
- [r, c]
55
- ), /* @__PURE__ */ e(Be.Provider, { value: d, children: t });
62
+ return H(() => {
63
+ i.next(o);
64
+ }, [o, i]), N(
65
+ () => i.pipe(xe(d.current)),
66
+ [i, d]
67
+ ), /* @__PURE__ */ e(De.Provider, { value: u, children: n });
56
68
  }
57
- ), Dt = y.forwardRef(function(n, o) {
58
- return /* @__PURE__ */ e(x, { variant: "ghost", "aria-label": "Close", ref: o, ...n, children: n.children ?? /* @__PURE__ */ e(it, {}) });
59
- }), W = y.forwardRef(function(n, o) {
69
+ ), Fn = T.forwardRef(function(t, o) {
70
+ return /* @__PURE__ */ e(v, { variant: "ghost", "aria-label": "Close", ref: o, ...t, children: t.children ?? /* @__PURE__ */ e(cn, {}) });
71
+ }), G = T.forwardRef(function(t, o) {
60
72
  const {
61
- children: i,
62
- portalled: r = !0,
73
+ children: r,
74
+ portalled: i = !0,
63
75
  portalRef: a,
64
76
  backdrop: l = !0,
65
77
  ...c
66
- } = n;
67
- return /* @__PURE__ */ s(ke, { disabled: !r, container: a, children: [
68
- l && /* @__PURE__ */ e(S.Backdrop, {}),
69
- /* @__PURE__ */ e(S.Positioner, { children: /* @__PURE__ */ e(S.Content, { ref: o, ...c, asChild: !1, children: i }) })
78
+ } = t;
79
+ return /* @__PURE__ */ s(ke, { disabled: !i, container: a, children: [
80
+ l && /* @__PURE__ */ e(k.Backdrop, {}),
81
+ /* @__PURE__ */ e(k.Positioner, { children: /* @__PURE__ */ e(k.Content, { ref: o, ...c, asChild: !1, children: r }) })
70
82
  ] });
71
- }), H = y.forwardRef(function(n, o) {
83
+ }), j = T.forwardRef(function(t, o) {
72
84
  return /* @__PURE__ */ e(
73
- S.CloseTrigger,
85
+ k.CloseTrigger,
74
86
  {
75
87
  position: "absolute",
76
88
  top: "2",
77
89
  insetEnd: "2",
78
- ...n,
90
+ ...t,
79
91
  asChild: !0,
80
- children: /* @__PURE__ */ e(Dt, { size: "sm", ref: o, children: n.children })
92
+ children: /* @__PURE__ */ e(Fn, { size: "sm", ref: o, children: t.children })
81
93
  }
82
94
  );
83
- }), N = S.Root, V = S.Footer, j = S.Header, G = S.Body;
84
- S.Backdrop;
85
- const Y = S.Title;
86
- S.Description;
87
- S.Trigger;
88
- const U = S.ActionTrigger, E = () => Ve(Be), f = () => {
89
- const { reader: t } = E();
90
- return t;
91
- }, Le = (t) => !!t && "__PROSE_READER_ENHANCER_SEARCH" in t, te = (t) => !!t && "__PROSE_READER_ENHANCER_ANNOTATIONS" in t, _e = (t) => !!t && "__PROSE_READER_ENHANCER_GALLERY" in t, $e = (t) => !!t && "__PROSE_READER_ENHANCER_REFIT" in t, Bt = (t) => {
92
- const n = f(), o = te(n) ? n : void 0;
95
+ }), q = k.Root, Y = k.Footer, U = k.Header, Z = k.Body;
96
+ k.Backdrop;
97
+ const Q = k.Title;
98
+ k.Description;
99
+ k.Trigger;
100
+ const K = k.ActionTrigger, E = () => Ge(De), m = () => {
101
+ const { reader: n } = E();
102
+ return n;
103
+ }, Le = (n) => !!n && "__PROSE_READER_ENHANCER_SEARCH" in n, ie = (n) => !!n && "__PROSE_READER_ENHANCER_ANNOTATIONS" in n, _e = (n) => !!n && "__PROSE_READER_ENHANCER_GALLERY" in n, $e = (n) => !!n && "__PROSE_READER_ENHANCER_REFIT" in n, Wn = (n) => {
104
+ const t = m(), o = ie(t) ? t : void 0;
93
105
  return { data: b(
94
106
  () => o?.annotations.annotations$.pipe(
95
- B((r) => r.find((a) => a.id === t)),
96
- ie(Ae),
97
- z((r) => o.locateResource(r))
107
+ _((i) => i.find((a) => a.id === n)),
108
+ le(Be),
109
+ W((i) => o.locateResource(i))
98
110
  ),
99
111
  [o]
100
112
  ) };
101
113
  }, Fe = ({
102
- id: t,
103
- onNavigate: n,
114
+ id: n,
115
+ onNavigate: t,
104
116
  allowLeftIcon: o = !0
105
117
  }) => {
106
- const i = f(), { data: r } = Bt(t), a = r?.meta.range?.toString() || r?.meta.node?.textContent;
107
- return /* @__PURE__ */ e(w.Item, { children: /* @__PURE__ */ s(
118
+ const r = m(), { data: i } = Wn(n), a = i?.meta.range?.toString() || i?.meta.node?.textContent;
119
+ return /* @__PURE__ */ e(P.Item, { children: /* @__PURE__ */ s(
108
120
  Se,
109
121
  {
110
122
  href: "#",
111
123
  onClick: () => {
112
- n(), i?.navigation.goToCfi(r?.meta.cfi ?? "");
124
+ t(), r?.navigation.goToCfi(i?.meta.cfi ?? "");
113
125
  },
114
126
  children: [
115
- r?.resource?.notes ? /* @__PURE__ */ e(w.Indicator, { asChild: !0, children: /* @__PURE__ */ e(le, {}) }) : o ? /* @__PURE__ */ e(w.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(le, {}) }) : null,
127
+ i?.resource?.notes ? /* @__PURE__ */ e(P.Indicator, { asChild: !0, children: /* @__PURE__ */ e(de, {}) }) : o ? /* @__PURE__ */ e(P.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(de, {}) }) : null,
116
128
  /* @__PURE__ */ s(C, { gap: 0, children: [
117
129
  a ? /* @__PURE__ */ e(p, { lineClamp: 2, fontSize: "md", children: a }) : /* @__PURE__ */ s(p, { lineClamp: 2, fontSize: "md", fontStyle: "italic", children: [
118
130
  "Page ",
119
- (r?.meta.absolutePageIndex ?? 0) + 1
131
+ (i?.meta.absolutePageIndex ?? 0) + 1
120
132
  ] }),
121
133
  /* @__PURE__ */ e(
122
134
  p,
@@ -124,162 +136,162 @@ const U = S.ActionTrigger, E = () => Ve(Be), f = () => {
124
136
  fontStyle: "italic",
125
137
  fontWeight: "bold",
126
138
  fontSize: "sm",
127
- children: `Book page: ${r?.meta?.absolutePageIndex !== void 0 ? r.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
139
+ children: `Book page: ${i?.meta?.absolutePageIndex !== void 0 ? i.meta.absolutePageIndex + 1 : "unknown (not loaded)"}`
128
140
  }
129
141
  )
130
142
  ] })
131
143
  ]
132
144
  }
133
145
  ) });
134
- }, ue = () => {
135
- const t = f(), n = te(t) ? t : void 0;
146
+ }, he = () => {
147
+ const n = m(), t = ie(n) ? n : void 0;
136
148
  return { data: b(
137
- () => n?.annotations.annotations$.pipe(
138
- z(
139
- (i) => n.locateResource(i)
149
+ () => t?.annotations.annotations$.pipe(
150
+ W(
151
+ (r) => t.locateResource(r)
140
152
  )
141
153
  ),
142
- [n]
154
+ [t]
143
155
  ) };
144
- }, Lt = () => {
145
- const { data: t } = ue();
156
+ }, Hn = () => {
157
+ const { data: n } = he();
146
158
  return {
147
- data: t?.filter((n) => n.meta.isCfiRange)
159
+ data: n?.filter((t) => t.meta.isCfiRange)
148
160
  };
149
- }, _t = ({ onNavigate: t }) => {
150
- const { data: n } = Lt();
151
- return /* @__PURE__ */ e(w.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: n?.map((o) => /* @__PURE__ */ e(
161
+ }, Nn = ({ onNavigate: n }) => {
162
+ const { data: t } = Hn();
163
+ return /* @__PURE__ */ e(P.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ e(
152
164
  Fe,
153
165
  {
154
166
  id: o.resource.id,
155
- onNavigate: t
167
+ onNavigate: n
156
168
  },
157
169
  o.resource.id
158
170
  )) });
159
- }, $t = () => {
160
- const { data: t } = ue();
171
+ }, Vn = () => {
172
+ const { data: n } = he();
161
173
  return {
162
- data: t?.filter(
163
- (n) => !n.meta.isCfiRange && !n.resource.notes
174
+ data: n?.filter(
175
+ (t) => !t.meta.isCfiRange && !t.resource.notes
164
176
  )
165
177
  };
166
- }, Ft = ({ onNavigate: t }) => {
167
- const { data: n } = $t();
168
- return /* @__PURE__ */ e(w.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: n?.map((o) => /* @__PURE__ */ e(
178
+ }, Gn = ({ onNavigate: n }) => {
179
+ const { data: t } = Vn();
180
+ return /* @__PURE__ */ e(P.Root, { overflowY: "auto", gap: 3, pt: 4, variant: "plain", children: t?.map((o) => /* @__PURE__ */ e(
169
181
  Fe,
170
182
  {
171
183
  id: o.resource.id,
172
- onNavigate: t,
184
+ onNavigate: n,
173
185
  allowLeftIcon: !1
174
186
  },
175
187
  o.resource.id
176
188
  )) });
177
- }, Wt = m(
189
+ }, jn = f(
178
190
  ({
179
- onNavigate: t,
180
- defaultTab: n
191
+ onNavigate: n,
192
+ defaultTab: t
181
193
  }) => {
182
- const [o, i] = R(n ?? "bookmarks");
194
+ const [o, r] = y(t ?? "bookmarks");
183
195
  return /* @__PURE__ */ s(
184
- M.Root,
196
+ D.Root,
185
197
  {
186
198
  value: o,
187
- onValueChange: (r) => i(r.value),
199
+ onValueChange: (i) => r(i.value),
188
200
  children: [
189
- /* @__PURE__ */ s(M.List, { children: [
190
- /* @__PURE__ */ s(M.Trigger, { value: "bookmarks", children: [
191
- /* @__PURE__ */ e(at, {}),
201
+ /* @__PURE__ */ s(D.List, { children: [
202
+ /* @__PURE__ */ s(D.Trigger, { value: "bookmarks", children: [
203
+ /* @__PURE__ */ e(dn, {}),
192
204
  "Bookmarks"
193
205
  ] }),
194
- /* @__PURE__ */ s(M.Trigger, { value: "annotations", children: [
195
- /* @__PURE__ */ e(le, {}),
206
+ /* @__PURE__ */ s(D.Trigger, { value: "annotations", children: [
207
+ /* @__PURE__ */ e(de, {}),
196
208
  "Annotations"
197
209
  ] }),
198
- /* @__PURE__ */ e(M.Indicator, {})
210
+ /* @__PURE__ */ e(D.Indicator, {})
199
211
  ] }),
200
- /* @__PURE__ */ e(M.Content, { value: "bookmarks", children: /* @__PURE__ */ e(Ft, { onNavigate: t }) }),
201
- /* @__PURE__ */ e(M.Content, { value: "annotations", children: /* @__PURE__ */ e(_t, { onNavigate: t }) })
212
+ /* @__PURE__ */ e(D.Content, { value: "bookmarks", children: /* @__PURE__ */ e(Gn, { onNavigate: n }) }),
213
+ /* @__PURE__ */ e(D.Content, { value: "annotations", children: /* @__PURE__ */ e(Nn, { onNavigate: n }) })
202
214
  ]
203
215
  }
204
216
  );
205
217
  }
206
- ), Ht = m(
218
+ ), qn = f(
207
219
  ({
208
- openWith: t,
209
- setOpen: n,
220
+ openWith: n,
221
+ setOpen: t,
210
222
  onNavigate: o
211
223
  }) => /* @__PURE__ */ e(
212
- N,
224
+ q,
213
225
  {
214
226
  lazyMount: !0,
215
227
  placement: "center",
216
- open: !!t,
217
- onOpenChange: (i) => n(i.open),
228
+ open: !!n,
229
+ onOpenChange: (r) => t(r.open),
218
230
  size: { mdDown: "full", md: "lg" },
219
231
  scrollBehavior: "inside",
220
- children: /* @__PURE__ */ s(W, { height: "100%", children: [
221
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Y, { children: "Annotations" }) }),
222
- /* @__PURE__ */ e(G, { flex: 1, children: /* @__PURE__ */ e(
223
- Wt,
232
+ children: /* @__PURE__ */ s(G, { height: "100%", children: [
233
+ /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Q, { children: "Annotations" }) }),
234
+ /* @__PURE__ */ e(Z, { flex: 1, children: /* @__PURE__ */ e(
235
+ jn,
224
236
  {
225
237
  onNavigate: o,
226
- defaultTab: t
238
+ defaultTab: n
227
239
  }
228
240
  ) }),
229
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "outline", children: "Cancel" }) }) }),
230
- /* @__PURE__ */ e(H, {})
241
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(K, { asChild: !0, children: /* @__PURE__ */ e(V, { variant: "outline", children: "Cancel" }) }) }),
242
+ /* @__PURE__ */ e(j, {})
231
243
  ] })
232
244
  }
233
245
  )
234
- ), Nt = m(({ children: t }) => {
235
- const n = f(), o = b(() => n?.spine.element$, [n]);
236
- return o ? /* @__PURE__ */ e(ce, { children: pt(t, o) }) : null;
237
- }), Vt = ({
238
- absolutePageIndex: t,
239
- itemIndex: n
246
+ ), Yn = f(({ children: n }) => {
247
+ const t = m(), o = b(() => t?.spine.element$, [t]);
248
+ return o ? /* @__PURE__ */ e(be, { children: Cn(n, o) }) : null;
249
+ }), Un = ({
250
+ absolutePageIndex: n,
251
+ itemIndex: t
240
252
  }) => {
241
- const o = f();
253
+ const o = m();
242
254
  return {
243
- spineItem: b(() => o ? n !== void 0 ? ae(o.spine.spineItemsManager.get(n)) : t !== void 0 ? o.spine.pages.observeFromAbsolutePageIndex(t).pipe(
244
- B((r) => o.spine.spineItemsManager.get(r?.itemIndex))
245
- ) : fe : fe, [n, t, o])
255
+ spineItem: b(() => o ? t !== void 0 ? ce(o.spine.spineItemsManager.get(t)) : n !== void 0 ? o.spine.pages.observeFromAbsolutePageIndex(n).pipe(
256
+ _((i) => o.spine.spineItemsManager.get(i?.itemIndex))
257
+ ) : ye : ye, [t, n, o])
246
258
  };
247
- }, jt = ({
248
- absolutePageIndex: t,
249
- itemIndex: n
259
+ }, Zn = ({
260
+ absolutePageIndex: n,
261
+ itemIndex: t
250
262
  }) => {
251
- const { spineItem: o } = Vt({ absolutePageIndex: t, itemIndex: n }), i = b(
252
- () => o?.isReady$ ?? ae(!1),
263
+ const { spineItem: o } = Un({ absolutePageIndex: n, itemIndex: t }), r = b(
264
+ () => o?.isReady$ ?? ce(!1),
253
265
  [o]
254
266
  );
255
- return { spineItem: o, isReady: i };
256
- }, Gt = m(
267
+ return { spineItem: o, isReady: r };
268
+ }, Qn = f(
257
269
  ({
258
- absolutePageIndex: t,
259
- left: n,
270
+ absolutePageIndex: n,
271
+ left: t,
260
272
  top: o,
261
- width: i
273
+ width: r
262
274
  }) => {
263
- const { isReady: r } = jt({
264
- absolutePageIndex: t
265
- }), { data: a } = ue(), l = a?.find(
266
- (d) => d?.meta?.absolutePageIndex === t && d.meta.range === void 0
275
+ const { isReady: i } = Zn({
276
+ absolutePageIndex: n
277
+ }), { data: a } = he(), l = a?.find(
278
+ (d) => d?.meta?.absolutePageIndex === n && d.meta.range === void 0
267
279
  );
268
- if (!r) return null;
269
- const c = i * 0.1 / 2;
280
+ if (!i) return null;
281
+ const c = r * 0.1 / 2;
270
282
  return /* @__PURE__ */ e(
271
- se,
283
+ oe,
272
284
  {
273
285
  present: !!l,
274
286
  lazyMount: !0,
275
287
  animationName: { _open: "fade-in", _closed: "fade-out" },
276
288
  animationDuration: "moderate",
277
289
  children: /* @__PURE__ */ e(
278
- O,
290
+ B,
279
291
  {
280
- "data-bookmark-area": zt,
292
+ "data-bookmark-area": $n,
281
293
  position: "absolute",
282
- left: n + i,
294
+ left: t + r,
283
295
  transform: "translateX(-100%)",
284
296
  pointerEvents: "none",
285
297
  top: o,
@@ -300,38 +312,38 @@ const U = S.ActionTrigger, E = () => Ve(Be), f = () => {
300
312
  }
301
313
  );
302
314
  }
303
- ), Yt = m(() => {
304
- const t = f(), n = b(() => t?.layoutInfo$, [t]);
305
- return /* @__PURE__ */ e(Nt, { children: n?.pages.map(
306
- ({ absoluteLayout: { left: o, top: i, width: r } }, a) => /* @__PURE__ */ e(
307
- Gt,
315
+ ), Kn = f(() => {
316
+ const n = m(), t = b(() => n?.layoutInfo$, [n]);
317
+ return /* @__PURE__ */ e(Yn, { children: t?.pages.map(
318
+ ({ absoluteLayout: { left: o, top: r, width: i } }, a) => /* @__PURE__ */ e(
319
+ Qn,
308
320
  {
309
321
  absolutePageIndex: a,
310
322
  left: o,
311
- top: i,
312
- width: r
323
+ top: r,
324
+ width: i
313
325
  },
314
326
  a
315
327
  )
316
328
  ) });
317
- }), Ut = () => {
318
- const t = f();
319
- return te(t) ? t : void 0;
320
- }, qt = () => {
321
- const t = Ut(), { data: n } = ue();
322
- ne(() => t ? t.gestures.hooks.register(
329
+ }), Xn = () => {
330
+ const n = m();
331
+ return ie(n) ? n : void 0;
332
+ }, Jn = () => {
333
+ const n = Xn(), { data: t } = he();
334
+ H(() => n ? n.gestures.hooks.register(
323
335
  "beforeTapGesture",
324
- ({ event$: i }) => i.pipe(
325
- Ue(t?.annotations.candidates$),
326
- B(([r, a]) => {
327
- if (!r.page) return !0;
336
+ ({ event$: r }) => r.pipe(
337
+ Ze(n?.annotations.candidates$),
338
+ _(([i, a]) => {
339
+ if (!i.page) return !0;
328
340
  const {
329
341
  spineItem: l,
330
342
  spineItemPageIndex: c,
331
343
  spineItemPagePosition: d,
332
344
  pageSize: u
333
- } = r.page;
334
- if (ft(
345
+ } = i.page;
346
+ if (kn(
335
347
  d,
336
348
  {
337
349
  type: "corner",
@@ -341,37 +353,37 @@ const U = S.ActionTrigger, E = () => Ve(Be), f = () => {
341
353
  },
342
354
  u
343
355
  )) {
344
- const h = t.spine.pages.fromSpineItemPageIndex(
356
+ const h = n.spine.pages.fromSpineItemPageIndex(
345
357
  l,
346
358
  c
347
359
  );
348
360
  if (!h) return !0;
349
- const v = n?.find(
350
- (P) => P?.meta?.absolutePageIndex === h.absolutePageIndex && P.meta.range === void 0
361
+ const x = t?.find(
362
+ (I) => I?.meta?.absolutePageIndex === h.absolutePageIndex && I.meta.range === void 0
351
363
  );
352
- if (v)
353
- return t?.annotations.delete(v.resource.id), !1;
364
+ if (x)
365
+ return n?.annotations.delete(x.resource.id), !1;
354
366
  if (a?.[h.absolutePageIndex])
355
- return t?.annotations.annotateAbsolutePage({
367
+ return n?.annotations.annotateAbsolutePage({
356
368
  absolutePageIndex: h.absolutePageIndex
357
369
  }), !1;
358
370
  }
359
371
  return !0;
360
372
  })
361
373
  )
362
- ) : void 0, [t, n]);
363
- }, me = Je({
374
+ ) : void 0, [n, t]);
375
+ }, me = tn({
364
376
  placement: "bottom-end",
365
377
  pauseOnPageIdle: !0
366
- }), Qt = () => /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ e(et, { toaster: me, insetInline: { mdDown: "4" }, children: (t) => /* @__PURE__ */ s(_.Root, { width: { md: "sm" }, children: [
367
- t.type === "loading" ? /* @__PURE__ */ e(tt, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ e(_.Indicator, {}),
378
+ }), et = () => /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ e(on, { toaster: me, insetInline: { mdDown: "4" }, children: (n) => /* @__PURE__ */ s($.Root, { width: { md: "sm" }, children: [
379
+ n.type === "loading" ? /* @__PURE__ */ e(rn, { size: "sm", color: "blue.solid" }) : /* @__PURE__ */ e($.Indicator, {}),
368
380
  /* @__PURE__ */ s(C, { gap: "1", flex: "1", maxWidth: "100%", children: [
369
- t.title && /* @__PURE__ */ e(_.Title, { children: t.title }),
370
- t.description && /* @__PURE__ */ e(_.Description, { children: t.description })
381
+ n.title && /* @__PURE__ */ e($.Title, { children: n.title }),
382
+ n.description && /* @__PURE__ */ e($.Description, { children: n.description })
371
383
  ] }),
372
- t.action && /* @__PURE__ */ e(_.ActionTrigger, { children: t.action.label }),
373
- t.meta?.closable && /* @__PURE__ */ e(_.CloseTrigger, {})
374
- ] }) }) }), Zt = {
384
+ n.action && /* @__PURE__ */ e($.ActionTrigger, { children: n.action.label }),
385
+ n.meta?.closable && /* @__PURE__ */ e($.CloseTrigger, {})
386
+ ] }) }) }), nt = {
375
387
  x: 0,
376
388
  y: 0,
377
389
  width: 0,
@@ -381,60 +393,60 @@ const U = S.ActionTrigger, E = () => Ve(Be), f = () => {
381
393
  bottom: 0,
382
394
  right: 0
383
395
  };
384
- function Kt() {
385
- const [t, n] = R(null), [o, i] = R(Zt), r = Pe(
396
+ function tt() {
397
+ const [n, t] = y(null), [o, r] = y(nt), i = Pe(
386
398
  () => new ResizeObserver((a) => {
387
399
  if (a[0]) {
388
- const { x: l, y: c, width: d, height: u, top: g, left: h, bottom: v, right: T } = a[0].contentRect;
389
- i({ x: l, y: c, width: d, height: u, top: g, left: h, bottom: v, right: T });
400
+ const { x: l, y: c, width: d, height: u, top: g, left: h, bottom: x, right: S } = a[0].contentRect;
401
+ r({ x: l, y: c, width: d, height: u, top: g, left: h, bottom: x, right: S });
390
402
  }
391
403
  }),
392
404
  []
393
405
  );
394
406
  return je(() => {
395
- if (t)
396
- return r.observe(t), () => {
397
- r.disconnect();
407
+ if (n)
408
+ return i.observe(n), () => {
409
+ i.disconnect();
398
410
  };
399
- }, [t, r]), [n, o, t];
411
+ }, [n, i]), [t, o, n];
400
412
  }
401
- const Xt = (t, n, o) => {
402
- const i = f(), r = _e(i) ? i : void 0;
403
- D(() => {
404
- if (!r || !t) return de;
405
- const a = n.layout.layout$.pipe(
406
- qe(n.layout.layoutInfo),
407
- Ce(mt)
408
- ), l = bt(
409
- t
410
- ).pipe(B((c) => c.some((d) => d.isIntersecting)));
413
+ const ot = (n, t, o) => {
414
+ const r = m(), i = _e(r) ? r : void 0;
415
+ N(() => {
416
+ if (!i || !n) return ve;
417
+ const a = t.layout.layout$.pipe(
418
+ Qe(t.layout.layoutInfo),
419
+ Ce(Sn)
420
+ ), l = In(
421
+ n
422
+ ).pipe(_((c) => c.some((d) => d.isIntersecting)));
411
423
  return a.pipe(
412
- Qe(100, void 0, { trailing: !0 }),
413
- z(() => l.pipe(
414
- ve((c) => {
415
- c || (t.innerHTML = "");
424
+ Ke(100, void 0, { trailing: !0 }),
425
+ W(() => l.pipe(
426
+ xe((c) => {
427
+ c || (n.innerHTML = "");
416
428
  }),
417
- ie((c) => c),
418
- Oe()
429
+ le((c) => c),
430
+ ze()
419
431
  ).pipe(
420
- z(() => (t.innerHTML = "", r?.gallery.snapshot(
421
- n,
432
+ W(() => (n.innerHTML = "", i?.gallery.snapshot(
422
433
  t,
434
+ n,
423
435
  o
424
436
  )))
425
437
  ))
426
438
  );
427
- }, [r, n, o, t]);
428
- }, Jt = m(
429
- ({ item: t, onNavigated: n }) => {
430
- const [o, i, r] = Kt(), a = f();
431
- Xt(r, t, i);
439
+ }, [i, t, o, n]);
440
+ }, rt = f(
441
+ ({ item: n, onNavigated: t }) => {
442
+ const [o, r, i] = tt(), a = m();
443
+ ot(i, n, r);
432
444
  const l = b(
433
- () => a?.locateResource(t, { mode: "shallow" }),
434
- [a, t]
445
+ () => a?.locateResource(n, { mode: "shallow" }),
446
+ [a, n]
435
447
  );
436
448
  return /* @__PURE__ */ s(
437
- O,
449
+ B,
438
450
  {
439
451
  width: "100%",
440
452
  aspectRatio: "2/3",
@@ -446,11 +458,11 @@ const Xt = (t, n, o) => {
446
458
  position: "relative",
447
459
  overflow: "hidden",
448
460
  onClick: () => {
449
- n(), a?.navigation.goToSpineItem({ indexOrId: t });
461
+ t(), a?.navigation.goToSpineItem({ indexOrId: n });
450
462
  },
451
463
  children: [
452
464
  /* @__PURE__ */ e(
453
- O,
465
+ B,
454
466
  {
455
467
  height: "100%",
456
468
  width: "100%",
@@ -480,22 +492,22 @@ const Xt = (t, n, o) => {
480
492
  }
481
493
  );
482
494
  }
483
- ), en = m(
484
- ({ open: t, setOpen: n }) => {
485
- const o = f(), i = b(() => o?.spineItemsManager.items$, [o]);
495
+ ), it = f(
496
+ ({ open: n, setOpen: t }) => {
497
+ const o = m(), r = b(() => o?.spineItemsManager.items$, [o]);
486
498
  return /* @__PURE__ */ e(
487
- N,
499
+ q,
488
500
  {
489
501
  lazyMount: !0,
490
502
  placement: "center",
491
- open: t,
492
- onOpenChange: (r) => n(r.open),
503
+ open: n,
504
+ onOpenChange: (i) => t(i.open),
493
505
  size: { mdDown: "full", md: "lg" },
494
506
  scrollBehavior: "inside",
495
- children: /* @__PURE__ */ s(W, { height: "100%", children: [
496
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Y, { children: "Gallery" }) }),
497
- /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
498
- O,
507
+ children: /* @__PURE__ */ s(G, { height: "100%", children: [
508
+ /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Q, { children: "Gallery" }) }),
509
+ /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ e(
510
+ B,
499
511
  {
500
512
  gridTemplateColumns: [
501
513
  "repeat(2, minmax(0, 1fr))",
@@ -505,38 +517,38 @@ const Xt = (t, n, o) => {
505
517
  gap: [2, 4],
506
518
  pt: 2,
507
519
  "data-grid": !0,
508
- children: i?.map((r) => /* @__PURE__ */ e(
509
- Jt,
520
+ children: r?.map((i) => /* @__PURE__ */ e(
521
+ rt,
510
522
  {
511
- item: r,
523
+ item: i,
512
524
  onNavigated: () => {
513
- n(!1);
525
+ t(!1);
514
526
  }
515
527
  },
516
- r.item.id
528
+ i.item.id
517
529
  ))
518
530
  }
519
531
  ) }),
520
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "outline", children: "Cancel" }) }) }),
521
- /* @__PURE__ */ e(H, {})
532
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(K, { asChild: !0, children: /* @__PURE__ */ e(V, { variant: "outline", children: "Cancel" }) }) }),
533
+ /* @__PURE__ */ e(j, {})
522
534
  ] })
523
535
  }
524
536
  );
525
537
  }
526
- ), tn = "@prose-reader/react-reader", nn = "1.248.0", on = m(
527
- ({ open: t, setOpen: n }) => /* @__PURE__ */ e(
528
- N,
538
+ ), at = "@prose-reader/react-reader", st = "1.250.0", lt = f(
539
+ ({ open: n, setOpen: t }) => /* @__PURE__ */ e(
540
+ q,
529
541
  {
530
542
  lazyMount: !0,
531
543
  placement: "center",
532
- open: t,
533
- onOpenChange: (o) => n(o.open),
544
+ open: n,
545
+ onOpenChange: (o) => t(o.open),
534
546
  size: { mdDown: "full", md: "lg" },
535
547
  scrollBehavior: "inside",
536
- children: /* @__PURE__ */ s(W, { children: [
537
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Y, { children: "Help" }) }),
548
+ children: /* @__PURE__ */ s(G, { children: [
549
+ /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Q, { children: "Help" }) }),
538
550
  /* @__PURE__ */ s(
539
- G,
551
+ Z,
540
552
  {
541
553
  overflowY: "auto",
542
554
  flex: 1,
@@ -545,192 +557,170 @@ const Xt = (t, n, o) => {
545
557
  gap: 4,
546
558
  children: [
547
559
  /* @__PURE__ */ s(C, { children: [
548
- /* @__PURE__ */ e(he, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
549
- /* @__PURE__ */ s(A, { mb: 1, children: [
550
- /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ e(st, {}) }),
560
+ /* @__PURE__ */ e(ge, { mb: 2, as: "h3", size: "lg", children: "Shortcuts" }),
561
+ /* @__PURE__ */ s(O, { mb: 1, children: [
562
+ /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ e(un, {}) }),
551
563
  " ",
552
564
  /* @__PURE__ */ e(p, { children: "Navigate to right page" })
553
565
  ] }),
554
- /* @__PURE__ */ s(A, { mb: 1, children: [
555
- /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ e(lt, {}) }),
566
+ /* @__PURE__ */ s(O, { mb: 1, children: [
567
+ /* @__PURE__ */ e(Te, { children: /* @__PURE__ */ e(hn, {}) }),
556
568
  " ",
557
569
  /* @__PURE__ */ e(p, { children: "Navigate to left page" })
558
570
  ] })
559
571
  ] }),
560
572
  /* @__PURE__ */ s(C, { children: [
561
- /* @__PURE__ */ e(he, { mb: 2, as: "h3", size: "lg", children: "Bookmarks" }),
562
- /* @__PURE__ */ e(A, { mb: 1, children: /* @__PURE__ */ e(p, { children: "Tap on the top right corner of a page bookmark it" }) })
573
+ /* @__PURE__ */ e(ge, { mb: 2, as: "h3", size: "lg", children: "Bookmarks" }),
574
+ /* @__PURE__ */ e(O, { mb: 1, children: /* @__PURE__ */ e(p, { children: "Tap on the top right corner of a page bookmark it" }) })
563
575
  ] }),
564
576
  /* @__PURE__ */ s(C, { children: [
565
- /* @__PURE__ */ e(he, { mb: 2, as: "h3", size: "lg", children: "About" }),
577
+ /* @__PURE__ */ e(ge, { mb: 2, as: "h3", size: "lg", children: "About" }),
566
578
  /* @__PURE__ */ s(p, { children: [
567
- tn,
579
+ at,
568
580
  " version: ",
569
- nn
581
+ st
570
582
  ] })
571
583
  ] })
572
584
  ]
573
585
  }
574
586
  ),
575
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "outline", children: "Cancel" }) }) }),
576
- /* @__PURE__ */ e(H, {})
587
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(K, { asChild: !0, children: /* @__PURE__ */ e(V, { variant: "outline", children: "Cancel" }) }) }),
588
+ /* @__PURE__ */ e(j, {})
577
589
  ] })
578
590
  }
579
591
  )
580
- ), q = () => {
581
- const t = f();
592
+ ), X = () => {
593
+ const n = m();
582
594
  return b(
583
- () => t ? Ze([t.pagination.state$, t.context]).pipe(
584
- B(([n, o]) => {
585
- const i = o.manifest?.spineItems.every(
586
- (r) => r.mediaType?.startsWith("image/")
595
+ () => n ? Xe([n.pagination.state$, n.context]).pipe(
596
+ _(([t, o]) => {
597
+ const r = o.manifest?.spineItems.every(
598
+ (i) => i.mediaType?.startsWith("image/")
587
599
  );
588
600
  return {
589
- ...n,
590
- hasChapters: !o.isFullyPrePaginated && !i
601
+ ...t,
602
+ hasChapters: !o.isFullyPrePaginated && !r
591
603
  };
592
604
  })
593
- ) : de,
594
- [t]
605
+ ) : ve,
606
+ [n]
595
607
  );
596
- }, rn = () => {
597
- const t = q(), n = Math.floor(
598
- (t?.percentageEstimateOfBook ?? 0) * 100
599
- ), o = n > 0 ? n : 1;
600
- return t?.percentageEstimateOfBook === void 0 ? null : /* @__PURE__ */ e(O, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ s(p, { fontSize: "sm", children: [
608
+ }, ct = () => {
609
+ const n = X(), t = Math.floor(
610
+ (n?.percentageEstimateOfBook ?? 0) * 100
611
+ ), o = t > 0 ? t : 1;
612
+ return n?.percentageEstimateOfBook === void 0 ? null : /* @__PURE__ */ e(B, { position: "absolute", right: 0, bottom: 0, p: 2, color: "black", children: /* @__PURE__ */ s(p, { fontSize: "sm", children: [
601
613
  o,
602
614
  " %"
603
615
  ] }) });
604
- }, an = () => {
605
- const [t, n] = R(/* @__PURE__ */ new Date());
606
- return ne(() => {
616
+ }, dt = () => {
617
+ const [n, t] = y(/* @__PURE__ */ new Date());
618
+ return H(() => {
607
619
  const o = setInterval(() => {
608
- n(/* @__PURE__ */ new Date());
620
+ t(/* @__PURE__ */ new Date());
609
621
  }, 6e4);
610
622
  return () => clearInterval(o);
611
- }, []), t;
612
- }, sn = (t) => {
613
- const n = an();
614
- return /* @__PURE__ */ e(p, { fontSize: "xs", ...t, children: n.toLocaleTimeString(navigator.language, {
623
+ }, []), n;
624
+ }, ut = (n) => {
625
+ const t = dt();
626
+ return /* @__PURE__ */ e(p, { fontSize: "xs", ...n, children: t.toLocaleTimeString(navigator.language, {
615
627
  hour: "2-digit",
616
628
  minute: "2-digit"
617
629
  }) });
618
630
  }, Ie = () => {
619
- const { quickMenuSignal: t } = E();
620
- return [be(t), t.update, t];
621
- }, ln = () => {
622
- const [t] = Ie();
631
+ const { quickMenuSignal: n } = E();
632
+ return [ue(n), n.update, n];
633
+ }, ht = () => {
634
+ const [n] = Ie();
623
635
  return /* @__PURE__ */ e(
624
- O,
636
+ B,
625
637
  {
626
638
  position: "absolute",
627
639
  left: 0,
628
640
  bottom: 0,
629
641
  p: 2,
630
- color: t ? void 0 : "colorPalette.contrast",
631
- children: /* @__PURE__ */ e(sn, {})
642
+ color: n ? void 0 : "colorPalette.contrast",
643
+ children: /* @__PURE__ */ e(ut, {})
632
644
  }
633
645
  );
634
- }, cn = () => {
635
- const t = f();
636
- D(
637
- () => t?.links$.subscribe((n) => {
638
- if (n.type === "click" && xt(n.target, "a")) {
639
- if (!n.target.href) return;
640
- const o = new URL(n.target.href);
646
+ }, gt = () => {
647
+ const n = m();
648
+ N(
649
+ () => n?.links$.subscribe((t) => {
650
+ if (t.type === "click" && Rn(t.target, "a")) {
651
+ if (!t.target.href) return;
652
+ const o = new URL(t.target.href);
641
653
  window.location.host !== o.host && confirm(
642
654
  "You are going to be redirected to external link"
643
- ) && window.open(n.target.href, "__blank");
655
+ ) && window.open(t.target.href, "__blank");
644
656
  }
645
657
  }),
646
- [t]
647
- );
648
- }, dn = () => {
649
- const t = f(), { notificationsSubject: n } = E();
650
- D(
651
- () => t?.zoom.state$.pipe(
652
- vt(["isZooming", "currentScale"]),
653
- z(({ isZooming: o, currentScale: i }) => {
654
- if (!o || i < 1) return fe;
655
- const r = new xe();
656
- return n.next({
657
- key: "zoom",
658
- title: "Zooming",
659
- duration: 999999,
660
- abort: r
661
- }), de.pipe(
662
- Ee(() => {
663
- r.next(), r.complete();
664
- })
665
- );
666
- })
667
- ),
668
- [t]
658
+ [n]
669
659
  );
670
- }, un = () => {
671
- const t = f(), { notificationsSubject: n } = E();
672
- D(
673
- () => t?.settings.values$.pipe(
674
- B(({ fontScale: o }) => o),
660
+ }, pt = () => {
661
+ const n = m(), { notificationsSubject: t } = E();
662
+ N(
663
+ () => n?.settings.values$.pipe(
664
+ _(({ fontScale: o }) => o),
675
665
  Ce(),
676
- Me(1),
677
- ve((o) => {
678
- n.next({
666
+ Oe(1),
667
+ xe((o) => {
668
+ t.next({
679
669
  key: "fontScaleChange",
680
670
  title: "Font size changed",
681
671
  description: `${o * 100} %`
682
672
  });
683
673
  })
684
674
  ),
685
- [t, n]
675
+ [n, t]
686
676
  );
687
- }, hn = () => {
688
- const { notificationsSubject: t } = E();
689
- un(), dn(), D(
690
- () => t.pipe(
691
- ie(Ae),
692
- Ke((n) => {
693
- const o = n.duration ?? 3e3, i = me.create({
694
- title: n.title,
695
- description: n.description,
677
+ }, ft = () => {
678
+ const { notificationsSubject: n } = E();
679
+ pt(), N(
680
+ () => n.pipe(
681
+ le(Be),
682
+ Je((t) => {
683
+ const o = t.duration ?? 3e3, r = me.create({
684
+ title: t.title,
685
+ description: t.description,
696
686
  duration: o
697
- }), r = t.pipe(
698
- Me(1),
699
- ie((a) => !!n.key && a?.key === n.key)
687
+ }), i = n.pipe(
688
+ Oe(1),
689
+ le((a) => !!t.key && a?.key === t.key)
700
690
  );
701
- return ze(
702
- De(o),
703
- n.abort ?? de,
704
- r
691
+ return Me(
692
+ Ee(o),
693
+ t.abort ?? ve,
694
+ i
705
695
  ).pipe(
706
- Oe(),
707
- Ee(() => {
708
- me.dismiss(i);
696
+ ze(),
697
+ en(() => {
698
+ me.dismiss(r);
709
699
  })
710
700
  );
711
701
  })
712
702
  ),
713
- [t]
703
+ [n]
714
704
  );
715
- }, gn = y.forwardRef(
716
- function(n, o) {
705
+ }, mt = T.forwardRef(
706
+ function(t, o) {
717
707
  const {
718
- showArrow: i,
719
- children: r,
708
+ showArrow: r,
709
+ children: i,
720
710
  portalled: a = !0,
721
711
  content: l,
722
712
  portalRef: c,
723
713
  ...d
724
- } = n;
714
+ } = t;
725
715
  return /* @__PURE__ */ s(
726
- $.Root,
716
+ F.Root,
727
717
  {
728
718
  ...d,
729
719
  positioning: { ...d.positioning, gutter: 4 },
730
720
  children: [
731
- /* @__PURE__ */ e($.Trigger, { asChild: !0, children: r }),
732
- /* @__PURE__ */ e(ke, { disabled: !a, container: c, children: /* @__PURE__ */ e($.Positioner, { children: /* @__PURE__ */ s(
733
- $.Content,
721
+ /* @__PURE__ */ e(F.Trigger, { asChild: !0, children: i }),
722
+ /* @__PURE__ */ e(ke, { disabled: !a, container: c, children: /* @__PURE__ */ e(F.Positioner, { children: /* @__PURE__ */ s(
723
+ F.Content,
734
724
  {
735
725
  width: "auto",
736
726
  px: "2",
@@ -739,7 +729,7 @@ const Xt = (t, n, o) => {
739
729
  rounded: "sm",
740
730
  ref: o,
741
731
  children: [
742
- i && /* @__PURE__ */ e($.Arrow, { children: /* @__PURE__ */ e($.ArrowTip, {}) }),
732
+ r && /* @__PURE__ */ e(F.Arrow, { children: /* @__PURE__ */ e(F.ArrowTip, {}) }),
743
733
  l
744
734
  ]
745
735
  }
@@ -748,84 +738,84 @@ const Xt = (t, n, o) => {
748
738
  }
749
739
  );
750
740
  }
751
- ), pn = y.forwardRef(function(n, o) {
752
- const { children: i, ...r } = n;
753
- return /* @__PURE__ */ e(gn, { content: i, ...r, ref: o, children: /* @__PURE__ */ e(
754
- x,
741
+ ), bt = T.forwardRef(function(t, o) {
742
+ const { children: r, ...i } = t;
743
+ return /* @__PURE__ */ e(mt, { content: r, ...i, ref: o, children: /* @__PURE__ */ e(
744
+ v,
755
745
  {
756
746
  variant: "ghost",
757
747
  "aria-label": "info",
758
748
  size: "2xs",
759
749
  colorPalette: "gray",
760
- children: /* @__PURE__ */ e(At, {})
750
+ children: /* @__PURE__ */ e(En, {})
761
751
  }
762
752
  ) });
763
- }), fn = y.forwardRef(function(n, o) {
764
- return /* @__PURE__ */ e(ee.Track, { ...n, ref: o, children: /* @__PURE__ */ e(ee.Range, {}) });
753
+ }), xt = T.forwardRef(function(t, o) {
754
+ return /* @__PURE__ */ e(re.Track, { ...t, ref: o, children: /* @__PURE__ */ e(re.Range, {}) });
765
755
  });
766
- y.forwardRef(function(n, o) {
767
- const { children: i, info: r, ...a } = n;
768
- return /* @__PURE__ */ s(ee.Label, { ...a, ref: o, children: [
769
- i,
770
- r && /* @__PURE__ */ e(pn, { children: r })
756
+ T.forwardRef(function(t, o) {
757
+ const { children: r, info: i, ...a } = t;
758
+ return /* @__PURE__ */ s(re.Label, { ...a, ref: o, children: [
759
+ r,
760
+ i && /* @__PURE__ */ e(bt, { children: i })
771
761
  ] });
772
762
  });
773
- const mn = ee.Root, bn = ee.ValueText, Re = () => {
774
- const t = q(), n = t?.numberOfTotalPages === 1, o = (t?.beginNumberOfPagesInSpineItem ?? 0) > 1, i = (t?.endNumberOfPagesInSpineItem ?? 0) > 1, r = (t?.hasChapters ? t?.beginPageIndexInSpineItem : t?.beginAbsolutePageIndex) ?? 0, a = (t?.hasChapters ? t?.endPageIndexInSpineItem : t?.endAbsolutePageIndex) ?? 0, [l = 0, c = 0] = [
775
- r,
763
+ const vt = re.Root, Ct = re.ValueText, Re = () => {
764
+ const n = X(), t = n?.numberOfTotalPages === 1, o = (n?.beginNumberOfPagesInSpineItem ?? 0) > 1, r = (n?.endNumberOfPagesInSpineItem ?? 0) > 1, i = (n?.hasChapters ? n?.beginPageIndexInSpineItem : n?.beginAbsolutePageIndex) ?? 0, a = (n?.hasChapters ? n?.endPageIndexInSpineItem : n?.endAbsolutePageIndex) ?? 0, [l = 0, c = 0] = [
765
+ i,
776
766
  a
777
- ].sort((g, h) => g - h), d = t?.beginPageIndexInSpineItem !== t?.endPageIndexInSpineItem || t?.beginSpineItemIndex !== t?.endSpineItemIndex, u = t?.hasChapters ? t?.beginNumberOfPagesInSpineItem : t?.numberOfTotalPages;
767
+ ].sort((g, h) => g - h), d = n?.beginPageIndexInSpineItem !== n?.endPageIndexInSpineItem || n?.beginSpineItemIndex !== n?.endSpineItemIndex, u = n?.hasChapters ? n?.beginNumberOfPagesInSpineItem : n?.numberOfTotalPages;
778
768
  return {
779
- hasOnlyOnePage: n,
780
- beginPageIndex: r,
769
+ hasOnlyOnePage: t,
770
+ beginPageIndex: i,
781
771
  endPageIndex: a,
782
772
  isBeginWithinChapter: o,
783
- isEndWithinChapter: i,
773
+ isEndWithinChapter: r,
784
774
  beginAndEndAreDifferent: d,
785
775
  totalApproximatePages: u,
786
776
  leftPageIndex: l,
787
777
  rightPageIndex: c
788
778
  };
789
- }, xn = () => {
790
- const t = q(), {
791
- hasOnlyOnePage: n,
779
+ }, kt = () => {
780
+ const n = X(), {
781
+ hasOnlyOnePage: t,
792
782
  leftPageIndex: o,
793
- rightPageIndex: i,
794
- totalApproximatePages: r,
783
+ rightPageIndex: r,
784
+ totalApproximatePages: i,
795
785
  beginAndEndAreDifferent: a
796
- } = Re(), l = Math.round((t?.percentageEstimateOfBook ?? 0) * 100), c = (u) => u?.subChapter ? `${u.title} / ${c(u.subChapter)}` : u?.title || "", d = c(t?.beginChapterInfo);
786
+ } = Re(), l = Math.round((n?.percentageEstimateOfBook ?? 0) * 100), c = (u) => u?.subChapter ? `${u.title} / ${c(u.subChapter)}` : u?.title || "", d = c(n?.beginChapterInfo);
797
787
  return /* @__PURE__ */ s(C, { alignItems: "center", gap: 1, maxW: "100%", overflow: "auto", children: [
798
- /* @__PURE__ */ e(mn, { value: l, size: "xs", width: 150, children: /* @__PURE__ */ s(A, { justifyContent: "space-between", children: [
799
- /* @__PURE__ */ e(fn, { width: 110 }),
800
- /* @__PURE__ */ e(bn, { children: `${l}%` })
788
+ /* @__PURE__ */ e(vt, { value: l, size: "xs", width: 150, children: /* @__PURE__ */ s(O, { justifyContent: "space-between", children: [
789
+ /* @__PURE__ */ e(xt, { width: 110 }),
790
+ /* @__PURE__ */ e(Ct, { children: `${l}%` })
801
791
  ] }) }),
802
792
  /* @__PURE__ */ e(p, { truncate: !0, maxWidth: "100%", fontSize: "sm", mt: 1, children: d ? `Chapter: ${d}` : " " }),
803
- !n && /* @__PURE__ */ s(A, { children: [
804
- /* @__PURE__ */ e(p, { fontSize: "xs", children: a ? `${o + 1} - ${i + 1} of ${r}` : `${o + 1} of ${r}` }),
805
- !!t?.hasChapters && /* @__PURE__ */ s(ce, { children: [
793
+ !t && /* @__PURE__ */ s(O, { children: [
794
+ /* @__PURE__ */ e(p, { fontSize: "xs", children: a ? `${o + 1} - ${r + 1} of ${i}` : `${o + 1} of ${i}` }),
795
+ !!n?.hasChapters && /* @__PURE__ */ s(be, { children: [
806
796
  /* @__PURE__ */ e(p, { children: "-" }),
807
797
  /* @__PURE__ */ s(p, { fontSize: "xs", children: [
808
798
  "(",
809
- (t?.beginAbsolutePageIndex ?? 0) + 1,
799
+ (n?.beginAbsolutePageIndex ?? 0) + 1,
810
800
  ")"
811
801
  ] })
812
802
  ] })
813
803
  ] })
814
804
  ] });
815
- }, We = m(
805
+ }, We = f(
816
806
  ({
817
- children: t,
818
- position: n,
807
+ children: n,
808
+ position: t,
819
809
  ...o
820
810
  }) => /* @__PURE__ */ e(
821
- se,
811
+ oe,
822
812
  {
823
813
  display: "flex",
824
814
  flexDirection: "row",
825
815
  width: "100%",
826
816
  position: "absolute",
827
- ...n === "bottom" ? { bottom: 0 } : { top: 0 },
828
- animationName: n === "bottom" ? {
817
+ ...t === "bottom" ? { bottom: 0 } : { top: 0 },
818
+ animationName: t === "bottom" ? {
829
819
  _open: "slide-from-bottom, fade-in",
830
820
  _closed: "slide-to-bottom, fade-out"
831
821
  } : {
@@ -839,11 +829,11 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
839
829
  shadow: "md",
840
830
  p: 4,
841
831
  ...o,
842
- children: t
832
+ children: n
843
833
  }
844
834
  )
845
- ), vn = nt(Ot), Cn = m((t) => /* @__PURE__ */ e(
846
- O,
835
+ ), St = an(Dn), It = f((n) => /* @__PURE__ */ e(
836
+ B,
847
837
  {
848
838
  display: "contents",
849
839
  css: {
@@ -852,7 +842,7 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
852
842
  "--color-solid": "colors.colorPalette.solid"
853
843
  },
854
844
  children: /* @__PURE__ */ e(
855
- vn,
845
+ St,
856
846
  {
857
847
  keyboard: !1,
858
848
  style: {
@@ -887,86 +877,96 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
887
877
  height: "24px",
888
878
  top: "50%",
889
879
  borderColor: "var(--color-solid)",
890
- transform: `translate(${t.reverse ? "50%" : "-50%"}, -50%)`,
880
+ transform: `translate(${n.reverse ? "50%" : "-50%"}, -50%)`,
891
881
  backgroundColor: "var(--bg)",
892
882
  marginTop: "0px"
893
883
  }
894
884
  },
895
- ...t
885
+ ...n
896
886
  }
897
887
  )
898
888
  }
899
- )), kn = () => {
900
- const n = q()?.isUsingSpread, { beginPageIndex: o, totalApproximatePages: i = 0 } = Re(), r = n ? Math.floor((o || 0) / 2) : o, [a, l] = Ye(
901
- () => J({
902
- default: r || 0
889
+ )), Rt = () => {
890
+ const t = X()?.isUsingSpread, { beginPageIndex: o, totalApproximatePages: r = 0 } = Re(), i = t ? Math.floor((o || 0) / 2) : o, [a, l] = Ue(
891
+ () => L({
892
+ default: i || 0
903
893
  })
904
894
  ), c = 0, d = Math.max(
905
895
  0,
906
- n ? Math.floor((i - 1) / 2) : i - 1
896
+ t ? Math.floor((r - 1) / 2) : r - 1
907
897
  );
908
- return ne(() => {
909
- l.update(r || 0);
910
- }, [r, l]), {
898
+ return H(() => {
899
+ l.update(i || 0);
900
+ }, [i, l]), {
911
901
  value: a,
912
902
  valueSignal: l,
913
903
  min: c,
914
904
  max: d
915
905
  };
916
- }, Sn = (t) => {
917
- const n = f(), o = q(), { manifest: i } = b(() => n?.context, [n]) ?? {}, r = i?.readingDirection === "rtl", a = o?.isUsingSpread, { totalApproximatePages: l = 0, isBeginWithinChapter: c } = Re(), d = 1, u = c, { value: g, valueSignal: h, min: v, max: T } = kn(), P = X(
918
- (Q) => {
919
- const [k = 0] = Array.isArray(Q) ? Q : [Q];
920
- h.update(k);
921
- const ye = a ? Math.floor(k) * 2 : Math.floor(k);
922
- u ? n?.navigation.goToPageOfSpineItem({
923
- pageIndex: ye,
924
- spineItemId: n.pagination.state.beginSpineItemIndex ?? 0,
906
+ }, yt = (n) => {
907
+ const t = m(), o = X(), { manifest: r } = b(() => t?.context, [t]) ?? {}, i = r?.readingDirection === "rtl", a = o?.isUsingSpread, { totalApproximatePages: l = 0, isBeginWithinChapter: c } = Re(), d = 1, u = c, { value: g, valueSignal: h, min: x, max: S } = Rt(), I = te(
908
+ (M) => {
909
+ const [A = 0] = Array.isArray(M) ? M : [M];
910
+ h.update(A);
911
+ const ae = a ? Math.floor(A) * 2 : Math.floor(A);
912
+ u ? t?.navigation.goToPageOfSpineItem({
913
+ pageIndex: ae,
914
+ spineItemId: t.pagination.state.beginSpineItemIndex ?? 0,
925
915
  animation: !1
926
- }) : n?.navigation.goToAbsolutePageIndex({
927
- absolutePageIndex: ye,
916
+ }) : t?.navigation.goToAbsolutePageIndex({
917
+ absolutePageIndex: ae,
928
918
  animation: !1
929
919
  });
930
920
  },
931
- [n, a, h, u]
921
+ [t, a, h, u]
932
922
  );
933
- return D(
934
- () => n?.navigation.throttleLock({
923
+ return N(
924
+ () => t?.navigation.throttleLock({
935
925
  duration: 100,
936
926
  trigger: h.subject
937
927
  }),
938
- [n, h]
939
- ), l === 1 || a && l === 2 ? /* @__PURE__ */ e(O, { style: t.style }) : /* @__PURE__ */ e(
940
- Cn,
928
+ [t, h]
929
+ ), l === 1 || a && l === 2 ? /* @__PURE__ */ e(B, { style: n.style }) : /* @__PURE__ */ e(
930
+ It,
941
931
  {
942
932
  value: [g],
943
- max: T,
944
- min: v,
945
- reverse: r,
933
+ max: S,
934
+ min: x,
935
+ reverse: i,
946
936
  step: d,
947
- onChange: P,
948
- ...t
937
+ onChange: I,
938
+ ...n
949
939
  }
950
940
  );
951
- }, In = m(
941
+ }, Tt = f(
952
942
  ({
953
- open: t,
954
- onItemClick: n
943
+ open: n,
944
+ onItemClick: t
955
945
  }) => {
956
- const o = f(), { refitMenuSignal: i } = E(), r = b(() => o?.navigation.state$, [o]), a = b(() => o?.settings.values$, [o]), l = b(() => o?.zoom.state$, [o]), c = a?.computedPageTurnMode === "scrollable", d = a?.computedPageTurnDirection === "vertical", [u, g] = R(!0);
957
- return /* @__PURE__ */ s(
946
+ const o = qe(null), r = m(), { refitMenuSignal: i, quickMenuBottomBarBoundingBox: a } = E(), l = b(() => r?.navigation.state$, [r]), c = b(() => r?.settings.values$, [r]), d = b(() => r?.zoom.state$, [r]), u = (d?.currentScale ?? 1) > 1, g = (d?.currentScale ?? 1) < 1, h = c?.computedPageTurnMode === "scrollable", x = c?.computedPageTurnDirection === "vertical", [S, I] = y(!0);
947
+ return H(() => {
948
+ if (!o.current) return;
949
+ const w = new ResizeObserver((M) => {
950
+ for (const A of M)
951
+ a.next(A);
952
+ });
953
+ return w.observe(o.current), () => {
954
+ w.disconnect();
955
+ };
956
+ }, [a]), /* @__PURE__ */ s(
958
957
  We,
959
958
  {
960
- present: t,
959
+ present: n,
961
960
  position: "bottom",
962
961
  display: "flex",
963
962
  flexDirection: "column",
964
963
  overflow: "auto",
965
964
  pb: 8,
966
965
  px: 0,
966
+ ref: o,
967
967
  children: [
968
968
  /* @__PURE__ */ s(
969
- A,
969
+ O,
970
970
  {
971
971
  flex: 1,
972
972
  alignItems: "center",
@@ -975,15 +975,15 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
975
975
  px: 4,
976
976
  children: [
977
977
  /* @__PURE__ */ e(
978
- x,
978
+ v,
979
979
  {
980
980
  "aria-label": "left",
981
981
  size: "lg",
982
982
  variant: "ghost",
983
983
  flexShrink: 0,
984
- onClick: () => o?.navigation.goToLeftOrTopSpineItem(),
985
- disabled: !r?.canGoLeftSpineItem && !r?.canGoTopSpineItem,
986
- children: d ? /* @__PURE__ */ e(yt, {}) : /* @__PURE__ */ e(Tt, {})
984
+ onClick: () => r?.navigation.goToLeftOrTopSpineItem(),
985
+ disabled: !l?.canGoLeftSpineItem && !l?.canGoTopSpineItem,
986
+ children: x ? /* @__PURE__ */ e(An, {}) : /* @__PURE__ */ e(zn, {})
987
987
  }
988
988
  ),
989
989
  /* @__PURE__ */ s(
@@ -996,9 +996,9 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
996
996
  overflow: "auto",
997
997
  px: 4,
998
998
  children: [
999
- /* @__PURE__ */ e(xn, {}),
999
+ /* @__PURE__ */ e(kt, {}),
1000
1000
  /* @__PURE__ */ e(
1001
- Sn,
1001
+ yt,
1002
1002
  {
1003
1003
  style: {
1004
1004
  width: "100%",
@@ -1011,102 +1011,118 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
1011
1011
  }
1012
1012
  ),
1013
1013
  /* @__PURE__ */ e(
1014
- x,
1014
+ v,
1015
1015
  {
1016
1016
  "aria-label": "right",
1017
1017
  size: "lg",
1018
1018
  flexShrink: 0,
1019
1019
  variant: "ghost",
1020
- disabled: !r?.canGoRightSpineItem && !r?.canGoBottomSpineItem,
1020
+ disabled: !l?.canGoRightSpineItem && !l?.canGoBottomSpineItem,
1021
1021
  onClick: () => {
1022
- o?.navigation.goToRightOrBottomSpineItem();
1022
+ r?.navigation.goToRightOrBottomSpineItem();
1023
1023
  },
1024
- children: d ? /* @__PURE__ */ e(wt, {}) : /* @__PURE__ */ e(Pt, {})
1024
+ children: x ? /* @__PURE__ */ e(On, {}) : /* @__PURE__ */ e(Mn, {})
1025
1025
  }
1026
1026
  )
1027
1027
  ]
1028
1028
  }
1029
1029
  ),
1030
- /* @__PURE__ */ e(A, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ s(
1031
- ge.Root,
1030
+ /* @__PURE__ */ e(O, { alignSelf: "stretch", alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ s(
1031
+ pe.Root,
1032
1032
  {
1033
- open: u,
1033
+ open: S,
1034
1034
  flex: 1,
1035
- onOpenChange: ({ open: h }) => {
1036
- g(h);
1035
+ onOpenChange: ({ open: w }) => {
1036
+ I(w);
1037
1037
  },
1038
1038
  width: "100%",
1039
1039
  children: [
1040
1040
  /* @__PURE__ */ e(
1041
- ge.Trigger,
1041
+ pe.Trigger,
1042
1042
  {
1043
1043
  paddingY: "3",
1044
1044
  width: "100%",
1045
1045
  display: "flex",
1046
1046
  justifyContent: "center",
1047
1047
  children: /* @__PURE__ */ e(
1048
- ct,
1048
+ gn,
1049
1049
  {
1050
1050
  style: {
1051
- transform: u ? "rotate(0deg)" : "rotate(180deg)"
1051
+ transform: S ? "rotate(0deg)" : "rotate(180deg)"
1052
1052
  }
1053
1053
  }
1054
1054
  )
1055
1055
  }
1056
1056
  ),
1057
- /* @__PURE__ */ e(ge.Content, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ s(O, { display: "flex", overflowX: "auto", px: 4, pb: 1, children: [
1057
+ /* @__PURE__ */ e(pe.Content, { display: "flex", justifyContent: "center", children: /* @__PURE__ */ s(B, { display: "flex", overflowX: "auto", px: 4, pb: 1, children: [
1058
1058
  /* @__PURE__ */ e(
1059
- x,
1059
+ v,
1060
1060
  {
1061
1061
  "aria-label": "Help",
1062
1062
  size: "lg",
1063
1063
  variant: "ghost",
1064
- onClick: () => n("help"),
1065
- children: /* @__PURE__ */ e(dt, {})
1064
+ onClick: () => t("help"),
1065
+ children: /* @__PURE__ */ e(pn, {})
1066
1066
  }
1067
1067
  ),
1068
1068
  /* @__PURE__ */ e(
1069
- x,
1069
+ v,
1070
1070
  {
1071
1071
  "aria-label": "Table of contents",
1072
1072
  size: "lg",
1073
1073
  variant: "ghost",
1074
- onClick: () => n("toc"),
1075
- children: /* @__PURE__ */ e(ut, {})
1074
+ onClick: () => t("toc"),
1075
+ children: /* @__PURE__ */ e(fn, {})
1076
1076
  }
1077
1077
  ),
1078
- Le(o) && /* @__PURE__ */ e(
1079
- x,
1078
+ Le(r) && /* @__PURE__ */ e(
1079
+ v,
1080
1080
  {
1081
1081
  "aria-label": "Search",
1082
1082
  size: "lg",
1083
1083
  variant: "ghost",
1084
- onClick: () => n("search"),
1085
- children: /* @__PURE__ */ e(ht, {})
1084
+ onClick: () => t("search"),
1085
+ children: /* @__PURE__ */ e(mn, {})
1086
+ }
1087
+ ),
1088
+ /* @__PURE__ */ e(
1089
+ v,
1090
+ {
1091
+ "aria-label": "Zoom",
1092
+ size: "lg",
1093
+ variant: u ? "solid" : "ghost",
1094
+ disabled: !h,
1095
+ onClick: () => {
1096
+ u ? r?.zoom.exit() : r?.zoom.enter({
1097
+ animate: !1,
1098
+ scale: 2
1099
+ });
1100
+ },
1101
+ children: u ? /* @__PURE__ */ e(bn, {}) : /* @__PURE__ */ e(xn, {})
1086
1102
  }
1087
1103
  ),
1088
- te(o) && /* @__PURE__ */ e(
1089
- x,
1104
+ ie(r) && /* @__PURE__ */ e(
1105
+ v,
1090
1106
  {
1091
1107
  "aria-label": "Bookmarks",
1092
1108
  size: "lg",
1093
1109
  variant: "ghost",
1094
- onClick: () => n("bookmarks"),
1095
- children: /* @__PURE__ */ e(Ct, {})
1110
+ onClick: () => t("bookmarks"),
1111
+ children: /* @__PURE__ */ e(yn, {})
1096
1112
  }
1097
1113
  ),
1098
- te(o) && /* @__PURE__ */ e(
1099
- x,
1114
+ ie(r) && /* @__PURE__ */ e(
1115
+ v,
1100
1116
  {
1101
1117
  "aria-label": "Annotations",
1102
1118
  size: "lg",
1103
1119
  variant: "ghost",
1104
- onClick: () => n("annotations"),
1105
- children: /* @__PURE__ */ e(le, {})
1120
+ onClick: () => t("annotations"),
1121
+ children: /* @__PURE__ */ e(de, {})
1106
1122
  }
1107
1123
  ),
1108
- $e(o) && /* @__PURE__ */ e(
1109
- x,
1124
+ $e(r) && /* @__PURE__ */ e(
1125
+ v,
1110
1126
  {
1111
1127
  "aria-label": "Refit",
1112
1128
  size: "lg",
@@ -1114,33 +1130,33 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
1114
1130
  onClick: () => {
1115
1131
  i.next(!0);
1116
1132
  },
1117
- disabled: !c,
1118
- children: /* @__PURE__ */ e(kt, {})
1133
+ disabled: !h,
1134
+ children: /* @__PURE__ */ e(Tn, {})
1119
1135
  }
1120
1136
  ),
1121
1137
  /* @__PURE__ */ e(
1122
- x,
1138
+ v,
1123
1139
  {
1124
1140
  "aria-label": "Thumbnails",
1125
1141
  size: "lg",
1126
- variant: l?.isZooming && l.currentScale < 1 ? "solid" : "ghost",
1142
+ variant: g ? "solid" : "ghost",
1127
1143
  onClick: () => {
1128
- l?.isZooming ? o?.zoom.exit() : o?.zoom.enter({
1144
+ g ? r?.zoom.exit() : r?.zoom.enter({
1129
1145
  animate: !0,
1130
1146
  scale: 0.5
1131
1147
  });
1132
1148
  },
1133
- children: /* @__PURE__ */ e(gt, {})
1149
+ children: /* @__PURE__ */ e(vn, {})
1134
1150
  }
1135
1151
  ),
1136
- _e(o) && /* @__PURE__ */ e(
1137
- x,
1152
+ _e(r) && /* @__PURE__ */ e(
1153
+ v,
1138
1154
  {
1139
1155
  "aria-label": "Gallery",
1140
1156
  size: "lg",
1141
1157
  variant: "ghost",
1142
- onClick: () => n("gallery"),
1143
- children: /* @__PURE__ */ e(Rt, {})
1158
+ onClick: () => t("gallery"),
1159
+ children: /* @__PURE__ */ e(Bn, {})
1144
1160
  }
1145
1161
  )
1146
1162
  ] }) })
@@ -1151,46 +1167,46 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
1151
1167
  }
1152
1168
  );
1153
1169
  }
1154
- ), Rn = () => {
1155
- const [t, n] = R(!1), o = X(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1156
- n(!1);
1170
+ ), wt = () => {
1171
+ const [n, t] = y(!1), o = te(() => document.fullscreenElement ? document.exitFullscreen().catch(console.error).then(() => {
1172
+ t(!1);
1157
1173
  }) : document.documentElement.requestFullscreen({ navigationUI: "hide" }).catch(console.error).then(() => {
1158
- n(!0);
1174
+ t(!0);
1159
1175
  }), []);
1160
- return ne(() => {
1161
- function i() {
1162
- n(!!document.fullscreenElement);
1176
+ return H(() => {
1177
+ function r() {
1178
+ t(!!document.fullscreenElement);
1163
1179
  }
1164
- return document.addEventListener("fullscreenchange", i), () => {
1165
- document.removeEventListener("fullscreenchange", i);
1180
+ return document.addEventListener("fullscreenchange", r), () => {
1181
+ document.removeEventListener("fullscreenchange", r);
1166
1182
  };
1167
1183
  }, []), {
1168
- isFullscreen: t,
1184
+ isFullscreen: n,
1169
1185
  onToggleFullscreenClick: o
1170
1186
  };
1171
- }, yn = m(
1187
+ }, Pt = f(
1172
1188
  ({
1173
- open: t,
1174
- onItemClick: n
1189
+ open: n,
1190
+ onItemClick: t
1175
1191
  }) => {
1176
- const o = f(), i = b(() => o?.context.manifest$, [o]), { isFullscreen: r, onToggleFullscreenClick: a } = Rn();
1192
+ const o = m(), r = b(() => o?.context.manifest$, [o]), { isFullscreen: i, onToggleFullscreenClick: a } = wt();
1177
1193
  return /* @__PURE__ */ s(
1178
1194
  We,
1179
1195
  {
1180
- present: t,
1196
+ present: n,
1181
1197
  position: "top",
1182
1198
  height: "80px",
1183
1199
  justifyContent: "space-between",
1184
1200
  children: [
1185
1201
  /* @__PURE__ */ e(
1186
- x,
1202
+ v,
1187
1203
  {
1188
1204
  "aria-label": "left",
1189
1205
  size: "lg",
1190
1206
  variant: "ghost",
1191
1207
  flexShrink: 0,
1192
- onClick: () => n("back"),
1193
- children: /* @__PURE__ */ e(Et, {})
1208
+ onClick: () => t("back"),
1209
+ children: /* @__PURE__ */ e(Ln, {})
1194
1210
  }
1195
1211
  ),
1196
1212
  /* @__PURE__ */ e(
@@ -1202,30 +1218,30 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
1202
1218
  alignItems: "center",
1203
1219
  overflow: "auto",
1204
1220
  px: 4,
1205
- children: /* @__PURE__ */ e(p, { truncate: !0, maxWidth: "100%", children: i?.title })
1221
+ children: /* @__PURE__ */ e(p, { truncate: !0, maxWidth: "100%", children: r?.title })
1206
1222
  }
1207
1223
  ),
1208
- /* @__PURE__ */ s(A, { children: [
1224
+ /* @__PURE__ */ s(O, { children: [
1209
1225
  /* @__PURE__ */ e(
1210
- x,
1226
+ v,
1211
1227
  {
1212
1228
  "aria-label": "right",
1213
1229
  size: "lg",
1214
1230
  flexShrink: 0,
1215
1231
  variant: "ghost",
1216
- onClick: () => n("more"),
1217
- children: /* @__PURE__ */ e(Mt, {})
1232
+ onClick: () => t("more"),
1233
+ children: /* @__PURE__ */ e(_n, {})
1218
1234
  }
1219
1235
  ),
1220
1236
  /* @__PURE__ */ e(
1221
- x,
1237
+ v,
1222
1238
  {
1223
1239
  "aria-label": "right",
1224
1240
  size: "lg",
1225
1241
  flexShrink: 0,
1226
1242
  variant: "ghost",
1227
1243
  onClick: a,
1228
- children: r ? /* @__PURE__ */ e(St, {}) : /* @__PURE__ */ e(It, {})
1244
+ children: i ? /* @__PURE__ */ e(wn, {}) : /* @__PURE__ */ e(Pn, {})
1229
1245
  }
1230
1246
  )
1231
1247
  ] })
@@ -1233,115 +1249,115 @@ const mn = ee.Root, bn = ee.ValueText, Re = () => {
1233
1249
  }
1234
1250
  );
1235
1251
  }
1236
- ), Tn = m(
1252
+ ), Bt = f(
1237
1253
  ({
1238
- onItemClick: t
1254
+ onItemClick: n
1239
1255
  }) => {
1240
- const [n] = Ie(), { refitMenuSignal: o } = E(), i = be(o);
1241
- return /* @__PURE__ */ s(ce, { children: [
1242
- /* @__PURE__ */ e(yn, { open: n && !i, onItemClick: t }),
1256
+ const [t] = Ie(), { refitMenuSignal: o } = E(), r = ue(o);
1257
+ return /* @__PURE__ */ s(be, { children: [
1258
+ /* @__PURE__ */ e(Pt, { open: t && !r, onItemClick: n }),
1243
1259
  /* @__PURE__ */ e(
1244
- In,
1260
+ Tt,
1245
1261
  {
1246
- open: n && !i,
1247
- onItemClick: t
1262
+ open: t && !r,
1263
+ onItemClick: n
1248
1264
  }
1249
1265
  )
1250
1266
  ] });
1251
1267
  }
1252
- ), wn = y.forwardRef(
1253
- function(n, o) {
1254
- const { label: i, children: r, helperText: a, errorText: l, optionalText: c, ...d } = n;
1255
- return /* @__PURE__ */ s(Z.Root, { ref: o, ...d, children: [
1256
- i && /* @__PURE__ */ s(Z.Label, { children: [
1257
- i,
1258
- /* @__PURE__ */ e(Z.RequiredIndicator, { fallback: c })
1268
+ ), At = T.forwardRef(
1269
+ function(t, o) {
1270
+ const { label: r, children: i, helperText: a, errorText: l, optionalText: c, ...d } = t;
1271
+ return /* @__PURE__ */ s(J.Root, { ref: o, ...d, children: [
1272
+ r && /* @__PURE__ */ s(J.Label, { children: [
1273
+ r,
1274
+ /* @__PURE__ */ e(J.RequiredIndicator, { fallback: c })
1259
1275
  ] }),
1260
- r,
1261
- a && /* @__PURE__ */ e(Z.HelperText, { children: a }),
1262
- l && /* @__PURE__ */ e(Z.ErrorText, { children: l })
1276
+ i,
1277
+ a && /* @__PURE__ */ e(J.HelperText, { children: a }),
1278
+ l && /* @__PURE__ */ e(J.ErrorText, { children: l })
1263
1279
  ] });
1264
1280
  }
1265
- ), oe = y.forwardRef(
1266
- function(n, o) {
1267
- const { children: i, inputProps: r, rootRef: a, ...l } = n;
1268
- return /* @__PURE__ */ s(K.Item, { ref: a, ...l, children: [
1269
- /* @__PURE__ */ e(K.ItemHiddenInput, { ref: o, ...r }),
1270
- /* @__PURE__ */ e(K.ItemIndicator, {}),
1271
- i && /* @__PURE__ */ e(K.ItemText, { children: i })
1281
+ ), se = T.forwardRef(
1282
+ function(t, o) {
1283
+ const { children: r, inputProps: i, rootRef: a, ...l } = t;
1284
+ return /* @__PURE__ */ s(ne.Item, { ref: a, ...l, children: [
1285
+ /* @__PURE__ */ e(ne.ItemHiddenInput, { ref: o, ...i }),
1286
+ /* @__PURE__ */ e(ne.ItemIndicator, {}),
1287
+ r && /* @__PURE__ */ e(ne.ItemText, { children: r })
1272
1288
  ] });
1273
1289
  }
1274
- ), Pn = K.Root, An = y.forwardRef(
1275
- function(n, o) {
1276
- const { marks: i, label: r, showValue: a, ...l } = n, c = n.defaultValue ?? n.value, d = i?.map((g) => typeof g == "number" ? { value: g, label: void 0 } : g), u = !!d?.some((g) => g.label);
1277
- return /* @__PURE__ */ s(I.Root, { ref: o, thumbAlignment: "center", ...l, children: [
1278
- r && !a && /* @__PURE__ */ e(I.Label, { children: r }),
1279
- r && a && /* @__PURE__ */ s(A, { justify: "space-between", children: [
1280
- /* @__PURE__ */ e(I.Label, { children: r }),
1281
- /* @__PURE__ */ e(I.ValueText, {})
1290
+ ), zt = ne.Root, He = T.forwardRef(
1291
+ function(t, o) {
1292
+ const { marks: r, label: i, showValue: a, ...l } = t, c = t.defaultValue ?? t.value, d = r?.map((g) => typeof g == "number" ? { value: g, label: void 0 } : g), u = !!d?.some((g) => g.label);
1293
+ return /* @__PURE__ */ s(R.Root, { ref: o, thumbAlignment: "center", ...l, children: [
1294
+ i && !a && /* @__PURE__ */ e(R.Label, { children: i }),
1295
+ i && a && /* @__PURE__ */ s(O, { justify: "space-between", children: [
1296
+ /* @__PURE__ */ e(R.Label, { children: i }),
1297
+ /* @__PURE__ */ e(R.ValueText, {})
1282
1298
  ] }),
1283
- /* @__PURE__ */ s(I.Control, { "data-has-mark-label": u || void 0, children: [
1284
- /* @__PURE__ */ e(I.Track, { children: /* @__PURE__ */ e(I.Range, {}) }),
1285
- /* @__PURE__ */ e(On, { value: c }),
1286
- /* @__PURE__ */ e(En, { marks: d })
1299
+ /* @__PURE__ */ s(R.Control, { "data-has-mark-label": u || void 0, children: [
1300
+ /* @__PURE__ */ e(R.Track, { children: /* @__PURE__ */ e(R.Range, {}) }),
1301
+ /* @__PURE__ */ e(Ot, { value: c }),
1302
+ /* @__PURE__ */ e(Mt, { marks: d })
1287
1303
  ] })
1288
1304
  ] });
1289
1305
  }
1290
1306
  );
1291
- function On(t) {
1292
- const { value: n } = t;
1293
- return /* @__PURE__ */ e(ot, { each: n, children: (o, i) => /* @__PURE__ */ e(I.Thumb, { index: i, children: /* @__PURE__ */ e(I.HiddenInput, {}) }, i) });
1307
+ function Ot(n) {
1308
+ const { value: t } = n;
1309
+ return /* @__PURE__ */ e(sn, { each: t, children: (o, r) => /* @__PURE__ */ e(R.Thumb, { index: r, children: /* @__PURE__ */ e(R.HiddenInput, {}) }, r) });
1294
1310
  }
1295
- const En = y.forwardRef(
1296
- function(n, o) {
1297
- const { marks: i } = n;
1298
- return i?.length ? /* @__PURE__ */ e(I.MarkerGroup, { ref: o, children: i.map((r, a) => {
1299
- const l = typeof r == "number" ? r : r.value, c = typeof r == "number" ? void 0 : r.label;
1300
- return /* @__PURE__ */ s(I.Marker, { value: l, children: [
1301
- /* @__PURE__ */ e(I.MarkerIndicator, {}),
1311
+ const Mt = T.forwardRef(
1312
+ function(t, o) {
1313
+ const { marks: r } = t;
1314
+ return r?.length ? /* @__PURE__ */ e(R.MarkerGroup, { ref: o, children: r.map((i, a) => {
1315
+ const l = typeof i == "number" ? i : i.value, c = typeof i == "number" ? void 0 : i.label;
1316
+ return /* @__PURE__ */ s(R.Marker, { value: l, children: [
1317
+ /* @__PURE__ */ e(R.MarkerIndicator, {}),
1302
1318
  c
1303
1319
  ] }, a);
1304
1320
  }) }) : null;
1305
1321
  }
1306
- ), Mn = m(() => {
1307
- const { refitMenuSignal: n } = E(), o = be(n), i = f(), r = $e(i) ? i : void 0, a = b(
1308
- () => r?.refit.settings$,
1309
- [r]
1322
+ ), Et = f(() => {
1323
+ const { refitMenuSignal: t } = E(), o = ue(t), r = m(), i = $e(r) ? r : void 0, a = b(
1324
+ () => i?.refit.settings$,
1325
+ [i]
1310
1326
  );
1311
1327
  return /* @__PURE__ */ e(
1312
- N,
1328
+ q,
1313
1329
  {
1314
1330
  lazyMount: !0,
1315
1331
  open: o,
1316
- onOpenChange: (l) => n.next(l.open),
1332
+ onOpenChange: (l) => t.next(l.open),
1317
1333
  placement: "center",
1318
- children: /* @__PURE__ */ s(W, { children: [
1319
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Y, { children: "Viewport fit" }) }),
1320
- /* @__PURE__ */ e(G, { children: /* @__PURE__ */ s(pe.Root, { children: [
1321
- /* @__PURE__ */ e(pe.HelperText, { children: "Adjust the viewport for a more comfortable reading experience." }),
1322
- /* @__PURE__ */ s(pe.Content, { children: [
1323
- /* @__PURE__ */ e(wn, { label: "Profile", children: /* @__PURE__ */ e(
1324
- Pn,
1334
+ children: /* @__PURE__ */ s(G, { children: [
1335
+ /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Q, { children: "Viewport fit" }) }),
1336
+ /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ s(fe.Root, { children: [
1337
+ /* @__PURE__ */ e(fe.HelperText, { children: "Adjust the viewport for a more comfortable reading experience." }),
1338
+ /* @__PURE__ */ s(fe.Content, { children: [
1339
+ /* @__PURE__ */ e(At, { label: "Profile", children: /* @__PURE__ */ e(
1340
+ zt,
1325
1341
  {
1326
1342
  defaultValue: "fit",
1327
1343
  onValueChange: (l) => {
1328
1344
  const c = l.value;
1329
- r?.refit.update({
1345
+ i?.refit.update({
1330
1346
  viewportFit: c,
1331
1347
  customWidth: 60
1332
1348
  });
1333
1349
  },
1334
1350
  value: a?.viewportFit ?? "fit",
1335
1351
  children: /* @__PURE__ */ s(C, { gap: 2, children: [
1336
- /* @__PURE__ */ e(oe, { value: "desktop", children: "Desktop" }),
1337
- /* @__PURE__ */ e(oe, { value: "tablet", children: "Tablet" }),
1338
- /* @__PURE__ */ e(oe, { value: "fit", children: "Full width (default)" }),
1339
- /* @__PURE__ */ e(oe, { value: "custom", children: "Custom" })
1352
+ /* @__PURE__ */ e(se, { value: "desktop", children: "Desktop" }),
1353
+ /* @__PURE__ */ e(se, { value: "tablet", children: "Tablet" }),
1354
+ /* @__PURE__ */ e(se, { value: "fit", children: "Full width (default)" }),
1355
+ /* @__PURE__ */ e(se, { value: "custom", children: "Custom" })
1340
1356
  ] })
1341
1357
  }
1342
1358
  ) }),
1343
1359
  /* @__PURE__ */ e(
1344
- An,
1360
+ He,
1345
1361
  {
1346
1362
  label: "Maximum width (%)",
1347
1363
  showValue: !0,
@@ -1352,7 +1368,7 @@ const En = y.forwardRef(
1352
1368
  value: [a?.customWidth ?? 60],
1353
1369
  onValueChange: (l) => {
1354
1370
  const c = l.value[0] ?? 0;
1355
- r?.refit.update({
1371
+ i?.refit.update({
1356
1372
  customWidth: c
1357
1373
  });
1358
1374
  }
@@ -1360,37 +1376,37 @@ const En = y.forwardRef(
1360
1376
  )
1361
1377
  ] })
1362
1378
  ] }) }),
1363
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "outline", children: "Close" }) }) }),
1364
- /* @__PURE__ */ e(H, {})
1379
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(K, { asChild: !0, children: /* @__PURE__ */ e(V, { variant: "outline", children: "Close" }) }) }),
1380
+ /* @__PURE__ */ e(j, {})
1365
1381
  ] })
1366
1382
  }
1367
1383
  );
1368
- }), zn = m(
1384
+ }), Dt = f(
1369
1385
  ({
1370
- contextText: t = "",
1371
- startOffset: n = 0,
1386
+ contextText: n = "",
1387
+ startOffset: t = 0,
1372
1388
  text: o,
1373
- cfi: i = "#",
1374
- onClick: r,
1389
+ cfi: r = "#",
1390
+ onClick: i,
1375
1391
  absolutePageIndex: a
1376
1392
  }) => {
1377
- const c = t.substring(
1378
- Math.max(n - 15, 0),
1379
- Math.max(n, 0)
1380
- ), d = t.substring(
1381
- Math.min(n + o.length, t.length - 1),
1393
+ const c = n.substring(
1394
+ Math.max(t - 15, 0),
1395
+ Math.max(t, 0)
1396
+ ), d = n.substring(
1397
+ Math.min(t + o.length, n.length - 1),
1382
1398
  Math.min(
1383
- n + o.length + 15,
1384
- t.length - 1
1399
+ t + o.length + 15,
1400
+ n.length - 1
1385
1401
  )
1386
1402
  );
1387
1403
  return /* @__PURE__ */ s(
1388
1404
  Se,
1389
1405
  {
1390
- href: i,
1406
+ href: r,
1391
1407
  style: { margin: 5, overflow: "hidden" },
1392
1408
  onClick: (u) => {
1393
- u.preventDefault(), r(i);
1409
+ u.preventDefault(), i(r);
1394
1410
  },
1395
1411
  display: "flex",
1396
1412
  flexDirection: "column",
@@ -1409,44 +1425,44 @@ const En = y.forwardRef(
1409
1425
  }
1410
1426
  );
1411
1427
  }
1412
- ), Dn = 500, Bn = () => {
1413
- const t = re(() => new Xe("")), n = b(t), o = f(), i = Le(o) ? o : void 0, r = b(() => t.pipe(
1428
+ ), Lt = 500, _t = () => {
1429
+ const n = ee(() => new nn("")), t = b(n), o = m(), r = Le(o) ? o : void 0, i = b(() => n.pipe(
1414
1430
  Ce(),
1415
- z(
1416
- (a) => a === "" || !i ? ae(void 0) : ze(
1417
- ae({
1431
+ W(
1432
+ (a) => a === "" || !r ? ce(void 0) : Me(
1433
+ ce({
1418
1434
  type: "start",
1419
1435
  data: void 0
1420
1436
  }),
1421
- De(Dn).pipe(
1422
- z(() => i.search.search(a)),
1423
- B((l) => ({ type: "end", data: l }))
1437
+ Ee(Lt).pipe(
1438
+ W(() => r.search.search(a)),
1439
+ _((l) => ({ type: "end", data: l }))
1424
1440
  )
1425
1441
  )
1426
1442
  )
1427
- ), [i, t]);
1443
+ ), [r, n]);
1428
1444
  return {
1429
- value: n,
1430
- setValue: t.next.bind(t),
1431
- status: r?.type ?? "idle",
1432
- data: r?.data
1445
+ value: t,
1446
+ setValue: n.next.bind(n),
1447
+ status: i?.type ?? "idle",
1448
+ data: i?.data
1433
1449
  };
1434
- }, Ln = m(
1435
- ({ onNavigate: t }) => {
1436
- const n = f(), { value: o, setValue: i, status: r, data: a } = Bn(), l = (u) => {
1437
- i(u.target.value);
1438
- }, c = X(
1450
+ }, $t = f(
1451
+ ({ onNavigate: n }) => {
1452
+ const t = m(), { value: o, setValue: r, status: i, data: a } = _t(), l = (u) => {
1453
+ r(u.target.value);
1454
+ }, c = te(
1439
1455
  (u) => {
1440
- t(), n?.navigation.goToCfi(u);
1456
+ n(), t?.navigation.goToCfi(u);
1441
1457
  },
1442
- [n, t]
1458
+ [t, n]
1443
1459
  ), d = b(
1444
- () => n?.locateResource(a?.slice(0, 100) ?? []),
1460
+ () => t?.locateResource(a?.slice(0, 100) ?? []),
1445
1461
  [a]
1446
1462
  );
1447
1463
  return /* @__PURE__ */ s(C, { flex: 1, height: "100%", gap: 2, children: [
1448
1464
  /* @__PURE__ */ e(
1449
- rt,
1465
+ ln,
1450
1466
  {
1451
1467
  placeholder: "Type something...",
1452
1468
  value: o,
@@ -1468,15 +1484,15 @@ const En = y.forwardRef(
1468
1484
  px: 4,
1469
1485
  flex: 1,
1470
1486
  children: [
1471
- r === "start" && /* @__PURE__ */ e(p, { children: "Searching ..." }),
1487
+ i === "start" && /* @__PURE__ */ e(p, { children: "Searching ..." }),
1472
1488
  a?.length === 0 && /* @__PURE__ */ e(p, { children: "No results" }),
1473
- r === "end" && (a?.length ?? 0) > 0 && /* @__PURE__ */ s(C, { children: [
1489
+ i === "end" && (a?.length ?? 0) > 0 && /* @__PURE__ */ s(C, { children: [
1474
1490
  /* @__PURE__ */ s(p, { fontSize: "md", children: [
1475
1491
  a?.length,
1476
1492
  " result(s)"
1477
1493
  ] }),
1478
1494
  /* @__PURE__ */ e(C, { gap: 0, children: d?.map((u, g) => /* @__PURE__ */ e(
1479
- zn,
1495
+ Dt,
1480
1496
  {
1481
1497
  contextText: u.meta?.range?.startContainer.parentElement?.textContent ?? "",
1482
1498
  pageIndex: u.meta?.itemPageIndex,
@@ -1494,41 +1510,41 @@ const En = y.forwardRef(
1494
1510
  )
1495
1511
  ] });
1496
1512
  }
1497
- ), _n = m(
1513
+ ), Ft = f(
1498
1514
  ({
1499
- open: t,
1500
- setOpen: n,
1515
+ open: n,
1516
+ setOpen: t,
1501
1517
  onNavigate: o
1502
1518
  }) => /* @__PURE__ */ e(
1503
- N,
1519
+ q,
1504
1520
  {
1505
1521
  lazyMount: !0,
1506
1522
  placement: "center",
1507
- open: t,
1508
- onOpenChange: (i) => n(i.open),
1523
+ open: n,
1524
+ onOpenChange: (r) => t(r.open),
1509
1525
  size: { mdDown: "full", md: "lg" },
1510
1526
  scrollBehavior: "inside",
1511
- children: /* @__PURE__ */ s(W, { height: "100%", children: [
1512
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Y, { children: "Search" }) }),
1513
- /* @__PURE__ */ e(G, { flex: 1, p: 0, children: /* @__PURE__ */ e(Ln, { onNavigate: o }) }),
1514
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "outline", children: "Cancel" }) }) }),
1515
- /* @__PURE__ */ e(H, {})
1527
+ children: /* @__PURE__ */ s(G, { height: "100%", children: [
1528
+ /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Q, { children: "Search" }) }),
1529
+ /* @__PURE__ */ e(Z, { flex: 1, p: 0, children: /* @__PURE__ */ e($t, { onNavigate: o }) }),
1530
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(K, { asChild: !0, children: /* @__PURE__ */ e(V, { variant: "outline", children: "Cancel" }) }) }),
1531
+ /* @__PURE__ */ e(j, {})
1516
1532
  ] })
1517
1533
  }
1518
1534
  )
1519
- ), $n = m(
1520
- ({ onNavigate: t }) => {
1521
- const n = f(), { manifest: o, assumedRenditionLayout: i } = b(() => n?.context, [n]) ?? {}, { nav: r } = o ?? {}, a = q();
1522
- r?.toc;
1523
- const { beginSpineItemIndex: l, beginPageIndexInSpineItem: c } = a ?? {}, d = (i === "reflowable" ? c : l) || 0;
1535
+ ), Wt = f(
1536
+ ({ onNavigate: n }) => {
1537
+ const t = m(), { manifest: o, assumedRenditionLayout: r } = b(() => t?.context, [t]) ?? {}, { nav: i } = o ?? {}, a = X();
1538
+ i?.toc;
1539
+ const { beginSpineItemIndex: l, beginPageIndexInSpineItem: c } = a ?? {}, d = (r === "reflowable" ? c : l) || 0;
1524
1540
  let u = a?.beginChapterInfo;
1525
1541
  for (; u?.subChapter; )
1526
1542
  u = u?.subChapter;
1527
- const g = (h, v, T) => /* @__PURE__ */ s(He.Fragment, { children: [
1543
+ const g = (h, x, S) => /* @__PURE__ */ s(Ne.Fragment, { children: [
1528
1544
  /* @__PURE__ */ e(
1529
- w.Item,
1545
+ P.Item,
1530
1546
  {
1531
- pl: 4 * (T + 1),
1547
+ pl: 4 * (S + 1),
1532
1548
  style: {
1533
1549
  display: "flex",
1534
1550
  alignItems: "center"
@@ -1537,12 +1553,12 @@ const En = y.forwardRef(
1537
1553
  Se,
1538
1554
  {
1539
1555
  onClick: () => {
1540
- t(), n?.navigation.goToUrl(h.href);
1556
+ n(), t?.navigation.goToUrl(h.href);
1541
1557
  },
1542
1558
  href: "#",
1543
1559
  children: [
1544
- u?.path === h.path && /* @__PURE__ */ e(w.Indicator, { asChild: !0, children: /* @__PURE__ */ e(we, {}) }),
1545
- u?.path !== h.path && /* @__PURE__ */ e(w.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(we, {}) }),
1560
+ u?.path === h.path && /* @__PURE__ */ e(P.Indicator, { asChild: !0, children: /* @__PURE__ */ e(we, {}) }),
1561
+ u?.path !== h.path && /* @__PURE__ */ e(P.Indicator, { asChild: !0, visibility: "hidden", children: /* @__PURE__ */ e(we, {}) }),
1546
1562
  /* @__PURE__ */ s(C, { gap: 0, children: [
1547
1563
  /* @__PURE__ */ e(p, { fontSize: "md", children: h.title || h.path }),
1548
1564
  u?.path === h.path && /* @__PURE__ */ e(
@@ -1560,102 +1576,152 @@ const En = y.forwardRef(
1560
1576
  )
1561
1577
  }
1562
1578
  ),
1563
- h.contents.length > 0 && /* @__PURE__ */ e(w.Root, { as: "div", gap: 2, children: h.contents.map(
1564
- (P, L) => g(P, L, T + 1)
1579
+ h.contents.length > 0 && /* @__PURE__ */ e(P.Root, { as: "div", gap: 2, children: h.contents.map(
1580
+ (I, w) => g(I, w, S + 1)
1565
1581
  ) })
1566
- ] }, v);
1567
- return /* @__PURE__ */ e(w.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: r?.toc.map((h, v) => g(h, v, 0)) });
1582
+ ] }, x);
1583
+ return /* @__PURE__ */ e(P.Root, { gap: 3, overflowY: "auto", py: 4, flex: 1, children: i?.toc.map((h, x) => g(h, x, 0)) });
1568
1584
  }
1569
- ), Fn = m(
1585
+ ), Ht = f(
1570
1586
  ({
1571
- open: t,
1572
- setOpen: n,
1587
+ open: n,
1588
+ setOpen: t,
1573
1589
  onNavigate: o
1574
1590
  }) => /* @__PURE__ */ e(
1575
- N,
1591
+ q,
1576
1592
  {
1577
1593
  lazyMount: !0,
1578
1594
  placement: "center",
1579
- open: t,
1580
- onOpenChange: (i) => n(i.open),
1595
+ open: n,
1596
+ onOpenChange: (r) => t(r.open),
1581
1597
  size: { mdDown: "full", md: "lg" },
1582
1598
  scrollBehavior: "inside",
1583
- children: /* @__PURE__ */ s(W, { children: [
1584
- /* @__PURE__ */ e(j, { children: /* @__PURE__ */ e(Y, { children: "Table of Contents" }) }),
1585
- /* @__PURE__ */ e(G, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ e($n, { onNavigate: o }) }),
1586
- /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(U, { asChild: !0, children: /* @__PURE__ */ e(F, { variant: "outline", children: "Cancel" }) }) }),
1587
- /* @__PURE__ */ e(H, {})
1599
+ children: /* @__PURE__ */ s(G, { children: [
1600
+ /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(Q, { children: "Table of Contents" }) }),
1601
+ /* @__PURE__ */ e(Z, { overflowY: "auto", flex: 1, children: /* @__PURE__ */ e(Wt, { onNavigate: o }) }),
1602
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(K, { asChild: !0, children: /* @__PURE__ */ e(V, { variant: "outline", children: "Cancel" }) }) }),
1603
+ /* @__PURE__ */ e(j, {})
1588
1604
  ] })
1589
1605
  }
1590
1606
  )
1591
- ), ro = ({
1592
- enableFloatingTime: t = !0,
1593
- enableFloatingProgress: n = !0,
1594
- onItemClick: o
1607
+ ), Nt = f(() => {
1608
+ const { quickMenuBottomBarBoundingBox: n } = E(), t = ue(
1609
+ n
1610
+ ), o = m(), r = b(() => o?.zoom.state$, [o]), i = r?.currentScale ?? 1, a = r?.isZooming && r.currentScale >= 1, l = t?.borderBoxSize?.[0]?.blockSize ?? 1;
1611
+ return /* @__PURE__ */ e(
1612
+ oe,
1613
+ {
1614
+ present: a,
1615
+ animationName: { _open: "fade-in", _closed: "fade-out" },
1616
+ animationDuration: "moderate",
1617
+ position: "absolute",
1618
+ bottom: `calc(${l}px + var(--chakra-spacing-4))`,
1619
+ right: 4,
1620
+ backgroundColor: "bg.panel",
1621
+ shadow: "sm",
1622
+ borderRadius: "md",
1623
+ p: 4,
1624
+ children: /* @__PURE__ */ e(
1625
+ He,
1626
+ {
1627
+ value: [i],
1628
+ min: 1,
1629
+ max: 5,
1630
+ step: 0.5,
1631
+ minWidth: 200,
1632
+ onValueChange: (c) => {
1633
+ const d = c.value?.[0] ?? 1;
1634
+ d === 1 ? o?.zoom.exit() : o?.zoom.scaleAt(d);
1635
+ }
1636
+ }
1637
+ )
1638
+ }
1639
+ );
1640
+ }), so = ({
1641
+ enableFloatingTime: n = !0,
1642
+ enableFloatingProgress: t = !0,
1643
+ onItemClick: o,
1644
+ children: r,
1645
+ ...i
1595
1646
  }) => {
1596
- const [i, r] = R(!1), [a, l] = R(!1), [c, d] = R(!1), [u, g] = R(void 0), [h, v] = R(!1), [T, P] = Ie(), L = X(() => {
1597
- r(!1), l(!1), d(!1), g(void 0), P(!1), v(!1);
1598
- }, [P]), Q = X(
1599
- (k) => {
1600
- k === "annotations" ? g("annotations") : k === "search" ? d(!0) : k === "help" ? l(!0) : k === "toc" ? r(!0) : k === "bookmarks" ? g("bookmarks") : k === "gallery" && v(!0), o?.(k);
1647
+ const [a, l] = y(!1), [c, d] = y(!1), [u, g] = y(!1), [h, x] = y(void 0), [S, I] = y(!1), [w, M] = Ie(), A = te(() => {
1648
+ l(!1), d(!1), g(!1), x(void 0), M(!1), I(!1);
1649
+ }, [M]), ae = te(
1650
+ (z) => {
1651
+ z === "annotations" ? x("annotations") : z === "search" ? g(!0) : z === "help" ? d(!0) : z === "toc" ? l(!0) : z === "bookmarks" ? x("bookmarks") : z === "gallery" && I(!0), o?.(z);
1601
1652
  },
1602
1653
  [o]
1603
1654
  );
1604
- return cn(), hn(), qt(), /* @__PURE__ */ s(ce, { children: [
1605
- n && /* @__PURE__ */ e(
1606
- se,
1607
- {
1608
- present: !T,
1609
- animationName: { _open: "fade-in", _closed: "fade-out" },
1610
- animationDuration: "moderate",
1611
- children: /* @__PURE__ */ e(rn, {})
1612
- }
1613
- ),
1614
- /* @__PURE__ */ e(en, { open: h, setOpen: v }),
1615
- /* @__PURE__ */ e(Mn, {}),
1616
- /* @__PURE__ */ e(Tn, { onItemClick: Q }),
1617
- /* @__PURE__ */ e(Yt, {}),
1618
- /* @__PURE__ */ e(on, { open: a, setOpen: l }),
1619
- /* @__PURE__ */ e(
1620
- Fn,
1621
- {
1622
- open: i,
1623
- setOpen: r,
1624
- onNavigate: L
1625
- }
1626
- ),
1627
- /* @__PURE__ */ e(
1628
- _n,
1629
- {
1630
- open: c,
1631
- setOpen: d,
1632
- onNavigate: L
1633
- }
1634
- ),
1635
- /* @__PURE__ */ e(
1636
- Ht,
1637
- {
1638
- openWith: u,
1639
- setOpen: (k) => g(k ? "annotations" : void 0),
1640
- onNavigate: L
1641
- }
1642
- ),
1643
- /* @__PURE__ */ e(
1644
- se,
1645
- {
1646
- present: t || T,
1647
- animationName: { _open: "fade-in", _closed: "fade-out" },
1648
- animationDuration: "slow",
1649
- overflow: "hidden",
1650
- children: /* @__PURE__ */ e(ln, {})
1651
- }
1652
- ),
1653
- /* @__PURE__ */ e(Qt, {})
1654
- ] });
1655
+ return gt(), ft(), Jn(), /* @__PURE__ */ s(
1656
+ B,
1657
+ {
1658
+ position: "absolute",
1659
+ top: 0,
1660
+ left: 0,
1661
+ height: "100%",
1662
+ width: "100%",
1663
+ overflow: "hidden",
1664
+ "data-prose-react-reader": !0,
1665
+ ...i,
1666
+ children: [
1667
+ r,
1668
+ t && /* @__PURE__ */ e(
1669
+ oe,
1670
+ {
1671
+ present: !w,
1672
+ animationName: { _open: "fade-in", _closed: "fade-out" },
1673
+ animationDuration: "moderate",
1674
+ children: /* @__PURE__ */ e(ct, {})
1675
+ }
1676
+ ),
1677
+ /* @__PURE__ */ e(it, { open: S, setOpen: I }),
1678
+ /* @__PURE__ */ e(Et, {}),
1679
+ /* @__PURE__ */ e(Bt, { onItemClick: ae }),
1680
+ /* @__PURE__ */ e(Nt, {}),
1681
+ /* @__PURE__ */ e(Kn, {}),
1682
+ /* @__PURE__ */ e(lt, { open: c, setOpen: d }),
1683
+ /* @__PURE__ */ e(
1684
+ Ht,
1685
+ {
1686
+ open: a,
1687
+ setOpen: l,
1688
+ onNavigate: A
1689
+ }
1690
+ ),
1691
+ /* @__PURE__ */ e(
1692
+ Ft,
1693
+ {
1694
+ open: u,
1695
+ setOpen: g,
1696
+ onNavigate: A
1697
+ }
1698
+ ),
1699
+ /* @__PURE__ */ e(
1700
+ qn,
1701
+ {
1702
+ openWith: h,
1703
+ setOpen: (z) => x(z ? "annotations" : void 0),
1704
+ onNavigate: A
1705
+ }
1706
+ ),
1707
+ /* @__PURE__ */ e(
1708
+ oe,
1709
+ {
1710
+ present: n || w,
1711
+ animationName: { _open: "fade-in", _closed: "fade-out" },
1712
+ animationDuration: "slow",
1713
+ overflow: "hidden",
1714
+ children: /* @__PURE__ */ e(ht, {})
1715
+ }
1716
+ ),
1717
+ /* @__PURE__ */ e(et, {})
1718
+ ]
1719
+ }
1720
+ );
1655
1721
  };
1656
1722
  export {
1657
- zt as BOOKMARK_AREA_DATA_ATTRIBUTE,
1658
- ro as ReactReader,
1659
- oo as ReactReaderProvider
1723
+ $n as BOOKMARK_AREA_DATA_ATTRIBUTE,
1724
+ so as ReactReader,
1725
+ ao as ReactReaderProvider
1660
1726
  };
1661
1727
  //# sourceMappingURL=index.js.map