@prose-reader/core 1.254.0 → 1.255.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,12 +1,12 @@
1
- import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as N, takeUntil as T, Observable as ne, defer as ke, Subject as R, combineLatest as k, merge as P, EMPTY as Z, NEVER as ge, tap as x, share as E, BehaviorSubject as H, withLatestFrom as O, filter as L, first as U, mergeMap as $e, endWith as me, finalize as de, catchError as Ft, lastValueFrom as rn, scheduled as an, animationFrameScheduler as re, exhaustMap as Ue, debounceTime as Se, distinctUntilChanged as z, throttleTime as cn, startWith as ee, shareReplay as J, switchScan as un, defaultIfEmpty as ln, forkJoin as dn, delay as we, timer as Te, ReplaySubject as st, identity as Pe, skip as Lt, reduce as pn, concatMap as rt } from "rxjs";
2
- import { Report as gn, isShallowEqual as V, shallowMergeIfDefined as xe, getParentPath as hn, parseContentType as mn, detectMimeTypeFromName as Me, arrayEqual as fn } from "@prose-reader/shared";
3
- import { isShallowEqual as sr } from "@prose-reader/shared";
4
- import { map as K, distinctUntilChanged as pe, switchMap as _, first as Mt, startWith as yn, shareReplay as Ce, tap as j, pairwise as Sn, take as In, takeUntil as G, filter as se, debounceTime as bn, skip as Ct, mergeMap as vn, catchError as at } from "rxjs/operators";
5
- import { generate as ze, parse as Et, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
1
+ import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as N, takeUntil as T, Observable as ne, defer as ke, Subject as R, combineLatest as k, merge as P, EMPTY as Z, NEVER as ge, tap as x, share as E, BehaviorSubject as H, withLatestFrom as O, filter as L, first as U, mergeMap as $e, endWith as me, finalize as de, catchError as Ft, lastValueFrom as an, scheduled as cn, animationFrameScheduler as re, exhaustMap as Ue, debounceTime as Se, distinctUntilChanged as z, throttleTime as un, startWith as ee, shareReplay as J, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as we, timer as Te, skip as Lt, ReplaySubject as st, identity as Pe, reduce as gn, concatMap as rt } from "rxjs";
2
+ import { Report as hn, isShallowEqual as V, shallowMergeIfDefined as xe, getParentPath as mn, parseContentType as fn, detectMimeTypeFromName as Me, arrayEqual as yn } from "@prose-reader/shared";
3
+ import { isShallowEqual as rr } from "@prose-reader/shared";
4
+ import { map as K, distinctUntilChanged as pe, switchMap as _, first as Mt, startWith as Sn, shareReplay as Ce, tap as j, pairwise as bn, take as In, takeUntil as G, filter as se, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as at } from "rxjs/operators";
5
+ import { generate as ze, parse as Et, isIndirectionOnly as Pn, isParsedCfiRange as xn, resolve as $n } from "@prose-reader/cfi";
6
6
  import { isDefined as Ge } from "reactjrx";
7
- const $n = "@prose-reader/core", D = gn.namespace($n, void 0, {
7
+ const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
8
8
  color: "#98cde7"
9
- }), Tn = [
9
+ }), Fn = [
10
10
  "pointercancel",
11
11
  "pointerdown",
12
12
  "pointerenter",
@@ -18,24 +18,24 @@ const $n = "@prose-reader/core", D = gn.namespace($n, void 0, {
18
18
  // `touchstart` as const,
19
19
  // `touchend` as const,
20
20
  ];
21
- function Fn(n, e, t) {
21
+ function Ln(n, e, t) {
22
22
  if ("caretPositionFromPoint" in n)
23
23
  return n.caretPositionFromPoint(e, t);
24
24
  if ("caretRangeFromPoint" in n && // @ts-expect-error limited availability
25
25
  typeof n.caretRangeFromPoint < "u")
26
26
  return n.caretRangeFromPoint(e, t);
27
27
  }
28
- const Ln = (n, e) => {
28
+ const Mn = (n, e) => {
29
29
  const t = "body" in n ? We(n.body, e) : We(n, e), i = "createRange" in n ? n : n.ownerDocument;
30
30
  if (t) {
31
31
  let o, s = 0;
32
32
  const r = i.createRange();
33
33
  return Array.from(t.childNodes).some((a) => {
34
34
  r.selectNodeContents(a);
35
- const c = r.getClientRects(), u = Mn(c, e);
35
+ const c = r.getClientRects(), u = Cn(c, e);
36
36
  if (u) {
37
37
  o = r.cloneRange();
38
- const l = Fn(
38
+ const l = Ln(
39
39
  i,
40
40
  Math.ceil(u.left),
41
41
  Math.ceil(u.top)
@@ -65,13 +65,13 @@ const Ln = (n, e) => {
65
65
  function Dt(n, { left: e, right: t }) {
66
66
  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";
67
67
  }
68
- function Mn(n, e) {
68
+ function Cn(n, e) {
69
69
  return Array.from(n).find((t) => {
70
70
  const i = Dt(t, e);
71
71
  return i !== "before" && i !== "after";
72
72
  });
73
73
  }
74
- const Cn = (n, e) => {
74
+ const En = (n, e) => {
75
75
  if (n.nodeType !== Node.CDATA_SECTION_NODE && n.nodeType !== Node.DOCUMENT_TYPE_NODE) {
76
76
  const t = n.ownerDocument?.createRange();
77
77
  t?.selectNodeContents(n);
@@ -93,8 +93,8 @@ const Cn = (n, e) => {
93
93
  if (e.PointerEvent && n instanceof e.PointerEvent)
94
94
  return !0;
95
95
  }
96
- return !!Tn.includes(n.type);
97
- }, En = (n) => {
96
+ return !!Fn.includes(n.type);
97
+ }, Dn = (n) => {
98
98
  if (Ze(n)) return !1;
99
99
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
100
100
  const e = n?.target?.ownerDocument?.defaultView;
@@ -107,7 +107,7 @@ const Cn = (n, e) => {
107
107
  return n instanceof e.MouseEvent;
108
108
  }
109
109
  return !1;
110
- }, Dn = (n) => {
110
+ }, Rn = (n) => {
111
111
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
112
112
  const e = n?.target?.ownerDocument?.defaultView;
113
113
  if (e.TouchEvent)
@@ -119,7 +119,7 @@ const Cn = (n, e) => {
119
119
  return n instanceof e.TouchEvent;
120
120
  }
121
121
  return !1;
122
- }, Rn = () => document.createElement("div"), Rt = (n) => {
122
+ }, An = () => document.createElement("div"), Rt = (n) => {
123
123
  const e = [
124
124
  "img",
125
125
  // Images
@@ -135,7 +135,7 @@ const Cn = (n, e) => {
135
135
  // JavaScript files
136
136
  ].join(",");
137
137
  return Array.from(n?.querySelectorAll(e) || []);
138
- }, An = (n) => {
138
+ }, On = (n) => {
139
139
  if (Rt(n).forEach((t) => {
140
140
  const i = t.getAttribute("src") || t.getAttribute("href");
141
141
  i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
@@ -170,10 +170,10 @@ function Ot(n) {
170
170
  // biome-ignore lint/suspicious/noExplicitAny: TODO
171
171
  ) && n.nodeType === Node.ELEMENT_NODE;
172
172
  }
173
- function On(n, e) {
173
+ function Nn(n, e) {
174
174
  return Ot(n) && n.tagName.toLowerCase() === e.toLowerCase();
175
175
  }
176
- function Nn(n) {
176
+ function Vn(n) {
177
177
  return At(
178
178
  n,
179
179
  [
@@ -198,9 +198,9 @@ const Je = (n, e, t, i) => {
198
198
  }, ct = (n, e) => {
199
199
  const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
200
200
  return i && Number.parseFloat(o) || 0;
201
- }, Vn = (n, e, t, i) => {
201
+ }, jn = (n, e, t, i) => {
202
202
  n?.contentDocument?.head && Je(n.contentDocument, e, t, i);
203
- }, Xs = (n, e) => {
203
+ }, Ys = (n, e) => {
204
204
  n?.contentDocument && Ke(n.contentDocument, e);
205
205
  }, te = (n, e, t, i) => {
206
206
  if (!n) return;
@@ -211,7 +211,7 @@ const Je = (n, e, t, i) => {
211
211
  o.innerHTML = t;
212
212
  return;
213
213
  }
214
- Vn(n, e, t, i);
214
+ jn(n, e, t, i);
215
215
  }, Qe = (n) => {
216
216
  if (n?.contentDocument) {
217
217
  const t = n.contentDocument.querySelector("meta[name='viewport']");
@@ -228,17 +228,17 @@ const Je = (n, e, t, i) => {
228
228
  }
229
229
  }
230
230
  return { hasViewport: !1 };
231
- }, jn = (n) => n.pipe(
231
+ }, kn = (n) => n.pipe(
232
232
  w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : q(e, "load").pipe(
233
233
  Tt(1),
234
234
  S(() => e)
235
235
  ))
236
- ), kn = (n) => n.pipe(
236
+ ), Un = (n) => n.pipe(
237
237
  w((e) => {
238
238
  const t = e?.contentDocument?.fonts.ready;
239
239
  return t ? N(t).pipe(S(() => e)) : v(void 0);
240
240
  })
241
- ), Un = (n) => (e) => {
241
+ ), zn = (n) => (e) => {
242
242
  const t = n(e), i = new IntersectionObserver((o) => {
243
243
  o.forEach((s) => {
244
244
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -273,7 +273,7 @@ const Je = (n, e, t, i) => {
273
273
  ), {
274
274
  ...t
275
275
  };
276
- }, zn = (n) => (e) => {
276
+ }, Wn = (n) => (e) => {
277
277
  const t = n(e);
278
278
  return t.context.watch("rootElement").pipe(T(t.context.destroy$)).subscribe((i) => {
279
279
  if (!i) return;
@@ -294,7 +294,7 @@ const Je = (n, e, t, i) => {
294
294
  clientX: a,
295
295
  clientY: c
296
296
  };
297
- }, Wn = (n, e, t, i) => {
297
+ }, _n = (n, e, t, i) => {
298
298
  const o = e?.view?.frameElement;
299
299
  if (!e || !o) return n;
300
300
  const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
@@ -314,7 +314,7 @@ const Je = (n, e, t, i) => {
314
314
  enumerable: !0
315
315
  }), d;
316
316
  }
317
- if (En(n)) {
317
+ if (Dn(n)) {
318
318
  const { clientX: u, clientY: l } = Re({
319
319
  position: n,
320
320
  frameElement: r
@@ -328,7 +328,7 @@ const Je = (n, e, t, i) => {
328
328
  enumerable: !0
329
329
  }), d;
330
330
  }
331
- if (Dn(n)) {
331
+ if (Rn(n)) {
332
332
  const u = Array.from(n.touches).map((d) => {
333
333
  const { clientX: g, clientY: h } = Re({
334
334
  position: d,
@@ -351,7 +351,7 @@ const Je = (n, e, t, i) => {
351
351
  }), l;
352
352
  }
353
353
  return n;
354
- }, _n = [
354
+ }, Hn = [
355
355
  "pointercancel",
356
356
  "pointerdown",
357
357
  "pointerenter",
@@ -360,21 +360,21 @@ const Je = (n, e, t, i) => {
360
360
  "pointerout",
361
361
  "pointerover",
362
362
  "pointerup"
363
- ], Hn = [
364
- ..._n
363
+ ], Bn = [
364
+ ...Hn
365
365
  /*, ...mouseEvents*/
366
- ], Bn = (n) => (e) => {
366
+ ], Xn = (n) => (e) => {
367
367
  const t = n(e);
368
368
  return t.hookManager.register(
369
369
  "item.onDocumentLoad",
370
370
  ({ destroy: i, itemId: o }) => {
371
371
  const s = t.spineItemsManager.get(o), r = s?.renderer.getDocumentFrame();
372
372
  if (!r || !s) return;
373
- const a = Hn.map((c) => {
373
+ const a = Bn.map((c) => {
374
374
  const u = (l) => {
375
375
  let d = l;
376
376
  if (Ze(l) && (d = new PointerEvent(l.type, l)), d !== l) {
377
- const g = Wn(
377
+ const g = _n(
378
378
  d,
379
379
  l,
380
380
  t.spine.locator,
@@ -418,7 +418,7 @@ const Ee = (n) => (e) => e.pipe(
418
418
  K(() => t)
419
419
  )
420
420
  )
421
- ), Xn = (n) => {
421
+ ), Yn = (n) => {
422
422
  let e;
423
423
  const t = n.subscribe((i) => {
424
424
  e = { result: i };
@@ -448,7 +448,7 @@ const lt = (n, e) => new ne((t) => {
448
448
  });
449
449
  return i.observe(n, e), () => i.disconnect();
450
450
  });
451
- function Ys(n, e) {
451
+ function qs(n, e) {
452
452
  return new ne((t) => {
453
453
  const i = new IntersectionObserver((o) => {
454
454
  t.next(o);
@@ -470,7 +470,7 @@ class jt {
470
470
  e
471
471
  ), this.outputSettingsUpdateSubject = new R(), this.values$ = k([
472
472
  this.settingsManager.values$,
473
- this.outputSettingsUpdateSubject.pipe(yn(this.outputSettings))
473
+ this.outputSettingsUpdateSubject.pipe(Sn(this.outputSettings))
474
474
  ]).pipe(
475
475
  K(([o, s]) => ({ ...o, ...s })),
476
476
  Ce(1)
@@ -506,7 +506,7 @@ class jt {
506
506
  this.outputSettingsUpdateSubject.complete();
507
507
  }
508
508
  }
509
- const qs = (n) => {
509
+ const Gs = (n) => {
510
510
  const e = new FileReader();
511
511
  return new Promise((t) => {
512
512
  e.addEventListener(
@@ -518,7 +518,7 @@ const qs = (n) => {
518
518
  ), e.readAsDataURL(n);
519
519
  });
520
520
  };
521
- let Yn = class extends jt {
521
+ let qn = class extends jt {
522
522
  computeOutputSettings(e) {
523
523
  return e;
524
524
  }
@@ -544,8 +544,8 @@ let Yn = class extends jt {
544
544
  };
545
545
  }
546
546
  };
547
- const qn = (n) => (e) => {
548
- const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new Yn(
547
+ const Gn = (n) => (e) => {
548
+ const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new qn(
549
549
  {
550
550
  fontScale: t,
551
551
  lineHeight: i,
@@ -577,7 +577,7 @@ const qn = (n) => (e) => {
577
577
  }
578
578
  });
579
579
  const d = (g) => g.pipe(
580
- Sn(),
580
+ bn(),
581
581
  S(([h, p]) => p.fontScale !== h.fontScale || p.lineHeight !== h.lineHeight)
582
582
  );
583
583
  return c.values$.pipe(
@@ -591,7 +591,7 @@ const qn = (n) => (e) => {
591
591
  },
592
592
  settings: c
593
593
  };
594
- }, Gn = (n) => (e) => {
594
+ }, Zn = (n) => (e) => {
595
595
  const t = n(e), i = (o) => q(o, "keyup").pipe(
596
596
  S((s) => {
597
597
  const { pageTurnDirection: r, computedPageTurnMode: a } = t.settings.values;
@@ -627,7 +627,7 @@ const qn = (n) => (e) => {
627
627
  ),
628
628
  T(t.$.destroy$)
629
629
  ).subscribe(), t;
630
- }, Zn = (n) => n.spine.spineItemsManager.items$.pipe(
630
+ }, Jn = (n) => n.spine.spineItemsManager.items$.pipe(
631
631
  w(
632
632
  (e) => P(
633
633
  ...e.map((t) => t.watch("isLoaded").pipe(
@@ -796,15 +796,15 @@ const Le = class Le extends X {
796
796
  };
797
797
  Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
798
798
  let fe = Le;
799
- const Jn = (n) => new URL(n.href);
799
+ const Kn = (n) => new URL(n.href);
800
800
  class nt {
801
801
  constructor(e, t) {
802
802
  this.item = e, this.settings = t;
803
803
  }
804
804
  async getResource() {
805
- return await rn(
805
+ return await an(
806
806
  this.settings.values.getResource?.(this.item) ?? v(void 0)
807
- ) ?? Jn(this.item);
807
+ ) ?? Kn(this.item);
808
808
  }
809
809
  async fetchResource() {
810
810
  const e = await this.getResource();
@@ -814,7 +814,7 @@ class nt {
814
814
  const kt = (n, e) => {
815
815
  const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
816
816
  return t ? o.replace("http://", "file://") : o;
817
- }, Kn = async (n, e, t, i, o) => {
817
+ }, Qn = async (n, e, t, i, o) => {
818
818
  if (!n || !n.defaultView) return;
819
819
  const s = e.sheet;
820
820
  if (s)
@@ -831,22 +831,22 @@ const kt = (n, e) => {
831
831
  return p;
832
832
  const m = p.match(/url\(['"]?([^'"]+)['"]?\)/);
833
833
  if (!m) return p;
834
- const y = m[1] ?? "", f = i.manifest?.items.find(({ href: I }) => `${kt(t, y).toLowerCase()}`.endsWith(
835
- `${I.toLowerCase()}`
834
+ const y = m[1] ?? "", f = i.manifest?.items.find(({ href: b }) => `${kt(t, y).toLowerCase()}`.endsWith(
835
+ `${b.toLowerCase()}`
836
836
  ));
837
837
  if (f) {
838
- const I = new nt(f, o);
838
+ const b = new nt(f, o);
839
839
  try {
840
- const b = await I.getResource();
841
- if (b instanceof Response) {
842
- const F = await b.blob(), $ = n.defaultView?.URL.createObjectURL(F);
840
+ const I = await b.getResource();
841
+ if (I instanceof Response) {
842
+ const F = await I.blob(), $ = n.defaultView?.URL.createObjectURL(F);
843
843
  return p.replace(
844
844
  m[0],
845
845
  `url("${$}")`
846
846
  );
847
847
  }
848
- } catch (b) {
849
- console.error("Error loading font:", b);
848
+ } catch (I) {
849
+ console.error("Error loading font:", I);
850
850
  }
851
851
  }
852
852
  return p;
@@ -862,7 +862,7 @@ const kt = (n, e) => {
862
862
  } catch (r) {
863
863
  console.error("Could not access stylesheet rules:", r);
864
864
  }
865
- }, Qn = (n, e, t, i, o) => {
865
+ }, ei = (n, e, t, i, o) => {
866
866
  const s = e.getAttribute("src") || e.getAttribute("href");
867
867
  if (!s) return v(null);
868
868
  const r = i.manifest?.items.find(({ href: c }) => `${kt(t, s).toLowerCase()}`.endsWith(
@@ -884,7 +884,7 @@ const kt = (n, e) => {
884
884
  return new ne((l) => {
885
885
  e.onload = async () => {
886
886
  try {
887
- e.sheet && await Kn(
887
+ e.sheet && await Qn(
888
888
  n,
889
889
  e,
890
890
  t,
@@ -899,7 +899,7 @@ const kt = (n, e) => {
899
899
  return v(null);
900
900
  })
901
901
  );
902
- }, ei = ({
902
+ }, ti = ({
903
903
  settings: n,
904
904
  item: e,
905
905
  context: t
@@ -907,8 +907,8 @@ const kt = (n, e) => {
907
907
  w((o) => {
908
908
  const s = Rt(
909
909
  o.contentDocument
910
- ), r = hn(e.href), a = s.map(
911
- (c) => Qn(
910
+ ), r = mn(e.href), a = s.map(
911
+ (c) => ei(
912
912
  o.contentDocument,
913
913
  c,
914
914
  r,
@@ -918,11 +918,11 @@ const kt = (n, e) => {
918
918
  );
919
919
  return k(a).pipe(S(() => o));
920
920
  })
921
- ), ti = (n) => {
922
- An(n?.contentDocument);
923
- }, Zs = "@prose-reader/core", Js = 0, Ks = 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) => {
921
+ ), ni = (n) => {
922
+ On(n?.contentDocument);
923
+ }, Js = "@prose-reader/core", Ks = 0, Qs = 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) => {
924
924
  if (typeof n == "string") return n;
925
- const t = mn(n.headers.get("Content-Type") || "") || Me(e.href);
925
+ const t = fn(n.headers.get("Content-Type") || "") || Me(e.href);
926
926
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
927
927
  (o) => o === t
928
928
  )) {
@@ -958,11 +958,11 @@ const kt = (n, e) => {
958
958
  </body>
959
959
  </html>
960
960
  ` : await n.text();
961
- }, ai = ({
961
+ }, ci = ({
962
962
  item: n,
963
963
  resourcesHandler: e
964
964
  }) => {
965
- const t = (i) => ri(i, n);
965
+ const t = (i) => ai(i, n);
966
966
  return (i) => i.pipe(
967
967
  w((o) => N(e.getResource()).pipe(
968
968
  w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
@@ -972,7 +972,7 @@ const kt = (n, e) => {
972
972
  "text/html",
973
973
  "text/xml"
974
974
  ].includes(n.mediaType) || // no encoding ? then try to detect html
975
- !n.mediaType && ni.some(
975
+ !n.mediaType && ii.some(
976
976
  (a) => n.href.endsWith(a)
977
977
  )) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? N(e.fetchResource()) : v(s)).pipe(
978
978
  w((a) => {
@@ -994,7 +994,7 @@ const kt = (n, e) => {
994
994
  ))
995
995
  ))
996
996
  );
997
- }, ci = () => {
997
+ }, ui = () => {
998
998
  const n = document.createElement("iframe");
999
999
  return n.frameBorder = "no", n.tabIndex = 0, n.setAttribute(
1000
1000
  "sandbox",
@@ -1027,7 +1027,7 @@ const kt = (n, e) => {
1027
1027
  n / (i.height ?? 1)
1028
1028
  ), computedWidthScale: o, viewportDimensions: i };
1029
1029
  }
1030
- }, ui = ({
1030
+ }, li = ({
1031
1031
  columnWidth: n,
1032
1032
  enableTouch: e,
1033
1033
  spreadPosition: t
@@ -1072,12 +1072,12 @@ const kt = (n, e) => {
1072
1072
  object-fit:contain;
1073
1073
  `}
1074
1074
  }
1075
- `, li = ({
1075
+ `, di = ({
1076
1076
  pageHeight: n,
1077
1077
  pageWidth: e
1078
1078
  }) => ({ columnHeight: n, columnWidth: e }), dt = (n, e) => {
1079
1079
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1080
- }, di = ({
1080
+ }, pi = ({
1081
1081
  minPageSpread: n,
1082
1082
  blankPagePosition: e,
1083
1083
  spreadPosition: t,
@@ -1089,9 +1089,9 @@ const kt = (n, e) => {
1089
1089
  }) => {
1090
1090
  const c = n * o;
1091
1091
  if (s?.contentDocument && s?.contentWindow) {
1092
- const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, g = i, h = ui(
1092
+ const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, g = i, h = li(
1093
1093
  {
1094
- ...li({ pageHeight: i, pageWidth: o }),
1094
+ ...di({ pageHeight: i, pageWidth: o }),
1095
1095
  enableTouch: a,
1096
1096
  spreadPosition: t
1097
1097
  },
@@ -1121,7 +1121,7 @@ const kt = (n, e) => {
1121
1121
  return { width: c, height: g };
1122
1122
  }
1123
1123
  return { width: c, height: i };
1124
- }, pi = () => `
1124
+ }, gi = () => `
1125
1125
  ${zt()}
1126
1126
  html {
1127
1127
  width: 100%;
@@ -1136,7 +1136,7 @@ const kt = (n, e) => {
1136
1136
  html, body {
1137
1137
  touch-action: none;
1138
1138
  }
1139
- `, gi = ({
1139
+ `, hi = ({
1140
1140
  isScrollable: n,
1141
1141
  enableTouch: e
1142
1142
  }) => `
@@ -1161,7 +1161,7 @@ const kt = (n, e) => {
1161
1161
  display: block;
1162
1162
  }
1163
1163
  ` : ""}
1164
- `, hi = ({
1164
+ `, mi = ({
1165
1165
  width: n,
1166
1166
  columnHeight: e,
1167
1167
  columnWidth: t
@@ -1229,7 +1229,7 @@ const kt = (n, e) => {
1229
1229
  td {
1230
1230
  max-width: ${t}px;
1231
1231
  }
1232
- `, mi = ({
1232
+ `, fi = ({
1233
1233
  isUsingVerticalWriting: n,
1234
1234
  minimumWidth: e,
1235
1235
  pageHeight: t,
@@ -1243,9 +1243,9 @@ const kt = (n, e) => {
1243
1243
  columnWidth: r,
1244
1244
  width: c
1245
1245
  };
1246
- }, be = (n, e) => {
1246
+ }, Ie = (n, e) => {
1247
1247
  n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
1248
- }, fi = ({
1248
+ }, yi = ({
1249
1249
  pageHeight: n,
1250
1250
  pageWidth: e,
1251
1251
  frameElement: t,
@@ -1270,8 +1270,8 @@ const kt = (n, e) => {
1270
1270
  te(
1271
1271
  t,
1272
1272
  "prose-reader-html-renderer-framce-css",
1273
- pi()
1274
- ), be(t, {
1273
+ gi()
1274
+ ), Ie(t, {
1275
1275
  width: h.width ?? 1,
1276
1276
  height: h.height ?? 1
1277
1277
  }), t?.style.setProperty("position", "absolute"), t?.style.setProperty("top", "50%"), t?.style.setProperty(
@@ -1282,26 +1282,26 @@ const kt = (n, e) => {
1282
1282
  `translate(-50%, -50%) scale(${p})`
1283
1283
  ), t?.style.setProperty("transform-origin", "center center");
1284
1284
  else {
1285
- const b = a ? gi({
1285
+ const I = a ? hi({
1286
1286
  isScrollable: i?.renditionFlow === "scrolled-continuous",
1287
1287
  enableTouch: c
1288
- }) : hi(
1289
- mi({
1288
+ }) : mi(
1289
+ fi({
1290
1290
  isUsingVerticalWriting: u,
1291
1291
  minimumWidth: l,
1292
1292
  pageHeight: g,
1293
1293
  pageWidth: e
1294
1294
  })
1295
1295
  );
1296
- if (te(t, "prose-reader-css", b, !0), u)
1296
+ if (te(t, "prose-reader-css", I, !0), u)
1297
1297
  f = Math.ceil(
1298
1298
  t.contentDocument.documentElement.scrollHeight / g
1299
- ) * g, be(t, {
1299
+ ) * g, Ie(t, {
1300
1300
  width: l,
1301
1301
  height: f
1302
1302
  });
1303
1303
  else if (i?.renditionFlow === "scrolled-continuous")
1304
- f = t.contentDocument.body.scrollHeight, be(t, {
1304
+ f = t.contentDocument.body.scrollHeight, Ie(t, {
1305
1305
  width: l,
1306
1306
  height: f
1307
1307
  });
@@ -1309,7 +1309,7 @@ const kt = (n, e) => {
1309
1309
  const F = Math.ceil(
1310
1310
  t.contentDocument.documentElement.scrollWidth / e
1311
1311
  );
1312
- m ? y = e : y = F * e, be(t, {
1312
+ m ? y = e : y = F * e, Ie(t, {
1313
1313
  width: y,
1314
1314
  height: f
1315
1315
  });
@@ -1318,19 +1318,19 @@ const kt = (n, e) => {
1318
1318
  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 };
1319
1319
  }
1320
1320
  };
1321
- class yi extends fe {
1321
+ class Si extends fe {
1322
1322
  constructor() {
1323
1323
  super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1324
1324
  }
1325
1325
  onCreateDocument() {
1326
- const e = ci();
1326
+ const e = ui();
1327
1327
  return this.setDocumentContainer(e), v(e);
1328
1328
  }
1329
1329
  onLoadDocument() {
1330
1330
  const e = this.getFrameElement();
1331
1331
  if (!e) throw new Error("invalid frame");
1332
1332
  return v(e).pipe(
1333
- ai({
1333
+ ci({
1334
1334
  item: this.item,
1335
1335
  resourcesHandler: this.resourcesHandler,
1336
1336
  settings: this.settings
@@ -1339,17 +1339,17 @@ class yi extends fe {
1339
1339
  x(() => {
1340
1340
  this.attach();
1341
1341
  }),
1342
- jn,
1343
- ei({
1342
+ kn,
1343
+ ti({
1344
1344
  context: this.context,
1345
1345
  item: this.item,
1346
1346
  settings: this.settings
1347
1347
  }),
1348
- kn
1348
+ Un
1349
1349
  );
1350
1350
  }
1351
1351
  onUnload() {
1352
- return ti(this.getFrameElement()), this.detach(), Z;
1352
+ return ni(this.getFrameElement()), this.detach(), Z;
1353
1353
  }
1354
1354
  onLayout({
1355
1355
  minPageSpread: e,
@@ -1360,7 +1360,7 @@ class yi extends fe {
1360
1360
  if (!r) return v(void 0);
1361
1361
  const a = !!this.writingMode?.startsWith("vertical");
1362
1362
  if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated") {
1363
- const u = di({
1363
+ const u = pi({
1364
1364
  blankPagePosition: t,
1365
1365
  enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
1366
1366
  frameElement: r,
@@ -1372,7 +1372,7 @@ class yi extends fe {
1372
1372
  });
1373
1373
  return v(u);
1374
1374
  }
1375
- const c = fi({
1375
+ const c = yi({
1376
1376
  pageHeight: s,
1377
1377
  pageWidth: o,
1378
1378
  frameElement: r,
@@ -1440,13 +1440,13 @@ class yi extends fe {
1440
1440
  return this.getFrameElement();
1441
1441
  }
1442
1442
  }
1443
- const Si = (n) => (e) => {
1443
+ const bi = (n) => (e) => {
1444
1444
  const t = n({
1445
1445
  ...e,
1446
1446
  getRenderer(o) {
1447
- return e.getRenderer?.(o) ?? ((r) => new yi(r));
1447
+ return e.getRenderer?.(o) ?? ((r) => new Si(r));
1448
1448
  }
1449
- }), i = Zn(t);
1449
+ }), i = Jn(t);
1450
1450
  return i.pipe(T(t.$.destroy$)).subscribe(), {
1451
1451
  ...t,
1452
1452
  links$: i
@@ -1480,7 +1480,7 @@ class _e extends it {
1480
1480
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1481
1481
  }
1482
1482
  }
1483
- class bi extends it {
1483
+ class vi extends it {
1484
1484
  constructor() {
1485
1485
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1486
1486
  }
@@ -1506,17 +1506,17 @@ class ae extends _t {
1506
1506
  return new ae(e);
1507
1507
  }
1508
1508
  }
1509
- const vi = (n, e) => {
1509
+ const wi = (n, e) => {
1510
1510
  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;
1511
1511
  return {
1512
1512
  x: u / a,
1513
1513
  y: l / c
1514
1514
  };
1515
- }, wi = (n, e) => new ae(
1516
- vi(n, e)
1517
- ), Pi = (n) => ({
1518
- getSpinePositionFromClientPosition: (e) => n.spine.element ? wi(e, n.spine.element) : void 0
1519
- }), xi = (n) => {
1515
+ }, Pi = (n, e) => new ae(
1516
+ wi(n, e)
1517
+ ), xi = (n) => ({
1518
+ getSpinePositionFromClientPosition: (e) => n.spine.element ? Pi(e, n.spine.element) : void 0
1519
+ }), $i = (n) => {
1520
1520
  let e;
1521
1521
  const t = n.context.watch("rootElement").pipe(
1522
1522
  _((c) => c ? new ne(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
@@ -1529,7 +1529,7 @@ const vi = (n, e) => {
1529
1529
  `, c.appendChild(e), () => {
1530
1530
  e?.remove(), e = void 0;
1531
1531
  })) : ge)
1532
- ), i = (c) => an(c, re).pipe(
1532
+ ), i = (c) => cn(c, re).pipe(
1533
1533
  j(() => {
1534
1534
  e?.style.setProperty(
1535
1535
  "visibility",
@@ -1555,11 +1555,11 @@ const vi = (n, e) => {
1555
1555
  G(n.$.destroy$)
1556
1556
  );
1557
1557
  return P(t, a);
1558
- }, $i = (n) => {
1558
+ }, Ti = (n) => {
1559
1559
  n.hookManager.register("item.onDocumentLoad", ({ itemId: e }) => {
1560
1560
  n.spineItemsManager.get(e)?.renderer.getDocumentFrame()?.setAttribute("scrolling", "no");
1561
1561
  });
1562
- }, Ti = (n) => {
1562
+ }, Fi = (n) => {
1563
1563
  n.hookManager.register(
1564
1564
  "item.onAfterLayout",
1565
1565
  ({ item: e, blankPagePosition: t, minimumWidth: i }) => {
@@ -1576,7 +1576,7 @@ const vi = (n, e) => {
1576
1576
  }
1577
1577
  }
1578
1578
  );
1579
- }, Fi = (n) => n.spineItemsManager.items$.pipe(
1579
+ }, Li = (n) => n.spineItemsManager.items$.pipe(
1580
1580
  w(
1581
1581
  (e) => P(
1582
1582
  ...e.map(
@@ -1589,7 +1589,7 @@ const vi = (n, e) => {
1589
1589
  )
1590
1590
  )
1591
1591
  );
1592
- let Li = class extends jt {
1592
+ let Mi = class extends jt {
1593
1593
  computeOutputSettings(e) {
1594
1594
  return e;
1595
1595
  }
@@ -1615,7 +1615,7 @@ let Li = class extends jt {
1615
1615
  };
1616
1616
  }
1617
1617
  };
1618
- const Mi = (n) => k([
1618
+ const Ci = (n) => k([
1619
1619
  n.viewport.watch(["width", "height"]),
1620
1620
  n.context.watch("manifest")
1621
1621
  ]).pipe(
@@ -1623,13 +1623,13 @@ const Mi = (n) => k([
1623
1623
  const o = e > t;
1624
1624
  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 });
1625
1625
  })
1626
- ), Ci = (n) => (e) => {
1626
+ ), Ei = (n) => (e) => {
1627
1627
  const {
1628
1628
  pageHorizontalMargin: t,
1629
1629
  pageVerticalMargin: i,
1630
1630
  layoutAutoResize: o,
1631
1631
  layoutLayerTransition: s
1632
- } = e, r = n(e), a = new Li(
1632
+ } = e, r = n(e), a = new Mi(
1633
1633
  {
1634
1634
  pageHorizontalMargin: t,
1635
1635
  pageVerticalMargin: i,
@@ -1645,12 +1645,12 @@ const Mi = (n) => k([
1645
1645
  !p && y && (y.getBoundingClientRect().left, p = !0);
1646
1646
  });
1647
1647
  }), r.hookManager.register("item.onBeforeLayout", ({ item: p }) => {
1648
- const m = r.spineItemsManager.get(p.id), f = !!(p.mediaType ?? Me(p.href))?.startsWith("image/"), { pageHorizontalMargin: I = 0, pageVerticalMargin: b = 0 } = a.values, F = r.viewport.pageSize;
1648
+ const m = r.spineItemsManager.get(p.id), f = !!(p.mediaType ?? Me(p.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: I = 0 } = a.values, F = r.viewport.pageSize;
1649
1649
  if (m?.renditionLayout === "reflowable" && !f) {
1650
- let $ = F.width - I * 2;
1651
- const A = F.height - b * 2;
1652
- let Y = F.width - I * 2, B = I * 2;
1653
- m.isUsingVerticalWriting() && (Y = F.width - I * 2, $ = A, B = b * 2);
1650
+ let $ = F.width - b * 2;
1651
+ const A = F.height - I * 2;
1652
+ let Y = F.width - b * 2, B = b * 2;
1653
+ m.isUsingVerticalWriting() && (Y = F.width - b * 2, $ = A, B = I * 2);
1654
1654
  const ie = m?.renderer.getDocumentFrame();
1655
1655
  ie && te(
1656
1656
  ie,
@@ -1658,7 +1658,7 @@ const Mi = (n) => k([
1658
1658
  `
1659
1659
  body {
1660
1660
  width: ${Y}px !important;
1661
- margin: ${b}px ${I}px !important;
1661
+ margin: ${I}px ${b}px !important;
1662
1662
  column-gap: ${B}px !important;
1663
1663
  column-width: ${$}px !important;
1664
1664
  height: ${A}px !important;
@@ -1676,7 +1676,7 @@ const Mi = (n) => k([
1676
1676
  `
1677
1677
  );
1678
1678
  }
1679
- }), Ti(r), $i(r), r.hookManager.register(
1679
+ }), Fi(r), Ti(r), r.hookManager.register(
1680
1680
  "item.onDocumentCreated",
1681
1681
  ({ documentContainer: p }) => {
1682
1682
  p.style.opacity = "0", a.values.layoutLayerTransition && (p.style.transition = "opacity 300ms");
@@ -1696,12 +1696,12 @@ const Mi = (n) => k([
1696
1696
  _(() => r.context.watch("rootElement")),
1697
1697
  se(le),
1698
1698
  _((p) => tt(p)),
1699
- bn(100),
1699
+ vn(100),
1700
1700
  se(le),
1701
1701
  j(() => {
1702
1702
  r?.layout();
1703
1703
  })
1704
- ), l = xi(r);
1704
+ ), l = $i(r);
1705
1705
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1706
1706
  Ct(1),
1707
1707
  j(() => {
@@ -1711,7 +1711,7 @@ const Mi = (n) => k([
1711
1711
  ).subscribe();
1712
1712
  const d = r.spine.pages.pipe(
1713
1713
  Ce({ refCount: !0, bufferSize: 1 })
1714
- ), g = Fi(r), h = Mi(r);
1714
+ ), g = Li(r), h = Ci(r);
1715
1715
  return P(
1716
1716
  c,
1717
1717
  l,
@@ -1727,9 +1727,9 @@ const Mi = (n) => k([
1727
1727
  settings: a,
1728
1728
  layout$: r.spine.layout$,
1729
1729
  layoutInfo$: d,
1730
- coordinates: Pi(r)
1730
+ coordinates: xi(r)
1731
1731
  };
1732
- }, Ei = `${W}-enhancer-loading`, Ht = `${Ei}-container`, Di = (n, e) => {
1732
+ }, Di = `${W}-enhancer-loading`, Ht = `${Di}-container`, Ri = (n, e) => {
1733
1733
  const t = n.ownerDocument.createElement("div");
1734
1734
  return t.classList.add(Ht), t.style.cssText = `
1735
1735
  height: 100%;
@@ -1747,7 +1747,7 @@ const Mi = (n) => k([
1747
1747
  background-color: white;
1748
1748
  z-index: 1;
1749
1749
  `, t;
1750
- }, Ri = ({
1750
+ }, Ai = ({
1751
1751
  container: n,
1752
1752
  item: e
1753
1753
  }) => {
@@ -1764,8 +1764,8 @@ const Mi = (n) => k([
1764
1764
  max-width: 300px;
1765
1765
  width: 80%;
1766
1766
  `, n.appendChild(t), n.appendChild(i), n;
1767
- }, Ai = (n) => (e) => {
1768
- const { loadingElementCreate: t = Ri } = e, i = n(e), o = (c) => v(
1767
+ }, Oi = (n) => (e) => {
1768
+ const { loadingElementCreate: t = Ai } = e, i = n(e), o = (c) => v(
1769
1769
  c.reduce((u, { item: l, element: d }) => {
1770
1770
  d.style.zIndex = "0";
1771
1771
  const g = d.querySelector(
@@ -1774,7 +1774,7 @@ const Mi = (n) => k([
1774
1774
  if (g instanceof HTMLElement)
1775
1775
  return u[l.id] = g, u;
1776
1776
  const h = t({
1777
- container: Di(d, i.viewport),
1777
+ container: Ri(d, i.viewport),
1778
1778
  item: l
1779
1779
  });
1780
1780
  return d.appendChild(h), u[l.id] = h, u;
@@ -1825,7 +1825,7 @@ const Mi = (n) => k([
1825
1825
  }
1826
1826
  };
1827
1827
  };
1828
- class Oi extends fe {
1828
+ class Ni extends fe {
1829
1829
  getImageElement() {
1830
1830
  const e = this.documentContainer;
1831
1831
  if (e instanceof HTMLImageElement)
@@ -1877,12 +1877,12 @@ class Oi extends fe {
1877
1877
  getDocumentFrame() {
1878
1878
  }
1879
1879
  }
1880
- const Ni = (n) => (e) => {
1880
+ const Vi = (n) => (e) => {
1881
1881
  const t = n({
1882
1882
  ...e,
1883
1883
  getRenderer(r) {
1884
1884
  const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
1885
- return !a && u ? (l) => new Oi(l) : a;
1885
+ return !a && u ? (l) => new Ni(l) : a;
1886
1886
  }
1887
1887
  }), i = new IntersectionObserver(
1888
1888
  (r) => {
@@ -1932,15 +1932,15 @@ const Ni = (n) => (e) => {
1932
1932
  i.disconnect(), o.disconnect(), t.destroy();
1933
1933
  }
1934
1934
  };
1935
- }, Vi = (n, e) => n.links$.pipe(
1935
+ }, ji = (n, e) => n.links$.pipe(
1936
1936
  x((t) => {
1937
- if (!On(t.target, "a") || t.type !== "click") return;
1937
+ if (!Nn(t.target, "a") || t.type !== "click") return;
1938
1938
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1939
1939
  n.context.manifest?.spineItems.some(
1940
1940
  (r) => r.href === o
1941
1941
  ) && e.goToUrl(i);
1942
1942
  })
1943
- ), oe = D.namespace("navigation"), ji = ({
1943
+ ), oe = D.namespace("navigation"), ki = ({
1944
1944
  position: n,
1945
1945
  spineItem: e,
1946
1946
  pageHeight: t,
@@ -1972,7 +1972,7 @@ const Ni = (n) => (e) => {
1972
1972
  const u = o.getSpineItemPositionFromSpinePosition(
1973
1973
  n,
1974
1974
  a
1975
- ), l = ji({
1975
+ ), l = ki({
1976
1976
  position: u,
1977
1977
  spineItem: a,
1978
1978
  pageHeight: s.pageSize.height,
@@ -1994,7 +1994,7 @@ const Ni = (n) => (e) => {
1994
1994
  x: 0
1995
1995
  })
1996
1996
  );
1997
- }, ki = ({
1997
+ }, Ui = ({
1998
1998
  position: n,
1999
1999
  spineItem: e,
2000
2000
  context: t,
@@ -2038,7 +2038,7 @@ const Ni = (n) => (e) => {
2038
2038
  return i.getAdjustedPositionForSpread(l);
2039
2039
  }
2040
2040
  return i.getAdjustedPositionForSpread(u);
2041
- }, Ui = ({
2041
+ }, zi = ({
2042
2042
  position: n,
2043
2043
  spineItem: e,
2044
2044
  pageHeight: t,
@@ -2070,7 +2070,7 @@ const Ni = (n) => (e) => {
2070
2070
  const u = o.getSpineItemPositionFromSpinePosition(
2071
2071
  n,
2072
2072
  a
2073
- ), l = Ui({
2073
+ ), l = zi({
2074
2074
  position: u,
2075
2075
  spineItem: a,
2076
2076
  pageHeight: s.pageSize.height,
@@ -2092,7 +2092,7 @@ const Ni = (n) => (e) => {
2092
2092
  x: 0
2093
2093
  })
2094
2094
  );
2095
- }, zi = ({
2095
+ }, Wi = ({
2096
2096
  position: n,
2097
2097
  spineItem: e,
2098
2098
  context: t,
@@ -2140,7 +2140,7 @@ const Ni = (n) => (e) => {
2140
2140
  }
2141
2141
  return i.getAdjustedPositionForSpread(u);
2142
2142
  };
2143
- class Wi {
2143
+ class _i {
2144
2144
  constructor(e) {
2145
2145
  this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
2146
2146
  }
@@ -2159,7 +2159,7 @@ class Wi {
2159
2159
  turnRightOrBottom() {
2160
2160
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2161
2161
  if (!t) return;
2162
- const i = zi({
2162
+ const i = Wi({
2163
2163
  context: this.reader.context,
2164
2164
  navigationResolver: this.reader.navigation.navigationResolver,
2165
2165
  position: e.position,
@@ -2177,7 +2177,7 @@ class Wi {
2177
2177
  turnLeftOrTop() {
2178
2178
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2179
2179
  if (!t) return;
2180
- const i = ki({
2180
+ const i = Ui({
2181
2181
  context: this.reader.context,
2182
2182
  navigationResolver: this.reader.navigation.navigationResolver,
2183
2183
  position: e.position,
@@ -2319,7 +2319,7 @@ class Wi {
2319
2319
  }
2320
2320
  }
2321
2321
  }
2322
- class _i {
2322
+ class Hi {
2323
2323
  constructor(e) {
2324
2324
  this.reader = e, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new M({ x: 0, y: 0 }), this.lastStartPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
2325
2325
  }
@@ -2358,8 +2358,8 @@ class _i {
2358
2358
  });
2359
2359
  }
2360
2360
  }
2361
- const Hi = 500;
2362
- class Bi extends X {
2361
+ const Bi = 500;
2362
+ class Xi extends X {
2363
2363
  constructor(e, t) {
2364
2364
  super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new R(), this.navigation$ = this.navigationSubject.asObservable();
2365
2365
  const i = this.scrollNavigationController.userScroll$.pipe(
@@ -2370,7 +2370,7 @@ class Bi extends X {
2370
2370
  v(o)
2371
2371
  ).pipe(
2372
2372
  Se(
2373
- Hi,
2373
+ Bi,
2374
2374
  re
2375
2375
  ),
2376
2376
  U(),
@@ -2393,7 +2393,7 @@ class Bi extends X {
2393
2393
  P(i).pipe(T(this.destroy$)).subscribe();
2394
2394
  }
2395
2395
  }
2396
- const Xi = (n) => n.pagination.state$.pipe(
2396
+ const Yi = (n) => n.pagination.state$.pipe(
2397
2397
  O(n.context.manifest$, n.settings.values$),
2398
2398
  S(
2399
2399
  ([
@@ -2413,7 +2413,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2413
2413
  }
2414
2414
  ),
2415
2415
  z(V)
2416
- ), Yi = ({ reader: n, duration: e }) => (t) => {
2416
+ ), qi = ({ reader: n, duration: e }) => (t) => {
2417
2417
  let i;
2418
2418
  const o = () => {
2419
2419
  i?.(), i = void 0;
@@ -2422,18 +2422,18 @@ const Xi = (n) => n.pagination.state$.pipe(
2422
2422
  x(() => {
2423
2423
  i || (i = n?.navigation.lock());
2424
2424
  }),
2425
- cn(e, re, {
2425
+ un(e, re, {
2426
2426
  trailing: !0,
2427
2427
  leading: !0
2428
2428
  }),
2429
2429
  x(o),
2430
2430
  de(o)
2431
2431
  );
2432
- }, qi = (n) => (e) => {
2433
- const t = n(e), i = Xi(t), o = new Wi(t), s = new _i(t), r = new Bi(
2432
+ }, Gi = (n) => (e) => {
2433
+ const t = n(e), i = Yi(t), o = new _i(t), s = new Hi(t), r = new Xi(
2434
2434
  t.navigation.scrollNavigationController,
2435
2435
  t.navigation.locker
2436
- ), a = Vi(t, o), c = r.navigation$.pipe(
2436
+ ), a = ji(t, o), c = r.navigation$.pipe(
2437
2437
  x((d) => {
2438
2438
  t.navigation.navigate(d);
2439
2439
  })
@@ -2450,7 +2450,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2450
2450
  navigation: {
2451
2451
  ...t.navigation,
2452
2452
  state$: i,
2453
- throttleLock: ({ duration: d, trigger: g }) => g.pipe(Yi({ duration: d, reader: t })),
2453
+ throttleLock: ({ duration: d, trigger: g }) => g.pipe(qi({ duration: d, reader: t })),
2454
2454
  moveTo: s.moveTo.bind(s),
2455
2455
  turnBottom: o.turnBottom.bind(o),
2456
2456
  turnTop: o.turnTop.bind(o),
@@ -2498,19 +2498,19 @@ const Xi = (n) => n.pagination.state$.pipe(
2498
2498
  }
2499
2499
  return o;
2500
2500
  }, void 0);
2501
- }, Gi = (n, e) => {
2501
+ }, Zi = (n, e) => {
2502
2502
  const { href: t } = e;
2503
2503
  return Bt(t, n.nav?.toc ?? [], n);
2504
- }, Zi = (n) => {
2504
+ }, Ji = (n) => {
2505
2505
  const e = n.context.manifest, t = n.spineItemsManager.items;
2506
2506
  return e ? t.reduce(
2507
- (i, { item: o }) => (i[o.id] = Gi(e, o), i),
2507
+ (i, { item: o }) => (i[o.id] = Zi(e, o), i),
2508
2508
  {}
2509
2509
  ) : {};
2510
- }, Ji = (n) => n.spineItemsManager.items$.pipe(
2510
+ }, Ki = (n) => n.spineItemsManager.items$.pipe(
2511
2511
  ee([]),
2512
- S(() => Zi(n))
2513
- ), Ki = (n, e, t) => n + e * t, Qi = (n, e, t) => {
2512
+ S(() => Ji(n))
2513
+ ), Qi = (n, e, t) => n + e * t, eo = (n, e, t) => {
2514
2514
  const { height: i, width: o } = t.layout.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
2515
2515
  return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2516
2516
  0,
@@ -2525,27 +2525,27 @@ const Xi = (n) => n.pagination.state$.pipe(
2525
2525
  (e.x - r + n.viewport.absoluteViewport.width) / o
2526
2526
  )
2527
2527
  );
2528
- }, eo = (n, e, t, i, o) => o.isReady$.pipe(
2528
+ }, to = (n, e, t, i, o) => o.isReady$.pipe(
2529
2529
  U(),
2530
2530
  O(n.layoutInfo$),
2531
2531
  S(([s, r]) => {
2532
- const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, h = r.pages.filter((f) => f.itemIndex === d).length ?? 0, p = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
2532
+ const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, b) => f + (b.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, h = r.pages.filter((f) => f.itemIndex === d).length ?? 0, p = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
2533
2533
  // relative to the total number of documents
2534
2534
  (d + 1) / g;
2535
2535
  let m = (t + 1) * (p / h);
2536
2536
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2537
2537
  let y = l + m;
2538
- return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Qi(
2538
+ return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = eo(
2539
2539
  n,
2540
2540
  i,
2541
2541
  o
2542
- ) : m = 0, y = Ki(
2542
+ ) : m = 0, y = Qi(
2543
2543
  l,
2544
2544
  p,
2545
2545
  m
2546
2546
  )), e === u - 1 && t === h - 1 && y > 0.99 ? 1 : y;
2547
2547
  })
2548
- ), to = (n) => n.spine.layout$.pipe(
2548
+ ), no = (n) => n.spine.layout$.pipe(
2549
2549
  Se(10, re),
2550
2550
  O(n.pagination.state$),
2551
2551
  S(() => ({
@@ -2563,7 +2563,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2563
2563
  numberOfPagesPerItems: [],
2564
2564
  numberOfTotalPages: 0
2565
2565
  })
2566
- ), no = (n, e, t, i) => {
2566
+ ), io = (n, e, t, i) => {
2567
2567
  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;
2568
2568
  return v({
2569
2569
  ...e,
@@ -2594,7 +2594,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2594
2594
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2595
2595
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2596
2596
  });
2597
- }, io = (n) => k([
2597
+ }, oo = (n) => k([
2598
2598
  n.pagination.state$,
2599
2599
  // Usually pagination change if layout changes (number of pages) however it is especially
2600
2600
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2603,7 +2603,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2603
2603
  ]).pipe(
2604
2604
  w(([e]) => {
2605
2605
  const t = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
2606
- return t ? eo(
2606
+ return t ? to(
2607
2607
  n,
2608
2608
  e.endSpineItemIndex ?? 0,
2609
2609
  e.endPageIndexInSpineItem || 0,
@@ -2611,8 +2611,8 @@ const Xi = (n) => n.pagination.state$.pipe(
2611
2611
  t
2612
2612
  ) : v(0);
2613
2613
  })
2614
- ), oo = (n) => {
2615
- const e = Ji(n), t = to(n), i = new H({
2614
+ ), so = (n) => {
2615
+ const e = Ki(n), t = no(n), i = new H({
2616
2616
  ...n.pagination.state,
2617
2617
  beginChapterInfo: void 0,
2618
2618
  beginCfi: void 0,
@@ -2630,10 +2630,10 @@ const Xi = (n) => n.pagination.state$.pipe(
2630
2630
  }), o = k([
2631
2631
  n.pagination.state$,
2632
2632
  e,
2633
- io(n)
2633
+ oo(n)
2634
2634
  ]).pipe(
2635
2635
  w(
2636
- ([r, a, c]) => no(
2636
+ ([r, a, c]) => io(
2637
2637
  n,
2638
2638
  r,
2639
2639
  a,
@@ -2677,7 +2677,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2677
2677
  item: t
2678
2678
  }) => {
2679
2679
  const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
2680
- return !i || !i?.documentElement || n === i ? he(t) : Nn(n) ? ze({
2680
+ return !i || !i?.documentElement || n === i ? he(t) : Vn(n) ? ze({
2681
2681
  start: {
2682
2682
  node: n.startContainer,
2683
2683
  offset: n.startOffset,
@@ -2709,14 +2709,14 @@ const Xi = (n) => n.pagination.state$.pipe(
2709
2709
  offset: o.offset,
2710
2710
  item: e.item
2711
2711
  }).trim() : he(e.item);
2712
- }, so = (n, e) => Xt({
2712
+ }, ro = (n, e) => Xt({
2713
2713
  nodeOrRange: n,
2714
2714
  item: e
2715
- }), er = (n) => n.index.toString(), ht = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
2715
+ }), tr = (n) => n.index.toString(), ht = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
2716
2716
  const e = Et(n);
2717
- return wn(e);
2718
- }, ro = (n) => Array.isArray(n) ? n[0] && ht(n[0]) ? n[0] : void 0 : n.parent[0] && ht(n.parent[0]) ? n.parent[0] : void 0, ot = (n) => {
2719
- const e = Et(n), s = ((ro(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2717
+ return Pn(e);
2718
+ }, ao = (n) => Array.isArray(n) ? n[0] && ht(n[0]) ? n[0] : void 0 : n.parent[0] && ht(n.parent[0]) ? n.parent[0] : void 0, ot = (n) => {
2719
+ const e = Et(n), s = ((ao(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = xn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
2720
2720
  return {
2721
2721
  isCfiRange: r,
2722
2722
  cleanedCfi: n,
@@ -2739,7 +2739,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2739
2739
  const r = s.contentWindow?.document;
2740
2740
  if (r)
2741
2741
  try {
2742
- const a = xn(n, r, {
2742
+ const a = $n(n, r, {
2743
2743
  throwOnError: !0
2744
2744
  });
2745
2745
  return {
@@ -2766,7 +2766,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2766
2766
  spineItem: o,
2767
2767
  node: null
2768
2768
  };
2769
- }, ao = (n, e) => {
2769
+ }, co = (n, e) => {
2770
2770
  if ("cfi" in e) {
2771
2771
  const { itemIndex: s, ...r } = n.cfi.parseCfi(e.cfi);
2772
2772
  return {
@@ -2786,7 +2786,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2786
2786
  itemIndex: t.index,
2787
2787
  node: null
2788
2788
  };
2789
- }, co = (n, e) => {
2789
+ }, uo = (n, e) => {
2790
2790
  let t = n?.itemPageIndex;
2791
2791
  const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
2792
2792
  return s ? Vt().pipe(
@@ -2819,7 +2819,7 @@ const Xi = (n) => n.pagination.state$.pipe(
2819
2819
  })
2820
2820
  ) : v({ ...n, itemIndex: i, ...o });
2821
2821
  };
2822
- class uo {
2822
+ class lo {
2823
2823
  constructor(e) {
2824
2824
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (t) => {
2825
2825
  const i = this.locatorsByKey.get(t);
@@ -2827,7 +2827,7 @@ class uo {
2827
2827
  }, this.locate = (t, i) => {
2828
2828
  const o = {
2829
2829
  resource: t,
2830
- meta: ao(this.reader, t)
2830
+ meta: co(this.reader, t)
2831
2831
  };
2832
2832
  return ut(() => {
2833
2833
  const s = this.reader.spineItemsManager.get(
@@ -2852,7 +2852,7 @@ class uo {
2852
2852
  const d = this.reader.spine.layout$.pipe(
2853
2853
  Se(10),
2854
2854
  ee(o),
2855
- un((g) => co(g.meta, this.reader).pipe(
2855
+ ln((g) => uo(g.meta, this.reader).pipe(
2856
2856
  S((h) => ({
2857
2857
  ...g,
2858
2858
  meta: h
@@ -2871,14 +2871,14 @@ class uo {
2871
2871
  return Array.isArray(e) ? ut(
2872
2872
  () => k(
2873
2873
  e.map((i) => this.locate(i, t ?? {}))
2874
- ).pipe(ln([]))
2874
+ ).pipe(dn([]))
2875
2875
  ) : this.locate(e, t ?? {});
2876
2876
  }
2877
2877
  }
2878
- const lo = (n) => (e) => {
2879
- const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = oo(t);
2878
+ const po = (n) => (e) => {
2879
+ const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = so(t);
2880
2880
  i.pipe(T(t.$.destroy$)).subscribe();
2881
- const s = new uo(t);
2881
+ const s = new lo(t);
2882
2882
  return {
2883
2883
  ...t,
2884
2884
  locateResource: s.locateResource.bind(s),
@@ -2892,7 +2892,7 @@ const lo = (n) => (e) => {
2892
2892
  }
2893
2893
  }
2894
2894
  };
2895
- }, po = (n) => ({
2895
+ }, go = (n) => ({
2896
2896
  put: (s, r) => new Promise((a, c) => {
2897
2897
  const u = n.transaction(["store"], "readwrite");
2898
2898
  u.onerror = (g) => {
@@ -2949,11 +2949,11 @@ const lo = (n) => (e) => {
2949
2949
  i.onerror = (o) => {
2950
2950
  t(o);
2951
2951
  }, i.onsuccess = () => {
2952
- e(po(i.result));
2952
+ e(go(i.result));
2953
2953
  }, i.onupgradeneeded = () => {
2954
2954
  i.result.createObjectStore("store");
2955
2955
  };
2956
- }), go = (n) => {
2956
+ }), ho = (n) => {
2957
2957
  let e = Date.now().toString();
2958
2958
  const t = new R(), i = (c) => {
2959
2959
  if (typeof c == "string" || typeof c == "object") {
@@ -2973,10 +2973,10 @@ const lo = (n) => (e) => {
2973
2973
  t.next({ id: c, data: u });
2974
2974
  };
2975
2975
  t.asObservable().pipe(
2976
- vn(({ id: c, data: u }) => {
2976
+ wn(({ id: c, data: u }) => {
2977
2977
  const l = i(c);
2978
2978
  return l ? N(
2979
- dn([Oe("prose-reader"), N(u.blob())])
2979
+ pn([Oe("prose-reader"), N(u.blob())])
2980
2980
  ).pipe(
2981
2981
  _(([d, g]) => N(d.put(`${e}_${l.id}`, g))),
2982
2982
  at((d) => (D.error(d), Z))
@@ -3011,8 +3011,8 @@ const lo = (n) => (e) => {
3011
3011
  t.complete();
3012
3012
  }
3013
3013
  };
3014
- }, ho = (n) => (e) => {
3015
- const t = n(e), i = go(t.context);
3014
+ }, mo = (n) => (e) => {
3015
+ const t = n(e), i = ho(t.context);
3016
3016
  return {
3017
3017
  ...t,
3018
3018
  // $: {
@@ -3024,7 +3024,7 @@ const lo = (n) => (e) => {
3024
3024
  }
3025
3025
  // load,
3026
3026
  };
3027
- }, mo = (n, e) => {
3027
+ }, fo = (n, e) => {
3028
3028
  const t = n.node.ownerDocument?.createRange(), i = n.node.compareDocumentPosition(e.node);
3029
3029
  if (t) {
3030
3030
  try {
@@ -3044,14 +3044,14 @@ const lo = (n) => (e) => {
3044
3044
  }
3045
3045
  return t;
3046
3046
  }
3047
- }, fo = ({
3047
+ }, yo = ({
3048
3048
  selection: n,
3049
3049
  spineItem: e
3050
3050
  }) => {
3051
3051
  const { anchorNode: t, anchorOffset: i, focusNode: o, focusOffset: s } = n;
3052
3052
  if (!(!t || !o))
3053
3053
  try {
3054
- return mo(
3054
+ return fo(
3055
3055
  { node: t, offset: i },
3056
3056
  { node: o, offset: s }
3057
3057
  );
@@ -3063,7 +3063,7 @@ const lo = (n) => (e) => {
3063
3063
  return;
3064
3064
  }
3065
3065
  };
3066
- class yo extends X {
3066
+ class So extends X {
3067
3067
  constructor(e) {
3068
3068
  super();
3069
3069
  const t = e.contentDocument || e.contentWindow?.document;
@@ -3118,11 +3118,11 @@ class yo extends X {
3118
3118
  }
3119
3119
  }
3120
3120
  }
3121
- const So = (n) => n.watch("isLoaded").pipe(
3121
+ const bo = (n) => n.watch("isLoaded").pipe(
3122
3122
  w(() => {
3123
3123
  const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
3124
3124
  if (!e || !t) return ge;
3125
- const i = new yo(e);
3125
+ const i = new So(e);
3126
3126
  return P(
3127
3127
  i.selectionChange$.pipe(
3128
3128
  S((o) => {
@@ -3156,7 +3156,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3156
3156
  w((l) => {
3157
3157
  const d = l.map((g) => {
3158
3158
  const h = t.spineItemsManager.getSpineItemIndex(g) ?? 0;
3159
- return So(g).pipe(
3159
+ return bo(g).pipe(
3160
3160
  S((p) => {
3161
3161
  if (p)
3162
3162
  return {
@@ -3204,7 +3204,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3204
3204
  selectionOver$: c,
3205
3205
  lastSelectionOnPointerdown$: u,
3206
3206
  getSelection: () => i,
3207
- createOrderedRangeFromSelection: fo
3207
+ createOrderedRangeFromSelection: yo
3208
3208
  }
3209
3209
  };
3210
3210
  }, mt = [
@@ -3222,7 +3222,7 @@ const So = (n) => n.watch("isLoaded").pipe(
3222
3222
  backgroundColor: "#191717",
3223
3223
  foregroundColor: "#f1ebeb"
3224
3224
  }
3225
- ], bo = (n) => (e) => {
3225
+ ], vo = (n) => (e) => {
3226
3226
  const t = n(e), i = new H(
3227
3227
  e.theme ?? "bright"
3228
3228
  ), o = () => {
@@ -3287,14 +3287,14 @@ const So = (n) => n.watch("isLoaded").pipe(
3287
3287
  }
3288
3288
  }
3289
3289
  };
3290
- }, vo = (n) => (e) => ({
3290
+ }, wo = (n) => (e) => ({
3291
3291
  ...n(e),
3292
3292
  utils: {
3293
3293
  isOrIsWithinValidLink: (o) => !!(Ot(o) && (o.nodeName === "a" ? o : o.closest("a"))?.getAttribute("href"))
3294
3294
  }
3295
3295
  });
3296
3296
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3297
- 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}";
3297
+ const Po = (n) => (e) => n(e), xo = "[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}";
3298
3298
  class ce extends ne {
3299
3299
  constructor(e) {
3300
3300
  super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new R(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new H(e);
@@ -3322,36 +3322,166 @@ class ce extends ne {
3322
3322
  this.stateSubject.complete(), this._destroy$.complete();
3323
3323
  }
3324
3324
  }
3325
- const xo = (n, e, t) => {
3325
+ const $o = (n, e, t) => {
3326
3326
  t.style.transformOrigin = "0 0";
3327
3327
  const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${n})`;
3328
3328
  t.style.transform = `${i} ${o}`;
3329
- }, $o = (n, e, t, i) => {
3329
+ }, To = (n, e, t, i) => {
3330
3330
  const o = e / n, s = t.clientWidth, r = t.clientHeight, a = s / 2 - i.x, c = r / 2 - i.y;
3331
3331
  return {
3332
3332
  x: i.x + a * (1 - o),
3333
3333
  y: i.y + c * (1 - o)
3334
3334
  };
3335
- }, To = (n, e, t, i, o) => {
3335
+ };
3336
+ class qt {
3337
+ constructor(e) {
3338
+ this.x = e.x, this.y = e.y;
3339
+ }
3340
+ }
3341
+ class ft extends qt {
3342
+ }
3343
+ class Fo extends qt {
3344
+ constructor() {
3345
+ super(...arguments), this.__symbol = Symbol("UnboundScrollPosition");
3346
+ }
3347
+ }
3348
+ class Lo extends ce {
3349
+ constructor(e, t, i, o, s) {
3350
+ super({
3351
+ element: void 0
3352
+ }), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new R(), this.scrollingSubject = new H(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({
3353
+ position: d
3354
+ }) => {
3355
+ const g = this.value.element;
3356
+ this.scrollingSubject.next(!0);
3357
+ const h = this.fromSpinePosition(d);
3358
+ g?.scrollTo({
3359
+ left: h.x,
3360
+ top: h.y,
3361
+ behavior: "instant"
3362
+ }), Te(1).pipe(
3363
+ x(() => {
3364
+ this.scrollingSubject.next(!1);
3365
+ }),
3366
+ T(P(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3367
+ ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3368
+ };
3369
+ const r = this.context.pipe(
3370
+ et(["rootElement"]),
3371
+ x(({ rootElement: d }) => {
3372
+ if (!d) return;
3373
+ const g = document.createElement("div");
3374
+ g.setAttribute(`data-${ri}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
3375
+ })
3376
+ ), a = k([
3377
+ t.watch(["computedPageTurnMode"]),
3378
+ this.watch("element")
3379
+ ]).pipe(
3380
+ x(([{ computedPageTurnMode: d }, g]) => {
3381
+ g && (d === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
3382
+ })
3383
+ ), c = this.navigateSubject.pipe(x(this.setViewportPosition));
3384
+ this.isNavigating$ = this.navigateSubject.pipe(
3385
+ ee(!1),
3386
+ w(() => P(v(!0), v(!1))),
3387
+ J(1)
3388
+ );
3389
+ const u = P(
3390
+ o.element$.pipe(
3391
+ L(le),
3392
+ w((d) => tt(d))
3393
+ ),
3394
+ o.element$.pipe(
3395
+ L(le),
3396
+ w((d) => q(d, "scroll"))
3397
+ ),
3398
+ o.spineItemsObserver.itemResize$
3399
+ ).pipe(
3400
+ w(
3401
+ () => Te(10).pipe(
3402
+ S(() => !1),
3403
+ ee(!0)
3404
+ )
3405
+ ),
3406
+ z(),
3407
+ ee(!1)
3408
+ ), l = k([
3409
+ u,
3410
+ this.isScrolling$
3411
+ ]).pipe(
3412
+ S(
3413
+ ([d, g]) => d || g
3414
+ ),
3415
+ J(1)
3416
+ );
3417
+ this.userScroll$ = this.watch("element").pipe(
3418
+ L(le),
3419
+ w(
3420
+ (d) => t.watch(["computedPageTurnMode"]).pipe(
3421
+ w(
3422
+ ({ computedPageTurnMode: g }) => g === "controlled" ? ge : q(d, "scroll").pipe(
3423
+ O(l),
3424
+ L(
3425
+ ([, h]) => !h
3426
+ ),
3427
+ S(([h]) => h)
3428
+ )
3429
+ )
3430
+ )
3431
+ ),
3432
+ E()
3433
+ ), P(r, a, c).pipe(T(this.destroy$)).subscribe();
3434
+ }
3435
+ update(e) {
3436
+ this.mergeCompare(e);
3437
+ }
3438
+ navigate(e) {
3439
+ this.navigateSubject.next(e);
3440
+ }
3441
+ fromScrollPosition(e) {
3442
+ const t = this.viewport.scaleFactor;
3443
+ return new ae({
3444
+ x: e.x / t,
3445
+ y: e.y / t
3446
+ });
3447
+ }
3448
+ fromSpinePosition(e) {
3449
+ const t = this.viewport.scaleFactor;
3450
+ return new ft({
3451
+ x: e.x * t,
3452
+ y: e.y * t
3453
+ });
3454
+ }
3455
+ get scrollPosition() {
3456
+ const e = this.value.element;
3457
+ return new ft({
3458
+ x: e?.scrollLeft ?? 0,
3459
+ y: e?.scrollTop ?? 0
3460
+ });
3461
+ }
3462
+ }
3463
+ const Mo = (n, e, t, i, o) => {
3336
3464
  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, g = u * d, h = l * d, p = g - s / 2 + i, m = h - r / 2 + o;
3337
- return { newScrollLeft: p, newScrollTop: m };
3338
- }, Fo = (n, e) => {
3339
- const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = t.scaleFactor, c = o.offsetLeft, u = o.offsetTop, { newScrollLeft: l, newScrollTop: d } = To(
3340
- s ?? Rn(),
3465
+ return new Fo({
3466
+ x: p,
3467
+ y: m
3468
+ });
3469
+ }, Co = (n, e) => {
3470
+ 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 = Mo(
3471
+ s ?? An(),
3341
3472
  a,
3342
3473
  n,
3343
3474
  c,
3344
3475
  u
3345
- ), g = n < 1 ? "down" : "up";
3476
+ ), d = n < 1 ? "down" : "up";
3346
3477
  return r?.setAttribute(
3347
3478
  `data-${W}-zooming-direction`,
3348
- g
3349
- ), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})`, i.fromScrollPosition({
3350
- x: l,
3351
- y: d
3352
- });
3479
+ d
3480
+ ), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})`, i.fromScrollPosition(
3481
+ l
3482
+ );
3353
3483
  }, ve = 200;
3354
- class Lo extends ce {
3484
+ class Eo extends ce {
3355
3485
  constructor(e) {
3356
3486
  super({
3357
3487
  isZooming: !1,
@@ -3417,7 +3547,7 @@ class Lo extends ce {
3417
3547
  }
3418
3548
  updateZoom(e, t) {
3419
3549
  if (this.isControlled) {
3420
- const i = t || $o(
3550
+ const i = t || To(
3421
3551
  this.value.currentScale,
3422
3552
  e,
3423
3553
  this.viewport.element,
@@ -3434,13 +3564,13 @@ class Lo extends ce {
3434
3564
  }
3435
3565
  applyZoom(e, t) {
3436
3566
  if (this.isControlled)
3437
- xo(
3567
+ $o(
3438
3568
  e,
3439
3569
  t,
3440
3570
  this.viewport.element
3441
3571
  );
3442
3572
  else {
3443
- const i = Fo(e, this.reader);
3573
+ const i = Co(e, this.reader);
3444
3574
  this.reader.navigation.navigate({
3445
3575
  position: i
3446
3576
  });
@@ -3456,11 +3586,11 @@ class Lo extends ce {
3456
3586
  return this.reader.viewport.value;
3457
3587
  }
3458
3588
  }
3459
- const ft = `${Ut}-enhancer-zoom`, Mo = (n) => (e) => {
3460
- const t = n(e), i = new Lo(t);
3461
- Je(document, ft, Po);
3589
+ const yt = `${Ut}-enhancer-zoom`, Do = (n) => (e) => {
3590
+ const t = n(e), i = new Eo(t);
3591
+ Je(document, yt, xo);
3462
3592
  const o = () => {
3463
- Ke(document, ft), i.destroy(), t.destroy();
3593
+ Ke(document, yt), i.destroy(), t.destroy();
3464
3594
  }, s = i;
3465
3595
  return {
3466
3596
  ...t,
@@ -3476,8 +3606,8 @@ const ft = `${Ut}-enhancer-zoom`, Mo = (n) => (e) => {
3476
3606
  }
3477
3607
  }
3478
3608
  };
3479
- }, qt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3480
- class Co {
3609
+ }, Gt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
3610
+ class Ro {
3481
3611
  constructor() {
3482
3612
  this.navigationSubject = new st(1), this.viewportStateSubject = new H("free"), this.paginationSubject = new st(), this.navigationIsLockedSubject = new H(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3483
3613
  z(),
@@ -3489,11 +3619,11 @@ class Co {
3489
3619
  ), this.navigation$ = this.navigationSubject.asObservable();
3490
3620
  }
3491
3621
  }
3492
- class Eo extends ce {
3622
+ class Ao extends ce {
3493
3623
  constructor() {
3494
3624
  super({
3495
3625
  assumedRenditionLayout: "reflowable"
3496
- }), this.bridgeEvent = new Co(), this.manifest$ = this.pipe(
3626
+ }), this.bridgeEvent = new Ro(), this.manifest$ = this.pipe(
3497
3627
  K((e) => e.manifest),
3498
3628
  se(le),
3499
3629
  pe()
@@ -3504,7 +3634,7 @@ class Eo extends ce {
3504
3634
  ...t,
3505
3635
  ...e,
3506
3636
  ...e.manifest && {
3507
- isFullyPrePaginated: qt(i),
3637
+ isFullyPrePaginated: Gt(i),
3508
3638
  assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
3509
3639
  }
3510
3640
  };
@@ -3517,7 +3647,7 @@ class Eo extends ce {
3517
3647
  return this.manifest?.readingDirection;
3518
3648
  }
3519
3649
  }
3520
- class Do extends ce {
3650
+ class Oo extends ce {
3521
3651
  constructor(e, t) {
3522
3652
  super({
3523
3653
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3552,7 +3682,7 @@ class Do extends ce {
3552
3682
  ).subscribe(this.next.bind(this));
3553
3683
  }
3554
3684
  }
3555
- class Ro {
3685
+ class No {
3556
3686
  constructor() {
3557
3687
  this._hooks = [], this._hookExecutions = [];
3558
3688
  }
@@ -3614,17 +3744,17 @@ class Ro {
3614
3744
  return k(s);
3615
3745
  }
3616
3746
  }
3617
- 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%}", Oo = (n) => ({
3747
+ const Vo = "[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%}", jo = (n) => ({
3618
3748
  x: -n.x,
3619
3749
  y: -n.y
3620
- }), No = (n) => n instanceof DOMMatrix ? new M({
3750
+ }), ko = (n) => n instanceof DOMMatrix ? new M({
3621
3751
  x: -n.e,
3622
3752
  y: -n.f
3623
3753
  }) : new M({
3624
3754
  x: -n.x,
3625
3755
  y: -n.y
3626
- }), Vo = "navigation/ViewportNavigator", yt = D.namespace(Vo);
3627
- class jo extends X {
3756
+ }), Uo = "navigation/ViewportNavigator", St = D.namespace(Uo);
3757
+ class zo extends X {
3628
3758
  constructor(e, t, i, o, s) {
3629
3759
  super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new R(), this.element$ = new H(
3630
3760
  document.createElement("div")
@@ -3653,13 +3783,13 @@ class jo extends X {
3653
3783
  );
3654
3784
  this.layout$ = c.pipe(
3655
3785
  x(() => {
3656
- yt.info("layout", e.values);
3786
+ St.info("layout", e.values);
3657
3787
  }),
3658
3788
  E()
3659
3789
  );
3660
3790
  const u = this.navigateSubject.pipe(
3661
3791
  x((l) => {
3662
- yt.info("Navigation requested", l);
3792
+ St.info("Navigation requested", l);
3663
3793
  })
3664
3794
  );
3665
3795
  this.isNavigating$ = u.pipe(
@@ -3736,7 +3866,7 @@ class jo extends X {
3736
3866
  * for remark about flicker / fonts smoothing
3737
3867
  */
3738
3868
  setViewportPosition(e) {
3739
- const t = this.element$.getValue(), i = Oo(e);
3869
+ const t = this.element$.getValue(), i = jo(e);
3740
3870
  t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3741
3871
  }
3742
3872
  navigate(e) {
@@ -3751,132 +3881,10 @@ class jo extends X {
3751
3881
  if (!i || i === "none")
3752
3882
  return new M({ x: 0, y: 0 });
3753
3883
  const o = new DOMMatrix(i);
3754
- return No(o);
3755
- }
3756
- }
3757
- class ko {
3758
- constructor(e) {
3759
- this.x = e.x, this.y = e.y;
3884
+ return ko(o);
3760
3885
  }
3761
3886
  }
3762
- class St extends ko {
3763
- }
3764
- class Uo extends ce {
3765
- constructor(e, t, i, o, s) {
3766
- super({
3767
- element: void 0
3768
- }), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new R(), this.scrollingSubject = new H(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({
3769
- position: d
3770
- }) => {
3771
- const g = this.value.element;
3772
- this.scrollingSubject.next(!0);
3773
- const h = this.fromSpinePosition(d);
3774
- g?.scrollTo({
3775
- left: h.x,
3776
- top: h.y,
3777
- behavior: "instant"
3778
- }), Te(1).pipe(
3779
- x(() => {
3780
- this.scrollingSubject.next(!1);
3781
- }),
3782
- T(P(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
3783
- ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
3784
- };
3785
- const r = this.context.pipe(
3786
- et(["rootElement"]),
3787
- x(({ rootElement: d }) => {
3788
- if (!d) return;
3789
- const g = document.createElement("div");
3790
- g.setAttribute(`data-${si}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
3791
- })
3792
- ), a = k([
3793
- t.watch(["computedPageTurnMode"]),
3794
- this.watch("element")
3795
- ]).pipe(
3796
- x(([{ computedPageTurnMode: d }, g]) => {
3797
- g && (d === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
3798
- })
3799
- ), c = this.navigateSubject.pipe(x(this.setViewportPosition));
3800
- this.isNavigating$ = this.navigateSubject.pipe(
3801
- ee(!1),
3802
- w(() => P(v(!0), v(!1))),
3803
- J(1)
3804
- );
3805
- const u = P(
3806
- o.element$.pipe(
3807
- L(le),
3808
- w((d) => tt(d))
3809
- ),
3810
- o.element$.pipe(
3811
- L(le),
3812
- w((d) => q(d, "scroll"))
3813
- ),
3814
- o.spineItemsObserver.itemResize$
3815
- ).pipe(
3816
- w(
3817
- () => Te(10).pipe(
3818
- S(() => !1),
3819
- ee(!0)
3820
- )
3821
- ),
3822
- z(),
3823
- ee(!1)
3824
- ), l = k([
3825
- u,
3826
- this.isScrolling$
3827
- ]).pipe(
3828
- S(
3829
- ([d, g]) => d || g
3830
- ),
3831
- J(1)
3832
- );
3833
- this.userScroll$ = this.watch("element").pipe(
3834
- L(le),
3835
- w(
3836
- (d) => t.watch(["computedPageTurnMode"]).pipe(
3837
- w(
3838
- ({ computedPageTurnMode: g }) => g === "controlled" ? ge : q(d, "scroll").pipe(
3839
- O(l),
3840
- L(
3841
- ([, h]) => !h
3842
- ),
3843
- S(([h]) => h)
3844
- )
3845
- )
3846
- )
3847
- ),
3848
- E()
3849
- ), P(r, a, c).pipe(T(this.destroy$)).subscribe();
3850
- }
3851
- update(e) {
3852
- this.mergeCompare(e);
3853
- }
3854
- navigate(e) {
3855
- this.navigateSubject.next(e);
3856
- }
3857
- fromScrollPosition(e) {
3858
- const t = this.viewport.scaleFactor;
3859
- return new ae({
3860
- x: e.x / t,
3861
- y: e.y / t
3862
- });
3863
- }
3864
- fromSpinePosition(e) {
3865
- const t = this.viewport.scaleFactor;
3866
- return new St({
3867
- x: e.x * t,
3868
- y: e.y * t
3869
- });
3870
- }
3871
- get scrollPosition() {
3872
- const e = this.value.element;
3873
- return new St({
3874
- x: e?.scrollLeft ?? 0,
3875
- y: e?.scrollTop ?? 0
3876
- });
3877
- }
3878
- }
3879
- const zo = () => (n) => n.pipe(
3887
+ const Wo = () => (n) => n.pipe(
3880
3888
  S(({ navigation: e, pagination: t, ...i }) => ({
3881
3889
  navigation: {
3882
3890
  ...e,
@@ -3884,7 +3892,7 @@ const zo = () => (n) => n.pipe(
3884
3892
  },
3885
3893
  ...i
3886
3894
  }))
3887
- ), Wo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3895
+ ), _o = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3888
3896
  O(e),
3889
3897
  L(
3890
3898
  ([i, o]) => i.navigationId === o.id
@@ -3901,7 +3909,7 @@ const zo = () => (n) => n.pipe(
3901
3909
  navigation: o
3902
3910
  }))
3903
3911
  )),
3904
- zo(),
3912
+ Wo(),
3905
3913
  z(
3906
3914
  (i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3907
3915
  ),
@@ -3913,7 +3921,7 @@ const zo = () => (n) => n.pipe(
3913
3921
  }
3914
3922
  })
3915
3923
  )
3916
- ), _o = ({ navigationResolver: n }) => (e) => e.pipe(
3924
+ ), Ho = ({ navigationResolver: n }) => (e) => e.pipe(
3917
3925
  S(([t, i]) => {
3918
3926
  const o = {
3919
3927
  type: "api",
@@ -3950,7 +3958,7 @@ const zo = () => (n) => n.pipe(
3950
3958
  navigation: o
3951
3959
  };
3952
3960
  })
3953
- ), Ho = ({ navigationResolver: n }) => (e) => e.pipe(
3961
+ ), Bo = ({ navigationResolver: n }) => (e) => e.pipe(
3954
3962
  S((t) => {
3955
3963
  if (t.navigation.cfi) {
3956
3964
  const i = n.getNavigationForCfi(
@@ -3967,16 +3975,16 @@ const zo = () => (n) => n.pipe(
3967
3975
  }
3968
3976
  return t;
3969
3977
  })
3970
- ), Bo = ({
3978
+ ), Xo = ({
3971
3979
  navigation: n,
3972
3980
  previousNavigation: e,
3973
3981
  settings: t
3974
- }) => 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 = ({
3982
+ }) => 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", Yo = ({
3975
3983
  context: n,
3976
3984
  settings: e
3977
3985
  }) => (t) => t.pipe(
3978
3986
  S(({ navigation: i, previousNavigation: o }) => {
3979
- const s = Bo({
3987
+ const s = Xo({
3980
3988
  navigation: i,
3981
3989
  previousNavigation: o,
3982
3990
  settings: e
@@ -3990,7 +3998,7 @@ const zo = () => (n) => n.pipe(
3990
3998
  direction: s
3991
3999
  };
3992
4000
  })
3993
- ), Yo = ({
4001
+ ), qo = ({
3994
4002
  spineItemsManager: n,
3995
4003
  navigationResolver: e,
3996
4004
  settings: t
@@ -4033,7 +4041,7 @@ const zo = () => (n) => n.pipe(
4033
4041
  ...s
4034
4042
  };
4035
4043
  })
4036
- ), It = ({
4044
+ ), bt = ({
4037
4045
  settings: n,
4038
4046
  spineItemsManager: e,
4039
4047
  navigationResolver: t,
@@ -4063,13 +4071,13 @@ const zo = () => (n) => n.pipe(
4063
4071
  restrictToScreen: !1
4064
4072
  }) ?? {}, m = (l === "forward" || l === "anchor" ? p : h) ?? h, y = e.get(m);
4065
4073
  if (!y) return;
4066
- const { endPageIndex: f, beginPageIndex: I } = i.getVisiblePagesFromViewportPosition({
4074
+ const { endPageIndex: f, beginPageIndex: b } = i.getVisiblePagesFromViewportPosition({
4067
4075
  position: a,
4068
4076
  spineItem: y,
4069
4077
  threshold: d,
4070
4078
  restrictToScreen: !1
4071
- }) ?? {}, b = (l === "forward" || l === "anchor" ? f : I) ?? 0, F = t.getNavigationForSpineItemPage({
4072
- pageIndex: b,
4079
+ }) ?? {}, I = (l === "forward" || l === "anchor" ? f : b) ?? 0, F = t.getNavigationForSpineItemPage({
4080
+ pageIndex: I,
4073
4081
  spineItemId: y
4074
4082
  }), $ = i.getVisibleSpineItemsFromPosition({
4075
4083
  position: F,
@@ -4092,7 +4100,7 @@ const zo = () => (n) => n.pipe(
4092
4100
  };
4093
4101
  })
4094
4102
  );
4095
- }, bt = ({ spine: n }) => (e) => e.pipe(
4103
+ }, It = ({ spine: n }) => (e) => e.pipe(
4096
4104
  w(({ navigation: t, ...i }) => {
4097
4105
  const o = n.getSpineItemSpineLayoutInfo(
4098
4106
  t.spineItem
@@ -4159,7 +4167,7 @@ const zo = () => (n) => n.pipe(
4159
4167
  ...a
4160
4168
  }))
4161
4169
  );
4162
- }, qo = ({ navigationResolver: n }) => (e) => e.pipe(
4170
+ }, Go = ({ navigationResolver: n }) => (e) => e.pipe(
4163
4171
  S((t) => {
4164
4172
  if (t.navigation.url) {
4165
4173
  const i = n.getNavigationForUrl(
@@ -4178,7 +4186,7 @@ const zo = () => (n) => n.pipe(
4178
4186
  return t;
4179
4187
  })
4180
4188
  );
4181
- class Gt {
4189
+ class Zt {
4182
4190
  constructor() {
4183
4191
  this.isLockedSubject = new H(0), this.isLocked$ = this.isLockedSubject.pipe(
4184
4192
  S((e) => !!e),
@@ -4192,7 +4200,7 @@ class Gt {
4192
4200
  };
4193
4201
  }
4194
4202
  }
4195
- const Go = ({
4203
+ const Zo = ({
4196
4204
  spineLocator: n,
4197
4205
  navigation: e,
4198
4206
  navigationResolver: t,
@@ -4249,7 +4257,7 @@ const Go = ({
4249
4257
  return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
4250
4258
  })
4251
4259
  ) : v(new M({ x: 0, y: 0 }));
4252
- }, Zo = ({
4260
+ }, Jo = ({
4253
4261
  navigation: n,
4254
4262
  spineLocator: e,
4255
4263
  spineItemsManager: t,
@@ -4318,7 +4326,7 @@ const Go = ({
4318
4326
  }
4319
4327
  }
4320
4328
  return n.position;
4321
- }, Jo = ({
4329
+ }, Ko = ({
4322
4330
  navigation: n,
4323
4331
  spineItemsManager: e,
4324
4332
  settings: t,
@@ -4326,7 +4334,7 @@ const Go = ({
4326
4334
  navigationResolver: o,
4327
4335
  spine: s
4328
4336
  }) => t.values.computedPageTurnMode === "scrollable" ? v(
4329
- Zo({
4337
+ Jo({
4330
4338
  navigation: n,
4331
4339
  spineLocator: i,
4332
4340
  navigationResolver: o,
@@ -4334,7 +4342,7 @@ const Go = ({
4334
4342
  spineItemsManager: e,
4335
4343
  spine: s
4336
4344
  })
4337
- ) : Go({
4345
+ ) : Zo({
4338
4346
  navigation: n,
4339
4347
  spineLocator: i,
4340
4348
  navigationResolver: o,
@@ -4346,7 +4354,7 @@ const Go = ({
4346
4354
  context: t,
4347
4355
  spine: i
4348
4356
  }) => (o) => o.pipe(
4349
- w((s) => Jo({
4357
+ w((s) => Ko({
4350
4358
  spineLocator: i.locator,
4351
4359
  navigation: s.navigation,
4352
4360
  navigationResolver: e,
@@ -4363,8 +4371,8 @@ const Go = ({
4363
4371
  }
4364
4372
  }))
4365
4373
  ))
4366
- ), Ko = "navigation/InternalNavigator", Qo = D.namespace(Ko);
4367
- class es extends X {
4374
+ ), Qo = "navigation/InternalNavigator", es = D.namespace(Qo);
4375
+ class ts extends X {
4368
4376
  constructor(e, t, i, o, s, r, a, c) {
4369
4377
  super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isUserLocked$ = c, this.navigationSubject = new H({
4370
4378
  animation: !1,
@@ -4376,36 +4384,36 @@ class es extends X {
4376
4384
  type: "api",
4377
4385
  id: Symbol()
4378
4386
  }), this.navigated$ = this.navigationSubject.pipe(Lt(1)), this.navigation$ = this.navigationSubject.pipe(
4379
- S(({ position: f, id: I }) => ({
4387
+ S(({ position: f, id: b }) => ({
4380
4388
  position: f,
4381
- id: I
4389
+ id: b
4382
4390
  })),
4383
4391
  z(
4384
- ({ position: f, ...I }, { position: b, ...F }) => V(I, F) && V(f, b)
4392
+ ({ position: f, ...b }, { position: I, ...F }) => V(b, F) && V(f, I)
4385
4393
  ),
4386
4394
  J(1)
4387
- ), this.locker = new Gt();
4395
+ ), this.locker = new Zt();
4388
4396
  const u = i.pipe(
4389
4397
  O(this.navigationSubject),
4390
- _o({
4398
+ Ho({
4391
4399
  navigationResolver: r
4392
4400
  }),
4393
4401
  /**
4394
4402
  * Url lookup is heavier so we start with it to fill
4395
4403
  * as much information as needed to reduce later lookup
4396
4404
  */
4397
- qo({
4405
+ Go({
4398
4406
  navigationResolver: r
4399
4407
  }),
4400
4408
  /**
4401
4409
  * Cfi lookup is heavier so we start with it to fill
4402
4410
  * as much information as needed to reduce later lookup
4403
4411
  */
4404
- Ho({
4412
+ Bo({
4405
4413
  navigationResolver: r
4406
4414
  }),
4407
- Xo({ context: t, settings: e }),
4408
- It({
4415
+ Yo({ context: t, settings: e }),
4416
+ bt({
4409
4417
  navigationResolver: r,
4410
4418
  settings: e,
4411
4419
  spineItemsManager: a.spineItemsManager,
@@ -4417,20 +4425,20 @@ class es extends X {
4417
4425
  spineItemsManager: a.spineItemsManager,
4418
4426
  spineLocator: a.locator
4419
4427
  }),
4420
- bt({
4428
+ It({
4421
4429
  spine: a
4422
4430
  })
4423
4431
  ).pipe(
4424
- Yo({
4432
+ qo({
4425
4433
  navigationResolver: r,
4426
4434
  spineItemsManager: a.spineItemsManager,
4427
4435
  settings: e
4428
4436
  }),
4429
4437
  O(c),
4430
- w(([f, I]) => {
4431
- const b = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4438
+ w(([f, b]) => {
4439
+ const I = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || b;
4432
4440
  return v(f).pipe(
4433
- b ? Pe : vt({
4441
+ I ? Pe : vt({
4434
4442
  navigationResolver: r,
4435
4443
  settings: e,
4436
4444
  spine: a,
@@ -4450,9 +4458,9 @@ class es extends X {
4450
4458
  O(c),
4451
4459
  L(([, f]) => f),
4452
4460
  w(([f]) => {
4453
- const I = this.locker.lock();
4461
+ const b = this.locker.lock();
4454
4462
  return c.pipe(
4455
- L((b) => !b),
4463
+ L((I) => !I),
4456
4464
  U(),
4457
4465
  S(
4458
4466
  () => ({
@@ -4461,7 +4469,7 @@ class es extends X {
4461
4469
  })
4462
4470
  ),
4463
4471
  de(() => {
4464
- I();
4472
+ b();
4465
4473
  }),
4466
4474
  T(u)
4467
4475
  );
@@ -4505,7 +4513,7 @@ class es extends X {
4505
4513
  spine: a
4506
4514
  }),
4507
4515
  S((f) => {
4508
- const I = {
4516
+ const b = {
4509
4517
  ...f.navigation,
4510
4518
  meta: {
4511
4519
  triggeredBy: "restoration"
@@ -4513,7 +4521,7 @@ class es extends X {
4513
4521
  };
4514
4522
  return {
4515
4523
  ...f,
4516
- navigation: I
4524
+ navigation: b
4517
4525
  };
4518
4526
  }),
4519
4527
  /**
@@ -4521,13 +4529,13 @@ class es extends X {
4521
4529
  * eg: after the reader load and the user has never navigated
4522
4530
  * yet.
4523
4531
  */
4524
- It({
4532
+ bt({
4525
4533
  navigationResolver: r,
4526
4534
  settings: e,
4527
4535
  spineItemsManager: a.spineItemsManager,
4528
4536
  spineLocator: a.locator
4529
4537
  }),
4530
- bt({
4538
+ It({
4531
4539
  spine: a
4532
4540
  }),
4533
4541
  Ne({
@@ -4538,7 +4546,7 @@ class es extends X {
4538
4546
  }),
4539
4547
  S(({ navigation: f }) => f),
4540
4548
  E()
4541
- ), h = Wo(
4549
+ ), h = _o(
4542
4550
  t,
4543
4551
  this.navigationSubject,
4544
4552
  a
@@ -4547,26 +4555,26 @@ class es extends X {
4547
4555
  u,
4548
4556
  h
4549
4557
  ), m = (f) => f.pipe(
4550
- x(([I, b]) => {
4551
- Qo.info(
4552
- `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4558
+ x(([b, I]) => {
4559
+ es.info(
4560
+ `navigation updated from ${b.meta.triggeredBy} of type ${b.type}`,
4553
4561
  {
4554
- previousNavigation: b,
4555
- currentNavigation: I
4562
+ previousNavigation: I,
4563
+ currentNavigation: b
4556
4564
  }
4557
- ), this.navigationSubject.next(I);
4565
+ ), this.navigationSubject.next(b);
4558
4566
  })
4559
4567
  ), y = (f) => f.pipe(
4560
- x(([I, b]) => {
4561
- const F = I.type === "scroll", $ = I.meta.triggeredBy === "pagination", A = I.meta.triggeredBy === "restoration", Y = V(
4562
- b.position,
4563
- I.position
4568
+ x(([b, I]) => {
4569
+ const F = b.type === "scroll", $ = b.meta.triggeredBy === "pagination", A = b.meta.triggeredBy === "restoration", Y = V(
4570
+ I.position,
4571
+ b.position
4564
4572
  );
4565
4573
  if (F && !A || $ || Y)
4566
4574
  return;
4567
4575
  const B = {
4568
- position: I.position,
4569
- animation: I.animation
4576
+ position: b.position,
4577
+ animation: b.animation
4570
4578
  };
4571
4579
  e.values.computedPageTurnMode === "scrollable" ? this.scrollNavigationController.navigate(B) : this.controlledNavigationController.navigate({
4572
4580
  ...B,
@@ -4606,14 +4614,14 @@ const Fe = (n, e, t) => {
4606
4614
  }, wt = (n, e, t) => {
4607
4615
  const i = [...Array(t)].map((o, s) => s * e);
4608
4616
  return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
4609
- }, ts = ({
4617
+ }, ns = ({
4610
4618
  itemWidth: n,
4611
4619
  itemHeight: e,
4612
4620
  spineItemPosition: t
4613
4621
  }) => new C({
4614
4622
  x: Math.min(n, Math.max(0, t.x)),
4615
4623
  y: Math.min(e, Math.max(0, t.y))
4616
- }), Zt = ({
4624
+ }), Jt = ({
4617
4625
  itemHeight: n,
4618
4626
  itemWidth: e,
4619
4627
  isUsingVerticalWriting: t,
@@ -4632,11 +4640,11 @@ const Fe = (n, e, t) => {
4632
4640
  pageTurnMode: a,
4633
4641
  isRTL: c
4634
4642
  }) => {
4635
- const l = ts({
4643
+ const l = ns({
4636
4644
  spineItemPosition: t,
4637
4645
  itemHeight: e,
4638
4646
  itemWidth: n
4639
- }).x, d = Zt({
4647
+ }).x, d = Jt({
4640
4648
  isUsingVerticalWriting: i,
4641
4649
  itemHeight: e,
4642
4650
  itemWidth: n,
@@ -4649,7 +4657,7 @@ const Fe = (n, e, t) => {
4649
4657
  return wt(t.y, s, d);
4650
4658
  const g = wt(l, o, d);
4651
4659
  return c ? d - 1 - g : g;
4652
- }, ns = ({
4660
+ }, is = ({
4653
4661
  pageIndex: n,
4654
4662
  itemLayout: e,
4655
4663
  context: t,
@@ -4679,14 +4687,14 @@ const Fe = (n, e, t) => {
4679
4687
  x: s,
4680
4688
  y: 0
4681
4689
  });
4682
- }, Jt = ({
4690
+ }, Kt = ({
4683
4691
  context: n,
4684
4692
  settings: e,
4685
4693
  viewport: t
4686
4694
  }) => {
4687
4695
  const i = (a, c, u) => {
4688
4696
  let l;
4689
- 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);
4697
+ 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);
4690
4698
  const d = u.layout.layoutInfo?.width || 0, g = t.pageSize.width;
4691
4699
  if (l !== void 0) {
4692
4700
  const h = Ve(
@@ -4702,7 +4710,7 @@ const Fe = (n, e, t) => {
4702
4710
  getSpineItemPositionFromPageIndex: ({
4703
4711
  pageIndex: a,
4704
4712
  spineItem: c
4705
- }) => ns({
4713
+ }) => is({
4706
4714
  context: n,
4707
4715
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4708
4716
  itemLayout: c.layout.layoutInfo,
@@ -4773,12 +4781,12 @@ const Fe = (n, e, t) => {
4773
4781
  });
4774
4782
  }
4775
4783
  };
4776
- }, is = ({
4784
+ }, os = ({
4777
4785
  context: n,
4778
4786
  settings: e,
4779
4787
  viewport: t
4780
4788
  }) => {
4781
- const i = Jt({
4789
+ const i = Kt({
4782
4790
  context: n,
4783
4791
  settings: e,
4784
4792
  viewport: t
@@ -4802,7 +4810,7 @@ const Fe = (n, e, t) => {
4802
4810
  ) || new C({ x: 0, y: 0 })
4803
4811
  };
4804
4812
  };
4805
- function Kt({
4813
+ function Qt({
4806
4814
  position: n,
4807
4815
  isRTL: e,
4808
4816
  spineItemsManager: t,
@@ -4835,7 +4843,7 @@ const xt = ({
4835
4843
  visibleAreaRectWidth: o,
4836
4844
  spine: s
4837
4845
  }) => {
4838
- const r = Kt({
4846
+ const r = Qt({
4839
4847
  position: n,
4840
4848
  isRTL: e,
4841
4849
  spineItemsManager: i,
@@ -4888,7 +4896,7 @@ const xt = ({
4888
4896
  });
4889
4897
  }
4890
4898
  return new M({ x: 0, y: 0 });
4891
- }, os = ({
4899
+ }, ss = ({
4892
4900
  pageIndex: n,
4893
4901
  spineItemsManager: e,
4894
4902
  spineItemId: t,
@@ -4918,28 +4926,28 @@ const xt = ({
4918
4926
  pageSizeWidth: s.pageSize.width,
4919
4927
  visibleAreaRectWidth: s.absoluteViewport.width
4920
4928
  });
4921
- }, ss = (n, e) => {
4929
+ }, rs = (n, e) => {
4922
4930
  if (e && e instanceof HTMLIFrameElement)
4923
4931
  return n.startsWith("#") ? e.contentDocument?.getElementById(
4924
4932
  n.replace("#", "")
4925
4933
  ) : e.contentDocument?.querySelector(n);
4926
- }, rs = ({
4934
+ }, as = ({
4927
4935
  anchor: n,
4928
4936
  spineItem: e,
4929
4937
  spine: t
4930
4938
  }) => {
4931
- const i = ss(
4939
+ const i = rs(
4932
4940
  n,
4933
4941
  e.renderer.getDocumentFrame()
4934
4942
  );
4935
4943
  return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
4936
- }, as = ({
4944
+ }, cs = ({
4937
4945
  anchor: n,
4938
4946
  spineItem: e,
4939
4947
  spineLocator: t,
4940
4948
  spine: i
4941
4949
  }) => {
4942
- const o = rs({
4950
+ const o = as({
4943
4951
  anchor: n,
4944
4952
  spineItem: e,
4945
4953
  spine: i
@@ -4948,7 +4956,7 @@ const xt = ({
4948
4956
  spineItemPosition: new C({ x: o, y: 0 }),
4949
4957
  spineItem: e
4950
4958
  });
4951
- }, cs = ({
4959
+ }, us = ({
4952
4960
  anchor: n,
4953
4961
  spineItem: e,
4954
4962
  spineLocator: t,
@@ -4956,7 +4964,7 @@ const xt = ({
4956
4964
  pageSizeWidth: o,
4957
4965
  visibleAreaRectWidth: s
4958
4966
  }) => {
4959
- const r = as({
4967
+ const r = cs({
4960
4968
  anchor: n,
4961
4969
  spineItem: e,
4962
4970
  spineLocator: t,
@@ -4967,7 +4975,7 @@ const xt = ({
4967
4975
  pageSizeWidth: o,
4968
4976
  visibleAreaRectWidth: s
4969
4977
  });
4970
- }, us = ({
4978
+ }, ls = ({
4971
4979
  spine: n,
4972
4980
  spineItemsManager: e,
4973
4981
  spineLocator: t,
@@ -4983,7 +4991,7 @@ const xt = ({
4983
4991
  if (u) {
4984
4992
  const l = e.get(u.id);
4985
4993
  if (l) {
4986
- const d = cs({
4994
+ const d = us({
4987
4995
  anchor: a.hash,
4988
4996
  spineItem: l,
4989
4997
  spine: n,
@@ -5006,7 +5014,7 @@ const xt = ({
5006
5014
  console.error(a);
5007
5015
  return;
5008
5016
  }
5009
- }, ls = ({
5017
+ }, ds = ({
5010
5018
  spineItem: n,
5011
5019
  spineItemPosition: e,
5012
5020
  spineLocator: t,
@@ -5025,7 +5033,7 @@ const xt = ({
5025
5033
  pageSizeWidth: o.pageSize.width,
5026
5034
  visibleAreaRectWidth: o.absoluteViewport.width
5027
5035
  });
5028
- }, ds = "spineNavigator", ps = ({
5036
+ }, ps = "spineNavigator", gs = ({
5029
5037
  context: n,
5030
5038
  spineItemsManager: e,
5031
5039
  locator: t,
@@ -5033,13 +5041,13 @@ const xt = ({
5033
5041
  spine: o,
5034
5042
  viewport: s
5035
5043
  }) => {
5036
- const r = is({
5044
+ const r = os({
5037
5045
  context: n,
5038
5046
  settings: i,
5039
5047
  viewport: s
5040
5048
  });
5041
5049
  return {
5042
- getNavigationForUrl: (h) => us({
5050
+ getNavigationForUrl: (h) => ls({
5043
5051
  context: n,
5044
5052
  spineItemsManager: e,
5045
5053
  spineLocator: t,
@@ -5048,14 +5056,14 @@ const xt = ({
5048
5056
  visibleAreaRectWidth: s.absoluteViewport.width,
5049
5057
  spine: o
5050
5058
  }),
5051
- getNavigationForSpineItemPage: (h) => os({
5059
+ getNavigationForSpineItemPage: (h) => ss({
5052
5060
  ...h,
5053
5061
  spineItemsManager: e,
5054
5062
  spineItemNavigationResolver: r,
5055
5063
  spineLocator: t,
5056
5064
  viewport: s
5057
5065
  }),
5058
- getNavigationFromSpineItemPosition: (h) => ls({
5066
+ getNavigationFromSpineItemPosition: (h) => ds({
5059
5067
  ...h,
5060
5068
  spineItemLocator: t.spineItemLocator,
5061
5069
  spineLocator: t,
@@ -5067,15 +5075,15 @@ const xt = ({
5067
5075
  spineItemsManager: e
5068
5076
  });
5069
5077
  if (!p) {
5070
- D.warn(ds, `unable to detect item id from cfi ${h}`);
5078
+ D.warn(ps, `unable to detect item id from cfi ${h}`);
5071
5079
  return;
5072
5080
  }
5073
- const f = m ? r.getNavigationFromNode(p, m, y) : new C({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
5081
+ const f = m ? r.getNavigationFromNode(p, m, y) : new C({ x: 0, y: 0 }), b = t.getSpinePositionFromSpineItemPosition({
5074
5082
  spineItemPosition: f,
5075
5083
  spineItem: p
5076
5084
  });
5077
5085
  return Q({
5078
- position: I,
5086
+ position: b,
5079
5087
  pageSizeWidth: s.pageSize.width,
5080
5088
  visibleAreaRectWidth: s.absoluteViewport.width
5081
5089
  });
@@ -5110,7 +5118,7 @@ const xt = ({
5110
5118
  viewport: s
5111
5119
  }),
5112
5120
  getMostPredominantNavigationForPosition: (h) => {
5113
- const p = i.values.computedPageTurnDirection, m = 0.5, y = p === "horizontal" ? h.x + s.absoluteViewport.width * m : 0, f = p === "horizontal" ? 0 : h.y + s.absoluteViewport.height * m, I = xt({
5121
+ const p = i.values.computedPageTurnDirection, m = 0.5, y = p === "horizontal" ? h.x + s.absoluteViewport.width * m : 0, f = p === "horizontal" ? 0 : h.y + s.absoluteViewport.height * m, b = xt({
5114
5122
  position: new M({
5115
5123
  x: y,
5116
5124
  y: f
@@ -5124,7 +5132,7 @@ const xt = ({
5124
5132
  return Ye({
5125
5133
  spineItemNavigationResolver: r,
5126
5134
  spineLocator: t,
5127
- viewportPosition: I,
5135
+ viewportPosition: b,
5128
5136
  viewport: s
5129
5137
  });
5130
5138
  },
@@ -5136,7 +5144,7 @@ const xt = ({
5136
5144
  spineItemsManager: e,
5137
5145
  spine: o
5138
5146
  }),
5139
- fromOutOfBoundsSpinePosition: (h) => Kt({
5147
+ fromOutOfBoundsSpinePosition: (h) => Qt({
5140
5148
  position: h,
5141
5149
  isRTL: n.isRTL(),
5142
5150
  spineItemsManager: e,
@@ -5152,7 +5160,7 @@ const xt = ({
5152
5160
  }),
5153
5161
  spineItemNavigator: r
5154
5162
  };
5155
- }, gs = ({
5163
+ }, hs = ({
5156
5164
  spineItemsManager: n,
5157
5165
  context: e,
5158
5166
  hookManager: t,
@@ -5160,26 +5168,26 @@ const xt = ({
5160
5168
  settings: o,
5161
5169
  viewport: s
5162
5170
  }) => {
5163
- const r = new R(), a = r.asObservable(), c = new Gt(), u = ps({
5171
+ const r = new R(), a = r.asObservable(), c = new Zt(), u = gs({
5164
5172
  context: e,
5165
5173
  settings: o,
5166
5174
  spineItemsManager: n,
5167
5175
  locator: i.locator,
5168
5176
  spine: i,
5169
5177
  viewport: s
5170
- }), l = new jo(
5178
+ }), l = new zo(
5171
5179
  o,
5172
5180
  t,
5173
5181
  e,
5174
5182
  i,
5175
5183
  s
5176
- ), d = new Uo(
5184
+ ), d = new Lo(
5177
5185
  s,
5178
5186
  o,
5179
5187
  t,
5180
5188
  i,
5181
5189
  e
5182
- ), g = new es(
5190
+ ), g = new ts(
5183
5191
  o,
5184
5192
  e,
5185
5193
  a,
@@ -5218,7 +5226,7 @@ const xt = ({
5218
5226
  navigation$: g.navigation$
5219
5227
  };
5220
5228
  };
5221
- class hs extends ce {
5229
+ class ms extends ce {
5222
5230
  constructor(e, t) {
5223
5231
  super({
5224
5232
  beginPageIndexInSpineItem: void 0,
@@ -5236,7 +5244,7 @@ class hs extends ce {
5236
5244
  this.mergeCompare(e);
5237
5245
  }
5238
5246
  }
5239
- class ms extends X {
5247
+ class fs extends X {
5240
5248
  constructor(e, t, i, o, s) {
5241
5249
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5242
5250
  const r = P(
@@ -5264,21 +5272,21 @@ class ms extends X {
5264
5272
  threshold: { type: "percentage", value: 0.5 }
5265
5273
  }) ?? {}, p = this.spineItemsManager.get(g), m = this.spineItemsManager.get(h);
5266
5274
  if (!p || !m) return;
5267
- const y = d.beginCfi, f = d.endCfi, { beginPageIndex: I = 0 } = c({
5275
+ const y = d.beginCfi, f = d.endCfi, { beginPageIndex: b = 0 } = c({
5268
5276
  spineItem: p,
5269
5277
  position: l
5270
- }) ?? {}, { endPageIndex: b = 0 } = c({
5278
+ }) ?? {}, { endPageIndex: I = 0 } = c({
5271
5279
  spineItem: m,
5272
5280
  position: l
5273
5281
  }) ?? {}, F = y === void 0 || Be(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== h || f === void 0 || Be(f), A = F ? he(p.item) : y, Y = $ ? he(m.item) : f, B = p.numberOfPages, ie = m.numberOfPages;
5274
5282
  this.pagination.update({
5275
5283
  beginCfi: A,
5276
5284
  beginNumberOfPagesInSpineItem: B,
5277
- beginPageIndexInSpineItem: I,
5285
+ beginPageIndexInSpineItem: b,
5278
5286
  beginSpineItemIndex: g,
5279
5287
  endCfi: Y,
5280
5288
  endNumberOfPagesInSpineItem: ie,
5281
- endPageIndexInSpineItem: b,
5289
+ endPageIndexInSpineItem: I,
5282
5290
  endSpineItemIndex: h,
5283
5291
  navigationId: u.id
5284
5292
  });
@@ -5314,11 +5322,11 @@ class ms extends X {
5314
5322
  P(r, a).pipe(T(this.destroy$)).subscribe();
5315
5323
  }
5316
5324
  }
5317
- const fs = ({
5325
+ const ys = ({
5318
5326
  manifest: n,
5319
5327
  spreadMode: e
5320
5328
  }) => n?.renditionFlow === "scrolled-continuous" ? !1 : e;
5321
- class ys extends X {
5329
+ class Ss extends X {
5322
5330
  constructor(e) {
5323
5331
  super();
5324
5332
  const t = {
@@ -5363,7 +5371,7 @@ class ys extends X {
5363
5371
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5364
5372
  }
5365
5373
  }
5366
- class Ss extends ys {
5374
+ class bs extends Ss {
5367
5375
  constructor(e, t) {
5368
5376
  super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
5369
5377
  x(() => this.update(this.values)),
@@ -5376,7 +5384,7 @@ class Ss extends ys {
5376
5384
  computedPageTurnAnimation: e.pageTurnAnimation,
5377
5385
  computedPageTurnMode: e.pageTurnMode,
5378
5386
  computedPageTurnAnimationDuration: 0,
5379
- computedSpreadMode: fs({
5387
+ computedSpreadMode: ys({
5380
5388
  spreadMode: e.spreadMode,
5381
5389
  manifest: t
5382
5390
  })
@@ -5421,7 +5429,7 @@ class Is extends fe {
5421
5429
  getDocumentFrame() {
5422
5430
  }
5423
5431
  }
5424
- class bs extends X {
5432
+ class vs extends X {
5425
5433
  constructor(e, t, i, o, s, r, a) {
5426
5434
  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 = ({
5427
5435
  blankPagePosition: c,
@@ -5431,27 +5439,27 @@ class bs extends X {
5431
5439
  const g = V(
5432
5440
  this.lastLayout?.pageSize,
5433
5441
  this.viewport.pageSize
5434
- ) ? this.lastLayout : void 0, { width: h, height: p } = g ?? {}, { width: m = h, height: y = p } = d ?? {}, { width: f, height: I } = this.viewport.pageSize, b = this.validateDimension(
5442
+ ) ? this.lastLayout : void 0, { width: h, height: p } = g ?? {}, { width: m = h, height: y = p } = d ?? {}, { width: f, height: b } = this.viewport.pageSize, I = this.validateDimension(
5435
5443
  m ?? f,
5436
5444
  f,
5437
5445
  u
5438
- ), F = this.settings.values.computedPageTurnMode === "scrollable" ? y ?? I : this.validateDimension(
5439
- y ?? I,
5440
- I,
5441
- I
5446
+ ), F = this.settings.values.computedPageTurnMode === "scrollable" ? y ?? b : this.validateDimension(
5447
+ y ?? b,
5448
+ b,
5449
+ b
5442
5450
  );
5443
5451
  return this.lastLayout = {
5444
- width: b,
5452
+ width: I,
5445
5453
  height: F,
5446
5454
  pageSize: this.viewport.pageSize
5447
- }, this.containerElement.style.width = `${b}px`, this.containerElement.style.height = `${F}px`, this.hookManager.execute("item.onAfterLayout", void 0, {
5455
+ }, this.containerElement.style.width = `${I}px`, this.containerElement.style.height = `${F}px`, this.hookManager.execute("item.onAfterLayout", void 0, {
5448
5456
  blankPagePosition: c,
5449
5457
  item: this.item,
5450
5458
  minimumWidth: u
5451
- }), { width: b, height: F };
5459
+ }), { width: I, height: F };
5452
5460
  })
5453
5461
  ), this.layout = (c) => {
5454
- const u = Xn(this.layout$.pipe(U()));
5462
+ const u = Yn(this.layout$.pipe(U()));
5455
5463
  return this.layoutTriggerSubject.next(c), u();
5456
5464
  }, this.adjustPositionOfElement = ({
5457
5465
  right: c,
@@ -5506,7 +5514,7 @@ class bs extends X {
5506
5514
  };
5507
5515
  }
5508
5516
  }
5509
- class Qt extends ce {
5517
+ class en extends ce {
5510
5518
  constructor(e, t, i, o, s, r, a) {
5511
5519
  super({
5512
5520
  isLoaded: !1,
@@ -5522,7 +5530,7 @@ class Qt extends ce {
5522
5530
  });
5523
5531
  }, this.destroy = () => {
5524
5532
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5525
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = vs(
5533
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = ws(
5526
5534
  t,
5527
5535
  e,
5528
5536
  s
@@ -5538,7 +5546,7 @@ class Qt extends ce {
5538
5546
  resourcesHandler: this.resourcesHandler,
5539
5547
  viewport: this.viewport
5540
5548
  };
5541
- this.renderer = c ? c(u) : new Is(u), this.layout = new bs(
5549
+ this.renderer = c ? c(u) : new Is(u), this.layout = new vs(
5542
5550
  e,
5543
5551
  this.containerElement,
5544
5552
  i,
@@ -5613,7 +5621,7 @@ class Qt extends ce {
5613
5621
  return this.renderer.renditionLayout;
5614
5622
  }
5615
5623
  get numberOfPages() {
5616
- return Zt({
5624
+ return Jt({
5617
5625
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
5618
5626
  itemHeight: this.layout.layoutInfo.height,
5619
5627
  itemWidth: this.layout.layoutInfo.width,
@@ -5624,19 +5632,19 @@ class Qt extends ce {
5624
5632
  });
5625
5633
  }
5626
5634
  }
5627
- const vs = (n, e, t) => {
5635
+ const ws = (n, e, t) => {
5628
5636
  const i = n.ownerDocument.createElement("div");
5629
5637
  return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
5630
5638
  position: absolute;
5631
5639
  overflow: hidden;
5632
5640
  `, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
5633
5641
  };
5634
- class ws extends X {
5642
+ class Ps extends X {
5635
5643
  constructor(e, t, i, o, s) {
5636
5644
  super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new H([]);
5637
5645
  const r = this.forcedOpenSubject.pipe(
5638
5646
  S((u) => [...new Set(u.flat())].sort()),
5639
- z(fn),
5647
+ z(yn),
5640
5648
  J({ bufferSize: 1, refCount: !0 })
5641
5649
  );
5642
5650
  P(
@@ -5658,10 +5666,10 @@ class ws extends X {
5658
5666
  useAbsoluteViewport: !1
5659
5667
  }) || {}, p = d === 1 / 0 ? 0 : g - d, m = d === 1 / 0 ? t.items.length - 1 : h + d, y = Array.from(
5660
5668
  { length: m - p + 1 },
5661
- (I, b) => p + b
5669
+ (b, I) => p + I
5662
5670
  ), f = [...l, ...y];
5663
- t.items.forEach((I, b) => {
5664
- f.includes(b) ? I.load() : I.unload();
5671
+ t.items.forEach((b, I) => {
5672
+ f.includes(I) ? b.load() : b.unload();
5665
5673
  });
5666
5674
  })
5667
5675
  ).pipe(T(this.destroy$)).subscribe();
@@ -5682,7 +5690,7 @@ class ws extends X {
5682
5690
  super.destroy(), this.forcedOpenSubject.complete();
5683
5691
  }
5684
5692
  }
5685
- const en = (n, e, t) => {
5693
+ const tn = (n, e, t) => {
5686
5694
  const i = (t.width - e.width) / 2, o = (t.height - e.height) / 2;
5687
5695
  return new ae({
5688
5696
  x: n.x - i,
@@ -5707,17 +5715,17 @@ class ye extends DOMRect {
5707
5715
  return new ye(i.x, i.y, i.width, i.height);
5708
5716
  }
5709
5717
  }
5710
- class Ps {
5718
+ class xs {
5711
5719
  constructor({ width: e, height: t }) {
5712
5720
  this.__symbol = Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5713
5721
  }
5714
5722
  }
5715
- class xs {
5723
+ class $s {
5716
5724
  constructor({ width: e, height: t }) {
5717
5725
  this.__symbol = Symbol("RelativeViewport"), this.width = e, this.height = t;
5718
5726
  }
5719
5727
  }
5720
- const $s = ({
5728
+ const Ts = ({
5721
5729
  pageIndex: n,
5722
5730
  spineItemOrId: e,
5723
5731
  spineItemsManager: t
@@ -5739,7 +5747,7 @@ const $s = ({
5739
5747
  { currentAbsolutePage: 0, found: !1 }
5740
5748
  );
5741
5749
  return s;
5742
- }, Ts = ({
5750
+ }, Fs = ({
5743
5751
  itemHeight: n,
5744
5752
  itemWidth: e,
5745
5753
  visibleWidthOfItem: t,
@@ -5748,7 +5756,7 @@ const $s = ({
5748
5756
  }) => {
5749
5757
  const s = t / e, r = i / n;
5750
5758
  return o.type === "percentage" ? s >= o.value && r >= o.value : t >= o.value && i >= o.value;
5751
- }, Fs = ({
5759
+ }, Ls = ({
5752
5760
  visibleWidthOfItem: n,
5753
5761
  visibleHeightOfItem: e,
5754
5762
  threshold: t,
@@ -5756,7 +5764,7 @@ const $s = ({
5756
5764
  }) => {
5757
5765
  const o = n / i.width, s = e / i.height;
5758
5766
  return t.type === "percentage" ? s >= t.value && o >= t.value : e >= t.value && n >= t.value;
5759
- }, tn = ({
5767
+ }, nn = ({
5760
5768
  itemPosition: {
5761
5769
  bottom: n,
5762
5770
  left: e,
@@ -5780,14 +5788,14 @@ const $s = ({
5780
5788
  Math.min(n, g) - Math.max(i, d)
5781
5789
  );
5782
5790
  if (h <= 0 || p <= 0) return { visible: !1 };
5783
- const y = Fs({
5791
+ const y = Ls({
5784
5792
  threshold: r,
5785
5793
  visibleHeightOfItem: p,
5786
5794
  visibleWidthOfItem: h,
5787
5795
  viewportPosition: a
5788
5796
  });
5789
5797
  return c ? { visible: y } : {
5790
- visible: Ts({
5798
+ visible: Fs({
5791
5799
  itemHeight: s,
5792
5800
  itemWidth: o,
5793
5801
  threshold: r,
@@ -5811,7 +5819,7 @@ const $s = ({
5811
5819
  }) => new M({
5812
5820
  x: e + n.x,
5813
5821
  y: t + n.y
5814
- }), Ls = ({
5822
+ }), Ms = ({
5815
5823
  position: n,
5816
5824
  threshold: e,
5817
5825
  restrictToScreen: t,
@@ -5826,20 +5834,20 @@ const $s = ({
5826
5834
  spineLayout: o
5827
5835
  }) || i.get(0), c = i.items.reduce(
5828
5836
  (h, p) => {
5829
- const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f = en(
5837
+ const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f = tn(
5830
5838
  n,
5831
5839
  r.absoluteViewport,
5832
5840
  y
5833
- ), I = ye.from(
5841
+ ), b = ye.from(
5834
5842
  f,
5835
5843
  y
5836
- ), { visible: b } = tn({
5844
+ ), { visible: I } = nn({
5837
5845
  itemPosition: m,
5838
5846
  threshold: e,
5839
- viewportPosition: I,
5847
+ viewportPosition: b,
5840
5848
  restrictToScreen: t
5841
5849
  });
5842
- return b ? [...h, p] : h;
5850
+ return I ? [...h, p] : h;
5843
5851
  },
5844
5852
  []
5845
5853
  ), u = c[0] ?? a, l = c[c.length - 1] ?? u;
@@ -5849,7 +5857,7 @@ const $s = ({
5849
5857
  beginIndex: d ?? 0,
5850
5858
  endIndex: g ?? 0
5851
5859
  };
5852
- }, Ms = ({
5860
+ }, Cs = ({
5853
5861
  spineItemsManager: n,
5854
5862
  context: e,
5855
5863
  spineItemLocator: t,
@@ -5892,44 +5900,44 @@ const $s = ({
5892
5900
  threshold: m,
5893
5901
  spineItem: y,
5894
5902
  restrictToScreen: f,
5895
- useAbsoluteViewport: I = !0,
5896
- viewport: b
5903
+ useAbsoluteViewport: b = !0,
5904
+ viewport: I
5897
5905
  }) => {
5898
- const F = y.numberOfPages, A = Array.from(Array(F)).map((ie, Ie) => {
5906
+ const F = y.numberOfPages, A = Array.from(Array(F)).map((ie, be) => {
5899
5907
  const De = t.getSpineItemPositionFromPageIndex({
5900
- pageIndex: Ie,
5908
+ pageIndex: be,
5901
5909
  spineItem: y
5902
5910
  }), ue = je({
5903
5911
  spineItemPosition: De,
5904
5912
  itemLayout: o.getSpineItemSpineLayoutInfo(y)
5905
5913
  });
5906
5914
  return {
5907
- index: Ie,
5915
+ index: be,
5908
5916
  absolutePosition: {
5909
- width: b.pageSize.width,
5910
- height: b.pageSize.height,
5917
+ width: I.pageSize.width,
5918
+ height: I.pageSize.height,
5911
5919
  left: ue.x,
5912
5920
  top: ue.y,
5913
- bottom: ue.y + b.pageSize.height,
5914
- right: ue.x + b.pageSize.width
5921
+ bottom: ue.y + I.pageSize.height,
5922
+ right: ue.x + I.pageSize.width
5915
5923
  }
5916
5924
  };
5917
5925
  }).reduce(
5918
- (ie, { absolutePosition: Ie, index: De }) => {
5919
- const ue = I ? b.absoluteViewport : b.relativeViewport, nn = en(
5926
+ (ie, { absolutePosition: be, index: De }) => {
5927
+ const ue = b ? I.absoluteViewport : I.relativeViewport, on = tn(
5920
5928
  p,
5921
- b.absoluteViewport,
5929
+ I.absoluteViewport,
5922
5930
  ue
5923
- ), on = ye.from(
5924
- nn,
5931
+ ), sn = ye.from(
5932
+ on,
5925
5933
  ue
5926
- ), { visible: sn } = tn({
5927
- viewportPosition: on,
5934
+ ), { visible: rn } = nn({
5935
+ viewportPosition: sn,
5928
5936
  restrictToScreen: f,
5929
5937
  threshold: m,
5930
- itemPosition: Ie
5938
+ itemPosition: be
5931
5939
  });
5932
- return sn ? [...ie, De] : ie;
5940
+ return rn ? [...ie, De] : ie;
5933
5941
  },
5934
5942
  []
5935
5943
  ), Y = A[0], B = A[A.length - 1] ?? Y;
@@ -5953,7 +5961,7 @@ const $s = ({
5953
5961
  /**
5954
5962
  * @deprecated use Pages
5955
5963
  */
5956
- _getAbsolutePageIndexFromPageIndex: (p) => $s({
5964
+ _getAbsolutePageIndexFromPageIndex: (p) => Ts({
5957
5965
  ...p,
5958
5966
  spineItemsManager: n
5959
5967
  }),
@@ -5973,7 +5981,7 @@ const $s = ({
5973
5981
  itemHeight: m.layout.layoutInfo.height,
5974
5982
  position: y,
5975
5983
  isUsingVerticalWriting: !!m.isUsingVerticalWriting()
5976
- }), I = t.getSpineItemPagePositionFromSpineItemPosition(
5984
+ }), b = t.getSpineItemPagePositionFromSpineItemPosition(
5977
5985
  y,
5978
5986
  f,
5979
5987
  m
@@ -5981,7 +5989,7 @@ const $s = ({
5981
5989
  return {
5982
5990
  spineItem: m,
5983
5991
  spineItemPageIndex: f,
5984
- spineItemPagePosition: I,
5992
+ spineItemPagePosition: b,
5985
5993
  pageSize: s.value.pageSize
5986
5994
  };
5987
5995
  },
@@ -5994,7 +6002,7 @@ const $s = ({
5994
6002
  }),
5995
6003
  getSpineItemFromIframe: c,
5996
6004
  getSpineItemPageIndexFromNode: u,
5997
- getVisibleSpineItemsFromPosition: (p) => Ls({
6005
+ getVisibleSpineItemsFromPosition: (p) => Ms({
5998
6006
  spineItemsManager: n,
5999
6007
  spineLayout: o,
6000
6008
  viewport: s,
@@ -6005,8 +6013,8 @@ const $s = ({
6005
6013
  viewport: s
6006
6014
  }),
6007
6015
  isPositionWithinSpineItem: (p, m) => {
6008
- const { bottom: y, left: f, right: I, top: b } = o.getSpineItemSpineLayoutInfo(m);
6009
- return p.x >= f && p.x <= I && p.y <= y && p.y >= b;
6016
+ const { bottom: y, left: f, right: b, top: I } = o.getSpineItemSpineLayoutInfo(m);
6017
+ return p.x >= f && p.x <= b && p.y <= y && p.y >= I;
6010
6018
  },
6011
6019
  spineItemLocator: t,
6012
6020
  getSafeSpineItemPositionFromUnsafeSpineItemPosition: (p, m) => {
@@ -6017,10 +6025,10 @@ const $s = ({
6017
6025
  });
6018
6026
  }
6019
6027
  };
6020
- }, Cs = D.namespace("spine"), Es = ({
6028
+ }, Es = D.namespace("spine"), Ds = ({
6021
6029
  position: n,
6022
6030
  pageSize: e
6023
- }) => new bi({
6031
+ }) => new vi({
6024
6032
  ...n,
6025
6033
  left: n.x,
6026
6034
  top: n.y,
@@ -6029,7 +6037,7 @@ const $s = ({
6029
6037
  bottom: n.y + e.height,
6030
6038
  right: n.x + e.width
6031
6039
  });
6032
- class Ds extends ce {
6040
+ class Rs extends ce {
6033
6041
  constructor(e, t, i, o, s, r) {
6034
6042
  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(
6035
6043
  (u) => u.itemIndex === a.index && u.pageIndex === c
@@ -6042,14 +6050,14 @@ class Ds extends ce {
6042
6050
  const f = i.getSpineItemPositionFromPageIndex({
6043
6051
  spineItem: d,
6044
6052
  pageIndex: y
6045
- }), I = s.getSpinePositionFromSpineItemPosition({
6053
+ }), b = s.getSpinePositionFromSpineItemPosition({
6046
6054
  spineItem: d,
6047
6055
  spineItemPosition: f
6048
6056
  });
6049
6057
  return {
6050
- absoluteLayout: Es({
6058
+ absoluteLayout: Ds({
6051
6059
  pageSize: a,
6052
- position: I
6060
+ position: b
6053
6061
  }),
6054
6062
  layout: new Ii({
6055
6063
  left: f.x,
@@ -6078,7 +6086,7 @@ class Ds extends ce {
6078
6086
  const p = l.spineItem.renderer?.getDocumentFrame();
6079
6087
  let m;
6080
6088
  p && p?.contentWindow?.document && // very important because it is being used by next functions
6081
- p.contentWindow.document.body !== null && (m = Ln(
6089
+ p.contentWindow.document.body !== null && (m = Mn(
6082
6090
  p.contentWindow.document,
6083
6091
  l.layout
6084
6092
  )), h.next({ ...g, firstVisibleNode: m });
@@ -6086,12 +6094,12 @@ class Ds extends ce {
6086
6094
  })
6087
6095
  );
6088
6096
  }),
6089
- S((a) => (Cs.info("Pages layout", a), { pages: a })),
6097
+ S((a) => (Es.info("Pages layout", a), { pages: a })),
6090
6098
  E()
6091
6099
  ), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
6092
6100
  }
6093
6101
  }
6094
- class Rs extends X {
6102
+ class As extends X {
6095
6103
  constructor(e, t) {
6096
6104
  super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
6097
6105
  w((i) => {
@@ -6114,7 +6122,7 @@ class Rs extends X {
6114
6122
  );
6115
6123
  }
6116
6124
  }
6117
- const As = ({
6125
+ const Os = ({
6118
6126
  horizontalOffset: n,
6119
6127
  verticalOffset: e,
6120
6128
  context: t,
@@ -6139,23 +6147,23 @@ const As = ({
6139
6147
  }).pipe(
6140
6148
  S(({ width: p, height: m }) => {
6141
6149
  if (s.values.computedPageTurnDirection === "vertical") {
6142
- const I = d ? e : e - c.absoluteViewport.height, b = d ? 0 : n;
6150
+ const b = d ? e : e - c.absoluteViewport.height, I = d ? 0 : n;
6143
6151
  t.isRTL() ? a.layout.adjustPositionOfElement({
6144
- top: I,
6145
- left: b
6152
+ top: b,
6153
+ left: I
6146
6154
  }) : a.layout.adjustPositionOfElement({
6147
- top: I,
6148
- left: b
6155
+ top: b,
6156
+ left: I
6149
6157
  });
6150
- const F = p + b, $ = m + I, A = new _e({
6151
- left: b,
6158
+ const F = p + I, $ = m + b, A = new _e({
6159
+ left: I,
6152
6160
  right: F,
6153
- top: I,
6161
+ top: b,
6154
6162
  bottom: $,
6155
6163
  height: m,
6156
6164
  width: p,
6157
- x: b,
6158
- y: I
6165
+ x: I,
6166
+ y: b
6159
6167
  });
6160
6168
  return {
6161
6169
  horizontalOffset: F,
@@ -6184,7 +6192,7 @@ const As = ({
6184
6192
  })
6185
6193
  );
6186
6194
  };
6187
- class Os extends X {
6195
+ class Ns extends X {
6188
6196
  constructor(e, t, i, o) {
6189
6197
  super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6190
6198
  x(() => {
@@ -6228,12 +6236,12 @@ class Os extends X {
6228
6236
  ),
6229
6237
  Ue(() => {
6230
6238
  s.next(!0);
6231
- const r = this.context.manifest, a = qt(r) ?? !1;
6239
+ const r = this.context.manifest, a = Gt(r) ?? !1;
6232
6240
  return N(this.spineItemsManager.items).pipe(
6233
- pn(
6241
+ gn(
6234
6242
  (u, l, d) => u.pipe(
6235
6243
  rt(
6236
- ({ horizontalOffset: g, verticalOffset: h }) => As({
6244
+ ({ horizontalOffset: g, verticalOffset: h }) => Os({
6237
6245
  context: this.context,
6238
6246
  horizontalOffset: g,
6239
6247
  index: d,
@@ -6291,32 +6299,32 @@ class Os extends X {
6291
6299
  super.destroy(), this.layoutSubject.complete();
6292
6300
  }
6293
6301
  }
6294
- class Ns extends X {
6302
+ class Vs extends X {
6295
6303
  constructor(e, t, i, o, s, r, a) {
6296
6304
  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 H(
6297
6305
  void 0
6298
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Os(
6306
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Ns(
6299
6307
  i,
6300
6308
  e,
6301
6309
  s,
6302
6310
  a
6303
- ), this.locator = Ms({
6311
+ ), this.locator = Cs({
6304
6312
  context: e,
6305
6313
  spineItemsManager: i,
6306
6314
  spineItemLocator: o,
6307
6315
  settings: s,
6308
6316
  spineLayout: this.spineLayout,
6309
6317
  viewport: a
6310
- }), this.spineItemsLoader = new ws(
6318
+ }), this.spineItemsLoader = new Ps(
6311
6319
  this.context,
6312
6320
  i,
6313
6321
  this.locator,
6314
6322
  s,
6315
6323
  this.spineLayout
6316
- ), this.spineItemsObserver = new Rs(
6324
+ ), this.spineItemsObserver = new As(
6317
6325
  i,
6318
6326
  this.locator
6319
- ), this.pages = new Ds(
6327
+ ), this.pages = new Rs(
6320
6328
  this.spineLayout,
6321
6329
  this.spineItemsManager,
6322
6330
  this.spineItemLocator,
@@ -6341,7 +6349,7 @@ class Ns extends X {
6341
6349
  if (!d) return;
6342
6350
  this.spineItemsManager.destroyItems();
6343
6351
  const g = l.spineItems.map(
6344
- (h, p) => new Qt(
6352
+ (h, p) => new en(
6345
6353
  h,
6346
6354
  d,
6347
6355
  this.context,
@@ -6372,7 +6380,7 @@ class Ns extends X {
6372
6380
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6373
6381
  }
6374
6382
  }
6375
- class Vs extends X {
6383
+ class js extends X {
6376
6384
  constructor(e, t) {
6377
6385
  super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new H([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6378
6386
  }
@@ -6386,7 +6394,7 @@ class Vs extends X {
6386
6394
  return i > o ? "after" : i === o ? "same" : "before";
6387
6395
  }
6388
6396
  getSpineItemIndex(e) {
6389
- const t = e instanceof Qt ? e : this.get(e);
6397
+ const t = e instanceof en ? e : this.get(e);
6390
6398
  if (!t) return;
6391
6399
  const i = this.orderedSpineItemsSubject.value.indexOf(t);
6392
6400
  return i < 0 ? void 0 : i;
@@ -6415,10 +6423,10 @@ class Vs extends X {
6415
6423
  });
6416
6424
  }
6417
6425
  }
6418
- class js extends ce {
6426
+ class ks extends ce {
6419
6427
  constructor(e, t) {
6420
6428
  const i = document.createElement("div");
6421
- i.setAttribute(`data-${oi}`, ""), super({
6429
+ i.setAttribute(`data-${si}`, ""), super({
6422
6430
  element: i,
6423
6431
  pageSize: {
6424
6432
  width: 1,
@@ -6458,7 +6466,7 @@ class js extends ce {
6458
6466
  });
6459
6467
  }
6460
6468
  get absoluteViewport() {
6461
- return new Ps({
6469
+ return new xs({
6462
6470
  width: this.value.width,
6463
6471
  height: this.value.height
6464
6472
  });
@@ -6486,18 +6494,18 @@ class js extends ce {
6486
6494
  */
6487
6495
  get relativeViewport() {
6488
6496
  const e = this.absoluteViewport, t = this.scaleFactor;
6489
- return new xs({
6497
+ return new $s({
6490
6498
  width: e.width / t,
6491
6499
  height: e.height / t
6492
6500
  });
6493
6501
  }
6494
6502
  }
6495
- const $t = `${Ut}-core`, ks = (n) => {
6496
- const e = crypto.randomUUID(), t = new R(), i = new R(), o = new Ro(), s = new Eo(), r = new Ss(n, s), a = new Do(s, r), c = new Vs(s, r), u = new js(s, r), l = Jt({
6503
+ const $t = `${Ut}-core`, Us = (n) => {
6504
+ const e = crypto.randomUUID(), t = new R(), i = new R(), o = new No(), s = new Ao(), r = new bs(n, s), a = new Oo(s, r), c = new js(s, r), u = new ks(s, r), l = Kt({
6497
6505
  context: s,
6498
6506
  settings: r,
6499
6507
  viewport: u
6500
- }), d = new hs(s, c), g = new Ns(
6508
+ }), d = new ms(s, c), g = new Vs(
6501
6509
  s,
6502
6510
  d,
6503
6511
  c,
@@ -6505,14 +6513,14 @@ const $t = `${Ut}-core`, ks = (n) => {
6505
6513
  r,
6506
6514
  o,
6507
6515
  u
6508
- ), h = gs({
6516
+ ), h = hs({
6509
6517
  context: s,
6510
6518
  spineItemsManager: c,
6511
6519
  hookManager: o,
6512
6520
  spine: g,
6513
6521
  settings: r,
6514
6522
  viewport: u
6515
- }), p = new ms(
6523
+ }), p = new fs(
6516
6524
  s,
6517
6525
  d,
6518
6526
  c,
@@ -6531,21 +6539,21 @@ const $t = `${Ut}-core`, ks = (n) => {
6531
6539
  return;
6532
6540
  }
6533
6541
  D.log("load", { options: $ });
6534
- const B = Us(A, e);
6542
+ const B = zs(A, e);
6535
6543
  s.update({
6536
6544
  manifest: Y,
6537
6545
  rootElement: B
6538
6546
  }), m();
6539
- }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), j(m)), I = t.pipe(
6547
+ }, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), j(m)), b = t.pipe(
6540
6548
  j(() => {
6541
6549
  const $ = s.value.rootElement;
6542
6550
  $ && ($.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
6543
6551
  }),
6544
6552
  G(i)
6545
- ), b = P(I, f).subscribe();
6546
- Je(document, $t, Ao);
6553
+ ), I = P(b, f).subscribe();
6554
+ Je(document, $t, Vo);
6547
6555
  const F = () => {
6548
- Ke(document, $t), b.unsubscribe(), c.destroy(), p.destroy(), r.destroy(), d.destroy(), s.destroy(), h.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6556
+ Ke(document, $t), I.unsubscribe(), c.destroy(), p.destroy(), r.destroy(), d.destroy(), s.destroy(), h.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
6549
6557
  };
6550
6558
  return {
6551
6559
  id: e,
@@ -6553,7 +6561,7 @@ const $t = `${Ut}-core`, ks = (n) => {
6553
6561
  spine: g,
6554
6562
  hookManager: o,
6555
6563
  cfi: {
6556
- generateCfiFromRange: so,
6564
+ generateCfiFromRange: ro,
6557
6565
  parseCfi: ot,
6558
6566
  generateCfiForSpineItemPage: ($) => He({
6559
6567
  ...$,
@@ -6594,31 +6602,31 @@ const $t = `${Ut}-core`, ks = (n) => {
6594
6602
  destroy$: i
6595
6603
  }
6596
6604
  };
6597
- }, Us = (n, e) => (n.style.cssText = `
6605
+ }, zs = (n, e) => (n.style.cssText = `
6598
6606
  ${n.style.cssText}
6599
6607
  background-color: white;
6600
6608
  position: relative;
6601
- `, n.classList.add(`${W}-reader`), n.setAttribute(ii, e), n), tr = (
6609
+ `, n.classList.add(`${W}-reader`), n.setAttribute(oi, e), n), nr = (
6602
6610
  //__
6603
6611
  Io(
6604
- Gn(
6605
- Ai(
6606
- wo(
6607
- qn(
6608
- Un(
6609
- ho(
6610
- vo(
6611
- Mo(
6612
- qi(
6613
- Si(
6614
- Ni(
6615
- zn(
6616
- bo(
6617
- lo(
6618
- Ci(
6619
- Bn(
6612
+ Zn(
6613
+ Oi(
6614
+ Po(
6615
+ Gn(
6616
+ zn(
6617
+ mo(
6618
+ wo(
6619
+ Do(
6620
+ Gi(
6621
+ bi(
6622
+ Vi(
6623
+ Wn(
6624
+ vo(
6625
+ po(
6626
+ Ei(
6627
+ Xn(
6620
6628
  // __
6621
- ks
6629
+ Us
6622
6630
  )
6623
6631
  )
6624
6632
  )
@@ -6636,80 +6644,81 @@ const $t = `${Ut}-core`, ks = (n) => {
6636
6644
  )
6637
6645
  )
6638
6646
  )
6639
- ), nr = (n) => (e) => n(e);
6647
+ ), ir = (n) => (e) => n(e);
6640
6648
  export {
6641
6649
  _t as AbstractSpinePosition,
6642
- Eo as Context,
6643
- jo as ControlledNavigationController,
6650
+ Ao as Context,
6651
+ zo as ControlledNavigationController,
6644
6652
  X as DestroyableClass,
6645
6653
  fe as DocumentRenderer,
6646
- Do as Features,
6647
- ii as HTML_ATTRIBUTE_DATA_READER_ID,
6654
+ Oo as Features,
6655
+ oi as HTML_ATTRIBUTE_DATA_READER_ID,
6648
6656
  W as HTML_PREFIX,
6649
- si as HTML_PREFIX_SCROLL_NAVIGATOR,
6650
- oi as HTML_PREFIX_VIEWPORT,
6657
+ ri as HTML_PREFIX_SCROLL_NAVIGATOR,
6658
+ si as HTML_PREFIX_VIEWPORT,
6651
6659
  Ut as HTML_STYLE_PREFIX,
6652
- Ro as HookManager,
6653
- ni as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6654
- es as InternalNavigator,
6660
+ No as HookManager,
6661
+ ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
6662
+ ts as InternalNavigator,
6655
6663
  it as LayoutEntry,
6656
- Gt as Locker,
6657
- Ks as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6658
- Zs as PROSE_READER_NAMESPACE,
6659
- Ds as Pages,
6660
- hs as Pagination,
6661
- ms as PaginationController,
6664
+ Zt as Locker,
6665
+ Qs as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
6666
+ Js as PROSE_READER_NAMESPACE,
6667
+ Rs as Pages,
6668
+ ms as Pagination,
6669
+ fs as PaginationController,
6662
6670
  ce as ReactiveEntity,
6663
6671
  nt as ResourceHandler,
6664
- uo as ResourcesLocator,
6665
- Uo as ScrollNavigationController,
6666
- St as ScrollPosition,
6667
- ys as SettingsManager,
6668
- Ns as Spine,
6669
- Qt as SpineItem,
6672
+ lo as ResourcesLocator,
6673
+ Lo as ScrollNavigationController,
6674
+ ft as ScrollPosition,
6675
+ Ss as SettingsManager,
6676
+ Vs as Spine,
6677
+ en as SpineItem,
6670
6678
  Ii as SpineItemPageLayout,
6671
- bi as SpineItemPageSpineLayout,
6679
+ vi as SpineItemPageSpineLayout,
6672
6680
  C as SpineItemPosition,
6673
6681
  _e as SpineItemSpineLayout,
6674
- Vs as SpineItemsManager,
6675
- Rs as SpineItemsObserver,
6682
+ js as SpineItemsManager,
6683
+ As as SpineItemsObserver,
6676
6684
  M as SpinePosition,
6685
+ Fo as UnboundScrollPosition,
6677
6686
  Ae as UnboundSpineItemPagePosition,
6678
6687
  ae as UnboundSpinePosition,
6679
- Js as VIEWPORT_ADJUSTMENT_THROTTLE,
6680
- js as Viewport,
6681
- co as consolidate,
6682
- tr as createReader,
6688
+ Ks as VIEWPORT_ADJUSTMENT_THROTTLE,
6689
+ ks as Viewport,
6690
+ uo as consolidate,
6691
+ nr as createReader,
6683
6692
  ut as deferIdle,
6684
- Xn as deferNextResult,
6693
+ Yn as deferNextResult,
6685
6694
  He as generateCfiForSpineItemPage,
6686
- so as generateCfiFromRange,
6695
+ ro as generateCfiFromRange,
6687
6696
  he as generateRootCfi,
6688
6697
  ct as getAttributeValueFromString,
6689
- qs as getBase64FromBlob,
6698
+ Gs as getBase64FromBlob,
6690
6699
  Qe as getFrameViewportInfo,
6691
- er as getItemAnchor,
6692
- Si as htmlEnhancer,
6700
+ tr as getItemAnchor,
6701
+ bi as htmlEnhancer,
6693
6702
  Vt as idle,
6694
- Vn as injectCSS,
6703
+ jn as injectCSS,
6695
6704
  Ot as isHtmlElement,
6696
- On as isHtmlTagElement,
6705
+ Nn as isHtmlTagElement,
6697
6706
  Be as isRootCfi,
6698
- sr as isShallowEqual,
6699
- Ci as layoutEnhancer,
6707
+ rr as isShallowEqual,
6708
+ Ei as layoutEnhancer,
6700
6709
  Nt as mapKeysTo,
6701
- Ys as observeIntersection,
6710
+ qs as observeIntersection,
6702
6711
  lt as observeMutation,
6703
6712
  tt as observeResize,
6704
- lo as paginationEnhancer,
6713
+ po as paginationEnhancer,
6705
6714
  ot as parseCfi,
6706
- Xs as removeCSS,
6715
+ Ys as removeCSS,
6707
6716
  Yt as resolveCfi,
6708
- nr as rootEnhancer,
6709
- Es as spinePositionToSpineItemSpineLayout,
6717
+ ir as rootEnhancer,
6718
+ Ds as spinePositionToSpineItemSpineLayout,
6710
6719
  te as upsertCSSToFrame,
6711
- jn as waitForFrameLoad,
6712
- kn as waitForFrameReady,
6720
+ kn as waitForFrameLoad,
6721
+ Un as waitForFrameReady,
6713
6722
  Ee as waitForSwitch,
6714
6723
  et as watchKeys
6715
6724
  };