@prose-reader/core 1.233.0 → 1.234.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,18 +1,18 @@
1
- import { switchMap as P, of as w, fromEvent as q, take as we, map as S, from as j, takeUntil as T, Observable as ot, defer as kt, Subject as W, combineLatest as B, merge as v, EMPTY as Q, withLatestFrom as A, NEVER as gt, tap as $, share as V, BehaviorSubject as U, filter as M, first as z, mergeMap as $t, endWith as mt, finalize as dt, catchError as Pe, lastValueFrom as ei, scheduled as ii, animationFrameScheduler as rt, distinctUntilChanged as H, throttleTime as ni, debounceTime as St, startWith as it, switchScan as oi, shareReplay as tt, defaultIfEmpty as si, forkJoin as ri, delay as wt, ReplaySubject as ie, skip as ve, identity as Pt, exhaustMap as Wt, timer as ne, reduce as ai, concatMap as oe } from "rxjs";
2
- import { Report as ci, isShallowEqual as N, shallowMergeIfDefined as vt, getParentPath as ui, parseContentType as di, detectMimeTypeFromName as Mt, arrayEqual as gi } from "@prose-reader/shared";
1
+ import { switchMap as P, of as w, fromEvent as q, take as Pe, map as S, from as j, takeUntil as T, Observable as ot, defer as jt, Subject as U, combineLatest as B, merge as v, EMPTY as Q, withLatestFrom as A, NEVER as lt, tap as $, share as V, BehaviorSubject as W, filter as M, first as z, mergeMap as Tt, endWith as mt, finalize as dt, catchError as ve, lastValueFrom as ti, scheduled as ei, animationFrameScheduler as rt, timer as kt, distinctUntilChanged as H, throttleTime as ii, debounceTime as St, startWith as it, switchScan as ni, shareReplay as tt, defaultIfEmpty as oi, forkJoin as si, delay as Pt, ReplaySubject as ie, skip as xe, identity as vt, exhaustMap as Ut, reduce as ri, concatMap as ne } from "rxjs";
2
+ import { Report as ai, isShallowEqual as N, shallowMergeIfDefined as xt, getParentPath as ci, parseContentType as ui, detectMimeTypeFromName as Mt, arrayEqual as di } from "@prose-reader/shared";
3
3
  import { isShallowEqual as Ws } from "@prose-reader/shared";
4
- import { switchMap as _, first as xe, map as Y, distinctUntilChanged as Z, startWith as $e, shareReplay as bt, tap as k, pairwise as li, take as pi, takeUntil as G, filter as K, debounceTime as hi, skip as mi, mergeMap as fi, catchError as se, withLatestFrom as yi } from "rxjs/operators";
5
- import { generate as Ut, parse as Te, isIndirectionOnly as Si, isParsedCfiRange as bi, resolve as Ii } from "@prose-reader/cfi";
4
+ import { switchMap as _, first as $e, map as Y, distinctUntilChanged as Z, startWith as Te, shareReplay as bt, tap as k, pairwise as li, take as gi, takeUntil as G, filter as K, debounceTime as pi, skip as hi, mergeMap as mi, catchError as oe, withLatestFrom as fi } from "rxjs/operators";
5
+ import { generate as Wt, parse as Fe, isIndirectionOnly as yi, isParsedCfiRange as Si, resolve as bi } from "@prose-reader/cfi";
6
6
  import { isDefined as qt } from "reactjrx";
7
- const re = (e, t) => {
7
+ const se = (e, t) => {
8
8
  const i = new RegExp(`${t}\\s*=\\s*([0-9.]+)`, "i"), n = e.match(i) || [], o = n[1] || "0";
9
9
  return n && Number.parseFloat(o) || 0;
10
- }, wi = (e, t, i, n) => {
10
+ }, Ii = (e, t, i, n) => {
11
11
  var s;
12
12
  if (!((s = e == null ? void 0 : e.contentDocument) != null && s.head)) return;
13
13
  const o = e.contentDocument.createElement("style");
14
14
  o.id = t, o.innerHTML = i, n ? e.contentDocument.head.prepend(o) : e.contentDocument.head.appendChild(o);
15
- }, Cs = (e, t) => {
15
+ }, Rs = (e, t) => {
16
16
  var i;
17
17
  if ((i = e == null ? void 0 : e.contentDocument) != null && i.head) {
18
18
  const n = e.contentDocument.getElementById(t);
@@ -28,14 +28,14 @@ const re = (e, t) => {
28
28
  o.innerHTML = i;
29
29
  return;
30
30
  }
31
- wi(e, t, i, n);
31
+ Ii(e, t, i, n);
32
32
  }, Zt = (e) => {
33
33
  if (e != null && e.contentDocument) {
34
34
  const i = e.contentDocument.querySelector("meta[name='viewport']");
35
35
  if (i) {
36
36
  const n = i.getAttribute("content");
37
37
  if (n) {
38
- const o = re(n, "width"), s = re(n, "height");
38
+ const o = se(n, "width"), s = se(n, "height");
39
39
  return o > 0 && s > 0 ? {
40
40
  hasViewport: !0,
41
41
  width: o,
@@ -45,21 +45,21 @@ const re = (e, t) => {
45
45
  }
46
46
  }
47
47
  return { hasViewport: !1 };
48
- }, Pi = (e) => e.pipe(
48
+ }, wi = (e) => e.pipe(
49
49
  P((t) => {
50
50
  var i;
51
51
  return t.src === "about:blank" && ((i = t.contentDocument) == null ? void 0 : i.readyState) === "complete" && t.contentDocument.body ? w(t) : q(t, "load").pipe(
52
- we(1),
52
+ Pe(1),
53
53
  S(() => t)
54
54
  );
55
55
  })
56
- ), vi = (e) => e.pipe(
56
+ ), Pi = (e) => e.pipe(
57
57
  P((t) => {
58
58
  var n;
59
59
  const i = (n = t == null ? void 0 : t.contentDocument) == null ? void 0 : n.fonts.ready;
60
60
  return i ? j(i).pipe(S(() => t)) : w(void 0);
61
61
  })
62
- ), xi = (e) => (t) => {
62
+ ), vi = (e) => (t) => {
63
63
  const i = e(t), n = new IntersectionObserver((o) => {
64
64
  o.forEach((s) => {
65
65
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -95,7 +95,7 @@ const re = (e, t) => {
95
95
  ), {
96
96
  ...i
97
97
  };
98
- }, $i = (e) => (t) => {
98
+ }, xi = (e) => (t) => {
99
99
  const i = e(t);
100
100
  return i.context.state$.pipe(T(i.$.destroy$)).subscribe(({ rootElement: n }) => {
101
101
  if (!n) return;
@@ -108,9 +108,9 @@ const re = (e, t) => {
108
108
  const o = i.spineItemsManager.get(n), s = o == null ? void 0 : o.renderer.getDocumentFrame();
109
109
  s && ((a = s.contentDocument) == null || a.body.setAttribute("tabindex", "-1"));
110
110
  }), i;
111
- }, Ti = "@prose-reader/core", O = ci.namespace(Ti, void 0, {
111
+ }, $i = "@prose-reader/core", O = ai.namespace($i, void 0, {
112
112
  color: "#98cde7"
113
- }), Fi = [
113
+ }), Ti = [
114
114
  "pointercancel",
115
115
  "pointerdown",
116
116
  "pointerenter",
@@ -122,24 +122,24 @@ const re = (e, t) => {
122
122
  // `touchstart` as const,
123
123
  // `touchend` as const,
124
124
  ];
125
- function Li(e, t, i) {
125
+ function Fi(e, t, i) {
126
126
  if ("caretPositionFromPoint" in e)
127
127
  return e.caretPositionFromPoint(t, i);
128
128
  if ("caretRangeFromPoint" in e && // @ts-expect-error limited availability
129
129
  typeof e.caretRangeFromPoint < "u")
130
130
  return e.caretRangeFromPoint(t, i);
131
131
  }
132
- const Mi = (e, t) => {
132
+ const Li = (e, t) => {
133
133
  const i = "body" in e ? zt(e.body, t) : zt(e, t), n = "createRange" in e ? e : e.ownerDocument;
134
134
  if (i) {
135
135
  let o, s = 0;
136
136
  const a = n.createRange();
137
137
  return Array.from(i.childNodes).some((r) => {
138
138
  a.selectNodeContents(r);
139
- const c = a.getClientRects(), u = Ci(c, t);
139
+ const c = a.getClientRects(), u = Mi(c, t);
140
140
  if (u) {
141
141
  o = a.cloneRange();
142
- const d = Li(
142
+ const d = Fi(
143
143
  n,
144
144
  Math.ceil(u.left),
145
145
  Math.ceil(u.top)
@@ -151,7 +151,7 @@ const Mi = (e, t) => {
151
151
  }
152
152
  }, zt = (e, t) => {
153
153
  let i;
154
- const n = Fe(
154
+ const n = Le(
155
155
  e.getBoundingClientRect(),
156
156
  t
157
157
  );
@@ -160,16 +160,16 @@ const Mi = (e, t) => {
160
160
  return s ? (i = s, !0) : !1;
161
161
  }), i;
162
162
  };
163
- function Fe(e, { left: t, right: i }) {
163
+ function Le(e, { left: t, right: i }) {
164
164
  return e.left <= t && e.right <= t ? "before" : e.left <= t && e.right > t && e.right <= i ? "partially-before" : e.left <= i && e.right > i ? "partially-after" : e.left > i ? "after" : "within";
165
165
  }
166
- function Ci(e, t) {
166
+ function Mi(e, t) {
167
167
  return Array.from(e).find((i) => {
168
- const n = Fe(i, t);
168
+ const n = Le(i, t);
169
169
  return n !== "before" && n !== "after";
170
170
  });
171
171
  }
172
- const Ri = (e, t) => {
172
+ const Ci = (e, t) => {
173
173
  var i;
174
174
  if (e.nodeType !== Node.CDATA_SECTION_NODE && e.nodeType !== Node.DOCUMENT_TYPE_NODE) {
175
175
  const n = (i = e.ownerDocument) == null ? void 0 : i.createRange();
@@ -193,8 +193,8 @@ const Ri = (e, t) => {
193
193
  if (a.PointerEvent && e instanceof a.PointerEvent)
194
194
  return !0;
195
195
  }
196
- return !!Fi.includes(e.type);
197
- }, Ai = (e) => {
196
+ return !!Ti.includes(e.type);
197
+ }, Ri = (e) => {
198
198
  var t, i, n, o, s;
199
199
  if (Gt(e)) return !1;
200
200
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
@@ -208,7 +208,7 @@ const Ri = (e, t) => {
208
208
  return e instanceof a.MouseEvent;
209
209
  }
210
210
  return !1;
211
- }, Di = (e) => {
211
+ }, Ai = (e) => {
212
212
  var t, i, n, o, s;
213
213
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
214
214
  const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
@@ -221,7 +221,7 @@ const Ri = (e, t) => {
221
221
  return e instanceof a.TouchEvent;
222
222
  }
223
223
  return !1;
224
- }, Le = () => document.createElement("div"), Me = (e) => {
224
+ }, Di = () => document.createElement("div"), Me = (e) => {
225
225
  const t = [
226
226
  "img",
227
227
  // Images
@@ -291,7 +291,7 @@ function Vi(e) {
291
291
  ["setStart", "setEnd", "selectNodeContents"]
292
292
  );
293
293
  }
294
- const Dt = ({
294
+ const At = ({
295
295
  position: e,
296
296
  frameElement: t
297
297
  }) => {
@@ -307,55 +307,55 @@ const Dt = ({
307
307
  const s = i.getSpineItemFromIframe(o), a = o, { height: r, width: c } = n.getPageSize();
308
308
  if (!s || !(a instanceof HTMLIFrameElement)) return e;
309
309
  if (Gt(e)) {
310
- const { clientX: d, clientY: g } = Dt({
310
+ const { clientX: d, clientY: l } = At({
311
311
  position: e,
312
312
  frameElement: a
313
- }), l = new PointerEvent(e.type, {
313
+ }), g = new PointerEvent(e.type, {
314
314
  ...e,
315
315
  pointerId: e.pointerId,
316
316
  clientX: d,
317
- clientY: g
317
+ clientY: l
318
318
  });
319
- return Object.defineProperty(l, "target", {
319
+ return Object.defineProperty(g, "target", {
320
320
  value: t.target,
321
321
  enumerable: !0
322
- }), l;
322
+ }), g;
323
323
  }
324
- if (Ai(e)) {
325
- const { clientX: d, clientY: g } = Dt({
324
+ if (Ri(e)) {
325
+ const { clientX: d, clientY: l } = At({
326
326
  position: e,
327
327
  frameElement: a
328
- }), l = new MouseEvent(e.type, {
328
+ }), g = new MouseEvent(e.type, {
329
329
  ...e,
330
330
  clientX: d,
331
- clientY: g
331
+ clientY: l
332
332
  });
333
- return Object.defineProperty(l, "target", {
333
+ return Object.defineProperty(g, "target", {
334
334
  value: t.target,
335
335
  enumerable: !0
336
- }), l;
336
+ }), g;
337
337
  }
338
- if (Di(e)) {
339
- const d = Array.from(e.touches).map((l) => {
340
- const { clientX: h, clientY: p } = Dt({
341
- position: l,
338
+ if (Ai(e)) {
339
+ const d = Array.from(e.touches).map((g) => {
340
+ const { clientX: h, clientY: p } = At({
341
+ position: g,
342
342
  frameElement: a
343
343
  });
344
344
  return new Touch({
345
- identifier: l.identifier,
346
- target: l.target,
345
+ identifier: g.identifier,
346
+ target: g.target,
347
347
  clientX: h,
348
348
  clientY: p
349
349
  });
350
- }), g = new TouchEvent(e.type, {
350
+ }), l = new TouchEvent(e.type, {
351
351
  touches: d,
352
352
  changedTouches: d,
353
353
  targetTouches: d
354
354
  });
355
- return Object.defineProperty(g, "target", {
355
+ return Object.defineProperty(l, "target", {
356
356
  value: t.target,
357
357
  enumerable: !0
358
- }), g;
358
+ }), l;
359
359
  }
360
360
  return e;
361
361
  }, ki = [
@@ -367,25 +367,25 @@ const Dt = ({
367
367
  "pointerout",
368
368
  "pointerover",
369
369
  "pointerup"
370
- ], Wi = [
370
+ ], Ui = [
371
371
  ...ki
372
372
  /*, ...mouseEvents*/
373
- ], Ui = (e) => (t) => {
373
+ ], Wi = (e) => (t) => {
374
374
  const i = e(t);
375
375
  return i.hookManager.register(
376
376
  "item.onDocumentLoad",
377
377
  ({ destroy: n, itemId: o }) => {
378
378
  const s = i.spineItemsManager.get(o), a = s == null ? void 0 : s.renderer.getDocumentFrame();
379
379
  if (!a || !s) return;
380
- const r = Wi.map((c) => {
380
+ const r = Ui.map((c) => {
381
381
  var d;
382
- const u = (g) => {
382
+ const u = (l) => {
383
383
  var h;
384
- let l = g;
385
- if (Gt(g) && (l = new PointerEvent(g.type, g)), l !== g) {
384
+ let g = l;
385
+ if (Gt(l) && (g = new PointerEvent(l.type, l)), g !== l) {
386
386
  const p = ji(
387
- l,
388
387
  g,
388
+ l,
389
389
  i.spine.locator,
390
390
  i.context
391
391
  );
@@ -393,8 +393,8 @@ const Dt = ({
393
393
  }
394
394
  };
395
395
  return (d = a.contentDocument) == null || d.addEventListener(c, u), () => {
396
- var g;
397
- (g = a.contentDocument) == null || g.removeEventListener(c, u);
396
+ var l;
397
+ (l = a.contentDocument) == null || l.removeEventListener(c, u);
398
398
  };
399
399
  });
400
400
  n(() => {
@@ -422,7 +422,7 @@ function Kt(e) {
422
422
  const Ct = (e) => (t) => t.pipe(
423
423
  _(
424
424
  (i) => e.pipe(
425
- xe(),
425
+ $e(),
426
426
  Y(() => i)
427
427
  )
428
428
  )
@@ -447,16 +447,16 @@ function De() {
447
447
  return () => clearTimeout(t);
448
448
  });
449
449
  }
450
- function ae(e) {
451
- return kt(() => De().pipe(_(e)));
450
+ function re(e) {
451
+ return jt(() => De().pipe(_(e)));
452
452
  }
453
- const ce = (e, t) => new ot((i) => {
453
+ const ae = (e, t) => new ot((i) => {
454
454
  const n = new MutationObserver((o) => {
455
455
  i.next(o);
456
456
  });
457
457
  return n.observe(e, t), () => n.disconnect();
458
458
  });
459
- function Rs(e, t) {
459
+ function As(e, t) {
460
460
  return new ot((i) => {
461
461
  const n = new IntersectionObserver((o) => {
462
462
  i.next(o);
@@ -469,23 +469,23 @@ function Rs(e, t) {
469
469
  class Ne {
470
470
  constructor(t, i) {
471
471
  this.settingsManager = i;
472
- const n = vt(
472
+ const n = xt(
473
473
  this.getDefaultSettings(),
474
474
  t
475
475
  );
476
- this.outputSettings = this.computeOutputSettings(n), this.inputSettings = vt(
476
+ this.outputSettings = this.computeOutputSettings(n), this.inputSettings = xt(
477
477
  this.getDefaultSettings(),
478
478
  t
479
- ), this.outputSettingsUpdateSubject = new W(), this.values$ = B([
479
+ ), this.outputSettingsUpdateSubject = new U(), this.values$ = B([
480
480
  this.settingsManager.values$,
481
- this.outputSettingsUpdateSubject.pipe($e(this.outputSettings))
481
+ this.outputSettingsUpdateSubject.pipe(Te(this.outputSettings))
482
482
  ]).pipe(
483
483
  Y(([o, s]) => ({ ...o, ...s })),
484
484
  bt(1)
485
485
  ), this.values$.subscribe();
486
486
  }
487
487
  _prepareUpdate(t) {
488
- const i = this.getCleanedParentInputSettings(t), n = this.settingsManager._prepareUpdate(i), o = vt(this.inputSettings, t), s = this.computeOutputSettings(o), a = this.hasSettingsChanged(s);
488
+ const i = this.getCleanedParentInputSettings(t), n = this.settingsManager._prepareUpdate(i), o = xt(this.inputSettings, t), s = this.computeOutputSettings(o), a = this.hasSettingsChanged(s);
489
489
  return {
490
490
  hasChanged: a || n.hasChanged,
491
491
  commit: () => (this.inputSettings = o, this.outputSettings = s, !n.hasChanged && a && this.outputSettingsUpdateSubject.next(s), {
@@ -535,7 +535,7 @@ let Hi = class extends Ne {
535
535
  }
536
536
  };
537
537
  const Bi = (e) => (t) => {
538
- const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t, a = new W(), r = e(t), c = new Hi(
538
+ const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t, a = new U(), r = e(t), c = new Hi(
539
539
  {
540
540
  fontScale: i,
541
541
  lineHeight: n,
@@ -551,27 +551,27 @@ const Bi = (e) => (t) => {
551
551
  ${c.values.fontWeight !== "publisher" ? `font-weight: ${c.values.fontWeight} !important;` : ""}
552
552
  ${c.values.fontJustification !== "publisher" ? `text-align: ${c.values.fontJustification} !important;` : ""}
553
553
  }
554
- `, d = (l) => {
554
+ `, d = (g) => {
555
555
  r.spineItemsManager.items.forEach((h) => {
556
556
  if (h.renditionLayout !== "pre-paginated") {
557
557
  const p = h.renderer.getDocumentFrame();
558
558
  p && nt(p, "prose-reader-fonts", u());
559
559
  }
560
- }), l && r.layout();
560
+ }), g && r.layout();
561
561
  };
562
- r.hookManager.register("item.onDocumentLoad", ({ itemId: l }) => {
563
- const h = r.spineItemsManager.get(l);
562
+ r.hookManager.register("item.onDocumentLoad", ({ itemId: g }) => {
563
+ const h = r.spineItemsManager.get(g);
564
564
  if ((h == null ? void 0 : h.renditionLayout) !== "pre-paginated") {
565
565
  const p = h == null ? void 0 : h.renderer.getDocumentFrame();
566
566
  p && nt(p, "prose-reader-fonts", u());
567
567
  }
568
568
  });
569
- const g = (l) => l.pipe(
569
+ const l = (g) => g.pipe(
570
570
  li(),
571
571
  S(([h, p]) => p.fontScale !== h.fontScale || p.lineHeight !== h.lineHeight)
572
572
  );
573
573
  return c.values$.pipe(
574
- g,
574
+ l,
575
575
  k(d),
576
576
  T(r.$.destroy$)
577
577
  ).subscribe(), {
@@ -621,7 +621,7 @@ const Bi = (e) => (t) => {
621
621
  ...t.map((i) => i.loaded$.pipe(
622
622
  P(() => {
623
623
  const n = i.renderer.getDocumentFrame();
624
- if (!n || !(n != null && n.contentDocument)) return gt;
624
+ if (!n || !(n != null && n.contentDocument)) return lt;
625
625
  const s = Array.from(
626
626
  n.contentDocument.querySelectorAll("a")
627
627
  ).map(
@@ -639,7 +639,7 @@ const Bi = (e) => (t) => {
639
639
  );
640
640
  class X {
641
641
  constructor() {
642
- this.isDestroyed = !1, this.destroySubject = new W(), this.destroy$ = this.destroySubject.asObservable();
642
+ this.isDestroyed = !1, this.destroySubject = new U(), this.destroy$ = this.destroySubject.asObservable();
643
643
  }
644
644
  destroy() {
645
645
  this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
@@ -647,7 +647,7 @@ class X {
647
647
  }
648
648
  const Lt = class Lt extends X {
649
649
  constructor(t) {
650
- super(), this.triggerSubject = new W(), this.stateSubject = new U("idle"), this.unload$ = this.triggerSubject.pipe(
650
+ super(), this.triggerSubject = new U(), this.stateSubject = new W("idle"), this.unload$ = this.triggerSubject.pipe(
651
651
  A(this.stateSubject),
652
652
  M(
653
653
  ([o, s]) => o.type === "unload" && s !== "idle" && s !== "unloading"
@@ -675,7 +675,7 @@ const Lt = class Lt extends X {
675
675
  );
676
676
  this.load$.pipe(
677
677
  P(() => (this.stateSubject.next("loading"), this.onCreateDocument().pipe(z()).pipe(
678
- $t((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
678
+ Tt((s) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
679
679
  itemId: this.item.id,
680
680
  documentContainer: s
681
681
  }), this.onLoadDocument().pipe(
@@ -739,8 +739,8 @@ const Lt = class Lt extends X {
739
739
  this.triggerSubject.next({ type: "unload" });
740
740
  }
741
741
  renderHeadless() {
742
- const t = new W();
743
- return kt(() => this.onRenderHeadless({ release: t })).pipe(
742
+ const t = new U();
743
+ return jt(() => this.onRenderHeadless({ release: t })).pipe(
744
744
  mt(void 0),
745
745
  z(),
746
746
  S((i) => {
@@ -755,11 +755,11 @@ const Lt = class Lt extends X {
755
755
  dt(() => {
756
756
  t.complete();
757
757
  }),
758
- Pe((i) => (O.error(i), w(void 0)))
758
+ ve((i) => (O.error(i), w(void 0)))
759
759
  );
760
760
  }
761
761
  layout(t) {
762
- return kt(() => this.onLayout(t));
762
+ return jt(() => this.onLayout(t));
763
763
  }
764
764
  destroy() {
765
765
  this.unload(), this.stateSubject.complete(), super.destroy();
@@ -792,7 +792,7 @@ class Qt {
792
792
  }
793
793
  async getResource() {
794
794
  var i, n;
795
- return await ei(
795
+ return await ti(
796
796
  ((n = (i = this.settings.values).getResource) == null ? void 0 : n.call(i, this.item)) ?? w(void 0)
797
797
  ) ?? Xi(this.item);
798
798
  }
@@ -815,8 +815,8 @@ const Oe = (e, t) => {
815
815
  if (e.defaultView && c instanceof e.defaultView.CSSFontFaceRule) {
816
816
  const u = c.style.getPropertyValue("src");
817
817
  if (u.match(/url\(['"]?([^'"]+)['"]?\)/g)) {
818
- const g = u.split(",").map((p) => p.trim()), l = await Promise.all(
819
- g.map(async (p) => {
818
+ const l = u.split(",").map((p) => p.trim()), g = await Promise.all(
819
+ l.map(async (p) => {
820
820
  var b, I;
821
821
  if (p.startsWith("local("))
822
822
  return p;
@@ -828,23 +828,23 @@ const Oe = (e, t) => {
828
828
  if (f) {
829
829
  const x = new Qt(f, o);
830
830
  try {
831
- const F = await x.getResource();
832
- if (F instanceof Response) {
833
- const C = await F.blob(), D = (I = e.defaultView) == null ? void 0 : I.URL.createObjectURL(C);
831
+ const L = await x.getResource();
832
+ if (L instanceof Response) {
833
+ const C = await L.blob(), D = (I = e.defaultView) == null ? void 0 : I.URL.createObjectURL(C);
834
834
  return p.replace(
835
835
  m[0],
836
836
  `url("${D}")`
837
837
  );
838
838
  }
839
- } catch (F) {
840
- console.error("Error loading font:", F);
839
+ } catch (L) {
840
+ console.error("Error loading font:", L);
841
841
  }
842
842
  }
843
843
  return p;
844
844
  })
845
845
  ), h = c.cssText.replace(
846
846
  /src:\s*[^;]+;/,
847
- `src: ${l.join(", ")};`
847
+ `src: ${g.join(", ")};`
848
848
  );
849
849
  s.deleteRule(r), s.insertRule(h, r);
850
850
  }
@@ -863,18 +863,18 @@ const Oe = (e, t) => {
863
863
  if (!a) return w(null);
864
864
  const r = new Qt(a, o);
865
865
  return j(r.getResource()).pipe(
866
- $t(
866
+ Tt(
867
867
  (u) => u instanceof Response ? j(u.blob()) : w(void 0)
868
868
  ),
869
- $t((u) => {
870
- var g;
869
+ Tt((u) => {
870
+ var l;
871
871
  if (!u)
872
872
  return w(null);
873
- const d = ((g = e == null ? void 0 : e.defaultView) == null ? void 0 : g.URL.createObjectURL(u)) ?? "";
873
+ const d = ((l = e == null ? void 0 : e.defaultView) == null ? void 0 : l.URL.createObjectURL(u)) ?? "";
874
874
  if (t.hasAttribute("src"))
875
875
  t.setAttribute("src", d);
876
876
  else if (t.hasAttribute("href") && (t.setAttribute("href", d), e != null && e.defaultView && t instanceof e.defaultView.HTMLLinkElement))
877
- return new ot((l) => {
877
+ return new ot((g) => {
878
878
  t.onload = async () => {
879
879
  try {
880
880
  t.sheet && await Yi(
@@ -883,11 +883,11 @@ const Oe = (e, t) => {
883
883
  i,
884
884
  n,
885
885
  o
886
- ), l.next(), l.complete();
886
+ ), g.next(), g.complete();
887
887
  } catch (h) {
888
- l.error(h);
888
+ g.error(h);
889
889
  }
890
- }, t.onerror = l.error;
890
+ }, t.onerror = g.error;
891
891
  });
892
892
  return w(null);
893
893
  })
@@ -900,7 +900,7 @@ const Oe = (e, t) => {
900
900
  P((o) => {
901
901
  const s = Me(
902
902
  o.contentDocument
903
- ), a = ui(t.href), r = s.map(
903
+ ), a = ci(t.href), r = s.map(
904
904
  (c) => qi(
905
905
  o.contentDocument,
906
906
  c,
@@ -915,7 +915,7 @@ const Oe = (e, t) => {
915
915
  Ni(e == null ? void 0 : e.contentDocument);
916
916
  }, Ji = [".xhtml", ".html", ".htm"], pt = "prose-reader", Ki = async (e, t) => {
917
917
  if (typeof e == "string") return e;
918
- const i = di(e.headers.get("Content-Type") || "") || Mt(t.href);
918
+ const i = ui(e.headers.get("Content-Type") || "") || Mt(t.href);
919
919
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
920
920
  (o) => o === i
921
921
  )) {
@@ -980,7 +980,7 @@ const Oe = (e, t) => {
980
980
  }
981
981
  }),
982
982
  S(() => o),
983
- Pe((r) => (O.error(
983
+ ve((r) => (O.error(
984
984
  `Error while trying to fetch or load resource for item ${e.id}`,
985
985
  s
986
986
  ), O.error(r), w(o)))
@@ -1068,7 +1068,7 @@ const Oe = (e, t) => {
1068
1068
  `, nn = ({
1069
1069
  pageHeight: e,
1070
1070
  pageWidth: t
1071
- }) => ({ columnHeight: e, columnWidth: t }), ue = (e, t) => {
1071
+ }) => ({ columnHeight: e, columnWidth: t }), ce = (e, t) => {
1072
1072
  e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
1073
1073
  }, on = ({
1074
1074
  minPageSpread: e,
@@ -1082,7 +1082,7 @@ const Oe = (e, t) => {
1082
1082
  }) => {
1083
1083
  const c = e * o;
1084
1084
  if (s != null && s.contentDocument && (s != null && s.contentWindow)) {
1085
- const { viewportDimensions: u, computedScale: d = 1 } = je({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, h = en(
1085
+ const { viewportDimensions: u, computedScale: d = 1 } = je({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, l = o, g = n, h = en(
1086
1086
  {
1087
1087
  ...nn({ pageHeight: n, pageWidth: o }),
1088
1088
  enableTouch: r,
@@ -1090,12 +1090,12 @@ const Oe = (e, t) => {
1090
1090
  },
1091
1091
  u
1092
1092
  );
1093
- if (nt(s, "prose-reader-css", h), u ? ue(s, {
1093
+ if (nt(s, "prose-reader-css", h), u ? ce(s, {
1094
1094
  width: u.width ?? 1,
1095
1095
  height: u.height ?? 1
1096
- }) : ue(s, {
1097
- width: g,
1098
- height: l
1096
+ }) : ce(s, {
1097
+ width: l,
1098
+ height: g
1099
1099
  }), u) {
1100
1100
  s == null || s.style.setProperty("position", "absolute"), s == null || s.style.setProperty("top", "50%"), i === "left" ? (s == null || s.style.setProperty("right", "0"), s == null || s.style.removeProperty("left")) : t === "before" && a ? (s == null || s.style.setProperty("right", "50%"), s == null || s.style.removeProperty("left")) : i === "right" ? (s == null || s.style.setProperty("left", "0"), s == null || s.style.removeProperty("right")) : (s == null || s.style.setProperty(
1101
1101
  "left",
@@ -1111,7 +1111,7 @@ const Oe = (e, t) => {
1111
1111
  );
1112
1112
  } else
1113
1113
  t === "before" ? a ? s == null || s.style.setProperty("margin-right", `${o}px`) : s == null || s.style.setProperty("margin-left", `${o}px`) : (s == null || s.style.removeProperty("margin-left"), s == null || s.style.removeProperty("margin-right"));
1114
- return { width: c, height: l };
1114
+ return { width: c, height: g };
1115
1115
  }
1116
1116
  return { width: c, height: n };
1117
1117
  }, sn = () => `
@@ -1236,7 +1236,7 @@ const Oe = (e, t) => {
1236
1236
  columnWidth: a,
1237
1237
  width: c
1238
1238
  };
1239
- }, It = (e, t) => {
1239
+ }, wt = (e, t) => {
1240
1240
  e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
1241
1241
  }, un = ({
1242
1242
  pageHeight: e,
@@ -1251,8 +1251,8 @@ const Oe = (e, t) => {
1251
1251
  enableTouch: u,
1252
1252
  isUsingVerticalWriting: d
1253
1253
  }) => {
1254
- const g = s * t;
1255
- let l = o;
1254
+ const l = s * t;
1255
+ let g = o;
1256
1256
  const h = (n == null ? void 0 : n.renditionLayout) === "reflowable" && (n == null ? void 0 : n.renditionFlow) === "scrolled-continuous", p = h ? Math.min(400, e) : e;
1257
1257
  i == null || i.style.setProperty("width", `${t}px`), h || i == null || i.style.setProperty("height", `${p}px`);
1258
1258
  const { viewportDimensions: m, computedScale: y = 1 } = je({
@@ -1267,7 +1267,7 @@ const Oe = (e, t) => {
1267
1267
  i,
1268
1268
  "prose-reader-html-renderer-framce-css",
1269
1269
  sn()
1270
- ), It(i, {
1270
+ ), wt(i, {
1271
1271
  width: m.width ?? 1,
1272
1272
  height: m.height ?? 1
1273
1273
  }), i == null || i.style.setProperty("position", "absolute"), i == null || i.style.setProperty("top", "50%"), i == null || i.style.setProperty(
@@ -1284,7 +1284,7 @@ const Oe = (e, t) => {
1284
1284
  }) : an(
1285
1285
  cn({
1286
1286
  isUsingVerticalWriting: d,
1287
- minimumWidth: g,
1287
+ minimumWidth: l,
1288
1288
  pageHeight: p,
1289
1289
  pageWidth: t
1290
1290
  })
@@ -1292,31 +1292,31 @@ const Oe = (e, t) => {
1292
1292
  if (nt(i, "prose-reader-css", C, !0), d)
1293
1293
  x = Math.ceil(
1294
1294
  i.contentDocument.documentElement.scrollHeight / p
1295
- ) * p, It(i, {
1296
- width: g,
1295
+ ) * p, wt(i, {
1296
+ width: l,
1297
1297
  height: x
1298
1298
  });
1299
1299
  else if ((n == null ? void 0 : n.renditionFlow) === "scrolled-continuous")
1300
- x = i.contentDocument.body.scrollHeight, l = x, It(i, {
1301
- width: g,
1300
+ x = i.contentDocument.body.scrollHeight, g = x, wt(i, {
1301
+ width: l,
1302
1302
  height: x
1303
1303
  });
1304
1304
  else {
1305
1305
  const D = Math.ceil(
1306
1306
  i.contentDocument.documentElement.scrollWidth / t
1307
1307
  );
1308
- f ? I = t : I = D * t, It(i, {
1308
+ f ? I = t : I = D * t, wt(i, {
1309
1309
  width: I,
1310
1310
  height: x
1311
1311
  });
1312
1312
  }
1313
1313
  }
1314
- return I % g === 0 ? i == null || i.style.setProperty("margin-left", "0px") : (I = I + t, a && !d && (i == null || i.style.setProperty("margin-left", `${t}px`))), { width: I, height: x };
1314
+ return I % l === 0 ? i == null || i.style.setProperty("margin-left", "0px") : (I = I + t, a && !d && (i == null || i.style.setProperty("margin-left", `${t}px`))), { width: I, height: x };
1315
1315
  }
1316
1316
  return {
1317
- width: g,
1318
- height: l || p,
1319
- latestContentHeightWhenLoaded: l
1317
+ width: l,
1318
+ height: g || p,
1319
+ latestContentHeightWhenLoaded: g
1320
1320
  };
1321
1321
  };
1322
1322
  class dn extends ft {
@@ -1343,13 +1343,13 @@ class dn extends ft {
1343
1343
  $(() => {
1344
1344
  this.attach();
1345
1345
  }),
1346
- Pi,
1346
+ wi,
1347
1347
  Zi({
1348
1348
  context: this.context,
1349
1349
  item: this.item,
1350
1350
  settings: this.settings
1351
1351
  }),
1352
- vi
1352
+ Pi
1353
1353
  );
1354
1354
  }
1355
1355
  onUnload() {
@@ -1360,12 +1360,12 @@ class dn extends ft {
1360
1360
  blankPagePosition: i,
1361
1361
  spreadPosition: n
1362
1362
  }) {
1363
- var d, g;
1363
+ var d, l;
1364
1364
  const { width: o, height: s } = this.context.getPageSize(), a = this.getFrameElement();
1365
1365
  if (!a) return w(void 0);
1366
1366
  const r = !!((d = this.writingMode) != null && d.startsWith("vertical"));
1367
- if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && ((g = this.context.manifest) == null ? void 0 : g.renditionLayout) === "pre-paginated") {
1368
- const l = on({
1367
+ if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && ((l = this.context.manifest) == null ? void 0 : l.renditionLayout) === "pre-paginated") {
1368
+ const g = on({
1369
1369
  blankPagePosition: i,
1370
1370
  enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
1371
1371
  frameElement: a,
@@ -1375,7 +1375,7 @@ class dn extends ft {
1375
1375
  pageWidth: o,
1376
1376
  spreadPosition: n
1377
1377
  });
1378
- return w(l);
1378
+ return w(g);
1379
1379
  }
1380
1380
  const { latestContentHeightWhenLoaded: c, ...u } = un({
1381
1381
  pageHeight: s,
@@ -1449,7 +1449,7 @@ class dn extends ft {
1449
1449
  return this.getFrameElement();
1450
1450
  }
1451
1451
  }
1452
- const gn = (e) => (t) => {
1452
+ const ln = (e) => (t) => {
1453
1453
  const i = e({
1454
1454
  ...t,
1455
1455
  getRenderer(o) {
@@ -1465,7 +1465,7 @@ const gn = (e) => (t) => {
1465
1465
  function at(e) {
1466
1466
  return e != null;
1467
1467
  }
1468
- let ln = class extends Ne {
1468
+ let gn = class extends Ne {
1469
1469
  computeOutputSettings(t) {
1470
1470
  return t;
1471
1471
  }
@@ -1503,7 +1503,7 @@ class R {
1503
1503
  this.__symbol = Symbol("SpineItemPosition"), this.x = t.x, this.y = t.y;
1504
1504
  }
1505
1505
  }
1506
- class Nt {
1506
+ class Dt {
1507
1507
  constructor(t) {
1508
1508
  this.__symbol = Symbol("SpineItemPagePosition"), this.x = t.x, this.y = t.y;
1509
1509
  }
@@ -1528,17 +1528,20 @@ class ke {
1528
1528
  this.x = t.x, this.y = t.y;
1529
1529
  }
1530
1530
  }
1531
- class L extends ke {
1531
+ class F extends ke {
1532
1532
  constructor() {
1533
1533
  super(...arguments), this.__symbol = "SpinePosition";
1534
1534
  }
1535
+ static from(t) {
1536
+ return new F(t);
1537
+ }
1535
1538
  }
1536
- class Rt extends ke {
1539
+ class It extends ke {
1537
1540
  constructor() {
1538
1541
  super(...arguments), this.__symbol = "UnsafeSpinePosition";
1539
1542
  }
1540
1543
  static from(t) {
1541
- return new Rt(t);
1544
+ return new It(t);
1542
1545
  }
1543
1546
  }
1544
1547
  const mn = (e, t) => {
@@ -1547,7 +1550,7 @@ const mn = (e, t) => {
1547
1550
  x: u / r,
1548
1551
  y: d / c
1549
1552
  };
1550
- }, fn = (e, t) => new Rt(
1553
+ }, fn = (e, t) => new It(
1551
1554
  mn(e, t)
1552
1555
  ), yn = (e) => ({
1553
1556
  getSpinePositionFromClientPosition: (t) => e.spine.element ? fn(t, e.spine.element) : void 0
@@ -1563,8 +1566,8 @@ const mn = (e, t) => {
1563
1566
  visibility: hidden;
1564
1567
  `, c.appendChild(t), () => {
1565
1568
  t == null || t.remove(), t = void 0;
1566
- })) : gt)
1567
- ), n = (c) => ii(c, rt).pipe(
1569
+ })) : lt)
1570
+ ), n = (c) => ei(c, rt).pipe(
1568
1571
  k(() => {
1569
1572
  t == null || t.style.setProperty(
1570
1573
  "visibility",
@@ -1579,7 +1582,7 @@ const mn = (e, t) => {
1579
1582
  );
1580
1583
  })
1581
1584
  ), s = n(e.viewportFree$).pipe(
1582
- pi(1)
1585
+ gi(1)
1583
1586
  ), r = e.settings.values$.pipe(
1584
1587
  Y(() => e.settings.values.computedPageTurnMode),
1585
1588
  Z()
@@ -1607,18 +1610,37 @@ const mn = (e, t) => {
1607
1610
  }
1608
1611
  }
1609
1612
  );
1610
- }, In = (e, t) => t.pipe(
1611
- $((i) => {
1612
- e.viewport.value.element.style.transition = "transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275)", e.settings.values.computedPageTurnMode === "scrollable" ? e.viewport.value.element.style.transformOrigin = "top" : e.viewport.value.element.style.transformOrigin = "center", i === "thumbnails" ? e.viewport.value.element.style.transform = "scale(0.5)" : e.viewport.value.element.style.transform = "scale(1)", e.layout();
1613
+ }, ue = 200, In = (e, t, i) => {
1614
+ const n = e.clientWidth, o = e.clientHeight, s = e.scrollLeft, a = e.scrollTop, r = s + n / 2, c = a + o / 2, u = i / t, d = r * u, l = c * u, g = d - n / 2, h = l - o / 2;
1615
+ return { newScrollLeft: g, newScrollTop: h };
1616
+ }, wn = (e, t) => t.pipe(
1617
+ P((i) => {
1618
+ var l;
1619
+ const n = e.navigation.scrollNavigationController.value.element, o = e.viewport.value.element, s = e.settings.values.computedPageTurnMode === "scrollable";
1620
+ o.style.transition = `transform ${ue}ms`, s ? o.style.transformOrigin = "top" : o.style.transformOrigin = "center";
1621
+ const a = o.style.transform, r = a.includes("scale") ? parseFloat(((l = a.match(/scale\(([^)]+)\)/)) == null ? void 0 : l[1]) || "1") : 1, c = i === "thumbnails" ? 0.5 : 1, { newScrollLeft: u, newScrollTop: d } = In(
1622
+ n ?? Di(),
1623
+ r,
1624
+ c
1625
+ );
1626
+ return e.viewport.value.element.style.transform = `scale(${c})`, n == null || n.scrollTo({
1627
+ left: Math.max(0, u),
1628
+ top: Math.max(0, d),
1629
+ behavior: "instant"
1630
+ }), kt(s ? 0 : ue).pipe(
1631
+ $(() => {
1632
+ e.layout();
1633
+ })
1634
+ );
1613
1635
  })
1614
- ), wn = (e) => (t) => {
1636
+ ), Pn = (e) => (t) => {
1615
1637
  const {
1616
1638
  pageHorizontalMargin: i,
1617
1639
  pageVerticalMargin: n,
1618
1640
  layoutAutoResize: o,
1619
1641
  layoutLayerTransition: s,
1620
1642
  viewportMode: a
1621
- } = t, r = e(t), c = new ln(
1643
+ } = t, r = e(t), c = new gn(
1622
1644
  {
1623
1645
  pageHorizontalMargin: i,
1624
1646
  pageVerticalMargin: n,
@@ -1635,12 +1657,12 @@ const mn = (e, t) => {
1635
1657
  !m && f && (f.getBoundingClientRect().left, m = !0);
1636
1658
  });
1637
1659
  }), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
1638
- const y = r.spineItemsManager.get(m.id), f = m.mediaType ?? Mt(m.href), b = !!(f != null && f.startsWith("image/")), { pageHorizontalMargin: I = 0, pageVerticalMargin: x = 0 } = c.values, F = r.context.getPageSize();
1660
+ const y = r.spineItemsManager.get(m.id), f = m.mediaType ?? Mt(m.href), b = !!(f != null && f.startsWith("image/")), { pageHorizontalMargin: I = 0, pageVerticalMargin: x = 0 } = c.values, L = r.context.getPageSize();
1639
1661
  if ((y == null ? void 0 : y.renditionLayout) === "reflowable" && !b) {
1640
- let C = F.width - I * 2;
1641
- const D = F.height - x * 2;
1642
- let E = F.width - I * 2, J = I * 2;
1643
- y.isUsingVerticalWriting() && (E = F.width - I * 2, C = D, J = x * 2);
1662
+ let C = L.width - I * 2;
1663
+ const D = L.height - x * 2;
1664
+ let E = L.width - I * 2, J = I * 2;
1665
+ y.isUsingVerticalWriting() && (E = L.width - I * 2, C = D, J = x * 2);
1644
1666
  const ct = y == null ? void 0 : y.renderer.getDocumentFrame();
1645
1667
  ct && nt(
1646
1668
  ct,
@@ -1686,34 +1708,34 @@ const mn = (e, t) => {
1686
1708
  _(() => r.context.watch("rootElement")),
1687
1709
  K(at),
1688
1710
  _((m) => Kt(m)),
1689
- hi(100),
1711
+ pi(100),
1690
1712
  K(at),
1691
1713
  k(() => {
1692
1714
  r == null || r.layout();
1693
1715
  })
1694
- ), g = Sn(r);
1716
+ ), l = Sn(r);
1695
1717
  c.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1696
- mi(1),
1718
+ hi(1),
1697
1719
  k(() => {
1698
1720
  r.layout();
1699
1721
  }),
1700
1722
  G(r.$.destroy$)
1701
1723
  ).subscribe();
1702
- const l = r.spineItemsObserver.itemIsReady$.pipe(
1724
+ const g = r.spineItemsObserver.itemIsReady$.pipe(
1703
1725
  k(({ item: m, isReady: y }) => {
1704
1726
  const f = "prose-spineItem-ready";
1705
1727
  y ? m.containerElement.classList.add(f) : m.containerElement.classList.remove(f);
1706
1728
  })
1707
- ), h = In(
1729
+ ), h = wn(
1708
1730
  r,
1709
1731
  c.watch("viewportMode")
1710
1732
  ), p = r.spine.pages.pipe(
1711
1733
  bt({ refCount: !0, bufferSize: 1 })
1712
1734
  );
1713
1735
  return v(
1714
- l,
1715
- u,
1716
1736
  g,
1737
+ u,
1738
+ l,
1717
1739
  d,
1718
1740
  h,
1719
1741
  p
@@ -1727,9 +1749,9 @@ const mn = (e, t) => {
1727
1749
  layoutInfo$: p,
1728
1750
  coordinates: yn(r)
1729
1751
  };
1730
- }, Pn = `${pt}-enhancer-loading`, We = `${Pn}-container`, vn = (e, t) => {
1752
+ }, vn = `${pt}-enhancer-loading`, Ue = `${vn}-container`, xn = (e, t) => {
1731
1753
  const i = e.ownerDocument.createElement("div");
1732
- return i.classList.add(We), i.style.cssText = `
1754
+ return i.classList.add(Ue), i.style.cssText = `
1733
1755
  height: 100%;
1734
1756
  width: 100%;
1735
1757
  max-width: ${t.state.visibleAreaRect.width}px;
@@ -1745,7 +1767,7 @@ const mn = (e, t) => {
1745
1767
  background-color: white;
1746
1768
  z-index: 1;
1747
1769
  `, i;
1748
- }, xn = ({
1770
+ }, $n = ({
1749
1771
  container: e,
1750
1772
  item: t
1751
1773
  }) => {
@@ -1762,20 +1784,20 @@ const mn = (e, t) => {
1762
1784
  max-width: 300px;
1763
1785
  width: 80%;
1764
1786
  `, e.appendChild(i), e.appendChild(n), e;
1765
- }, $n = (e) => (t) => {
1766
- const { loadingElementCreate: i = xn } = t, n = e(t), o = (c) => w(
1767
- c.reduce((u, { item: d, element: g }) => {
1768
- g.style.zIndex = "0";
1769
- const l = g.querySelector(
1770
- `.${We}`
1787
+ }, Tn = (e) => (t) => {
1788
+ const { loadingElementCreate: i = $n } = t, n = e(t), o = (c) => w(
1789
+ c.reduce((u, { item: d, element: l }) => {
1790
+ l.style.zIndex = "0";
1791
+ const g = l.querySelector(
1792
+ `.${Ue}`
1771
1793
  );
1772
- if (l instanceof HTMLElement)
1773
- return u[d.id] = l, u;
1794
+ if (g instanceof HTMLElement)
1795
+ return u[d.id] = g, u;
1774
1796
  const h = i({
1775
- container: vn(g, n.context),
1797
+ container: xn(l, n.context),
1776
1798
  item: d
1777
1799
  });
1778
- return g.appendChild(h), u[d.id] = h, u;
1800
+ return l.appendChild(h), u[d.id] = h, u;
1779
1801
  }, {})
1780
1802
  ), s = (c) => B([n.spine.layout$, n.theme.$.theme$]).pipe(
1781
1803
  Y(([, u]) => ({
@@ -1784,8 +1806,8 @@ const mn = (e, t) => {
1784
1806
  })),
1785
1807
  Z(N),
1786
1808
  k(({ width: u, theme: d }) => {
1787
- Object.values(c).forEach((g) => {
1788
- g.style.setProperty("max-width", `${u}px`), g.style.setProperty(
1809
+ Object.values(c).forEach((l) => {
1810
+ l.style.setProperty("max-width", `${u}px`), l.style.setProperty(
1789
1811
  "color",
1790
1812
  d === "sepia" ? "#939393" : "rgb(202, 202, 202)"
1791
1813
  );
@@ -1793,11 +1815,11 @@ const mn = (e, t) => {
1793
1815
  })
1794
1816
  ), a = (c) => n.spineItemsObserver.itemIsReady$.pipe(
1795
1817
  k(({ item: u, isReady: d }) => {
1796
- var g, l;
1797
- (g = c[u.item.id]) == null || g.style.setProperty(
1818
+ var l, g;
1819
+ (l = c[u.item.id]) == null || l.style.setProperty(
1798
1820
  "visibility",
1799
1821
  d ? "hidden" : "visible"
1800
- ), (l = c[u.item.id]) == null || l.style.setProperty(
1822
+ ), (g = c[u.item.id]) == null || g.style.setProperty(
1801
1823
  "z-index",
1802
1824
  d ? "0" : "1"
1803
1825
  );
@@ -1824,7 +1846,7 @@ const mn = (e, t) => {
1824
1846
  }
1825
1847
  };
1826
1848
  };
1827
- class Tn extends ft {
1849
+ class Fn extends ft {
1828
1850
  getImageElement() {
1829
1851
  const t = this.documentContainer;
1830
1852
  if (t instanceof HTMLImageElement)
@@ -1876,13 +1898,13 @@ class Tn extends ft {
1876
1898
  getDocumentFrame() {
1877
1899
  }
1878
1900
  }
1879
- const Fn = (e) => (t) => {
1901
+ const Ln = (e) => (t) => {
1880
1902
  const i = e({
1881
1903
  ...t,
1882
1904
  getRenderer(a) {
1883
1905
  var d;
1884
1906
  const r = (d = t.getRenderer) == null ? void 0 : d.call(t, a), c = a.mediaType ?? Mt(a.href), u = !!(c != null && c.startsWith("image/"));
1885
- return !r && u ? (g) => new Tn(g) : r;
1907
+ return !r && u ? (l) => new Fn(l) : r;
1886
1908
  }
1887
1909
  }), n = new IntersectionObserver(
1888
1910
  (a) => {
@@ -1891,10 +1913,10 @@ const Fn = (e) => (t) => {
1891
1913
  const c = r.target, u = Array.from(
1892
1914
  ((d = c.contentDocument) == null ? void 0 : d.body.getElementsByTagName("audio")) || []
1893
1915
  );
1894
- r.isIntersecting ? u.forEach((g) => {
1895
- g.hasAttribute("autoplay") && g.paused && g.readyState >= 2 && g.play().catch(console.error);
1896
- }) : u.forEach((g) => {
1897
- g.pause(), g.currentTime = 0;
1916
+ r.isIntersecting ? u.forEach((l) => {
1917
+ l.hasAttribute("autoplay") && l.paused && l.readyState >= 2 && l.play().catch(console.error);
1918
+ }) : u.forEach((l) => {
1919
+ l.pause(), l.currentTime = 0;
1898
1920
  });
1899
1921
  });
1900
1922
  },
@@ -1917,11 +1939,11 @@ const Fn = (e) => (t) => {
1917
1939
  return i.hookManager.register(
1918
1940
  "item.onDocumentLoad",
1919
1941
  ({ destroy: a, itemId: r }) => {
1920
- var g, l;
1921
- const c = (g = i.spineItemsManager.get(r)) == null ? void 0 : g.renderer.getDocumentFrame();
1942
+ var l, g;
1943
+ const c = (l = i.spineItemsManager.get(r)) == null ? void 0 : l.renderer.getDocumentFrame();
1922
1944
  if (!c) return;
1923
1945
  n.observe(c);
1924
- const u = (l = c.contentDocument) == null ? void 0 : l.body.getElementsByTagName("video"), d = Array.from(u || []).map((h) => (o.observe(h), () => o.unobserve(h)));
1946
+ const u = (g = c.contentDocument) == null ? void 0 : g.body.getElementsByTagName("video"), d = Array.from(u || []).map((h) => (o.observe(h), () => o.unobserve(h)));
1925
1947
  a(() => {
1926
1948
  n.unobserve(c), d.forEach((h) => h());
1927
1949
  });
@@ -1932,7 +1954,7 @@ const Fn = (e) => (t) => {
1932
1954
  n.disconnect(), o.disconnect(), i.destroy();
1933
1955
  }
1934
1956
  };
1935
- }, Ln = (e, t) => e.links$.pipe(
1957
+ }, Mn = (e, t) => e.links$.pipe(
1936
1958
  $((i) => {
1937
1959
  var a;
1938
1960
  if (!Oi(i.target, "a") || i.type !== "click") return;
@@ -1941,7 +1963,7 @@ const Fn = (e) => (t) => {
1941
1963
  (r) => r.href === o
1942
1964
  )) && t.goToUrl(n);
1943
1965
  })
1944
- ), st = O.namespace("navigation"), Mn = ({
1966
+ ), st = O.namespace("navigation"), Cn = ({
1945
1967
  position: e,
1946
1968
  spineItem: t,
1947
1969
  pageHeight: i,
@@ -1973,7 +1995,7 @@ const Fn = (e) => (t) => {
1973
1995
  const u = o.getSpineItemPositionFromSpinePosition(
1974
1996
  e,
1975
1997
  r
1976
- ), d = Mn({
1998
+ ), d = Cn({
1977
1999
  position: u,
1978
2000
  spineItem: r,
1979
2001
  pageHeight: s.getPageSize().height,
@@ -1987,15 +2009,15 @@ const Fn = (e) => (t) => {
1987
2009
  spineItemPosition: d,
1988
2010
  spineItem: r
1989
2011
  }) : t.getAdjustedPositionWithSafeEdge(
1990
- a === "horizontal" ? new L({
2012
+ a === "horizontal" ? new F({
1991
2013
  x: e.x - s.getPageSize().width,
1992
2014
  y: 0
1993
- }) : new L({
2015
+ }) : new F({
1994
2016
  y: e.y - s.getPageSize().height,
1995
2017
  x: 0
1996
2018
  })
1997
2019
  );
1998
- }, Cn = ({
2020
+ }, Rn = ({
1999
2021
  position: e,
2000
2022
  spineItem: t,
2001
2023
  context: i,
@@ -2037,7 +2059,7 @@ const Fn = (e) => (t) => {
2037
2059
  return n.getAdjustedPositionForSpread(c);
2038
2060
  }
2039
2061
  return n.getAdjustedPositionForSpread(r);
2040
- }, Rn = ({
2062
+ }, An = ({
2041
2063
  position: e,
2042
2064
  spineItem: t,
2043
2065
  pageHeight: i,
@@ -2055,7 +2077,7 @@ const Fn = (e) => (t) => {
2055
2077
  s,
2056
2078
  t
2057
2079
  );
2058
- }, ge = ({
2080
+ }, le = ({
2059
2081
  position: e,
2060
2082
  navigationResolver: t,
2061
2083
  computedPageTurnDirection: i,
@@ -2069,7 +2091,7 @@ const Fn = (e) => (t) => {
2069
2091
  const u = o.getSpineItemPositionFromSpinePosition(
2070
2092
  e,
2071
2093
  r
2072
- ), d = Rn({
2094
+ ), d = An({
2073
2095
  position: u,
2074
2096
  spineItem: r,
2075
2097
  pageHeight: s.getPageSize().height,
@@ -2083,15 +2105,15 @@ const Fn = (e) => (t) => {
2083
2105
  spineItemPosition: d,
2084
2106
  spineItem: r
2085
2107
  }) : t.getAdjustedPositionWithSafeEdge(
2086
- a === "horizontal" ? new L({
2108
+ a === "horizontal" ? new F({
2087
2109
  x: e.x + s.getPageSize().width,
2088
2110
  y: 0
2089
- }) : new L({
2111
+ }) : new F({
2090
2112
  y: e.y + s.getPageSize().height,
2091
2113
  x: 0
2092
2114
  })
2093
2115
  );
2094
- }, An = ({
2116
+ }, Dn = ({
2095
2117
  position: e,
2096
2118
  spineItem: t,
2097
2119
  context: i,
@@ -2100,7 +2122,7 @@ const Fn = (e) => (t) => {
2100
2122
  spineLocator: s,
2101
2123
  computedPageTurnDirection: a
2102
2124
  }) => {
2103
- const r = ge({
2125
+ const r = le({
2104
2126
  position: e,
2105
2127
  context: i,
2106
2128
  navigationResolver: n,
@@ -2125,7 +2147,7 @@ const Fn = (e) => (t) => {
2125
2147
  );
2126
2148
  if (a === "vertical" && e.y !== r.y)
2127
2149
  return n.getAdjustedPositionForSpread(r);
2128
- const c = ge({
2150
+ const c = le({
2129
2151
  position: r,
2130
2152
  context: i,
2131
2153
  navigationResolver: n,
@@ -2137,9 +2159,9 @@ const Fn = (e) => (t) => {
2137
2159
  }
2138
2160
  return n.getAdjustedPositionForSpread(r);
2139
2161
  };
2140
- class Dn {
2162
+ class Nn {
2141
2163
  constructor(t) {
2142
- this.reader = t, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2164
+ this.reader = t, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new F({ x: 0, y: 0 }), this.unlock = void 0;
2143
2165
  }
2144
2166
  turnRight() {
2145
2167
  return this.turnRightOrBottom();
@@ -2156,7 +2178,7 @@ class Dn {
2156
2178
  turnRightOrBottom() {
2157
2179
  const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
2158
2180
  if (!i) return;
2159
- const n = An({
2181
+ const n = Dn({
2160
2182
  context: this.reader.context,
2161
2183
  navigationResolver: this.reader.navigation.navigationResolver,
2162
2184
  position: t.position,
@@ -2172,7 +2194,7 @@ class Dn {
2172
2194
  turnLeftOrTop() {
2173
2195
  const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
2174
2196
  if (!i) return;
2175
- const n = Cn({
2197
+ const n = Rn({
2176
2198
  context: this.reader.context,
2177
2199
  navigationResolver: this.reader.navigation.navigationResolver,
2178
2200
  position: t.position,
@@ -2312,9 +2334,9 @@ class Dn {
2312
2334
  }
2313
2335
  }
2314
2336
  }
2315
- class Nn {
2337
+ class On {
2316
2338
  constructor(t) {
2317
- this.reader = t, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new L({ x: 0, y: 0 }), this.lastStartPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2339
+ this.reader = t, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new F({ x: 0, y: 0 }), this.lastStartPosition = new F({ x: 0, y: 0 }), this.unlock = void 0;
2318
2340
  }
2319
2341
  moveTo(t, { final: i, start: n } = {}) {
2320
2342
  var a, r, c, u;
@@ -2328,12 +2350,12 @@ class Nn {
2328
2350
  n && ((a = this.unlock) == null || a.call(this), this.unlock = this.reader.navigation.lock(), this.lastDelta = { x: 0, y: 0 }, this.lastStartPosition = this.reader.navigation.controlledNavigationController.viewportPosition, this.lastPosition = this.lastStartPosition);
2329
2351
  let s = this.reader.navigation.getNavigation().position;
2330
2352
  if (t) {
2331
- const d = this.reader.viewport.absoluteViewport.width / this.reader.viewport.relativeViewport.width, g = Math.floor(t.x) - (((r = this.lastDelta) == null ? void 0 : r.x) || 0), l = Math.floor(t.y) - (((c = this.lastDelta) == null ? void 0 : c.y) || 0), h = Math.floor(
2332
- o === "horizontal" ? this.lastPosition.x - g / d : 0
2353
+ const d = this.reader.viewport.absoluteViewport.width / this.reader.viewport.relativeViewport.width, l = Math.floor(t.x) - (((r = this.lastDelta) == null ? void 0 : r.x) || 0), g = Math.floor(t.y) - (((c = this.lastDelta) == null ? void 0 : c.y) || 0), h = Math.floor(
2354
+ o === "horizontal" ? this.lastPosition.x - l / d : 0
2333
2355
  ), p = Math.floor(
2334
- o === "horizontal" ? 0 : this.lastPosition.y - l / d
2356
+ o === "horizontal" ? 0 : this.lastPosition.y - g / d
2335
2357
  );
2336
- s = new L({
2358
+ s = new F({
2337
2359
  x: h,
2338
2360
  y: p
2339
2361
  }), this.lastDelta = t;
@@ -2352,7 +2374,7 @@ class Nn {
2352
2374
  });
2353
2375
  }
2354
2376
  }
2355
- const On = (e) => e.pagination.state$.pipe(
2377
+ const Vn = (e) => e.pagination.state$.pipe(
2356
2378
  A(e.context.manifest$, e.settings.values$),
2357
2379
  S(
2358
2380
  ([
@@ -2360,10 +2382,10 @@ const On = (e) => e.pagination.state$.pipe(
2360
2382
  { spineItems: i, readingDirection: n },
2361
2383
  { computedPageTurnDirection: o }
2362
2384
  ]) => {
2363
- const s = i.length ?? 0, a = t.beginSpineItemIndex === 0, r = t.endSpineItemIndex === Math.max(s - 1, 0), c = t.endSpineItemIndex === Math.max(s - 1, 0), u = t.beginSpineItemIndex === 0, d = t.beginPageIndexInSpineItem === 0, g = t.endPageIndexInSpineItem === t.endNumberOfPagesInSpineItem - 1;
2385
+ const s = i.length ?? 0, a = t.beginSpineItemIndex === 0, r = t.endSpineItemIndex === Math.max(s - 1, 0), c = t.endSpineItemIndex === Math.max(s - 1, 0), u = t.beginSpineItemIndex === 0, d = t.beginPageIndexInSpineItem === 0, l = t.endPageIndexInSpineItem === t.endNumberOfPagesInSpineItem - 1;
2364
2386
  return {
2365
2387
  canTurnLeft: o === "vertical" ? !1 : !d,
2366
- canTurnRight: o === "vertical" ? !1 : !g,
2388
+ canTurnRight: o === "vertical" ? !1 : !l,
2367
2389
  canGoTopSpineItem: o === "vertical" && !a,
2368
2390
  canGoBottomSpineItem: o === "vertical" && !r,
2369
2391
  canGoLeftSpineItem: o !== "vertical" && (n === "ltr" && !a || n === "rtl" && !c),
@@ -2372,7 +2394,7 @@ const On = (e) => e.pagination.state$.pipe(
2372
2394
  }
2373
2395
  ),
2374
2396
  H(N)
2375
- ), Vn = ({ reader: e, duration: t }) => (i) => {
2397
+ ), jn = ({ reader: e, duration: t }) => (i) => {
2376
2398
  let n;
2377
2399
  const o = () => {
2378
2400
  n == null || n(), n = void 0;
@@ -2381,25 +2403,25 @@ const On = (e) => e.pagination.state$.pipe(
2381
2403
  $(() => {
2382
2404
  n || (n = e == null ? void 0 : e.navigation.lock());
2383
2405
  }),
2384
- ni(t, rt, {
2406
+ ii(t, rt, {
2385
2407
  trailing: !0,
2386
2408
  leading: !0
2387
2409
  }),
2388
2410
  $(o),
2389
2411
  dt(o)
2390
2412
  );
2391
- }, jn = (e) => (t) => {
2392
- const i = e(t), n = On(i), o = new Dn(i), s = new Nn(i), a = (c) => {
2413
+ }, kn = (e) => (t) => {
2414
+ const i = e(t), n = Vn(i), o = new Nn(i), s = new On(i), a = (c) => {
2393
2415
  const { cfi: u, ...d } = c;
2394
2416
  i.load(d), u && o.goToCfi(u, { animate: !1 });
2395
2417
  };
2396
- return Ln(i, o).pipe(T(i.$.destroy$)).subscribe(), {
2418
+ return Mn(i, o).pipe(T(i.$.destroy$)).subscribe(), {
2397
2419
  ...i,
2398
2420
  load: a,
2399
2421
  navigation: {
2400
2422
  ...i.navigation,
2401
2423
  state$: n,
2402
- throttleLock: ({ duration: c, trigger: u }) => u.pipe(Vn({ duration: c, reader: i })),
2424
+ throttleLock: ({ duration: c, trigger: u }) => u.pipe(jn({ duration: c, reader: i })),
2403
2425
  moveTo: s.moveTo.bind(s),
2404
2426
  turnBottom: o.turnBottom.bind(o),
2405
2427
  turnTop: o.turnTop.bind(o),
@@ -2422,16 +2444,16 @@ const On = (e) => e.pagination.state$.pipe(
2422
2444
  goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
2423
2445
  }
2424
2446
  };
2425
- }, lt = (e) => Ut({
2447
+ }, gt = (e) => Wt({
2426
2448
  spineIndex: e.index,
2427
2449
  spineId: e.id
2428
- }), Ue = ({
2450
+ }), We = ({
2429
2451
  nodeOrRange: e,
2430
2452
  offset: t,
2431
2453
  item: i
2432
2454
  }) => {
2433
2455
  const n = "ownerDocument" in e ? e.ownerDocument : e.startContainer.ownerDocument;
2434
- return !n || !(n != null && n.documentElement) || e === n ? lt(i) : Vi(e) ? Ut({
2456
+ return !n || !(n != null && n.documentElement) || e === n ? gt(i) : Vi(e) ? Wt({
2435
2457
  start: {
2436
2458
  node: e.startContainer,
2437
2459
  offset: e.startOffset,
@@ -2444,7 +2466,7 @@ const On = (e) => e.pagination.state$.pipe(
2444
2466
  spineIndex: i.index,
2445
2467
  spineId: i.id
2446
2468
  }
2447
- }) : Ut({
2469
+ }) : Wt({
2448
2470
  node: e,
2449
2471
  offset: t,
2450
2472
  spineIndex: i.index,
@@ -2459,23 +2481,23 @@ const On = (e) => e.pagination.state$.pipe(
2459
2481
  const n = i.pages.value.pages.find(
2460
2482
  (r) => r.itemIndex === t.index && r.pageIndex === e
2461
2483
  ), o = n == null ? void 0 : n.firstVisibleNode, s = t.renderer.getDocumentFrame();
2462
- return o && s instanceof HTMLIFrameElement && ((a = s.contentWindow) != null && a.document) ? Ue({
2484
+ return o && s instanceof HTMLIFrameElement && ((a = s.contentWindow) != null && a.document) ? We({
2463
2485
  nodeOrRange: o.node,
2464
2486
  offset: o.offset,
2465
2487
  item: t.item
2466
- }).trim() : lt(t.item);
2467
- }, kn = (e, t) => Ue({
2488
+ }).trim() : gt(t.item);
2489
+ }, Un = (e, t) => We({
2468
2490
  nodeOrRange: e,
2469
2491
  item: t
2470
- }), Ns = (e) => e.index.toString(), le = (e) => {
2492
+ }), Os = (e) => e.index.toString(), ge = (e) => {
2471
2493
  var t;
2472
2494
  return ((t = e[0]) == null ? void 0 : t.index) === 6 && e.length > 1;
2473
2495
  }, Et = (e) => {
2474
- const t = Te(e);
2475
- return Si(t);
2476
- }, Wn = (e) => Array.isArray(e) ? e[0] && le(e[0]) ? e[0] : void 0 : e.parent[0] && le(e.parent[0]) ? e.parent[0] : void 0, ee = (e) => {
2477
- var c, u, d, g;
2478
- const t = Te(e), n = (Wn(t) ?? [])[1], s = ((n == null ? void 0 : n.index) ?? 2) / 2 - 1, a = bi(t), r = a ? (u = (c = t.end.at(-1)) == null ? void 0 : c.at(-1)) == null ? void 0 : u.offset : (g = (d = t.at(-1)) == null ? void 0 : d.at(-1)) == null ? void 0 : g.offset;
2496
+ const t = Fe(e);
2497
+ return yi(t);
2498
+ }, Wn = (e) => Array.isArray(e) ? e[0] && ge(e[0]) ? e[0] : void 0 : e.parent[0] && ge(e.parent[0]) ? e.parent[0] : void 0, ee = (e) => {
2499
+ var c, u, d, l;
2500
+ const t = Fe(e), n = (Wn(t) ?? [])[1], s = ((n == null ? void 0 : n.index) ?? 2) / 2 - 1, a = Si(t), r = a ? (u = (c = t.end.at(-1)) == null ? void 0 : c.at(-1)) == null ? void 0 : u.offset : (l = (d = t.at(-1)) == null ? void 0 : d.at(-1)) == null ? void 0 : l.offset;
2479
2501
  return {
2480
2502
  isCfiRange: a,
2481
2503
  cleanedCfi: e,
@@ -2491,20 +2513,21 @@ const On = (e) => e.pagination.state$.pipe(
2491
2513
  if (!o)
2492
2514
  return {
2493
2515
  ...n,
2494
- itemIndex: i
2516
+ itemIndex: i,
2517
+ node: null
2495
2518
  };
2496
2519
  const s = o.renderer.getDocumentFrame();
2497
2520
  if (s instanceof HTMLIFrameElement) {
2498
2521
  const c = (a = s.contentWindow) == null ? void 0 : a.document;
2499
2522
  if (c)
2500
2523
  try {
2501
- const u = Ii(e, c, {
2524
+ const u = bi(e, c, {
2502
2525
  throwOnError: !0
2503
2526
  });
2504
2527
  return {
2505
2528
  ...n,
2506
2529
  itemIndex: i,
2507
- node: u.isRange ? (r = u.node) == null ? void 0 : r.startContainer : u.node,
2530
+ node: u.isRange ? ((r = u.node) == null ? void 0 : r.startContainer) ?? null : u.node ?? null,
2508
2531
  isCfiRange: u.isRange,
2509
2532
  range: u.isRange ? u.node : void 0,
2510
2533
  offset: Array.isArray(u.offset) ? u.offset.at(-1) : u.offset,
@@ -2514,41 +2537,45 @@ const On = (e) => e.pagination.state$.pipe(
2514
2537
  return O.warn(`Error resolving cfi: ${e}.`), O.warn(u), {
2515
2538
  ...n,
2516
2539
  spineItem: o,
2517
- itemIndex: i
2540
+ itemIndex: i,
2541
+ node: null
2518
2542
  };
2519
2543
  }
2520
2544
  }
2521
2545
  return {
2522
2546
  ...n,
2523
2547
  itemIndex: i,
2524
- spineItem: o
2548
+ spineItem: o,
2549
+ node: null
2525
2550
  };
2526
- }, Un = (e, t) => {
2551
+ }, zn = (e, t) => {
2527
2552
  if ("cfi" in t) {
2528
2553
  const { itemIndex: s, ...a } = e.cfi.parseCfi(t.cfi);
2529
2554
  return {
2530
2555
  ...t,
2531
2556
  ...a,
2532
- itemIndex: s
2557
+ itemIndex: s,
2558
+ node: null
2533
2559
  };
2534
2560
  }
2535
2561
  const i = e.spineItemsManager.get(t);
2536
2562
  if (!i)
2537
2563
  throw new Error("Spine item not found");
2538
- const n = lt(i.item);
2564
+ const n = gt(i.item);
2539
2565
  return {
2540
2566
  ...e.cfi.parseCfi(n),
2541
- cfi: lt(i.item),
2542
- itemIndex: i.index
2567
+ cfi: gt(i.item),
2568
+ itemIndex: i.index,
2569
+ node: null
2543
2570
  };
2544
- }, zn = (e, t) => {
2571
+ }, Hn = (e, t) => {
2545
2572
  let i = e == null ? void 0 : e.itemPageIndex;
2546
2573
  const { itemIndex: n, ...o } = t.cfi.parseCfi(e.cfi), s = t.spineItemsManager.get(n);
2547
2574
  return s ? De().pipe(
2548
2575
  A(s.isReady$),
2549
2576
  S(([, a]) => {
2550
2577
  const {
2551
- node: r,
2578
+ node: r = null,
2552
2579
  offset: c,
2553
2580
  range: u
2554
2581
  } = a ? t.cfi.resolveCfi({ cfi: e.cfi }) : {};
@@ -2557,8 +2584,8 @@ const On = (e) => e.pagination.state$.pipe(
2557
2584
  c ?? 0,
2558
2585
  s
2559
2586
  ) ?? i);
2560
- let g = e == null ? void 0 : e.absolutePageIndex;
2561
- return i === void 0 && (i = 0), g = t.spine.locator._getAbsolutePageIndexFromPageIndex({
2587
+ let l = e == null ? void 0 : e.absolutePageIndex;
2588
+ return i === void 0 && (i = 0), l = t.spine.locator._getAbsolutePageIndexFromPageIndex({
2562
2589
  pageIndex: i,
2563
2590
  spineItemOrId: s
2564
2591
  }) ?? (e == null ? void 0 : e.absolutePageIndex), {
@@ -2566,15 +2593,15 @@ const On = (e) => e.pagination.state$.pipe(
2566
2593
  ...o,
2567
2594
  range: u,
2568
2595
  itemIndex: n,
2569
- startNode: r ?? void 0,
2596
+ node: r,
2570
2597
  startOffset: c,
2571
- absolutePageIndex: g,
2598
+ absolutePageIndex: l,
2572
2599
  itemPageIndex: i
2573
2600
  };
2574
2601
  })
2575
2602
  ) : w({ ...e, itemIndex: n, ...o });
2576
2603
  };
2577
- class Hn {
2604
+ class Bn {
2578
2605
  constructor(t) {
2579
2606
  this.reader = t, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (i) => {
2580
2607
  const n = this.locatorsByKey.get(i);
@@ -2582,13 +2609,13 @@ class Hn {
2582
2609
  }, this.locate = (i, n) => {
2583
2610
  const o = {
2584
2611
  resource: i,
2585
- meta: Un(this.reader, i)
2612
+ meta: zn(this.reader, i)
2586
2613
  };
2587
- return ae(() => {
2614
+ return re(() => {
2588
2615
  const s = this.reader.spineItemsManager.get(
2589
2616
  o.meta.itemIndex ?? 0
2590
2617
  ), a = (s == null ? void 0 : s.renditionLayout) === "reflowable", r = n.mode === "shallow" || !a || !s ? () => {
2591
- } : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in i ? i.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, d = (l) => l.pipe(
2618
+ } : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in i ? i.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, d = (g) => g.pipe(
2592
2619
  dt(() => {
2593
2620
  c && this.deregisterMemoizedStream(c), setTimeout(() => {
2594
2621
  r();
@@ -2598,18 +2625,18 @@ class Hn {
2598
2625
  if (c && u)
2599
2626
  return u.observerCount++, d(
2600
2627
  u.consolidate$.pipe(
2601
- S(({ resource: l, meta: h }) => ({
2602
- resource: l,
2628
+ S(({ resource: g, meta: h }) => ({
2629
+ resource: g,
2603
2630
  meta: h
2604
2631
  }))
2605
2632
  )
2606
2633
  );
2607
- const g = this.reader.spine.layout$.pipe(
2634
+ const l = this.reader.spine.layout$.pipe(
2608
2635
  St(10),
2609
2636
  it(o),
2610
- oi((l) => zn(l.meta, this.reader).pipe(
2637
+ ni((g) => Hn(g.meta, this.reader).pipe(
2611
2638
  S((h) => ({
2612
- ...l,
2639
+ ...g,
2613
2640
  meta: h
2614
2641
  }))
2615
2642
  ), o),
@@ -2617,16 +2644,16 @@ class Hn {
2617
2644
  );
2618
2645
  return c && this.locatorsByKey.set(c, {
2619
2646
  observerCount: 1,
2620
- consolidate$: g
2621
- }), d(g);
2647
+ consolidate$: l
2648
+ }), d(l);
2622
2649
  });
2623
2650
  };
2624
2651
  }
2625
2652
  locateResource(t, i) {
2626
- return Array.isArray(t) ? ae(
2653
+ return Array.isArray(t) ? re(
2627
2654
  () => B(
2628
2655
  t.map((n) => this.locate(n, i ?? {}))
2629
- ).pipe(si([]))
2656
+ ).pipe(oi([]))
2630
2657
  ) : this.locate(t, i ?? {});
2631
2658
  }
2632
2659
  }
@@ -2638,8 +2665,8 @@ const He = (e, t, i) => {
2638
2665
  const a = s.href.indexOf("#"), r = a > 0 ? s.href.substr(0, a) : s.href, c = r.substring(
2639
2666
  0,
2640
2667
  r.lastIndexOf("/")
2641
- ), u = e.substring(0, e.lastIndexOf("/")), d = e.endsWith(r), g = u !== "" && u.endsWith(c);
2642
- if (d || g) {
2668
+ ), u = e.substring(0, e.lastIndexOf("/")), d = e.endsWith(r), l = u !== "" && u.endsWith(c);
2669
+ if (d || l) {
2643
2670
  const h = i.spineItems.findIndex(
2644
2671
  (f) => f.href === s.href
2645
2672
  );
@@ -2655,20 +2682,20 @@ const He = (e, t, i) => {
2655
2682
  }
2656
2683
  return o;
2657
2684
  }, void 0);
2658
- }, Bn = (e, t) => {
2685
+ }, En = (e, t) => {
2659
2686
  var n;
2660
2687
  const { href: i } = t;
2661
2688
  return He(i, ((n = e.nav) == null ? void 0 : n.toc) ?? [], e);
2662
- }, En = (e) => {
2689
+ }, _n = (e) => {
2663
2690
  const t = e.context.manifest, i = e.spineItemsManager.items;
2664
2691
  return t ? i.reduce(
2665
- (n, { item: o }) => (n[o.id] = Bn(t, o), n),
2692
+ (n, { item: o }) => (n[o.id] = En(t, o), n),
2666
2693
  {}
2667
2694
  ) : {};
2668
- }, _n = (e) => e.spineItemsManager.items$.pipe(
2695
+ }, Xn = (e) => e.spineItemsManager.items$.pipe(
2669
2696
  it([]),
2670
- S(() => En(e))
2671
- ), Xn = (e, t, i) => e + t * i, Yn = (e, t, i) => {
2697
+ S(() => _n(e))
2698
+ ), Yn = (e, t, i) => e + t * i, qn = (e, t, i) => {
2672
2699
  const n = e.context, { height: o, width: s } = i.layout.layoutInfo, { top: a, left: r } = e.spine.getSpineItemSpineLayoutInfo(i);
2673
2700
  return e.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2674
2701
  0,
@@ -2683,28 +2710,28 @@ const He = (e, t, i) => {
2683
2710
  (t.x - r + n.state.visibleAreaRect.width) / s
2684
2711
  )
2685
2712
  );
2686
- }, qn = (e, t, i, n, o) => o.isReady$.pipe(
2713
+ }, Zn = (e, t, i, n, o) => o.isReady$.pipe(
2687
2714
  z(),
2688
2715
  A(e.layoutInfo$),
2689
2716
  S(([s, a]) => {
2690
- var f, b, I, x, F, C, D;
2691
- const r = e.context, c = ((f = r.manifest) == null ? void 0 : f.renditionLayout) === "pre-paginated", u = ((b = r.manifest) == null ? void 0 : b.spineItems.length) || 0, d = ((I = r.manifest) == null ? void 0 : I.spineItems.slice(0, t).reduce((E, J) => E + (J.progressionWeight ?? 0), 0)) || 0, g = e.spineItemsManager.getSpineItemIndex(o) ?? 0, l = ((x = e.context.manifest) == null ? void 0 : x.spineItems.length) ?? 0, h = a.pages.filter((E) => E.itemIndex === g).length ?? 0, p = ((C = (F = r.manifest) == null ? void 0 : F.spineItems[t]) == null ? void 0 : C.progressionWeight) ?? // if no progressionWeight is defined we "assume" the document weight to be
2717
+ var f, b, I, x, L, C, D;
2718
+ const r = e.context, c = ((f = r.manifest) == null ? void 0 : f.renditionLayout) === "pre-paginated", u = ((b = r.manifest) == null ? void 0 : b.spineItems.length) || 0, d = ((I = r.manifest) == null ? void 0 : I.spineItems.slice(0, t).reduce((E, J) => E + (J.progressionWeight ?? 0), 0)) || 0, l = e.spineItemsManager.getSpineItemIndex(o) ?? 0, g = ((x = e.context.manifest) == null ? void 0 : x.spineItems.length) ?? 0, h = a.pages.filter((E) => E.itemIndex === l).length ?? 0, p = ((C = (L = r.manifest) == null ? void 0 : L.spineItems[t]) == null ? void 0 : C.progressionWeight) ?? // if no progressionWeight is defined we "assume" the document weight to be
2692
2719
  // relative to the total number of documents
2693
- (g + 1) / l;
2720
+ (l + 1) / g;
2694
2721
  let m = (i + 1) * (p / h);
2695
2722
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2696
2723
  let y = d + m;
2697
- return ((D = r.manifest) == null ? void 0 : D.renditionFlow) === "scrolled-continuous" && (s ? m = Yn(
2724
+ return ((D = r.manifest) == null ? void 0 : D.renditionFlow) === "scrolled-continuous" && (s ? m = qn(
2698
2725
  e,
2699
2726
  n,
2700
2727
  o
2701
- ) : m = 0, y = Xn(
2728
+ ) : m = 0, y = Yn(
2702
2729
  d,
2703
2730
  p,
2704
2731
  m
2705
2732
  )), t === u - 1 && i === h - 1 && y > 0.99 ? 1 : y;
2706
2733
  })
2707
- ), Zn = (e) => e.spine.layout$.pipe(
2734
+ ), Gn = (e) => e.spine.layout$.pipe(
2708
2735
  St(10, rt),
2709
2736
  A(e.pagination.state$),
2710
2737
  S(() => ({
@@ -2722,7 +2749,7 @@ const He = (e, t, i) => {
2722
2749
  numberOfPagesPerItems: [],
2723
2750
  numberOfTotalPages: 0
2724
2751
  })
2725
- ), Gn = (e, t, i, n) => {
2752
+ ), Jn = (e, t, i, n) => {
2726
2753
  const o = e.context, s = t.beginSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.beginSpineItemIndex) : void 0, a = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
2727
2754
  return w({
2728
2755
  ...t,
@@ -2753,7 +2780,7 @@ const He = (e, t, i) => {
2753
2780
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2754
2781
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2755
2782
  });
2756
- }, Jn = (e) => B([
2783
+ }, Kn = (e) => B([
2757
2784
  e.pagination.state$,
2758
2785
  // Usually pagination change if layout changes (number of pages) however it is especially
2759
2786
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2762,7 +2789,7 @@ const He = (e, t, i) => {
2762
2789
  ]).pipe(
2763
2790
  P(([t]) => {
2764
2791
  const i = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
2765
- return i ? qn(
2792
+ return i ? Zn(
2766
2793
  e,
2767
2794
  t.endSpineItemIndex ?? 0,
2768
2795
  t.endPageIndexInSpineItem || 0,
@@ -2770,8 +2797,8 @@ const He = (e, t, i) => {
2770
2797
  i
2771
2798
  ) : w(0);
2772
2799
  })
2773
- ), Kn = (e) => {
2774
- const t = _n(e), i = Zn(e), n = new U({
2800
+ ), Qn = (e) => {
2801
+ const t = Xn(e), i = Gn(e), n = new W({
2775
2802
  ...e.pagination.state,
2776
2803
  beginChapterInfo: void 0,
2777
2804
  beginCfi: void 0,
@@ -2789,10 +2816,10 @@ const He = (e, t, i) => {
2789
2816
  }), o = B([
2790
2817
  e.pagination.state$,
2791
2818
  t,
2792
- Jn(e)
2819
+ Kn(e)
2793
2820
  ]).pipe(
2794
2821
  P(
2795
- ([a, r, c]) => Gn(
2822
+ ([a, r, c]) => Jn(
2796
2823
  e,
2797
2824
  a,
2798
2825
  r,
@@ -2827,10 +2854,10 @@ const He = (e, t, i) => {
2827
2854
  }),
2828
2855
  tt(1)
2829
2856
  ), getPaginationInfo: () => n.value };
2830
- }, Qn = (e) => (t) => {
2831
- const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = Kn(i);
2857
+ }, to = (e) => (t) => {
2858
+ const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = Qn(i);
2832
2859
  n.pipe(T(i.$.destroy$)).subscribe();
2833
- const s = new Hn(i);
2860
+ const s = new Bn(i);
2834
2861
  return {
2835
2862
  ...i,
2836
2863
  locateResource: s.locateResource.bind(s),
@@ -2844,34 +2871,34 @@ const He = (e, t, i) => {
2844
2871
  }
2845
2872
  }
2846
2873
  };
2847
- }, to = (e) => ({
2874
+ }, eo = (e) => ({
2848
2875
  put: (s, a) => new Promise((r, c) => {
2849
2876
  const u = e.transaction(["store"], "readwrite");
2850
- u.onerror = (l) => {
2851
- c(l);
2877
+ u.onerror = (g) => {
2878
+ c(g);
2852
2879
  }, u.oncomplete = () => {
2853
2880
  r();
2854
2881
  };
2855
- const g = u.objectStore("store").put(a, s);
2856
- g.onsuccess = () => {
2882
+ const l = u.objectStore("store").put(a, s);
2883
+ l.onsuccess = () => {
2857
2884
  r();
2858
- }, g.onerror = (l) => {
2859
- c(l);
2885
+ }, l.onerror = (g) => {
2886
+ c(g);
2860
2887
  };
2861
2888
  }),
2862
2889
  keys: () => new Promise((s, a) => {
2863
2890
  const r = e.transaction(["store"], "readonly");
2864
- r.onerror = (g) => {
2865
- a(g);
2891
+ r.onerror = (l) => {
2892
+ a(l);
2866
2893
  };
2867
2894
  const u = r.objectStore("store").openKeyCursor(), d = [];
2868
2895
  u.onsuccess = () => {
2869
- const g = u.result;
2870
- if (!g) {
2896
+ const l = u.result;
2897
+ if (!l) {
2871
2898
  s(d);
2872
2899
  return;
2873
2900
  }
2874
- d.push(g.key), g.continue();
2901
+ d.push(l.key), l.continue();
2875
2902
  }, u.onerror = () => {
2876
2903
  a(u.error);
2877
2904
  };
@@ -2879,8 +2906,8 @@ const He = (e, t, i) => {
2879
2906
  get: (s) => new Promise((a, r) => {
2880
2907
  const c = e.transaction(["store"], "readwrite"), d = c.objectStore("store").get(s);
2881
2908
  d.onsuccess = () => {
2882
- let g = d.result;
2883
- g === void 0 && (g = null), a(g);
2909
+ let l = d.result;
2910
+ l === void 0 && (l = null), a(l);
2884
2911
  }, c.onerror = () => {
2885
2912
  r(d.error);
2886
2913
  };
@@ -2892,48 +2919,48 @@ const He = (e, t, i) => {
2892
2919
  }, c.oncomplete = () => {
2893
2920
  a();
2894
2921
  }, c.onabort = () => {
2895
- var l;
2896
- const g = d.error ? d.error : (l = d.transaction) == null ? void 0 : l.error;
2897
- r(g);
2922
+ var g;
2923
+ const l = d.error ? d.error : (g = d.transaction) == null ? void 0 : g.error;
2924
+ r(l);
2898
2925
  };
2899
2926
  })
2900
- }), Ot = async (e) => new Promise((t, i) => {
2927
+ }), Nt = async (e) => new Promise((t, i) => {
2901
2928
  const n = window.indexedDB.open(e);
2902
2929
  n.onerror = (o) => {
2903
2930
  i(o);
2904
2931
  }, n.onsuccess = () => {
2905
- t(to(n.result));
2932
+ t(eo(n.result));
2906
2933
  }, n.onupgradeneeded = () => {
2907
2934
  n.result.createObjectStore("store");
2908
2935
  };
2909
- }), eo = (e) => {
2936
+ }), io = (e) => {
2910
2937
  let t = Date.now().toString();
2911
- const i = new W(), n = (c) => {
2938
+ const i = new U(), n = (c) => {
2912
2939
  var u, d;
2913
2940
  if (typeof c == "string" || typeof c == "object") {
2914
- const g = typeof c == "object" ? c.id : c;
2915
- return (u = e.manifest) == null ? void 0 : u.spineItems.find((l) => l.id === g);
2941
+ const l = typeof c == "object" ? c.id : c;
2942
+ return (u = e.manifest) == null ? void 0 : u.spineItems.find((g) => g.id === l);
2916
2943
  }
2917
2944
  return (d = e.manifest) == null ? void 0 : d.spineItems[c];
2918
2945
  }, o = async (c, u) => {
2919
2946
  const d = n(c);
2920
2947
  if (!d) return new Response("Item not found", { status: 404 });
2921
- const l = await (await Ot("prose-reader")).get(`${t}_${d.id}`);
2922
- if (l)
2923
- return new Response(l, { status: 200 });
2948
+ const g = await (await Nt("prose-reader")).get(`${t}_${d.id}`);
2949
+ if (g)
2950
+ return new Response(g, { status: 200 });
2924
2951
  const h = u && await u(d) || await fetch(d.href);
2925
2952
  return s(d, h.clone()), h;
2926
2953
  }, s = (c, u) => {
2927
2954
  i.next({ id: c, data: u });
2928
2955
  };
2929
2956
  i.asObservable().pipe(
2930
- fi(({ id: c, data: u }) => {
2957
+ mi(({ id: c, data: u }) => {
2931
2958
  const d = n(c);
2932
2959
  return d ? j(
2933
- ri([Ot("prose-reader"), j(u.blob())])
2960
+ si([Nt("prose-reader"), j(u.blob())])
2934
2961
  ).pipe(
2935
- _(([g, l]) => j(g.put(`${t}_${d.id}`, l))),
2936
- se((g) => (O.error(g), Q))
2962
+ _(([l, g]) => j(l.put(`${t}_${d.id}`, g))),
2963
+ oe((l) => (O.error(l), Q))
2937
2964
  ) : Q;
2938
2965
  }),
2939
2966
  G(e.destroy$)
@@ -2944,19 +2971,19 @@ const He = (e, t, i) => {
2944
2971
  })
2945
2972
  );
2946
2973
  return v(a).pipe(
2947
- _(() => (O.debug("Cleanup up old cache..."), j(Ot("prose-reader")).pipe(
2974
+ _(() => (O.debug("Cleanup up old cache..."), j(Nt("prose-reader")).pipe(
2948
2975
  _(
2949
2976
  (c) => j(c.keys()).pipe(
2950
2977
  Y(
2951
2978
  (u) => u.filter((d) => !d.toString().startsWith(t))
2952
2979
  ),
2953
2980
  _((u) => {
2954
- const d = u.map((g) => c.remove(g));
2981
+ const d = u.map((l) => c.remove(l));
2955
2982
  return j(Promise.all(d));
2956
2983
  })
2957
2984
  )
2958
2985
  ),
2959
- se((c) => (O.error(c), Q))
2986
+ oe((c) => (O.error(c), Q))
2960
2987
  ))),
2961
2988
  G(e.destroy$)
2962
2989
  ).subscribe(), {
@@ -2965,8 +2992,8 @@ const He = (e, t, i) => {
2965
2992
  i.complete();
2966
2993
  }
2967
2994
  };
2968
- }, io = (e) => (t) => {
2969
- const i = e(t), n = eo(i.context);
2995
+ }, no = (e) => (t) => {
2996
+ const i = e(t), n = io(i.context);
2970
2997
  return {
2971
2998
  ...i,
2972
2999
  // $: {
@@ -2978,7 +3005,7 @@ const He = (e, t, i) => {
2978
3005
  }
2979
3006
  // load,
2980
3007
  };
2981
- }, no = (e, t) => {
3008
+ }, oo = (e, t) => {
2982
3009
  var o;
2983
3010
  const i = (o = e.node.ownerDocument) == null ? void 0 : o.createRange(), n = e.node.compareDocumentPosition(t.node);
2984
3011
  if (i) {
@@ -2999,14 +3026,14 @@ const He = (e, t, i) => {
2999
3026
  }
3000
3027
  return i;
3001
3028
  }
3002
- }, oo = ({
3029
+ }, so = ({
3003
3030
  selection: e,
3004
3031
  spineItem: t
3005
3032
  }) => {
3006
3033
  const { anchorNode: i, anchorOffset: n, focusNode: o, focusOffset: s } = e;
3007
3034
  if (!(!i || !o))
3008
3035
  try {
3009
- return no(
3036
+ return oo(
3010
3037
  { node: i, offset: n },
3011
3038
  { node: o, offset: s }
3012
3039
  );
@@ -3018,22 +3045,22 @@ const He = (e, t, i) => {
3018
3045
  return;
3019
3046
  }
3020
3047
  };
3021
- class so extends X {
3048
+ class ro extends X {
3022
3049
  constructor(t) {
3023
3050
  var n;
3024
3051
  super();
3025
3052
  const i = t.contentDocument || ((n = t.contentWindow) == null ? void 0 : n.document);
3026
3053
  if (!i)
3027
- this.selectionChange$ = gt, this.selectionOver$ = gt;
3054
+ this.selectionChange$ = lt, this.selectionOver$ = lt;
3028
3055
  else {
3029
- const o = ce(i.body, {
3056
+ const o = ae(i.body, {
3030
3057
  childList: !0,
3031
3058
  subtree: !0
3032
3059
  }).pipe(
3033
3060
  M(
3034
3061
  (a) => !!a.find((r) => r.type === "childList" && r.removedNodes.length)
3035
3062
  )
3036
- ), s = t.parentElement ? ce(t.parentElement, {
3063
+ ), s = t.parentElement ? ae(t.parentElement, {
3037
3064
  childList: !0
3038
3065
  }).pipe(
3039
3066
  M(
@@ -3061,7 +3088,7 @@ class so extends X {
3061
3088
  * The selection is still valid during the event even if it will
3062
3089
  * be discarded. The timeout make sure to detect this edge case.
3063
3090
  */
3064
- wt(0),
3091
+ Pt(0),
3065
3092
  S((a) => {
3066
3093
  const r = i.getSelection();
3067
3094
  return r && !r.isCollapsed ? [a, r] : void 0;
@@ -3074,12 +3101,12 @@ class so extends X {
3074
3101
  }
3075
3102
  }
3076
3103
  }
3077
- const ro = (e) => e.loaded$.pipe(
3104
+ const ao = (e) => e.loaded$.pipe(
3078
3105
  P(() => {
3079
3106
  var o;
3080
3107
  const t = e.renderer.getDocumentFrame(), i = (t == null ? void 0 : t.contentDocument) || ((o = t == null ? void 0 : t.contentWindow) == null ? void 0 : o.document);
3081
- if (!t || !i) return gt;
3082
- const n = new so(t);
3108
+ if (!t || !i) return lt;
3109
+ const n = new ro(t);
3083
3110
  return v(
3084
3111
  n.selectionChange$.pipe(
3085
3112
  S((s) => {
@@ -3106,14 +3133,14 @@ const ro = (e) => e.loaded$.pipe(
3106
3133
  );
3107
3134
  }),
3108
3135
  H()
3109
- ), ao = (e) => (t) => {
3136
+ ), co = (e) => (t) => {
3110
3137
  const i = e(t);
3111
3138
  let n;
3112
3139
  const o = i.spineItemsManager.items$.pipe(
3113
3140
  P((d) => {
3114
- const g = d.map((l) => {
3115
- const h = i.spineItemsManager.getSpineItemIndex(l) ?? 0;
3116
- return ro(l).pipe(
3141
+ const l = d.map((g) => {
3142
+ const h = i.spineItemsManager.getSpineItemIndex(g) ?? 0;
3143
+ return ao(g).pipe(
3117
3144
  S((p) => {
3118
3145
  if (p)
3119
3146
  return {
@@ -3123,7 +3150,7 @@ const ro = (e) => e.loaded$.pipe(
3123
3150
  })
3124
3151
  );
3125
3152
  });
3126
- return v(...g);
3153
+ return v(...l);
3127
3154
  }),
3128
3155
  it(void 0),
3129
3156
  H(),
@@ -3161,7 +3188,7 @@ const ro = (e) => e.loaded$.pipe(
3161
3188
  selectionOver$: c,
3162
3189
  lastSelectionOnPointerdown$: u,
3163
3190
  getSelection: () => n,
3164
- createOrderedRangeFromSelection: oo
3191
+ createOrderedRangeFromSelection: so
3165
3192
  }
3166
3193
  };
3167
3194
  }, pe = [
@@ -3179,8 +3206,8 @@ const ro = (e) => e.loaded$.pipe(
3179
3206
  backgroundColor: "#191717",
3180
3207
  foregroundColor: "#f1ebeb"
3181
3208
  }
3182
- ], co = (e) => (t) => {
3183
- const i = e(t), n = new U(
3209
+ ], uo = (e) => (t) => {
3210
+ const i = e(t), n = new W(
3184
3211
  t.theme ?? "bright"
3185
3212
  ), o = () => {
3186
3213
  const r = pe.find(
@@ -3244,7 +3271,7 @@ const ro = (e) => e.loaded$.pipe(
3244
3271
  }
3245
3272
  }
3246
3273
  };
3247
- }, uo = (e) => (t) => ({
3274
+ }, lo = (e) => (t) => ({
3248
3275
  ...e(t),
3249
3276
  utils: {
3250
3277
  isOrIsWithinValidLink: (o) => {
@@ -3264,9 +3291,9 @@ class Be {
3264
3291
  this.reader = t;
3265
3292
  }
3266
3293
  }
3267
- class lo extends Be {
3294
+ class po extends Be {
3268
3295
  constructor() {
3269
- super(...arguments), this.isZooming$ = new U(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3296
+ super(...arguments), this.isZooming$ = new W(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3270
3297
  }
3271
3298
  enter(t) {
3272
3299
  if (!t) {
@@ -3312,7 +3339,7 @@ class lo extends Be {
3312
3339
  ), this.currentScale = i;
3313
3340
  }
3314
3341
  }
3315
- const Tt = ({
3342
+ const he = ({
3316
3343
  newScale: e,
3317
3344
  oldScale: t,
3318
3345
  screenSize: i,
@@ -3321,9 +3348,9 @@ const Tt = ({
3321
3348
  const o = i * e / 2 - i + i / 2, s = i * t / 2 - i + i / 2, a = e / t, r = n - s;
3322
3349
  return Math.max(o + r * a, 0);
3323
3350
  };
3324
- class po extends Be {
3351
+ class ho extends Be {
3325
3352
  constructor() {
3326
- super(...arguments), this.isZooming$ = new U(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3353
+ super(...arguments), this.isZooming$ = new W(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3327
3354
  }
3328
3355
  enter() {
3329
3356
  this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
@@ -3339,13 +3366,13 @@ class po extends Be {
3339
3366
  const i = this.reader.spine.element, n = this.reader.navigation.scrollNavigationController.value.element;
3340
3367
  if (!i || !n) return;
3341
3368
  const o = Math.ceil(t * 100) / 100, s = Math.max(o, 1), a = i.getBoundingClientRect().width / i.offsetWidth, r = n.scrollTop;
3342
- i.style.transform = `scale(${s})`, n.scrollLeft = Tt({
3369
+ i.style.transform = `scale(${s})`, n.scrollLeft = he({
3343
3370
  newScale: s,
3344
3371
  oldScale: a,
3345
3372
  pageSize: n.clientWidth,
3346
3373
  screenSize: i.offsetWidth,
3347
3374
  scrollOffset: n.scrollLeft
3348
- }), n.scrollTop = Tt({
3375
+ }), n.scrollTop = he({
3349
3376
  newScale: s,
3350
3377
  oldScale: a,
3351
3378
  pageSize: n.clientHeight,
@@ -3354,8 +3381,8 @@ class po extends Be {
3354
3381
  }), this.currentScale = o;
3355
3382
  }
3356
3383
  }
3357
- const ho = (e) => (t) => {
3358
- const i = e(t), n = new lo(i), o = new po(i), s = new U(o);
3384
+ const mo = (e) => (t) => {
3385
+ const i = e(t), n = new po(i), o = new ho(i), s = new W(o);
3359
3386
  return {
3360
3387
  ...i,
3361
3388
  destroy: () => {
@@ -3389,7 +3416,7 @@ const ho = (e) => (t) => {
3389
3416
  }, Ee = (e) => (e == null ? void 0 : e.renditionLayout) === "pre-paginated" || (e == null ? void 0 : e.spineItems.every((t) => t.renditionLayout === "pre-paginated"));
3390
3417
  class ht extends ot {
3391
3418
  constructor(t) {
3392
- super((i) => this.stateSubject.pipe(T(this.destroy$)).subscribe(i)), this.destroy$ = new W(), this.stateSubject = new U(t);
3419
+ super((i) => this.stateSubject.pipe(T(this.destroy$)).subscribe(i)), this.destroy$ = new U(), this.stateSubject = new W(t);
3393
3420
  }
3394
3421
  next(t) {
3395
3422
  this.stateSubject.next(t);
@@ -3414,9 +3441,9 @@ class ht extends ot {
3414
3441
  this.stateSubject.complete(), this.destroy$.complete();
3415
3442
  }
3416
3443
  }
3417
- class mo {
3444
+ class fo {
3418
3445
  constructor() {
3419
- this.navigationSubject = new ie(1), this.viewportStateSubject = new U("free"), this.paginationSubject = new ie(), this.navigationIsLockedSubject = new U(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3446
+ this.navigationSubject = new ie(1), this.viewportStateSubject = new W("free"), this.paginationSubject = new ie(), this.navigationIsLockedSubject = new W(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3420
3447
  H(),
3421
3448
  M((t) => !t)
3422
3449
  ), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
@@ -3426,7 +3453,7 @@ class mo {
3426
3453
  ), this.navigation$ = this.navigationSubject.asObservable();
3427
3454
  }
3428
3455
  }
3429
- const fo = ({
3456
+ const yo = ({
3430
3457
  manifest: e,
3431
3458
  visibleAreaRect: t,
3432
3459
  forceSinglePageMode: i
@@ -3434,7 +3461,7 @@ const fo = ({
3434
3461
  const { height: n, width: o } = t, s = o > n;
3435
3462
  return i || (e == null ? void 0 : e.renditionFlow) === "scrolled-continuous" ? !1 : !s && (e == null ? void 0 : e.renditionSpread) === "portrait" ? !0 : s && ((e == null ? void 0 : e.renditionSpread) === void 0 || (e == null ? void 0 : e.renditionSpread) === "auto" || (e == null ? void 0 : e.renditionSpread) === "landscape" || (e == null ? void 0 : e.renditionSpread) === "both");
3436
3463
  };
3437
- class yo extends ht {
3464
+ class So extends ht {
3438
3465
  constructor() {
3439
3466
  super({
3440
3467
  marginBottom: 0,
@@ -3447,7 +3474,7 @@ class yo extends ht {
3447
3474
  x: 0,
3448
3475
  y: 0
3449
3476
  }
3450
- }), this.bridgeEvent = new mo(), this.destroy$ = new W(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
3477
+ }), this.bridgeEvent = new fo(), this.destroy$ = new U(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
3451
3478
  Y((t) => t.manifest),
3452
3479
  K(at),
3453
3480
  Z()
@@ -3478,7 +3505,7 @@ class yo extends ht {
3478
3505
  isFullyPrePaginated: Ee(n),
3479
3506
  assumedRenditionLayout: (n == null ? void 0 : n.renditionLayout) ?? "reflowable"
3480
3507
  },
3481
- isUsingSpreadMode: fo({
3508
+ isUsingSpreadMode: yo({
3482
3509
  manifest: n,
3483
3510
  visibleAreaRect: s,
3484
3511
  forceSinglePageMode: o
@@ -3510,7 +3537,7 @@ class yo extends ht {
3510
3537
  };
3511
3538
  }
3512
3539
  }
3513
- class So extends ht {
3540
+ class bo extends ht {
3514
3541
  constructor(t, i) {
3515
3542
  super({
3516
3543
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3546,7 +3573,7 @@ class So extends ht {
3546
3573
  ).subscribe(this.next.bind(this));
3547
3574
  }
3548
3575
  }
3549
- class bo {
3576
+ class Io {
3550
3577
  constructor() {
3551
3578
  this._hooks = [], this._hookExecutions = [];
3552
3579
  }
@@ -3577,9 +3604,9 @@ class bo {
3577
3604
  (a) => t === a.name
3578
3605
  ).map((a) => {
3579
3606
  let r = () => w(void 0);
3580
- const c = new W(), u = (l) => {
3581
- r = l;
3582
- }, d = () => (c.next(), c.complete(), r() ?? w(void 0)), g = a.runFn({
3607
+ const c = new U(), u = (g) => {
3608
+ r = g;
3609
+ }, d = () => (c.next(), c.complete(), r() ?? w(void 0)), l = a.runFn({
3583
3610
  // biome-ignore lint/suspicious/noExplicitAny: TODO
3584
3611
  ...n,
3585
3612
  destroy$: c.asObservable(),
@@ -3590,7 +3617,7 @@ class bo {
3590
3617
  id: i,
3591
3618
  destroyFn: d,
3592
3619
  ref: a
3593
- }), g;
3620
+ }), l;
3594
3621
  });
3595
3622
  }
3596
3623
  destroy(t, i, n) {
@@ -3610,7 +3637,7 @@ class bo {
3610
3637
  }
3611
3638
  class _e {
3612
3639
  constructor() {
3613
- this.isLockedSubject = new U(0), this.isLocked$ = this.isLockedSubject.pipe(
3640
+ this.isLockedSubject = new W(0), this.isLocked$ = this.isLockedSubject.pipe(
3614
3641
  S((t) => !!t),
3615
3642
  H()
3616
3643
  );
@@ -3622,7 +3649,7 @@ class _e {
3622
3649
  };
3623
3650
  }
3624
3651
  }
3625
- const Io = () => (e) => e.pipe(
3652
+ const wo = () => (e) => e.pipe(
3626
3653
  S(({ navigation: t, pagination: i, ...n }) => ({
3627
3654
  navigation: {
3628
3655
  ...t,
@@ -3630,7 +3657,7 @@ const Io = () => (e) => e.pipe(
3630
3657
  },
3631
3658
  ...n
3632
3659
  }))
3633
- ), wo = (e, t, i) => e.bridgeEvent.pagination$.pipe(
3660
+ ), Po = (e, t, i) => e.bridgeEvent.pagination$.pipe(
3634
3661
  A(t),
3635
3662
  M(
3636
3663
  ([n, o]) => n.navigationId === o.id
@@ -3650,7 +3677,7 @@ const Io = () => (e) => e.pipe(
3650
3677
  }))
3651
3678
  );
3652
3679
  }),
3653
- Io(),
3680
+ wo(),
3654
3681
  H(
3655
3682
  (n, o) => n.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3656
3683
  ),
@@ -3662,7 +3689,7 @@ const Io = () => (e) => e.pipe(
3662
3689
  }
3663
3690
  })
3664
3691
  )
3665
- ), Po = (e) => e.pipe(
3692
+ ), vo = (e) => e.pipe(
3666
3693
  S(([t, i]) => {
3667
3694
  const n = {
3668
3695
  type: "api",
@@ -3671,14 +3698,15 @@ const Io = () => (e) => e.pipe(
3671
3698
  },
3672
3699
  id: Symbol(),
3673
3700
  animation: "turn",
3674
- ...t
3701
+ ...t,
3702
+ position: t.position ? F.from(t.position) : void 0
3675
3703
  };
3676
3704
  return {
3677
3705
  previousNavigation: i,
3678
3706
  navigation: n
3679
3707
  };
3680
3708
  })
3681
- ), vo = ({ navigationResolver: e }) => (t) => t.pipe(
3709
+ ), xo = ({ navigationResolver: e }) => (t) => t.pipe(
3682
3710
  S((i) => {
3683
3711
  if (i.navigation.cfi) {
3684
3712
  const n = e.getNavigationForCfi(
@@ -3695,16 +3723,16 @@ const Io = () => (e) => e.pipe(
3695
3723
  }
3696
3724
  return i;
3697
3725
  })
3698
- ), xo = ({
3726
+ ), $o = ({
3699
3727
  navigation: e,
3700
3728
  previousNavigation: t,
3701
3729
  settings: i
3702
- }) => e.directionFromLastNavigation ? e.directionFromLastNavigation : e.url !== void 0 || e.cfi !== void 0 ? "anchor" : t.spineItem === void 0 || e.spineItem || !e.position ? "forward" : i.values.computedPageTurnDirection === "vertical" ? e.position.y > t.position.y || e.position.y === t.position.y && t.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(e.position.x) > Math.abs(t.position.x) || e.position.x === t.position.x && t.directionFromLastNavigation !== "backward" ? "forward" : "backward", $o = ({
3730
+ }) => e.directionFromLastNavigation ? e.directionFromLastNavigation : e.url !== void 0 || e.cfi !== void 0 ? "anchor" : t.spineItem === void 0 || e.spineItem || !e.position ? "forward" : i.values.computedPageTurnDirection === "vertical" ? e.position.y > t.position.y || e.position.y === t.position.y && t.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(e.position.x) > Math.abs(t.position.x) || e.position.x === t.position.x && t.directionFromLastNavigation !== "backward" ? "forward" : "backward", To = ({
3703
3731
  context: e,
3704
3732
  settings: t
3705
3733
  }) => (i) => i.pipe(
3706
3734
  S(({ navigation: n, previousNavigation: o }) => {
3707
- const s = xo({
3735
+ const s = $o({
3708
3736
  navigation: n,
3709
3737
  previousNavigation: o,
3710
3738
  settings: t
@@ -3718,7 +3746,7 @@ const Io = () => (e) => e.pipe(
3718
3746
  direction: s
3719
3747
  };
3720
3748
  })
3721
- ), To = ({
3749
+ ), Fo = ({
3722
3750
  spineItemsManager: e,
3723
3751
  navigationResolver: t
3724
3752
  }) => (i) => i.pipe(
@@ -3741,12 +3769,12 @@ const Io = () => (e) => e.pipe(
3741
3769
  } : {
3742
3770
  navigation: {
3743
3771
  ...n,
3744
- position: new L({ x: 0, y: 0 })
3772
+ position: new F({ x: 0, y: 0 })
3745
3773
  },
3746
3774
  ...o
3747
3775
  };
3748
3776
  })
3749
- ), he = ({
3777
+ ), me = ({
3750
3778
  settings: e,
3751
3779
  spineItemsManager: t,
3752
3780
  navigationResolver: i,
@@ -3758,7 +3786,7 @@ const Io = () => (e) => e.pipe(
3758
3786
  spineItem: c,
3759
3787
  cfi: u,
3760
3788
  directionFromLastNavigation: d
3761
- } = a, { navigationSnapThreshold: g, computedPageTurnMode: l } = e.values;
3789
+ } = a, { navigationSnapThreshold: l, computedPageTurnMode: g } = e.values;
3762
3790
  if (c !== void 0) {
3763
3791
  const h = t.get(c);
3764
3792
  if (h) return h;
@@ -3769,29 +3797,29 @@ const Io = () => (e) => e.pipe(
3769
3797
  const h = t.getSpineItemFromCfi(u);
3770
3798
  if (h) return h;
3771
3799
  }
3772
- if (r && l === "controlled") {
3800
+ if (r && g === "controlled") {
3773
3801
  const { beginIndex: h, endIndex: p } = n.getVisibleSpineItemsFromPosition({
3774
3802
  position: r,
3775
- threshold: g,
3803
+ threshold: l,
3776
3804
  restrictToScreen: !1
3777
3805
  }) ?? {}, m = (d === "forward" || d === "anchor" ? p : h) ?? h, y = t.get(m);
3778
3806
  if (!y) return;
3779
3807
  const { endPageIndex: f, beginPageIndex: b } = n.getVisiblePagesFromViewportPosition({
3780
3808
  position: r,
3781
3809
  spineItem: y,
3782
- threshold: g,
3810
+ threshold: l,
3783
3811
  restrictToScreen: !1
3784
3812
  }) ?? {}, I = (d === "forward" || d === "anchor" ? f : b) ?? 0, x = i.getNavigationForSpineItemPage({
3785
3813
  pageIndex: I,
3786
3814
  spineItemId: y
3787
- }), F = n.getVisibleSpineItemsFromPosition({
3815
+ }), L = n.getVisibleSpineItemsFromPosition({
3788
3816
  position: x,
3789
- threshold: g,
3817
+ threshold: l,
3790
3818
  restrictToScreen: !1
3791
- }), C = d === "forward" || d === "anchor" ? F == null ? void 0 : F.beginIndex : F == null ? void 0 : F.endIndex;
3819
+ }), C = d === "forward" || d === "anchor" ? L == null ? void 0 : L.beginIndex : L == null ? void 0 : L.endIndex;
3792
3820
  return t.get(C);
3793
3821
  }
3794
- return r && l === "scrollable" ? n.getSpineItemFromPosition(r) : t.get(0);
3822
+ return r && g === "scrollable" ? n.getSpineItemFromPosition(r) : t.get(0);
3795
3823
  };
3796
3824
  return o.pipe(
3797
3825
  S(({ navigation: a, ...r }) => {
@@ -3805,7 +3833,7 @@ const Io = () => (e) => e.pipe(
3805
3833
  };
3806
3834
  })
3807
3835
  );
3808
- }, me = ({ spine: e }) => (t) => t.pipe(
3836
+ }, fe = ({ spine: e }) => (t) => t.pipe(
3809
3837
  P(({ navigation: i, ...n }) => {
3810
3838
  const o = e.getSpineItemSpineLayoutInfo(
3811
3839
  i.spineItem
@@ -3828,7 +3856,7 @@ const Io = () => (e) => e.pipe(
3828
3856
  )
3829
3857
  );
3830
3858
  })
3831
- ), Vt = ({
3859
+ ), Ot = ({
3832
3860
  settings: e,
3833
3861
  spineItemsManager: t,
3834
3862
  spineLocator: i,
@@ -3838,13 +3866,13 @@ const Io = () => (e) => e.pipe(
3838
3866
  const { navigationSnapThreshold: r, computedPageTurnMode: c } = e.values, u = t.get(a.spineItem);
3839
3867
  if (!(!u || !a.position)) {
3840
3868
  if (c === "controlled") {
3841
- const { endPageIndex: d, beginPageIndex: g } = i.getVisiblePagesFromViewportPosition({
3869
+ const { endPageIndex: d, beginPageIndex: l } = i.getVisiblePagesFromViewportPosition({
3842
3870
  position: a.position,
3843
3871
  spineItem: u,
3844
3872
  threshold: r,
3845
3873
  restrictToScreen: !1
3846
- }) ?? {}, l = (a.directionFromLastNavigation === "forward" || a.directionFromLastNavigation === "anchor" ? d : g) ?? 0, h = n.getNavigationForSpineItemPage({
3847
- pageIndex: l,
3874
+ }) ?? {}, g = (a.directionFromLastNavigation === "forward" || a.directionFromLastNavigation === "anchor" ? d : l) ?? 0, h = n.getNavigationForSpineItemPage({
3875
+ pageIndex: g,
3848
3876
  spineItemId: u
3849
3877
  }), p = i.getVisiblePagesFromViewportPosition({
3850
3878
  position: h,
@@ -3872,7 +3900,7 @@ const Io = () => (e) => e.pipe(
3872
3900
  ...r
3873
3901
  }))
3874
3902
  );
3875
- }, Fo = ({ navigationResolver: e }) => (t) => t.pipe(
3903
+ }, Lo = ({ navigationResolver: e }) => (t) => t.pipe(
3876
3904
  S((i) => {
3877
3905
  if (i.navigation.url) {
3878
3906
  const n = e.getNavigationForUrl(
@@ -3890,7 +3918,7 @@ const Io = () => (e) => e.pipe(
3890
3918
  }
3891
3919
  return i;
3892
3920
  })
3893
- ), Lo = ({
3921
+ ), Mo = ({
3894
3922
  spineLocator: e,
3895
3923
  navigation: t,
3896
3924
  navigationResolver: i,
@@ -3905,7 +3933,7 @@ const Io = () => (e) => e.pipe(
3905
3933
  const r = o.getSpineItemSpineLayoutInfo(s), c = e.isPositionWithinSpineItem(
3906
3934
  t.position,
3907
3935
  s
3908
- ), u = r.width - (t.spineItemWidth ?? 0), d = r.height - (t.spineItemHeight ?? 0), g = u !== 0 || d !== 0;
3936
+ ), u = r.width - (t.spineItemWidth ?? 0), d = r.height - (t.spineItemHeight ?? 0), l = u !== 0 || d !== 0;
3909
3937
  if (t.url !== void 0 && (u || d || // when spine item is ready dimensions may have not changed but the position
3910
3938
  // of dom elements may have!
3911
3939
  a && !t.spineItemIsReady)) {
@@ -3915,15 +3943,15 @@ const Io = () => (e) => e.pipe(
3915
3943
  if (m)
3916
3944
  return m.position;
3917
3945
  }
3918
- const l = t.cfi ?? t.paginationBeginCfi;
3919
- if (l !== void 0 && !Et(l) && (u || d || // when spine item is ready dimensions may have not changed but the position
3946
+ const g = t.cfi ?? t.paginationBeginCfi;
3947
+ if (g !== void 0 && !Et(g) && (u || d || // when spine item is ready dimensions may have not changed but the position
3920
3948
  // of dom elements may have!
3921
3949
  a && !t.spineItemIsReady)) {
3922
- const m = i.getNavigationForCfi(l);
3950
+ const m = i.getNavigationForCfi(g);
3923
3951
  if (m)
3924
3952
  return m;
3925
3953
  }
3926
- if (c && g && t.directionFromLastNavigation === "backward") {
3954
+ if (c && l && t.directionFromLastNavigation === "backward") {
3927
3955
  const m = new R({
3928
3956
  x: (((h = t.positionInSpineItem) == null ? void 0 : h.x) ?? 0) + u,
3929
3957
  y: (((p = t.positionInSpineItem) == null ? void 0 : p.y) ?? 0) + d
@@ -3947,8 +3975,8 @@ const Io = () => (e) => e.pipe(
3947
3975
  }
3948
3976
  return c ? i.getNavigationForPosition(t.position) : i.getNavigationForSpineIndexOrId(s);
3949
3977
  })
3950
- ) : w(new L({ x: 0, y: 0 }));
3951
- }, Mo = ({
3978
+ ) : w(new F({ x: 0, y: 0 }));
3979
+ }, Co = ({
3952
3980
  navigation: e,
3953
3981
  spineLocator: t,
3954
3982
  spineItemsManager: i,
@@ -3957,11 +3985,11 @@ const Io = () => (e) => e.pipe(
3957
3985
  spine: s
3958
3986
  }) => {
3959
3987
  const { spineItem: a } = e, r = i.get(a);
3960
- if (!r) return new L({ x: 0, y: 0 });
3988
+ if (!r) return new F({ x: 0, y: 0 });
3961
3989
  const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(r), d = t.isPositionWithinSpineItem(
3962
3990
  e.position,
3963
3991
  r
3964
- ), g = e.positionInSpineItem ?? new R({
3992
+ ), l = e.positionInSpineItem ?? new R({
3965
3993
  y: 0,
3966
3994
  x: 0
3967
3995
  });
@@ -3971,7 +3999,7 @@ const Io = () => (e) => e.pipe(
3971
3999
  if (u === e.spineItemTop && c === e.spineItemHeight && !d)
3972
4000
  return o.getNavigationForSpineIndexOrId(r);
3973
4001
  if (u !== e.spineItemTop) {
3974
- const l = t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
4002
+ const g = t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
3975
4003
  e.positionInSpineItem ?? new R({
3976
4004
  x: 0,
3977
4005
  y: 0
@@ -3979,13 +4007,13 @@ const Io = () => (e) => e.pipe(
3979
4007
  r
3980
4008
  );
3981
4009
  return t.getSpinePositionFromSpineItemPosition({
3982
- spineItemPosition: l,
4010
+ spineItemPosition: g,
3983
4011
  spineItem: r
3984
4012
  });
3985
4013
  }
3986
4014
  if (u === e.spineItemTop && c !== e.spineItemHeight) {
3987
- const l = (e.spineItemHeight ?? g.y) - g.y, h = new R({
3988
- y: e.directionFromLastNavigation === "backward" ? c - l : g.y,
4015
+ const g = (e.spineItemHeight ?? l.y) - l.y, h = new R({
4016
+ y: e.directionFromLastNavigation === "backward" ? c - g : l.y,
3989
4017
  x: e.position.x
3990
4018
  });
3991
4019
  if (d) {
@@ -4001,7 +4029,7 @@ const Io = () => (e) => e.pipe(
4001
4029
  if (!d) {
4002
4030
  if (!(e.position.y < u)) {
4003
4031
  const m = new R({
4004
- y: c - l,
4032
+ y: c - g,
4005
4033
  x: e.position.x
4006
4034
  });
4007
4035
  return t.getSpinePositionFromSpineItemPosition({
@@ -4017,7 +4045,7 @@ const Io = () => (e) => e.pipe(
4017
4045
  }
4018
4046
  }
4019
4047
  return e.position;
4020
- }, Co = ({
4048
+ }, Ro = ({
4021
4049
  navigation: e,
4022
4050
  spineItemsManager: t,
4023
4051
  settings: i,
@@ -4025,7 +4053,7 @@ const Io = () => (e) => e.pipe(
4025
4053
  navigationResolver: o,
4026
4054
  spine: s
4027
4055
  }) => i.values.computedPageTurnMode === "scrollable" ? w(
4028
- Mo({
4056
+ Co({
4029
4057
  navigation: e,
4030
4058
  spineLocator: n,
4031
4059
  navigationResolver: o,
@@ -4033,19 +4061,19 @@ const Io = () => (e) => e.pipe(
4033
4061
  spineItemsManager: t,
4034
4062
  spine: s
4035
4063
  })
4036
- ) : Lo({
4064
+ ) : Mo({
4037
4065
  navigation: e,
4038
4066
  spineLocator: n,
4039
4067
  navigationResolver: o,
4040
4068
  spineItemsManager: t,
4041
4069
  spine: s
4042
- }), fe = ({
4070
+ }), ye = ({
4043
4071
  settings: e,
4044
4072
  navigationResolver: t,
4045
4073
  context: i,
4046
4074
  spine: n
4047
4075
  }) => (o) => o.pipe(
4048
- P((s) => Co({
4076
+ P((s) => Ro({
4049
4077
  spineLocator: n.locator,
4050
4078
  navigation: s.navigation,
4051
4079
  navigationResolver: t,
@@ -4062,19 +4090,19 @@ const Io = () => (e) => e.pipe(
4062
4090
  }
4063
4091
  }))
4064
4092
  ))
4065
- ), Ro = "navigation/InternalNavigator", Ao = O.namespace(Ro);
4066
- class Do extends X {
4093
+ ), Ao = "navigation/InternalNavigator", Do = O.namespace(Ao);
4094
+ class No extends X {
4067
4095
  constructor(t, i, n, o, s, a, r, c) {
4068
- super(), this.settings = t, this.context = i, this.userNavigation$ = n, this.viewportController = o, this.scrollNavigationController = s, this.navigationResolver = a, this.spine = r, this.isUserLocked$ = c, this.navigationSubject = new U({
4096
+ super(), this.settings = t, this.context = i, this.userNavigation$ = n, this.viewportController = o, this.scrollNavigationController = s, this.navigationResolver = a, this.spine = r, this.isUserLocked$ = c, this.navigationSubject = new W({
4069
4097
  animation: !1,
4070
- position: new L({ x: 0, y: 0 }),
4098
+ position: new F({ x: 0, y: 0 }),
4071
4099
  meta: {
4072
4100
  triggeredBy: "user"
4073
4101
  },
4074
4102
  spineItemIsReady: !1,
4075
4103
  type: "api",
4076
4104
  id: Symbol()
4077
- }), this.navigated$ = this.navigationSubject.pipe(ve(1)), this.navigation$ = this.navigationSubject.pipe(
4105
+ }), this.navigated$ = this.navigationSubject.pipe(xe(1)), this.navigation$ = this.navigationSubject.pipe(
4078
4106
  S(({ position: f, id: b }) => ({
4079
4107
  position: f,
4080
4108
  id: b
@@ -4086,39 +4114,39 @@ class Do extends X {
4086
4114
  ), this.locker = new _e();
4087
4115
  const u = n.pipe(
4088
4116
  A(this.navigationSubject),
4089
- Po,
4117
+ vo,
4090
4118
  /**
4091
4119
  * Url lookup is heavier so we start with it to fill
4092
4120
  * as much information as needed to reduce later lookup
4093
4121
  */
4094
- Fo({
4122
+ Lo({
4095
4123
  navigationResolver: a
4096
4124
  }),
4097
4125
  /**
4098
4126
  * Cfi lookup is heavier so we start with it to fill
4099
4127
  * as much information as needed to reduce later lookup
4100
4128
  */
4101
- vo({
4129
+ xo({
4102
4130
  navigationResolver: a
4103
4131
  }),
4104
- $o({ context: i, settings: t }),
4105
- he({
4132
+ To({ context: i, settings: t }),
4133
+ me({
4106
4134
  navigationResolver: a,
4107
4135
  settings: t,
4108
4136
  spineItemsManager: r.spineItemsManager,
4109
4137
  spineLocator: r.locator
4110
4138
  }),
4111
- Vt({
4139
+ Ot({
4112
4140
  navigationResolver: a,
4113
4141
  settings: t,
4114
4142
  spineItemsManager: r.spineItemsManager,
4115
4143
  spineLocator: r.locator
4116
4144
  }),
4117
- me({
4145
+ fe({
4118
4146
  spine: r
4119
4147
  })
4120
4148
  ).pipe(
4121
- To({
4149
+ Fo({
4122
4150
  navigationResolver: a,
4123
4151
  spineItemsManager: r.spineItemsManager
4124
4152
  }),
@@ -4126,7 +4154,7 @@ class Do extends X {
4126
4154
  P(([f, b]) => {
4127
4155
  const I = f.navigation.cfi || f.navigation.url || t.values.computedPageTurnMode === "scrollable" || b;
4128
4156
  return w(f).pipe(
4129
- I ? Pt : fe({
4157
+ I ? vt : ye({
4130
4158
  navigationResolver: a,
4131
4159
  settings: t,
4132
4160
  spine: r,
@@ -4134,7 +4162,7 @@ class Do extends X {
4134
4162
  })
4135
4163
  );
4136
4164
  }),
4137
- Vt({
4165
+ Ot({
4138
4166
  spineItemsManager: r.spineItemsManager,
4139
4167
  spineLocator: r.locator,
4140
4168
  settings: t,
@@ -4163,7 +4191,7 @@ class Do extends X {
4163
4191
  );
4164
4192
  }),
4165
4193
  V()
4166
- ), g = v(
4194
+ ), l = v(
4167
4195
  o.layout$,
4168
4196
  r.layout$
4169
4197
  ).pipe(
@@ -4189,12 +4217,12 @@ class Do extends X {
4189
4217
  v(d, u)
4190
4218
  )
4191
4219
  ))
4192
- ), l = v(
4193
- g,
4220
+ ), g = v(
4221
+ l,
4194
4222
  d
4195
4223
  ).pipe(
4196
4224
  S((f) => ({ navigation: f })),
4197
- fe({
4225
+ ye({
4198
4226
  navigationResolver: a,
4199
4227
  settings: t,
4200
4228
  context: i,
@@ -4217,16 +4245,16 @@ class Do extends X {
4217
4245
  * eg: after the reader load and the user has never navigated
4218
4246
  * yet.
4219
4247
  */
4220
- he({
4248
+ me({
4221
4249
  navigationResolver: a,
4222
4250
  settings: t,
4223
4251
  spineItemsManager: r.spineItemsManager,
4224
4252
  spineLocator: r.locator
4225
4253
  }),
4226
- me({
4254
+ fe({
4227
4255
  spine: r
4228
4256
  }),
4229
- Vt({
4257
+ Ot({
4230
4258
  spineItemsManager: r.spineItemsManager,
4231
4259
  spineLocator: r.locator,
4232
4260
  settings: t,
@@ -4234,17 +4262,17 @@ class Do extends X {
4234
4262
  }),
4235
4263
  S(({ navigation: f }) => f),
4236
4264
  V()
4237
- ), h = wo(
4265
+ ), h = Po(
4238
4266
  i,
4239
4267
  this.navigationSubject,
4240
4268
  r
4241
4269
  ), p = v(
4242
- l,
4270
+ g,
4243
4271
  u,
4244
4272
  h
4245
4273
  ), m = (f) => f.pipe(
4246
4274
  $(([b, I]) => {
4247
- Ao.info(
4275
+ Do.info(
4248
4276
  `navigation updated from ${b.meta.triggeredBy} of type ${b.type}`,
4249
4277
  {
4250
4278
  previousNavigation: I,
@@ -4254,11 +4282,11 @@ class Do extends X {
4254
4282
  })
4255
4283
  ), y = (f) => f.pipe(
4256
4284
  $(([b, I]) => {
4257
- const x = b.type === "scroll", F = b.meta.triggeredBy === "pagination", C = b.meta.triggeredBy === "restoration", D = N(
4285
+ const x = b.type === "scroll", L = b.meta.triggeredBy === "pagination", C = b.meta.triggeredBy === "restoration", D = N(
4258
4286
  I.position,
4259
4287
  b.position
4260
4288
  );
4261
- if (x && !C || F || D)
4289
+ if (x && !C || L || D)
4262
4290
  return;
4263
4291
  const E = {
4264
4292
  position: b.position,
@@ -4285,93 +4313,66 @@ class Do extends X {
4285
4313
  return this.navigationSubject.getValue();
4286
4314
  }
4287
4315
  }
4288
- const Xe = ({
4289
- position: { x: e, y: t },
4290
- spineElement: i,
4291
- element: n
4292
- }) => {
4293
- if (!i) throw new Error("Invalid spine element");
4294
- const o = i.getBoundingClientRect().width / i.offsetWidth;
4295
- return new L({
4296
- x: Tt({
4297
- newScale: 1,
4298
- oldScale: o,
4299
- screenSize: n.clientWidth ?? 0,
4300
- pageSize: i.scrollWidth,
4301
- scrollOffset: e
4302
- }),
4303
- y: Tt({
4304
- newScale: 1,
4305
- oldScale: o,
4306
- screenSize: n.clientHeight ?? 0,
4307
- pageSize: i.scrollHeight,
4308
- scrollOffset: t
4309
- })
4310
- });
4311
- }, No = 500;
4312
- class Oo extends X {
4313
- constructor(t, i, n, o, s) {
4314
- super(), this.settings = t, this.context = i, this.spine = n, this.scrollNavigationController = o, this.locker = s, this.navigationSubject = new W(), this.navigation$ = this.navigationSubject.asObservable();
4315
- const a = this.scrollNavigationController.userScroll$.pipe(
4316
- Wt((r) => {
4317
- const c = this.locker.lock();
4316
+ const Oo = 500;
4317
+ class Vo extends X {
4318
+ constructor(t, i, n, o, s, a) {
4319
+ super(), this.settings = t, this.context = i, this.spine = n, this.scrollNavigationController = o, this.locker = s, this.navigationSubject = new U(), this.navigation$ = this.navigationSubject.asObservable();
4320
+ const r = this.scrollNavigationController.userScroll$.pipe(
4321
+ Ut((c) => {
4322
+ const u = this.locker.lock();
4318
4323
  return v(
4319
4324
  this.scrollNavigationController.userScroll$,
4320
- w(r)
4325
+ w(c)
4321
4326
  ).pipe(
4322
4327
  St(
4323
- No,
4328
+ Oo,
4324
4329
  rt
4325
4330
  ),
4326
4331
  z(),
4327
4332
  $(() => {
4328
- const u = r.target, d = Xe({
4329
- element: u,
4330
- position: new L({
4331
- x: u.scrollLeft ?? 0,
4332
- y: u.scrollTop ?? 0
4333
- }),
4334
- spineElement: this.spine.element ?? Le()
4333
+ const d = c.target, l = new It({
4334
+ x: d.scrollLeft / a.scaleFactor,
4335
+ y: d.scrollTop / a.scaleFactor
4335
4336
  });
4336
4337
  this.navigationSubject.next({
4337
4338
  animation: !1,
4338
4339
  type: "scroll",
4339
- position: d
4340
+ position: l
4340
4341
  });
4341
4342
  }),
4342
4343
  dt(() => {
4343
- c();
4344
+ u();
4344
4345
  })
4345
4346
  );
4346
4347
  })
4347
4348
  );
4348
- v(a).pipe(T(this.destroy$)).subscribe();
4349
+ v(r).pipe(T(this.destroy$)).subscribe();
4349
4350
  }
4350
4351
  }
4351
- const Vo = (e) => ({
4352
+ const jo = (e) => ({
4352
4353
  x: -e.x,
4353
4354
  y: -e.y
4354
- }), jo = (e) => e instanceof DOMMatrix ? new L({
4355
+ }), ko = (e) => e instanceof DOMMatrix ? new F({
4355
4356
  x: -e.e,
4356
4357
  y: -e.f
4357
- }) : new L({
4358
+ }) : new F({
4358
4359
  x: -e.x,
4359
4360
  y: -e.y
4360
- }), ko = "navigation/ViewportNavigator", ye = O.namespace(ko);
4361
+ }), Uo = "navigation/ViewportNavigator", Se = O.namespace(Uo);
4361
4362
  class Wo extends X {
4362
4363
  constructor(t, i, n, o, s) {
4363
- super(), this.settings = t, this.hookManager = i, this.context = n, this.spine = o, this.viewport = s, this.navigateSubject = new W(), this.element$ = new U(
4364
+ super(), this.settings = t, this.hookManager = i, this.context = n, this.spine = o, this.viewport = s, this.navigateSubject = new U(), this.element$ = new W(
4364
4365
  document.createElement("div")
4365
4366
  );
4366
4367
  const a = this.spine.element$.pipe(
4367
4368
  M(qt),
4368
4369
  A(this.element$),
4369
- $(([d, g]) => {
4370
- g.style.cssText = `
4370
+ $(([d, l]) => {
4371
+ l.style.cssText = `
4371
4372
  height: 100%;
4372
4373
  width: 100%;
4373
4374
  position: relative;
4374
- `, g.className = `${pt}-controlled-navigator`, g.innerHTML = "", g.appendChild(d), this.viewport.value.element.appendChild(g), this.element$.next(g);
4375
+ `, l.className = `${pt}-controlled-navigator`, l.innerHTML = "", l.appendChild(d), this.viewport.value.element.appendChild(l), this.element$.next(l);
4375
4376
  })
4376
4377
  ), r = t.watch([
4377
4378
  "computedPageTurnDirection",
@@ -4387,30 +4388,30 @@ class Wo extends X {
4387
4388
  );
4388
4389
  this.layout$ = c.pipe(
4389
4390
  $(() => {
4390
- ye.info("layout", t.values);
4391
+ Se.info("layout", t.values);
4391
4392
  }),
4392
4393
  V()
4393
4394
  );
4394
4395
  const u = this.navigateSubject.pipe(
4395
4396
  $((d) => {
4396
- ye.info("Navigation requested", d);
4397
+ Se.info("Navigation requested", d);
4397
4398
  })
4398
4399
  );
4399
4400
  this.isNavigating$ = u.pipe(
4400
- S(({ animation: d, position: g }) => ({
4401
+ S(({ animation: d, position: l }) => ({
4401
4402
  type: "manualAdjust",
4402
4403
  shouldAnimate: !(!d || d === "turn" && t.values.computedPageTurnAnimation === "none"),
4403
4404
  animation: d,
4404
- position: g
4405
+ position: l
4405
4406
  })),
4406
4407
  P((d) => {
4407
- const g = this.element$.getValue();
4408
- return g.style.setProperty("transition", "none"), g.style.setProperty("opacity", "1"), v(
4408
+ const l = this.element$.getValue();
4409
+ return l.style.setProperty("transition", "none"), l.style.setProperty("opacity", "1"), v(
4409
4410
  w(!0),
4410
4411
  w(null).pipe(
4411
- $t(() => {
4412
+ Tt(() => {
4412
4413
  if ((d == null ? void 0 : d.type) !== "manualAdjust") return w(!1);
4413
- const l = d.animation === "snap" ? t.values.snapAnimationDuration : t.values.computedPageTurnAnimationDuration, h = d.animation === "snap" ? "slide" : t.values.computedPageTurnAnimation;
4414
+ const g = d.animation === "snap" ? t.values.snapAnimationDuration : t.values.computedPageTurnAnimationDuration, h = d.animation === "snap" ? "slide" : t.values.computedPageTurnAnimation;
4414
4415
  return w(d).pipe(
4415
4416
  /**
4416
4417
  * @important
@@ -4420,15 +4421,15 @@ class Wo extends X {
4420
4421
  * anything for x ms while we effectively adjust. We want it to be immediate.
4421
4422
  * However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
4422
4423
  */
4423
- d.shouldAnimate ? wt(1, rt) : Pt,
4424
+ d.shouldAnimate ? Pt(1, rt) : vt,
4424
4425
  $((p) => {
4425
4426
  const m = this.element$.getValue();
4426
4427
  p.shouldAnimate ? h === "fade" ? (m.style.setProperty(
4427
4428
  "transition",
4428
- `opacity ${l / 2}ms`
4429
+ `opacity ${g / 2}ms`
4429
4430
  ), m.style.setProperty("opacity", "0")) : (d.animation === "snap" || h === "slide") && (m.style.setProperty(
4430
4431
  "transition",
4431
- `transform ${l}ms`
4432
+ `transform ${g}ms`
4432
4433
  ), m.style.setProperty("opacity", "1")) : (m.style.setProperty("transition", "none"), m.style.setProperty("opacity", "1"));
4433
4434
  }),
4434
4435
  /**
@@ -4442,12 +4443,12 @@ class Wo extends X {
4442
4443
  $((p) => {
4443
4444
  h !== "fade" && this.setViewportPosition(p.position);
4444
4445
  }),
4445
- d.shouldAnimate ? wt(l / 2, rt) : Pt,
4446
+ d.shouldAnimate ? Pt(g / 2, rt) : vt,
4446
4447
  $((p) => {
4447
4448
  const m = this.element$.getValue();
4448
4449
  h === "fade" && (this.setViewportPosition(p.position), m.style.setProperty("opacity", "1"));
4449
4450
  }),
4450
- d.shouldAnimate ? wt(l / 2, rt) : Pt,
4451
+ d.shouldAnimate ? Pt(g / 2, rt) : vt,
4451
4452
  $((p) => {
4452
4453
  h === "fade" && this.setViewportPosition(p.position);
4453
4454
  })
@@ -4470,7 +4471,7 @@ class Wo extends X {
4470
4471
  * for remark about flicker / fonts smoothing
4471
4472
  */
4472
4473
  setViewportPosition(t) {
4473
- const i = this.element$.getValue(), n = Vo(t);
4474
+ const i = this.element$.getValue(), n = jo(t);
4474
4475
  i.style.transform = `translate(${n.x}px, ${n.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4475
4476
  }
4476
4477
  navigate(t) {
@@ -4483,47 +4484,52 @@ class Wo extends X {
4483
4484
  get viewportPosition() {
4484
4485
  const t = this.element$.getValue(), i = window.getComputedStyle(t), n = i.transform || i.webkitTransform;
4485
4486
  if (!n || n === "none")
4486
- return new L({ x: 0, y: 0 });
4487
+ return new F({ x: 0, y: 0 });
4487
4488
  const o = new DOMMatrix(n);
4488
- return jo(o);
4489
+ return ko(o);
4489
4490
  }
4490
4491
  }
4491
- class Uo extends ht {
4492
+ class zo extends ht {
4492
4493
  constructor(t, i, n, o, s) {
4493
4494
  super({
4494
4495
  element: void 0
4495
- }), this.viewport = t, this.settings = i, this.hookManager = n, this.spine = o, this.context = s, this.navigateSubject = new W(), this.scrollingSubject = new U(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({ position: g }) => {
4496
- const l = this.value.element;
4497
- this.scrollingSubject.next(!0), l == null || l.scrollTo({
4498
- left: g.x,
4499
- top: g.y,
4496
+ }), this.viewport = t, this.settings = i, this.hookManager = n, this.spine = o, this.context = s, this.navigateSubject = new U(), this.scrollingSubject = new W(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({ position: l }) => {
4497
+ const g = this.value.element;
4498
+ this.scrollingSubject.next(!0);
4499
+ const h = this.viewport.scaleFactor, p = new F({
4500
+ x: l.x * h,
4501
+ y: l.y * h
4502
+ });
4503
+ g == null || g.scrollTo({
4504
+ left: p.x,
4505
+ top: p.y,
4500
4506
  behavior: "instant"
4501
- }), ne(1).pipe(
4507
+ }), kt(1).pipe(
4502
4508
  $(() => {
4503
4509
  this.scrollingSubject.next(!1);
4504
4510
  }),
4505
- T(v(this.scrollingSubject.pipe(ve(1)), this.destroy$))
4511
+ T(v(this.scrollingSubject.pipe(xe(1)), this.destroy$))
4506
4512
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4507
4513
  };
4508
4514
  const a = this.context.pipe(
4509
4515
  Jt(["rootElement"]),
4510
- $(({ rootElement: g }) => {
4511
- if (!g) return;
4512
- const l = document.createElement("div");
4513
- l.style.cssText = `
4516
+ $(({ rootElement: l }) => {
4517
+ if (!l) return;
4518
+ const g = document.createElement("div");
4519
+ g.style.cssText = `
4514
4520
  height: 100%;
4515
4521
  width: 100%;
4516
4522
  position: relative;
4517
4523
  overflow-y: scroll;
4518
4524
  overflow-x: hidden;
4519
- `, l.className = `${pt}-scroll-navigator`, l.appendChild(this.viewport.value.element), g.appendChild(l), this.update({ element: l });
4525
+ `, g.className = `${pt}-scroll-navigator`, g.appendChild(this.viewport.value.element), l.appendChild(g), this.update({ element: g });
4520
4526
  })
4521
4527
  ), r = B([
4522
4528
  i.watch(["computedPageTurnMode"]),
4523
4529
  this.watch("element")
4524
4530
  ]).pipe(
4525
- $(([{ computedPageTurnMode: g }, l]) => {
4526
- l && (g === "scrollable" ? l.style.display = "block" : l.style.display = "contents");
4531
+ $(([{ computedPageTurnMode: l }, g]) => {
4532
+ g && (l === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
4527
4533
  })
4528
4534
  ), c = this.navigateSubject.pipe($(this.setViewportPosition));
4529
4535
  this.isNavigating$ = this.navigateSubject.pipe(
@@ -4534,16 +4540,16 @@ class Uo extends ht {
4534
4540
  const u = v(
4535
4541
  o.element$.pipe(
4536
4542
  M(at),
4537
- P((g) => Kt(g))
4543
+ P((l) => Kt(l))
4538
4544
  ),
4539
4545
  o.element$.pipe(
4540
4546
  M(at),
4541
- P((g) => q(g, "scroll"))
4547
+ P((l) => q(l, "scroll"))
4542
4548
  ),
4543
4549
  o.spineItemsObserver.itemResize$
4544
4550
  ).pipe(
4545
4551
  P(
4546
- () => ne(10).pipe(
4552
+ () => kt(10).pipe(
4547
4553
  S(() => !1),
4548
4554
  it(!0)
4549
4555
  )
@@ -4555,16 +4561,16 @@ class Uo extends ht {
4555
4561
  this.isScrolling$
4556
4562
  ]).pipe(
4557
4563
  S(
4558
- ([g, l]) => g || l
4564
+ ([l, g]) => l || g
4559
4565
  ),
4560
4566
  tt(1)
4561
4567
  );
4562
4568
  this.userScroll$ = this.watch("element").pipe(
4563
4569
  M(at),
4564
4570
  P(
4565
- (g) => i.watch(["computedPageTurnMode"]).pipe(
4571
+ (l) => i.watch(["computedPageTurnMode"]).pipe(
4566
4572
  P(
4567
- ({ computedPageTurnMode: l }) => l === "controlled" ? gt : q(g, "scroll").pipe(
4573
+ ({ computedPageTurnMode: g }) => g === "controlled" ? lt : q(l, "scroll").pipe(
4568
4574
  A(d),
4569
4575
  M(
4570
4576
  ([, h]) => !h
@@ -4585,33 +4591,31 @@ class Uo extends ht {
4585
4591
  }
4586
4592
  get viewportPosition() {
4587
4593
  const t = this.value.element;
4588
- return t ? Xe({
4589
- element: t,
4590
- position: new L({
4591
- x: (t == null ? void 0 : t.scrollLeft) ?? 0,
4592
- y: (t == null ? void 0 : t.scrollTop) ?? 0
4593
- }),
4594
- spineElement: this.spine.element ?? Le()
4595
- }) : new L({ x: 0, y: 0 });
4594
+ if (!t) return new F({ x: 0, y: 0 });
4595
+ const i = this.viewport.scaleFactor;
4596
+ return new F({
4597
+ x: t.scrollLeft / i,
4598
+ y: t.scrollTop / i
4599
+ });
4596
4600
  }
4597
4601
  }
4598
4602
  const Ft = (e, t, i) => {
4599
4603
  const n = i - e, o = i * (t * e) / (i || 1);
4600
4604
  return Math.max(0, Math.min(n, o));
4601
- }, _t = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), xt = (e, t, i) => {
4605
+ }, _t = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), $t = (e, t, i) => {
4602
4606
  const n = _t(i, t), o = [...Array(n)].map((s, a) => a * t);
4603
4607
  return e >= n * t ? o[o.length - 1] || 0 : o.find((s) => e < s + t) || 0;
4604
- }, Se = (e, t, i) => {
4608
+ }, be = (e, t, i) => {
4605
4609
  const n = [...Array(i)].map((o, s) => s * t);
4606
4610
  return e <= 0 || i === 0 ? 0 : e >= i * t ? i - 1 : n.findIndex((o) => e < o + t) ?? 0;
4607
- }, zo = ({
4611
+ }, Ho = ({
4608
4612
  itemWidth: e,
4609
4613
  itemHeight: t,
4610
4614
  spineItemPosition: i
4611
4615
  }) => new R({
4612
4616
  x: Math.min(e, Math.max(0, i.x)),
4613
4617
  y: Math.min(t, Math.max(0, i.y))
4614
- }), Ye = ({
4618
+ }), Xe = ({
4615
4619
  itemHeight: e,
4616
4620
  itemWidth: t,
4617
4621
  isUsingVerticalWriting: i,
@@ -4619,7 +4623,7 @@ const Ft = (e, t, i) => {
4619
4623
  pageHeight: o,
4620
4624
  pageTurnDirection: s,
4621
4625
  pageTurnMode: a
4622
- }) => s === "vertical" && a === "scrollable" ? 1 : i || s === "vertical" ? _t(e, o) : _t(t, n), be = ({
4626
+ }) => s === "vertical" && a === "scrollable" ? 1 : i || s === "vertical" ? _t(e, o) : _t(t, n), Ie = ({
4623
4627
  itemWidth: e,
4624
4628
  itemHeight: t,
4625
4629
  position: i,
@@ -4630,11 +4634,11 @@ const Ft = (e, t, i) => {
4630
4634
  pageTurnMode: r,
4631
4635
  isRTL: c
4632
4636
  }) => {
4633
- const d = zo({
4637
+ const d = Ho({
4634
4638
  spineItemPosition: i,
4635
4639
  itemHeight: t,
4636
4640
  itemWidth: e
4637
- }).x, g = Ye({
4641
+ }).x, l = Xe({
4638
4642
  isUsingVerticalWriting: n,
4639
4643
  itemHeight: t,
4640
4644
  itemWidth: e,
@@ -4644,10 +4648,10 @@ const Ft = (e, t, i) => {
4644
4648
  pageTurnMode: r
4645
4649
  });
4646
4650
  if (n)
4647
- return Se(i.y, s, g);
4648
- const l = Se(d, o, g);
4649
- return c ? g - 1 - l : l;
4650
- }, Ho = ({
4651
+ return be(i.y, s, l);
4652
+ const g = be(d, o, l);
4653
+ return c ? l - 1 - g : g;
4654
+ }, Bo = ({
4651
4655
  pageIndex: e,
4652
4656
  itemLayout: t,
4653
4657
  context: i,
@@ -4676,24 +4680,24 @@ const Ft = (e, t, i) => {
4676
4680
  x: o,
4677
4681
  y: 0
4678
4682
  });
4679
- }, qe = ({
4683
+ }, Ye = ({
4680
4684
  context: e,
4681
4685
  settings: t
4682
4686
  }) => {
4683
4687
  const i = (a, r, c) => {
4684
- var l;
4688
+ var g;
4685
4689
  let u;
4686
4690
  if ((a == null ? void 0 : a.nodeName) === "img" || (a == null ? void 0 : a.textContent) === "" && a.nodeType === Node.ELEMENT_NODE)
4687
4691
  u = a.getBoundingClientRect().x;
4688
4692
  else if (a) {
4689
- const h = a ? Ri(a, r) : void 0;
4693
+ const h = a ? Ci(a, r) : void 0;
4690
4694
  u = (h == null ? void 0 : h.getBoundingClientRect().x) || u;
4691
4695
  }
4692
- const d = ((l = c.layout.layoutInfo) == null ? void 0 : l.width) || 0, g = e.getPageSize().width;
4696
+ const d = ((g = c.layout.layoutInfo) == null ? void 0 : g.width) || 0, l = e.getPageSize().width;
4693
4697
  if (u !== void 0) {
4694
- const h = xt(
4698
+ const h = $t(
4695
4699
  u,
4696
- g,
4700
+ l,
4697
4701
  d
4698
4702
  );
4699
4703
  return new R({ x: h, y: 0 });
@@ -4704,13 +4708,13 @@ const Ft = (e, t, i) => {
4704
4708
  getSpineItemPositionFromPageIndex: ({
4705
4709
  pageIndex: a,
4706
4710
  spineItem: r
4707
- }) => Ho({
4711
+ }) => Bo({
4708
4712
  context: e,
4709
4713
  isUsingVerticalWriting: !!r.isUsingVerticalWriting(),
4710
4714
  itemLayout: r.layout.layoutInfo,
4711
4715
  pageIndex: a
4712
4716
  }),
4713
- getSpineItemPageIndexFromPosition: (a) => be({
4717
+ getSpineItemPageIndexFromPosition: (a) => Ie({
4714
4718
  ...a,
4715
4719
  isRTL: e.isRTL(),
4716
4720
  pageWidth: e.getPageSize().width,
@@ -4719,12 +4723,12 @@ const Ft = (e, t, i) => {
4719
4723
  pageTurnMode: t.values.pageTurnMode
4720
4724
  }),
4721
4725
  getSpineItemPageIndexFromNode: (a, r, c) => {
4722
- const u = i(a, r, c), { height: d, width: g } = c.layout.layoutInfo;
4723
- return u ? be({
4726
+ const u = i(a, r, c), { height: d, width: l } = c.layout.layoutInfo;
4727
+ return u ? Ie({
4724
4728
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4725
4729
  position: u,
4726
4730
  itemHeight: d,
4727
- itemWidth: g,
4731
+ itemWidth: l,
4728
4732
  isRTL: e.isRTL(),
4729
4733
  pageWidth: e.getPageSize().width,
4730
4734
  pageHeight: e.getPageSize().height,
@@ -4735,12 +4739,12 @@ const Ft = (e, t, i) => {
4735
4739
  getSpineItemClosestPositionFromUnsafePosition: (a, r) => {
4736
4740
  const { width: c, height: u } = r.layout.layoutInfo;
4737
4741
  return new R({
4738
- x: xt(
4742
+ x: $t(
4739
4743
  a.x,
4740
4744
  e.getPageSize().width,
4741
4745
  c
4742
4746
  ),
4743
- y: xt(
4747
+ y: $t(
4744
4748
  a.y,
4745
4749
  e.getPageSize().height,
4746
4750
  u
@@ -4748,37 +4752,37 @@ const Ft = (e, t, i) => {
4748
4752
  });
4749
4753
  },
4750
4754
  getSpineItemPagePositionFromSpineItemPosition: (a, r, c) => {
4751
- const { width: u, height: d } = c.layout.layoutInfo, g = e.getPageSize().width, l = e.getPageSize().height;
4755
+ const { width: u, height: d } = c.layout.layoutInfo, l = e.getPageSize().width, g = e.getPageSize().height;
4752
4756
  if (!!c.isUsingVerticalWriting()) {
4753
4757
  const m = Ft(
4754
- l,
4758
+ g,
4755
4759
  r,
4756
4760
  d
4757
4761
  );
4758
- return new Nt({
4762
+ return new Dt({
4759
4763
  x: a.x,
4760
4764
  y: a.y - m
4761
4765
  });
4762
4766
  }
4763
- const p = Ft(g, r, u);
4767
+ const p = Ft(l, r, u);
4764
4768
  if (e.isRTL()) {
4765
- const m = u - (r + 1) * g;
4766
- return new Nt({
4769
+ const m = u - (r + 1) * l;
4770
+ return new Dt({
4767
4771
  x: a.x - Math.max(0, m),
4768
4772
  y: a.y
4769
4773
  });
4770
4774
  }
4771
- return new Nt({
4775
+ return new Dt({
4772
4776
  x: a.x - p,
4773
4777
  y: a.y
4774
4778
  });
4775
4779
  }
4776
4780
  };
4777
- }, Bo = ({
4781
+ }, Eo = ({
4778
4782
  context: e,
4779
4783
  settings: t
4780
4784
  }) => {
4781
- const i = qe({ context: e, settings: t });
4785
+ const i = Ye({ context: e, settings: t });
4782
4786
  return {
4783
4787
  getNavigationForLastPage: (a) => {
4784
4788
  const r = a.numberOfPages;
@@ -4803,8 +4807,8 @@ const Ft = (e, t, i) => {
4803
4807
  visibleAreaRectWidth: n
4804
4808
  }) => {
4805
4809
  const s = e % n !== 0 ? e - i : e;
4806
- return new L({ x: s, y: t });
4807
- }, Ie = ({
4810
+ return new F({ x: s, y: t });
4811
+ }, we = ({
4808
4812
  position: e,
4809
4813
  isRTL: t,
4810
4814
  pageSizeHeight: i,
@@ -4818,12 +4822,12 @@ const Ft = (e, t, i) => {
4818
4822
  a || 0
4819
4823
  ), c = r.bottom - i, u = Math.min(Math.max(0, e.y), c);
4820
4824
  if (t)
4821
- return new L({
4825
+ return new F({
4822
4826
  x: Math.max(Math.min(0, e.x), r.left),
4823
4827
  y: u
4824
4828
  });
4825
4829
  const d = r.right - o;
4826
- return new L({
4830
+ return new F({
4827
4831
  x: Math.min(Math.max(0, e.x), d),
4828
4832
  y: u
4829
4833
  });
@@ -4851,8 +4855,8 @@ const Ft = (e, t, i) => {
4851
4855
  visibleAreaRectWidth: i.state.visibleAreaRect.width
4852
4856
  });
4853
4857
  }
4854
- return new L({ x: 0, y: 0 });
4855
- }, Eo = ({
4858
+ return new F({ x: 0, y: 0 });
4859
+ }, _o = ({
4856
4860
  pageIndex: e,
4857
4861
  spineItemsManager: t,
4858
4862
  spineItemId: i,
@@ -4864,7 +4868,7 @@ const Ft = (e, t, i) => {
4864
4868
  if (!a) {
4865
4869
  const u = e * n.getPageSize().width;
4866
4870
  return Xt({
4867
- viewportPosition: new L({ x: u, y: 0 }),
4871
+ viewportPosition: new F({ x: u, y: 0 }),
4868
4872
  context: n,
4869
4873
  spineItemNavigationResolver: s,
4870
4874
  spineLocator: o
@@ -4882,25 +4886,25 @@ const Ft = (e, t, i) => {
4882
4886
  pageSizeWidth: n.getPageSize().width,
4883
4887
  visibleAreaRectWidth: n.state.visibleAreaRect.width
4884
4888
  });
4885
- }, _o = ({
4889
+ }, Xo = ({
4886
4890
  anchor: e,
4887
4891
  spineItem: t,
4888
4892
  context: i
4889
4893
  }) => {
4890
4894
  var r;
4891
4895
  const n = ((r = t.layout.layoutInfo) == null ? void 0 : r.width) || 0, o = i.getPageSize().width, s = t.getBoundingRectOfElementFromSelector(e), a = (s == null ? void 0 : s.x) || 0;
4892
- return xt(
4896
+ return $t(
4893
4897
  a,
4894
4898
  o,
4895
4899
  n
4896
4900
  );
4897
- }, Xo = ({
4901
+ }, Yo = ({
4898
4902
  anchor: e,
4899
4903
  context: t,
4900
4904
  spineItem: i,
4901
4905
  spineLocator: n
4902
4906
  }) => {
4903
- const o = _o({
4907
+ const o = Xo({
4904
4908
  anchor: e,
4905
4909
  spineItem: i,
4906
4910
  context: t
@@ -4909,7 +4913,7 @@ const Ft = (e, t, i) => {
4909
4913
  spineItemPosition: new R({ x: o, y: 0 }),
4910
4914
  spineItem: i
4911
4915
  });
4912
- }, Yo = ({
4916
+ }, qo = ({
4913
4917
  anchor: e,
4914
4918
  spineItem: t,
4915
4919
  spineLocator: i,
@@ -4917,7 +4921,7 @@ const Ft = (e, t, i) => {
4917
4921
  pageSizeWidth: o,
4918
4922
  visibleAreaRectWidth: s
4919
4923
  }) => {
4920
- const a = Xo({
4924
+ const a = Yo({
4921
4925
  anchor: e,
4922
4926
  context: n,
4923
4927
  spineItem: t,
@@ -4928,7 +4932,7 @@ const Ft = (e, t, i) => {
4928
4932
  pageSizeWidth: o,
4929
4933
  visibleAreaRectWidth: s
4930
4934
  });
4931
- }, qo = ({
4935
+ }, Zo = ({
4932
4936
  context: e,
4933
4937
  spineItemsManager: t,
4934
4938
  spineLocator: i,
@@ -4944,7 +4948,7 @@ const Ft = (e, t, i) => {
4944
4948
  if (u) {
4945
4949
  const d = t.get(u.id);
4946
4950
  if (d) {
4947
- const g = Yo({
4951
+ const l = qo({
4948
4952
  anchor: r.hash,
4949
4953
  spineItem: d,
4950
4954
  context: e,
@@ -4954,7 +4958,7 @@ const Ft = (e, t, i) => {
4954
4958
  });
4955
4959
  return {
4956
4960
  position: et({
4957
- position: g,
4961
+ position: l,
4958
4962
  pageSizeWidth: o,
4959
4963
  visibleAreaRectWidth: s
4960
4964
  }),
@@ -4967,7 +4971,7 @@ const Ft = (e, t, i) => {
4967
4971
  console.error(r);
4968
4972
  return;
4969
4973
  }
4970
- }, Zo = ({
4974
+ }, Go = ({
4971
4975
  spineItem: e,
4972
4976
  spineItemPosition: t,
4973
4977
  spineLocator: i,
@@ -4986,43 +4990,43 @@ const Ft = (e, t, i) => {
4986
4990
  pageSizeWidth: o.getPageSize().width,
4987
4991
  visibleAreaRectWidth: o.state.visibleAreaRect.width
4988
4992
  });
4989
- }, Go = "spineNavigator", Jo = ({
4993
+ }, Jo = "spineNavigator", Ko = ({
4990
4994
  context: e,
4991
4995
  spineItemsManager: t,
4992
4996
  locator: i,
4993
4997
  settings: n,
4994
4998
  spine: o
4995
4999
  }) => {
4996
- const s = Bo({ context: e, settings: n });
5000
+ const s = Eo({ context: e, settings: n });
4997
5001
  return {
4998
- getNavigationForUrl: (l) => qo({
5002
+ getNavigationForUrl: (g) => Zo({
4999
5003
  context: e,
5000
5004
  spineItemsManager: t,
5001
5005
  spineLocator: i,
5002
- url: l,
5006
+ url: g,
5003
5007
  pageSizeWidth: e.getPageSize().width,
5004
5008
  visibleAreaRectWidth: e.state.visibleAreaRect.width
5005
5009
  }),
5006
- getNavigationForSpineItemPage: (l) => Eo({
5007
- ...l,
5010
+ getNavigationForSpineItemPage: (g) => _o({
5011
+ ...g,
5008
5012
  context: e,
5009
5013
  spineItemsManager: t,
5010
5014
  spineItemNavigationResolver: s,
5011
5015
  spineLocator: i
5012
5016
  }),
5013
- getNavigationFromSpineItemPosition: (l) => Zo({
5014
- ...l,
5017
+ getNavigationFromSpineItemPosition: (g) => Go({
5018
+ ...g,
5015
5019
  spineItemLocator: i.spineItemLocator,
5016
5020
  spineLocator: i,
5017
5021
  context: e
5018
5022
  }),
5019
- getNavigationForCfi: (l) => {
5020
- const h = t.getSpineItemFromCfi(l), { node: p, offset: m = 0 } = ze({
5021
- cfi: l,
5023
+ getNavigationForCfi: (g) => {
5024
+ const h = t.getSpineItemFromCfi(g), { node: p, offset: m = 0 } = ze({
5025
+ cfi: g,
5022
5026
  spineItemsManager: t
5023
5027
  });
5024
5028
  if (!h) {
5025
- O.warn(Go, `unable to detect item id from cfi ${l}`);
5029
+ O.warn(Jo, `unable to detect item id from cfi ${g}`);
5026
5030
  return;
5027
5031
  }
5028
5032
  const y = p ? s.getNavigationFromNode(h, p, m) : new R({ x: 0, y: 0 }), f = i.getSpinePositionFromSpineItemPosition({
@@ -5035,10 +5039,10 @@ const Ft = (e, t, i) => {
5035
5039
  visibleAreaRectWidth: e.state.visibleAreaRect.width
5036
5040
  });
5037
5041
  },
5038
- getNavigationForLastPage: (l) => {
5039
- const h = s.getNavigationForLastPage(l), p = i.getSpinePositionFromSpineItemPosition({
5042
+ getNavigationForLastPage: (g) => {
5043
+ const h = s.getNavigationForLastPage(g), p = i.getSpinePositionFromSpineItemPosition({
5040
5044
  spineItemPosition: h,
5041
- spineItem: l
5045
+ spineItem: g
5042
5046
  });
5043
5047
  return et({
5044
5048
  position: p,
@@ -5046,8 +5050,8 @@ const Ft = (e, t, i) => {
5046
5050
  visibleAreaRectWidth: e.state.visibleAreaRect.width
5047
5051
  });
5048
5052
  },
5049
- getNavigationForSpineIndexOrId: (l) => {
5050
- const h = t.get(l);
5053
+ getNavigationForSpineIndexOrId: (g) => {
5054
+ const h = t.get(g);
5051
5055
  if (h) {
5052
5056
  const p = i.getSpinePositionFromSpineItem(h);
5053
5057
  return et({
@@ -5056,17 +5060,17 @@ const Ft = (e, t, i) => {
5056
5060
  visibleAreaRectWidth: e.state.visibleAreaRect.width
5057
5061
  });
5058
5062
  }
5059
- return new L({ x: 0, y: 0 });
5063
+ return new F({ x: 0, y: 0 });
5060
5064
  },
5061
- getNavigationForPosition: (l) => Xt({
5062
- viewportPosition: l,
5065
+ getNavigationForPosition: (g) => Xt({
5066
+ viewportPosition: g,
5063
5067
  context: e,
5064
5068
  spineItemNavigationResolver: s,
5065
5069
  spineLocator: i
5066
5070
  }),
5067
- getMostPredominantNavigationForPosition: (l) => {
5068
- const h = n.values.computedPageTurnDirection, p = 0.5, m = h === "horizontal" ? l.x + e.state.visibleAreaRect.width * p : 0, y = h === "horizontal" ? 0 : l.y + e.state.visibleAreaRect.height * p, f = Ie({
5069
- position: new L({
5071
+ getMostPredominantNavigationForPosition: (g) => {
5072
+ const h = n.values.computedPageTurnDirection, p = 0.5, m = h === "horizontal" ? g.x + e.state.visibleAreaRect.width * p : 0, y = h === "horizontal" ? 0 : g.y + e.state.visibleAreaRect.height * p, f = we({
5073
+ position: new F({
5070
5074
  x: m,
5071
5075
  y
5072
5076
  }),
@@ -5083,24 +5087,24 @@ const Ft = (e, t, i) => {
5083
5087
  viewportPosition: f
5084
5088
  });
5085
5089
  },
5086
- getAdjustedPositionWithSafeEdge: (l) => Ie({
5087
- position: l,
5090
+ getAdjustedPositionWithSafeEdge: (g) => we({
5091
+ position: g,
5088
5092
  isRTL: e.isRTL(),
5089
5093
  pageSizeHeight: e.getPageSize().height,
5090
5094
  visibleAreaRectWidth: e.state.visibleAreaRect.width,
5091
5095
  spineItemsManager: t,
5092
5096
  spine: o
5093
5097
  }),
5094
- isNavigationGoingForwardFrom: (l, h) => n.values.computedPageTurnDirection === "vertical" ? l.y > h.y : l.x > h.x,
5095
- arePositionsDifferent: (l, h) => l.x !== h.x || l.y !== h.y,
5096
- getAdjustedPositionForSpread: (l) => et({
5097
- position: l,
5098
+ isNavigationGoingForwardFrom: (g, h) => n.values.computedPageTurnDirection === "vertical" ? g.y > h.y : g.x > h.x,
5099
+ arePositionsDifferent: (g, h) => g.x !== h.x || g.y !== h.y,
5100
+ getAdjustedPositionForSpread: (g) => et({
5101
+ position: g,
5098
5102
  pageSizeWidth: e.getPageSize().width,
5099
5103
  visibleAreaRectWidth: e.state.visibleAreaRect.width
5100
5104
  }),
5101
5105
  spineItemNavigator: s
5102
5106
  };
5103
- }, Ko = ({
5107
+ }, Qo = ({
5104
5108
  spineItemsManager: e,
5105
5109
  context: t,
5106
5110
  hookManager: i,
@@ -5108,7 +5112,7 @@ const Ft = (e, t, i) => {
5108
5112
  settings: o,
5109
5113
  viewport: s
5110
5114
  }) => {
5111
- const a = new W(), r = new _e(), c = Jo({
5115
+ const a = new U(), r = new _e(), c = Ko({
5112
5116
  context: t,
5113
5117
  settings: o,
5114
5118
  spineItemsManager: e,
@@ -5120,25 +5124,26 @@ const Ft = (e, t, i) => {
5120
5124
  t,
5121
5125
  n,
5122
5126
  s
5123
- ), d = new Uo(
5127
+ ), d = new zo(
5124
5128
  s,
5125
5129
  o,
5126
5130
  i,
5127
5131
  n,
5128
5132
  t
5129
- ), g = new Oo(
5133
+ ), l = new Vo(
5130
5134
  o,
5131
5135
  t,
5132
5136
  n,
5133
5137
  d,
5134
- r
5135
- ), l = v(
5138
+ r,
5139
+ s
5140
+ ), g = v(
5136
5141
  a,
5137
- g.navigation$
5138
- ), h = new Do(
5142
+ l.navigation$
5143
+ ), h = new No(
5139
5144
  o,
5140
5145
  t,
5141
- l,
5146
+ g,
5142
5147
  u,
5143
5148
  d,
5144
5149
  c,
@@ -5156,7 +5161,7 @@ const Ft = (e, t, i) => {
5156
5161
  );
5157
5162
  return {
5158
5163
  destroy: () => {
5159
- g.destroy(), u.destroy(), h.destroy();
5164
+ l.destroy(), u.destroy(), h.destroy();
5160
5165
  },
5161
5166
  getNavigation: () => h.navigation,
5162
5167
  internalNavigator: h,
@@ -5174,7 +5179,7 @@ const Ft = (e, t, i) => {
5174
5179
  navigation$: h.navigation$
5175
5180
  };
5176
5181
  };
5177
- class Qo extends ht {
5182
+ class ts extends ht {
5178
5183
  constructor(t, i) {
5179
5184
  super({
5180
5185
  beginPageIndexInSpineItem: void 0,
@@ -5192,7 +5197,7 @@ class Qo extends ht {
5192
5197
  this.mergeCompare(t);
5193
5198
  }
5194
5199
  }
5195
- class ts extends X {
5200
+ class es extends X {
5196
5201
  constructor(t, i, n, o, s) {
5197
5202
  super(), this.context = t, this.pagination = i, this.spineItemsManager = n, this.spine = o, this.spineItemLocator = s;
5198
5203
  const a = v(
@@ -5209,29 +5214,29 @@ class ts extends X {
5209
5214
  threshold: { type: "percentage", value: 0.5 }
5210
5215
  });
5211
5216
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5212
- we(1),
5217
+ Pe(1),
5213
5218
  A(this.context.bridgeEvent.navigation$),
5214
5219
  $(([, u]) => {
5215
- const { position: d } = u, g = this.pagination.value, {
5216
- beginIndex: l,
5220
+ const { position: d } = u, l = this.pagination.value, {
5221
+ beginIndex: g,
5217
5222
  endIndex: h
5218
5223
  } = this.spine.locator.getVisibleSpineItemsFromPosition({
5219
5224
  position: d,
5220
5225
  threshold: { type: "percentage", value: 0.5 }
5221
- }) ?? {}, p = this.spineItemsManager.get(l), m = this.spineItemsManager.get(h);
5226
+ }) ?? {}, p = this.spineItemsManager.get(g), m = this.spineItemsManager.get(h);
5222
5227
  if (!p || !m) return;
5223
- const y = g.beginCfi, f = g.endCfi, { beginPageIndex: b = 0 } = c({
5228
+ const y = l.beginCfi, f = l.endCfi, { beginPageIndex: b = 0 } = c({
5224
5229
  spineItem: p,
5225
5230
  position: d
5226
5231
  }) ?? {}, { endPageIndex: I = 0 } = c({
5227
5232
  spineItem: m,
5228
5233
  position: d
5229
- }) ?? {}, x = y === void 0 || Et(y) || g.beginSpineItemIndex !== l, F = g.endSpineItemIndex !== h || f === void 0 || Et(f), C = x ? lt(p.item) : y, D = F ? lt(m.item) : f, E = p.numberOfPages, J = m.numberOfPages;
5234
+ }) ?? {}, x = y === void 0 || Et(y) || l.beginSpineItemIndex !== g, L = l.endSpineItemIndex !== h || f === void 0 || Et(f), C = x ? gt(p.item) : y, D = L ? gt(m.item) : f, E = p.numberOfPages, J = m.numberOfPages;
5230
5235
  this.pagination.update({
5231
5236
  beginCfi: C,
5232
5237
  beginNumberOfPagesInSpineItem: E,
5233
5238
  beginPageIndexInSpineItem: b,
5234
- beginSpineItemIndex: l,
5239
+ beginSpineItemIndex: g,
5235
5240
  endCfi: D,
5236
5241
  endNumberOfPagesInSpineItem: J,
5237
5242
  endPageIndexInSpineItem: I,
@@ -5248,19 +5253,19 @@ class ts extends X {
5248
5253
  beginSpineItemIndex: c,
5249
5254
  endSpineItemIndex: u,
5250
5255
  beginPageIndexInSpineItem: d,
5251
- endPageIndexInSpineItem: g
5256
+ endPageIndexInSpineItem: l
5252
5257
  } = this.pagination.value;
5253
- if (d === void 0 || g === void 0 || c === void 0 || u === void 0)
5258
+ if (d === void 0 || l === void 0 || c === void 0 || u === void 0)
5254
5259
  return;
5255
- const l = this.spineItemsManager.get(c), h = this.spineItemsManager.get(u);
5256
- l === void 0 || h === void 0 || this.pagination.update({
5260
+ const g = this.spineItemsManager.get(c), h = this.spineItemsManager.get(u);
5261
+ g === void 0 || h === void 0 || this.pagination.update({
5257
5262
  beginCfi: Bt({
5258
5263
  pageIndex: d,
5259
- spineItem: l,
5264
+ spineItem: g,
5260
5265
  spine: this.spine
5261
5266
  }),
5262
5267
  endCfi: Bt({
5263
- pageIndex: g,
5268
+ pageIndex: l,
5264
5269
  spineItem: h,
5265
5270
  spine: this.spine
5266
5271
  })
@@ -5270,17 +5275,17 @@ class ts extends X {
5270
5275
  v(a, r).pipe(T(this.destroy$)).subscribe();
5271
5276
  }
5272
5277
  }
5273
- class es extends X {
5278
+ class is extends X {
5274
5279
  constructor(t) {
5275
5280
  super();
5276
5281
  const i = {
5277
5282
  ...this.getDefaultSettings(),
5278
5283
  ...t
5279
5284
  };
5280
- this.inputSettings = i, this.outputSettingsUpdateSubject = new W(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(tt(1)), this._settings$.subscribe();
5285
+ this.inputSettings = i, this.outputSettingsUpdateSubject = new U(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(tt(1)), this._settings$.subscribe();
5281
5286
  }
5282
5287
  _prepareUpdate(t) {
5283
- const i = vt(this.inputSettings, t), n = this.getOutputSettings(i), o = !N(this.outputSettings, n);
5288
+ const i = xt(this.inputSettings, t), n = this.getOutputSettings(i), o = !N(this.outputSettings, n);
5284
5289
  return {
5285
5290
  hasChanged: o,
5286
5291
  state: n,
@@ -5315,7 +5320,7 @@ class es extends X {
5315
5320
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5316
5321
  }
5317
5322
  }
5318
- class is extends es {
5323
+ class ns extends is {
5319
5324
  constructor(t, i) {
5320
5325
  super(t), this.context = i;
5321
5326
  const n = B([
@@ -5360,18 +5365,18 @@ class is extends es {
5360
5365
  };
5361
5366
  }
5362
5367
  }
5363
- class ns extends X {
5368
+ class os extends X {
5364
5369
  constructor(t, i, n, o, s, a) {
5365
- super(), this.item = t, this.containerElement = i, this.context = n, this.hookManager = o, this.renderer = s, this.settings = a, this.layoutTriggerSubject = new W(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5370
+ super(), this.item = t, this.containerElement = i, this.context = n, this.hookManager = o, this.renderer = s, this.settings = a, this.layoutTriggerSubject = new U(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5366
5371
  blankPagePosition: r,
5367
5372
  minimumWidth: c
5368
5373
  }) => (u) => u.pipe(
5369
5374
  S((d) => {
5370
5375
  var x;
5371
- const g = N(
5376
+ const l = N(
5372
5377
  (x = this.lastLayout) == null ? void 0 : x.pageSize,
5373
5378
  this.context.getPageSize()
5374
- ) ? this.lastLayout : void 0, { width: l, height: h } = g ?? {}, { width: p = l, height: m = h } = d ?? {}, { width: y, height: f } = this.context.getPageSize(), b = this.validateDimension(
5379
+ ) ? this.lastLayout : void 0, { width: g, height: h } = l ?? {}, { width: p = g, height: m = h } = d ?? {}, { width: y, height: f } = this.context.getPageSize(), b = this.validateDimension(
5375
5380
  p ?? y,
5376
5381
  y,
5377
5382
  c
@@ -5407,7 +5412,7 @@ class ns extends X {
5407
5412
  item: this.item,
5408
5413
  minimumWidth: u
5409
5414
  });
5410
- const g = this.renderer.layout({
5415
+ const l = this.renderer.layout({
5411
5416
  blankPagePosition: c,
5412
5417
  minPageSpread: u / this.context.getPageSize().width,
5413
5418
  minimumWidth: u,
@@ -5415,12 +5420,12 @@ class ns extends X {
5415
5420
  });
5416
5421
  return v(
5417
5422
  w({ type: "start" }),
5418
- g.pipe(
5423
+ l.pipe(
5419
5424
  this.applyDimsAfterLayout(r),
5420
5425
  S(
5421
- (l) => ({
5426
+ (g) => ({
5422
5427
  type: "end",
5423
- data: l
5428
+ data: g
5424
5429
  })
5425
5430
  )
5426
5431
  )
@@ -5446,7 +5451,7 @@ class ns extends X {
5446
5451
  };
5447
5452
  }
5448
5453
  }
5449
- class os extends ft {
5454
+ class ss extends ft {
5450
5455
  onUnload() {
5451
5456
  return Q;
5452
5457
  }
@@ -5465,14 +5470,14 @@ class os extends ft {
5465
5470
  getDocumentFrame() {
5466
5471
  }
5467
5472
  }
5468
- class Ze extends X {
5473
+ class qe extends X {
5469
5474
  constructor(t, i, n, o, s, a) {
5470
5475
  var u, d;
5471
- super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index = a, this.getBoundingRectOfElementFromSelector = (g) => {
5476
+ super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index = a, this.getBoundingRectOfElementFromSelector = (l) => {
5472
5477
  var h, p, m, y;
5473
- const l = this.renderer.getDocumentFrame();
5474
- if (l && l instanceof HTMLIFrameElement && g)
5475
- return g.startsWith("#") ? (p = (h = l.contentDocument) == null ? void 0 : h.getElementById(g.replace("#", ""))) == null ? void 0 : p.getBoundingClientRect() : (y = (m = l.contentDocument) == null ? void 0 : m.querySelector(g)) == null ? void 0 : y.getBoundingClientRect();
5478
+ const g = this.renderer.getDocumentFrame();
5479
+ if (g && g instanceof HTMLIFrameElement && l)
5480
+ return l.startsWith("#") ? (p = (h = g.contentDocument) == null ? void 0 : h.getElementById(l.replace("#", ""))) == null ? void 0 : p.getBoundingClientRect() : (y = (m = g.contentDocument) == null ? void 0 : m.querySelector(l)) == null ? void 0 : y.getBoundingClientRect();
5476
5481
  }, this.load = () => {
5477
5482
  this.renderer.load();
5478
5483
  }, this.unload = () => {
@@ -5480,9 +5485,9 @@ class Ze extends X {
5480
5485
  }, this.destroy = () => {
5481
5486
  super.destroy(), this.containerElement.remove(), this.renderer.destroy();
5482
5487
  }, this.isUsingVerticalWriting = () => {
5483
- var g;
5484
- return !!((g = this.renderer.writingMode) != null && g.startsWith("vertical"));
5485
- }, this.containerElement = ss(
5488
+ var l;
5489
+ return !!((l = this.renderer.writingMode) != null && l.startsWith("vertical"));
5490
+ }, this.containerElement = rs(
5486
5491
  i,
5487
5492
  t,
5488
5493
  s
@@ -5497,7 +5502,7 @@ class Ze extends X {
5497
5502
  containerElement: this.containerElement,
5498
5503
  resourcesHandler: this.resourcesHandler
5499
5504
  };
5500
- this.renderer = r ? r(c) : new os(c), this.layout = new ns(
5505
+ this.renderer = r ? r(c) : new ss(c), this.layout = new os(
5501
5506
  t,
5502
5507
  this.containerElement,
5503
5508
  n,
@@ -5505,12 +5510,12 @@ class Ze extends X {
5505
5510
  this.renderer,
5506
5511
  this.settings
5507
5512
  ), this.isReady$ = this.layout.layoutProcess$.pipe(
5508
- yi(this.renderer.isLoaded$),
5509
- Y(([g, l]) => !!(g.type === "end" && l)),
5510
- $e(!1),
5513
+ fi(this.renderer.isLoaded$),
5514
+ Y(([l, g]) => !!(l.type === "end" && g)),
5515
+ Te(!1),
5511
5516
  Z(),
5512
- k((g) => {
5513
- this.containerElement.dataset.isReady = g.toString();
5517
+ k((l) => {
5518
+ this.containerElement.dataset.isReady = l.toString();
5514
5519
  }),
5515
5520
  bt({ refCount: !0, bufferSize: 1 })
5516
5521
  ), this.needsLayout$ = v(this.unloaded$, this.loaded$), v(
@@ -5551,7 +5556,7 @@ class Ze extends X {
5551
5556
  _(
5552
5557
  () => this.renderer.state$.pipe(
5553
5558
  K((t) => t === "idle"),
5554
- xe()
5559
+ $e()
5555
5560
  )
5556
5561
  )
5557
5562
  );
@@ -5560,7 +5565,7 @@ class Ze extends X {
5560
5565
  return this.renderer.renditionLayout;
5561
5566
  }
5562
5567
  get numberOfPages() {
5563
- return Ye({
5568
+ return Xe({
5564
5569
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
5565
5570
  itemHeight: this.layout.layoutInfo.height,
5566
5571
  itemWidth: this.layout.layoutInfo.width,
@@ -5571,13 +5576,13 @@ class Ze extends X {
5571
5576
  });
5572
5577
  }
5573
5578
  }
5574
- const ss = (e, t, i) => {
5579
+ const rs = (e, t, i) => {
5575
5580
  const n = e.ownerDocument.createElement("div");
5576
5581
  return n.classList.add("spineItem"), n.classList.add(`spineItem-${t.renditionLayout ?? "reflowable"}`), n.style.cssText = `
5577
5582
  position: absolute;
5578
5583
  overflow: hidden;
5579
5584
  `, n.dataset.isReady = "false", i.execute("item.onBeforeContainerCreated", void 0, { element: n }), n;
5580
- }, rs = O.namespace("spine"), as = ({
5585
+ }, as = O.namespace("spine"), cs = ({
5581
5586
  position: e,
5582
5587
  pageSize: t
5583
5588
  }) => new hn({
@@ -5589,7 +5594,7 @@ const ss = (e, t, i) => {
5589
5594
  bottom: e.y + t.height,
5590
5595
  right: e.x + t.width
5591
5596
  });
5592
- class cs extends ht {
5597
+ class us extends ht {
5593
5598
  constructor(t, i, n, o, s, a) {
5594
5599
  super({ pages: [] }), this.spineLayout = t, this.spineItemsManager = i, this.spineItemLocator = n, this.context = o, this.locator = s, this.viewport = a, this.fromSpineItemPageIndex = (r, c) => this.value.pages.find(
5595
5600
  (u) => u.itemIndex === r.index && u.pageIndex === c
@@ -5597,17 +5602,17 @@ class cs extends ht {
5597
5602
  A(a),
5598
5603
  P(([, { pageSize: r }]) => {
5599
5604
  const c = i.items.reduce(
5600
- (d, g, l) => {
5601
- const p = new Array(g.numberOfPages).fill(void 0).map((m, y) => {
5605
+ (d, l, g) => {
5606
+ const p = new Array(l.numberOfPages).fill(void 0).map((m, y) => {
5602
5607
  const f = n.getSpineItemPositionFromPageIndex({
5603
- spineItem: g,
5608
+ spineItem: l,
5604
5609
  pageIndex: y
5605
5610
  }), b = s.getSpinePositionFromSpineItemPosition({
5606
- spineItem: g,
5611
+ spineItem: l,
5607
5612
  spineItemPosition: f
5608
5613
  });
5609
5614
  return {
5610
- absoluteLayout: as({
5615
+ absoluteLayout: cs({
5611
5616
  pageSize: r,
5612
5617
  position: b
5613
5618
  }),
@@ -5621,9 +5626,9 @@ class cs extends ht {
5621
5626
  x: f.x,
5622
5627
  y: f.y
5623
5628
  }),
5624
- itemIndex: l,
5629
+ itemIndex: g,
5625
5630
  absolutePageIndex: d.length + y,
5626
- spineItem: g,
5631
+ spineItem: l,
5627
5632
  pageIndex: y
5628
5633
  };
5629
5634
  });
@@ -5633,26 +5638,26 @@ class cs extends ht {
5633
5638
  );
5634
5639
  return B(
5635
5640
  c.map((d) => {
5636
- const { spineItem: g, ...l } = d;
5641
+ const { spineItem: l, ...g } = d;
5637
5642
  return new ot((h) => {
5638
5643
  var y, f;
5639
5644
  const p = (y = d.spineItem.renderer) == null ? void 0 : y.getDocumentFrame();
5640
5645
  let m;
5641
5646
  p && ((f = p == null ? void 0 : p.contentWindow) != null && f.document) && // very important because it is being used by next functions
5642
- p.contentWindow.document.body !== null && (m = Mi(
5647
+ p.contentWindow.document.body !== null && (m = Li(
5643
5648
  p.contentWindow.document,
5644
5649
  d.layout
5645
- )), h.next({ ...l, firstVisibleNode: m });
5650
+ )), h.next({ ...g, firstVisibleNode: m });
5646
5651
  });
5647
5652
  })
5648
5653
  );
5649
5654
  }),
5650
- S((r) => (rs.info("Pages layout", r), { pages: r })),
5655
+ S((r) => (as.info("Pages layout", r), { pages: r })),
5651
5656
  V()
5652
5657
  ), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
5653
5658
  }
5654
5659
  }
5655
- class us extends X {
5660
+ class ds extends X {
5656
5661
  constructor(t, i) {
5657
5662
  super(), this.spineItemsManager = t, this.spineLocator = i, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
5658
5663
  P((n) => {
@@ -5682,7 +5687,7 @@ class us extends X {
5682
5687
  );
5683
5688
  }
5684
5689
  }
5685
- const ds = ({
5690
+ const ls = ({
5686
5691
  horizontalOffset: e,
5687
5692
  verticalOffset: t,
5688
5693
  context: i,
@@ -5694,20 +5699,20 @@ const ds = ({
5694
5699
  viewport: c
5695
5700
  }) => {
5696
5701
  let u = i.getPageSize().width, d = "none";
5697
- const g = e % c.absoluteViewport.width === 0, l = a === n.items.length - 1;
5702
+ const l = e % c.absoluteViewport.width === 0, g = a === n.items.length - 1;
5698
5703
  if (i.state.isUsingSpreadMode) {
5699
- !o && r.renditionLayout === "reflowable" && !l && (u = i.getPageSize().width * 2), !o && r.renditionLayout === "reflowable" && l && g && (u = i.getPageSize().width * 2);
5700
- const p = g && l && o;
5701
- r.item.pageSpreadRight && g && !i.isRTL() || r.item.pageSpreadLeft && g && i.isRTL() ? (d = "before", u = i.getPageSize().width * 2) : p && (i.isRTL() ? d = "before" : d = "after", u = i.getPageSize().width * 2);
5704
+ !o && r.renditionLayout === "reflowable" && !g && (u = i.getPageSize().width * 2), !o && r.renditionLayout === "reflowable" && g && l && (u = i.getPageSize().width * 2);
5705
+ const p = l && g && o;
5706
+ r.item.pageSpreadRight && l && !i.isRTL() || r.item.pageSpreadLeft && l && i.isRTL() ? (d = "before", u = i.getPageSize().width * 2) : p && (i.isRTL() ? d = "before" : d = "after", u = i.getPageSize().width * 2);
5702
5707
  }
5703
5708
  return r.layout.layout({
5704
5709
  minimumWidth: u,
5705
5710
  blankPagePosition: d,
5706
- spreadPosition: i.state.isUsingSpreadMode ? g ? i.isRTL() ? "right" : "left" : i.isRTL() ? "left" : "right" : "none"
5711
+ spreadPosition: i.state.isUsingSpreadMode ? l ? i.isRTL() ? "right" : "left" : i.isRTL() ? "left" : "right" : "none"
5707
5712
  }).pipe(
5708
5713
  S(({ width: p, height: m }) => {
5709
5714
  if (s.values.computedPageTurnDirection === "vertical") {
5710
- const b = g ? t : t - i.state.visibleAreaRect.height, I = g ? 0 : e;
5715
+ const b = l ? t : t - i.state.visibleAreaRect.height, I = l ? 0 : e;
5711
5716
  i.isRTL() ? r.layout.adjustPositionOfElement({
5712
5717
  top: b,
5713
5718
  left: I
@@ -5715,11 +5720,11 @@ const ds = ({
5715
5720
  top: b,
5716
5721
  left: I
5717
5722
  });
5718
- const x = p + I, F = m + b, C = new Ht({
5723
+ const x = p + I, L = m + b, C = new Ht({
5719
5724
  left: I,
5720
5725
  right: x,
5721
5726
  top: b,
5722
- bottom: F,
5727
+ bottom: L,
5723
5728
  height: m,
5724
5729
  width: p,
5725
5730
  x: I,
@@ -5727,7 +5732,7 @@ const ds = ({
5727
5732
  });
5728
5733
  return {
5729
5734
  horizontalOffset: x,
5730
- verticalOffset: F,
5735
+ verticalOffset: L,
5731
5736
  layoutPosition: C
5732
5737
  };
5733
5738
  }
@@ -5754,7 +5759,7 @@ const ds = ({
5754
5759
  };
5755
5760
  class gs extends X {
5756
5761
  constructor(t, i, n, o) {
5757
- super(), this.spineItemsManager = t, this.context = i, this.settings = n, this.viewport = o, this.layoutSubject = new W(), this.spineItemsRelativeLayouts = [], t.items$.pipe(
5762
+ super(), this.spineItemsManager = t, this.context = i, this.settings = n, this.viewport = o, this.layoutSubject = new U(), this.spineItemsRelativeLayouts = [], t.items$.pipe(
5758
5763
  $(() => {
5759
5764
  this.spineItemsRelativeLayouts = [];
5760
5765
  }),
@@ -5779,27 +5784,27 @@ class gs extends X {
5779
5784
  return v(...r, ...c);
5780
5785
  })
5781
5786
  ).pipe(T(this.destroy$)).subscribe();
5782
- const s = new U(!1);
5787
+ const s = new W(!1);
5783
5788
  this.layout$ = this.layoutSubject.pipe(
5784
5789
  St(50),
5785
5790
  // queue layout until previous layout is done
5786
- Wt(
5791
+ Ut(
5787
5792
  () => s.pipe(
5788
5793
  M((a) => !a),
5789
5794
  z()
5790
5795
  )
5791
5796
  ),
5792
- Wt(() => {
5797
+ Ut(() => {
5793
5798
  s.next(!0);
5794
5799
  const a = this.context.manifest, r = Ee(a) ?? !1;
5795
5800
  return j(this.spineItemsManager.items).pipe(
5796
- ai(
5797
- (u, d, g) => u.pipe(
5798
- oe(
5799
- ({ horizontalOffset: l, verticalOffset: h }) => ds({
5801
+ ri(
5802
+ (u, d, l) => u.pipe(
5803
+ ne(
5804
+ ({ horizontalOffset: g, verticalOffset: h }) => ls({
5800
5805
  context: this.context,
5801
- horizontalOffset: l,
5802
- index: g,
5806
+ horizontalOffset: g,
5807
+ index: l,
5803
5808
  isGloballyPrePaginated: r,
5804
5809
  item: d,
5805
5810
  settings: this.settings,
@@ -5812,7 +5817,7 @@ class gs extends X {
5812
5817
  horizontalOffset: p,
5813
5818
  verticalOffset: m,
5814
5819
  layoutPosition: y
5815
- }) => (this.spineItemsRelativeLayouts[g] = y, {
5820
+ }) => (this.spineItemsRelativeLayouts[l] = y, {
5816
5821
  horizontalOffset: p,
5817
5822
  verticalOffset: m
5818
5823
  })
@@ -5822,7 +5827,7 @@ class gs extends X {
5822
5827
  ),
5823
5828
  w({ horizontalOffset: 0, verticalOffset: 0 })
5824
5829
  ),
5825
- oe((u) => u),
5830
+ ne((u) => u),
5826
5831
  dt(() => {
5827
5832
  s.next(!1);
5828
5833
  })
@@ -5854,12 +5859,12 @@ class gs extends X {
5854
5859
  super.destroy(), this.layoutSubject.complete();
5855
5860
  }
5856
5861
  }
5857
- class ls extends X {
5862
+ class ps extends X {
5858
5863
  constructor(t, i, n, o, s) {
5859
- super(), this.context = t, this.spineItemsManager = i, this.spineLocator = n, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new U([]);
5864
+ super(), this.context = t, this.spineItemsManager = i, this.spineLocator = n, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new W([]);
5860
5865
  const a = this.forcedOpenSubject.pipe(
5861
5866
  S((u) => [...new Set(u.flat())].sort()),
5862
- H(gi),
5867
+ H(di),
5863
5868
  tt({ bufferSize: 1, refCount: !0 })
5864
5869
  );
5865
5870
  v(
@@ -5875,11 +5880,11 @@ class ls extends X {
5875
5880
  Ct(this.context.bridgeEvent.viewportFree$),
5876
5881
  A(this.context.bridgeEvent.navigation$, a),
5877
5882
  S(([, u, d]) => {
5878
- const { numberOfAdjacentSpineItemToPreLoad: g } = o.values, { beginIndex: l = 0, endIndex: h = 0 } = n.getVisibleSpineItemsFromPosition({
5883
+ const { numberOfAdjacentSpineItemToPreLoad: l } = o.values, { beginIndex: g = 0, endIndex: h = 0 } = n.getVisibleSpineItemsFromPosition({
5879
5884
  position: u.position,
5880
5885
  threshold: { type: "percentage", value: 0 },
5881
5886
  useAbsoluteViewport: !1
5882
- }) || {}, p = g === 1 / 0 ? 0 : l - g, m = g === 1 / 0 ? i.items.length - 1 : h + g, y = Array.from(
5887
+ }) || {}, p = l === 1 / 0 ? 0 : g - l, m = l === 1 / 0 ? i.items.length - 1 : h + l, y = Array.from(
5883
5888
  { length: m - p + 1 },
5884
5889
  (b, I) => p + I
5885
5890
  ), f = [...d, ...y];
@@ -5905,9 +5910,9 @@ class ls extends X {
5905
5910
  super.destroy(), this.forcedOpenSubject.complete();
5906
5911
  }
5907
5912
  }
5908
- const Ge = (e, t, i) => {
5913
+ const Ze = (e, t, i) => {
5909
5914
  const n = (i.width - t.width) / 2, o = (i.height - t.height) / 2;
5910
- return new Rt({
5915
+ return new It({
5911
5916
  x: e.x - n,
5912
5917
  y: e.y - o
5913
5918
  });
@@ -5930,17 +5935,17 @@ class yt extends DOMRect {
5930
5935
  return new yt(n.x, n.y, n.width, n.height);
5931
5936
  }
5932
5937
  }
5933
- class ps {
5938
+ class hs {
5934
5939
  constructor({ width: t, height: i }) {
5935
5940
  this.__symbol = Symbol("AbsoluteViewport"), this.width = t, this.height = i;
5936
5941
  }
5937
5942
  }
5938
- class hs {
5943
+ class ms {
5939
5944
  constructor({ width: t, height: i }) {
5940
5945
  this.__symbol = Symbol("RelativeViewport"), this.width = t, this.height = i;
5941
5946
  }
5942
5947
  }
5943
- const ms = ({
5948
+ const fs = ({
5944
5949
  pageIndex: e,
5945
5950
  spineItemOrId: t,
5946
5951
  spineItemsManager: i
@@ -5962,7 +5967,7 @@ const ms = ({
5962
5967
  { currentAbsolutePage: 0, found: !1 }
5963
5968
  );
5964
5969
  return s;
5965
- }, fs = ({
5970
+ }, ys = ({
5966
5971
  itemHeight: e,
5967
5972
  itemWidth: t,
5968
5973
  visibleWidthOfItem: i,
@@ -5971,7 +5976,7 @@ const ms = ({
5971
5976
  }) => {
5972
5977
  const s = i / t, a = n / e;
5973
5978
  return o.type === "percentage" ? s >= o.value && a >= o.value : i >= o.value && n >= o.value;
5974
- }, ys = ({
5979
+ }, Ss = ({
5975
5980
  visibleWidthOfItem: e,
5976
5981
  visibleHeightOfItem: t,
5977
5982
  threshold: i,
@@ -5979,7 +5984,7 @@ const ms = ({
5979
5984
  }) => {
5980
5985
  const o = e / n.width, s = t / n.height;
5981
5986
  return i.type === "percentage" ? s >= i.value && o >= i.value : t >= i.value && e >= i.value;
5982
- }, Je = ({
5987
+ }, Ge = ({
5983
5988
  itemPosition: {
5984
5989
  bottom: e,
5985
5990
  left: t,
@@ -5992,7 +5997,7 @@ const ms = ({
5992
5997
  viewportPosition: r,
5993
5998
  restrictToScreen: c
5994
5999
  }) => {
5995
- const u = r.x, d = r.x + (r.width - 1), g = r.y, l = Math.max(
6000
+ const u = r.x, d = r.x + (r.width - 1), l = r.y, g = Math.max(
5996
6001
  r.y + (r.height - 1),
5997
6002
  0
5998
6003
  ), h = Math.max(
@@ -6000,17 +6005,17 @@ const ms = ({
6000
6005
  Math.min(i, d) - Math.max(t, u)
6001
6006
  ), p = Math.max(
6002
6007
  0,
6003
- Math.min(e, l) - Math.max(n, g)
6008
+ Math.min(e, g) - Math.max(n, l)
6004
6009
  );
6005
6010
  if (h <= 0 || p <= 0) return { visible: !1 };
6006
- const y = ys({
6011
+ const y = Ss({
6007
6012
  threshold: a,
6008
6013
  visibleHeightOfItem: p,
6009
6014
  visibleWidthOfItem: h,
6010
6015
  viewportPosition: r
6011
6016
  });
6012
6017
  return c ? { visible: y } : {
6013
- visible: fs({
6018
+ visible: ys({
6014
6019
  itemHeight: s,
6015
6020
  itemWidth: o,
6016
6021
  threshold: a,
@@ -6028,13 +6033,13 @@ const ms = ({
6028
6033
  return u && d;
6029
6034
  });
6030
6035
  return e.x === 0 && !n ? t.items[0] : n;
6031
- }, jt = ({
6036
+ }, Vt = ({
6032
6037
  spineItemPosition: e,
6033
6038
  itemLayout: { left: t, top: i }
6034
- }) => new L({
6039
+ }) => new F({
6035
6040
  x: t + e.x,
6036
6041
  y: i + e.y
6037
- }), Ss = ({
6042
+ }), bs = ({
6038
6043
  position: e,
6039
6044
  threshold: t,
6040
6045
  restrictToScreen: i,
@@ -6049,14 +6054,14 @@ const ms = ({
6049
6054
  spineLayout: o
6050
6055
  }) || n.get(0), c = n.items.reduce(
6051
6056
  (h, p) => {
6052
- const m = o.getSpineItemSpineLayoutInfo(p), y = s ? a.absoluteViewport : a.relativeViewport, f = Ge(
6057
+ const m = o.getSpineItemSpineLayoutInfo(p), y = s ? a.absoluteViewport : a.relativeViewport, f = Ze(
6053
6058
  e,
6054
6059
  a.absoluteViewport,
6055
6060
  y
6056
6061
  ), b = yt.from(
6057
6062
  f,
6058
6063
  y
6059
- ), { visible: I } = Je({
6064
+ ), { visible: I } = Ge({
6060
6065
  itemPosition: m,
6061
6066
  threshold: t,
6062
6067
  viewportPosition: b,
@@ -6067,12 +6072,12 @@ const ms = ({
6067
6072
  []
6068
6073
  ), u = c[0] ?? r, d = c[c.length - 1] ?? u;
6069
6074
  if (!u || !d) return;
6070
- const g = n.getSpineItemIndex(u), l = n.getSpineItemIndex(d);
6075
+ const l = n.getSpineItemIndex(u), g = n.getSpineItemIndex(d);
6071
6076
  return {
6072
- beginIndex: g ?? 0,
6073
- endIndex: l ?? 0
6077
+ beginIndex: l ?? 0,
6078
+ endIndex: g ?? 0
6074
6079
  };
6075
- }, bs = ({
6080
+ }, Is = ({
6076
6081
  spineItemsManager: e,
6077
6082
  context: t,
6078
6083
  spineItemLocator: i,
@@ -6093,7 +6098,7 @@ const ms = ({
6093
6098
  x: Math.max(p.x - y, 0),
6094
6099
  y: Math.max(p.y - f, 0)
6095
6100
  });
6096
- }, r = (p) => jt({
6101
+ }, r = (p) => Vt({
6097
6102
  spineItemPosition: new R({ x: 0, y: 0 }),
6098
6103
  itemLayout: o.getSpineItemSpineLayoutInfo(p)
6099
6104
  }), c = (p) => e.items.find((m) => m.renderer.getDocumentFrame() === p), u = (p, m, y) => {
@@ -6119,11 +6124,11 @@ const ms = ({
6119
6124
  viewport: I
6120
6125
  }) => {
6121
6126
  const x = y.numberOfPages, C = Array.from(Array(x)).map((J, ct) => {
6122
- const At = i.getSpineItemPositionFromPageIndex({
6127
+ const Rt = i.getSpineItemPositionFromPageIndex({
6123
6128
  pageIndex: ct,
6124
6129
  spineItem: y
6125
- }), ut = jt({
6126
- spineItemPosition: At,
6130
+ }), ut = Vt({
6131
+ spineItemPosition: Rt,
6127
6132
  itemLayout: o.getSpineItemSpineLayoutInfo(y)
6128
6133
  });
6129
6134
  return {
@@ -6138,21 +6143,21 @@ const ms = ({
6138
6143
  }
6139
6144
  };
6140
6145
  }).reduce(
6141
- (J, { absolutePosition: ct, index: At }) => {
6142
- const ut = b ? I.absoluteViewport : I.relativeViewport, Ke = Ge(
6146
+ (J, { absolutePosition: ct, index: Rt }) => {
6147
+ const ut = b ? I.absoluteViewport : I.relativeViewport, Je = Ze(
6143
6148
  p,
6144
6149
  I.absoluteViewport,
6145
6150
  ut
6146
- ), Qe = yt.from(
6147
- Ke,
6151
+ ), Ke = yt.from(
6152
+ Je,
6148
6153
  ut
6149
- ), { visible: ti } = Je({
6150
- viewportPosition: Qe,
6154
+ ), { visible: Qe } = Ge({
6155
+ viewportPosition: Ke,
6151
6156
  restrictToScreen: f,
6152
6157
  threshold: m,
6153
6158
  itemPosition: ct
6154
6159
  });
6155
- return ti ? [...J, At] : J;
6160
+ return Qe ? [...J, Rt] : J;
6156
6161
  },
6157
6162
  []
6158
6163
  ), D = C[0], E = C[C.length - 1] ?? D;
@@ -6168,7 +6173,7 @@ const ms = ({
6168
6173
  spineItemPosition: m
6169
6174
  }) => {
6170
6175
  const y = o.getSpineItemSpineLayoutInfo(p);
6171
- return jt({
6176
+ return Vt({
6172
6177
  itemLayout: y,
6173
6178
  spineItemPosition: m
6174
6179
  });
@@ -6176,7 +6181,7 @@ const ms = ({
6176
6181
  /**
6177
6182
  * @deprecated use Pages
6178
6183
  */
6179
- _getAbsolutePageIndexFromPageIndex: (p) => ms({
6184
+ _getAbsolutePageIndexFromPageIndex: (p) => fs({
6180
6185
  ...p,
6181
6186
  spineItemsManager: e
6182
6187
  }),
@@ -6217,7 +6222,7 @@ const ms = ({
6217
6222
  }),
6218
6223
  getSpineItemFromIframe: c,
6219
6224
  getSpineItemPageIndexFromNode: u,
6220
- getVisibleSpineItemsFromPosition: (p) => Ss({
6225
+ getVisibleSpineItemsFromPosition: (p) => bs({
6221
6226
  spineItemsManager: e,
6222
6227
  spineLayout: o,
6223
6228
  viewport: s,
@@ -6241,32 +6246,32 @@ const ms = ({
6241
6246
  }
6242
6247
  };
6243
6248
  };
6244
- class Is extends X {
6249
+ class ws extends X {
6245
6250
  constructor(t, i, n, o, s, a, r, c) {
6246
- super(), this.parentElement$ = t, this.context = i, this.pagination = n, this.spineItemsManager = o, this.spineItemLocator = s, this.settings = a, this.hookManager = r, this.viewport = c, this.elementSubject = new U(
6251
+ super(), this.parentElement$ = t, this.context = i, this.pagination = n, this.spineItemsManager = o, this.spineItemLocator = s, this.settings = a, this.hookManager = r, this.viewport = c, this.elementSubject = new W(
6247
6252
  void 0
6248
6253
  ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new gs(
6249
6254
  o,
6250
6255
  i,
6251
6256
  a,
6252
6257
  c
6253
- ), this.locator = bs({
6258
+ ), this.locator = Is({
6254
6259
  context: i,
6255
6260
  spineItemsManager: o,
6256
6261
  spineItemLocator: s,
6257
6262
  settings: a,
6258
6263
  spineLayout: this.spineLayout,
6259
6264
  viewport: c
6260
- }), this.spineItemsLoader = new ls(
6265
+ }), this.spineItemsLoader = new ps(
6261
6266
  this.context,
6262
6267
  o,
6263
6268
  this.locator,
6264
6269
  a,
6265
6270
  this.spineLayout
6266
- ), this.spineItemsObserver = new us(
6271
+ ), this.spineItemsObserver = new ds(
6267
6272
  o,
6268
6273
  this.locator
6269
- ), this.pages = new cs(
6274
+ ), this.pages = new us(
6270
6275
  this.spineLayout,
6271
6276
  this.spineItemsManager,
6272
6277
  this.spineItemLocator,
@@ -6276,24 +6281,24 @@ class Is extends X {
6276
6281
  );
6277
6282
  const u = t.pipe(
6278
6283
  K(qt),
6279
- k((g) => {
6280
- const l = g.ownerDocument.createElement("div");
6281
- l.style.cssText = `
6284
+ k((l) => {
6285
+ const g = l.ownerDocument.createElement("div");
6286
+ g.style.cssText = `
6282
6287
  height: 100%;
6283
6288
  position: relative;
6284
- `, l.className = `${pt}-spine`, this.elementSubject.next(l);
6289
+ `, g.className = `${pt}-spine`, this.elementSubject.next(g);
6285
6290
  })
6286
6291
  ), d = B([
6287
6292
  this.context.manifest$,
6288
6293
  this.element$
6289
6294
  ]).pipe(
6290
- k(([g, l]) => {
6291
- if (!l) return;
6295
+ k(([l, g]) => {
6296
+ if (!g) return;
6292
6297
  this.spineItemsManager.destroyItems();
6293
- const h = g.spineItems.map(
6294
- (p, m) => new Ze(
6298
+ const h = l.spineItems.map(
6299
+ (p, m) => new qe(
6295
6300
  p,
6296
- l,
6301
+ g,
6297
6302
  this.context,
6298
6303
  this.settings,
6299
6304
  this.hookManager,
@@ -6322,9 +6327,9 @@ class Is extends X {
6322
6327
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), (t = this.elementSubject.getValue()) == null || t.remove(), this.elementSubject.complete();
6323
6328
  }
6324
6329
  }
6325
- class ws extends X {
6330
+ class Ps extends X {
6326
6331
  constructor(t, i) {
6327
- super(), this.context = t, this.settings = i, this.orderedSpineItemsSubject = new U([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6332
+ super(), this.context = t, this.settings = i, this.orderedSpineItemsSubject = new W([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6328
6333
  }
6329
6334
  get(t) {
6330
6335
  return typeof t == "number" ? this.orderedSpineItemsSubject.value[t] : typeof t == "string" ? this.orderedSpineItemsSubject.value.find(
@@ -6336,7 +6341,7 @@ class ws extends X {
6336
6341
  return n > o ? "after" : n === o ? "same" : "before";
6337
6342
  }
6338
6343
  getSpineItemIndex(t) {
6339
- const i = t instanceof Ze ? t : this.get(t);
6344
+ const i = t instanceof qe ? t : this.get(t);
6340
6345
  if (!i) return;
6341
6346
  const n = this.orderedSpineItemsSubject.value.indexOf(i);
6342
6347
  return n < 0 ? void 0 : n;
@@ -6363,7 +6368,7 @@ class ws extends X {
6363
6368
  this.orderedSpineItemsSubject.value.forEach((t) => t.destroy());
6364
6369
  }
6365
6370
  }
6366
- class Ps extends ht {
6371
+ class vs extends ht {
6367
6372
  constructor(t) {
6368
6373
  const i = document.createElement("div");
6369
6374
  i.style.cssText = `
@@ -6397,11 +6402,15 @@ class Ps extends ht {
6397
6402
  }
6398
6403
  get absoluteViewport() {
6399
6404
  const t = this.context.state.visibleAreaRect;
6400
- return new ps({
6405
+ return new hs({
6401
6406
  width: t.width,
6402
6407
  height: t.height
6403
6408
  });
6404
6409
  }
6410
+ get scaleFactor() {
6411
+ const t = this.absoluteViewport, i = this.value.element.getBoundingClientRect();
6412
+ return ((i == null ? void 0 : i.width) ?? t.width) / t.width;
6413
+ }
6405
6414
  /**
6406
6415
  * Returns the relative viewport after eventual transforms.
6407
6416
  * For example if the viewport was zoomed out, we start seeing more left and right
@@ -6417,18 +6426,18 @@ class Ps extends ht {
6417
6426
  * like relativeViewportPosition or even better a ViewportSlicePosition
6418
6427
  */
6419
6428
  get relativeViewport() {
6420
- const t = this.absoluteViewport, i = this.value.element.getBoundingClientRect(), n = ((i == null ? void 0 : i.width) ?? t.width) / t.width;
6421
- return new hs({
6422
- width: t.width / n,
6423
- height: t.height / n
6429
+ const t = this.absoluteViewport, i = this.scaleFactor;
6430
+ return new ms({
6431
+ width: t.width / i,
6432
+ height: t.height / i
6424
6433
  });
6425
6434
  }
6426
6435
  }
6427
- const vs = (e) => {
6428
- const t = new W(), i = new bo(), n = new yo(), o = new is(e, n), s = new So(n, o), a = new ws(n, o), r = new Ps(n), c = n.watch("rootElement"), u = qe({
6436
+ const xs = (e) => {
6437
+ const t = new U(), i = new Io(), n = new So(), o = new ns(e, n), s = new bo(n, o), a = new Ps(n, o), r = new vs(n), c = n.watch("rootElement"), u = Ye({
6429
6438
  context: n,
6430
6439
  settings: o
6431
- }), d = new Qo(n, a), g = new Is(
6440
+ }), d = new ts(n, a), l = new ws(
6432
6441
  c,
6433
6442
  n,
6434
6443
  d,
@@ -6437,21 +6446,21 @@ const vs = (e) => {
6437
6446
  o,
6438
6447
  i,
6439
6448
  r
6440
- ), l = Ko({
6449
+ ), g = Qo({
6441
6450
  context: n,
6442
6451
  spineItemsManager: a,
6443
6452
  hookManager: i,
6444
- spine: g,
6453
+ spine: l,
6445
6454
  settings: o,
6446
6455
  viewport: r
6447
- }), h = new ts(
6456
+ }), h = new es(
6448
6457
  n,
6449
6458
  d,
6450
6459
  a,
6451
- g,
6460
+ l,
6452
6461
  u
6453
6462
  );
6454
- l.viewportState$.subscribe(n.bridgeEvent.viewportStateSubject), l.navigation$.subscribe(n.bridgeEvent.navigationSubject), l.locker.isLocked$.subscribe(
6463
+ g.viewportState$.subscribe(n.bridgeEvent.viewportStateSubject), g.navigation$.subscribe(n.bridgeEvent.navigationSubject), g.locker.isLocked$.subscribe(
6455
6464
  n.bridgeEvent.navigationIsLockedSubject
6456
6465
  ), d.subscribe(n.bridgeEvent.paginationSubject);
6457
6466
  const p = () => {
@@ -6470,7 +6479,7 @@ const vs = (e) => {
6470
6479
  width: b.width,
6471
6480
  height: b.height
6472
6481
  }
6473
- }), g.layout();
6482
+ }), l.layout();
6474
6483
  }, m = (f) => {
6475
6484
  const { containerElement: b, manifest: I } = f;
6476
6485
  if (n.manifest) {
@@ -6478,30 +6487,30 @@ const vs = (e) => {
6478
6487
  return;
6479
6488
  }
6480
6489
  O.log("load", { options: f });
6481
- const x = xs(b);
6490
+ const x = $s(b);
6482
6491
  n.update({
6483
6492
  manifest: I,
6484
6493
  rootElement: x,
6485
6494
  forceSinglePageMode: o.values.forceSinglePageMode
6486
6495
  }), p();
6487
6496
  }, y = () => {
6488
- a.destroy(), h.destroy(), o.destroy(), d.destroy(), n.destroy(), l.destroy(), g.destroy(), s.destroy(), t.next(), t.complete(), r.destroy();
6497
+ a.destroy(), h.destroy(), o.destroy(), d.destroy(), n.destroy(), g.destroy(), l.destroy(), s.destroy(), t.next(), t.complete(), r.destroy();
6489
6498
  };
6490
6499
  return {
6491
6500
  context: n,
6492
- spine: g,
6501
+ spine: l,
6493
6502
  hookManager: i,
6494
6503
  cfi: {
6495
- generateCfiFromRange: kn,
6504
+ generateCfiFromRange: Un,
6496
6505
  parseCfi: ee,
6497
6506
  generateCfiForSpineItemPage: (f) => Bt({
6498
6507
  ...f,
6499
- spine: g
6508
+ spine: l
6500
6509
  }),
6501
6510
  resolveCfi: (f) => ze({ ...f, spineItemsManager: a })
6502
6511
  },
6503
- navigation: l,
6504
- spineItemsObserver: g.spineItemsObserver,
6512
+ navigation: g,
6513
+ spineItemsObserver: l.spineItemsObserver,
6505
6514
  spineItemsManager: a,
6506
6515
  layout: p,
6507
6516
  load: m,
@@ -6533,31 +6542,31 @@ const vs = (e) => {
6533
6542
  destroy$: t
6534
6543
  }
6535
6544
  };
6536
- }, xs = (e) => (e.style.cssText = `
6545
+ }, $s = (e) => (e.style.cssText = `
6537
6546
  ${e.style.cssText}
6538
6547
  background-color: white;
6539
6548
  position: relative;
6540
- `, e.classList.add(`${pt}-reader`), e), Os = (
6549
+ `, e.classList.add(`${pt}-reader`), e), Vs = (
6541
6550
  //__
6542
- ao(
6551
+ co(
6543
6552
  Ei(
6544
- $n(
6553
+ Tn(
6545
6554
  go(
6546
6555
  Bi(
6547
- xi(
6548
- io(
6549
- uo(
6550
- ho(
6551
- jn(
6552
- gn(
6553
- Fn(
6554
- $i(
6555
- co(
6556
- Qn(
6557
- wn(
6558
- Ui(
6556
+ vi(
6557
+ no(
6558
+ lo(
6559
+ mo(
6560
+ kn(
6561
+ ln(
6562
+ Ln(
6563
+ xi(
6564
+ uo(
6565
+ to(
6566
+ Pn(
6567
+ Wi(
6559
6568
  // __
6560
- vs
6569
+ xs
6561
6570
  )
6562
6571
  )
6563
6572
  )
@@ -6575,68 +6584,68 @@ const vs = (e) => {
6575
6584
  )
6576
6585
  )
6577
6586
  )
6578
- ), Vs = (e) => (t) => e(t);
6587
+ ), js = (e) => (t) => e(t);
6579
6588
  export {
6580
6589
  ke as AbstractSpinePosition,
6581
- yo as Context,
6590
+ So as Context,
6582
6591
  Wo as ControlledNavigationController,
6583
6592
  X as DestroyableClass,
6584
6593
  ft as DocumentRenderer,
6585
- So as Features,
6586
- bo as HookManager,
6587
- Do as InternalNavigator,
6594
+ bo as Features,
6595
+ Io as HookManager,
6596
+ No as InternalNavigator,
6588
6597
  te as LayoutEntry,
6589
6598
  _e as Locker,
6590
- cs as Pages,
6591
- Qo as Pagination,
6592
- ts as PaginationController,
6599
+ us as Pages,
6600
+ ts as Pagination,
6601
+ es as PaginationController,
6593
6602
  Qt as ResourceHandler,
6594
- Hn as ResourcesLocator,
6595
- Uo as ScrollNavigationController,
6596
- es as SettingsManager,
6597
- Is as Spine,
6598
- Ze as SpineItem,
6603
+ Bn as ResourcesLocator,
6604
+ zo as ScrollNavigationController,
6605
+ is as SettingsManager,
6606
+ ws as Spine,
6607
+ qe as SpineItem,
6599
6608
  pn as SpineItemPageLayout,
6600
6609
  hn as SpineItemPageSpineLayout,
6601
6610
  R as SpineItemPosition,
6602
6611
  Ht as SpineItemSpineLayout,
6603
- ws as SpineItemsManager,
6604
- us as SpineItemsObserver,
6605
- L as SpinePosition,
6606
- Nt as UnsafeSpineItemPagePosition,
6607
- Rt as UnsafeSpinePosition,
6608
- Ps as Viewport,
6609
- zn as consolidate,
6610
- Os as createReader,
6611
- ae as deferIdle,
6612
+ Ps as SpineItemsManager,
6613
+ ds as SpineItemsObserver,
6614
+ F as SpinePosition,
6615
+ Dt as UnsafeSpineItemPagePosition,
6616
+ It as UnsafeSpinePosition,
6617
+ vs as Viewport,
6618
+ Hn as consolidate,
6619
+ Vs as createReader,
6620
+ re as deferIdle,
6612
6621
  zi as deferNextResult,
6613
6622
  Bt as generateCfiForSpineItemPage,
6614
- kn as generateCfiFromRange,
6615
- lt as generateRootCfi,
6616
- re as getAttributeValueFromString,
6623
+ Un as generateCfiFromRange,
6624
+ gt as generateRootCfi,
6625
+ se as getAttributeValueFromString,
6617
6626
  Zt as getFrameViewportInfo,
6618
- Ns as getItemAnchor,
6619
- gn as htmlEnhancer,
6627
+ Os as getItemAnchor,
6628
+ ln as htmlEnhancer,
6620
6629
  De as idle,
6621
- wi as injectCSS,
6630
+ Ii as injectCSS,
6622
6631
  Re as isHtmlElement,
6623
6632
  Oi as isHtmlTagElement,
6624
6633
  Et as isRootCfi,
6625
6634
  Ws as isShallowEqual,
6626
- wn as layoutEnhancer,
6635
+ Pn as layoutEnhancer,
6627
6636
  Ae as mapKeysTo,
6628
- Rs as observeIntersection,
6629
- ce as observeMutation,
6637
+ As as observeIntersection,
6638
+ ae as observeMutation,
6630
6639
  Kt as observeResize,
6631
- Qn as paginationEnhancer,
6640
+ to as paginationEnhancer,
6632
6641
  ee as parseCfi,
6633
- Cs as removeCSS,
6642
+ Rs as removeCSS,
6634
6643
  ze as resolveCfi,
6635
- Vs as rootEnhancer,
6636
- as as spinePositionToSpineItemSpineLayout,
6644
+ js as rootEnhancer,
6645
+ cs as spinePositionToSpineItemSpineLayout,
6637
6646
  nt as upsertCSSToFrame,
6638
- Pi as waitForFrameLoad,
6639
- vi as waitForFrameReady,
6647
+ wi as waitForFrameLoad,
6648
+ Pi as waitForFrameReady,
6640
6649
  Ct as waitForSwitch,
6641
6650
  Jt as watchKeys
6642
6651
  };