@prose-reader/core 1.301.0 → 1.303.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { Report as $n, isShallowEqual as U, shallowMergeIfDefined as Le, getParentPath as Tn, parseContentType as Cn, detectMimeTypeFromName as Qe, arrayEqual as Fn } from "@prose-reader/shared";
2
- import { isShallowEqual as da } from "@prose-reader/shared";
3
- import { switchMap as $, of as P, fromEvent as J, take as jt, map as S, from as B, takeUntil as M, defer as Ut, Observable as le, Subject as k, combineLatest as _, merge as C, EMPTY as q, NEVER as ye, tap as F, share as R, BehaviorSubject as ee, distinctUntilChanged as N, filter as L, mergeMap as Se, first as W, endWith as we, catchError as Ae, finalize as be, lastValueFrom as Mn, scheduled as Ln, animationFrameScheduler as xe, skip as zt, exhaustMap as An, debounceTime as et, withLatestFrom as H, throttleTime as En, startWith as Ie, switchScan as Nn, shareReplay as G, defaultIfEmpty as Rn, auditTime as Dn, forkJoin as On, delay as Ee, timer as $e, ReplaySubject as ke, identity as Pe, debounce as Vn, concatMap as kn, timeout as jn } from "rxjs";
4
- import { switchMap as Q, first as Un, map as pe, distinctUntilChanged as Oe, startWith as zn, shareReplay as _t, tap as z, pairwise as _n, take as Wn, takeUntil as oe, filter as fe, debounceTime as Bn, skip as Wt, mergeMap as Hn, catchError as dt, share as qn } from "rxjs/operators";
5
- import { generate as qe, parse as Bt, isIndirectionOnly as Xn, isParsedCfiRange as Yn, resolve as Gn } from "@prose-reader/cfi";
6
- const Zn = "@prose-reader/core", A = $n.namespace(Zn, void 0, {
1
+ import { Report as $n, isShallowEqual as U, shallowMergeIfDefined as Le, getParentPath as Tn, parseContentType as Cn, detectMimeTypeFromName as Qe, getItemSpreadPosition as Fn, arrayEqual as Mn } from "@prose-reader/shared";
2
+ import { isShallowEqual as la } from "@prose-reader/shared";
3
+ import { switchMap as $, of as P, fromEvent as K, take as jt, map as S, from as B, takeUntil as M, defer as Ut, Observable as le, Subject as k, combineLatest as _, merge as C, EMPTY as q, NEVER as ye, tap as F, share as R, BehaviorSubject as te, distinctUntilChanged as E, filter as L, mergeMap as Se, first as W, endWith as we, catchError as Ae, finalize as be, lastValueFrom as Ln, scheduled as An, animationFrameScheduler as xe, skip as zt, exhaustMap as Nn, debounceTime as et, withLatestFrom as H, throttleTime as En, startWith as Ie, switchScan as Rn, shareReplay as Z, defaultIfEmpty as Dn, auditTime as On, forkJoin as Vn, delay as Ne, timer as $e, ReplaySubject as ke, identity as Pe, debounce as kn, concatMap as jn, timeout as Un } from "rxjs";
4
+ import { switchMap as ee, first as zn, map as ge, distinctUntilChanged as Oe, startWith as _n, shareReplay as _t, tap as z, pairwise as Wn, take as Bn, takeUntil as oe, filter as fe, debounceTime as Hn, skip as Wt, mergeMap as qn, catchError as dt, share as Xn } from "rxjs/operators";
5
+ import { generate as qe, parse as Bt, isIndirectionOnly as Yn, isParsedCfiRange as Gn, resolve as Zn } from "@prose-reader/cfi";
6
+ const Jn = "@prose-reader/core", A = $n.namespace(Jn, void 0, {
7
7
  color: "#98cde7"
8
- }), Jn = [
8
+ }), Kn = [
9
9
  "pointercancel",
10
10
  "pointerdown",
11
11
  "pointerenter",
@@ -24,23 +24,23 @@ function ne(t, e, n) {
24
24
  function Ht(t, e) {
25
25
  t.hasAttribute(e) && t.removeAttribute(e);
26
26
  }
27
- function Kn(t, e, n) {
27
+ function Qn(t, e, n) {
28
28
  t[e] !== n && (t[e] = n);
29
29
  }
30
- function w(t, e, n) {
30
+ function x(t, e, n) {
31
31
  t.getPropertyValue(e) !== n && t.setProperty(e, n);
32
32
  }
33
- function K(t, e) {
33
+ function Q(t, e) {
34
34
  t.getPropertyValue(e) !== "" && t.removeProperty(e);
35
35
  }
36
- function Qn(t, e, n) {
36
+ function ei(t, e, n) {
37
37
  if ("caretPositionFromPoint" in t)
38
38
  return t.caretPositionFromPoint(e, n);
39
39
  if ("caretRangeFromPoint" in t && // @ts-expect-error limited availability
40
40
  typeof t.caretRangeFromPoint < "u")
41
41
  return t.caretRangeFromPoint(e, n);
42
42
  }
43
- const ei = (t, e) => {
43
+ const ti = (t, e) => {
44
44
  const n = "createRange" in t ? t : t.ownerDocument;
45
45
  if (!n) return;
46
46
  const i = "body" in t ? Xe(t.body, e) : Xe(t, e);
@@ -49,10 +49,10 @@ const ei = (t, e) => {
49
49
  const s = n.createRange();
50
50
  return Array.from(i.childNodes).some((a) => {
51
51
  s.selectNodeContents(a);
52
- const c = s.getClientRects(), u = ti(c, e);
52
+ const c = s.getClientRects(), u = ni(c, e);
53
53
  if (u) {
54
54
  o = s.cloneRange();
55
- const d = Qn(
55
+ const d = ei(
56
56
  n,
57
57
  Math.ceil(u.left),
58
58
  Math.ceil(u.top)
@@ -82,13 +82,13 @@ const ei = (t, e) => {
82
82
  function qt(t, { left: e, right: n }) {
83
83
  return t.left <= e && t.right <= e ? "before" : t.left <= e && t.right > e && t.right <= n ? "partially-before" : t.left <= n && t.right > n ? "partially-after" : t.left > n ? "after" : "within";
84
84
  }
85
- function ti(t, e) {
85
+ function ni(t, e) {
86
86
  return Array.from(t).find((n) => {
87
87
  const i = qt(n, e);
88
88
  return i !== "before" && i !== "after";
89
89
  });
90
90
  }
91
- const ni = (t, e) => {
91
+ const ii = (t, e) => {
92
92
  if (t.nodeType !== Node.CDATA_SECTION_NODE && t.nodeType !== Node.DOCUMENT_TYPE_NODE) {
93
93
  const n = t.ownerDocument?.createRange();
94
94
  n?.selectNodeContents(t);
@@ -110,8 +110,8 @@ const ni = (t, e) => {
110
110
  if (e.PointerEvent && t instanceof e.PointerEvent)
111
111
  return !0;
112
112
  }
113
- return !!Jn.includes(t.type);
114
- }, ii = (t) => {
113
+ return !!Kn.includes(t.type);
114
+ }, oi = (t) => {
115
115
  if (tt(t)) return !1;
116
116
  if (t?.target && t?.target?.ownerDocument?.defaultView) {
117
117
  const e = t?.target?.ownerDocument?.defaultView;
@@ -124,7 +124,7 @@ const ni = (t, e) => {
124
124
  return t instanceof e.MouseEvent;
125
125
  }
126
126
  return !1;
127
- }, oi = (t) => {
127
+ }, ri = (t) => {
128
128
  if (t?.target && t?.target?.ownerDocument?.defaultView) {
129
129
  const e = t?.target?.ownerDocument?.defaultView;
130
130
  if (e.TouchEvent)
@@ -136,7 +136,7 @@ const ni = (t, e) => {
136
136
  return t instanceof e.TouchEvent;
137
137
  }
138
138
  return !1;
139
- }, ri = () => document.createElement("div"), Xt = (t) => {
139
+ }, si = () => document.createElement("div"), Xt = (t) => {
140
140
  const e = [
141
141
  "img",
142
142
  // Images
@@ -152,7 +152,7 @@ const ni = (t, e) => {
152
152
  // JavaScript files
153
153
  ].join(",");
154
154
  return Array.from(t?.querySelectorAll(e) || []);
155
- }, si = (t) => {
155
+ }, ai = (t) => {
156
156
  if (Xt(t).forEach((n) => {
157
157
  const i = n.getAttribute("src") || n.getAttribute("href");
158
158
  i?.startsWith("blob:") && t?.defaultView?.URL.revokeObjectURL(i);
@@ -193,10 +193,10 @@ function Gt(t) {
193
193
  // biome-ignore lint/suspicious/noExplicitAny: TODO
194
194
  ) && t.nodeType === Node.ELEMENT_NODE;
195
195
  }
196
- function ai(t, e) {
196
+ function ci(t, e) {
197
197
  return Gt(t) && t.tagName.toLowerCase() === e.toLowerCase();
198
198
  }
199
- function ci(t) {
199
+ function ui(t) {
200
200
  return Yt(
201
201
  t,
202
202
  [
@@ -228,9 +228,9 @@ const nt = (t, e, n, i) => {
228
228
  if (!n) return 0;
229
229
  const i = Number.parseFloat(n);
230
230
  return Number.isFinite(i) ? i : 0;
231
- }, ui = (t, e, n, i) => {
231
+ }, di = (t, e, n, i) => {
232
232
  t?.contentDocument?.head && nt(t.contentDocument, e, n, i);
233
- }, Gs = (t, e) => {
233
+ }, Zs = (t, e) => {
234
234
  t?.contentDocument && it(t.contentDocument, e);
235
235
  }, de = (t, e, n, i) => {
236
236
  if (!t) return;
@@ -241,7 +241,7 @@ const nt = (t, e, n, i) => {
241
241
  o.textContent !== n && (o.textContent = n);
242
242
  return;
243
243
  }
244
- ui(t, e, n, i);
244
+ di(t, e, n, i);
245
245
  }, ot = (t) => {
246
246
  if (t?.contentDocument) {
247
247
  const n = t.contentDocument.querySelector("meta[name='viewport']");
@@ -263,17 +263,17 @@ const nt = (t, e, n, i) => {
263
263
  }
264
264
  }
265
265
  return { hasViewport: !1 };
266
- }, di = (t) => t.pipe(
267
- $((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? P(e) : J(e, "load").pipe(
266
+ }, li = (t) => t.pipe(
267
+ $((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? P(e) : K(e, "load").pipe(
268
268
  jt(1),
269
269
  S(() => e)
270
270
  ))
271
- ), li = (t) => t.pipe(
271
+ ), pi = (t) => t.pipe(
272
272
  $((e) => {
273
273
  const n = e?.contentDocument?.fonts.ready;
274
274
  return n ? B(n).pipe(S(() => e)) : P(e);
275
275
  })
276
- ), pi = (t) => (e) => {
276
+ ), gi = (t) => (e) => {
277
277
  const n = t(e), i = new IntersectionObserver((r) => {
278
278
  r.forEach((s) => {
279
279
  s.isIntersecting ? Ht(s.target, "tab-index") : ne(s.target, "tab-index", "-1");
@@ -310,7 +310,7 @@ const nt = (t, e, n, i) => {
310
310
  }), {
311
311
  ...n
312
312
  };
313
- }, gi = (t) => (e) => {
313
+ }, hi = (t) => (e) => {
314
314
  const n = t(e);
315
315
  return n.context.watch("rootElement").pipe(M(n.context.destroy$)).subscribe((i) => {
316
316
  if (!i) return;
@@ -331,7 +331,7 @@ const nt = (t, e, n, i) => {
331
331
  clientX: a,
332
332
  clientY: c
333
333
  };
334
- }, hi = (t, e, n, i) => {
334
+ }, mi = (t, e, n, i) => {
335
335
  const o = e?.view?.frameElement;
336
336
  if (!e || !o) return t;
337
337
  const r = n.getSpineItemFromIframe(o), s = o, { height: a, width: c } = i.pageSize;
@@ -351,7 +351,7 @@ const nt = (t, e, n, i) => {
351
351
  enumerable: !0
352
352
  }), l;
353
353
  }
354
- if (ii(t)) {
354
+ if (oi(t)) {
355
355
  const { clientX: u, clientY: d } = je({
356
356
  position: t,
357
357
  frameElement: s
@@ -365,7 +365,7 @@ const nt = (t, e, n, i) => {
365
365
  enumerable: !0
366
366
  }), l;
367
367
  }
368
- if (oi(t)) {
368
+ if (ri(t)) {
369
369
  const u = Array.from(t.touches).map((l) => {
370
370
  const { clientX: g, clientY: h } = je({
371
371
  position: l,
@@ -388,7 +388,7 @@ const nt = (t, e, n, i) => {
388
388
  }), d;
389
389
  }
390
390
  return t;
391
- }, mi = [
391
+ }, fi = [
392
392
  "pointercancel",
393
393
  "pointerdown",
394
394
  "pointerenter",
@@ -397,20 +397,20 @@ const nt = (t, e, n, i) => {
397
397
  "pointerout",
398
398
  "pointerover",
399
399
  "pointerup"
400
- ], fi = [
401
- ...mi
400
+ ], Si = [
401
+ ...fi
402
402
  /*, ...mouseEvents*/
403
- ], Si = (t) => (e) => {
403
+ ], yi = (t) => (e) => {
404
404
  const n = t(e), i = /* @__PURE__ */ new Map();
405
405
  return n.hookManager.register("item.onDocumentLoad", async ({ itemId: o }) => {
406
406
  i.get(o)?.(), i.delete(o);
407
407
  const r = n.spineItemsManager.get(o), s = r?.renderer.getDocumentFrame();
408
408
  if (!s || !r) return;
409
- const a = fi.map((u) => {
409
+ const a = Si.map((u) => {
410
410
  const d = (l) => {
411
411
  let g = l;
412
412
  if (tt(l) && (g = new PointerEvent(l.type, l)), g !== l) {
413
- const h = hi(
413
+ const h = mi(
414
414
  g,
415
415
  l,
416
416
  n.spine.locator,
@@ -431,7 +431,7 @@ const nt = (t, e, n, i) => {
431
431
  }), n.hookManager.register("item.onDocumentUnload", async ({ itemId: o }) => {
432
432
  i.get(o)?.(), i.delete(o);
433
433
  }), n;
434
- }, Zs = (t) => {
434
+ }, Js = (t) => {
435
435
  const e = new FileReader();
436
436
  return new Promise((n) => {
437
437
  e.addEventListener(
@@ -442,13 +442,13 @@ const nt = (t, e, n, i) => {
442
442
  !1
443
443
  ), e.readAsDataURL(t);
444
444
  });
445
- }, yi = (t, e) => Object.entries(t).reduce(
445
+ }, Ii = (t, e) => Object.entries(t).reduce(
446
446
  (n, [i, o]) => e.includes(i) ? {
447
447
  ...n,
448
448
  [i]: o
449
449
  } : n,
450
450
  {}
451
- ), Zt = (t) => pe((e) => yi(e, t)), rt = (t) => (e) => e.pipe(Zt(t), Oe(U));
451
+ ), Zt = (t) => ge((e) => Ii(e, t)), rt = (t) => (e) => e.pipe(Zt(t), Oe(U));
452
452
  function st(t) {
453
453
  return new le((e) => {
454
454
  const n = new ResizeObserver((i) => {
@@ -460,13 +460,13 @@ function st(t) {
460
460
  });
461
461
  }
462
462
  const Ve = (t) => (e) => e.pipe(
463
- Q(
463
+ ee(
464
464
  (n) => t.pipe(
465
- Un(),
466
- pe(() => n)
465
+ zn(),
466
+ ge(() => n)
467
467
  )
468
468
  )
469
- ), Ii = (t) => {
469
+ ), bi = (t) => {
470
470
  let e;
471
471
  const n = t.subscribe((i) => {
472
472
  e = { result: i };
@@ -488,7 +488,7 @@ function Jt() {
488
488
  });
489
489
  }
490
490
  function pt(t) {
491
- return Ut(() => Jt().pipe(Q(t)));
491
+ return Ut(() => Jt().pipe(ee(t)));
492
492
  }
493
493
  const gt = (t, e) => new le((n) => {
494
494
  const i = new MutationObserver((o) => {
@@ -496,7 +496,7 @@ const gt = (t, e) => new le((n) => {
496
496
  });
497
497
  return i.observe(t, e), () => i.disconnect();
498
498
  });
499
- function Js(t, e) {
499
+ function Ks(t, e) {
500
500
  return new le((n) => {
501
501
  const i = new IntersectionObserver((o) => {
502
502
  n.next(o);
@@ -518,9 +518,9 @@ class Kt {
518
518
  e
519
519
  ), this.outputSettingsUpdateSubject = new k(), this.values$ = _([
520
520
  this.settingsManager.values$,
521
- this.outputSettingsUpdateSubject.pipe(zn(this.outputSettings))
521
+ this.outputSettingsUpdateSubject.pipe(_n(this.outputSettings))
522
522
  ]).pipe(
523
- pe(([o, r]) => ({ ...o, ...r })),
523
+ ge(([o, r]) => ({ ...o, ...r })),
524
524
  _t(1)
525
525
  ), this.values$.subscribe();
526
526
  }
@@ -546,7 +546,7 @@ class Kt {
546
546
  }
547
547
  watch(e) {
548
548
  return Array.isArray(e) ? this.values$.pipe(rt(e)) : this.values$.pipe(
549
- pe((n) => n[e]),
549
+ ge((n) => n[e]),
550
550
  Oe(U)
551
551
  );
552
552
  }
@@ -554,7 +554,7 @@ class Kt {
554
554
  this.outputSettingsUpdateSubject.complete();
555
555
  }
556
556
  }
557
- let bi = class extends Kt {
557
+ let vi = class extends Kt {
558
558
  computeOutputSettings(e) {
559
559
  return e;
560
560
  }
@@ -580,8 +580,8 @@ let bi = class extends Kt {
580
580
  };
581
581
  }
582
582
  };
583
- const vi = (t) => (e) => {
584
- const { fontScale: n, lineHeight: i, fontWeight: o, fontJustification: r } = e, s = new k(), a = t(e), c = new bi(
583
+ const wi = (t) => (e) => {
584
+ const { fontScale: n, lineHeight: i, fontWeight: o, fontJustification: r } = e, s = new k(), a = t(e), c = new vi(
585
585
  {
586
586
  fontScale: n,
587
587
  lineHeight: i,
@@ -613,7 +613,7 @@ const vi = (t) => (e) => {
613
613
  }
614
614
  });
615
615
  const l = (g) => g.pipe(
616
- _n(),
616
+ Wn(),
617
617
  S(([h, p]) => p.fontScale !== h.fontScale || p.lineHeight !== h.lineHeight)
618
618
  );
619
619
  return c.values$.pipe(
@@ -627,8 +627,8 @@ const vi = (t) => (e) => {
627
627
  },
628
628
  settings: c
629
629
  };
630
- }, wi = (t) => (e) => {
631
- const n = t(e), i = (o) => J(o, "keyup").pipe(
630
+ }, xi = (t) => (e) => {
631
+ const n = t(e), i = (o) => K(o, "keyup").pipe(
632
632
  S((r) => {
633
633
  const { pageTurnDirection: s, computedPageTurnMode: a } = n.settings.values;
634
634
  if (a === "scrollable")
@@ -663,7 +663,7 @@ const vi = (t) => (e) => {
663
663
  ),
664
664
  M(n.$.destroy$)
665
665
  ).subscribe(), n;
666
- }, xi = (t) => t.spine.spineItemsManager.items$.pipe(
666
+ }, Pi = (t) => t.spine.spineItemsManager.items$.pipe(
667
667
  $(
668
668
  (e) => C(
669
669
  ...e.map((n) => n.watch("isLoaded").pipe(
@@ -673,7 +673,7 @@ const vi = (t) => (e) => {
673
673
  const r = Array.from(
674
674
  i.contentDocument.querySelectorAll("a")
675
675
  ).map(
676
- (s) => J(s, "click")
676
+ (s) => K(s, "click")
677
677
  );
678
678
  return C(...r);
679
679
  })
@@ -687,7 +687,7 @@ const vi = (t) => (e) => {
687
687
  );
688
688
  class re extends le {
689
689
  constructor(e) {
690
- super((n) => this.stateSubject.pipe(M(this._destroy$)).subscribe(n)), this._destroy$ = new k(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new ee(e), this.state$ = this.stateSubject.asObservable();
690
+ super((n) => this.stateSubject.pipe(M(this._destroy$)).subscribe(n)), this._destroy$ = new k(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new te(e), this.state$ = this.stateSubject.asObservable();
691
691
  }
692
692
  next(e) {
693
693
  this.stateSubject.next(e);
@@ -702,7 +702,7 @@ class re extends le {
702
702
  watch(e) {
703
703
  return Array.isArray(e) ? this.stateSubject.pipe(rt(e)) : this.stateSubject.pipe(
704
704
  S((n) => n[e]),
705
- N(U)
705
+ E(U)
706
706
  );
707
707
  }
708
708
  get value() {
@@ -846,16 +846,16 @@ const De = class De extends re {
846
846
  }
847
847
  };
848
848
  De.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
849
- let Ne = De;
850
- const Pi = (t) => new URL(t.href);
849
+ let Ee = De;
850
+ const $i = (t) => new URL(t.href);
851
851
  class at {
852
852
  constructor(e, n) {
853
853
  this.item = e, this.settings = n;
854
854
  }
855
855
  async getResource() {
856
- return await Mn(
856
+ return await Ln(
857
857
  this.settings.values.getResource?.(this.item) ?? P(void 0)
858
- ) ?? Pi(this.item);
858
+ ) ?? $i(this.item);
859
859
  }
860
860
  async fetchResource() {
861
861
  const e = await this.getResource();
@@ -865,7 +865,7 @@ class at {
865
865
  const Qt = (t, e) => {
866
866
  const n = t.startsWith("file://"), i = n ? t.replace("file://", "http://") : t, o = new URL(e, i).toString();
867
867
  return n ? o.replace("http://", "file://") : o;
868
- }, $i = async (t, e, n, i, o) => {
868
+ }, Ti = async (t, e, n, i, o) => {
869
869
  if (!t || !t.defaultView) return;
870
870
  const r = e.sheet;
871
871
  if (r)
@@ -882,22 +882,22 @@ const Qt = (t, e) => {
882
882
  return p;
883
883
  const m = p.match(/url\(['"]?([^'"]+)['"]?\)/);
884
884
  if (!m) return p;
885
- const f = m[1] ?? "", y = i.manifest?.items.find(({ href: x }) => `${Qt(n, f).toLowerCase()}`.endsWith(
886
- `${x.toLowerCase()}`
885
+ const f = m[1] ?? "", y = i.manifest?.items.find(({ href: v }) => `${Qt(n, f).toLowerCase()}`.endsWith(
886
+ `${v.toLowerCase()}`
887
887
  ));
888
888
  if (y) {
889
- const x = new at(y, o);
889
+ const v = new at(y, o);
890
890
  try {
891
- const v = await x.getResource();
892
- if (v instanceof Response) {
893
- const b = await v.blob(), T = t.defaultView?.URL.createObjectURL(b);
891
+ const w = await v.getResource();
892
+ if (w instanceof Response) {
893
+ const b = await w.blob(), T = t.defaultView?.URL.createObjectURL(b);
894
894
  return p.replace(
895
895
  m[0],
896
896
  `url("${T}")`
897
897
  );
898
898
  }
899
- } catch (v) {
900
- console.error("Error loading font:", v);
899
+ } catch (w) {
900
+ console.error("Error loading font:", w);
901
901
  }
902
902
  }
903
903
  return p;
@@ -913,7 +913,7 @@ const Qt = (t, e) => {
913
913
  } catch (s) {
914
914
  console.error("Could not access stylesheet rules:", s);
915
915
  }
916
- }, Ti = (t, e, n, i, o) => {
916
+ }, Ci = (t, e, n, i, o) => {
917
917
  const r = e.getAttribute("src") || e.getAttribute("href");
918
918
  if (!r) return P(null);
919
919
  const s = i.manifest?.items.find(({ href: c }) => `${Qt(n, r).toLowerCase()}`.endsWith(
@@ -935,7 +935,7 @@ const Qt = (t, e) => {
935
935
  return new le((d) => {
936
936
  e.onload = async () => {
937
937
  try {
938
- e.sheet && await $i(
938
+ e.sheet && await Ti(
939
939
  t,
940
940
  e,
941
941
  n,
@@ -950,7 +950,7 @@ const Qt = (t, e) => {
950
950
  return P(null);
951
951
  })
952
952
  );
953
- }, Ci = ({
953
+ }, Fi = ({
954
954
  settings: t,
955
955
  item: e,
956
956
  context: n
@@ -959,7 +959,7 @@ const Qt = (t, e) => {
959
959
  const r = Xt(
960
960
  o.contentDocument
961
961
  ), s = Tn(e.href), a = r.map(
962
- (c) => Ti(
962
+ (c) => Ci(
963
963
  o.contentDocument,
964
964
  c,
965
965
  s,
@@ -969,9 +969,9 @@ const Qt = (t, e) => {
969
969
  );
970
970
  return a.length === 0 ? P(o) : _(a).pipe(S(() => o));
971
971
  })
972
- ), Fi = (t) => {
973
- si(t?.contentDocument);
974
- }, Mi = async (t, e) => {
972
+ ), Mi = (t) => {
973
+ ai(t?.contentDocument);
974
+ }, Li = async (t, e) => {
975
975
  if (typeof t == "string")
976
976
  return new Blob([t], { type: "text/html" });
977
977
  const n = Cn(t.headers.get("Content-Type") || "") || Qe(e.href);
@@ -1024,13 +1024,13 @@ const Qt = (t, e) => {
1024
1024
  );
1025
1025
  }
1026
1026
  return await t.blob();
1027
- }, Li = [
1027
+ }, Ai = [
1028
1028
  ".txt",
1029
1029
  ".jpg",
1030
1030
  ".jpeg",
1031
1031
  ".png",
1032
1032
  ".webp"
1033
- ], Ai = [
1033
+ ], Ni = [
1034
1034
  "text/plain",
1035
1035
  "image/jpg",
1036
1036
  "image/jpeg",
@@ -1051,14 +1051,14 @@ const Qt = (t, e) => {
1051
1051
  return (i) => i.pipe(
1052
1052
  $((o) => B(e.getResource()).pipe(
1053
1053
  $((r) => {
1054
- const s = Li.some(
1054
+ const s = Ai.some(
1055
1055
  (c) => t.href.endsWith(c)
1056
- ) || t.mediaType && Ai.includes(t.mediaType);
1056
+ ) || t.mediaType && Ni.includes(t.mediaType);
1057
1057
  return r instanceof URL && t.href.startsWith(window.location.origin) && !s ? (Ge(o), o?.setAttribute("src", r.href), P(o)) : (r instanceof URL ? B(e.fetchResource()) : P(r)).pipe(
1058
1058
  $((c) => {
1059
1059
  if (!(c instanceof Response))
1060
1060
  throw new Error("Invalid resource");
1061
- return Mi(c, t);
1061
+ return Li(c, t);
1062
1062
  }),
1063
1063
  F((c) => {
1064
1064
  n(o, c);
@@ -1072,7 +1072,7 @@ const Qt = (t, e) => {
1072
1072
  })
1073
1073
  ))
1074
1074
  );
1075
- }, Ni = () => {
1075
+ }, Ri = () => {
1076
1076
  const t = document.createElement("iframe");
1077
1077
  return t.frameBorder = "no", t.tabIndex = 0, t.setAttribute(
1078
1078
  "sandbox",
@@ -1087,7 +1087,7 @@ const Qt = (t, e) => {
1087
1087
  border: 0px none transparent;
1088
1088
  padding: 0px;
1089
1089
  `, t.setAttribute("role", "main"), t;
1090
- }, Ri = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", en = ({
1090
+ }, Di = "body{margin:0}html,body{height:100%;width:100%}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] body{display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=left] body{justify-content:flex-end}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=right] body{justify-content:flex-start}html[data-prose-reader-html-renderer-has-viewport-dimensions=false][data-prose-reader-html-renderer-spread-position=none] body{justify-content:center}:not(html.prose-reader-html-renderer-touch-enabled),:not(html.prose-reader-html-renderer-touch-enabled) body{touch-action:none}img{-webkit-user-select:none;user-select:none;-webkit-user-drag:none;-khtml-user-drag:none;-moz-user-drag:none;-o-user-drag:none;display:flex}html[data-prose-reader-html-renderer-has-viewport-dimensions=false] img{max-width:100%;height:100%;object-fit:contain}", en = ({
1091
1091
  pageHeight: t,
1092
1092
  pageWidth: e,
1093
1093
  frameElement: n
@@ -1111,17 +1111,17 @@ const Qt = (t, e) => {
1111
1111
  viewportDimensions: s
1112
1112
  };
1113
1113
  }
1114
- }, ht = /* @__PURE__ */ new WeakMap(), te = (t, e, n) => {
1114
+ }, ht = /* @__PURE__ */ new WeakMap(), G = (t, e, n) => {
1115
1115
  t.style.getPropertyValue(e) !== n && t.style.setProperty(e, n);
1116
- }, me = (t, e) => {
1116
+ }, pe = (t, e) => {
1117
1117
  t.style.getPropertyValue(e) !== "" && t.style.removeProperty(e);
1118
1118
  }, mt = (t, e) => {
1119
1119
  const n = `${e.width}px`, i = `${e.height}px`;
1120
1120
  t.style.width !== n && (t.style.width = n), t.style.height !== i && (t.style.height = i);
1121
- }, Di = (t, e, n) => {
1121
+ }, Oi = (t, e, n) => {
1122
1122
  const i = t.contentDocument?.documentElement;
1123
1123
  i && i.getAttribute(e) !== n && i.setAttribute(e, n);
1124
- }, Oi = ({
1124
+ }, Vi = ({
1125
1125
  hasViewportDimensions: t,
1126
1126
  viewportWidth: e,
1127
1127
  viewportHeight: n,
@@ -1141,7 +1141,7 @@ const Qt = (t, e) => {
1141
1141
  s ? "1" : "0",
1142
1142
  a,
1143
1143
  c
1144
- ].join("|"), Vi = ({
1144
+ ].join("|"), ki = ({
1145
1145
  frameElement: t,
1146
1146
  viewportDimensions: e,
1147
1147
  computedScale: n,
@@ -1151,25 +1151,25 @@ const Qt = (t, e) => {
1151
1151
  pageWidth: s
1152
1152
  }) => {
1153
1153
  if (e) {
1154
- te(t, "position", "absolute"), te(t, "top", "50%"), i === "left" ? (te(t, "right", "0"), me(t, "left")) : o === "before" && r ? (te(t, "right", "50%"), me(t, "left")) : i === "right" ? (te(t, "left", "0"), me(t, "right")) : (te(
1154
+ G(t, "position", "absolute"), G(t, "top", "50%"), o === "before" ? i === "left" ? (G(t, "left", r ? "0" : "50%"), pe(t, "right")) : i === "right" ? (G(t, "right", r ? "50%" : "0"), pe(t, "left")) : (G(t, "left", r ? "25%" : "75%"), pe(t, "right")) : i === "left" ? (G(t, "right", "0"), pe(t, "left")) : i === "right" ? (G(t, "left", "0"), pe(t, "right")) : (G(
1155
1155
  t,
1156
1156
  "left",
1157
- o === "before" ? r ? "25%" : "75%" : o === "after" ? r ? "75%" : "25%" : "50%"
1158
- ), me(t, "right"));
1159
- const a = i !== "none" ? "0" : "-50%", c = i === "right" && o !== "before" ? "left" : i === "left" || o === "before" && r ? "right" : "center";
1160
- te(
1157
+ o === "after" ? r ? "75%" : "25%" : "50%"
1158
+ ), pe(t, "right"));
1159
+ const a = i !== "none" ? "0" : "-50%", c = o === "before" ? i === "left" ? "left" : i === "right" ? "right" : "center" : i === "right" ? "left" : i === "left" ? "right" : "center";
1160
+ G(
1161
1161
  t,
1162
1162
  "transform",
1163
1163
  `translate(${a}, -50%) scale(${n})`
1164
- ), te(
1164
+ ), G(
1165
1165
  t,
1166
1166
  "transform-origin",
1167
1167
  `${c} center`
1168
1168
  );
1169
1169
  return;
1170
1170
  }
1171
- o === "before" ? r ? te(t, "margin-right", `${s}px`) : te(t, "margin-left", `${s}px`) : (me(t, "margin-left"), me(t, "margin-right"));
1172
- }, ki = ({
1171
+ o === "before" ? r ? G(t, "margin-right", `${s}px`) : G(t, "margin-left", `${s}px`) : (pe(t, "margin-left"), pe(t, "margin-right"));
1172
+ }, ji = ({
1173
1173
  minPageSpread: t,
1174
1174
  blankPagePosition: e,
1175
1175
  spreadPosition: n,
@@ -1180,7 +1180,7 @@ const Qt = (t, e) => {
1180
1180
  }) => {
1181
1181
  const a = t * o;
1182
1182
  if (r?.contentDocument && r?.contentWindow) {
1183
- const { viewportDimensions: c, computedScale: u = 1 } = en({ frameElement: r, pageHeight: i, pageWidth: o }) ?? {}, d = !!c, l = o, g = i, h = Oi({
1183
+ const { viewportDimensions: c, computedScale: u = 1 } = en({ frameElement: r, pageHeight: i, pageWidth: o }) ?? {}, d = !!c, l = o, g = i, h = Vi({
1184
1184
  hasViewportDimensions: d,
1185
1185
  viewportWidth: c?.width,
1186
1186
  viewportHeight: c?.height,
@@ -1191,7 +1191,7 @@ const Qt = (t, e) => {
1191
1191
  pageWidth: o,
1192
1192
  pageHeight: i
1193
1193
  });
1194
- return ht.get(r) === h ? { width: a, height: g } : (ht.set(r, h), Di(
1194
+ return ht.get(r) === h ? { width: a, height: g } : (ht.set(r, h), Oi(
1195
1195
  r,
1196
1196
  "data-prose-reader-html-renderer-has-viewport-dimensions",
1197
1197
  d.toString()
@@ -1201,7 +1201,7 @@ const Qt = (t, e) => {
1201
1201
  }) : mt(r, {
1202
1202
  width: l,
1203
1203
  height: g
1204
- }), Vi({
1204
+ }), ki({
1205
1205
  frameElement: r,
1206
1206
  viewportDimensions: c,
1207
1207
  computedScale: u,
@@ -1212,7 +1212,7 @@ const Qt = (t, e) => {
1212
1212
  }), { width: a, height: g });
1213
1213
  }
1214
1214
  return { width: a, height: i };
1215
- }, ji = () => `
1215
+ }, Ui = () => `
1216
1216
  body {
1217
1217
  margin: 0;
1218
1218
  }
@@ -1229,7 +1229,7 @@ const Qt = (t, e) => {
1229
1229
  html, body {
1230
1230
  touch-action: none;
1231
1231
  }
1232
- `, Ui = ({
1232
+ `, zi = ({
1233
1233
  isScrollable: t,
1234
1234
  enableTouch: e
1235
1235
  }) => `
@@ -1254,7 +1254,7 @@ const Qt = (t, e) => {
1254
1254
  display: block;
1255
1255
  }
1256
1256
  ` : ""}
1257
- `, zi = ({
1257
+ `, _i = ({
1258
1258
  width: t,
1259
1259
  columnHeight: e,
1260
1260
  columnWidth: n
@@ -1322,7 +1322,7 @@ const Qt = (t, e) => {
1322
1322
  td {
1323
1323
  max-width: ${n}px;
1324
1324
  }
1325
- `, _i = ({
1325
+ `, Wi = ({
1326
1326
  isUsingVerticalWriting: t,
1327
1327
  minimumWidth: e,
1328
1328
  pageHeight: n,
@@ -1337,8 +1337,8 @@ const Qt = (t, e) => {
1337
1337
  width: c
1338
1338
  };
1339
1339
  }, Fe = (t, e) => {
1340
- w(t.style, "width", `${e.width}px`), w(t.style, "height", `${e.height}px`);
1341
- }, Wi = ({
1340
+ x(t.style, "width", `${e.width}px`), x(t.style, "height", `${e.height}px`);
1341
+ }, Bi = ({
1342
1342
  pageHeight: t,
1343
1343
  pageWidth: e,
1344
1344
  frameElement: n,
@@ -1352,41 +1352,41 @@ const Qt = (t, e) => {
1352
1352
  isUsingVerticalWriting: d
1353
1353
  }) => {
1354
1354
  const l = r * e, g = i?.renditionLayout === "reflowable" && o === "scrolled-continuous", h = g ? Math.min(400, t) : t;
1355
- w(n.style, "width", `${e}px`), g ? K(n.style, "height") : w(n.style, "height", `${h}px`);
1355
+ x(n.style, "width", `${e}px`), g ? Q(n.style, "height") : x(n.style, "height", `${h}px`);
1356
1356
  const { viewportDimensions: p, computedScale: m = 1 } = en({
1357
1357
  frameElement: n,
1358
1358
  pageHeight: h,
1359
1359
  pageWidth: e
1360
1360
  }) ?? {}, f = i?.renditionLayout === "pre-paginated";
1361
1361
  if (n?.contentDocument && n?.contentWindow && n.contentDocument.body) {
1362
- let y = e, x = h;
1362
+ let y = e, v = h;
1363
1363
  if (p?.hasViewport)
1364
1364
  de(
1365
1365
  n,
1366
1366
  "prose-reader-html-renderer-framce-css",
1367
- ji()
1367
+ Ui()
1368
1368
  ), Fe(n, {
1369
1369
  width: p.width ?? 1,
1370
1370
  height: p.height ?? 1
1371
- }), w(n.style, "position", "absolute"), w(n.style, "top", "50%"), w(
1371
+ }), x(n.style, "position", "absolute"), x(n.style, "top", "50%"), x(
1372
1372
  n.style,
1373
1373
  "left",
1374
1374
  a === "before" ? s ? "25%" : "75%" : a === "after" ? s ? "75%" : "25%" : "50%"
1375
- ), w(
1375
+ ), x(
1376
1376
  n.style,
1377
1377
  "transform",
1378
1378
  `translate(-50%, -50%) scale(${m})`
1379
- ), w(
1379
+ ), x(
1380
1380
  n.style,
1381
1381
  "transform-origin",
1382
1382
  "center center"
1383
1383
  );
1384
1384
  else {
1385
- const b = c ? Ui({
1385
+ const b = c ? zi({
1386
1386
  isScrollable: o === "scrolled-continuous",
1387
1387
  enableTouch: u
1388
- }) : zi(
1389
- _i({
1388
+ }) : _i(
1389
+ Wi({
1390
1390
  isUsingVerticalWriting: d,
1391
1391
  minimumWidth: l,
1392
1392
  pageHeight: h,
@@ -1394,16 +1394,16 @@ const Qt = (t, e) => {
1394
1394
  })
1395
1395
  );
1396
1396
  if (de(n, "prose-reader-css", b, !0), d)
1397
- x = Math.ceil(
1397
+ v = Math.ceil(
1398
1398
  n.contentDocument.documentElement.scrollHeight / h
1399
1399
  ) * h, Fe(n, {
1400
1400
  width: l,
1401
- height: x
1401
+ height: v
1402
1402
  });
1403
1403
  else if (o === "scrolled-continuous")
1404
- x = n.contentDocument.body.scrollHeight, Fe(n, {
1404
+ v = n.contentDocument.body.scrollHeight, Fe(n, {
1405
1405
  width: l,
1406
- height: x
1406
+ height: v
1407
1407
  });
1408
1408
  else {
1409
1409
  const T = Math.ceil(
@@ -1411,23 +1411,23 @@ const Qt = (t, e) => {
1411
1411
  );
1412
1412
  f ? y = e : y = T * e, Fe(n, {
1413
1413
  width: y,
1414
- height: x
1414
+ height: v
1415
1415
  });
1416
1416
  }
1417
1417
  }
1418
- return y % l === 0 ? w(n.style, "margin-left", "0px") : (y = y + e, s && !d && w(
1418
+ return y % l === 0 ? x(n.style, "margin-left", "0px") : (y = y + e, s && !d && x(
1419
1419
  n.style,
1420
1420
  "margin-left",
1421
1421
  `${e}px`
1422
- )), { width: y, height: x };
1422
+ )), { width: y, height: v };
1423
1423
  }
1424
1424
  };
1425
- class Bi extends Ne {
1425
+ class Hi extends Ee {
1426
1426
  constructor() {
1427
1427
  super(...arguments), this.isPrePaginated = () => this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated", this.isImageType = () => !!(this.item.mediaType ?? Qe(this.item.href))?.startsWith("image/");
1428
1428
  }
1429
1429
  onCreateDocument() {
1430
- const e = Ni();
1430
+ const e = Ri();
1431
1431
  return this.setDocumentContainer(e), P(e);
1432
1432
  }
1433
1433
  onLoadDocument() {
@@ -1447,16 +1447,16 @@ class Bi extends Ne {
1447
1447
  F((n) => {
1448
1448
  this.prepareFrameForAttach(n), this.attach();
1449
1449
  }),
1450
- di,
1450
+ li,
1451
1451
  F((n) => {
1452
- this.isPrePaginated() ? de(n, "prose-reader-css", Ri) : this.isImageType();
1452
+ this.isPrePaginated() ? de(n, "prose-reader-css", Di) : this.isImageType();
1453
1453
  }),
1454
- Ci({
1454
+ Fi({
1455
1455
  context: this.context,
1456
1456
  item: this.item,
1457
1457
  settings: this.settings
1458
1458
  }),
1459
- li,
1459
+ pi,
1460
1460
  F((n) => {
1461
1461
  this.revealFrameAfterReady(n);
1462
1462
  })
@@ -1464,7 +1464,7 @@ class Bi extends Ne {
1464
1464
  }
1465
1465
  onUnload() {
1466
1466
  const e = this.getFrameElement();
1467
- return Fi(e), Ge(e), this.detach(), q;
1467
+ return Mi(e), Ge(e), this.detach(), q;
1468
1468
  }
1469
1469
  onLayout({
1470
1470
  minPageSpread: e,
@@ -1483,7 +1483,7 @@ class Bi extends Ne {
1483
1483
  ) : s.contentDocument?.documentElement.classList.remove(
1484
1484
  "prose-reader-html-renderer-touch-enabled"
1485
1485
  )), this.isPrePaginated()) {
1486
- const l = ki({
1486
+ const l = ji({
1487
1487
  blankPagePosition: n,
1488
1488
  frameElement: s,
1489
1489
  isRTL: this.context.isRTL(),
@@ -1494,7 +1494,7 @@ class Bi extends Ne {
1494
1494
  });
1495
1495
  return P(l);
1496
1496
  }
1497
- const c = !!this.writingMode?.startsWith("vertical"), u = this.isImageType(), d = Wi({
1497
+ const c = !!this.writingMode?.startsWith("vertical"), u = this.isImageType(), d = Bi({
1498
1498
  pageHeight: r,
1499
1499
  pageWidth: o,
1500
1500
  frameElement: s,
@@ -1575,13 +1575,13 @@ class Bi extends Ne {
1575
1575
  return this.getFrameElement();
1576
1576
  }
1577
1577
  }
1578
- const Hi = (t) => (e) => {
1578
+ const qi = (t) => (e) => {
1579
1579
  const n = t({
1580
1580
  ...e,
1581
1581
  getRenderer(o) {
1582
- return e.getRenderer?.(o) ?? ((s) => new Bi(s));
1582
+ return e.getRenderer?.(o) ?? ((s) => new Hi(s));
1583
1583
  }
1584
- }), i = xi(n);
1584
+ }), i = Pi(n);
1585
1585
  return i.pipe(M(n.$.destroy$)).subscribe(), {
1586
1586
  ...n,
1587
1587
  links$: i
@@ -1605,7 +1605,7 @@ class Ue {
1605
1605
  this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
1606
1606
  }
1607
1607
  }
1608
- class qi extends ct {
1608
+ class Xi extends ct {
1609
1609
  constructor() {
1610
1610
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1611
1611
  }
@@ -1615,7 +1615,7 @@ class ze extends ct {
1615
1615
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1616
1616
  }
1617
1617
  }
1618
- class Xi extends ct {
1618
+ class Yi extends ct {
1619
1619
  constructor() {
1620
1620
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1621
1621
  }
@@ -1641,20 +1641,20 @@ class O extends tn {
1641
1641
  return new O(e);
1642
1642
  }
1643
1643
  }
1644
- const Yi = (t, e) => {
1644
+ const Gi = (t, e) => {
1645
1645
  const n = e.getBoundingClientRect(), { x: i, y: o } = t, { left: r, top: s } = n, a = n.width / e.offsetWidth, c = n.height / e.offsetHeight, u = i - r, d = o - s;
1646
1646
  return {
1647
1647
  x: u / a,
1648
1648
  y: d / c
1649
1649
  };
1650
- }, Gi = (t, e) => new O(
1651
- Yi(t, e)
1652
- ), Zi = (t) => ({
1653
- getSpinePositionFromClientPosition: (e) => t.spine.element ? Gi(e, t.spine.element) : void 0
1654
- }), Ji = (t) => {
1650
+ }, Zi = (t, e) => new O(
1651
+ Gi(t, e)
1652
+ ), Ji = (t) => ({
1653
+ getSpinePositionFromClientPosition: (e) => t.spine.element ? Zi(e, t.spine.element) : void 0
1654
+ }), Ki = (t) => {
1655
1655
  let e;
1656
1656
  const n = t.context.watch("rootElement").pipe(
1657
- Q((c) => c ? new le(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
1657
+ ee((c) => c ? new le(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
1658
1658
  position: absolute;
1659
1659
  left: 0;
1660
1660
  top: 0;
@@ -1664,9 +1664,9 @@ const Yi = (t, e) => {
1664
1664
  `, c.appendChild(e), () => {
1665
1665
  e?.remove(), e = void 0;
1666
1666
  })) : ye)
1667
- ), i = (c) => Ln(c, xe).pipe(
1667
+ ), i = (c) => An(c, xe).pipe(
1668
1668
  z(() => {
1669
- e && w(
1669
+ e && x(
1670
1670
  e.style,
1671
1671
  "visibility",
1672
1672
  "hidden"
@@ -1674,50 +1674,50 @@ const Yi = (t, e) => {
1674
1674
  })
1675
1675
  ), o = t.context.bridgeEvent.viewportBusy$.pipe(
1676
1676
  z(() => {
1677
- e && w(
1677
+ e && x(
1678
1678
  e.style,
1679
1679
  "visibility",
1680
1680
  "visible"
1681
1681
  );
1682
1682
  })
1683
1683
  ), r = i(t.viewportFree$).pipe(
1684
- Wn(1)
1684
+ Bn(1)
1685
1685
  ), a = t.settings.values$.pipe(
1686
- pe(() => t.settings.values.computedPageTurnMode),
1686
+ ge(() => t.settings.values.computedPageTurnMode),
1687
1687
  Oe()
1688
1688
  ).pipe(
1689
- Q(
1690
- (c) => c === "controlled" ? o.pipe(Q(() => r)) : i(P(void 0))
1689
+ ee(
1690
+ (c) => c === "controlled" ? o.pipe(ee(() => r)) : i(P(void 0))
1691
1691
  ),
1692
1692
  oe(t.$.destroy$)
1693
1693
  );
1694
1694
  return C(n, a);
1695
- }, Qs = "@prose-reader/core", ea = 0, ta = 200, j = "prose-reader", Ki = `${j}-style`, Qi = `data-${j}-id`, eo = `${j}-viewport`, to = `${j}-scroll-navigator`, no = `${j}-spine-item`, ft = `--${j}-absolute-viewport-width`, St = `--${j}-absolute-viewport-height`, ut = `${j}-enhancer-loading`, io = `${ut}-container`, oo = `${ut}-logo`, ro = `${ut}-details`, so = ({
1695
+ }, ea = "@prose-reader/core", ta = 0, na = 200, j = "prose-reader", Qi = `${j}-style`, eo = `data-${j}-id`, to = `${j}-viewport`, no = `${j}-scroll-navigator`, io = `${j}-spine-item`, ft = `--${j}-absolute-viewport-width`, St = `--${j}-absolute-viewport-height`, ut = `${j}-enhancer-loading`, oo = `${ut}-container`, ro = `${ut}-logo`, so = `${ut}-details`, ao = ({
1696
1696
  container: t,
1697
1697
  item: e
1698
1698
  }) => {
1699
1699
  const n = t.ownerDocument.createElement("div");
1700
- n.classList.add(io);
1700
+ n.classList.add(oo);
1701
1701
  const i = n.ownerDocument.createElement("div");
1702
- i.classList.add(oo), i.innerText = "prose";
1702
+ i.classList.add(ro), i.innerText = "prose";
1703
1703
  const o = n.ownerDocument.createElement("div");
1704
- return o.classList.add(ro), o.setAttribute("data-details-element", "true"), o.innerText = `loading ${e.id}`, n.appendChild(i), n.appendChild(o), n;
1705
- }, ao = (t) => t === "sepia" ? "#939393" : "rgb(202, 202, 202)", yt = ({
1704
+ return o.classList.add(so), o.setAttribute("data-details-element", "true"), o.innerText = `loading ${e.id}`, n.appendChild(i), n.appendChild(o), n;
1705
+ }, co = (t) => t === "sepia" ? "#939393" : "rgb(202, 202, 202)", yt = ({
1706
1706
  loadingElement: t,
1707
1707
  theme: e
1708
1708
  }) => {
1709
- w(
1709
+ x(
1710
1710
  t.style,
1711
1711
  "color",
1712
- ao(e)
1712
+ co(e)
1713
1713
  );
1714
- }, co = (t) => {
1714
+ }, uo = (t) => {
1715
1715
  const e = /* @__PURE__ */ new WeakMap();
1716
1716
  t.hookManager.register(
1717
1717
  "item.onBeforeContainerAttach",
1718
1718
  ({ element: o, item: r }) => {
1719
- w(o.style, "z-index", "0");
1720
- const s = so({
1719
+ x(o.style, "z-index", "0");
1720
+ const s = ao({
1721
1721
  container: o,
1722
1722
  item: r
1723
1723
  });
@@ -1735,7 +1735,7 @@ const Yi = (t, e) => {
1735
1735
  const c = a.querySelector(
1736
1736
  "[data-details-element]"
1737
1737
  );
1738
- c instanceof HTMLElement && Kn(
1738
+ c instanceof HTMLElement && Qn(
1739
1739
  c,
1740
1740
  "innerText",
1741
1741
  s?.toString() ?? "Unknown error"
@@ -1753,12 +1753,12 @@ const Yi = (t, e) => {
1753
1753
  })
1754
1754
  );
1755
1755
  return C(n, i);
1756
- }, uo = (t) => {
1756
+ }, lo = (t) => {
1757
1757
  t.hookManager.register("item.onDocumentLoad", async ({ itemId: e }) => {
1758
1758
  const i = t.spineItemsManager.get(e)?.renderer.getDocumentFrame();
1759
1759
  i && ne(i, "scrolling", "no");
1760
1760
  });
1761
- }, lo = (t) => {
1761
+ }, po = (t) => {
1762
1762
  t.hookManager.register(
1763
1763
  "item.onAfterLayout",
1764
1764
  ({ item: e, blankPagePosition: n, minimumWidth: i }) => {
@@ -1768,7 +1768,7 @@ const Yi = (t, e) => {
1768
1768
  const { hasViewport: s } = ot(r), { width: a } = t.viewport.pageSize, c = o?.renderer.getDocumentFrame();
1769
1769
  if (s) {
1770
1770
  const u = a < i;
1771
- n === "none" && u && c instanceof HTMLIFrameElement && w(
1771
+ n === "none" && u && c instanceof HTMLIFrameElement && x(
1772
1772
  c.style,
1773
1773
  "left",
1774
1774
  t.context.isRTL() ? "75%" : "25%"
@@ -1776,12 +1776,12 @@ const Yi = (t, e) => {
1776
1776
  }
1777
1777
  }
1778
1778
  );
1779
- }, po = (t) => t.spineItemsObserver.states$.pipe(
1779
+ }, go = (t) => t.spineItemsObserver.states$.pipe(
1780
1780
  F(({ item: e, isReady: n, isDirty: i }) => {
1781
1781
  e.containerElement.dataset.isDirty = i.toString(), e.containerElement.dataset.isReady = n.toString();
1782
1782
  })
1783
1783
  );
1784
- let go = class extends Kt {
1784
+ let ho = class extends Kt {
1785
1785
  computeOutputSettings(e) {
1786
1786
  return e;
1787
1787
  }
@@ -1810,19 +1810,19 @@ let go = class extends Kt {
1810
1810
  const nn = ({
1811
1811
  manifest: t,
1812
1812
  spreadMode: e
1813
- }) => t?.renditionFlow === "scrolled-continuous" ? !1 : e, ho = (t) => t === void 0 || t === "auto" || t === "landscape" || t === "both", on = ({
1813
+ }) => t?.renditionFlow === "scrolled-continuous" ? !1 : e, mo = (t) => t === void 0 || t === "auto" || t === "landscape" || t === "both", on = ({
1814
1814
  manifest: t,
1815
1815
  viewport: e
1816
1816
  }) => {
1817
1817
  const n = e.width > e.height;
1818
- return !!(!n && t?.renditionSpread === "portrait" || n && ho(t?.renditionSpread));
1819
- }, ia = ({
1818
+ return !!(!n && t?.renditionSpread === "portrait" || n && mo(t?.renditionSpread));
1819
+ }, oa = ({
1820
1820
  manifest: t,
1821
1821
  viewport: e
1822
1822
  }) => nn({
1823
1823
  manifest: t,
1824
1824
  spreadMode: on({ manifest: t, viewport: e })
1825
- }), mo = (t) => _([
1825
+ }), fo = (t) => _([
1826
1826
  t.viewport.watch(["width", "height"]),
1827
1827
  t.context.watch("manifest")
1828
1828
  ]).pipe(
@@ -1834,13 +1834,13 @@ const nn = ({
1834
1834
  })
1835
1835
  })
1836
1836
  )
1837
- ), fo = (t) => (e) => {
1837
+ ), So = (t) => (e) => {
1838
1838
  const {
1839
1839
  pageHorizontalMargin: n,
1840
1840
  pageVerticalMargin: i,
1841
1841
  layoutAutoResize: o,
1842
1842
  layoutLayerTransition: r
1843
- } = e, s = t(e), a = new go(
1843
+ } = e, s = t(e), a = new ho(
1844
1844
  {
1845
1845
  pageHorizontalMargin: n,
1846
1846
  pageVerticalMargin: i,
@@ -1858,12 +1858,12 @@ const nn = ({
1858
1858
  }
1859
1859
  }
1860
1860
  }), s.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
1861
- const f = s.spineItemsManager.get(m.id), x = !!(m.mediaType ?? Qe(m.href))?.startsWith("image/"), { pageHorizontalMargin: v = 0, pageVerticalMargin: b = 0 } = a.values, T = s.viewport.pageSize;
1862
- if (f?.renditionLayout === "reflowable" && !x) {
1863
- let I = T.width - v * 2;
1864
- const E = T.height - b * 2;
1865
- let X = T.width - v * 2, Y = v * 2;
1866
- f.isUsingVerticalWriting() && (X = T.width - v * 2, I = E, Y = b * 2);
1861
+ const f = s.spineItemsManager.get(m.id), v = !!(m.mediaType ?? Qe(m.href))?.startsWith("image/"), { pageHorizontalMargin: w = 0, pageVerticalMargin: b = 0 } = a.values, T = s.viewport.pageSize;
1862
+ if (f?.renditionLayout === "reflowable" && !v) {
1863
+ let I = T.width - w * 2;
1864
+ const N = T.height - b * 2;
1865
+ let X = T.width - w * 2, Y = w * 2;
1866
+ f.isUsingVerticalWriting() && (X = T.width - w * 2, I = N, Y = b * 2);
1867
1867
  const se = f?.renderer.getDocumentFrame();
1868
1868
  se && de(
1869
1869
  se,
@@ -1871,14 +1871,14 @@ const nn = ({
1871
1871
  `
1872
1872
  body {
1873
1873
  width: ${X}px !important;
1874
- margin: ${b}px ${v}px !important;
1874
+ margin: ${b}px ${w}px !important;
1875
1875
  column-gap: ${Y}px !important;
1876
1876
  column-width: ${I}px !important;
1877
- height: ${E}px !important;
1877
+ height: ${N}px !important;
1878
1878
  }
1879
1879
  img, video, audio, object, svg {
1880
1880
  -max-width: ${I}px !important;
1881
- -max-height: ${E}px !important;
1881
+ -max-height: ${N}px !important;
1882
1882
  }
1883
1883
  table {
1884
1884
  max-width: ${I}px !important;
@@ -1889,10 +1889,10 @@ const nn = ({
1889
1889
  `
1890
1890
  );
1891
1891
  }
1892
- }), lo(s), uo(s), s.hookManager.register(
1892
+ }), po(s), lo(s), s.hookManager.register(
1893
1893
  "item.onDocumentCreated",
1894
1894
  ({ documentContainer: m }) => {
1895
- w(m.style, "opacity", "0"), a.values.layoutLayerTransition && w(
1895
+ x(m.style, "opacity", "0"), a.values.layoutLayerTransition && x(
1896
1896
  m.style,
1897
1897
  "transition",
1898
1898
  "opacity 800ms"
@@ -1906,19 +1906,19 @@ const nn = ({
1906
1906
  fe(({ isReady: m }) => m),
1907
1907
  z(({ item: m }) => {
1908
1908
  const f = m.renderer.documentContainer;
1909
- f && w(f.style, "opacity", "1");
1909
+ f && x(f.style, "opacity", "1");
1910
1910
  })
1911
1911
  ), u = a.values$.pipe(
1912
1912
  fe(({ layoutAutoResize: m }) => m === "container"),
1913
- Q(() => s.context.watch("rootElement")),
1913
+ ee(() => s.context.watch("rootElement")),
1914
1914
  fe(ie),
1915
- Q((m) => st(m)),
1916
- Bn(100),
1915
+ ee((m) => st(m)),
1916
+ Hn(100),
1917
1917
  fe(ie),
1918
1918
  z(() => {
1919
1919
  s?.layout();
1920
1920
  })
1921
- ), d = Ji(s);
1921
+ ), d = Ki(s);
1922
1922
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1923
1923
  Wt(1),
1924
1924
  z(() => {
@@ -1928,7 +1928,7 @@ const nn = ({
1928
1928
  ).subscribe();
1929
1929
  const l = s.spine.pages.pipe(
1930
1930
  _t({ refCount: !0, bufferSize: 1 })
1931
- ), g = po(s), h = mo(s), p = co(s);
1931
+ ), g = go(s), h = fo(s), p = uo(s);
1932
1932
  return C(
1933
1933
  c,
1934
1934
  d,
@@ -1945,9 +1945,9 @@ const nn = ({
1945
1945
  settings: a,
1946
1946
  layout$: s.spine.layout$,
1947
1947
  layoutInfo$: l,
1948
- coordinates: Zi(s)
1948
+ coordinates: Ji(s)
1949
1949
  };
1950
- }, So = (t) => (e) => {
1950
+ }, yo = (t) => (e) => {
1951
1951
  const n = t(e), i = new IntersectionObserver(
1952
1952
  (a) => {
1953
1953
  a.forEach((c) => {
@@ -2007,7 +2007,7 @@ const nn = ({
2007
2007
  ), sn = ({
2008
2008
  navigation$: t,
2009
2009
  navigationState$: e
2010
- }) => t.pipe(rn(e)), yo = (t) => sn(t).pipe(zt(1)), Io = (t) => (e) => e.pipe(M(yo(t))), an = (t) => t.navigation.navigation$.pipe(
2010
+ }) => t.pipe(rn(e)), Io = (t) => sn(t).pipe(zt(1)), bo = (t) => (e) => e.pipe(M(Io(t))), an = (t) => t.navigation.navigation$.pipe(
2011
2011
  L((e) => e.triggeredBy === "user"),
2012
2012
  rn(t.navigation.navigationState$),
2013
2013
  S((e) => {
@@ -2020,15 +2020,15 @@ const nn = ({
2020
2020
  L((e) => e !== void 0),
2021
2021
  S((e) => ({ boundary: e })),
2022
2022
  R()
2023
- ), bo = (t, e) => t.links$.pipe(
2023
+ ), vo = (t, e) => t.links$.pipe(
2024
2024
  F((n) => {
2025
- if (!ai(n.target, "a") || n.type !== "click") return;
2025
+ if (!ci(n.target, "a") || n.type !== "click") return;
2026
2026
  const i = new URL(n.target.href), o = `${i.origin}${i.pathname}`;
2027
2027
  t.context.manifest?.spineItems.some(
2028
2028
  (s) => s.href === o
2029
2029
  ) && e.goToUrl(i);
2030
2030
  })
2031
- ), ae = A.namespace("navigation"), vo = ({
2031
+ ), ae = A.namespace("navigation"), wo = ({
2032
2032
  position: t,
2033
2033
  spineItem: e,
2034
2034
  pageHeight: n,
@@ -2060,7 +2060,7 @@ const nn = ({
2060
2060
  const u = o.getSpineItemPositionFromSpinePosition(
2061
2061
  t,
2062
2062
  a
2063
- ), d = vo({
2063
+ ), d = wo({
2064
2064
  position: u,
2065
2065
  spineItem: a,
2066
2066
  pageHeight: r.pageSize.height,
@@ -2080,7 +2080,7 @@ const nn = ({
2080
2080
  y: t.y - r.pageSize.height,
2081
2081
  x: 0
2082
2082
  });
2083
- }, wo = ({
2083
+ }, xo = ({
2084
2084
  position: t,
2085
2085
  spineItem: e,
2086
2086
  context: n,
@@ -2130,7 +2130,7 @@ const nn = ({
2130
2130
  return i.getAdjustedPositionForSpread(d);
2131
2131
  }
2132
2132
  return i.getAdjustedPositionForSpread(u);
2133
- }, xo = ({
2133
+ }, Po = ({
2134
2134
  position: t,
2135
2135
  spineItem: e,
2136
2136
  pageHeight: n,
@@ -2162,7 +2162,7 @@ const nn = ({
2162
2162
  const u = o.getSpineItemPositionFromSpinePosition(
2163
2163
  t,
2164
2164
  a
2165
- ), d = xo({
2165
+ ), d = Po({
2166
2166
  position: u,
2167
2167
  spineItem: a,
2168
2168
  pageHeight: r.pageSize.height,
@@ -2182,7 +2182,7 @@ const nn = ({
2182
2182
  y: t.y + r.pageSize.height,
2183
2183
  x: 0
2184
2184
  });
2185
- }, Po = ({
2185
+ }, $o = ({
2186
2186
  position: t,
2187
2187
  spineItem: e,
2188
2188
  context: n,
@@ -2233,7 +2233,7 @@ const nn = ({
2233
2233
  }
2234
2234
  return i.getAdjustedPositionForSpread(u);
2235
2235
  };
2236
- class $o {
2236
+ class To {
2237
2237
  constructor(e) {
2238
2238
  this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new V({ x: 0, y: 0 }), this.unlock = void 0;
2239
2239
  }
@@ -2252,7 +2252,7 @@ class $o {
2252
2252
  turnRightOrBottom() {
2253
2253
  const e = this.reader.navigation.getNavigation(), n = this.reader.spineItemsManager.get(e.spineItem);
2254
2254
  if (!n) return;
2255
- const i = Po({
2255
+ const i = $o({
2256
2256
  context: this.reader.context,
2257
2257
  navigationResolver: this.reader.navigation.navigationResolver,
2258
2258
  position: e.position,
@@ -2270,7 +2270,7 @@ class $o {
2270
2270
  turnLeftOrTop() {
2271
2271
  const e = this.reader.navigation.getNavigation(), n = this.reader.spineItemsManager.get(e.spineItem);
2272
2272
  if (!n) return;
2273
- const i = wo({
2273
+ const i = xo({
2274
2274
  context: this.reader.context,
2275
2275
  navigationResolver: this.reader.navigation.navigationResolver,
2276
2276
  position: e.position,
@@ -2412,7 +2412,7 @@ class $o {
2412
2412
  }
2413
2413
  }
2414
2414
  }
2415
- class To extends re {
2415
+ class Co extends re {
2416
2416
  constructor(e) {
2417
2417
  super({
2418
2418
  lastDelta: { x: 0, y: 0 },
@@ -2469,7 +2469,7 @@ class To extends re {
2469
2469
  });
2470
2470
  }
2471
2471
  }
2472
- class Z {
2472
+ class J {
2473
2473
  constructor() {
2474
2474
  this.isDestroyed = !1, this.destroySubject = new k(), this.destroy$ = this.destroySubject.asObservable();
2475
2475
  }
@@ -2477,19 +2477,19 @@ class Z {
2477
2477
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
2478
2478
  }
2479
2479
  }
2480
- const Co = 500;
2481
- class Fo extends Z {
2480
+ const Fo = 500;
2481
+ class Mo extends J {
2482
2482
  constructor(e, n) {
2483
2483
  super(), this.scrollNavigationController = e, this.lock = n, this.navigationSubject = new k(), this.navigation$ = this.navigationSubject.asObservable();
2484
2484
  const i = this.scrollNavigationController.userScroll$.pipe(
2485
- An((o) => {
2485
+ Nn((o) => {
2486
2486
  const r = this.lock();
2487
2487
  return C(
2488
2488
  this.scrollNavigationController.userScroll$,
2489
2489
  P(o)
2490
2490
  ).pipe(
2491
2491
  et(
2492
- Co,
2492
+ Fo,
2493
2493
  xe
2494
2494
  ),
2495
2495
  W(),
@@ -2512,7 +2512,7 @@ class Fo extends Z {
2512
2512
  C(i).pipe(M(this.destroy$)).subscribe();
2513
2513
  }
2514
2514
  }
2515
- const Mo = (t) => t.pagination.state$.pipe(
2515
+ const Lo = (t) => t.pagination.state$.pipe(
2516
2516
  H(t.context.manifest$, t.settings.values$),
2517
2517
  S(
2518
2518
  ([
@@ -2531,8 +2531,8 @@ const Mo = (t) => t.pagination.state$.pipe(
2531
2531
  };
2532
2532
  }
2533
2533
  ),
2534
- N(U)
2535
- ), Lo = ({ reader: t, duration: e }) => (n) => {
2534
+ E(U)
2535
+ ), Ao = ({ reader: t, duration: e }) => (n) => {
2536
2536
  let i;
2537
2537
  const o = () => {
2538
2538
  i?.(), i = void 0;
@@ -2548,11 +2548,11 @@ const Mo = (t) => t.pagination.state$.pipe(
2548
2548
  F(o),
2549
2549
  be(o)
2550
2550
  );
2551
- }, Ao = (t) => (e) => {
2552
- const n = t(e), i = Mo(n), o = an(n), r = new $o(n), s = new To(n), a = new Fo(
2551
+ }, No = (t) => (e) => {
2552
+ const n = t(e), i = Lo(n), o = an(n), r = new To(n), s = new Co(n), a = new Mo(
2553
2553
  n.navigation.scrollNavigationController,
2554
2554
  n.navigation.lock
2555
- ), c = bo(n, r), u = a.navigation$.pipe(
2555
+ ), c = vo(n, r), u = a.navigation$.pipe(
2556
2556
  F((g) => {
2557
2557
  n.navigation.navigate(g);
2558
2558
  })
@@ -2570,7 +2570,7 @@ const Mo = (t) => t.pagination.state$.pipe(
2570
2570
  ...n.navigation,
2571
2571
  state$: i,
2572
2572
  outOfSpineBoundary$: o,
2573
- throttleLock: ({ duration: g, trigger: h }) => h.pipe(Lo({ duration: g, reader: n })),
2573
+ throttleLock: ({ duration: g, trigger: h }) => h.pipe(Ao({ duration: g, reader: n })),
2574
2574
  panNavigator: s,
2575
2575
  turnBottom: r.turnBottom.bind(r),
2576
2576
  turnTop: r.turnTop.bind(r),
@@ -2613,7 +2613,7 @@ const Mo = (t) => t.pagination.state$.pipe(
2613
2613
  itemIndex: n.index,
2614
2614
  node: null
2615
2615
  };
2616
- }, No = (t, e) => {
2616
+ }, Ro = (t, e) => {
2617
2617
  let n = t?.itemPageIndex;
2618
2618
  const { itemIndex: i, ...o } = e.cfi.parseCfi(t.cfi), r = e.spineItemsManager.get(i);
2619
2619
  return r ? Jt().pipe(
@@ -2646,7 +2646,7 @@ const Mo = (t) => t.pagination.state$.pipe(
2646
2646
  })
2647
2647
  ) : P({ ...t, itemIndex: i, ...o });
2648
2648
  };
2649
- class Ro {
2649
+ class Do {
2650
2650
  constructor(e) {
2651
2651
  this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (n) => {
2652
2652
  const i = this.locatorsByKey.get(n);
@@ -2679,13 +2679,13 @@ class Ro {
2679
2679
  const l = this.reader.spine.layout$.pipe(
2680
2680
  et(10),
2681
2681
  Ie(o),
2682
- Nn((g) => No(g.meta, this.reader).pipe(
2682
+ Rn((g) => Ro(g.meta, this.reader).pipe(
2683
2683
  S((h) => ({
2684
2684
  ...g,
2685
2685
  meta: h
2686
2686
  }))
2687
2687
  ), o),
2688
- G({ refCount: !0, bufferSize: 1 })
2688
+ Z({ refCount: !0, bufferSize: 1 })
2689
2689
  );
2690
2690
  return c && this.locatorsByKey.set(c, {
2691
2691
  observerCount: 1,
@@ -2698,14 +2698,14 @@ class Ro {
2698
2698
  return Array.isArray(e) ? pt(
2699
2699
  () => _(
2700
2700
  e.map((i) => this.locate(i, n ?? {}))
2701
- ).pipe(Rn([]))
2701
+ ).pipe(Dn([]))
2702
2702
  ) : this.locate(e, n ?? {});
2703
2703
  }
2704
2704
  }
2705
- const Do = A.namespace("spine"), Oo = ({
2705
+ const Oo = A.namespace("spine"), Vo = ({
2706
2706
  position: t,
2707
2707
  pageSize: e
2708
- }) => new Xi({
2708
+ }) => new Yi({
2709
2709
  ...t,
2710
2710
  left: t.x,
2711
2711
  top: t.y,
@@ -2713,7 +2713,7 @@ const Do = A.namespace("spine"), Oo = ({
2713
2713
  height: e.height,
2714
2714
  bottom: t.y + e.height,
2715
2715
  right: t.x + e.width
2716
- }), Vo = 10, ko = (t) => {
2716
+ }), ko = 10, jo = (t) => {
2717
2717
  const { spineItem: e, ...n } = t;
2718
2718
  if (!t.spineItem.value.isLoaded)
2719
2719
  return {
@@ -2726,12 +2726,12 @@ const Do = A.namespace("spine"), Oo = ({
2726
2726
  firstVisibleNode: void 0
2727
2727
  } : {
2728
2728
  ...n,
2729
- firstVisibleNode: ei(
2729
+ firstVisibleNode: ti(
2730
2730
  o,
2731
2731
  t.layout
2732
2732
  )
2733
2733
  };
2734
- }, jo = (t) => new le((e) => {
2734
+ }, Uo = (t) => new le((e) => {
2735
2735
  if (t.length === 0) {
2736
2736
  e.next([]), e.complete();
2737
2737
  return;
@@ -2742,13 +2742,13 @@ const Do = A.namespace("spine"), Oo = ({
2742
2742
  }, s = () => {
2743
2743
  n = void 0;
2744
2744
  let c = 0;
2745
- for (; i < t.length && c < Vo; ) {
2745
+ for (; i < t.length && c < ko; ) {
2746
2746
  const u = t[i];
2747
2747
  if (!u) {
2748
2748
  i = t.length;
2749
2749
  break;
2750
2750
  }
2751
- o[i] = ko(u), i += 1, c += 1;
2751
+ o[i] = jo(u), i += 1, c += 1;
2752
2752
  }
2753
2753
  if (i >= t.length) {
2754
2754
  e.next(o), e.complete();
@@ -2777,11 +2777,11 @@ const Do = A.namespace("spine"), Oo = ({
2777
2777
  spineItemPosition: h
2778
2778
  }), m = u.length;
2779
2779
  u.push({
2780
- absoluteLayout: Oo({
2780
+ absoluteLayout: Vo({
2781
2781
  pageSize: a,
2782
2782
  position: p
2783
2783
  }),
2784
- layout: new qi({
2784
+ layout: new Xi({
2785
2785
  left: h.x,
2786
2786
  right: h.x + a.width,
2787
2787
  top: h.y,
@@ -2801,9 +2801,9 @@ const Do = A.namespace("spine"), Oo = ({
2801
2801
  },
2802
2802
  []
2803
2803
  );
2804
- return jo(c);
2804
+ return Uo(c);
2805
2805
  }),
2806
- S((a) => (Do.info("Pages layout", a), { pages: a })),
2806
+ S((a) => (Oo.info("Pages layout", a), { pages: a })),
2807
2807
  R()
2808
2808
  ), this.layout$.pipe(M(this.destroy$)).subscribe(this.next.bind(this));
2809
2809
  }
@@ -2820,7 +2820,7 @@ ce.fromSpineItemPageIndex = (e, n, i) => {
2820
2820
  ), ce.fromAbsolutePageIndex = (e, n) => e.pages.find(
2821
2821
  (i) => i.absolutePageIndex === n
2822
2822
  );
2823
- let he = ce;
2823
+ let me = ce;
2824
2824
  const Te = (t) => {
2825
2825
  const e = t.indexOf("#");
2826
2826
  return e >= 0 ? t.substring(0, e) : t;
@@ -2828,7 +2828,7 @@ const Te = (t) => {
2828
2828
  if (!t) return;
2829
2829
  const e = t.indexOf("#");
2830
2830
  return e < 0 ? void 0 : t.substring(e + 1) || void 0;
2831
- }, Uo = (t) => {
2831
+ }, zo = (t) => {
2832
2832
  try {
2833
2833
  return decodeURIComponent(t);
2834
2834
  } catch {
@@ -2844,13 +2844,13 @@ const Te = (t) => {
2844
2844
  },
2845
2845
  ...cn(n.contents, i)
2846
2846
  ];
2847
- }), zo = (t) => {
2847
+ }), _o = (t) => {
2848
2848
  const e = /* @__PURE__ */ new Map();
2849
2849
  return t.spineItems.forEach((n, i) => {
2850
2850
  e.has(n.href) || e.set(n.href, i);
2851
2851
  }), e;
2852
- }, _o = (t, e) => {
2853
- const n = zo(e);
2852
+ }, Wo = (t, e) => {
2853
+ const n = _o(e);
2854
2854
  return cn(t).map((i) => {
2855
2855
  const o = Te(i.href), r = n.get(o) ?? -1;
2856
2856
  return {
@@ -2859,7 +2859,7 @@ const Te = (t) => {
2859
2859
  spineItemIndex: r
2860
2860
  };
2861
2861
  });
2862
- }, Wo = ({
2862
+ }, Bo = ({
2863
2863
  manifest: t,
2864
2864
  tocIndex: e
2865
2865
  }) => {
@@ -2883,7 +2883,7 @@ const Te = (t) => {
2883
2883
  u,
2884
2884
  d
2885
2885
  ] of n)
2886
- Bo(
2886
+ Ho(
2887
2887
  s,
2888
2888
  u
2889
2889
  ) && c.push(...d);
@@ -2894,7 +2894,7 @@ const Te = (t) => {
2894
2894
  i.set(r.href, a);
2895
2895
  }
2896
2896
  return i;
2897
- }, Bo = (t, e) => t === e || t.endsWith(e) || e.endsWith(t), Ho = (t, e) => {
2897
+ }, Ho = (t, e) => t === e || t.endsWith(e) || e.endsWith(t), qo = (t, e) => {
2898
2898
  const n = t.endsWith(e), i = t.substring(
2899
2899
  0,
2900
2900
  t.lastIndexOf("/")
@@ -2919,7 +2919,7 @@ const Te = (t) => {
2919
2919
  o.subChapter = s, o = s;
2920
2920
  }
2921
2921
  return i;
2922
- }, qo = ({
2922
+ }, Xo = ({
2923
2923
  doc: t,
2924
2924
  node: e,
2925
2925
  offset: n
@@ -2933,14 +2933,14 @@ const Te = (t) => {
2933
2933
  i.setStart(e, r);
2934
2934
  }
2935
2935
  return i.collapse(!0), i;
2936
- }, Xo = ({
2936
+ }, Yo = ({
2937
2937
  rangeToTest: t,
2938
2938
  upperBoundRange: e
2939
- }) => t.compareBoundaryPoints(Range.START_TO_START, e) < 0, Yo = (t) => {
2939
+ }) => t.compareBoundaryPoints(Range.START_TO_START, e) < 0, Go = (t) => {
2940
2940
  const e = t.createRange(), n = t.body ?? t.documentElement;
2941
2941
  if (n)
2942
2942
  return e.selectNodeContents(n), e.collapse(!1), e;
2943
- }, Go = ({
2943
+ }, Zo = ({
2944
2944
  anchorNode: t,
2945
2945
  nextPageNode: e
2946
2946
  }) => t === e || t.contains(e), wt = ({
@@ -2953,11 +2953,11 @@ const Te = (t) => {
2953
2953
  if (!t || e === void 0 || !i || n.length === 0) return;
2954
2954
  const r = i.renderer.getDocumentFrame()?.contentDocument;
2955
2955
  if (!r || t.ownerDocument !== r) return;
2956
- const s = o?.firstVisibleNode?.node, a = o?.firstVisibleNode?.offset, c = o ? s !== void 0 && a !== void 0 && s.ownerDocument === r ? qo({
2956
+ const s = o?.firstVisibleNode?.node, a = o?.firstVisibleNode?.offset, c = o ? s !== void 0 && a !== void 0 && s.ownerDocument === r ? Xo({
2957
2957
  doc: r,
2958
2958
  node: s,
2959
2959
  offset: a
2960
- }) : void 0 : Yo(r);
2960
+ }) : void 0 : Go(r);
2961
2961
  if (!c) return;
2962
2962
  const u = o !== void 0 && s !== void 0 && s.ownerDocument === r;
2963
2963
  let d, l, g;
@@ -2966,14 +2966,14 @@ const Te = (t) => {
2966
2966
  g = p.chain;
2967
2967
  continue;
2968
2968
  }
2969
- const m = r.getElementById(Uo(p.anchorId));
2970
- if (!m || u && Go({
2969
+ const m = r.getElementById(zo(p.anchorId));
2970
+ if (!m || u && Zo({
2971
2971
  anchorNode: m,
2972
2972
  nextPageNode: s
2973
2973
  }))
2974
2974
  continue;
2975
2975
  const f = r.createRange();
2976
- f.setStartBefore(m), f.collapse(!0), Xo({
2976
+ f.setStartBefore(m), f.collapse(!0), Yo({
2977
2977
  rangeToTest: f,
2978
2978
  upperBoundRange: c
2979
2979
  }) && (!l || f.compareBoundaryPoints(
@@ -2983,14 +2983,14 @@ const Te = (t) => {
2983
2983
  }
2984
2984
  const h = d ?? g;
2985
2985
  return h ? un(h) : void 0;
2986
- }, Zo = ({
2986
+ }, Jo = ({
2987
2987
  candidate: t,
2988
2988
  hrefHasAnchor: e
2989
2989
  }) => {
2990
2990
  if (e || !t.anchorId) return !1;
2991
2991
  const n = t.chain[t.chain.length - 1], i = t.chain[t.chain.length - 2];
2992
2992
  return !n || !i ? !1 : Te(n.path) === Te(i.path);
2993
- }, Jo = ({
2993
+ }, Ko = ({
2994
2994
  href: t,
2995
2995
  tocIndex: e,
2996
2996
  manifest: n
@@ -3000,18 +3000,18 @@ const Te = (t) => {
3000
3000
  );
3001
3001
  let s;
3002
3002
  for (const a of e)
3003
- Ho(
3003
+ qo(
3004
3004
  i,
3005
3005
  a.hrefWithoutAnchor
3006
- ) && (r < a.spineItemIndex || Zo({ candidate: a, hrefHasAnchor: o }) || (s = a.chain));
3006
+ ) && (r < a.spineItemIndex || Jo({ candidate: a, hrefHasAnchor: o }) || (s = a.chain));
3007
3007
  return s;
3008
- }, Ko = (t, e, n) => {
3009
- const { href: i } = n, o = Jo({ href: i, tocIndex: e, manifest: t });
3008
+ }, Qo = (t, e, n) => {
3009
+ const { href: i } = n, o = Ko({ href: i, tocIndex: e, manifest: t });
3010
3010
  return o ? un(o) : void 0;
3011
- }, Qo = (t, e) => t ? t.spineItems.reduce(
3012
- (i, o) => (i[o.id] = Ko(t, e, o), i),
3011
+ }, er = (t, e) => t ? t.spineItems.reduce(
3012
+ (i, o) => (i[o.id] = Qo(t, e, o), i),
3013
3013
  {}
3014
- ) : {}, er = (t, e, n) => t + e * n, tr = (t, e, n) => {
3014
+ ) : {}, tr = (t, e, n) => t + e * n, nr = (t, e, n) => {
3015
3015
  const { height: i, width: o } = n.layoutInfo, { top: r, left: s } = t.spine.getSpineItemSpineLayoutInfo(n);
3016
3016
  return t.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
3017
3017
  0,
@@ -3026,21 +3026,21 @@ const Te = (t) => {
3026
3026
  (e.x - s + t.viewport.absoluteViewport.width) / o
3027
3027
  )
3028
3028
  );
3029
- }, nr = (t, e, n, i, o, r) => o.isReady$.pipe(
3029
+ }, ir = (t, e, n, i, o, r) => o.isReady$.pipe(
3030
3030
  W(),
3031
3031
  H(t.layoutInfo$),
3032
3032
  S(([s, a]) => {
3033
- const c = r.renditionLayout === "pre-paginated", u = r.spineItems.length || 0, d = r.spineItems.slice(0, e).reduce((y, x) => y + (x.progressionWeight ?? 0), 0) || 0, l = t.spineItemsManager.getSpineItemIndex(o) ?? 0, g = r.spineItems.length ?? 0, h = a.pages.filter((y) => y.itemIndex === l).length ?? 0, p = r.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
3033
+ const c = r.renditionLayout === "pre-paginated", u = r.spineItems.length || 0, d = r.spineItems.slice(0, e).reduce((y, v) => y + (v.progressionWeight ?? 0), 0) || 0, l = t.spineItemsManager.getSpineItemIndex(o) ?? 0, g = r.spineItems.length ?? 0, h = a.pages.filter((y) => y.itemIndex === l).length ?? 0, p = r.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
3034
3034
  // relative to the total number of documents
3035
3035
  (l + 1) / g;
3036
3036
  let m = (n + 1) * (p / h);
3037
3037
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
3038
3038
  let f = d + m;
3039
- return r.renditionFlow === "scrolled-continuous" && (s ? m = tr(
3039
+ return r.renditionFlow === "scrolled-continuous" && (s ? m = nr(
3040
3040
  t,
3041
3041
  i,
3042
3042
  o
3043
- ) : m = 0, f = er(
3043
+ ) : m = 0, f = tr(
3044
3044
  d,
3045
3045
  p,
3046
3046
  m
@@ -3056,10 +3056,10 @@ const Te = (t) => {
3056
3056
  item: t,
3057
3057
  nextItem: e,
3058
3058
  previousItem: n
3059
- }) => Pt(t, n) || Pt(t, e), ir = {
3059
+ }) => Pt(t, n) || Pt(t, e), or = {
3060
3060
  tocCandidatesBySpineHref: /* @__PURE__ */ new Map(),
3061
3061
  chaptersInfo: {}
3062
- }, or = ({
3062
+ }, rr = ({
3063
3063
  beginItem: t,
3064
3064
  endItem: e,
3065
3065
  paginationInfo: n,
@@ -3067,15 +3067,15 @@ const Te = (t) => {
3067
3067
  pagesState: o,
3068
3068
  spineItems: r
3069
3069
  }) => {
3070
- const s = t && n.beginPageIndexInSpineItem !== void 0 ? he.fromSpineItemPageIndex(
3070
+ const s = t && n.beginPageIndexInSpineItem !== void 0 ? me.fromSpineItemPageIndex(
3071
3071
  o,
3072
3072
  t.index,
3073
3073
  n.beginPageIndexInSpineItem
3074
- ) : void 0, a = s ? he.fromNextPageWithinSameSpineItem(o, s) : void 0, c = e && n.endPageIndexInSpineItem !== void 0 ? he.fromSpineItemPageIndex(
3074
+ ) : void 0, a = s ? me.fromNextPageWithinSameSpineItem(o, s) : void 0, c = e && n.endPageIndexInSpineItem !== void 0 ? me.fromSpineItemPageIndex(
3075
3075
  o,
3076
3076
  e.index,
3077
3077
  n.endPageIndexInSpineItem
3078
- ) : void 0, u = c ? he.fromNextPageWithinSameSpineItem(o, c) : void 0, d = t ? wt({
3078
+ ) : void 0, u = c ? me.fromNextPageWithinSameSpineItem(o, c) : void 0, d = t ? wt({
3079
3079
  node: s?.firstVisibleNode?.node,
3080
3080
  offset: s?.firstVisibleNode?.offset,
3081
3081
  candidates: i.tocCandidatesBySpineHref.get(t.item.href) ?? [],
@@ -3106,7 +3106,7 @@ const Te = (t) => {
3106
3106
  endSpineItemReadingDirection: e?.readingDirection,
3107
3107
  endAbsolutePageIndex: c?.absolutePageIndex
3108
3108
  };
3109
- }, rr = ({
3109
+ }, sr = ({
3110
3110
  items: t,
3111
3111
  pagesState: e
3112
3112
  }) => {
@@ -3120,16 +3120,16 @@ const Te = (t) => {
3120
3120
  */
3121
3121
  numberOfTotalPages: e.pages.length
3122
3122
  };
3123
- }, sr = (t, e) => t.numberOfTotalPages !== e.numberOfTotalPages || t.numberOfPagesPerItems.length !== e.numberOfPagesPerItems.length ? !1 : t.numberOfPagesPerItems.every(
3123
+ }, ar = (t, e) => t.numberOfTotalPages !== e.numberOfTotalPages || t.numberOfPagesPerItems.length !== e.numberOfPagesPerItems.length ? !1 : t.numberOfPagesPerItems.every(
3124
3124
  (n, i) => n === e.numberOfPagesPerItems[i]
3125
- ), ar = ({
3125
+ ), cr = ({
3126
3126
  reader: t,
3127
3127
  paginationInfo: e,
3128
3128
  navigationPosition: n,
3129
3129
  manifest: i
3130
3130
  }) => {
3131
3131
  const o = t.spineItemsManager.get(e.endSpineItemIndex);
3132
- return o ? nr(
3132
+ return o ? ir(
3133
3133
  t,
3134
3134
  e.endSpineItemIndex ?? 0,
3135
3135
  e.endPageIndexInSpineItem || 0,
@@ -3137,30 +3137,30 @@ const Te = (t) => {
3137
3137
  o,
3138
3138
  i
3139
3139
  ) : P(0);
3140
- }, cr = (t) => t.context.manifest$.pipe(
3140
+ }, ur = (t) => t.context.manifest$.pipe(
3141
3141
  S((e) => {
3142
3142
  if (!e)
3143
- return ir;
3144
- const n = _o(e.nav?.toc ?? [], e);
3143
+ return or;
3144
+ const n = Wo(e.nav?.toc ?? [], e);
3145
3145
  return {
3146
- tocCandidatesBySpineHref: Wo({
3146
+ tocCandidatesBySpineHref: Bo({
3147
3147
  manifest: e,
3148
3148
  tocIndex: n
3149
3149
  }),
3150
- chaptersInfo: Qo(e, n)
3150
+ chaptersInfo: er(e, n)
3151
3151
  };
3152
3152
  })
3153
- ), ur = (t) => ({
3153
+ ), dr = (t) => ({
3154
3154
  beginSpineItemIndex: t.beginSpineItemIndex,
3155
3155
  beginPageIndexInSpineItem: t.beginPageIndexInSpineItem,
3156
3156
  endSpineItemIndex: t.endSpineItemIndex,
3157
3157
  endPageIndexInSpineItem: t.endPageIndexInSpineItem
3158
- }), dr = (t) => {
3159
- const e = t.pagination.state$, n = t.spine.pages.layout$, i = cr(t).pipe(
3160
- G({ bufferSize: 1, refCount: !0 })
3158
+ }), lr = (t) => {
3159
+ const e = t.pagination.state$, n = t.spine.pages.layout$, i = ur(t).pipe(
3160
+ Z({ bufferSize: 1, refCount: !0 })
3161
3161
  ), o = e.pipe(
3162
- S(ur),
3163
- N(U)
3162
+ S(dr),
3163
+ E(U)
3164
3164
  ), r = _([
3165
3165
  o,
3166
3166
  i,
@@ -3169,7 +3169,7 @@ const Te = (t) => {
3169
3169
  ]).pipe(
3170
3170
  S(([l, g, h, p]) => {
3171
3171
  const m = l.beginSpineItemIndex !== void 0 ? p[l.beginSpineItemIndex] : void 0, f = l.endSpineItemIndex !== void 0 ? p[l.endSpineItemIndex] : void 0;
3172
- return or({
3172
+ return rr({
3173
3173
  beginItem: m,
3174
3174
  endItem: f,
3175
3175
  paginationInfo: l,
@@ -3178,18 +3178,18 @@ const Te = (t) => {
3178
3178
  spineItems: p
3179
3179
  });
3180
3180
  }),
3181
- G({ bufferSize: 1, refCount: !0 })
3181
+ Z({ bufferSize: 1, refCount: !0 })
3182
3182
  ), s = t.settings.watch(["computedSpreadMode"]).pipe(
3183
3183
  S((l) => l.computedSpreadMode ?? !1),
3184
- N()
3184
+ E()
3185
3185
  ), a = _([
3186
3186
  n,
3187
3187
  t.spineItemsManager.items$
3188
3188
  ]).pipe(
3189
3189
  S(
3190
- ([l, g]) => rr({ items: g, pagesState: l })
3190
+ ([l, g]) => sr({ items: g, pagesState: l })
3191
3191
  ),
3192
- N(sr)
3192
+ E(ar)
3193
3193
  ), c = _([
3194
3194
  e,
3195
3195
  s,
@@ -3204,7 +3204,7 @@ const Te = (t) => {
3204
3204
  }))
3205
3205
  ), u = sn(t.navigation).pipe(
3206
3206
  S(({ position: l }) => l),
3207
- N(U)
3207
+ E(U)
3208
3208
  ), d = _([
3209
3209
  e,
3210
3210
  t.layout$,
@@ -3212,7 +3212,7 @@ const Te = (t) => {
3212
3212
  t.context.manifest$
3213
3213
  ]).pipe(
3214
3214
  $(
3215
- ([l, g, h, p]) => ar({
3215
+ ([l, g, h, p]) => cr({
3216
3216
  reader: t,
3217
3217
  paginationInfo: l,
3218
3218
  navigationPosition: h,
@@ -3234,11 +3234,11 @@ const Te = (t) => {
3234
3234
  ...l,
3235
3235
  ...g
3236
3236
  })),
3237
- N(U),
3238
- Dn(5)
3237
+ E(U),
3238
+ On(5)
3239
3239
  );
3240
- }, lr = (t) => (e) => {
3241
- const n = t(e), i = new ee({
3240
+ }, pr = (t) => (e) => {
3241
+ const n = t(e), i = new te({
3242
3242
  ...n.pagination.state,
3243
3243
  beginChapterInfo: void 0,
3244
3244
  beginHasAdjacentSpreadPage: !1,
@@ -3255,7 +3255,7 @@ const Te = (t) => {
3255
3255
  endHasAdjacentSpreadPage: !1,
3256
3256
  endSpineItemReadingDirection: void 0,
3257
3257
  percentageEstimateOfBook: 0
3258
- }), o = new Ro(n), r = dr(n).pipe(F((s) => A.log("Pagination", s))).subscribe(i);
3258
+ }), o = new Do(n), r = lr(n).pipe(F((s) => A.log("Pagination", s))).subscribe(i);
3259
3259
  return {
3260
3260
  ...n,
3261
3261
  locateResource: o.locateResource.bind(o),
@@ -3272,7 +3272,7 @@ const Te = (t) => {
3272
3272
  }
3273
3273
  }
3274
3274
  };
3275
- }, pr = (t) => ({
3275
+ }, gr = (t) => ({
3276
3276
  put: (r, s) => new Promise((a, c) => {
3277
3277
  const u = t.transaction(["store"], "readwrite");
3278
3278
  u.onerror = (g) => {
@@ -3329,11 +3329,11 @@ const Te = (t) => {
3329
3329
  i.onerror = (o) => {
3330
3330
  n(o);
3331
3331
  }, i.onsuccess = () => {
3332
- e(pr(i.result));
3332
+ e(gr(i.result));
3333
3333
  }, i.onupgradeneeded = () => {
3334
3334
  i.result.createObjectStore("store");
3335
3335
  };
3336
- }), gr = (t) => {
3336
+ }), hr = (t) => {
3337
3337
  let e = Date.now().toString();
3338
3338
  const n = new k(), i = (c) => {
3339
3339
  if (typeof c == "string" || typeof c == "object") {
@@ -3353,12 +3353,12 @@ const Te = (t) => {
3353
3353
  n.next({ id: c, data: u });
3354
3354
  };
3355
3355
  n.asObservable().pipe(
3356
- Hn(({ id: c, data: u }) => {
3356
+ qn(({ id: c, data: u }) => {
3357
3357
  const d = i(c);
3358
3358
  return d ? B(
3359
- On([_e("prose-reader"), B(u.blob())])
3359
+ Vn([_e("prose-reader"), B(u.blob())])
3360
3360
  ).pipe(
3361
- Q(([l, g]) => B(l.put(`${e}_${d.id}`, g))),
3361
+ ee(([l, g]) => B(l.put(`${e}_${d.id}`, g))),
3362
3362
  dt((l) => (A.error(l), q))
3363
3363
  ) : q;
3364
3364
  }),
@@ -3370,13 +3370,13 @@ const Te = (t) => {
3370
3370
  })
3371
3371
  );
3372
3372
  return C(s).pipe(
3373
- Q(() => (A.debug("Cleanup up old cache..."), B(_e("prose-reader")).pipe(
3374
- Q(
3373
+ ee(() => (A.debug("Cleanup up old cache..."), B(_e("prose-reader")).pipe(
3374
+ ee(
3375
3375
  (c) => B(c.keys()).pipe(
3376
- pe(
3376
+ ge(
3377
3377
  (u) => u.filter((d) => !d.toString().startsWith(e))
3378
3378
  ),
3379
- Q((u) => {
3379
+ ee((u) => {
3380
3380
  const d = u.map((l) => c.remove(l));
3381
3381
  return B(Promise.all(d));
3382
3382
  })
@@ -3391,8 +3391,8 @@ const Te = (t) => {
3391
3391
  n.complete();
3392
3392
  }
3393
3393
  };
3394
- }, hr = (t) => (e) => {
3395
- const n = t(e), i = gr(n.context);
3394
+ }, mr = (t) => (e) => {
3395
+ const n = t(e), i = hr(n.context);
3396
3396
  return {
3397
3397
  ...n,
3398
3398
  // $: {
@@ -3404,7 +3404,7 @@ const Te = (t) => {
3404
3404
  }
3405
3405
  // load,
3406
3406
  };
3407
- }, mr = (t, e) => {
3407
+ }, fr = (t, e) => {
3408
3408
  const n = t.node.ownerDocument?.createRange(), i = t.node.compareDocumentPosition(e.node);
3409
3409
  if (n) {
3410
3410
  try {
@@ -3424,14 +3424,14 @@ const Te = (t) => {
3424
3424
  }
3425
3425
  return n;
3426
3426
  }
3427
- }, fr = ({
3427
+ }, Sr = ({
3428
3428
  selection: t,
3429
3429
  spineItem: e
3430
3430
  }) => {
3431
3431
  const { anchorNode: n, anchorOffset: i, focusNode: o, focusOffset: r } = t;
3432
3432
  if (!(!n || !o))
3433
3433
  try {
3434
- return mr(
3434
+ return fr(
3435
3435
  { node: n, offset: i },
3436
3436
  { node: o, offset: r }
3437
3437
  );
@@ -3443,7 +3443,7 @@ const Te = (t) => {
3443
3443
  return;
3444
3444
  }
3445
3445
  };
3446
- class Sr extends Z {
3446
+ class yr extends J {
3447
3447
  constructor(e) {
3448
3448
  super();
3449
3449
  const n = e.contentDocument || e.contentWindow?.document;
@@ -3467,25 +3467,25 @@ class Sr extends Z {
3467
3467
  )
3468
3468
  ) : P(null);
3469
3469
  this.selectionChange$ = C(
3470
- J(n, "selectionchange"),
3470
+ K(n, "selectionchange"),
3471
3471
  i
3472
3472
  ).pipe(
3473
3473
  S(() => n.getSelection()),
3474
3474
  M(C(o, this.destroy$)),
3475
3475
  we(null)
3476
- ), this.selectionOver$ = J(n, "pointerdown").pipe(
3476
+ ), this.selectionOver$ = K(n, "pointerdown").pipe(
3477
3477
  $(
3478
3478
  () => C(
3479
- J(n, "pointerup"),
3480
- J(n, "pointercancel"),
3481
- J(n, "contextmenu")
3479
+ K(n, "pointerup"),
3480
+ K(n, "pointercancel"),
3481
+ K(n, "contextmenu")
3482
3482
  ).pipe(
3483
3483
  W(),
3484
3484
  /**
3485
3485
  * The selection is still valid during the event even if it will
3486
3486
  * be discarded. The timeout make sure to detect this edge case.
3487
3487
  */
3488
- Ee(0),
3488
+ Ne(0),
3489
3489
  S((r) => {
3490
3490
  const s = n.getSelection();
3491
3491
  return s && !s.isCollapsed ? [r, s] : void 0;
@@ -3498,11 +3498,11 @@ class Sr extends Z {
3498
3498
  }
3499
3499
  }
3500
3500
  }
3501
- const yr = (t) => t.watch("isLoaded").pipe(
3501
+ const Ir = (t) => t.watch("isLoaded").pipe(
3502
3502
  $(() => {
3503
3503
  const e = t.renderer.getDocumentFrame(), n = e?.contentDocument || e?.contentWindow?.document;
3504
3504
  if (!e || !n) return ye;
3505
- const i = new Sr(e);
3505
+ const i = new yr(e);
3506
3506
  return C(
3507
3507
  i.selectionChange$.pipe(
3508
3508
  S((o) => {
@@ -3528,15 +3528,15 @@ const yr = (t) => t.watch("isLoaded").pipe(
3528
3528
  })
3529
3529
  );
3530
3530
  }),
3531
- N()
3532
- ), Ir = (t) => (e) => {
3531
+ E()
3532
+ ), br = (t) => (e) => {
3533
3533
  const n = t(e);
3534
3534
  let i;
3535
3535
  const o = n.spineItemsManager.items$.pipe(
3536
3536
  $((d) => {
3537
3537
  const l = d.map((g) => {
3538
3538
  const h = n.spineItemsManager.getSpineItemIndex(g) ?? 0;
3539
- return yr(g).pipe(
3539
+ return Ir(g).pipe(
3540
3540
  S((p) => {
3541
3541
  if (p)
3542
3542
  return {
@@ -3549,19 +3549,19 @@ const yr = (t) => t.watch("isLoaded").pipe(
3549
3549
  return C(...l);
3550
3550
  }),
3551
3551
  Ie(void 0),
3552
- N(),
3552
+ E(),
3553
3553
  F((d) => {
3554
3554
  i = d;
3555
3555
  }),
3556
- G({ refCount: !0, bufferSize: 1 })
3556
+ Z({ refCount: !0, bufferSize: 1 })
3557
3557
  ), r = o, s = o.pipe(
3558
3558
  S((d) => !!d),
3559
- N(),
3559
+ E(),
3560
3560
  L((d) => d),
3561
3561
  R()
3562
3562
  ), a = s.pipe(
3563
3563
  $(() => r),
3564
- N(),
3564
+ E(),
3565
3565
  L((d) => !d),
3566
3566
  R()
3567
3567
  ), c = o.pipe(
@@ -3569,11 +3569,11 @@ const yr = (t) => t.watch("isLoaded").pipe(
3569
3569
  R()
3570
3570
  ), u = n.context.watch("rootElement").pipe(
3571
3571
  L(ie),
3572
- $((d) => J(d, "pointerdown")),
3572
+ $((d) => K(d, "pointerdown")),
3573
3573
  H(r),
3574
3574
  S(([, d]) => d),
3575
3575
  Ie(void 0),
3576
- G({ refCount: !0, bufferSize: 1 })
3576
+ Z({ refCount: !0, bufferSize: 1 })
3577
3577
  );
3578
3578
  return C(r, u).pipe(M(n.$.destroy$)).subscribe(), {
3579
3579
  ...n,
@@ -3584,7 +3584,7 @@ const yr = (t) => t.watch("isLoaded").pipe(
3584
3584
  selectionOver$: c,
3585
3585
  lastSelectionOnPointerdown$: u,
3586
3586
  getSelection: () => i,
3587
- createOrderedRangeFromSelection: fr
3587
+ createOrderedRangeFromSelection: Sr
3588
3588
  }
3589
3589
  };
3590
3590
  }, Tt = [
@@ -3602,8 +3602,8 @@ const yr = (t) => t.watch("isLoaded").pipe(
3602
3602
  backgroundColor: "#191717",
3603
3603
  foregroundColor: "#f1ebeb"
3604
3604
  }
3605
- ], br = (t) => (e) => {
3606
- const n = t(e), i = new ee(
3605
+ ], vr = (t) => (e) => {
3606
+ const n = t(e), i = new te(
3607
3607
  e.theme ?? "bright"
3608
3608
  ), o = () => {
3609
3609
  const a = Tt.find(
@@ -3626,7 +3626,7 @@ const yr = (t) => t.watch("isLoaded").pipe(
3626
3626
  const c = Tt.find(
3627
3627
  (u) => u.name === i.value
3628
3628
  );
3629
- return c && w(
3629
+ return c && x(
3630
3630
  a.style,
3631
3631
  "background-color",
3632
3632
  c.backgroundColor
@@ -3668,7 +3668,7 @@ const yr = (t) => t.watch("isLoaded").pipe(
3668
3668
  }
3669
3669
  }
3670
3670
  };
3671
- }, vr = (t) => (e) => {
3671
+ }, wr = (t) => (e) => {
3672
3672
  const n = t(e);
3673
3673
  return {
3674
3674
  ...n,
@@ -3682,7 +3682,7 @@ const yr = (t) => t.watch("isLoaded").pipe(
3682
3682
  };
3683
3683
  };
3684
3684
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3685
- const wr = (t) => (e) => t(e), Ct = (t, e, n) => {
3685
+ const xr = (t) => (e) => t(e), Ct = (t, e, n) => {
3686
3686
  const { clientWidth: i, clientHeight: o } = n.value.element, r = {
3687
3687
  maxX: 0,
3688
3688
  minX: i * (1 - e),
@@ -3693,15 +3693,15 @@ const wr = (t) => (e) => t(e), Ct = (t, e, n) => {
3693
3693
  x: Math.min(Math.max(t.x, r.minX), r.maxX),
3694
3694
  y: Math.min(Math.max(t.y, r.minY), r.maxY)
3695
3695
  };
3696
- }, xr = (t, e, n) => {
3697
- w(n.style, "transform-origin", "0 0");
3696
+ }, Pr = (t, e, n) => {
3697
+ x(n.style, "transform-origin", "0 0");
3698
3698
  const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${t})`;
3699
- w(
3699
+ x(
3700
3700
  n.style,
3701
3701
  "transform",
3702
3702
  `${i} ${o}`
3703
3703
  );
3704
- }, Pr = (t, e, n, i) => {
3704
+ }, $r = (t, e, n, i) => {
3705
3705
  const o = e / t, r = n.clientWidth, s = n.clientHeight, a = r / 2 - i.x, c = s / 2 - i.y;
3706
3706
  return {
3707
3707
  x: i.x + a * (1 - o),
@@ -3715,16 +3715,16 @@ class dn {
3715
3715
  }
3716
3716
  class Ft extends dn {
3717
3717
  }
3718
- class $r extends dn {
3718
+ class Tr extends dn {
3719
3719
  constructor() {
3720
3720
  super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("UnboundScrollPosition");
3721
3721
  }
3722
3722
  }
3723
- class Tr extends re {
3723
+ class Cr extends re {
3724
3724
  constructor(e, n, i, o, r) {
3725
3725
  super({
3726
3726
  element: void 0
3727
- }), this.viewport = e, this.settings = n, this.hookManager = i, this.spine = o, this.context = r, this.navigateSubject = new k(), this.scrollingSubject = new ee(!1), this.applyNavigationPosition = ({ position: l }) => {
3727
+ }), this.viewport = e, this.settings = n, this.hookManager = i, this.spine = o, this.context = r, this.navigateSubject = new k(), this.scrollingSubject = new te(!1), this.applyNavigationPosition = ({ position: l }) => {
3728
3728
  const g = this.value.element;
3729
3729
  if (!g) return;
3730
3730
  const h = this.fromSpinePosition(l);
@@ -3744,14 +3744,14 @@ class Tr extends re {
3744
3744
  F(({ rootElement: l }) => {
3745
3745
  if (!l) return;
3746
3746
  const g = document.createElement("div");
3747
- g.setAttribute(`data-${to}`, ""), g.appendChild(this.viewport.value.element), l.appendChild(g), this.update({ element: g });
3747
+ g.setAttribute(`data-${no}`, ""), g.appendChild(this.viewport.value.element), l.appendChild(g), this.update({ element: g });
3748
3748
  })
3749
3749
  ), a = _([
3750
3750
  n.watch(["computedPageTurnMode"]),
3751
3751
  this.watch("element")
3752
3752
  ]).pipe(
3753
3753
  F(([{ computedPageTurnMode: l }, g]) => {
3754
- g && (l === "scrollable" ? w(g.style, "display", "block") : w(g.style, "display", "contents"));
3754
+ g && (l === "scrollable" ? x(g.style, "display", "block") : x(g.style, "display", "contents"));
3755
3755
  })
3756
3756
  ), c = this.navigateSubject.pipe(
3757
3757
  F(this.applyNavigationPosition)
@@ -3764,7 +3764,7 @@ class Tr extends re {
3764
3764
  ),
3765
3765
  o.element$.pipe(
3766
3766
  L(ie),
3767
- $((l) => J(l, "scroll"))
3767
+ $((l) => K(l, "scroll"))
3768
3768
  ),
3769
3769
  o.spineItemsObserver.itemResize$
3770
3770
  ).pipe(
@@ -3774,7 +3774,7 @@ class Tr extends re {
3774
3774
  Ie(!0)
3775
3775
  )
3776
3776
  ),
3777
- N(),
3777
+ E(),
3778
3778
  Ie(!1)
3779
3779
  ), d = _([
3780
3780
  u,
@@ -3783,14 +3783,14 @@ class Tr extends re {
3783
3783
  S(
3784
3784
  ([l, g]) => l || g
3785
3785
  ),
3786
- G(1)
3786
+ Z(1)
3787
3787
  );
3788
3788
  this.userScroll$ = this.watch("element").pipe(
3789
3789
  L(ie),
3790
3790
  $(
3791
3791
  (l) => n.watch(["computedPageTurnMode"]).pipe(
3792
3792
  $(
3793
- ({ computedPageTurnMode: g }) => g === "controlled" ? ye : J(l, "scroll").pipe(
3793
+ ({ computedPageTurnMode: g }) => g === "controlled" ? ye : K(l, "scroll").pipe(
3794
3794
  H(d),
3795
3795
  L(
3796
3796
  ([, h]) => !h
@@ -3835,15 +3835,15 @@ class Tr extends re {
3835
3835
  });
3836
3836
  }
3837
3837
  }
3838
- const Cr = (t, e, n, i, o) => {
3838
+ const Fr = (t, e, n, i, o) => {
3839
3839
  const r = t.clientWidth, s = t.clientHeight, a = t.scrollLeft, c = t.scrollTop, u = a + r / 2 - i, d = c + s / 2 - o, l = n / e, g = u * l, h = d * l, p = g - r / 2 + i, m = h - s / 2 + o;
3840
- return new $r({
3840
+ return new Tr({
3841
3841
  x: p,
3842
3842
  y: m
3843
3843
  });
3844
- }, Fr = (t, e) => {
3845
- const n = e.viewport, i = e.navigation.scrollNavigationController, o = n.value.element, r = i.value.element, s = i.value.element, a = Math.round(n.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, d = Cr(
3846
- r ?? ri(),
3844
+ }, Mr = (t, e) => {
3845
+ const n = e.viewport, i = e.navigation.scrollNavigationController, o = n.value.element, r = i.value.element, s = i.value.element, a = Math.round(n.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, d = Fr(
3846
+ r ?? si(),
3847
3847
  a,
3848
3848
  t,
3849
3849
  c,
@@ -3853,11 +3853,11 @@ const Cr = (t, e, n, i, o) => {
3853
3853
  s,
3854
3854
  `data-${j}-zooming-direction`,
3855
3855
  l
3856
- ), t < 1 ? w(o.style, "transform-origin", "top") : t > 1 && w(
3856
+ ), t < 1 ? x(o.style, "transform-origin", "top") : t > 1 && x(
3857
3857
  o.style,
3858
3858
  "transform-origin",
3859
3859
  `${c}px ${u}px`
3860
- ), w(
3860
+ ), x(
3861
3861
  o.style,
3862
3862
  "transform",
3863
3863
  `scale(${t})`
@@ -3869,7 +3869,7 @@ const Cr = (t, e, n, i, o) => {
3869
3869
  position: g
3870
3870
  });
3871
3871
  }, Me = 200;
3872
- class Mr extends re {
3872
+ class Lr extends re {
3873
3873
  constructor(e) {
3874
3874
  super({
3875
3875
  isZooming: !1,
@@ -3889,7 +3889,7 @@ class Mr extends re {
3889
3889
  c,
3890
3890
  `data-${j}-zooming`,
3891
3891
  this.isControlled ? "false" : "true"
3892
- ), s && this.isControlled && w(
3892
+ ), s && this.isControlled && x(
3893
3893
  a.style,
3894
3894
  "transition",
3895
3895
  `transform ${Me}ms`
@@ -3919,19 +3919,19 @@ class Mr extends re {
3919
3919
  s,
3920
3920
  `data-${j}-zooming`,
3921
3921
  "false"
3922
- )), o?.animate && this.isControlled && w(
3922
+ )), o?.animate && this.isControlled && x(
3923
3923
  r.style,
3924
3924
  "transition",
3925
3925
  `transform ${Me}ms`
3926
- ), this.updateZoom(1, { x: 0, y: 0 }), K(r.style, "transform"), this.mergeCompare({
3926
+ ), this.updateZoom(1, { x: 0, y: 0 }), Q(r.style, "transform"), this.mergeCompare({
3927
3927
  isZooming: !1
3928
3928
  }), $e(o?.animate ? Me : 0).pipe(
3929
3929
  F(() => {
3930
3930
  const a = this.reader.viewport.value.element;
3931
- K(
3931
+ Q(
3932
3932
  a.style,
3933
3933
  "transform-origin"
3934
- ), K(a.style, "transition"), this.isControlled && this.reader.layout();
3934
+ ), Q(a.style, "transition"), this.isControlled && this.reader.layout();
3935
3935
  }),
3936
3936
  M(this.enterSubject)
3937
3937
  );
@@ -3946,13 +3946,13 @@ class Mr extends re {
3946
3946
  this.exitSubject.next(e);
3947
3947
  }
3948
3948
  move(e, n) {
3949
- this.isControlled && (K(this.viewport.element.style, "transition"), this.updateZoom(this.value.currentScale, e, {
3949
+ this.isControlled && (Q(this.viewport.element.style, "transition"), this.updateZoom(this.value.currentScale, e, {
3950
3950
  constraints: n?.constrain === "within-viewport" ? (...i) => Ct(...i, this.reader.viewport) : void 0
3951
3951
  }));
3952
3952
  }
3953
3953
  scaleAt(e, n) {
3954
3954
  if (!this.value.isZooming) return;
3955
- K(this.viewport.element.style, "transition");
3955
+ Q(this.viewport.element.style, "transition");
3956
3956
  const o = Math.ceil(e * 100) / 100;
3957
3957
  this.updateZoom(o, void 0, {
3958
3958
  constraints: n?.constrain === "within-viewport" ? (...r) => Ct(...r, this.reader.viewport) : void 0
@@ -3960,7 +3960,7 @@ class Mr extends re {
3960
3960
  }
3961
3961
  updateZoom(e, n, i) {
3962
3962
  if (this.isControlled) {
3963
- const o = n || Pr(
3963
+ const o = n || $r(
3964
3964
  this.value.currentScale,
3965
3965
  e,
3966
3966
  this.viewport.element,
@@ -3976,11 +3976,11 @@ class Mr extends re {
3976
3976
  });
3977
3977
  }
3978
3978
  applyZoom(e, n) {
3979
- this.isControlled ? xr(
3979
+ this.isControlled ? Pr(
3980
3980
  e,
3981
3981
  n,
3982
3982
  this.viewport.element
3983
- ) : Fr(e, this.reader), this.reader.viewport.layout();
3983
+ ) : Mr(e, this.reader), this.reader.viewport.layout();
3984
3984
  }
3985
3985
  get isControlled() {
3986
3986
  return this.reader.settings.values.computedPageTurnMode === "controlled";
@@ -3992,8 +3992,8 @@ class Mr extends re {
3992
3992
  return this.reader.viewport.value;
3993
3993
  }
3994
3994
  }
3995
- const Lr = (t) => (e) => {
3996
- const n = t(e), i = new Mr(n), o = () => {
3995
+ const Ar = (t) => (e) => {
3996
+ const n = t(e), i = new Lr(n), o = () => {
3997
3997
  i.destroy(), n.destroy();
3998
3998
  }, r = i;
3999
3999
  return {
@@ -4019,7 +4019,7 @@ const Lr = (t) => (e) => {
4019
4019
  item: n
4020
4020
  }) => {
4021
4021
  const i = "ownerDocument" in t ? t.ownerDocument : t.startContainer.ownerDocument;
4022
- return !i?.documentElement || t === i ? ln(n) : ci(t) ? qe({
4022
+ return !i?.documentElement || t === i ? ln(n) : ui(t) ? qe({
4023
4023
  start: {
4024
4024
  node: t.startContainer,
4025
4025
  offset: t.startOffset,
@@ -4038,7 +4038,7 @@ const Lr = (t) => (e) => {
4038
4038
  spineIndex: n.index,
4039
4039
  spineId: n.id
4040
4040
  });
4041
- }, Ar = ({
4041
+ }, Nr = ({
4042
4042
  spineItem: t,
4043
4043
  pageNode: e
4044
4044
  }) => pn({
@@ -4048,17 +4048,17 @@ const Lr = (t) => (e) => {
4048
4048
  }).trim(), Er = (t, e) => pn({
4049
4049
  nodeOrRange: t,
4050
4050
  item: e
4051
- }), oa = (t) => t.index.toString(), Mt = (t) => t[0]?.index === 6 && t.length > 1, Nr = (t) => {
4051
+ }), ra = (t) => t.index.toString(), Mt = (t) => t[0]?.index === 6 && t.length > 1, Rr = (t) => {
4052
4052
  const e = Bt(t);
4053
- return Xn(e);
4054
- }, Rr = (t) => Array.isArray(t) ? t[0] && Mt(t[0]) ? t[0] : void 0 : t.parent[0] && Mt(t.parent[0]) ? t.parent[0] : void 0, gn = (t) => {
4055
- const e = Bt(t), r = ((Rr(e) ?? [])[1]?.index ?? 2) / 2 - 1, s = Yn(e), a = s ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
4053
+ return Yn(e);
4054
+ }, Dr = (t) => Array.isArray(t) ? t[0] && Mt(t[0]) ? t[0] : void 0 : t.parent[0] && Mt(t.parent[0]) ? t.parent[0] : void 0, gn = (t) => {
4055
+ const e = Bt(t), r = ((Dr(e) ?? [])[1]?.index ?? 2) / 2 - 1, s = Gn(e), a = s ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
4056
4056
  return {
4057
4057
  isCfiRange: s,
4058
4058
  itemIndex: r,
4059
4059
  offset: a ?? 0
4060
4060
  };
4061
- }, Dr = ({
4061
+ }, Or = ({
4062
4062
  cfi: t,
4063
4063
  spineItemsManager: e
4064
4064
  }) => {
@@ -4074,7 +4074,7 @@ const Lr = (t) => (e) => {
4074
4074
  const s = r.contentWindow?.document;
4075
4075
  if (s)
4076
4076
  try {
4077
- const a = Gn(t, s, {
4077
+ const a = Zn(t, s, {
4078
4078
  throwOnError: !0
4079
4079
  });
4080
4080
  return {
@@ -4102,7 +4102,7 @@ const Lr = (t) => (e) => {
4102
4102
  node: null
4103
4103
  };
4104
4104
  };
4105
- class Or {
4105
+ class Vr {
4106
4106
  constructor(e, n) {
4107
4107
  this.hookManager = e, this.spineItemsManager = n, this.transformForResolve = (i) => {
4108
4108
  const { finalParams: o } = this.hookManager.executeSequential(
@@ -4117,19 +4117,19 @@ class Or {
4117
4117
  const { itemIndex: o } = this.parseCfi(i);
4118
4118
  if (o !== void 0)
4119
4119
  return this.spineItemsManager.get(o);
4120
- }, this.isRootCfi = (i) => Nr(i), this.generateRootCfi = (i) => this.transformGeneratedCfi({
4120
+ }, this.isRootCfi = (i) => Rr(i), this.generateRootCfi = (i) => this.transformGeneratedCfi({
4121
4121
  cfi: ln(i),
4122
4122
  spineItem: i
4123
4123
  }), this.generateCfiForSpineItemPage = ({
4124
4124
  spineItem: i,
4125
4125
  pageNode: o
4126
4126
  }) => this.transformGeneratedCfi({
4127
- cfi: Ar({ spineItem: i, pageNode: o }),
4127
+ cfi: Nr({ spineItem: i, pageNode: o }),
4128
4128
  spineItem: i
4129
4129
  }), this.generateCfiFromRange = (i, o) => this.transformGeneratedCfi({
4130
4130
  cfi: Er(i, o),
4131
4131
  spineItem: o
4132
- }), this.resolveCfi = (i) => Dr({
4132
+ }), this.resolveCfi = (i) => Or({
4133
4133
  ...i,
4134
4134
  cfi: this.transformForResolve(i.cfi),
4135
4135
  spineItemsManager: this.spineItemsManager
@@ -4150,21 +4150,21 @@ class Or {
4150
4150
  const hn = (t) => t?.spineItems.every(
4151
4151
  (e) => (e.renditionLayout ?? t.renditionLayout) === "pre-paginated"
4152
4152
  );
4153
- class Vr {
4153
+ class kr {
4154
4154
  constructor() {
4155
- this.navigationSubject = new ke(1), this.positionSubject = new ke(1), this.viewportStateSubject = new ee("free"), this.paginationSubject = new ke(1), this.pagination$ = this.paginationSubject.asObservable(), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
4155
+ this.navigationSubject = new ke(1), this.positionSubject = new ke(1), this.viewportStateSubject = new te("free"), this.paginationSubject = new ke(1), this.pagination$ = this.paginationSubject.asObservable(), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
4156
4156
  L((e) => e === "free")
4157
4157
  ), this.viewportBusy$ = this.viewportState$.pipe(
4158
4158
  L((e) => e === "busy")
4159
4159
  ), this.navigation$ = this.navigationSubject.asObservable(), this.position$ = this.positionSubject.asObservable();
4160
4160
  }
4161
4161
  }
4162
- class kr extends re {
4162
+ class jr extends re {
4163
4163
  constructor() {
4164
4164
  super({
4165
4165
  assumedRenditionLayout: "reflowable"
4166
- }), this.bridgeEvent = new Vr(), this.manifest$ = this.pipe(
4167
- pe((e) => e.manifest),
4166
+ }), this.bridgeEvent = new kr(), this.manifest$ = this.pipe(
4167
+ ge((e) => e.manifest),
4168
4168
  fe(ie),
4169
4169
  Oe()
4170
4170
  ), this.isRTL = () => this.value.manifest?.readingDirection === "rtl";
@@ -4187,7 +4187,7 @@ class kr extends re {
4187
4187
  return this.manifest?.readingDirection;
4188
4188
  }
4189
4189
  }
4190
- class jr extends re {
4190
+ class Ur extends re {
4191
4191
  constructor(e, n) {
4192
4192
  super({
4193
4193
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -4204,7 +4204,7 @@ class jr extends re {
4204
4204
  renditionLayout: i?.renditionLayout,
4205
4205
  computedPageTurnMode: r
4206
4206
  })),
4207
- N(U),
4207
+ E(U),
4208
4208
  S(
4209
4209
  ({
4210
4210
  hasVerticalWriting: i,
@@ -4222,7 +4222,7 @@ class jr extends re {
4222
4222
  ).subscribe(this.next.bind(this));
4223
4223
  }
4224
4224
  }
4225
- class Ur {
4225
+ class zr {
4226
4226
  constructor() {
4227
4227
  this._hooks = [], this._hookExecutions = [];
4228
4228
  }
@@ -4354,19 +4354,19 @@ class Ur {
4354
4354
  return _(r);
4355
4355
  }
4356
4356
  }
4357
- const zr = "[data-prose-reader-spine-item][data-is-ready=false]{pointer-events:none;user-select:none;-webkit-user-select:none}.prose-reader-enhancer-loading-container{height:100%;width:100%;max-width:var(--prose-reader-absolute-viewport-width, 100%);text-align:center;display:flex;justify-content:center;align-items:center;flex-direction:column;position:absolute;left:0;top:0;color:#cacaca;background-color:#fff;z-index:1}[data-prose-reader-spine-item][data-is-ready=true] .prose-reader-enhancer-loading-container{visibility:hidden;z-index:0}.prose-reader-enhancer-loading-logo{font-size:4em}.prose-reader-enhancer-loading-details{font-size:1.2em;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:300px;width:80%}[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}[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%}", _r = (t) => ({
4357
+ const _r = "[data-prose-reader-spine-item][data-is-ready=false]{pointer-events:none;user-select:none;-webkit-user-select:none}.prose-reader-enhancer-loading-container{height:100%;width:100%;max-width:var(--prose-reader-absolute-viewport-width, 100%);text-align:center;display:flex;justify-content:center;align-items:center;flex-direction:column;position:absolute;left:0;top:0;color:#cacaca;background-color:#fff;z-index:1}[data-prose-reader-spine-item][data-is-ready=true] .prose-reader-enhancer-loading-container{visibility:hidden;z-index:0}.prose-reader-enhancer-loading-logo{font-size:4em}.prose-reader-enhancer-loading-details{font-size:1.2em;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;max-width:300px;width:80%}[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}[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%}", Wr = (t) => ({
4358
4358
  x: -t.x,
4359
4359
  y: -t.y
4360
- }), Wr = (t) => t instanceof DOMMatrix ? new V({
4360
+ }), Br = (t) => t instanceof DOMMatrix ? new V({
4361
4361
  x: -t.e,
4362
4362
  y: -t.f
4363
4363
  }) : new V({
4364
4364
  x: -t.x,
4365
4365
  y: -t.y
4366
- }), Br = "navigation/ControlledNavigationController", Lt = A.namespace(Br);
4367
- class Hr extends Z {
4366
+ }), Hr = "navigation/ControlledNavigationController", Lt = A.namespace(Hr);
4367
+ class qr extends J {
4368
4368
  constructor(e, n, i, o, r) {
4369
- super(), this.settings = e, this.hookManager = n, this.context = i, this.spine = o, this.viewport = r, this.navigateSubject = new k(), this.element$ = new ee(
4369
+ super(), this.settings = e, this.hookManager = n, this.context = i, this.spine = o, this.viewport = r, this.navigateSubject = new k(), this.element$ = new te(
4370
4370
  document.createElement("div")
4371
4371
  ), this.isActive = () => this.settings.values.computedPageTurnMode === "controlled", this.getNavigationVisibleArea = () => this.viewport.absoluteViewport;
4372
4372
  const s = this.spine.element$.pipe(
@@ -4388,7 +4388,7 @@ class Hr extends Z {
4388
4388
  this.element$
4389
4389
  ]).pipe(
4390
4390
  F(([, u]) => {
4391
- e.values.computedPageTurnMode === "scrollable" ? w(u.style, "display", "contents") : w(u.style, "display", "block");
4391
+ e.values.computedPageTurnMode === "scrollable" ? x(u.style, "display", "contents") : x(u.style, "display", "block");
4392
4392
  })
4393
4393
  );
4394
4394
  this.layout$ = c.pipe(
@@ -4397,7 +4397,7 @@ class Hr extends Z {
4397
4397
  }),
4398
4398
  R()
4399
4399
  ), this.isNavigating$ = this.navigateSubject.pipe(
4400
- N((u, d) => U(u.position, d.position)),
4400
+ E((u, d) => U(u.position, d.position)),
4401
4401
  S(({ animation: u, position: d }) => (Lt.info("Navigation requested", { animation: u, position: d }), {
4402
4402
  type: "manualAdjust",
4403
4403
  shouldAnimate: !(!u || u === "turn" && e.values.computedPageTurnAnimation === "none"),
@@ -4406,7 +4406,7 @@ class Hr extends Z {
4406
4406
  })),
4407
4407
  $((u) => {
4408
4408
  const d = this.element$.getValue();
4409
- return w(d.style, "transition", "none"), w(d.style, "opacity", "1"), C(
4409
+ return x(d.style, "transition", "none"), x(d.style, "opacity", "1"), C(
4410
4410
  P(!0),
4411
4411
  P(null).pipe(
4412
4412
  Se(() => {
@@ -4421,22 +4421,22 @@ class Hr extends Z {
4421
4421
  * anything for x ms while we effectively adjust. We want it to be immediate.
4422
4422
  * However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
4423
4423
  */
4424
- u.shouldAnimate ? Ee(1, xe) : Pe,
4424
+ u.shouldAnimate ? Ne(1, xe) : Pe,
4425
4425
  F((h) => {
4426
4426
  const p = this.element$.getValue();
4427
- h.shouldAnimate ? g === "fade" ? (w(
4427
+ h.shouldAnimate ? g === "fade" ? (x(
4428
4428
  p.style,
4429
4429
  "transition",
4430
4430
  `opacity ${l / 2}ms`
4431
- ), w(p.style, "opacity", "0")) : (u.animation === "snap" || g === "slide") && (w(
4431
+ ), x(p.style, "opacity", "0")) : (u.animation === "snap" || g === "slide") && (x(
4432
4432
  p.style,
4433
4433
  "transition",
4434
4434
  `transform ${l}ms`
4435
- ), w(p.style, "opacity", "1")) : (w(
4435
+ ), x(p.style, "opacity", "1")) : (x(
4436
4436
  p.style,
4437
4437
  "transition",
4438
4438
  "none"
4439
- ), w(p.style, "opacity", "1"));
4439
+ ), x(p.style, "opacity", "1"));
4440
4440
  }),
4441
4441
  /**
4442
4442
  * @important
@@ -4449,12 +4449,12 @@ class Hr extends Z {
4449
4449
  F((h) => {
4450
4450
  g !== "fade" && this.applyNavigationPosition(h.position);
4451
4451
  }),
4452
- u.shouldAnimate ? Ee(l / 2, xe) : Pe,
4452
+ u.shouldAnimate ? Ne(l / 2, xe) : Pe,
4453
4453
  F((h) => {
4454
4454
  const p = this.element$.getValue();
4455
- g === "fade" && (this.applyNavigationPosition(h.position), w(p.style, "opacity", "1"));
4455
+ g === "fade" && (this.applyNavigationPosition(h.position), x(p.style, "opacity", "1"));
4456
4456
  }),
4457
- u.shouldAnimate ? Ee(l / 2, xe) : Pe,
4457
+ u.shouldAnimate ? Ne(l / 2, xe) : Pe,
4458
4458
  F((h) => {
4459
4459
  g === "fade" && this.applyNavigationPosition(h.position);
4460
4460
  })
@@ -4465,7 +4465,7 @@ class Hr extends Z {
4465
4465
  );
4466
4466
  }),
4467
4467
  Ie(!1),
4468
- G(1)
4468
+ Z(1)
4469
4469
  ), C(s, this.isNavigating$, this.layout$).pipe(M(this.destroy$)).subscribe();
4470
4470
  }
4471
4471
  /**
@@ -4477,8 +4477,8 @@ class Hr extends Z {
4477
4477
  * for remark about flicker / fonts smoothing
4478
4478
  */
4479
4479
  applyNavigationPosition(e) {
4480
- const n = this.element$.getValue(), i = _r(e);
4481
- w(
4480
+ const n = this.element$.getValue(), i = Wr(e);
4481
+ x(
4482
4482
  n.style,
4483
4483
  "transform",
4484
4484
  `translate(${i.x}px, ${i.y}px)`
@@ -4496,10 +4496,10 @@ class Hr extends Z {
4496
4496
  if (!i || i === "none")
4497
4497
  return new V({ x: 0, y: 0 });
4498
4498
  const o = new DOMMatrix(i);
4499
- return Wr(o);
4499
+ return Br(o);
4500
4500
  }
4501
4501
  }
4502
- const qr = () => (t) => t.pipe(
4502
+ const Xr = () => (t) => t.pipe(
4503
4503
  S(({ navigation: e, pagination: n, ...i }) => ({
4504
4504
  navigation: {
4505
4505
  ...e,
@@ -4507,7 +4507,7 @@ const qr = () => (t) => t.pipe(
4507
4507
  },
4508
4508
  ...i
4509
4509
  }))
4510
- ), Xr = (t, e, n) => t.bridgeEvent.pagination$.pipe(
4510
+ ), Yr = (t, e, n) => t.bridgeEvent.pagination$.pipe(
4511
4511
  H(e),
4512
4512
  L(
4513
4513
  ([i, o]) => i.navigationId === o.id
@@ -4524,8 +4524,8 @@ const qr = () => (t) => t.pipe(
4524
4524
  navigation: o
4525
4525
  }))
4526
4526
  )),
4527
- qr(),
4528
- N(
4527
+ Xr(),
4528
+ E(
4529
4529
  (i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
4530
4530
  ),
4531
4531
  S(
@@ -4537,7 +4537,7 @@ const qr = () => (t) => t.pipe(
4537
4537
  requestedPosition: i.position
4538
4538
  })
4539
4539
  )
4540
- ), Yr = ({
4540
+ ), Gr = ({
4541
4541
  navigationResolver: t,
4542
4542
  getNavigationVisibleArea: e
4543
4543
  }) => (n) => n.pipe(
@@ -4570,7 +4570,7 @@ const qr = () => (t) => t.pipe(
4570
4570
  navigation: c
4571
4571
  };
4572
4572
  })
4573
- ), Gr = ({ navigationResolver: t }) => (e) => e.pipe(
4573
+ ), Zr = ({ navigationResolver: t }) => (e) => e.pipe(
4574
4574
  S((n) => {
4575
4575
  if (n.navigation.cfi) {
4576
4576
  const i = t.getNavigationForCfi(
@@ -4587,16 +4587,16 @@ const qr = () => (t) => t.pipe(
4587
4587
  }
4588
4588
  return n;
4589
4589
  })
4590
- ), Zr = ({
4590
+ ), Jr = ({
4591
4591
  navigation: t,
4592
4592
  previousNavigation: e,
4593
4593
  settings: n
4594
- }) => t.directionFromLastNavigation ? t.directionFromLastNavigation : t.url !== void 0 || t.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || t.spineItem || !t.position ? "forward" : n.values.computedPageTurnDirection === "vertical" ? t.position.y > e.position.y || t.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(t.position.x) > Math.abs(e.position.x) || t.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Jr = ({
4594
+ }) => t.directionFromLastNavigation ? t.directionFromLastNavigation : t.url !== void 0 || t.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || t.spineItem || !t.position ? "forward" : n.values.computedPageTurnDirection === "vertical" ? t.position.y > e.position.y || t.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(t.position.x) > Math.abs(e.position.x) || t.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Kr = ({
4595
4595
  context: t,
4596
4596
  settings: e
4597
4597
  }) => (n) => n.pipe(
4598
4598
  S(({ navigation: i, previousNavigation: o }) => {
4599
- const r = Zr({
4599
+ const r = Jr({
4600
4600
  navigation: i,
4601
4601
  previousNavigation: o,
4602
4602
  settings: e
@@ -4610,7 +4610,7 @@ const qr = () => (t) => t.pipe(
4610
4610
  direction: r
4611
4611
  };
4612
4612
  })
4613
- ), Kr = ({
4613
+ ), Qr = ({
4614
4614
  spineItemsManager: t,
4615
4615
  navigationResolver: e,
4616
4616
  settings: n,
@@ -4689,20 +4689,20 @@ const qr = () => (t) => t.pipe(
4689
4689
  restrictToScreen: !1
4690
4690
  }) ?? {}, f = (l === "forward" || l === "anchor" ? m : p) ?? p, y = e.get(f);
4691
4691
  if (!y) return;
4692
- const { endPageIndex: x, beginPageIndex: v } = i.getVisiblePagesFromViewportPosition({
4692
+ const { endPageIndex: v, beginPageIndex: w } = i.getVisiblePagesFromViewportPosition({
4693
4693
  position: c,
4694
4694
  spineItem: y,
4695
4695
  threshold: g,
4696
4696
  restrictToScreen: !1
4697
- }) ?? {}, b = (l === "forward" || l === "anchor" ? x : v) ?? 0, T = n.getNavigationForSpineItemPage({
4697
+ }) ?? {}, b = (l === "forward" || l === "anchor" ? v : w) ?? 0, T = n.getNavigationForSpineItemPage({
4698
4698
  pageIndex: b,
4699
4699
  spineItemId: y
4700
4700
  }), I = i.getVisibleSpineItemsFromPosition({
4701
4701
  position: T,
4702
4702
  threshold: g,
4703
4703
  restrictToScreen: !1
4704
- }), E = l === "forward" || l === "anchor" ? I?.beginIndex : I?.endIndex;
4705
- return e.get(E);
4704
+ }), N = l === "forward" || l === "anchor" ? I?.beginIndex : I?.endIndex;
4705
+ return e.get(N);
4706
4706
  }
4707
4707
  return c && h === "scrollable" ? i.getSpineItemFromPosition(c) : e.get(0);
4708
4708
  };
@@ -4718,7 +4718,7 @@ const qr = () => (t) => t.pipe(
4718
4718
  };
4719
4719
  })
4720
4720
  );
4721
- }, Et = ({ spine: t }) => (e) => e.pipe(
4721
+ }, Nt = ({ spine: t }) => (e) => e.pipe(
4722
4722
  $(({ navigation: n, ...i }) => {
4723
4723
  const o = t.getSpineItemSpineLayoutInfo(
4724
4724
  n.spineItem
@@ -4785,7 +4785,7 @@ const qr = () => (t) => t.pipe(
4785
4785
  ...a
4786
4786
  }))
4787
4787
  );
4788
- }, Qr = ({ navigationResolver: t }) => (e) => e.pipe(
4788
+ }, es = ({ navigationResolver: t }) => (e) => e.pipe(
4789
4789
  S((n) => {
4790
4790
  if (n.navigation.url) {
4791
4791
  const i = t.getNavigationForUrl(
@@ -4806,9 +4806,9 @@ const qr = () => (t) => t.pipe(
4806
4806
  );
4807
4807
  class mn {
4808
4808
  constructor() {
4809
- this.isLockedSubject = new ee(0), this.isLocked$ = this.isLockedSubject.pipe(
4809
+ this.isLockedSubject = new te(0), this.isLocked$ = this.isLockedSubject.pipe(
4810
4810
  S((e) => !!e),
4811
- N()
4811
+ E()
4812
4812
  );
4813
4813
  }
4814
4814
  lock() {
@@ -4818,7 +4818,7 @@ class mn {
4818
4818
  };
4819
4819
  }
4820
4820
  }
4821
- const es = ({
4821
+ const ts = ({
4822
4822
  spineLocator: t,
4823
4823
  navigation: e,
4824
4824
  navigationResolver: n,
@@ -4876,7 +4876,7 @@ const es = ({
4876
4876
  return u ? n.getNavigationForPosition(e.position) : n.getNavigationForSpineIndexOrId(s);
4877
4877
  })
4878
4878
  ) : P(new V({ x: 0, y: 0 }));
4879
- }, ts = ({
4879
+ }, ns = ({
4880
4880
  navigation: t,
4881
4881
  spineLocator: e,
4882
4882
  spineItemsManager: n,
@@ -4945,7 +4945,7 @@ const es = ({
4945
4945
  }
4946
4946
  }
4947
4947
  return t.position;
4948
- }, ns = ({
4948
+ }, is = ({
4949
4949
  navigation: t,
4950
4950
  spineItemsManager: e,
4951
4951
  settings: n,
@@ -4954,7 +4954,7 @@ const es = ({
4954
4954
  spine: r,
4955
4955
  cfiManager: s
4956
4956
  }) => n.values.computedPageTurnMode === "scrollable" ? P(
4957
- ts({
4957
+ ns({
4958
4958
  navigation: t,
4959
4959
  spineLocator: i,
4960
4960
  navigationResolver: o,
@@ -4962,21 +4962,21 @@ const es = ({
4962
4962
  spineItemsManager: e,
4963
4963
  spine: r
4964
4964
  })
4965
- ) : es({
4965
+ ) : ts({
4966
4966
  navigation: t,
4967
4967
  spineLocator: i,
4968
4968
  navigationResolver: o,
4969
4969
  spineItemsManager: e,
4970
4970
  spine: r,
4971
4971
  cfiManager: s
4972
- }), Nt = ({
4972
+ }), Et = ({
4973
4973
  settings: t,
4974
4974
  navigationResolver: e,
4975
4975
  context: n,
4976
4976
  spine: i,
4977
4977
  cfiManager: o
4978
4978
  }) => (r) => r.pipe(
4979
- $((s) => ns({
4979
+ $((s) => is({
4980
4980
  spineLocator: i.locator,
4981
4981
  navigation: s.navigation,
4982
4982
  navigationResolver: e,
@@ -4994,10 +4994,10 @@ const es = ({
4994
4994
  }
4995
4995
  }))
4996
4996
  ))
4997
- ), is = "navigation/InternalNavigator", os = A.namespace(is), Rt = (t, e) => t === e || !!t && !!e && t.x === e.x && t.y === e.y, rs = (t, e) => t === e || !!t && !!e && t.width === e.width && t.height === e.height, ss = (t, e) => t.id === e.id && Rt(t.position, e.position) && Rt(t.requestedPosition, e.requestedPosition) && rs(t.requestedVisibleArea, e.requestedVisibleArea);
4998
- class as extends Z {
4997
+ ), os = "navigation/InternalNavigator", rs = A.namespace(os), Rt = (t, e) => t === e || !!t && !!e && t.x === e.x && t.y === e.y, ss = (t, e) => t === e || !!t && !!e && t.width === e.width && t.height === e.height, as = (t, e) => t.id === e.id && Rt(t.position, e.position) && Rt(t.requestedPosition, e.requestedPosition) && ss(t.requestedVisibleArea, e.requestedVisibleArea);
4998
+ class cs extends J {
4999
4999
  constructor(e, n, i, o, r, s, a, c, u, d) {
5000
- super(), this.settings = e, this.context = n, this.userNavigation$ = i, this.getActiveNavigationModeController = o, this.navigationModeLayout$ = r, this.navigationResolver = s, this.spine = a, this.viewport = c, this.cfiManager = u, this.isUserInteractionLocked$ = d, this.navigationSubject = new ee({
5000
+ super(), this.settings = e, this.context = n, this.userNavigation$ = i, this.getActiveNavigationModeController = o, this.navigationModeLayout$ = r, this.navigationResolver = s, this.spine = a, this.viewport = c, this.cfiManager = u, this.isUserInteractionLocked$ = d, this.navigationSubject = new te({
5001
5001
  animation: !1,
5002
5002
  position: new V({ x: 0, y: 0 }),
5003
5003
  meta: {
@@ -5008,19 +5008,19 @@ class as extends Z {
5008
5008
  type: "api",
5009
5009
  id: /* @__PURE__ */ Symbol("init")
5010
5010
  }), this.navigation$ = this.navigationSubject.pipe(
5011
- S(({ position: b, id: T, requestedPosition: I, requestedVisibleArea: E, meta: X }) => ({
5011
+ S(({ position: b, id: T, requestedPosition: I, requestedVisibleArea: N, meta: X }) => ({
5012
5012
  position: b,
5013
5013
  id: T,
5014
5014
  requestedPosition: I,
5015
- requestedVisibleArea: E,
5015
+ requestedVisibleArea: N,
5016
5016
  triggeredBy: X.triggeredBy
5017
5017
  })),
5018
- N(ss),
5019
- G(1)
5018
+ E(as),
5019
+ Z(1)
5020
5020
  ), this.locker = new mn();
5021
5021
  const l = () => o().getNavigationVisibleArea(), g = i.pipe(
5022
5022
  H(this.navigationSubject),
5023
- Yr({
5023
+ Gr({
5024
5024
  navigationResolver: s,
5025
5025
  getNavigationVisibleArea: l
5026
5026
  }),
@@ -5028,17 +5028,17 @@ class as extends Z {
5028
5028
  * Url lookup is heavier so we start with it to fill
5029
5029
  * as much information as needed to reduce later lookup
5030
5030
  */
5031
- Qr({
5031
+ es({
5032
5032
  navigationResolver: s
5033
5033
  }),
5034
5034
  /**
5035
5035
  * Cfi lookup is heavier so we start with it to fill
5036
5036
  * as much information as needed to reduce later lookup
5037
5037
  */
5038
- Gr({
5038
+ Zr({
5039
5039
  navigationResolver: s
5040
5040
  }),
5041
- Jr({ context: n, settings: e }),
5041
+ Kr({ context: n, settings: e }),
5042
5042
  At({
5043
5043
  cfi: u,
5044
5044
  navigationResolver: s,
@@ -5052,11 +5052,11 @@ class as extends Z {
5052
5052
  spineItemsManager: a.spineItemsManager,
5053
5053
  spineLocator: a.locator
5054
5054
  }),
5055
- Et({
5055
+ Nt({
5056
5056
  spine: a
5057
5057
  })
5058
5058
  ).pipe(
5059
- Kr({
5059
+ Qr({
5060
5060
  navigationResolver: s,
5061
5061
  spineItemsManager: a.spineItemsManager,
5062
5062
  settings: e,
@@ -5066,7 +5066,7 @@ class as extends Z {
5066
5066
  $(([b, T]) => {
5067
5067
  const I = b.navigation.cfi || b.navigation.url || e.values.computedPageTurnMode === "scrollable" || T;
5068
5068
  return P(b).pipe(
5069
- I ? Pe : Nt({
5069
+ I ? Pe : Et({
5070
5070
  navigationResolver: s,
5071
5071
  settings: e,
5072
5072
  spine: a,
@@ -5134,7 +5134,7 @@ class as extends Z {
5134
5134
  p,
5135
5135
  h
5136
5136
  ).pipe(
5137
- Nt({
5137
+ Et({
5138
5138
  navigationResolver: s,
5139
5139
  settings: e,
5140
5140
  context: n,
@@ -5160,7 +5160,7 @@ class as extends Z {
5160
5160
  spineItemsManager: a.spineItemsManager,
5161
5161
  spineLocator: a.locator
5162
5162
  }),
5163
- Et({
5163
+ Nt({
5164
5164
  spine: a
5165
5165
  }),
5166
5166
  We({
@@ -5171,7 +5171,7 @@ class as extends Z {
5171
5171
  }),
5172
5172
  S(({ navigation: b }) => b),
5173
5173
  R()
5174
- ), f = Xr(
5174
+ ), f = Yr(
5175
5175
  n,
5176
5176
  this.navigationSubject,
5177
5177
  a
@@ -5179,9 +5179,9 @@ class as extends Z {
5179
5179
  m,
5180
5180
  g,
5181
5181
  f
5182
- ), x = (b) => b.pipe(
5182
+ ), v = (b) => b.pipe(
5183
5183
  F(([T, I]) => {
5184
- os.info(
5184
+ rs.info(
5185
5185
  `navigation updated from ${T.meta.triggeredBy} of type ${T.type}`,
5186
5186
  {
5187
5187
  previousNavigation: I,
@@ -5189,10 +5189,10 @@ class as extends Z {
5189
5189
  }
5190
5190
  ), this.navigationSubject.next(T);
5191
5191
  })
5192
- ), v = (b) => b.pipe(
5192
+ ), w = (b) => b.pipe(
5193
5193
  F(([T]) => {
5194
- const I = T.type === "scroll", E = T.meta.triggeredBy === "pagination", X = T.meta.triggeredBy === "restoration";
5195
- if (I && !X || E) return;
5194
+ const I = T.type === "scroll", N = T.meta.triggeredBy === "pagination", X = T.meta.triggeredBy === "restoration";
5195
+ if (I && !X || N) return;
5196
5196
  const Y = {
5197
5197
  position: T.position,
5198
5198
  animation: T.animation
@@ -5208,8 +5208,8 @@ class as extends Z {
5208
5208
  * We need to start navigation before notifying navigation change, this
5209
5209
  * keeps navigationState sync and avoids a "free" ping in between.
5210
5210
  */
5211
+ w,
5211
5212
  v,
5212
- x,
5213
5213
  M(this.destroy$)
5214
5214
  ).subscribe();
5215
5215
  }
@@ -5226,7 +5226,7 @@ const Re = (t, e, n) => {
5226
5226
  }, Dt = (t, e, n) => {
5227
5227
  const i = [...Array(n)].map((o, r) => r * e);
5228
5228
  return t <= 0 || n === 0 ? 0 : t >= n * e ? n - 1 : i.findIndex((o) => t < o + e) ?? 0;
5229
- }, cs = ({
5229
+ }, us = ({
5230
5230
  itemWidth: t,
5231
5231
  itemHeight: e,
5232
5232
  spineItemPosition: n
@@ -5252,7 +5252,7 @@ const Re = (t, e, n) => {
5252
5252
  pageTurnMode: a,
5253
5253
  isRTL: c
5254
5254
  }) => {
5255
- const d = cs({
5255
+ const d = us({
5256
5256
  spineItemPosition: n,
5257
5257
  itemHeight: e,
5258
5258
  itemWidth: t
@@ -5269,7 +5269,7 @@ const Re = (t, e, n) => {
5269
5269
  return Dt(n.y, r, l);
5270
5270
  const g = Dt(d, o, l);
5271
5271
  return c ? l - 1 - g : g;
5272
- }, us = ({
5272
+ }, ds = ({
5273
5273
  pageIndex: t,
5274
5274
  itemLayout: e,
5275
5275
  context: n,
@@ -5306,7 +5306,7 @@ const Re = (t, e, n) => {
5306
5306
  }) => {
5307
5307
  const i = (a, c, u) => {
5308
5308
  let d;
5309
- a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? d = a.getBoundingClientRect().x : a && (d = (a ? ni(a, c) : void 0)?.getBoundingClientRect().x || d);
5309
+ a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? d = a.getBoundingClientRect().x : a && (d = (a ? ii(a, c) : void 0)?.getBoundingClientRect().x || d);
5310
5310
  const l = u.layoutInfo?.width || 0, g = n.pageSize.width;
5311
5311
  if (d !== void 0) {
5312
5312
  const h = Be(
@@ -5322,7 +5322,7 @@ const Re = (t, e, n) => {
5322
5322
  getSpineItemPositionFromPageIndex: ({
5323
5323
  pageIndex: a,
5324
5324
  spineItem: c
5325
- }) => us({
5325
+ }) => ds({
5326
5326
  context: t,
5327
5327
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
5328
5328
  itemLayout: c.layoutInfo,
@@ -5393,7 +5393,7 @@ const Re = (t, e, n) => {
5393
5393
  });
5394
5394
  }
5395
5395
  };
5396
- }, ds = ({
5396
+ }, ls = ({
5397
5397
  context: t,
5398
5398
  settings: e,
5399
5399
  viewport: n
@@ -5463,7 +5463,7 @@ const Re = (t, e, n) => {
5463
5463
  if (!r) return new O({ x: 0, y: 0 });
5464
5464
  const s = Math.min(Math.max(r.yMin, t.y), r.yMax), a = n ? Math.max(r.xMin, Math.min(r.xMax, t.x)) : Math.min(Math.max(r.xMin, t.x), r.xMax);
5465
5465
  return new O({ x: a, y: s });
5466
- }, ls = ({
5466
+ }, ps = ({
5467
5467
  position: t,
5468
5468
  size: e,
5469
5469
  isRTL: n,
@@ -5519,7 +5519,7 @@ const Re = (t, e, n) => {
5519
5519
  });
5520
5520
  }
5521
5521
  return new V({ x: 0, y: 0 });
5522
- }, ps = ({
5522
+ }, gs = ({
5523
5523
  pageIndex: t,
5524
5524
  spineItemsManager: e,
5525
5525
  spineItemId: n,
@@ -5549,7 +5549,7 @@ const Re = (t, e, n) => {
5549
5549
  pageSizeWidth: r.pageSize.width,
5550
5550
  visibleAreaRectWidth: r.absoluteViewport.width
5551
5551
  });
5552
- }, gs = (t, e) => {
5552
+ }, hs = (t, e) => {
5553
5553
  if (e && e instanceof HTMLIFrameElement) {
5554
5554
  const n = e.contentDocument, i = t.trim();
5555
5555
  if (!n || i.length === 0)
@@ -5564,23 +5564,23 @@ const Re = (t, e, n) => {
5564
5564
  return;
5565
5565
  }
5566
5566
  }
5567
- }, hs = ({
5567
+ }, ms = ({
5568
5568
  anchor: t,
5569
5569
  spineItem: e,
5570
5570
  spine: n
5571
5571
  }) => {
5572
- const i = gs(
5572
+ const i = hs(
5573
5573
  t,
5574
5574
  e.renderer.getDocumentFrame()
5575
5575
  );
5576
5576
  return i ? n.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
5577
- }, ms = ({
5577
+ }, fs = ({
5578
5578
  anchor: t,
5579
5579
  spineItem: e,
5580
5580
  spineLocator: n,
5581
5581
  spine: i
5582
5582
  }) => {
5583
- const o = hs({
5583
+ const o = ms({
5584
5584
  anchor: t,
5585
5585
  spineItem: e,
5586
5586
  spine: i
@@ -5589,7 +5589,7 @@ const Re = (t, e, n) => {
5589
5589
  spineItemPosition: new D({ x: o, y: 0 }),
5590
5590
  spineItem: e
5591
5591
  });
5592
- }, fs = ({
5592
+ }, Ss = ({
5593
5593
  anchor: t,
5594
5594
  spineItem: e,
5595
5595
  spineLocator: n,
@@ -5597,7 +5597,7 @@ const Re = (t, e, n) => {
5597
5597
  pageSizeWidth: o,
5598
5598
  visibleAreaRectWidth: r
5599
5599
  }) => {
5600
- const s = ms({
5600
+ const s = fs({
5601
5601
  anchor: t,
5602
5602
  spineItem: e,
5603
5603
  spineLocator: n,
@@ -5608,7 +5608,7 @@ const Re = (t, e, n) => {
5608
5608
  pageSizeWidth: o,
5609
5609
  visibleAreaRectWidth: r
5610
5610
  });
5611
- }, Ss = ({
5611
+ }, ys = ({
5612
5612
  spine: t,
5613
5613
  spineItemsManager: e,
5614
5614
  spineLocator: n,
@@ -5624,7 +5624,7 @@ const Re = (t, e, n) => {
5624
5624
  if (u) {
5625
5625
  const d = e.get(u.id);
5626
5626
  if (d) {
5627
- const l = fs({
5627
+ const l = Ss({
5628
5628
  anchor: a.hash,
5629
5629
  spineItem: d,
5630
5630
  spine: t,
@@ -5647,7 +5647,7 @@ const Re = (t, e, n) => {
5647
5647
  console.error(a);
5648
5648
  return;
5649
5649
  }
5650
- }, ys = ({
5650
+ }, Is = ({
5651
5651
  spineItem: t,
5652
5652
  spineItemPosition: e,
5653
5653
  spineLocator: n,
@@ -5666,7 +5666,7 @@ const Re = (t, e, n) => {
5666
5666
  pageSizeWidth: o.pageSize.width,
5667
5667
  visibleAreaRectWidth: o.absoluteViewport.width
5668
5668
  });
5669
- }, Is = "spineNavigator", bs = ({
5669
+ }, bs = "spineNavigator", vs = ({
5670
5670
  context: t,
5671
5671
  spineItemsManager: e,
5672
5672
  locator: n,
@@ -5675,13 +5675,13 @@ const Re = (t, e, n) => {
5675
5675
  viewport: r,
5676
5676
  cfi: s
5677
5677
  }) => {
5678
- const a = ds({
5678
+ const a = ls({
5679
5679
  context: t,
5680
5680
  settings: i,
5681
5681
  viewport: r
5682
5682
  });
5683
5683
  return {
5684
- getNavigationForUrl: (p) => Ss({
5684
+ getNavigationForUrl: (p) => ys({
5685
5685
  context: t,
5686
5686
  spineItemsManager: e,
5687
5687
  spineLocator: n,
@@ -5690,14 +5690,14 @@ const Re = (t, e, n) => {
5690
5690
  visibleAreaRectWidth: r.absoluteViewport.width,
5691
5691
  spine: o
5692
5692
  }),
5693
- getNavigationForSpineItemPage: (p) => ps({
5693
+ getNavigationForSpineItemPage: (p) => gs({
5694
5694
  ...p,
5695
5695
  spineItemsManager: e,
5696
5696
  spineItemNavigationResolver: a,
5697
5697
  spineLocator: n,
5698
5698
  viewport: r
5699
5699
  }),
5700
- getNavigationFromSpineItemPosition: (p) => ys({
5700
+ getNavigationFromSpineItemPosition: (p) => Is({
5701
5701
  ...p,
5702
5702
  spineItemLocator: n.spineItemLocator,
5703
5703
  spineLocator: n,
@@ -5712,15 +5712,15 @@ const Re = (t, e, n) => {
5712
5712
  cfi: p
5713
5713
  });
5714
5714
  if (!y) {
5715
- A.warn(Is, `unable to detect item id from cfi ${p}`);
5715
+ A.warn(bs, `unable to detect item id from cfi ${p}`);
5716
5716
  return;
5717
5717
  }
5718
- const x = m ? a.getNavigationFromNode(y, m, f) : new D({ x: 0, y: 0 }), v = n.getSpinePositionFromSpineItemPosition({
5719
- spineItemPosition: x,
5718
+ const v = m ? a.getNavigationFromNode(y, m, f) : new D({ x: 0, y: 0 }), w = n.getSpinePositionFromSpineItemPosition({
5719
+ spineItemPosition: v,
5720
5720
  spineItem: y
5721
5721
  });
5722
5722
  return ue({
5723
- position: v,
5723
+ position: w,
5724
5724
  pageSizeWidth: r.pageSize.width,
5725
5725
  visibleAreaRectWidth: r.absoluteViewport.width
5726
5726
  });
@@ -5755,10 +5755,10 @@ const Re = (t, e, n) => {
5755
5755
  viewport: r
5756
5756
  }),
5757
5757
  getMostPredominantNavigationForPosition: (p) => {
5758
- const m = i.values.computedPageTurnDirection, f = 0.5, y = m === "horizontal" ? p.x + r.absoluteViewport.width * f : 0, x = m === "horizontal" ? 0 : p.y + r.absoluteViewport.height * f, v = Vt({
5758
+ const m = i.values.computedPageTurnDirection, f = 0.5, y = m === "horizontal" ? p.x + r.absoluteViewport.width * f : 0, v = m === "horizontal" ? 0 : p.y + r.absoluteViewport.height * f, w = Vt({
5759
5759
  position: new V({
5760
5760
  x: y,
5761
- y: x
5761
+ y: v
5762
5762
  }),
5763
5763
  size: r.absoluteViewport,
5764
5764
  isRTL: t.isRTL(),
@@ -5768,7 +5768,7 @@ const Re = (t, e, n) => {
5768
5768
  return Je({
5769
5769
  spineItemNavigationResolver: a,
5770
5770
  spineLocator: n,
5771
- viewportPosition: v,
5771
+ viewportPosition: w,
5772
5772
  viewport: r
5773
5773
  });
5774
5774
  },
@@ -5779,7 +5779,7 @@ const Re = (t, e, n) => {
5779
5779
  spineItemsManager: e,
5780
5780
  spine: o
5781
5781
  }),
5782
- getBoundaryForPosition: (p, m = r.absoluteViewport) => ls({
5782
+ getBoundaryForPosition: (p, m = r.absoluteViewport) => ps({
5783
5783
  position: p,
5784
5784
  size: m,
5785
5785
  isRTL: t.isRTL(),
@@ -5795,7 +5795,7 @@ const Re = (t, e, n) => {
5795
5795
  }),
5796
5796
  spineItemNavigator: a
5797
5797
  };
5798
- }, vs = ({
5798
+ }, ws = ({
5799
5799
  spineItemsManager: t,
5800
5800
  context: e,
5801
5801
  hookManager: n,
@@ -5804,7 +5804,7 @@ const Re = (t, e, n) => {
5804
5804
  viewport: r,
5805
5805
  cfi: s
5806
5806
  }) => {
5807
- const a = new k(), c = a.asObservable(), u = new mn(), d = s, l = bs({
5807
+ const a = new k(), c = a.asObservable(), u = new mn(), d = s, l = vs({
5808
5808
  cfi: d,
5809
5809
  context: e,
5810
5810
  settings: o,
@@ -5812,13 +5812,13 @@ const Re = (t, e, n) => {
5812
5812
  locator: i.locator,
5813
5813
  spine: i,
5814
5814
  viewport: r
5815
- }), g = new Hr(
5815
+ }), g = new qr(
5816
5816
  o,
5817
5817
  n,
5818
5818
  e,
5819
5819
  i,
5820
5820
  r
5821
- ), h = new Tr(
5821
+ ), h = new Cr(
5822
5822
  r,
5823
5823
  o,
5824
5824
  n,
@@ -5831,7 +5831,7 @@ const Re = (t, e, n) => {
5831
5831
  ...p.flatMap(
5832
5832
  (I) => I.layout$ ? [I.layout$] : []
5833
5833
  )
5834
- ), y = new as(
5834
+ ), y = new cs(
5835
5835
  o,
5836
5836
  e,
5837
5837
  c,
@@ -5842,18 +5842,18 @@ const Re = (t, e, n) => {
5842
5842
  r,
5843
5843
  d,
5844
5844
  u.isLocked$
5845
- ), x = _([
5845
+ ), v = _([
5846
5846
  ...p.map((I) => I.isNavigating$),
5847
5847
  u.isLocked$,
5848
5848
  y.locker.isLocked$
5849
5849
  ]).pipe(
5850
- S((I) => I.some((E) => E) ? "busy" : "free"),
5851
- N(),
5852
- G(1)
5853
- ), v = y.navigation$.pipe(
5850
+ S((I) => I.some((N) => N) ? "busy" : "free"),
5851
+ E(),
5852
+ Z(1)
5853
+ ), w = y.navigation$.pipe(
5854
5854
  S(({ position: I }) => I),
5855
- N(U),
5856
- G(1)
5855
+ E(U),
5856
+ Z(1)
5857
5857
  );
5858
5858
  return {
5859
5859
  destroy: () => {
@@ -5865,7 +5865,7 @@ const Re = (t, e, n) => {
5865
5865
  internalNavigator: y,
5866
5866
  scrollNavigationController: h,
5867
5867
  controlledNavigationController: g,
5868
- navigationState$: x,
5868
+ navigationState$: v,
5869
5869
  navigate: (I) => {
5870
5870
  A.info("User navigation", I), a.next(I);
5871
5871
  },
@@ -5882,10 +5882,10 @@ const Re = (t, e, n) => {
5882
5882
  isLocked$: u.isLocked$,
5883
5883
  navigationResolver: l,
5884
5884
  navigation$: y.navigation$,
5885
- position$: v
5885
+ position$: w
5886
5886
  };
5887
5887
  };
5888
- class ws extends re {
5888
+ class xs extends re {
5889
5889
  constructor(e, n) {
5890
5890
  super({
5891
5891
  beginPageIndexInSpineItem: void 0,
@@ -5903,7 +5903,7 @@ class ws extends re {
5903
5903
  this.mergeCompare(e);
5904
5904
  }
5905
5905
  }
5906
- class xs extends Z {
5906
+ class Ps extends J {
5907
5907
  constructor(e, n, i, o, r, s, a) {
5908
5908
  super(), this.context = e, this.pagination = n, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = r, this.isNavigationLocked$ = s, this.cfi = a;
5909
5909
  const c = C(
@@ -5932,13 +5932,13 @@ class xs extends Z {
5932
5932
  threshold: { type: "percentage", value: 0.5 }
5933
5933
  }) ?? {}, f = this.spineItemsManager.get(p), y = this.spineItemsManager.get(m);
5934
5934
  if (!f || !y) return;
5935
- const x = h.beginCfi, v = h.endCfi, { beginPageIndex: b = 0 } = d({
5935
+ const v = h.beginCfi, w = h.endCfi, { beginPageIndex: b = 0 } = d({
5936
5936
  spineItem: f,
5937
5937
  position: g
5938
5938
  }) ?? {}, { endPageIndex: T = 0 } = d({
5939
5939
  spineItem: y,
5940
5940
  position: g
5941
- }) ?? {}, I = x === void 0 || this.cfi.isRootCfi(x) || h.beginSpineItemIndex !== p, E = h.endSpineItemIndex !== m || v === void 0 || this.cfi.isRootCfi(v), X = I ? this.cfi.generateRootCfi(f.item) : x, Y = E ? this.cfi.generateRootCfi(y.item) : v, se = f.numberOfPages, ve = y.numberOfPages;
5941
+ }) ?? {}, I = v === void 0 || this.cfi.isRootCfi(v) || h.beginSpineItemIndex !== p, N = h.endSpineItemIndex !== m || w === void 0 || this.cfi.isRootCfi(w), X = I ? this.cfi.generateRootCfi(f.item) : v, Y = N ? this.cfi.generateRootCfi(y.item) : w, se = f.numberOfPages, ve = y.numberOfPages;
5942
5942
  this.pagination.update({
5943
5943
  beginCfi: X,
5944
5944
  beginNumberOfPagesInSpineItem: se,
@@ -5988,14 +5988,14 @@ class xs extends Z {
5988
5988
  C(c, u).pipe(M(this.destroy$)).subscribe();
5989
5989
  }
5990
5990
  }
5991
- class Ps extends Z {
5991
+ class $s extends J {
5992
5992
  constructor(e) {
5993
5993
  super();
5994
5994
  const n = {
5995
5995
  ...this.getDefaultSettings(),
5996
5996
  ...e
5997
5997
  };
5998
- this.inputSettings = n, this.outputSettingsUpdateSubject = new k(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(G(1)), this._settings$.subscribe();
5998
+ this.inputSettings = n, this.outputSettingsUpdateSubject = new k(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(Z(1)), this._settings$.subscribe();
5999
5999
  }
6000
6000
  _prepareUpdate(e) {
6001
6001
  const n = Le(this.inputSettings, e), i = this.getOutputSettings(n), o = !U(this.outputSettings, i);
@@ -6026,14 +6026,14 @@ class Ps extends Z {
6026
6026
  watch(e) {
6027
6027
  return this.values$.pipe(
6028
6028
  Zt(e),
6029
- N(U)
6029
+ E(U)
6030
6030
  );
6031
6031
  }
6032
6032
  destroy() {
6033
6033
  super.destroy(), this.outputSettingsUpdateSubject.complete();
6034
6034
  }
6035
6035
  }
6036
- class $s extends Ps {
6036
+ class Ts extends $s {
6037
6037
  constructor(e, n) {
6038
6038
  super(e), this.context = n, n.watch(["manifest", "hasVerticalWriting"]).pipe(
6039
6039
  F(() => this.update(this.values)),
@@ -6072,7 +6072,7 @@ class $s extends Ps {
6072
6072
  };
6073
6073
  }
6074
6074
  }
6075
- class Ts extends Ne {
6075
+ class Cs extends Ee {
6076
6076
  onUnload() {
6077
6077
  return q;
6078
6078
  }
@@ -6091,37 +6091,38 @@ class Ts extends Ne {
6091
6091
  getDocumentFrame() {
6092
6092
  }
6093
6093
  }
6094
- class Cs extends Z {
6094
+ class Fs extends J {
6095
6095
  constructor(e, n, i, o, r, s, a) {
6096
6096
  super(), this.item = e, this.containerElement = n, this.context = i, this.hookManager = o, this.renderer = r, this.settings = s, this.viewport = a, this.layoutTriggerSubject = new k(), this.lastLayout = null, this.computeLayoutInformation = ({
6097
6097
  isLastItem: u,
6098
- horizontalOffset: d
6098
+ horizontalOffset: d,
6099
+ spreadPosition: l
6099
6100
  }) => {
6100
- let l = this.viewport.value.pageSize.width, g = "none";
6101
- const h = d % this.viewport.absoluteViewport.width === 0, p = this.context.manifest, m = hn(p) ?? !1;
6101
+ let g = this.viewport.value.pageSize.width, h = "none";
6102
+ const p = d % this.viewport.absoluteViewport.width === 0, m = this.context.manifest, f = hn(m) ?? !1;
6102
6103
  if (this.settings.values.computedSpreadMode) {
6103
- !m && this.renderer.renditionLayout === "reflowable" && !u && (l = this.viewport.value.pageSize.width * 2), !m && this.renderer.renditionLayout === "reflowable" && u && h && (l = this.viewport.value.pageSize.width * 2);
6104
- const f = h && u && m;
6105
- this.item.pageSpreadRight && h && !this.context.isRTL() ? (g = "before", l = this.viewport.value.pageSize.width * 2) : this.item.pageSpreadLeft && h && this.context.isRTL() ? (g = "before", l = this.viewport.value.pageSize.width * 2) : f && (this.context.isRTL() ? g = "before" : g = "after", l = this.viewport.value.pageSize.width * 2);
6104
+ !f && this.renderer.renditionLayout === "reflowable" && !u && (g = this.viewport.value.pageSize.width * 2), !f && this.renderer.renditionLayout === "reflowable" && u && p && (g = this.viewport.value.pageSize.width * 2);
6105
+ const y = p && u && f, v = Fn(this.item);
6106
+ v !== void 0 && v !== l ? (h = "before", g = this.viewport.value.pageSize.width * 2) : y && (this.context.isRTL() ? h = "before" : h = "after", g = this.viewport.value.pageSize.width * 2);
6106
6107
  }
6107
6108
  return {
6108
- minimumWidth: l,
6109
- blankPagePosition: g
6109
+ minimumWidth: g,
6110
+ blankPagePosition: h
6110
6111
  };
6111
6112
  }, this.adjustPositionOfElement = ({
6112
6113
  right: u,
6113
6114
  left: d,
6114
6115
  top: l
6115
6116
  }) => {
6116
- u !== void 0 ? w(
6117
+ u !== void 0 ? x(
6117
6118
  this.containerElement.style,
6118
6119
  "right",
6119
6120
  `${u}px`
6120
- ) : K(this.containerElement.style, "right"), d !== void 0 ? w(
6121
+ ) : Q(this.containerElement.style, "right"), d !== void 0 ? x(
6121
6122
  this.containerElement.style,
6122
6123
  "left",
6123
6124
  `${d}px`
6124
- ) : K(this.containerElement.style, "left"), l !== void 0 ? w(this.containerElement.style, "top", `${l}px`) : K(this.containerElement.style, "top");
6125
+ ) : Q(this.containerElement.style, "left"), l !== void 0 ? x(this.containerElement.style, "top", `${l}px`) : Q(this.containerElement.style, "top");
6125
6126
  }, this.updateContainerLayout = ({
6126
6127
  minimumWidth: u,
6127
6128
  edgeX: d,
@@ -6131,12 +6132,12 @@ class Cs extends Z {
6131
6132
  const p = U(
6132
6133
  this.lastLayout?.pageSize,
6133
6134
  this.viewport.pageSize
6134
- ) ? this.lastLayout : void 0, { width: m, height: f } = p ?? {}, { width: y = m, height: x = f } = h ?? {}, { width: v, height: b } = this.viewport.pageSize, T = this.validateDimension(
6135
- y ?? v,
6136
- v,
6135
+ ) ? this.lastLayout : void 0, { width: m, height: f } = p ?? {}, { width: y = m, height: v = f } = h ?? {}, { width: w, height: b } = this.viewport.pageSize, T = this.validateDimension(
6136
+ y ?? w,
6137
+ w,
6137
6138
  u
6138
- ), I = this.settings.values.computedPageTurnMode === "scrollable" ? x ?? b : this.validateDimension(
6139
- x ?? b,
6139
+ ), I = this.settings.values.computedPageTurnMode === "scrollable" ? v ?? b : this.validateDimension(
6140
+ v ?? b,
6140
6141
  b,
6141
6142
  b
6142
6143
  );
@@ -6144,11 +6145,11 @@ class Cs extends Z {
6144
6145
  width: T,
6145
6146
  height: I,
6146
6147
  pageSize: this.viewport.pageSize
6147
- }, w(
6148
+ }, x(
6148
6149
  this.containerElement.style,
6149
6150
  "width",
6150
6151
  `${T}px`
6151
- ), w(
6152
+ ), x(
6152
6153
  this.containerElement.style,
6153
6154
  "height",
6154
6155
  `${I}px`
@@ -6160,13 +6161,17 @@ class Cs extends Z {
6160
6161
  ), { width: T, height: I });
6161
6162
  })
6162
6163
  ), this.layout = (u) => {
6163
- const d = Ii(this.didLayout$.pipe(W()));
6164
+ const d = bi(this.didLayout$.pipe(W()));
6164
6165
  return this.layoutTriggerSubject.next(u), d();
6165
6166
  };
6166
6167
  const c = this.layoutTriggerSubject.pipe(
6167
6168
  $(
6168
6169
  ({ spreadPosition: u, horizontalOffset: d, isLastItem: l, edgeX: g, edgeY: h }) => {
6169
- const { blankPagePosition: p, minimumWidth: m } = this.computeLayoutInformation({ horizontalOffset: d, isLastItem: l });
6170
+ const { blankPagePosition: p, minimumWidth: m } = this.computeLayoutInformation({
6171
+ horizontalOffset: d,
6172
+ isLastItem: l,
6173
+ spreadPosition: u
6174
+ });
6170
6175
  this.hookManager.execute("item.onBeforeLayout", {
6171
6176
  blankPagePosition: p,
6172
6177
  item: this.item,
@@ -6241,7 +6246,7 @@ class In extends re {
6241
6246
  });
6242
6247
  }, this.destroy = () => {
6243
6248
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
6244
- }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (l) => this._layout.layout(l), this.containerElement = Fs(
6249
+ }, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.layout = (l) => this._layout.layout(l), this.containerElement = Ms(
6245
6250
  n,
6246
6251
  e,
6247
6252
  r
@@ -6257,7 +6262,7 @@ class In extends re {
6257
6262
  resourcesHandler: this.resourcesHandler,
6258
6263
  viewport: this.viewport
6259
6264
  };
6260
- this.renderer = c ? c(u) : new Ts(u), this._layout = new Cs(
6265
+ this.renderer = c ? c(u) : new Cs(u), this._layout = new Fs(
6261
6266
  e,
6262
6267
  this.containerElement,
6263
6268
  i,
@@ -6282,7 +6287,7 @@ class In extends re {
6282
6287
  isReady: this.renderer.value.state === "loaded"
6283
6288
  });
6284
6289
  }),
6285
- qn()
6290
+ Xn()
6286
6291
  ), C(
6287
6292
  /**
6288
6293
  * @important
@@ -6345,22 +6350,22 @@ class In extends re {
6345
6350
  });
6346
6351
  }
6347
6352
  }
6348
- const Fs = (t, e, n) => {
6353
+ const Ms = (t, e, n) => {
6349
6354
  const i = t.ownerDocument.createElement("div");
6350
- return i.setAttribute(`data-${no}`, ""), i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
6355
+ return i.setAttribute(`data-${io}`, ""), i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
6351
6356
  position: absolute;
6352
6357
  overflow: hidden;
6353
6358
  `, i.dataset.isReady = "false", n.execute("item.onBeforeContainerAttach", { element: i, item: e }), i;
6354
6359
  };
6355
- class Ms extends Z {
6360
+ class Ls extends J {
6356
6361
  constructor(e, n, i, o, r, s) {
6357
- super(), this.context = e, this.spineItemsManager = n, this.spineLocator = i, this.settings = o, this.spineLayout = r, this.viewport = s, this.forcedOpenSubject = new ee(
6362
+ super(), this.context = e, this.spineItemsManager = n, this.spineLocator = i, this.settings = o, this.spineLayout = r, this.viewport = s, this.forcedOpenSubject = new te(
6358
6363
  /* @__PURE__ */ new Map()
6359
6364
  );
6360
6365
  const a = this.forcedOpenSubject.pipe(
6361
6366
  S((d) => Array.from(d.keys()).sort((l, g) => l - g)),
6362
- N(Fn),
6363
- G({ bufferSize: 1, refCount: !0 })
6367
+ E(Mn),
6368
+ Z({ bufferSize: 1, refCount: !0 })
6364
6369
  );
6365
6370
  C(
6366
6371
  this.context.bridgeEvent.position$,
@@ -6382,10 +6387,10 @@ class Ms extends Z {
6382
6387
  useAbsoluteViewport: !1
6383
6388
  }) || {}, m = g === 1 / 0 ? 0 : h - g, f = g === 1 / 0 ? n.items.length - 1 : p + g, y = Array.from(
6384
6389
  { length: f - m + 1 },
6385
- (v, b) => m + b
6386
- ), x = [...l, ...y];
6387
- n.items.forEach((v, b) => {
6388
- x.includes(b) ? v.load() : v.unload();
6390
+ (w, b) => m + b
6391
+ ), v = [...l, ...y];
6392
+ n.items.forEach((w, b) => {
6393
+ v.includes(b) ? w.load() : w.unload();
6389
6394
  });
6390
6395
  })
6391
6396
  ).pipe(M(this.destroy$)).subscribe();
@@ -6433,12 +6438,12 @@ class Ce extends DOMRect {
6433
6438
  return new Ce(i.x, i.y, i.width, i.height);
6434
6439
  }
6435
6440
  }
6436
- class Ls {
6441
+ class As {
6437
6442
  constructor({ width: e, height: n }) {
6438
6443
  this.__symbol = /* @__PURE__ */ Symbol("AbsoluteViewport"), this.width = e, this.height = n;
6439
6444
  }
6440
6445
  }
6441
- class As {
6446
+ class Ns {
6442
6447
  constructor({ width: e, height: n }) {
6443
6448
  this.__symbol = /* @__PURE__ */ Symbol("RelativeViewport"), this.width = e, this.height = n;
6444
6449
  }
@@ -6465,7 +6470,7 @@ const Es = ({
6465
6470
  { currentAbsolutePage: 0, found: !1 }
6466
6471
  );
6467
6472
  return r;
6468
- }, Ns = ({
6473
+ }, Rs = ({
6469
6474
  itemHeight: t,
6470
6475
  itemWidth: e,
6471
6476
  visibleWidthOfItem: n,
@@ -6474,7 +6479,7 @@ const Es = ({
6474
6479
  }) => {
6475
6480
  const r = n / e, s = i / t;
6476
6481
  return o.type === "percentage" ? r >= o.value && s >= o.value : n >= o.value && i >= o.value;
6477
- }, Rs = ({
6482
+ }, Ds = ({
6478
6483
  visibleWidthOfItem: t,
6479
6484
  visibleHeightOfItem: e,
6480
6485
  threshold: n,
@@ -6506,14 +6511,14 @@ const Es = ({
6506
6511
  Math.min(t, g) - Math.max(i, l)
6507
6512
  );
6508
6513
  if (h <= 0 || p <= 0) return { visible: !1 };
6509
- const f = Rs({
6514
+ const f = Ds({
6510
6515
  threshold: s,
6511
6516
  visibleHeightOfItem: p,
6512
6517
  visibleWidthOfItem: h,
6513
6518
  viewportPosition: a
6514
6519
  });
6515
6520
  return c ? { visible: f } : {
6516
- visible: Ns({
6521
+ visible: Rs({
6517
6522
  itemHeight: r,
6518
6523
  itemWidth: o,
6519
6524
  threshold: s,
@@ -6537,7 +6542,7 @@ const Es = ({
6537
6542
  }) => new V({
6538
6543
  x: e + t.x,
6539
6544
  y: n + t.y
6540
- }), Ds = ({
6545
+ }), Os = ({
6541
6546
  position: t,
6542
6547
  threshold: e,
6543
6548
  restrictToScreen: n,
@@ -6556,16 +6561,16 @@ const Es = ({
6556
6561
  t,
6557
6562
  s.absoluteViewport,
6558
6563
  f
6559
- ), x = Ce.from(
6564
+ ), v = Ce.from(
6560
6565
  y,
6561
6566
  f
6562
- ), { visible: v } = vn({
6567
+ ), { visible: w } = vn({
6563
6568
  itemPosition: m,
6564
6569
  threshold: e,
6565
- viewportPosition: x,
6570
+ viewportPosition: v,
6566
6571
  restrictToScreen: n
6567
6572
  });
6568
- return v ? [...h, p] : h;
6573
+ return w ? [...h, p] : h;
6569
6574
  },
6570
6575
  []
6571
6576
  ), u = c[0] ?? a, d = c[c.length - 1] ?? u;
@@ -6575,7 +6580,7 @@ const Es = ({
6575
6580
  beginIndex: l ?? 0,
6576
6581
  endIndex: g ?? 0
6577
6582
  };
6578
- }, Os = ({
6583
+ }, Vs = ({
6579
6584
  spineItemsManager: t,
6580
6585
  context: e,
6581
6586
  spineItemLocator: n,
@@ -6618,37 +6623,37 @@ const Es = ({
6618
6623
  threshold: m,
6619
6624
  spineItem: f,
6620
6625
  restrictToScreen: y,
6621
- useAbsoluteViewport: x = !0,
6622
- viewport: v
6626
+ useAbsoluteViewport: v = !0,
6627
+ viewport: w
6623
6628
  }) => {
6624
6629
  const b = f.numberOfPages, I = Array.from(Array(b)).map((Y, se) => {
6625
6630
  const ve = n.getSpineItemPositionFromPageIndex({
6626
6631
  pageIndex: se,
6627
6632
  spineItem: f
6628
- }), ge = He({
6633
+ }), he = He({
6629
6634
  spineItemPosition: ve,
6630
6635
  itemLayout: o.getSpineItemSpineLayoutInfo(f)
6631
6636
  });
6632
6637
  return {
6633
6638
  index: se,
6634
6639
  absolutePosition: {
6635
- width: v.pageSize.width,
6636
- height: v.pageSize.height,
6637
- left: ge.x,
6638
- top: ge.y,
6639
- bottom: ge.y + v.pageSize.height,
6640
- right: ge.x + v.pageSize.width
6640
+ width: w.pageSize.width,
6641
+ height: w.pageSize.height,
6642
+ left: he.x,
6643
+ top: he.y,
6644
+ bottom: he.y + w.pageSize.height,
6645
+ right: he.x + w.pageSize.width
6641
6646
  }
6642
6647
  };
6643
6648
  }).reduce(
6644
6649
  (Y, { absolutePosition: se, index: ve }) => {
6645
- const ge = x ? v.absoluteViewport : v.relativeViewport, wn = bn(
6650
+ const he = v ? w.absoluteViewport : w.relativeViewport, wn = bn(
6646
6651
  p,
6647
- v.absoluteViewport,
6648
- ge
6652
+ w.absoluteViewport,
6653
+ he
6649
6654
  ), xn = Ce.from(
6650
6655
  wn,
6651
- ge
6656
+ he
6652
6657
  ), { visible: Pn } = vn({
6653
6658
  viewportPosition: xn,
6654
6659
  restrictToScreen: y,
@@ -6658,10 +6663,10 @@ const Es = ({
6658
6663
  return Pn ? [...Y, ve] : Y;
6659
6664
  },
6660
6665
  []
6661
- ), E = I[0], X = I[I.length - 1] ?? E;
6662
- if (!(E === void 0 || X === void 0))
6666
+ ), N = I[0], X = I[I.length - 1] ?? N;
6667
+ if (!(N === void 0 || X === void 0))
6663
6668
  return {
6664
- beginPageIndex: E,
6669
+ beginPageIndex: N,
6665
6670
  endPageIndex: X
6666
6671
  };
6667
6672
  };
@@ -6699,7 +6704,7 @@ const Es = ({
6699
6704
  itemHeight: m.layoutInfo.height,
6700
6705
  position: f,
6701
6706
  isUsingVerticalWriting: !!m.isUsingVerticalWriting()
6702
- }), x = n.getSpineItemPagePositionFromSpineItemPosition(
6707
+ }), v = n.getSpineItemPagePositionFromSpineItemPosition(
6703
6708
  f,
6704
6709
  y,
6705
6710
  m
@@ -6707,7 +6712,7 @@ const Es = ({
6707
6712
  return {
6708
6713
  spineItem: m,
6709
6714
  spineItemPageIndex: y,
6710
- spineItemPagePosition: x,
6715
+ spineItemPagePosition: v,
6711
6716
  pageSize: r.value.pageSize
6712
6717
  };
6713
6718
  },
@@ -6720,7 +6725,7 @@ const Es = ({
6720
6725
  }),
6721
6726
  getSpineItemFromIframe: c,
6722
6727
  getSpineItemPageIndexFromNode: u,
6723
- getVisibleSpineItemsFromPosition: (p) => Ds({
6728
+ getVisibleSpineItemsFromPosition: (p) => Os({
6724
6729
  spineItemsManager: t,
6725
6730
  spineLayout: o,
6726
6731
  viewport: r,
@@ -6731,8 +6736,8 @@ const Es = ({
6731
6736
  viewport: r
6732
6737
  }),
6733
6738
  isPositionWithinSpineItem: (p, m) => {
6734
- const { bottom: f, left: y, right: x, top: v } = o.getSpineItemSpineLayoutInfo(m);
6735
- return p.x >= y && p.x <= x && p.y <= f && p.y >= v;
6739
+ const { bottom: f, left: y, right: v, top: w } = o.getSpineItemSpineLayoutInfo(m);
6740
+ return p.x >= y && p.x <= v && p.y <= f && p.y >= w;
6736
6741
  },
6737
6742
  spineItemLocator: n,
6738
6743
  getSafeSpineItemPositionFromUnsafeSpineItemPosition: (p, m) => {
@@ -6744,14 +6749,14 @@ const Es = ({
6744
6749
  }
6745
6750
  };
6746
6751
  };
6747
- class Vs extends Z {
6752
+ class ks extends J {
6748
6753
  constructor(e) {
6749
6754
  super(), this.spineItemsManager = e, this.states$ = this.spineItemsManager.items$.pipe(
6750
6755
  $((n) => C(
6751
6756
  ...n.map(
6752
6757
  (i) => i.pipe(
6753
6758
  S((o) => ({ item: i, ...o })),
6754
- N(U)
6759
+ E(U)
6755
6760
  )
6756
6761
  )
6757
6762
  )),
@@ -6777,7 +6782,7 @@ class Vs extends Z {
6777
6782
  );
6778
6783
  }
6779
6784
  }
6780
- class ks extends Z {
6785
+ class js extends J {
6781
6786
  constructor(e, n, i, o, r) {
6782
6787
  super(), this.spineItemsManager = e, this.spineItemsObserver = n, this.context = i, this.settings = o, this.viewport = r, this.externalLayoutTrigger = new k(), this.spineItemsRelativeLayouts = [];
6783
6788
  const s = C(
@@ -6801,15 +6806,15 @@ class ks extends Z {
6801
6806
  }),
6802
6807
  // Immediate only skips this artificial delay. Item layout itself can still
6803
6808
  // complete asynchronously depending on the renderer.
6804
- Vn((c) => c.immediate ? P(void 0) : $e(50)),
6809
+ kn((c) => c.immediate ? P(void 0) : $e(50)),
6805
6810
  $(
6806
6811
  () => this.spineItemsManager.items.reduce(
6807
6812
  (c, u, d) => c.pipe(
6808
- kn(({ horizontalOffset: l, verticalOffset: g }) => {
6813
+ jn(({ horizontalOffset: l, verticalOffset: g }) => {
6809
6814
  const h = l % r.absoluteViewport.width === 0, p = d === e.items.length - 1, m = o.values.computedPageTurnDirection === "vertical", f = i.isRTL(), y = this.getSpreadPosition(
6810
6815
  h,
6811
6816
  f
6812
- ), { edgeX: x, edgeY: v } = this.getStartEdges(
6817
+ ), { edgeX: v, edgeY: w } = this.getStartEdges(
6813
6818
  m,
6814
6819
  h,
6815
6820
  l,
@@ -6820,22 +6825,22 @@ class ks extends Z {
6820
6825
  spreadPosition: y,
6821
6826
  horizontalOffset: l,
6822
6827
  isLastItem: p,
6823
- edgeX: x,
6824
- edgeY: v
6828
+ edgeX: v,
6829
+ edgeY: w
6825
6830
  }).pipe(
6826
6831
  S(({ width: b, height: T }) => {
6827
6832
  const I = this.createSpineItemLayout(
6828
6833
  m,
6829
6834
  f,
6830
- x,
6831
6835
  v,
6836
+ w,
6832
6837
  b,
6833
6838
  T,
6834
6839
  r.absoluteViewport.width
6835
6840
  );
6836
6841
  return this.spineItemsRelativeLayouts[d] = I, {
6837
- horizontalOffset: x + b,
6838
- verticalOffset: m ? v + T : 0
6842
+ horizontalOffset: v + b,
6843
+ verticalOffset: m ? w + T : 0
6839
6844
  };
6840
6845
  })
6841
6846
  );
@@ -6919,31 +6924,31 @@ class ks extends Z {
6919
6924
  });
6920
6925
  }
6921
6926
  }
6922
- class js extends Z {
6927
+ class Us extends J {
6923
6928
  constructor(e, n, i, o, r, s, a) {
6924
- super(), this.context = e, this.pagination = n, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = r, this.hookManager = s, this.viewport = a, this.elementSubject = new ee(
6929
+ super(), this.context = e, this.pagination = n, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = r, this.hookManager = s, this.viewport = a, this.elementSubject = new te(
6925
6930
  void 0
6926
- ), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new Vs(i), this.spineLayout = new ks(
6931
+ ), this.element$ = this.elementSubject.asObservable(), this.spineItemsObserver = new ks(i), this.spineLayout = new js(
6927
6932
  i,
6928
6933
  this.spineItemsObserver,
6929
6934
  e,
6930
6935
  r,
6931
6936
  a
6932
- ), this.locator = Os({
6937
+ ), this.locator = Vs({
6933
6938
  context: e,
6934
6939
  spineItemsManager: i,
6935
6940
  spineItemLocator: o,
6936
6941
  settings: r,
6937
6942
  spineLayout: this.spineLayout,
6938
6943
  viewport: a
6939
- }), this.spineItemsLoader = new Ms(
6944
+ }), this.spineItemsLoader = new Ls(
6940
6945
  this.context,
6941
6946
  i,
6942
6947
  this.locator,
6943
6948
  r,
6944
6949
  this.spineLayout,
6945
6950
  this.viewport
6946
- ), this.pages = new he(
6951
+ ), this.pages = new me(
6947
6952
  this.spineLayout,
6948
6953
  this.spineItemsManager,
6949
6954
  this.spineItemLocator,
@@ -6999,9 +7004,9 @@ class js extends Z {
6999
7004
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
7000
7005
  }
7001
7006
  }
7002
- class Us extends Z {
7007
+ class zs extends J {
7003
7008
  constructor(e, n) {
7004
- super(), this.context = e, this.settings = n, this.orderedSpineItemsSubject = new ee([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
7009
+ super(), this.context = e, this.settings = n, this.orderedSpineItemsSubject = new te([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
7005
7010
  }
7006
7011
  get(e) {
7007
7012
  return typeof e == "number" ? this.orderedSpineItemsSubject.value[e] : typeof e == "string" ? this.orderedSpineItemsSubject.value.find(
@@ -7036,10 +7041,10 @@ class Us extends Z {
7036
7041
  });
7037
7042
  }
7038
7043
  }
7039
- class zs extends re {
7044
+ class _s extends re {
7040
7045
  constructor(e, n) {
7041
7046
  const i = document.createElement("div");
7042
- i.setAttribute(`data-${eo}`, ""), super({
7047
+ i.setAttribute(`data-${to}`, ""), super({
7043
7048
  element: i,
7044
7049
  pageSize: {
7045
7050
  width: 1,
@@ -7070,15 +7075,15 @@ class zs extends re {
7070
7075
  }
7071
7076
  syncAbsoluteViewportCssVariables(e) {
7072
7077
  const { style: n } = this.value.element;
7073
- e.width > 0 ? w(
7078
+ e.width > 0 ? x(
7074
7079
  n,
7075
7080
  ft,
7076
7081
  `${e.width}px`
7077
- ) : K(n, ft), e.height > 0 ? w(
7082
+ ) : Q(n, ft), e.height > 0 ? x(
7078
7083
  n,
7079
7084
  St,
7080
7085
  `${e.height}px`
7081
- ) : K(n, St);
7086
+ ) : Q(n, St);
7082
7087
  }
7083
7088
  /**
7084
7089
  * Re-measure the viewport and notify viewport-geometry dependents.
@@ -7100,7 +7105,7 @@ class zs extends re {
7100
7105
  }), this.layoutSubject.next();
7101
7106
  }
7102
7107
  get absoluteViewport() {
7103
- return new Ls({
7108
+ return new As({
7104
7109
  width: this.value.width,
7105
7110
  height: this.value.height
7106
7111
  });
@@ -7128,7 +7133,7 @@ class zs extends re {
7128
7133
  */
7129
7134
  get relativeViewport() {
7130
7135
  const e = this.absoluteViewport, n = this.scaleFactor;
7131
- return new As({
7136
+ return new Ns({
7132
7137
  width: e.width / n,
7133
7138
  height: e.height / n
7134
7139
  });
@@ -7137,12 +7142,12 @@ class zs extends re {
7137
7142
  super.destroy(), this.layoutSubject.complete();
7138
7143
  }
7139
7144
  }
7140
- const kt = `${Ki}-core`, _s = (t) => {
7141
- const e = crypto.randomUUID(), n = new k(), i = new k(), o = new Ur(), r = new kr(), s = new $s(t, r), a = new jr(r, s), c = new Us(r, s), u = new Or(o, c), d = new zs(r, s), l = Sn({
7145
+ const kt = `${Qi}-core`, Ws = (t) => {
7146
+ const e = crypto.randomUUID(), n = new k(), i = new k(), o = new zr(), r = new jr(), s = new Ts(t, r), a = new Ur(r, s), c = new zs(r, s), u = new Vr(o, c), d = new _s(r, s), l = Sn({
7142
7147
  context: r,
7143
7148
  settings: s,
7144
7149
  viewport: d
7145
- }), g = new ws(r, c), h = new js(
7150
+ }), g = new xs(r, c), h = new Us(
7146
7151
  r,
7147
7152
  g,
7148
7153
  c,
@@ -7150,7 +7155,7 @@ const kt = `${Ki}-core`, _s = (t) => {
7150
7155
  s,
7151
7156
  o,
7152
7157
  d
7153
- ), p = vs({
7158
+ ), p = ws({
7154
7159
  cfi: u,
7155
7160
  context: r,
7156
7161
  spineItemsManager: c,
@@ -7158,7 +7163,7 @@ const kt = `${Ki}-core`, _s = (t) => {
7158
7163
  spine: h,
7159
7164
  settings: s,
7160
7165
  viewport: d
7161
- }), m = new xs(
7166
+ }), m = new Ps(
7162
7167
  r,
7163
7168
  g,
7164
7169
  c,
@@ -7171,28 +7176,28 @@ const kt = `${Ki}-core`, _s = (t) => {
7171
7176
  const f = (I = {}) => {
7172
7177
  n.next(I);
7173
7178
  }, y = (I) => {
7174
- const { containerElement: E, manifest: X } = I;
7179
+ const { containerElement: N, manifest: X } = I;
7175
7180
  if (r.manifest) {
7176
7181
  A.warn("loading a new book is not supported yet");
7177
7182
  return;
7178
7183
  }
7179
7184
  A.log("load", { options: I });
7180
- const Y = Ws(E, e);
7185
+ const Y = Bs(N, e);
7181
7186
  r.update({
7182
7187
  manifest: X,
7183
7188
  rootElement: Y
7184
7189
  }), f({ immediate: !0 });
7185
- }, x = s.watch(["computedSpreadMode"]).pipe(
7190
+ }, v = s.watch(["computedSpreadMode"]).pipe(
7186
7191
  Wt(1),
7187
7192
  z(() => f())
7188
- ), v = n.pipe(
7193
+ ), w = n.pipe(
7189
7194
  z((I) => {
7190
- const E = r.value.rootElement;
7191
- E && (w(E.style, "overflow", "hidden"), d.layout(), h.layout(I));
7195
+ const N = r.value.rootElement;
7196
+ N && (x(N.style, "overflow", "hidden"), d.layout(), h.layout(I));
7192
7197
  }),
7193
7198
  oe(i)
7194
- ), b = C(v, x).subscribe();
7195
- nt(document, kt, zr);
7199
+ ), b = C(w, v).subscribe();
7200
+ nt(document, kt, _r);
7196
7201
  const T = () => {
7197
7202
  it(document, kt), b.unsubscribe(), c.destroy(), m.destroy(), s.destroy(), g.destroy(), r.destroy(), p.destroy(), h.destroy(), a.destroy(), i.next(), i.complete(), d.destroy();
7198
7203
  };
@@ -7228,37 +7233,37 @@ const kt = `${Ki}-core`, _s = (t) => {
7228
7233
  * It can typically be used to hide a loading indicator.
7229
7234
  */
7230
7235
  state$: r.manifest$.pipe(
7231
- pe((I) => I ? "ready" : "idle")
7236
+ ge((I) => I ? "ready" : "idle")
7232
7237
  ),
7233
7238
  features: a,
7234
7239
  $: {
7235
7240
  destroy$: i
7236
7241
  }
7237
7242
  };
7238
- }, Ws = (t, e) => (t.style.cssText = `
7243
+ }, Bs = (t, e) => (t.style.cssText = `
7239
7244
  ${t.style.cssText}
7240
7245
  background-color: white;
7241
7246
  position: relative;
7242
- `, t.classList.add(`${j}-reader`), t.setAttribute(Qi, e), t.setAttribute("data-prose-reader-container", e), t), ra = (
7247
+ `, t.classList.add(`${j}-reader`), t.setAttribute(eo, e), t.setAttribute("data-prose-reader-container", e), t), sa = (
7243
7248
  //__
7244
- Ir(
7245
- wi(
7246
- wr(
7247
- vi(
7248
- pi(
7249
- hr(
7250
- vr(
7251
- Lr(
7252
- Ao(
7253
- Hi(
7254
- So(
7255
- gi(
7256
- Si(
7257
- lr(
7258
- fo(
7259
- br(
7249
+ br(
7250
+ xi(
7251
+ xr(
7252
+ wi(
7253
+ gi(
7254
+ mr(
7255
+ wr(
7256
+ Ar(
7257
+ No(
7258
+ qi(
7259
+ yo(
7260
+ hi(
7261
+ yi(
7262
+ pr(
7263
+ So(
7264
+ vr(
7260
7265
  // __
7261
- _s
7266
+ Ws
7262
7267
  )
7263
7268
  )
7264
7269
  )
@@ -7275,8 +7280,8 @@ const kt = `${Ki}-core`, _s = (t) => {
7275
7280
  )
7276
7281
  )
7277
7282
  )
7278
- ), sa = (t) => (e) => t(e), Bs = 5e3, aa = (t, {
7279
- itemReadinessTimeoutMs: e = Bs
7283
+ ), aa = (t) => (e) => t(e), Hs = 5e3, ca = (t, {
7284
+ itemReadinessTimeoutMs: e = Hs
7280
7285
  } = {}) => an(t).pipe(
7281
7286
  $((n) => {
7282
7287
  if (n.boundary === "start") return P(n);
@@ -7285,11 +7290,11 @@ const kt = `${Ki}-core`, _s = (t) => {
7285
7290
  L(Boolean),
7286
7291
  W(),
7287
7292
  S(() => n),
7288
- e === 1 / 0 ? Pe : jn({
7293
+ e === 1 / 0 ? Pe : Un({
7289
7294
  first: e,
7290
7295
  with: () => q
7291
7296
  }),
7292
- Io(t.navigation)
7297
+ bo(t.navigation)
7293
7298
  ) : q;
7294
7299
  }),
7295
7300
  R()
@@ -7298,93 +7303,93 @@ export {
7298
7303
  tn as AbstractSpinePosition,
7299
7304
  St as CSS_VAR_ABSOLUTE_VIEWPORT_HEIGHT,
7300
7305
  ft as CSS_VAR_ABSOLUTE_VIEWPORT_WIDTH,
7301
- Or as CfiManager,
7302
- kr as Context,
7303
- Hr as ControlledNavigationController,
7304
- Z as DestroyableClass,
7305
- Ne as DocumentRenderer,
7306
- jr as Features,
7307
- Qi as HTML_ATTRIBUTE_DATA_READER_ID,
7306
+ Vr as CfiManager,
7307
+ jr as Context,
7308
+ qr as ControlledNavigationController,
7309
+ J as DestroyableClass,
7310
+ Ee as DocumentRenderer,
7311
+ Ur as Features,
7312
+ eo as HTML_ATTRIBUTE_DATA_READER_ID,
7308
7313
  j as HTML_PREFIX,
7309
- to as HTML_PREFIX_SCROLL_NAVIGATOR,
7310
- no as HTML_PREFIX_SPINE_ITEM,
7311
- eo as HTML_PREFIX_VIEWPORT,
7312
- Ki as HTML_STYLE_PREFIX,
7313
- Ur as HookManager,
7314
- as as InternalNavigator,
7314
+ no as HTML_PREFIX_SCROLL_NAVIGATOR,
7315
+ io as HTML_PREFIX_SPINE_ITEM,
7316
+ to as HTML_PREFIX_VIEWPORT,
7317
+ Qi as HTML_STYLE_PREFIX,
7318
+ zr as HookManager,
7319
+ cs as InternalNavigator,
7315
7320
  ct as LayoutEntry,
7316
7321
  mn as Locker,
7317
- ta as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
7318
- Qs as PROSE_READER_NAMESPACE,
7319
- he as Pages,
7320
- ws as Pagination,
7321
- xs as PaginationController,
7322
+ na as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
7323
+ ea as PROSE_READER_NAMESPACE,
7324
+ me as Pages,
7325
+ xs as Pagination,
7326
+ Ps as PaginationController,
7322
7327
  re as ReactiveEntity,
7323
7328
  at as ResourceHandler,
7324
- Ro as ResourcesLocator,
7325
- Tr as ScrollNavigationController,
7329
+ Do as ResourcesLocator,
7330
+ Cr as ScrollNavigationController,
7326
7331
  Ft as ScrollPosition,
7327
- Ps as SettingsManager,
7328
- js as Spine,
7332
+ $s as SettingsManager,
7333
+ Us as Spine,
7329
7334
  In as SpineItem,
7330
- qi as SpineItemPageLayout,
7331
- Xi as SpineItemPageSpineLayout,
7335
+ Xi as SpineItemPageLayout,
7336
+ Yi as SpineItemPageSpineLayout,
7332
7337
  D as SpineItemPosition,
7333
7338
  ze as SpineItemSpineLayout,
7334
- Us as SpineItemsManager,
7335
- Vs as SpineItemsObserver,
7339
+ zs as SpineItemsManager,
7340
+ ks as SpineItemsObserver,
7336
7341
  V as SpinePosition,
7337
- $r as UnboundScrollPosition,
7342
+ Tr as UnboundScrollPosition,
7338
7343
  Ue as UnboundSpineItemPagePosition,
7339
7344
  O as UnboundSpinePosition,
7340
- ea as VIEWPORT_ADJUSTMENT_THROTTLE,
7341
- zs as Viewport,
7342
- No as consolidate,
7343
- ra as createReader,
7345
+ ta as VIEWPORT_ADJUSTMENT_THROTTLE,
7346
+ _s as Viewport,
7347
+ Ro as consolidate,
7348
+ sa as createReader,
7344
7349
  pt as deferIdle,
7345
- Ii as deferNextResult,
7346
- Ar as generateCfiForSpineItemPage,
7350
+ bi as deferNextResult,
7351
+ Nr as generateCfiForSpineItemPage,
7347
7352
  Er as generateCfiFromRange,
7348
7353
  ln as generateRootCfi,
7349
7354
  lt as getAttributeValueFromString,
7350
- Zs as getBase64FromBlob,
7355
+ Js as getBase64FromBlob,
7351
7356
  ot as getFrameViewportInfo,
7352
- oa as getItemAnchor,
7353
- Hi as htmlEnhancer,
7357
+ ra as getItemAnchor,
7358
+ qi as htmlEnhancer,
7354
7359
  Jt as idle,
7355
7360
  nt as injectCSS,
7356
- ui as injectCSSToFrame,
7361
+ di as injectCSSToFrame,
7357
7362
  ie as isDefined,
7358
7363
  Gt as isHtmlElement,
7359
- ai as isHtmlTagElement,
7360
- Nr as isRootCfi,
7361
- da as isShallowEqual,
7362
- fo as layoutEnhancer,
7364
+ ci as isHtmlTagElement,
7365
+ Rr as isRootCfi,
7366
+ la as isShallowEqual,
7367
+ So as layoutEnhancer,
7363
7368
  Zt as mapKeysTo,
7364
- aa as observeBookBoundaryReached,
7365
- Js as observeIntersection,
7369
+ ca as observeBookBoundaryReached,
7370
+ Ks as observeIntersection,
7366
7371
  gt as observeMutation,
7367
- yo as observeNextSettledNavigation,
7372
+ Io as observeNextSettledNavigation,
7368
7373
  st as observeResize,
7369
7374
  sn as observeSettledNavigation,
7370
- lr as paginationEnhancer,
7375
+ pr as paginationEnhancer,
7371
7376
  gn as parseCfi,
7372
- yi as pick,
7377
+ Ii as pick,
7373
7378
  Ht as removeAttributeIfPresent,
7374
- Gs as removeCSS,
7375
- K as removeStylePropertyIfPresent,
7376
- Dr as resolveCfi,
7377
- sa as rootEnhancer,
7379
+ Zs as removeCSS,
7380
+ Q as removeStylePropertyIfPresent,
7381
+ Or as resolveCfi,
7382
+ aa as rootEnhancer,
7378
7383
  ne as setAttributeIfChanged,
7379
- Kn as setPropertyIfChanged,
7380
- w as setStylePropertyIfChanged,
7384
+ Qn as setPropertyIfChanged,
7385
+ x as setStylePropertyIfChanged,
7381
7386
  on as shouldEnableSpreadModeForViewport,
7382
- ia as shouldUseComputedSpreadModeForViewport,
7383
- Oo as spinePositionToSpineItemSpineLayout,
7384
- Io as takeUntilNextNavigationSettled,
7387
+ oa as shouldUseComputedSpreadModeForViewport,
7388
+ Vo as spinePositionToSpineItemSpineLayout,
7389
+ bo as takeUntilNextNavigationSettled,
7385
7390
  de as upsertCSSToFrame,
7386
- di as waitForFrameLoad,
7387
- li as waitForFrameReady,
7391
+ li as waitForFrameLoad,
7392
+ pi as waitForFrameReady,
7388
7393
  rn as waitForNavigationSettled,
7389
7394
  Ve as waitForSwitch,
7390
7395
  rt as watchKeys