@prose-reader/core 1.238.0 → 1.239.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,7 +1,7 @@
1
- import { switchMap as v, of as b, fromEvent as X, take as wt, map as S, from as j, takeUntil as T, Observable as ie, defer as Ve, Subject as V, combineLatest as z, merge as P, EMPTY as J, withLatestFrom as E, NEVER as ge, tap as $, share as A, BehaviorSubject as k, filter as L, first as U, mergeMap as Te, endWith as fe, finalize as le, catchError as Pt, lastValueFrom as Qt, scheduled as en, animationFrameScheduler as re, timer as je, distinctUntilChanged as W, throttleTime as tn, startWith as te, debounceTime as Ie, shareReplay as K, switchScan as nn, defaultIfEmpty as on, forkJoin as sn, delay as we, ReplaySubject as nt, skip as xt, identity as Pe, exhaustMap as ke, reduce as rn, concatMap as it } from "rxjs";
2
- import { Report as an, isShallowEqual as O, shallowMergeIfDefined as xe, getParentPath as cn, parseContentType as un, detectMimeTypeFromName as Me, arrayEqual as ln } from "@prose-reader/shared";
3
- import { isShallowEqual as Us } from "@prose-reader/shared";
4
- import { switchMap as B, first as $t, map as Y, distinctUntilChanged as G, startWith as dn, shareReplay as Ce, tap as D, pairwise as pn, take as gn, takeUntil as q, filter as Q, debounceTime as hn, skip as mn, mergeMap as fn, catchError as ot } from "rxjs/operators";
1
+ import { switchMap as v, of as b, fromEvent as X, take as wt, map as S, from as j, takeUntil as T, Observable as ie, defer as Ve, Subject as V, combineLatest as z, merge as P, EMPTY as J, withLatestFrom as A, NEVER as ge, tap as $, share as E, BehaviorSubject as k, filter as L, first as U, mergeMap as $e, endWith as fe, finalize as le, catchError as Pt, lastValueFrom as Qt, scheduled as en, animationFrameScheduler as re, timer as je, distinctUntilChanged as W, throttleTime as tn, startWith as te, debounceTime as Ie, shareReplay as K, switchScan as nn, defaultIfEmpty as on, forkJoin as sn, delay as we, ReplaySubject as nt, skip as xt, identity as Pe, exhaustMap as ke, reduce as rn, concatMap as it } from "rxjs";
2
+ import { Report as an, isShallowEqual as N, shallowMergeIfDefined as xe, getParentPath as cn, parseContentType as un, detectMimeTypeFromName as Le, arrayEqual as ln } from "@prose-reader/shared";
3
+ import { isShallowEqual as Ws } from "@prose-reader/shared";
4
+ import { switchMap as B, first as $t, map as Y, distinctUntilChanged as G, startWith as dn, shareReplay as Me, tap as D, pairwise as pn, take as gn, takeUntil as q, filter as Q, debounceTime as hn, skip as mn, mergeMap as fn, catchError as ot } from "rxjs/operators";
5
5
  import { generate as Ue, parse as Tt, isIndirectionOnly as yn, isParsedCfiRange as Sn, resolve as In } from "@prose-reader/cfi";
6
6
  import { isDefined as qe } from "reactjrx";
7
7
  const st = (n, e) => {
@@ -11,7 +11,7 @@ const st = (n, e) => {
11
11
  if (!n?.contentDocument?.head) return;
12
12
  const o = n.contentDocument.createElement("style");
13
13
  o.id = e, o.innerHTML = t, i ? n.contentDocument.head.prepend(o) : n.contentDocument.head.appendChild(o);
14
- }, Rs = (n, e) => {
14
+ }, As = (n, e) => {
15
15
  if (n?.contentDocument?.head) {
16
16
  const t = n.contentDocument.getElementById(e);
17
17
  t && t.remove();
@@ -99,7 +99,7 @@ const st = (n, e) => {
99
99
  const s = t.spineItemsManager.get(i)?.renderer.getDocumentFrame();
100
100
  s && s.contentDocument?.body.setAttribute("tabindex", "-1");
101
101
  }), t;
102
- }, $n = "@prose-reader/core", N = an.namespace($n, void 0, {
102
+ }, $n = "@prose-reader/core", O = an.namespace($n, void 0, {
103
103
  color: "#98cde7"
104
104
  }), Tn = [
105
105
  "pointercancel",
@@ -167,7 +167,7 @@ const Cn = (n, e) => {
167
167
  try {
168
168
  e <= (t?.endOffset || 0) && t?.setStart(n, e || 0);
169
169
  } catch (i) {
170
- N.error(i);
170
+ O.error(i);
171
171
  }
172
172
  return t;
173
173
  }
@@ -196,7 +196,7 @@ const Cn = (n, e) => {
196
196
  return n instanceof e.MouseEvent;
197
197
  }
198
198
  return !1;
199
- }, En = (n) => {
199
+ }, An = (n) => {
200
200
  if (n?.target && n?.target?.ownerDocument?.defaultView) {
201
201
  const e = n?.target?.ownerDocument?.defaultView;
202
202
  if (e.TouchEvent)
@@ -208,7 +208,7 @@ const Cn = (n, e) => {
208
208
  return n instanceof e.TouchEvent;
209
209
  }
210
210
  return !1;
211
- }, An = () => document.createElement("div"), Lt = (n) => {
211
+ }, En = () => document.createElement("div"), Lt = (n) => {
212
212
  const e = [
213
213
  "img",
214
214
  // Images
@@ -259,10 +259,10 @@ function Ct(n) {
259
259
  // biome-ignore lint/suspicious/noExplicitAny: TODO
260
260
  ) && n.nodeType === Node.ELEMENT_NODE;
261
261
  }
262
- function On(n, e) {
262
+ function Nn(n, e) {
263
263
  return Ct(n) && n.tagName.toLowerCase() === e.toLowerCase();
264
264
  }
265
- function Nn(n) {
265
+ function On(n) {
266
266
  return Mt(
267
267
  n,
268
268
  [
@@ -276,7 +276,7 @@ function Nn(n) {
276
276
  ["setStart", "setEnd", "selectNodeContents"]
277
277
  );
278
278
  }
279
- const Ee = ({
279
+ const Re = ({
280
280
  position: n,
281
281
  frameElement: e
282
282
  }) => {
@@ -291,7 +291,7 @@ const Ee = ({
291
291
  const s = t.getSpineItemFromIframe(o), a = o, { height: r, width: c } = i.getPageSize();
292
292
  if (!s || !(a instanceof HTMLIFrameElement)) return n;
293
293
  if (Ge(n)) {
294
- const { clientX: u, clientY: l } = Ee({
294
+ const { clientX: u, clientY: l } = Re({
295
295
  position: n,
296
296
  frameElement: a
297
297
  }), d = new PointerEvent(n.type, {
@@ -306,7 +306,7 @@ const Ee = ({
306
306
  }), d;
307
307
  }
308
308
  if (Rn(n)) {
309
- const { clientX: u, clientY: l } = Ee({
309
+ const { clientX: u, clientY: l } = Re({
310
310
  position: n,
311
311
  frameElement: a
312
312
  }), d = new MouseEvent(n.type, {
@@ -319,9 +319,9 @@ const Ee = ({
319
319
  enumerable: !0
320
320
  }), d;
321
321
  }
322
- if (En(n)) {
322
+ if (An(n)) {
323
323
  const u = Array.from(n.touches).map((d) => {
324
- const { clientX: p, clientY: h } = Ee({
324
+ const { clientX: p, clientY: h } = Re({
325
325
  position: d,
326
326
  frameElement: a
327
327
  });
@@ -389,7 +389,7 @@ const Ee = ({
389
389
  [i]: o
390
390
  } : t,
391
391
  {}
392
- )), Je = (n) => (e) => e.pipe(Rt(n), G(O));
392
+ )), Je = (n) => (e) => e.pipe(Rt(n), G(N));
393
393
  function Ke(n) {
394
394
  return new ie((e) => {
395
395
  const t = new ResizeObserver((i) => {
@@ -400,7 +400,7 @@ function Ke(n) {
400
400
  };
401
401
  });
402
402
  }
403
- const Re = (n) => (e) => e.pipe(
403
+ const Ce = (n) => (e) => e.pipe(
404
404
  B(
405
405
  (t) => n.pipe(
406
406
  $t(),
@@ -414,7 +414,7 @@ const Re = (n) => (e) => e.pipe(
414
414
  });
415
415
  return () => (t.unsubscribe(), e ? b(e.result) : n);
416
416
  };
417
- function Et() {
417
+ function At() {
418
418
  return new ie((n) => {
419
419
  if (window.requestIdleCallback) {
420
420
  const t = window.requestIdleCallback(() => {
@@ -429,7 +429,7 @@ function Et() {
429
429
  });
430
430
  }
431
431
  function rt(n) {
432
- return Ve(() => Et().pipe(B(n)));
432
+ return Ve(() => At().pipe(B(n)));
433
433
  }
434
434
  const at = (n, e) => new ie((t) => {
435
435
  const i = new MutationObserver((o) => {
@@ -447,7 +447,7 @@ function Es(n, e) {
447
447
  };
448
448
  });
449
449
  }
450
- class At {
450
+ class Et {
451
451
  constructor(e, t) {
452
452
  this.settingsManager = t;
453
453
  const i = xe(
@@ -462,7 +462,7 @@ class At {
462
462
  this.outputSettingsUpdateSubject.pipe(dn(this.outputSettings))
463
463
  ]).pipe(
464
464
  Y(([o, s]) => ({ ...o, ...s })),
465
- Ce(1)
465
+ Me(1)
466
466
  ), this.values$.subscribe();
467
467
  }
468
468
  _prepareUpdate(e) {
@@ -488,19 +488,19 @@ class At {
488
488
  watch(e) {
489
489
  return Array.isArray(e) ? this.values$.pipe(Je(e)) : this.values$.pipe(
490
490
  Y((t) => t[e]),
491
- G(O)
491
+ G(N)
492
492
  );
493
493
  }
494
494
  destroy() {
495
495
  this.outputSettingsUpdateSubject.complete();
496
496
  }
497
497
  }
498
- let zn = class extends At {
498
+ let zn = class extends Et {
499
499
  computeOutputSettings(e) {
500
500
  return e;
501
501
  }
502
502
  hasSettingsChanged(e) {
503
- return !O(this.outputSettings, e);
503
+ return !N(this.outputSettings, e);
504
504
  }
505
505
  getCleanedParentInputSettings(e) {
506
506
  const {
@@ -570,7 +570,7 @@ const Hn = (n) => (e) => {
570
570
  };
571
571
  }, Bn = (n) => (e) => {
572
572
  const t = n(e), i = (o) => X(o, "keyup").pipe(
573
- E(t.settings.values$),
573
+ A(t.settings.values$),
574
574
  S(([s, { pageTurnDirection: a }]) => {
575
575
  if (a === "horizontal") {
576
576
  if (s.key === "ArrowRight")
@@ -622,7 +622,7 @@ const Hn = (n) => (e) => {
622
622
  $((e) => {
623
623
  e.preventDefault();
624
624
  }),
625
- A()
625
+ E()
626
626
  );
627
627
  class _ {
628
628
  constructor() {
@@ -632,44 +632,44 @@ class _ {
632
632
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
633
633
  }
634
634
  }
635
- const Le = class Le extends _ {
635
+ const Fe = class Fe extends _ {
636
636
  constructor(e) {
637
637
  super(), this.triggerSubject = new V(), this.stateSubject = new k("idle"), this.unload$ = this.triggerSubject.pipe(
638
- E(this.stateSubject),
638
+ A(this.stateSubject),
639
639
  L(
640
640
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
641
641
  ),
642
642
  S(() => {
643
643
  }),
644
- A()
644
+ E()
645
645
  ), this.load$ = this.triggerSubject.pipe(
646
- E(this.stateSubject),
646
+ A(this.stateSubject),
647
647
  L(
648
648
  ([o, s]) => o.type === "load" && s !== "loaded" && s !== "loading"
649
649
  ),
650
650
  S(() => {
651
651
  }),
652
- A()
652
+ E()
653
653
  ), this.context = e.context, this.settings = e.settings, this.hookManager = e.hookManager, this.item = e.item, this.containerElement = e.containerElement, this.resourcesHandler = e.resourcesHandler;
654
654
  const t = this.triggerSubject.pipe(
655
- E(this.stateSubject),
655
+ A(this.stateSubject),
656
656
  L(
657
657
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
658
658
  ),
659
659
  S(() => {
660
660
  }),
661
- A()
661
+ E()
662
662
  );
663
663
  this.loaded$ = this.load$.pipe(
664
664
  v(() => (this.stateSubject.next("loading"), this.onCreateDocument().pipe(U()).pipe(
665
- Te((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
665
+ $e((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
666
666
  itemId: this.item.id,
667
667
  documentContainer: s
668
668
  }), this.onLoadDocument().pipe(
669
669
  fe(null),
670
670
  U()
671
671
  ).pipe(
672
- Re(this.context.bridgeEvent.viewportFree$),
672
+ Ce(this.context.bridgeEvent.viewportFree$),
673
673
  v(() => {
674
674
  const r = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
675
675
  itemId: this.item.id,
@@ -685,7 +685,7 @@ const Le = class Le extends _ {
685
685
  }),
686
686
  T(t)
687
687
  ))),
688
- A()
688
+ E()
689
689
  );
690
690
  const i = t.pipe(
691
691
  v(() => (this.stateSubject.next("unloading"), this.context.bridgeEvent.viewportFree$.pipe(
@@ -704,7 +704,7 @@ const Le = class Le extends _ {
704
704
  }
705
705
  setDocumentContainer(e) {
706
706
  this._documentContainer = e, this._documentContainer.classList.add(
707
- Le.DOCUMENT_CONTAINER_CLASS_NAME
707
+ Fe.DOCUMENT_CONTAINER_CLASS_NAME
708
708
  );
709
709
  }
710
710
  attach() {
@@ -742,7 +742,7 @@ const Le = class Le extends _ {
742
742
  le(() => {
743
743
  e.complete();
744
744
  }),
745
- Pt((t) => (N.error(t), b(void 0)))
745
+ Pt((t) => (O.error(t), b(void 0)))
746
746
  );
747
747
  }
748
748
  layout(e) {
@@ -769,8 +769,8 @@ const Le = class Le extends _ {
769
769
  return this.context.manifest?.renditionLayout ?? "reflowable";
770
770
  }
771
771
  };
772
- Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
773
- let ye = Le;
772
+ Fe.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
773
+ let ye = Fe;
774
774
  const Xn = (n) => new URL(n.href);
775
775
  class Qe {
776
776
  constructor(e, t) {
@@ -846,10 +846,10 @@ const Dt = (n, e) => {
846
846
  if (!a) return b(null);
847
847
  const r = new Qe(a, o);
848
848
  return j(r.getResource()).pipe(
849
- Te(
849
+ $e(
850
850
  (c) => c instanceof Response ? j(c.blob()) : b(void 0)
851
851
  ),
852
- Te((c) => {
852
+ $e((c) => {
853
853
  if (!c)
854
854
  return b(null);
855
855
  const u = n?.defaultView?.URL.createObjectURL(c) ?? "";
@@ -897,7 +897,7 @@ const Dt = (n, e) => {
897
897
  Dn(n?.contentDocument);
898
898
  }, Jn = [".xhtml", ".html", ".htm"], me = "prose-reader", Kn = async (n, e) => {
899
899
  if (typeof n == "string") return n;
900
- const t = un(n.headers.get("Content-Type") || "") || Me(e.href);
900
+ const t = un(n.headers.get("Content-Type") || "") || Le(e.href);
901
901
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
902
902
  (o) => o === t
903
903
  )) {
@@ -962,10 +962,10 @@ const Dt = (n, e) => {
962
962
  }
963
963
  }),
964
964
  S(() => o),
965
- Pt((r) => (N.error(
965
+ Pt((r) => (O.error(
966
966
  `Error while trying to fetch or load resource for item ${n.id}`,
967
967
  s
968
- ), N.error(r), b(o)))
968
+ ), O.error(r), b(o)))
969
969
  ))
970
970
  ))
971
971
  );
@@ -984,12 +984,12 @@ const Dt = (n, e) => {
984
984
  border: 0px none transparent;
985
985
  padding: 0px;
986
986
  `, n.setAttribute("role", "main"), n;
987
- }, Ot = () => `
987
+ }, Nt = () => `
988
988
  body {
989
989
  margin: 0;
990
990
  }
991
991
  }
992
- `, Nt = ({
992
+ `, Ot = ({
993
993
  pageHeight: n,
994
994
  pageWidth: e,
995
995
  frameElement: t
@@ -1007,7 +1007,7 @@ const Dt = (n, e) => {
1007
1007
  enableTouch: e,
1008
1008
  spreadPosition: t
1009
1009
  }, i) => `
1010
- ${Ot()}
1010
+ ${Nt()}
1011
1011
  body {
1012
1012
  ${i ? "" : `
1013
1013
  display: flex;
@@ -1064,7 +1064,7 @@ const Dt = (n, e) => {
1064
1064
  }) => {
1065
1065
  const c = n * o;
1066
1066
  if (s?.contentDocument && s?.contentWindow) {
1067
- const { viewportDimensions: u, computedScale: l = 1 } = Nt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, p = i, h = ti(
1067
+ const { viewportDimensions: u, computedScale: l = 1 } = Ot({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, p = i, h = ti(
1068
1068
  {
1069
1069
  ...ni({ pageHeight: i, pageWidth: o }),
1070
1070
  enableTouch: r,
@@ -1097,7 +1097,7 @@ const Dt = (n, e) => {
1097
1097
  }
1098
1098
  return { width: c, height: i };
1099
1099
  }, oi = () => `
1100
- ${Ot()}
1100
+ ${Nt()}
1101
1101
  html {
1102
1102
  width: 100%;
1103
1103
  height: 100%;
@@ -1234,7 +1234,7 @@ const Dt = (n, e) => {
1234
1234
  }) => {
1235
1235
  const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", p = d ? Math.min(400, n) : n;
1236
1236
  t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${p}px`);
1237
- const { viewportDimensions: h, computedScale: g = 1 } = Nt({
1237
+ const { viewportDimensions: h, computedScale: g = 1 } = Ot({
1238
1238
  frameElement: t,
1239
1239
  pageHeight: p,
1240
1240
  pageWidth: e
@@ -1295,7 +1295,7 @@ const Dt = (n, e) => {
1295
1295
  };
1296
1296
  class ui extends ye {
1297
1297
  constructor() {
1298
- super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
1298
+ super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Le(this.item.href))?.startsWith("image/");
1299
1299
  }
1300
1300
  onCreateDocument() {
1301
1301
  const e = ei();
@@ -1310,7 +1310,7 @@ class ui extends ye {
1310
1310
  resourcesHandler: this.resourcesHandler,
1311
1311
  settings: this.settings
1312
1312
  }),
1313
- Re(this.context.bridgeEvent.viewportFree$),
1313
+ Ce(this.context.bridgeEvent.viewportFree$),
1314
1314
  $(() => {
1315
1315
  this.attach();
1316
1316
  }),
@@ -1560,12 +1560,12 @@ const gi = (n, e) => {
1560
1560
  )
1561
1561
  )
1562
1562
  );
1563
- let Ii = class extends At {
1563
+ let Ii = class extends Et {
1564
1564
  computeOutputSettings(e) {
1565
1565
  return e;
1566
1566
  }
1567
1567
  hasSettingsChanged(e) {
1568
- return !O(this.outputSettings, e);
1568
+ return !N(this.outputSettings, e);
1569
1569
  }
1570
1570
  getCleanedParentInputSettings(e) {
1571
1571
  const {
@@ -1596,7 +1596,7 @@ const ut = 200, bi = (n, e, t) => {
1596
1596
  const i = n.navigation.scrollNavigationController.value.element, o = n.viewport.value.element, s = n.settings.values.computedPageTurnMode === "scrollable";
1597
1597
  o.style.transition = `transform ${ut}ms`, s ? o.style.transformOrigin = "top" : o.style.transformOrigin = "center";
1598
1598
  const a = o.style.transform, r = a.includes("scale") ? parseFloat(a.match(/scale\(([^)]+)\)/)?.[1] || "1") : 1, c = t === "thumbnails" ? 0.5 : 1, { newScrollLeft: u, newScrollTop: l } = bi(
1599
- i ?? An(),
1599
+ i ?? En(),
1600
1600
  r,
1601
1601
  c
1602
1602
  );
@@ -1634,7 +1634,7 @@ const ut = 200, bi = (n, e, t) => {
1634
1634
  !f && I && (I.getBoundingClientRect().left, f = !0);
1635
1635
  });
1636
1636
  }), r.hookManager.register("item.onBeforeLayout", ({ item: f }) => {
1637
- const m = r.spineItemsManager.get(f.id), w = !!(f.mediaType ?? Me(f.href))?.startsWith("image/"), { pageHorizontalMargin: x = 0, pageVerticalMargin: C = 0 } = c.values, M = r.context.getPageSize();
1637
+ const m = r.spineItemsManager.get(f.id), w = !!(f.mediaType ?? Le(f.href))?.startsWith("image/"), { pageHorizontalMargin: x = 0, pageVerticalMargin: C = 0 } = c.values, M = r.context.getPageSize();
1638
1638
  if (m?.renditionLayout === "reflowable" && !w) {
1639
1639
  let H = M.width - x * 2;
1640
1640
  const Z = M.height - C * 2;
@@ -1707,7 +1707,7 @@ const ut = 200, bi = (n, e, t) => {
1707
1707
  r,
1708
1708
  c.watch("viewportMode")
1709
1709
  ), g = r.spine.pages.pipe(
1710
- Ce({ refCount: !0, bufferSize: 1 })
1710
+ Me({ refCount: !0, bufferSize: 1 })
1711
1711
  ), y = Si(r);
1712
1712
  return P(
1713
1713
  p,
@@ -1782,7 +1782,7 @@ const ut = 200, bi = (n, e, t) => {
1782
1782
  width: i.context.state.visibleAreaRect.width,
1783
1783
  theme: u
1784
1784
  })),
1785
- G(O),
1785
+ G(N),
1786
1786
  D(({ width: u, theme: l }) => {
1787
1787
  Object.values(c).forEach((d) => {
1788
1788
  d.style.setProperty("max-width", `${u}px`), d.style.setProperty(
@@ -1803,7 +1803,7 @@ const ut = 200, bi = (n, e, t) => {
1803
1803
  })
1804
1804
  ), r = i.spineItemsManager.items$.pipe(
1805
1805
  B((c) => o(c)),
1806
- Ce(1),
1806
+ Me(1),
1807
1807
  q(i.context.destroy$)
1808
1808
  );
1809
1809
  return r.pipe(
@@ -1879,7 +1879,7 @@ const Li = (n) => (e) => {
1879
1879
  const t = n({
1880
1880
  ...e,
1881
1881
  getRenderer(a) {
1882
- const r = e.getRenderer?.(a), u = !!(a.mediaType ?? Me(a.href))?.startsWith("image/");
1882
+ const r = e.getRenderer?.(a), u = !!(a.mediaType ?? Le(a.href))?.startsWith("image/");
1883
1883
  return !r && u ? (l) => new Fi(l) : r;
1884
1884
  }
1885
1885
  }), i = new IntersectionObserver(
@@ -1930,13 +1930,13 @@ const Li = (n) => (e) => {
1930
1930
  };
1931
1931
  }, Mi = (n, e) => n.links$.pipe(
1932
1932
  $((t) => {
1933
- if (!On(t.target, "a") || t.type !== "click") return;
1933
+ if (!Nn(t.target, "a") || t.type !== "click") return;
1934
1934
  const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
1935
1935
  n.context.manifest?.spineItems.some(
1936
1936
  (a) => a.href === o
1937
1937
  ) && e.goToUrl(i);
1938
1938
  })
1939
- ), se = N.namespace("navigation"), Ci = ({
1939
+ ), se = O.namespace("navigation"), Ci = ({
1940
1940
  position: n,
1941
1941
  spineItem: e,
1942
1942
  pageHeight: t,
@@ -2032,7 +2032,7 @@ const Li = (n) => (e) => {
2032
2032
  return i.getAdjustedPositionForSpread(c);
2033
2033
  }
2034
2034
  return i.getAdjustedPositionForSpread(r);
2035
- }, Ei = ({
2035
+ }, Ai = ({
2036
2036
  position: n,
2037
2037
  spineItem: e,
2038
2038
  pageHeight: t,
@@ -2064,7 +2064,7 @@ const Li = (n) => (e) => {
2064
2064
  const u = o.getSpineItemPositionFromSpinePosition(
2065
2065
  n,
2066
2066
  r
2067
- ), l = Ei({
2067
+ ), l = Ai({
2068
2068
  position: u,
2069
2069
  spineItem: r,
2070
2070
  pageHeight: s.getPageSize().height,
@@ -2086,7 +2086,7 @@ const Li = (n) => (e) => {
2086
2086
  x: 0
2087
2087
  })
2088
2088
  );
2089
- }, Ai = ({
2089
+ }, Ei = ({
2090
2090
  position: n,
2091
2091
  spineItem: e,
2092
2092
  context: t,
@@ -2151,7 +2151,7 @@ class Di {
2151
2151
  turnRightOrBottom() {
2152
2152
  const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
2153
2153
  if (!t) return;
2154
- const i = Ai({
2154
+ const i = Ei({
2155
2155
  context: this.reader.context,
2156
2156
  navigationResolver: this.reader.navigation.navigationResolver,
2157
2157
  position: e.position,
@@ -2307,7 +2307,7 @@ class Di {
2307
2307
  }
2308
2308
  }
2309
2309
  }
2310
- class Oi {
2310
+ class Ni {
2311
2311
  constructor(e) {
2312
2312
  this.reader = e, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new F({ x: 0, y: 0 }), this.lastStartPosition = new F({ x: 0, y: 0 }), this.unlock = void 0;
2313
2313
  }
@@ -2346,8 +2346,8 @@ class Oi {
2346
2346
  });
2347
2347
  }
2348
2348
  }
2349
- const Ni = (n) => n.pagination.state$.pipe(
2350
- E(n.context.manifest$, n.settings.values$),
2349
+ const Oi = (n) => n.pagination.state$.pipe(
2350
+ A(n.context.manifest$, n.settings.values$),
2351
2351
  S(
2352
2352
  ([
2353
2353
  e,
@@ -2365,7 +2365,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2365
2365
  };
2366
2366
  }
2367
2367
  ),
2368
- W(O)
2368
+ W(N)
2369
2369
  ), Vi = ({ reader: n, duration: e }) => (t) => {
2370
2370
  let i;
2371
2371
  const o = () => {
@@ -2383,7 +2383,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2383
2383
  le(o)
2384
2384
  );
2385
2385
  }, ji = (n) => (e) => {
2386
- const t = n(e), i = Ni(t), o = new Di(t), s = new Oi(t), a = (c) => {
2386
+ const t = n(e), i = Oi(t), o = new Di(t), s = new Ni(t), a = (c) => {
2387
2387
  const { cfi: u, ...l } = c;
2388
2388
  t.load(l), u && o.goToCfi(u, { animate: !1 });
2389
2389
  };
@@ -2470,7 +2470,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2470
2470
  );
2471
2471
  }, Bi = (n, e, t, i, o) => o.isReady$.pipe(
2472
2472
  U(),
2473
- E(n.layoutInfo$),
2473
+ A(n.layoutInfo$),
2474
2474
  S(([s, a]) => {
2475
2475
  const r = n.context, c = r.manifest?.renditionLayout === "pre-paginated", u = r.manifest?.spineItems.length || 0, l = r.manifest?.spineItems.slice(0, e).reduce((m, I) => m + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0, p = n.context.manifest?.spineItems.length ?? 0, h = a.pages.filter((m) => m.itemIndex === d).length ?? 0, g = r.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
2476
2476
  // relative to the total number of documents
@@ -2490,7 +2490,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2490
2490
  })
2491
2491
  ), _i = (n) => n.spine.layout$.pipe(
2492
2492
  Ie(10, re),
2493
- E(n.pagination.state$),
2493
+ A(n.pagination.state$),
2494
2494
  S(() => ({
2495
2495
  numberOfPagesPerItems: n.spineItemsManager.items.reduce(
2496
2496
  (t, i) => [...t, i.numberOfPages],
@@ -2501,7 +2501,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2501
2501
  */
2502
2502
  numberOfTotalPages: n.spine.pages.value.pages.length
2503
2503
  })),
2504
- W(O),
2504
+ W(N),
2505
2505
  te({
2506
2506
  numberOfPagesPerItems: [],
2507
2507
  numberOfTotalPages: 0
@@ -2588,7 +2588,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2588
2588
  }))
2589
2589
  )
2590
2590
  ),
2591
- W(O)
2591
+ W(N)
2592
2592
  );
2593
2593
  return { paginationInfo$: z([
2594
2594
  o,
@@ -2620,7 +2620,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2620
2620
  item: t
2621
2621
  }) => {
2622
2622
  const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
2623
- return !i || !i?.documentElement || n === i ? he(t) : Nn(n) ? Ue({
2623
+ return !i || !i?.documentElement || n === i ? he(t) : On(n) ? Ue({
2624
2624
  start: {
2625
2625
  node: n.startContainer,
2626
2626
  offset: n.startOffset,
@@ -2695,7 +2695,7 @@ const Ni = (n) => n.pagination.state$.pipe(
2695
2695
  spineItem: o
2696
2696
  };
2697
2697
  } catch (r) {
2698
- return N.warn(`Error resolving cfi: ${n}.`), N.warn(r), {
2698
+ return O.warn(`Error resolving cfi: ${n}.`), O.warn(r), {
2699
2699
  ...i,
2700
2700
  spineItem: o,
2701
2701
  itemIndex: t,
@@ -2732,8 +2732,8 @@ const Ni = (n) => n.pagination.state$.pipe(
2732
2732
  }, Ki = (n, e) => {
2733
2733
  let t = n?.itemPageIndex;
2734
2734
  const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
2735
- return s ? Et().pipe(
2736
- E(s.isReady$),
2735
+ return s ? At().pipe(
2736
+ A(s.isReady$),
2737
2737
  S(([, a]) => {
2738
2738
  const {
2739
2739
  node: r = null,
@@ -2887,7 +2887,7 @@ const eo = (n) => (e) => {
2887
2887
  r(d);
2888
2888
  };
2889
2889
  })
2890
- }), De = async (n) => new Promise((e, t) => {
2890
+ }), Ee = async (n) => new Promise((e, t) => {
2891
2891
  const i = window.indexedDB.open(n);
2892
2892
  i.onerror = (o) => {
2893
2893
  t(o);
@@ -2907,7 +2907,7 @@ const eo = (n) => (e) => {
2907
2907
  }, o = async (c, u) => {
2908
2908
  const l = i(c);
2909
2909
  if (!l) return new Response("Item not found", { status: 404 });
2910
- const p = await (await De("prose-reader")).get(`${e}_${l.id}`);
2910
+ const p = await (await Ee("prose-reader")).get(`${e}_${l.id}`);
2911
2911
  if (p)
2912
2912
  return new Response(p, { status: 200 });
2913
2913
  const h = u && await u(l) || await fetch(l.href);
@@ -2919,10 +2919,10 @@ const eo = (n) => (e) => {
2919
2919
  fn(({ id: c, data: u }) => {
2920
2920
  const l = i(c);
2921
2921
  return l ? j(
2922
- sn([De("prose-reader"), j(u.blob())])
2922
+ sn([Ee("prose-reader"), j(u.blob())])
2923
2923
  ).pipe(
2924
2924
  B(([d, p]) => j(d.put(`${e}_${l.id}`, p))),
2925
- ot((d) => (N.error(d), J))
2925
+ ot((d) => (O.error(d), J))
2926
2926
  ) : J;
2927
2927
  }),
2928
2928
  q(n.destroy$)
@@ -2933,7 +2933,7 @@ const eo = (n) => (e) => {
2933
2933
  })
2934
2934
  );
2935
2935
  return P(a).pipe(
2936
- B(() => (N.debug("Cleanup up old cache..."), j(De("prose-reader")).pipe(
2936
+ B(() => (O.debug("Cleanup up old cache..."), j(Ee("prose-reader")).pipe(
2937
2937
  B(
2938
2938
  (c) => j(c.keys()).pipe(
2939
2939
  Y(
@@ -2945,7 +2945,7 @@ const eo = (n) => (e) => {
2945
2945
  })
2946
2946
  )
2947
2947
  ),
2948
- ot((c) => (N.error(c), J))
2948
+ ot((c) => (O.error(c), J))
2949
2949
  ))),
2950
2950
  q(n.destroy$)
2951
2951
  ).subscribe(), {
@@ -2980,7 +2980,7 @@ const eo = (n) => (e) => {
2980
2980
  t.setStart(n.node, o), t.setEnd(n.node, s);
2981
2981
  }
2982
2982
  } catch (o) {
2983
- N.warn("Failed to create range from selection", o, {
2983
+ O.warn("Failed to create range from selection", o, {
2984
2984
  anchor: n,
2985
2985
  focus: e
2986
2986
  });
@@ -2999,7 +2999,7 @@ const eo = (n) => (e) => {
2999
2999
  { node: o, offset: s }
3000
3000
  );
3001
3001
  } catch (a) {
3002
- N.warn("Failed to create range from selection", a, {
3002
+ O.warn("Failed to create range from selection", a, {
3003
3003
  selection: n,
3004
3004
  spineItem: e
3005
3005
  });
@@ -3121,19 +3121,19 @@ const ao = (n) => n.loaded$.pipe(
3121
3121
  S((l) => !!l),
3122
3122
  W(),
3123
3123
  L((l) => l),
3124
- A()
3124
+ E()
3125
3125
  ), r = a.pipe(
3126
3126
  v(() => s),
3127
3127
  W(),
3128
3128
  L((l) => !l),
3129
- A()
3129
+ E()
3130
3130
  ), c = o.pipe(
3131
3131
  L((l) => l?.type === "over"),
3132
- A()
3132
+ E()
3133
3133
  ), u = t.context.watch("rootElement").pipe(
3134
3134
  L(qe),
3135
3135
  v((l) => X(l, "pointerdown")),
3136
- E(s),
3136
+ A(s),
3137
3137
  S(([, l]) => l),
3138
3138
  te(void 0),
3139
3139
  K({ refCount: !0, bufferSize: 1 })
@@ -3374,12 +3374,12 @@ class de extends ie {
3374
3374
  */
3375
3375
  mergeCompare(e) {
3376
3376
  const t = { ...this.value, ...e };
3377
- O(this.value, t) || this.stateSubject.next(t);
3377
+ N(this.value, t) || this.stateSubject.next(t);
3378
3378
  }
3379
3379
  watch(e) {
3380
3380
  return Array.isArray(e) ? this.stateSubject.pipe(Je(e)) : this.stateSubject.pipe(
3381
3381
  S((t) => t[e]),
3382
- W(O)
3382
+ W(N)
3383
3383
  );
3384
3384
  }
3385
3385
  get value() {
@@ -3422,7 +3422,7 @@ class So extends de {
3422
3422
  x: 0,
3423
3423
  y: 0
3424
3424
  }
3425
- }), this.bridgeEvent = new fo(), this.destroy$ = new V(), this.state$ = this.pipe(G(O)), this.manifest$ = this.pipe(
3425
+ }), this.bridgeEvent = new fo(), this.destroy$ = new V(), this.state$ = this.pipe(G(N)), this.manifest$ = this.pipe(
3426
3426
  Y((e) => e.manifest),
3427
3427
  Q(ae),
3428
3428
  G()
@@ -3456,7 +3456,7 @@ class So extends de {
3456
3456
  forceSinglePageMode: o
3457
3457
  })
3458
3458
  };
3459
- O(c, t) || this.next(c);
3459
+ N(c, t) || this.next(c);
3460
3460
  }
3461
3461
  /**
3462
3462
  * @deprecated
@@ -3489,7 +3489,7 @@ class Io extends de {
3489
3489
  supportedPageTurnDirection: ["horizontal", "vertical"],
3490
3490
  supportedComputedPageTurnDirection: ["horizontal", "vertical"]
3491
3491
  }), P(e.state$, t.values$).pipe(
3492
- E(e.state$),
3492
+ A(e.state$),
3493
3493
  S(([, { hasVerticalWriting: i }]) => {
3494
3494
  const o = e.manifest;
3495
3495
  return {
@@ -3499,7 +3499,7 @@ class Io extends de {
3499
3499
  computedPageTurnMode: t.values.computedPageTurnMode
3500
3500
  };
3501
3501
  }),
3502
- W(O),
3502
+ W(N),
3503
3503
  S(
3504
3504
  ({
3505
3505
  hasVerticalWriting: i,
@@ -3588,7 +3588,7 @@ const vo = () => (n) => n.pipe(
3588
3588
  ...i
3589
3589
  }))
3590
3590
  ), wo = (n, e, t) => n.bridgeEvent.pagination$.pipe(
3591
- E(e),
3591
+ A(e),
3592
3592
  L(
3593
3593
  ([i, o]) => i.navigationId === o.id
3594
3594
  ),
@@ -3783,7 +3783,7 @@ const vo = () => (n) => n.pipe(
3783
3783
  )
3784
3784
  );
3785
3785
  })
3786
- ), Oe = ({
3786
+ ), De = ({
3787
3787
  settings: n,
3788
3788
  spineItemsManager: e,
3789
3789
  spineLocator: t,
@@ -4031,7 +4031,7 @@ const Mo = ({
4031
4031
  }
4032
4032
  }))
4033
4033
  ))
4034
- ), Eo = "navigation/InternalNavigator", Ao = N.namespace(Eo);
4034
+ ), Ao = "navigation/InternalNavigator", Eo = O.namespace(Ao);
4035
4035
  class Do extends _ {
4036
4036
  constructor(e, t, i, o, s, a, r, c) {
4037
4037
  super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.viewportController = o, this.scrollNavigationController = s, this.navigationResolver = a, this.spine = r, this.isUserLocked$ = c, this.navigationSubject = new k({
@@ -4049,12 +4049,12 @@ class Do extends _ {
4049
4049
  id: I
4050
4050
  })),
4051
4051
  W(
4052
- ({ position: m, ...I }, { position: w, ...x }) => O(I, x) && O(m, w)
4052
+ ({ position: m, ...I }, { position: w, ...x }) => N(I, x) && N(m, w)
4053
4053
  ),
4054
4054
  K(1)
4055
4055
  ), this.locker = new Bt();
4056
4056
  const u = i.pipe(
4057
- E(this.navigationSubject),
4057
+ A(this.navigationSubject),
4058
4058
  Po,
4059
4059
  /**
4060
4060
  * Url lookup is heavier so we start with it to fill
@@ -4077,7 +4077,7 @@ class Do extends _ {
4077
4077
  spineItemsManager: r.spineItemsManager,
4078
4078
  spineLocator: r.locator
4079
4079
  }),
4080
- Oe({
4080
+ De({
4081
4081
  navigationResolver: a,
4082
4082
  settings: e,
4083
4083
  spineItemsManager: r.spineItemsManager,
@@ -4091,7 +4091,7 @@ class Do extends _ {
4091
4091
  navigationResolver: a,
4092
4092
  spineItemsManager: r.spineItemsManager
4093
4093
  }),
4094
- E(c),
4094
+ A(c),
4095
4095
  v(([m, I]) => {
4096
4096
  const w = m.navigation.cfi || m.navigation.url || e.values.computedPageTurnMode === "scrollable" || I;
4097
4097
  return b(m).pipe(
@@ -4103,16 +4103,16 @@ class Do extends _ {
4103
4103
  })
4104
4104
  );
4105
4105
  }),
4106
- Oe({
4106
+ De({
4107
4107
  spineItemsManager: r.spineItemsManager,
4108
4108
  spineLocator: r.locator,
4109
4109
  settings: e,
4110
4110
  navigationResolver: a
4111
4111
  }),
4112
4112
  S((m) => m.navigation),
4113
- A()
4113
+ E()
4114
4114
  ), l = u.pipe(
4115
- E(c),
4115
+ A(c),
4116
4116
  L(([, m]) => m),
4117
4117
  v(([m]) => {
4118
4118
  const I = this.locker.lock();
@@ -4131,7 +4131,7 @@ class Do extends _ {
4131
4131
  T(u)
4132
4132
  );
4133
4133
  }),
4134
- A()
4134
+ E()
4135
4135
  ), d = P(
4136
4136
  o.layout$,
4137
4137
  r.layout$
@@ -4195,14 +4195,14 @@ class Do extends _ {
4195
4195
  ft({
4196
4196
  spine: r
4197
4197
  }),
4198
- Oe({
4198
+ De({
4199
4199
  spineItemsManager: r.spineItemsManager,
4200
4200
  spineLocator: r.locator,
4201
4201
  settings: e,
4202
4202
  navigationResolver: a
4203
4203
  }),
4204
4204
  S(({ navigation: m }) => m),
4205
- A()
4205
+ E()
4206
4206
  ), h = wo(
4207
4207
  t,
4208
4208
  this.navigationSubject,
@@ -4213,7 +4213,7 @@ class Do extends _ {
4213
4213
  h
4214
4214
  ), y = (m) => m.pipe(
4215
4215
  $(([I, w]) => {
4216
- Ao.info(
4216
+ Eo.info(
4217
4217
  `navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
4218
4218
  {
4219
4219
  previousNavigation: w,
@@ -4223,7 +4223,7 @@ class Do extends _ {
4223
4223
  })
4224
4224
  ), f = (m) => m.pipe(
4225
4225
  $(([I, w]) => {
4226
- const x = I.type === "scroll", C = I.meta.triggeredBy === "pagination", M = I.meta.triggeredBy === "restoration", H = O(
4226
+ const x = I.type === "scroll", C = I.meta.triggeredBy === "pagination", M = I.meta.triggeredBy === "restoration", H = N(
4227
4227
  w.position,
4228
4228
  I.position
4229
4229
  );
@@ -4237,7 +4237,7 @@ class Do extends _ {
4237
4237
  })
4238
4238
  );
4239
4239
  g.pipe(
4240
- E(this.navigationSubject),
4240
+ A(this.navigationSubject),
4241
4241
  /**
4242
4242
  * @important
4243
4243
  *
@@ -4254,8 +4254,8 @@ class Do extends _ {
4254
4254
  return this.navigationSubject.getValue();
4255
4255
  }
4256
4256
  }
4257
- const Oo = 500;
4258
- class No extends _ {
4257
+ const No = 500;
4258
+ class Oo extends _ {
4259
4259
  constructor(e, t, i, o, s, a) {
4260
4260
  super(), this.settings = e, this.context = t, this.spine = i, this.scrollNavigationController = o, this.locker = s, this.navigationSubject = new V(), this.navigation$ = this.navigationSubject.asObservable();
4261
4261
  const r = this.scrollNavigationController.userScroll$.pipe(
@@ -4266,7 +4266,7 @@ class No extends _ {
4266
4266
  b(c)
4267
4267
  ).pipe(
4268
4268
  Ie(
4269
- Oo,
4269
+ No,
4270
4270
  re
4271
4271
  ),
4272
4272
  U(),
@@ -4299,7 +4299,7 @@ const Vo = (n) => ({
4299
4299
  }) : new F({
4300
4300
  x: -n.x,
4301
4301
  y: -n.y
4302
- }), ko = "navigation/ViewportNavigator", St = N.namespace(ko);
4302
+ }), ko = "navigation/ViewportNavigator", St = O.namespace(ko);
4303
4303
  class Uo extends _ {
4304
4304
  constructor(e, t, i, o, s) {
4305
4305
  super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new V(), this.element$ = new k(
@@ -4307,7 +4307,7 @@ class Uo extends _ {
4307
4307
  );
4308
4308
  const a = this.spine.element$.pipe(
4309
4309
  L(qe),
4310
- E(this.element$),
4310
+ A(this.element$),
4311
4311
  $(([l, d]) => {
4312
4312
  d.style.cssText = `
4313
4313
  height: 100%;
@@ -4331,7 +4331,7 @@ class Uo extends _ {
4331
4331
  $(() => {
4332
4332
  St.info("layout", e.values);
4333
4333
  }),
4334
- A()
4334
+ E()
4335
4335
  );
4336
4336
  const u = this.navigateSubject.pipe(
4337
4337
  $((l) => {
@@ -4350,7 +4350,7 @@ class Uo extends _ {
4350
4350
  return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), P(
4351
4351
  b(!0),
4352
4352
  b(null).pipe(
4353
- Te(() => {
4353
+ $e(() => {
4354
4354
  if (l?.type !== "manualAdjust") return b(!1);
4355
4355
  const p = l.animation === "snap" ? e.values.snapAnimationDuration : e.values.computedPageTurnAnimationDuration, h = l.animation === "snap" ? "slide" : e.values.computedPageTurnAnimation;
4356
4356
  return b(l).pipe(
@@ -4512,7 +4512,7 @@ class Wo extends de {
4512
4512
  (d) => t.watch(["computedPageTurnMode"]).pipe(
4513
4513
  v(
4514
4514
  ({ computedPageTurnMode: p }) => p === "controlled" ? ge : X(d, "scroll").pipe(
4515
- E(l),
4515
+ A(l),
4516
4516
  L(
4517
4517
  ([, h]) => !h
4518
4518
  ),
@@ -4521,7 +4521,7 @@ class Wo extends de {
4521
4521
  )
4522
4522
  )
4523
4523
  ),
4524
- A()
4524
+ E()
4525
4525
  ), P(a, r, c).pipe(T(this.destroy$)).subscribe();
4526
4526
  }
4527
4527
  update(e) {
@@ -4540,10 +4540,10 @@ class Wo extends de {
4540
4540
  });
4541
4541
  }
4542
4542
  }
4543
- const Fe = (n, e, t) => {
4543
+ const Te = (n, e, t) => {
4544
4544
  const i = t - n, o = t * (e * n) / (t || 1);
4545
4545
  return Math.max(0, Math.min(i, o));
4546
- }, _e = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), $e = (n, e, t) => {
4546
+ }, _e = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), Ne = (n, e, t) => {
4547
4547
  const i = _e(t, e), o = [...Array(i)].map((s, a) => a * e);
4548
4548
  return n >= i * e ? o[o.length - 1] || 0 : o.find((s) => n < s + e) || 0;
4549
4549
  }, It = (n, e, t) => {
@@ -4599,7 +4599,7 @@ const Fe = (n, e, t) => {
4599
4599
  isUsingVerticalWriting: i
4600
4600
  }) => {
4601
4601
  if (i) {
4602
- const s = Fe(
4602
+ const s = Te(
4603
4603
  t.getPageSize().height,
4604
4604
  n,
4605
4605
  e.height
@@ -4609,7 +4609,7 @@ const Fe = (n, e, t) => {
4609
4609
  y: s
4610
4610
  });
4611
4611
  }
4612
- const o = Fe(
4612
+ const o = Te(
4613
4613
  t.getPageSize().width,
4614
4614
  n,
4615
4615
  e.width
@@ -4630,7 +4630,7 @@ const Fe = (n, e, t) => {
4630
4630
  a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? u = a.getBoundingClientRect().x : a && (u = (a ? Cn(a, r) : void 0)?.getBoundingClientRect().x || u);
4631
4631
  const l = c.layout.layoutInfo?.width || 0, d = n.getPageSize().width;
4632
4632
  if (u !== void 0) {
4633
- const p = $e(
4633
+ const p = Ne(
4634
4634
  u,
4635
4635
  d,
4636
4636
  l
@@ -4674,12 +4674,12 @@ const Fe = (n, e, t) => {
4674
4674
  getSpineItemClosestPositionFromUnsafePosition: (a, r) => {
4675
4675
  const { width: c, height: u } = r.layout.layoutInfo;
4676
4676
  return new R({
4677
- x: $e(
4677
+ x: Ne(
4678
4678
  a.x,
4679
4679
  n.getPageSize().width,
4680
4680
  c
4681
4681
  ),
4682
- y: $e(
4682
+ y: Ne(
4683
4683
  a.y,
4684
4684
  n.getPageSize().height,
4685
4685
  u
@@ -4689,7 +4689,7 @@ const Fe = (n, e, t) => {
4689
4689
  getSpineItemPagePositionFromSpineItemPosition: (a, r, c) => {
4690
4690
  const { width: u, height: l } = c.layout.layoutInfo, d = n.getPageSize().width, p = n.getPageSize().height;
4691
4691
  if (!!c.isUsingVerticalWriting()) {
4692
- const y = Fe(
4692
+ const y = Te(
4693
4693
  p,
4694
4694
  r,
4695
4695
  l
@@ -4699,7 +4699,7 @@ const Fe = (n, e, t) => {
4699
4699
  y: a.y - y
4700
4700
  });
4701
4701
  }
4702
- const g = Fe(d, r, u);
4702
+ const g = Te(d, r, u);
4703
4703
  if (n.isRTL()) {
4704
4704
  const y = u - (r + 1) * d;
4705
4705
  return new Ae({
@@ -4821,90 +4821,95 @@ const Fe = (n, e, t) => {
4821
4821
  pageSizeWidth: i.getPageSize().width,
4822
4822
  visibleAreaRectWidth: i.state.visibleAreaRect.width
4823
4823
  });
4824
- }, Xo = ({
4824
+ }, Xo = (n, e) => {
4825
+ if (e && e instanceof HTMLIFrameElement)
4826
+ return n.startsWith("#") ? e.contentDocument?.getElementById(
4827
+ n.replace("#", "")
4828
+ ) : e.contentDocument?.querySelector(n);
4829
+ }, Yo = ({
4825
4830
  anchor: n,
4826
4831
  spineItem: e,
4827
- context: t
4832
+ spine: t
4828
4833
  }) => {
4829
- const i = e.layout.layoutInfo?.width || 0, o = t.getPageSize().width, a = e.getBoundingRectOfElementFromSelector(n)?.x || 0;
4830
- return $e(
4831
- a,
4832
- o,
4833
- i
4834
+ const i = Xo(
4835
+ n,
4836
+ e.renderer.getDocumentFrame()
4834
4837
  );
4835
- }, Yo = ({
4838
+ return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
4839
+ }, qo = ({
4836
4840
  anchor: n,
4837
- context: e,
4838
- spineItem: t,
4839
- spineLocator: i
4841
+ spineItem: e,
4842
+ spineLocator: t,
4843
+ spine: i
4840
4844
  }) => {
4841
- const o = Xo({
4845
+ const o = Yo({
4842
4846
  anchor: n,
4843
- spineItem: t,
4844
- context: e
4847
+ spineItem: e,
4848
+ spine: i
4845
4849
  });
4846
- return i.getSpinePositionFromSpineItemPosition({
4850
+ return t.getSpinePositionFromSpineItemPosition({
4847
4851
  spineItemPosition: new R({ x: o, y: 0 }),
4848
- spineItem: t
4852
+ spineItem: e
4849
4853
  });
4850
- }, qo = ({
4854
+ }, Zo = ({
4851
4855
  anchor: n,
4852
4856
  spineItem: e,
4853
4857
  spineLocator: t,
4854
- context: i,
4858
+ spine: i,
4855
4859
  pageSizeWidth: o,
4856
4860
  visibleAreaRectWidth: s
4857
4861
  }) => {
4858
- const a = Yo({
4862
+ const a = qo({
4859
4863
  anchor: n,
4860
- context: i,
4861
4864
  spineItem: e,
4862
- spineLocator: t
4865
+ spineLocator: t,
4866
+ spine: i
4863
4867
  });
4864
4868
  return ee({
4865
4869
  position: a,
4866
4870
  pageSizeWidth: o,
4867
4871
  visibleAreaRectWidth: s
4868
4872
  });
4869
- }, Zo = ({
4870
- context: n,
4873
+ }, Go = ({
4874
+ spine: n,
4871
4875
  spineItemsManager: e,
4872
4876
  spineLocator: t,
4873
4877
  url: i,
4874
- pageSizeWidth: o,
4875
- visibleAreaRectWidth: s
4878
+ context: o,
4879
+ pageSizeWidth: s,
4880
+ visibleAreaRectWidth: a
4876
4881
  }) => {
4877
4882
  try {
4878
- const a = i instanceof URL ? i : new URL(i), r = `${a.origin}${a.pathname}`, c = n.manifest?.spineItems.find(
4879
- (u) => u.href === r
4883
+ const r = i instanceof URL ? i : new URL(i), c = `${r.origin}${r.pathname}`, u = o.manifest?.spineItems.find(
4884
+ (l) => l.href === c
4880
4885
  );
4881
- if (c) {
4882
- const u = e.get(c.id);
4883
- if (u) {
4884
- const l = qo({
4885
- anchor: a.hash,
4886
- spineItem: u,
4887
- context: n,
4886
+ if (u) {
4887
+ const l = e.get(u.id);
4888
+ if (l) {
4889
+ const d = Zo({
4890
+ anchor: r.hash,
4891
+ spineItem: l,
4892
+ spine: n,
4888
4893
  spineLocator: t,
4889
- pageSizeWidth: o,
4890
- visibleAreaRectWidth: s
4894
+ pageSizeWidth: s,
4895
+ visibleAreaRectWidth: a
4891
4896
  });
4892
4897
  return {
4893
4898
  position: ee({
4894
- position: l,
4895
- pageSizeWidth: o,
4896
- visibleAreaRectWidth: s
4899
+ position: d,
4900
+ pageSizeWidth: s,
4901
+ visibleAreaRectWidth: a
4897
4902
  }),
4898
- spineItemId: c.id
4903
+ spineItemId: u.id
4899
4904
  };
4900
4905
  }
4901
4906
  }
4902
4907
  return;
4903
- } catch (a) {
4904
- console.error(a);
4908
+ } catch (r) {
4909
+ console.error(r);
4905
4910
  return;
4906
4911
  }
4907
- }, Go = ({
4912
+ }, Jo = ({
4908
4913
  spineItem: n,
4909
4914
  spineItemPosition: e,
4910
4915
  spineLocator: t,
@@ -4923,7 +4928,7 @@ const Fe = (n, e, t) => {
4923
4928
  pageSizeWidth: o.getPageSize().width,
4924
4929
  visibleAreaRectWidth: o.state.visibleAreaRect.width
4925
4930
  });
4926
- }, Jo = "spineNavigator", Ko = ({
4931
+ }, Ko = "spineNavigator", Qo = ({
4927
4932
  context: n,
4928
4933
  spineItemsManager: e,
4929
4934
  locator: t,
@@ -4932,13 +4937,14 @@ const Fe = (n, e, t) => {
4932
4937
  }) => {
4933
4938
  const s = Bo({ context: n, settings: i });
4934
4939
  return {
4935
- getNavigationForUrl: (p) => Zo({
4940
+ getNavigationForUrl: (p) => Go({
4936
4941
  context: n,
4937
4942
  spineItemsManager: e,
4938
4943
  spineLocator: t,
4939
4944
  url: p,
4940
4945
  pageSizeWidth: n.getPageSize().width,
4941
- visibleAreaRectWidth: n.state.visibleAreaRect.width
4946
+ visibleAreaRectWidth: n.state.visibleAreaRect.width,
4947
+ spine: o
4942
4948
  }),
4943
4949
  getNavigationForSpineItemPage: (p) => _o({
4944
4950
  ...p,
@@ -4947,7 +4953,7 @@ const Fe = (n, e, t) => {
4947
4953
  spineItemNavigationResolver: s,
4948
4954
  spineLocator: t
4949
4955
  }),
4950
- getNavigationFromSpineItemPosition: (p) => Go({
4956
+ getNavigationFromSpineItemPosition: (p) => Jo({
4951
4957
  ...p,
4952
4958
  spineItemLocator: t.spineItemLocator,
4953
4959
  spineLocator: t,
@@ -4959,7 +4965,7 @@ const Fe = (n, e, t) => {
4959
4965
  spineItemsManager: e
4960
4966
  });
4961
4967
  if (!h) {
4962
- N.warn(Jo, `unable to detect item id from cfi ${p}`);
4968
+ O.warn(Ko, `unable to detect item id from cfi ${p}`);
4963
4969
  return;
4964
4970
  }
4965
4971
  const f = g ? s.getNavigationFromNode(h, g, y) : new R({ x: 0, y: 0 }), m = t.getSpinePositionFromSpineItemPosition({
@@ -5037,7 +5043,7 @@ const Fe = (n, e, t) => {
5037
5043
  }),
5038
5044
  spineItemNavigator: s
5039
5045
  };
5040
- }, Qo = ({
5046
+ }, es = ({
5041
5047
  spineItemsManager: n,
5042
5048
  context: e,
5043
5049
  hookManager: t,
@@ -5045,7 +5051,7 @@ const Fe = (n, e, t) => {
5045
5051
  settings: o,
5046
5052
  viewport: s
5047
5053
  }) => {
5048
- const a = new V(), r = new Bt(), c = Ko({
5054
+ const a = new V(), r = new Bt(), c = Qo({
5049
5055
  context: e,
5050
5056
  settings: o,
5051
5057
  spineItemsManager: n,
@@ -5063,7 +5069,7 @@ const Fe = (n, e, t) => {
5063
5069
  t,
5064
5070
  i,
5065
5071
  e
5066
- ), d = new No(
5072
+ ), d = new Oo(
5067
5073
  o,
5068
5074
  e,
5069
5075
  i,
@@ -5090,7 +5096,7 @@ const Fe = (n, e, t) => {
5090
5096
  ]).pipe(
5091
5097
  Y((m) => m.some((I) => I) ? "busy" : "free"),
5092
5098
  G(),
5093
- Ce(1)
5099
+ Me(1)
5094
5100
  );
5095
5101
  return {
5096
5102
  destroy: () => {
@@ -5112,7 +5118,7 @@ const Fe = (n, e, t) => {
5112
5118
  navigation$: h.navigation$
5113
5119
  };
5114
5120
  };
5115
- class es extends de {
5121
+ class ts extends de {
5116
5122
  constructor(e, t) {
5117
5123
  super({
5118
5124
  beginPageIndexInSpineItem: void 0,
@@ -5130,7 +5136,7 @@ class es extends de {
5130
5136
  this.mergeCompare(e);
5131
5137
  }
5132
5138
  }
5133
- class ts extends _ {
5139
+ class ns extends _ {
5134
5140
  constructor(e, t, i, o, s) {
5135
5141
  super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
5136
5142
  const a = P(
@@ -5148,7 +5154,7 @@ class ts extends _ {
5148
5154
  });
5149
5155
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5150
5156
  wt(1),
5151
- E(this.context.bridgeEvent.navigation$),
5157
+ A(this.context.bridgeEvent.navigation$),
5152
5158
  $(([, u]) => {
5153
5159
  const { position: l } = u, d = this.pagination.value, {
5154
5160
  beginIndex: p,
@@ -5180,7 +5186,7 @@ class ts extends _ {
5180
5186
  );
5181
5187
  })
5182
5188
  ), r = a.pipe(
5183
- Re(this.context.bridgeEvent.viewportFree$),
5189
+ Ce(this.context.bridgeEvent.viewportFree$),
5184
5190
  $(() => {
5185
5191
  const {
5186
5192
  beginSpineItemIndex: c,
@@ -5208,7 +5214,7 @@ class ts extends _ {
5208
5214
  P(a, r).pipe(T(this.destroy$)).subscribe();
5209
5215
  }
5210
5216
  }
5211
- class ns extends _ {
5217
+ class is extends _ {
5212
5218
  constructor(e) {
5213
5219
  super();
5214
5220
  const t = {
@@ -5218,7 +5224,7 @@ class ns extends _ {
5218
5224
  this.inputSettings = t, this.outputSettingsUpdateSubject = new V(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(K(1)), this._settings$.subscribe();
5219
5225
  }
5220
5226
  _prepareUpdate(e) {
5221
- const t = xe(this.inputSettings, e), i = this.getOutputSettings(t), o = !O(this.outputSettings, i);
5227
+ const t = xe(this.inputSettings, e), i = this.getOutputSettings(t), o = !N(this.outputSettings, i);
5222
5228
  return {
5223
5229
  hasChanged: o,
5224
5230
  state: i,
@@ -5246,14 +5252,14 @@ class ns extends _ {
5246
5252
  watch(e) {
5247
5253
  return this.values$.pipe(
5248
5254
  Rt(e),
5249
- W(O)
5255
+ W(N)
5250
5256
  );
5251
5257
  }
5252
5258
  destroy() {
5253
5259
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5254
5260
  }
5255
5261
  }
5256
- class is extends ns {
5262
+ class os extends is {
5257
5263
  constructor(e, t) {
5258
5264
  super(e), this.context = t;
5259
5265
  const i = z([
@@ -5277,7 +5283,7 @@ class is extends ns {
5277
5283
  computedPageTurnMode: e.pageTurnMode,
5278
5284
  computedPageTurnAnimationDuration: 0
5279
5285
  };
5280
- return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (N.warn(
5286
+ return t?.renditionFlow === "scrolled-continuous" && (o.computedPageTurnMode = "scrollable"), o.computedPageTurnMode === "scrollable" && (o.computedPageTurnDirection = "vertical"), i && o.computedPageTurnAnimation === "slide" && (O.warn(
5281
5287
  `pageTurnAnimation ${o.computedPageTurnAnimation} incompatible with current book, switching back to default`
5282
5288
  ), o.computedPageTurnAnimation = "none"), o.computedPageTurnMode === "scrollable" ? (o.computedPageTurnAnimationDuration = 0, o.computedPageTurnAnimation = "none") : o.computedPageTurnAnimationDuration = e.pageTurnAnimationDuration !== void 0 ? e.pageTurnAnimationDuration : 300, o;
5283
5289
  }
@@ -5298,7 +5304,7 @@ class is extends ns {
5298
5304
  };
5299
5305
  }
5300
5306
  }
5301
- class os extends ye {
5307
+ class ss extends ye {
5302
5308
  onUnload() {
5303
5309
  return J;
5304
5310
  }
@@ -5317,14 +5323,14 @@ class os extends ye {
5317
5323
  getDocumentFrame() {
5318
5324
  }
5319
5325
  }
5320
- class ss extends _ {
5326
+ class rs extends _ {
5321
5327
  constructor(e, t, i, o, s, a) {
5322
5328
  super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = a, this.layoutTriggerSubject = new V(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5323
5329
  blankPagePosition: r,
5324
5330
  minimumWidth: c
5325
5331
  }) => (u) => u.pipe(
5326
5332
  S((l) => {
5327
- const d = O(
5333
+ const d = N(
5328
5334
  this.lastLayout?.pageSize,
5329
5335
  this.context.getPageSize()
5330
5336
  ) ? this.lastLayout : void 0, { width: p, height: h } = d ?? {}, { width: g = p, height: y = h } = l ?? {}, { width: f, height: m } = this.context.getPageSize(), I = this.validateDimension(
@@ -5382,11 +5388,11 @@ class ss extends _ {
5382
5388
  )
5383
5389
  );
5384
5390
  }),
5385
- A()
5391
+ E()
5386
5392
  ), this.layout$ = this.layoutProcess$.pipe(
5387
5393
  L((r) => r.type === "end"),
5388
5394
  S((r) => r.data),
5389
- A()
5395
+ E()
5390
5396
  );
5391
5397
  }
5392
5398
  validateDimension(e, t, i) {
@@ -5408,11 +5414,7 @@ class Yt extends de {
5408
5414
  isLoaded: !1,
5409
5415
  isReady: !1,
5410
5416
  iDirty: !1
5411
- }), this.item = e, this.parentElement = t, this.context = i, this.settings = o, this.hookManager = s, this.index = a, this.getBoundingRectOfElementFromSelector = (d) => {
5412
- const p = this.renderer.getDocumentFrame();
5413
- if (p && p instanceof HTMLIFrameElement && d)
5414
- return d.startsWith("#") ? p.contentDocument?.getElementById(d.replace("#", ""))?.getBoundingClientRect() : p.contentDocument?.querySelector(d)?.getBoundingClientRect();
5415
- }, this.load = () => {
5417
+ }), this.item = e, this.parentElement = t, this.context = i, this.settings = o, this.hookManager = s, this.index = a, this.load = () => {
5416
5418
  this.renderer.load();
5417
5419
  }, this.unload = () => {
5418
5420
  this.renderer.unload();
@@ -5422,7 +5424,7 @@ class Yt extends de {
5422
5424
  });
5423
5425
  }, this.destroy = () => {
5424
5426
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5425
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = rs(
5427
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = as(
5426
5428
  t,
5427
5429
  e,
5428
5430
  s
@@ -5437,7 +5439,7 @@ class Yt extends de {
5437
5439
  containerElement: this.containerElement,
5438
5440
  resourcesHandler: this.resourcesHandler
5439
5441
  };
5440
- this.renderer = r ? r(c) : new os(c), this.layout = new ss(
5442
+ this.renderer = r ? r(c) : new ss(c), this.layout = new rs(
5441
5443
  e,
5442
5444
  this.containerElement,
5443
5445
  i,
@@ -5522,14 +5524,14 @@ class Yt extends de {
5522
5524
  });
5523
5525
  }
5524
5526
  }
5525
- const rs = (n, e, t) => {
5527
+ const as = (n, e, t) => {
5526
5528
  const i = n.ownerDocument.createElement("div");
5527
5529
  return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
5528
5530
  position: absolute;
5529
5531
  overflow: hidden;
5530
5532
  `, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
5531
5533
  };
5532
- class as extends _ {
5534
+ class cs extends _ {
5533
5535
  constructor(e, t, i, o, s) {
5534
5536
  super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new k([]);
5535
5537
  const a = this.forcedOpenSubject.pipe(
@@ -5547,8 +5549,8 @@ class as extends _ {
5547
5549
  // Ideally loading faster is better but loading too close to user navigating can
5548
5550
  // be dangerous.
5549
5551
  Ie(100, re),
5550
- Re(this.context.bridgeEvent.viewportFree$),
5551
- E(this.context.bridgeEvent.navigation$, a),
5552
+ Ce(this.context.bridgeEvent.viewportFree$),
5553
+ A(this.context.bridgeEvent.navigation$, a),
5552
5554
  S(([, u, l]) => {
5553
5555
  const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex: p = 0, endIndex: h = 0 } = i.getVisibleSpineItemsFromPosition({
5554
5556
  position: u.position,
@@ -5605,17 +5607,17 @@ class Se extends DOMRect {
5605
5607
  return new Se(i.x, i.y, i.width, i.height);
5606
5608
  }
5607
5609
  }
5608
- class cs {
5610
+ class us {
5609
5611
  constructor({ width: e, height: t }) {
5610
5612
  this.__symbol = Symbol("AbsoluteViewport"), this.width = e, this.height = t;
5611
5613
  }
5612
5614
  }
5613
- class us {
5615
+ class ls {
5614
5616
  constructor({ width: e, height: t }) {
5615
5617
  this.__symbol = Symbol("RelativeViewport"), this.width = e, this.height = t;
5616
5618
  }
5617
5619
  }
5618
- const ls = ({
5620
+ const ds = ({
5619
5621
  pageIndex: n,
5620
5622
  spineItemOrId: e,
5621
5623
  spineItemsManager: t
@@ -5637,7 +5639,7 @@ const ls = ({
5637
5639
  { currentAbsolutePage: 0, found: !1 }
5638
5640
  );
5639
5641
  return s;
5640
- }, ds = ({
5642
+ }, ps = ({
5641
5643
  itemHeight: n,
5642
5644
  itemWidth: e,
5643
5645
  visibleWidthOfItem: t,
@@ -5646,7 +5648,7 @@ const ls = ({
5646
5648
  }) => {
5647
5649
  const s = t / e, a = i / n;
5648
5650
  return o.type === "percentage" ? s >= o.value && a >= o.value : t >= o.value && i >= o.value;
5649
- }, ps = ({
5651
+ }, gs = ({
5650
5652
  visibleWidthOfItem: n,
5651
5653
  visibleHeightOfItem: e,
5652
5654
  threshold: t,
@@ -5678,14 +5680,14 @@ const ls = ({
5678
5680
  Math.min(n, p) - Math.max(i, d)
5679
5681
  );
5680
5682
  if (h <= 0 || g <= 0) return { visible: !1 };
5681
- const f = ps({
5683
+ const f = gs({
5682
5684
  threshold: a,
5683
5685
  visibleHeightOfItem: g,
5684
5686
  visibleWidthOfItem: h,
5685
5687
  viewportPosition: r
5686
5688
  });
5687
5689
  return c ? { visible: f } : {
5688
- visible: ds({
5690
+ visible: ps({
5689
5691
  itemHeight: s,
5690
5692
  itemWidth: o,
5691
5693
  threshold: a,
@@ -5703,13 +5705,13 @@ const ls = ({
5703
5705
  return u && l;
5704
5706
  });
5705
5707
  return n.x === 0 && !i ? e.items[0] : i;
5706
- }, Ne = ({
5708
+ }, Oe = ({
5707
5709
  spineItemPosition: n,
5708
5710
  itemLayout: { left: e, top: t }
5709
5711
  }) => new F({
5710
5712
  x: e + n.x,
5711
5713
  y: t + n.y
5712
- }), gs = ({
5714
+ }), hs = ({
5713
5715
  position: n,
5714
5716
  threshold: e,
5715
5717
  restrictToScreen: t,
@@ -5747,7 +5749,7 @@ const ls = ({
5747
5749
  beginIndex: d ?? 0,
5748
5750
  endIndex: p ?? 0
5749
5751
  };
5750
- }, hs = ({
5752
+ }, ms = ({
5751
5753
  spineItemsManager: n,
5752
5754
  context: e,
5753
5755
  spineItemLocator: t,
@@ -5768,7 +5770,7 @@ const ls = ({
5768
5770
  x: Math.max(g.x - f, 0),
5769
5771
  y: Math.max(g.y - m, 0)
5770
5772
  });
5771
- }, r = (g) => Ne({
5773
+ }, r = (g) => Oe({
5772
5774
  spineItemPosition: new R({ x: 0, y: 0 }),
5773
5775
  itemLayout: o.getSpineItemSpineLayoutInfo(g)
5774
5776
  }), c = (g) => n.items.find((y) => y.renderer.getDocumentFrame() === g), u = (g, y, f) => {
@@ -5797,7 +5799,7 @@ const ls = ({
5797
5799
  const pe = t.getSpineItemPositionFromPageIndex({
5798
5800
  pageIndex: ce,
5799
5801
  spineItem: f
5800
- }), ue = Ne({
5802
+ }), ue = Oe({
5801
5803
  spineItemPosition: pe,
5802
5804
  itemLayout: o.getSpineItemSpineLayoutInfo(f)
5803
5805
  });
@@ -5843,7 +5845,7 @@ const ls = ({
5843
5845
  spineItemPosition: y
5844
5846
  }) => {
5845
5847
  const f = o.getSpineItemSpineLayoutInfo(g);
5846
- return Ne({
5848
+ return Oe({
5847
5849
  itemLayout: f,
5848
5850
  spineItemPosition: y
5849
5851
  });
@@ -5851,7 +5853,7 @@ const ls = ({
5851
5853
  /**
5852
5854
  * @deprecated use Pages
5853
5855
  */
5854
- _getAbsolutePageIndexFromPageIndex: (g) => ls({
5856
+ _getAbsolutePageIndexFromPageIndex: (g) => ds({
5855
5857
  ...g,
5856
5858
  spineItemsManager: n
5857
5859
  }),
@@ -5892,7 +5894,7 @@ const ls = ({
5892
5894
  }),
5893
5895
  getSpineItemFromIframe: c,
5894
5896
  getSpineItemPageIndexFromNode: u,
5895
- getVisibleSpineItemsFromPosition: (g) => gs({
5897
+ getVisibleSpineItemsFromPosition: (g) => hs({
5896
5898
  spineItemsManager: n,
5897
5899
  spineLayout: o,
5898
5900
  viewport: s,
@@ -5915,7 +5917,7 @@ const ls = ({
5915
5917
  });
5916
5918
  }
5917
5919
  };
5918
- }, ms = N.namespace("spine"), fs = ({
5920
+ }, fs = O.namespace("spine"), ys = ({
5919
5921
  position: n,
5920
5922
  pageSize: e
5921
5923
  }) => new pi({
@@ -5927,12 +5929,12 @@ const ls = ({
5927
5929
  bottom: n.y + e.height,
5928
5930
  right: n.x + e.width
5929
5931
  });
5930
- class ys extends de {
5932
+ class Ss extends de {
5931
5933
  constructor(e, t, i, o, s, a) {
5932
5934
  super({ pages: [] }), this.spineLayout = e, this.spineItemsManager = t, this.spineItemLocator = i, this.context = o, this.locator = s, this.viewport = a, this.fromSpineItemPageIndex = (r, c) => this.value.pages.find(
5933
5935
  (u) => u.itemIndex === r.index && u.pageIndex === c
5934
5936
  ), this.fromAbsolutePageIndex = (r) => this.value.pages.reduce((c, u) => c || (u.absolutePageIndex === r ? u : c), void 0), this.observeFromAbsolutePageIndex = (r) => this.pipe(S(() => this.fromAbsolutePageIndex(r))), this.layout$ = e.layout$.pipe(
5935
- E(a),
5937
+ A(a),
5936
5938
  v(([, { pageSize: r }]) => {
5937
5939
  const c = t.items.reduce(
5938
5940
  (l, d, p) => {
@@ -5945,7 +5947,7 @@ class ys extends de {
5945
5947
  spineItemPosition: m
5946
5948
  });
5947
5949
  return {
5948
- absoluteLayout: fs({
5950
+ absoluteLayout: ys({
5949
5951
  pageSize: r,
5950
5952
  position: I
5951
5953
  }),
@@ -5984,12 +5986,12 @@ class ys extends de {
5984
5986
  })
5985
5987
  );
5986
5988
  }),
5987
- S((r) => (ms.info("Pages layout", r), { pages: r })),
5988
- A()
5989
+ S((r) => (fs.info("Pages layout", r), { pages: r })),
5990
+ E()
5989
5991
  ), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
5990
5992
  }
5991
5993
  }
5992
- class Ss extends _ {
5994
+ class Is extends _ {
5993
5995
  constructor(e, t) {
5994
5996
  super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
5995
5997
  v((i) => {
@@ -5998,7 +6000,7 @@ class Ss extends _ {
5998
6000
  );
5999
6001
  return P(...o);
6000
6002
  }),
6001
- A()
6003
+ E()
6002
6004
  ), this.itemResize$ = this.spineItemsManager.items$.pipe(
6003
6005
  v((i) => {
6004
6006
  const o = i.map(
@@ -6008,7 +6010,7 @@ class Ss extends _ {
6008
6010
  );
6009
6011
  return P(...o);
6010
6012
  }),
6011
- A()
6013
+ E()
6012
6014
  ), this.itemLoaded$ = this.spineItemsManager.items$.pipe(
6013
6015
  v((i) => {
6014
6016
  const o = i.map(
@@ -6019,7 +6021,7 @@ class Ss extends _ {
6019
6021
  );
6020
6022
  }
6021
6023
  }
6022
- const Is = ({
6024
+ const bs = ({
6023
6025
  horizontalOffset: n,
6024
6026
  verticalOffset: e,
6025
6027
  context: t,
@@ -6089,7 +6091,7 @@ const Is = ({
6089
6091
  })
6090
6092
  );
6091
6093
  };
6092
- class bs extends _ {
6094
+ class vs extends _ {
6093
6095
  constructor(e, t, i, o) {
6094
6096
  super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new V(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
6095
6097
  $(() => {
@@ -6138,7 +6140,7 @@ class bs extends _ {
6138
6140
  rn(
6139
6141
  (u, l, d) => u.pipe(
6140
6142
  it(
6141
- ({ horizontalOffset: p, verticalOffset: h }) => Is({
6143
+ ({ horizontalOffset: p, verticalOffset: h }) => bs({
6142
6144
  context: this.context,
6143
6145
  horizontalOffset: p,
6144
6146
  index: d,
@@ -6170,7 +6172,7 @@ class bs extends _ {
6170
6172
  })
6171
6173
  );
6172
6174
  }),
6173
- A()
6175
+ E()
6174
6176
  ), P(this.layout$).pipe(T(this.destroy$)).subscribe();
6175
6177
  }
6176
6178
  layout() {
@@ -6196,32 +6198,32 @@ class bs extends _ {
6196
6198
  super.destroy(), this.layoutSubject.complete();
6197
6199
  }
6198
6200
  }
6199
- class vs extends _ {
6201
+ class ws extends _ {
6200
6202
  constructor(e, t, i, o, s, a, r, c) {
6201
6203
  super(), this.parentElement$ = e, this.context = t, this.pagination = i, this.spineItemsManager = o, this.spineItemLocator = s, this.settings = a, this.hookManager = r, this.viewport = c, this.elementSubject = new k(
6202
6204
  void 0
6203
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new bs(
6205
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new vs(
6204
6206
  o,
6205
6207
  t,
6206
6208
  a,
6207
6209
  c
6208
- ), this.locator = hs({
6210
+ ), this.locator = ms({
6209
6211
  context: t,
6210
6212
  spineItemsManager: o,
6211
6213
  spineItemLocator: s,
6212
6214
  settings: a,
6213
6215
  spineLayout: this.spineLayout,
6214
6216
  viewport: c
6215
- }), this.spineItemsLoader = new as(
6217
+ }), this.spineItemsLoader = new cs(
6216
6218
  this.context,
6217
6219
  o,
6218
6220
  this.locator,
6219
6221
  a,
6220
6222
  this.spineLayout
6221
- ), this.spineItemsObserver = new Ss(
6223
+ ), this.spineItemsObserver = new Is(
6222
6224
  o,
6223
6225
  this.locator
6224
- ), this.pages = new ys(
6226
+ ), this.pages = new Ss(
6225
6227
  this.spineLayout,
6226
6228
  this.spineItemsManager,
6227
6229
  this.spineItemLocator,
@@ -6276,7 +6278,7 @@ class vs extends _ {
6276
6278
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
6277
6279
  }
6278
6280
  }
6279
- class ws extends _ {
6281
+ class Ps extends _ {
6280
6282
  constructor(e, t) {
6281
6283
  super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new k([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6282
6284
  }
@@ -6317,7 +6319,7 @@ class ws extends _ {
6317
6319
  this.orderedSpineItemsSubject.value.forEach((e) => e.destroy());
6318
6320
  }
6319
6321
  }
6320
- class Ps extends de {
6322
+ class xs extends de {
6321
6323
  constructor(e) {
6322
6324
  const t = document.createElement("div");
6323
6325
  t.style.cssText = `
@@ -6351,7 +6353,7 @@ class Ps extends de {
6351
6353
  }
6352
6354
  get absoluteViewport() {
6353
6355
  const e = this.context.state.visibleAreaRect;
6354
- return new cs({
6356
+ return new us({
6355
6357
  width: e.width,
6356
6358
  height: e.height
6357
6359
  });
@@ -6376,17 +6378,17 @@ class Ps extends de {
6376
6378
  */
6377
6379
  get relativeViewport() {
6378
6380
  const e = this.absoluteViewport, t = this.scaleFactor;
6379
- return new us({
6381
+ return new ls({
6380
6382
  width: e.width / t,
6381
6383
  height: e.height / t
6382
6384
  });
6383
6385
  }
6384
6386
  }
6385
- const xs = (n) => {
6386
- const e = new V(), t = new V(), i = new bo(), o = new So(), s = new is(n, o), a = new Io(o, s), r = new ws(o, s), c = new Ps(o), u = o.watch("rootElement"), l = Xt({
6387
+ const $s = (n) => {
6388
+ const e = new V(), t = new V(), i = new bo(), o = new So(), s = new os(n, o), a = new Io(o, s), r = new Ps(o, s), c = new xs(o), u = o.watch("rootElement"), l = Xt({
6387
6389
  context: o,
6388
6390
  settings: s
6389
- }), d = new es(o, r), p = new vs(
6391
+ }), d = new ts(o, r), p = new ws(
6390
6392
  u,
6391
6393
  o,
6392
6394
  d,
@@ -6395,14 +6397,14 @@ const xs = (n) => {
6395
6397
  s,
6396
6398
  i,
6397
6399
  c
6398
- ), h = Qo({
6400
+ ), h = es({
6399
6401
  context: o,
6400
6402
  spineItemsManager: r,
6401
6403
  hookManager: i,
6402
6404
  spine: p,
6403
6405
  settings: s,
6404
6406
  viewport: c
6405
- }), g = new ts(
6407
+ }), g = new ns(
6406
6408
  o,
6407
6409
  d,
6408
6410
  r,
@@ -6417,11 +6419,11 @@ const xs = (n) => {
6417
6419
  }, f = (x) => {
6418
6420
  const { containerElement: C, manifest: M } = x;
6419
6421
  if (o.manifest) {
6420
- N.warn("loading a new book is not supported yet");
6422
+ O.warn("loading a new book is not supported yet");
6421
6423
  return;
6422
6424
  }
6423
- N.log("load", { options: x });
6424
- const H = $s(C);
6425
+ O.log("load", { options: x });
6426
+ const H = Ts(C);
6425
6427
  o.update({
6426
6428
  manifest: M,
6427
6429
  rootElement: H,
@@ -6496,11 +6498,11 @@ const xs = (n) => {
6496
6498
  destroy$: t
6497
6499
  }
6498
6500
  };
6499
- }, $s = (n) => (n.style.cssText = `
6501
+ }, Ts = (n) => (n.style.cssText = `
6500
6502
  ${n.style.cssText}
6501
6503
  background-color: white;
6502
6504
  position: relative;
6503
- `, n.classList.add(`${me}-reader`), n), Ns = (
6505
+ `, n.classList.add(`${me}-reader`), n), Vs = (
6504
6506
  //__
6505
6507
  co(
6506
6508
  Bn(
@@ -6520,7 +6522,7 @@ const xs = (n) => {
6520
6522
  wi(
6521
6523
  Un(
6522
6524
  // __
6523
- xs
6525
+ $s
6524
6526
  )
6525
6527
  )
6526
6528
  )
@@ -6538,7 +6540,7 @@ const xs = (n) => {
6538
6540
  )
6539
6541
  )
6540
6542
  )
6541
- ), Vs = (n) => (e) => n(e);
6543
+ ), js = (n) => (e) => n(e);
6542
6544
  export {
6543
6545
  Vt as AbstractSpinePosition,
6544
6546
  So as Context,
@@ -6550,27 +6552,27 @@ export {
6550
6552
  Do as InternalNavigator,
6551
6553
  et as LayoutEntry,
6552
6554
  Bt as Locker,
6553
- ys as Pages,
6554
- es as Pagination,
6555
- ts as PaginationController,
6555
+ Ss as Pages,
6556
+ ts as Pagination,
6557
+ ns as PaginationController,
6556
6558
  Qe as ResourceHandler,
6557
6559
  Qi as ResourcesLocator,
6558
6560
  Wo as ScrollNavigationController,
6559
- ns as SettingsManager,
6560
- vs as Spine,
6561
+ is as SettingsManager,
6562
+ ws as Spine,
6561
6563
  Yt as SpineItem,
6562
6564
  di as SpineItemPageLayout,
6563
6565
  pi as SpineItemPageSpineLayout,
6564
6566
  R as SpineItemPosition,
6565
6567
  ze as SpineItemSpineLayout,
6566
- ws as SpineItemsManager,
6567
- Ss as SpineItemsObserver,
6568
+ Ps as SpineItemsManager,
6569
+ Is as SpineItemsObserver,
6568
6570
  F as SpinePosition,
6569
6571
  Ae as UnsafeSpineItemPagePosition,
6570
6572
  be as UnsafeSpinePosition,
6571
- Ps as Viewport,
6573
+ xs as Viewport,
6572
6574
  Ki as consolidate,
6573
- Ns as createReader,
6575
+ Vs as createReader,
6574
6576
  rt as deferIdle,
6575
6577
  Wn as deferNextResult,
6576
6578
  He as generateCfiForSpineItemPage,
@@ -6580,12 +6582,12 @@ export {
6580
6582
  Ze as getFrameViewportInfo,
6581
6583
  Os as getItemAnchor,
6582
6584
  li as htmlEnhancer,
6583
- Et as idle,
6585
+ At as idle,
6584
6586
  bn as injectCSS,
6585
6587
  Ct as isHtmlElement,
6586
- On as isHtmlTagElement,
6588
+ Nn as isHtmlTagElement,
6587
6589
  Be as isRootCfi,
6588
- Us as isShallowEqual,
6590
+ Ws as isShallowEqual,
6589
6591
  wi as layoutEnhancer,
6590
6592
  Rt as mapKeysTo,
6591
6593
  Es as observeIntersection,
@@ -6593,14 +6595,14 @@ export {
6593
6595
  Ke as observeResize,
6594
6596
  eo as paginationEnhancer,
6595
6597
  tt as parseCfi,
6596
- Rs as removeCSS,
6598
+ As as removeCSS,
6597
6599
  Wt as resolveCfi,
6598
- Vs as rootEnhancer,
6599
- fs as spinePositionToSpineItemSpineLayout,
6600
+ js as rootEnhancer,
6601
+ ys as spinePositionToSpineItemSpineLayout,
6600
6602
  ne as upsertCSSToFrame,
6601
6603
  vn as waitForFrameLoad,
6602
6604
  wn as waitForFrameReady,
6603
- Re as waitForSwitch,
6605
+ Ce as waitForSwitch,
6604
6606
  Je as watchKeys
6605
6607
  };
6606
6608
  //# sourceMappingURL=index.js.map