@prose-reader/core 1.269.0 → 1.270.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,11 +1,11 @@
1
- import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as A, takeUntil as $, Observable as se, defer as Ft, Subject as R, combineLatest as O, merge as P, EMPTY as _, NEVER as he, tap as x, share as j, BehaviorSubject as Y, distinctUntilChanged as k, filter as M, mergeMap as ge, first as V, endWith as ye, catchError as Ue, finalize as pe, lastValueFrom as an, scheduled as cn, animationFrameScheduler as ce, exhaustMap as ze, debounceTime as be, withLatestFrom as z, throttleTime as un, startWith as ne, shareReplay as J, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as Pe, timer as Te, skip as Lt, ReplaySubject as ot, identity as xe, reduce as gn, concatMap as st } from "rxjs";
2
- import { Report as hn, isShallowEqual as U, shallowMergeIfDefined as $e, getParentPath as mn, parseContentType as fn, detectMimeTypeFromName as Me, arrayEqual as yn } from "@prose-reader/shared";
3
- import { isShallowEqual as or } from "@prose-reader/shared";
4
- import { switchMap as X, first as Mt, map as ie, distinctUntilChanged as fe, startWith as Sn, shareReplay as Ze, tap as N, pairwise as In, take as bn, takeUntil as K, filter as ae, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as rt } from "rxjs/operators";
5
- import { generate as We, parse as Et, isIndirectionOnly as Pn, isParsedCfiRange as xn, resolve as $n } from "@prose-reader/cfi";
6
- const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
1
+ import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as A, takeUntil as $, Observable as se, defer as Ft, Subject as R, combineLatest as O, merge as P, EMPTY as _, NEVER as he, tap as x, share as j, BehaviorSubject as Y, distinctUntilChanged as k, filter as M, mergeMap as ge, first as V, endWith as ye, catchError as Ue, finalize as pe, lastValueFrom as rn, scheduled as an, animationFrameScheduler as ce, exhaustMap as ze, debounceTime as be, withLatestFrom as z, throttleTime as cn, startWith as ne, shareReplay as J, switchScan as un, defaultIfEmpty as ln, forkJoin as dn, delay as Pe, timer as Te, skip as Lt, ReplaySubject as ot, identity as xe, reduce as pn, concatMap as st } from "rxjs";
2
+ import { Report as gn, isShallowEqual as U, shallowMergeIfDefined as $e, getParentPath as hn, parseContentType as mn, detectMimeTypeFromName as Me, arrayEqual as fn } from "@prose-reader/shared";
3
+ import { isShallowEqual as nr } from "@prose-reader/shared";
4
+ import { switchMap as X, first as Mt, map as ie, distinctUntilChanged as fe, startWith as yn, shareReplay as Ze, tap as N, pairwise as Sn, take as In, takeUntil as K, filter as ae, debounceTime as bn, skip as Ct, mergeMap as vn, catchError as rt } from "rxjs/operators";
5
+ import { generate as We, parse as Et, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
6
+ const $n = "@prose-reader/core", D = gn.namespace($n, void 0, {
7
7
  color: "#98cde7"
8
- }), Fn = [
8
+ }), Tn = [
9
9
  "pointercancel",
10
10
  "pointerdown",
11
11
  "pointerenter",
@@ -17,24 +17,24 @@ const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
17
17
  // `touchstart` as const,
18
18
  // `touchend` as const,
19
19
  ];
20
- function Ln(n, e, t) {
20
+ function Fn(n, e, t) {
21
21
  if ("caretPositionFromPoint" in n)
22
22
  return n.caretPositionFromPoint(e, t);
23
23
  if ("caretRangeFromPoint" in n && // @ts-expect-error limited availability
24
24
  typeof n.caretRangeFromPoint < "u")
25
25
  return n.caretRangeFromPoint(e, t);
26
26
  }
27
- const Mn = (n, e) => {
27
+ const Ln = (n, e) => {
28
28
  const t = "body" in n ? _e(n.body, e) : _e(n, e), i = "createRange" in n ? n : n.ownerDocument;
29
29
  if (t) {
30
30
  let o, s = 0;
31
31
  const r = i.createRange();
32
32
  return Array.from(t.childNodes).some((a) => {
33
33
  r.selectNodeContents(a);
34
- const c = r.getClientRects(), u = Cn(c, e);
34
+ const c = r.getClientRects(), u = Mn(c, e);
35
35
  if (u) {
36
36
  o = r.cloneRange();
37
- const l = Ln(
37
+ const l = Fn(
38
38
  i,
39
39
  Math.ceil(u.left),
40
40
  Math.ceil(u.top)
@@ -64,13 +64,13 @@ const Mn = (n, e) => {
64
64
  function Dt(n, { left: e, right: t }) {
65
65
  return n.left <= e && n.right <= e ? "before" : n.left <= e && n.right > e && n.right <= t ? "partially-before" : n.left <= t && n.right > t ? "partially-after" : n.left > t ? "after" : "within";
66
66
  }
67
- function Cn(n, e) {
67
+ function Mn(n, e) {
68
68
  return Array.from(n).find((t) => {
69
69
  const i = Dt(t, e);
70
70
  return i !== "before" && i !== "after";
71
71
  });
72
72
  }
73
- const En = (n, e) => {
73
+ const Cn = (n, e) => {
74
74
  if (n.nodeType !== Node.CDATA_SECTION_NODE && n.nodeType !== Node.DOCUMENT_TYPE_NODE) {
75
75
  const t = n.ownerDocument?.createRange();
76
76
  t?.selectNodeContents(n);
@@ -92,8 +92,8 @@ const En = (n, e) => {
92
92
  if (e.PointerEvent && n instanceof e.PointerEvent)
93
93
  return !0;
94
94
  }
95
- return !!Fn.includes(n.type);
96
- }, Dn = (n) => {
95
+ return !!Tn.includes(n.type);
96
+ }, En = (n) => {
97
97
  if (Je(n)) return !1;
98
98
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
99
99
  const e = n?.target?.ownerDocument?.defaultView;
@@ -106,7 +106,7 @@ const En = (n, e) => {
106
106
  return n instanceof e.MouseEvent;
107
107
  }
108
108
  return !1;
109
- }, Rn = (n) => {
109
+ }, Dn = (n) => {
110
110
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
111
111
  const e = n?.target?.ownerDocument?.defaultView;
112
112
  if (e.TouchEvent)
@@ -118,7 +118,7 @@ const En = (n, e) => {
118
118
  return n instanceof e.TouchEvent;
119
119
  }
120
120
  return !1;
121
- }, An = () => document.createElement("div"), Rt = (n) => {
121
+ }, Rn = () => document.createElement("div"), Rt = (n) => {
122
122
  const e = [
123
123
  "img",
124
124
  // Images
@@ -134,7 +134,7 @@ const En = (n, e) => {
134
134
  // JavaScript files
135
135
  ].join(",");
136
136
  return Array.from(n?.querySelectorAll(e) || []);
137
- }, Nn = (n) => {
137
+ }, An = (n) => {
138
138
  if (Rt(n).forEach((t) => {
139
139
  const i = t.getAttribute("src") || t.getAttribute("href");
140
140
  i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
@@ -169,10 +169,10 @@ function Nt(n) {
169
169
  // biome-ignore lint/suspicious/noExplicitAny: TODO
170
170
  ) && n.nodeType === Node.ELEMENT_NODE;
171
171
  }
172
- function On(n, e) {
172
+ function Nn(n, e) {
173
173
  return Nt(n) && n.tagName.toLowerCase() === e.toLowerCase();
174
174
  }
175
- function Vn(n) {
175
+ function On(n) {
176
176
  return At(
177
177
  n,
178
178
  [
@@ -199,9 +199,9 @@ const Ce = (n, e, t, i) => {
199
199
  }, at = (n, e) => {
200
200
  const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
201
201
  return i && Number.parseFloat(o) || 0;
202
- }, jn = (n, e, t, i) => {
202
+ }, Vn = (n, e, t, i) => {
203
203
  n?.contentDocument?.head && Ce(n.contentDocument, e, t, i);
204
- }, Bs = (n, e) => {
204
+ }, _s = (n, e) => {
205
205
  n?.contentDocument && Ee(n.contentDocument, e);
206
206
  }, oe = (n, e, t, i) => {
207
207
  if (!n) return;
@@ -212,7 +212,7 @@ const Ce = (n, e, t, i) => {
212
212
  o.innerHTML = t;
213
213
  return;
214
214
  }
215
- jn(n, e, t, i);
215
+ Vn(n, e, t, i);
216
216
  }, Ke = (n) => {
217
217
  if (n?.contentDocument) {
218
218
  const t = n.contentDocument.querySelector("meta[name='viewport']");
@@ -229,17 +229,17 @@ const Ce = (n, e, t, i) => {
229
229
  }
230
230
  }
231
231
  return { hasViewport: !1 };
232
- }, kn = (n) => n.pipe(
232
+ }, jn = (n) => n.pipe(
233
233
  w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : q(e, "load").pipe(
234
234
  Tt(1),
235
235
  S(() => e)
236
236
  ))
237
- ), Un = (n) => n.pipe(
237
+ ), kn = (n) => n.pipe(
238
238
  w((e) => {
239
239
  const t = e?.contentDocument?.fonts.ready;
240
240
  return t ? A(t).pipe(S(() => e)) : v(void 0);
241
241
  })
242
- ), zn = (n) => (e) => {
242
+ ), Un = (n) => (e) => {
243
243
  const t = n(e), i = new IntersectionObserver((o) => {
244
244
  o.forEach((s) => {
245
245
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -274,7 +274,7 @@ const Ce = (n, e, t, i) => {
274
274
  ), {
275
275
  ...t
276
276
  };
277
- }, Wn = (n) => (e) => {
277
+ }, zn = (n) => (e) => {
278
278
  const t = n(e);
279
279
  return t.context.watch("rootElement").pipe($(t.context.destroy$)).subscribe((i) => {
280
280
  if (!i) return;
@@ -295,7 +295,7 @@ const Ce = (n, e, t, i) => {
295
295
  clientX: a,
296
296
  clientY: c
297
297
  };
298
- }, _n = (n, e, t, i) => {
298
+ }, Wn = (n, e, t, i) => {
299
299
  const o = e?.view?.frameElement;
300
300
  if (!e || !o) return n;
301
301
  const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
@@ -315,7 +315,7 @@ const Ce = (n, e, t, i) => {
315
315
  enumerable: !0
316
316
  }), d;
317
317
  }
318
- if (Dn(n)) {
318
+ if (En(n)) {
319
319
  const { clientX: u, clientY: l } = Ae({
320
320
  position: n,
321
321
  frameElement: r
@@ -329,7 +329,7 @@ const Ce = (n, e, t, i) => {
329
329
  enumerable: !0
330
330
  }), d;
331
331
  }
332
- if (Rn(n)) {
332
+ if (Dn(n)) {
333
333
  const u = Array.from(n.touches).map((d) => {
334
334
  const { clientX: p, clientY: g } = Ae({
335
335
  position: d,
@@ -352,7 +352,7 @@ const Ce = (n, e, t, i) => {
352
352
  }), l;
353
353
  }
354
354
  return n;
355
- }, Hn = [
355
+ }, _n = [
356
356
  "pointercancel",
357
357
  "pointerdown",
358
358
  "pointerenter",
@@ -361,21 +361,21 @@ const Ce = (n, e, t, i) => {
361
361
  "pointerout",
362
362
  "pointerover",
363
363
  "pointerup"
364
- ], Bn = [
365
- ...Hn
364
+ ], Hn = [
365
+ ..._n
366
366
  /*, ...mouseEvents*/
367
- ], Xn = (n) => (e) => {
367
+ ], Bn = (n) => (e) => {
368
368
  const t = n(e);
369
369
  return t.hookManager.register(
370
370
  "item.onDocumentLoad",
371
371
  ({ destroy: i, itemId: o }) => {
372
372
  const s = t.spineItemsManager.get(o), r = s?.renderer.getDocumentFrame();
373
373
  if (!r || !s) return;
374
- const a = Bn.map((c) => {
374
+ const a = Hn.map((c) => {
375
375
  const u = (l) => {
376
376
  let d = l;
377
377
  if (Je(l) && (d = new PointerEvent(l.type, l)), d !== l) {
378
- const p = _n(
378
+ const p = Wn(
379
379
  d,
380
380
  l,
381
381
  t.spine.locator,
@@ -419,7 +419,7 @@ const De = (n) => (e) => e.pipe(
419
419
  ie(() => t)
420
420
  )
421
421
  )
422
- ), Yn = (n) => {
422
+ ), Xn = (n) => {
423
423
  let e;
424
424
  const t = n.subscribe((i) => {
425
425
  e = { result: i };
@@ -449,7 +449,7 @@ const ut = (n, e) => new se((t) => {
449
449
  });
450
450
  return i.observe(n, e), () => i.disconnect();
451
451
  });
452
- function Xs(n, e) {
452
+ function Hs(n, e) {
453
453
  return new se((t) => {
454
454
  const i = new IntersectionObserver((o) => {
455
455
  t.next(o);
@@ -471,7 +471,7 @@ class jt {
471
471
  e
472
472
  ), this.outputSettingsUpdateSubject = new R(), this.values$ = O([
473
473
  this.settingsManager.values$,
474
- this.outputSettingsUpdateSubject.pipe(Sn(this.outputSettings))
474
+ this.outputSettingsUpdateSubject.pipe(yn(this.outputSettings))
475
475
  ]).pipe(
476
476
  ie(([o, s]) => ({ ...o, ...s })),
477
477
  Ze(1)
@@ -507,7 +507,7 @@ class jt {
507
507
  this.outputSettingsUpdateSubject.complete();
508
508
  }
509
509
  }
510
- const Ys = (n) => {
510
+ const Bs = (n) => {
511
511
  const e = new FileReader();
512
512
  return new Promise((t) => {
513
513
  e.addEventListener(
@@ -519,7 +519,7 @@ const Ys = (n) => {
519
519
  ), e.readAsDataURL(n);
520
520
  });
521
521
  };
522
- let qn = class extends jt {
522
+ let Yn = class extends jt {
523
523
  computeOutputSettings(e) {
524
524
  return e;
525
525
  }
@@ -545,8 +545,8 @@ let qn = class extends jt {
545
545
  };
546
546
  }
547
547
  };
548
- const Gn = (n) => (e) => {
549
- const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new qn(
548
+ const qn = (n) => (e) => {
549
+ const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new Yn(
550
550
  {
551
551
  fontScale: t,
552
552
  lineHeight: i,
@@ -578,7 +578,7 @@ const Gn = (n) => (e) => {
578
578
  }
579
579
  });
580
580
  const d = (p) => p.pipe(
581
- In(),
581
+ Sn(),
582
582
  S(([g, h]) => h.fontScale !== g.fontScale || h.lineHeight !== g.lineHeight)
583
583
  );
584
584
  return c.values$.pipe(
@@ -592,7 +592,7 @@ const Gn = (n) => (e) => {
592
592
  },
593
593
  settings: c
594
594
  };
595
- }, Zn = (n) => (e) => {
595
+ }, Gn = (n) => (e) => {
596
596
  const t = n(e), i = (o) => q(o, "keyup").pipe(
597
597
  S((s) => {
598
598
  const { pageTurnDirection: r, computedPageTurnMode: a } = t.settings.values;
@@ -628,7 +628,7 @@ const Gn = (n) => (e) => {
628
628
  ),
629
629
  $(t.$.destroy$)
630
630
  ).subscribe(), t;
631
- }, Jn = (n) => n.spine.spineItemsManager.items$.pipe(
631
+ }, Zn = (n) => n.spine.spineItemsManager.items$.pipe(
632
632
  w(
633
633
  (e) => P(
634
634
  ...e.map((t) => t.watch("isLoaded").pipe(
@@ -802,15 +802,15 @@ const Le = class Le extends Q {
802
802
  };
803
803
  Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
804
804
  let Se = Le;
805
- const Kn = (n) => new URL(n.href);
805
+ const Jn = (n) => new URL(n.href);
806
806
  class tt {
807
807
  constructor(e, t) {
808
808
  this.item = e, this.settings = t;
809
809
  }
810
810
  async getResource() {
811
- return await an(
811
+ return await rn(
812
812
  this.settings.values.getResource?.(this.item) ?? v(void 0)
813
- ) ?? Kn(this.item);
813
+ ) ?? Jn(this.item);
814
814
  }
815
815
  async fetchResource() {
816
816
  const e = await this.getResource();
@@ -820,7 +820,7 @@ class tt {
820
820
  const kt = (n, e) => {
821
821
  const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
822
822
  return t ? o.replace("http://", "file://") : o;
823
- }, Qn = async (n, e, t, i, o) => {
823
+ }, Kn = async (n, e, t, i, o) => {
824
824
  if (!n || !n.defaultView) return;
825
825
  const s = e.sheet;
826
826
  if (s)
@@ -868,7 +868,7 @@ const kt = (n, e) => {
868
868
  } catch (r) {
869
869
  console.error("Could not access stylesheet rules:", r);
870
870
  }
871
- }, ei = (n, e, t, i, o) => {
871
+ }, Qn = (n, e, t, i, o) => {
872
872
  const s = e.getAttribute("src") || e.getAttribute("href");
873
873
  if (!s) return v(null);
874
874
  const r = i.manifest?.items.find(({ href: c }) => `${kt(t, s).toLowerCase()}`.endsWith(
@@ -890,7 +890,7 @@ const kt = (n, e) => {
890
890
  return new se((l) => {
891
891
  e.onload = async () => {
892
892
  try {
893
- e.sheet && await Qn(
893
+ e.sheet && await Kn(
894
894
  n,
895
895
  e,
896
896
  t,
@@ -905,7 +905,7 @@ const kt = (n, e) => {
905
905
  return v(null);
906
906
  })
907
907
  );
908
- }, ti = ({
908
+ }, ei = ({
909
909
  settings: n,
910
910
  item: e,
911
911
  context: t
@@ -913,8 +913,8 @@ const kt = (n, e) => {
913
913
  w((o) => {
914
914
  const s = Rt(
915
915
  o.contentDocument
916
- ), r = mn(e.href), a = s.map(
917
- (c) => ei(
916
+ ), r = hn(e.href), a = s.map(
917
+ (c) => Qn(
918
918
  o.contentDocument,
919
919
  c,
920
920
  r,
@@ -924,11 +924,11 @@ const kt = (n, e) => {
924
924
  );
925
925
  return O(a).pipe(S(() => o));
926
926
  })
927
- ), ni = (n) => {
928
- Nn(n?.contentDocument);
929
- }, Gs = "@prose-reader/core", Zs = 0, Js = 200, ii = [".xhtml", ".html", ".htm"], W = "prose-reader", Ut = `${W}-style`, oi = `data-${W}-id`, si = `${W}-viewport`, ri = `${W}-scroll-navigator`, ai = async (n, e) => {
927
+ ), ti = (n) => {
928
+ An(n?.contentDocument);
929
+ }, Ys = "@prose-reader/core", qs = 0, Gs = 200, ni = [".xhtml", ".html", ".htm"], W = "prose-reader", Ut = `${W}-style`, ii = `data-${W}-id`, oi = `${W}-viewport`, si = `${W}-scroll-navigator`, ri = async (n, e) => {
930
930
  if (typeof n == "string") return n;
931
- const t = fn(n.headers.get("Content-Type") || "") || Me(e.href);
931
+ const t = mn(n.headers.get("Content-Type") || "") || Me(e.href);
932
932
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
933
933
  (o) => o === t
934
934
  )) {
@@ -964,11 +964,11 @@ const kt = (n, e) => {
964
964
  </body>
965
965
  </html>
966
966
  ` : await n.text();
967
- }, ci = ({
967
+ }, ai = ({
968
968
  item: n,
969
969
  resourcesHandler: e
970
970
  }) => {
971
- const t = (i) => ai(i, n);
971
+ const t = (i) => ri(i, n);
972
972
  return (i) => i.pipe(
973
973
  w((o) => A(e.getResource()).pipe(
974
974
  w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
@@ -978,7 +978,7 @@ const kt = (n, e) => {
978
978
  "text/html",
979
979
  "text/xml"
980
980
  ].includes(n.mediaType) || // no encoding ? then try to detect html
981
- !n.mediaType && ii.some(
981
+ !n.mediaType && ni.some(
982
982
  (a) => n.href.endsWith(a)
983
983
  )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? A(e.fetchResource()) : v(s)).pipe(
984
984
  w((a) => {
@@ -1000,7 +1000,7 @@ const kt = (n, e) => {
1000
1000
  ))
1001
1001
  ))
1002
1002
  );
1003
- }, ui = () => {
1003
+ }, ci = () => {
1004
1004
  const n = document.createElement("iframe");
1005
1005
  return n.frameBorder = "no", n.tabIndex = 0, n.setAttribute(
1006
1006
  "sandbox",
@@ -1015,12 +1015,7 @@ const kt = (n, e) => {
1015
1015
  border: 0px none transparent;
1016
1016
  padding: 0px;
1017
1017
  `, n.setAttribute("role", "main"), n;
1018
- }, zt = () => `
1019
- body {
1020
- margin: 0;
1021
- }
1022
- }
1023
- `, Wt = ({
1018
+ }, ui = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", zt = ({
1024
1019
  pageHeight: n,
1025
1020
  pageWidth: e,
1026
1021
  frameElement: t
@@ -1033,102 +1028,51 @@ const kt = (n, e) => {
1033
1028
  n / (i.height ?? 1)
1034
1029
  ), computedWidthScale: o, viewportDimensions: i };
1035
1030
  }
1036
- }, li = ({
1037
- columnWidth: n,
1038
- enableTouch: e,
1039
- spreadPosition: t
1040
- }, i) => `
1041
- ${zt()}
1042
- body {
1043
- ${i ? "" : `
1044
- display: flex;
1045
- justify-content: ${t === "left" ? "flex-end" : t === "right" ? "flex-start" : "center"};
1046
- `}
1047
- }
1048
-
1049
- html, body {
1050
- height: 100%;
1051
- width: 100%;
1052
- }
1053
-
1054
- html, body {
1055
- -max-width: ${n}px !important;
1056
- }
1057
-
1058
- html, body {
1059
- ${e ? "" : `
1060
- touch-action: none
1061
- `}
1062
- }
1063
-
1064
- img {
1065
- user-select: none;
1066
- -webkit-user-drag: none;
1067
- -khtml-user-drag: none;
1068
- -moz-user-drag: none;
1069
- -o-user-drag: none;
1070
- user-drag: none;
1071
-
1072
- display: flex;
1073
-
1074
- ${i ? "" : `
1075
- -width: 100%;
1076
- max-width: 100%;
1077
- height:100%;
1078
- object-fit:contain;
1079
- `}
1080
- }
1081
- `, di = ({
1082
- pageHeight: n,
1083
- pageWidth: e
1084
- }) => ({ columnHeight: n, columnWidth: e }), lt = (n, e) => {
1031
+ }, lt = (n, e) => {
1085
1032
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1086
- }, pi = ({
1033
+ }, li = ({
1087
1034
  minPageSpread: n,
1088
1035
  blankPagePosition: e,
1089
1036
  spreadPosition: t,
1090
1037
  pageHeight: i,
1091
1038
  pageWidth: o,
1092
1039
  frameElement: s,
1093
- isRTL: r,
1094
- enableTouch: a
1040
+ isRTL: r
1095
1041
  }) => {
1096
- const c = n * o;
1042
+ const a = n * o;
1097
1043
  if (s?.contentDocument && s?.contentWindow) {
1098
- const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, p = i, g = li(
1099
- {
1100
- ...di({ pageHeight: i, pageWidth: o }),
1101
- enableTouch: a,
1102
- spreadPosition: t
1103
- },
1104
- u
1105
- );
1106
- if (oe(s, "prose-reader-css", g), u ? lt(s, {
1107
- width: u.width ?? 1,
1108
- height: u.height ?? 1
1044
+ const { viewportDimensions: c, computedScale: u = 1 } = zt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, l = !!c, d = o, p = i;
1045
+ if (s.contentDocument?.documentElement && s.contentDocument?.documentElement.setAttribute(
1046
+ "data-prose-reader-html-renderer-has-viewport-dimensions",
1047
+ l.toString()
1048
+ ), c ? lt(s, {
1049
+ width: c.width ?? 1,
1050
+ height: c.height ?? 1
1109
1051
  }) : lt(s, {
1110
1052
  width: d,
1111
1053
  height: p
1112
- }), u) {
1054
+ }), c) {
1113
1055
  s?.style.setProperty("position", "absolute"), s?.style.setProperty("top", "50%"), t === "left" ? (s?.style.setProperty("right", "0"), s?.style.removeProperty("left")) : e === "before" && r ? (s?.style.setProperty("right", "50%"), s?.style.removeProperty("left")) : t === "right" ? (s?.style.setProperty("left", "0"), s?.style.removeProperty("right")) : (s?.style.setProperty(
1114
1056
  "left",
1115
1057
  e === "before" ? r ? "25%" : "75%" : e === "after" ? r ? "75%" : "25%" : "50%"
1116
1058
  ), s?.style.removeProperty("right"));
1117
- const h = t !== "none" ? "0" : "-50%", m = t === "right" && e !== "before" ? "left" : t === "left" || e === "before" && r ? "right" : "center";
1059
+ const g = t !== "none" ? "0" : "-50%", h = t === "right" && e !== "before" ? "left" : t === "left" || e === "before" && r ? "right" : "center";
1118
1060
  s?.style.setProperty(
1119
1061
  "transform",
1120
- `translate(${h}, -50%) scale(${l})`
1062
+ `translate(${g}, -50%) scale(${u})`
1121
1063
  ), s?.style.setProperty(
1122
1064
  "transform-origin",
1123
- `${m} center`
1065
+ `${h} center`
1124
1066
  );
1125
1067
  } else
1126
1068
  e === "before" ? r ? s?.style.setProperty("margin-right", `${o}px`) : s?.style.setProperty("margin-left", `${o}px`) : (s?.style.removeProperty("margin-left"), s?.style.removeProperty("margin-right"));
1127
- return { width: c, height: p };
1069
+ return { width: a, height: p };
1128
1070
  }
1129
- return { width: c, height: i };
1130
- }, gi = () => `
1131
- ${zt()}
1071
+ return { width: a, height: i };
1072
+ }, di = () => `
1073
+ body {
1074
+ margin: 0;
1075
+ }
1132
1076
  html {
1133
1077
  width: 100%;
1134
1078
  height: 100%;
@@ -1142,7 +1086,7 @@ const kt = (n, e) => {
1142
1086
  html, body {
1143
1087
  touch-action: none;
1144
1088
  }
1145
- `, hi = ({
1089
+ `, pi = ({
1146
1090
  isScrollable: n,
1147
1091
  enableTouch: e
1148
1092
  }) => `
@@ -1167,7 +1111,7 @@ const kt = (n, e) => {
1167
1111
  display: block;
1168
1112
  }
1169
1113
  ` : ""}
1170
- `, mi = ({
1114
+ `, gi = ({
1171
1115
  width: n,
1172
1116
  columnHeight: e,
1173
1117
  columnWidth: t
@@ -1235,7 +1179,7 @@ const kt = (n, e) => {
1235
1179
  td {
1236
1180
  max-width: ${t}px;
1237
1181
  }
1238
- `, fi = ({
1182
+ `, hi = ({
1239
1183
  isUsingVerticalWriting: n,
1240
1184
  minimumWidth: e,
1241
1185
  pageHeight: t,
@@ -1251,7 +1195,7 @@ const kt = (n, e) => {
1251
1195
  };
1252
1196
  }, ve = (n, e) => {
1253
1197
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1254
- }, yi = ({
1198
+ }, mi = ({
1255
1199
  pageHeight: n,
1256
1200
  pageWidth: e,
1257
1201
  frameElement: t,
@@ -1265,7 +1209,7 @@ const kt = (n, e) => {
1265
1209
  }) => {
1266
1210
  const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", p = d ? Math.min(400, n) : n;
1267
1211
  t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${p}px`);
1268
- const { viewportDimensions: g, computedScale: h = 1 } = Wt({
1212
+ const { viewportDimensions: g, computedScale: h = 1 } = zt({
1269
1213
  frameElement: t,
1270
1214
  pageHeight: p,
1271
1215
  pageWidth: e
@@ -1276,7 +1220,7 @@ const kt = (n, e) => {
1276
1220
  oe(
1277
1221
  t,
1278
1222
  "prose-reader-html-renderer-framce-css",
1279
- gi()
1223
+ di()
1280
1224
  ), ve(t, {
1281
1225
  width: g.width ?? 1,
1282
1226
  height: g.height ?? 1
@@ -1288,11 +1232,11 @@ const kt = (n, e) => {
1288
1232
  `translate(-50%, -50%) scale(${h})`
1289
1233
  ), t?.style.setProperty("transform-origin", "center center");
1290
1234
  else {
1291
- const b = a ? hi({
1235
+ const b = a ? pi({
1292
1236
  isScrollable: i?.renditionFlow === "scrolled-continuous",
1293
1237
  enableTouch: c
1294
- }) : mi(
1295
- fi({
1238
+ }) : gi(
1239
+ hi({
1296
1240
  isUsingVerticalWriting: u,
1297
1241
  minimumWidth: l,
1298
1242
  pageHeight: p,
@@ -1324,19 +1268,19 @@ const kt = (n, e) => {
1324
1268
  return y % l === 0 ? t?.style.setProperty("margin-left", "0px") : (y = y + e, s && !u && t?.style.setProperty("margin-left", `${e}px`)), { width: y, height: f };
1325
1269
  }
1326
1270
  };
1327
- class Si extends Se {
1271
+ class fi extends Se {
1328
1272
  constructor() {
1329
- super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1273
+ super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1330
1274
  }
1331
1275
  onCreateDocument() {
1332
- const e = ui();
1276
+ const e = ci();
1333
1277
  return this.setDocumentContainer(e), v(e);
1334
1278
  }
1335
1279
  onLoadDocument() {
1336
1280
  const e = this.getFrameElement();
1337
1281
  if (!e) throw new Error("invalid frame");
1338
1282
  return v(e).pipe(
1339
- ci({
1283
+ ai({
1340
1284
  item: this.item,
1341
1285
  resourcesHandler: this.resourcesHandler,
1342
1286
  settings: this.settings
@@ -1345,17 +1289,20 @@ class Si extends Se {
1345
1289
  x(() => {
1346
1290
  this.attach();
1347
1291
  }),
1348
- kn,
1349
- ti({
1292
+ jn,
1293
+ x((t) => {
1294
+ this.isPrePaginated() ? oe(t, "prose-reader-css", ui) : this.isImageType();
1295
+ }),
1296
+ ei({
1350
1297
  context: this.context,
1351
1298
  item: this.item,
1352
1299
  settings: this.settings
1353
1300
  }),
1354
- Un
1301
+ kn
1355
1302
  );
1356
1303
  }
1357
1304
  onUnload() {
1358
- return ni(this.getFrameElement()), this.detach(), _;
1305
+ return ti(this.getFrameElement()), this.detach(), _;
1359
1306
  }
1360
1307
  onLayout({
1361
1308
  minPageSpread: e,
@@ -1364,16 +1311,17 @@ class Si extends Se {
1364
1311
  }) {
1365
1312
  const { width: o, height: s } = this.viewport.pageSize, r = this.getFrameElement();
1366
1313
  if (!r) return v(void 0);
1367
- const a = !!this.writingMode?.startsWith("vertical");
1368
- if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated") {
1369
- const u = pi({
1314
+ const a = !!this.writingMode?.startsWith("vertical"), c = this.settings.values.computedPageTurnMode === "scrollable";
1315
+ if (r.contentDocument?.documentElement && (r.contentDocument?.documentElement.setAttribute(
1316
+ "data-prose-reader-html-renderer-spread-position",
1317
+ i
1318
+ ), c ? r.contentDocument?.documentElement.classList.add(
1319
+ "prose-reader-html-renderer-touch-enabled"
1320
+ ) : r.contentDocument?.documentElement.classList.remove(
1321
+ "prose-reader-html-renderer-touch-enabled"
1322
+ )), this.isPrePaginated()) {
1323
+ const l = li({
1370
1324
  blankPagePosition: t,
1371
- /**
1372
- * When we have scrollable content, we use "native" touch event from the frame instead of
1373
- * our own gestures.
1374
- * @todo move this into scroll navigator
1375
- */
1376
- enableTouch: this.settings.values.computedPageTurnMode === "scrollable",
1377
1325
  frameElement: r,
1378
1326
  isRTL: this.context.isRTL(),
1379
1327
  minPageSpread: e,
@@ -1381,9 +1329,9 @@ class Si extends Se {
1381
1329
  pageWidth: o,
1382
1330
  spreadPosition: i
1383
1331
  });
1384
- return v(u);
1332
+ return v(l);
1385
1333
  }
1386
- const c = yi({
1334
+ const u = mi({
1387
1335
  pageHeight: s,
1388
1336
  pageWidth: o,
1389
1337
  frameElement: r,
@@ -1400,7 +1348,7 @@ class Si extends Se {
1400
1348
  */
1401
1349
  enableTouch: this.settings.values.computedPageTurnMode === "scrollable"
1402
1350
  });
1403
- return v(c);
1351
+ return v(u);
1404
1352
  }
1405
1353
  onRenderHeadless() {
1406
1354
  return A(this.resourcesHandler.fetchResource()).pipe(
@@ -1456,13 +1404,13 @@ class Si extends Se {
1456
1404
  return this.getFrameElement();
1457
1405
  }
1458
1406
  }
1459
- const Ii = (n) => (e) => {
1407
+ const yi = (n) => (e) => {
1460
1408
  const t = n({
1461
1409
  ...e,
1462
1410
  getRenderer(o) {
1463
- return e.getRenderer?.(o) ?? ((r) => new Si(r));
1411
+ return e.getRenderer?.(o) ?? ((r) => new fi(r));
1464
1412
  }
1465
- }), i = Jn(t);
1413
+ }), i = Zn(t);
1466
1414
  return i.pipe($(t.$.destroy$)).subscribe(), {
1467
1415
  ...t,
1468
1416
  links$: i
@@ -1486,7 +1434,7 @@ class Ne {
1486
1434
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1487
1435
  }
1488
1436
  }
1489
- class bi extends nt {
1437
+ class Si extends nt {
1490
1438
  constructor() {
1491
1439
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1492
1440
  }
@@ -1496,17 +1444,17 @@ class He extends nt {
1496
1444
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1497
1445
  }
1498
1446
  }
1499
- class vi extends nt {
1447
+ class Ii extends nt {
1500
1448
  constructor() {
1501
1449
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1502
1450
  }
1503
1451
  }
1504
- class _t {
1452
+ class Wt {
1505
1453
  constructor(e) {
1506
1454
  this.x = e.x, this.y = e.y;
1507
1455
  }
1508
1456
  }
1509
- class L extends _t {
1457
+ class L extends Wt {
1510
1458
  constructor() {
1511
1459
  super(...arguments), this.__symbol = "SpinePosition";
1512
1460
  }
@@ -1514,7 +1462,7 @@ class L extends _t {
1514
1462
  return new L(e);
1515
1463
  }
1516
1464
  }
1517
- class ue extends _t {
1465
+ class ue extends Wt {
1518
1466
  constructor() {
1519
1467
  super(...arguments), this.__symbol = "UnboundSpinePosition";
1520
1468
  }
@@ -1522,17 +1470,17 @@ class ue extends _t {
1522
1470
  return new ue(e);
1523
1471
  }
1524
1472
  }
1525
- const wi = (n, e) => {
1473
+ const bi = (n, e) => {
1526
1474
  const t = e.getBoundingClientRect(), { x: i, y: o } = n, { left: s, top: r } = t, a = t.width / e.offsetWidth, c = t.height / e.offsetHeight, u = i - s, l = o - r;
1527
1475
  return {
1528
1476
  x: u / a,
1529
1477
  y: l / c
1530
1478
  };
1531
- }, Pi = (n, e) => new ue(
1532
- wi(n, e)
1533
- ), xi = (n) => ({
1534
- getSpinePositionFromClientPosition: (e) => n.spine.element ? Pi(e, n.spine.element) : void 0
1535
- }), $i = (n) => {
1479
+ }, vi = (n, e) => new ue(
1480
+ bi(n, e)
1481
+ ), wi = (n) => ({
1482
+ getSpinePositionFromClientPosition: (e) => n.spine.element ? vi(e, n.spine.element) : void 0
1483
+ }), Pi = (n) => {
1536
1484
  let e;
1537
1485
  const t = n.context.watch("rootElement").pipe(
1538
1486
  X((c) => c ? new se(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
@@ -1545,7 +1493,7 @@ const wi = (n, e) => {
1545
1493
  `, c.appendChild(e), () => {
1546
1494
  e?.remove(), e = void 0;
1547
1495
  })) : he)
1548
- ), i = (c) => cn(c, ce).pipe(
1496
+ ), i = (c) => an(c, ce).pipe(
1549
1497
  N(() => {
1550
1498
  e?.style.setProperty(
1551
1499
  "visibility",
@@ -1560,7 +1508,7 @@ const wi = (n, e) => {
1560
1508
  );
1561
1509
  })
1562
1510
  ), s = i(n.viewportFree$).pipe(
1563
- bn(1)
1511
+ In(1)
1564
1512
  ), a = n.settings.values$.pipe(
1565
1513
  ie(() => n.settings.values.computedPageTurnMode),
1566
1514
  fe()
@@ -1571,13 +1519,13 @@ const wi = (n, e) => {
1571
1519
  K(n.$.destroy$)
1572
1520
  );
1573
1521
  return P(t, a);
1574
- }, Ti = `${W}-enhancer-loading`, Ht = `${Ti}-container`, Fi = ({
1522
+ }, xi = `${W}-enhancer-loading`, _t = `${xi}-container`, $i = ({
1575
1523
  container: n,
1576
1524
  item: e,
1577
1525
  viewport: t
1578
1526
  }) => {
1579
1527
  const i = n.ownerDocument.createElement("div");
1580
- i.classList.add(Ht), i.style.cssText = `
1528
+ i.classList.add(_t), i.style.cssText = `
1581
1529
  height: 100%;
1582
1530
  width: 100%;
1583
1531
  max-width: ${t.absoluteViewport.width}px;
@@ -1606,14 +1554,14 @@ const wi = (n, e) => {
1606
1554
  max-width: 300px;
1607
1555
  width: 80%;
1608
1556
  `, i.appendChild(o), i.appendChild(s), i;
1609
- }, Li = (n) => n.spineItemsManager.items$.pipe(
1557
+ }, Ti = (n) => n.spineItemsManager.items$.pipe(
1610
1558
  X(
1611
1559
  (e) => P(
1612
1560
  ...e.map((t) => {
1613
1561
  t.containerElement.style.zIndex = "0";
1614
1562
  const i = t.containerElement.querySelector(
1615
- `.${Ht}`
1616
- ), o = i instanceof HTMLElement ? i : Fi({
1563
+ `.${_t}`
1564
+ ), o = i instanceof HTMLElement ? i : $i({
1617
1565
  container: t.containerElement,
1618
1566
  item: t.item,
1619
1567
  viewport: n.viewport
@@ -1651,11 +1599,11 @@ const wi = (n, e) => {
1651
1599
  })
1652
1600
  )
1653
1601
  )
1654
- ), Mi = (n) => {
1602
+ ), Fi = (n) => {
1655
1603
  n.hookManager.register("item.onDocumentLoad", ({ itemId: e }) => {
1656
1604
  n.spineItemsManager.get(e)?.renderer.getDocumentFrame()?.setAttribute("scrolling", "no");
1657
1605
  });
1658
- }, Ci = (n) => {
1606
+ }, Li = (n) => {
1659
1607
  n.hookManager.register(
1660
1608
  "item.onAfterLayout",
1661
1609
  ({ item: e, blankPagePosition: t, minimumWidth: i }) => {
@@ -1672,7 +1620,7 @@ const wi = (n, e) => {
1672
1620
  }
1673
1621
  }
1674
1622
  );
1675
- }, Ei = (n) => n.spineItemsManager.items$.pipe(
1623
+ }, Mi = (n) => n.spineItemsManager.items$.pipe(
1676
1624
  w(
1677
1625
  (e) => P(
1678
1626
  ...e.map(
@@ -1685,7 +1633,7 @@ const wi = (n, e) => {
1685
1633
  )
1686
1634
  )
1687
1635
  );
1688
- let Di = class extends jt {
1636
+ let Ci = class extends jt {
1689
1637
  computeOutputSettings(e) {
1690
1638
  return e;
1691
1639
  }
@@ -1711,7 +1659,7 @@ let Di = class extends jt {
1711
1659
  };
1712
1660
  }
1713
1661
  };
1714
- const Ri = (n) => O([
1662
+ const Ei = (n) => O([
1715
1663
  n.viewport.watch(["width", "height"]),
1716
1664
  n.context.watch("manifest")
1717
1665
  ]).pipe(
@@ -1719,13 +1667,13 @@ const Ri = (n) => O([
1719
1667
  const o = e > t;
1720
1668
  return !o && i?.renditionSpread === "portrait" ? n.settings.update({ spreadMode: !0 }) : o && (i?.renditionSpread === void 0 || i?.renditionSpread === "auto" || i?.renditionSpread === "landscape" || i?.renditionSpread === "both") ? n.settings.update({ spreadMode: !0 }) : n.settings.update({ spreadMode: !1 });
1721
1669
  })
1722
- ), Ai = (n) => (e) => {
1670
+ ), Di = (n) => (e) => {
1723
1671
  const {
1724
1672
  pageHorizontalMargin: t,
1725
1673
  pageVerticalMargin: i,
1726
1674
  layoutAutoResize: o,
1727
1675
  layoutLayerTransition: s
1728
- } = e, r = n(e), a = new Di(
1676
+ } = e, r = n(e), a = new Ci(
1729
1677
  {
1730
1678
  pageHorizontalMargin: t,
1731
1679
  pageVerticalMargin: i,
@@ -1772,7 +1720,7 @@ const Ri = (n) => O([
1772
1720
  `
1773
1721
  );
1774
1722
  }
1775
- }), Ci(r), Mi(r), r.hookManager.register(
1723
+ }), Li(r), Fi(r), r.hookManager.register(
1776
1724
  "item.onDocumentCreated",
1777
1725
  ({ documentContainer: m }) => {
1778
1726
  m.style.opacity = "0", a.values.layoutLayerTransition && (m.style.transition = "opacity 300ms");
@@ -1792,12 +1740,12 @@ const Ri = (n) => O([
1792
1740
  X(() => r.context.watch("rootElement")),
1793
1741
  ae(Z),
1794
1742
  X((m) => et(m)),
1795
- vn(100),
1743
+ bn(100),
1796
1744
  ae(Z),
1797
1745
  N(() => {
1798
1746
  r?.layout();
1799
1747
  })
1800
- ), l = $i(r);
1748
+ ), l = Pi(r);
1801
1749
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1802
1750
  Ct(1),
1803
1751
  N(() => {
@@ -1807,7 +1755,7 @@ const Ri = (n) => O([
1807
1755
  ).subscribe();
1808
1756
  const d = r.spine.pages.pipe(
1809
1757
  Ze({ refCount: !0, bufferSize: 1 })
1810
- ), p = Ei(r), g = Ri(r), h = Li(r);
1758
+ ), p = Mi(r), g = Ei(r), h = Ti(r);
1811
1759
  return P(
1812
1760
  c,
1813
1761
  l,
@@ -1824,10 +1772,10 @@ const Ri = (n) => O([
1824
1772
  settings: a,
1825
1773
  layout$: r.spine.layout$,
1826
1774
  layoutInfo$: d,
1827
- coordinates: xi(r)
1775
+ coordinates: wi(r)
1828
1776
  };
1829
1777
  };
1830
- class Ni extends Se {
1778
+ class Ri extends Se {
1831
1779
  getImageElement() {
1832
1780
  const e = this.documentContainer;
1833
1781
  if (e instanceof HTMLImageElement)
@@ -1879,12 +1827,12 @@ class Ni extends Se {
1879
1827
  getDocumentFrame() {
1880
1828
  }
1881
1829
  }
1882
- const Oi = (n) => (e) => {
1830
+ const Ai = (n) => (e) => {
1883
1831
  const t = n({
1884
1832
  ...e,
1885
1833
  getRenderer(r) {
1886
1834
  const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
1887
- return !a && u ? (l) => new Ni(l) : a;
1835
+ return !a && u ? (l) => new Ri(l) : a;
1888
1836
  }
1889
1837
  }), i = new IntersectionObserver(
1890
1838
  (r) => {
@@ -1934,15 +1882,15 @@ const Oi = (n) => (e) => {
1934
1882
  i.disconnect(), o.disconnect(), t.destroy();
1935
1883
  }
1936
1884
  };
1937
- }, Vi = (n, e) => n.links$.pipe(
1885
+ }, Ni = (n, e) => n.links$.pipe(
1938
1886
  x((t) => {
1939
- if (!On(t.target, "a") || t.type !== "click") return;
1887
+ if (!Nn(t.target, "a") || t.type !== "click") return;
1940
1888
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1941
1889
  n.context.manifest?.spineItems.some(
1942
1890
  (r) => r.href === o
1943
1891
  ) && e.goToUrl(i);
1944
1892
  })
1945
- ), ee = D.namespace("navigation"), ji = ({
1893
+ ), ee = D.namespace("navigation"), Oi = ({
1946
1894
  position: n,
1947
1895
  spineItem: e,
1948
1896
  pageHeight: t,
@@ -1974,7 +1922,7 @@ const Oi = (n) => (e) => {
1974
1922
  const u = o.getSpineItemPositionFromSpinePosition(
1975
1923
  n,
1976
1924
  a
1977
- ), l = ji({
1925
+ ), l = Oi({
1978
1926
  position: u,
1979
1927
  spineItem: a,
1980
1928
  pageHeight: s.pageSize.height,
@@ -1996,7 +1944,7 @@ const Oi = (n) => (e) => {
1996
1944
  x: 0
1997
1945
  })
1998
1946
  );
1999
- }, ki = ({
1947
+ }, Vi = ({
2000
1948
  position: n,
2001
1949
  spineItem: e,
2002
1950
  context: t,
@@ -2040,7 +1988,7 @@ const Oi = (n) => (e) => {
2040
1988
  return i.getAdjustedPositionForSpread(l);
2041
1989
  }
2042
1990
  return i.getAdjustedPositionForSpread(u);
2043
- }, Ui = ({
1991
+ }, ji = ({
2044
1992
  position: n,
2045
1993
  spineItem: e,
2046
1994
  pageHeight: t,
@@ -2072,7 +2020,7 @@ const Oi = (n) => (e) => {
2072
2020
  const u = o.getSpineItemPositionFromSpinePosition(
2073
2021
  n,
2074
2022
  a
2075
- ), l = Ui({
2023
+ ), l = ji({
2076
2024
  position: u,
2077
2025
  spineItem: a,
2078
2026
  pageHeight: s.pageSize.height,
@@ -2094,7 +2042,7 @@ const Oi = (n) => (e) => {
2094
2042
  x: 0
2095
2043
  })
2096
2044
  );
2097
- }, zi = ({
2045
+ }, ki = ({
2098
2046
  position: n,
2099
2047
  spineItem: e,
2100
2048
  context: t,
@@ -2142,7 +2090,7 @@ const Oi = (n) => (e) => {
2142
2090
  }
2143
2091
  return i.getAdjustedPositionForSpread(u);
2144
2092
  };
2145
- class Wi {
2093
+ class Ui {
2146
2094
  constructor(e) {
2147
2095
  this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2148
2096
  }
@@ -2161,7 +2109,7 @@ class Wi {
2161
2109
  turnRightOrBottom() {
2162
2110
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2163
2111
  if (!t) return;
2164
- const i = zi({
2112
+ const i = ki({
2165
2113
  context: this.reader.context,
2166
2114
  navigationResolver: this.reader.navigation.navigationResolver,
2167
2115
  position: e.position,
@@ -2179,7 +2127,7 @@ class Wi {
2179
2127
  turnLeftOrTop() {
2180
2128
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2181
2129
  if (!t) return;
2182
- const i = ki({
2130
+ const i = Vi({
2183
2131
  context: this.reader.context,
2184
2132
  navigationResolver: this.reader.navigation.navigationResolver,
2185
2133
  position: e.position,
@@ -2321,7 +2269,7 @@ class Wi {
2321
2269
  }
2322
2270
  }
2323
2271
  }
2324
- class _i extends Q {
2272
+ class zi extends Q {
2325
2273
  constructor(e) {
2326
2274
  super({
2327
2275
  lastDelta: { x: 0, y: 0 },
@@ -2386,8 +2334,8 @@ class G {
2386
2334
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
2387
2335
  }
2388
2336
  }
2389
- const Hi = 500;
2390
- class Bi extends G {
2337
+ const Wi = 500;
2338
+ class _i extends G {
2391
2339
  constructor(e, t) {
2392
2340
  super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new R(), this.navigation$ = this.navigationSubject.asObservable();
2393
2341
  const i = this.scrollNavigationController.userScroll$.pipe(
@@ -2398,7 +2346,7 @@ class Bi extends G {
2398
2346
  v(o)
2399
2347
  ).pipe(
2400
2348
  be(
2401
- Hi,
2349
+ Wi,
2402
2350
  ce
2403
2351
  ),
2404
2352
  V(),
@@ -2421,7 +2369,7 @@ class Bi extends G {
2421
2369
  P(i).pipe($(this.destroy$)).subscribe();
2422
2370
  }
2423
2371
  }
2424
- const Xi = (n) => n.pagination.state$.pipe(
2372
+ const Hi = (n) => n.pagination.state$.pipe(
2425
2373
  z(n.context.manifest$, n.settings.values$),
2426
2374
  S(
2427
2375
  ([
@@ -2441,7 +2389,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2441
2389
  }
2442
2390
  ),
2443
2391
  k(U)
2444
- ), Yi = ({ reader: n, duration: e }) => (t) => {
2392
+ ), Bi = ({ reader: n, duration: e }) => (t) => {
2445
2393
  let i;
2446
2394
  const o = () => {
2447
2395
  i?.(), i = void 0;
@@ -2450,18 +2398,18 @@ const Xi = (n) => n.pagination.state$.pipe(
2450
2398
  x(() => {
2451
2399
  i || (i = n?.navigation.lock());
2452
2400
  }),
2453
- un(e, ce, {
2401
+ cn(e, ce, {
2454
2402
  trailing: !0,
2455
2403
  leading: !0
2456
2404
  }),
2457
2405
  x(o),
2458
2406
  pe(o)
2459
2407
  );
2460
- }, qi = (n) => (e) => {
2461
- const t = n(e), i = Xi(t), o = new Wi(t), s = new _i(t), r = new Bi(
2408
+ }, Xi = (n) => (e) => {
2409
+ const t = n(e), i = Hi(t), o = new Ui(t), s = new zi(t), r = new _i(
2462
2410
  t.navigation.scrollNavigationController,
2463
2411
  t.navigation.locker
2464
- ), a = Vi(t, o), c = r.navigation$.pipe(
2412
+ ), a = Ni(t, o), c = r.navigation$.pipe(
2465
2413
  x((d) => {
2466
2414
  t.navigation.navigate(d);
2467
2415
  })
@@ -2478,7 +2426,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2478
2426
  navigation: {
2479
2427
  ...t.navigation,
2480
2428
  state$: i,
2481
- throttleLock: ({ duration: d, trigger: p }) => p.pipe(Yi({ duration: d, reader: t })),
2429
+ throttleLock: ({ duration: d, trigger: p }) => p.pipe(Bi({ duration: d, reader: t })),
2482
2430
  panNavigator: s,
2483
2431
  turnBottom: o.turnBottom.bind(o),
2484
2432
  turnTop: o.turnTop.bind(o),
@@ -2501,7 +2449,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2501
2449
  goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
2502
2450
  }
2503
2451
  };
2504
- }, Bt = (n, e, t) => {
2452
+ }, Ht = (n, e, t) => {
2505
2453
  const i = t.spineItems.findIndex(
2506
2454
  (o) => o.href === n
2507
2455
  );
@@ -2518,7 +2466,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2518
2466
  const m = {
2519
2467
  title: s.title,
2520
2468
  path: s.path
2521
- }, y = Bt(n, s.contents, t);
2469
+ }, y = Ht(n, s.contents, t);
2522
2470
  return y ? {
2523
2471
  ...m,
2524
2472
  subChapter: y
@@ -2526,19 +2474,19 @@ const Xi = (n) => n.pagination.state$.pipe(
2526
2474
  }
2527
2475
  return o;
2528
2476
  }, void 0);
2529
- }, Gi = (n, e) => {
2477
+ }, Yi = (n, e) => {
2530
2478
  const { href: t } = e;
2531
- return Bt(t, n.nav?.toc ?? [], n);
2532
- }, Zi = (n) => {
2479
+ return Ht(t, n.nav?.toc ?? [], n);
2480
+ }, qi = (n) => {
2533
2481
  const e = n.context.manifest, t = n.spineItemsManager.items;
2534
2482
  return e ? t.reduce(
2535
- (i, { item: o }) => (i[o.id] = Gi(e, o), i),
2483
+ (i, { item: o }) => (i[o.id] = Yi(e, o), i),
2536
2484
  {}
2537
2485
  ) : {};
2538
- }, Ji = (n) => n.spineItemsManager.items$.pipe(
2486
+ }, Gi = (n) => n.spineItemsManager.items$.pipe(
2539
2487
  ne([]),
2540
- S(() => Zi(n))
2541
- ), Ki = (n, e, t) => n + e * t, Qi = (n, e, t) => {
2488
+ S(() => qi(n))
2489
+ ), Zi = (n, e, t) => n + e * t, Ji = (n, e, t) => {
2542
2490
  const { height: i, width: o } = t.layout.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
2543
2491
  return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2544
2492
  0,
@@ -2553,7 +2501,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2553
2501
  (e.x - r + n.viewport.absoluteViewport.width) / o
2554
2502
  )
2555
2503
  );
2556
- }, eo = (n, e, t, i, o) => o.isReady$.pipe(
2504
+ }, Ki = (n, e, t, i, o) => o.isReady$.pipe(
2557
2505
  V(),
2558
2506
  z(n.layoutInfo$),
2559
2507
  S(([s, r]) => {
@@ -2563,17 +2511,17 @@ const Xi = (n) => n.pagination.state$.pipe(
2563
2511
  let m = (t + 1) * (h / g);
2564
2512
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2565
2513
  let y = l + m;
2566
- return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Qi(
2514
+ return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Ji(
2567
2515
  n,
2568
2516
  i,
2569
2517
  o
2570
- ) : m = 0, y = Ki(
2518
+ ) : m = 0, y = Zi(
2571
2519
  l,
2572
2520
  h,
2573
2521
  m
2574
2522
  )), e === u - 1 && t === g - 1 && y > 0.99 ? 1 : y;
2575
2523
  })
2576
- ), to = (n) => n.spine.layout$.pipe(
2524
+ ), Qi = (n) => n.spine.layout$.pipe(
2577
2525
  be(10, ce),
2578
2526
  z(n.pagination.state$),
2579
2527
  S(() => ({
@@ -2591,7 +2539,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2591
2539
  numberOfPagesPerItems: [],
2592
2540
  numberOfTotalPages: 0
2593
2541
  })
2594
- ), no = (n, e, t, i) => {
2542
+ ), eo = (n, e, t, i) => {
2595
2543
  const o = e.beginSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.beginSpineItemIndex) : void 0, s = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2596
2544
  return v({
2597
2545
  ...e,
@@ -2622,7 +2570,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2622
2570
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2623
2571
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2624
2572
  });
2625
- }, io = (n) => O([
2573
+ }, to = (n) => O([
2626
2574
  n.pagination.state$,
2627
2575
  // Usually pagination change if layout changes (number of pages) however it is especially
2628
2576
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2631,7 +2579,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2631
2579
  ]).pipe(
2632
2580
  w(([e]) => {
2633
2581
  const t = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2634
- return t ? eo(
2582
+ return t ? Ki(
2635
2583
  n,
2636
2584
  e.endSpineItemIndex ?? 0,
2637
2585
  e.endPageIndexInSpineItem || 0,
@@ -2639,8 +2587,8 @@ const Xi = (n) => n.pagination.state$.pipe(
2639
2587
  t
2640
2588
  ) : v(0);
2641
2589
  })
2642
- ), oo = (n) => {
2643
- const e = Ji(n), t = to(n), i = new Y({
2590
+ ), no = (n) => {
2591
+ const e = Gi(n), t = Qi(n), i = new Y({
2644
2592
  ...n.pagination.state,
2645
2593
  beginChapterInfo: void 0,
2646
2594
  beginCfi: void 0,
@@ -2658,10 +2606,10 @@ const Xi = (n) => n.pagination.state$.pipe(
2658
2606
  }), o = O([
2659
2607
  n.pagination.state$,
2660
2608
  e,
2661
- io(n)
2609
+ to(n)
2662
2610
  ]).pipe(
2663
2611
  w(
2664
- ([r, a, c]) => no(
2612
+ ([r, a, c]) => eo(
2665
2613
  n,
2666
2614
  r,
2667
2615
  a,
@@ -2699,13 +2647,13 @@ const Xi = (n) => n.pagination.state$.pipe(
2699
2647
  }, me = (n) => We({
2700
2648
  spineIndex: n.index,
2701
2649
  spineId: n.id
2702
- }), Xt = ({
2650
+ }), Bt = ({
2703
2651
  nodeOrRange: n,
2704
2652
  offset: e,
2705
2653
  item: t
2706
2654
  }) => {
2707
2655
  const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
2708
- return !i || !i?.documentElement || n === i ? me(t) : Vn(n) ? We({
2656
+ return !i || !i?.documentElement || n === i ? me(t) : On(n) ? We({
2709
2657
  start: {
2710
2658
  node: n.startContainer,
2711
2659
  offset: n.startOffset,
@@ -2732,25 +2680,25 @@ const Xi = (n) => n.pagination.state$.pipe(
2732
2680
  const o = t.pages.value.pages.find(
2733
2681
  (r) => r.itemIndex === e.index && r.pageIndex === n
2734
2682
  )?.firstVisibleNode, s = e.renderer.getDocumentFrame();
2735
- return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Xt({
2683
+ return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Bt({
2736
2684
  nodeOrRange: o.node,
2737
2685
  offset: o.offset,
2738
2686
  item: e.item
2739
2687
  }).trim() : me(e.item);
2740
- }, so = (n, e) => Xt({
2688
+ }, io = (n, e) => Bt({
2741
2689
  nodeOrRange: n,
2742
2690
  item: e
2743
- }), Qs = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Xe = (n) => {
2691
+ }), Js = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Xe = (n) => {
2744
2692
  const e = Et(n);
2745
- return Pn(e);
2746
- }, ro = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
2747
- const e = Et(n), s = ((ro(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = xn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2693
+ return wn(e);
2694
+ }, oo = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
2695
+ const e = Et(n), s = ((oo(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2748
2696
  return {
2749
2697
  isCfiRange: r,
2750
2698
  itemIndex: s,
2751
2699
  offset: a ?? 0
2752
2700
  };
2753
- }, Yt = ({
2701
+ }, Xt = ({
2754
2702
  cfi: n,
2755
2703
  spineItemsManager: e
2756
2704
  }) => {
@@ -2766,7 +2714,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2766
2714
  const r = s.contentWindow?.document;
2767
2715
  if (r)
2768
2716
  try {
2769
- const a = $n(n, r, {
2717
+ const a = xn(n, r, {
2770
2718
  throwOnError: !0
2771
2719
  });
2772
2720
  return {
@@ -2793,7 +2741,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2793
2741
  spineItem: o,
2794
2742
  node: null
2795
2743
  };
2796
- }, ao = (n, e) => {
2744
+ }, so = (n, e) => {
2797
2745
  if ("cfi" in e) {
2798
2746
  const { itemIndex: s, ...r } = n.cfi.parseCfi(e.cfi);
2799
2747
  return {
@@ -2813,7 +2761,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2813
2761
  itemIndex: t.index,
2814
2762
  node: null
2815
2763
  };
2816
- }, co = (n, e) => {
2764
+ }, ro = (n, e) => {
2817
2765
  let t = n?.itemPageIndex;
2818
2766
  const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
2819
2767
  return s ? Vt().pipe(
@@ -2846,7 +2794,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2846
2794
  })
2847
2795
  ) : v({ ...n, itemIndex: i, ...o });
2848
2796
  };
2849
- class uo {
2797
+ class ao {
2850
2798
  constructor(e) {
2851
2799
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (t) => {
2852
2800
  const i = this.locatorsByKey.get(t);
@@ -2854,7 +2802,7 @@ class uo {
2854
2802
  }, this.locate = (t, i) => {
2855
2803
  const o = {
2856
2804
  resource: t,
2857
- meta: ao(this.reader, t)
2805
+ meta: so(this.reader, t)
2858
2806
  };
2859
2807
  return ct(() => {
2860
2808
  const s = this.reader.spineItemsManager.get(
@@ -2879,7 +2827,7 @@ class uo {
2879
2827
  const d = this.reader.spine.layout$.pipe(
2880
2828
  be(10),
2881
2829
  ne(o),
2882
- ln((p) => co(p.meta, this.reader).pipe(
2830
+ un((p) => ro(p.meta, this.reader).pipe(
2883
2831
  S((g) => ({
2884
2832
  ...p,
2885
2833
  meta: g
@@ -2898,14 +2846,14 @@ class uo {
2898
2846
  return Array.isArray(e) ? ct(
2899
2847
  () => O(
2900
2848
  e.map((i) => this.locate(i, t ?? {}))
2901
- ).pipe(dn([]))
2849
+ ).pipe(ln([]))
2902
2850
  ) : this.locate(e, t ?? {});
2903
2851
  }
2904
2852
  }
2905
- const lo = (n) => (e) => {
2906
- const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = oo(t);
2853
+ const co = (n) => (e) => {
2854
+ const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = no(t);
2907
2855
  i.pipe($(t.$.destroy$)).subscribe();
2908
- const s = new uo(t);
2856
+ const s = new ao(t);
2909
2857
  return {
2910
2858
  ...t,
2911
2859
  locateResource: s.locateResource.bind(s),
@@ -2919,7 +2867,7 @@ const lo = (n) => (e) => {
2919
2867
  }
2920
2868
  }
2921
2869
  };
2922
- }, po = (n) => ({
2870
+ }, uo = (n) => ({
2923
2871
  put: (s, r) => new Promise((a, c) => {
2924
2872
  const u = n.transaction(["store"], "readwrite");
2925
2873
  u.onerror = (p) => {
@@ -2976,11 +2924,11 @@ const lo = (n) => (e) => {
2976
2924
  i.onerror = (o) => {
2977
2925
  t(o);
2978
2926
  }, i.onsuccess = () => {
2979
- e(po(i.result));
2927
+ e(uo(i.result));
2980
2928
  }, i.onupgradeneeded = () => {
2981
2929
  i.result.createObjectStore("store");
2982
2930
  };
2983
- }), go = (n) => {
2931
+ }), lo = (n) => {
2984
2932
  let e = Date.now().toString();
2985
2933
  const t = new R(), i = (c) => {
2986
2934
  if (typeof c == "string" || typeof c == "object") {
@@ -3000,10 +2948,10 @@ const lo = (n) => (e) => {
3000
2948
  t.next({ id: c, data: u });
3001
2949
  };
3002
2950
  t.asObservable().pipe(
3003
- wn(({ id: c, data: u }) => {
2951
+ vn(({ id: c, data: u }) => {
3004
2952
  const l = i(c);
3005
2953
  return l ? A(
3006
- pn([Oe("prose-reader"), A(u.blob())])
2954
+ dn([Oe("prose-reader"), A(u.blob())])
3007
2955
  ).pipe(
3008
2956
  X(([d, p]) => A(d.put(`${e}_${l.id}`, p))),
3009
2957
  rt((d) => (D.error(d), _))
@@ -3038,8 +2986,8 @@ const lo = (n) => (e) => {
3038
2986
  t.complete();
3039
2987
  }
3040
2988
  };
3041
- }, ho = (n) => (e) => {
3042
- const t = n(e), i = go(t.context);
2989
+ }, po = (n) => (e) => {
2990
+ const t = n(e), i = lo(t.context);
3043
2991
  return {
3044
2992
  ...t,
3045
2993
  // $: {
@@ -3051,7 +2999,7 @@ const lo = (n) => (e) => {
3051
2999
  }
3052
3000
  // load,
3053
3001
  };
3054
- }, mo = (n, e) => {
3002
+ }, go = (n, e) => {
3055
3003
  const t = n.node.ownerDocument?.createRange(), i = n.node.compareDocumentPosition(e.node);
3056
3004
  if (t) {
3057
3005
  try {
@@ -3071,14 +3019,14 @@ const lo = (n) => (e) => {
3071
3019
  }
3072
3020
  return t;
3073
3021
  }
3074
- }, fo = ({
3022
+ }, ho = ({
3075
3023
  selection: n,
3076
3024
  spineItem: e
3077
3025
  }) => {
3078
3026
  const { anchorNode: t, anchorOffset: i, focusNode: o, focusOffset: s } = n;
3079
3027
  if (!(!t || !o))
3080
3028
  try {
3081
- return mo(
3029
+ return go(
3082
3030
  { node: t, offset: i },
3083
3031
  { node: o, offset: s }
3084
3032
  );
@@ -3090,7 +3038,7 @@ const lo = (n) => (e) => {
3090
3038
  return;
3091
3039
  }
3092
3040
  };
3093
- class yo extends G {
3041
+ class mo extends G {
3094
3042
  constructor(e) {
3095
3043
  super();
3096
3044
  const t = e.contentDocument || e.contentWindow?.document;
@@ -3145,11 +3093,11 @@ class yo extends G {
3145
3093
  }
3146
3094
  }
3147
3095
  }
3148
- const So = (n) => n.watch("isLoaded").pipe(
3096
+ const fo = (n) => n.watch("isLoaded").pipe(
3149
3097
  w(() => {
3150
3098
  const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
3151
3099
  if (!e || !t) return he;
3152
- const i = new yo(e);
3100
+ const i = new mo(e);
3153
3101
  return P(
3154
3102
  i.selectionChange$.pipe(
3155
3103
  S((o) => {
@@ -3176,14 +3124,14 @@ const So = (n) => n.watch("isLoaded").pipe(
3176
3124
  );
3177
3125
  }),
3178
3126
  k()
3179
- ), Io = (n) => (e) => {
3127
+ ), yo = (n) => (e) => {
3180
3128
  const t = n(e);
3181
3129
  let i;
3182
3130
  const o = t.spineItemsManager.items$.pipe(
3183
3131
  w((l) => {
3184
3132
  const d = l.map((p) => {
3185
3133
  const g = t.spineItemsManager.getSpineItemIndex(p) ?? 0;
3186
- return So(p).pipe(
3134
+ return fo(p).pipe(
3187
3135
  S((h) => {
3188
3136
  if (h)
3189
3137
  return {
@@ -3231,7 +3179,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3231
3179
  selectionOver$: c,
3232
3180
  lastSelectionOnPointerdown$: u,
3233
3181
  getSelection: () => i,
3234
- createOrderedRangeFromSelection: fo
3182
+ createOrderedRangeFromSelection: ho
3235
3183
  }
3236
3184
  };
3237
3185
  }, ht = [
@@ -3249,7 +3197,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3249
3197
  backgroundColor: "#191717",
3250
3198
  foregroundColor: "#f1ebeb"
3251
3199
  }
3252
- ], bo = (n) => (e) => {
3200
+ ], So = (n) => (e) => {
3253
3201
  const t = n(e), i = new Y(
3254
3202
  e.theme ?? "bright"
3255
3203
  ), o = () => {
@@ -3314,7 +3262,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3314
3262
  }
3315
3263
  }
3316
3264
  };
3317
- }, vo = (n) => (e) => {
3265
+ }, Io = (n) => (e) => {
3318
3266
  const t = n(e);
3319
3267
  return {
3320
3268
  ...t,
@@ -3328,7 +3276,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3328
3276
  };
3329
3277
  };
3330
3278
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3331
- const wo = (n) => (e) => n(e), Po = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
3279
+ const bo = (n) => (e) => n(e), vo = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
3332
3280
  const { clientWidth: i, clientHeight: o } = t.value.element, s = {
3333
3281
  maxX: 0,
3334
3282
  minX: i * (1 - e),
@@ -3339,30 +3287,30 @@ const wo = (n) => (e) => n(e), Po = "[data-prose-reader-scroll-navigator][data-p
3339
3287
  x: Math.min(Math.max(n.x, s.minX), s.maxX),
3340
3288
  y: Math.min(Math.max(n.y, s.minY), s.maxY)
3341
3289
  };
3342
- }, xo = (n, e, t) => {
3290
+ }, wo = (n, e, t) => {
3343
3291
  t.style.transformOrigin = "0 0";
3344
3292
  const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${n})`;
3345
3293
  t.style.transform = `${i} ${o}`;
3346
- }, $o = (n, e, t, i) => {
3294
+ }, Po = (n, e, t, i) => {
3347
3295
  const o = e / n, s = t.clientWidth, r = t.clientHeight, a = s / 2 - i.x, c = r / 2 - i.y;
3348
3296
  return {
3349
3297
  x: i.x + a * (1 - o),
3350
3298
  y: i.y + c * (1 - o)
3351
3299
  };
3352
3300
  };
3353
- class qt {
3301
+ class Yt {
3354
3302
  constructor(e) {
3355
3303
  this.x = e.x, this.y = e.y;
3356
3304
  }
3357
3305
  }
3358
- class ft extends qt {
3306
+ class ft extends Yt {
3359
3307
  }
3360
- class To extends qt {
3308
+ class xo extends Yt {
3361
3309
  constructor() {
3362
3310
  super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("UnboundScrollPosition");
3363
3311
  }
3364
3312
  }
3365
- class Fo extends Q {
3313
+ class $o extends Q {
3366
3314
  constructor(e, t, i, o, s) {
3367
3315
  super({
3368
3316
  element: void 0
@@ -3388,7 +3336,7 @@ class Fo extends Q {
3388
3336
  x(({ rootElement: d }) => {
3389
3337
  if (!d) return;
3390
3338
  const p = document.createElement("div");
3391
- p.setAttribute(`data-${ri}`, ""), p.appendChild(this.viewport.value.element), d.appendChild(p), this.update({ element: p });
3339
+ p.setAttribute(`data-${si}`, ""), p.appendChild(this.viewport.value.element), d.appendChild(p), this.update({ element: p });
3392
3340
  })
3393
3341
  ), a = O([
3394
3342
  t.watch(["computedPageTurnMode"]),
@@ -3477,15 +3425,15 @@ class Fo extends Q {
3477
3425
  });
3478
3426
  }
3479
3427
  }
3480
- const Lo = (n, e, t, i, o) => {
3428
+ const To = (n, e, t, i, o) => {
3481
3429
  const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, d = t / e, p = u * d, g = l * d, h = p - s / 2 + i, m = g - r / 2 + o;
3482
- return new To({
3430
+ return new xo({
3483
3431
  x: h,
3484
3432
  y: m
3485
3433
  });
3486
- }, Mo = (n, e) => {
3487
- const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l = Lo(
3488
- s ?? An(),
3434
+ }, Fo = (n, e) => {
3435
+ const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l = To(
3436
+ s ?? Rn(),
3489
3437
  a,
3490
3438
  n,
3491
3439
  c,
@@ -3502,7 +3450,7 @@ const Lo = (n, e, t, i, o) => {
3502
3450
  position: p
3503
3451
  });
3504
3452
  }, we = 200;
3505
- class Co extends Q {
3453
+ class Lo extends Q {
3506
3454
  constructor(e) {
3507
3455
  super({
3508
3456
  isZooming: !1,
@@ -3572,7 +3520,7 @@ class Co extends Q {
3572
3520
  }
3573
3521
  updateZoom(e, t, i) {
3574
3522
  if (this.isControlled) {
3575
- const o = t || $o(
3523
+ const o = t || Po(
3576
3524
  this.value.currentScale,
3577
3525
  e,
3578
3526
  this.viewport.element,
@@ -3588,11 +3536,11 @@ class Co extends Q {
3588
3536
  });
3589
3537
  }
3590
3538
  applyZoom(e, t) {
3591
- this.isControlled ? xo(
3539
+ this.isControlled ? wo(
3592
3540
  e,
3593
3541
  t,
3594
3542
  this.viewport.element
3595
- ) : Mo(e, this.reader);
3543
+ ) : Fo(e, this.reader);
3596
3544
  }
3597
3545
  get isControlled() {
3598
3546
  return this.reader.settings.values.computedPageTurnMode === "controlled";
@@ -3604,9 +3552,9 @@ class Co extends Q {
3604
3552
  return this.reader.viewport.value;
3605
3553
  }
3606
3554
  }
3607
- const yt = `${Ut}-enhancer-zoom`, Eo = (n) => (e) => {
3608
- const t = n(e), i = new Co(t);
3609
- Ce(document, yt, Po);
3555
+ const yt = `${Ut}-enhancer-zoom`, Mo = (n) => (e) => {
3556
+ const t = n(e), i = new Lo(t);
3557
+ Ce(document, yt, vo);
3610
3558
  const o = () => {
3611
3559
  Ee(document, yt), i.destroy(), t.destroy();
3612
3560
  }, s = i;
@@ -3624,8 +3572,8 @@ const yt = `${Ut}-enhancer-zoom`, Eo = (n) => (e) => {
3624
3572
  }
3625
3573
  }
3626
3574
  };
3627
- }, Gt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3628
- class Do {
3575
+ }, qt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3576
+ class Co {
3629
3577
  constructor() {
3630
3578
  this.navigationSubject = new ot(1), this.viewportStateSubject = new Y("free"), this.paginationSubject = new ot(), this.navigationIsLockedSubject = new Y(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3631
3579
  k(),
@@ -3637,11 +3585,11 @@ class Do {
3637
3585
  ), this.navigation$ = this.navigationSubject.asObservable();
3638
3586
  }
3639
3587
  }
3640
- class Ro extends Q {
3588
+ class Eo extends Q {
3641
3589
  constructor() {
3642
3590
  super({
3643
3591
  assumedRenditionLayout: "reflowable"
3644
- }), this.bridgeEvent = new Do(), this.manifest$ = this.pipe(
3592
+ }), this.bridgeEvent = new Co(), this.manifest$ = this.pipe(
3645
3593
  ie((e) => e.manifest),
3646
3594
  ae(Z),
3647
3595
  fe()
@@ -3652,7 +3600,7 @@ class Ro extends Q {
3652
3600
  ...t,
3653
3601
  ...e,
3654
3602
  ...e.manifest && {
3655
- isFullyPrePaginated: Gt(i),
3603
+ isFullyPrePaginated: qt(i),
3656
3604
  assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
3657
3605
  }
3658
3606
  };
@@ -3665,7 +3613,7 @@ class Ro extends Q {
3665
3613
  return this.manifest?.readingDirection;
3666
3614
  }
3667
3615
  }
3668
- class Ao extends Q {
3616
+ class Do extends Q {
3669
3617
  constructor(e, t) {
3670
3618
  super({
3671
3619
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3700,7 +3648,7 @@ class Ao extends Q {
3700
3648
  ).subscribe(this.next.bind(this));
3701
3649
  }
3702
3650
  }
3703
- class No {
3651
+ class Ro {
3704
3652
  constructor() {
3705
3653
  this._hooks = [], this._hookExecutions = [];
3706
3654
  }
@@ -3762,17 +3710,17 @@ class No {
3762
3710
  return O(s);
3763
3711
  }
3764
3712
  }
3765
- const Oo = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", Vo = (n) => ({
3713
+ const Ao = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", No = (n) => ({
3766
3714
  x: -n.x,
3767
3715
  y: -n.y
3768
- }), jo = (n) => n instanceof DOMMatrix ? new L({
3716
+ }), Oo = (n) => n instanceof DOMMatrix ? new L({
3769
3717
  x: -n.e,
3770
3718
  y: -n.f
3771
3719
  }) : new L({
3772
3720
  x: -n.x,
3773
3721
  y: -n.y
3774
- }), ko = "navigation/ViewportNavigator", St = D.namespace(ko);
3775
- class Uo extends G {
3722
+ }), Vo = "navigation/ViewportNavigator", St = D.namespace(Vo);
3723
+ class jo extends G {
3776
3724
  constructor(e, t, i, o, s) {
3777
3725
  super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new R(), this.element$ = new Y(
3778
3726
  document.createElement("div")
@@ -3884,7 +3832,7 @@ class Uo extends G {
3884
3832
  * for remark about flicker / fonts smoothing
3885
3833
  */
3886
3834
  setViewportPosition(e) {
3887
- const t = this.element$.getValue(), i = Vo(e);
3835
+ const t = this.element$.getValue(), i = No(e);
3888
3836
  t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3889
3837
  }
3890
3838
  navigate(e) {
@@ -3899,10 +3847,10 @@ class Uo extends G {
3899
3847
  if (!i || i === "none")
3900
3848
  return new L({ x: 0, y: 0 });
3901
3849
  const o = new DOMMatrix(i);
3902
- return jo(o);
3850
+ return Oo(o);
3903
3851
  }
3904
3852
  }
3905
- const zo = () => (n) => n.pipe(
3853
+ const ko = () => (n) => n.pipe(
3906
3854
  S(({ navigation: e, pagination: t, ...i }) => ({
3907
3855
  navigation: {
3908
3856
  ...e,
@@ -3910,7 +3858,7 @@ const zo = () => (n) => n.pipe(
3910
3858
  },
3911
3859
  ...i
3912
3860
  }))
3913
- ), Wo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3861
+ ), Uo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3914
3862
  z(e),
3915
3863
  M(
3916
3864
  ([i, o]) => i.navigationId === o.id
@@ -3927,7 +3875,7 @@ const zo = () => (n) => n.pipe(
3927
3875
  navigation: o
3928
3876
  }))
3929
3877
  )),
3930
- zo(),
3878
+ ko(),
3931
3879
  k(
3932
3880
  (i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3933
3881
  ),
@@ -3939,7 +3887,7 @@ const zo = () => (n) => n.pipe(
3939
3887
  }
3940
3888
  })
3941
3889
  )
3942
- ), _o = ({ navigationResolver: n }) => (e) => e.pipe(
3890
+ ), zo = ({ navigationResolver: n }) => (e) => e.pipe(
3943
3891
  S(([t, i]) => {
3944
3892
  const o = {
3945
3893
  type: "api",
@@ -3976,7 +3924,7 @@ const zo = () => (n) => n.pipe(
3976
3924
  navigation: o
3977
3925
  };
3978
3926
  })
3979
- ), Ho = ({ navigationResolver: n }) => (e) => e.pipe(
3927
+ ), Wo = ({ navigationResolver: n }) => (e) => e.pipe(
3980
3928
  S((t) => {
3981
3929
  if (t.navigation.cfi) {
3982
3930
  const i = n.getNavigationForCfi(
@@ -3993,16 +3941,16 @@ const zo = () => (n) => n.pipe(
3993
3941
  }
3994
3942
  return t;
3995
3943
  })
3996
- ), Bo = ({
3944
+ ), _o = ({
3997
3945
  navigation: n,
3998
3946
  previousNavigation: e,
3999
3947
  settings: t
4000
- }) => n.directionFromLastNavigation ? n.directionFromLastNavigation : n.url !== void 0 || n.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || n.spineItem || !n.position ? "forward" : t.values.computedPageTurnDirection === "vertical" ? n.position.y > e.position.y || n.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(n.position.x) > Math.abs(e.position.x) || n.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Xo = ({
3948
+ }) => n.directionFromLastNavigation ? n.directionFromLastNavigation : n.url !== void 0 || n.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || n.spineItem || !n.position ? "forward" : t.values.computedPageTurnDirection === "vertical" ? n.position.y > e.position.y || n.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(n.position.x) > Math.abs(e.position.x) || n.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Ho = ({
4001
3949
  context: n,
4002
3950
  settings: e
4003
3951
  }) => (t) => t.pipe(
4004
3952
  S(({ navigation: i, previousNavigation: o }) => {
4005
- const s = Bo({
3953
+ const s = _o({
4006
3954
  navigation: i,
4007
3955
  previousNavigation: o,
4008
3956
  settings: e
@@ -4016,7 +3964,7 @@ const zo = () => (n) => n.pipe(
4016
3964
  direction: s
4017
3965
  };
4018
3966
  })
4019
- ), Yo = ({
3967
+ ), Bo = ({
4020
3968
  spineItemsManager: n,
4021
3969
  navigationResolver: e,
4022
3970
  settings: t
@@ -4185,7 +4133,7 @@ const zo = () => (n) => n.pipe(
4185
4133
  ...a
4186
4134
  }))
4187
4135
  );
4188
- }, qo = ({ navigationResolver: n }) => (e) => e.pipe(
4136
+ }, Xo = ({ navigationResolver: n }) => (e) => e.pipe(
4189
4137
  S((t) => {
4190
4138
  if (t.navigation.url) {
4191
4139
  const i = n.getNavigationForUrl(
@@ -4204,7 +4152,7 @@ const zo = () => (n) => n.pipe(
4204
4152
  return t;
4205
4153
  })
4206
4154
  );
4207
- class Zt {
4155
+ class Gt {
4208
4156
  constructor() {
4209
4157
  this.isLockedSubject = new Y(0), this.isLocked$ = this.isLockedSubject.pipe(
4210
4158
  S((e) => !!e),
@@ -4218,7 +4166,7 @@ class Zt {
4218
4166
  };
4219
4167
  }
4220
4168
  }
4221
- const Go = ({
4169
+ const Yo = ({
4222
4170
  spineLocator: n,
4223
4171
  navigation: e,
4224
4172
  navigationResolver: t,
@@ -4275,7 +4223,7 @@ const Go = ({
4275
4223
  return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
4276
4224
  })
4277
4225
  ) : v(new L({ x: 0, y: 0 }));
4278
- }, Zo = ({
4226
+ }, qo = ({
4279
4227
  navigation: n,
4280
4228
  spineLocator: e,
4281
4229
  spineItemsManager: t,
@@ -4344,7 +4292,7 @@ const Go = ({
4344
4292
  }
4345
4293
  }
4346
4294
  return n.position;
4347
- }, Jo = ({
4295
+ }, Go = ({
4348
4296
  navigation: n,
4349
4297
  spineItemsManager: e,
4350
4298
  settings: t,
@@ -4352,7 +4300,7 @@ const Go = ({
4352
4300
  navigationResolver: o,
4353
4301
  spine: s
4354
4302
  }) => t.values.computedPageTurnMode === "scrollable" ? v(
4355
- Zo({
4303
+ qo({
4356
4304
  navigation: n,
4357
4305
  spineLocator: i,
4358
4306
  navigationResolver: o,
@@ -4360,7 +4308,7 @@ const Go = ({
4360
4308
  spineItemsManager: e,
4361
4309
  spine: s
4362
4310
  })
4363
- ) : Go({
4311
+ ) : Yo({
4364
4312
  navigation: n,
4365
4313
  spineLocator: i,
4366
4314
  navigationResolver: o,
@@ -4372,7 +4320,7 @@ const Go = ({
4372
4320
  context: t,
4373
4321
  spine: i
4374
4322
  }) => (o) => o.pipe(
4375
- w((s) => Jo({
4323
+ w((s) => Go({
4376
4324
  spineLocator: i.locator,
4377
4325
  navigation: s.navigation,
4378
4326
  navigationResolver: e,
@@ -4389,8 +4337,8 @@ const Go = ({
4389
4337
  }
4390
4338
  }))
4391
4339
  ))
4392
- ), Ko = "navigation/InternalNavigator", Qo = D.namespace(Ko);
4393
- class es extends G {
4340
+ ), Zo = "navigation/InternalNavigator", Jo = D.namespace(Zo);
4341
+ class Ko extends G {
4394
4342
  constructor(e, t, i, o, s, r, a, c) {
4395
4343
  super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isRestorationLocked$ = c, this.navigationSubject = new Y({
4396
4344
  animation: !1,
@@ -4410,27 +4358,27 @@ class es extends G {
4410
4358
  ({ position: f, ...I }, { position: b, ...F }) => U(I, F) && U(f, b)
4411
4359
  ),
4412
4360
  J(1)
4413
- ), this.locker = new Zt();
4361
+ ), this.locker = new Gt();
4414
4362
  const u = i.pipe(
4415
4363
  z(this.navigationSubject),
4416
- _o({
4364
+ zo({
4417
4365
  navigationResolver: r
4418
4366
  }),
4419
4367
  /**
4420
4368
  * Url lookup is heavier so we start with it to fill
4421
4369
  * as much information as needed to reduce later lookup
4422
4370
  */
4423
- qo({
4371
+ Xo({
4424
4372
  navigationResolver: r
4425
4373
  }),
4426
4374
  /**
4427
4375
  * Cfi lookup is heavier so we start with it to fill
4428
4376
  * as much information as needed to reduce later lookup
4429
4377
  */
4430
- Ho({
4378
+ Wo({
4431
4379
  navigationResolver: r
4432
4380
  }),
4433
- Xo({ context: t, settings: e }),
4381
+ Ho({ context: t, settings: e }),
4434
4382
  It({
4435
4383
  navigationResolver: r,
4436
4384
  settings: e,
@@ -4447,7 +4395,7 @@ class es extends G {
4447
4395
  spine: a
4448
4396
  })
4449
4397
  ).pipe(
4450
- Yo({
4398
+ Bo({
4451
4399
  navigationResolver: r,
4452
4400
  spineItemsManager: a.spineItemsManager,
4453
4401
  settings: e
@@ -4564,7 +4512,7 @@ class es extends G {
4564
4512
  }),
4565
4513
  S(({ navigation: f }) => f),
4566
4514
  j()
4567
- ), g = Wo(
4515
+ ), g = Uo(
4568
4516
  t,
4569
4517
  this.navigationSubject,
4570
4518
  a
@@ -4574,7 +4522,7 @@ class es extends G {
4574
4522
  g
4575
4523
  ), m = (f) => f.pipe(
4576
4524
  x(([I, b]) => {
4577
- Qo.info(
4525
+ Jo.info(
4578
4526
  `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4579
4527
  {
4580
4528
  previousNavigation: b,
@@ -4632,14 +4580,14 @@ const Fe = (n, e, t) => {
4632
4580
  }, wt = (n, e, t) => {
4633
4581
  const i = [...Array(t)].map((o, s) => s * e);
4634
4582
  return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
4635
- }, ts = ({
4583
+ }, Qo = ({
4636
4584
  itemWidth: n,
4637
4585
  itemHeight: e,
4638
4586
  spineItemPosition: t
4639
4587
  }) => new C({
4640
4588
  x: Math.min(n, Math.max(0, t.x)),
4641
4589
  y: Math.min(e, Math.max(0, t.y))
4642
- }), Jt = ({
4590
+ }), Zt = ({
4643
4591
  itemHeight: n,
4644
4592
  itemWidth: e,
4645
4593
  isUsingVerticalWriting: t,
@@ -4658,11 +4606,11 @@ const Fe = (n, e, t) => {
4658
4606
  pageTurnMode: a,
4659
4607
  isRTL: c
4660
4608
  }) => {
4661
- const l = ts({
4609
+ const l = Qo({
4662
4610
  spineItemPosition: t,
4663
4611
  itemHeight: e,
4664
4612
  itemWidth: n
4665
- }).x, d = Jt({
4613
+ }).x, d = Zt({
4666
4614
  isUsingVerticalWriting: i,
4667
4615
  itemHeight: e,
4668
4616
  itemWidth: n,
@@ -4675,7 +4623,7 @@ const Fe = (n, e, t) => {
4675
4623
  return wt(t.y, s, d);
4676
4624
  const p = wt(l, o, d);
4677
4625
  return c ? d - 1 - p : p;
4678
- }, ns = ({
4626
+ }, es = ({
4679
4627
  pageIndex: n,
4680
4628
  itemLayout: e,
4681
4629
  context: t,
@@ -4705,14 +4653,14 @@ const Fe = (n, e, t) => {
4705
4653
  x: s,
4706
4654
  y: 0
4707
4655
  });
4708
- }, Kt = ({
4656
+ }, Jt = ({
4709
4657
  context: n,
4710
4658
  settings: e,
4711
4659
  viewport: t
4712
4660
  }) => {
4713
4661
  const i = (a, c, u) => {
4714
4662
  let l;
4715
- a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? En(a, c) : void 0)?.getBoundingClientRect().x || l);
4663
+ a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? Cn(a, c) : void 0)?.getBoundingClientRect().x || l);
4716
4664
  const d = u.layout.layoutInfo?.width || 0, p = t.pageSize.width;
4717
4665
  if (l !== void 0) {
4718
4666
  const g = je(
@@ -4728,7 +4676,7 @@ const Fe = (n, e, t) => {
4728
4676
  getSpineItemPositionFromPageIndex: ({
4729
4677
  pageIndex: a,
4730
4678
  spineItem: c
4731
- }) => ns({
4679
+ }) => es({
4732
4680
  context: n,
4733
4681
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4734
4682
  itemLayout: c.layout.layoutInfo,
@@ -4799,12 +4747,12 @@ const Fe = (n, e, t) => {
4799
4747
  });
4800
4748
  }
4801
4749
  };
4802
- }, is = ({
4750
+ }, ts = ({
4803
4751
  context: n,
4804
4752
  settings: e,
4805
4753
  viewport: t
4806
4754
  }) => {
4807
- const i = Kt({
4755
+ const i = Jt({
4808
4756
  context: n,
4809
4757
  settings: e,
4810
4758
  viewport: t
@@ -4828,7 +4776,7 @@ const Fe = (n, e, t) => {
4828
4776
  ) || new C({ x: 0, y: 0 })
4829
4777
  };
4830
4778
  };
4831
- function Qt({
4779
+ function Kt({
4832
4780
  position: n,
4833
4781
  isRTL: e,
4834
4782
  spineItemsManager: t,
@@ -4861,7 +4809,7 @@ const xt = ({
4861
4809
  visibleAreaRectWidth: o,
4862
4810
  spine: s
4863
4811
  }) => {
4864
- const r = Qt({
4812
+ const r = Kt({
4865
4813
  position: n,
4866
4814
  isRTL: e,
4867
4815
  spineItemsManager: i,
@@ -4914,7 +4862,7 @@ const xt = ({
4914
4862
  });
4915
4863
  }
4916
4864
  return new L({ x: 0, y: 0 });
4917
- }, os = ({
4865
+ }, ns = ({
4918
4866
  pageIndex: n,
4919
4867
  spineItemsManager: e,
4920
4868
  spineItemId: t,
@@ -4944,28 +4892,28 @@ const xt = ({
4944
4892
  pageSizeWidth: s.pageSize.width,
4945
4893
  visibleAreaRectWidth: s.absoluteViewport.width
4946
4894
  });
4947
- }, ss = (n, e) => {
4895
+ }, is = (n, e) => {
4948
4896
  if (e && e instanceof HTMLIFrameElement)
4949
4897
  return n.startsWith("#") ? e.contentDocument?.getElementById(
4950
4898
  n.replace("#", "")
4951
4899
  ) : e.contentDocument?.querySelector(n);
4952
- }, rs = ({
4900
+ }, os = ({
4953
4901
  anchor: n,
4954
4902
  spineItem: e,
4955
4903
  spine: t
4956
4904
  }) => {
4957
- const i = ss(
4905
+ const i = is(
4958
4906
  n,
4959
4907
  e.renderer.getDocumentFrame()
4960
4908
  );
4961
4909
  return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
4962
- }, as = ({
4910
+ }, ss = ({
4963
4911
  anchor: n,
4964
4912
  spineItem: e,
4965
4913
  spineLocator: t,
4966
4914
  spine: i
4967
4915
  }) => {
4968
- const o = rs({
4916
+ const o = os({
4969
4917
  anchor: n,
4970
4918
  spineItem: e,
4971
4919
  spine: i
@@ -4974,7 +4922,7 @@ const xt = ({
4974
4922
  spineItemPosition: new C({ x: o, y: 0 }),
4975
4923
  spineItem: e
4976
4924
  });
4977
- }, cs = ({
4925
+ }, rs = ({
4978
4926
  anchor: n,
4979
4927
  spineItem: e,
4980
4928
  spineLocator: t,
@@ -4982,7 +4930,7 @@ const xt = ({
4982
4930
  pageSizeWidth: o,
4983
4931
  visibleAreaRectWidth: s
4984
4932
  }) => {
4985
- const r = as({
4933
+ const r = ss({
4986
4934
  anchor: n,
4987
4935
  spineItem: e,
4988
4936
  spineLocator: t,
@@ -4993,7 +4941,7 @@ const xt = ({
4993
4941
  pageSizeWidth: o,
4994
4942
  visibleAreaRectWidth: s
4995
4943
  });
4996
- }, us = ({
4944
+ }, as = ({
4997
4945
  spine: n,
4998
4946
  spineItemsManager: e,
4999
4947
  spineLocator: t,
@@ -5009,7 +4957,7 @@ const xt = ({
5009
4957
  if (u) {
5010
4958
  const l = e.get(u.id);
5011
4959
  if (l) {
5012
- const d = cs({
4960
+ const d = rs({
5013
4961
  anchor: a.hash,
5014
4962
  spineItem: l,
5015
4963
  spine: n,
@@ -5032,7 +4980,7 @@ const xt = ({
5032
4980
  console.error(a);
5033
4981
  return;
5034
4982
  }
5035
- }, ls = ({
4983
+ }, cs = ({
5036
4984
  spineItem: n,
5037
4985
  spineItemPosition: e,
5038
4986
  spineLocator: t,
@@ -5051,7 +4999,7 @@ const xt = ({
5051
4999
  pageSizeWidth: o.pageSize.width,
5052
5000
  visibleAreaRectWidth: o.absoluteViewport.width
5053
5001
  });
5054
- }, ds = "spineNavigator", ps = ({
5002
+ }, us = "spineNavigator", ls = ({
5055
5003
  context: n,
5056
5004
  spineItemsManager: e,
5057
5005
  locator: t,
@@ -5059,13 +5007,13 @@ const xt = ({
5059
5007
  spine: o,
5060
5008
  viewport: s
5061
5009
  }) => {
5062
- const r = is({
5010
+ const r = ts({
5063
5011
  context: n,
5064
5012
  settings: i,
5065
5013
  viewport: s
5066
5014
  });
5067
5015
  return {
5068
- getNavigationForUrl: (g) => us({
5016
+ getNavigationForUrl: (g) => as({
5069
5017
  context: n,
5070
5018
  spineItemsManager: e,
5071
5019
  spineLocator: t,
@@ -5074,26 +5022,26 @@ const xt = ({
5074
5022
  visibleAreaRectWidth: s.absoluteViewport.width,
5075
5023
  spine: o
5076
5024
  }),
5077
- getNavigationForSpineItemPage: (g) => os({
5025
+ getNavigationForSpineItemPage: (g) => ns({
5078
5026
  ...g,
5079
5027
  spineItemsManager: e,
5080
5028
  spineItemNavigationResolver: r,
5081
5029
  spineLocator: t,
5082
5030
  viewport: s
5083
5031
  }),
5084
- getNavigationFromSpineItemPosition: (g) => ls({
5032
+ getNavigationFromSpineItemPosition: (g) => cs({
5085
5033
  ...g,
5086
5034
  spineItemLocator: t.spineItemLocator,
5087
5035
  spineLocator: t,
5088
5036
  viewport: s
5089
5037
  }),
5090
5038
  getNavigationForCfi: (g) => {
5091
- const h = e.getSpineItemFromCfi(g), { node: m, offset: y = 0 } = Yt({
5039
+ const h = e.getSpineItemFromCfi(g), { node: m, offset: y = 0 } = Xt({
5092
5040
  cfi: g,
5093
5041
  spineItemsManager: e
5094
5042
  });
5095
5043
  if (!h) {
5096
- D.warn(ds, `unable to detect item id from cfi ${g}`);
5044
+ D.warn(us, `unable to detect item id from cfi ${g}`);
5097
5045
  return;
5098
5046
  }
5099
5047
  const f = m ? r.getNavigationFromNode(h, m, y) : new C({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
@@ -5162,7 +5110,7 @@ const xt = ({
5162
5110
  spineItemsManager: e,
5163
5111
  spine: o
5164
5112
  }),
5165
- fromOutOfBoundsSpinePosition: (g) => Qt({
5113
+ fromOutOfBoundsSpinePosition: (g) => Kt({
5166
5114
  position: g,
5167
5115
  isRTL: n.isRTL(),
5168
5116
  spineItemsManager: e,
@@ -5178,7 +5126,7 @@ const xt = ({
5178
5126
  }),
5179
5127
  spineItemNavigator: r
5180
5128
  };
5181
- }, gs = ({
5129
+ }, ds = ({
5182
5130
  spineItemsManager: n,
5183
5131
  context: e,
5184
5132
  hookManager: t,
@@ -5186,26 +5134,26 @@ const xt = ({
5186
5134
  settings: o,
5187
5135
  viewport: s
5188
5136
  }) => {
5189
- const r = new R(), a = r.asObservable(), c = new Zt(), u = ps({
5137
+ const r = new R(), a = r.asObservable(), c = new Gt(), u = ls({
5190
5138
  context: e,
5191
5139
  settings: o,
5192
5140
  spineItemsManager: n,
5193
5141
  locator: i.locator,
5194
5142
  spine: i,
5195
5143
  viewport: s
5196
- }), l = new Uo(
5144
+ }), l = new jo(
5197
5145
  o,
5198
5146
  t,
5199
5147
  e,
5200
5148
  i,
5201
5149
  s
5202
- ), d = new Fo(
5150
+ ), d = new $o(
5203
5151
  s,
5204
5152
  o,
5205
5153
  t,
5206
5154
  i,
5207
5155
  e
5208
- ), p = new es(
5156
+ ), p = new Ko(
5209
5157
  o,
5210
5158
  e,
5211
5159
  a,
@@ -5248,7 +5196,7 @@ const xt = ({
5248
5196
  navigation$: p.navigation$
5249
5197
  };
5250
5198
  };
5251
- class hs extends Q {
5199
+ class ps extends Q {
5252
5200
  constructor(e, t) {
5253
5201
  super({
5254
5202
  beginPageIndexInSpineItem: void 0,
@@ -5266,7 +5214,7 @@ class hs extends Q {
5266
5214
  this.mergeCompare(e);
5267
5215
  }
5268
5216
  }
5269
- class ms extends G {
5217
+ class gs extends G {
5270
5218
  constructor(e, t, i, o, s) {
5271
5219
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5272
5220
  const r = P(
@@ -5344,11 +5292,11 @@ class ms extends G {
5344
5292
  P(r, a).pipe($(this.destroy$)).subscribe();
5345
5293
  }
5346
5294
  }
5347
- const fs = ({
5295
+ const hs = ({
5348
5296
  manifest: n,
5349
5297
  spreadMode: e
5350
5298
  }) => n?.renditionFlow === "scrolled-continuous" ? !1 : e;
5351
- class ys extends G {
5299
+ class ms extends G {
5352
5300
  constructor(e) {
5353
5301
  super();
5354
5302
  const t = {
@@ -5393,7 +5341,7 @@ class ys extends G {
5393
5341
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5394
5342
  }
5395
5343
  }
5396
- class Ss extends ys {
5344
+ class fs extends ms {
5397
5345
  constructor(e, t) {
5398
5346
  super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
5399
5347
  x(() => this.update(this.values)),
@@ -5406,7 +5354,7 @@ class Ss extends ys {
5406
5354
  computedPageTurnAnimation: e.pageTurnAnimation,
5407
5355
  computedPageTurnMode: e.pageTurnMode,
5408
5356
  computedPageTurnAnimationDuration: 0,
5409
- computedSpreadMode: fs({
5357
+ computedSpreadMode: hs({
5410
5358
  spreadMode: e.spreadMode,
5411
5359
  manifest: t
5412
5360
  })
@@ -5432,7 +5380,7 @@ class Ss extends ys {
5432
5380
  };
5433
5381
  }
5434
5382
  }
5435
- class Is extends Se {
5383
+ class ys extends Se {
5436
5384
  onUnload() {
5437
5385
  return _;
5438
5386
  }
@@ -5451,7 +5399,7 @@ class Is extends Se {
5451
5399
  getDocumentFrame() {
5452
5400
  }
5453
5401
  }
5454
- class bs extends G {
5402
+ class Ss extends G {
5455
5403
  constructor(e, t, i, o, s, r, a) {
5456
5404
  super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new R(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5457
5405
  blankPagePosition: c,
@@ -5481,7 +5429,7 @@ class bs extends G {
5481
5429
  }), { width: b, height: F };
5482
5430
  })
5483
5431
  ), this.layout = (c) => {
5484
- const u = Yn(this.layout$.pipe(V()));
5432
+ const u = Xn(this.layout$.pipe(V()));
5485
5433
  return this.layoutTriggerSubject.next(c), u();
5486
5434
  }, this.adjustPositionOfElement = ({
5487
5435
  right: c,
@@ -5536,7 +5484,7 @@ class bs extends G {
5536
5484
  };
5537
5485
  }
5538
5486
  }
5539
- class en extends Q {
5487
+ class Qt extends Q {
5540
5488
  constructor(e, t, i, o, s, r, a) {
5541
5489
  super({
5542
5490
  isLoaded: !1,
@@ -5554,7 +5502,7 @@ class en extends Q {
5554
5502
  });
5555
5503
  }, this.destroy = () => {
5556
5504
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5557
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = vs(
5505
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = Is(
5558
5506
  t,
5559
5507
  e,
5560
5508
  s
@@ -5570,7 +5518,7 @@ class en extends Q {
5570
5518
  resourcesHandler: this.resourcesHandler,
5571
5519
  viewport: this.viewport
5572
5520
  };
5573
- this.renderer = c ? c(u) : new Is(u), this.layout = new bs(
5521
+ this.renderer = c ? c(u) : new ys(u), this.layout = new Ss(
5574
5522
  e,
5575
5523
  this.containerElement,
5576
5524
  i,
@@ -5647,7 +5595,7 @@ class en extends Q {
5647
5595
  return this.renderer.renditionLayout;
5648
5596
  }
5649
5597
  get numberOfPages() {
5650
- return Jt({
5598
+ return Zt({
5651
5599
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
5652
5600
  itemHeight: this.layout.layoutInfo.height,
5653
5601
  itemWidth: this.layout.layoutInfo.width,
@@ -5658,21 +5606,21 @@ class en extends Q {
5658
5606
  });
5659
5607
  }
5660
5608
  }
5661
- const vs = (n, e, t) => {
5609
+ const Is = (n, e, t) => {
5662
5610
  const i = n.ownerDocument.createElement("div");
5663
5611
  return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
5664
5612
  position: absolute;
5665
5613
  overflow: hidden;
5666
5614
  `, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
5667
5615
  };
5668
- class ws extends G {
5616
+ class bs extends G {
5669
5617
  constructor(e, t, i, o, s) {
5670
5618
  super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new Y(
5671
5619
  /* @__PURE__ */ new Map()
5672
5620
  );
5673
5621
  const r = this.forcedOpenSubject.pipe(
5674
5622
  S((u) => Array.from(u.keys()).sort((l, d) => l - d)),
5675
- k(yn),
5623
+ k(fn),
5676
5624
  J({ bufferSize: 1, refCount: !0 })
5677
5625
  );
5678
5626
  P(
@@ -5720,7 +5668,7 @@ class ws extends G {
5720
5668
  super.destroy(), this.forcedOpenSubject.complete();
5721
5669
  }
5722
5670
  }
5723
- const tn = (n, e, t) => {
5671
+ const en = (n, e, t) => {
5724
5672
  const i = (t.width - e.width) / 2, o = (t.height - e.height) / 2;
5725
5673
  return new ue({
5726
5674
  x: n.x - i,
@@ -5745,17 +5693,17 @@ class Ie extends DOMRect {
5745
5693
  return new Ie(i.x, i.y, i.width, i.height);
5746
5694
  }
5747
5695
  }
5748
- class Ps {
5696
+ class vs {
5749
5697
  constructor({ width: e, height: t }) {
5750
5698
  this.__symbol = /* @__PURE__ */ Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5751
5699
  }
5752
5700
  }
5753
- class xs {
5701
+ class ws {
5754
5702
  constructor({ width: e, height: t }) {
5755
5703
  this.__symbol = /* @__PURE__ */ Symbol("RelativeViewport"), this.width = e, this.height = t;
5756
5704
  }
5757
5705
  }
5758
- const $s = ({
5706
+ const Ps = ({
5759
5707
  pageIndex: n,
5760
5708
  spineItemOrId: e,
5761
5709
  spineItemsManager: t
@@ -5777,7 +5725,7 @@ const $s = ({
5777
5725
  { currentAbsolutePage: 0, found: !1 }
5778
5726
  );
5779
5727
  return s;
5780
- }, Ts = ({
5728
+ }, xs = ({
5781
5729
  itemHeight: n,
5782
5730
  itemWidth: e,
5783
5731
  visibleWidthOfItem: t,
@@ -5786,7 +5734,7 @@ const $s = ({
5786
5734
  }) => {
5787
5735
  const s = t / e, r = i / n;
5788
5736
  return o.type === "percentage" ? s >= o.value && r >= o.value : t >= o.value && i >= o.value;
5789
- }, Fs = ({
5737
+ }, $s = ({
5790
5738
  visibleWidthOfItem: n,
5791
5739
  visibleHeightOfItem: e,
5792
5740
  threshold: t,
@@ -5794,7 +5742,7 @@ const $s = ({
5794
5742
  }) => {
5795
5743
  const o = n / i.width, s = e / i.height;
5796
5744
  return t.type === "percentage" ? s >= t.value && o >= t.value : e >= t.value && n >= t.value;
5797
- }, nn = ({
5745
+ }, tn = ({
5798
5746
  itemPosition: {
5799
5747
  bottom: n,
5800
5748
  left: e,
@@ -5818,14 +5766,14 @@ const $s = ({
5818
5766
  Math.min(n, p) - Math.max(i, d)
5819
5767
  );
5820
5768
  if (g <= 0 || h <= 0) return { visible: !1 };
5821
- const y = Fs({
5769
+ const y = $s({
5822
5770
  threshold: r,
5823
5771
  visibleHeightOfItem: h,
5824
5772
  visibleWidthOfItem: g,
5825
5773
  viewportPosition: a
5826
5774
  });
5827
5775
  return c ? { visible: y } : {
5828
- visible: Ts({
5776
+ visible: xs({
5829
5777
  itemHeight: s,
5830
5778
  itemWidth: o,
5831
5779
  threshold: r,
@@ -5849,7 +5797,7 @@ const $s = ({
5849
5797
  }) => new L({
5850
5798
  x: e + n.x,
5851
5799
  y: t + n.y
5852
- }), Ls = ({
5800
+ }), Ts = ({
5853
5801
  position: n,
5854
5802
  threshold: e,
5855
5803
  restrictToScreen: t,
@@ -5864,14 +5812,14 @@ const $s = ({
5864
5812
  spineLayout: o
5865
5813
  }) || i.get(0), c = i.items.reduce(
5866
5814
  (g, h) => {
5867
- const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f = tn(
5815
+ const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f = en(
5868
5816
  n,
5869
5817
  r.absoluteViewport,
5870
5818
  y
5871
5819
  ), I = Ie.from(
5872
5820
  f,
5873
5821
  y
5874
- ), { visible: b } = nn({
5822
+ ), { visible: b } = tn({
5875
5823
  itemPosition: m,
5876
5824
  threshold: e,
5877
5825
  viewportPosition: I,
@@ -5887,7 +5835,7 @@ const $s = ({
5887
5835
  beginIndex: d ?? 0,
5888
5836
  endIndex: p ?? 0
5889
5837
  };
5890
- }, Ms = ({
5838
+ }, Fs = ({
5891
5839
  spineItemsManager: n,
5892
5840
  context: e,
5893
5841
  spineItemLocator: t,
@@ -5954,20 +5902,20 @@ const $s = ({
5954
5902
  };
5955
5903
  }).reduce(
5956
5904
  (re, { absolutePosition: le, index: Re }) => {
5957
- const de = I ? b.absoluteViewport : b.relativeViewport, on = tn(
5905
+ const de = I ? b.absoluteViewport : b.relativeViewport, nn = en(
5958
5906
  h,
5959
5907
  b.absoluteViewport,
5960
5908
  de
5961
- ), sn = Ie.from(
5962
- on,
5909
+ ), on = Ie.from(
5910
+ nn,
5963
5911
  de
5964
- ), { visible: rn } = nn({
5965
- viewportPosition: sn,
5912
+ ), { visible: sn } = tn({
5913
+ viewportPosition: on,
5966
5914
  restrictToScreen: f,
5967
5915
  threshold: m,
5968
5916
  itemPosition: le
5969
5917
  });
5970
- return rn ? [...re, Re] : re;
5918
+ return sn ? [...re, Re] : re;
5971
5919
  },
5972
5920
  []
5973
5921
  ), H = E[0], B = E[E.length - 1] ?? H;
@@ -5991,7 +5939,7 @@ const $s = ({
5991
5939
  /**
5992
5940
  * @deprecated use Pages
5993
5941
  */
5994
- _getAbsolutePageIndexFromPageIndex: (h) => $s({
5942
+ _getAbsolutePageIndexFromPageIndex: (h) => Ps({
5995
5943
  ...h,
5996
5944
  spineItemsManager: n
5997
5945
  }),
@@ -6032,7 +5980,7 @@ const $s = ({
6032
5980
  }),
6033
5981
  getSpineItemFromIframe: c,
6034
5982
  getSpineItemPageIndexFromNode: u,
6035
- getVisibleSpineItemsFromPosition: (h) => Ls({
5983
+ getVisibleSpineItemsFromPosition: (h) => Ts({
6036
5984
  spineItemsManager: n,
6037
5985
  spineLayout: o,
6038
5986
  viewport: s,
@@ -6055,10 +6003,10 @@ const $s = ({
6055
6003
  });
6056
6004
  }
6057
6005
  };
6058
- }, Cs = D.namespace("spine"), Es = ({
6006
+ }, Ls = D.namespace("spine"), Ms = ({
6059
6007
  position: n,
6060
6008
  pageSize: e
6061
- }) => new vi({
6009
+ }) => new Ii({
6062
6010
  ...n,
6063
6011
  left: n.x,
6064
6012
  top: n.y,
@@ -6067,7 +6015,7 @@ const $s = ({
6067
6015
  bottom: n.y + e.height,
6068
6016
  right: n.x + e.width
6069
6017
  });
6070
- class Ds extends Q {
6018
+ class Cs extends Q {
6071
6019
  constructor(e, t, i, o, s, r) {
6072
6020
  super({ pages: [] }), this.spineLayout = e, this.spineItemsManager = t, this.spineItemLocator = i, this.context = o, this.locator = s, this.viewport = r, this.fromSpineItemPageIndex = (a, c) => this.value.pages.find(
6073
6021
  (u) => u.itemIndex === a.index && u.pageIndex === c
@@ -6085,11 +6033,11 @@ class Ds extends Q {
6085
6033
  spineItemPosition: f
6086
6034
  });
6087
6035
  return {
6088
- absoluteLayout: Es({
6036
+ absoluteLayout: Ms({
6089
6037
  pageSize: a,
6090
6038
  position: I
6091
6039
  }),
6092
- layout: new bi({
6040
+ layout: new Si({
6093
6041
  left: f.x,
6094
6042
  right: f.x + a.width,
6095
6043
  top: f.y,
@@ -6116,7 +6064,7 @@ class Ds extends Q {
6116
6064
  const h = l.spineItem.renderer?.getDocumentFrame();
6117
6065
  let m;
6118
6066
  h && h?.contentWindow?.document && // very important because it is being used by next functions
6119
- h.contentWindow.document.body !== null && (m = Mn(
6067
+ h.contentWindow.document.body !== null && (m = Ln(
6120
6068
  h.contentWindow.document,
6121
6069
  l.layout
6122
6070
  )), g.next({ ...p, firstVisibleNode: m });
@@ -6124,12 +6072,12 @@ class Ds extends Q {
6124
6072
  })
6125
6073
  );
6126
6074
  }),
6127
- S((a) => (Cs.info("Pages layout", a), { pages: a })),
6075
+ S((a) => (Ls.info("Pages layout", a), { pages: a })),
6128
6076
  j()
6129
6077
  ), this.layout$.pipe($(this.destroy$)).subscribe(this.next.bind(this));
6130
6078
  }
6131
6079
  }
6132
- class Rs extends G {
6080
+ class Es extends G {
6133
6081
  constructor(e, t) {
6134
6082
  super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
6135
6083
  w((i) => {
@@ -6152,7 +6100,7 @@ class Rs extends G {
6152
6100
  );
6153
6101
  }
6154
6102
  }
6155
- const As = ({
6103
+ const Ds = ({
6156
6104
  horizontalOffset: n,
6157
6105
  verticalOffset: e,
6158
6106
  context: t,
@@ -6222,7 +6170,7 @@ const As = ({
6222
6170
  })
6223
6171
  );
6224
6172
  };
6225
- class Ns extends G {
6173
+ class Rs extends G {
6226
6174
  constructor(e, t, i, o) {
6227
6175
  super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6228
6176
  x(() => {
@@ -6266,12 +6214,12 @@ class Ns extends G {
6266
6214
  ),
6267
6215
  ze(() => {
6268
6216
  s.next(!0);
6269
- const r = this.context.manifest, a = Gt(r) ?? !1;
6217
+ const r = this.context.manifest, a = qt(r) ?? !1;
6270
6218
  return A(this.spineItemsManager.items).pipe(
6271
- gn(
6219
+ pn(
6272
6220
  (u, l, d) => u.pipe(
6273
6221
  st(
6274
- ({ horizontalOffset: p, verticalOffset: g }) => As({
6222
+ ({ horizontalOffset: p, verticalOffset: g }) => Ds({
6275
6223
  context: this.context,
6276
6224
  horizontalOffset: p,
6277
6225
  index: d,
@@ -6329,32 +6277,32 @@ class Ns extends G {
6329
6277
  super.destroy(), this.layoutSubject.complete();
6330
6278
  }
6331
6279
  }
6332
- class Os extends G {
6280
+ class As extends G {
6333
6281
  constructor(e, t, i, o, s, r, a) {
6334
6282
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new Y(
6335
6283
  void 0
6336
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Ns(
6284
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Rs(
6337
6285
  i,
6338
6286
  e,
6339
6287
  s,
6340
6288
  a
6341
- ), this.locator = Ms({
6289
+ ), this.locator = Fs({
6342
6290
  context: e,
6343
6291
  spineItemsManager: i,
6344
6292
  spineItemLocator: o,
6345
6293
  settings: s,
6346
6294
  spineLayout: this.spineLayout,
6347
6295
  viewport: a
6348
- }), this.spineItemsLoader = new ws(
6296
+ }), this.spineItemsLoader = new bs(
6349
6297
  this.context,
6350
6298
  i,
6351
6299
  this.locator,
6352
6300
  s,
6353
6301
  this.spineLayout
6354
- ), this.spineItemsObserver = new Rs(
6302
+ ), this.spineItemsObserver = new Es(
6355
6303
  i,
6356
6304
  this.locator
6357
- ), this.pages = new Ds(
6305
+ ), this.pages = new Cs(
6358
6306
  this.spineLayout,
6359
6307
  this.spineItemsManager,
6360
6308
  this.spineItemLocator,
@@ -6379,7 +6327,7 @@ class Os extends G {
6379
6327
  if (!d) return;
6380
6328
  this.spineItemsManager.destroyItems();
6381
6329
  const p = l.spineItems.map(
6382
- (g, h) => new en(
6330
+ (g, h) => new Qt(
6383
6331
  g,
6384
6332
  d,
6385
6333
  this.context,
@@ -6410,7 +6358,7 @@ class Os extends G {
6410
6358
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6411
6359
  }
6412
6360
  }
6413
- class Vs extends G {
6361
+ class Ns extends G {
6414
6362
  constructor(e, t) {
6415
6363
  super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new Y([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6416
6364
  }
@@ -6424,7 +6372,7 @@ class Vs extends G {
6424
6372
  return i > o ? "after" : i === o ? "same" : "before";
6425
6373
  }
6426
6374
  getSpineItemIndex(e) {
6427
- const t = e instanceof en ? e : this.get(e);
6375
+ const t = e instanceof Qt ? e : this.get(e);
6428
6376
  if (!t) return;
6429
6377
  const i = this.orderedSpineItemsSubject.value.indexOf(t);
6430
6378
  return i < 0 ? void 0 : i;
@@ -6453,10 +6401,10 @@ class Vs extends G {
6453
6401
  });
6454
6402
  }
6455
6403
  }
6456
- class js extends Q {
6404
+ class Os extends Q {
6457
6405
  constructor(e, t) {
6458
6406
  const i = document.createElement("div");
6459
- i.setAttribute(`data-${si}`, ""), super({
6407
+ i.setAttribute(`data-${oi}`, ""), super({
6460
6408
  element: i,
6461
6409
  pageSize: {
6462
6410
  width: 1,
@@ -6496,7 +6444,7 @@ class js extends Q {
6496
6444
  });
6497
6445
  }
6498
6446
  get absoluteViewport() {
6499
- return new Ps({
6447
+ return new vs({
6500
6448
  width: this.value.width,
6501
6449
  height: this.value.height
6502
6450
  });
@@ -6524,18 +6472,18 @@ class js extends Q {
6524
6472
  */
6525
6473
  get relativeViewport() {
6526
6474
  const e = this.absoluteViewport, t = this.scaleFactor;
6527
- return new xs({
6475
+ return new ws({
6528
6476
  width: e.width / t,
6529
6477
  height: e.height / t
6530
6478
  });
6531
6479
  }
6532
6480
  }
6533
- const $t = `${Ut}-core`, ks = (n) => {
6534
- const e = crypto.randomUUID(), t = new R(), i = new R(), o = new No(), s = new Ro(), r = new Ss(n, s), a = new Ao(s, r), c = new Vs(s, r), u = new js(s, r), l = Kt({
6481
+ const $t = `${Ut}-core`, Vs = (n) => {
6482
+ const e = crypto.randomUUID(), t = new R(), i = new R(), o = new Ro(), s = new Eo(), r = new fs(n, s), a = new Do(s, r), c = new Ns(s, r), u = new Os(s, r), l = Jt({
6535
6483
  context: s,
6536
6484
  settings: r,
6537
6485
  viewport: u
6538
- }), d = new hs(s, c), p = new Os(
6486
+ }), d = new ps(s, c), p = new As(
6539
6487
  s,
6540
6488
  d,
6541
6489
  c,
@@ -6543,14 +6491,14 @@ const $t = `${Ut}-core`, ks = (n) => {
6543
6491
  r,
6544
6492
  o,
6545
6493
  u
6546
- ), g = gs({
6494
+ ), g = ds({
6547
6495
  context: s,
6548
6496
  spineItemsManager: c,
6549
6497
  hookManager: o,
6550
6498
  spine: p,
6551
6499
  settings: r,
6552
6500
  viewport: u
6553
- }), h = new ms(
6501
+ }), h = new gs(
6554
6502
  s,
6555
6503
  d,
6556
6504
  c,
@@ -6569,7 +6517,7 @@ const $t = `${Ut}-core`, ks = (n) => {
6569
6517
  return;
6570
6518
  }
6571
6519
  D.log("load", { options: T });
6572
- const B = Us(E, e);
6520
+ const B = js(E, e);
6573
6521
  s.update({
6574
6522
  manifest: H,
6575
6523
  rootElement: B
@@ -6581,7 +6529,7 @@ const $t = `${Ut}-core`, ks = (n) => {
6581
6529
  }),
6582
6530
  K(i)
6583
6531
  ), b = P(I, f).subscribe();
6584
- Ce(document, $t, Oo);
6532
+ Ce(document, $t, Ao);
6585
6533
  const F = () => {
6586
6534
  Ee(document, $t), b.unsubscribe(), c.destroy(), h.destroy(), r.destroy(), d.destroy(), s.destroy(), g.destroy(), p.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6587
6535
  };
@@ -6591,13 +6539,13 @@ const $t = `${Ut}-core`, ks = (n) => {
6591
6539
  spine: p,
6592
6540
  hookManager: o,
6593
6541
  cfi: {
6594
- generateCfiFromRange: so,
6542
+ generateCfiFromRange: io,
6595
6543
  parseCfi: it,
6596
6544
  generateCfiForSpineItemPage: (T) => Be({
6597
6545
  ...T,
6598
6546
  spine: p
6599
6547
  }),
6600
- resolveCfi: (T) => Yt({ ...T, spineItemsManager: c })
6548
+ resolveCfi: (T) => Xt({ ...T, spineItemsManager: c })
6601
6549
  },
6602
6550
  navigation: g,
6603
6551
  spineItemsObserver: p.spineItemsObserver,
@@ -6632,30 +6580,30 @@ const $t = `${Ut}-core`, ks = (n) => {
6632
6580
  destroy$: i
6633
6581
  }
6634
6582
  };
6635
- }, Us = (n, e) => (n.style.cssText = `
6583
+ }, js = (n, e) => (n.style.cssText = `
6636
6584
  ${n.style.cssText}
6637
6585
  background-color: white;
6638
6586
  position: relative;
6639
- `, n.classList.add(`${W}-reader`), n.setAttribute(oi, e), n.setAttribute("data-prose-reader-container", e), n), er = (
6587
+ `, n.classList.add(`${W}-reader`), n.setAttribute(ii, e), n.setAttribute("data-prose-reader-container", e), n), Ks = (
6640
6588
  //__
6641
- Io(
6642
- Zn(
6643
- wo(
6644
- Gn(
6645
- zn(
6646
- ho(
6647
- vo(
6648
- Eo(
6649
- qi(
6650
- Ii(
6651
- Oi(
6652
- Wn(
6653
- Xn(
6654
- lo(
6655
- Ai(
6656
- bo(
6589
+ yo(
6590
+ Gn(
6591
+ bo(
6592
+ qn(
6593
+ Un(
6594
+ po(
6595
+ Io(
6596
+ Mo(
6597
+ Xi(
6598
+ yi(
6599
+ Ai(
6600
+ zn(
6601
+ Bn(
6602
+ co(
6603
+ Di(
6604
+ So(
6657
6605
  // __
6658
- ks
6606
+ Vs
6659
6607
  )
6660
6608
  )
6661
6609
  )
@@ -6672,82 +6620,82 @@ const $t = `${Ut}-core`, ks = (n) => {
6672
6620
  )
6673
6621
  )
6674
6622
  )
6675
- ), tr = (n) => (e) => n(e);
6623
+ ), Qs = (n) => (e) => n(e);
6676
6624
  export {
6677
- _t as AbstractSpinePosition,
6678
- Ro as Context,
6679
- Uo as ControlledNavigationController,
6625
+ Wt as AbstractSpinePosition,
6626
+ Eo as Context,
6627
+ jo as ControlledNavigationController,
6680
6628
  G as DestroyableClass,
6681
6629
  Se as DocumentRenderer,
6682
- Ao as Features,
6683
- oi as HTML_ATTRIBUTE_DATA_READER_ID,
6630
+ Do as Features,
6631
+ ii as HTML_ATTRIBUTE_DATA_READER_ID,
6684
6632
  W as HTML_PREFIX,
6685
- ri as HTML_PREFIX_SCROLL_NAVIGATOR,
6686
- si as HTML_PREFIX_VIEWPORT,
6633
+ si as HTML_PREFIX_SCROLL_NAVIGATOR,
6634
+ oi as HTML_PREFIX_VIEWPORT,
6687
6635
  Ut as HTML_STYLE_PREFIX,
6688
- No as HookManager,
6689
- ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6690
- es as InternalNavigator,
6636
+ Ro as HookManager,
6637
+ ni as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6638
+ Ko as InternalNavigator,
6691
6639
  nt as LayoutEntry,
6692
- Zt as Locker,
6693
- Js as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6694
- Gs as PROSE_READER_NAMESPACE,
6695
- Ds as Pages,
6696
- hs as Pagination,
6697
- ms as PaginationController,
6640
+ Gt as Locker,
6641
+ Gs as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6642
+ Ys as PROSE_READER_NAMESPACE,
6643
+ Cs as Pages,
6644
+ ps as Pagination,
6645
+ gs as PaginationController,
6698
6646
  Q as ReactiveEntity,
6699
6647
  tt as ResourceHandler,
6700
- uo as ResourcesLocator,
6701
- Fo as ScrollNavigationController,
6648
+ ao as ResourcesLocator,
6649
+ $o as ScrollNavigationController,
6702
6650
  ft as ScrollPosition,
6703
- ys as SettingsManager,
6704
- Os as Spine,
6705
- en as SpineItem,
6706
- bi as SpineItemPageLayout,
6707
- vi as SpineItemPageSpineLayout,
6651
+ ms as SettingsManager,
6652
+ As as Spine,
6653
+ Qt as SpineItem,
6654
+ Si as SpineItemPageLayout,
6655
+ Ii as SpineItemPageSpineLayout,
6708
6656
  C as SpineItemPosition,
6709
6657
  He as SpineItemSpineLayout,
6710
- Vs as SpineItemsManager,
6711
- Rs as SpineItemsObserver,
6658
+ Ns as SpineItemsManager,
6659
+ Es as SpineItemsObserver,
6712
6660
  L as SpinePosition,
6713
- To as UnboundScrollPosition,
6661
+ xo as UnboundScrollPosition,
6714
6662
  Ne as UnboundSpineItemPagePosition,
6715
6663
  ue as UnboundSpinePosition,
6716
- Zs as VIEWPORT_ADJUSTMENT_THROTTLE,
6717
- js as Viewport,
6718
- co as consolidate,
6719
- er as createReader,
6664
+ qs as VIEWPORT_ADJUSTMENT_THROTTLE,
6665
+ Os as Viewport,
6666
+ ro as consolidate,
6667
+ Ks as createReader,
6720
6668
  ct as deferIdle,
6721
- Yn as deferNextResult,
6669
+ Xn as deferNextResult,
6722
6670
  Be as generateCfiForSpineItemPage,
6723
- so as generateCfiFromRange,
6671
+ io as generateCfiFromRange,
6724
6672
  me as generateRootCfi,
6725
6673
  at as getAttributeValueFromString,
6726
- Ys as getBase64FromBlob,
6674
+ Bs as getBase64FromBlob,
6727
6675
  Ke as getFrameViewportInfo,
6728
- Qs as getItemAnchor,
6729
- Ii as htmlEnhancer,
6676
+ Js as getItemAnchor,
6677
+ yi as htmlEnhancer,
6730
6678
  Vt as idle,
6731
- jn as injectCSSToFrame,
6679
+ Vn as injectCSSToFrame,
6732
6680
  Z as isDefined,
6733
6681
  Nt as isHtmlElement,
6734
- On as isHtmlTagElement,
6682
+ Nn as isHtmlTagElement,
6735
6683
  Xe as isRootCfi,
6736
- or as isShallowEqual,
6737
- Ai as layoutEnhancer,
6684
+ nr as isShallowEqual,
6685
+ Di as layoutEnhancer,
6738
6686
  Ot as mapKeysTo,
6739
- Xs as observeIntersection,
6687
+ Hs as observeIntersection,
6740
6688
  ut as observeMutation,
6741
6689
  et as observeResize,
6742
- lo as paginationEnhancer,
6690
+ co as paginationEnhancer,
6743
6691
  it as parseCfi,
6744
- Bs as removeCSS,
6745
- Yt as resolveCfi,
6746
- tr as rootEnhancer,
6747
- Es as spinePositionToSpineItemSpineLayout,
6692
+ _s as removeCSS,
6693
+ Xt as resolveCfi,
6694
+ Qs as rootEnhancer,
6695
+ Ms as spinePositionToSpineItemSpineLayout,
6748
6696
  oe as upsertCSSToFrame,
6749
- kn as waitForFrameLoad,
6750
- Un as waitForFrameReady,
6697
+ jn as waitForFrameLoad,
6698
+ kn as waitForFrameReady,
6751
6699
  De as waitForSwitch,
6752
6700
  Qe as watchKeys
6753
6701
  };