@likecoin/epub-ts 0.4.3 → 0.4.5

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/epub.js CHANGED
@@ -1,4 +1,4 @@
1
- import Jt from "jszip";
1
+ import Qt from "jszip";
2
2
  function P(l) {
3
3
  const t = typeof l == "function" ? l.prototype : l;
4
4
  return t.on = function(e, i) {
@@ -14,15 +14,15 @@ function P(l) {
14
14
  s[n](...i);
15
15
  }, l;
16
16
  }
17
- const xt = typeof window < "u" ? window.requestAnimationFrame.bind(window) : !1, Qt = 1, te = 3, It = typeof URL < "u" ? URL : window.URL;
18
- function ht() {
17
+ const Et = typeof window < "u" ? window.requestAnimationFrame.bind(window) : !1, te = 1, ee = 3, Ot = typeof URL < "u" ? URL : typeof window < "u" ? window.URL : void 0;
18
+ function ot() {
19
19
  let l = (/* @__PURE__ */ new Date()).getTime();
20
20
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
21
21
  const i = (l + Math.random() * 16) % 16 | 0;
22
22
  return l = Math.floor(l / 16), (e == "x" ? i : i & 7 | 8).toString(16);
23
23
  });
24
24
  }
25
- function ee() {
25
+ function ie() {
26
26
  return Math.max(
27
27
  document.documentElement.clientHeight,
28
28
  document.body.scrollHeight,
@@ -31,26 +31,26 @@ function ee() {
31
31
  document.documentElement.offsetHeight
32
32
  );
33
33
  }
34
- function Ot(l) {
34
+ function Pt(l) {
35
35
  return !!(l && l.nodeType == 1);
36
36
  }
37
37
  function E(l) {
38
38
  return !isNaN(parseFloat(l)) && isFinite(l);
39
39
  }
40
- function Pt(l) {
40
+ function zt(l) {
41
41
  const t = parseFloat(l);
42
42
  return E(l) === !1 ? !1 : typeof l == "string" && l.indexOf(".") > -1 ? !0 : Math.floor(t) !== t;
43
43
  }
44
44
  function U(l) {
45
45
  const t = ["Webkit", "webkit", "Moz", "O", "ms"], e = ["-webkit-", "-webkit-", "-moz-", "-o-", "-ms-"], i = l.toLowerCase(), s = t.length;
46
- if (typeof document > "u" || typeof document.body.style[i] < "u")
46
+ if (typeof document > "u" || i in document.body.style)
47
47
  return l;
48
48
  for (let n = 0; n < s; n++)
49
- if (typeof document.body.style[e[n] + i] < "u")
49
+ if (e[n] + i in document.body.style)
50
50
  return e[n] + i;
51
51
  return l;
52
52
  }
53
- function zt(l, ...t) {
53
+ function Dt(l, ...t) {
54
54
  for (let e = 0; e < t.length; e++) {
55
55
  const i = t[e];
56
56
  for (const s in i)
@@ -65,12 +65,12 @@ function C(l, ...t) {
65
65
  });
66
66
  }), l;
67
67
  }
68
- function ie(l, t, e) {
68
+ function se(l, t, e) {
69
69
  const i = H(l, t, e);
70
70
  return t.splice(i, 0, l), i;
71
71
  }
72
72
  function H(l, t, e, i, s) {
73
- const n = i || 0, r = s || t.length, o = parseInt(n + (r - n) / 2);
73
+ const n = i || 0, r = s || t.length, o = Math.floor(n + (r - n) / 2);
74
74
  if (e || (e = function(a, c) {
75
75
  return a > c ? 1 : a < c ? -1 : 0;
76
76
  }), r - n <= 0)
@@ -78,16 +78,16 @@ function H(l, t, e, i, s) {
78
78
  const h = e(t[o], l);
79
79
  return r - n === 1 ? h >= 0 ? o : o + 1 : h === 0 ? o : h === -1 ? H(l, t, e, o, r) : H(l, t, e, n, o);
80
80
  }
81
- function tt(l, t, e, i, s) {
82
- const n = i || 0, r = s || t.length, o = parseInt(n + (r - n) / 2);
81
+ function Q(l, t, e, i, s) {
82
+ const n = i || 0, r = s || t.length, o = Math.floor(n + (r - n) / 2);
83
83
  if (e || (e = function(a, c) {
84
84
  return a > c ? 1 : a < c ? -1 : 0;
85
85
  }), r - n <= 0)
86
86
  return -1;
87
87
  const h = e(t[o], l);
88
- return r - n === 1 ? h === 0 ? o : -1 : h === 0 ? o : h === -1 ? tt(l, t, e, o, r) : tt(l, t, e, n, o);
88
+ return r - n === 1 ? h === 0 ? o : -1 : h === 0 ? o : h === -1 ? Q(l, t, e, o, r) : Q(l, t, e, n, o);
89
89
  }
90
- function J(l) {
90
+ function Z(l) {
91
91
  const t = window.getComputedStyle(l), e = ["width", "padding-right", "padding-left", "margin-right", "margin-left", "border-right-width", "border-left-width"], i = ["height", "padding-top", "padding-bottom", "margin-top", "margin-bottom", "border-top-width", "border-bottom-width"];
92
92
  let s = 0, n = 0;
93
93
  return e.forEach(function(r) {
@@ -99,7 +99,7 @@ function J(l) {
99
99
  width: s
100
100
  };
101
101
  }
102
- function et(l) {
102
+ function tt(l) {
103
103
  const t = window.getComputedStyle(l), e = ["padding-right", "padding-left", "margin-right", "margin-left", "border-right-width", "border-left-width"], i = ["padding-top", "padding-bottom", "margin-top", "margin-bottom", "border-top-width", "border-bottom-width"];
104
104
  let s = 0, n = 0;
105
105
  return e.forEach(function(r) {
@@ -111,7 +111,7 @@ function et(l) {
111
111
  width: s
112
112
  };
113
113
  }
114
- function pt(l) {
114
+ function gt(l) {
115
115
  let t;
116
116
  const e = l.ownerDocument;
117
117
  if (l.nodeType == Node.TEXT_NODE) {
@@ -121,7 +121,7 @@ function pt(l) {
121
121
  t = l.getBoundingClientRect();
122
122
  return t;
123
123
  }
124
- function it() {
124
+ function et() {
125
125
  const l = window.innerWidth, t = window.innerHeight;
126
126
  return {
127
127
  top: 0,
@@ -132,39 +132,39 @@ function it() {
132
132
  height: t
133
133
  };
134
134
  }
135
- function Et(l, t) {
135
+ function St(l, t) {
136
136
  const i = l.parentNode.childNodes;
137
137
  let s, n = -1;
138
138
  for (let r = 0; r < i.length && (s = i[r], s.nodeType === t && n++, s != l); r++)
139
139
  ;
140
140
  return n;
141
141
  }
142
- function se(l) {
143
- return Et(l, te);
142
+ function ne(l) {
143
+ return St(l, ee);
144
144
  }
145
- function Dt(l) {
146
- return Et(l, Qt);
145
+ function Bt(l) {
146
+ return St(l, te);
147
147
  }
148
- function $(l) {
148
+ function Y(l) {
149
149
  return ["xml", "opf", "ncx"].indexOf(l) > -1;
150
150
  }
151
- function Bt(l, t) {
151
+ function Mt(l, t) {
152
152
  return new Blob([l], { type: t });
153
153
  }
154
- function st(l, t) {
155
- const e = Bt(l, t);
156
- return It.createObjectURL(e);
154
+ function it(l, t) {
155
+ const e = Mt(l, t);
156
+ return Ot.createObjectURL(e);
157
157
  }
158
- function Mt(l) {
159
- return It.revokeObjectURL(l);
158
+ function qt(l) {
159
+ return Ot.revokeObjectURL(l);
160
160
  }
161
- function gt(l, t) {
161
+ function mt(l, t) {
162
162
  if (typeof l != "string")
163
163
  return;
164
164
  const e = btoa(l);
165
165
  return "data:" + t + ";base64," + e;
166
166
  }
167
- function qt(l) {
167
+ function Wt(l) {
168
168
  return Object.prototype.toString.call(l).slice(8, -1);
169
169
  }
170
170
  function O(l, t) {
@@ -173,7 +173,7 @@ function O(l, t) {
173
173
  function b(l, t) {
174
174
  if (!l)
175
175
  throw new Error("No Element Provided");
176
- return l.querySelector(t) ?? void 0;
176
+ return l.querySelector(t);
177
177
  }
178
178
  function M(l, t) {
179
179
  return l.querySelectorAll(t);
@@ -184,27 +184,27 @@ function j(l, t, e) {
184
184
  t += i + "~='" + e[i] + "'";
185
185
  return t += "]", l.querySelector(t) ?? void 0;
186
186
  }
187
- function nt(l, t) {
188
- Wt(l, t, NodeFilter.SHOW_TEXT);
187
+ function st(l, t) {
188
+ Ut(l, t, NodeFilter.SHOW_TEXT);
189
189
  }
190
- function Wt(l, t, e) {
190
+ function Ut(l, t, e) {
191
191
  const i = document.createTreeWalker(l, e, null);
192
192
  let s;
193
193
  for (; s = i.nextNode(); )
194
194
  t(s);
195
195
  }
196
- function Ut(l, t, e) {
196
+ function jt(l, t, e) {
197
197
  if (t(l))
198
198
  return !0;
199
199
  let i = l.firstChild;
200
200
  if (i)
201
201
  do {
202
- if (Ut(i, t))
202
+ if (jt(i, t))
203
203
  return !0;
204
204
  i = i.nextSibling;
205
205
  } while (i);
206
206
  }
207
- function jt(l) {
207
+ function Ft(l) {
208
208
  return new Promise(function(t, e) {
209
209
  const i = new FileReader();
210
210
  i.readAsDataURL(l), i.onloadend = function() {
@@ -214,12 +214,12 @@ function jt(l) {
214
214
  }
215
215
  class y {
216
216
  constructor() {
217
- this.id = ht(), this.promise = new Promise((t, e) => {
217
+ this.id = ot(), this.promise = new Promise((t, e) => {
218
218
  this.resolve = t, this.reject = e;
219
219
  }), Object.freeze(this);
220
220
  }
221
221
  }
222
- function rt(l, t, e) {
222
+ function nt(l, t, e) {
223
223
  const i = l.querySelector(`${t}[*|type="${e}"]`);
224
224
  if (i)
225
225
  return i;
@@ -228,7 +228,7 @@ function rt(l, t, e) {
228
228
  if (s[n].getAttributeNS("http://www.idpf.org/2007/ops", "type") === e || s[n].getAttribute("epub:type") === e)
229
229
  return s[n];
230
230
  }
231
- function mt(l) {
231
+ function vt(l) {
232
232
  const t = [], e = l.childNodes;
233
233
  for (let i = 0; i < e.length; i++) {
234
234
  const s = e[i];
@@ -236,7 +236,7 @@ function mt(l) {
236
236
  }
237
237
  return t;
238
238
  }
239
- function vt(l) {
239
+ function yt(l) {
240
240
  const t = [];
241
241
  for (let e = l ?? null; e; e = e.parentNode)
242
242
  t.unshift(e);
@@ -255,7 +255,7 @@ function F(l, t, e) {
255
255
  if (!e)
256
256
  return i;
257
257
  }
258
- function ne(l, t) {
258
+ function re(l, t) {
259
259
  let e;
260
260
  if (!(l === null || t === ""))
261
261
  for (e = l.parentNode; e && e.nodeType === 1; ) {
@@ -264,7 +264,7 @@ function ne(l, t) {
264
264
  e = e.parentNode;
265
265
  }
266
266
  }
267
- class Ft {
267
+ class Vt {
268
268
  constructor() {
269
269
  this.collapsed = !1, this.commonAncestorContainer = void 0, this.endContainer = void 0, this.endOffset = void 0, this.startContainer = void 0, this.startOffset = void 0;
270
270
  }
@@ -287,7 +287,7 @@ class Ft {
287
287
  this.setStart(t, 0), this.setEnd(t, e);
288
288
  }
289
289
  _commonAncestorContainer(t, e) {
290
- const i = vt(t ?? this.startContainer), s = vt(e ?? this.endContainer);
290
+ const i = yt(t ?? this.startContainer), s = yt(e ?? this.endContainer);
291
291
  if (i[0] == s[0]) {
292
292
  for (let n = 0; n < i.length; n++)
293
293
  if (i[n] != s[n])
@@ -301,54 +301,54 @@ class Ft {
301
301
  return "";
302
302
  }
303
303
  }
304
- const re = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
304
+ const oe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
305
305
  __proto__: null,
306
- RangeObject: Ft,
307
- blob2base64: jt,
308
- borders: et,
309
- bounds: J,
310
- createBase64Url: gt,
311
- createBlob: Bt,
312
- createBlobUrl: st,
313
- defaults: zt,
306
+ RangeObject: Vt,
307
+ blob2base64: Ft,
308
+ borders: tt,
309
+ bounds: Z,
310
+ createBase64Url: mt,
311
+ createBlob: Mt,
312
+ createBlobUrl: it,
313
+ defaults: Dt,
314
314
  defer: y,
315
- documentHeight: ee,
315
+ documentHeight: ie,
316
316
  extend: C,
317
317
  filterChildren: F,
318
- findChildren: mt,
319
- getParentByTagName: ne,
320
- indexOfElementNode: Dt,
321
- indexOfNode: Et,
322
- indexOfSorted: tt,
323
- indexOfTextNode: se,
324
- insert: ie,
325
- isElement: Ot,
326
- isFloat: Pt,
318
+ findChildren: vt,
319
+ getParentByTagName: re,
320
+ indexOfElementNode: Bt,
321
+ indexOfNode: St,
322
+ indexOfSorted: Q,
323
+ indexOfTextNode: ne,
324
+ insert: se,
325
+ isElement: Pt,
326
+ isFloat: zt,
327
327
  isNumber: E,
328
- isXml: $,
328
+ isXml: Y,
329
329
  locationOf: H,
330
- nodeBounds: pt,
331
- parents: vt,
330
+ nodeBounds: gt,
331
+ parents: yt,
332
332
  parse: O,
333
333
  prefixed: U,
334
334
  qs: b,
335
335
  qsa: M,
336
336
  qsp: j,
337
- querySelectorByType: rt,
338
- requestAnimationFrame: xt,
339
- revokeBlobUrl: Mt,
340
- sprint: nt,
341
- treeWalker: Wt,
342
- type: qt,
343
- uuid: ht,
344
- walk: Ut,
345
- windowBounds: it
337
+ querySelectorByType: nt,
338
+ requestAnimationFrame: Et,
339
+ revokeBlobUrl: qt,
340
+ sprint: st,
341
+ treeWalker: Ut,
342
+ type: Wt,
343
+ uuid: ot,
344
+ walk: jt,
345
+ windowBounds: et
346
346
  }, Symbol.toStringTag, { value: "Module" }));
347
347
  function X(l) {
348
348
  if (typeof l != "string")
349
349
  throw new TypeError("Path must be a string. Received " + l);
350
350
  }
351
- function oe(l, t) {
351
+ function he(l, t) {
352
352
  let e = "", i = -1, s = 0, n;
353
353
  for (let r = 0; r <= l.length; ++r) {
354
354
  if (r < l.length)
@@ -383,16 +383,16 @@ function oe(l, t) {
383
383
  }
384
384
  return e;
385
385
  }
386
- function yt(...l) {
386
+ function wt(...l) {
387
387
  let t = "", e = !1;
388
388
  for (let i = l.length - 1; i >= -1 && !e; i--) {
389
389
  const s = i >= 0 ? l[i] : "/";
390
390
  X(s), s.length !== 0 && (t = s + "/" + t, e = s.charCodeAt(0) === 47);
391
391
  }
392
- return t = oe(t, !e), e ? t.length > 0 ? "/" + t : "/" : t.length > 0 ? t : ".";
392
+ return t = he(t, !e), e ? t.length > 0 ? "/" + t : "/" : t.length > 0 ? t : ".";
393
393
  }
394
- function he(l, t) {
395
- if (X(l), X(t), l === t || (l = yt(l), t = yt(t), l === t))
394
+ function le(l, t) {
395
+ if (X(l), X(t), l === t || (l = wt(l), t = wt(t), l === t))
396
396
  return "";
397
397
  let e = 1;
398
398
  for (; e < l.length && l.charCodeAt(e) === 47; ++e)
@@ -423,7 +423,7 @@ function he(l, t) {
423
423
  (c === i || l.charCodeAt(c) === 47) && (d.length === 0 ? d += ".." : d += "/..");
424
424
  return d.length > 0 ? d + t.slice(n + a) : (n += a, t.charCodeAt(n) === 47 && ++n, t.slice(n));
425
425
  }
426
- function le(l) {
426
+ function ae(l) {
427
427
  if (X(l), l.length === 0)
428
428
  return ".";
429
429
  let t = l.charCodeAt(0);
@@ -439,10 +439,10 @@ function le(l) {
439
439
  s = !1;
440
440
  return i === -1 ? e ? "/" : "." : e && i === 1 ? "//" : l.slice(0, i);
441
441
  }
442
- function ae(l) {
442
+ function ce(l) {
443
443
  return X(l), l.length > 0 && l.charCodeAt(0) === 47;
444
444
  }
445
- function ce(l) {
445
+ function de(l) {
446
446
  X(l);
447
447
  const t = { root: "", dir: "", base: "", ext: "", name: "" };
448
448
  if (l.length === 0)
@@ -464,7 +464,7 @@ function ce(l) {
464
464
  }
465
465
  return n === -1 || o === -1 || c === 0 || c === 1 && n === o - 1 && n === r + 1 ? o !== -1 && (r === 0 && i ? t.base = t.name = l.slice(1, o) : t.base = t.name = l.slice(r, o)) : (r === 0 && i ? (t.name = l.slice(1, n), t.base = l.slice(1, o)) : (t.name = l.slice(r, n), t.base = l.slice(r, o)), t.ext = l.slice(n, o)), r > 0 ? t.dir = l.slice(0, r - 1) : i && (t.dir = "/"), t;
466
466
  }
467
- const B = { resolve: yt, relative: he, dirname: le, isAbsolute: ae, parse: ce };
467
+ const B = { resolve: wt, relative: le, dirname: ae, isAbsolute: ce, parse: de };
468
468
  class z {
469
469
  constructor(t) {
470
470
  t.indexOf("://") > -1 && (t = new URL(t).pathname);
@@ -514,9 +514,6 @@ class z {
514
514
  relative(t) {
515
515
  return t && t.indexOf("://") > -1 ? t : B.relative(this.directory, t);
516
516
  }
517
- splitPath(t) {
518
- return this.splitPathRe.exec(t).slice(1);
519
- }
520
517
  /**
521
518
  * Return the path string
522
519
  * @returns {string} path
@@ -525,7 +522,7 @@ class z {
525
522
  return this.path;
526
523
  }
527
524
  }
528
- class N {
525
+ class R {
529
526
  constructor(t, e) {
530
527
  const i = t.indexOf("://") > -1;
531
528
  let s = t, n;
@@ -569,7 +566,7 @@ class N {
569
566
  return this.href;
570
567
  }
571
568
  }
572
- const W = 1, L = 3, de = 9;
569
+ const W = 1, L = 3, ue = 9;
573
570
  class v {
574
571
  constructor(t, e, i) {
575
572
  if (this.str = "", this.base = {}, this.spinePos = 0, this.range = !1, this.path = {}, this.start = null, this.end = null, !(this instanceof v))
@@ -593,7 +590,7 @@ class v {
593
590
  * @private
594
591
  */
595
592
  checkType(t) {
596
- return this.isCfiString(t) ? "string" : t && typeof t == "object" && (qt(t) === "Range" || typeof t.startContainer < "u") ? "range" : t && typeof t == "object" && typeof t.nodeType < "u" ? "node" : t && typeof t == "object" && t instanceof v ? "EpubCFI" : !1;
593
+ return this.isCfiString(t) ? "string" : t && typeof t == "object" && (Wt(t) === "Range" || typeof t.startContainer < "u") ? "range" : t && typeof t == "object" && typeof t.nodeType < "u" ? "node" : t && typeof t == "object" && t instanceof v ? "EpubCFI" : !1;
597
594
  }
598
595
  /**
599
596
  * Parse a cfi string to a CFI object representation
@@ -630,7 +627,7 @@ class v {
630
627
  }
631
628
  }, i = t.split(":"), s = i[0].split("/");
632
629
  let n;
633
- return i.length > 1 && (n = i[1], e.terminal = this.parseTerminal(n)), s[0] === "" && s.shift(), e.steps = s.map((r) => this.parseStep(r)).filter((r) => r !== void 0), e;
630
+ return i.length > 1 && (n = i[1], e.terminal = this.parseTerminal(n)), s[0] === "" && s.shift(), e.steps = s.map((r) => this.parseStep(r)), e;
634
631
  }
635
632
  parseStep(t) {
636
633
  let e, i, s;
@@ -700,23 +697,18 @@ class v {
700
697
  if (t.spinePos < e.spinePos)
701
698
  return -1;
702
699
  t.range ? (i = t.path.steps.concat(t.start.steps), n = t.start.terminal) : (i = t.path.steps, n = t.path.terminal), e.range ? (s = e.path.steps.concat(e.start.steps), r = e.start.terminal) : (s = e.path.steps, r = e.path.terminal);
703
- for (let o = 0; o < i.length; o++) {
704
- if (!i[o])
700
+ for (let a = 0; a < i.length; a++) {
701
+ if (!i[a])
705
702
  return -1;
706
- if (!s[o] || i[o].index > s[o].index)
703
+ if (!s[a] || i[a].index > s[a].index)
707
704
  return 1;
708
- if (i[o].index < s[o].index)
705
+ if (i[a].index < s[a].index)
709
706
  return -1;
710
707
  }
711
708
  if (i.length < s.length)
712
709
  return -1;
713
- if (n.offset != null && r.offset != null) {
714
- if (n.offset > r.offset)
715
- return 1;
716
- if (n.offset < r.offset)
717
- return -1;
718
- }
719
- return 0;
710
+ const o = n.offset ?? 0, h = r.offset ?? 0;
711
+ return o > h ? 1 : o < h ? -1 : 0;
720
712
  }
721
713
  step(t) {
722
714
  const e = t.nodeType === L ? "text" : "element";
@@ -748,7 +740,7 @@ class v {
748
740
  }
749
741
  };
750
742
  let n = t, r;
751
- for (; n && n.parentNode && n.parentNode.nodeType != de; )
743
+ for (; n && n.parentNode && n.parentNode.nodeType != ue; )
752
744
  i ? r = this.filteredStep(n, i) : r = this.step(n), r && s.steps.unshift(r), n = n.parentNode;
753
745
  return e != null && e >= 0 && (s.terminal.offset = e, s.steps.length > 0 && s.steps[s.steps.length - 1].type != "text" && s.steps.push({
754
746
  type: "text",
@@ -841,7 +833,7 @@ class v {
841
833
  }
842
834
  position(t) {
843
835
  let e, i;
844
- return t.nodeType === W ? (e = t.parentNode.children, e || (e = mt(t.parentNode)), i = Array.from(e).indexOf(t)) : (e = this.textNodes(t.parentNode), i = e.indexOf(t)), i;
836
+ return t.nodeType === W ? (e = t.parentNode.children, e || (e = vt(t.parentNode)), i = Array.from(e).indexOf(t)) : (e = this.textNodes(t.parentNode), i = e.indexOf(t)), i;
845
837
  }
846
838
  filteredPosition(t, e) {
847
839
  let i, s;
@@ -888,7 +880,7 @@ class v {
888
880
  let n = s.documentElement, r, o;
889
881
  const h = t.length;
890
882
  let a;
891
- for (a = 0; a < h && (o = t[a], o.type === "element" ? o.id ? n = s.getElementById(o.id) : (r = n.children || mt(n), n = r[o.index]) : o.type === "text" && (n = this.textNodes(n, i)[o.index]), !!n); a++)
883
+ for (a = 0; a < h && (o = t[a], o.type === "element" ? o.id ? n = s.getElementById(o.id) : (r = n.children || vt(n), n = r[o.index]) : o.type === "text" && (n = this.textNodes(n, i)[o.index]), !!n); a++)
892
884
  ;
893
885
  return n;
894
886
  }
@@ -930,7 +922,7 @@ class v {
930
922
  let c, d;
931
923
  const u = e ? i.querySelector("." + e) != null : !1;
932
924
  let p;
933
- if (typeof i.createRange < "u" ? s = i.createRange() : s = new Ft(), a.range ? (n = a.start, c = a.path.steps.concat(n.steps), o = this.findNode(c, i, u ? e : void 0), r = a.end, d = a.path.steps.concat(r.steps), h = this.findNode(d, i, u ? e : void 0)) : (n = a.path, c = a.path.steps, o = this.findNode(a.path.steps, i, u ? e : void 0)), o)
925
+ if (typeof i.createRange < "u" ? s = i.createRange() : s = new Vt(), a.range ? (n = a.start, c = a.path.steps.concat(n.steps), o = this.findNode(c, i, u ? e : void 0), r = a.end, d = a.path.steps.concat(r.steps), h = this.findNode(d, i, u ? e : void 0)) : (n = a.path, c = a.path.steps, o = this.findNode(a.path.steps, i, u ? e : void 0)), o)
934
926
  try {
935
927
  n.terminal.offset != null ? s.setStart(o, n.terminal.offset) : s.setStart(o, 0);
936
928
  } catch {
@@ -1021,7 +1013,7 @@ class A {
1021
1013
  return this.hooks = [];
1022
1014
  }
1023
1015
  }
1024
- function Vt(l, t) {
1016
+ function Ht(l, t) {
1025
1017
  let e, i = t.url;
1026
1018
  const s = i.indexOf("://") > -1;
1027
1019
  if (!l)
@@ -1029,7 +1021,7 @@ function Vt(l, t) {
1029
1021
  const n = b(l, "head");
1030
1022
  e = b(n, "base"), e || (e = l.createElement("base"), n.insertBefore(e, n.firstChild)), !s && window && window.location && (i = window.location.origin + i), e.setAttribute("href", i);
1031
1023
  }
1032
- function ue(l, t) {
1024
+ function fe(l, t) {
1033
1025
  let e;
1034
1026
  const i = t.canonical;
1035
1027
  if (!l)
@@ -1037,7 +1029,7 @@ function ue(l, t) {
1037
1029
  const s = b(l, "head");
1038
1030
  e = b(s, "link[rel='canonical']"), e ? e.setAttribute("href", i) : (e = l.createElement("link"), e.setAttribute("rel", "canonical"), e.setAttribute("href", i), s.appendChild(e));
1039
1031
  }
1040
- function fe(l, t) {
1032
+ function pe(l, t) {
1041
1033
  let e;
1042
1034
  const i = t.idref;
1043
1035
  if (!l)
@@ -1045,7 +1037,7 @@ function fe(l, t) {
1045
1037
  const s = b(l, "head");
1046
1038
  e = b(s, "link[property='dc.identifier']"), e ? e.setAttribute("content", i) : (e = l.createElement("meta"), e.setAttribute("name", "dc.identifier"), e.setAttribute("content", i), s.appendChild(e));
1047
1039
  }
1048
- function pe(l, t) {
1040
+ function ge(l, t) {
1049
1041
  const e = l.querySelectorAll("a[href]");
1050
1042
  if (!e.length)
1051
1043
  return;
@@ -1063,7 +1055,7 @@ function pe(l, t) {
1063
1055
  else {
1064
1056
  let c;
1065
1057
  try {
1066
- c = new N(o, s);
1058
+ c = new R(o, s);
1067
1059
  } catch {
1068
1060
  }
1069
1061
  r.onclick = function() {
@@ -1074,7 +1066,7 @@ function pe(l, t) {
1074
1066
  for (let r = 0; r < e.length; r++)
1075
1067
  n(e[r]);
1076
1068
  }
1077
- function kt(l, t, e) {
1069
+ function Lt(l, t, e) {
1078
1070
  return t.forEach(function(i, s) {
1079
1071
  if (i && e[s]) {
1080
1072
  try {
@@ -1089,13 +1081,13 @@ function kt(l, t, e) {
1089
1081
  }
1090
1082
  }), l;
1091
1083
  }
1092
- function K(l, t, e, i) {
1084
+ function $(l, t, e, i) {
1093
1085
  const s = typeof window < "u" ? window.URL : !1, n = s ? "blob" : "arraybuffer", r = new y(), o = new XMLHttpRequest();
1094
1086
  let h;
1095
1087
  e && (o.withCredentials = !0), o.onreadystatechange = c, o.onerror = a, o.open("GET", l, !0);
1096
1088
  for (h in i)
1097
1089
  o.setRequestHeader(h, i[h]);
1098
- t == "json" && o.setRequestHeader("Accept", "application/json"), t || (t = new z(l).extension), t == "blob" && (o.responseType = n), $(t) && o.overrideMimeType("text/xml"), t == "binary" && (o.responseType = "arraybuffer"), o.send();
1090
+ t == "json" && o.setRequestHeader("Accept", "application/json"), t || (t = new z(l).extension), t == "blob" && (o.responseType = n), Y(t) && o.overrideMimeType("text/xml"), t == "binary" && (o.responseType = "arraybuffer"), o.send();
1099
1091
  function a(d) {
1100
1092
  r.reject(d);
1101
1093
  }
@@ -1117,7 +1109,7 @@ function K(l, t, e, i) {
1117
1109
  message: "Forbidden",
1118
1110
  stack: new Error().stack
1119
1111
  }), r.promise;
1120
- d ? u = o.responseXML : $(t) ? u = O(o.response, "text/xml") : t == "xhtml" ? u = O(o.response, "application/xhtml+xml") : t == "html" || t == "htm" ? u = O(o.response, "text/html") : t == "json" ? u = JSON.parse(o.response) : t == "blob" ? s ? u = o.response : u = new Blob([o.response]) : u = o.response, r.resolve(u);
1112
+ d ? u = o.responseXML : Y(t) ? u = O(o.response, "text/xml") : t == "xhtml" ? u = O(o.response, "application/xhtml+xml") : t == "html" || t == "htm" ? u = O(o.response, "text/html") : t == "json" ? u = JSON.parse(o.response) : t == "blob" ? s ? u = o.response : u = new Blob([o.response]) : u = o.response, r.resolve(u);
1121
1113
  } else
1122
1114
  r.reject({
1123
1115
  status: o.status,
@@ -1128,7 +1120,7 @@ function K(l, t, e, i) {
1128
1120
  }
1129
1121
  return r.promise;
1130
1122
  }
1131
- class ge {
1123
+ class me {
1132
1124
  constructor(t, e) {
1133
1125
  this.idref = t.idref, this.linear = t.linear === "yes", this.properties = t.properties, this.index = t.index, this.href = t.href, this.url = t.url, this.canonical = t.canonical, this.next = t.next, this.prev = t.prev, this.cfiBase = t.cfiBase, e ? this.hooks = e : (this.hooks = {}, this.hooks.serialize = new A(this), this.hooks.content = new A(this)), this.document = void 0, this.contents = void 0, this.output = void 0;
1134
1126
  }
@@ -1138,7 +1130,7 @@ class ge {
1138
1130
  * @return {document} a promise with the xml document
1139
1131
  */
1140
1132
  load(t) {
1141
- const e = t || this.request || K, i = new y(), s = i.promise;
1133
+ const e = t || this.request || $, i = new y(), s = i.promise;
1142
1134
  return this.contents ? i.resolve(this.contents) : e(this.url).then((n) => (this.document = n, this.contents = n.documentElement, this.hooks.content.trigger(this.document, this))).then(() => {
1143
1135
  i.resolve(this.contents);
1144
1136
  }).catch(function(n) {
@@ -1150,7 +1142,7 @@ class ge {
1150
1142
  * @private
1151
1143
  */
1152
1144
  base() {
1153
- return Vt(this.document, this);
1145
+ return Ht(this.document, this);
1154
1146
  }
1155
1147
  /**
1156
1148
  * Render the contents of a section
@@ -1184,7 +1176,7 @@ class ge {
1184
1176
  excerpt: u
1185
1177
  })), d = c;
1186
1178
  };
1187
- return nt(e.document, function(r) {
1179
+ return st(e.document, function(r) {
1188
1180
  n(r);
1189
1181
  }), i;
1190
1182
  }
@@ -1205,10 +1197,10 @@ class ge {
1205
1197
  x += 1;
1206
1198
  const S = d[0], _ = d[x], T = n.document.createRange();
1207
1199
  T.setStart(S, g);
1208
- const I = d.slice(0, x).reduce((at, ct) => at + (ct.textContent ?? "").length, 0);
1200
+ const I = d.slice(0, x).reduce((lt, at) => lt + (at.textContent ?? "").length, 0);
1209
1201
  T.setEnd(_, I > w ? w : w - I);
1210
1202
  const q = n.cfiFromRange(T);
1211
- let D = d.slice(0, x + 1).reduce((at, ct) => at + (ct.textContent ?? ""), "");
1203
+ let D = d.slice(0, x + 1).reduce((lt, at) => lt + (at.textContent ?? ""), "");
1212
1204
  D.length > 150 && (D = D.substring(g - 150 / 2, g + 150 / 2), D = "..." + D + "..."), i.push({
1213
1205
  cfi: q,
1214
1206
  excerpt: D
@@ -1265,9 +1257,9 @@ class ge {
1265
1257
  this.unload(), this.hooks.serialize.clear(), this.hooks.content.clear(), this.hooks = void 0, this.idref = void 0, this.linear = void 0, this.properties = void 0, this.index = void 0, this.href = void 0, this.url = void 0, this.next = void 0, this.prev = void 0, this.cfiBase = void 0;
1266
1258
  }
1267
1259
  }
1268
- class me {
1260
+ class ve {
1269
1261
  constructor() {
1270
- this.spineItems = [], this.spineByHref = {}, this.spineById = {}, this.hooks = {}, this.hooks.serialize = new A(), this.hooks.content = new A(), this.hooks.content.register(Vt), this.hooks.content.register(ue), this.hooks.content.register(fe), this.epubcfi = new v(), this.loaded = !1, this.items = [], this.manifest = {}, this.spineNodeIndex = 0, this.baseUrl = "", this.length = 0;
1262
+ this.spineItems = [], this.spineByHref = {}, this.spineById = {}, this.hooks = {}, this.hooks.serialize = new A(), this.hooks.content = new A(), this.hooks.content.register(Ht), this.hooks.content.register(fe), this.hooks.content.register(pe), this.epubcfi = new v(), this.loaded = !1, this.items = [], this.manifest = {}, this.spineNodeIndex = 0, this.baseUrl = "", this.length = 0;
1271
1263
  }
1272
1264
  /**
1273
1265
  * Unpack items from a opf into spine items
@@ -1297,7 +1289,7 @@ class me {
1297
1289
  }) : (s.prev = function() {
1298
1290
  }, s.next = function() {
1299
1291
  });
1300
- const o = new ge(s, this.hooks);
1292
+ const o = new me(s, this.hooks);
1301
1293
  this.append(o);
1302
1294
  }), this.loaded = !0;
1303
1295
  }
@@ -1391,14 +1383,10 @@ class me {
1391
1383
  this.each((t) => t.destroy()), this.spineItems = void 0, this.spineByHref = void 0, this.spineById = void 0, this.hooks.serialize.clear(), this.hooks.content.clear(), this.hooks = void 0, this.epubcfi = void 0, this.loaded = !1, this.items = void 0, this.manifest = void 0, this.spineNodeIndex = void 0, this.baseUrl = void 0, this.length = void 0;
1392
1384
  }
1393
1385
  }
1394
- class St {
1386
+ class _t {
1395
1387
  constructor(t) {
1396
- this._q = [], this.context = t, this.tick = xt, this.running = !1, this.paused = !1;
1388
+ this._q = [], this.context = t, this.tick = Et, this.running = !1, this.paused = !1;
1397
1389
  }
1398
- /**
1399
- * Add an item to the queue
1400
- * @return {Promise}
1401
- */
1402
1390
  enqueue(...t) {
1403
1391
  let e, i, s;
1404
1392
  const [n, ...r] = t;
@@ -1411,6 +1399,7 @@ class St {
1411
1399
  deferred: e,
1412
1400
  promise: i
1413
1401
  }) : s = {
1402
+ args: [],
1414
1403
  promise: n
1415
1404
  }, this._q.push(s), this.paused == !1 && !this.running && this.run(), s.promise;
1416
1405
  }
@@ -1420,17 +1409,11 @@ class St {
1420
1409
  */
1421
1410
  dequeue() {
1422
1411
  let t, e, i;
1423
- if (this._q.length && !this.paused) {
1424
- if (t = this._q.shift(), e = t.task, e)
1425
- return i = e.call(this.context, ...t.args), i && typeof i.then == "function" ? i.then((...s) => {
1426
- t.deferred.resolve(...s);
1427
- }, (...s) => {
1428
- t.deferred.reject(...s);
1429
- }) : (t.deferred.resolve(i), t.promise);
1430
- if (t.promise)
1431
- return t.promise;
1432
- } else
1433
- return t = new y(), t.resolve(), t.promise;
1412
+ return this._q.length && !this.paused ? (t = this._q.shift(), e = t.task, e ? (i = e.call(this.context, ...t.args), i && typeof i.then == "function" ? i.then((s) => {
1413
+ t.deferred.resolve(s);
1414
+ }, (s) => {
1415
+ t.deferred.reject(s);
1416
+ }) : (t.deferred.resolve(i), t.promise)) : t.promise) : Promise.resolve();
1434
1417
  }
1435
1418
  // Run All Immediately
1436
1419
  dump() {
@@ -1442,8 +1425,9 @@ class St {
1442
1425
  * @return {Promise}
1443
1426
  */
1444
1427
  run() {
1445
- return this.running || (this.running = !0, this.defered = new y()), this.tick(() => {
1446
- this._q.length ? this.dequeue().then(() => {
1428
+ return this.running || (this.running = !0, this.defered = new y()), this.tick && this.tick(() => {
1429
+ var t;
1430
+ this._q.length ? (t = this.dequeue()) == null || t.then(() => {
1447
1431
  this.run();
1448
1432
  }) : (this.defered.resolve(), this.running = void 0);
1449
1433
  }), this.paused == !0 && (this.paused = !1), this.defered.promise;
@@ -1453,10 +1437,11 @@ class St {
1453
1437
  * @return {Promise}
1454
1438
  */
1455
1439
  flush() {
1440
+ var t;
1456
1441
  if (this.running)
1457
1442
  return this.running;
1458
1443
  if (this._q.length)
1459
- return this.running = this.dequeue().then(() => (this.running = void 0, this.flush())), this.running;
1444
+ return this.running = (t = this.dequeue()) == null ? void 0 : t.then(() => (this.running = void 0, this.flush())), this.running;
1460
1445
  }
1461
1446
  /**
1462
1447
  * Clear all items in wait
@@ -1484,7 +1469,7 @@ class St {
1484
1469
  this._q = [], this.running = !1, this.paused = !0;
1485
1470
  }
1486
1471
  }
1487
- const lt = "0.3", Q = ["keydown", "keyup", "keypress", "mouseup", "mousedown", "mousemove", "click", "dblclick", "touchend", "touchstart", "touchmove"], f = {
1472
+ const ht = "0.3", J = ["keydown", "keyup", "keypress", "mouseup", "mousedown", "mousemove", "click", "dblclick", "touchend", "touchstart", "touchmove"], f = {
1488
1473
  BOOK: {
1489
1474
  OPEN_FAILED: "openFailed"
1490
1475
  },
@@ -1541,9 +1526,9 @@ const lt = "0.3", Q = ["keydown", "keyup", "keypress", "mouseup", "mousedown", "
1541
1526
  DETACH: "detach"
1542
1527
  }
1543
1528
  };
1544
- class Ht {
1529
+ class Xt {
1545
1530
  constructor(t, e, i) {
1546
- this.spine = t, this.request = e, this.pause = i || 100, this.q = new St(this), this.epubcfi = new v(), this._locations = [], this._locationsWords = [], this.total = 0, this.break = 150, this._current = 0, this._wordCounter = 0, this._currentCfi = "", this.processingTimeout = void 0;
1531
+ this.spine = t, this.request = e, this.pause = i || 100, this.q = new _t(this), this.epubcfi = new v(), this._locations = [], this._locationsWords = [], this.total = 0, this.break = 150, this._current = 0, this._wordCounter = 0, this._currentCfi = "", this.processingTimeout = void 0;
1547
1532
  }
1548
1533
  /**
1549
1534
  * Load all of sections in the book to generate locations
@@ -1575,12 +1560,12 @@ class Ht {
1575
1560
  const r = t.ownerDocument, o = b(r, "body");
1576
1561
  let h = 0, a;
1577
1562
  const c = i || this.break;
1578
- if (nt(o, (u) => {
1563
+ if (st(o, (u) => {
1579
1564
  const p = u.length;
1580
1565
  let g, m = 0;
1581
- if (h === 0 && n === void 0 && (n = this.createRange(), n.startContainer = u, n.startOffset = 0), (u.textContent ?? "").trim().length === 0)
1566
+ if ((u.textContent ?? "").trim().length === 0)
1582
1567
  return a = u, !1;
1583
- for (g = c - h, g > p && (h += p, m = p); m < p; )
1568
+ for (h === 0 && (n = this.createRange(), n.startContainer = u, n.startOffset = 0), g = c - h, g > p && (h += p, m = p); m < p; )
1584
1569
  if (g = c - h, h === 0 && (m += 1, n = this.createRange(), n.startContainer = u, n.startOffset = m), m + g >= p)
1585
1570
  h += p - m, m = p;
1586
1571
  else {
@@ -1623,7 +1608,7 @@ class Ht {
1623
1608
  parseWords(t, e, i, s) {
1624
1609
  const n = e.cfiBase, r = [], o = t.ownerDocument, h = b(o, "body"), a = i;
1625
1610
  let c = s ? s.spinePos !== e.index : !0, d;
1626
- return s && e.index === s.spinePos && (d = s.findNode(s.range ? s.path.steps.concat(s.start.steps) : s.path.steps, t.ownerDocument)), nt(h, (p) => {
1611
+ return s && e.index === s.spinePos && (d = s.findNode(s.range ? s.path.steps.concat(s.start.steps) : s.path.steps, t.ownerDocument)), st(h, (p) => {
1627
1612
  if (!c)
1628
1613
  if (p === d)
1629
1614
  c = !0;
@@ -1750,8 +1735,8 @@ class Ht {
1750
1735
  this.spine = void 0, this.request = void 0, this.pause = void 0, (t = this.q) == null || t.stop(), this.q = void 0, this.epubcfi = void 0, this._locations = void 0, this.total = void 0, this.break = void 0, this._current = void 0, this.currentLocation = void 0, this._currentCfi = void 0, clearTimeout(this.processingTimeout);
1751
1736
  }
1752
1737
  }
1753
- P(Ht.prototype);
1754
- class ve {
1738
+ P(Xt.prototype);
1739
+ class ye {
1755
1740
  constructor(t) {
1756
1741
  this.packagePath = "", this.directory = "", this.encoding = "", t && this.parse(t);
1757
1742
  }
@@ -1771,7 +1756,7 @@ class ve {
1771
1756
  this.packagePath = void 0, this.directory = void 0, this.encoding = void 0;
1772
1757
  }
1773
1758
  }
1774
- class Lt {
1759
+ class Nt {
1775
1760
  constructor(t) {
1776
1761
  this.manifest = {}, this.navPath = "", this.ncxPath = "", this.coverPath = "", this.spineNodeIndex = 0, this.spine = [], this.metadata = {}, t && this.parse(t);
1777
1762
  }
@@ -1792,7 +1777,7 @@ class Lt {
1792
1777
  const s = b(t, "spine");
1793
1778
  if (!s)
1794
1779
  throw new Error("No Spine Found");
1795
- return this.manifest = this.parseManifest(i), this.navPath = this.findNavPath(i), this.ncxPath = this.findNcxPath(i, s), this.coverPath = this.findCoverPath(t), this.spineNodeIndex = Dt(s), this.spine = this.parseSpine(s, this.manifest), this.uniqueIdentifier = this.findUniqueIdentifier(t), this.metadata = this.parseMetadata(e), this.metadata.direction = s.getAttribute("page-progression-direction") ?? "", {
1780
+ return this.manifest = this.parseManifest(i), this.navPath = this.findNavPath(i), this.ncxPath = this.findNcxPath(i, s), this.coverPath = this.findCoverPath(t), this.spineNodeIndex = Bt(s), this.spine = this.parseSpine(s, this.manifest), this.uniqueIdentifier = this.findUniqueIdentifier(t), this.metadata = this.parseMetadata(e), this.metadata.direction = s.getAttribute("page-progression-direction") ?? "", {
1796
1781
  metadata: this.metadata,
1797
1782
  spine: this.spine,
1798
1783
  manifest: this.manifest,
@@ -1959,7 +1944,7 @@ class Lt {
1959
1944
  this.manifest = void 0, this.navPath = void 0, this.ncxPath = void 0, this.coverPath = void 0, this.spineNodeIndex = void 0, this.spine = void 0, this.metadata = void 0;
1960
1945
  }
1961
1946
  }
1962
- class dt {
1947
+ class ct {
1963
1948
  constructor(t) {
1964
1949
  this.toc = [], this.tocByHref = {}, this.tocById = {}, this.landmarks = [], this.landmarksByType = {}, this.length = 0, t && this.parse(t);
1965
1950
  }
@@ -2030,7 +2015,7 @@ class dt {
2030
2015
  * @return {array} navigation list
2031
2016
  */
2032
2017
  parseNav(t) {
2033
- const e = rt(t, "nav", "toc");
2018
+ const e = nt(t, "nav", "toc");
2034
2019
  let i = [];
2035
2020
  if (!e) return i;
2036
2021
  const s = F(e, "ol", !0);
@@ -2082,7 +2067,7 @@ class dt {
2082
2067
  * @return {array} landmarks list
2083
2068
  */
2084
2069
  parseLandmarks(t) {
2085
- const e = rt(t, "nav", "landmarks"), i = e ? Array.from(M(e, "li")) : [], s = i.length;
2070
+ const e = nt(t, "nav", "landmarks"), i = e ? Array.from(M(e, "li")) : [], s = i.length;
2086
2071
  let n;
2087
2072
  const r = [];
2088
2073
  let o;
@@ -2147,7 +2132,10 @@ class dt {
2147
2132
  * @return {Array} navItems
2148
2133
  */
2149
2134
  load(t) {
2150
- return t.map((e) => (e.label = e.title, e.subitems = e.children ? this.load(e.children) : [], e));
2135
+ return t.map((e) => {
2136
+ const i = e;
2137
+ return i.label = i.title, i.subitems = i.children ? this.load(i.children) : [], e;
2138
+ });
2151
2139
  }
2152
2140
  /**
2153
2141
  * forEach pass through
@@ -2158,7 +2146,7 @@ class dt {
2158
2146
  return this.toc.forEach(t);
2159
2147
  }
2160
2148
  }
2161
- const G = {
2149
+ const dt = {
2162
2150
  application: {
2163
2151
  ecmascript: ["es", "ecma"],
2164
2152
  javascript: "js",
@@ -2292,26 +2280,27 @@ const G = {
2292
2280
  "x-ms-vob": "vob",
2293
2281
  "x-smv": "smv"
2294
2282
  }
2295
- }, ye = (function() {
2283
+ }, we = (function() {
2296
2284
  let l, t, e, i;
2297
2285
  const s = {};
2298
- for (l in G)
2299
- if (G.hasOwnProperty(l)) {
2300
- for (t in G[l])
2301
- if (G[l].hasOwnProperty(t))
2302
- if (e = G[l][t], typeof e == "string")
2286
+ for (l in dt)
2287
+ if (dt.hasOwnProperty(l)) {
2288
+ const n = dt[l];
2289
+ for (t in n)
2290
+ if (n.hasOwnProperty(t))
2291
+ if (e = n[t], typeof e == "string")
2303
2292
  s[e] = l + "/" + t;
2304
2293
  else
2305
2294
  for (i = 0; i < e.length; i++)
2306
2295
  s[e[i]] = l + "/" + t;
2307
2296
  }
2308
2297
  return s;
2309
- })(), we = "text/plain";
2310
- function be(l) {
2311
- return l && ye[l.split(".").pop().toLowerCase()] || we;
2298
+ })(), be = "text/plain";
2299
+ function xe(l) {
2300
+ return l && we[l.split(".").pop().toLowerCase()] || be;
2312
2301
  }
2313
- const V = { lookup: be };
2314
- class xe {
2302
+ const V = { lookup: xe };
2303
+ class Ee {
2315
2304
  constructor(t, e) {
2316
2305
  this.settings = {
2317
2306
  replacements: e && e.replacements || "base64",
@@ -2357,8 +2346,8 @@ class xe {
2357
2346
  * @return {Promise<string>} Promise resolves with url string
2358
2347
  */
2359
2348
  createUrl(t) {
2360
- const e = new N(t), i = V.lookup(e.filename);
2361
- return this.settings.archive ? this.settings.archive.createUrl(t, { base64: this.settings.replacements === "base64" }) : this.settings.replacements === "base64" ? this.settings.request(t, "blob").then((s) => jt(s)).then((s) => gt(s, i)) : this.settings.request(t, "blob").then((s) => st(s, i));
2349
+ const e = new R(t), i = V.lookup(e.filename);
2350
+ return this.settings.archive ? this.settings.archive.createUrl(t, { base64: this.settings.replacements === "base64" }) : this.settings.replacements === "base64" ? this.settings.request(t, "blob").then((s) => Ft(s)).then((s) => mt(s, i)) : this.settings.request(t, "blob").then((s) => it(s, i));
2362
2351
  }
2363
2352
  /**
2364
2353
  * Create blob urls for all the assets
@@ -2411,7 +2400,10 @@ class xe {
2411
2400
  const o = this.settings.resolver(r);
2412
2401
  return new z(i).relative(o);
2413
2402
  });
2414
- return s ? s.then((r) => (r = kt(r, n, this.replacementUrls), this.settings.replacements === "base64" ? e = gt(r, "text/css") : e = st(r, "text/css"), e), (r) => new Promise(function(o) {
2403
+ return s ? s.then((r) => {
2404
+ const o = Lt(r, n, this.replacementUrls);
2405
+ return this.settings.replacements === "base64" ? e = mt(o, "text/css") : e = it(o, "text/css"), e;
2406
+ }, (r) => new Promise(function(o) {
2415
2407
  o();
2416
2408
  })) : new Promise(function(r) {
2417
2409
  r();
@@ -2450,7 +2442,7 @@ class xe {
2450
2442
  */
2451
2443
  substitute(t, e) {
2452
2444
  let i;
2453
- return e ? i = this.relativeTo(e) : i = this.urls, kt(t, i, this.replacementUrls);
2445
+ return e ? i = this.relativeTo(e) : i = this.urls, Lt(t, i, this.replacementUrls);
2454
2446
  }
2455
2447
  destroy() {
2456
2448
  this.settings = void 0, this.manifest = void 0, this.resources = void 0, this.replacementUrls = void 0, this.html = void 0, this.assets = void 0, this.css = void 0, this.urls = void 0, this.cssUrls = void 0;
@@ -2475,7 +2467,7 @@ class ut {
2475
2467
  * @return {PageList.item[]} list
2476
2468
  */
2477
2469
  parseNav(t) {
2478
- const e = rt(t, "nav", "page-list"), i = e ? Array.from(M(e, "li")) : [], s = i.length;
2470
+ const e = nt(t, "nav", "page-list"), i = e ? Array.from(M(e, "li")) : [], s = i.length;
2479
2471
  let n;
2480
2472
  const r = [];
2481
2473
  let o;
@@ -2541,7 +2533,7 @@ class ut {
2541
2533
  let e = -1;
2542
2534
  if (this.locations.length === 0)
2543
2535
  return -1;
2544
- let i = tt(t, this.locations, this.epubcfi.compare);
2536
+ let i = Q(t, this.locations, this.epubcfi.compare);
2545
2537
  return i != -1 ? e = this.pages[i] : (i = H(t, this.locations, this.epubcfi.compare), e = i - 1 >= 0 ? this.pages[i - 1] : this.pages[0], e !== void 0 || (e = -1)), e;
2546
2538
  }
2547
2539
  /**
@@ -2588,7 +2580,7 @@ class ut {
2588
2580
  this.pages = void 0, this.locations = void 0, this.epubcfi = void 0, this.pageList = void 0, this.toc = void 0, this.ncx = void 0;
2589
2581
  }
2590
2582
  }
2591
- class Xt {
2583
+ class Gt {
2592
2584
  constructor(t) {
2593
2585
  this.settings = t, this.name = t.layout || "reflowable", this._spread = t.spread !== "none", this._minSpreadWidth = t.minSpreadWidth || 800, this._evenSpreads = t.evenSpreads || !1, t.flow === "scrolled" || t.flow === "scrolled-continuous" || t.flow === "scrolled-doc" ? this._flow = "scrolled" : this._flow = "paginated", this.width = 0, this.height = 0, this.spreadWidth = 0, this.delta = 0, this.columnWidth = 0, this.gap = 0, this.divisor = 1, this.props = {
2594
2586
  name: this.name,
@@ -2681,8 +2673,8 @@ class Xt {
2681
2673
  }
2682
2674
  }
2683
2675
  }
2684
- P(Xt.prototype);
2685
- class Ee {
2676
+ P(Gt.prototype);
2677
+ class Se {
2686
2678
  constructor(t) {
2687
2679
  this.rendition = t, this._themes = {
2688
2680
  default: {
@@ -2749,7 +2741,7 @@ class Ee {
2749
2741
  * @param {string} input
2750
2742
  */
2751
2743
  registerUrl(t, e) {
2752
- const i = new N(e);
2744
+ const i = new R(e);
2753
2745
  this._themes[t] = { url: i.toString() }, (this._injected[t] || t == "default") && this.update(t);
2754
2746
  }
2755
2747
  /**
@@ -2847,7 +2839,7 @@ class Ee {
2847
2839
  this.rendition = void 0, this._themes = void 0, this._overrides = void 0, this._current = void 0, this._injected = void 0;
2848
2840
  }
2849
2841
  }
2850
- class Se {
2842
+ class _e {
2851
2843
  constructor(t) {
2852
2844
  this.rendition = t, this.highlights = [], this.underlines = [], this.marks = [], this._annotations = {}, this._annotationsBySectionIndex = {}, this.rendition.hooks.render.register((e) => this.inject(e)), this.rendition.hooks.unloaded.register((e) => this.clear(e));
2853
2845
  }
@@ -3015,8 +3007,7 @@ class Yt {
3015
3007
  */
3016
3008
  detach(t) {
3017
3009
  const { cfiRange: e, type: i } = this;
3018
- let s;
3019
- return t && (i === "highlight" ? s = t.unhighlight(e) : i === "underline" ? s = t.ununderline(e) : i === "mark" && (s = t.unmark(e))), this.mark = void 0, this.emit(f.ANNOTATION.DETACH, s), s;
3010
+ t && (i === "highlight" ? t.unhighlight(e) : i === "underline" ? t.ununderline(e) : i === "mark" && t.unmark(e)), this.mark = void 0, this.emit(f.ANNOTATION.DETACH, void 0);
3020
3011
  }
3021
3012
  /**
3022
3013
  * [Not Implemented] Get text of an annotation
@@ -3026,7 +3017,7 @@ class Yt {
3026
3017
  }
3027
3018
  }
3028
3019
  P(Yt.prototype);
3029
- class wt {
3020
+ class bt {
3030
3021
  constructor(t, e, i, s = !1) {
3031
3022
  this.layout = t, this.horizontal = i === "horizontal", this.direction = e || "ltr", this._dev = s;
3032
3023
  }
@@ -3100,7 +3091,7 @@ class wt {
3100
3091
  for (; s.length; )
3101
3092
  if (n = s.shift(), r = this.walk(n, (h) => {
3102
3093
  let a, c, d, u;
3103
- const p = pt(h);
3094
+ const p = gt(h);
3104
3095
  if (this.horizontal && this.direction === "ltr") {
3105
3096
  if (a = this.horizontal ? p.left : p.top, c = this.horizontal ? p.right : p.bottom, a >= e && a <= i)
3106
3097
  return h;
@@ -3138,7 +3129,7 @@ class wt {
3138
3129
  for (; s.length; )
3139
3130
  if (n = s.shift(), o = this.walk(n, (h) => {
3140
3131
  let a, c, d, u;
3141
- const p = pt(h);
3132
+ const p = gt(h);
3142
3133
  if (this.horizontal && this.direction === "ltr") {
3143
3134
  if (a = Math.round(p.left), c = Math.round(p.right), a > i && r)
3144
3135
  return r;
@@ -3266,19 +3257,19 @@ class wt {
3266
3257
  return t && (this.horizontal = t === "horizontal"), this.horizontal;
3267
3258
  }
3268
3259
  }
3269
- const Gt = typeof navigator < "u", _e = Gt && /Chrome/.test(navigator.userAgent), Rt = Gt && !_e && /AppleWebKit/.test(navigator.userAgent), Ce = 1;
3270
- class _t {
3260
+ const $t = typeof navigator < "u", Ce = $t && /Chrome/.test(navigator.userAgent), Rt = $t && !Ce && /AppleWebKit/.test(navigator.userAgent), Te = 1;
3261
+ class Ct {
3271
3262
  constructor(t, e, i, s) {
3272
3263
  this.epubcfi = new v(), this.document = t, this.documentElement = this.document.documentElement, this.content = e || this.document.body, this.window = this.document.defaultView, this._size = {
3273
3264
  width: 0,
3274
3265
  height: 0
3275
- }, this.sectionIndex = s || 0, this.cfiBase = i || "", this._mediaQueryHandlers = [], this.epubReadingSystem("epub.js", lt), this.called = 0, this.active = !0, this.listeners();
3266
+ }, this.sectionIndex = s || 0, this.cfiBase = i || "", this._mediaQueryHandlers = [], this.epubReadingSystem("epub.js", ht), this.called = 0, this.active = !0, this.listeners();
3276
3267
  }
3277
3268
  /**
3278
3269
  * Get DOM events that are listened for and passed along
3279
3270
  */
3280
3271
  static get listenedEvents() {
3281
- return Q;
3272
+ return J;
3282
3273
  }
3283
3274
  /**
3284
3275
  * Get or Set width
@@ -3322,7 +3313,7 @@ class _t {
3322
3313
  */
3323
3314
  textWidth() {
3324
3315
  let t;
3325
- const e = this.document.createRange(), i = this.content || this.document.body, s = et(i);
3316
+ const e = this.document.createRange(), i = this.content || this.document.body, s = tt(i);
3326
3317
  return e.selectNodeContents(i), t = e.getBoundingClientRect().width, s && s.width && (t += s.width), Math.round(t);
3327
3318
  }
3328
3319
  /**
@@ -3378,7 +3369,7 @@ class _t {
3378
3369
  */
3379
3370
  css(t, e, i) {
3380
3371
  const s = this.content || this.document.body;
3381
- return e ? s.style.setProperty(t, e, i ? "important" : "") : s.style.removeProperty(t), this.window.getComputedStyle(s).getPropertyValue(t);
3372
+ return e ? s.style.setProperty(t, e, i ? "important" : "") : s.style.removeProperty(t), this.window.getComputedStyle(s)[t] ?? "";
3382
3373
  }
3383
3374
  /**
3384
3375
  * Get or Set the viewport element
@@ -3405,7 +3396,7 @@ class _t {
3405
3396
  const r = e.getAttribute("content") ?? "", o = r.match(/width\s*=\s*([^,]*)/), h = r.match(/height\s*=\s*([^,]*)/), a = r.match(/initial-scale\s*=\s*([^,]*)/), c = r.match(/minimum-scale\s*=\s*([^,]*)/), d = r.match(/maximum-scale\s*=\s*([^,]*)/), u = r.match(/user-scalable\s*=\s*([^,]*)/);
3406
3397
  o && o.length && typeof o[1] < "u" && (i.width = o[1]), h && h.length && typeof h[1] < "u" && (i.height = h[1]), a && a.length && typeof a[1] < "u" && (i.scale = a[1]), c && c.length && typeof c[1] < "u" && (i.minimum = c[1]), d && d.length && typeof d[1] < "u" && (i.maximum = d[1]), u && u.length && typeof u[1] < "u" && (i.scalable = u[1]);
3407
3398
  }
3408
- return n = zt(t || {}, i), t && (n.width && s.push("width=" + n.width), n.height && s.push("height=" + n.height), n.scale && s.push("initial-scale=" + n.scale), n.scalable === "no" ? (s.push("minimum-scale=" + n.scale), s.push("maximum-scale=" + n.scale), s.push("user-scalable=" + n.scalable)) : (n.scalable && s.push("user-scalable=" + n.scalable), n.minimum && s.push("minimum-scale=" + n.minimum), n.maximum && s.push("minimum-scale=" + n.maximum)), e || (e = this.document.createElement("meta"), e.setAttribute("name", "viewport"), this.document.querySelector("head").appendChild(e)), e.setAttribute("content", s.join(", ")), this.window.scrollTo(0, 0)), n;
3399
+ return n = Dt(t ?? {}, i), t && (n.width && s.push("width=" + n.width), n.height && s.push("height=" + n.height), n.scale && s.push("initial-scale=" + n.scale), n.scalable === "no" ? (s.push("minimum-scale=" + n.scale), s.push("maximum-scale=" + n.scale), s.push("user-scalable=" + n.scalable)) : (n.scalable && s.push("user-scalable=" + n.scalable), n.minimum && s.push("minimum-scale=" + n.minimum), n.maximum && s.push("minimum-scale=" + n.maximum)), e || (e = this.document.createElement("meta"), e.setAttribute("name", "viewport"), this.document.querySelector("head").appendChild(e)), e.setAttribute("content", s.join(", ")), this.window.scrollTo(0, 0)), n;
3409
3400
  }
3410
3401
  /**
3411
3402
  * Event emitter for when the contents has expanded
@@ -3566,7 +3557,7 @@ class _t {
3566
3557
  else if (Rt) {
3567
3558
  const r = n.startContainer, o = new Range();
3568
3559
  try {
3569
- r.nodeType === Ce ? i = r.getBoundingClientRect() : n.startOffset + 2 < r.length ? (o.setStart(r, n.startOffset), o.setEnd(r, n.startOffset + 2), i = o.getBoundingClientRect()) : n.startOffset - 2 > 0 ? (o.setStart(r, n.startOffset - 2), o.setEnd(r, n.startOffset), i = o.getBoundingClientRect()) : i = r.parentNode.getBoundingClientRect();
3560
+ r.nodeType === Te ? i = r.getBoundingClientRect() : n.startOffset + 2 < r.length ? (o.setStart(r, n.startOffset), o.setEnd(r, n.startOffset + 2), i = o.getBoundingClientRect()) : n.startOffset - 2 > 0 ? (o.setStart(r, n.startOffset - 2), o.setEnd(r, n.startOffset), i = o.getBoundingClientRect()) : i = r.parentNode.getBoundingClientRect();
3570
3561
  } catch (h) {
3571
3562
  console.error(h, h instanceof Error ? h.stack : void 0);
3572
3563
  }
@@ -3700,7 +3691,7 @@ class _t {
3700
3691
  * @private
3701
3692
  */
3702
3693
  addEventListeners() {
3703
- this.document && (this._triggerEvent = this.triggerEvent.bind(this), Q.forEach((t) => {
3694
+ this.document && (this._triggerEvent = this.triggerEvent.bind(this), J.forEach((t) => {
3704
3695
  this.document.addEventListener(t, this._triggerEvent, { passive: !0 });
3705
3696
  }));
3706
3697
  }
@@ -3709,7 +3700,7 @@ class _t {
3709
3700
  * @private
3710
3701
  */
3711
3702
  removeEventListeners() {
3712
- this.document && (Q.forEach((t) => {
3703
+ this.document && (J.forEach((t) => {
3713
3704
  this.document.removeEventListener(t, this._triggerEvent);
3714
3705
  }), this._triggerEvent = void 0);
3715
3706
  }
@@ -3830,14 +3821,14 @@ class _t {
3830
3821
  this.documentElement && (this.documentElement.style.direction = t);
3831
3822
  }
3832
3823
  mapPage(t, e, i, s, n) {
3833
- return new wt(e, void 0, void 0, n).page(this, t, i, s);
3824
+ return new bt(e, void 0, void 0, n).page(this, t, i, s);
3834
3825
  }
3835
3826
  /**
3836
3827
  * Emit event when link in content is clicked
3837
3828
  * @private
3838
3829
  */
3839
3830
  linksHandler() {
3840
- pe(this.content, (t) => {
3831
+ ge(this.content, (t) => {
3841
3832
  this.emit(f.CONTENTS.LINK_CLICKED, t);
3842
3833
  });
3843
3834
  }
@@ -3864,7 +3855,7 @@ class _t {
3864
3855
  * @private
3865
3856
  */
3866
3857
  epubReadingSystem(t, e) {
3867
- return navigator.epubReadingSystem = {
3858
+ navigator.epubReadingSystem = {
3868
3859
  name: t,
3869
3860
  version: e,
3870
3861
  layoutStyle: this.layoutStyle(),
@@ -3886,23 +3877,23 @@ class _t {
3886
3877
  return !1;
3887
3878
  }
3888
3879
  }
3889
- }, navigator.epubReadingSystem;
3880
+ };
3890
3881
  }
3891
3882
  destroy() {
3892
3883
  this.removeListeners(), this.__listeners = {};
3893
3884
  }
3894
3885
  }
3895
- P(_t.prototype);
3896
- function Z(l) {
3886
+ P(Ct.prototype);
3887
+ function K(l) {
3897
3888
  return document.createElementNS("http://www.w3.org/2000/svg", l);
3898
3889
  }
3899
- function Te(l, t) {
3890
+ function ke(l, t) {
3900
3891
  function e(s) {
3901
3892
  for (let n = t.length - 1; n >= 0; n--) {
3902
3893
  const r = t[n];
3903
3894
  let o, h;
3904
- if ("touches" in s && s.touches.length ? (o = s.touches[0].clientX, h = s.touches[0].clientY) : (o = s.clientX, h = s.clientY), !!Le(r, l, o, h)) {
3905
- r.dispatchEvent(ke(s));
3895
+ if ("touches" in s && s.touches.length ? (o = s.touches[0].clientX, h = s.touches[0].clientY) : (o = s.clientX, h = s.clientY), !!Ne(r, l, o, h)) {
3896
+ r.dispatchEvent(Le(s));
3906
3897
  break;
3907
3898
  }
3908
3899
  }
@@ -3919,7 +3910,7 @@ function Te(l, t) {
3919
3910
  for (const s of ["mouseup", "mousedown", "click", "touchstart"])
3920
3911
  i.addEventListener(s, (n) => e(n), !1);
3921
3912
  }
3922
- function ke(l) {
3913
+ function Le(l) {
3923
3914
  const t = Object.assign({}, l, { bubbles: !1 });
3924
3915
  try {
3925
3916
  return new MouseEvent(l.type, t);
@@ -3944,7 +3935,7 @@ function ke(l) {
3944
3935
  ), s;
3945
3936
  }
3946
3937
  }
3947
- function Le(l, t, e, i) {
3938
+ function Ne(l, t, e, i) {
3948
3939
  const s = t.getBoundingClientRect();
3949
3940
  function n(h, a, c) {
3950
3941
  const d = h.top - s.top, u = h.left - s.left, p = d + h.height, g = u + h.width;
@@ -3968,18 +3959,18 @@ function Re(l, t) {
3968
3959
  width: l.scrollWidth
3969
3960
  };
3970
3961
  }
3971
- function Ne(l, t) {
3962
+ function Ae(l, t) {
3972
3963
  l.style.setProperty("top", `${t.top}px`, "important"), l.style.setProperty("left", `${t.left}px`, "important"), l.style.setProperty("height", `${t.height}px`, "important"), l.style.setProperty("width", `${t.width}px`, "important");
3973
3964
  }
3974
- function Ae(l, t) {
3965
+ function Ie(l, t) {
3975
3966
  return t.right <= l.right && t.left >= l.left && t.top >= l.top && t.bottom <= l.bottom;
3976
3967
  }
3977
- class Nt {
3968
+ class At {
3978
3969
  constructor(t, e = document.body) {
3979
- this.target = t, this.element = Z("svg"), this.marks = [], this.element.style.position = "absolute", this.element.setAttribute("pointer-events", "none"), Te(this.target, this.marks), this.container = e, this.container.appendChild(this.element), this.render();
3970
+ this.target = t, this.element = K("svg"), this.marks = [], this.element.style.position = "absolute", this.element.setAttribute("pointer-events", "none"), ke(this.target, this.marks), this.container = e, this.container.appendChild(this.element), this.render();
3980
3971
  }
3981
3972
  addMark(t) {
3982
- const e = Z("g");
3973
+ const e = K("g");
3983
3974
  return this.element.appendChild(e), t.bind(e, this.container), this.marks.push(t), t.render(), t;
3984
3975
  }
3985
3976
  removeMark(t) {
@@ -3990,12 +3981,12 @@ class Nt {
3990
3981
  this.element.removeChild(i), this.marks.splice(e, 1);
3991
3982
  }
3992
3983
  render() {
3993
- Ne(this.element, Re(this.target, this.container));
3984
+ Ae(this.element, Re(this.target, this.container));
3994
3985
  for (const t of this.marks)
3995
3986
  t.render();
3996
3987
  }
3997
3988
  }
3998
- class Ie {
3989
+ class Oe {
3999
3990
  constructor() {
4000
3991
  this.element = null;
4001
3992
  }
@@ -4027,14 +4018,14 @@ class Ie {
4027
4018
  for (let i = 0; i < t.length; i++) {
4028
4019
  if (t[i] === e)
4029
4020
  return !0;
4030
- if (Ae(t[i], e))
4021
+ if (Ie(t[i], e))
4031
4022
  return !1;
4032
4023
  }
4033
4024
  return !0;
4034
4025
  });
4035
4026
  }
4036
4027
  }
4037
- class $t extends Ie {
4028
+ class Kt extends Oe {
4038
4029
  constructor(t, e, i, s) {
4039
4030
  super(), this.range = t, this.className = e, this.data = i || {}, this.attributes = s || {};
4040
4031
  }
@@ -4051,13 +4042,13 @@ class $t extends Ie {
4051
4042
  this.element.removeChild(this.element.firstChild);
4052
4043
  const t = this.element.ownerDocument.createDocumentFragment(), e = this.filteredRanges(), i = this.element.getBoundingClientRect(), s = this.container.getBoundingClientRect();
4053
4044
  for (let n = 0, r = e.length; n < r; n++) {
4054
- const o = e[n], h = Z("rect");
4045
+ const o = e[n], h = K("rect");
4055
4046
  h.setAttribute("x", String(o.left - i.left + s.left)), h.setAttribute("y", String(o.top - i.top + s.top)), h.setAttribute("height", String(o.height)), h.setAttribute("width", String(o.width)), t.appendChild(h);
4056
4047
  }
4057
4048
  this.element.appendChild(t);
4058
4049
  }
4059
4050
  }
4060
- class Oe extends $t {
4051
+ class Pe extends Kt {
4061
4052
  constructor(t, e, i, s) {
4062
4053
  super(t, e, i, s);
4063
4054
  }
@@ -4066,15 +4057,15 @@ class Oe extends $t {
4066
4057
  this.element.removeChild(this.element.firstChild);
4067
4058
  const t = this.element.ownerDocument.createDocumentFragment(), e = this.filteredRanges(), i = this.element.getBoundingClientRect(), s = this.container.getBoundingClientRect();
4068
4059
  for (let n = 0, r = e.length; n < r; n++) {
4069
- const o = e[n], h = Z("rect");
4060
+ const o = e[n], h = K("rect");
4070
4061
  h.setAttribute("x", String(o.left - i.left + s.left)), h.setAttribute("y", String(o.top - i.top + s.top)), h.setAttribute("height", String(o.height)), h.setAttribute("width", String(o.width)), h.setAttribute("fill", "none");
4071
- const a = Z("line");
4062
+ const a = K("line");
4072
4063
  a.setAttribute("x1", String(o.left - i.left + s.left)), a.setAttribute("x2", String(o.left - i.left + s.left + o.width)), a.setAttribute("y1", String(o.top - i.top + s.top + o.height - 1)), a.setAttribute("y2", String(o.top - i.top + s.top + o.height - 1)), a.setAttribute("stroke-width", "1"), a.setAttribute("stroke", "black"), a.setAttribute("stroke-linecap", "square"), t.appendChild(h), t.appendChild(a);
4073
4064
  }
4074
4065
  this.element.appendChild(t);
4075
4066
  }
4076
4067
  }
4077
- class Kt {
4068
+ class Zt {
4078
4069
  constructor(t, e) {
4079
4070
  this.settings = C({
4080
4071
  ignoreClass: "",
@@ -4089,14 +4080,14 @@ class Kt {
4089
4080
  forceRight: !1,
4090
4081
  allowScriptedContent: !1,
4091
4082
  allowPopups: !1
4092
- }, e || {}), this.id = "epubjs-view-" + ht(), this.section = t, this.index = t.index, this.element = this.container(this.settings.axis), this.added = !1, this.displayed = !1, this.rendered = !1, this.fixedWidth = 0, this.fixedHeight = 0, this.epubcfi = new v(), this.layout = this.settings.layout, this.pane = void 0, this.highlights = {}, this.underlines = {}, this.marks = {};
4083
+ }, e || {}), this.id = "epubjs-view-" + ot(), this.section = t, this.index = t.index, this.element = this.container(this.settings.axis), this.added = !1, this.displayed = !1, this.rendered = !1, this.fixedWidth = 0, this.fixedHeight = 0, this.epubcfi = new v(), this.layout = this.settings.layout, this.pane = void 0, this.highlights = {}, this.underlines = {}, this.marks = {};
4093
4084
  }
4094
4085
  container(t) {
4095
4086
  const e = document.createElement("div");
4096
4087
  return e.classList.add("epub-view"), e.style.height = "0px", e.style.width = "0px", e.style.overflow = "hidden", e.style.position = "relative", e.style.display = "block", t && t == "horizontal" ? e.style.flex = "none" : e.style.flex = "initial", e;
4097
4088
  }
4098
4089
  create() {
4099
- return this.iframe ? this.iframe : (this.element || (this.element = this.container()), this.iframe = document.createElement("iframe"), this.iframe.id = this.id, this.iframe.scrolling = "no", this.iframe.style.overflow = "hidden", this.iframe.seamless = "seamless", this.iframe.style.border = "none", this.iframe.sandbox = "allow-same-origin", this.settings.allowScriptedContent && (this.iframe.sandbox += " allow-scripts"), this.settings.allowPopups && (this.iframe.sandbox += " allow-popups"), this.iframe.setAttribute("enable-annotation", "true"), this.resizing = !0, this.element.style.visibility = "hidden", this.iframe.style.visibility = "hidden", this.iframe.style.width = "0", this.iframe.style.height = "0", this._width = 0, this._height = 0, this.element.setAttribute("ref", String(this.index)), this.added = !0, this.elementBounds = J(this.element), "srcdoc" in this.iframe ? this.supportsSrcdoc = !0 : this.supportsSrcdoc = !1, this.settings.method || (this.settings.method = this.supportsSrcdoc ? "srcdoc" : "write"), this.iframe);
4090
+ return this.iframe ? this.iframe : (this.element || (this.element = this.container()), this.iframe = document.createElement("iframe"), this.iframe.id = this.id, this.iframe.scrolling = "no", this.iframe.style.overflow = "hidden", this.iframe.setAttribute("seamless", "seamless"), this.iframe.style.border = "none", this.iframe.sandbox = "allow-same-origin", this.settings.allowScriptedContent && (this.iframe.sandbox += " allow-scripts"), this.settings.allowPopups && (this.iframe.sandbox += " allow-popups"), this.iframe.setAttribute("enable-annotation", "true"), this.resizing = !0, this.element.style.visibility = "hidden", this.iframe.style.visibility = "hidden", this.iframe.style.width = "0", this.iframe.style.height = "0", this._width = 0, this._height = 0, this.element.setAttribute("ref", String(this.index)), this.added = !0, this.elementBounds = Z(this.element), "srcdoc" in this.iframe ? this.supportsSrcdoc = !0 : this.supportsSrcdoc = !1, this.settings.method || (this.settings.method = this.supportsSrcdoc ? "srcdoc" : "write"), this.iframe);
4100
4091
  }
4101
4092
  render(t, e) {
4102
4093
  return this.create(), this.size(), this.sectionRender || (this.sectionRender = this.section.render(t)), this.sectionRender.then((i) => this.load(i)).then(() => {
@@ -4121,9 +4112,9 @@ class Kt {
4121
4112
  }
4122
4113
  // Lock an axis to element dimensions, taking borders into account
4123
4114
  lock(t, e, i) {
4124
- const s = et(this.element);
4115
+ const s = tt(this.element);
4125
4116
  let n;
4126
- this.iframe ? n = et(this.iframe) : n = { width: 0, height: 0 }, t == "width" && E(e) && (this.lockedWidth = e - s.width - n.width), t == "height" && E(i) && (this.lockedHeight = i - s.height - n.height), t === "both" && E(e) && E(i) && (this.lockedWidth = e - s.width - n.width, this.lockedHeight = i - s.height - n.height), this.displayed && this.iframe && this.expand();
4117
+ this.iframe ? n = tt(this.iframe) : n = { width: 0, height: 0 }, t == "width" && E(e) && (this.lockedWidth = e - s.width - n.width), t == "height" && E(i) && (this.lockedHeight = i - s.height - n.height), t === "both" && E(e) && E(i) && (this.lockedWidth = e - s.width - n.width, this.lockedHeight = i - s.height - n.height), this.displayed && this.iframe && this.expand();
4127
4118
  }
4128
4119
  // Resize a single axis based on content dimensions
4129
4120
  expand(t) {
@@ -4142,7 +4133,7 @@ class Kt {
4142
4133
  let r;
4143
4134
  for (const o in this.marks)
4144
4135
  this.marks.hasOwnProperty(o) && (r = this.marks[o], this.placeMark(r.element, r.range));
4145
- }), this.onResize(this, n), this.emit(f.VIEWS.RESIZED, n), this.prevBounds = n, this.elementBounds = J(this.element);
4136
+ }), this.onResize(this, n), this.emit(f.VIEWS.RESIZED, n), this.prevBounds = n, this.elementBounds = Z(this.element);
4146
4137
  }
4147
4138
  load(t) {
4148
4139
  const e = new y(), i = e.promise;
@@ -4151,7 +4142,7 @@ class Kt {
4151
4142
  if (this.iframe.onload = (s) => {
4152
4143
  this.onLoad(s, e);
4153
4144
  }, this.settings.method === "blobUrl")
4154
- this.blobUrl = st(t, "application/xhtml+xml"), this.iframe.src = this.blobUrl, this.element.appendChild(this.iframe);
4145
+ this.blobUrl = it(t, "application/xhtml+xml"), this.iframe.src = this.blobUrl, this.element.appendChild(this.iframe);
4155
4146
  else if (this.settings.method === "srcdoc")
4156
4147
  this.iframe.srcdoc = t, this.element.appendChild(this.iframe);
4157
4148
  else {
@@ -4162,7 +4153,7 @@ class Kt {
4162
4153
  return i;
4163
4154
  }
4164
4155
  onLoad(t, e) {
4165
- this.window = this.iframe.contentWindow, this.document = this.iframe.contentDocument, this.contents = new _t(this.document, this.document.body, this.section.cfiBase, this.section.index), this.rendering = !1;
4156
+ this.window = this.iframe.contentWindow, this.document = this.iframe.contentDocument, this.contents = new Ct(this.document, this.document.body, this.section.cfiBase, this.section.index), this.rendering = !1;
4166
4157
  let i = this.document.querySelector("link[rel='canonical']");
4167
4158
  i ? i.setAttribute("href", this.section.canonical) : (i = this.document.createElement("link"), i.setAttribute("rel", "canonical"), i.setAttribute("href", this.section.canonical), this.document.querySelector("head").appendChild(i)), this.contents.on(f.CONTENTS.EXPAND, () => {
4168
4159
  this.displayed && this.iframe && (this.expand(), this.contents && this.layout.format(this.contents));
@@ -4181,7 +4172,7 @@ class Kt {
4181
4172
  }
4182
4173
  addListeners() {
4183
4174
  }
4184
- removeListeners(t) {
4175
+ removeListeners() {
4185
4176
  this.contents && (this.contents.off(f.CONTENTS.EXPAND), this.contents.off(f.CONTENTS.RESIZE));
4186
4177
  }
4187
4178
  display(t) {
@@ -4226,16 +4217,16 @@ class Kt {
4226
4217
  onResize(t, e) {
4227
4218
  }
4228
4219
  bounds(t) {
4229
- return (t || !this.elementBounds) && (this.elementBounds = J(this.element)), this.elementBounds;
4220
+ return (t || !this.elementBounds) && (this.elementBounds = Z(this.element)), this.elementBounds;
4230
4221
  }
4231
4222
  highlight(t, e = {}, i, s = "epubjs-hl", n = {}) {
4232
4223
  if (!this.contents)
4233
4224
  return;
4234
- const r = Object.assign({ fill: "yellow", "fill-opacity": "0.3", "mix-blend-mode": "multiply" }, n), o = this.contents.range(t), h = () => {
4225
+ const r = Object.assign({ fill: "yellow", "fill-opacity": "0.3", "mix-blend-mode": "multiply" }, n), o = this.contents.range(t), h = (d) => {
4235
4226
  this.emit(f.VIEWS.MARK_CLICKED, t, e);
4236
4227
  };
4237
- e.epubcfi = t, this.pane || (this.pane = new Nt(this.iframe, this.element));
4238
- const a = new $t(o, s, e, r);
4228
+ e.epubcfi = t, this.pane || (this.pane = new At(this.iframe, this.element));
4229
+ const a = new Kt(o, s, e, r);
4239
4230
  let c;
4240
4231
  try {
4241
4232
  c = this.pane.addMark(a);
@@ -4248,11 +4239,11 @@ class Kt {
4248
4239
  underline(t, e = {}, i, s = "epubjs-ul", n = {}) {
4249
4240
  if (!this.contents)
4250
4241
  return;
4251
- const r = Object.assign({ stroke: "black", "stroke-opacity": "0.3", "mix-blend-mode": "multiply" }, n), o = this.contents.range(t), h = () => {
4242
+ const r = Object.assign({ stroke: "black", "stroke-opacity": "0.3", "mix-blend-mode": "multiply" }, n), o = this.contents.range(t), h = (d) => {
4252
4243
  this.emit(f.VIEWS.MARK_CLICKED, t, e);
4253
4244
  };
4254
- e.epubcfi = t, this.pane || (this.pane = new Nt(this.iframe, this.element));
4255
- const a = new Oe(o, s, e, r);
4245
+ e.epubcfi = t, this.pane || (this.pane = new At(this.iframe, this.element));
4246
+ const a = new Pe(o, s, e, r);
4256
4247
  let c;
4257
4248
  try {
4258
4249
  c = this.pane.addMark(a);
@@ -4323,16 +4314,16 @@ class Kt {
4323
4314
  this.ununderline(t);
4324
4315
  for (const t in this.marks)
4325
4316
  this.unmark(t);
4326
- this.blobUrl && Mt(this.blobUrl), this.displayed && (this.displayed = !1, this.removeListeners(), this.contents.destroy(), this.stopExpanding = !0, this.iframe && (this.iframe.onload = null), this.element.removeChild(this.iframe), this.pane && (this.pane.element.remove(), this.pane = void 0), this.iframe = void 0, this.contents = void 0, this._textWidth = void 0, this._textHeight = void 0, this._width = void 0, this._height = void 0), this.__listeners = {};
4317
+ this.blobUrl && qt(this.blobUrl), this.displayed && (this.displayed = !1, this.removeListeners(), this.contents.destroy(), this.stopExpanding = !0, this.iframe && (this.iframe.onload = null), this.element.removeChild(this.iframe), this.pane && (this.pane.element.remove(), this.pane = void 0), this.iframe = void 0, this.contents = void 0, this._textWidth = void 0, this._textHeight = void 0, this._width = void 0, this._height = void 0), this.__listeners = {};
4327
4318
  }
4328
4319
  }
4329
- P(Kt.prototype);
4330
- function Pe() {
4320
+ P(Zt.prototype);
4321
+ function ze() {
4331
4322
  let l = "reverse";
4332
- const t = ze();
4323
+ const t = De();
4333
4324
  return document.body.appendChild(t), t.scrollLeft > 0 ? l = "default" : typeof Element < "u" && typeof Element.prototype.scrollIntoView == "function" ? (t.children[0].children[1].scrollIntoView(), t.scrollLeft < 0 && (l = "negative")) : (t.scrollLeft = 1, t.scrollLeft === 0 && (l = "negative")), document.body.removeChild(t), l;
4334
4325
  }
4335
- function ze() {
4326
+ function De() {
4336
4327
  const l = document.createElement("div");
4337
4328
  l.dir = "rtl", l.style.position = "fixed", l.style.width = "1px", l.style.height = "1px", l.style.top = "0px", l.style.left = "0px", l.style.overflow = "hidden";
4338
4329
  const t = document.createElement("div");
@@ -4342,7 +4333,7 @@ function ze() {
4342
4333
  const i = document.createElement("span");
4343
4334
  return i.style.width = "1px", i.style.display = "inline-block", t.appendChild(e), t.appendChild(i), l.appendChild(t), l;
4344
4335
  }
4345
- function De(l, t) {
4336
+ function Be(l, t) {
4346
4337
  let e = null, i = 0;
4347
4338
  return function(...s) {
4348
4339
  const n = Date.now(), r = t - (n - i);
@@ -4351,9 +4342,9 @@ function De(l, t) {
4351
4342
  }, r));
4352
4343
  };
4353
4344
  }
4354
- class Be {
4345
+ class Me {
4355
4346
  constructor(t) {
4356
- this.settings = t || {}, this.id = "epubjs-container-" + ht(), this.container = this.create(this.settings), this.settings.hidden && (this.wrapper = this.wrap(this.container));
4347
+ this.settings = t || {}, this.id = "epubjs-container-" + ot(), this.container = this.create(this.settings), this.settings.hidden && (this.wrapper = this.wrap(this.container));
4357
4348
  }
4358
4349
  /*
4359
4350
  * Creates an element to render to.
@@ -4372,7 +4363,7 @@ class Be {
4372
4363
  }
4373
4364
  getElement(t) {
4374
4365
  let e = null;
4375
- if (Ot(t) ? e = t : typeof t == "string" && (e = document.getElementById(t)), !e)
4366
+ if (Pt(t) ? e = t : typeof t == "string" && (e = document.getElementById(t)), !e)
4376
4367
  throw new Error("Not an Element");
4377
4368
  return e;
4378
4369
  }
@@ -4386,7 +4377,7 @@ class Be {
4386
4377
  return this.container;
4387
4378
  }
4388
4379
  onResize(t) {
4389
- (!E(this.settings.width) || !E(this.settings.height)) && (this.resizeFunc = De(t, 50), window.addEventListener("resize", this.resizeFunc, !1));
4380
+ (!E(this.settings.width) || !E(this.settings.height)) && (this.resizeFunc = Be(t, 50), window.addEventListener("resize", this.resizeFunc, !1));
4390
4381
  }
4391
4382
  onOrientationChange(t) {
4392
4383
  this.orientationChangeFunc = t, window.addEventListener("orientationchange", this.orientationChangeFunc, !1);
@@ -4400,7 +4391,7 @@ class Be {
4400
4391
  top: parseFloat(this.containerStyles.paddingTop) || 0,
4401
4392
  bottom: parseFloat(this.containerStyles.paddingBottom) || 0
4402
4393
  };
4403
- const r = it(), o = window.getComputedStyle(document.body), h = {
4394
+ const r = et(), o = window.getComputedStyle(document.body), h = {
4404
4395
  left: parseFloat(o.paddingLeft) || 0,
4405
4396
  right: parseFloat(o.paddingRight) || 0,
4406
4397
  top: parseFloat(o.paddingTop) || 0,
@@ -4413,7 +4404,7 @@ class Be {
4413
4404
  }
4414
4405
  bounds() {
4415
4406
  let t;
4416
- return this.container.style.overflow !== "visible" && (t = this.container && this.container.getBoundingClientRect()), !t || !t.width || !t.height ? it() : t;
4407
+ return this.container.style.overflow !== "visible" && (t = this.container && this.container.getBoundingClientRect()), !t || !t.width || !t.height ? et() : t;
4417
4408
  }
4418
4409
  getSheet() {
4419
4410
  const t = document.createElement("style");
@@ -4449,7 +4440,7 @@ class Be {
4449
4440
  this.element && (this.settings.hidden ? this.wrapper : this.container, this.element.contains(this.container) && this.element.removeChild(this.container), window.removeEventListener("resize", this.resizeFunc), window.removeEventListener("orientationchange", this.orientationChangeFunc));
4450
4441
  }
4451
4442
  }
4452
- class Me {
4443
+ class qe {
4453
4444
  constructor(t) {
4454
4445
  this.container = t, this._views = [], this.length = 0, this.hidden = !1;
4455
4446
  }
@@ -4530,9 +4521,9 @@ class Me {
4530
4521
  this.hidden = !0;
4531
4522
  }
4532
4523
  }
4533
- class ot {
4524
+ class rt {
4534
4525
  constructor(t) {
4535
- this.name = "default", this.optsSettings = t.settings, this.View = t.view, this.request = t.request, this.renditionQueue = t.queue, this.q = new St(this), this.settings = C({}, {
4526
+ this.name = "default", this.optsSettings = t.settings, this.View = t.view, this.request = t.request, this.renditionQueue = t.queue, this.q = new _t(this), this.settings = C({}, {
4536
4527
  infinite: !0,
4537
4528
  hidden: !1,
4538
4529
  width: void 0,
@@ -4560,7 +4551,7 @@ class ot {
4560
4551
  }
4561
4552
  render(t, e) {
4562
4553
  const i = t.tagName;
4563
- typeof this.settings.fullsize > "u" && i && (i.toLowerCase() == "body" || i.toLowerCase() == "html") && (this.settings.fullsize = !0), this.settings.fullsize && (this.settings.overflow = "visible", this.overflow = this.settings.overflow), this.settings.size = e, this.settings.rtlScrollType = Pe(), this.stage = new Be({
4554
+ typeof this.settings.fullsize > "u" && i && (i.toLowerCase() == "body" || i.toLowerCase() == "html") && (this.settings.fullsize = !0), this.settings.fullsize && (this.settings.overflow = "visible", this.overflow = this.settings.overflow), this.settings.size = e, this.settings.rtlScrollType = ze(), this.stage = new Me({
4564
4555
  width: e.width,
4565
4556
  height: e.height,
4566
4557
  overflow: this.overflow,
@@ -4568,7 +4559,7 @@ class ot {
4568
4559
  axis: this.settings.axis,
4569
4560
  fullsize: this.settings.fullsize,
4570
4561
  direction: this.settings.direction
4571
- }), this.stage.attachTo(t), this.container = this.stage.getContainer(), this.views = new Me(this.container), this._bounds = this.bounds(), this._stageSize = this.stage.size(), this.viewSettings.width = this._stageSize.width, this.viewSettings.height = this._stageSize.height, this.stage.onResize(() => this.onResized()), this.stage.onOrientationChange((s) => this.onOrientationChange(s)), this.addEventListeners(), this.layout && this.updateLayout(), this.rendered = !0;
4562
+ }), this.stage.attachTo(t), this.container = this.stage.getContainer(), this.views = new qe(this.container), this._bounds = this.bounds(), this._stageSize = this.stage.size(), this.viewSettings.width = this._stageSize.width, this.viewSettings.height = this._stageSize.height, this.stage.onResize(() => this.onResized()), this.stage.onOrientationChange((s) => this.onOrientationChange(s)), this.addEventListeners(), this.layout && this.updateLayout(), this.rendered = !0;
4572
4563
  }
4573
4564
  addEventListeners() {
4574
4565
  let t;
@@ -4584,9 +4575,11 @@ class ot {
4584
4575
  clearTimeout(this.orientationTimeout), clearTimeout(this.resizeTimeout), clearTimeout(this.afterScrolled), this.clear(), this.removeEventListeners(), this.stage.destroy(), this.rendered = !1, this.__listeners = {};
4585
4576
  }
4586
4577
  onOrientationChange(t) {
4578
+ var i;
4587
4579
  const { orientation: e } = window;
4588
- this.optsSettings.resizeOnOrientationChange && this.resize(), clearTimeout(this.orientationTimeout), this.orientationTimeout = setTimeout(() => {
4589
- this.orientationTimeout = void 0, this.optsSettings.resizeOnOrientationChange && this.resize(), this.emit(f.MANAGERS.ORIENTATION_CHANGE, e);
4580
+ (i = this.optsSettings) != null && i.resizeOnOrientationChange && this.resize(), clearTimeout(this.orientationTimeout), this.orientationTimeout = setTimeout(() => {
4581
+ var s;
4582
+ this.orientationTimeout = void 0, (s = this.optsSettings) != null && s.resizeOnOrientationChange && this.resize(), this.emit(f.MANAGERS.ORIENTATION_CHANGE, e);
4590
4583
  }, 500);
4591
4584
  }
4592
4585
  onResized(t) {
@@ -4594,7 +4587,7 @@ class ot {
4594
4587
  }
4595
4588
  resize(t, e, i) {
4596
4589
  const s = this.stage.size(t, e);
4597
- if (this.winBounds = it(), this.orientationTimeout && this.winBounds.width === this.winBounds.height) {
4590
+ if (this.winBounds = et(), this.orientationTimeout && this.winBounds.width === this.winBounds.height) {
4598
4591
  this._stageSize = void 0;
4599
4592
  return;
4600
4593
  }
@@ -4839,7 +4832,7 @@ class ot {
4839
4832
  ), this.settings.offset = this.layout.delta / this.layout.divisor) : this.layout.calculate(this._stageSize.width, this._stageSize.height), this.viewSettings.width = this.layout.width, this.viewSettings.height = this.layout.height, this.setLayout(this.layout));
4840
4833
  }
4841
4834
  setLayout(t) {
4842
- this.viewSettings.layout = t, this.mapping = new wt(t.props, this.settings.direction, this.settings.axis), this.views && this.views.forEach((e) => {
4835
+ this.viewSettings.layout = t, this.mapping = new bt(t.props, this.settings.direction, this.settings.axis), this.views && this.views.forEach((e) => {
4843
4836
  e && e.setLayout(t);
4844
4837
  });
4845
4838
  }
@@ -4847,7 +4840,7 @@ class ot {
4847
4840
  this.writingMode = t;
4848
4841
  }
4849
4842
  updateAxis(t, e) {
4850
- !e && t === this.settings.axis || (this.settings.axis = t, this.stage && this.stage.axis(t), this.viewSettings.axis = t, this.mapping && (this.mapping = new wt(this.layout.props, this.settings.direction, this.settings.axis)), this.layout && (t === "vertical" ? this.layout.spread("none") : this.layout.spread(this.layout.settings.spread)));
4843
+ !e && t === this.settings.axis || (this.settings.axis = t, this.stage && this.stage.axis(t), this.viewSettings.axis = t, this.mapping && (this.mapping = new bt(this.layout.props, this.settings.direction, this.settings.axis)), this.layout && (t === "vertical" ? this.layout.spread("none") : this.layout.spread(this.layout.settings.spread)));
4851
4844
  }
4852
4845
  updateFlow(t, e = "auto") {
4853
4846
  const i = t === "paginated" || t === "auto";
@@ -4867,26 +4860,26 @@ class ot {
4867
4860
  return this.rendered;
4868
4861
  }
4869
4862
  }
4870
- P(ot.prototype);
4871
- const qe = {
4863
+ P(rt.prototype);
4864
+ const We = {
4872
4865
  easeInCubic: function(l) {
4873
4866
  return Math.pow(l, 3);
4874
4867
  }
4875
4868
  };
4876
- class bt {
4869
+ class xt {
4877
4870
  constructor(t, e) {
4878
4871
  this.settings = C({
4879
4872
  duration: 80,
4880
4873
  minVelocity: 0.2,
4881
4874
  minDistance: 10,
4882
- easing: qe.easeInCubic
4875
+ easing: We.easeInCubic
4883
4876
  }, e || {}), this._supportsTouch = this.supportsTouch(), this._supportsTouch && this.setup(t);
4884
4877
  }
4885
4878
  setup(t) {
4886
- this.manager = t, this.layout = this.manager.layout, this.fullsize = this.manager.settings.fullsize ?? !1, this.fullsize ? (this.element = this.manager.stage.element, this.scroller = window, this.disableScroll()) : (this.element = this.manager.stage.container, this.scroller = this.element, this.element.style.WebkitOverflowScrolling = "touch"), this.manager.settings.offset = this.layout.width, this.manager.settings.afterScrolledTimeout = this.settings.duration * 2, this.isVertical = this.manager.settings.axis === "vertical", !(!this.manager.isPaginated || this.isVertical) && (this.touchCanceler = !1, this.resizeCanceler = !1, this.snapping = !1, this.scrollLeft, this.scrollTop, this.startTouchX = void 0, this.startTouchY = void 0, this.startTime = void 0, this.endTouchX = void 0, this.endTouchY = void 0, this.endTime = void 0, this.addListeners());
4879
+ this.manager = t, this.layout = this.manager.layout, this.fullsize = this.manager.settings.fullsize ?? !1, this.fullsize ? (this.element = this.manager.stage.element, this.scroller = window, this.disableScroll()) : (this.element = this.manager.stage.container, this.scroller = this.element, this.element.style.setProperty("-webkit-overflow-scrolling", "touch")), this.manager.settings.offset = this.layout.width, this.manager.settings.afterScrolledTimeout = this.settings.duration * 2, this.isVertical = this.manager.settings.axis === "vertical", !(!this.manager.isPaginated || this.isVertical) && (this.touchCanceler = !1, this.resizeCanceler = !1, this.snapping = !1, this.scrollLeft, this.scrollTop, this.startTouchX = void 0, this.startTouchY = void 0, this.startTime = void 0, this.endTouchX = void 0, this.endTouchY = void 0, this.endTime = void 0, this.addListeners());
4887
4880
  }
4888
4881
  supportsTouch() {
4889
- return !!("ontouchstart" in window || window.DocumentTouch && document instanceof window.DocumentTouch);
4882
+ return "ontouchstart" in window || "DocumentTouch" in window;
4890
4883
  }
4891
4884
  disableScroll() {
4892
4885
  this.element.style.overflow = "hidden";
@@ -4964,8 +4957,8 @@ class bt {
4964
4957
  this.scroller && (this.fullsize && this.enableScroll(), this.removeListeners(), this.scroller = void 0);
4965
4958
  }
4966
4959
  }
4967
- P(bt.prototype);
4968
- function We(l, t) {
4960
+ P(xt.prototype);
4961
+ function Ue(l, t) {
4969
4962
  let e;
4970
4963
  return function(...i) {
4971
4964
  clearTimeout(e), e = setTimeout(() => {
@@ -4973,8 +4966,9 @@ function We(l, t) {
4973
4966
  }, t);
4974
4967
  };
4975
4968
  }
4976
- class Ue extends ot {
4969
+ class je extends rt {
4977
4970
  constructor(t) {
4971
+ var i;
4978
4972
  super(t), this.name = "continuous", this.settings = C({}, {
4979
4973
  infinite: !0,
4980
4974
  overflow: void 0,
@@ -4989,7 +4983,9 @@ class Ue extends ot {
4989
4983
  afterScrolledTimeout: 10,
4990
4984
  allowScriptedContent: !1,
4991
4985
  allowPopups: !1
4992
- }), C(this.settings, t.settings || {}), t.settings.gap != "undefined" && t.settings.gap === 0 && (this.settings.gap = t.settings.gap), this.viewSettings = {
4986
+ }), C(this.settings, t.settings || {});
4987
+ const e = (i = t.settings) == null ? void 0 : i.gap;
4988
+ e !== void 0 && e === 0 && (this.settings.gap = e), this.viewSettings = {
4993
4989
  ignoreClass: this.settings.ignoreClass,
4994
4990
  axis: this.settings.axis,
4995
4991
  flow: this.settings.flow,
@@ -5002,7 +4998,7 @@ class Ue extends ot {
5002
4998
  }, this.scrollTop = 0, this.scrollLeft = 0;
5003
4999
  }
5004
5000
  display(t, e) {
5005
- return ot.prototype.display.call(this, t, e).then(() => this.fill());
5001
+ return rt.prototype.display.call(this, t, e).then(() => this.fill());
5006
5002
  }
5007
5003
  fill(t) {
5008
5004
  const e = t || new y();
@@ -5012,7 +5008,7 @@ class Ue extends ot {
5012
5008
  }
5013
5009
  moveTo(t) {
5014
5010
  let e = 0, i = 0;
5015
- this.isPaginated ? (e = Math.floor(t.left / this.layout.delta) * this.layout.delta, e + this.settings.offsetDelta) : (i = t.top, t.top + this.settings.offsetDelta), (e > 0 || i > 0) && this.scrollBy(e, i, !0);
5011
+ this.isPaginated ? (e = Math.floor(t.left / this.layout.delta) * this.layout.delta, e + (this.settings.offsetDelta ?? 0)) : (i = t.top, t.top + (this.settings.offsetDelta ?? 0)), (e > 0 || i > 0) && this.scrollBy(e, i, !0);
5016
5012
  }
5017
5013
  afterResized(t) {
5018
5014
  this.emit(f.MANAGERS.RESIZE, t.section);
@@ -5032,6 +5028,7 @@ class Ue extends ot {
5032
5028
  this.updateWritingMode(i);
5033
5029
  }), e.onDisplayed = (i) => this.afterDisplayed(i), e.onResize = (i) => this.afterResized(i), e.display(this.request);
5034
5030
  }
5031
+ // @ts-expect-error - Returns IframeView synchronously unlike base class Promise<IframeView>
5035
5032
  append(t) {
5036
5033
  const e = this.createView(t);
5037
5034
  return e.on(f.VIEWS.RESIZED, (i) => {
@@ -5042,6 +5039,7 @@ class Ue extends ot {
5042
5039
  this.updateWritingMode(i);
5043
5040
  }), this.views.append(e), e.onDisplayed = (i) => this.afterDisplayed(i), e;
5044
5041
  }
5042
+ // @ts-expect-error - Returns IframeView synchronously unlike base class Promise<IframeView>
5045
5043
  prepend(t) {
5046
5044
  const e = this.createView(t);
5047
5045
  return e.on(f.VIEWS.RESIZED, (i) => {
@@ -5122,13 +5120,13 @@ class Ue extends ot {
5122
5120
  addEventListeners(t) {
5123
5121
  this._onUnload = (e) => {
5124
5122
  this.ignore = !0, this.destroy();
5125
- }, window.addEventListener("unload", this._onUnload), this.addScrollListeners(), this.isPaginated && this.settings.snap && (this.snapper = new bt(this, typeof this.settings.snap == "object" ? this.settings.snap : void 0));
5123
+ }, window.addEventListener("unload", this._onUnload), this.addScrollListeners(), this.isPaginated && this.settings.snap && (this.snapper = new xt(this, typeof this.settings.snap == "object" ? this.settings.snap : void 0));
5126
5124
  }
5127
5125
  addScrollListeners() {
5128
5126
  let t;
5129
- this.tick = xt;
5127
+ this.tick = Et;
5130
5128
  const e = this.settings.direction === "rtl" && this.settings.rtlScrollType === "default" ? -1 : 1;
5131
- this.scrollDeltaVert = 0, this.scrollDeltaHorz = 0, this.settings.fullsize ? (t = window, this.scrollTop = window.scrollY * e, this.scrollLeft = window.scrollX * e) : (t = this.container, this.scrollTop = this.container.scrollTop, this.scrollLeft = this.container.scrollLeft), this._onScroll = this.onScroll.bind(this), t.addEventListener("scroll", this._onScroll), this._scrolled = We(() => this.scrolled(), 30), this.didScroll = !1;
5129
+ this.scrollDeltaVert = 0, this.scrollDeltaHorz = 0, this.settings.fullsize ? (t = window, this.scrollTop = window.scrollY * e, this.scrollLeft = window.scrollX * e) : (t = this.container, this.scrollTop = this.container.scrollTop, this.scrollLeft = this.container.scrollLeft), this._onScroll = this.onScroll.bind(this), t.addEventListener("scroll", this._onScroll), this._scrolled = Ue(() => this.scrolled(), 30), this.didScroll = !1;
5132
5130
  }
5133
5131
  removeEventListeners() {
5134
5132
  let t;
@@ -5161,13 +5159,13 @@ class Ue extends ot {
5161
5159
  this.views.length && (this.isPaginated && this.settings.axis === "horizontal" ? this.scrollBy(-t, 0, !0) : this.scrollBy(0, -this.layout.height, !0), this.q.enqueue(() => this.check()));
5162
5160
  }
5163
5161
  updateFlow(t) {
5164
- this.rendered && this.snapper && (this.snapper.destroy(), this.snapper = void 0), super.updateFlow(t, "scroll"), this.rendered && this.isPaginated && this.settings.snap && (this.snapper = new bt(this, typeof this.settings.snap == "object" ? this.settings.snap : void 0));
5162
+ this.rendered && this.snapper && (this.snapper.destroy(), this.snapper = void 0), super.updateFlow(t, "scroll"), this.rendered && this.isPaginated && this.settings.snap && (this.snapper = new xt(this, typeof this.settings.snap == "object" ? this.settings.snap : void 0));
5165
5163
  }
5166
5164
  destroy() {
5167
5165
  clearTimeout(this.scrollTimeout), clearTimeout(this.trimTimeout), super.destroy(), this.snapper && this.snapper.destroy();
5168
5166
  }
5169
5167
  }
5170
- class Ct {
5168
+ class Tt {
5171
5169
  constructor(t, e) {
5172
5170
  this.settings = C({}, {
5173
5171
  width: null,
@@ -5186,7 +5184,7 @@ class Ct {
5186
5184
  defaultDirection: "ltr",
5187
5185
  allowScriptedContent: !1,
5188
5186
  allowPopups: !1
5189
- }), C(this.settings, e), typeof this.settings.manager == "object" && (this.manager = this.settings.manager), this.book = t, this.hooks = {}, this.hooks.display = new A(this), this.hooks.serialize = new A(this), this.hooks.content = new A(this), this.hooks.unloaded = new A(this), this.hooks.layout = new A(this), this.hooks.render = new A(this), this.hooks.show = new A(this), this.hooks.content.register((i) => this.handleLinks(i)), this.hooks.content.register((i) => this.passEvents(i)), this.hooks.content.register((i) => this.adjustImages(i)), this.book.spine.hooks.content.register((i, s) => this.injectIdentifier(i, s)), this.settings.stylesheet && this.book.spine.hooks.content.register((i, s) => this.injectStylesheet(i, s)), this.settings.script && this.book.spine.hooks.content.register((i, s) => this.injectScript(i, s)), this.themes = new Ee(this), this.annotations = new Se(this), this.epubcfi = new v(), this.q = new St(this), this.location = void 0, this.q.enqueue(this.book.opened), this.starting = new y(), this.started = this.starting.promise, this.q.enqueue(this.start);
5187
+ }), C(this.settings, e), typeof this.settings.manager == "object" && (this.manager = this.settings.manager), this.book = t, this.hooks = {}, this.hooks.display = new A(this), this.hooks.serialize = new A(this), this.hooks.content = new A(this), this.hooks.unloaded = new A(this), this.hooks.layout = new A(this), this.hooks.render = new A(this), this.hooks.show = new A(this), this.hooks.content.register((i) => this.handleLinks(i)), this.hooks.content.register((i) => this.passEvents(i)), this.hooks.content.register((i) => this.adjustImages(i)), this.book.spine.hooks.content.register((i, s) => this.injectIdentifier(i, s)), this.settings.stylesheet && this.book.spine.hooks.content.register((i, s) => this.injectStylesheet(i, s)), this.settings.script && this.book.spine.hooks.content.register((i, s) => this.injectScript(i, s)), this.themes = new Se(this), this.annotations = new _e(this), this.epubcfi = new v(), this.q = new _t(this), this.location = void 0, this.q.enqueue(this.book.opened), this.starting = new y(), this.started = this.starting.promise, this.q.enqueue(this.start);
5190
5188
  }
5191
5189
  /**
5192
5190
  * Set the manager function
@@ -5202,7 +5200,7 @@ class Ct {
5202
5200
  */
5203
5201
  requireManager(t) {
5204
5202
  let e;
5205
- return typeof t == "string" && t === "default" ? e = ot : typeof t == "string" && t === "continuous" ? e = Ue : e = t, e;
5203
+ return typeof t == "string" && t === "default" ? e = rt : typeof t == "string" && t === "continuous" ? e = je : e = t, e;
5206
5204
  }
5207
5205
  /**
5208
5206
  * Require the view from passed string, or as a class function
@@ -5211,7 +5209,7 @@ class Ct {
5211
5209
  */
5212
5210
  requireView(t) {
5213
5211
  let e;
5214
- return typeof t == "string" && t === "iframe" ? e = Kt : e = t, e;
5212
+ return typeof t == "string" && t === "iframe" ? e = Zt : e = t, e;
5215
5213
  }
5216
5214
  /**
5217
5215
  * Start the rendering
@@ -5256,7 +5254,7 @@ class Ct {
5256
5254
  * @return {Promise}
5257
5255
  */
5258
5256
  display(t) {
5259
- return this.displaying && this.displaying.resolve(), this.q.enqueue(this._display, t);
5257
+ return this.displaying && this.displaying.resolve(void 0), this.q.enqueue(this._display, t);
5260
5258
  }
5261
5259
  /**
5262
5260
  * Tells the manager what to display immediately
@@ -5269,7 +5267,7 @@ class Ct {
5269
5267
  return;
5270
5268
  this.epubcfi.isCfiString(t);
5271
5269
  const e = new y(), i = e.promise;
5272
- this.displaying = e, this.book.locations.length() && Pt(t) && (t = this.book.locations.cfiFromPercentage(parseFloat(t)));
5270
+ this.displaying = e, this.book.locations.length() && zt(t) && (t = this.book.locations.cfiFromPercentage(parseFloat(t)));
5273
5271
  const s = this.book.spine.get(t);
5274
5272
  return s ? (this.manager.display(s, t).then(() => {
5275
5273
  e.resolve(s), this.displaying = void 0, this.emit(f.RENDITION.DISPLAYED, s), this.reportLocation();
@@ -5432,7 +5430,7 @@ class Ct {
5432
5430
  * @param {object} settings
5433
5431
  */
5434
5432
  layout(t) {
5435
- return t && (this._layout = new Xt(t), this._layout.spread(t.spread, this.settings.minSpreadWidth), this._layout.on(f.LAYOUT.UPDATED, (e, i) => {
5433
+ return t && (this._layout = new Gt(t), this._layout.spread(t.spread, this.settings.minSpreadWidth), this._layout.on(f.LAYOUT.UPDATED, (e, i) => {
5436
5434
  this.emit(f.RENDITION.LAYOUT, e, i);
5437
5435
  })), this.manager && this._layout && this.manager.applyLayout(this._layout), this._layout;
5438
5436
  }
@@ -5459,7 +5457,7 @@ class Ct {
5459
5457
  return this.q.enqueue(() => {
5460
5458
  requestAnimationFrame(() => {
5461
5459
  const t = this.manager.currentLocation();
5462
- if (t && t.then && typeof t.then == "function")
5460
+ if (t && "then" in t && typeof t.then == "function")
5463
5461
  t.then((e) => {
5464
5462
  const i = this.located(e);
5465
5463
  !i || !i.start || !i.end || (this.location = i, this.emit(f.RENDITION.LOCATION_CHANGED, {
@@ -5491,7 +5489,7 @@ class Ct {
5491
5489
  */
5492
5490
  currentLocation() {
5493
5491
  const t = this.manager.currentLocation();
5494
- if (t && t.then && typeof t.then == "function")
5492
+ if (t && "then" in t && typeof t.then == "function")
5495
5493
  t.then((e) => this.located(e));
5496
5494
  else if (t)
5497
5495
  return this.located(t);
@@ -5541,7 +5539,7 @@ class Ct {
5541
5539
  * @param {Contents} view contents
5542
5540
  */
5543
5541
  passEvents(t) {
5544
- Q.forEach((e) => {
5542
+ J.forEach((e) => {
5545
5543
  t.on(e, (i) => this.triggerViewEvent(i, t));
5546
5544
  }), t.on(f.CONTENTS.SELECTED, (e) => this.triggerSelectedEvent(e, t));
5547
5545
  }
@@ -5580,7 +5578,7 @@ class Ct {
5580
5578
  return i.spinePos === n.index;
5581
5579
  });
5582
5580
  if (s.length)
5583
- return s[0].contents.range(i, e);
5581
+ return s[0].contents.range(i.toString(), e);
5584
5582
  }
5585
5583
  /**
5586
5584
  * Hook to adjust images to fit in columns
@@ -5673,8 +5671,8 @@ class Ct {
5673
5671
  s.setAttribute("name", "dc.relation.ispartof"), i && s.setAttribute("content", i), t.getElementsByTagName("head")[0].appendChild(s);
5674
5672
  }
5675
5673
  }
5676
- P(Ct.prototype);
5677
- class je {
5674
+ P(Tt.prototype);
5675
+ class Fe {
5678
5676
  constructor() {
5679
5677
  this.zip = void 0, this.urlCache = {}, this.checkRequirements();
5680
5678
  }
@@ -5685,7 +5683,7 @@ class je {
5685
5683
  */
5686
5684
  checkRequirements() {
5687
5685
  try {
5688
- this.zip = new Jt();
5686
+ this.zip = new Qt();
5689
5687
  } catch {
5690
5688
  throw new Error("JSZip lib not loaded");
5691
5689
  }
@@ -5706,7 +5704,7 @@ class je {
5706
5704
  * @return {Promise} zipfile
5707
5705
  */
5708
5706
  openUrl(t, e) {
5709
- return K(t, "binary").then((i) => this.zip.loadAsync(i, { base64: e }));
5707
+ return $(t, "binary").then((i) => this.zip.loadAsync(i, { base64: e }));
5710
5708
  }
5711
5709
  /**
5712
5710
  * Request a url from the archive
@@ -5735,7 +5733,7 @@ class je {
5735
5733
  */
5736
5734
  handleResponse(t, e) {
5737
5735
  let i;
5738
- return e == "json" ? i = JSON.parse(t) : $(e) ? i = O(t, "text/xml") : e == "xhtml" ? i = O(t, "application/xhtml+xml") : e == "html" || e == "htm" ? i = O(t, "text/html") : i = t, i;
5736
+ return e == "json" ? i = JSON.parse(t) : Y(e) ? i = O(t, "text/xml") : e == "xhtml" ? i = O(t, "application/xhtml+xml") : e == "html" || e == "htm" ? i = O(t, "text/html") : i = t, i;
5739
5737
  }
5740
5738
  /**
5741
5739
  * Get a Blob from Archive by Url
@@ -5810,7 +5808,7 @@ class je {
5810
5808
  this.zip = void 0, this.urlCache = {};
5811
5809
  }
5812
5810
  }
5813
- function Fe(l) {
5811
+ function Ve(l) {
5814
5812
  return new Promise((t, e) => {
5815
5813
  const i = indexedDB.open(l, 1);
5816
5814
  i.onupgradeneeded = () => {
@@ -5818,8 +5816,8 @@ function Fe(l) {
5818
5816
  }, i.onsuccess = () => t(i.result), i.onerror = () => e(i.error);
5819
5817
  });
5820
5818
  }
5821
- function Ve(l) {
5822
- const t = Fe(l);
5819
+ function He(l) {
5820
+ const t = Ve(l);
5823
5821
  return {
5824
5822
  getItem(e) {
5825
5823
  return t.then((i) => new Promise((s, n) => {
@@ -5835,9 +5833,10 @@ function Ve(l) {
5835
5833
  }
5836
5834
  };
5837
5835
  }
5838
- class Zt {
5836
+ const ft = typeof window < "u" ? window.URL || window.webkitURL || window.mozURL : void 0;
5837
+ class Jt {
5839
5838
  constructor(t, e, i) {
5840
- this.urlCache = {}, this.name = t, this.requester = e || K, this.resolver = i, this.online = !0, this.checkRequirements(), this.addListeners();
5839
+ this.urlCache = {}, this.name = t, this.requester = e || $, this.resolver = i, this.online = !0, this.checkRequirements(), this.addListeners();
5841
5840
  }
5842
5841
  /**
5843
5842
  * Checks that IndexedDB is available and creates the storage instance
@@ -5847,7 +5846,7 @@ class Zt {
5847
5846
  try {
5848
5847
  if (typeof indexedDB > "u")
5849
5848
  throw new Error("IndexedDB not available");
5850
- this.storage = Ve(this.name);
5849
+ this.storage = He(this.name);
5851
5850
  } catch {
5852
5851
  throw new Error("IndexedDB not available");
5853
5852
  }
@@ -5930,13 +5929,13 @@ class Zt {
5930
5929
  /**
5931
5930
  * Handle the response from request
5932
5931
  * @private
5933
- * @param {any} response
5932
+ * @param {string | Blob} response
5934
5933
  * @param {string} [type]
5935
- * @return {any} the parsed result
5934
+ * @return {string | Document | Blob | object} the parsed result
5936
5935
  */
5937
5936
  handleResponse(t, e) {
5938
5937
  let i;
5939
- return e == "json" ? i = JSON.parse(t) : $(e) ? i = O(t, "text/xml") : e == "xhtml" ? i = O(t, "application/xhtml+xml") : e == "html" || e == "htm" ? i = O(t, "text/html") : i = t, i;
5938
+ return e == "json" ? i = JSON.parse(t) : Y(e) ? i = O(t, "text/xml") : e == "xhtml" ? i = O(t, "application/xhtml+xml") : e == "html" || e == "htm" ? i = O(t, "text/html") : i = t, i;
5940
5939
  }
5941
5940
  /**
5942
5941
  * Get a Blob from Storage by Url
@@ -5992,14 +5991,14 @@ class Zt {
5992
5991
  * @return {Promise} url promise with Url string
5993
5992
  */
5994
5993
  createUrl(t, e) {
5995
- const i = new y(), s = window.URL || window.webkitURL || window.mozURL;
5996
- let n, r;
5997
- const o = e && e.base64;
5998
- return t in this.urlCache ? (i.resolve(this.urlCache[t]), i.promise) : (o ? (r = this.getBase64(t), r && r.then((h) => {
5999
- h && (this.urlCache[t] = h, i.resolve(h));
6000
- })) : (r = this.getBlob(t), r && r.then((h) => {
6001
- h && (n = s.createObjectURL(h), this.urlCache[t] = n, i.resolve(n));
6002
- })), r || i.reject({
5994
+ const i = new y();
5995
+ let s, n;
5996
+ const r = e && e.base64;
5997
+ return t in this.urlCache ? (i.resolve(this.urlCache[t]), i.promise) : (r ? (n = this.getBase64(t), n && n.then((o) => {
5998
+ this.urlCache[t] = o, i.resolve(o);
5999
+ })) : (n = this.getBlob(t), n && n.then((o) => {
6000
+ s = o ? ft.createObjectURL(o) : void 0, this.urlCache[t] = s, i.resolve(s);
6001
+ })), n || i.reject({
6003
6002
  message: "File not found in storage: " + t,
6004
6003
  stack: new Error().stack
6005
6004
  }), i.promise);
@@ -6009,18 +6008,17 @@ class Zt {
6009
6008
  * @param {string} url url of the item in the store
6010
6009
  */
6011
6010
  revokeUrl(t) {
6012
- const e = window.URL || window.webkitURL || window.mozURL, i = this.urlCache[t];
6013
- i && e.revokeObjectURL(i);
6011
+ const e = this.urlCache[t];
6012
+ e && ft.revokeObjectURL(e);
6014
6013
  }
6015
6014
  destroy() {
6016
- const t = window.URL || window.webkitURL || window.mozURL;
6017
- for (const e in this.urlCache)
6018
- t.revokeObjectURL(e);
6015
+ for (const t in this.urlCache)
6016
+ ft.revokeObjectURL(t);
6019
6017
  this.urlCache = {}, this.removeListeners();
6020
6018
  }
6021
6019
  }
6022
- P(Zt.prototype);
6023
- class ft {
6020
+ P(Jt.prototype);
6021
+ class pt {
6024
6022
  constructor(t) {
6025
6023
  this.interactive = "", this.fixedLayout = "", this.openToSpread = "", this.orientationLock = "", t && this.parse(t);
6026
6024
  }
@@ -6055,7 +6053,7 @@ class ft {
6055
6053
  this.interactive = void 0, this.fixedLayout = void 0, this.openToSpread = void 0, this.orientationLock = void 0;
6056
6054
  }
6057
6055
  }
6058
- const At = "META-INF/container.xml", He = "META-INF/com.apple.ibooks.display-options.xml", R = {
6056
+ const It = "META-INF/container.xml", Xe = "META-INF/com.apple.ibooks.display-options.xml", N = {
6059
6057
  BINARY: "binary",
6060
6058
  BASE64: "base64",
6061
6059
  EPUB: "epub",
@@ -6063,7 +6061,7 @@ const At = "META-INF/container.xml", He = "META-INF/com.apple.ibooks.display-opt
6063
6061
  MANIFEST: "json",
6064
6062
  DIRECTORY: "directory"
6065
6063
  };
6066
- class Tt {
6064
+ class kt {
6067
6065
  constructor(t, e) {
6068
6066
  typeof e > "u" && typeof t != "string" && !(t instanceof Blob) && !(t instanceof ArrayBuffer) && (e = t, t = void 0), this.settings = C({}, {
6069
6067
  requestMethod: void 0,
@@ -6100,7 +6098,7 @@ class Tt {
6100
6098
  this.loaded.navigation,
6101
6099
  this.loaded.resources,
6102
6100
  this.loaded.displayOptions
6103
- ]), this.isRendered = !1, this.request = this.settings.requestMethod || K, this.spine = new me(), this.locations = new Ht(this.spine, (i) => this.load(i)), this.navigation = void 0, this.pageList = void 0, this.url = void 0, this.path = void 0, this.archived = !1, this.archive = void 0, this.storage = void 0, this.resources = void 0, this.rendition = void 0, this.container = void 0, this.packaging = void 0, this.displayOptions = void 0, this.settings.store && this.store(this.settings.store), t && this.open(t, this.settings.openAs).catch((i) => {
6101
+ ]), this.isRendered = !1, this.request = this.settings.requestMethod || $, this.spine = new ve(), this.locations = new Xt(this.spine, (i) => this.load(i)), this.navigation = void 0, this.pageList = void 0, this.url = void 0, this.path = void 0, this.archived = !1, this.archive = void 0, this.storage = void 0, this.resources = void 0, this.rendition = void 0, this.container = void 0, this.packaging = void 0, this.displayOptions = void 0, this.settings.store && this.store(this.settings.store), t && this.open(t, this.settings.openAs).catch((i) => {
6104
6102
  const s = new Error("Cannot load book at " + t);
6105
6103
  this.emit(f.BOOK.OPEN_FAILED, s);
6106
6104
  });
@@ -6115,7 +6113,7 @@ class Tt {
6115
6113
  open(t, e) {
6116
6114
  let i;
6117
6115
  const s = e || this.determineType(t);
6118
- return s === R.BINARY ? (this.archived = !0, this.url = new N("/", ""), i = this.openEpub(t)) : s === R.BASE64 ? (this.archived = !0, this.url = new N("/", ""), i = this.openEpub(t, s)) : s === R.EPUB ? (this.archived = !0, this.url = new N("/", ""), i = this.request(t, "binary", this.settings.requestCredentials, this.settings.requestHeaders).then((n) => this.openEpub(n))) : s == R.OPF ? (this.url = new N(t), i = this.openPackaging(this.url.Path.toString())) : s == R.MANIFEST ? (this.url = new N(t), i = this.openManifest(this.url.Path.toString())) : (this.url = new N(t), i = this.openContainer(At).then((n) => this.openPackaging(n))), i;
6116
+ return s === N.BINARY ? (this.archived = !0, this.url = new R("/", ""), i = this.openEpub(t)) : s === N.BASE64 ? (this.archived = !0, this.url = new R("/", ""), i = this.openEpub(t, s)) : s === N.EPUB ? (this.archived = !0, this.url = new R("/", ""), i = this.request(t, "binary", this.settings.requestCredentials, this.settings.requestHeaders).then((n) => this.openEpub(n))) : s == N.OPF ? (this.url = new R(t), i = this.openPackaging(this.url.Path.toString())) : s == N.MANIFEST ? (this.url = new R(t), i = this.openManifest(this.url.Path.toString())) : (this.url = new R(t), i = this.openContainer(It).then((n) => this.openPackaging(n))), i;
6119
6117
  }
6120
6118
  /**
6121
6119
  * Open an archived epub
@@ -6125,7 +6123,7 @@ class Tt {
6125
6123
  * @return {Promise}
6126
6124
  */
6127
6125
  openEpub(t, e) {
6128
- return this.unarchive(t, e || this.settings.encoding).then(() => this.openContainer(At)).then((i) => this.openPackaging(i));
6126
+ return this.unarchive(t, e || this.settings.encoding).then(() => this.openContainer(It)).then((i) => this.openPackaging(i));
6129
6127
  }
6130
6128
  /**
6131
6129
  * Open the epub container
@@ -6134,7 +6132,7 @@ class Tt {
6134
6132
  * @return {string} packagePath
6135
6133
  */
6136
6134
  openContainer(t) {
6137
- return this.load(t).then((e) => (this.container = new ve(e), this.resolve(this.container.packagePath)));
6135
+ return this.load(t).then((e) => (this.container = new ye(e), this.resolve(this.container.packagePath)));
6138
6136
  }
6139
6137
  /**
6140
6138
  * Open the Open Packaging Format Xml
@@ -6143,7 +6141,7 @@ class Tt {
6143
6141
  * @return {Promise}
6144
6142
  */
6145
6143
  openPackaging(t) {
6146
- return this.path = new z(t), this.load(t).then((e) => (this.packaging = new Lt(e), this.unpack(this.packaging)));
6144
+ return this.path = new z(t), this.load(t).then((e) => (this.packaging = new Nt(e), this.unpack(this.packaging)));
6147
6145
  }
6148
6146
  /**
6149
6147
  * Open the manifest JSON
@@ -6152,7 +6150,7 @@ class Tt {
6152
6150
  * @return {Promise}
6153
6151
  */
6154
6152
  openManifest(t) {
6155
- return this.path = new z(t), this.load(t).then((e) => (this.packaging = new Lt(), this.packaging.load(e), this.unpack(this.packaging)));
6153
+ return this.path = new z(t), this.load(t).then((e) => (this.packaging = new Nt(), this.packaging.load(e), this.unpack(this.packaging)));
6156
6154
  }
6157
6155
  /**
6158
6156
  * Load a resource from the Book
@@ -6192,7 +6190,18 @@ class Tt {
6192
6190
  */
6193
6191
  determineType(t) {
6194
6192
  let e;
6195
- return this.settings.encoding === "base64" ? R.BASE64 : typeof t != "string" ? R.BINARY : (e = new N(t).path().extension, e && (e = e.replace(/\?.*$/, "")), e ? e === "epub" ? R.EPUB : e === "opf" ? R.OPF : e === "json" ? R.MANIFEST : R.BINARY : R.DIRECTORY);
6193
+ if (this.settings.encoding === "base64")
6194
+ return N.BASE64;
6195
+ if (typeof t != "string")
6196
+ return N.BINARY;
6197
+ if (e = new R(t).path().extension, e && (e = e.replace(/\?.*$/, "")), !e)
6198
+ return N.DIRECTORY;
6199
+ if (e === "epub")
6200
+ return N.EPUB;
6201
+ if (e === "opf")
6202
+ return N.OPF;
6203
+ if (e === "json")
6204
+ return N.MANIFEST;
6196
6205
  }
6197
6206
  /**
6198
6207
  * unpack the contents of the Books packaging
@@ -6200,11 +6209,11 @@ class Tt {
6200
6209
  * @param {Packaging} packaging object
6201
6210
  */
6202
6211
  unpack(t) {
6203
- this.package = t, this.packaging.metadata.layout === "" ? this.load(this.url.resolve(He)).then((e) => {
6204
- this.displayOptions = new ft(e), this.loading.displayOptions.resolve(this.displayOptions);
6212
+ this.package = t, this.packaging.metadata.layout === "" ? this.load(this.url.resolve(Xe)).then((e) => {
6213
+ this.displayOptions = new pt(e), this.loading.displayOptions.resolve(this.displayOptions);
6205
6214
  }).catch((e) => {
6206
- this.displayOptions = new ft(), this.loading.displayOptions.resolve(this.displayOptions);
6207
- }) : (this.displayOptions = new ft(), this.loading.displayOptions.resolve(this.displayOptions)), this.spine.unpack(this.packaging, (e, i) => this.resolve(e, i), (e) => this.canonical(e)), this.resources = new xe(this.packaging.manifest, {
6215
+ this.displayOptions = new pt(), this.loading.displayOptions.resolve(this.displayOptions);
6216
+ }) : (this.displayOptions = new pt(), this.loading.displayOptions.resolve(this.displayOptions)), this.spine.unpack(this.packaging, (e, i) => this.resolve(e, i), (e) => this.canonical(e)), this.resources = new Ee(this.packaging.manifest, {
6208
6217
  archive: this.archive,
6209
6218
  resolver: (e, i) => this.resolve(e, i),
6210
6219
  request: (e, i) => this.request(e, i),
@@ -6229,9 +6238,9 @@ class Tt {
6229
6238
  loadNavigation(t) {
6230
6239
  const e = t.navPath || t.ncxPath, i = t.toc;
6231
6240
  return i ? new Promise((s, n) => {
6232
- this.navigation = new dt(i), t.pageList && (this.pageList = new ut(t.pageList)), s(this.navigation);
6233
- }) : e ? this.load(e, "xml").then((s) => (this.navigation = new dt(s), this.pageList = new ut(s), this.navigation)) : new Promise((s, n) => {
6234
- this.navigation = new dt(), this.pageList = new ut(), s(this.navigation);
6241
+ this.navigation = new ct(i), "pageList" in t && t.pageList && (this.pageList = new ut(t.pageList)), s(this.navigation);
6242
+ }) : e ? this.load(e, "xml").then((s) => (this.navigation = new ct(s), this.pageList = new ut(s), this.navigation)) : new Promise((s, n) => {
6243
+ this.navigation = new ct(), this.pageList = new ut(), s(this.navigation);
6235
6244
  });
6236
6245
  }
6237
6246
  /**
@@ -6250,7 +6259,7 @@ class Tt {
6250
6259
  * @return {Rendition}
6251
6260
  */
6252
6261
  renderTo(t, e) {
6253
- return this.rendition = new Ct(this, e), this.rendition.attachTo(t), this.rendition;
6262
+ return this.rendition = new Tt(this, e), this.rendition.attachTo(t), this.rendition;
6254
6263
  }
6255
6264
  /**
6256
6265
  * Set if request should use withCredentials
@@ -6274,7 +6283,7 @@ class Tt {
6274
6283
  * @return {Archive}
6275
6284
  */
6276
6285
  unarchive(t, e) {
6277
- return this.archive = new je(), this.archive.open(t, e === "base64");
6286
+ return this.archive = new Fe(), this.archive.open(t, e === "base64");
6278
6287
  }
6279
6288
  /**
6280
6289
  * Store the epubs contents
@@ -6284,14 +6293,14 @@ class Tt {
6284
6293
  * @return {Store}
6285
6294
  */
6286
6295
  store(t) {
6287
- const e = this.settings.replacements && this.settings.replacements !== "none", i = this.url, s = this.settings.requestMethod || ((n, r) => K(n, r));
6288
- return this.storage = new Zt(t, s, (n, r) => this.resolve(n, r)), this.request = (n, r) => this.storage.request(n, r), this.opened.then(() => {
6296
+ const e = this.settings.replacements && this.settings.replacements !== "none" ? this.settings.replacements : void 0, i = this.url, s = this.settings.requestMethod || ((n, r) => $(n, r));
6297
+ return this.storage = new Jt(t, s, (n, r) => this.resolve(n, r)), this.request = (n, r) => this.storage.request(n, r), this.opened.then(() => {
6289
6298
  this.archived && (this.storage.requester = (r, o) => this.archive.request(r, o));
6290
6299
  const n = (r, o) => {
6291
6300
  o.output = this.resources.substitute(r, o.url);
6292
6301
  };
6293
6302
  this.resources.settings.replacements = e || "blobUrl", this.resources.replacements().then(() => this.resources.replaceCss()), this.storage.on("offline", () => {
6294
- this.url = new N("/", ""), this.spine.hooks.serialize.register(n);
6303
+ this.url = new R("/", ""), this.spine.hooks.serialize.register(n);
6295
6304
  }), this.storage.on("online", () => {
6296
6305
  this.url = i, this.spine.hooks.serialize.deregister(n);
6297
6306
  });
@@ -6335,7 +6344,7 @@ class Tt {
6335
6344
  */
6336
6345
  key(t) {
6337
6346
  const e = t || this.packaging.metadata.identifier || this.url.filename;
6338
- return `epubjs:${lt}:${e}`;
6347
+ return `epubjs:${ht}:${e}`;
6339
6348
  }
6340
6349
  /**
6341
6350
  * Destroy the Book and all associated objects
@@ -6344,36 +6353,36 @@ class Tt {
6344
6353
  this.opened = void 0, this.loading = void 0, this.loaded = void 0, this.ready = void 0, this.isOpen = !1, this.isRendered = !1, this.spine && this.spine.destroy(), this.locations && this.locations.destroy(), this.pageList && this.pageList.destroy(), this.archive && this.archive.destroy(), this.resources && this.resources.destroy(), this.container && this.container.destroy(), this.packaging && this.packaging.destroy(), this.rendition && this.rendition.destroy(), this.displayOptions && this.displayOptions.destroy(), this.storage && (this.storage.destroy(), this.storage = void 0), this.spine = void 0, this.locations = void 0, this.pageList = void 0, this.archive = void 0, this.resources = void 0, this.container = void 0, this.packaging = void 0, this.rendition = void 0, this.navigation = void 0, this.url = void 0, this.path = void 0, this.archived = !1;
6345
6354
  }
6346
6355
  }
6347
- P(Tt.prototype);
6348
- function Y(l, t) {
6349
- return new Tt(l, t);
6356
+ P(kt.prototype);
6357
+ function G(l, t) {
6358
+ return new kt(l, t);
6350
6359
  }
6351
- Y.VERSION = lt;
6352
- typeof global < "u" && (globalThis.EPUBJS_VERSION = lt);
6353
- Y.Book = Tt;
6354
- Y.Rendition = Ct;
6355
- Y.Contents = _t;
6356
- Y.CFI = v;
6357
- Y.utils = re;
6360
+ G.VERSION = ht;
6361
+ typeof global < "u" && (globalThis.EPUBJS_VERSION = ht);
6362
+ G.Book = kt;
6363
+ G.Rendition = Tt;
6364
+ G.Contents = Ct;
6365
+ G.CFI = v;
6366
+ G.utils = oe;
6358
6367
  export {
6359
- Se as Annotations,
6360
- je as Archive,
6361
- Tt as Book,
6362
- _t as Contents,
6363
- ft as DisplayOptions,
6368
+ _e as Annotations,
6369
+ Fe as Archive,
6370
+ kt as Book,
6371
+ Ct as Contents,
6372
+ pt as DisplayOptions,
6364
6373
  v as EpubCFI,
6365
- Xt as Layout,
6366
- Ht as Locations,
6367
- wt as Mapping,
6368
- dt as Navigation,
6369
- Lt as Packaging,
6374
+ Gt as Layout,
6375
+ Xt as Locations,
6376
+ bt as Mapping,
6377
+ ct as Navigation,
6378
+ Nt as Packaging,
6370
6379
  ut as PageList,
6371
- Ct as Rendition,
6372
- xe as Resources,
6373
- ge as Section,
6374
- me as Spine,
6375
- Zt as Store,
6376
- Ee as Themes,
6377
- Y as default
6380
+ Tt as Rendition,
6381
+ Ee as Resources,
6382
+ me as Section,
6383
+ ve as Spine,
6384
+ Jt as Store,
6385
+ Se as Themes,
6386
+ G as default
6378
6387
  };
6379
6388
  //# sourceMappingURL=epub.js.map