@prose-reader/core 1.232.0 → 1.233.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,6 +1,6 @@
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 ht, 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";
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
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";
3
- import { isShallowEqual as Us } from "@prose-reader/shared";
3
+ import { isShallowEqual as Ws } from "@prose-reader/shared";
4
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
5
  import { generate as Ut, parse as Te, isIndirectionOnly as Si, isParsedCfiRange as bi, resolve as Ii } from "@prose-reader/cfi";
6
6
  import { isDefined as qt } from "reactjrx";
@@ -8,19 +8,27 @@ const re = (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
10
  }, wi = (e, t, i, n) => {
11
- var o;
12
- if ((o = e == null ? void 0 : e.contentDocument) != null && o.head) {
13
- const s = e.contentDocument.createElement("style");
14
- s.id = t, s.innerHTML = i, n ? e.contentDocument.head.prepend(s) : e.contentDocument.head.appendChild(s);
15
- }
16
- }, Pi = (e, t) => {
11
+ var s;
12
+ if (!((s = e == null ? void 0 : e.contentDocument) != null && s.head)) return;
13
+ const o = e.contentDocument.createElement("style");
14
+ o.id = t, o.innerHTML = i, n ? e.contentDocument.head.prepend(o) : e.contentDocument.head.appendChild(o);
15
+ }, Cs = (e, t) => {
17
16
  var i;
18
17
  if ((i = e == null ? void 0 : e.contentDocument) != null && i.head) {
19
18
  const n = e.contentDocument.getElementById(t);
20
19
  n && n.remove();
21
20
  }
22
21
  }, nt = (e, t, i, n) => {
23
- e && (Pi(e, t), wi(e, t, i, n));
22
+ var s;
23
+ if (!e) return;
24
+ const o = (s = e == null ? void 0 : e.contentDocument) == null ? void 0 : s.getElementById(
25
+ t
26
+ );
27
+ if (o) {
28
+ o.innerHTML = i;
29
+ return;
30
+ }
31
+ wi(e, t, i, n);
24
32
  }, Zt = (e) => {
25
33
  if (e != null && e.contentDocument) {
26
34
  const i = e.contentDocument.querySelector("meta[name='viewport']");
@@ -37,7 +45,7 @@ const re = (e, t) => {
37
45
  }
38
46
  }
39
47
  return { hasViewport: !1 };
40
- }, vi = (e) => e.pipe(
48
+ }, Pi = (e) => e.pipe(
41
49
  P((t) => {
42
50
  var i;
43
51
  return t.src === "about:blank" && ((i = t.contentDocument) == null ? void 0 : i.readyState) === "complete" && t.contentDocument.body ? w(t) : q(t, "load").pipe(
@@ -45,16 +53,13 @@ const re = (e, t) => {
45
53
  S(() => t)
46
54
  );
47
55
  })
48
- ), xi = (e) => e.pipe(
49
- P(
50
- (t) => {
51
- var i;
52
- return j(((i = t == null ? void 0 : t.contentDocument) == null ? void 0 : i.fonts.ready) || w(void 0)).pipe(
53
- S(() => t)
54
- );
55
- }
56
- )
57
- ), $i = (e) => (t) => {
56
+ ), vi = (e) => e.pipe(
57
+ P((t) => {
58
+ var n;
59
+ const i = (n = t == null ? void 0 : t.contentDocument) == null ? void 0 : n.fonts.ready;
60
+ return i ? j(i).pipe(S(() => t)) : w(void 0);
61
+ })
62
+ ), xi = (e) => (t) => {
58
63
  const i = e(t), n = new IntersectionObserver((o) => {
59
64
  o.forEach((s) => {
60
65
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -64,12 +69,12 @@ const re = (e, t) => {
64
69
  "item.onDocumentLoad",
65
70
  ({ itemId: o, destroy: s }) => {
66
71
  var u;
67
- const r = i.spineItemsManager.get(o);
68
- if (!r) return;
69
- const a = r.renderer.getDocumentFrame();
72
+ const a = i.spineItemsManager.get(o);
70
73
  if (!a) return;
74
+ const r = a.renderer.getDocumentFrame();
75
+ if (!r) return;
71
76
  nt(
72
- a,
77
+ r,
73
78
  "prose-reader-accessibility",
74
79
  `
75
80
  :focus-visible {
@@ -78,7 +83,7 @@ const re = (e, t) => {
78
83
  }
79
84
  `
80
85
  );
81
- const c = (u = a.contentDocument) == null ? void 0 : u.body.querySelectorAll("a");
86
+ const c = (u = r.contentDocument) == null ? void 0 : u.body.querySelectorAll("a");
82
87
  c == null || c.forEach((d) => {
83
88
  n.observe(d);
84
89
  }), s(() => {
@@ -90,7 +95,7 @@ const re = (e, t) => {
90
95
  ), {
91
96
  ...i
92
97
  };
93
- }, Ti = (e) => (t) => {
98
+ }, $i = (e) => (t) => {
94
99
  const i = e(t);
95
100
  return i.context.state$.pipe(T(i.$.destroy$)).subscribe(({ rootElement: n }) => {
96
101
  if (!n) return;
@@ -99,13 +104,13 @@ const re = (e, t) => {
99
104
  };
100
105
  n.addEventListener("scroll", o);
101
106
  }), i.hookManager.register("item.onDocumentLoad", ({ itemId: n }) => {
102
- var r;
107
+ var a;
103
108
  const o = i.spineItemsManager.get(n), s = o == null ? void 0 : o.renderer.getDocumentFrame();
104
- s && ((r = s.contentDocument) == null || r.body.setAttribute("tabindex", "-1"));
109
+ s && ((a = s.contentDocument) == null || a.body.setAttribute("tabindex", "-1"));
105
110
  }), i;
106
- }, Fi = "@prose-reader/core", O = ci.namespace(Fi, void 0, {
111
+ }, Ti = "@prose-reader/core", O = ci.namespace(Ti, void 0, {
107
112
  color: "#98cde7"
108
- }), Li = [
113
+ }), Fi = [
109
114
  "pointercancel",
110
115
  "pointerdown",
111
116
  "pointerenter",
@@ -117,24 +122,24 @@ const re = (e, t) => {
117
122
  // `touchstart` as const,
118
123
  // `touchend` as const,
119
124
  ];
120
- function Mi(e, t, i) {
125
+ function Li(e, t, i) {
121
126
  if ("caretPositionFromPoint" in e)
122
127
  return e.caretPositionFromPoint(t, i);
123
128
  if ("caretRangeFromPoint" in e && // @ts-expect-error limited availability
124
129
  typeof e.caretRangeFromPoint < "u")
125
130
  return e.caretRangeFromPoint(t, i);
126
131
  }
127
- const Ci = (e, t) => {
132
+ const Mi = (e, t) => {
128
133
  const i = "body" in e ? zt(e.body, t) : zt(e, t), n = "createRange" in e ? e : e.ownerDocument;
129
134
  if (i) {
130
135
  let o, s = 0;
131
- const r = n.createRange();
132
- return Array.from(i.childNodes).some((a) => {
133
- r.selectNodeContents(a);
134
- const c = r.getClientRects(), u = Ri(c, t);
136
+ const a = n.createRange();
137
+ return Array.from(i.childNodes).some((r) => {
138
+ a.selectNodeContents(r);
139
+ const c = a.getClientRects(), u = Ci(c, t);
135
140
  if (u) {
136
- o = r.cloneRange();
137
- const d = Mi(
141
+ o = a.cloneRange();
142
+ const d = Li(
138
143
  n,
139
144
  Math.ceil(u.left),
140
145
  Math.ceil(u.top)
@@ -158,13 +163,13 @@ const Ci = (e, t) => {
158
163
  function Fe(e, { left: t, right: i }) {
159
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";
160
165
  }
161
- function Ri(e, t) {
166
+ function Ci(e, t) {
162
167
  return Array.from(e).find((i) => {
163
168
  const n = Fe(i, t);
164
169
  return n !== "before" && n !== "after";
165
170
  });
166
171
  }
167
- const Ai = (e, t) => {
172
+ const Ri = (e, t) => {
168
173
  var i;
169
174
  if (e.nodeType !== Node.CDATA_SECTION_NODE && e.nodeType !== Node.DOCUMENT_TYPE_NODE) {
170
175
  const n = (i = e.ownerDocument) == null ? void 0 : i.createRange();
@@ -179,41 +184,41 @@ const Ai = (e, t) => {
179
184
  }, Gt = (e) => {
180
185
  var t, i, n, o, s;
181
186
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
182
- const r = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
183
- if (r.PointerEvent && e instanceof r.PointerEvent)
187
+ const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
188
+ if (a.PointerEvent && e instanceof a.PointerEvent)
184
189
  return !0;
185
190
  }
186
191
  if ((s = e == null ? void 0 : e.view) != null && s.window) {
187
- const r = e == null ? void 0 : e.view;
188
- if (r.PointerEvent && e instanceof r.PointerEvent)
192
+ const a = e == null ? void 0 : e.view;
193
+ if (a.PointerEvent && e instanceof a.PointerEvent)
189
194
  return !0;
190
195
  }
191
- return !!Li.includes(e.type);
192
- }, Di = (e) => {
196
+ return !!Fi.includes(e.type);
197
+ }, Ai = (e) => {
193
198
  var t, i, n, o, s;
194
199
  if (Gt(e)) return !1;
195
200
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
196
- const r = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
197
- if (r.MouseEvent)
198
- return e instanceof r.MouseEvent;
201
+ const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
202
+ if (a.MouseEvent)
203
+ return e instanceof a.MouseEvent;
199
204
  }
200
205
  if ((s = e == null ? void 0 : e.view) != null && s.window) {
201
- const r = e == null ? void 0 : e.view;
202
- if (r.MouseEvent)
203
- return e instanceof r.MouseEvent;
206
+ const a = e == null ? void 0 : e.view;
207
+ if (a.MouseEvent)
208
+ return e instanceof a.MouseEvent;
204
209
  }
205
210
  return !1;
206
- }, Ni = (e) => {
211
+ }, Di = (e) => {
207
212
  var t, i, n, o, s;
208
213
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
209
- const r = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
210
- if (r.TouchEvent)
211
- return e instanceof r.TouchEvent;
214
+ const a = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
215
+ if (a.TouchEvent)
216
+ return e instanceof a.TouchEvent;
212
217
  }
213
218
  if ((s = e == null ? void 0 : e.view) != null && s.window) {
214
- const r = e == null ? void 0 : e.view;
215
- if (r.TouchEvent)
216
- return e instanceof r.TouchEvent;
219
+ const a = e == null ? void 0 : e.view;
220
+ if (a.TouchEvent)
221
+ return e instanceof a.TouchEvent;
217
222
  }
218
223
  return !1;
219
224
  }, Le = () => document.createElement("div"), Me = (e) => {
@@ -232,7 +237,7 @@ const Ai = (e, t) => {
232
237
  // JavaScript files
233
238
  ].join(",");
234
239
  return Array.from((e == null ? void 0 : e.querySelectorAll(t)) || []);
235
- }, Oi = (e) => {
240
+ }, Ni = (e) => {
236
241
  if (Me(e).forEach((i) => {
237
242
  var o;
238
243
  const n = i.getAttribute("src") || i.getAttribute("href");
@@ -243,8 +248,8 @@ const Ai = (e, t) => {
243
248
  const o = Array.from(n.cssRules || []);
244
249
  for (const s of o)
245
250
  if (e.defaultView && s instanceof e.defaultView.CSSFontFaceRule) {
246
- const a = s.style.getPropertyValue("src").match(/blob:[^,\s'")]+/g);
247
- a && a.forEach((c) => {
251
+ const r = s.style.getPropertyValue("src").match(/blob:[^,\s'")]+/g);
252
+ r && r.forEach((c) => {
248
253
  var u;
249
254
  (u = e == null ? void 0 : e.defaultView) == null || u.URL.revokeObjectURL(c);
250
255
  });
@@ -269,10 +274,10 @@ function Re(e) {
269
274
  // biome-ignore lint/suspicious/noExplicitAny: <explanation>
270
275
  ) && e.nodeType === Node.ELEMENT_NODE;
271
276
  }
272
- function Vi(e, t) {
277
+ function Oi(e, t) {
273
278
  return Re(e) && e.tagName.toLowerCase() === t.toLowerCase();
274
279
  }
275
- function ji(e) {
280
+ function Vi(e) {
276
281
  return Ce(
277
282
  e,
278
283
  [
@@ -290,21 +295,21 @@ const Dt = ({
290
295
  position: e,
291
296
  frameElement: t
292
297
  }) => {
293
- const i = t.getBoundingClientRect(), n = i.width / t.offsetWidth, o = i.height / t.offsetHeight, { left: s = 0, top: r = 0 } = i, a = e.clientX * n + s, c = e.clientY * o + r;
298
+ const i = t.getBoundingClientRect(), n = i.width / t.offsetWidth, o = i.height / t.offsetHeight, { left: s = 0, top: a = 0 } = i, r = e.clientX * n + s, c = e.clientY * o + a;
294
299
  return {
295
- clientX: a,
300
+ clientX: r,
296
301
  clientY: c
297
302
  };
298
- }, ki = (e, t, i, n) => {
303
+ }, ji = (e, t, i, n) => {
299
304
  var u;
300
305
  const o = (u = t == null ? void 0 : t.view) == null ? void 0 : u.frameElement;
301
306
  if (!t || !o) return e;
302
- const s = i.getSpineItemFromIframe(o), r = o, { height: a, width: c } = n.getPageSize();
303
- if (!s || !(r instanceof HTMLIFrameElement)) return e;
307
+ const s = i.getSpineItemFromIframe(o), a = o, { height: r, width: c } = n.getPageSize();
308
+ if (!s || !(a instanceof HTMLIFrameElement)) return e;
304
309
  if (Gt(e)) {
305
310
  const { clientX: d, clientY: g } = Dt({
306
311
  position: e,
307
- frameElement: r
312
+ frameElement: a
308
313
  }), l = new PointerEvent(e.type, {
309
314
  ...e,
310
315
  pointerId: e.pointerId,
@@ -316,10 +321,10 @@ const Dt = ({
316
321
  enumerable: !0
317
322
  }), l;
318
323
  }
319
- if (Di(e)) {
324
+ if (Ai(e)) {
320
325
  const { clientX: d, clientY: g } = Dt({
321
326
  position: e,
322
- frameElement: r
327
+ frameElement: a
323
328
  }), l = new MouseEvent(e.type, {
324
329
  ...e,
325
330
  clientX: d,
@@ -330,11 +335,11 @@ const Dt = ({
330
335
  enumerable: !0
331
336
  }), l;
332
337
  }
333
- if (Ni(e)) {
338
+ if (Di(e)) {
334
339
  const d = Array.from(e.touches).map((l) => {
335
340
  const { clientX: h, clientY: p } = Dt({
336
341
  position: l,
337
- frameElement: r
342
+ frameElement: a
338
343
  });
339
344
  return new Touch({
340
345
  identifier: l.identifier,
@@ -353,7 +358,7 @@ const Dt = ({
353
358
  }), g;
354
359
  }
355
360
  return e;
356
- }, Wi = [
361
+ }, ki = [
357
362
  "pointercancel",
358
363
  "pointerdown",
359
364
  "pointerenter",
@@ -362,23 +367,23 @@ const Dt = ({
362
367
  "pointerout",
363
368
  "pointerover",
364
369
  "pointerup"
365
- ], Ui = [
366
- ...Wi
370
+ ], Wi = [
371
+ ...ki
367
372
  /*, ...mouseEvents*/
368
- ], zi = (e) => (t) => {
373
+ ], Ui = (e) => (t) => {
369
374
  const i = e(t);
370
375
  return i.hookManager.register(
371
376
  "item.onDocumentLoad",
372
377
  ({ destroy: n, itemId: o }) => {
373
- const s = i.spineItemsManager.get(o), r = s == null ? void 0 : s.renderer.getDocumentFrame();
374
- if (!r || !s) return;
375
- const a = Ui.map((c) => {
378
+ const s = i.spineItemsManager.get(o), a = s == null ? void 0 : s.renderer.getDocumentFrame();
379
+ if (!a || !s) return;
380
+ const r = Wi.map((c) => {
376
381
  var d;
377
382
  const u = (g) => {
378
383
  var h;
379
384
  let l = g;
380
385
  if (Gt(g) && (l = new PointerEvent(g.type, g)), l !== g) {
381
- const p = ki(
386
+ const p = ji(
382
387
  l,
383
388
  g,
384
389
  i.spine.locator,
@@ -387,13 +392,13 @@ const Dt = ({
387
392
  (h = i.context.state.rootElement) == null || h.dispatchEvent(p);
388
393
  }
389
394
  };
390
- return (d = r.contentDocument) == null || d.addEventListener(c, u), () => {
395
+ return (d = a.contentDocument) == null || d.addEventListener(c, u), () => {
391
396
  var g;
392
- (g = r.contentDocument) == null || g.removeEventListener(c, u);
397
+ (g = a.contentDocument) == null || g.removeEventListener(c, u);
393
398
  };
394
399
  });
395
400
  n(() => {
396
- a.forEach((c) => c());
401
+ r.forEach((c) => c());
397
402
  });
398
403
  }
399
404
  ), i;
@@ -421,7 +426,7 @@ const Ct = (e) => (t) => t.pipe(
421
426
  Y(() => i)
422
427
  )
423
428
  )
424
- ), Hi = (e) => {
429
+ ), zi = (e) => {
425
430
  let t;
426
431
  const i = e.subscribe((n) => {
427
432
  t = { result: n };
@@ -451,7 +456,7 @@ const ce = (e, t) => new ot((i) => {
451
456
  });
452
457
  return n.observe(e, t), () => n.disconnect();
453
458
  });
454
- function As(e, t) {
459
+ function Rs(e, t) {
455
460
  return new ot((i) => {
456
461
  const n = new IntersectionObserver((o) => {
457
462
  i.next(o);
@@ -480,10 +485,10 @@ class Ne {
480
485
  ), this.values$.subscribe();
481
486
  }
482
487
  _prepareUpdate(t) {
483
- const i = this.getCleanedParentInputSettings(t), n = this.settingsManager._prepareUpdate(i), o = vt(this.inputSettings, t), s = this.computeOutputSettings(o), r = this.hasSettingsChanged(s);
488
+ const i = this.getCleanedParentInputSettings(t), n = this.settingsManager._prepareUpdate(i), o = vt(this.inputSettings, t), s = this.computeOutputSettings(o), a = this.hasSettingsChanged(s);
484
489
  return {
485
- hasChanged: r || n.hasChanged,
486
- commit: () => (this.inputSettings = o, this.outputSettings = s, !n.hasChanged && r && this.outputSettingsUpdateSubject.next(s), {
490
+ hasChanged: a || n.hasChanged,
491
+ commit: () => (this.inputSettings = o, this.outputSettings = s, !n.hasChanged && a && this.outputSettingsUpdateSubject.next(s), {
487
492
  ...n.commit(),
488
493
  ...s
489
494
  })
@@ -509,7 +514,7 @@ class Ne {
509
514
  this.outputSettingsUpdateSubject.complete();
510
515
  }
511
516
  }
512
- let Bi = class extends Ne {
517
+ let Hi = class extends Ne {
513
518
  computeOutputSettings(t) {
514
519
  return t;
515
520
  }
@@ -517,8 +522,8 @@ let Bi = class extends Ne {
517
522
  return !N(this.outputSettings, t);
518
523
  }
519
524
  getCleanedParentInputSettings(t) {
520
- const { fontJustification: i, fontScale: n, fontWeight: o, lineHeight: s, ...r } = t;
521
- return r;
525
+ const { fontJustification: i, fontScale: n, fontWeight: o, lineHeight: s, ...a } = t;
526
+ return a;
522
527
  }
523
528
  getDefaultSettings() {
524
529
  return {
@@ -529,15 +534,15 @@ let Bi = class extends Ne {
529
534
  };
530
535
  }
531
536
  };
532
- const Ei = (e) => (t) => {
533
- const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t, r = new W(), a = e(t), c = new Bi(
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(
534
539
  {
535
540
  fontScale: i,
536
541
  lineHeight: n,
537
542
  fontWeight: o,
538
543
  fontJustification: s
539
544
  },
540
- a.settings
545
+ r.settings
541
546
  ), u = () => `
542
547
 
543
548
  body {
@@ -547,15 +552,15 @@ const Ei = (e) => (t) => {
547
552
  ${c.values.fontJustification !== "publisher" ? `text-align: ${c.values.fontJustification} !important;` : ""}
548
553
  }
549
554
  `, d = (l) => {
550
- a.spineItemsManager.items.forEach((h) => {
555
+ r.spineItemsManager.items.forEach((h) => {
551
556
  if (h.renditionLayout !== "pre-paginated") {
552
557
  const p = h.renderer.getDocumentFrame();
553
558
  p && nt(p, "prose-reader-fonts", u());
554
559
  }
555
- }), l && a.layout();
560
+ }), l && r.layout();
556
561
  };
557
- a.hookManager.register("item.onDocumentLoad", ({ itemId: l }) => {
558
- const h = a.spineItemsManager.get(l);
562
+ r.hookManager.register("item.onDocumentLoad", ({ itemId: l }) => {
563
+ const h = r.spineItemsManager.get(l);
559
564
  if ((h == null ? void 0 : h.renditionLayout) !== "pre-paginated") {
560
565
  const p = h == null ? void 0 : h.renderer.getDocumentFrame();
561
566
  p && nt(p, "prose-reader-fonts", u());
@@ -568,25 +573,25 @@ const Ei = (e) => (t) => {
568
573
  return c.values$.pipe(
569
574
  g,
570
575
  k(d),
571
- T(a.$.destroy$)
576
+ T(r.$.destroy$)
572
577
  ).subscribe(), {
573
- ...a,
578
+ ...r,
574
579
  destroy: () => {
575
- r.complete(), c.destroy(), a.destroy();
580
+ a.complete(), c.destroy(), r.destroy();
576
581
  },
577
582
  settings: c
578
583
  };
579
- }, _i = (e) => (t) => {
584
+ }, Ei = (e) => (t) => {
580
585
  const i = e(t), n = (o) => q(o, "keyup").pipe(
581
586
  A(i.settings.values$),
582
- S(([s, { pageTurnDirection: r }]) => {
583
- if (r === "horizontal") {
587
+ S(([s, { pageTurnDirection: a }]) => {
588
+ if (a === "horizontal") {
584
589
  if (s.key === "ArrowRight")
585
590
  return i.navigation.turnRight();
586
591
  if (s.key === "ArrowLeft")
587
592
  return i.navigation.turnLeft();
588
593
  }
589
- if (r === "vertical") {
594
+ if (a === "vertical") {
590
595
  if (s.key === "ArrowDown")
591
596
  return i.navigation.turnRight();
592
597
  if (s.key === "ArrowUp")
@@ -601,8 +606,8 @@ const Ei = (e) => (t) => {
601
606
  ...o.map(
602
607
  (s) => s.loaded$.pipe(
603
608
  P(() => {
604
- const r = s.renderer.getDocumentFrame();
605
- return r instanceof HTMLIFrameElement && (r != null && r.contentDocument) ? n(r.contentDocument) : Q;
609
+ const a = s.renderer.getDocumentFrame();
610
+ return a instanceof HTMLIFrameElement && (a != null && a.contentDocument) ? n(a.contentDocument) : Q;
606
611
  })
607
612
  )
608
613
  )
@@ -610,7 +615,7 @@ const Ei = (e) => (t) => {
610
615
  ),
611
616
  T(i.$.destroy$)
612
617
  ).subscribe(), i;
613
- }, Xi = (e) => e.spine.spineItemsManager.items$.pipe(
618
+ }, _i = (e) => e.spine.spineItemsManager.items$.pipe(
614
619
  P(
615
620
  (t) => v(
616
621
  ...t.map((i) => i.loaded$.pipe(
@@ -620,7 +625,7 @@ const Ei = (e) => (t) => {
620
625
  const s = Array.from(
621
626
  n.contentDocument.querySelectorAll("a")
622
627
  ).map(
623
- (r) => q(r, "click")
628
+ (a) => q(a, "click")
624
629
  );
625
630
  return v(...s);
626
631
  })
@@ -674,18 +679,18 @@ const Lt = class Lt extends X {
674
679
  itemId: this.item.id,
675
680
  documentContainer: s
676
681
  }), this.onLoadDocument().pipe(
677
- ht(null),
682
+ mt(null),
678
683
  z()
679
684
  ).pipe(
680
685
  Ct(this.context.bridgeEvent.viewportFree$),
681
686
  P(() => {
682
- const a = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
687
+ const r = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
683
688
  itemId: this.item.id,
684
689
  documentContainer: s
685
690
  }).filter(
686
691
  (c) => c instanceof ot
687
692
  );
688
- return B([w(null), ...a]).pipe(z());
693
+ return B([w(null), ...r]).pipe(z());
689
694
  })
690
695
  ))),
691
696
  $(() => {
@@ -700,7 +705,7 @@ const Lt = class Lt extends X {
700
705
  $(() => {
701
706
  this.hookManager.destroy("item.onDocumentLoad", this.item.id);
702
707
  }),
703
- P(() => this.onUnload().pipe(ht(null), z())),
708
+ P(() => this.onUnload().pipe(mt(null), z())),
704
709
  $(() => {
705
710
  this.stateSubject.next("idle");
706
711
  }),
@@ -736,7 +741,7 @@ const Lt = class Lt extends X {
736
741
  renderHeadless() {
737
742
  const t = new W();
738
743
  return kt(() => this.onRenderHeadless({ release: t })).pipe(
739
- ht(void 0),
744
+ mt(void 0),
740
745
  z(),
741
746
  S((i) => {
742
747
  if (i)
@@ -779,8 +784,8 @@ const Lt = class Lt extends X {
779
784
  }
780
785
  };
781
786
  Lt.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
782
- let mt = Lt;
783
- const Yi = (e) => new URL(e.href);
787
+ let ft = Lt;
788
+ const Xi = (e) => new URL(e.href);
784
789
  class Qt {
785
790
  constructor(t, i) {
786
791
  this.item = t, this.settings = i;
@@ -789,7 +794,7 @@ class Qt {
789
794
  var i, n;
790
795
  return await ei(
791
796
  ((n = (i = this.settings.values).getResource) == null ? void 0 : n.call(i, this.item)) ?? w(void 0)
792
- ) ?? Yi(this.item);
797
+ ) ?? Xi(this.item);
793
798
  }
794
799
  async fetchResource() {
795
800
  const t = await this.getResource();
@@ -799,14 +804,14 @@ class Qt {
799
804
  const Oe = (e, t) => {
800
805
  const i = e.startsWith("file://"), n = i ? e.replace("file://", "http://") : e, o = new URL(t, n).toString();
801
806
  return i ? o.replace("http://", "file://") : o;
802
- }, qi = async (e, t, i, n, o) => {
807
+ }, Yi = async (e, t, i, n, o) => {
803
808
  if (!e || !e.defaultView) return;
804
809
  const s = t.sheet;
805
810
  if (s)
806
811
  try {
807
- const r = Array.from(s.cssRules || []);
808
- for (let a = 0; a < r.length; a++) {
809
- const c = r[a];
812
+ const a = Array.from(s.cssRules || []);
813
+ for (let r = 0; r < a.length; r++) {
814
+ const c = a[r];
810
815
  if (e.defaultView && c instanceof e.defaultView.CSSFontFaceRule) {
811
816
  const u = c.style.getPropertyValue("src");
812
817
  if (u.match(/url\(['"]?([^'"]+)['"]?\)/g)) {
@@ -841,23 +846,23 @@ const Oe = (e, t) => {
841
846
  /src:\s*[^;]+;/,
842
847
  `src: ${l.join(", ")};`
843
848
  );
844
- s.deleteRule(a), s.insertRule(h, a);
849
+ s.deleteRule(r), s.insertRule(h, r);
845
850
  }
846
851
  }
847
852
  }
848
- } catch (r) {
849
- console.error("Could not access stylesheet rules:", r);
853
+ } catch (a) {
854
+ console.error("Could not access stylesheet rules:", a);
850
855
  }
851
- }, Zi = (e, t, i, n, o) => {
856
+ }, qi = (e, t, i, n, o) => {
852
857
  var c;
853
858
  const s = t.getAttribute("src") || t.getAttribute("href");
854
859
  if (!s) return w(null);
855
- const r = (c = n.manifest) == null ? void 0 : c.items.find(({ href: u }) => `${Oe(i, s).toLowerCase()}`.endsWith(
860
+ const a = (c = n.manifest) == null ? void 0 : c.items.find(({ href: u }) => `${Oe(i, s).toLowerCase()}`.endsWith(
856
861
  `${u.toLowerCase()}`
857
862
  ));
858
- if (!r) return w(null);
859
- const a = new Qt(r, o);
860
- return j(a.getResource()).pipe(
863
+ if (!a) return w(null);
864
+ const r = new Qt(a, o);
865
+ return j(r.getResource()).pipe(
861
866
  $t(
862
867
  (u) => u instanceof Response ? j(u.blob()) : w(void 0)
863
868
  ),
@@ -872,7 +877,7 @@ const Oe = (e, t) => {
872
877
  return new ot((l) => {
873
878
  t.onload = async () => {
874
879
  try {
875
- t.sheet && await qi(
880
+ t.sheet && await Yi(
876
881
  e,
877
882
  t,
878
883
  i,
@@ -887,7 +892,7 @@ const Oe = (e, t) => {
887
892
  return w(null);
888
893
  })
889
894
  );
890
- }, Gi = ({
895
+ }, Zi = ({
891
896
  settings: e,
892
897
  item: t,
893
898
  context: i
@@ -895,30 +900,30 @@ const Oe = (e, t) => {
895
900
  P((o) => {
896
901
  const s = Me(
897
902
  o.contentDocument
898
- ), r = ui(t.href), a = s.map(
899
- (c) => Zi(
903
+ ), a = ui(t.href), r = s.map(
904
+ (c) => qi(
900
905
  o.contentDocument,
901
906
  c,
902
- r,
907
+ a,
903
908
  i,
904
909
  e
905
910
  )
906
911
  );
907
- return B(a).pipe(S(() => o));
912
+ return B(r).pipe(S(() => o));
908
913
  })
909
- ), Ji = (e) => {
910
- Oi(e == null ? void 0 : e.contentDocument);
911
- }, Ki = [".xhtml", ".html", ".htm"], lt = "prose-reader", Qi = async (e, t) => {
914
+ ), Gi = (e) => {
915
+ Ni(e == null ? void 0 : e.contentDocument);
916
+ }, Ji = [".xhtml", ".html", ".htm"], pt = "prose-reader", Ki = async (e, t) => {
912
917
  if (typeof e == "string") return e;
913
918
  const i = di(e.headers.get("Content-Type") || "") || Mt(t.href);
914
919
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
915
920
  (o) => o === i
916
921
  )) {
917
- const o = await e.blob(), s = URL.createObjectURL(o), r = await createImageBitmap(o), { width: a, height: c } = { width: r.width, height: r.height };
918
- return r.close(), `
922
+ const o = await e.blob(), s = URL.createObjectURL(o), a = await createImageBitmap(o), { width: r, height: c } = { width: a.width, height: a.height };
923
+ return a.close(), `
919
924
  <html>
920
925
  <head>
921
- ${t.renditionLayout === "pre-paginated" ? `<meta name="viewport" content="width=${a}, height=${c}">` : ""}
926
+ ${t.renditionLayout === "pre-paginated" ? `<meta name="viewport" content="width=${r}, height=${c}">` : ""}
922
927
  </head>
923
928
  <body style="margin: 0px;" tab-index="-1;">
924
929
  <img
@@ -946,11 +951,11 @@ const Oe = (e, t) => {
946
951
  </body>
947
952
  </html>
948
953
  ` : await e.text();
949
- }, tn = ({
954
+ }, Qi = ({
950
955
  item: e,
951
956
  resourcesHandler: t
952
957
  }) => {
953
- const i = (n) => Qi(n, e);
958
+ const i = (n) => Ki(n, e);
954
959
  return (n) => n.pipe(
955
960
  P((o) => j(t.getResource()).pipe(
956
961
  P((s) => s instanceof URL && e.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
@@ -960,29 +965,29 @@ const Oe = (e, t) => {
960
965
  "text/html",
961
966
  "text/xml"
962
967
  ].includes(e.mediaType) || // no encoding ? then try to detect html
963
- !e.mediaType && Ki.some(
964
- (a) => e.href.endsWith(a)
968
+ !e.mediaType && Ji.some(
969
+ (r) => e.href.endsWith(r)
965
970
  )) ? (o == null || o.setAttribute("src", e.href), w(o)) : (s instanceof URL ? j(t.fetchResource()) : w(s)).pipe(
966
- P((a) => {
967
- if (!(a instanceof Response))
971
+ P((r) => {
972
+ if (!(r instanceof Response))
968
973
  throw new Error("Invalid resource");
969
- return j(i(a));
974
+ return j(i(r));
970
975
  }),
971
- $((a) => {
972
- if (a) {
973
- const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
976
+ $((r) => {
977
+ if (r) {
978
+ const c = new Blob([r], { type: "text/html" }), u = URL.createObjectURL(c);
974
979
  o == null || o.setAttribute("src", u);
975
980
  }
976
981
  }),
977
982
  S(() => o),
978
- Pe((a) => (O.error(
983
+ Pe((r) => (O.error(
979
984
  `Error while trying to fetch or load resource for item ${e.id}`,
980
985
  s
981
- ), O.error(a), w(o)))
986
+ ), O.error(r), w(o)))
982
987
  ))
983
988
  ))
984
989
  );
985
- }, en = () => {
990
+ }, tn = () => {
986
991
  const e = document.createElement("iframe");
987
992
  return e.frameBorder = "no", e.tabIndex = 0, e.setAttribute(
988
993
  "sandbox",
@@ -1015,7 +1020,7 @@ const Oe = (e, t) => {
1015
1020
  e / (n.height ?? 1)
1016
1021
  ), computedWidthScale: o, viewportDimensions: n };
1017
1022
  }
1018
- }, nn = ({
1023
+ }, en = ({
1019
1024
  columnWidth: e,
1020
1025
  enableTouch: t,
1021
1026
  spreadPosition: i
@@ -1060,27 +1065,27 @@ const Oe = (e, t) => {
1060
1065
  object-fit:contain;
1061
1066
  `}
1062
1067
  }
1063
- `, on = ({
1068
+ `, nn = ({
1064
1069
  pageHeight: e,
1065
1070
  pageWidth: t
1066
1071
  }) => ({ columnHeight: e, columnWidth: t }), ue = (e, t) => {
1067
1072
  e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
1068
- }, sn = ({
1073
+ }, on = ({
1069
1074
  minPageSpread: e,
1070
1075
  blankPagePosition: t,
1071
1076
  spreadPosition: i,
1072
1077
  pageHeight: n,
1073
1078
  pageWidth: o,
1074
1079
  frameElement: s,
1075
- isRTL: r,
1076
- enableTouch: a
1080
+ isRTL: a,
1081
+ enableTouch: r
1077
1082
  }) => {
1078
1083
  const c = e * o;
1079
1084
  if (s != null && s.contentDocument && (s != null && s.contentWindow)) {
1080
- const { viewportDimensions: u, computedScale: d = 1 } = je({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, h = nn(
1085
+ const { viewportDimensions: u, computedScale: d = 1 } = je({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, h = en(
1081
1086
  {
1082
- ...on({ pageHeight: n, pageWidth: o }),
1083
- enableTouch: a,
1087
+ ...nn({ pageHeight: n, pageWidth: o }),
1088
+ enableTouch: r,
1084
1089
  spreadPosition: i
1085
1090
  },
1086
1091
  u
@@ -1092,11 +1097,11 @@ const Oe = (e, t) => {
1092
1097
  width: g,
1093
1098
  height: l
1094
1099
  }), u) {
1095
- 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" && r ? (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(
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(
1096
1101
  "left",
1097
- t === "before" ? r ? "25%" : "75%" : t === "after" ? r ? "75%" : "25%" : "50%"
1102
+ t === "before" ? a ? "25%" : "75%" : t === "after" ? a ? "75%" : "25%" : "50%"
1098
1103
  ), s == null || s.style.removeProperty("right"));
1099
- const p = i !== "none" ? "0" : "-50%", m = i === "right" && t !== "before" ? "left" : i === "left" || t === "before" && r ? "right" : "center";
1104
+ const p = i !== "none" ? "0" : "-50%", m = i === "right" && t !== "before" ? "left" : i === "left" || t === "before" && a ? "right" : "center";
1100
1105
  s == null || s.style.setProperty(
1101
1106
  "transform",
1102
1107
  `translate(${p}, -50%) scale(${d})`
@@ -1105,11 +1110,11 @@ const Oe = (e, t) => {
1105
1110
  `${m} center`
1106
1111
  );
1107
1112
  } else
1108
- t === "before" ? r ? 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"));
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"));
1109
1114
  return { width: c, height: l };
1110
1115
  }
1111
1116
  return { width: c, height: n };
1112
- }, rn = () => `
1117
+ }, sn = () => `
1113
1118
  ${Ve()}
1114
1119
  html {
1115
1120
  width: 100%;
@@ -1124,7 +1129,7 @@ const Oe = (e, t) => {
1124
1129
  html, body {
1125
1130
  touch-action: none;
1126
1131
  }
1127
- `, an = ({
1132
+ `, rn = ({
1128
1133
  isScrollable: e,
1129
1134
  enableTouch: t
1130
1135
  }) => `
@@ -1149,7 +1154,7 @@ const Oe = (e, t) => {
1149
1154
  display: block;
1150
1155
  }
1151
1156
  ` : ""}
1152
- `, cn = ({
1157
+ `, an = ({
1153
1158
  width: e,
1154
1159
  columnHeight: t,
1155
1160
  columnWidth: i
@@ -1217,31 +1222,31 @@ const Oe = (e, t) => {
1217
1222
  td {
1218
1223
  max-width: ${i}px;
1219
1224
  }
1220
- `, un = ({
1225
+ `, cn = ({
1221
1226
  isUsingVerticalWriting: e,
1222
1227
  minimumWidth: t,
1223
1228
  pageHeight: i,
1224
1229
  pageWidth: n
1225
1230
  }) => {
1226
- let r = n - 0;
1227
- const a = i - 0 * 2;
1231
+ let a = n - 0;
1232
+ const r = i - 0 * 2;
1228
1233
  let c = n - 0 * 2;
1229
- return e && (c = t - 0 * 2, r = a), {
1230
- columnHeight: a,
1231
- columnWidth: r,
1234
+ return e && (c = t - 0 * 2, a = r), {
1235
+ columnHeight: r,
1236
+ columnWidth: a,
1232
1237
  width: c
1233
1238
  };
1234
1239
  }, It = (e, t) => {
1235
1240
  e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
1236
- }, dn = ({
1241
+ }, un = ({
1237
1242
  pageHeight: e,
1238
1243
  pageWidth: t,
1239
1244
  frameElement: i,
1240
1245
  manifest: n,
1241
1246
  latestContentHeightWhenLoaded: o,
1242
1247
  minPageSpread: s,
1243
- isRTL: r,
1244
- blankPagePosition: a,
1248
+ isRTL: a,
1249
+ blankPagePosition: r,
1245
1250
  isImageType: c,
1246
1251
  enableTouch: u,
1247
1252
  isUsingVerticalWriting: d
@@ -1261,23 +1266,23 @@ const Oe = (e, t) => {
1261
1266
  nt(
1262
1267
  i,
1263
1268
  "prose-reader-html-renderer-framce-css",
1264
- rn()
1269
+ sn()
1265
1270
  ), It(i, {
1266
1271
  width: m.width ?? 1,
1267
1272
  height: m.height ?? 1
1268
1273
  }), i == null || i.style.setProperty("position", "absolute"), i == null || i.style.setProperty("top", "50%"), i == null || i.style.setProperty(
1269
1274
  "left",
1270
- a === "before" ? r ? "25%" : "75%" : a === "after" ? r ? "75%" : "25%" : "50%"
1275
+ r === "before" ? a ? "25%" : "75%" : r === "after" ? a ? "75%" : "25%" : "50%"
1271
1276
  ), i == null || i.style.setProperty(
1272
1277
  "transform",
1273
1278
  `translate(-50%, -50%) scale(${y})`
1274
1279
  ), i == null || i.style.setProperty("transform-origin", "center center");
1275
1280
  else {
1276
- const C = c ? an({
1281
+ const C = c ? rn({
1277
1282
  isScrollable: (n == null ? void 0 : n.renditionFlow) === "scrolled-continuous",
1278
1283
  enableTouch: u
1279
- }) : cn(
1280
- un({
1284
+ }) : an(
1285
+ cn({
1281
1286
  isUsingVerticalWriting: d,
1282
1287
  minimumWidth: g,
1283
1288
  pageHeight: p,
@@ -1306,7 +1311,7 @@ const Oe = (e, t) => {
1306
1311
  });
1307
1312
  }
1308
1313
  }
1309
- return I % g === 0 ? i == null || i.style.setProperty("margin-left", "0px") : (I = I + t, r && !d && (i == null || i.style.setProperty("margin-left", `${t}px`))), { width: I, height: x };
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 };
1310
1315
  }
1311
1316
  return {
1312
1317
  width: g,
@@ -1314,7 +1319,7 @@ const Oe = (e, t) => {
1314
1319
  latestContentHeightWhenLoaded: l
1315
1320
  };
1316
1321
  };
1317
- class gn extends mt {
1322
+ class dn extends ft {
1318
1323
  constructor() {
1319
1324
  super(...arguments), this.isImageType = () => {
1320
1325
  const t = this.item.mediaType ?? Mt(this.item.href);
@@ -1322,14 +1327,14 @@ class gn extends mt {
1322
1327
  };
1323
1328
  }
1324
1329
  onCreateDocument() {
1325
- const t = en();
1330
+ const t = tn();
1326
1331
  return this.setDocumentContainer(t), w(t);
1327
1332
  }
1328
1333
  onLoadDocument() {
1329
1334
  const t = this.getFrameElement();
1330
1335
  if (!t) throw new Error("invalid frame");
1331
1336
  return w(t).pipe(
1332
- tn({
1337
+ Qi({
1333
1338
  item: this.item,
1334
1339
  resourcesHandler: this.resourcesHandler,
1335
1340
  settings: this.settings
@@ -1338,17 +1343,17 @@ class gn extends mt {
1338
1343
  $(() => {
1339
1344
  this.attach();
1340
1345
  }),
1341
- vi,
1342
- Gi({
1346
+ Pi,
1347
+ Zi({
1343
1348
  context: this.context,
1344
1349
  item: this.item,
1345
1350
  settings: this.settings
1346
1351
  }),
1347
- xi
1352
+ vi
1348
1353
  );
1349
1354
  }
1350
1355
  onUnload() {
1351
- return Ji(this.getFrameElement()), this.detach(), Q;
1356
+ return Gi(this.getFrameElement()), this.detach(), Q;
1352
1357
  }
1353
1358
  onLayout({
1354
1359
  minPageSpread: t,
@@ -1356,14 +1361,14 @@ class gn extends mt {
1356
1361
  spreadPosition: n
1357
1362
  }) {
1358
1363
  var d, g;
1359
- const { width: o, height: s } = this.context.getPageSize(), r = this.getFrameElement();
1360
- if (!r) return w(void 0);
1361
- const a = !!((d = this.writingMode) != null && d.startsWith("vertical"));
1364
+ const { width: o, height: s } = this.context.getPageSize(), a = this.getFrameElement();
1365
+ if (!a) return w(void 0);
1366
+ const r = !!((d = this.writingMode) != null && d.startsWith("vertical"));
1362
1367
  if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && ((g = this.context.manifest) == null ? void 0 : g.renditionLayout) === "pre-paginated") {
1363
- const l = sn({
1368
+ const l = on({
1364
1369
  blankPagePosition: i,
1365
1370
  enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
1366
- frameElement: r,
1371
+ frameElement: a,
1367
1372
  isRTL: this.context.isRTL(),
1368
1373
  minPageSpread: t,
1369
1374
  pageHeight: s,
@@ -1372,13 +1377,13 @@ class gn extends mt {
1372
1377
  });
1373
1378
  return w(l);
1374
1379
  }
1375
- const { latestContentHeightWhenLoaded: c, ...u } = dn({
1380
+ const { latestContentHeightWhenLoaded: c, ...u } = un({
1376
1381
  pageHeight: s,
1377
1382
  pageWidth: o,
1378
- frameElement: r,
1383
+ frameElement: a,
1379
1384
  manifest: this.context.manifest,
1380
1385
  blankPagePosition: i,
1381
- isUsingVerticalWriting: a,
1386
+ isUsingVerticalWriting: r,
1382
1387
  isRTL: this.context.isRTL(),
1383
1388
  latestContentHeightWhenLoaded: this.latestContentHeightWhenLoaded,
1384
1389
  minPageSpread: t,
@@ -1444,14 +1449,14 @@ class gn extends mt {
1444
1449
  return this.getFrameElement();
1445
1450
  }
1446
1451
  }
1447
- const ln = (e) => (t) => {
1452
+ const gn = (e) => (t) => {
1448
1453
  const i = e({
1449
1454
  ...t,
1450
1455
  getRenderer(o) {
1451
- var r;
1452
- return ((r = t.getRenderer) == null ? void 0 : r.call(t, o)) ?? ((a) => new gn(a));
1456
+ var a;
1457
+ return ((a = t.getRenderer) == null ? void 0 : a.call(t, o)) ?? ((r) => new dn(r));
1453
1458
  }
1454
- }), n = Xi(i);
1459
+ }), n = _i(i);
1455
1460
  return n.pipe(T(i.$.destroy$)).subscribe(), {
1456
1461
  ...i,
1457
1462
  links$: n
@@ -1460,7 +1465,7 @@ const ln = (e) => (t) => {
1460
1465
  function at(e) {
1461
1466
  return e != null;
1462
1467
  }
1463
- let pn = class extends Ne {
1468
+ let ln = class extends Ne {
1464
1469
  computeOutputSettings(t) {
1465
1470
  return t;
1466
1471
  }
@@ -1473,10 +1478,10 @@ let pn = class extends Ne {
1473
1478
  pageHorizontalMargin: n,
1474
1479
  pageVerticalMargin: o,
1475
1480
  layoutLayerTransition: s,
1476
- viewportMode: r,
1477
- ...a
1481
+ viewportMode: a,
1482
+ ...r
1478
1483
  } = t;
1479
- return a;
1484
+ return r;
1480
1485
  }
1481
1486
  getDefaultSettings() {
1482
1487
  return {
@@ -1503,7 +1508,7 @@ class Nt {
1503
1508
  this.__symbol = Symbol("SpineItemPagePosition"), this.x = t.x, this.y = t.y;
1504
1509
  }
1505
1510
  }
1506
- class hn extends te {
1511
+ class pn extends te {
1507
1512
  constructor() {
1508
1513
  super(...arguments), this.__symbol = "SpineItemPageLayout";
1509
1514
  }
@@ -1513,7 +1518,7 @@ class Ht extends te {
1513
1518
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1514
1519
  }
1515
1520
  }
1516
- class mn extends te {
1521
+ class hn extends te {
1517
1522
  constructor() {
1518
1523
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1519
1524
  }
@@ -1536,17 +1541,17 @@ class Rt extends ke {
1536
1541
  return new Rt(t);
1537
1542
  }
1538
1543
  }
1539
- const fn = (e, t) => {
1540
- const i = t.getBoundingClientRect(), { x: n, y: o } = e, { left: s, top: r } = i, a = i.width / t.offsetWidth, c = i.height / t.offsetHeight, u = n - s, d = o - r;
1544
+ const mn = (e, t) => {
1545
+ const i = t.getBoundingClientRect(), { x: n, y: o } = e, { left: s, top: a } = i, r = i.width / t.offsetWidth, c = i.height / t.offsetHeight, u = n - s, d = o - a;
1541
1546
  return {
1542
- x: u / a,
1547
+ x: u / r,
1543
1548
  y: d / c
1544
1549
  };
1545
- }, yn = (e, t) => new Rt(
1546
- fn(e, t)
1547
- ), Sn = (e) => ({
1548
- getSpinePositionFromClientPosition: (t) => e.spine.element ? yn(t, e.spine.element) : void 0
1549
- }), bn = (e) => {
1550
+ }, fn = (e, t) => new Rt(
1551
+ mn(e, t)
1552
+ ), yn = (e) => ({
1553
+ getSpinePositionFromClientPosition: (t) => e.spine.element ? fn(t, e.spine.element) : void 0
1554
+ }), Sn = (e) => {
1550
1555
  let t;
1551
1556
  const i = e.context.state$.pipe(
1552
1557
  _(({ rootElement: c }) => c ? new ot(() => (t = c.ownerDocument.createElement("div"), t.style.cssText = `
@@ -1575,7 +1580,7 @@ const fn = (e, t) => {
1575
1580
  })
1576
1581
  ), s = n(e.viewportFree$).pipe(
1577
1582
  pi(1)
1578
- ), a = e.settings.values$.pipe(
1583
+ ), r = e.settings.values$.pipe(
1579
1584
  Y(() => e.settings.values.computedPageTurnMode),
1580
1585
  Z()
1581
1586
  ).pipe(
@@ -1584,17 +1589,17 @@ const fn = (e, t) => {
1584
1589
  ),
1585
1590
  G(e.$.destroy$)
1586
1591
  );
1587
- return v(i, a);
1588
- }, In = (e) => {
1592
+ return v(i, r);
1593
+ }, bn = (e) => {
1589
1594
  e.hookManager.register(
1590
1595
  "item.onAfterLayout",
1591
1596
  ({ item: t, blankPagePosition: i, minimumWidth: n }) => {
1592
1597
  const o = e.spineItemsManager.get(t.id), s = o == null ? void 0 : o.renderer.getDocumentFrame();
1593
1598
  if ((o == null ? void 0 : o.renditionLayout) !== "reflowable" || !(s instanceof HTMLIFrameElement))
1594
1599
  return;
1595
- const { hasViewport: r } = Zt(s), { width: a } = e.context.getPageSize(), c = o == null ? void 0 : o.renderer.getDocumentFrame();
1596
- if (r) {
1597
- const u = a < n;
1600
+ const { hasViewport: a } = Zt(s), { width: r } = e.context.getPageSize(), c = o == null ? void 0 : o.renderer.getDocumentFrame();
1601
+ if (a) {
1602
+ const u = r < n;
1598
1603
  i === "none" && u && c instanceof HTMLIFrameElement && (c == null || c.style.setProperty(
1599
1604
  "left",
1600
1605
  e.context.isRTL() ? "75%" : "25%"
@@ -1602,35 +1607,35 @@ const fn = (e, t) => {
1602
1607
  }
1603
1608
  }
1604
1609
  );
1605
- }, wn = (e, t) => t.pipe(
1610
+ }, In = (e, t) => t.pipe(
1606
1611
  $((i) => {
1607
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();
1608
1613
  })
1609
- ), Pn = (e) => (t) => {
1614
+ ), wn = (e) => (t) => {
1610
1615
  const {
1611
1616
  pageHorizontalMargin: i,
1612
1617
  pageVerticalMargin: n,
1613
1618
  layoutAutoResize: o,
1614
1619
  layoutLayerTransition: s,
1615
- viewportMode: r
1616
- } = t, a = e(t), c = new pn(
1620
+ viewportMode: a
1621
+ } = t, r = e(t), c = new ln(
1617
1622
  {
1618
1623
  pageHorizontalMargin: i,
1619
1624
  pageVerticalMargin: n,
1620
1625
  layoutAutoResize: o,
1621
1626
  layoutLayerTransition: s,
1622
- viewportMode: r
1627
+ viewportMode: a
1623
1628
  },
1624
- a.settings
1629
+ r.settings
1625
1630
  );
1626
- a.hookManager.register("onViewportOffsetAdjust", () => {
1631
+ r.hookManager.register("onViewportOffsetAdjust", () => {
1627
1632
  let m = !1;
1628
- a.spineItemsManager.items.forEach((y) => {
1633
+ r.spineItemsManager.items.forEach((y) => {
1629
1634
  const f = y.renderer.getDocumentFrame();
1630
1635
  !m && f && (f.getBoundingClientRect().left, m = !0);
1631
1636
  });
1632
- }), a.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
1633
- const y = a.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 = a.context.getPageSize();
1637
+ }), 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();
1634
1639
  if ((y == null ? void 0 : y.renditionLayout) === "reflowable" && !b) {
1635
1640
  let C = F.width - I * 2;
1636
1641
  const D = F.height - x * 2;
@@ -1661,16 +1666,16 @@ const fn = (e, t) => {
1661
1666
  `
1662
1667
  );
1663
1668
  }
1664
- }), In(a), a.hookManager.register(
1669
+ }), bn(r), r.hookManager.register(
1665
1670
  "item.onDocumentCreated",
1666
1671
  ({ documentContainer: m }) => {
1667
1672
  m.style.opacity = "0", c.values.layoutLayerTransition && (m.style.transition = "opacity 300ms");
1668
1673
  }
1669
- ), a.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
1670
- const y = a.spineItemsManager.get(m.id), f = y == null ? void 0 : y.renderer.documentContainer;
1671
- a.settings.values.computedPageTurnMode !== "scrollable" && (f == null || f.setAttribute("tab-index", "0"));
1674
+ ), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
1675
+ const y = r.spineItemsManager.get(m.id), f = y == null ? void 0 : y.renderer.documentContainer;
1676
+ r.settings.values.computedPageTurnMode !== "scrollable" && (f == null || f.setAttribute("tab-index", "0"));
1672
1677
  });
1673
- const u = a.spineItemsObserver.itemIsReady$.pipe(
1678
+ const u = r.spineItemsObserver.itemIsReady$.pipe(
1674
1679
  K(({ isReady: m }) => m),
1675
1680
  k(({ item: m }) => {
1676
1681
  const y = m.renderer.documentContainer;
@@ -1678,31 +1683,31 @@ const fn = (e, t) => {
1678
1683
  })
1679
1684
  ), d = c.values$.pipe(
1680
1685
  K(({ layoutAutoResize: m }) => m === "container"),
1681
- _(() => a.context.watch("rootElement")),
1686
+ _(() => r.context.watch("rootElement")),
1682
1687
  K(at),
1683
1688
  _((m) => Kt(m)),
1684
1689
  hi(100),
1685
1690
  K(at),
1686
1691
  k(() => {
1687
- a == null || a.layout();
1692
+ r == null || r.layout();
1688
1693
  })
1689
- ), g = bn(a);
1694
+ ), g = Sn(r);
1690
1695
  c.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1691
1696
  mi(1),
1692
1697
  k(() => {
1693
- a.layout();
1698
+ r.layout();
1694
1699
  }),
1695
- G(a.$.destroy$)
1700
+ G(r.$.destroy$)
1696
1701
  ).subscribe();
1697
- const l = a.spineItemsObserver.itemIsReady$.pipe(
1702
+ const l = r.spineItemsObserver.itemIsReady$.pipe(
1698
1703
  k(({ item: m, isReady: y }) => {
1699
1704
  const f = "prose-spineItem-ready";
1700
1705
  y ? m.containerElement.classList.add(f) : m.containerElement.classList.remove(f);
1701
1706
  })
1702
- ), h = wn(
1703
- a,
1707
+ ), h = In(
1708
+ r,
1704
1709
  c.watch("viewportMode")
1705
- ), p = a.spine.pages.pipe(
1710
+ ), p = r.spine.pages.pipe(
1706
1711
  bt({ refCount: !0, bufferSize: 1 })
1707
1712
  );
1708
1713
  return v(
@@ -1712,17 +1717,17 @@ const fn = (e, t) => {
1712
1717
  d,
1713
1718
  h,
1714
1719
  p
1715
- ).pipe(G(a.$.destroy$)).subscribe(), {
1716
- ...a,
1720
+ ).pipe(G(r.$.destroy$)).subscribe(), {
1721
+ ...r,
1717
1722
  destroy: () => {
1718
- c.destroy(), a.destroy();
1723
+ c.destroy(), r.destroy();
1719
1724
  },
1720
1725
  settings: c,
1721
- layout$: a.spine.layout$,
1726
+ layout$: r.spine.layout$,
1722
1727
  layoutInfo$: p,
1723
- coordinates: Sn(a)
1728
+ coordinates: yn(r)
1724
1729
  };
1725
- }, vn = `${lt}-enhancer-loading`, We = `${vn}-container`, xn = (e, t) => {
1730
+ }, Pn = `${pt}-enhancer-loading`, We = `${Pn}-container`, vn = (e, t) => {
1726
1731
  const i = e.ownerDocument.createElement("div");
1727
1732
  return i.classList.add(We), i.style.cssText = `
1728
1733
  height: 100%;
@@ -1740,7 +1745,7 @@ const fn = (e, t) => {
1740
1745
  background-color: white;
1741
1746
  z-index: 1;
1742
1747
  `, i;
1743
- }, $n = ({
1748
+ }, xn = ({
1744
1749
  container: e,
1745
1750
  item: t
1746
1751
  }) => {
@@ -1757,8 +1762,8 @@ const fn = (e, t) => {
1757
1762
  max-width: 300px;
1758
1763
  width: 80%;
1759
1764
  `, e.appendChild(i), e.appendChild(n), e;
1760
- }, Tn = (e) => (t) => {
1761
- const { loadingElementCreate: i = $n } = t, n = e(t), o = (c) => w(
1765
+ }, $n = (e) => (t) => {
1766
+ const { loadingElementCreate: i = xn } = t, n = e(t), o = (c) => w(
1762
1767
  c.reduce((u, { item: d, element: g }) => {
1763
1768
  g.style.zIndex = "0";
1764
1769
  const l = g.querySelector(
@@ -1767,7 +1772,7 @@ const fn = (e, t) => {
1767
1772
  if (l instanceof HTMLElement)
1768
1773
  return u[d.id] = l, u;
1769
1774
  const h = i({
1770
- container: xn(g, n.context),
1775
+ container: vn(g, n.context),
1771
1776
  item: d
1772
1777
  });
1773
1778
  return g.appendChild(h), u[d.id] = h, u;
@@ -1786,7 +1791,7 @@ const fn = (e, t) => {
1786
1791
  );
1787
1792
  });
1788
1793
  })
1789
- ), r = (c) => n.spineItemsObserver.itemIsReady$.pipe(
1794
+ ), a = (c) => n.spineItemsObserver.itemIsReady$.pipe(
1790
1795
  k(({ item: u, isReady: d }) => {
1791
1796
  var g, l;
1792
1797
  (g = c[u.item.id]) == null || g.style.setProperty(
@@ -1797,16 +1802,16 @@ const fn = (e, t) => {
1797
1802
  d ? "0" : "1"
1798
1803
  );
1799
1804
  })
1800
- ), a = n.spineItemsManager.items$.pipe(
1805
+ ), r = n.spineItemsManager.items$.pipe(
1801
1806
  _((c) => o(c)),
1802
1807
  bt(1),
1803
1808
  G(n.context.destroy$)
1804
1809
  );
1805
- return a.pipe(
1810
+ return r.pipe(
1806
1811
  _(
1807
1812
  (c) => v(
1808
1813
  s(c),
1809
- r(c)
1814
+ a(c)
1810
1815
  )
1811
1816
  ),
1812
1817
  G(n.$.destroy$)
@@ -1814,12 +1819,12 @@ const fn = (e, t) => {
1814
1819
  ...n,
1815
1820
  loading: {
1816
1821
  $: {
1817
- items$: a
1822
+ items$: r
1818
1823
  }
1819
1824
  }
1820
1825
  };
1821
1826
  };
1822
- class Fn extends mt {
1827
+ class Tn extends ft {
1823
1828
  getImageElement() {
1824
1829
  const t = this.documentContainer;
1825
1830
  if (t instanceof HTMLImageElement)
@@ -1857,11 +1862,11 @@ class Fn extends mt {
1857
1862
  }) {
1858
1863
  const i = this.getImageElement(), { height: n, width: o } = this.context.getPageSize();
1859
1864
  let s = n;
1860
- const r = o;
1865
+ const a = o;
1861
1866
  if (!i) return w(void 0);
1862
- const a = i.naturalWidth || 1, c = i.naturalHeight || 1, u = a / c;
1863
- return this.settings.values.computedPageTurnDirection === "vertical" && this.settings.values.computedPageTurnMode === "scrollable" && !this.context.state.isUsingSpreadMode && (s = Math.ceil(o / u)), i.style.height = `${s}px`, i.style.width = `${r}px`, i.style.objectPosition = t === "left" ? "right" : t === "right" ? "left" : "center", w({
1864
- width: r,
1867
+ const r = i.naturalWidth || 1, c = i.naturalHeight || 1, u = r / c;
1868
+ return this.settings.values.computedPageTurnDirection === "vertical" && this.settings.values.computedPageTurnMode === "scrollable" && !this.context.state.isUsingSpreadMode && (s = Math.ceil(o / u)), i.style.height = `${s}px`, i.style.width = `${a}px`, i.style.objectPosition = t === "left" ? "right" : t === "right" ? "left" : "center", w({
1869
+ width: a,
1865
1870
  height: s
1866
1871
  });
1867
1872
  }
@@ -1871,22 +1876,22 @@ class Fn extends mt {
1871
1876
  getDocumentFrame() {
1872
1877
  }
1873
1878
  }
1874
- const Ln = (e) => (t) => {
1879
+ const Fn = (e) => (t) => {
1875
1880
  const i = e({
1876
1881
  ...t,
1877
- getRenderer(r) {
1882
+ getRenderer(a) {
1878
1883
  var d;
1879
- const a = (d = t.getRenderer) == null ? void 0 : d.call(t, r), c = r.mediaType ?? Mt(r.href), u = !!(c != null && c.startsWith("image/"));
1880
- return !a && u ? (g) => new Fn(g) : a;
1884
+ 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;
1881
1886
  }
1882
1887
  }), n = new IntersectionObserver(
1883
- (r) => {
1884
- r.forEach((a) => {
1888
+ (a) => {
1889
+ a.forEach((r) => {
1885
1890
  var d;
1886
- const c = a.target, u = Array.from(
1891
+ const c = r.target, u = Array.from(
1887
1892
  ((d = c.contentDocument) == null ? void 0 : d.body.getElementsByTagName("audio")) || []
1888
1893
  );
1889
- a.isIntersecting ? u.forEach((g) => {
1894
+ r.isIntersecting ? u.forEach((g) => {
1890
1895
  g.hasAttribute("autoplay") && g.paused && g.readyState >= 2 && g.play().catch(console.error);
1891
1896
  }) : u.forEach((g) => {
1892
1897
  g.pause(), g.currentTime = 0;
@@ -1897,11 +1902,11 @@ const Ln = (e) => (t) => {
1897
1902
  threshold: 0.01
1898
1903
  }
1899
1904
  ), o = new IntersectionObserver(
1900
- (r) => {
1901
- r.forEach((a) => {
1902
- if (a.target.tagName === "video") {
1903
- const c = a.target;
1904
- a.isIntersecting ? c.hasAttribute("autoplay") && c.paused && c.readyState >= 2 && c.play().catch(console.error) : (c.pause(), c.currentTime = 0);
1905
+ (a) => {
1906
+ a.forEach((r) => {
1907
+ if (r.target.tagName === "video") {
1908
+ const c = r.target;
1909
+ r.isIntersecting ? c.hasAttribute("autoplay") && c.paused && c.readyState >= 2 && c.play().catch(console.error) : (c.pause(), c.currentTime = 0);
1905
1910
  }
1906
1911
  });
1907
1912
  },
@@ -1911,13 +1916,13 @@ const Ln = (e) => (t) => {
1911
1916
  );
1912
1917
  return i.hookManager.register(
1913
1918
  "item.onDocumentLoad",
1914
- ({ destroy: r, itemId: a }) => {
1919
+ ({ destroy: a, itemId: r }) => {
1915
1920
  var g, l;
1916
- const c = (g = i.spineItemsManager.get(a)) == null ? void 0 : g.renderer.getDocumentFrame();
1921
+ const c = (g = i.spineItemsManager.get(r)) == null ? void 0 : g.renderer.getDocumentFrame();
1917
1922
  if (!c) return;
1918
1923
  n.observe(c);
1919
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)));
1920
- r(() => {
1925
+ a(() => {
1921
1926
  n.unobserve(c), d.forEach((h) => h());
1922
1927
  });
1923
1928
  }
@@ -1927,16 +1932,16 @@ const Ln = (e) => (t) => {
1927
1932
  n.disconnect(), o.disconnect(), i.destroy();
1928
1933
  }
1929
1934
  };
1930
- }, Mn = (e, t) => e.links$.pipe(
1935
+ }, Ln = (e, t) => e.links$.pipe(
1931
1936
  $((i) => {
1932
- var r;
1933
- if (!Vi(i.target, "a") || i.type !== "click") return;
1937
+ var a;
1938
+ if (!Oi(i.target, "a") || i.type !== "click") return;
1934
1939
  const n = new URL(i.target.href), o = `${n.origin}${n.pathname}`;
1935
- ((r = e.context.manifest) == null ? void 0 : r.spineItems.some(
1936
- (a) => a.href === o
1940
+ ((a = e.context.manifest) == null ? void 0 : a.spineItems.some(
1941
+ (r) => r.href === o
1937
1942
  )) && t.goToUrl(n);
1938
1943
  })
1939
- ), st = O.namespace("navigation"), Cn = ({
1944
+ ), st = O.namespace("navigation"), Mn = ({
1940
1945
  position: e,
1941
1946
  spineItem: t,
1942
1947
  pageHeight: i,
@@ -1962,15 +1967,15 @@ const Ln = (e) => (t) => {
1962
1967
  spineLocator: o,
1963
1968
  context: s
1964
1969
  }) => {
1965
- const r = i, a = o.getSpineItemFromPosition(e) || n.get(0), c = e;
1966
- if (!a)
1970
+ const a = i, r = o.getSpineItemFromPosition(e) || n.get(0), c = e;
1971
+ if (!r)
1967
1972
  return c;
1968
1973
  const u = o.getSpineItemPositionFromSpinePosition(
1969
1974
  e,
1970
- a
1971
- ), d = Cn({
1975
+ r
1976
+ ), d = Mn({
1972
1977
  position: u,
1973
- spineItem: a,
1978
+ spineItem: r,
1974
1979
  pageHeight: s.getPageSize().height,
1975
1980
  pageWidth: s.getPageSize().width,
1976
1981
  spineItemLocator: o.spineItemLocator
@@ -1980,9 +1985,9 @@ const Ln = (e) => (t) => {
1980
1985
  u
1981
1986
  ) ? o.getSpinePositionFromSpineItemPosition({
1982
1987
  spineItemPosition: d,
1983
- spineItem: a
1988
+ spineItem: r
1984
1989
  }) : t.getAdjustedPositionWithSafeEdge(
1985
- r === "horizontal" ? new L({
1990
+ a === "horizontal" ? new L({
1986
1991
  x: e.x - s.getPageSize().width,
1987
1992
  y: 0
1988
1993
  }) : new L({
@@ -1990,49 +1995,49 @@ const Ln = (e) => (t) => {
1990
1995
  x: 0
1991
1996
  })
1992
1997
  );
1993
- }, Rn = ({
1998
+ }, Cn = ({
1994
1999
  position: e,
1995
2000
  spineItem: t,
1996
2001
  context: i,
1997
2002
  navigationResolver: n,
1998
2003
  spineItemsManager: o,
1999
2004
  spineLocator: s,
2000
- computedPageTurnDirection: r
2005
+ computedPageTurnDirection: a
2001
2006
  }) => {
2002
- const a = de({
2007
+ const r = de({
2003
2008
  position: e,
2004
2009
  context: i,
2005
2010
  navigationResolver: n,
2006
- computedPageTurnDirection: r,
2011
+ computedPageTurnDirection: a,
2007
2012
  spineItemsManager: o,
2008
2013
  spineLocator: s
2009
2014
  });
2010
- if (t != null && t.isUsingVerticalWriting() && e.x === a.x)
2011
- return n.getAdjustedPositionForSpread(a);
2015
+ if (t != null && t.isUsingVerticalWriting() && e.x === r.x)
2016
+ return n.getAdjustedPositionForSpread(r);
2012
2017
  if (i.state.isUsingSpreadMode) {
2013
- if (t != null && t.isUsingVerticalWriting() && e.x !== a.x)
2018
+ if (t != null && t.isUsingVerticalWriting() && e.x !== r.x)
2014
2019
  return n.getAdjustedPositionForSpread(
2015
2020
  n.getAdjustedPositionWithSafeEdge(
2016
- i.isRTL() ? { ...a, x: a.x + i.getPageSize().width } : {
2017
- ...a,
2018
- x: a.x - i.getPageSize().width
2021
+ i.isRTL() ? { ...r, x: r.x + i.getPageSize().width } : {
2022
+ ...r,
2023
+ x: r.x - i.getPageSize().width
2019
2024
  }
2020
2025
  )
2021
2026
  );
2022
- if (r === "vertical" && e.y !== a.y)
2023
- return n.getAdjustedPositionForSpread(a);
2027
+ if (a === "vertical" && e.y !== r.y)
2028
+ return n.getAdjustedPositionForSpread(r);
2024
2029
  const c = de({
2025
- position: a,
2030
+ position: r,
2026
2031
  context: i,
2027
2032
  navigationResolver: n,
2028
- computedPageTurnDirection: r,
2033
+ computedPageTurnDirection: a,
2029
2034
  spineItemsManager: o,
2030
2035
  spineLocator: s
2031
2036
  });
2032
2037
  return n.getAdjustedPositionForSpread(c);
2033
2038
  }
2034
- return n.getAdjustedPositionForSpread(a);
2035
- }, An = ({
2039
+ return n.getAdjustedPositionForSpread(r);
2040
+ }, Rn = ({
2036
2041
  position: e,
2037
2042
  spineItem: t,
2038
2043
  pageHeight: i,
@@ -2058,15 +2063,15 @@ const Ln = (e) => (t) => {
2058
2063
  spineLocator: o,
2059
2064
  context: s
2060
2065
  }) => {
2061
- const r = i, a = o.getSpineItemFromPosition(e) || n.get(0), c = e;
2062
- if (!a)
2066
+ const a = i, r = o.getSpineItemFromPosition(e) || n.get(0), c = e;
2067
+ if (!r)
2063
2068
  return c;
2064
2069
  const u = o.getSpineItemPositionFromSpinePosition(
2065
2070
  e,
2066
- a
2067
- ), d = An({
2071
+ r
2072
+ ), d = Rn({
2068
2073
  position: u,
2069
- spineItem: a,
2074
+ spineItem: r,
2070
2075
  pageHeight: s.getPageSize().height,
2071
2076
  pageWidth: s.getPageSize().width,
2072
2077
  spineItemLocator: o.spineItemLocator
@@ -2076,9 +2081,9 @@ const Ln = (e) => (t) => {
2076
2081
  u
2077
2082
  ) ? o.getSpinePositionFromSpineItemPosition({
2078
2083
  spineItemPosition: d,
2079
- spineItem: a
2084
+ spineItem: r
2080
2085
  }) : t.getAdjustedPositionWithSafeEdge(
2081
- r === "horizontal" ? new L({
2086
+ a === "horizontal" ? new L({
2082
2087
  x: e.x + s.getPageSize().width,
2083
2088
  y: 0
2084
2089
  }) : new L({
@@ -2086,53 +2091,53 @@ const Ln = (e) => (t) => {
2086
2091
  x: 0
2087
2092
  })
2088
2093
  );
2089
- }, Dn = ({
2094
+ }, An = ({
2090
2095
  position: e,
2091
2096
  spineItem: t,
2092
2097
  context: i,
2093
2098
  navigationResolver: n,
2094
2099
  spineItemsManager: o,
2095
2100
  spineLocator: s,
2096
- computedPageTurnDirection: r
2101
+ computedPageTurnDirection: a
2097
2102
  }) => {
2098
- const a = ge({
2103
+ const r = ge({
2099
2104
  position: e,
2100
2105
  context: i,
2101
2106
  navigationResolver: n,
2102
- computedPageTurnDirection: r,
2107
+ computedPageTurnDirection: a,
2103
2108
  spineItemsManager: o,
2104
2109
  spineLocator: s
2105
2110
  });
2106
- if (t != null && t.isUsingVerticalWriting() && e.x === a.x)
2107
- return n.getAdjustedPositionForSpread(a);
2111
+ if (t != null && t.isUsingVerticalWriting() && e.x === r.x)
2112
+ return n.getAdjustedPositionForSpread(r);
2108
2113
  if (i.state.isUsingSpreadMode) {
2109
- if (t != null && t.isUsingVerticalWriting() && e.x !== a.x)
2114
+ if (t != null && t.isUsingVerticalWriting() && e.x !== r.x)
2110
2115
  return n.getAdjustedPositionForSpread(
2111
2116
  n.getAdjustedPositionWithSafeEdge(
2112
2117
  i.isRTL() ? {
2113
- ...a,
2114
- x: a.x - i.getPageSize().width
2118
+ ...r,
2119
+ x: r.x - i.getPageSize().width
2115
2120
  } : {
2116
- ...a,
2117
- x: a.x + i.getPageSize().width
2121
+ ...r,
2122
+ x: r.x + i.getPageSize().width
2118
2123
  }
2119
2124
  )
2120
2125
  );
2121
- if (r === "vertical" && e.y !== a.y)
2122
- return n.getAdjustedPositionForSpread(a);
2126
+ if (a === "vertical" && e.y !== r.y)
2127
+ return n.getAdjustedPositionForSpread(r);
2123
2128
  const c = ge({
2124
- position: a,
2129
+ position: r,
2125
2130
  context: i,
2126
2131
  navigationResolver: n,
2127
- computedPageTurnDirection: r,
2132
+ computedPageTurnDirection: a,
2128
2133
  spineItemsManager: o,
2129
2134
  spineLocator: s
2130
2135
  });
2131
2136
  return n.getAdjustedPositionForSpread(c);
2132
2137
  }
2133
- return n.getAdjustedPositionForSpread(a);
2138
+ return n.getAdjustedPositionForSpread(r);
2134
2139
  };
2135
- class Nn {
2140
+ class Dn {
2136
2141
  constructor(t) {
2137
2142
  this.reader = t, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new L({ x: 0, y: 0 }), this.unlock = void 0;
2138
2143
  }
@@ -2151,7 +2156,7 @@ class Nn {
2151
2156
  turnRightOrBottom() {
2152
2157
  const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
2153
2158
  if (!i) return;
2154
- const n = Dn({
2159
+ const n = An({
2155
2160
  context: this.reader.context,
2156
2161
  navigationResolver: this.reader.navigation.navigationResolver,
2157
2162
  position: t.position,
@@ -2167,7 +2172,7 @@ class Nn {
2167
2172
  turnLeftOrTop() {
2168
2173
  const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
2169
2174
  if (!i) return;
2170
- const n = Rn({
2175
+ const n = Cn({
2171
2176
  context: this.reader.context,
2172
2177
  navigationResolver: this.reader.navigation.navigationResolver,
2173
2178
  position: t.position,
@@ -2288,9 +2293,7 @@ class Nn {
2288
2293
  absolutePageIndex: t,
2289
2294
  ...i
2290
2295
  }) {
2291
- const n = this.reader.spine.locator.getSpineInfoFromAbsolutePageIndex({
2292
- absolutePageIndex: t
2293
- });
2296
+ const n = this.reader.spine.pages.fromAbsolutePageIndex(t);
2294
2297
  if (st.debug(".goToAbsolutePageIndex()", {
2295
2298
  absolutePageIndex: t,
2296
2299
  ...i,
@@ -2309,12 +2312,12 @@ class Nn {
2309
2312
  }
2310
2313
  }
2311
2314
  }
2312
- class On {
2315
+ class Nn {
2313
2316
  constructor(t) {
2314
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;
2315
2318
  }
2316
2319
  moveTo(t, { final: i, start: n } = {}) {
2317
- var r, a, c, u;
2320
+ var a, r, c, u;
2318
2321
  if (this.reader.settings.values.computedPageTurnMode === "scrollable") {
2319
2322
  st.warn(
2320
2323
  "pan control is not available on free page turn mode"
@@ -2322,10 +2325,10 @@ class On {
2322
2325
  return;
2323
2326
  }
2324
2327
  const o = this.reader.settings.values.computedPageTurnDirection;
2325
- n && ((r = this.unlock) == null || r.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);
2328
+ 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);
2326
2329
  let s = this.reader.navigation.getNavigation().position;
2327
2330
  if (t) {
2328
- const d = this.reader.viewport.absoluteViewport.width / this.reader.viewport.relativeViewport.width, g = Math.floor(t.x) - (((a = this.lastDelta) == null ? void 0 : a.x) || 0), l = Math.floor(t.y) - (((c = this.lastDelta) == null ? void 0 : c.y) || 0), h = Math.floor(
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(
2329
2332
  o === "horizontal" ? this.lastPosition.x - g / d : 0
2330
2333
  ), p = Math.floor(
2331
2334
  o === "horizontal" ? 0 : this.lastPosition.y - l / d
@@ -2349,7 +2352,7 @@ class On {
2349
2352
  });
2350
2353
  }
2351
2354
  }
2352
- const Vn = (e) => e.pagination.state$.pipe(
2355
+ const On = (e) => e.pagination.state$.pipe(
2353
2356
  A(e.context.manifest$, e.settings.values$),
2354
2357
  S(
2355
2358
  ([
@@ -2357,19 +2360,19 @@ const Vn = (e) => e.pagination.state$.pipe(
2357
2360
  { spineItems: i, readingDirection: n },
2358
2361
  { computedPageTurnDirection: o }
2359
2362
  ]) => {
2360
- const s = i.length ?? 0, r = t.beginSpineItemIndex === 0, a = 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;
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;
2361
2364
  return {
2362
2365
  canTurnLeft: o === "vertical" ? !1 : !d,
2363
2366
  canTurnRight: o === "vertical" ? !1 : !g,
2364
- canGoTopSpineItem: o === "vertical" && !r,
2365
- canGoBottomSpineItem: o === "vertical" && !a,
2366
- canGoLeftSpineItem: o !== "vertical" && (n === "ltr" && !r || n === "rtl" && !c),
2367
- canGoRightSpineItem: o !== "vertical" && (n === "ltr" && !a || n === "rtl" && !u)
2367
+ canGoTopSpineItem: o === "vertical" && !a,
2368
+ canGoBottomSpineItem: o === "vertical" && !r,
2369
+ canGoLeftSpineItem: o !== "vertical" && (n === "ltr" && !a || n === "rtl" && !c),
2370
+ canGoRightSpineItem: o !== "vertical" && (n === "ltr" && !r || n === "rtl" && !u)
2368
2371
  };
2369
2372
  }
2370
2373
  ),
2371
2374
  H(N)
2372
- ), jn = ({ reader: e, duration: t }) => (i) => {
2375
+ ), Vn = ({ reader: e, duration: t }) => (i) => {
2373
2376
  let n;
2374
2377
  const o = () => {
2375
2378
  n == null || n(), n = void 0;
@@ -2385,18 +2388,18 @@ const Vn = (e) => e.pagination.state$.pipe(
2385
2388
  $(o),
2386
2389
  dt(o)
2387
2390
  );
2388
- }, kn = (e) => (t) => {
2389
- const i = e(t), n = Vn(i), o = new Nn(i), s = new On(i), r = (c) => {
2391
+ }, jn = (e) => (t) => {
2392
+ const i = e(t), n = On(i), o = new Dn(i), s = new Nn(i), a = (c) => {
2390
2393
  const { cfi: u, ...d } = c;
2391
2394
  i.load(d), u && o.goToCfi(u, { animate: !1 });
2392
2395
  };
2393
- return Mn(i, o).pipe(T(i.$.destroy$)).subscribe(), {
2396
+ return Ln(i, o).pipe(T(i.$.destroy$)).subscribe(), {
2394
2397
  ...i,
2395
- load: r,
2398
+ load: a,
2396
2399
  navigation: {
2397
2400
  ...i.navigation,
2398
2401
  state$: n,
2399
- throttleLock: ({ duration: c, trigger: u }) => u.pipe(jn({ duration: c, reader: i })),
2402
+ throttleLock: ({ duration: c, trigger: u }) => u.pipe(Vn({ duration: c, reader: i })),
2400
2403
  moveTo: s.moveTo.bind(s),
2401
2404
  turnBottom: o.turnBottom.bind(o),
2402
2405
  turnTop: o.turnTop.bind(o),
@@ -2419,7 +2422,7 @@ const Vn = (e) => e.pagination.state$.pipe(
2419
2422
  goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
2420
2423
  }
2421
2424
  };
2422
- }, ft = (e) => Ut({
2425
+ }, lt = (e) => Ut({
2423
2426
  spineIndex: e.index,
2424
2427
  spineId: e.id
2425
2428
  }), Ue = ({
@@ -2428,7 +2431,7 @@ const Vn = (e) => e.pagination.state$.pipe(
2428
2431
  item: i
2429
2432
  }) => {
2430
2433
  const n = "ownerDocument" in e ? e.ownerDocument : e.startContainer.ownerDocument;
2431
- return !n || !(n != null && n.documentElement) || e === n ? ft(i) : ji(e) ? Ut({
2434
+ return !n || !(n != null && n.documentElement) || e === n ? lt(i) : Vi(e) ? Ut({
2432
2435
  start: {
2433
2436
  node: e.startContainer,
2434
2437
  offset: e.startOffset,
@@ -2452,28 +2455,29 @@ const Vn = (e) => e.pagination.state$.pipe(
2452
2455
  spineItem: t,
2453
2456
  spine: i
2454
2457
  }) => {
2455
- var r;
2458
+ var a;
2456
2459
  const n = i.pages.value.pages.find(
2457
- (a) => a.itemIndex === t.index && a.pageIndex === e
2460
+ (r) => r.itemIndex === t.index && r.pageIndex === e
2458
2461
  ), o = n == null ? void 0 : n.firstVisibleNode, s = t.renderer.getDocumentFrame();
2459
- return o && s instanceof HTMLIFrameElement && ((r = s.contentWindow) != null && r.document) ? Ue({
2462
+ return o && s instanceof HTMLIFrameElement && ((a = s.contentWindow) != null && a.document) ? Ue({
2460
2463
  nodeOrRange: o.node,
2461
2464
  offset: o.offset,
2462
2465
  item: t.item
2463
- }).trim() : ft(t.item);
2464
- }, Wn = (e, t) => Ue({
2466
+ }).trim() : lt(t.item);
2467
+ }, kn = (e, t) => Ue({
2465
2468
  nodeOrRange: e,
2466
2469
  item: t
2467
- }), Os = (e) => e.index.toString(), le = (e) => {
2470
+ }), Ns = (e) => e.index.toString(), le = (e) => {
2468
2471
  var t;
2469
2472
  return ((t = e[0]) == null ? void 0 : t.index) === 6 && e.length > 1;
2470
2473
  }, Et = (e) => {
2471
2474
  const t = Te(e);
2472
2475
  return Si(t);
2473
- }, Un = (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) => {
2474
- var a, c, u, d;
2475
- const t = Te(e), n = (Un(t) ?? [])[1], s = ((n == null ? void 0 : n.index) ?? 2) / 2 - 1, r = bi(t) ? (c = (a = t.end.at(-1)) == null ? void 0 : a.at(-1)) == null ? void 0 : c.offset : (d = (u = t.at(-1)) == null ? void 0 : u.at(-1)) == null ? void 0 : d.offset;
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;
2476
2479
  return {
2480
+ isCfiRange: a,
2477
2481
  cleanedCfi: e,
2478
2482
  itemIndex: s,
2479
2483
  offset: r ?? 0
@@ -2482,76 +2486,95 @@ const Vn = (e) => e.pagination.state$.pipe(
2482
2486
  cfi: e,
2483
2487
  spineItemsManager: t
2484
2488
  }) => {
2485
- var s, r;
2486
- if (!e) return;
2487
- const { itemIndex: i } = ee(e), n = t.get(i);
2488
- if (!n) return;
2489
- const o = n.renderer.getDocumentFrame();
2490
- if (o instanceof HTMLIFrameElement) {
2491
- const a = (s = o.contentWindow) == null ? void 0 : s.document;
2492
- if (a)
2489
+ var a, r;
2490
+ const { itemIndex: i, ...n } = ee(e), o = t.get(i);
2491
+ if (!o)
2492
+ return {
2493
+ ...n,
2494
+ itemIndex: i
2495
+ };
2496
+ const s = o.renderer.getDocumentFrame();
2497
+ if (s instanceof HTMLIFrameElement) {
2498
+ const c = (a = s.contentWindow) == null ? void 0 : a.document;
2499
+ if (c)
2493
2500
  try {
2494
- const c = Ii(e, a, {
2501
+ const u = Ii(e, c, {
2495
2502
  throwOnError: !0
2496
2503
  });
2497
2504
  return {
2498
- node: c.isRange ? (r = c.node) == null ? void 0 : r.startContainer : c.node,
2499
- isRange: c.isRange,
2500
- range: c.isRange ? c.node : void 0,
2501
- offset: Array.isArray(c.offset) ? c.offset.at(-1) : c.offset,
2502
- spineItem: n
2505
+ ...n,
2506
+ itemIndex: i,
2507
+ node: u.isRange ? (r = u.node) == null ? void 0 : r.startContainer : u.node,
2508
+ isCfiRange: u.isRange,
2509
+ range: u.isRange ? u.node : void 0,
2510
+ offset: Array.isArray(u.offset) ? u.offset.at(-1) : u.offset,
2511
+ spineItem: o
2503
2512
  };
2504
- } catch (c) {
2505
- return O.warn(`Error resolving cfi: ${e}.`), O.warn(c), {
2506
- spineItem: n
2513
+ } catch (u) {
2514
+ return O.warn(`Error resolving cfi: ${e}.`), O.warn(u), {
2515
+ ...n,
2516
+ spineItem: o,
2517
+ itemIndex: i
2507
2518
  };
2508
2519
  }
2509
2520
  }
2510
2521
  return {
2511
- spineItem: n
2522
+ ...n,
2523
+ itemIndex: i,
2524
+ spineItem: o
2512
2525
  };
2513
- }, zn = (e, t) => {
2514
- if ("cfi" in t)
2515
- return t;
2526
+ }, Un = (e, t) => {
2527
+ if ("cfi" in t) {
2528
+ const { itemIndex: s, ...a } = e.cfi.parseCfi(t.cfi);
2529
+ return {
2530
+ ...t,
2531
+ ...a,
2532
+ itemIndex: s
2533
+ };
2534
+ }
2516
2535
  const i = e.spineItemsManager.get(t);
2517
2536
  if (!i)
2518
2537
  throw new Error("Spine item not found");
2538
+ const n = lt(i.item);
2519
2539
  return {
2520
- cfi: ft(i.item)
2540
+ ...e.cfi.parseCfi(n),
2541
+ cfi: lt(i.item),
2542
+ itemIndex: i.index
2521
2543
  };
2522
- }, Hn = (e, t) => {
2544
+ }, zn = (e, t) => {
2523
2545
  let i = e == null ? void 0 : e.itemPageIndex;
2524
- const { itemIndex: n } = t.cfi.parseCfi(e.cfi), o = t.spineItemsManager.get(n);
2525
- return o ? De().pipe(
2526
- A(o.isReady$),
2527
- S(([, s]) => {
2546
+ const { itemIndex: n, ...o } = t.cfi.parseCfi(e.cfi), s = t.spineItemsManager.get(n);
2547
+ return s ? De().pipe(
2548
+ A(s.isReady$),
2549
+ S(([, a]) => {
2528
2550
  const {
2529
2551
  node: r,
2530
- offset: a,
2531
- range: c
2532
- } = (s ? t.cfi.resolveCfi({ cfi: e.cfi }) : {}) ?? {};
2533
- o.renditionLayout !== "pre-paginated" && r && (i = t.spine.locator.spineItemLocator.getSpineItemPageIndexFromNode(
2552
+ offset: c,
2553
+ range: u
2554
+ } = a ? t.cfi.resolveCfi({ cfi: e.cfi }) : {};
2555
+ s.renditionLayout !== "pre-paginated" && r && (i = t.spine.locator.spineItemLocator.getSpineItemPageIndexFromNode(
2534
2556
  r,
2535
- a ?? 0,
2536
- o
2557
+ c ?? 0,
2558
+ s
2537
2559
  ) ?? i);
2538
- let d = e == null ? void 0 : e.absolutePageIndex;
2539
- return i === void 0 && (i = 0), d = t.spine.locator._getAbsolutePageIndexFromPageIndex({
2560
+ let g = e == null ? void 0 : e.absolutePageIndex;
2561
+ return i === void 0 && (i = 0), g = t.spine.locator._getAbsolutePageIndexFromPageIndex({
2540
2562
  pageIndex: i,
2541
- spineItemOrId: o
2563
+ spineItemOrId: s
2542
2564
  }) ?? (e == null ? void 0 : e.absolutePageIndex), {
2543
2565
  ...e,
2544
- range: c,
2566
+ ...o,
2567
+ range: u,
2545
2568
  itemIndex: n,
2546
2569
  startNode: r ?? void 0,
2547
- startOffset: a,
2548
- absolutePageIndex: d,
2570
+ startOffset: c,
2571
+ absolutePageIndex: g,
2549
2572
  itemPageIndex: i
2550
2573
  };
2551
2574
  })
2552
- ) : w({ ...e, itemIndex: n });
2575
+ ) : w({ ...e, itemIndex: n, ...o });
2553
2576
  };
2554
- class Bn {
2577
+ class Hn {
2555
2578
  constructor(t) {
2556
2579
  this.reader = t, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (i) => {
2557
2580
  const n = this.locatorsByKey.get(i);
@@ -2559,44 +2582,43 @@ class Bn {
2559
2582
  }, this.locate = (i, n) => {
2560
2583
  const o = {
2561
2584
  resource: i,
2562
- meta: zn(this.reader, i)
2585
+ meta: Un(this.reader, i)
2563
2586
  };
2564
2587
  return ae(() => {
2565
- var h;
2566
- const s = (h = this.reader.cfi.parseCfi(
2567
- o.meta.cfi
2568
- )) == null ? void 0 : h.itemIndex, r = this.reader.spineItemsManager.get(s), a = (r == null ? void 0 : r.renditionLayout) === "reflowable", c = n.mode === "shallow" || !a || !r ? () => {
2569
- } : this.reader.spine.spineItemsLoader.forceOpen([r.index]), u = "cfi" in i ? i.cfi : void 0, d = u ? this.locatorsByKey.get(u) : void 0, g = (p) => p.pipe(
2588
+ const s = this.reader.spineItemsManager.get(
2589
+ o.meta.itemIndex ?? 0
2590
+ ), 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(
2570
2592
  dt(() => {
2571
- u && this.deregisterMemoizedStream(u), setTimeout(() => {
2572
- c();
2593
+ c && this.deregisterMemoizedStream(c), setTimeout(() => {
2594
+ r();
2573
2595
  }, 1e3);
2574
2596
  })
2575
2597
  );
2576
- if (u && d)
2577
- return d.observerCount++, g(
2578
- d.consolidate$.pipe(
2579
- S(({ resource: p, meta: m }) => ({
2580
- resource: p,
2581
- meta: m
2598
+ if (c && u)
2599
+ return u.observerCount++, d(
2600
+ u.consolidate$.pipe(
2601
+ S(({ resource: l, meta: h }) => ({
2602
+ resource: l,
2603
+ meta: h
2582
2604
  }))
2583
2605
  )
2584
2606
  );
2585
- const l = this.reader.spine.layout$.pipe(
2607
+ const g = this.reader.spine.layout$.pipe(
2586
2608
  St(10),
2587
2609
  it(o),
2588
- oi((p) => Hn(p.meta, this.reader).pipe(
2589
- S((m) => ({
2590
- ...p,
2591
- meta: m
2610
+ oi((l) => zn(l.meta, this.reader).pipe(
2611
+ S((h) => ({
2612
+ ...l,
2613
+ meta: h
2592
2614
  }))
2593
2615
  ), o),
2594
2616
  tt({ refCount: !0, bufferSize: 1 })
2595
2617
  );
2596
- return u && this.locatorsByKey.set(u, {
2618
+ return c && this.locatorsByKey.set(c, {
2597
2619
  observerCount: 1,
2598
- consolidate$: l
2599
- }), g(l);
2620
+ consolidate$: g
2621
+ }), d(g);
2600
2622
  });
2601
2623
  };
2602
2624
  }
@@ -2613,10 +2635,10 @@ const He = (e, t, i) => {
2613
2635
  (o) => o.href === e
2614
2636
  );
2615
2637
  return t.reduce((o, s) => {
2616
- const r = s.href.indexOf("#"), a = r > 0 ? s.href.substr(0, r) : s.href, c = a.substring(
2638
+ const a = s.href.indexOf("#"), r = a > 0 ? s.href.substr(0, a) : s.href, c = r.substring(
2617
2639
  0,
2618
- a.lastIndexOf("/")
2619
- ), u = e.substring(0, e.lastIndexOf("/")), d = e.endsWith(a), g = u !== "" && u.endsWith(c);
2640
+ r.lastIndexOf("/")
2641
+ ), u = e.substring(0, e.lastIndexOf("/")), d = e.endsWith(r), g = u !== "" && u.endsWith(c);
2620
2642
  if (d || g) {
2621
2643
  const h = i.spineItems.findIndex(
2622
2644
  (f) => f.href === s.href
@@ -2633,56 +2655,56 @@ const He = (e, t, i) => {
2633
2655
  }
2634
2656
  return o;
2635
2657
  }, void 0);
2636
- }, En = (e, t) => {
2658
+ }, Bn = (e, t) => {
2637
2659
  var n;
2638
2660
  const { href: i } = t;
2639
2661
  return He(i, ((n = e.nav) == null ? void 0 : n.toc) ?? [], e);
2640
- }, _n = (e) => {
2662
+ }, En = (e) => {
2641
2663
  const t = e.context.manifest, i = e.spineItemsManager.items;
2642
2664
  return t ? i.reduce(
2643
- (n, { item: o }) => (n[o.id] = En(t, o), n),
2665
+ (n, { item: o }) => (n[o.id] = Bn(t, o), n),
2644
2666
  {}
2645
2667
  ) : {};
2646
- }, Xn = (e) => e.spineItemsManager.items$.pipe(
2668
+ }, _n = (e) => e.spineItemsManager.items$.pipe(
2647
2669
  it([]),
2648
- S(() => _n(e))
2649
- ), Yn = (e, t, i) => e + t * i, qn = (e, t, i) => {
2650
- const n = e.context, { height: o, width: s } = i.layout.layoutInfo, { top: r, left: a } = e.spine.getSpineItemSpineLayoutInfo(i);
2670
+ S(() => En(e))
2671
+ ), Xn = (e, t, i) => e + t * i, Yn = (e, t, i) => {
2672
+ const n = e.context, { height: o, width: s } = i.layout.layoutInfo, { top: a, left: r } = e.spine.getSpineItemSpineLayoutInfo(i);
2651
2673
  return e.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2652
2674
  0,
2653
2675
  Math.min(
2654
2676
  1,
2655
- (t.y - r + n.state.visibleAreaRect.height) / o
2677
+ (t.y - a + n.state.visibleAreaRect.height) / o
2656
2678
  )
2657
2679
  ) : Math.max(
2658
2680
  0,
2659
2681
  Math.min(
2660
2682
  1,
2661
- (t.x - a + n.state.visibleAreaRect.width) / s
2683
+ (t.x - r + n.state.visibleAreaRect.width) / s
2662
2684
  )
2663
2685
  );
2664
- }, Zn = (e, t, i, n, o) => o.isReady$.pipe(
2686
+ }, qn = (e, t, i, n, o) => o.isReady$.pipe(
2665
2687
  z(),
2666
2688
  A(e.layoutInfo$),
2667
- S(([s, r]) => {
2689
+ S(([s, a]) => {
2668
2690
  var f, b, I, x, F, C, D;
2669
- const a = e.context, c = ((f = a.manifest) == null ? void 0 : f.renditionLayout) === "pre-paginated", u = ((b = a.manifest) == null ? void 0 : b.spineItems.length) || 0, d = ((I = a.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 = r.pages.filter((E) => E.itemIndex === g).length ?? 0, p = ((C = (F = a.manifest) == null ? void 0 : F.spineItems[t]) == null ? void 0 : C.progressionWeight) ?? // if no progressionWeight is defined we "assume" the document weight to be
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
2670
2692
  // relative to the total number of documents
2671
2693
  (g + 1) / l;
2672
2694
  let m = (i + 1) * (p / h);
2673
2695
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2674
2696
  let y = d + m;
2675
- return ((D = a.manifest) == null ? void 0 : D.renditionFlow) === "scrolled-continuous" && (s ? m = qn(
2697
+ return ((D = r.manifest) == null ? void 0 : D.renditionFlow) === "scrolled-continuous" && (s ? m = Yn(
2676
2698
  e,
2677
2699
  n,
2678
2700
  o
2679
- ) : m = 0, y = Yn(
2701
+ ) : m = 0, y = Xn(
2680
2702
  d,
2681
2703
  p,
2682
2704
  m
2683
2705
  )), t === u - 1 && i === h - 1 && y > 0.99 ? 1 : y;
2684
2706
  })
2685
- ), Gn = (e) => e.spine.layout$.pipe(
2707
+ ), Zn = (e) => e.spine.layout$.pipe(
2686
2708
  St(10, rt),
2687
2709
  A(e.pagination.state$),
2688
2710
  S(() => ({
@@ -2700,8 +2722,8 @@ const He = (e, t, i) => {
2700
2722
  numberOfPagesPerItems: [],
2701
2723
  numberOfTotalPages: 0
2702
2724
  })
2703
- ), Jn = (e, t, i, n) => {
2704
- const o = e.context, s = t.beginSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.beginSpineItemIndex) : void 0, r = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
2725
+ ), Gn = (e, t, i, n) => {
2726
+ 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;
2705
2727
  return w({
2706
2728
  ...t,
2707
2729
  beginChapterInfo: s ? i[s.item.id] : void 0,
@@ -2716,8 +2738,8 @@ const He = (e, t, i) => {
2716
2738
  // charOffset: number;
2717
2739
  // serializeString?: string;
2718
2740
  beginSpineItemReadingDirection: s == null ? void 0 : s.readingDirection,
2719
- endChapterInfo: r ? i[r.item.id] : void 0,
2720
- endSpineItemReadingDirection: r == null ? void 0 : r.readingDirection,
2741
+ endChapterInfo: a ? i[a.item.id] : void 0,
2742
+ endSpineItemReadingDirection: a == null ? void 0 : a.readingDirection,
2721
2743
  // spineItemReadingDirection: focusedSpineItem?.getReadingDirection(),
2722
2744
  /**
2723
2745
  * This percentage is based of the weight (kb) of every items and the number of pages.
@@ -2731,7 +2753,7 @@ const He = (e, t, i) => {
2731
2753
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2732
2754
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2733
2755
  });
2734
- }, Kn = (e) => B([
2756
+ }, Jn = (e) => B([
2735
2757
  e.pagination.state$,
2736
2758
  // Usually pagination change if layout changes (number of pages) however it is especially
2737
2759
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2740,7 +2762,7 @@ const He = (e, t, i) => {
2740
2762
  ]).pipe(
2741
2763
  P(([t]) => {
2742
2764
  const i = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
2743
- return i ? Zn(
2765
+ return i ? qn(
2744
2766
  e,
2745
2767
  t.endSpineItemIndex ?? 0,
2746
2768
  t.endPageIndexInSpineItem || 0,
@@ -2748,8 +2770,8 @@ const He = (e, t, i) => {
2748
2770
  i
2749
2771
  ) : w(0);
2750
2772
  })
2751
- ), Qn = (e) => {
2752
- const t = Xn(e), i = Gn(e), n = new U({
2773
+ ), Kn = (e) => {
2774
+ const t = _n(e), i = Zn(e), n = new U({
2753
2775
  ...e.pagination.state,
2754
2776
  beginChapterInfo: void 0,
2755
2777
  beginCfi: void 0,
@@ -2767,17 +2789,17 @@ const He = (e, t, i) => {
2767
2789
  }), o = B([
2768
2790
  e.pagination.state$,
2769
2791
  t,
2770
- Kn(e)
2792
+ Jn(e)
2771
2793
  ]).pipe(
2772
2794
  P(
2773
- ([r, a, c]) => Jn(
2795
+ ([a, r, c]) => Gn(
2774
2796
  e,
2775
- r,
2776
2797
  a,
2798
+ r,
2777
2799
  c
2778
2800
  ).pipe(
2779
2801
  S((u) => ({
2780
- ...r,
2802
+ ...a,
2781
2803
  ...u
2782
2804
  }))
2783
2805
  )
@@ -2788,27 +2810,27 @@ const He = (e, t, i) => {
2788
2810
  o,
2789
2811
  i
2790
2812
  ]).pipe(
2791
- S(([r, a]) => ({
2792
- ...r,
2813
+ S(([a, r]) => ({
2793
2814
  ...a,
2794
- beginAbsolutePageIndex: a.numberOfPagesPerItems.slice(0, r.beginSpineItemIndex).reduce(
2815
+ ...r,
2816
+ beginAbsolutePageIndex: r.numberOfPagesPerItems.slice(0, a.beginSpineItemIndex).reduce(
2795
2817
  (c, u) => c + u,
2796
- r.beginPageIndexInSpineItem ?? 0
2818
+ a.beginPageIndexInSpineItem ?? 0
2797
2819
  ),
2798
- endAbsolutePageIndex: a.numberOfPagesPerItems.slice(0, r.endSpineItemIndex).reduce(
2820
+ endAbsolutePageIndex: r.numberOfPagesPerItems.slice(0, a.endSpineItemIndex).reduce(
2799
2821
  (c, u) => c + u,
2800
- r.endPageIndexInSpineItem ?? 0
2822
+ a.endPageIndexInSpineItem ?? 0
2801
2823
  )
2802
2824
  })),
2803
- $((r) => {
2804
- n.next(r);
2825
+ $((a) => {
2826
+ n.next(a);
2805
2827
  }),
2806
2828
  tt(1)
2807
2829
  ), getPaginationInfo: () => n.value };
2808
- }, to = (e) => (t) => {
2809
- const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = Qn(i);
2830
+ }, Qn = (e) => (t) => {
2831
+ const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = Kn(i);
2810
2832
  n.pipe(T(i.$.destroy$)).subscribe();
2811
- const s = new Bn(i);
2833
+ const s = new Hn(i);
2812
2834
  return {
2813
2835
  ...i,
2814
2836
  locateResource: s.locateResource.bind(s),
@@ -2822,27 +2844,27 @@ const He = (e, t, i) => {
2822
2844
  }
2823
2845
  }
2824
2846
  };
2825
- }, eo = (e) => ({
2826
- put: (s, r) => new Promise((a, c) => {
2847
+ }, to = (e) => ({
2848
+ put: (s, a) => new Promise((r, c) => {
2827
2849
  const u = e.transaction(["store"], "readwrite");
2828
2850
  u.onerror = (l) => {
2829
2851
  c(l);
2830
2852
  }, u.oncomplete = () => {
2831
- a();
2853
+ r();
2832
2854
  };
2833
- const g = u.objectStore("store").put(r, s);
2855
+ const g = u.objectStore("store").put(a, s);
2834
2856
  g.onsuccess = () => {
2835
- a();
2857
+ r();
2836
2858
  }, g.onerror = (l) => {
2837
2859
  c(l);
2838
2860
  };
2839
2861
  }),
2840
- keys: () => new Promise((s, r) => {
2841
- const a = e.transaction(["store"], "readonly");
2842
- a.onerror = (g) => {
2843
- r(g);
2862
+ keys: () => new Promise((s, a) => {
2863
+ const r = e.transaction(["store"], "readonly");
2864
+ r.onerror = (g) => {
2865
+ a(g);
2844
2866
  };
2845
- const u = a.objectStore("store").openKeyCursor(), d = [];
2867
+ const u = r.objectStore("store").openKeyCursor(), d = [];
2846
2868
  u.onsuccess = () => {
2847
2869
  const g = u.result;
2848
2870
  if (!g) {
@@ -2851,28 +2873,28 @@ const He = (e, t, i) => {
2851
2873
  }
2852
2874
  d.push(g.key), g.continue();
2853
2875
  }, u.onerror = () => {
2854
- r(u.error);
2876
+ a(u.error);
2855
2877
  };
2856
2878
  }),
2857
- get: (s) => new Promise((r, a) => {
2879
+ get: (s) => new Promise((a, r) => {
2858
2880
  const c = e.transaction(["store"], "readwrite"), d = c.objectStore("store").get(s);
2859
2881
  d.onsuccess = () => {
2860
2882
  let g = d.result;
2861
- g === void 0 && (g = null), r(g);
2883
+ g === void 0 && (g = null), a(g);
2862
2884
  }, c.onerror = () => {
2863
- a(d.error);
2885
+ r(d.error);
2864
2886
  };
2865
2887
  }),
2866
- remove: (s) => new Promise((r, a) => {
2888
+ remove: (s) => new Promise((a, r) => {
2867
2889
  const c = e.transaction(["store"], "readwrite"), d = c.objectStore("store").delete(s);
2868
2890
  c.onerror = () => {
2869
- a(d.error);
2891
+ r(d.error);
2870
2892
  }, c.oncomplete = () => {
2871
- r();
2893
+ a();
2872
2894
  }, c.onabort = () => {
2873
2895
  var l;
2874
2896
  const g = d.error ? d.error : (l = d.transaction) == null ? void 0 : l.error;
2875
- a(g);
2897
+ r(g);
2876
2898
  };
2877
2899
  })
2878
2900
  }), Ot = async (e) => new Promise((t, i) => {
@@ -2880,11 +2902,11 @@ const He = (e, t, i) => {
2880
2902
  n.onerror = (o) => {
2881
2903
  i(o);
2882
2904
  }, n.onsuccess = () => {
2883
- t(eo(n.result));
2905
+ t(to(n.result));
2884
2906
  }, n.onupgradeneeded = () => {
2885
2907
  n.result.createObjectStore("store");
2886
2908
  };
2887
- }), io = (e) => {
2909
+ }), eo = (e) => {
2888
2910
  let t = Date.now().toString();
2889
2911
  const i = new W(), n = (c) => {
2890
2912
  var u, d;
@@ -2916,12 +2938,12 @@ const He = (e, t, i) => {
2916
2938
  }),
2917
2939
  G(e.destroy$)
2918
2940
  ).subscribe();
2919
- const r = e.manifest$.pipe(
2941
+ const a = e.manifest$.pipe(
2920
2942
  k(() => {
2921
2943
  t = Date.now().toString();
2922
2944
  })
2923
2945
  );
2924
- return v(r).pipe(
2946
+ return v(a).pipe(
2925
2947
  _(() => (O.debug("Cleanup up old cache..."), j(Ot("prose-reader")).pipe(
2926
2948
  _(
2927
2949
  (c) => j(c.keys()).pipe(
@@ -2943,8 +2965,8 @@ const He = (e, t, i) => {
2943
2965
  i.complete();
2944
2966
  }
2945
2967
  };
2946
- }, no = (e) => (t) => {
2947
- const i = e(t), n = io(i.context);
2968
+ }, io = (e) => (t) => {
2969
+ const i = e(t), n = eo(i.context);
2948
2970
  return {
2949
2971
  ...i,
2950
2972
  // $: {
@@ -2956,7 +2978,7 @@ const He = (e, t, i) => {
2956
2978
  }
2957
2979
  // load,
2958
2980
  };
2959
- }, oo = (e, t) => {
2981
+ }, no = (e, t) => {
2960
2982
  var o;
2961
2983
  const i = (o = e.node.ownerDocument) == null ? void 0 : o.createRange(), n = e.node.compareDocumentPosition(t.node);
2962
2984
  if (i) {
@@ -2966,8 +2988,8 @@ const He = (e, t, i) => {
2966
2988
  else if (n & Node.DOCUMENT_POSITION_FOLLOWING)
2967
2989
  i.setStart(e.node, e.offset || 0), i.setEnd(t.node, t.offset || 0);
2968
2990
  else {
2969
- const s = Math.min(e.offset || 0, t.offset || 0), r = Math.max(e.offset || 0, t.offset || 0);
2970
- i.setStart(e.node, s), i.setEnd(e.node, r);
2991
+ const s = Math.min(e.offset || 0, t.offset || 0), a = Math.max(e.offset || 0, t.offset || 0);
2992
+ i.setStart(e.node, s), i.setEnd(e.node, a);
2971
2993
  }
2972
2994
  } catch (s) {
2973
2995
  O.warn("Failed to create range from selection", s, {
@@ -2977,26 +2999,26 @@ const He = (e, t, i) => {
2977
2999
  }
2978
3000
  return i;
2979
3001
  }
2980
- }, so = ({
3002
+ }, oo = ({
2981
3003
  selection: e,
2982
3004
  spineItem: t
2983
3005
  }) => {
2984
3006
  const { anchorNode: i, anchorOffset: n, focusNode: o, focusOffset: s } = e;
2985
3007
  if (!(!i || !o))
2986
3008
  try {
2987
- return oo(
3009
+ return no(
2988
3010
  { node: i, offset: n },
2989
3011
  { node: o, offset: s }
2990
3012
  );
2991
- } catch (r) {
2992
- O.warn("Failed to create range from selection", r, {
3013
+ } catch (a) {
3014
+ O.warn("Failed to create range from selection", a, {
2993
3015
  selection: e,
2994
3016
  spineItem: t
2995
3017
  });
2996
3018
  return;
2997
3019
  }
2998
3020
  };
2999
- class ro extends X {
3021
+ class so extends X {
3000
3022
  constructor(t) {
3001
3023
  var n;
3002
3024
  super();
@@ -3009,14 +3031,14 @@ class ro extends X {
3009
3031
  subtree: !0
3010
3032
  }).pipe(
3011
3033
  M(
3012
- (r) => !!r.find((a) => a.type === "childList" && a.removedNodes.length)
3034
+ (a) => !!a.find((r) => r.type === "childList" && r.removedNodes.length)
3013
3035
  )
3014
3036
  ), s = t.parentElement ? ce(t.parentElement, {
3015
3037
  childList: !0
3016
3038
  }).pipe(
3017
3039
  M(
3018
- (r) => !!r.find(
3019
- (a) => Array.from(a.removedNodes).includes(t)
3040
+ (a) => !!a.find(
3041
+ (r) => Array.from(r.removedNodes).includes(t)
3020
3042
  )
3021
3043
  )
3022
3044
  ) : w(null);
@@ -3026,7 +3048,7 @@ class ro extends X {
3026
3048
  ).pipe(
3027
3049
  S(() => i.getSelection()),
3028
3050
  T(v(s, this.destroy$)),
3029
- ht(null)
3051
+ mt(null)
3030
3052
  ), this.selectionOver$ = q(i, "pointerdown").pipe(
3031
3053
  P(
3032
3054
  () => v(
@@ -3040,9 +3062,9 @@ class ro extends X {
3040
3062
  * be discarded. The timeout make sure to detect this edge case.
3041
3063
  */
3042
3064
  wt(0),
3043
- S((r) => {
3044
- const a = i.getSelection();
3045
- return a && !a.isCollapsed ? [r, a] : void 0;
3065
+ S((a) => {
3066
+ const r = i.getSelection();
3067
+ return r && !r.isCollapsed ? [a, r] : void 0;
3046
3068
  }),
3047
3069
  M(at)
3048
3070
  )
@@ -3052,12 +3074,12 @@ class ro extends X {
3052
3074
  }
3053
3075
  }
3054
3076
  }
3055
- const ao = (e) => e.loaded$.pipe(
3077
+ const ro = (e) => e.loaded$.pipe(
3056
3078
  P(() => {
3057
3079
  var o;
3058
3080
  const t = e.renderer.getDocumentFrame(), i = (t == null ? void 0 : t.contentDocument) || ((o = t == null ? void 0 : t.contentWindow) == null ? void 0 : o.document);
3059
3081
  if (!t || !i) return gt;
3060
- const n = new ro(t);
3082
+ const n = new so(t);
3061
3083
  return v(
3062
3084
  n.selectionChange$.pipe(
3063
3085
  S((s) => {
@@ -3069,29 +3091,29 @@ const ao = (e) => e.loaded$.pipe(
3069
3091
  })
3070
3092
  ),
3071
3093
  n.selectionOver$.pipe(
3072
- S(([s, r]) => ({
3094
+ S(([s, a]) => ({
3073
3095
  type: "over",
3074
3096
  event: s,
3075
- selection: r
3097
+ selection: a
3076
3098
  }))
3077
3099
  )
3078
3100
  ).pipe(
3079
3101
  T(e.unloaded$),
3080
- ht(void 0),
3102
+ mt(void 0),
3081
3103
  dt(() => {
3082
3104
  n.destroy();
3083
3105
  })
3084
3106
  );
3085
3107
  }),
3086
3108
  H()
3087
- ), co = (e) => (t) => {
3109
+ ), ao = (e) => (t) => {
3088
3110
  const i = e(t);
3089
3111
  let n;
3090
3112
  const o = i.spineItemsManager.items$.pipe(
3091
3113
  P((d) => {
3092
3114
  const g = d.map((l) => {
3093
3115
  const h = i.spineItemsManager.getSpineItemIndex(l) ?? 0;
3094
- return ao(l).pipe(
3116
+ return ro(l).pipe(
3095
3117
  S((p) => {
3096
3118
  if (p)
3097
3119
  return {
@@ -3109,12 +3131,12 @@ const ao = (e) => e.loaded$.pipe(
3109
3131
  n = d;
3110
3132
  }),
3111
3133
  tt({ refCount: !0, bufferSize: 1 })
3112
- ), s = o, r = o.pipe(
3134
+ ), s = o, a = o.pipe(
3113
3135
  S((d) => !!d),
3114
3136
  H(),
3115
3137
  M((d) => d),
3116
3138
  V()
3117
- ), a = r.pipe(
3139
+ ), r = a.pipe(
3118
3140
  P(() => s),
3119
3141
  H(),
3120
3142
  M((d) => !d),
@@ -3134,12 +3156,12 @@ const ao = (e) => e.loaded$.pipe(
3134
3156
  ...i,
3135
3157
  selection: {
3136
3158
  selection$: s,
3137
- selectionStart$: r,
3138
- selectionEnd$: a,
3159
+ selectionStart$: a,
3160
+ selectionEnd$: r,
3139
3161
  selectionOver$: c,
3140
3162
  lastSelectionOnPointerdown$: u,
3141
3163
  getSelection: () => n,
3142
- createOrderedRangeFromSelection: so
3164
+ createOrderedRangeFromSelection: oo
3143
3165
  }
3144
3166
  };
3145
3167
  }, pe = [
@@ -3157,64 +3179,64 @@ const ao = (e) => e.loaded$.pipe(
3157
3179
  backgroundColor: "#191717",
3158
3180
  foregroundColor: "#f1ebeb"
3159
3181
  }
3160
- ], uo = (e) => (t) => {
3182
+ ], co = (e) => (t) => {
3161
3183
  const i = e(t), n = new U(
3162
3184
  t.theme ?? "bright"
3163
3185
  ), o = () => {
3164
- const a = pe.find(
3186
+ const r = pe.find(
3165
3187
  (c) => c.name === n.value
3166
3188
  );
3167
3189
  return `
3168
3190
  body {
3169
- ${a !== void 0 ? `background-color: ${a.backgroundColor} !important;` : ""}
3191
+ ${r !== void 0 ? `background-color: ${r.backgroundColor} !important;` : ""}
3170
3192
  }
3171
- ${a != null && a.foregroundColor ? `
3193
+ ${r != null && r.foregroundColor ? `
3172
3194
  body * {
3173
3195
 
3174
- color: ${a.foregroundColor};
3196
+ color: ${r.foregroundColor};
3175
3197
  }
3176
3198
  ` : ""}
3177
3199
  `;
3178
3200
  }, s = ({
3179
- container: a
3201
+ container: r
3180
3202
  }) => {
3181
3203
  const c = pe.find(
3182
3204
  (u) => u.name === n.value
3183
3205
  );
3184
- return c && a.style.setProperty(
3206
+ return c && r.style.setProperty(
3185
3207
  "background-color",
3186
3208
  c.backgroundColor
3187
3209
  ), () => {
3188
3210
  };
3189
- }, r = () => {
3190
- i.spineItemsManager.items.forEach((a) => {
3191
- const c = a.renderer.getDocumentFrame();
3192
- c && nt(c, "prose-reader-theme", o()), s({ container: a.element });
3211
+ }, a = () => {
3212
+ i.spineItemsManager.items.forEach((r) => {
3213
+ const c = r.renderer.getDocumentFrame();
3214
+ c && nt(c, "prose-reader-theme", o()), s({ container: r.element });
3193
3215
  });
3194
3216
  };
3195
- return i.hookManager.register("item.onDocumentLoad", ({ itemId: a }) => {
3196
- const c = i.spineItemsManager.get(a);
3217
+ return i.hookManager.register("item.onDocumentLoad", ({ itemId: r }) => {
3218
+ const c = i.spineItemsManager.get(r);
3197
3219
  if ((c == null ? void 0 : c.renditionLayout) !== "pre-paginated") {
3198
3220
  const u = c == null ? void 0 : c.renderer.getDocumentFrame();
3199
3221
  u && nt(u, "prose-reader-theme", o());
3200
3222
  }
3201
3223
  }), i.spineItemsManager.items$.pipe(
3202
3224
  k(
3203
- (a) => a.map(
3225
+ (r) => r.map(
3204
3226
  ({ element: c }) => s({ container: c })
3205
3227
  )
3206
3228
  ),
3207
3229
  G(i.$.destroy$)
3208
3230
  ).subscribe(), n.pipe(
3209
3231
  k(() => {
3210
- r();
3232
+ a();
3211
3233
  }),
3212
3234
  G(i.$.destroy$)
3213
3235
  ).subscribe(), {
3214
3236
  ...i,
3215
3237
  theme: {
3216
- set: (a) => {
3217
- a !== n.value && n.next(a);
3238
+ set: (r) => {
3239
+ r !== n.value && n.next(r);
3218
3240
  },
3219
3241
  get: () => n.value,
3220
3242
  $: {
@@ -3222,7 +3244,7 @@ const ao = (e) => e.loaded$.pipe(
3222
3244
  }
3223
3245
  }
3224
3246
  };
3225
- }, go = (e) => (t) => ({
3247
+ }, uo = (e) => (t) => ({
3226
3248
  ...e(t),
3227
3249
  utils: {
3228
3250
  isOrIsWithinValidLink: (o) => {
@@ -3236,13 +3258,13 @@ const ao = (e) => e.loaded$.pipe(
3236
3258
  }
3237
3259
  });
3238
3260
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3239
- const lo = (e) => (t) => e(t);
3261
+ const go = (e) => (t) => e(t);
3240
3262
  class Be {
3241
3263
  constructor(t) {
3242
3264
  this.reader = t;
3243
3265
  }
3244
3266
  }
3245
- class po extends Be {
3267
+ class lo extends Be {
3246
3268
  constructor() {
3247
3269
  super(...arguments), this.isZooming$ = new U(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3248
3270
  }
@@ -3296,10 +3318,10 @@ const Tt = ({
3296
3318
  screenSize: i,
3297
3319
  scrollOffset: n
3298
3320
  }) => {
3299
- const o = i * e / 2 - i + i / 2, s = i * t / 2 - i + i / 2, r = e / t, a = n - s;
3300
- return Math.max(o + a * r, 0);
3321
+ const o = i * e / 2 - i + i / 2, s = i * t / 2 - i + i / 2, a = e / t, r = n - s;
3322
+ return Math.max(o + r * a, 0);
3301
3323
  };
3302
- class ho extends Be {
3324
+ class po extends Be {
3303
3325
  constructor() {
3304
3326
  super(...arguments), this.isZooming$ = new U(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3305
3327
  }
@@ -3316,24 +3338,24 @@ class ho extends Be {
3316
3338
  scaleAt(t) {
3317
3339
  const i = this.reader.spine.element, n = this.reader.navigation.scrollNavigationController.value.element;
3318
3340
  if (!i || !n) return;
3319
- const o = Math.ceil(t * 100) / 100, s = Math.max(o, 1), r = i.getBoundingClientRect().width / i.offsetWidth, a = n.scrollTop;
3341
+ const o = Math.ceil(t * 100) / 100, s = Math.max(o, 1), a = i.getBoundingClientRect().width / i.offsetWidth, r = n.scrollTop;
3320
3342
  i.style.transform = `scale(${s})`, n.scrollLeft = Tt({
3321
3343
  newScale: s,
3322
- oldScale: r,
3344
+ oldScale: a,
3323
3345
  pageSize: n.clientWidth,
3324
3346
  screenSize: i.offsetWidth,
3325
3347
  scrollOffset: n.scrollLeft
3326
3348
  }), n.scrollTop = Tt({
3327
3349
  newScale: s,
3328
- oldScale: r,
3350
+ oldScale: a,
3329
3351
  pageSize: n.clientHeight,
3330
3352
  screenSize: i.offsetHeight,
3331
- scrollOffset: a
3353
+ scrollOffset: r
3332
3354
  }), this.currentScale = o;
3333
3355
  }
3334
3356
  }
3335
- const mo = (e) => (t) => {
3336
- const i = e(t), n = new po(i), o = new ho(i), s = new U(o);
3357
+ const ho = (e) => (t) => {
3358
+ const i = e(t), n = new lo(i), o = new po(i), s = new U(o);
3337
3359
  return {
3338
3360
  ...i,
3339
3361
  destroy: () => {
@@ -3365,7 +3387,7 @@ const mo = (e) => (t) => {
3365
3387
  }
3366
3388
  };
3367
3389
  }, Ee = (e) => (e == null ? void 0 : e.renditionLayout) === "pre-paginated" || (e == null ? void 0 : e.spineItems.every((t) => t.renditionLayout === "pre-paginated"));
3368
- class pt extends ot {
3390
+ class ht extends ot {
3369
3391
  constructor(t) {
3370
3392
  super((i) => this.stateSubject.pipe(T(this.destroy$)).subscribe(i)), this.destroy$ = new W(), this.stateSubject = new U(t);
3371
3393
  }
@@ -3392,7 +3414,7 @@ class pt extends ot {
3392
3414
  this.stateSubject.complete(), this.destroy$.complete();
3393
3415
  }
3394
3416
  }
3395
- class fo {
3417
+ class mo {
3396
3418
  constructor() {
3397
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(
3398
3420
  H(),
@@ -3404,7 +3426,7 @@ class fo {
3404
3426
  ), this.navigation$ = this.navigationSubject.asObservable();
3405
3427
  }
3406
3428
  }
3407
- const yo = ({
3429
+ const fo = ({
3408
3430
  manifest: e,
3409
3431
  visibleAreaRect: t,
3410
3432
  forceSinglePageMode: i
@@ -3412,7 +3434,7 @@ const yo = ({
3412
3434
  const { height: n, width: o } = t, s = o > n;
3413
3435
  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");
3414
3436
  };
3415
- class So extends pt {
3437
+ class yo extends ht {
3416
3438
  constructor() {
3417
3439
  super({
3418
3440
  marginBottom: 0,
@@ -3425,7 +3447,7 @@ class So extends pt {
3425
3447
  x: 0,
3426
3448
  y: 0
3427
3449
  }
3428
- }), this.bridgeEvent = new fo(), this.destroy$ = new W(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
3450
+ }), this.bridgeEvent = new mo(), this.destroy$ = new W(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
3429
3451
  Y((t) => t.manifest),
3430
3452
  K(at),
3431
3453
  Z()
@@ -3445,18 +3467,18 @@ class So extends pt {
3445
3467
  * @todo optimize to not run if not necessary
3446
3468
  */
3447
3469
  update(t) {
3448
- const i = this.value, n = t.manifest ?? i.manifest, o = t.forceSinglePageMode ?? i.forceSinglePageMode, s = t.visibleAreaRect ?? i.visibleAreaRect, r = t.marginTop ?? i.marginTop, a = t.marginBottom ?? i.marginBottom, c = {
3470
+ const i = this.value, n = t.manifest ?? i.manifest, o = t.forceSinglePageMode ?? i.forceSinglePageMode, s = t.visibleAreaRect ?? i.visibleAreaRect, a = t.marginTop ?? i.marginTop, r = t.marginBottom ?? i.marginBottom, c = {
3449
3471
  ...i,
3450
3472
  ...t,
3451
3473
  ...t.visibleAreaRect && {
3452
3474
  ...t.visibleAreaRect,
3453
- height: t.visibleAreaRect.height - r - a
3475
+ height: t.visibleAreaRect.height - a - r
3454
3476
  },
3455
3477
  ...t.manifest && {
3456
3478
  isFullyPrePaginated: Ee(n),
3457
3479
  assumedRenditionLayout: (n == null ? void 0 : n.renditionLayout) ?? "reflowable"
3458
3480
  },
3459
- isUsingSpreadMode: yo({
3481
+ isUsingSpreadMode: fo({
3460
3482
  manifest: n,
3461
3483
  visibleAreaRect: s,
3462
3484
  forceSinglePageMode: o
@@ -3488,7 +3510,7 @@ class So extends pt {
3488
3510
  };
3489
3511
  }
3490
3512
  }
3491
- class bo extends pt {
3513
+ class So extends ht {
3492
3514
  constructor(t, i) {
3493
3515
  super({
3494
3516
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3512,19 +3534,19 @@ class bo extends pt {
3512
3534
  hasVerticalWriting: n,
3513
3535
  renditionFlow: o,
3514
3536
  renditionLayout: s,
3515
- computedPageTurnMode: r
3537
+ computedPageTurnMode: a
3516
3538
  }) => ({
3517
3539
  ...this.value,
3518
3540
  supportedPageTurnMode: o === "scrolled-continuous" ? ["scrollable"] : ["controlled", "scrollable"],
3519
- supportedPageTurnAnimation: o === "scrolled-continuous" || r === "scrollable" ? ["none"] : n ? ["fade", "none"] : ["fade", "none", "slide"],
3520
- supportedPageTurnDirection: r === "scrollable" ? ["vertical"] : s === "reflowable" ? ["horizontal"] : ["horizontal", "vertical"]
3541
+ supportedPageTurnAnimation: o === "scrolled-continuous" || a === "scrollable" ? ["none"] : n ? ["fade", "none"] : ["fade", "none", "slide"],
3542
+ supportedPageTurnDirection: a === "scrollable" ? ["vertical"] : s === "reflowable" ? ["horizontal"] : ["horizontal", "vertical"]
3521
3543
  })
3522
3544
  ),
3523
3545
  T(this.destroy$)
3524
3546
  ).subscribe(this.next.bind(this));
3525
3547
  }
3526
3548
  }
3527
- class Io {
3549
+ class bo {
3528
3550
  constructor() {
3529
3551
  this._hooks = [], this._hookExecutions = [];
3530
3552
  }
@@ -3552,12 +3574,12 @@ class Io {
3552
3574
  }
3553
3575
  execute(t, i, n) {
3554
3576
  return this._hooks.filter(
3555
- (r) => t === r.name
3556
- ).map((r) => {
3557
- let a = () => w(void 0);
3577
+ (a) => t === a.name
3578
+ ).map((a) => {
3579
+ let r = () => w(void 0);
3558
3580
  const c = new W(), u = (l) => {
3559
- a = l;
3560
- }, d = () => (c.next(), c.complete(), a() ?? w(void 0)), g = r.runFn({
3581
+ r = l;
3582
+ }, d = () => (c.next(), c.complete(), r() ?? w(void 0)), g = a.runFn({
3561
3583
  // biome-ignore lint/suspicious/noExplicitAny: TODO
3562
3584
  ...n,
3563
3585
  destroy$: c.asObservable(),
@@ -3567,22 +3589,22 @@ class Io {
3567
3589
  name: t,
3568
3590
  id: i,
3569
3591
  destroyFn: d,
3570
- ref: r
3592
+ ref: a
3571
3593
  }), g;
3572
3594
  });
3573
3595
  }
3574
3596
  destroy(t, i, n) {
3575
3597
  const o = this._hookExecutions.filter(
3576
- (r) => (
3598
+ (a) => (
3577
3599
  // by ref is higher priority
3578
- n && r.ref === n || // otherwise we refine by name and eventually by id
3579
- t === r.name && (!i || i && i === r.id)
3600
+ n && a.ref === n || // otherwise we refine by name and eventually by id
3601
+ t === a.name && (!i || i && i === a.id)
3580
3602
  )
3581
3603
  );
3582
3604
  this._hookExecutions = this._hookExecutions.filter(
3583
- (r) => !o.includes(r)
3605
+ (a) => !o.includes(a)
3584
3606
  );
3585
- const s = o.map(({ destroyFn: r }) => r());
3607
+ const s = o.map(({ destroyFn: a }) => a());
3586
3608
  return B(s);
3587
3609
  }
3588
3610
  }
@@ -3600,7 +3622,7 @@ class _e {
3600
3622
  };
3601
3623
  }
3602
3624
  }
3603
- const wo = () => (e) => e.pipe(
3625
+ const Io = () => (e) => e.pipe(
3604
3626
  S(({ navigation: t, pagination: i, ...n }) => ({
3605
3627
  navigation: {
3606
3628
  ...t,
@@ -3608,7 +3630,7 @@ const wo = () => (e) => e.pipe(
3608
3630
  },
3609
3631
  ...n
3610
3632
  }))
3611
- ), Po = (e, t, i) => e.bridgeEvent.pagination$.pipe(
3633
+ ), wo = (e, t, i) => e.bridgeEvent.pagination$.pipe(
3612
3634
  A(t),
3613
3635
  M(
3614
3636
  ([n, o]) => n.navigationId === o.id
@@ -3621,14 +3643,14 @@ const wo = () => (e) => e.pipe(
3621
3643
  P(([n, o]) => {
3622
3644
  const s = i.spineItemsManager.get(o.spineItem);
3623
3645
  return ((s == null ? void 0 : s.isReady$.pipe(z())) ?? w(!1)).pipe(
3624
- M((r) => r),
3646
+ M((a) => a),
3625
3647
  S(() => ({
3626
3648
  pagination: n,
3627
3649
  navigation: o
3628
3650
  }))
3629
3651
  );
3630
3652
  }),
3631
- wo(),
3653
+ Io(),
3632
3654
  H(
3633
3655
  (n, o) => n.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3634
3656
  ),
@@ -3640,7 +3662,7 @@ const wo = () => (e) => e.pipe(
3640
3662
  }
3641
3663
  })
3642
3664
  )
3643
- ), vo = (e) => e.pipe(
3665
+ ), Po = (e) => e.pipe(
3644
3666
  S(([t, i]) => {
3645
3667
  const n = {
3646
3668
  type: "api",
@@ -3656,7 +3678,7 @@ const wo = () => (e) => e.pipe(
3656
3678
  navigation: n
3657
3679
  };
3658
3680
  })
3659
- ), xo = ({ navigationResolver: e }) => (t) => t.pipe(
3681
+ ), vo = ({ navigationResolver: e }) => (t) => t.pipe(
3660
3682
  S((i) => {
3661
3683
  if (i.navigation.cfi) {
3662
3684
  const n = e.getNavigationForCfi(
@@ -3673,30 +3695,30 @@ const wo = () => (e) => e.pipe(
3673
3695
  }
3674
3696
  return i;
3675
3697
  })
3676
- ), $o = ({
3698
+ ), xo = ({
3677
3699
  navigation: e,
3678
3700
  previousNavigation: t,
3679
3701
  settings: i
3680
- }) => 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 = ({
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 = ({
3681
3703
  context: e,
3682
3704
  settings: t
3683
3705
  }) => (i) => i.pipe(
3684
3706
  S(({ navigation: n, previousNavigation: o }) => {
3685
- const s = $o({
3707
+ const s = xo({
3686
3708
  navigation: n,
3687
3709
  previousNavigation: o,
3688
3710
  settings: t
3689
- }), r = {
3711
+ }), a = {
3690
3712
  ...n,
3691
3713
  directionFromLastNavigation: s
3692
3714
  };
3693
3715
  return {
3694
3716
  previousNavigation: o,
3695
- navigation: r,
3717
+ navigation: a,
3696
3718
  direction: s
3697
3719
  };
3698
3720
  })
3699
- ), Fo = ({
3721
+ ), To = ({
3700
3722
  spineItemsManager: e,
3701
3723
  navigationResolver: t
3702
3724
  }) => (i) => i.pipe(
@@ -3730,13 +3752,13 @@ const wo = () => (e) => e.pipe(
3730
3752
  navigationResolver: i,
3731
3753
  spineLocator: n
3732
3754
  }) => (o) => {
3733
- const s = (r) => {
3755
+ const s = (a) => {
3734
3756
  const {
3735
- position: a,
3757
+ position: r,
3736
3758
  spineItem: c,
3737
3759
  cfi: u,
3738
3760
  directionFromLastNavigation: d
3739
- } = r, { navigationSnapThreshold: g, computedPageTurnMode: l } = e.values;
3761
+ } = a, { navigationSnapThreshold: g, computedPageTurnMode: l } = e.values;
3740
3762
  if (c !== void 0) {
3741
3763
  const h = t.get(c);
3742
3764
  if (h) return h;
@@ -3747,15 +3769,15 @@ const wo = () => (e) => e.pipe(
3747
3769
  const h = t.getSpineItemFromCfi(u);
3748
3770
  if (h) return h;
3749
3771
  }
3750
- if (a && l === "controlled") {
3772
+ if (r && l === "controlled") {
3751
3773
  const { beginIndex: h, endIndex: p } = n.getVisibleSpineItemsFromPosition({
3752
- position: a,
3774
+ position: r,
3753
3775
  threshold: g,
3754
3776
  restrictToScreen: !1
3755
3777
  }) ?? {}, m = (d === "forward" || d === "anchor" ? p : h) ?? h, y = t.get(m);
3756
3778
  if (!y) return;
3757
3779
  const { endPageIndex: f, beginPageIndex: b } = n.getVisiblePagesFromViewportPosition({
3758
- position: a,
3780
+ position: r,
3759
3781
  spineItem: y,
3760
3782
  threshold: g,
3761
3783
  restrictToScreen: !1
@@ -3769,17 +3791,17 @@ const wo = () => (e) => e.pipe(
3769
3791
  }), C = d === "forward" || d === "anchor" ? F == null ? void 0 : F.beginIndex : F == null ? void 0 : F.endIndex;
3770
3792
  return t.get(C);
3771
3793
  }
3772
- return a && l === "scrollable" ? n.getSpineItemFromPosition(a) : t.get(0);
3794
+ return r && l === "scrollable" ? n.getSpineItemFromPosition(r) : t.get(0);
3773
3795
  };
3774
3796
  return o.pipe(
3775
- S(({ navigation: r, ...a }) => {
3776
- const c = s(r);
3797
+ S(({ navigation: a, ...r }) => {
3798
+ const c = s(a);
3777
3799
  return {
3778
3800
  navigation: {
3779
- ...r,
3801
+ ...a,
3780
3802
  spineItem: t.getSpineItemIndex(c)
3781
3803
  },
3782
- ...a
3804
+ ...r
3783
3805
  };
3784
3806
  })
3785
3807
  );
@@ -3791,7 +3813,7 @@ const wo = () => (e) => e.pipe(
3791
3813
  return ((s == null ? void 0 : s.isReady$) ?? w(!1)).pipe(
3792
3814
  z(),
3793
3815
  S(
3794
- (r) => ({
3816
+ (a) => ({
3795
3817
  navigation: {
3796
3818
  ...i,
3797
3819
  spineItemHeight: o == null ? void 0 : o.height,
@@ -3799,7 +3821,7 @@ const wo = () => (e) => e.pipe(
3799
3821
  spineItemLeft: o.left,
3800
3822
  spineItemTop: o.top,
3801
3823
  spineItemIsUsingVerticalWriting: s == null ? void 0 : s.isUsingVerticalWriting(),
3802
- spineItemIsReady: r
3824
+ spineItemIsReady: a
3803
3825
  },
3804
3826
  ...n
3805
3827
  })
@@ -3812,16 +3834,16 @@ const wo = () => (e) => e.pipe(
3812
3834
  spineLocator: i,
3813
3835
  navigationResolver: n
3814
3836
  }) => (o) => {
3815
- const s = (r) => {
3816
- const { navigationSnapThreshold: a, computedPageTurnMode: c } = e.values, u = t.get(r.spineItem);
3817
- if (!(!u || !r.position)) {
3837
+ const s = (a) => {
3838
+ const { navigationSnapThreshold: r, computedPageTurnMode: c } = e.values, u = t.get(a.spineItem);
3839
+ if (!(!u || !a.position)) {
3818
3840
  if (c === "controlled") {
3819
3841
  const { endPageIndex: d, beginPageIndex: g } = i.getVisiblePagesFromViewportPosition({
3820
- position: r.position,
3842
+ position: a.position,
3821
3843
  spineItem: u,
3822
- threshold: a,
3844
+ threshold: r,
3823
3845
  restrictToScreen: !1
3824
- }) ?? {}, l = (r.directionFromLastNavigation === "forward" || r.directionFromLastNavigation === "anchor" ? d : g) ?? 0, h = n.getNavigationForSpineItemPage({
3846
+ }) ?? {}, l = (a.directionFromLastNavigation === "forward" || a.directionFromLastNavigation === "anchor" ? d : g) ?? 0, h = n.getNavigationForSpineItemPage({
3825
3847
  pageIndex: l,
3826
3848
  spineItemId: u
3827
3849
  }), p = i.getVisiblePagesFromViewportPosition({
@@ -3829,28 +3851,28 @@ const wo = () => (e) => e.pipe(
3829
3851
  spineItem: u,
3830
3852
  threshold: { type: "percentage", value: 0 },
3831
3853
  restrictToScreen: !0
3832
- }), m = (r.directionFromLastNavigation === "forward" || r.directionFromLastNavigation === "anchor" ? p == null ? void 0 : p.beginPageIndex : p == null ? void 0 : p.endPageIndex) ?? 0;
3854
+ }), m = (a.directionFromLastNavigation === "forward" || a.directionFromLastNavigation === "anchor" ? p == null ? void 0 : p.beginPageIndex : p == null ? void 0 : p.endPageIndex) ?? 0;
3833
3855
  return i.spineItemLocator.getSpineItemPositionFromPageIndex({
3834
3856
  pageIndex: m,
3835
3857
  spineItem: u
3836
3858
  });
3837
3859
  }
3838
3860
  return i.getSpineItemPositionFromSpinePosition(
3839
- r.position,
3861
+ a.position,
3840
3862
  u
3841
3863
  );
3842
3864
  }
3843
3865
  };
3844
3866
  return o.pipe(
3845
- S(({ navigation: r, ...a }) => ({
3867
+ S(({ navigation: a, ...r }) => ({
3846
3868
  navigation: {
3847
- ...r,
3848
- positionInSpineItem: s(r)
3869
+ ...a,
3870
+ positionInSpineItem: s(a)
3849
3871
  },
3850
- ...a
3872
+ ...r
3851
3873
  }))
3852
3874
  );
3853
- }, Lo = ({ navigationResolver: e }) => (t) => t.pipe(
3875
+ }, Fo = ({ navigationResolver: e }) => (t) => t.pipe(
3854
3876
  S((i) => {
3855
3877
  if (i.navigation.url) {
3856
3878
  const n = e.getNavigationForUrl(
@@ -3868,7 +3890,7 @@ const wo = () => (e) => e.pipe(
3868
3890
  }
3869
3891
  return i;
3870
3892
  })
3871
- ), Mo = ({
3893
+ ), Lo = ({
3872
3894
  spineLocator: e,
3873
3895
  navigation: t,
3874
3896
  navigationResolver: i,
@@ -3878,15 +3900,15 @@ const wo = () => (e) => e.pipe(
3878
3900
  const s = n.get(t.spineItem);
3879
3901
  return s ? s.isReady$.pipe(
3880
3902
  z(),
3881
- S((r) => {
3903
+ S((a) => {
3882
3904
  var h, p;
3883
- const a = o.getSpineItemSpineLayoutInfo(s), c = e.isPositionWithinSpineItem(
3905
+ const r = o.getSpineItemSpineLayoutInfo(s), c = e.isPositionWithinSpineItem(
3884
3906
  t.position,
3885
3907
  s
3886
- ), u = a.width - (t.spineItemWidth ?? 0), d = a.height - (t.spineItemHeight ?? 0), g = u !== 0 || d !== 0;
3908
+ ), u = r.width - (t.spineItemWidth ?? 0), d = r.height - (t.spineItemHeight ?? 0), g = u !== 0 || d !== 0;
3887
3909
  if (t.url !== void 0 && (u || d || // when spine item is ready dimensions may have not changed but the position
3888
3910
  // of dom elements may have!
3889
- r && !t.spineItemIsReady)) {
3911
+ a && !t.spineItemIsReady)) {
3890
3912
  const m = i.getNavigationForUrl(
3891
3913
  t.url
3892
3914
  );
@@ -3896,7 +3918,7 @@ const wo = () => (e) => e.pipe(
3896
3918
  const l = t.cfi ?? t.paginationBeginCfi;
3897
3919
  if (l !== void 0 && !Et(l) && (u || d || // when spine item is ready dimensions may have not changed but the position
3898
3920
  // of dom elements may have!
3899
- r && !t.spineItemIsReady)) {
3921
+ a && !t.spineItemIsReady)) {
3900
3922
  const m = i.getNavigationForCfi(l);
3901
3923
  if (m)
3902
3924
  return m;
@@ -3926,7 +3948,7 @@ const wo = () => (e) => e.pipe(
3926
3948
  return c ? i.getNavigationForPosition(t.position) : i.getNavigationForSpineIndexOrId(s);
3927
3949
  })
3928
3950
  ) : w(new L({ x: 0, y: 0 }));
3929
- }, Co = ({
3951
+ }, Mo = ({
3930
3952
  navigation: e,
3931
3953
  spineLocator: t,
3932
3954
  spineItemsManager: i,
@@ -3934,11 +3956,11 @@ const wo = () => (e) => e.pipe(
3934
3956
  navigationResolver: o,
3935
3957
  spine: s
3936
3958
  }) => {
3937
- const { spineItem: r } = e, a = i.get(r);
3938
- if (!a) return new L({ x: 0, y: 0 });
3939
- const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(a), d = t.isPositionWithinSpineItem(
3959
+ const { spineItem: a } = e, r = i.get(a);
3960
+ if (!r) return new L({ x: 0, y: 0 });
3961
+ const { height: c, top: u } = s.getSpineItemSpineLayoutInfo(r), d = t.isPositionWithinSpineItem(
3940
3962
  e.position,
3941
- a
3963
+ r
3942
3964
  ), g = e.positionInSpineItem ?? new R({
3943
3965
  y: 0,
3944
3966
  x: 0
@@ -3947,18 +3969,18 @@ const wo = () => (e) => e.pipe(
3947
3969
  if (u === e.spineItemTop && c === e.spineItemHeight && d)
3948
3970
  return e.position;
3949
3971
  if (u === e.spineItemTop && c === e.spineItemHeight && !d)
3950
- return o.getNavigationForSpineIndexOrId(a);
3972
+ return o.getNavigationForSpineIndexOrId(r);
3951
3973
  if (u !== e.spineItemTop) {
3952
3974
  const l = t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
3953
3975
  e.positionInSpineItem ?? new R({
3954
3976
  x: 0,
3955
3977
  y: 0
3956
3978
  }),
3957
- a
3979
+ r
3958
3980
  );
3959
3981
  return t.getSpinePositionFromSpineItemPosition({
3960
3982
  spineItemPosition: l,
3961
- spineItem: a
3983
+ spineItem: r
3962
3984
  });
3963
3985
  }
3964
3986
  if (u === e.spineItemTop && c !== e.spineItemHeight) {
@@ -3969,11 +3991,11 @@ const wo = () => (e) => e.pipe(
3969
3991
  if (d) {
3970
3992
  const p = t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
3971
3993
  h,
3972
- a
3994
+ r
3973
3995
  );
3974
3996
  return t.getSpinePositionFromSpineItemPosition({
3975
3997
  spineItemPosition: p,
3976
- spineItem: a
3998
+ spineItem: r
3977
3999
  });
3978
4000
  }
3979
4001
  if (!d) {
@@ -3985,17 +4007,17 @@ const wo = () => (e) => e.pipe(
3985
4007
  return t.getSpinePositionFromSpineItemPosition({
3986
4008
  spineItemPosition: t.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
3987
4009
  m,
3988
- a
4010
+ r
3989
4011
  ),
3990
- spineItem: a
4012
+ spineItem: r
3991
4013
  });
3992
4014
  }
3993
- return o.getNavigationForSpineIndexOrId(a);
4015
+ return o.getNavigationForSpineIndexOrId(r);
3994
4016
  }
3995
4017
  }
3996
4018
  }
3997
4019
  return e.position;
3998
- }, Ro = ({
4020
+ }, Co = ({
3999
4021
  navigation: e,
4000
4022
  spineItemsManager: t,
4001
4023
  settings: i,
@@ -4003,7 +4025,7 @@ const wo = () => (e) => e.pipe(
4003
4025
  navigationResolver: o,
4004
4026
  spine: s
4005
4027
  }) => i.values.computedPageTurnMode === "scrollable" ? w(
4006
- Co({
4028
+ Mo({
4007
4029
  navigation: e,
4008
4030
  spineLocator: n,
4009
4031
  navigationResolver: o,
@@ -4011,7 +4033,7 @@ const wo = () => (e) => e.pipe(
4011
4033
  spineItemsManager: t,
4012
4034
  spine: s
4013
4035
  })
4014
- ) : Mo({
4036
+ ) : Lo({
4015
4037
  navigation: e,
4016
4038
  spineLocator: n,
4017
4039
  navigationResolver: o,
@@ -4023,7 +4045,7 @@ const wo = () => (e) => e.pipe(
4023
4045
  context: i,
4024
4046
  spine: n
4025
4047
  }) => (o) => o.pipe(
4026
- P((s) => Ro({
4048
+ P((s) => Co({
4027
4049
  spineLocator: n.locator,
4028
4050
  navigation: s.navigation,
4029
4051
  navigationResolver: t,
@@ -4032,18 +4054,18 @@ const wo = () => (e) => e.pipe(
4032
4054
  spineItemLocator: n.locator.spineItemLocator,
4033
4055
  spine: n
4034
4056
  }).pipe(
4035
- S((r) => ({
4057
+ S((a) => ({
4036
4058
  ...s,
4037
4059
  navigation: {
4038
4060
  ...s.navigation,
4039
- position: r
4061
+ position: a
4040
4062
  }
4041
4063
  }))
4042
4064
  ))
4043
- ), Ao = "navigation/InternalNavigator", Do = O.namespace(Ao);
4044
- class No extends X {
4045
- constructor(t, i, n, o, s, r, a, c) {
4046
- super(), this.settings = t, this.context = i, this.userNavigation$ = n, this.viewportController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isUserLocked$ = c, this.navigationSubject = new U({
4065
+ ), Ro = "navigation/InternalNavigator", Ao = O.namespace(Ro);
4066
+ class Do extends X {
4067
+ 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({
4047
4069
  animation: !1,
4048
4070
  position: new L({ x: 0, y: 0 }),
4049
4071
  meta: {
@@ -4064,59 +4086,59 @@ class No extends X {
4064
4086
  ), this.locker = new _e();
4065
4087
  const u = n.pipe(
4066
4088
  A(this.navigationSubject),
4067
- vo,
4089
+ Po,
4068
4090
  /**
4069
4091
  * Url lookup is heavier so we start with it to fill
4070
4092
  * as much information as needed to reduce later lookup
4071
4093
  */
4072
- Lo({
4073
- navigationResolver: r
4094
+ Fo({
4095
+ navigationResolver: a
4074
4096
  }),
4075
4097
  /**
4076
4098
  * Cfi lookup is heavier so we start with it to fill
4077
4099
  * as much information as needed to reduce later lookup
4078
4100
  */
4079
- xo({
4080
- navigationResolver: r
4101
+ vo({
4102
+ navigationResolver: a
4081
4103
  }),
4082
- To({ context: i, settings: t }),
4104
+ $o({ context: i, settings: t }),
4083
4105
  he({
4084
- navigationResolver: r,
4106
+ navigationResolver: a,
4085
4107
  settings: t,
4086
- spineItemsManager: a.spineItemsManager,
4087
- spineLocator: a.locator
4108
+ spineItemsManager: r.spineItemsManager,
4109
+ spineLocator: r.locator
4088
4110
  }),
4089
4111
  Vt({
4090
- navigationResolver: r,
4112
+ navigationResolver: a,
4091
4113
  settings: t,
4092
- spineItemsManager: a.spineItemsManager,
4093
- spineLocator: a.locator
4114
+ spineItemsManager: r.spineItemsManager,
4115
+ spineLocator: r.locator
4094
4116
  }),
4095
4117
  me({
4096
- spine: a
4118
+ spine: r
4097
4119
  })
4098
4120
  ).pipe(
4099
- Fo({
4100
- navigationResolver: r,
4101
- spineItemsManager: a.spineItemsManager
4121
+ To({
4122
+ navigationResolver: a,
4123
+ spineItemsManager: r.spineItemsManager
4102
4124
  }),
4103
4125
  A(c),
4104
4126
  P(([f, b]) => {
4105
4127
  const I = f.navigation.cfi || f.navigation.url || t.values.computedPageTurnMode === "scrollable" || b;
4106
4128
  return w(f).pipe(
4107
4129
  I ? Pt : fe({
4108
- navigationResolver: r,
4130
+ navigationResolver: a,
4109
4131
  settings: t,
4110
- spine: a,
4132
+ spine: r,
4111
4133
  context: i
4112
4134
  })
4113
4135
  );
4114
4136
  }),
4115
4137
  Vt({
4116
- spineItemsManager: a.spineItemsManager,
4117
- spineLocator: a.locator,
4138
+ spineItemsManager: r.spineItemsManager,
4139
+ spineLocator: r.locator,
4118
4140
  settings: t,
4119
- navigationResolver: r
4141
+ navigationResolver: a
4120
4142
  }),
4121
4143
  S((f) => f.navigation),
4122
4144
  V()
@@ -4143,7 +4165,7 @@ class No extends X {
4143
4165
  V()
4144
4166
  ), g = v(
4145
4167
  o.layout$,
4146
- a.layout$
4168
+ r.layout$
4147
4169
  ).pipe(
4148
4170
  P(() => w(null).pipe(
4149
4171
  P(
@@ -4173,10 +4195,10 @@ class No extends X {
4173
4195
  ).pipe(
4174
4196
  S((f) => ({ navigation: f })),
4175
4197
  fe({
4176
- navigationResolver: r,
4198
+ navigationResolver: a,
4177
4199
  settings: t,
4178
4200
  context: i,
4179
- spine: a
4201
+ spine: r
4180
4202
  }),
4181
4203
  S((f) => {
4182
4204
  const b = {
@@ -4196,33 +4218,33 @@ class No extends X {
4196
4218
  * yet.
4197
4219
  */
4198
4220
  he({
4199
- navigationResolver: r,
4221
+ navigationResolver: a,
4200
4222
  settings: t,
4201
- spineItemsManager: a.spineItemsManager,
4202
- spineLocator: a.locator
4223
+ spineItemsManager: r.spineItemsManager,
4224
+ spineLocator: r.locator
4203
4225
  }),
4204
4226
  me({
4205
- spine: a
4227
+ spine: r
4206
4228
  }),
4207
4229
  Vt({
4208
- spineItemsManager: a.spineItemsManager,
4209
- spineLocator: a.locator,
4230
+ spineItemsManager: r.spineItemsManager,
4231
+ spineLocator: r.locator,
4210
4232
  settings: t,
4211
- navigationResolver: r
4233
+ navigationResolver: a
4212
4234
  }),
4213
4235
  S(({ navigation: f }) => f),
4214
4236
  V()
4215
- ), h = Po(
4237
+ ), h = wo(
4216
4238
  i,
4217
4239
  this.navigationSubject,
4218
- a
4240
+ r
4219
4241
  ), p = v(
4220
4242
  l,
4221
4243
  u,
4222
4244
  h
4223
4245
  ), m = (f) => f.pipe(
4224
4246
  $(([b, I]) => {
4225
- Do.info(
4247
+ Ao.info(
4226
4248
  `navigation updated from ${b.meta.triggeredBy} of type ${b.type}`,
4227
4249
  {
4228
4250
  previousNavigation: I,
@@ -4286,24 +4308,24 @@ const Xe = ({
4286
4308
  scrollOffset: t
4287
4309
  })
4288
4310
  });
4289
- }, Oo = 500;
4290
- class Vo extends X {
4311
+ }, No = 500;
4312
+ class Oo extends X {
4291
4313
  constructor(t, i, n, o, s) {
4292
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();
4293
- const r = this.scrollNavigationController.userScroll$.pipe(
4294
- Wt((a) => {
4315
+ const a = this.scrollNavigationController.userScroll$.pipe(
4316
+ Wt((r) => {
4295
4317
  const c = this.locker.lock();
4296
4318
  return v(
4297
4319
  this.scrollNavigationController.userScroll$,
4298
- w(a)
4320
+ w(r)
4299
4321
  ).pipe(
4300
4322
  St(
4301
- Oo,
4323
+ No,
4302
4324
  rt
4303
4325
  ),
4304
4326
  z(),
4305
4327
  $(() => {
4306
- const u = a.target, d = Xe({
4328
+ const u = r.target, d = Xe({
4307
4329
  element: u,
4308
4330
  position: new L({
4309
4331
  x: u.scrollLeft ?? 0,
@@ -4323,25 +4345,25 @@ class Vo extends X {
4323
4345
  );
4324
4346
  })
4325
4347
  );
4326
- v(r).pipe(T(this.destroy$)).subscribe();
4348
+ v(a).pipe(T(this.destroy$)).subscribe();
4327
4349
  }
4328
4350
  }
4329
- const jo = (e) => ({
4351
+ const Vo = (e) => ({
4330
4352
  x: -e.x,
4331
4353
  y: -e.y
4332
- }), ko = (e) => e instanceof DOMMatrix ? new L({
4354
+ }), jo = (e) => e instanceof DOMMatrix ? new L({
4333
4355
  x: -e.e,
4334
4356
  y: -e.f
4335
4357
  }) : new L({
4336
4358
  x: -e.x,
4337
4359
  y: -e.y
4338
- }), Wo = "navigation/ViewportNavigator", ye = O.namespace(Wo);
4339
- class Uo extends X {
4360
+ }), ko = "navigation/ViewportNavigator", ye = O.namespace(ko);
4361
+ class Wo extends X {
4340
4362
  constructor(t, i, n, o, s) {
4341
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(
4342
4364
  document.createElement("div")
4343
4365
  );
4344
- const r = this.spine.element$.pipe(
4366
+ const a = this.spine.element$.pipe(
4345
4367
  M(qt),
4346
4368
  A(this.element$),
4347
4369
  $(([d, g]) => {
@@ -4349,14 +4371,14 @@ class Uo extends X {
4349
4371
  height: 100%;
4350
4372
  width: 100%;
4351
4373
  position: relative;
4352
- `, g.className = `${lt}-controlled-navigator`, g.innerHTML = "", g.appendChild(d), this.viewport.value.element.appendChild(g), this.element$.next(g);
4374
+ `, g.className = `${pt}-controlled-navigator`, g.innerHTML = "", g.appendChild(d), this.viewport.value.element.appendChild(g), this.element$.next(g);
4353
4375
  })
4354
- ), a = t.watch([
4376
+ ), r = t.watch([
4355
4377
  "computedPageTurnDirection",
4356
4378
  "computedPageTurnMode",
4357
4379
  "numberOfAdjacentSpineItemToPreLoad"
4358
4380
  ]), c = B([
4359
- a,
4381
+ r,
4360
4382
  this.element$
4361
4383
  ]).pipe(
4362
4384
  $(([, d]) => {
@@ -4437,7 +4459,7 @@ class Uo extends X {
4437
4459
  }),
4438
4460
  it(!1),
4439
4461
  tt(1)
4440
- ), v(r, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
4462
+ ), v(a, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
4441
4463
  }
4442
4464
  /**
4443
4465
  * Programmatically set the viewport position.
@@ -4448,7 +4470,7 @@ class Uo extends X {
4448
4470
  * for remark about flicker / fonts smoothing
4449
4471
  */
4450
4472
  setViewportPosition(t) {
4451
- const i = this.element$.getValue(), n = jo(t);
4473
+ const i = this.element$.getValue(), n = Vo(t);
4452
4474
  i.style.transform = `translate(${n.x}px, ${n.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4453
4475
  }
4454
4476
  navigate(t) {
@@ -4463,10 +4485,10 @@ class Uo extends X {
4463
4485
  if (!n || n === "none")
4464
4486
  return new L({ x: 0, y: 0 });
4465
4487
  const o = new DOMMatrix(n);
4466
- return ko(o);
4488
+ return jo(o);
4467
4489
  }
4468
4490
  }
4469
- class zo extends pt {
4491
+ class Uo extends ht {
4470
4492
  constructor(t, i, n, o, s) {
4471
4493
  super({
4472
4494
  element: void 0
@@ -4483,7 +4505,7 @@ class zo extends pt {
4483
4505
  T(v(this.scrollingSubject.pipe(ve(1)), this.destroy$))
4484
4506
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4485
4507
  };
4486
- const r = this.context.pipe(
4508
+ const a = this.context.pipe(
4487
4509
  Jt(["rootElement"]),
4488
4510
  $(({ rootElement: g }) => {
4489
4511
  if (!g) return;
@@ -4494,9 +4516,9 @@ class zo extends pt {
4494
4516
  position: relative;
4495
4517
  overflow-y: scroll;
4496
4518
  overflow-x: hidden;
4497
- `, l.className = `${lt}-scroll-navigator`, l.appendChild(this.viewport.value.element), g.appendChild(l), this.update({ element: l });
4519
+ `, l.className = `${pt}-scroll-navigator`, l.appendChild(this.viewport.value.element), g.appendChild(l), this.update({ element: l });
4498
4520
  })
4499
- ), a = B([
4521
+ ), r = B([
4500
4522
  i.watch(["computedPageTurnMode"]),
4501
4523
  this.watch("element")
4502
4524
  ]).pipe(
@@ -4553,7 +4575,7 @@ class zo extends pt {
4553
4575
  )
4554
4576
  ),
4555
4577
  V()
4556
- ), v(r, a, c).pipe(T(this.destroy$)).subscribe();
4578
+ ), v(a, r, c).pipe(T(this.destroy$)).subscribe();
4557
4579
  }
4558
4580
  update(t) {
4559
4581
  this.mergeCompare(t);
@@ -4577,12 +4599,12 @@ const Ft = (e, t, i) => {
4577
4599
  const n = i - e, o = i * (t * e) / (i || 1);
4578
4600
  return Math.max(0, Math.min(n, o));
4579
4601
  }, _t = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), xt = (e, t, i) => {
4580
- const n = _t(i, t), o = [...Array(n)].map((s, r) => r * t);
4602
+ const n = _t(i, t), o = [...Array(n)].map((s, a) => a * t);
4581
4603
  return e >= n * t ? o[o.length - 1] || 0 : o.find((s) => e < s + t) || 0;
4582
4604
  }, Se = (e, t, i) => {
4583
4605
  const n = [...Array(i)].map((o, s) => s * t);
4584
4606
  return e <= 0 || i === 0 ? 0 : e >= i * t ? i - 1 : n.findIndex((o) => e < o + t) ?? 0;
4585
- }, Ho = ({
4607
+ }, zo = ({
4586
4608
  itemWidth: e,
4587
4609
  itemHeight: t,
4588
4610
  spineItemPosition: i
@@ -4596,19 +4618,19 @@ const Ft = (e, t, i) => {
4596
4618
  pageWidth: n,
4597
4619
  pageHeight: o,
4598
4620
  pageTurnDirection: s,
4599
- pageTurnMode: r
4600
- }) => s === "vertical" && r === "scrollable" ? 1 : i || s === "vertical" ? _t(e, o) : _t(t, n), be = ({
4621
+ pageTurnMode: a
4622
+ }) => s === "vertical" && a === "scrollable" ? 1 : i || s === "vertical" ? _t(e, o) : _t(t, n), be = ({
4601
4623
  itemWidth: e,
4602
4624
  itemHeight: t,
4603
4625
  position: i,
4604
4626
  isUsingVerticalWriting: n,
4605
4627
  pageWidth: o,
4606
4628
  pageHeight: s,
4607
- pageTurnDirection: r,
4608
- pageTurnMode: a,
4629
+ pageTurnDirection: a,
4630
+ pageTurnMode: r,
4609
4631
  isRTL: c
4610
4632
  }) => {
4611
- const d = Ho({
4633
+ const d = zo({
4612
4634
  spineItemPosition: i,
4613
4635
  itemHeight: t,
4614
4636
  itemWidth: e
@@ -4618,14 +4640,14 @@ const Ft = (e, t, i) => {
4618
4640
  itemWidth: e,
4619
4641
  pageWidth: o,
4620
4642
  pageHeight: s,
4621
- pageTurnDirection: r,
4622
- pageTurnMode: a
4643
+ pageTurnDirection: a,
4644
+ pageTurnMode: r
4623
4645
  });
4624
4646
  if (n)
4625
4647
  return Se(i.y, s, g);
4626
4648
  const l = Se(d, o, g);
4627
4649
  return c ? g - 1 - l : l;
4628
- }, Bo = ({
4650
+ }, Ho = ({
4629
4651
  pageIndex: e,
4630
4652
  itemLayout: t,
4631
4653
  context: i,
@@ -4658,13 +4680,13 @@ const Ft = (e, t, i) => {
4658
4680
  context: e,
4659
4681
  settings: t
4660
4682
  }) => {
4661
- const i = (r, a, c) => {
4683
+ const i = (a, r, c) => {
4662
4684
  var l;
4663
4685
  let u;
4664
- if ((r == null ? void 0 : r.nodeName) === "img" || (r == null ? void 0 : r.textContent) === "" && r.nodeType === Node.ELEMENT_NODE)
4665
- u = r.getBoundingClientRect().x;
4666
- else if (r) {
4667
- const h = r ? Ai(r, a) : void 0;
4686
+ if ((a == null ? void 0 : a.nodeName) === "img" || (a == null ? void 0 : a.textContent) === "" && a.nodeType === Node.ELEMENT_NODE)
4687
+ u = a.getBoundingClientRect().x;
4688
+ else if (a) {
4689
+ const h = a ? Ri(a, r) : void 0;
4668
4690
  u = (h == null ? void 0 : h.getBoundingClientRect().x) || u;
4669
4691
  }
4670
4692
  const d = ((l = c.layout.layoutInfo) == null ? void 0 : l.width) || 0, g = e.getPageSize().width;
@@ -4680,24 +4702,24 @@ const Ft = (e, t, i) => {
4680
4702
  return {
4681
4703
  getSpineItemPositionFromNode: i,
4682
4704
  getSpineItemPositionFromPageIndex: ({
4683
- pageIndex: r,
4684
- spineItem: a
4685
- }) => Bo({
4705
+ pageIndex: a,
4706
+ spineItem: r
4707
+ }) => Ho({
4686
4708
  context: e,
4687
- isUsingVerticalWriting: !!a.isUsingVerticalWriting(),
4688
- itemLayout: a.layout.layoutInfo,
4689
- pageIndex: r
4709
+ isUsingVerticalWriting: !!r.isUsingVerticalWriting(),
4710
+ itemLayout: r.layout.layoutInfo,
4711
+ pageIndex: a
4690
4712
  }),
4691
- getSpineItemPageIndexFromPosition: (r) => be({
4692
- ...r,
4713
+ getSpineItemPageIndexFromPosition: (a) => be({
4714
+ ...a,
4693
4715
  isRTL: e.isRTL(),
4694
4716
  pageWidth: e.getPageSize().width,
4695
4717
  pageHeight: e.getPageSize().height,
4696
4718
  pageTurnDirection: t.values.computedPageTurnDirection,
4697
4719
  pageTurnMode: t.values.pageTurnMode
4698
4720
  }),
4699
- getSpineItemPageIndexFromNode: (r, a, c) => {
4700
- const u = i(r, a, c), { height: d, width: g } = c.layout.layoutInfo;
4721
+ getSpineItemPageIndexFromNode: (a, r, c) => {
4722
+ const u = i(a, r, c), { height: d, width: g } = c.layout.layoutInfo;
4701
4723
  return u ? be({
4702
4724
  isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
4703
4725
  position: u,
@@ -4710,69 +4732,69 @@ const Ft = (e, t, i) => {
4710
4732
  pageTurnMode: t.values.pageTurnMode
4711
4733
  }) : void 0;
4712
4734
  },
4713
- getSpineItemClosestPositionFromUnsafePosition: (r, a) => {
4714
- const { width: c, height: u } = a.layout.layoutInfo;
4735
+ getSpineItemClosestPositionFromUnsafePosition: (a, r) => {
4736
+ const { width: c, height: u } = r.layout.layoutInfo;
4715
4737
  return new R({
4716
4738
  x: xt(
4717
- r.x,
4739
+ a.x,
4718
4740
  e.getPageSize().width,
4719
4741
  c
4720
4742
  ),
4721
4743
  y: xt(
4722
- r.y,
4744
+ a.y,
4723
4745
  e.getPageSize().height,
4724
4746
  u
4725
4747
  )
4726
4748
  });
4727
4749
  },
4728
- getSpineItemPagePositionFromSpineItemPosition: (r, a, c) => {
4750
+ getSpineItemPagePositionFromSpineItemPosition: (a, r, c) => {
4729
4751
  const { width: u, height: d } = c.layout.layoutInfo, g = e.getPageSize().width, l = e.getPageSize().height;
4730
4752
  if (!!c.isUsingVerticalWriting()) {
4731
4753
  const m = Ft(
4732
4754
  l,
4733
- a,
4755
+ r,
4734
4756
  d
4735
4757
  );
4736
4758
  return new Nt({
4737
- x: r.x,
4738
- y: r.y - m
4759
+ x: a.x,
4760
+ y: a.y - m
4739
4761
  });
4740
4762
  }
4741
- const p = Ft(g, a, u);
4763
+ const p = Ft(g, r, u);
4742
4764
  if (e.isRTL()) {
4743
- const m = u - (a + 1) * g;
4765
+ const m = u - (r + 1) * g;
4744
4766
  return new Nt({
4745
- x: r.x - Math.max(0, m),
4746
- y: r.y
4767
+ x: a.x - Math.max(0, m),
4768
+ y: a.y
4747
4769
  });
4748
4770
  }
4749
4771
  return new Nt({
4750
- x: r.x - p,
4751
- y: r.y
4772
+ x: a.x - p,
4773
+ y: a.y
4752
4774
  });
4753
4775
  }
4754
4776
  };
4755
- }, Eo = ({
4777
+ }, Bo = ({
4756
4778
  context: e,
4757
4779
  settings: t
4758
4780
  }) => {
4759
4781
  const i = qe({ context: e, settings: t });
4760
4782
  return {
4761
- getNavigationForLastPage: (r) => {
4762
- const a = r.numberOfPages;
4783
+ getNavigationForLastPage: (a) => {
4784
+ const r = a.numberOfPages;
4763
4785
  return i.getSpineItemPositionFromPageIndex({
4764
- pageIndex: a - 1,
4765
- spineItem: r
4786
+ pageIndex: r - 1,
4787
+ spineItem: a
4766
4788
  });
4767
4789
  },
4768
- getNavigationForPosition: (r, a) => i.getSpineItemClosestPositionFromUnsafePosition(
4769
- a,
4770
- r
4790
+ getNavigationForPosition: (a, r) => i.getSpineItemClosestPositionFromUnsafePosition(
4791
+ r,
4792
+ a
4771
4793
  ),
4772
- getNavigationFromNode: (r, a, c) => i.getSpineItemPositionFromNode(
4773
- a,
4794
+ getNavigationFromNode: (a, r, c) => i.getSpineItemPositionFromNode(
4795
+ r,
4774
4796
  c,
4775
- r
4797
+ a
4776
4798
  ) || new R({ x: 0, y: 0 })
4777
4799
  };
4778
4800
  }, et = ({
@@ -4790,17 +4812,17 @@ const Ft = (e, t, i) => {
4790
4812
  visibleAreaRectWidth: o,
4791
4813
  spine: s
4792
4814
  }) => {
4793
- const r = n.get(
4815
+ const a = n.get(
4794
4816
  n.items.length - 1
4795
- ), a = s.getSpineItemSpineLayoutInfo(
4796
- r || 0
4797
- ), c = a.bottom - i, u = Math.min(Math.max(0, e.y), c);
4817
+ ), r = s.getSpineItemSpineLayoutInfo(
4818
+ a || 0
4819
+ ), c = r.bottom - i, u = Math.min(Math.max(0, e.y), c);
4798
4820
  if (t)
4799
4821
  return new L({
4800
- x: Math.max(Math.min(0, e.x), a.left),
4822
+ x: Math.max(Math.min(0, e.x), r.left),
4801
4823
  y: u
4802
4824
  });
4803
- const d = a.right - o;
4825
+ const d = r.right - o;
4804
4826
  return new L({
4805
4827
  x: Math.min(Math.max(0, e.x), d),
4806
4828
  y: u
@@ -4816,21 +4838,21 @@ const Ft = (e, t, i) => {
4816
4838
  const s = t.getSpineItemPositionFromSpinePosition(
4817
4839
  e,
4818
4840
  o
4819
- ), r = n.getNavigationForPosition(
4841
+ ), a = n.getNavigationForPosition(
4820
4842
  o,
4821
4843
  s
4822
- ), a = t.getSpinePositionFromSpineItemPosition({
4823
- spineItemPosition: r,
4844
+ ), r = t.getSpinePositionFromSpineItemPosition({
4845
+ spineItemPosition: a,
4824
4846
  spineItem: o
4825
4847
  });
4826
4848
  return et({
4827
- position: a,
4849
+ position: r,
4828
4850
  pageSizeWidth: i.getPageSize().width,
4829
4851
  visibleAreaRectWidth: i.state.visibleAreaRect.width
4830
4852
  });
4831
4853
  }
4832
4854
  return new L({ x: 0, y: 0 });
4833
- }, _o = ({
4855
+ }, Eo = ({
4834
4856
  pageIndex: e,
4835
4857
  spineItemsManager: t,
4836
4858
  spineItemId: i,
@@ -4838,8 +4860,8 @@ const Ft = (e, t, i) => {
4838
4860
  spineLocator: o,
4839
4861
  spineItemNavigationResolver: s
4840
4862
  }) => {
4841
- const r = t.get(i);
4842
- if (!r) {
4863
+ const a = t.get(i);
4864
+ if (!a) {
4843
4865
  const u = e * n.getPageSize().width;
4844
4866
  return Xt({
4845
4867
  viewportPosition: new L({ x: u, y: 0 }),
@@ -4848,37 +4870,37 @@ const Ft = (e, t, i) => {
4848
4870
  spineLocator: o
4849
4871
  });
4850
4872
  }
4851
- const a = o.spineItemLocator.getSpineItemPositionFromPageIndex({
4873
+ const r = o.spineItemLocator.getSpineItemPositionFromPageIndex({
4852
4874
  pageIndex: e,
4853
- spineItem: r
4875
+ spineItem: a
4854
4876
  }), c = o.getSpinePositionFromSpineItemPosition({
4855
- spineItemPosition: a,
4856
- spineItem: r
4877
+ spineItemPosition: r,
4878
+ spineItem: a
4857
4879
  });
4858
4880
  return et({
4859
4881
  position: c,
4860
4882
  pageSizeWidth: n.getPageSize().width,
4861
4883
  visibleAreaRectWidth: n.state.visibleAreaRect.width
4862
4884
  });
4863
- }, Xo = ({
4885
+ }, _o = ({
4864
4886
  anchor: e,
4865
4887
  spineItem: t,
4866
4888
  context: i
4867
4889
  }) => {
4868
- var a;
4869
- const n = ((a = t.layout.layoutInfo) == null ? void 0 : a.width) || 0, o = i.getPageSize().width, s = t.getBoundingRectOfElementFromSelector(e), r = (s == null ? void 0 : s.x) || 0;
4890
+ var r;
4891
+ 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;
4870
4892
  return xt(
4871
- r,
4893
+ a,
4872
4894
  o,
4873
4895
  n
4874
4896
  );
4875
- }, Yo = ({
4897
+ }, Xo = ({
4876
4898
  anchor: e,
4877
4899
  context: t,
4878
4900
  spineItem: i,
4879
4901
  spineLocator: n
4880
4902
  }) => {
4881
- const o = Xo({
4903
+ const o = _o({
4882
4904
  anchor: e,
4883
4905
  spineItem: i,
4884
4906
  context: t
@@ -4887,7 +4909,7 @@ const Ft = (e, t, i) => {
4887
4909
  spineItemPosition: new R({ x: o, y: 0 }),
4888
4910
  spineItem: i
4889
4911
  });
4890
- }, qo = ({
4912
+ }, Yo = ({
4891
4913
  anchor: e,
4892
4914
  spineItem: t,
4893
4915
  spineLocator: i,
@@ -4895,18 +4917,18 @@ const Ft = (e, t, i) => {
4895
4917
  pageSizeWidth: o,
4896
4918
  visibleAreaRectWidth: s
4897
4919
  }) => {
4898
- const r = Yo({
4920
+ const a = Xo({
4899
4921
  anchor: e,
4900
4922
  context: n,
4901
4923
  spineItem: t,
4902
4924
  spineLocator: i
4903
4925
  });
4904
4926
  return et({
4905
- position: r,
4927
+ position: a,
4906
4928
  pageSizeWidth: o,
4907
4929
  visibleAreaRectWidth: s
4908
4930
  });
4909
- }, Zo = ({
4931
+ }, qo = ({
4910
4932
  context: e,
4911
4933
  spineItemsManager: t,
4912
4934
  spineLocator: i,
@@ -4914,16 +4936,16 @@ const Ft = (e, t, i) => {
4914
4936
  pageSizeWidth: o,
4915
4937
  visibleAreaRectWidth: s
4916
4938
  }) => {
4917
- var r;
4939
+ var a;
4918
4940
  try {
4919
- const a = n instanceof URL ? n : new URL(n), c = `${a.origin}${a.pathname}`, u = (r = e.manifest) == null ? void 0 : r.spineItems.find(
4941
+ const r = n instanceof URL ? n : new URL(n), c = `${r.origin}${r.pathname}`, u = (a = e.manifest) == null ? void 0 : a.spineItems.find(
4920
4942
  (d) => d.href === c
4921
4943
  );
4922
4944
  if (u) {
4923
4945
  const d = t.get(u.id);
4924
4946
  if (d) {
4925
- const g = qo({
4926
- anchor: a.hash,
4947
+ const g = Yo({
4948
+ anchor: r.hash,
4927
4949
  spineItem: d,
4928
4950
  context: e,
4929
4951
  spineLocator: i,
@@ -4941,11 +4963,11 @@ const Ft = (e, t, i) => {
4941
4963
  }
4942
4964
  }
4943
4965
  return;
4944
- } catch (a) {
4945
- console.error(a);
4966
+ } catch (r) {
4967
+ console.error(r);
4946
4968
  return;
4947
4969
  }
4948
- }, Go = ({
4970
+ }, Zo = ({
4949
4971
  spineItem: e,
4950
4972
  spineItemPosition: t,
4951
4973
  spineLocator: i,
@@ -4955,25 +4977,25 @@ const Ft = (e, t, i) => {
4955
4977
  const s = n.getSpineItemClosestPositionFromUnsafePosition(
4956
4978
  t,
4957
4979
  e
4958
- ), r = i.getSpinePositionFromSpineItemPosition({
4980
+ ), a = i.getSpinePositionFromSpineItemPosition({
4959
4981
  spineItemPosition: s,
4960
4982
  spineItem: e
4961
4983
  });
4962
4984
  return et({
4963
- position: r,
4985
+ position: a,
4964
4986
  pageSizeWidth: o.getPageSize().width,
4965
4987
  visibleAreaRectWidth: o.state.visibleAreaRect.width
4966
4988
  });
4967
- }, Jo = "spineNavigator", Ko = ({
4989
+ }, Go = "spineNavigator", Jo = ({
4968
4990
  context: e,
4969
4991
  spineItemsManager: t,
4970
4992
  locator: i,
4971
4993
  settings: n,
4972
4994
  spine: o
4973
4995
  }) => {
4974
- const s = Eo({ context: e, settings: n });
4996
+ const s = Bo({ context: e, settings: n });
4975
4997
  return {
4976
- getNavigationForUrl: (l) => Zo({
4998
+ getNavigationForUrl: (l) => qo({
4977
4999
  context: e,
4978
5000
  spineItemsManager: t,
4979
5001
  spineLocator: i,
@@ -4981,14 +5003,14 @@ const Ft = (e, t, i) => {
4981
5003
  pageSizeWidth: e.getPageSize().width,
4982
5004
  visibleAreaRectWidth: e.state.visibleAreaRect.width
4983
5005
  }),
4984
- getNavigationForSpineItemPage: (l) => _o({
5006
+ getNavigationForSpineItemPage: (l) => Eo({
4985
5007
  ...l,
4986
5008
  context: e,
4987
5009
  spineItemsManager: t,
4988
5010
  spineItemNavigationResolver: s,
4989
5011
  spineLocator: i
4990
5012
  }),
4991
- getNavigationFromSpineItemPosition: (l) => Go({
5013
+ getNavigationFromSpineItemPosition: (l) => Zo({
4992
5014
  ...l,
4993
5015
  spineItemLocator: i.spineItemLocator,
4994
5016
  spineLocator: i,
@@ -4998,9 +5020,9 @@ const Ft = (e, t, i) => {
4998
5020
  const h = t.getSpineItemFromCfi(l), { node: p, offset: m = 0 } = ze({
4999
5021
  cfi: l,
5000
5022
  spineItemsManager: t
5001
- }) || {};
5023
+ });
5002
5024
  if (!h) {
5003
- O.warn(Jo, `unable to detect item id from cfi ${l}`);
5025
+ O.warn(Go, `unable to detect item id from cfi ${l}`);
5004
5026
  return;
5005
5027
  }
5006
5028
  const y = p ? s.getNavigationFromNode(h, p, m) : new R({ x: 0, y: 0 }), f = i.getSpinePositionFromSpineItemPosition({
@@ -5078,7 +5100,7 @@ const Ft = (e, t, i) => {
5078
5100
  }),
5079
5101
  spineItemNavigator: s
5080
5102
  };
5081
- }, Qo = ({
5103
+ }, Ko = ({
5082
5104
  spineItemsManager: e,
5083
5105
  context: t,
5084
5106
  hookManager: i,
@@ -5086,34 +5108,34 @@ const Ft = (e, t, i) => {
5086
5108
  settings: o,
5087
5109
  viewport: s
5088
5110
  }) => {
5089
- const r = new W(), a = new _e(), c = Ko({
5111
+ const a = new W(), r = new _e(), c = Jo({
5090
5112
  context: t,
5091
5113
  settings: o,
5092
5114
  spineItemsManager: e,
5093
5115
  locator: n.locator,
5094
5116
  spine: n
5095
- }), u = new Uo(
5117
+ }), u = new Wo(
5096
5118
  o,
5097
5119
  i,
5098
5120
  t,
5099
5121
  n,
5100
5122
  s
5101
- ), d = new zo(
5123
+ ), d = new Uo(
5102
5124
  s,
5103
5125
  o,
5104
5126
  i,
5105
5127
  n,
5106
5128
  t
5107
- ), g = new Vo(
5129
+ ), g = new Oo(
5108
5130
  o,
5109
5131
  t,
5110
5132
  n,
5111
5133
  d,
5112
- a
5134
+ r
5113
5135
  ), l = v(
5114
- r,
5136
+ a,
5115
5137
  g.navigation$
5116
- ), h = new No(
5138
+ ), h = new Do(
5117
5139
  o,
5118
5140
  t,
5119
5141
  l,
@@ -5121,11 +5143,11 @@ const Ft = (e, t, i) => {
5121
5143
  d,
5122
5144
  c,
5123
5145
  n,
5124
- a.isLocked$
5146
+ r.isLocked$
5125
5147
  ), p = B([
5126
5148
  u.isNavigating$,
5127
5149
  d.isNavigating$,
5128
- a.isLocked$,
5150
+ r.isLocked$,
5129
5151
  h.locker.isLocked$
5130
5152
  ]).pipe(
5131
5153
  Y((f) => f.some((b) => b) ? "busy" : "free"),
@@ -5140,19 +5162,19 @@ const Ft = (e, t, i) => {
5140
5162
  internalNavigator: h,
5141
5163
  scrollNavigationController: d,
5142
5164
  controlledNavigationController: u,
5143
- locker: a,
5165
+ locker: r,
5144
5166
  viewportState$: p,
5145
5167
  navigate: (f) => {
5146
- r.next(f);
5168
+ a.next(f);
5147
5169
  },
5148
5170
  lock() {
5149
- return a.lock();
5171
+ return r.lock();
5150
5172
  },
5151
5173
  navigationResolver: c,
5152
5174
  navigation$: h.navigation$
5153
5175
  };
5154
5176
  };
5155
- class ts extends pt {
5177
+ class Qo extends ht {
5156
5178
  constructor(t, i) {
5157
5179
  super({
5158
5180
  beginPageIndexInSpineItem: void 0,
@@ -5170,10 +5192,10 @@ class ts extends pt {
5170
5192
  this.mergeCompare(t);
5171
5193
  }
5172
5194
  }
5173
- class es extends X {
5195
+ class ts extends X {
5174
5196
  constructor(t, i, n, o, s) {
5175
5197
  super(), this.context = t, this.pagination = i, this.spineItemsManager = n, this.spine = o, this.spineItemLocator = s;
5176
- const r = v(
5198
+ const a = v(
5177
5199
  this.context.bridgeEvent.navigation$,
5178
5200
  o.layout$
5179
5201
  ).pipe(
@@ -5204,7 +5226,7 @@ class es extends X {
5204
5226
  }) ?? {}, { endPageIndex: I = 0 } = c({
5205
5227
  spineItem: m,
5206
5228
  position: d
5207
- }) ?? {}, x = y === void 0 || Et(y) || g.beginSpineItemIndex !== l, F = g.endSpineItemIndex !== h || f === void 0 || Et(f), C = x ? ft(p.item) : y, D = F ? ft(m.item) : f, E = p.numberOfPages, J = m.numberOfPages;
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;
5208
5230
  this.pagination.update({
5209
5231
  beginCfi: C,
5210
5232
  beginNumberOfPagesInSpineItem: E,
@@ -5219,7 +5241,7 @@ class es extends X {
5219
5241
  })
5220
5242
  );
5221
5243
  })
5222
- ), a = r.pipe(
5244
+ ), r = a.pipe(
5223
5245
  Ct(this.context.bridgeEvent.viewportFree$),
5224
5246
  $(() => {
5225
5247
  const {
@@ -5245,10 +5267,10 @@ class es extends X {
5245
5267
  });
5246
5268
  })
5247
5269
  );
5248
- v(r, a).pipe(T(this.destroy$)).subscribe();
5270
+ v(a, r).pipe(T(this.destroy$)).subscribe();
5249
5271
  }
5250
5272
  }
5251
- class is extends X {
5273
+ class es extends X {
5252
5274
  constructor(t) {
5253
5275
  super();
5254
5276
  const i = {
@@ -5293,7 +5315,7 @@ class is extends X {
5293
5315
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5294
5316
  }
5295
5317
  }
5296
- class ns extends is {
5318
+ class is extends es {
5297
5319
  constructor(t, i) {
5298
5320
  super(t), this.context = i;
5299
5321
  const n = B([
@@ -5338,10 +5360,10 @@ class ns extends is {
5338
5360
  };
5339
5361
  }
5340
5362
  }
5341
- class os extends X {
5342
- constructor(t, i, n, o, s, r) {
5343
- super(), this.item = t, this.containerElement = i, this.context = n, this.hookManager = o, this.renderer = s, this.settings = r, this.layoutTriggerSubject = new W(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5344
- blankPagePosition: a,
5363
+ class ns extends X {
5364
+ 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 = ({
5366
+ blankPagePosition: r,
5345
5367
  minimumWidth: c
5346
5368
  }) => (u) => u.pipe(
5347
5369
  S((d) => {
@@ -5363,23 +5385,23 @@ class os extends X {
5363
5385
  height: I,
5364
5386
  pageSize: this.context.getPageSize()
5365
5387
  }, this.containerElement.style.width = `${b}px`, this.containerElement.style.height = `${I}px`, this.hookManager.execute("item.onAfterLayout", void 0, {
5366
- blankPagePosition: a,
5388
+ blankPagePosition: r,
5367
5389
  item: this.item,
5368
5390
  minimumWidth: c
5369
5391
  }), { width: b, height: I };
5370
5392
  })
5371
- ), this.layout = (a) => {
5372
- const c = Hi(this.layout$.pipe(z()));
5373
- return this.layoutTriggerSubject.next(a), c();
5393
+ ), this.layout = (r) => {
5394
+ const c = zi(this.layout$.pipe(z()));
5395
+ return this.layoutTriggerSubject.next(r), c();
5374
5396
  }, this.adjustPositionOfElement = ({
5375
- right: a,
5397
+ right: r,
5376
5398
  left: c,
5377
5399
  top: u
5378
5400
  }) => {
5379
- a !== void 0 ? this.containerElement.style.right = `${a}px` : this.containerElement.style.removeProperty("right"), c !== void 0 ? this.containerElement.style.left = `${c}px` : this.containerElement.style.removeProperty("left"), u !== void 0 ? this.containerElement.style.top = `${u}px` : this.containerElement.style.removeProperty("top");
5401
+ r !== void 0 ? this.containerElement.style.right = `${r}px` : this.containerElement.style.removeProperty("right"), c !== void 0 ? this.containerElement.style.left = `${c}px` : this.containerElement.style.removeProperty("left"), u !== void 0 ? this.containerElement.style.top = `${u}px` : this.containerElement.style.removeProperty("top");
5380
5402
  }, this.layoutProcess$ = this.layoutTriggerSubject.pipe(
5381
- P((a) => {
5382
- const { blankPagePosition: c, minimumWidth: u, spreadPosition: d } = a;
5403
+ P((r) => {
5404
+ const { blankPagePosition: c, minimumWidth: u, spreadPosition: d } = r;
5383
5405
  this.hookManager.execute("item.onBeforeLayout", void 0, {
5384
5406
  blankPagePosition: c,
5385
5407
  item: this.item,
@@ -5394,7 +5416,7 @@ class os extends X {
5394
5416
  return v(
5395
5417
  w({ type: "start" }),
5396
5418
  g.pipe(
5397
- this.applyDimsAfterLayout(a),
5419
+ this.applyDimsAfterLayout(r),
5398
5420
  S(
5399
5421
  (l) => ({
5400
5422
  type: "end",
@@ -5406,15 +5428,15 @@ class os extends X {
5406
5428
  }),
5407
5429
  V()
5408
5430
  ), this.layout$ = this.layoutProcess$.pipe(
5409
- M((a) => a.type === "end"),
5410
- S((a) => a.data),
5431
+ M((r) => r.type === "end"),
5432
+ S((r) => r.data),
5411
5433
  V()
5412
5434
  );
5413
5435
  }
5414
5436
  validateDimension(t, i, n) {
5415
5437
  if (t <= 0) return n;
5416
- const o = Math.max(t, n), r = Math.ceil(o / i) * i;
5417
- return Math.max(r, i);
5438
+ const o = Math.max(t, n), a = Math.ceil(o / i) * i;
5439
+ return Math.max(a, i);
5418
5440
  }
5419
5441
  get layoutInfo() {
5420
5442
  const t = this.containerElement.style, i = t.width ? parseFloat(t.width) : 0, n = t.height ? parseFloat(t.height) : 0;
@@ -5424,7 +5446,7 @@ class os extends X {
5424
5446
  };
5425
5447
  }
5426
5448
  }
5427
- class ss extends mt {
5449
+ class os extends ft {
5428
5450
  onUnload() {
5429
5451
  return Q;
5430
5452
  }
@@ -5444,9 +5466,9 @@ class ss extends mt {
5444
5466
  }
5445
5467
  }
5446
5468
  class Ze extends X {
5447
- constructor(t, i, n, o, s, r) {
5469
+ constructor(t, i, n, o, s, a) {
5448
5470
  var u, d;
5449
- super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index = r, this.getBoundingRectOfElementFromSelector = (g) => {
5471
+ super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index = a, this.getBoundingRectOfElementFromSelector = (g) => {
5450
5472
  var h, p, m, y;
5451
5473
  const l = this.renderer.getDocumentFrame();
5452
5474
  if (l && l instanceof HTMLIFrameElement && g)
@@ -5460,12 +5482,12 @@ class Ze extends X {
5460
5482
  }, this.isUsingVerticalWriting = () => {
5461
5483
  var g;
5462
5484
  return !!((g = this.renderer.writingMode) != null && g.startsWith("vertical"));
5463
- }, this.containerElement = rs(
5485
+ }, this.containerElement = ss(
5464
5486
  i,
5465
5487
  t,
5466
5488
  s
5467
5489
  ), i.appendChild(this.containerElement);
5468
- const a = (d = (u = this.settings.values).getRenderer) == null ? void 0 : d.call(u, t);
5490
+ const r = (d = (u = this.settings.values).getRenderer) == null ? void 0 : d.call(u, t);
5469
5491
  this.resourcesHandler = new Qt(t, this.settings);
5470
5492
  const c = {
5471
5493
  context: n,
@@ -5475,7 +5497,7 @@ class Ze extends X {
5475
5497
  containerElement: this.containerElement,
5476
5498
  resourcesHandler: this.resourcesHandler
5477
5499
  };
5478
- this.renderer = a ? a(c) : new ss(c), this.layout = new os(
5500
+ this.renderer = r ? r(c) : new os(c), this.layout = new ns(
5479
5501
  t,
5480
5502
  this.containerElement,
5481
5503
  n,
@@ -5549,16 +5571,16 @@ class Ze extends X {
5549
5571
  });
5550
5572
  }
5551
5573
  }
5552
- const rs = (e, t, i) => {
5574
+ const ss = (e, t, i) => {
5553
5575
  const n = e.ownerDocument.createElement("div");
5554
5576
  return n.classList.add("spineItem"), n.classList.add(`spineItem-${t.renditionLayout ?? "reflowable"}`), n.style.cssText = `
5555
5577
  position: absolute;
5556
5578
  overflow: hidden;
5557
5579
  `, n.dataset.isReady = "false", i.execute("item.onBeforeContainerCreated", void 0, { element: n }), n;
5558
- }, as = O.namespace("spine"), cs = ({
5580
+ }, rs = O.namespace("spine"), as = ({
5559
5581
  position: e,
5560
5582
  pageSize: t
5561
- }) => new mn({
5583
+ }) => new hn({
5562
5584
  ...e,
5563
5585
  left: e.x,
5564
5586
  top: e.y,
@@ -5567,13 +5589,13 @@ const rs = (e, t, i) => {
5567
5589
  bottom: e.y + t.height,
5568
5590
  right: e.x + t.width
5569
5591
  });
5570
- class us extends pt {
5571
- constructor(t, i, n, o, s, r) {
5572
- super({ pages: [] }), this.spineLayout = t, this.spineItemsManager = i, this.spineItemLocator = n, this.context = o, this.locator = s, this.viewport = r, this.fromSpineItemPageIndex = (a, c) => this.value.pages.find(
5573
- (u) => u.itemIndex === a.index && u.pageIndex === c
5574
- ), this.layout$ = t.layout$.pipe(
5575
- A(r),
5576
- P(([, { pageSize: a }]) => {
5592
+ class cs extends ht {
5593
+ constructor(t, i, n, o, s, a) {
5594
+ 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
+ (u) => u.itemIndex === r.index && u.pageIndex === c
5596
+ ), this.fromAbsolutePageIndex = (r) => this.value.pages.reduce((c, u) => c || (u.absolutePageIndex === r ? u : c), void 0), this.observeFromAbsolutePageIndex = (r) => this.pipe(S(() => this.fromAbsolutePageIndex(r))), this.layout$ = t.layout$.pipe(
5597
+ A(a),
5598
+ P(([, { pageSize: r }]) => {
5577
5599
  const c = i.items.reduce(
5578
5600
  (d, g, l) => {
5579
5601
  const p = new Array(g.numberOfPages).fill(void 0).map((m, y) => {
@@ -5585,17 +5607,17 @@ class us extends pt {
5585
5607
  spineItemPosition: f
5586
5608
  });
5587
5609
  return {
5588
- absoluteLayout: cs({
5589
- pageSize: a,
5610
+ absoluteLayout: as({
5611
+ pageSize: r,
5590
5612
  position: b
5591
5613
  }),
5592
- layout: new hn({
5614
+ layout: new pn({
5593
5615
  left: f.x,
5594
- right: f.x + a.width,
5616
+ right: f.x + r.width,
5595
5617
  top: f.y,
5596
- bottom: f.y + a.height,
5597
- width: a.width,
5598
- height: a.height,
5618
+ bottom: f.y + r.height,
5619
+ width: r.width,
5620
+ height: r.height,
5599
5621
  x: f.x,
5600
5622
  y: f.y
5601
5623
  }),
@@ -5617,7 +5639,7 @@ class us extends pt {
5617
5639
  const p = (y = d.spineItem.renderer) == null ? void 0 : y.getDocumentFrame();
5618
5640
  let m;
5619
5641
  p && ((f = p == null ? void 0 : p.contentWindow) != null && f.document) && // very important because it is being used by next functions
5620
- p.contentWindow.document.body !== null && (m = Ci(
5642
+ p.contentWindow.document.body !== null && (m = Mi(
5621
5643
  p.contentWindow.document,
5622
5644
  d.layout
5623
5645
  )), h.next({ ...l, firstVisibleNode: m });
@@ -5625,17 +5647,17 @@ class us extends pt {
5625
5647
  })
5626
5648
  );
5627
5649
  }),
5628
- S((a) => (as.info("Pages layout", a), { pages: a })),
5650
+ S((r) => (rs.info("Pages layout", r), { pages: r })),
5629
5651
  V()
5630
5652
  ), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
5631
5653
  }
5632
5654
  }
5633
- class ds extends X {
5655
+ class us extends X {
5634
5656
  constructor(t, i) {
5635
5657
  super(), this.spineItemsManager = t, this.spineLocator = i, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
5636
5658
  P((n) => {
5637
5659
  const o = n.map(
5638
- (s) => s.isReady$.pipe(S((r) => ({ item: s, isReady: r })))
5660
+ (s) => s.isReady$.pipe(S((a) => ({ item: s, isReady: a })))
5639
5661
  );
5640
5662
  return v(...o);
5641
5663
  }),
@@ -5644,7 +5666,7 @@ class ds extends X {
5644
5666
  P((n) => {
5645
5667
  const o = n.map(
5646
5668
  (s) => Kt(s.element).pipe(
5647
- S((r) => ({ entries: r, item: s }))
5669
+ S((a) => ({ entries: a, item: s }))
5648
5670
  )
5649
5671
  );
5650
5672
  return v(...o);
@@ -5660,25 +5682,25 @@ class ds extends X {
5660
5682
  );
5661
5683
  }
5662
5684
  }
5663
- const gs = ({
5685
+ const ds = ({
5664
5686
  horizontalOffset: e,
5665
5687
  verticalOffset: t,
5666
5688
  context: i,
5667
5689
  spineItemsManager: n,
5668
5690
  isGloballyPrePaginated: o,
5669
5691
  settings: s,
5670
- index: r,
5671
- item: a,
5692
+ index: a,
5693
+ item: r,
5672
5694
  viewport: c
5673
5695
  }) => {
5674
5696
  let u = i.getPageSize().width, d = "none";
5675
- const g = e % c.absoluteViewport.width === 0, l = r === n.items.length - 1;
5697
+ const g = e % c.absoluteViewport.width === 0, l = a === n.items.length - 1;
5676
5698
  if (i.state.isUsingSpreadMode) {
5677
- !o && a.renditionLayout === "reflowable" && !l && (u = i.getPageSize().width * 2), !o && a.renditionLayout === "reflowable" && l && g && (u = i.getPageSize().width * 2);
5699
+ !o && r.renditionLayout === "reflowable" && !l && (u = i.getPageSize().width * 2), !o && r.renditionLayout === "reflowable" && l && g && (u = i.getPageSize().width * 2);
5678
5700
  const p = g && l && o;
5679
- a.item.pageSpreadRight && g && !i.isRTL() || a.item.pageSpreadLeft && g && i.isRTL() ? (d = "before", u = i.getPageSize().width * 2) : p && (i.isRTL() ? d = "before" : d = "after", u = i.getPageSize().width * 2);
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);
5680
5702
  }
5681
- return a.layout.layout({
5703
+ return r.layout.layout({
5682
5704
  minimumWidth: u,
5683
5705
  blankPagePosition: d,
5684
5706
  spreadPosition: i.state.isUsingSpreadMode ? g ? i.isRTL() ? "right" : "left" : i.isRTL() ? "left" : "right" : "none"
@@ -5686,10 +5708,10 @@ const gs = ({
5686
5708
  S(({ width: p, height: m }) => {
5687
5709
  if (s.values.computedPageTurnDirection === "vertical") {
5688
5710
  const b = g ? t : t - i.state.visibleAreaRect.height, I = g ? 0 : e;
5689
- i.isRTL() ? a.layout.adjustPositionOfElement({
5711
+ i.isRTL() ? r.layout.adjustPositionOfElement({
5690
5712
  top: b,
5691
5713
  left: I
5692
- }) : a.layout.adjustPositionOfElement({
5714
+ }) : r.layout.adjustPositionOfElement({
5693
5715
  top: b,
5694
5716
  left: I
5695
5717
  });
@@ -5709,7 +5731,7 @@ const gs = ({
5709
5731
  layoutPosition: C
5710
5732
  };
5711
5733
  }
5712
- a.layout.adjustPositionOfElement(
5734
+ r.layout.adjustPositionOfElement(
5713
5735
  i.isRTL() ? { right: e, top: 0 } : { left: e, top: 0 }
5714
5736
  );
5715
5737
  const y = i.isRTL() ? c.absoluteViewport.width - e - p : e, f = new Ht({
@@ -5730,20 +5752,20 @@ const gs = ({
5730
5752
  })
5731
5753
  );
5732
5754
  };
5733
- class ls extends X {
5755
+ class gs extends X {
5734
5756
  constructor(t, i, n, o) {
5735
5757
  super(), this.spineItemsManager = t, this.context = i, this.settings = n, this.viewport = o, this.layoutSubject = new W(), this.spineItemsRelativeLayouts = [], t.items$.pipe(
5736
5758
  $(() => {
5737
5759
  this.spineItemsRelativeLayouts = [];
5738
5760
  }),
5739
- P((r) => {
5740
- const a = r.map(
5761
+ P((a) => {
5762
+ const r = a.map(
5741
5763
  (u) => u.needsLayout$.pipe(
5742
5764
  $(() => {
5743
5765
  this.layout();
5744
5766
  })
5745
5767
  )
5746
- ), c = r.map(
5768
+ ), c = a.map(
5747
5769
  (u) => u.loaded$.pipe(
5748
5770
  $(() => {
5749
5771
  u.isUsingVerticalWriting() ? this.context.update({
@@ -5754,7 +5776,7 @@ class ls extends X {
5754
5776
  })
5755
5777
  )
5756
5778
  );
5757
- return v(...a, ...c);
5779
+ return v(...r, ...c);
5758
5780
  })
5759
5781
  ).pipe(T(this.destroy$)).subscribe();
5760
5782
  const s = new U(!1);
@@ -5763,22 +5785,22 @@ class ls extends X {
5763
5785
  // queue layout until previous layout is done
5764
5786
  Wt(
5765
5787
  () => s.pipe(
5766
- M((r) => !r),
5788
+ M((a) => !a),
5767
5789
  z()
5768
5790
  )
5769
5791
  ),
5770
5792
  Wt(() => {
5771
5793
  s.next(!0);
5772
- const r = this.context.manifest, a = Ee(r) ?? !1;
5794
+ const a = this.context.manifest, r = Ee(a) ?? !1;
5773
5795
  return j(this.spineItemsManager.items).pipe(
5774
5796
  ai(
5775
5797
  (u, d, g) => u.pipe(
5776
5798
  oe(
5777
- ({ horizontalOffset: l, verticalOffset: h }) => gs({
5799
+ ({ horizontalOffset: l, verticalOffset: h }) => ds({
5778
5800
  context: this.context,
5779
5801
  horizontalOffset: l,
5780
5802
  index: g,
5781
- isGloballyPrePaginated: a,
5803
+ isGloballyPrePaginated: r,
5782
5804
  item: d,
5783
5805
  settings: this.settings,
5784
5806
  spineItemsManager: this.spineItemsManager,
@@ -5832,10 +5854,10 @@ class ls extends X {
5832
5854
  super.destroy(), this.layoutSubject.complete();
5833
5855
  }
5834
5856
  }
5835
- class ps extends X {
5857
+ class ls extends X {
5836
5858
  constructor(t, i, n, o, s) {
5837
5859
  super(), this.context = t, this.spineItemsManager = i, this.spineLocator = n, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new U([]);
5838
- const r = this.forcedOpenSubject.pipe(
5860
+ const a = this.forcedOpenSubject.pipe(
5839
5861
  S((u) => [...new Set(u.flat())].sort()),
5840
5862
  H(gi),
5841
5863
  tt({ bufferSize: 1, refCount: !0 })
@@ -5843,7 +5865,7 @@ class ps extends X {
5843
5865
  v(
5844
5866
  this.context.bridgeEvent.navigation$,
5845
5867
  this.spineLayout.layout$,
5846
- r,
5868
+ a,
5847
5869
  o.watch(["numberOfAdjacentSpineItemToPreLoad"])
5848
5870
  ).pipe(
5849
5871
  // this can be changed by whatever we want and SHOULD not break navigation.
@@ -5851,13 +5873,13 @@ class ps extends X {
5851
5873
  // be dangerous.
5852
5874
  St(100, rt),
5853
5875
  Ct(this.context.bridgeEvent.viewportFree$),
5854
- A(this.context.bridgeEvent.navigation$, r),
5876
+ A(this.context.bridgeEvent.navigation$, a),
5855
5877
  S(([, u, d]) => {
5856
5878
  const { numberOfAdjacentSpineItemToPreLoad: g } = o.values, { beginIndex: l = 0, endIndex: h = 0 } = n.getVisibleSpineItemsFromPosition({
5857
5879
  position: u.position,
5858
5880
  threshold: { type: "percentage", value: 0 },
5859
5881
  useAbsoluteViewport: !1
5860
- }) || {}, p = l - g, m = h + g, y = Array.from(
5882
+ }) || {}, p = g === 1 / 0 ? 0 : l - g, m = g === 1 / 0 ? i.items.length - 1 : h + g, y = Array.from(
5861
5883
  { length: m - p + 1 },
5862
5884
  (b, I) => p + I
5863
5885
  ), f = [...d, ...y];
@@ -5908,17 +5930,17 @@ class yt extends DOMRect {
5908
5930
  return new yt(n.x, n.y, n.width, n.height);
5909
5931
  }
5910
5932
  }
5911
- class hs {
5933
+ class ps {
5912
5934
  constructor({ width: t, height: i }) {
5913
5935
  this.__symbol = Symbol("AbsoluteViewport"), this.width = t, this.height = i;
5914
5936
  }
5915
5937
  }
5916
- class ms {
5938
+ class hs {
5917
5939
  constructor({ width: t, height: i }) {
5918
5940
  this.__symbol = Symbol("RelativeViewport"), this.width = t, this.height = i;
5919
5941
  }
5920
5942
  }
5921
- const fs = ({
5943
+ const ms = ({
5922
5944
  pageIndex: e,
5923
5945
  spineItemOrId: t,
5924
5946
  spineItemsManager: i
@@ -5926,30 +5948,30 @@ const fs = ({
5926
5948
  const n = i.items, o = i.get(t);
5927
5949
  if (!o) return;
5928
5950
  const { currentAbsolutePage: s } = n.reduce(
5929
- (r, a) => {
5930
- if (r.found) return r;
5931
- const c = a.numberOfPages;
5932
- return o === a && e <= c - 1 ? {
5933
- currentAbsolutePage: r.currentAbsolutePage + e,
5951
+ (a, r) => {
5952
+ if (a.found) return a;
5953
+ const c = r.numberOfPages;
5954
+ return o === r && e <= c - 1 ? {
5955
+ currentAbsolutePage: a.currentAbsolutePage + e,
5934
5956
  found: !0
5935
5957
  } : {
5936
- ...r,
5937
- currentAbsolutePage: r.currentAbsolutePage + c
5958
+ ...a,
5959
+ currentAbsolutePage: a.currentAbsolutePage + c
5938
5960
  };
5939
5961
  },
5940
5962
  { currentAbsolutePage: 0, found: !1 }
5941
5963
  );
5942
5964
  return s;
5943
- }, ys = ({
5965
+ }, fs = ({
5944
5966
  itemHeight: e,
5945
5967
  itemWidth: t,
5946
5968
  visibleWidthOfItem: i,
5947
5969
  visibleHeightOfItem: n,
5948
5970
  threshold: o
5949
5971
  }) => {
5950
- const s = i / t, r = n / e;
5951
- return o.type === "percentage" ? s >= o.value && r >= o.value : i >= o.value && n >= o.value;
5952
- }, Ss = ({
5972
+ const s = i / t, a = n / e;
5973
+ return o.type === "percentage" ? s >= o.value && a >= o.value : i >= o.value && n >= o.value;
5974
+ }, ys = ({
5953
5975
  visibleWidthOfItem: e,
5954
5976
  visibleHeightOfItem: t,
5955
5977
  threshold: i,
@@ -5966,12 +5988,12 @@ const fs = ({
5966
5988
  width: o,
5967
5989
  height: s
5968
5990
  },
5969
- threshold: r,
5970
- viewportPosition: a,
5991
+ threshold: a,
5992
+ viewportPosition: r,
5971
5993
  restrictToScreen: c
5972
5994
  }) => {
5973
- const u = a.x, d = a.x + (a.width - 1), g = a.y, l = Math.max(
5974
- a.y + (a.height - 1),
5995
+ const u = r.x, d = r.x + (r.width - 1), g = r.y, l = Math.max(
5996
+ r.y + (r.height - 1),
5975
5997
  0
5976
5998
  ), h = Math.max(
5977
5999
  0,
@@ -5981,54 +6003,28 @@ const fs = ({
5981
6003
  Math.min(e, l) - Math.max(n, g)
5982
6004
  );
5983
6005
  if (h <= 0 || p <= 0) return { visible: !1 };
5984
- const y = Ss({
5985
- threshold: r,
6006
+ const y = ys({
6007
+ threshold: a,
5986
6008
  visibleHeightOfItem: p,
5987
6009
  visibleWidthOfItem: h,
5988
- viewportPosition: a
6010
+ viewportPosition: r
5989
6011
  });
5990
6012
  return c ? { visible: y } : {
5991
- visible: ys({
6013
+ visible: fs({
5992
6014
  itemHeight: s,
5993
6015
  itemWidth: o,
5994
- threshold: r,
6016
+ threshold: a,
5995
6017
  visibleHeightOfItem: p,
5996
6018
  visibleWidthOfItem: h
5997
6019
  }) || y
5998
6020
  };
5999
- }, bs = ({
6000
- absolutePageIndex: e,
6001
- spineItemsManager: t
6002
- }) => {
6003
- const i = t.items, { found: n, currentAbsolutePage: o } = i.reduce(
6004
- (s, r) => {
6005
- if (s.found) return s;
6006
- const a = r.numberOfPages, c = e - s.currentAbsolutePage, u = s.currentAbsolutePage + a;
6007
- return c <= a - 1 ? {
6008
- ...s,
6009
- currentAbsolutePage: u,
6010
- found: { item: r, pageIndex: c }
6011
- } : {
6012
- ...s,
6013
- currentAbsolutePage: u
6014
- };
6015
- },
6016
- { currentAbsolutePage: 0 }
6017
- );
6018
- if (n)
6019
- return {
6020
- spineItem: n.item,
6021
- pageIndex: n.pageIndex,
6022
- itemIndex: t.getSpineItemIndex(n.item) ?? 0,
6023
- currentAbsolutePage: o
6024
- };
6025
6021
  }, Yt = ({
6026
6022
  position: e,
6027
6023
  spineItemsManager: t,
6028
6024
  spineLayout: i
6029
6025
  }) => {
6030
6026
  const n = t.items.find((o) => {
6031
- const { left: s, right: r, bottom: a, top: c } = i.getSpineItemSpineLayoutInfo(o), u = e.x >= s && e.x < r, d = e.y >= c && e.y < a;
6027
+ const { left: s, right: a, bottom: r, top: c } = i.getSpineItemSpineLayoutInfo(o), u = e.x >= s && e.x < a, d = e.y >= c && e.y < r;
6032
6028
  return u && d;
6033
6029
  });
6034
6030
  return e.x === 0 && !n ? t.items[0] : n;
@@ -6038,24 +6034,24 @@ const fs = ({
6038
6034
  }) => new L({
6039
6035
  x: t + e.x,
6040
6036
  y: i + e.y
6041
- }), Is = ({
6037
+ }), Ss = ({
6042
6038
  position: e,
6043
6039
  threshold: t,
6044
6040
  restrictToScreen: i,
6045
6041
  spineItemsManager: n,
6046
6042
  spineLayout: o,
6047
6043
  useAbsoluteViewport: s = !0,
6048
- viewport: r
6044
+ viewport: a
6049
6045
  }) => {
6050
- const a = Yt({
6046
+ const r = Yt({
6051
6047
  position: e,
6052
6048
  spineItemsManager: n,
6053
6049
  spineLayout: o
6054
6050
  }) || n.get(0), c = n.items.reduce(
6055
6051
  (h, p) => {
6056
- const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f = Ge(
6052
+ const m = o.getSpineItemSpineLayoutInfo(p), y = s ? a.absoluteViewport : a.relativeViewport, f = Ge(
6057
6053
  e,
6058
- r.absoluteViewport,
6054
+ a.absoluteViewport,
6059
6055
  y
6060
6056
  ), b = yt.from(
6061
6057
  f,
@@ -6069,14 +6065,14 @@ const fs = ({
6069
6065
  return I ? [...h, p] : h;
6070
6066
  },
6071
6067
  []
6072
- ), u = c[0] ?? a, d = c[c.length - 1] ?? u;
6068
+ ), u = c[0] ?? r, d = c[c.length - 1] ?? u;
6073
6069
  if (!u || !d) return;
6074
6070
  const g = n.getSpineItemIndex(u), l = n.getSpineItemIndex(d);
6075
6071
  return {
6076
6072
  beginIndex: g ?? 0,
6077
6073
  endIndex: l ?? 0
6078
6074
  };
6079
- }, ws = ({
6075
+ }, bs = ({
6080
6076
  spineItemsManager: e,
6081
6077
  context: t,
6082
6078
  spineItemLocator: i,
@@ -6084,7 +6080,7 @@ const fs = ({
6084
6080
  spineLayout: o,
6085
6081
  viewport: s
6086
6082
  }) => {
6087
- const r = (p, m) => {
6083
+ const a = (p, m) => {
6088
6084
  const { left: y, top: f } = o.getSpineItemSpineLayoutInfo(m);
6089
6085
  return new R({
6090
6086
  /**
@@ -6097,7 +6093,7 @@ const fs = ({
6097
6093
  x: Math.max(p.x - y, 0),
6098
6094
  y: Math.max(p.y - f, 0)
6099
6095
  });
6100
- }, a = (p) => jt({
6096
+ }, r = (p) => jt({
6101
6097
  spineItemPosition: new R({ x: 0, y: 0 }),
6102
6098
  itemLayout: o.getSpineItemSpineLayoutInfo(p)
6103
6099
  }), c = (p) => e.items.find((m) => m.renderer.getDocumentFrame() === p), u = (p, m, y) => {
@@ -6180,11 +6176,7 @@ const fs = ({
6180
6176
  /**
6181
6177
  * @deprecated use Pages
6182
6178
  */
6183
- _getAbsolutePageIndexFromPageIndex: (p) => fs({
6184
- ...p,
6185
- spineItemsManager: e
6186
- }),
6187
- getSpineInfoFromAbsolutePageIndex: (p) => bs({
6179
+ _getAbsolutePageIndexFromPageIndex: (p) => ms({
6188
6180
  ...p,
6189
6181
  spineItemsManager: e
6190
6182
  }),
@@ -6196,7 +6188,7 @@ const fs = ({
6196
6188
  });
6197
6189
  if (!m)
6198
6190
  return;
6199
- const y = r(
6191
+ const y = a(
6200
6192
  p,
6201
6193
  m
6202
6194
  ), f = i.getSpineItemPageIndexFromPosition({
@@ -6216,8 +6208,8 @@ const fs = ({
6216
6208
  pageSize: s.value.pageSize
6217
6209
  };
6218
6210
  },
6219
- getSpinePositionFromSpineItem: a,
6220
- getSpineItemPositionFromSpinePosition: r,
6211
+ getSpinePositionFromSpineItem: r,
6212
+ getSpineItemPositionFromSpinePosition: a,
6221
6213
  getSpineItemFromPosition: (p) => Yt({
6222
6214
  position: p,
6223
6215
  spineItemsManager: e,
@@ -6225,7 +6217,7 @@ const fs = ({
6225
6217
  }),
6226
6218
  getSpineItemFromIframe: c,
6227
6219
  getSpineItemPageIndexFromNode: u,
6228
- getVisibleSpineItemsFromPosition: (p) => Is({
6220
+ getVisibleSpineItemsFromPosition: (p) => Ss({
6229
6221
  spineItemsManager: e,
6230
6222
  spineLayout: o,
6231
6223
  viewport: s,
@@ -6249,32 +6241,32 @@ const fs = ({
6249
6241
  }
6250
6242
  };
6251
6243
  };
6252
- class Ps extends X {
6253
- constructor(t, i, n, o, s, r, a, c) {
6254
- super(), this.parentElement$ = t, this.context = i, this.pagination = n, this.spineItemsManager = o, this.spineItemLocator = s, this.settings = r, this.hookManager = a, this.viewport = c, this.elementSubject = new U(
6244
+ class Is extends X {
6245
+ 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(
6255
6247
  void 0
6256
- ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new ls(
6248
+ ), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new gs(
6257
6249
  o,
6258
6250
  i,
6259
- r,
6251
+ a,
6260
6252
  c
6261
- ), this.locator = ws({
6253
+ ), this.locator = bs({
6262
6254
  context: i,
6263
6255
  spineItemsManager: o,
6264
6256
  spineItemLocator: s,
6265
- settings: r,
6257
+ settings: a,
6266
6258
  spineLayout: this.spineLayout,
6267
6259
  viewport: c
6268
- }), this.spineItemsLoader = new ps(
6260
+ }), this.spineItemsLoader = new ls(
6269
6261
  this.context,
6270
6262
  o,
6271
6263
  this.locator,
6272
- r,
6264
+ a,
6273
6265
  this.spineLayout
6274
- ), this.spineItemsObserver = new ds(
6266
+ ), this.spineItemsObserver = new us(
6275
6267
  o,
6276
6268
  this.locator
6277
- ), this.pages = new us(
6269
+ ), this.pages = new cs(
6278
6270
  this.spineLayout,
6279
6271
  this.spineItemsManager,
6280
6272
  this.spineItemLocator,
@@ -6289,7 +6281,7 @@ class Ps extends X {
6289
6281
  l.style.cssText = `
6290
6282
  height: 100%;
6291
6283
  position: relative;
6292
- `, l.className = `${lt}-spine`, this.elementSubject.next(l);
6284
+ `, l.className = `${pt}-spine`, this.elementSubject.next(l);
6293
6285
  })
6294
6286
  ), d = B([
6295
6287
  this.context.manifest$,
@@ -6330,7 +6322,7 @@ class Ps extends X {
6330
6322
  super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), (t = this.elementSubject.getValue()) == null || t.remove(), this.elementSubject.complete();
6331
6323
  }
6332
6324
  }
6333
- class vs extends X {
6325
+ class ws extends X {
6334
6326
  constructor(t, i) {
6335
6327
  super(), this.context = t, this.settings = i, this.orderedSpineItemsSubject = new U([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6336
6328
  }
@@ -6371,7 +6363,7 @@ class vs extends X {
6371
6363
  this.orderedSpineItemsSubject.value.forEach((t) => t.destroy());
6372
6364
  }
6373
6365
  }
6374
- class xs extends pt {
6366
+ class Ps extends ht {
6375
6367
  constructor(t) {
6376
6368
  const i = document.createElement("div");
6377
6369
  i.style.cssText = `
@@ -6380,7 +6372,7 @@ class xs extends pt {
6380
6372
  -transform: scale(0.2);
6381
6373
  height: 100%;
6382
6374
  width: 100%;
6383
- `, i.className = `${lt}-viewport`, super({
6375
+ `, i.className = `${pt}-viewport`, super({
6384
6376
  element: i,
6385
6377
  pageSize: {
6386
6378
  width: 1,
@@ -6405,7 +6397,7 @@ class xs extends pt {
6405
6397
  }
6406
6398
  get absoluteViewport() {
6407
6399
  const t = this.context.state.visibleAreaRect;
6408
- return new hs({
6400
+ return new ps({
6409
6401
  width: t.width,
6410
6402
  height: t.height
6411
6403
  });
@@ -6426,36 +6418,36 @@ class xs extends pt {
6426
6418
  */
6427
6419
  get relativeViewport() {
6428
6420
  const t = this.absoluteViewport, i = this.value.element.getBoundingClientRect(), n = ((i == null ? void 0 : i.width) ?? t.width) / t.width;
6429
- return new ms({
6421
+ return new hs({
6430
6422
  width: t.width / n,
6431
6423
  height: t.height / n
6432
6424
  });
6433
6425
  }
6434
6426
  }
6435
- const $s = (e) => {
6436
- const t = new W(), i = new Io(), n = new So(), o = new ns(e, n), s = new bo(n, o), r = new vs(n, o), a = new xs(n), c = n.watch("rootElement"), u = qe({
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({
6437
6429
  context: n,
6438
6430
  settings: o
6439
- }), d = new ts(n, r), g = new Ps(
6431
+ }), d = new Qo(n, a), g = new Is(
6440
6432
  c,
6441
6433
  n,
6442
6434
  d,
6443
- r,
6435
+ a,
6444
6436
  u,
6445
6437
  o,
6446
6438
  i,
6447
- a
6448
- ), l = Qo({
6439
+ r
6440
+ ), l = Ko({
6449
6441
  context: n,
6450
- spineItemsManager: r,
6442
+ spineItemsManager: a,
6451
6443
  hookManager: i,
6452
6444
  spine: g,
6453
6445
  settings: o,
6454
- viewport: a
6455
- }), h = new es(
6446
+ viewport: r
6447
+ }), h = new ts(
6456
6448
  n,
6457
6449
  d,
6458
- r,
6450
+ a,
6459
6451
  g,
6460
6452
  u
6461
6453
  );
@@ -6486,31 +6478,31 @@ const $s = (e) => {
6486
6478
  return;
6487
6479
  }
6488
6480
  O.log("load", { options: f });
6489
- const x = Ts(b);
6481
+ const x = xs(b);
6490
6482
  n.update({
6491
6483
  manifest: I,
6492
6484
  rootElement: x,
6493
6485
  forceSinglePageMode: o.values.forceSinglePageMode
6494
6486
  }), p();
6495
6487
  }, y = () => {
6496
- r.destroy(), h.destroy(), o.destroy(), d.destroy(), n.destroy(), l.destroy(), g.destroy(), s.destroy(), t.next(), t.complete(), a.destroy();
6488
+ a.destroy(), h.destroy(), o.destroy(), d.destroy(), n.destroy(), l.destroy(), g.destroy(), s.destroy(), t.next(), t.complete(), r.destroy();
6497
6489
  };
6498
6490
  return {
6499
6491
  context: n,
6500
6492
  spine: g,
6501
6493
  hookManager: i,
6502
6494
  cfi: {
6503
- generateCfiFromRange: Wn,
6495
+ generateCfiFromRange: kn,
6504
6496
  parseCfi: ee,
6505
6497
  generateCfiForSpineItemPage: (f) => Bt({
6506
6498
  ...f,
6507
6499
  spine: g
6508
6500
  }),
6509
- resolveCfi: (f) => ze({ ...f, spineItemsManager: r })
6501
+ resolveCfi: (f) => ze({ ...f, spineItemsManager: a })
6510
6502
  },
6511
6503
  navigation: l,
6512
6504
  spineItemsObserver: g.spineItemsObserver,
6513
- spineItemsManager: r,
6505
+ spineItemsManager: a,
6514
6506
  layout: p,
6515
6507
  load: m,
6516
6508
  destroy: y,
@@ -6523,7 +6515,7 @@ const $s = (e) => {
6523
6515
  }
6524
6516
  },
6525
6517
  settings: o,
6526
- viewport: a,
6518
+ viewport: r,
6527
6519
  element$: c,
6528
6520
  viewportState$: n.bridgeEvent.viewportState$,
6529
6521
  viewportFree$: n.bridgeEvent.viewportFree$,
@@ -6541,31 +6533,31 @@ const $s = (e) => {
6541
6533
  destroy$: t
6542
6534
  }
6543
6535
  };
6544
- }, Ts = (e) => (e.style.cssText = `
6536
+ }, xs = (e) => (e.style.cssText = `
6545
6537
  ${e.style.cssText}
6546
6538
  background-color: white;
6547
6539
  position: relative;
6548
- `, e.classList.add(`${lt}-reader`), e), Vs = (
6540
+ `, e.classList.add(`${pt}-reader`), e), Os = (
6549
6541
  //__
6550
- co(
6551
- _i(
6552
- Tn(
6553
- lo(
6554
- Ei(
6555
- $i(
6556
- no(
6557
- go(
6558
- mo(
6559
- kn(
6560
- ln(
6561
- Ln(
6562
- Ti(
6563
- uo(
6564
- to(
6565
- Pn(
6566
- zi(
6542
+ ao(
6543
+ Ei(
6544
+ $n(
6545
+ go(
6546
+ 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(
6567
6559
  // __
6568
- $s
6560
+ vs
6569
6561
  )
6570
6562
  )
6571
6563
  )
@@ -6583,68 +6575,68 @@ const $s = (e) => {
6583
6575
  )
6584
6576
  )
6585
6577
  )
6586
- ), js = (e) => (t) => e(t);
6578
+ ), Vs = (e) => (t) => e(t);
6587
6579
  export {
6588
6580
  ke as AbstractSpinePosition,
6589
- So as Context,
6590
- Uo as ControlledNavigationController,
6581
+ yo as Context,
6582
+ Wo as ControlledNavigationController,
6591
6583
  X as DestroyableClass,
6592
- mt as DocumentRenderer,
6593
- bo as Features,
6594
- Io as HookManager,
6595
- No as InternalNavigator,
6584
+ ft as DocumentRenderer,
6585
+ So as Features,
6586
+ bo as HookManager,
6587
+ Do as InternalNavigator,
6596
6588
  te as LayoutEntry,
6597
6589
  _e as Locker,
6598
- us as Pages,
6599
- ts as Pagination,
6600
- es as PaginationController,
6590
+ cs as Pages,
6591
+ Qo as Pagination,
6592
+ ts as PaginationController,
6601
6593
  Qt as ResourceHandler,
6602
- Bn as ResourcesLocator,
6603
- zo as ScrollNavigationController,
6604
- is as SettingsManager,
6605
- Ps as Spine,
6594
+ Hn as ResourcesLocator,
6595
+ Uo as ScrollNavigationController,
6596
+ es as SettingsManager,
6597
+ Is as Spine,
6606
6598
  Ze as SpineItem,
6607
- hn as SpineItemPageLayout,
6608
- mn as SpineItemPageSpineLayout,
6599
+ pn as SpineItemPageLayout,
6600
+ hn as SpineItemPageSpineLayout,
6609
6601
  R as SpineItemPosition,
6610
6602
  Ht as SpineItemSpineLayout,
6611
- vs as SpineItemsManager,
6612
- ds as SpineItemsObserver,
6603
+ ws as SpineItemsManager,
6604
+ us as SpineItemsObserver,
6613
6605
  L as SpinePosition,
6614
6606
  Nt as UnsafeSpineItemPagePosition,
6615
6607
  Rt as UnsafeSpinePosition,
6616
- xs as Viewport,
6617
- Hn as consolidate,
6618
- Vs as createReader,
6608
+ Ps as Viewport,
6609
+ zn as consolidate,
6610
+ Os as createReader,
6619
6611
  ae as deferIdle,
6620
- Hi as deferNextResult,
6612
+ zi as deferNextResult,
6621
6613
  Bt as generateCfiForSpineItemPage,
6622
- Wn as generateCfiFromRange,
6623
- ft as generateRootCfi,
6614
+ kn as generateCfiFromRange,
6615
+ lt as generateRootCfi,
6624
6616
  re as getAttributeValueFromString,
6625
6617
  Zt as getFrameViewportInfo,
6626
- Os as getItemAnchor,
6627
- ln as htmlEnhancer,
6618
+ Ns as getItemAnchor,
6619
+ gn as htmlEnhancer,
6628
6620
  De as idle,
6629
6621
  wi as injectCSS,
6630
6622
  Re as isHtmlElement,
6631
- Vi as isHtmlTagElement,
6623
+ Oi as isHtmlTagElement,
6632
6624
  Et as isRootCfi,
6633
- Us as isShallowEqual,
6634
- Pn as layoutEnhancer,
6625
+ Ws as isShallowEqual,
6626
+ wn as layoutEnhancer,
6635
6627
  Ae as mapKeysTo,
6636
- As as observeIntersection,
6628
+ Rs as observeIntersection,
6637
6629
  ce as observeMutation,
6638
6630
  Kt as observeResize,
6639
- to as paginationEnhancer,
6631
+ Qn as paginationEnhancer,
6640
6632
  ee as parseCfi,
6641
- Pi as removeCSS,
6633
+ Cs as removeCSS,
6642
6634
  ze as resolveCfi,
6643
- js as rootEnhancer,
6644
- cs as spinePositionToSpineItemSpineLayout,
6635
+ Vs as rootEnhancer,
6636
+ as as spinePositionToSpineItemSpineLayout,
6645
6637
  nt as upsertCSSToFrame,
6646
- vi as waitForFrameLoad,
6647
- xi as waitForFrameReady,
6638
+ Pi as waitForFrameLoad,
6639
+ vi as waitForFrameReady,
6648
6640
  Ct as waitForSwitch,
6649
6641
  Jt as watchKeys
6650
6642
  };