@prose-reader/core 1.214.0 → 1.215.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,32 +1,32 @@
1
- import { switchMap as v, of as w, fromEvent as G, take as pe, map as b, from as W, takeUntil as F, Observable as st, defer as Nt, Subject as U, combineLatest as q, merge as x, EMPTY as K, withLatestFrom as D, NEVER as gt, tap as T, share as V, BehaviorSubject as k, filter as R, first as H, mergeMap as $t, endWith as pt, finalize as ut, catchError as he, lastValueFrom as qe, scheduled as Ye, animationFrameScheduler as at, shareReplay as et, distinctUntilChanged as E, throttleTime as Ze, debounceTime as St, startWith as nt, switchScan as Ge, forkJoin as Je, delay as wt, ReplaySubject as Gt, skip as me, identity as Pt, exhaustMap as Vt, timer as Jt, reduce as Ke, concatMap as Kt } from "rxjs";
2
- import { Report as Qe, isShallowEqual as N, shallowMergeIfDefined as vt, getParentPath as ti, parseContentType as ei, detectMimeTypeFromName as Lt, arrayEqual as ii } from "@prose-reader/shared";
3
- import { isShallowEqual as Ts } from "@prose-reader/shared";
4
- import { switchMap as _, first as fe, map as X, distinctUntilChanged as Z, startWith as ye, shareReplay as Mt, tap as z, pairwise as ni, take as oi, takeUntil as J, filter as tt, debounceTime as si, skip as ri, mergeMap as ai, catchError as Qt, withLatestFrom as ci } from "rxjs/operators";
5
- import { serialize as ui, generate as di, parse as Se, resolveExtensions as gi, isParsedCfiRange as li, resolve as pi } from "@prose-reader/cfi";
6
- const te = (e, t) => {
1
+ import { switchMap as v, of as w, fromEvent as G, take as me, map as b, from as W, takeUntil as F, Observable as st, defer as Nt, Subject as U, combineLatest as q, merge as x, EMPTY as K, withLatestFrom as D, NEVER as gt, tap as T, share as V, BehaviorSubject as k, filter as R, first as H, mergeMap as $t, endWith as pt, finalize as ut, catchError as fe, lastValueFrom as Ye, scheduled as Ze, animationFrameScheduler as at, shareReplay as et, distinctUntilChanged as E, throttleTime as Ge, debounceTime as St, startWith as nt, switchScan as Je, forkJoin as Ke, delay as wt, ReplaySubject as Kt, skip as ye, identity as Pt, exhaustMap as Vt, timer as Qt, reduce as Qe, concatMap as te } from "rxjs";
2
+ import { Report as ti, isShallowEqual as N, shallowMergeIfDefined as vt, getParentPath as ei, parseContentType as ii, detectMimeTypeFromName as Lt, arrayEqual as ni } from "@prose-reader/shared";
3
+ import { isShallowEqual as $s } from "@prose-reader/shared";
4
+ import { switchMap as _, first as Se, map as X, distinctUntilChanged as Z, startWith as be, shareReplay as Mt, tap as z, pairwise as oi, take as si, takeUntil as J, filter as tt, debounceTime as ri, skip as ai, mergeMap as ci, catchError as ee, withLatestFrom as ui } from "rxjs/operators";
5
+ import { generate as Ie, parse as we, isParsedCfiRange as di, resolve as gi } from "@prose-reader/cfi";
6
+ const ie = (e, t) => {
7
7
  const i = new RegExp(`${t}\\s*=\\s*([0-9.]+)`, "i"), n = e.match(i) || [], o = n[1] || "0";
8
8
  return n && Number.parseFloat(o) || 0;
9
- }, hi = (e, t, i, n) => {
9
+ }, li = (e, t, i, n) => {
10
10
  var o;
11
11
  if ((o = e == null ? void 0 : e.contentDocument) != null && o.head) {
12
12
  const s = e.contentDocument.createElement("style");
13
13
  s.id = t, s.innerHTML = i, n ? e.contentDocument.head.prepend(s) : e.contentDocument.head.appendChild(s);
14
14
  }
15
- }, mi = (e, t) => {
15
+ }, pi = (e, t) => {
16
16
  var i;
17
17
  if ((i = e == null ? void 0 : e.contentDocument) != null && i.head) {
18
18
  const n = e.contentDocument.getElementById(t);
19
19
  n && n.remove();
20
20
  }
21
21
  }, ot = (e, t, i, n) => {
22
- e && (mi(e, t), hi(e, t, i, n));
23
- }, Bt = (e) => {
22
+ e && (pi(e, t), li(e, t, i, n));
23
+ }, _t = (e) => {
24
24
  if (e != null && e.contentDocument) {
25
25
  const i = e.contentDocument.querySelector("meta[name='viewport']");
26
26
  if (i) {
27
27
  const n = i.getAttribute("content");
28
28
  if (n) {
29
- const o = te(n, "width"), s = te(n, "height");
29
+ const o = ie(n, "width"), s = ie(n, "height");
30
30
  return o > 0 && s > 0 ? {
31
31
  hasViewport: !0,
32
32
  width: o,
@@ -36,15 +36,15 @@ const te = (e, t) => {
36
36
  }
37
37
  }
38
38
  return { hasViewport: !1 };
39
- }, fi = (e) => e.pipe(
39
+ }, hi = (e) => e.pipe(
40
40
  v((t) => {
41
41
  var i;
42
42
  return t.src === "about:blank" && ((i = t.contentDocument) == null ? void 0 : i.readyState) === "complete" && t.contentDocument.body ? w(t) : G(t, "load").pipe(
43
- pe(1),
43
+ me(1),
44
44
  b(() => t)
45
45
  );
46
46
  })
47
- ), yi = (e) => e.pipe(
47
+ ), mi = (e) => e.pipe(
48
48
  v(
49
49
  (t) => {
50
50
  var i;
@@ -53,7 +53,7 @@ const te = (e, t) => {
53
53
  );
54
54
  }
55
55
  )
56
- ), Si = (e) => (t) => {
56
+ ), fi = (e) => (t) => {
57
57
  const i = e(t), n = new IntersectionObserver((o) => {
58
58
  o.forEach((s) => {
59
59
  s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
@@ -89,7 +89,7 @@ const te = (e, t) => {
89
89
  ), {
90
90
  ...i
91
91
  };
92
- }, bi = (e) => (t) => {
92
+ }, yi = (e) => (t) => {
93
93
  const i = e(t);
94
94
  return i.context.state$.pipe(F(i.$.destroy$)).subscribe(({ containerElement: n }) => {
95
95
  if (!n) return;
@@ -102,7 +102,7 @@ const te = (e, t) => {
102
102
  const o = i.spineItemsManager.get(n), s = o == null ? void 0 : o.renderer.getDocumentFrame();
103
103
  s && ((r = s.contentDocument) == null || r.body.setAttribute("tabindex", "-1"));
104
104
  }), i;
105
- }, Ii = "@prose-reader/core", j = Qe.namespace(Ii), wi = [
105
+ }, Si = "@prose-reader/core", j = ti.namespace(Si), bi = [
106
106
  "pointercancel",
107
107
  "pointerdown",
108
108
  "pointerenter",
@@ -113,25 +113,25 @@ const te = (e, t) => {
113
113
  "pointerup"
114
114
  // `touchstart` as const,
115
115
  // `touchend` as const,
116
- ], be = (e) => typeof e == "object" && !!e && "nodeType" in e && (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE;
117
- function Pi(e, t, i) {
116
+ ], Pe = (e) => typeof e == "object" && !!e && "nodeType" in e && (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE;
117
+ function Ii(e, t, i) {
118
118
  if ("caretPositionFromPoint" in e)
119
119
  return e.caretPositionFromPoint(t, i);
120
120
  if ("caretRangeFromPoint" in e && // @ts-expect-error limited availability
121
121
  typeof e.caretRangeFromPoint < "u")
122
122
  return e.caretRangeFromPoint(t, i);
123
123
  }
124
- const vi = (e, t) => {
124
+ const wi = (e, t) => {
125
125
  const i = "body" in e ? jt(e.body, t) : jt(e, t), n = "createRange" in e ? e : e.ownerDocument;
126
126
  if (i) {
127
127
  let o, s = 0;
128
128
  const r = n.createRange();
129
129
  return Array.from(i.childNodes).some((a) => {
130
130
  r.selectNodeContents(a);
131
- const c = r.getClientRects(), u = xi(c, t);
131
+ const c = r.getClientRects(), u = Pi(c, t);
132
132
  if (u) {
133
133
  o = r.cloneRange();
134
- const d = Pi(
134
+ const d = Ii(
135
135
  n,
136
136
  Math.ceil(u.left),
137
137
  Math.ceil(u.top)
@@ -143,7 +143,7 @@ const vi = (e, t) => {
143
143
  }
144
144
  }, jt = (e, t) => {
145
145
  let i;
146
- const n = Ie(
146
+ const n = ve(
147
147
  e.getBoundingClientRect(),
148
148
  t
149
149
  );
@@ -152,16 +152,16 @@ const vi = (e, t) => {
152
152
  return s ? (i = s, !0) : !1;
153
153
  }), i;
154
154
  };
155
- function Ie(e, { left: t, right: i }) {
155
+ function ve(e, { left: t, right: i }) {
156
156
  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";
157
157
  }
158
- function xi(e, t) {
158
+ function Pi(e, t) {
159
159
  return Array.from(e).find((i) => {
160
- const n = Ie(i, t);
160
+ const n = ve(i, t);
161
161
  return n !== "before" && n !== "after";
162
162
  });
163
163
  }
164
- const $i = (e, t) => {
164
+ const vi = (e, t) => {
165
165
  var i;
166
166
  if (e.nodeType !== Node.CDATA_SECTION_NODE && e.nodeType !== Node.DOCUMENT_TYPE_NODE) {
167
167
  const n = (i = e.ownerDocument) == null ? void 0 : i.createRange();
@@ -173,7 +173,7 @@ const $i = (e, t) => {
173
173
  }
174
174
  return n;
175
175
  }
176
- }, _t = (e) => {
176
+ }, Xt = (e) => {
177
177
  var t, i, n, o, s;
178
178
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
179
179
  const r = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
@@ -185,10 +185,10 @@ const $i = (e, t) => {
185
185
  if (r.PointerEvent && e instanceof r.PointerEvent)
186
186
  return !0;
187
187
  }
188
- return !!wi.includes(e.type);
189
- }, Ti = (e) => {
188
+ return !!bi.includes(e.type);
189
+ }, xi = (e) => {
190
190
  var t, i, n, o, s;
191
- if (_t(e)) return !1;
191
+ if (Xt(e)) return !1;
192
192
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
193
193
  const r = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
194
194
  if (r.MouseEvent)
@@ -200,7 +200,7 @@ const $i = (e, t) => {
200
200
  return e instanceof r.MouseEvent;
201
201
  }
202
202
  return !1;
203
- }, Fi = (e) => {
203
+ }, $i = (e) => {
204
204
  var t, i, n, o, s;
205
205
  if (e != null && e.target && ((i = (t = e == null ? void 0 : e.target) == null ? void 0 : t.ownerDocument) != null && i.defaultView)) {
206
206
  const r = (o = (n = e == null ? void 0 : e.target) == null ? void 0 : n.ownerDocument) == null ? void 0 : o.defaultView;
@@ -213,7 +213,7 @@ const $i = (e, t) => {
213
213
  return e instanceof r.TouchEvent;
214
214
  }
215
215
  return !1;
216
- }, Li = () => document.createElement("div"), we = (e) => {
216
+ }, Ti = () => document.createElement("div"), xe = (e) => {
217
217
  const t = [
218
218
  "img",
219
219
  // Images
@@ -229,8 +229,8 @@ const $i = (e, t) => {
229
229
  // JavaScript files
230
230
  ].join(",");
231
231
  return Array.from((e == null ? void 0 : e.querySelectorAll(t)) || []);
232
- }, Mi = (e) => {
233
- if (we(e).forEach((i) => {
232
+ }, Fi = (e) => {
233
+ if (xe(e).forEach((i) => {
234
234
  var o;
235
235
  const n = i.getAttribute("src") || i.getAttribute("href");
236
236
  n != null && n.startsWith("blob:") && ((o = e == null ? void 0 : e.defaultView) == null || o.URL.revokeObjectURL(n));
@@ -249,8 +249,8 @@ const $i = (e, t) => {
249
249
  }
250
250
  }
251
251
  };
252
- function Ci(e, t) {
253
- return be(e) && e.tagName.toLowerCase() === t.toLowerCase();
252
+ function Li(e, t) {
253
+ return Pe(e) && e.tagName.toLowerCase() === t.toLowerCase();
254
254
  }
255
255
  const Rt = ({
256
256
  position: e,
@@ -261,13 +261,13 @@ const Rt = ({
261
261
  clientX: a,
262
262
  clientY: c
263
263
  };
264
- }, Ri = (e, t, i, n) => {
264
+ }, Mi = (e, t, i, n) => {
265
265
  var u;
266
266
  const o = (u = t == null ? void 0 : t.view) == null ? void 0 : u.frameElement;
267
267
  if (!t || !o) return e;
268
268
  const s = i.getSpineItemFromIframe(o), r = o, { height: a, width: c } = n.getPageSize();
269
269
  if (!s || !(r instanceof HTMLIFrameElement)) return e;
270
- if (_t(e)) {
270
+ if (Xt(e)) {
271
271
  const { clientX: d, clientY: g } = Rt({
272
272
  position: e,
273
273
  frameElement: r
@@ -282,7 +282,7 @@ const Rt = ({
282
282
  enumerable: !0
283
283
  }), l;
284
284
  }
285
- if (Ti(e)) {
285
+ if (xi(e)) {
286
286
  const { clientX: d, clientY: g } = Rt({
287
287
  position: e,
288
288
  frameElement: r
@@ -296,7 +296,7 @@ const Rt = ({
296
296
  enumerable: !0
297
297
  }), l;
298
298
  }
299
- if (Fi(e)) {
299
+ if ($i(e)) {
300
300
  const d = Array.from(e.touches).map((l) => {
301
301
  const { clientX: p, clientY: h } = Rt({
302
302
  position: l,
@@ -319,7 +319,7 @@ const Rt = ({
319
319
  }), g;
320
320
  }
321
321
  return e;
322
- }, Ai = [
322
+ }, Ci = [
323
323
  "pointercancel",
324
324
  "pointerdown",
325
325
  "pointerenter",
@@ -328,23 +328,23 @@ const Rt = ({
328
328
  "pointerout",
329
329
  "pointerover",
330
330
  "pointerup"
331
- ], Oi = [
332
- ...Ai
331
+ ], Ri = [
332
+ ...Ci
333
333
  /*, ...mouseEvents*/
334
- ], Di = (e) => (t) => {
334
+ ], Ai = (e) => (t) => {
335
335
  const i = e(t);
336
336
  return i.hookManager.register(
337
337
  "item.onDocumentLoad",
338
338
  ({ destroy: n, itemId: o }) => {
339
339
  const s = i.spineItemsManager.get(o), r = s == null ? void 0 : s.renderer.getDocumentFrame();
340
340
  if (!r || !s) return;
341
- const a = Oi.map((c) => {
341
+ const a = Ri.map((c) => {
342
342
  var d;
343
343
  const u = (g) => {
344
344
  var p;
345
345
  let l = g;
346
- if (_t(g) && (l = new PointerEvent(g.type, g)), l !== g) {
347
- const h = Ri(
346
+ if (Xt(g) && (l = new PointerEvent(g.type, g)), l !== g) {
347
+ const h = Mi(
348
348
  l,
349
349
  g,
350
350
  i.spine.locator,
@@ -365,14 +365,14 @@ const Rt = ({
365
365
  });
366
366
  }
367
367
  ), i;
368
- }, Pe = (e) => X((t) => Object.entries(t).reduce(
368
+ }, $e = (e) => X((t) => Object.entries(t).reduce(
369
369
  (i, [n, o]) => e.includes(n) ? {
370
370
  ...i,
371
371
  [n]: o
372
372
  } : i,
373
373
  {}
374
- )), Xt = (e) => (t) => t.pipe(Pe(e), Z(N));
375
- function ve(e) {
374
+ )), qt = (e) => (t) => t.pipe($e(e), Z(N));
375
+ function Te(e) {
376
376
  return new st((t) => {
377
377
  const i = new ResizeObserver((n) => {
378
378
  t.next(n);
@@ -385,18 +385,18 @@ function ve(e) {
385
385
  const Ct = (e) => (t) => t.pipe(
386
386
  _(
387
387
  (i) => e.pipe(
388
- fe(),
388
+ Se(),
389
389
  X(() => i)
390
390
  )
391
391
  )
392
- ), Ni = (e) => {
392
+ ), Oi = (e) => {
393
393
  let t;
394
394
  const i = e.subscribe((n) => {
395
395
  t = { result: n };
396
396
  });
397
397
  return () => (i.unsubscribe(), t ? w(t.result) : e);
398
398
  };
399
- function xe() {
399
+ function Fe() {
400
400
  return new st((e) => {
401
401
  if (window.requestIdleCallback) {
402
402
  const i = window.requestIdleCallback(() => {
@@ -410,16 +410,16 @@ function xe() {
410
410
  return () => clearTimeout(t);
411
411
  });
412
412
  }
413
- function ee(e) {
414
- return Nt(() => xe().pipe(_(e)));
413
+ function ne(e) {
414
+ return Nt(() => Fe().pipe(_(e)));
415
415
  }
416
- const ie = (e, t) => new st((i) => {
416
+ const oe = (e, t) => new st((i) => {
417
417
  const n = new MutationObserver((o) => {
418
418
  i.next(o);
419
419
  });
420
420
  return n.observe(e, t), () => n.disconnect();
421
421
  });
422
- function Is(e, t) {
422
+ function bs(e, t) {
423
423
  return new st((i) => {
424
424
  const n = new IntersectionObserver((o) => {
425
425
  i.next(o);
@@ -429,7 +429,7 @@ function Is(e, t) {
429
429
  };
430
430
  });
431
431
  }
432
- class $e {
432
+ class Le {
433
433
  constructor(t, i) {
434
434
  this.settingsManager = i;
435
435
  const n = vt(
@@ -441,7 +441,7 @@ class $e {
441
441
  t
442
442
  ), this.outputSettingsUpdateSubject = new U(), this.values$ = q([
443
443
  this.settingsManager.values$,
444
- this.outputSettingsUpdateSubject.pipe(ye(this.outputSettings))
444
+ this.outputSettingsUpdateSubject.pipe(be(this.outputSettings))
445
445
  ]).pipe(
446
446
  X(([o, s]) => ({ ...o, ...s })),
447
447
  Mt(1)
@@ -468,7 +468,7 @@ class $e {
468
468
  };
469
469
  }
470
470
  watch(t) {
471
- return Array.isArray(t) ? this.values$.pipe(Xt(t)) : this.values$.pipe(
471
+ return Array.isArray(t) ? this.values$.pipe(qt(t)) : this.values$.pipe(
472
472
  X((i) => i[t]),
473
473
  Z(N)
474
474
  );
@@ -477,7 +477,7 @@ class $e {
477
477
  this.outputSettingsUpdateSubject.complete();
478
478
  }
479
479
  }
480
- const Vi = (e) => {
480
+ const Di = (e) => {
481
481
  const t = new FileReader();
482
482
  return new Promise((i) => {
483
483
  t.addEventListener(
@@ -489,7 +489,7 @@ const Vi = (e) => {
489
489
  ), t.readAsDataURL(e);
490
490
  });
491
491
  };
492
- let ji = class extends $e {
492
+ let Ni = class extends Le {
493
493
  computeOutputSettings(t) {
494
494
  return t;
495
495
  }
@@ -509,8 +509,8 @@ let ji = class extends $e {
509
509
  };
510
510
  }
511
511
  };
512
- const ki = (e) => (t) => {
513
- const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t, r = new U(), a = e(t), c = new ji(
512
+ const Vi = (e) => (t) => {
513
+ const { fontScale: i, lineHeight: n, fontWeight: o, fontJustification: s } = t, r = new U(), a = e(t), c = new Ni(
514
514
  {
515
515
  fontScale: i,
516
516
  lineHeight: n,
@@ -542,7 +542,7 @@ const ki = (e) => (t) => {
542
542
  }
543
543
  });
544
544
  const g = (l) => l.pipe(
545
- ni(),
545
+ oi(),
546
546
  b(([p, h]) => h.fontScale !== p.fontScale || h.lineHeight !== p.lineHeight)
547
547
  );
548
548
  return c.values$.pipe(
@@ -556,7 +556,7 @@ const ki = (e) => (t) => {
556
556
  },
557
557
  settings: c
558
558
  };
559
- }, Wi = (e) => (t) => {
559
+ }, ji = (e) => (t) => {
560
560
  const i = e(t), n = (o) => G(o, "keyup").pipe(
561
561
  D(i.settings.values$),
562
562
  b(([s, { pageTurnDirection: r }]) => {
@@ -590,7 +590,7 @@ const ki = (e) => (t) => {
590
590
  ),
591
591
  F(i.$.destroy$)
592
592
  ).subscribe(), i;
593
- }, zi = (e) => e.spine.spineItemsManager.items$.pipe(
593
+ }, ki = (e) => e.spine.spineItemsManager.items$.pipe(
594
594
  v(
595
595
  (t) => x(
596
596
  ...t.map((i) => i.loaded$.pipe(
@@ -730,7 +730,7 @@ const Ft = class Ft extends Y {
730
730
  ut(() => {
731
731
  t.complete();
732
732
  }),
733
- he((i) => (j.error(i), w(void 0)))
733
+ fe((i) => (j.error(i), w(void 0)))
734
734
  );
735
735
  }
736
736
  layout(t) {
@@ -752,7 +752,7 @@ const Ft = class Ft extends Y {
752
752
  if (t) return t;
753
753
  const i = this.getDocumentFrame();
754
754
  if (i) {
755
- const { hasViewport: o } = Bt(i);
755
+ const { hasViewport: o } = _t(i);
756
756
  if (o) return "pre-paginated";
757
757
  }
758
758
  return ((n = this.context.manifest) == null ? void 0 : n.renditionLayout) ?? "reflowable";
@@ -760,26 +760,26 @@ const Ft = class Ft extends Y {
760
760
  };
761
761
  Ft.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
762
762
  let ht = Ft;
763
- const Ui = (e) => new URL(e.href);
764
- class qt {
763
+ const Wi = (e) => new URL(e.href);
764
+ class Yt {
765
765
  constructor(t, i) {
766
766
  this.item = t, this.settings = i;
767
767
  }
768
768
  async getResource() {
769
769
  var i, n;
770
- return await qe(
770
+ return await Ye(
771
771
  ((n = (i = this.settings.values).getResource) == null ? void 0 : n.call(i, this.item)) ?? w(void 0)
772
- ) ?? Ui(this.item);
772
+ ) ?? Wi(this.item);
773
773
  }
774
774
  async fetchResource() {
775
775
  const t = await this.getResource();
776
776
  return t instanceof Response ? t : t instanceof URL ? fetch(t) : t;
777
777
  }
778
778
  }
779
- const Te = (e, t) => {
779
+ const Me = (e, t) => {
780
780
  const i = e.startsWith("file://"), n = i ? e.replace("file://", "http://") : e, o = new URL(t, n).toString();
781
781
  return i ? o.replace("http://", "file://") : o;
782
- }, Hi = async (e, t, i, n, o) => {
782
+ }, zi = async (e, t, i, n, o) => {
783
783
  if (!e || !e.defaultView) return;
784
784
  const s = t.sheet;
785
785
  if (s)
@@ -797,11 +797,11 @@ const Te = (e, t) => {
797
797
  return h;
798
798
  const m = h.match(/url\(['"]?([^'"]+)['"]?\)/);
799
799
  if (!m) return h;
800
- const S = m[1] ?? "", f = (y = n.manifest) == null ? void 0 : y.items.find(({ href: P }) => `${Te(i, S).toLowerCase()}`.endsWith(
800
+ const S = m[1] ?? "", f = (y = n.manifest) == null ? void 0 : y.items.find(({ href: P }) => `${Me(i, S).toLowerCase()}`.endsWith(
801
801
  `${P.toLowerCase()}`
802
802
  ));
803
803
  if (f) {
804
- const P = new qt(f, o);
804
+ const P = new Yt(f, o);
805
805
  try {
806
806
  const $ = await P.getResource();
807
807
  if ($ instanceof Response) {
@@ -828,15 +828,15 @@ const Te = (e, t) => {
828
828
  } catch (r) {
829
829
  console.error("Could not access stylesheet rules:", r);
830
830
  }
831
- }, Ei = (e, t, i, n, o) => {
831
+ }, Ui = (e, t, i, n, o) => {
832
832
  var c;
833
833
  const s = t.getAttribute("src") || t.getAttribute("href");
834
834
  if (!s) return w(null);
835
- const r = (c = n.manifest) == null ? void 0 : c.items.find(({ href: u }) => `${Te(i, s).toLowerCase()}`.endsWith(
835
+ const r = (c = n.manifest) == null ? void 0 : c.items.find(({ href: u }) => `${Me(i, s).toLowerCase()}`.endsWith(
836
836
  `${u.toLowerCase()}`
837
837
  ));
838
838
  if (!r) return w(null);
839
- const a = new qt(r, o);
839
+ const a = new Yt(r, o);
840
840
  return W(a.getResource()).pipe(
841
841
  $t(
842
842
  (u) => u instanceof Response ? W(u.blob()) : w(void 0)
@@ -852,7 +852,7 @@ const Te = (e, t) => {
852
852
  return new st((l) => {
853
853
  t.onload = async () => {
854
854
  try {
855
- t.sheet && await Hi(
855
+ t.sheet && await zi(
856
856
  e,
857
857
  t,
858
858
  i,
@@ -867,16 +867,16 @@ const Te = (e, t) => {
867
867
  return w(null);
868
868
  })
869
869
  );
870
- }, Bi = ({
870
+ }, Hi = ({
871
871
  settings: e,
872
872
  item: t,
873
873
  context: i
874
874
  }) => (n) => n.pipe(
875
875
  v((o) => {
876
- const s = we(
876
+ const s = xe(
877
877
  o.contentDocument
878
- ), r = ti(t.href), a = s.map(
879
- (c) => Ei(
878
+ ), r = ei(t.href), a = s.map(
879
+ (c) => Ui(
880
880
  o.contentDocument,
881
881
  c,
882
882
  r,
@@ -886,20 +886,20 @@ const Te = (e, t) => {
886
886
  );
887
887
  return q(a).pipe(b(() => o));
888
888
  })
889
- ), _i = (e) => {
890
- Mi(e == null ? void 0 : e.contentDocument);
891
- }, Xi = [".xhtml", ".html", ".htm"], lt = "prose-reader", qi = (e) => new Promise((t, i) => {
889
+ ), Ei = (e) => {
890
+ Fi(e == null ? void 0 : e.contentDocument);
891
+ }, Bi = [".xhtml", ".html", ".htm"], lt = "prose-reader", _i = (e) => new Promise((t, i) => {
892
892
  const n = new Image();
893
893
  n.src = e, n.onload = () => {
894
894
  t({ height: n.naturalHeight, width: n.naturalWidth });
895
895
  }, n.onerror = i;
896
- }), Yi = async (e, t) => {
896
+ }), Xi = async (e, t) => {
897
897
  if (typeof e == "string") return e;
898
- const i = ei(e.headers.get("Content-Type") || "") || Lt(t.href);
898
+ const i = ii(e.headers.get("Content-Type") || "") || Lt(t.href);
899
899
  if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
900
900
  (o) => o === i
901
901
  )) {
902
- const o = await Vi(await e.blob()), { height: s, width: r } = await qi(o);
902
+ const o = await Di(await e.blob()), { height: s, width: r } = await _i(o);
903
903
  return `
904
904
  <html>
905
905
  <head>
@@ -931,11 +931,11 @@ const Te = (e, t) => {
931
931
  </body>
932
932
  </html>
933
933
  ` : await e.text();
934
- }, Zi = ({
934
+ }, qi = ({
935
935
  item: e,
936
936
  resourcesHandler: t
937
937
  }) => {
938
- const i = (n) => Yi(n, e);
938
+ const i = (n) => Xi(n, e);
939
939
  return (n) => n.pipe(
940
940
  v((o) => W(t.getResource()).pipe(
941
941
  v((s) => s instanceof URL && e.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
@@ -945,7 +945,7 @@ const Te = (e, t) => {
945
945
  "text/html",
946
946
  "text/xml"
947
947
  ].includes(e.mediaType) || // no encoding ? then try to detect html
948
- !e.mediaType && Xi.some(
948
+ !e.mediaType && Bi.some(
949
949
  (a) => e.href.endsWith(a)
950
950
  )) ? (o == null || o.setAttribute("src", e.href), w(o)) : (s instanceof URL ? W(t.fetchResource()) : s instanceof Response ? w(s) : K).pipe(
951
951
  R((a) => a instanceof Response),
@@ -957,13 +957,13 @@ const Te = (e, t) => {
957
957
  }
958
958
  }),
959
959
  b(() => o),
960
- he((a) => (j.error(
960
+ fe((a) => (j.error(
961
961
  `Error while trying to fetch or load resource for item ${e.id}`
962
962
  ), j.error(a), w(o)))
963
963
  ))
964
964
  ))
965
965
  );
966
- }, Gi = () => {
966
+ }, Yi = () => {
967
967
  const e = document.createElement("iframe");
968
968
  return e.frameBorder = "no", e.tabIndex = 0, e.setAttribute(
969
969
  "sandbox",
@@ -978,17 +978,17 @@ const Te = (e, t) => {
978
978
  border: 0px none transparent;
979
979
  padding: 0px;
980
980
  `, e.setAttribute("role", "main"), e;
981
- }, Fe = () => `
981
+ }, Ce = () => `
982
982
  body {
983
983
  margin: 0;
984
984
  }
985
985
  }
986
- `, Le = ({
986
+ `, Re = ({
987
987
  pageHeight: e,
988
988
  pageWidth: t,
989
989
  frameElement: i
990
990
  }) => {
991
- const n = Bt(i);
991
+ const n = _t(i);
992
992
  if (i != null && i.contentDocument && i.contentWindow && n) {
993
993
  const o = t / (n.width ?? 1);
994
994
  return { computedScale: Math.min(
@@ -996,12 +996,12 @@ const Te = (e, t) => {
996
996
  e / (n.height ?? 1)
997
997
  ), computedWidthScale: o, viewportDimensions: n };
998
998
  }
999
- }, Ji = ({
999
+ }, Zi = ({
1000
1000
  columnWidth: e,
1001
1001
  enableTouch: t,
1002
1002
  spreadPosition: i
1003
1003
  }, n) => `
1004
- ${Fe()}
1004
+ ${Ce()}
1005
1005
  body {
1006
1006
  ${n ? "" : `
1007
1007
  display: flex;
@@ -1041,12 +1041,12 @@ const Te = (e, t) => {
1041
1041
  object-fit:contain;
1042
1042
  `}
1043
1043
  }
1044
- `, Ki = ({
1044
+ `, Gi = ({
1045
1045
  pageHeight: e,
1046
1046
  pageWidth: t
1047
- }) => ({ columnHeight: e, columnWidth: t }), ne = (e, t) => {
1047
+ }) => ({ columnHeight: e, columnWidth: t }), se = (e, t) => {
1048
1048
  e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
1049
- }, Qi = ({
1049
+ }, Ji = ({
1050
1050
  minPageSpread: e,
1051
1051
  blankPagePosition: t,
1052
1052
  spreadPosition: i,
@@ -1058,18 +1058,18 @@ const Te = (e, t) => {
1058
1058
  }) => {
1059
1059
  const c = e * o;
1060
1060
  if (s != null && s.contentDocument && (s != null && s.contentWindow)) {
1061
- const { viewportDimensions: u, computedScale: d = 1 } = Le({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, p = Ji(
1061
+ const { viewportDimensions: u, computedScale: d = 1 } = Re({ frameElement: s, pageHeight: n, pageWidth: o }) ?? {}, g = o, l = n, p = Zi(
1062
1062
  {
1063
- ...Ki({ pageHeight: n, pageWidth: o }),
1063
+ ...Gi({ pageHeight: n, pageWidth: o }),
1064
1064
  enableTouch: a,
1065
1065
  spreadPosition: i
1066
1066
  },
1067
1067
  u
1068
1068
  );
1069
- if (ot(s, "prose-reader-css", p), u ? ne(s, {
1069
+ if (ot(s, "prose-reader-css", p), u ? se(s, {
1070
1070
  width: u.width ?? 1,
1071
1071
  height: u.height ?? 1
1072
- }) : ne(s, {
1072
+ }) : se(s, {
1073
1073
  width: g,
1074
1074
  height: l
1075
1075
  }), u) {
@@ -1090,8 +1090,8 @@ const Te = (e, t) => {
1090
1090
  return { width: c, height: l };
1091
1091
  }
1092
1092
  return { width: c, height: n };
1093
- }, tn = () => `
1094
- ${Fe()}
1093
+ }, Ki = () => `
1094
+ ${Ce()}
1095
1095
  html {
1096
1096
  width: 100%;
1097
1097
  height: 100%;
@@ -1105,7 +1105,7 @@ const Te = (e, t) => {
1105
1105
  html, body {
1106
1106
  touch-action: none;
1107
1107
  }
1108
- `, en = ({
1108
+ `, Qi = ({
1109
1109
  isScrollable: e,
1110
1110
  enableTouch: t
1111
1111
  }) => `
@@ -1130,7 +1130,7 @@ const Te = (e, t) => {
1130
1130
  display: block;
1131
1131
  }
1132
1132
  ` : ""}
1133
- `, nn = ({
1133
+ `, tn = ({
1134
1134
  width: e,
1135
1135
  columnHeight: t,
1136
1136
  columnWidth: i
@@ -1198,7 +1198,7 @@ const Te = (e, t) => {
1198
1198
  td {
1199
1199
  max-width: ${i}px;
1200
1200
  }
1201
- `, on = ({
1201
+ `, en = ({
1202
1202
  isUsingVerticalWriting: e,
1203
1203
  minimumWidth: t,
1204
1204
  pageHeight: i,
@@ -1214,7 +1214,7 @@ const Te = (e, t) => {
1214
1214
  };
1215
1215
  }, It = (e, t) => {
1216
1216
  e.style.width = `${t.width}px`, e.style.height = `${t.height}px`;
1217
- }, sn = ({
1217
+ }, nn = ({
1218
1218
  pageHeight: e,
1219
1219
  pageWidth: t,
1220
1220
  frameElement: i,
@@ -1231,7 +1231,7 @@ const Te = (e, t) => {
1231
1231
  let l = o;
1232
1232
  const p = (n == null ? void 0 : n.renditionLayout) === "reflowable" && (n == null ? void 0 : n.renditionFlow) === "scrolled-continuous", h = p ? Math.min(400, e) : e;
1233
1233
  i == null || i.style.setProperty("width", `${t}px`), p || i == null || i.style.setProperty("height", `${h}px`);
1234
- const { viewportDimensions: m, computedScale: S = 1 } = Le({
1234
+ const { viewportDimensions: m, computedScale: S = 1 } = Re({
1235
1235
  frameElement: i,
1236
1236
  pageHeight: h,
1237
1237
  pageWidth: t
@@ -1242,7 +1242,7 @@ const Te = (e, t) => {
1242
1242
  ot(
1243
1243
  i,
1244
1244
  "prose-reader-html-renderer-framce-css",
1245
- tn()
1245
+ Ki()
1246
1246
  ), It(i, {
1247
1247
  width: m.width ?? 1,
1248
1248
  height: m.height ?? 1
@@ -1254,11 +1254,11 @@ const Te = (e, t) => {
1254
1254
  `translate(-50%, -50%) scale(${S})`
1255
1255
  ), i == null || i.style.setProperty("transform-origin", "center center");
1256
1256
  else {
1257
- const L = c ? en({
1257
+ const L = c ? Qi({
1258
1258
  isScrollable: (n == null ? void 0 : n.renditionFlow) === "scrolled-continuous",
1259
1259
  enableTouch: u
1260
- }) : nn(
1261
- on({
1260
+ }) : tn(
1261
+ en({
1262
1262
  isUsingVerticalWriting: d,
1263
1263
  minimumWidth: g,
1264
1264
  pageHeight: h,
@@ -1295,7 +1295,7 @@ const Te = (e, t) => {
1295
1295
  latestContentHeightWhenLoaded: l
1296
1296
  };
1297
1297
  };
1298
- class rn extends ht {
1298
+ class on extends ht {
1299
1299
  constructor() {
1300
1300
  super(...arguments), this.isImageType = () => {
1301
1301
  const t = this.item.mediaType ?? Lt(this.item.href);
@@ -1303,14 +1303,14 @@ class rn extends ht {
1303
1303
  };
1304
1304
  }
1305
1305
  onCreateDocument() {
1306
- const t = Gi();
1306
+ const t = Yi();
1307
1307
  return this.setDocumentContainer(t), w(t);
1308
1308
  }
1309
1309
  onLoadDocument() {
1310
1310
  const t = this.getFrameElement();
1311
1311
  if (!t) throw new Error("invalid frame");
1312
1312
  return w(t).pipe(
1313
- Zi({
1313
+ qi({
1314
1314
  item: this.item,
1315
1315
  resourcesHandler: this.resourcesHandler,
1316
1316
  settings: this.settings
@@ -1319,17 +1319,17 @@ class rn extends ht {
1319
1319
  T(() => {
1320
1320
  this.attach();
1321
1321
  }),
1322
- fi,
1323
- Bi({
1322
+ hi,
1323
+ Hi({
1324
1324
  context: this.context,
1325
1325
  item: this.item,
1326
1326
  settings: this.settings
1327
1327
  }),
1328
- yi
1328
+ mi
1329
1329
  );
1330
1330
  }
1331
1331
  onUnload() {
1332
- return _i(this.getFrameElement()), this.detach(), K;
1332
+ return Ei(this.getFrameElement()), this.detach(), K;
1333
1333
  }
1334
1334
  onLayout({
1335
1335
  minPageSpread: t,
@@ -1341,7 +1341,7 @@ class rn extends ht {
1341
1341
  if (!r) return w(void 0);
1342
1342
  const a = !!((d = this.writingMode) != null && d.startsWith("vertical"));
1343
1343
  if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && ((g = this.context.manifest) == null ? void 0 : g.renditionLayout) === "pre-paginated") {
1344
- const l = Qi({
1344
+ const l = Ji({
1345
1345
  blankPagePosition: i,
1346
1346
  enableTouch: this.settings.values.computedPageTurnMode !== "scrollable",
1347
1347
  frameElement: r,
@@ -1353,7 +1353,7 @@ class rn extends ht {
1353
1353
  });
1354
1354
  return w(l);
1355
1355
  }
1356
- const { latestContentHeightWhenLoaded: c, ...u } = sn({
1356
+ const { latestContentHeightWhenLoaded: c, ...u } = nn({
1357
1357
  pageHeight: s,
1358
1358
  pageWidth: o,
1359
1359
  frameElement: r,
@@ -1425,14 +1425,14 @@ class rn extends ht {
1425
1425
  return this.getFrameElement();
1426
1426
  }
1427
1427
  }
1428
- const an = (e) => (t) => {
1428
+ const sn = (e) => (t) => {
1429
1429
  const i = e({
1430
1430
  ...t,
1431
1431
  getRenderer(o) {
1432
1432
  var r;
1433
- return ((r = t.getRenderer) == null ? void 0 : r.call(t, o)) ?? ((a) => new rn(a));
1433
+ return ((r = t.getRenderer) == null ? void 0 : r.call(t, o)) ?? ((a) => new on(a));
1434
1434
  }
1435
- }), n = zi(i);
1435
+ }), n = ki(i);
1436
1436
  return n.pipe(F(i.$.destroy$)).subscribe(), {
1437
1437
  ...i,
1438
1438
  links$: n
@@ -1441,7 +1441,7 @@ const an = (e) => (t) => {
1441
1441
  function ct(e) {
1442
1442
  return e != null;
1443
1443
  }
1444
- let cn = class extends $e {
1444
+ let rn = class extends Le {
1445
1445
  computeOutputSettings(t) {
1446
1446
  return t;
1447
1447
  }
@@ -1469,7 +1469,7 @@ let cn = class extends $e {
1469
1469
  };
1470
1470
  }
1471
1471
  };
1472
- const un = (e) => {
1472
+ const an = (e) => {
1473
1473
  let t;
1474
1474
  const i = e.context.state$.pipe(
1475
1475
  _(({ containerElement: c }) => c ? new st(() => (t = c.ownerDocument.createElement("div"), t.style.cssText = `
@@ -1482,7 +1482,7 @@ const un = (e) => {
1482
1482
  `, c.appendChild(t), () => {
1483
1483
  t == null || t.remove(), t = void 0;
1484
1484
  })) : gt)
1485
- ), n = (c) => Ye(c, at).pipe(
1485
+ ), n = (c) => Ze(c, at).pipe(
1486
1486
  z(() => {
1487
1487
  t == null || t.style.setProperty(
1488
1488
  "visibility",
@@ -1497,7 +1497,7 @@ const un = (e) => {
1497
1497
  );
1498
1498
  })
1499
1499
  ), s = n(e.viewportFree$).pipe(
1500
- oi(1)
1500
+ si(1)
1501
1501
  ), a = e.settings.values$.pipe(
1502
1502
  X(() => e.settings.values.computedPageTurnMode),
1503
1503
  Z()
@@ -1508,14 +1508,14 @@ const un = (e) => {
1508
1508
  J(e.$.destroy$)
1509
1509
  );
1510
1510
  return x(i, a);
1511
- }, dn = (e) => {
1511
+ }, cn = (e) => {
1512
1512
  e.hookManager.register(
1513
1513
  "item.onAfterLayout",
1514
1514
  ({ item: t, blankPagePosition: i, minimumWidth: n }) => {
1515
1515
  const o = e.spineItemsManager.get(t.id), s = o == null ? void 0 : o.renderer.getDocumentFrame();
1516
1516
  if ((o == null ? void 0 : o.renditionLayout) !== "reflowable" || !(s instanceof HTMLIFrameElement))
1517
1517
  return;
1518
- const { hasViewport: r } = Bt(s), { width: a } = e.context.getPageSize(), c = o == null ? void 0 : o.renderer.getDocumentFrame();
1518
+ const { hasViewport: r } = _t(s), { width: a } = e.context.getPageSize(), c = o == null ? void 0 : o.renderer.getDocumentFrame();
1519
1519
  if (r) {
1520
1520
  const u = a < n;
1521
1521
  i === "none" && u && c instanceof HTMLIFrameElement && (c == null || c.style.setProperty(
@@ -1526,17 +1526,17 @@ const un = (e) => {
1526
1526
  }
1527
1527
  );
1528
1528
  };
1529
- class Me {
1529
+ class Ae {
1530
1530
  constructor(t) {
1531
1531
  this.left = t.left, this.right = t.right, this.top = t.top, this.bottom = t.bottom, this.width = t.width, this.height = t.height, this.x = t.x, this.y = t.y;
1532
1532
  }
1533
1533
  }
1534
- class kt extends Me {
1534
+ class kt extends Ae {
1535
1535
  constructor() {
1536
1536
  super(...arguments), this.__symbol = "SpineItemSpineLayout";
1537
1537
  }
1538
1538
  }
1539
- class gn extends Me {
1539
+ class un extends Ae {
1540
1540
  constructor() {
1541
1541
  super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
1542
1542
  }
@@ -1546,18 +1546,18 @@ class M {
1546
1546
  this.__symbol = "SpinePosition", this.x = t.x, this.y = t.y;
1547
1547
  }
1548
1548
  }
1549
- class Yt {
1549
+ class Zt {
1550
1550
  constructor(t) {
1551
1551
  this.__symbol = "UnsafeSpinePosition", this.x = t.x, this.y = t.y;
1552
1552
  }
1553
1553
  static from(t) {
1554
- return new Yt(t);
1554
+ return new Zt(t);
1555
1555
  }
1556
1556
  }
1557
- const ln = ({
1557
+ const dn = ({
1558
1558
  position: e,
1559
1559
  pageSize: t
1560
- }) => new gn({
1560
+ }) => new un({
1561
1561
  x: e.x,
1562
1562
  y: e.y,
1563
1563
  left: e.x,
@@ -1566,7 +1566,7 @@ const ln = ({
1566
1566
  height: t.height,
1567
1567
  bottom: e.y + t.height,
1568
1568
  right: e.x + t.width
1569
- }), pn = (e) => {
1569
+ }), gn = (e) => {
1570
1570
  const t = e.spine.spineLayout.layout$.pipe(
1571
1571
  b(() => ({
1572
1572
  pages: e.spine.spineItemsManager.items.reduce((s, r, a) => {
@@ -1578,7 +1578,7 @@ const ln = ({
1578
1578
  spineItem: r,
1579
1579
  spineItemPosition: p
1580
1580
  });
1581
- return ln({
1581
+ return dn({
1582
1582
  pageSize: e.context.getPageSize(),
1583
1583
  position: h
1584
1584
  });
@@ -1596,17 +1596,17 @@ const ln = ({
1596
1596
  V()
1597
1597
  ), i = t.pipe(et({ refCount: !0, bufferSize: 1 }));
1598
1598
  return i.pipe(F(e.$.destroy$)).subscribe(), { layout$: t, info$: i };
1599
- }, hn = (e, t) => t.pipe(
1599
+ }, ln = (e, t) => t.pipe(
1600
1600
  T((i) => {
1601
1601
  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();
1602
1602
  })
1603
- ), mn = (e) => (t) => {
1603
+ ), pn = (e) => (t) => {
1604
1604
  const {
1605
1605
  pageHorizontalMargin: i,
1606
1606
  pageVerticalMargin: n,
1607
1607
  layoutAutoResize: o,
1608
1608
  layoutLayerTransition: s
1609
- } = t, r = e(t), a = new cn(
1609
+ } = t, r = e(t), a = new rn(
1610
1610
  {
1611
1611
  pageHorizontalMargin: i,
1612
1612
  pageVerticalMargin: n,
@@ -1653,7 +1653,7 @@ const ln = ({
1653
1653
  `
1654
1654
  );
1655
1655
  }
1656
- }), dn(r), r.hookManager.register(
1656
+ }), cn(r), r.hookManager.register(
1657
1657
  "item.onDocumentCreated",
1658
1658
  ({ documentContainer: S }) => {
1659
1659
  S.style.opacity = "0", a.values.layoutLayerTransition && (S.style.transition = "opacity 300ms");
@@ -1680,13 +1680,13 @@ const ln = ({
1680
1680
  _(() => r.context.containerElement$),
1681
1681
  tt(ct),
1682
1682
  _((S) => u(S)),
1683
- si(100),
1683
+ ri(100),
1684
1684
  z(() => {
1685
1685
  r == null || r.layout();
1686
1686
  })
1687
- ), g = un(r);
1687
+ ), g = an(r);
1688
1688
  a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
1689
- ri(1),
1689
+ ai(1),
1690
1690
  z(() => {
1691
1691
  r.layout();
1692
1692
  }),
@@ -1697,7 +1697,7 @@ const ln = ({
1697
1697
  const y = "prose-spineItem-ready";
1698
1698
  f ? S.containerElement.classList.add(y) : S.containerElement.classList.remove(y);
1699
1699
  })
1700
- ), { layout$: p, info$: h } = pn(r), m = hn(
1700
+ ), { layout$: p, info$: h } = gn(r), m = ln(
1701
1701
  r,
1702
1702
  a.watch("viewportMode")
1703
1703
  );
@@ -1716,9 +1716,9 @@ const ln = ({
1716
1716
  layout$: p,
1717
1717
  layoutInfo$: h
1718
1718
  };
1719
- }, fn = `${lt}-enhancer-loading`, Ce = `${fn}-container`, yn = (e, t) => {
1719
+ }, hn = `${lt}-enhancer-loading`, Oe = `${hn}-container`, mn = (e, t) => {
1720
1720
  const i = e.ownerDocument.createElement("div");
1721
- return i.classList.add(Ce), i.style.cssText = `
1721
+ return i.classList.add(Oe), i.style.cssText = `
1722
1722
  height: 100%;
1723
1723
  width: 100%;
1724
1724
  max-width: ${t.state.visibleAreaRect.width}px;
@@ -1734,7 +1734,7 @@ const ln = ({
1734
1734
  background-color: white;
1735
1735
  z-index: 1;
1736
1736
  `, i;
1737
- }, Sn = ({
1737
+ }, fn = ({
1738
1738
  container: e,
1739
1739
  item: t
1740
1740
  }) => {
@@ -1751,17 +1751,17 @@ const ln = ({
1751
1751
  max-width: 300px;
1752
1752
  width: 80%;
1753
1753
  `, e.appendChild(i), e.appendChild(n), e;
1754
- }, bn = (e) => (t) => {
1755
- const { loadingElementCreate: i = Sn } = t, n = e(t), o = (c) => w(
1754
+ }, yn = (e) => (t) => {
1755
+ const { loadingElementCreate: i = fn } = t, n = e(t), o = (c) => w(
1756
1756
  c.reduce((u, { item: d, element: g }) => {
1757
1757
  g.style.zIndex = "0";
1758
1758
  const l = g.querySelector(
1759
- `.${Ce}`
1759
+ `.${Oe}`
1760
1760
  );
1761
1761
  if (l instanceof HTMLElement)
1762
1762
  return u[d.id] = l, u;
1763
1763
  const p = i({
1764
- container: yn(g, n.context),
1764
+ container: mn(g, n.context),
1765
1765
  item: d
1766
1766
  });
1767
1767
  return g.appendChild(p), u[d.id] = p, u;
@@ -1816,7 +1816,7 @@ const ln = ({
1816
1816
  }
1817
1817
  };
1818
1818
  };
1819
- class In extends ht {
1819
+ class Sn extends ht {
1820
1820
  getImageElement() {
1821
1821
  const t = this.documentContainer;
1822
1822
  if (t instanceof HTMLImageElement)
@@ -1868,13 +1868,13 @@ class In extends ht {
1868
1868
  getDocumentFrame() {
1869
1869
  }
1870
1870
  }
1871
- const wn = (e) => (t) => {
1871
+ const bn = (e) => (t) => {
1872
1872
  const i = e({
1873
1873
  ...t,
1874
1874
  getRenderer(r) {
1875
1875
  var d;
1876
1876
  const a = (d = t.getRenderer) == null ? void 0 : d.call(t, r), c = r.mediaType ?? Lt(r.href), u = !!(c != null && c.startsWith("image/"));
1877
- return !a && u ? (g) => new In(g) : a;
1877
+ return !a && u ? (g) => new Sn(g) : a;
1878
1878
  }
1879
1879
  }), n = new IntersectionObserver(
1880
1880
  (r) => {
@@ -1924,10 +1924,10 @@ const wn = (e) => (t) => {
1924
1924
  n.disconnect(), o.disconnect(), i.destroy();
1925
1925
  }
1926
1926
  };
1927
- }, Pn = (e, t) => e.links$.pipe(
1927
+ }, In = (e, t) => e.links$.pipe(
1928
1928
  T((i) => {
1929
1929
  var r;
1930
- if (!Ci(i.target, "a") || i.type !== "click") return;
1930
+ if (!Li(i.target, "a") || i.type !== "click") return;
1931
1931
  const n = new URL(i.target.href), o = `${n.origin}${n.pathname}`;
1932
1932
  ((r = e.context.manifest) == null ? void 0 : r.spineItems.some(
1933
1933
  (a) => a.href === o
@@ -1939,7 +1939,7 @@ class A {
1939
1939
  this.__symbol = Symbol("SpineItemPosition"), this.x = t.x, this.y = t.y;
1940
1940
  }
1941
1941
  }
1942
- const vn = ({
1942
+ const wn = ({
1943
1943
  position: e,
1944
1944
  spineItem: t,
1945
1945
  pageHeight: i,
@@ -1957,7 +1957,7 @@ const vn = ({
1957
1957
  s,
1958
1958
  t
1959
1959
  );
1960
- }, oe = ({
1960
+ }, re = ({
1961
1961
  position: e,
1962
1962
  navigationResolver: t,
1963
1963
  computedPageTurnDirection: i,
@@ -1971,7 +1971,7 @@ const vn = ({
1971
1971
  const u = o.getSpineItemPositionFromSpinePosition(
1972
1972
  e,
1973
1973
  a
1974
- ), d = vn({
1974
+ ), d = wn({
1975
1975
  position: u,
1976
1976
  spineItem: a,
1977
1977
  pageHeight: s.getPageSize().height,
@@ -1993,7 +1993,7 @@ const vn = ({
1993
1993
  x: 0
1994
1994
  })
1995
1995
  );
1996
- }, xn = ({
1996
+ }, Pn = ({
1997
1997
  position: e,
1998
1998
  spineItem: t,
1999
1999
  context: i,
@@ -2002,7 +2002,7 @@ const vn = ({
2002
2002
  spineLocator: s,
2003
2003
  computedPageTurnDirection: r
2004
2004
  }) => {
2005
- const a = oe({
2005
+ const a = re({
2006
2006
  position: e,
2007
2007
  context: i,
2008
2008
  navigationResolver: n,
@@ -2024,7 +2024,7 @@ const vn = ({
2024
2024
  );
2025
2025
  if (r === "vertical" && e.y !== a.y)
2026
2026
  return n.getAdjustedPositionForSpread(a);
2027
- const c = oe({
2027
+ const c = re({
2028
2028
  position: a,
2029
2029
  context: i,
2030
2030
  navigationResolver: n,
@@ -2035,7 +2035,7 @@ const vn = ({
2035
2035
  return n.getAdjustedPositionForSpread(c);
2036
2036
  }
2037
2037
  return n.getAdjustedPositionForSpread(a);
2038
- }, $n = ({
2038
+ }, vn = ({
2039
2039
  position: e,
2040
2040
  spineItem: t,
2041
2041
  pageHeight: i,
@@ -2053,7 +2053,7 @@ const vn = ({
2053
2053
  s,
2054
2054
  t
2055
2055
  );
2056
- }, se = ({
2056
+ }, ae = ({
2057
2057
  position: e,
2058
2058
  navigationResolver: t,
2059
2059
  computedPageTurnDirection: i,
@@ -2067,7 +2067,7 @@ const vn = ({
2067
2067
  const u = o.getSpineItemPositionFromSpinePosition(
2068
2068
  e,
2069
2069
  a
2070
- ), d = $n({
2070
+ ), d = vn({
2071
2071
  position: u,
2072
2072
  spineItem: a,
2073
2073
  pageHeight: s.getPageSize().height,
@@ -2089,7 +2089,7 @@ const vn = ({
2089
2089
  x: 0
2090
2090
  })
2091
2091
  );
2092
- }, Tn = ({
2092
+ }, xn = ({
2093
2093
  position: e,
2094
2094
  spineItem: t,
2095
2095
  context: i,
@@ -2098,7 +2098,7 @@ const vn = ({
2098
2098
  spineLocator: s,
2099
2099
  computedPageTurnDirection: r
2100
2100
  }) => {
2101
- const a = se({
2101
+ const a = ae({
2102
2102
  position: e,
2103
2103
  context: i,
2104
2104
  navigationResolver: n,
@@ -2123,7 +2123,7 @@ const vn = ({
2123
2123
  );
2124
2124
  if (r === "vertical" && e.y !== a.y)
2125
2125
  return n.getAdjustedPositionForSpread(a);
2126
- const c = se({
2126
+ const c = ae({
2127
2127
  position: a,
2128
2128
  context: i,
2129
2129
  navigationResolver: n,
@@ -2135,7 +2135,7 @@ const vn = ({
2135
2135
  }
2136
2136
  return n.getAdjustedPositionForSpread(a);
2137
2137
  };
2138
- class Fn {
2138
+ class $n {
2139
2139
  constructor(t) {
2140
2140
  this.reader = t, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
2141
2141
  }
@@ -2154,7 +2154,7 @@ class Fn {
2154
2154
  turnRightOrBottom() {
2155
2155
  const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
2156
2156
  if (!i) return;
2157
- const n = Tn({
2157
+ const n = xn({
2158
2158
  context: this.reader.context,
2159
2159
  navigationResolver: this.reader.navigation.navigationResolver,
2160
2160
  position: t.position,
@@ -2170,7 +2170,7 @@ class Fn {
2170
2170
  turnLeftOrTop() {
2171
2171
  const t = this.reader.navigation.getNavigation(), i = this.reader.spineItemsManager.get(t.spineItem);
2172
2172
  if (!i) return;
2173
- const n = xn({
2173
+ const n = Pn({
2174
2174
  context: this.reader.context,
2175
2175
  navigationResolver: this.reader.navigation.navigationResolver,
2176
2176
  position: t.position,
@@ -2312,7 +2312,7 @@ class Fn {
2312
2312
  }
2313
2313
  }
2314
2314
  }
2315
- class Ln {
2315
+ class Tn {
2316
2316
  constructor(t) {
2317
2317
  this.reader = t, this.lastDelta = { x: 0, y: 0 }, this.lastPosition = new M({ x: 0, y: 0 }), this.lastStartPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
2318
2318
  }
@@ -2352,7 +2352,7 @@ class Ln {
2352
2352
  });
2353
2353
  }
2354
2354
  }
2355
- const Mn = (e) => e.pagination.state$.pipe(
2355
+ const Fn = (e) => e.pagination.state$.pipe(
2356
2356
  D(e.context.manifest$, e.settings.values$),
2357
2357
  b(
2358
2358
  ([
@@ -2372,7 +2372,7 @@ const Mn = (e) => e.pagination.state$.pipe(
2372
2372
  }
2373
2373
  ),
2374
2374
  E(N)
2375
- ), Cn = ({ reader: e, duration: t }) => (i) => {
2375
+ ), Ln = ({ reader: e, duration: t }) => (i) => {
2376
2376
  let n;
2377
2377
  const o = () => {
2378
2378
  n == null || n(), n = void 0;
@@ -2381,25 +2381,25 @@ const Mn = (e) => e.pagination.state$.pipe(
2381
2381
  T(() => {
2382
2382
  n || (n = e == null ? void 0 : e.navigation.lock());
2383
2383
  }),
2384
- Ze(t, at, {
2384
+ Ge(t, at, {
2385
2385
  trailing: !0,
2386
2386
  leading: !0
2387
2387
  }),
2388
2388
  T(o),
2389
2389
  ut(o)
2390
2390
  );
2391
- }, Rn = (e) => (t) => {
2392
- const i = e(t), n = Mn(i), o = new Fn(i), s = new Ln(i), r = (c) => {
2391
+ }, Mn = (e) => (t) => {
2392
+ const i = e(t), n = Fn(i), o = new $n(i), s = new Tn(i), r = (c) => {
2393
2393
  const { cfi: u, ...d } = c;
2394
2394
  i.load(d), u && o.goToCfi(u, { animate: !1 });
2395
2395
  };
2396
- return Pn(i, o).pipe(F(i.$.destroy$)).subscribe(), {
2396
+ return In(i, o).pipe(F(i.$.destroy$)).subscribe(), {
2397
2397
  ...i,
2398
2398
  load: r,
2399
2399
  navigation: {
2400
2400
  ...i.navigation,
2401
2401
  state$: n,
2402
- throttleLock: ({ duration: c, trigger: u }) => u.pipe(Cn({ duration: c, reader: i })),
2402
+ throttleLock: ({ duration: c, trigger: u }) => u.pipe(Ln({ duration: c, reader: i })),
2403
2403
  moveTo: s.moveTo.bind(s),
2404
2404
  turnBottom: o.turnBottom.bind(o),
2405
2405
  turnTop: o.turnTop.bind(o),
@@ -2422,21 +2422,12 @@ const Mn = (e) => e.pagination.state$.pipe(
2422
2422
  goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
2423
2423
  }
2424
2424
  };
2425
- }, mt = (e) => {
2426
- const t = Re(e);
2427
- return ui([
2428
- [{ index: 0, extensions: { "vnd.prose.anchor": t } }]
2429
- ]);
2430
- }, ft = (e, t, i) => {
2425
+ }, mt = (e) => Ie({
2426
+ spineIndex: e.index,
2427
+ spineId: e.id
2428
+ }), ft = (e, t, i) => {
2431
2429
  var n;
2432
- return !e.ownerDocument || !((n = e.ownerDocument) != null && n.documentElement) || e === e.ownerDocument ? mt(i) : di(
2433
- { node: e, offset: t },
2434
- {
2435
- extensions: {
2436
- "vnd.prose.anchor": Re(i)
2437
- }
2438
- }
2439
- );
2430
+ return !e.ownerDocument || !((n = e.ownerDocument) != null && n.documentElement) || e === e.ownerDocument ? mt(i) : Ie({ node: e, offset: t, spineIndex: i.index, spineId: i.id });
2440
2431
  }, Wt = ({
2441
2432
  pageIndex: e,
2442
2433
  spineItem: t,
@@ -2452,10 +2443,10 @@ const Mn = (e) => e.pagination.state$.pipe(
2452
2443
  n.offset,
2453
2444
  t.item
2454
2445
  ).trim() : mt(t.item);
2455
- }, An = (e, t) => {
2446
+ }, Cn = (e, t) => {
2456
2447
  const i = ft(e.startContainer, e.startOffset, t), n = ft(e.endContainer, e.endOffset, t);
2457
2448
  return { start: i, end: n };
2458
- }, On = ({
2449
+ }, Rn = ({
2459
2450
  item: e,
2460
2451
  selection: t
2461
2452
  }) => {
@@ -2464,53 +2455,55 @@ const Mn = (e) => e.pagination.state$.pipe(
2464
2455
  anchorCfi: i,
2465
2456
  focusCfi: n
2466
2457
  };
2467
- }, Re = (e) => e.index.toString(), zt = (e) => {
2468
- var i, n, o;
2469
- const t = Se(e);
2470
- if (Array.isArray(t)) {
2471
- const s = t.at(-1);
2472
- return ((i = s == null ? void 0 : s[0]) == null ? void 0 : i.index) === 0;
2473
- }
2474
- return ((o = (n = t.parent.at(-1)) == null ? void 0 : n[0]) == null ? void 0 : o.index) === 0;
2475
- }, Ae = (e) => {
2476
- var s, r, a, c;
2477
- const t = Se(e), i = gi(t), n = Number.parseInt((i == null ? void 0 : i["vnd.prose.anchor"]) || ""), o = li(t) ? (r = (s = t.end.at(-1)) == null ? void 0 : s.at(-1)) == null ? void 0 : r.offset : (c = (a = t.at(-1)) == null ? void 0 : a.at(-1)) == null ? void 0 : c.offset;
2458
+ }, zt = (e) => {
2459
+ var t;
2460
+ return ((t = e[0]) == null ? void 0 : t.index) === 6 && e.length > 1;
2461
+ }, Ut = (e) => {
2462
+ const t = we(e), i = (n) => {
2463
+ if (n.length !== 1) return !1;
2464
+ const o = n[0] ?? [];
2465
+ return zt(o);
2466
+ };
2467
+ return Array.isArray(t) ? i(t) : i(t.parent);
2468
+ }, An = (e) => Array.isArray(e) ? e[0] && zt(e[0]) ? e[0] : void 0 : e.parent[0] && zt(e.parent[0]) ? e.parent[0] : void 0, Gt = (e) => {
2469
+ var a, c, u, d;
2470
+ const t = we(e), n = (An(t) ?? [])[1], s = ((n == null ? void 0 : n.index) ?? 2) / 2 - 1, r = di(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;
2478
2471
  return {
2479
2472
  cleanedCfi: e,
2480
- itemIndex: Number.isNaN(n) ? void 0 : n,
2481
- offset: o ?? 0
2473
+ itemIndex: s,
2474
+ offset: r ?? 0
2482
2475
  };
2483
- }, Oe = ({
2476
+ }, De = ({
2484
2477
  cfi: e,
2485
2478
  spineItemsManager: t
2486
2479
  }) => {
2487
- var o, s;
2480
+ var s, r;
2488
2481
  if (!e) return;
2489
- const i = t.getSpineItemFromCfi(e);
2490
- if (!i) return;
2491
- const n = i.renderer.getDocumentFrame();
2492
- if (n instanceof HTMLIFrameElement) {
2493
- const r = (o = n.contentWindow) == null ? void 0 : o.document;
2494
- if (r)
2482
+ const { itemIndex: i } = Gt(e), n = t.get(i);
2483
+ if (!n) return;
2484
+ const o = n.renderer.getDocumentFrame();
2485
+ if (o instanceof HTMLIFrameElement) {
2486
+ const a = (s = o.contentWindow) == null ? void 0 : s.document;
2487
+ if (a)
2495
2488
  try {
2496
- const a = pi(e, r, {
2489
+ const c = gi(e, a, {
2497
2490
  throwOnError: !0
2498
2491
  });
2499
2492
  return {
2500
- node: a.isRange ? (s = a.node) == null ? void 0 : s.startContainer : a.node,
2501
- offset: Array.isArray(a.offset) ? a.offset.at(-1) : a.offset,
2502
- spineItem: i
2493
+ node: c.isRange ? (r = c.node) == null ? void 0 : r.startContainer : c.node,
2494
+ offset: Array.isArray(c.offset) ? c.offset.at(-1) : c.offset,
2495
+ spineItem: n
2503
2496
  };
2504
- } catch (a) {
2505
- return j.error(a), {
2506
- spineItem: i
2497
+ } catch (c) {
2498
+ return j.error(c), {
2499
+ spineItem: n
2507
2500
  };
2508
2501
  }
2509
2502
  }
2510
2503
  return {
2511
- spineItem: i
2504
+ spineItem: n
2512
2505
  };
2513
- }, Dn = (e, t) => {
2506
+ }, On = (e, t) => {
2514
2507
  if ("cfi" in t)
2515
2508
  return t;
2516
2509
  const i = e.spineItemsManager.get(t);
@@ -2519,10 +2512,10 @@ const Mn = (e) => e.pagination.state$.pipe(
2519
2512
  return {
2520
2513
  cfi: mt(i.item)
2521
2514
  };
2522
- }, Nn = (e, t) => {
2515
+ }, Dn = (e, t) => {
2523
2516
  let i = e == null ? void 0 : e.itemPageIndex;
2524
2517
  const { itemIndex: n } = t.cfi.parseCfi(e.cfi), o = t.spineItemsManager.get(n);
2525
- return o ? xe().pipe(
2518
+ return o ? Fe().pipe(
2526
2519
  D(o.isReady$),
2527
2520
  b(([, s]) => {
2528
2521
  var g;
@@ -2552,19 +2545,19 @@ const Mn = (e) => e.pagination.state$.pipe(
2552
2545
  })
2553
2546
  ) : w({ ...e, itemIndex: n });
2554
2547
  };
2555
- class Vn {
2548
+ class Nn {
2556
2549
  constructor(t) {
2557
2550
  this.reader = t, this.locate = (i, n) => {
2558
2551
  const o = {
2559
2552
  resource: i,
2560
- meta: Dn(this.reader, i)
2553
+ meta: On(this.reader, i)
2561
2554
  };
2562
- return ee(() => {
2555
+ return ne(() => {
2563
2556
  var d;
2564
2557
  const s = this.reader.spine.spineLayout.layout$.pipe(
2565
2558
  St(10),
2566
2559
  nt(o),
2567
- Ge((g) => Nn(g.meta, this.reader).pipe(
2560
+ Je((g) => Dn(g.meta, this.reader).pipe(
2568
2561
  b((l) => ({
2569
2562
  ...g,
2570
2563
  meta: l
@@ -2585,12 +2578,12 @@ class Vn {
2585
2578
  };
2586
2579
  }
2587
2580
  locateResource(t, i) {
2588
- return Array.isArray(t) ? ee(
2581
+ return Array.isArray(t) ? ne(
2589
2582
  () => q(t.map((n) => this.locate(n, i ?? {})))
2590
2583
  ) : this.locate(t, i ?? {});
2591
2584
  }
2592
2585
  }
2593
- const De = (e, t, i) => {
2586
+ const Ne = (e, t, i) => {
2594
2587
  const n = i.spineItems.findIndex(
2595
2588
  (o) => o.href === e
2596
2589
  );
@@ -2607,7 +2600,7 @@ const De = (e, t, i) => {
2607
2600
  const m = {
2608
2601
  title: s.title,
2609
2602
  path: s.path
2610
- }, S = De(e, s.contents, i);
2603
+ }, S = Ne(e, s.contents, i);
2611
2604
  return S ? {
2612
2605
  ...m,
2613
2606
  subChapter: S
@@ -2615,20 +2608,20 @@ const De = (e, t, i) => {
2615
2608
  }
2616
2609
  return o;
2617
2610
  }, void 0);
2618
- }, jn = (e, t) => {
2611
+ }, Vn = (e, t) => {
2619
2612
  var n;
2620
2613
  const { href: i } = t;
2621
- return De(i, ((n = e.nav) == null ? void 0 : n.toc) ?? [], e);
2622
- }, kn = (e) => {
2614
+ return Ne(i, ((n = e.nav) == null ? void 0 : n.toc) ?? [], e);
2615
+ }, jn = (e) => {
2623
2616
  const t = e.context.manifest, i = e.spineItemsManager.items;
2624
2617
  return t ? i.reduce(
2625
- (n, { item: o }) => (n[o.id] = jn(t, o), n),
2618
+ (n, { item: o }) => (n[o.id] = Vn(t, o), n),
2626
2619
  {}
2627
2620
  ) : {};
2628
- }, Wn = (e) => e.spineItemsManager.items$.pipe(
2621
+ }, kn = (e) => e.spineItemsManager.items$.pipe(
2629
2622
  nt([]),
2630
- b(() => kn(e))
2631
- ), zn = (e, t, i) => e + t * i, Un = (e, t, i) => {
2623
+ b(() => jn(e))
2624
+ ), Wn = (e, t, i) => e + t * i, zn = (e, t, i) => {
2632
2625
  const n = e.context, { height: o, width: s } = i.layout.layoutInfo, { top: r, left: a } = e.spine.spineLayout.getSpineItemSpineLayoutInfo(i);
2633
2626
  return e.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
2634
2627
  0,
@@ -2643,7 +2636,7 @@ const De = (e, t, i) => {
2643
2636
  (t.x - a + n.state.visibleAreaRect.width) / s
2644
2637
  )
2645
2638
  );
2646
- }, Hn = (e, t, i, n, o) => o.isReady$.pipe(
2639
+ }, Un = (e, t, i, n, o) => o.isReady$.pipe(
2647
2640
  H(),
2648
2641
  D(e.layoutInfo$),
2649
2642
  b(([s, r]) => {
@@ -2654,17 +2647,17 @@ const De = (e, t, i) => {
2654
2647
  let m = (i + 1) * (h / p);
2655
2648
  !c && o.renditionLayout === "reflowable" && !s && (m = 0);
2656
2649
  let S = d + m;
2657
- return ((C = a.manifest) == null ? void 0 : C.renditionFlow) === "scrolled-continuous" && (s ? m = Un(
2650
+ return ((C = a.manifest) == null ? void 0 : C.renditionFlow) === "scrolled-continuous" && (s ? m = zn(
2658
2651
  e,
2659
2652
  n,
2660
2653
  o
2661
- ) : m = 0, S = zn(
2654
+ ) : m = 0, S = Wn(
2662
2655
  d,
2663
2656
  h,
2664
2657
  m
2665
2658
  )), t === u - 1 && i === p - 1 && S > 0.99 ? 1 : S;
2666
2659
  })
2667
- ), En = (e) => e.spine.spineLayout.layout$.pipe(
2660
+ ), Hn = (e) => e.spine.spineLayout.layout$.pipe(
2668
2661
  St(10, at),
2669
2662
  D(e.pagination.state$),
2670
2663
  b(() => ({
@@ -2682,7 +2675,7 @@ const De = (e, t, i) => {
2682
2675
  numberOfPagesPerItems: [],
2683
2676
  numberOfTotalPages: 0
2684
2677
  })
2685
- ), Bn = (e, t, i, n) => {
2678
+ ), En = (e, t, i, n) => {
2686
2679
  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;
2687
2680
  return w({
2688
2681
  ...t,
@@ -2713,7 +2706,7 @@ const De = (e, t, i) => {
2713
2706
  // hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
2714
2707
  // numberOfSpineItems: context.manifest?.readingOrder.length,
2715
2708
  });
2716
- }, _n = (e) => q([
2709
+ }, Bn = (e) => q([
2717
2710
  e.pagination.state$,
2718
2711
  // Usually pagination change if layout changes (number of pages) however it is especially
2719
2712
  // useful for like webtoon where you still have one page but only the layout will give you the final size
@@ -2722,7 +2715,7 @@ const De = (e, t, i) => {
2722
2715
  ]).pipe(
2723
2716
  v(([t]) => {
2724
2717
  const i = t.endSpineItemIndex !== void 0 ? e.spineItemsManager.get(t.endSpineItemIndex) : void 0;
2725
- return i ? Hn(
2718
+ return i ? Un(
2726
2719
  e,
2727
2720
  t.endSpineItemIndex ?? 0,
2728
2721
  t.endPageIndexInSpineItem || 0,
@@ -2730,8 +2723,8 @@ const De = (e, t, i) => {
2730
2723
  i
2731
2724
  ) : w(0);
2732
2725
  })
2733
- ), Xn = (e) => {
2734
- const t = Wn(e), i = En(e), n = new k({
2726
+ ), _n = (e) => {
2727
+ const t = kn(e), i = Hn(e), n = new k({
2735
2728
  ...e.pagination.state,
2736
2729
  beginChapterInfo: void 0,
2737
2730
  beginCfi: void 0,
@@ -2749,10 +2742,10 @@ const De = (e, t, i) => {
2749
2742
  }), o = q([
2750
2743
  e.pagination.state$,
2751
2744
  t,
2752
- _n(e)
2745
+ Bn(e)
2753
2746
  ]).pipe(
2754
2747
  v(
2755
- ([r, a, c]) => Bn(
2748
+ ([r, a, c]) => En(
2756
2749
  e,
2757
2750
  r,
2758
2751
  a,
@@ -2787,10 +2780,10 @@ const De = (e, t, i) => {
2787
2780
  }),
2788
2781
  et(1)
2789
2782
  ), getPaginationInfo: () => n.value };
2790
- }, qn = (e) => (t) => {
2791
- const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = Xn(i);
2783
+ }, Xn = (e) => (t) => {
2784
+ const i = e(t), { paginationInfo$: n, getPaginationInfo: o } = _n(i);
2792
2785
  n.pipe(F(i.$.destroy$)).subscribe();
2793
- const s = new Vn(i);
2786
+ const s = new Nn(i);
2794
2787
  return {
2795
2788
  ...i,
2796
2789
  locateResource: s.locateResource.bind(s),
@@ -2804,7 +2797,7 @@ const De = (e, t, i) => {
2804
2797
  }
2805
2798
  }
2806
2799
  };
2807
- }, Yn = (e) => ({
2800
+ }, qn = (e) => ({
2808
2801
  put: (s, r) => new Promise((a, c) => {
2809
2802
  const u = e.transaction(["store"], "readwrite");
2810
2803
  u.onerror = (l) => {
@@ -2862,11 +2855,11 @@ const De = (e, t, i) => {
2862
2855
  n.onerror = (o) => {
2863
2856
  i(o);
2864
2857
  }, n.onsuccess = () => {
2865
- t(Yn(n.result));
2858
+ t(qn(n.result));
2866
2859
  }, n.onupgradeneeded = () => {
2867
2860
  n.result.createObjectStore("store");
2868
2861
  };
2869
- }), Zn = (e) => {
2862
+ }), Yn = (e) => {
2870
2863
  let t = Date.now().toString();
2871
2864
  const i = new U(), n = (c) => {
2872
2865
  var u, d;
@@ -2887,13 +2880,13 @@ const De = (e, t, i) => {
2887
2880
  i.next({ id: c, data: u });
2888
2881
  };
2889
2882
  i.asObservable().pipe(
2890
- ai(({ id: c, data: u }) => {
2883
+ ci(({ id: c, data: u }) => {
2891
2884
  const d = n(c);
2892
2885
  return d ? W(
2893
- Je([At("prose-reader"), W(u.blob())])
2886
+ Ke([At("prose-reader"), W(u.blob())])
2894
2887
  ).pipe(
2895
2888
  _(([g, l]) => W(g.put(`${t}_${d.id}`, l))),
2896
- Qt((g) => (j.error(g), K))
2889
+ ee((g) => (j.error(g), K))
2897
2890
  ) : K;
2898
2891
  }),
2899
2892
  J(e.destroy$)
@@ -2916,7 +2909,7 @@ const De = (e, t, i) => {
2916
2909
  })
2917
2910
  )
2918
2911
  ),
2919
- Qt((c) => (j.error(c), K))
2912
+ ee((c) => (j.error(c), K))
2920
2913
  ))),
2921
2914
  J(e.destroy$)
2922
2915
  ).subscribe(), {
@@ -2925,8 +2918,8 @@ const De = (e, t, i) => {
2925
2918
  i.complete();
2926
2919
  }
2927
2920
  };
2928
- }, Gn = (e) => (t) => {
2929
- const i = e(t), n = Zn(i.context);
2921
+ }, Zn = (e) => (t) => {
2922
+ const i = e(t), n = Yn(i.context);
2930
2923
  return {
2931
2924
  ...i,
2932
2925
  // $: {
@@ -2938,7 +2931,7 @@ const De = (e, t, i) => {
2938
2931
  }
2939
2932
  // load,
2940
2933
  };
2941
- }, Jn = (e, t) => {
2934
+ }, Gn = (e, t) => {
2942
2935
  var o;
2943
2936
  const i = (o = e.node.ownerDocument) == null ? void 0 : o.createRange(), n = e.node.compareDocumentPosition(t.node);
2944
2937
  if (i) {
@@ -2959,14 +2952,14 @@ const De = (e, t, i) => {
2959
2952
  }
2960
2953
  return i;
2961
2954
  }
2962
- }, Kn = ({
2955
+ }, Jn = ({
2963
2956
  selection: e,
2964
2957
  spineItem: t
2965
2958
  }) => {
2966
2959
  const { anchorNode: i, anchorOffset: n, focusNode: o, focusOffset: s } = e;
2967
2960
  if (!(!i || !o))
2968
2961
  try {
2969
- return Jn(
2962
+ return Gn(
2970
2963
  { node: i, offset: n },
2971
2964
  { node: o, offset: s }
2972
2965
  );
@@ -2978,7 +2971,7 @@ const De = (e, t, i) => {
2978
2971
  return;
2979
2972
  }
2980
2973
  };
2981
- class Qn extends Y {
2974
+ class Kn extends Y {
2982
2975
  constructor(t) {
2983
2976
  var n;
2984
2977
  super();
@@ -2986,14 +2979,14 @@ class Qn extends Y {
2986
2979
  if (!i)
2987
2980
  this.selectionChange$ = gt, this.selectionOver$ = gt;
2988
2981
  else {
2989
- const o = ie(i.body, {
2982
+ const o = oe(i.body, {
2990
2983
  childList: !0,
2991
2984
  subtree: !0
2992
2985
  }).pipe(
2993
2986
  R(
2994
2987
  (r) => !!r.find((a) => a.type === "childList" && a.removedNodes.length)
2995
2988
  )
2996
- ), s = t.parentElement ? ie(t.parentElement, {
2989
+ ), s = t.parentElement ? oe(t.parentElement, {
2997
2990
  childList: !0
2998
2991
  }).pipe(
2999
2992
  R(
@@ -3034,12 +3027,12 @@ class Qn extends Y {
3034
3027
  }
3035
3028
  }
3036
3029
  }
3037
- const to = (e) => e.loaded$.pipe(
3030
+ const Qn = (e) => e.loaded$.pipe(
3038
3031
  v(() => {
3039
3032
  var o;
3040
3033
  const t = e.renderer.getDocumentFrame(), i = (t == null ? void 0 : t.contentDocument) || ((o = t == null ? void 0 : t.contentWindow) == null ? void 0 : o.document);
3041
3034
  if (!t || !i) return gt;
3042
- const n = new Qn(t);
3035
+ const n = new Kn(t);
3043
3036
  return x(
3044
3037
  n.selectionChange$.pipe(
3045
3038
  b((s) => {
@@ -3066,14 +3059,14 @@ const to = (e) => e.loaded$.pipe(
3066
3059
  );
3067
3060
  }),
3068
3061
  E()
3069
- ), eo = (e) => (t) => {
3062
+ ), to = (e) => (t) => {
3070
3063
  const i = e(t);
3071
3064
  let n;
3072
3065
  const o = i.spineItemsManager.items$.pipe(
3073
3066
  v((d) => {
3074
3067
  const g = d.map((l) => {
3075
3068
  const p = i.spineItemsManager.getSpineItemIndex(l) ?? 0;
3076
- return to(l).pipe(
3069
+ return Qn(l).pipe(
3077
3070
  b((h) => {
3078
3071
  if (h)
3079
3072
  return {
@@ -3120,10 +3113,10 @@ const to = (e) => e.loaded$.pipe(
3120
3113
  selectionOver$: c,
3121
3114
  lastSelectionOnPointerdown$: u,
3122
3115
  getSelection: () => n,
3123
- createOrderedRangeFromSelection: Kn
3116
+ createOrderedRangeFromSelection: Jn
3124
3117
  }
3125
3118
  };
3126
- }, re = [
3119
+ }, ce = [
3127
3120
  {
3128
3121
  name: "bright",
3129
3122
  backgroundColor: "white"
@@ -3138,11 +3131,11 @@ const to = (e) => e.loaded$.pipe(
3138
3131
  backgroundColor: "#191717",
3139
3132
  foregroundColor: "#f1ebeb"
3140
3133
  }
3141
- ], io = (e) => (t) => {
3134
+ ], eo = (e) => (t) => {
3142
3135
  const i = e(t), n = new k(
3143
3136
  t.theme ?? "bright"
3144
3137
  ), o = () => {
3145
- const a = re.find(
3138
+ const a = ce.find(
3146
3139
  (c) => c.name === n.value
3147
3140
  );
3148
3141
  return `
@@ -3159,7 +3152,7 @@ const to = (e) => e.loaded$.pipe(
3159
3152
  }, s = ({
3160
3153
  container: a
3161
3154
  }) => {
3162
- const c = re.find(
3155
+ const c = ce.find(
3163
3156
  (u) => u.name === n.value
3164
3157
  );
3165
3158
  return c && a.style.setProperty(
@@ -3203,11 +3196,11 @@ const to = (e) => e.loaded$.pipe(
3203
3196
  }
3204
3197
  }
3205
3198
  };
3206
- }, no = (e) => (t) => ({
3199
+ }, io = (e) => (t) => ({
3207
3200
  ...e(t),
3208
3201
  utils: {
3209
3202
  isOrIsWithinValidLink: (o) => {
3210
- if (be(o)) {
3203
+ if (Pe(o)) {
3211
3204
  const s = o.nodeName === "a" ? o : o.closest("a");
3212
3205
  if (s != null && s.getAttribute("href"))
3213
3206
  return !0;
@@ -3217,13 +3210,13 @@ const to = (e) => e.loaded$.pipe(
3217
3210
  }
3218
3211
  });
3219
3212
  navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
3220
- const oo = (e) => (t) => e(t);
3221
- class Ne {
3213
+ const no = (e) => (t) => e(t);
3214
+ class Ve {
3222
3215
  constructor(t) {
3223
3216
  this.reader = t;
3224
3217
  }
3225
3218
  }
3226
- class so extends Ne {
3219
+ class oo extends Ve {
3227
3220
  constructor() {
3228
3221
  super(...arguments), this.isZooming$ = new k(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3229
3222
  }
@@ -3280,7 +3273,7 @@ const Tt = ({
3280
3273
  const o = i * e / 2 - i + i / 2, s = i * t / 2 - i + i / 2, r = e / t, a = n - s;
3281
3274
  return Math.max(o + a * r, 0);
3282
3275
  };
3283
- class ro extends Ne {
3276
+ class so extends Ve {
3284
3277
  constructor() {
3285
3278
  super(...arguments), this.isZooming$ = new k(!1), this.currentScale = 1, this.currentPosition = { x: 0, y: 0 };
3286
3279
  }
@@ -3313,8 +3306,8 @@ class ro extends Ne {
3313
3306
  }), this.currentScale = o;
3314
3307
  }
3315
3308
  }
3316
- const ao = (e) => (t) => {
3317
- const i = e(t), n = new so(i), o = new ro(i), s = new k(o);
3309
+ const ro = (e) => (t) => {
3310
+ const i = e(t), n = new oo(i), o = new so(i), s = new k(o);
3318
3311
  return {
3319
3312
  ...i,
3320
3313
  destroy: () => {
@@ -3345,7 +3338,7 @@ const ao = (e) => (t) => {
3345
3338
  }
3346
3339
  }
3347
3340
  };
3348
- }, Ve = (e) => (e == null ? void 0 : e.renditionLayout) === "pre-paginated" || (e == null ? void 0 : e.spineItems.every((t) => t.renditionLayout === "pre-paginated"));
3341
+ }, je = (e) => (e == null ? void 0 : e.renditionLayout) === "pre-paginated" || (e == null ? void 0 : e.spineItems.every((t) => t.renditionLayout === "pre-paginated"));
3349
3342
  class bt extends st {
3350
3343
  constructor(t) {
3351
3344
  super((i) => this.stateSubject.pipe(F(this.destroy$)).subscribe(i)), this.destroy$ = new U(), this.stateSubject = new k(t);
@@ -3361,7 +3354,7 @@ class bt extends st {
3361
3354
  N(this.value, i) || this.stateSubject.next(i);
3362
3355
  }
3363
3356
  watch(t) {
3364
- return Array.isArray(t) ? this.stateSubject.pipe(Xt(t)) : this.stateSubject.pipe(
3357
+ return Array.isArray(t) ? this.stateSubject.pipe(qt(t)) : this.stateSubject.pipe(
3365
3358
  b((i) => i[t]),
3366
3359
  E(N)
3367
3360
  );
@@ -3373,9 +3366,9 @@ class bt extends st {
3373
3366
  this.stateSubject.complete(), this.destroy$.complete();
3374
3367
  }
3375
3368
  }
3376
- class co {
3369
+ class ao {
3377
3370
  constructor() {
3378
- this.navigationSubject = new Gt(1), this.viewportStateSubject = new k("free"), this.paginationSubject = new Gt(), this.navigationIsLockedSubject = new k(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3371
+ this.navigationSubject = new Kt(1), this.viewportStateSubject = new k("free"), this.paginationSubject = new Kt(), this.navigationIsLockedSubject = new k(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
3379
3372
  E(),
3380
3373
  R((t) => !t)
3381
3374
  ), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
@@ -3385,7 +3378,7 @@ class co {
3385
3378
  ), this.navigation$ = this.navigationSubject.asObservable();
3386
3379
  }
3387
3380
  }
3388
- const uo = ({
3381
+ const co = ({
3389
3382
  manifest: e,
3390
3383
  visibleAreaRect: t,
3391
3384
  forceSinglePageMode: i
@@ -3393,7 +3386,7 @@ const uo = ({
3393
3386
  const { height: n, width: o } = t, s = o > n;
3394
3387
  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");
3395
3388
  };
3396
- class go extends bt {
3389
+ class uo extends bt {
3397
3390
  constructor() {
3398
3391
  super({
3399
3392
  marginBottom: 0,
@@ -3406,7 +3399,7 @@ class go extends bt {
3406
3399
  x: 0,
3407
3400
  y: 0
3408
3401
  }
3409
- }), this.bridgeEvent = new co(), this.destroy$ = new U(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
3402
+ }), this.bridgeEvent = new ao(), this.destroy$ = new U(), this.state$ = this.pipe(Z(N)), this.manifest$ = this.pipe(
3410
3403
  X((t) => t.manifest),
3411
3404
  tt(ct),
3412
3405
  Z()
@@ -3438,10 +3431,10 @@ class go extends bt {
3438
3431
  height: t.visibleAreaRect.height - r - a
3439
3432
  },
3440
3433
  ...t.manifest && {
3441
- isFullyPrePaginated: Ve(n),
3434
+ isFullyPrePaginated: je(n),
3442
3435
  assumedRenditionLayout: (n == null ? void 0 : n.renditionLayout) ?? "reflowable"
3443
3436
  },
3444
- isUsingSpreadMode: uo({
3437
+ isUsingSpreadMode: co({
3445
3438
  manifest: n,
3446
3439
  visibleAreaRect: s,
3447
3440
  forceSinglePageMode: o
@@ -3473,7 +3466,7 @@ class go extends bt {
3473
3466
  };
3474
3467
  }
3475
3468
  }
3476
- class lo extends bt {
3469
+ class go extends bt {
3477
3470
  constructor(t, i) {
3478
3471
  super({
3479
3472
  supportedPageTurnAnimation: ["fade", "none", "slide"],
@@ -3509,7 +3502,7 @@ class lo extends bt {
3509
3502
  ).subscribe(this.next.bind(this));
3510
3503
  }
3511
3504
  }
3512
- class po {
3505
+ class lo {
3513
3506
  constructor() {
3514
3507
  this._hooks = [], this._hookExecutions = [];
3515
3508
  }
@@ -3571,7 +3564,7 @@ class po {
3571
3564
  return q(s);
3572
3565
  }
3573
3566
  }
3574
- class je {
3567
+ class ke {
3575
3568
  constructor() {
3576
3569
  this.isLockedSubject = new k(0), this.isLocked$ = this.isLockedSubject.pipe(
3577
3570
  b((t) => !!t),
@@ -3585,7 +3578,7 @@ class je {
3585
3578
  };
3586
3579
  }
3587
3580
  }
3588
- const ho = () => (e) => e.pipe(
3581
+ const po = () => (e) => e.pipe(
3589
3582
  b(({ navigation: t, pagination: i, ...n }) => ({
3590
3583
  navigation: {
3591
3584
  ...t,
@@ -3593,7 +3586,7 @@ const ho = () => (e) => e.pipe(
3593
3586
  },
3594
3587
  ...n
3595
3588
  }))
3596
- ), mo = (e, t, i) => e.bridgeEvent.pagination$.pipe(
3589
+ ), ho = (e, t, i) => e.bridgeEvent.pagination$.pipe(
3597
3590
  D(t),
3598
3591
  R(
3599
3592
  ([n, o]) => n.navigationId === o.id
@@ -3613,7 +3606,7 @@ const ho = () => (e) => e.pipe(
3613
3606
  }))
3614
3607
  );
3615
3608
  }),
3616
- ho(),
3609
+ po(),
3617
3610
  E(
3618
3611
  (n, o) => n.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
3619
3612
  ),
@@ -3625,7 +3618,7 @@ const ho = () => (e) => e.pipe(
3625
3618
  }
3626
3619
  })
3627
3620
  )
3628
- ), fo = (e) => e.pipe(
3621
+ ), mo = (e) => e.pipe(
3629
3622
  b(([t, i]) => {
3630
3623
  const n = {
3631
3624
  type: "api",
@@ -3641,7 +3634,7 @@ const ho = () => (e) => e.pipe(
3641
3634
  navigation: n
3642
3635
  };
3643
3636
  })
3644
- ), yo = ({ navigationResolver: e }) => (t) => t.pipe(
3637
+ ), fo = ({ navigationResolver: e }) => (t) => t.pipe(
3645
3638
  b((i) => {
3646
3639
  if (i.navigation.cfi) {
3647
3640
  const n = e.getNavigationForCfi(
@@ -3658,16 +3651,16 @@ const ho = () => (e) => e.pipe(
3658
3651
  }
3659
3652
  return i;
3660
3653
  })
3661
- ), So = ({
3654
+ ), yo = ({
3662
3655
  navigation: e,
3663
3656
  previousNavigation: t,
3664
3657
  settings: i
3665
- }) => 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", bo = ({
3658
+ }) => 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", So = ({
3666
3659
  context: e,
3667
3660
  settings: t
3668
3661
  }) => (i) => i.pipe(
3669
3662
  b(({ navigation: n, previousNavigation: o }) => {
3670
- const s = So({
3663
+ const s = yo({
3671
3664
  navigation: n,
3672
3665
  previousNavigation: o,
3673
3666
  settings: t
@@ -3681,7 +3674,7 @@ const ho = () => (e) => e.pipe(
3681
3674
  direction: s
3682
3675
  };
3683
3676
  })
3684
- ), Io = ({
3677
+ ), bo = ({
3685
3678
  spineItemsManager: e,
3686
3679
  navigationResolver: t
3687
3680
  }) => (i) => i.pipe(
@@ -3709,7 +3702,7 @@ const ho = () => (e) => e.pipe(
3709
3702
  ...o
3710
3703
  };
3711
3704
  })
3712
- ), ae = ({
3705
+ ), ue = ({
3713
3706
  settings: e,
3714
3707
  spineItemsManager: t,
3715
3708
  navigationResolver: i,
@@ -3768,7 +3761,7 @@ const ho = () => (e) => e.pipe(
3768
3761
  };
3769
3762
  })
3770
3763
  );
3771
- }, ce = ({ spine: e }) => (t) => t.pipe(
3764
+ }, de = ({ spine: e }) => (t) => t.pipe(
3772
3765
  v(({ navigation: i, ...n }) => {
3773
3766
  const o = e.spineLayout.getSpineItemSpineLayoutInfo(i.spineItem), s = e.spineItemsManager.get(i.spineItem);
3774
3767
  return ((s == null ? void 0 : s.isReady$) ?? w(!1)).pipe(
@@ -3833,7 +3826,7 @@ const ho = () => (e) => e.pipe(
3833
3826
  ...a
3834
3827
  }))
3835
3828
  );
3836
- }, wo = ({ navigationResolver: e }) => (t) => t.pipe(
3829
+ }, Io = ({ navigationResolver: e }) => (t) => t.pipe(
3837
3830
  b((i) => {
3838
3831
  if (i.navigation.url) {
3839
3832
  const n = e.getNavigationForUrl(
@@ -3851,7 +3844,7 @@ const ho = () => (e) => e.pipe(
3851
3844
  }
3852
3845
  return i;
3853
3846
  })
3854
- ), Po = ({
3847
+ ), wo = ({
3855
3848
  spineLocator: e,
3856
3849
  navigation: t,
3857
3850
  navigationResolver: i,
@@ -3877,7 +3870,7 @@ const ho = () => (e) => e.pipe(
3877
3870
  return m.position;
3878
3871
  }
3879
3872
  const l = t.cfi ?? t.paginationBeginCfi;
3880
- if (l !== void 0 && !zt(l) && (u || d || // when spine item is ready dimensions may have not changed but the position
3873
+ if (l !== void 0 && !Ut(l) && (u || d || // when spine item is ready dimensions may have not changed but the position
3881
3874
  // of dom elements may have!
3882
3875
  r && !t.spineItemIsReady)) {
3883
3876
  const m = i.getNavigationForCfi(l);
@@ -3909,7 +3902,7 @@ const ho = () => (e) => e.pipe(
3909
3902
  return c ? i.getNavigationForPosition(t.position) : i.getNavigationForSpineIndexOrId(s);
3910
3903
  })
3911
3904
  ) : w(new M({ x: 0, y: 0 }));
3912
- }, vo = ({
3905
+ }, Po = ({
3913
3906
  navigation: e,
3914
3907
  spineLocator: t,
3915
3908
  spineItemsManager: i,
@@ -3978,7 +3971,7 @@ const ho = () => (e) => e.pipe(
3978
3971
  }
3979
3972
  }
3980
3973
  return e.position;
3981
- }, xo = ({
3974
+ }, vo = ({
3982
3975
  navigation: e,
3983
3976
  spineItemsManager: t,
3984
3977
  settings: i,
@@ -3986,7 +3979,7 @@ const ho = () => (e) => e.pipe(
3986
3979
  navigationResolver: o,
3987
3980
  spineLayout: s
3988
3981
  }) => i.values.computedPageTurnMode === "scrollable" ? w(
3989
- vo({
3982
+ Po({
3990
3983
  navigation: e,
3991
3984
  spineLocator: n,
3992
3985
  navigationResolver: o,
@@ -3994,19 +3987,19 @@ const ho = () => (e) => e.pipe(
3994
3987
  spineItemsManager: t,
3995
3988
  spineLayout: s
3996
3989
  })
3997
- ) : Po({
3990
+ ) : wo({
3998
3991
  navigation: e,
3999
3992
  spineLocator: n,
4000
3993
  navigationResolver: o,
4001
3994
  spineItemsManager: t,
4002
3995
  spineLayout: s
4003
- }), ue = ({
3996
+ }), ge = ({
4004
3997
  settings: e,
4005
3998
  navigationResolver: t,
4006
3999
  context: i,
4007
4000
  spine: n
4008
4001
  }) => (o) => o.pipe(
4009
- v((s) => xo({
4002
+ v((s) => vo({
4010
4003
  spineLocator: n.locator,
4011
4004
  navigation: s.navigation,
4012
4005
  navigationResolver: t,
@@ -4023,8 +4016,8 @@ const ho = () => (e) => e.pipe(
4023
4016
  }
4024
4017
  }))
4025
4018
  ))
4026
- ), $o = "navigation/InternalNavigator", To = j.namespace($o);
4027
- class Fo extends Y {
4019
+ ), xo = "navigation/InternalNavigator", $o = j.namespace(xo);
4020
+ class To extends Y {
4028
4021
  constructor(t, i, n, o, s, r, a, c) {
4029
4022
  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 k({
4030
4023
  animation: !1,
@@ -4035,7 +4028,7 @@ class Fo extends Y {
4035
4028
  spineItemIsReady: !1,
4036
4029
  type: "api",
4037
4030
  id: Symbol()
4038
- }), this.navigated$ = this.navigationSubject.pipe(me(1)), this.navigation$ = this.navigationSubject.pipe(
4031
+ }), this.navigated$ = this.navigationSubject.pipe(ye(1)), this.navigation$ = this.navigationSubject.pipe(
4039
4032
  b(({ position: f, id: y }) => ({
4040
4033
  position: f,
4041
4034
  id: y
@@ -4044,26 +4037,26 @@ class Fo extends Y {
4044
4037
  ({ position: f, ...y }, { position: I, ...P }) => N(y, P) && N(f, I)
4045
4038
  ),
4046
4039
  et(1)
4047
- ), this.locker = new je();
4040
+ ), this.locker = new ke();
4048
4041
  const u = n.pipe(
4049
4042
  D(this.navigationSubject),
4050
- fo,
4043
+ mo,
4051
4044
  /**
4052
4045
  * Url lookup is heavier so we start with it to fill
4053
4046
  * as much information as needed to reduce later lookup
4054
4047
  */
4055
- wo({
4048
+ Io({
4056
4049
  navigationResolver: r
4057
4050
  }),
4058
4051
  /**
4059
4052
  * Cfi lookup is heavier so we start with it to fill
4060
4053
  * as much information as needed to reduce later lookup
4061
4054
  */
4062
- yo({
4055
+ fo({
4063
4056
  navigationResolver: r
4064
4057
  }),
4065
- bo({ context: i, settings: t }),
4066
- ae({
4058
+ So({ context: i, settings: t }),
4059
+ ue({
4067
4060
  navigationResolver: r,
4068
4061
  settings: t,
4069
4062
  spineItemsManager: a.spineItemsManager,
@@ -4075,11 +4068,11 @@ class Fo extends Y {
4075
4068
  spineItemsManager: a.spineItemsManager,
4076
4069
  spineLocator: a.locator
4077
4070
  }),
4078
- ce({
4071
+ de({
4079
4072
  spine: a
4080
4073
  })
4081
4074
  ).pipe(
4082
- Io({
4075
+ bo({
4083
4076
  navigationResolver: r,
4084
4077
  spineItemsManager: a.spineItemsManager
4085
4078
  }),
@@ -4087,7 +4080,7 @@ class Fo extends Y {
4087
4080
  v(([f, y]) => {
4088
4081
  const I = f.navigation.cfi || f.navigation.url || t.values.computedPageTurnMode === "scrollable" || y;
4089
4082
  return w(f).pipe(
4090
- I ? Pt : ue({
4083
+ I ? Pt : ge({
4091
4084
  navigationResolver: r,
4092
4085
  settings: t,
4093
4086
  spine: a,
@@ -4155,7 +4148,7 @@ class Fo extends Y {
4155
4148
  d
4156
4149
  ).pipe(
4157
4150
  b((f) => ({ navigation: f })),
4158
- ue({
4151
+ ge({
4159
4152
  navigationResolver: r,
4160
4153
  settings: t,
4161
4154
  context: i,
@@ -4178,13 +4171,13 @@ class Fo extends Y {
4178
4171
  * eg: after the reader load and the user has never navigated
4179
4172
  * yet.
4180
4173
  */
4181
- ae({
4174
+ ue({
4182
4175
  navigationResolver: r,
4183
4176
  settings: t,
4184
4177
  spineItemsManager: a.spineItemsManager,
4185
4178
  spineLocator: a.locator
4186
4179
  }),
4187
- ce({
4180
+ de({
4188
4181
  spine: a
4189
4182
  }),
4190
4183
  Ot({
@@ -4195,7 +4188,7 @@ class Fo extends Y {
4195
4188
  }),
4196
4189
  b(({ navigation: f }) => f),
4197
4190
  V()
4198
- ), p = mo(
4191
+ ), p = ho(
4199
4192
  i,
4200
4193
  this.navigationSubject,
4201
4194
  a
@@ -4205,7 +4198,7 @@ class Fo extends Y {
4205
4198
  p
4206
4199
  ), m = (f) => f.pipe(
4207
4200
  T(([y, I]) => {
4208
- To.info(
4201
+ $o.info(
4209
4202
  `navigation updated from ${y.meta.triggeredBy} of type ${y.type}`,
4210
4203
  {
4211
4204
  previousNavigation: I,
@@ -4246,7 +4239,7 @@ class Fo extends Y {
4246
4239
  return this.navigationSubject.getValue();
4247
4240
  }
4248
4241
  }
4249
- const ke = ({
4242
+ const We = ({
4250
4243
  position: { x: e, y: t },
4251
4244
  spineElement: i,
4252
4245
  element: n
@@ -4269,8 +4262,8 @@ const ke = ({
4269
4262
  scrollOffset: t
4270
4263
  })
4271
4264
  });
4272
- }, Lo = 500;
4273
- class Mo extends Y {
4265
+ }, Fo = 500;
4266
+ class Lo extends Y {
4274
4267
  constructor(t, i, n, o, s) {
4275
4268
  super(), this.settings = t, this.context = i, this.spine = n, this.scrollNavigationController = o, this.locker = s, this.navigationSubject = new U(), this.navigation$ = this.navigationSubject.asObservable();
4276
4269
  const r = this.scrollNavigationController.userScroll$.pipe(
@@ -4281,12 +4274,12 @@ class Mo extends Y {
4281
4274
  w(a)
4282
4275
  ).pipe(
4283
4276
  St(
4284
- Lo,
4277
+ Fo,
4285
4278
  at
4286
4279
  ),
4287
4280
  H(),
4288
4281
  T(() => {
4289
- const u = a.target, d = ke({
4282
+ const u = a.target, d = We({
4290
4283
  element: u,
4291
4284
  position: new M({
4292
4285
  x: u.scrollLeft ?? 0,
@@ -4309,17 +4302,17 @@ class Mo extends Y {
4309
4302
  x(r).pipe(F(this.destroy$)).subscribe();
4310
4303
  }
4311
4304
  }
4312
- const Co = (e) => ({
4305
+ const Mo = (e) => ({
4313
4306
  x: -e.x,
4314
4307
  y: -e.y
4315
- }), Ro = (e) => e instanceof DOMMatrix ? new M({
4308
+ }), Co = (e) => e instanceof DOMMatrix ? new M({
4316
4309
  x: -e.e,
4317
4310
  y: -e.f
4318
4311
  }) : new M({
4319
4312
  x: -e.x,
4320
4313
  y: -e.y
4321
- }), Ao = "navigation/ViewportNavigator", de = j.namespace(Ao);
4322
- class Oo extends Y {
4314
+ }), Ro = "navigation/ViewportNavigator", le = j.namespace(Ro);
4315
+ class Ao extends Y {
4323
4316
  constructor(t, i, n, o, s) {
4324
4317
  super(), this.settings = t, this.hookManager = i, this.context = n, this.spine = o, this.viewport = s, this.navigateSubject = new U(), this.element$ = new k(
4325
4318
  document.createElement("div")
@@ -4347,13 +4340,13 @@ class Oo extends Y {
4347
4340
  );
4348
4341
  this.layout$ = c.pipe(
4349
4342
  T(() => {
4350
- de.info("layout", t.values);
4343
+ le.info("layout", t.values);
4351
4344
  }),
4352
4345
  V()
4353
4346
  );
4354
4347
  const u = this.navigateSubject.pipe(
4355
4348
  T((d) => {
4356
- de.info("Navigation requested", d);
4349
+ le.info("Navigation requested", d);
4357
4350
  })
4358
4351
  );
4359
4352
  this.isNavigating$ = u.pipe(
@@ -4430,7 +4423,7 @@ class Oo extends Y {
4430
4423
  * for remark about flicker / fonts smoothing
4431
4424
  */
4432
4425
  setViewportPosition(t) {
4433
- const i = this.element$.getValue(), n = Co(t);
4426
+ const i = this.element$.getValue(), n = Mo(t);
4434
4427
  i.style.transform = `translate(${n.x}px, ${n.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4435
4428
  }
4436
4429
  navigate(t) {
@@ -4445,10 +4438,10 @@ class Oo extends Y {
4445
4438
  if (!n || n === "none")
4446
4439
  return new M({ x: 0, y: 0 });
4447
4440
  const o = new DOMMatrix(n);
4448
- return Ro(o);
4441
+ return Co(o);
4449
4442
  }
4450
4443
  }
4451
- class Do extends bt {
4444
+ class Oo extends bt {
4452
4445
  constructor(t, i, n, o, s) {
4453
4446
  super({
4454
4447
  element: void 0
@@ -4458,15 +4451,15 @@ class Do extends bt {
4458
4451
  left: g.x,
4459
4452
  top: g.y,
4460
4453
  behavior: "instant"
4461
- }), Jt(1).pipe(
4454
+ }), Qt(1).pipe(
4462
4455
  T(() => {
4463
4456
  this.scrollingSubject.next(!1);
4464
4457
  }),
4465
- F(x(this.scrollingSubject.pipe(me(1)), this.destroy$))
4458
+ F(x(this.scrollingSubject.pipe(ye(1)), this.destroy$))
4466
4459
  ).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
4467
4460
  };
4468
4461
  const r = this.context.pipe(
4469
- Xt(["rootElement"]),
4462
+ qt(["rootElement"]),
4470
4463
  T(({ rootElement: g }) => {
4471
4464
  if (!g) return;
4472
4465
  const l = document.createElement("div");
@@ -4492,12 +4485,12 @@ class Do extends bt {
4492
4485
  et(1)
4493
4486
  );
4494
4487
  const u = x(
4495
- o.element$.pipe(v((g) => ve(g))),
4488
+ o.element$.pipe(v((g) => Te(g))),
4496
4489
  o.element$.pipe(v((g) => G(g, "scroll"))),
4497
4490
  o.spineItemsObserver.itemResize$
4498
4491
  ).pipe(
4499
4492
  v(
4500
- () => Jt(10).pipe(
4493
+ () => Qt(10).pipe(
4501
4494
  b(() => !1),
4502
4495
  nt(!0)
4503
4496
  )
@@ -4539,7 +4532,7 @@ class Do extends bt {
4539
4532
  }
4540
4533
  get viewportPosition() {
4541
4534
  const t = this.value.element;
4542
- return t ? ke({
4535
+ return t ? We({
4543
4536
  element: t,
4544
4537
  position: new M({
4545
4538
  x: (t == null ? void 0 : t.scrollLeft) ?? 0,
@@ -4549,13 +4542,13 @@ class Do extends bt {
4549
4542
  }) : new M({ x: 0, y: 0 });
4550
4543
  }
4551
4544
  }
4552
- const ge = (e, t, i) => {
4545
+ const pe = (e, t, i) => {
4553
4546
  const n = i - e, o = i * (t * e) / (i || 1);
4554
4547
  return Math.max(0, Math.min(n, o));
4555
- }, Ut = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), xt = (e, t, i) => {
4556
- const n = Ut(i, t), o = [...Array(n)].map((s, r) => r * t);
4548
+ }, Ht = (e, t) => (t || 0) === 0 || (e || 0) === 0 ? 1 : Math.floor(Math.max(1, e / t)), xt = (e, t, i) => {
4549
+ const n = Ht(i, t), o = [...Array(n)].map((s, r) => r * t);
4557
4550
  return e >= n * t ? o[o.length - 1] || 0 : o.find((s) => e < s + t) || 0;
4558
- }, Zt = ({
4551
+ }, Jt = ({
4559
4552
  itemHeight: e,
4560
4553
  itemWidth: t,
4561
4554
  isUsingVerticalWriting: i,
@@ -4563,18 +4556,18 @@ const ge = (e, t, i) => {
4563
4556
  context: o
4564
4557
  }) => {
4565
4558
  const { pageTurnDirection: s, pageTurnMode: r } = n.values;
4566
- return s === "vertical" && r === "scrollable" ? 1 : i || s === "vertical" ? Ut(
4559
+ return s === "vertical" && r === "scrollable" ? 1 : i || s === "vertical" ? Ht(
4567
4560
  e,
4568
4561
  o.getPageSize().height
4569
- ) : Ut(t, o.getPageSize().width);
4570
- }, Ht = ({
4562
+ ) : Ht(t, o.getPageSize().width);
4563
+ }, Et = ({
4571
4564
  pageIndex: e,
4572
4565
  itemLayout: t,
4573
4566
  context: i,
4574
4567
  isUsingVerticalWriting: n
4575
4568
  }) => {
4576
4569
  if (n) {
4577
- const s = ge(
4570
+ const s = pe(
4578
4571
  i.getPageSize().height,
4579
4572
  e,
4580
4573
  t.height
@@ -4584,7 +4577,7 @@ const ge = (e, t, i) => {
4584
4577
  y: s
4585
4578
  });
4586
4579
  }
4587
- const o = ge(
4580
+ const o = pe(
4588
4581
  i.getPageSize().width,
4589
4582
  e,
4590
4583
  t.width
@@ -4596,13 +4589,13 @@ const ge = (e, t, i) => {
4596
4589
  x: o,
4597
4590
  y: 0
4598
4591
  });
4599
- }, No = ({
4592
+ }, Do = ({
4600
4593
  context: e,
4601
4594
  isUsingVerticalWriting: t,
4602
4595
  settings: i,
4603
4596
  itemLayout: n
4604
4597
  }) => {
4605
- const o = Zt({
4598
+ const o = Jt({
4606
4599
  context: e,
4607
4600
  isUsingVerticalWriting: t,
4608
4601
  itemHeight: n.height,
@@ -4610,14 +4603,14 @@ const ge = (e, t, i) => {
4610
4603
  settings: i
4611
4604
  });
4612
4605
  return new Array(o).fill(void 0).map(
4613
- (s, r) => Ht({
4606
+ (s, r) => Et({
4614
4607
  context: e,
4615
4608
  isUsingVerticalWriting: t,
4616
4609
  itemLayout: n,
4617
4610
  pageIndex: r
4618
4611
  })
4619
4612
  );
4620
- }, We = ({
4613
+ }, ze = ({
4621
4614
  context: e,
4622
4615
  settings: t
4623
4616
  }) => {
@@ -4638,7 +4631,7 @@ const ge = (e, t, i) => {
4638
4631
  spineItemPosition: g,
4639
4632
  itemHeight: d,
4640
4633
  itemWidth: u
4641
- }), S = e.isRTL() ? u - m.x - e.getPageSize().width : m.x, f = Zt({
4634
+ }), S = e.isRTL() ? u - m.x - e.getPageSize().width : m.x, f = Jt({
4642
4635
  isUsingVerticalWriting: l,
4643
4636
  itemHeight: d,
4644
4637
  itemWidth: u,
@@ -4652,7 +4645,7 @@ const ge = (e, t, i) => {
4652
4645
  if ((u == null ? void 0 : u.nodeName) === "img" || (u == null ? void 0 : u.textContent) === "" && u.nodeType === Node.ELEMENT_NODE)
4653
4646
  l = u.getBoundingClientRect().x;
4654
4647
  else if (u) {
4655
- const S = u ? $i(u, d) : void 0;
4648
+ const S = u ? vi(u, d) : void 0;
4656
4649
  l = (S == null ? void 0 : S.getBoundingClientRect().x) || l;
4657
4650
  }
4658
4651
  const p = ((m = g.layout.layoutInfo) == null ? void 0 : m.width) || 0, h = e.getPageSize().width;
@@ -4669,7 +4662,7 @@ const ge = (e, t, i) => {
4669
4662
  const g = e.getPageSize(), l = (p = d.renderer) == null ? void 0 : p.getDocumentFrame();
4670
4663
  if (l && ((h = l == null ? void 0 : l.contentWindow) != null && h.document) && // very important because it is being used by next functions
4671
4664
  l.contentWindow.document.body !== null) {
4672
- const { x: m, y: S } = Ht({
4665
+ const { x: m, y: S } = Et({
4673
4666
  pageIndex: u,
4674
4667
  itemLayout: d.layout.layoutInfo,
4675
4668
  context: e,
@@ -4679,7 +4672,7 @@ const ge = (e, t, i) => {
4679
4672
  right: m + g.width,
4680
4673
  bottom: S + g.height
4681
4674
  };
4682
- return vi(
4675
+ return wi(
4683
4676
  l.contentWindow.document,
4684
4677
  f
4685
4678
  );
@@ -4718,7 +4711,7 @@ const ge = (e, t, i) => {
4718
4711
  getSpineItemPositionFromPageIndex: ({
4719
4712
  pageIndex: u,
4720
4713
  spineItem: d
4721
- }) => Ht({
4714
+ }) => Et({
4722
4715
  context: e,
4723
4716
  isUsingVerticalWriting: !!d.isUsingVerticalWriting(),
4724
4717
  itemLayout: d.layout.layoutInfo,
@@ -4728,18 +4721,18 @@ const ge = (e, t, i) => {
4728
4721
  getSpineItemPageIndexFromNode: a,
4729
4722
  getSpineItemClosestPositionFromUnsafePosition: r,
4730
4723
  getFirstNodeOrRangeAtPage: s,
4731
- getSpineItemPagesPosition: ({ item: u }) => No({
4724
+ getSpineItemPagesPosition: ({ item: u }) => Do({
4732
4725
  context: e,
4733
4726
  isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
4734
4727
  settings: t,
4735
4728
  itemLayout: u.layout.layoutInfo
4736
4729
  })
4737
4730
  };
4738
- }, Vo = ({
4731
+ }, No = ({
4739
4732
  context: e,
4740
4733
  settings: t
4741
4734
  }) => {
4742
- const i = We({ context: e, settings: t });
4735
+ const i = ze({ context: e, settings: t });
4743
4736
  return {
4744
4737
  getNavigationForLastPage: (r) => {
4745
4738
  const a = r.numberOfPages;
@@ -4765,7 +4758,7 @@ const ge = (e, t, i) => {
4765
4758
  }) => {
4766
4759
  const s = e % n !== 0 ? e - i : e;
4767
4760
  return new M({ x: s, y: t });
4768
- }, le = ({
4761
+ }, he = ({
4769
4762
  position: e,
4770
4763
  isRTL: t,
4771
4764
  pageSizeHeight: i,
@@ -4788,7 +4781,7 @@ const ge = (e, t, i) => {
4788
4781
  x: Math.min(Math.max(0, e.x), d),
4789
4782
  y: u
4790
4783
  });
4791
- }, Et = ({
4784
+ }, Bt = ({
4792
4785
  viewportPosition: e,
4793
4786
  spineLocator: t,
4794
4787
  context: i,
@@ -4813,7 +4806,7 @@ const ge = (e, t, i) => {
4813
4806
  });
4814
4807
  }
4815
4808
  return new M({ x: 0, y: 0 });
4816
- }, jo = ({
4809
+ }, Vo = ({
4817
4810
  pageIndex: e,
4818
4811
  spineItemsManager: t,
4819
4812
  spineItemId: i,
@@ -4824,7 +4817,7 @@ const ge = (e, t, i) => {
4824
4817
  const r = t.get(i);
4825
4818
  if (!r) {
4826
4819
  const u = e * n.getPageSize().width;
4827
- return Et({
4820
+ return Bt({
4828
4821
  viewportPosition: new M({ x: u, y: 0 }),
4829
4822
  context: n,
4830
4823
  spineItemNavigationResolver: s,
@@ -4843,7 +4836,7 @@ const ge = (e, t, i) => {
4843
4836
  pageSizeWidth: n.getPageSize().width,
4844
4837
  visibleAreaRectWidth: n.state.visibleAreaRect.width
4845
4838
  });
4846
- }, ko = ({
4839
+ }, jo = ({
4847
4840
  anchor: e,
4848
4841
  spineItem: t,
4849
4842
  context: i
@@ -4855,13 +4848,13 @@ const ge = (e, t, i) => {
4855
4848
  o,
4856
4849
  n
4857
4850
  );
4858
- }, Wo = ({
4851
+ }, ko = ({
4859
4852
  anchor: e,
4860
4853
  context: t,
4861
4854
  spineItem: i,
4862
4855
  spineLocator: n
4863
4856
  }) => {
4864
- const o = ko({
4857
+ const o = jo({
4865
4858
  anchor: e,
4866
4859
  spineItem: i,
4867
4860
  context: t
@@ -4870,7 +4863,7 @@ const ge = (e, t, i) => {
4870
4863
  spineItemPosition: new A({ x: o, y: 0 }),
4871
4864
  spineItem: i
4872
4865
  });
4873
- }, zo = ({
4866
+ }, Wo = ({
4874
4867
  anchor: e,
4875
4868
  spineItem: t,
4876
4869
  spineLocator: i,
@@ -4878,7 +4871,7 @@ const ge = (e, t, i) => {
4878
4871
  pageSizeWidth: o,
4879
4872
  visibleAreaRectWidth: s
4880
4873
  }) => {
4881
- const r = Wo({
4874
+ const r = ko({
4882
4875
  anchor: e,
4883
4876
  context: n,
4884
4877
  spineItem: t,
@@ -4889,7 +4882,7 @@ const ge = (e, t, i) => {
4889
4882
  pageSizeWidth: o,
4890
4883
  visibleAreaRectWidth: s
4891
4884
  });
4892
- }, Uo = ({
4885
+ }, zo = ({
4893
4886
  context: e,
4894
4887
  spineItemsManager: t,
4895
4888
  spineLocator: i,
@@ -4905,7 +4898,7 @@ const ge = (e, t, i) => {
4905
4898
  if (u) {
4906
4899
  const d = t.get(u.id);
4907
4900
  if (d) {
4908
- const g = zo({
4901
+ const g = Wo({
4909
4902
  anchor: a.hash,
4910
4903
  spineItem: d,
4911
4904
  context: e,
@@ -4928,7 +4921,7 @@ const ge = (e, t, i) => {
4928
4921
  console.error(a);
4929
4922
  return;
4930
4923
  }
4931
- }, Ho = ({
4924
+ }, Uo = ({
4932
4925
  spineItem: e,
4933
4926
  spineItemPosition: t,
4934
4927
  spineLocator: i,
@@ -4947,16 +4940,16 @@ const ge = (e, t, i) => {
4947
4940
  pageSizeWidth: o.getPageSize().width,
4948
4941
  visibleAreaRectWidth: o.state.visibleAreaRect.width
4949
4942
  });
4950
- }, Eo = "spineNavigator", Bo = ({
4943
+ }, Ho = "spineNavigator", Eo = ({
4951
4944
  context: e,
4952
4945
  spineItemsManager: t,
4953
4946
  locator: i,
4954
4947
  settings: n,
4955
4948
  spineLayout: o
4956
4949
  }) => {
4957
- const s = Vo({ context: e, settings: n });
4950
+ const s = No({ context: e, settings: n });
4958
4951
  return {
4959
- getNavigationForUrl: (l) => Uo({
4952
+ getNavigationForUrl: (l) => zo({
4960
4953
  context: e,
4961
4954
  spineItemsManager: t,
4962
4955
  spineLocator: i,
@@ -4964,26 +4957,26 @@ const ge = (e, t, i) => {
4964
4957
  pageSizeWidth: e.getPageSize().width,
4965
4958
  visibleAreaRectWidth: e.state.visibleAreaRect.width
4966
4959
  }),
4967
- getNavigationForSpineItemPage: (l) => jo({
4960
+ getNavigationForSpineItemPage: (l) => Vo({
4968
4961
  ...l,
4969
4962
  context: e,
4970
4963
  spineItemsManager: t,
4971
4964
  spineItemNavigationResolver: s,
4972
4965
  spineLocator: i
4973
4966
  }),
4974
- getNavigationFromSpineItemPosition: (l) => Ho({
4967
+ getNavigationFromSpineItemPosition: (l) => Uo({
4975
4968
  ...l,
4976
4969
  spineItemLocator: i.spineItemLocator,
4977
4970
  spineLocator: i,
4978
4971
  context: e
4979
4972
  }),
4980
4973
  getNavigationForCfi: (l) => {
4981
- const p = t.getSpineItemFromCfi(l), { node: h, offset: m = 0 } = Oe({
4974
+ const p = t.getSpineItemFromCfi(l), { node: h, offset: m = 0 } = De({
4982
4975
  cfi: l,
4983
4976
  spineItemsManager: t
4984
4977
  }) || {};
4985
4978
  if (!p) {
4986
- j.warn(Eo, `unable to detect item id from cfi ${l}`);
4979
+ j.warn(Ho, `unable to detect item id from cfi ${l}`);
4987
4980
  return;
4988
4981
  }
4989
4982
  const S = h ? s.getNavigationFromNode(p, h, m) : new A({ x: 0, y: 0 }), f = i.getSpinePositionFromSpineItemPosition({
@@ -5019,14 +5012,14 @@ const ge = (e, t, i) => {
5019
5012
  }
5020
5013
  return new M({ x: 0, y: 0 });
5021
5014
  },
5022
- getNavigationForPosition: (l) => Et({
5015
+ getNavigationForPosition: (l) => Bt({
5023
5016
  viewportPosition: l,
5024
5017
  context: e,
5025
5018
  spineItemNavigationResolver: s,
5026
5019
  spineLocator: i
5027
5020
  }),
5028
5021
  getMostPredominantNavigationForPosition: (l) => {
5029
- const p = n.values.computedPageTurnDirection, h = 0.5, m = p === "horizontal" ? l.x + e.state.visibleAreaRect.width * h : 0, S = p === "horizontal" ? 0 : l.y + e.state.visibleAreaRect.height * h, f = le({
5022
+ const p = n.values.computedPageTurnDirection, h = 0.5, m = p === "horizontal" ? l.x + e.state.visibleAreaRect.width * h : 0, S = p === "horizontal" ? 0 : l.y + e.state.visibleAreaRect.height * h, f = he({
5030
5023
  position: new M({
5031
5024
  x: m,
5032
5025
  y: S
@@ -5037,14 +5030,14 @@ const ge = (e, t, i) => {
5037
5030
  spineItemsManager: t,
5038
5031
  spineLayout: o
5039
5032
  });
5040
- return Et({
5033
+ return Bt({
5041
5034
  context: e,
5042
5035
  spineItemNavigationResolver: s,
5043
5036
  spineLocator: i,
5044
5037
  viewportPosition: f
5045
5038
  });
5046
5039
  },
5047
- getAdjustedPositionWithSafeEdge: (l) => le({
5040
+ getAdjustedPositionWithSafeEdge: (l) => he({
5048
5041
  position: l,
5049
5042
  isRTL: e.isRTL(),
5050
5043
  pageSizeHeight: e.getPageSize().height,
@@ -5061,7 +5054,7 @@ const ge = (e, t, i) => {
5061
5054
  }),
5062
5055
  spineItemNavigator: s
5063
5056
  };
5064
- }, _o = ({
5057
+ }, Bo = ({
5065
5058
  spineItemsManager: e,
5066
5059
  context: t,
5067
5060
  hookManager: i,
@@ -5069,25 +5062,25 @@ const ge = (e, t, i) => {
5069
5062
  settings: o,
5070
5063
  viewport: s
5071
5064
  }) => {
5072
- const r = new U(), a = new je(), c = Bo({
5065
+ const r = new U(), a = new ke(), c = Eo({
5073
5066
  context: t,
5074
5067
  settings: o,
5075
5068
  spineItemsManager: e,
5076
5069
  locator: n.locator,
5077
5070
  spineLayout: n.spineLayout
5078
- }), u = new Oo(
5071
+ }), u = new Ao(
5079
5072
  o,
5080
5073
  i,
5081
5074
  t,
5082
5075
  n,
5083
5076
  s
5084
- ), d = new Do(
5077
+ ), d = new Oo(
5085
5078
  s,
5086
5079
  o,
5087
5080
  i,
5088
5081
  n,
5089
5082
  t
5090
- ), g = new Mo(
5083
+ ), g = new Lo(
5091
5084
  o,
5092
5085
  t,
5093
5086
  n,
@@ -5096,7 +5089,7 @@ const ge = (e, t, i) => {
5096
5089
  ), l = x(
5097
5090
  r,
5098
5091
  g.navigation$
5099
- ), p = new Fo(
5092
+ ), p = new To(
5100
5093
  o,
5101
5094
  t,
5102
5095
  l,
@@ -5135,7 +5128,7 @@ const ge = (e, t, i) => {
5135
5128
  navigation$: p.navigation$
5136
5129
  };
5137
5130
  };
5138
- class Xo extends bt {
5131
+ class _o extends bt {
5139
5132
  constructor(t, i) {
5140
5133
  super({
5141
5134
  beginPageIndexInSpineItem: void 0,
@@ -5153,7 +5146,7 @@ class Xo extends bt {
5153
5146
  this.mergeCompare(t);
5154
5147
  }
5155
5148
  }
5156
- class qo extends Y {
5149
+ class Xo extends Y {
5157
5150
  constructor(t, i, n, o, s) {
5158
5151
  super(), this.context = t, this.pagination = i, this.spineItemsManager = n, this.spine = o, this.spineItemLocator = s;
5159
5152
  const r = x(
@@ -5170,7 +5163,7 @@ class qo extends Y {
5170
5163
  threshold: 0.5
5171
5164
  });
5172
5165
  return this.context.bridgeEvent.navigationUnlocked$.pipe(
5173
- pe(1),
5166
+ me(1),
5174
5167
  D(this.context.bridgeEvent.navigation$),
5175
5168
  T(([, u]) => {
5176
5169
  const { position: d } = u, g = this.pagination.value, {
@@ -5187,7 +5180,7 @@ class qo extends Y {
5187
5180
  }) ?? {}, { endPageIndex: I = 0 } = c({
5188
5181
  spineItem: m,
5189
5182
  position: d
5190
- }) ?? {}, P = S === void 0 || zt(S) || g.beginSpineItemIndex !== l, $ = g.endSpineItemIndex !== p || f === void 0 || zt(f), L = P ? mt(h.item) : S, C = $ ? mt(m.item) : f, O = h.numberOfPages, B = m.numberOfPages;
5183
+ }) ?? {}, P = S === void 0 || Ut(S) || g.beginSpineItemIndex !== l, $ = g.endSpineItemIndex !== p || f === void 0 || Ut(f), L = P ? mt(h.item) : S, C = $ ? mt(m.item) : f, O = h.numberOfPages, B = m.numberOfPages;
5191
5184
  this.pagination.update({
5192
5185
  beginCfi: L,
5193
5186
  beginNumberOfPagesInSpineItem: O,
@@ -5231,7 +5224,7 @@ class qo extends Y {
5231
5224
  x(r, a).pipe(F(this.destroy$)).subscribe();
5232
5225
  }
5233
5226
  }
5234
- class Yo extends Y {
5227
+ class qo extends Y {
5235
5228
  constructor(t) {
5236
5229
  super();
5237
5230
  const i = {
@@ -5268,7 +5261,7 @@ class Yo extends Y {
5268
5261
  }
5269
5262
  watch(t) {
5270
5263
  return this.values$.pipe(
5271
- Pe(t),
5264
+ $e(t),
5272
5265
  E(N)
5273
5266
  );
5274
5267
  }
@@ -5276,7 +5269,7 @@ class Yo extends Y {
5276
5269
  super.destroy(), this.outputSettingsUpdateSubject.complete();
5277
5270
  }
5278
5271
  }
5279
- class Zo extends Yo {
5272
+ class Yo extends qo {
5280
5273
  constructor(t, i) {
5281
5274
  super(t), this.context = i;
5282
5275
  const n = q([
@@ -5321,7 +5314,7 @@ class Zo extends Yo {
5321
5314
  };
5322
5315
  }
5323
5316
  }
5324
- class Go extends Y {
5317
+ class Zo extends Y {
5325
5318
  constructor(t, i, n, o, s, r) {
5326
5319
  super(), this.item = t, this.containerElement = i, this.context = n, this.hookManager = o, this.renderer = s, this.settings = r, this.layoutTriggerSubject = new U(), this.lastLayout = null, this.applyDimsAfterLayout = ({
5327
5320
  blankPagePosition: a,
@@ -5352,7 +5345,7 @@ class Go extends Y {
5352
5345
  }), { width: y, height: I };
5353
5346
  })
5354
5347
  ), this.layout = (a) => {
5355
- const c = Ni(this.layout$.pipe(H()));
5348
+ const c = Oi(this.layout$.pipe(H()));
5356
5349
  return this.layoutTriggerSubject.next(a), c();
5357
5350
  }, this.adjustPositionOfElement = ({
5358
5351
  right: a,
@@ -5407,7 +5400,7 @@ class Go extends Y {
5407
5400
  };
5408
5401
  }
5409
5402
  }
5410
- class Jo extends ht {
5403
+ class Go extends ht {
5411
5404
  onUnload() {
5412
5405
  return K;
5413
5406
  }
@@ -5426,7 +5419,7 @@ class Jo extends ht {
5426
5419
  getDocumentFrame() {
5427
5420
  }
5428
5421
  }
5429
- class ze extends Y {
5422
+ class Ue extends Y {
5430
5423
  constructor(t, i, n, o, s, r) {
5431
5424
  var u, d;
5432
5425
  super(), this.item = t, this.parentElement = i, this.context = n, this.settings = o, this.hookManager = s, this.index = r, this.getBoundingRectOfElementFromSelector = (g) => {
@@ -5443,13 +5436,13 @@ class ze extends Y {
5443
5436
  }, this.isUsingVerticalWriting = () => {
5444
5437
  var g;
5445
5438
  return !!((g = this.renderer.writingMode) != null && g.startsWith("vertical"));
5446
- }, this.containerElement = Ko(
5439
+ }, this.containerElement = Jo(
5447
5440
  i,
5448
5441
  t,
5449
5442
  s
5450
5443
  ), i.appendChild(this.containerElement);
5451
5444
  const a = (d = (u = this.settings.values).getRenderer) == null ? void 0 : d.call(u, t);
5452
- this.resourcesHandler = new qt(t, this.settings);
5445
+ this.resourcesHandler = new Yt(t, this.settings);
5453
5446
  const c = {
5454
5447
  context: n,
5455
5448
  settings: o,
@@ -5458,7 +5451,7 @@ class ze extends Y {
5458
5451
  containerElement: this.containerElement,
5459
5452
  resourcesHandler: this.resourcesHandler
5460
5453
  };
5461
- this.renderer = a ? a(c) : new Jo(c), this.layout = new Go(
5454
+ this.renderer = a ? a(c) : new Go(c), this.layout = new Zo(
5462
5455
  t,
5463
5456
  this.containerElement,
5464
5457
  n,
@@ -5466,9 +5459,9 @@ class ze extends Y {
5466
5459
  this.renderer,
5467
5460
  this.settings
5468
5461
  ), this.isReady$ = this.layout.layoutProcess$.pipe(
5469
- ci(this.renderer.isLoaded$),
5462
+ ui(this.renderer.isLoaded$),
5470
5463
  X(([g, l]) => !!(g.type === "end" && l)),
5471
- ye(!1),
5464
+ be(!1),
5472
5465
  Z(),
5473
5466
  z((g) => {
5474
5467
  this.containerElement.dataset.isReady = g.toString();
@@ -5512,7 +5505,7 @@ class ze extends Y {
5512
5505
  _(
5513
5506
  () => this.renderer.state$.pipe(
5514
5507
  tt((t) => t === "idle"),
5515
- fe()
5508
+ Se()
5516
5509
  )
5517
5510
  )
5518
5511
  );
@@ -5521,7 +5514,7 @@ class ze extends Y {
5521
5514
  return this.renderer.renditionLayout;
5522
5515
  }
5523
5516
  get numberOfPages() {
5524
- return Zt({
5517
+ return Jt({
5525
5518
  isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
5526
5519
  itemHeight: this.layout.layoutInfo.height,
5527
5520
  itemWidth: this.layout.layoutInfo.width,
@@ -5530,14 +5523,14 @@ class ze extends Y {
5530
5523
  });
5531
5524
  }
5532
5525
  }
5533
- const Ko = (e, t, i) => {
5526
+ const Jo = (e, t, i) => {
5534
5527
  const n = e.ownerDocument.createElement("div");
5535
5528
  return n.classList.add("spineItem"), n.classList.add(`spineItem-${t.renditionLayout ?? "reflowable"}`), n.style.cssText = `
5536
5529
  position: absolute;
5537
5530
  overflow: hidden;
5538
5531
  `, n.dataset.isReady = "false", i.execute("item.onBeforeContainerCreated", void 0, { element: n }), n;
5539
5532
  };
5540
- class Qo extends Y {
5533
+ class Ko extends Y {
5541
5534
  constructor(t, i) {
5542
5535
  super(), this.spineItemsManager = t, this.spineLocator = i, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
5543
5536
  v((n) => {
@@ -5550,7 +5543,7 @@ class Qo extends Y {
5550
5543
  ), this.itemResize$ = this.spineItemsManager.items$.pipe(
5551
5544
  v((n) => {
5552
5545
  const o = n.map(
5553
- (s) => ve(s.element).pipe(
5546
+ (s) => Te(s.element).pipe(
5554
5547
  b((r) => ({ entries: r, item: s }))
5555
5548
  )
5556
5549
  );
@@ -5567,7 +5560,7 @@ class Qo extends Y {
5567
5560
  );
5568
5561
  }
5569
5562
  }
5570
- const ts = ({
5563
+ const Qo = ({
5571
5564
  horizontalOffset: e,
5572
5565
  verticalOffset: t,
5573
5566
  context: i,
@@ -5637,7 +5630,7 @@ const ts = ({
5637
5630
  })
5638
5631
  );
5639
5632
  };
5640
- class es extends Y {
5633
+ class ts extends Y {
5641
5634
  constructor(t, i, n, o) {
5642
5635
  super(), this.spineItemsManager = t, this.context = i, this.settings = n, this.viewport = o, this.layoutSubject = new U(), this.spineItemsRelativeLayouts = [], t.items$.pipe(
5643
5636
  T(() => {
@@ -5676,12 +5669,12 @@ class es extends Y {
5676
5669
  ),
5677
5670
  Vt(() => {
5678
5671
  s.next(!0);
5679
- const r = this.context.manifest, a = Ve(r) ?? !1;
5672
+ const r = this.context.manifest, a = je(r) ?? !1;
5680
5673
  return W(this.spineItemsManager.items).pipe(
5681
- Ke(
5674
+ Qe(
5682
5675
  (u, d, g) => u.pipe(
5683
- Kt(
5684
- ({ horizontalOffset: l, verticalOffset: p, pages: h }) => ts({
5676
+ te(
5677
+ ({ horizontalOffset: l, verticalOffset: p, pages: h }) => Qo({
5685
5678
  context: this.context,
5686
5679
  horizontalOffset: l,
5687
5680
  index: g,
@@ -5708,7 +5701,7 @@ class es extends Y {
5708
5701
  ),
5709
5702
  w({ horizontalOffset: 0, verticalOffset: 0, pages: [] })
5710
5703
  ),
5711
- Kt((u) => u),
5704
+ te((u) => u),
5712
5705
  ut(() => {
5713
5706
  s.next(!1);
5714
5707
  })
@@ -5740,12 +5733,12 @@ class es extends Y {
5740
5733
  super.destroy(), this.layoutSubject.complete();
5741
5734
  }
5742
5735
  }
5743
- class is extends Y {
5736
+ class es extends Y {
5744
5737
  constructor(t, i, n, o, s) {
5745
5738
  super(), this.context = t, this.spineItemsManager = i, this.spineLocator = n, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new k([]);
5746
5739
  const r = this.forcedOpenSubject.pipe(
5747
5740
  b((u) => [...new Set(u.flat())].sort()),
5748
- E(ii),
5741
+ E(ni),
5749
5742
  et({ bufferSize: 1, refCount: !0 })
5750
5743
  );
5751
5744
  x(
@@ -5791,9 +5784,9 @@ class is extends Y {
5791
5784
  super.destroy(), this.forcedOpenSubject.complete();
5792
5785
  }
5793
5786
  }
5794
- const Ue = (e, t, i) => {
5787
+ const He = (e, t, i) => {
5795
5788
  const n = (i.width - t.width) / 2, o = (i.height - t.height) / 2;
5796
- return new Yt({
5789
+ return new Zt({
5797
5790
  x: e.x - n,
5798
5791
  y: e.y - o
5799
5792
  });
@@ -5816,17 +5809,17 @@ class yt extends DOMRect {
5816
5809
  return new yt(n.x, n.y, n.width, n.height);
5817
5810
  }
5818
5811
  }
5819
- class ns {
5812
+ class is {
5820
5813
  constructor({ width: t, height: i }) {
5821
5814
  this.__symbol = Symbol("AbsoluteViewport"), this.width = t, this.height = i;
5822
5815
  }
5823
5816
  }
5824
- class os {
5817
+ class ns {
5825
5818
  constructor({ width: t, height: i }) {
5826
5819
  this.__symbol = Symbol("RelativeViewport"), this.width = t, this.height = i;
5827
5820
  }
5828
5821
  }
5829
- const ss = ({
5822
+ const os = ({
5830
5823
  pageIndex: e,
5831
5824
  spineItemOrId: t,
5832
5825
  spineItemsManager: i
@@ -5848,7 +5841,7 @@ const ss = ({
5848
5841
  { currentAbsolutePage: 0, found: !1 }
5849
5842
  );
5850
5843
  return s;
5851
- }, rs = ({
5844
+ }, ss = ({
5852
5845
  itemHeight: e,
5853
5846
  itemWidth: t,
5854
5847
  visibleWidthOfItem: i,
@@ -5857,7 +5850,7 @@ const ss = ({
5857
5850
  }) => {
5858
5851
  const s = i / t, r = n / e;
5859
5852
  return s >= o && r >= o;
5860
- }, as = ({
5853
+ }, rs = ({
5861
5854
  visibleWidthOfItem: e,
5862
5855
  visibleHeightOfItem: t,
5863
5856
  threshold: i,
@@ -5865,7 +5858,7 @@ const ss = ({
5865
5858
  }) => {
5866
5859
  const o = e / n.width;
5867
5860
  return t / n.height >= i && o >= i;
5868
- }, He = ({
5861
+ }, Ee = ({
5869
5862
  itemPosition: {
5870
5863
  bottom: e,
5871
5864
  left: t,
@@ -5889,14 +5882,14 @@ const ss = ({
5889
5882
  Math.min(e, l) - Math.max(n, g)
5890
5883
  );
5891
5884
  if (p <= 0 || h <= 0) return { visible: !1 };
5892
- const S = as({
5885
+ const S = rs({
5893
5886
  threshold: r,
5894
5887
  visibleHeightOfItem: h,
5895
5888
  visibleWidthOfItem: p,
5896
5889
  viewportPosition: a
5897
5890
  });
5898
5891
  return c ? { visible: S } : {
5899
- visible: rs({
5892
+ visible: ss({
5900
5893
  itemHeight: s,
5901
5894
  itemWidth: o,
5902
5895
  threshold: r,
@@ -5904,7 +5897,7 @@ const ss = ({
5904
5897
  visibleWidthOfItem: p
5905
5898
  }) || S
5906
5899
  };
5907
- }, cs = ({
5900
+ }, as = ({
5908
5901
  absolutePageIndex: e,
5909
5902
  spineItemsManager: t
5910
5903
  }) => {
@@ -5930,7 +5923,7 @@ const ss = ({
5930
5923
  itemIndex: t.getSpineItemIndex(n.item) ?? 0,
5931
5924
  currentAbsolutePage: o
5932
5925
  };
5933
- }, Ee = ({
5926
+ }, Be = ({
5934
5927
  position: e,
5935
5928
  spineItemsManager: t,
5936
5929
  spineLayout: i,
@@ -5947,7 +5940,7 @@ const ss = ({
5947
5940
  }) => new M({
5948
5941
  x: t + e.x,
5949
5942
  y: i + e.y
5950
- }), us = ({
5943
+ }), cs = ({
5951
5944
  position: e,
5952
5945
  threshold: t,
5953
5946
  restrictToScreen: i,
@@ -5957,21 +5950,21 @@ const ss = ({
5957
5950
  useAbsoluteViewport: r = !0,
5958
5951
  viewport: a
5959
5952
  }) => {
5960
- const c = Ee({
5953
+ const c = Be({
5961
5954
  position: e,
5962
5955
  settings: o,
5963
5956
  spineItemsManager: n,
5964
5957
  spineLayout: s
5965
5958
  }) || n.get(0), u = n.items.reduce(
5966
5959
  (h, m) => {
5967
- const S = s.getSpineItemSpineLayoutInfo(m), f = r ? a.absoluteViewport : a.relativeViewport, y = Ue(
5960
+ const S = s.getSpineItemSpineLayoutInfo(m), f = r ? a.absoluteViewport : a.relativeViewport, y = He(
5968
5961
  e,
5969
5962
  a.absoluteViewport,
5970
5963
  f
5971
5964
  ), I = yt.from(
5972
5965
  y,
5973
5966
  f
5974
- ), { visible: P } = He({
5967
+ ), { visible: P } = Ee({
5975
5968
  itemPosition: S,
5976
5969
  threshold: t,
5977
5970
  viewportPosition: I,
@@ -5987,7 +5980,7 @@ const ss = ({
5987
5980
  beginIndex: l ?? 0,
5988
5981
  endIndex: p ?? 0
5989
5982
  };
5990
- }, ds = ({
5983
+ }, us = ({
5991
5984
  spineItemsManager: e,
5992
5985
  context: t,
5993
5986
  spineItemLocator: i,
@@ -6054,20 +6047,20 @@ const ss = ({
6054
6047
  };
6055
6048
  }).reduce(
6056
6049
  (O, { absolutePosition: B, index: dt }) => {
6057
- const Q = f ? y.absoluteViewport : y.relativeViewport, Be = Ue(
6050
+ const Q = f ? y.absoluteViewport : y.relativeViewport, _e = He(
6058
6051
  p,
6059
6052
  y.absoluteViewport,
6060
6053
  Q
6061
- ), _e = yt.from(
6062
- Be,
6054
+ ), Xe = yt.from(
6055
+ _e,
6063
6056
  Q
6064
- ), { visible: Xe } = He({
6065
- viewportPosition: _e,
6057
+ ), { visible: qe } = Ee({
6058
+ viewportPosition: Xe,
6066
6059
  restrictToScreen: S,
6067
6060
  threshold: h,
6068
6061
  itemPosition: B
6069
6062
  });
6070
- return Xe ? [...O, dt] : O;
6063
+ return qe ? [...O, dt] : O;
6071
6064
  },
6072
6065
  []
6073
6066
  ), L = $[0], C = $[$.length - 1] ?? L;
@@ -6088,17 +6081,17 @@ const ss = ({
6088
6081
  spineItemPosition: h
6089
6082
  });
6090
6083
  },
6091
- getAbsolutePageIndexFromPageIndex: (p) => ss({
6084
+ getAbsolutePageIndexFromPageIndex: (p) => os({
6092
6085
  ...p,
6093
6086
  spineItemsManager: e
6094
6087
  }),
6095
- getSpineInfoFromAbsolutePageIndex: (p) => cs({
6088
+ getSpineInfoFromAbsolutePageIndex: (p) => as({
6096
6089
  ...p,
6097
6090
  spineItemsManager: e
6098
6091
  }),
6099
6092
  getSpinePositionFromSpineItem: a,
6100
6093
  getSpineItemPositionFromSpinePosition: r,
6101
- getSpineItemFromPosition: (p) => Ee({
6094
+ getSpineItemFromPosition: (p) => Be({
6102
6095
  position: p,
6103
6096
  settings: n,
6104
6097
  spineItemsManager: e,
@@ -6106,7 +6099,7 @@ const ss = ({
6106
6099
  }),
6107
6100
  getSpineItemFromIframe: c,
6108
6101
  getSpineItemPageIndexFromNode: u,
6109
- getVisibleSpineItemsFromPosition: (p) => us({
6102
+ getVisibleSpineItemsFromPosition: (p) => cs({
6110
6103
  settings: n,
6111
6104
  spineItemsManager: e,
6112
6105
  spineLayout: o,
@@ -6131,27 +6124,27 @@ const ss = ({
6131
6124
  }
6132
6125
  };
6133
6126
  };
6134
- class gs extends Y {
6127
+ class ds extends Y {
6135
6128
  constructor(t, i, n, o, s, r, a, c) {
6136
- 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 k(Li()), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new es(
6129
+ 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 k(Ti()), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new ts(
6137
6130
  o,
6138
6131
  i,
6139
6132
  r,
6140
6133
  c
6141
- ), this.locator = ds({
6134
+ ), this.locator = us({
6142
6135
  context: i,
6143
6136
  spineItemsManager: o,
6144
6137
  spineItemLocator: s,
6145
6138
  settings: r,
6146
6139
  spineLayout: this.spineLayout,
6147
6140
  viewport: c
6148
- }), this.spineItemsLoader = new is(
6141
+ }), this.spineItemsLoader = new es(
6149
6142
  this.context,
6150
6143
  o,
6151
6144
  this.locator,
6152
6145
  r,
6153
6146
  this.spineLayout
6154
- ), this.spineItemsObserver = new Qo(
6147
+ ), this.spineItemsObserver = new Ko(
6155
6148
  o,
6156
6149
  this.locator
6157
6150
  );
@@ -6159,7 +6152,7 @@ class gs extends Y {
6159
6152
  z((g) => {
6160
6153
  this.spineItemsManager.destroyItems();
6161
6154
  const l = g.spineItems.map(
6162
- (p, h) => new ze(
6155
+ (p, h) => new Ue(
6163
6156
  p,
6164
6157
  this.elementSubject.getValue(),
6165
6158
  this.context,
@@ -6191,7 +6184,7 @@ class gs extends Y {
6191
6184
  super.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue().remove(), this.elementSubject.complete();
6192
6185
  }
6193
6186
  }
6194
- class ls extends Y {
6187
+ class gs extends Y {
6195
6188
  constructor(t, i) {
6196
6189
  super(), this.context = t, this.settings = i, this.orderedSpineItemsSubject = new k([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
6197
6190
  }
@@ -6205,7 +6198,7 @@ class ls extends Y {
6205
6198
  return n > o ? "after" : n === o ? "same" : "before";
6206
6199
  }
6207
6200
  getSpineItemIndex(t) {
6208
- const i = t instanceof ze ? t : this.get(t);
6201
+ const i = t instanceof Ue ? t : this.get(t);
6209
6202
  if (!i) return;
6210
6203
  const n = this.orderedSpineItemsSubject.value.indexOf(i);
6211
6204
  return n < 0 ? void 0 : n;
@@ -6218,7 +6211,7 @@ class ls extends Y {
6218
6211
  }
6219
6212
  // @todo move
6220
6213
  getSpineItemFromCfi(t) {
6221
- const { itemIndex: i } = Ae(t);
6214
+ const { itemIndex: i } = Gt(t);
6222
6215
  if (i !== void 0)
6223
6216
  return this.get(i);
6224
6217
  }
@@ -6232,7 +6225,7 @@ class ls extends Y {
6232
6225
  this.orderedSpineItemsSubject.value.forEach((t) => t.destroy());
6233
6226
  }
6234
6227
  }
6235
- class ps extends bt {
6228
+ class ls extends bt {
6236
6229
  constructor(t) {
6237
6230
  const i = document.createElement("div");
6238
6231
  i.style.cssText = `
@@ -6266,7 +6259,7 @@ class ps extends bt {
6266
6259
  }
6267
6260
  get absoluteViewport() {
6268
6261
  const t = this.context.state.visibleAreaRect;
6269
- return new ns({
6262
+ return new is({
6270
6263
  width: t.width,
6271
6264
  height: t.height
6272
6265
  });
@@ -6281,19 +6274,19 @@ class ps extends bt {
6281
6274
  */
6282
6275
  get relativeViewport() {
6283
6276
  const t = this.absoluteViewport, i = this.value.element.getBoundingClientRect(), n = ((i == null ? void 0 : i.width) ?? t.width) / t.width;
6284
- return new os({
6277
+ return new ns({
6285
6278
  width: t.width / n,
6286
6279
  height: t.height / n
6287
6280
  });
6288
6281
  }
6289
6282
  }
6290
- const hs = (e) => {
6291
- const t = new U(), i = new po(), n = new go(), o = new Zo(e, n), s = new lo(n, o), r = new ls(n, o), a = new k(
6283
+ const ps = (e) => {
6284
+ const t = new U(), i = new lo(), n = new uo(), o = new Yo(e, n), s = new go(n, o), r = new gs(n, o), a = new k(
6292
6285
  void 0
6293
- ), c = new ps(n), u = a.pipe(tt(ct)), d = We({
6286
+ ), c = new ls(n), u = a.pipe(tt(ct)), d = ze({
6294
6287
  context: n,
6295
6288
  settings: o
6296
- }), g = new Xo(n, r), l = new gs(
6289
+ }), g = new _o(n, r), l = new ds(
6297
6290
  u,
6298
6291
  n,
6299
6292
  g,
@@ -6302,14 +6295,14 @@ const hs = (e) => {
6302
6295
  o,
6303
6296
  i,
6304
6297
  c
6305
- ), p = _o({
6298
+ ), p = Bo({
6306
6299
  context: n,
6307
6300
  spineItemsManager: r,
6308
6301
  hookManager: i,
6309
6302
  spine: l,
6310
6303
  settings: o,
6311
6304
  viewport: c
6312
- }), h = new qo(
6305
+ }), h = new Xo(
6313
6306
  n,
6314
6307
  g,
6315
6308
  r,
@@ -6345,7 +6338,7 @@ const hs = (e) => {
6345
6338
  return;
6346
6339
  }
6347
6340
  j.log("load", { options: y });
6348
- const $ = ms(I);
6341
+ const $ = hs(I);
6349
6342
  I !== ((L = a.getValue()) == null ? void 0 : L.parentElement) && (a.next($), I.appendChild($)), n.update({
6350
6343
  manifest: P,
6351
6344
  containerElement: I,
@@ -6361,14 +6354,14 @@ const hs = (e) => {
6361
6354
  spine: l,
6362
6355
  hookManager: i,
6363
6356
  cfi: {
6364
- generateCfiFromRange: An,
6365
- generateCfiFromSelection: On,
6366
- parseCfi: Ae,
6357
+ generateCfiFromRange: Cn,
6358
+ generateCfiFromSelection: Rn,
6359
+ parseCfi: Gt,
6367
6360
  generateCfiForSpineItemPage: (y) => Wt({
6368
6361
  ...y,
6369
6362
  spineItemLocator: d
6370
6363
  }),
6371
- resolveCfi: (y) => Oe({ ...y, spineItemsManager: r })
6364
+ resolveCfi: (y) => De({ ...y, spineItemsManager: r })
6372
6365
  },
6373
6366
  navigation: p,
6374
6367
  spineItemsObserver: l.spineItemsObserver,
@@ -6403,33 +6396,33 @@ const hs = (e) => {
6403
6396
  destroy$: t
6404
6397
  }
6405
6398
  };
6406
- }, ms = (e) => {
6399
+ }, hs = (e) => {
6407
6400
  const t = e.ownerDocument.createElement("div");
6408
6401
  return t.style.cssText = `
6409
6402
  background-color: white;
6410
6403
  position: relative;
6411
6404
  `, t.className = `${lt}-reader`, t;
6412
- }, vs = (
6405
+ }, Ps = (
6413
6406
  //__
6414
- eo(
6415
- Wi(
6416
- bn(
6417
- oo(
6418
- ki(
6419
- Si(
6420
- Gn(
6421
- no(
6422
- ao(
6423
- Rn(
6424
- an(
6425
- wn(
6426
- bi(
6427
- io(
6428
- qn(
6429
- mn(
6430
- Di(
6407
+ to(
6408
+ ji(
6409
+ yn(
6410
+ no(
6411
+ Vi(
6412
+ fi(
6413
+ Zn(
6414
+ io(
6415
+ ro(
6416
+ Mn(
6417
+ sn(
6418
+ bn(
6419
+ yi(
6420
+ eo(
6421
+ Xn(
6422
+ pn(
6423
+ Ai(
6431
6424
  // __
6432
- hs
6425
+ ps
6433
6426
  )
6434
6427
  )
6435
6428
  )
@@ -6451,29 +6444,29 @@ const hs = (e) => {
6451
6444
  export {
6452
6445
  Y as DestroyableClass,
6453
6446
  ht as DocumentRenderer,
6454
- po as HookManager,
6455
- qt as ResourceHandler,
6456
- Yo as SettingsManager,
6457
- ze as SpineItem,
6458
- vs as createReader,
6459
- ee as deferIdle,
6460
- Ni as deferNextResult,
6461
- te as getAttributeValueFromString,
6462
- Bt as getFrameViewportInfo,
6463
- xe as idle,
6464
- hi as injectCSS,
6465
- be as isHtmlElement,
6466
- Ci as isHtmlTagElement,
6467
- Ts as isShallowEqual,
6468
- Pe as mapKeysTo,
6469
- Is as observeIntersection,
6470
- ie as observeMutation,
6471
- ve as observeResize,
6472
- mi as removeCSS,
6447
+ lo as HookManager,
6448
+ Yt as ResourceHandler,
6449
+ qo as SettingsManager,
6450
+ Ue as SpineItem,
6451
+ Ps as createReader,
6452
+ ne as deferIdle,
6453
+ Oi as deferNextResult,
6454
+ ie as getAttributeValueFromString,
6455
+ _t as getFrameViewportInfo,
6456
+ Fe as idle,
6457
+ li as injectCSS,
6458
+ Pe as isHtmlElement,
6459
+ Li as isHtmlTagElement,
6460
+ $s as isShallowEqual,
6461
+ $e as mapKeysTo,
6462
+ bs as observeIntersection,
6463
+ oe as observeMutation,
6464
+ Te as observeResize,
6465
+ pi as removeCSS,
6473
6466
  ot as upsertCSSToFrame,
6474
- fi as waitForFrameLoad,
6475
- yi as waitForFrameReady,
6467
+ hi as waitForFrameLoad,
6468
+ mi as waitForFrameReady,
6476
6469
  Ct as waitForSwitch,
6477
- Xt as watchKeys
6470
+ qt as watchKeys
6478
6471
  };
6479
6472
  //# sourceMappingURL=index.js.map