@prose-reader/streamer 1.286.0 → 1.289.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,36 +1,37 @@
1
- import { detectMimeTypeFromName as w, Report as se, isXmlBasedMimeType as ie, parseContentType as q, isMediaContentMimeType as oe, urlJoin as N } from "@prose-reader/shared";
2
- import { XmlDocument as y, XmlTextNode as ae, XmlElement as ce } from "xmldoc";
3
- import { Subject as W, mergeMap as J, EMPTY as M, pairwise as de, filter as C, startWith as le, from as R, tap as P, catchError as z, switchMap as I, merge as U, first as V, takeUntil as pe, map as x, ignoreElements as ue, BehaviorSubject as me, distinctUntilChanged as fe, shareReplay as he, NEVER as X, timer as ge, finalize as ye, of as be, lastValueFrom as ve } from "rxjs";
4
- const j = (e, n) => {
5
- const i = e.split(/(\d+)/), r = n.split(/(\d+)/);
6
- for (let t = 0, s = i.length; t < s; t++)
7
- if (i[t] !== r[t])
8
- return i[t]?.match(/\d/) ? +(i[t] || "") - +(r[t] || "") : (i[t] || "").localeCompare(r[t] || "");
1
+ import { detectMimeTypeFromName as b, Report as ee, isXmlBasedMimeType as te, parseContentType as V, isMediaContentMimeType as ne, urlJoin as L } from "@prose-reader/shared";
2
+ import { parseOpf as re, APPLE_IBOOKS_DISPLAY_OPTIONS_FILENAME as X, parseAppleDisplayOptionsXml as se, resolveArchiveMetadata as T, COMIC_INFO_FILENAME as G, parseComicInfo as ie, KOBO_DISPLAY_OPTIONS_FILENAME as N, parseKoboXml as oe, tokenizeXmlSpaceSeparatedList as ae } from "@prose-reader/archive-parser";
3
+ import { XmlDocument as I, XmlTextNode as ce, XmlElement as de } from "xmldoc";
4
+ import { Subject as R, mergeMap as H, EMPTY as O, pairwise as le, filter as C, startWith as ue, from as A, tap as E, catchError as k, switchMap as x, merge as z, first as M, takeUntil as pe, map as F, ignoreElements as fe, BehaviorSubject as me, distinctUntilChanged as he, shareReplay as ge, NEVER as B, timer as ye, finalize as be, of as ve, lastValueFrom as we } from "rxjs";
5
+ const W = (n, t) => {
6
+ const i = n.split(/(\d+)/), r = t.split(/(\d+)/);
7
+ for (let e = 0, s = i.length; e < s; e++)
8
+ if (i[e] !== r[e])
9
+ return i[e]?.match(/\d/) ? +(i[e] || "") - +(r[e] || "") : (i[e] || "").localeCompare(r[e] || "");
9
10
  return 1;
10
- }, v = (e) => e.substring(e.lastIndexOf("/") + 1) || e, _ = (e) => e.endsWith("/") ? e.slice(0, -1) : e, we = (e) => {
11
- const n = e.lastIndexOf("/");
12
- return n >= 0 ? e.substring(0, n) : "";
13
- }, mt = async (e, { orderByAlpha: n, name: i } = {}) => {
14
- let r = e;
15
- return n && (r = r.slice().sort((t, s) => j(t.name, s.name))), {
11
+ }, y = (n) => n.substring(n.lastIndexOf("/") + 1) || n, j = (n) => n.endsWith("/") ? n.slice(0, -1) : n, $e = (n) => {
12
+ const t = n.lastIndexOf("/");
13
+ return t >= 0 ? n.substring(0, t) : "";
14
+ }, yt = async (n, { orderByAlpha: t, name: i } = {}) => {
15
+ let r = n;
16
+ return t && (r = r.slice().sort((e, s) => W(e.name, s.name))), {
16
17
  filename: i || "",
17
- records: r.map((t) => {
18
- const s = t.size, o = v(t.name);
19
- return t.isDir ? {
18
+ records: r.map((e) => {
19
+ const s = e.size, o = y(e.name);
20
+ return e.isDir ? {
20
21
  dir: !0,
21
22
  basename: o,
22
- uri: t.name,
23
+ uri: e.name,
23
24
  size: s
24
25
  } : {
25
- dir: t.isDir,
26
+ dir: e.isDir,
26
27
  basename: o,
27
- encodingFormat: w(t.name),
28
- uri: t.name,
29
- blob: async () => new Blob([await t.data()], {
30
- type: w(t.name) ?? ""
28
+ encodingFormat: b(e.name),
29
+ uri: e.name,
30
+ blob: async () => new Blob([await e.data()], {
31
+ type: b(e.name) ?? ""
31
32
  }),
32
33
  string: async () => {
33
- const a = await t.data();
34
+ const a = await e.data();
34
35
  return String.fromCharCode.apply(
35
36
  null,
36
37
  Array.from(new Uint16Array(a))
@@ -41,32 +42,32 @@ const j = (e, n) => {
41
42
  }),
42
43
  close: () => Promise.resolve()
43
44
  };
44
- }, $e = "@prose-reader/streamer", u = se.namespace($e, !1, {
45
+ }, Fe = "@prose-reader/streamer", p = ee.namespace(Fe, !1, {
45
46
  color: "#ffae42"
46
- }), xe = (e) => {
47
- const n = {};
48
- for (const r of e) {
49
- const t = r.split("/");
50
- let s = n;
51
- for (let o = 0; o < t.length; o++) {
52
- const a = t[o];
47
+ }), Ae = (n) => {
48
+ const t = {};
49
+ for (const r of n) {
50
+ const e = r.split("/");
51
+ let s = t;
52
+ for (let o = 0; o < e.length; o++) {
53
+ const a = e[o];
53
54
  a !== void 0 && (s[a] || (s[a] = {}), s = s[a]);
54
55
  }
55
56
  }
56
- const i = (r, t = "") => Object.keys(r).sort().map((s, o, a) => {
57
- const c = o === a.length - 1, d = t + (c ? "└── " : "├── "), l = t + (c ? " " : "│ "), p = r[s];
58
- return p && Object.keys(p).length > 0 ? `${d}${s}/
59
- ${i(p, l)}` : `${d}${s}`;
57
+ const i = (r, e = "") => Object.keys(r).sort().map((s, o, a) => {
58
+ const c = o === a.length - 1, l = e + (c ? "└── " : "├── "), u = e + (c ? " " : "│ "), f = r[s];
59
+ return f && Object.keys(f).length > 0 ? `${l}${s}/
60
+ ${i(f, u)}` : `${l}${s}`;
60
61
  }).join(`
61
62
  `);
62
- return i(n);
63
- }, ft = async (e, { orderByAlpha: n, name: i } = {}) => {
64
- let r = Object.values(e.files);
65
- n && (r = r.slice().sort((s, o) => j(s.name, o.name)));
66
- const t = {
63
+ return i(t);
64
+ }, bt = async (n, { orderByAlpha: t, name: i } = {}) => {
65
+ let r = Object.values(n.files);
66
+ t && (r = r.slice().sort((s, o) => W(s.name, o.name)));
67
+ const e = {
67
68
  filename: i || "",
68
69
  records: r.map((s) => {
69
- const o = s._data.uncompressedSize, a = v(s.name);
70
+ const o = s._data.uncompressedSize, a = y(s.name);
70
71
  return s.dir ? {
71
72
  dir: !0,
72
73
  basename: a,
@@ -74,9 +75,9 @@ ${i(p, l)}` : `${d}${s}`;
74
75
  size: o
75
76
  } : {
76
77
  dir: !1,
77
- basename: v(s.name),
78
+ basename: y(s.name),
78
79
  uri: s.name,
79
- encodingFormat: w(s.name),
80
+ encodingFormat: b(s.name),
80
81
  blob: () => s.async("blob"),
81
82
  string: () => s.async("string"),
82
83
  ...s.internalStream && {
@@ -89,29 +90,29 @@ ${i(p, l)}` : `${d}${s}`;
89
90
  }),
90
91
  close: () => Promise.resolve()
91
92
  };
92
- if (u.log("Generated archive", t), process.env.NODE_ENV === "development" && u.isEnabled()) {
93
- const s = xe(r.map((o) => o.name));
94
- u.groupCollapsed(...u.getGroupArgs("Archive folder structure")), u.log(`
95
- ${s}`), u.groupEnd();
93
+ if (p.log("Generated archive", e), process.env.NODE_ENV === "development" && p.isEnabled()) {
94
+ const s = Ae(r.map((o) => o.name));
95
+ p.groupCollapsed(...p.getGroupArgs("Archive folder structure")), p.log(`
96
+ ${s}`), p.groupEnd();
96
97
  }
97
- return t;
98
- }, ht = async (e, { name: n } = {}) => {
99
- const i = await e.getFilesArray(), r = {
100
- close: () => e.close(),
101
- filename: n ?? "",
102
- records: i.map((t) => ({
98
+ return e;
99
+ }, vt = async (n, { name: t } = {}) => {
100
+ const i = await n.getFilesArray(), r = {
101
+ close: () => n.close(),
102
+ filename: t ?? "",
103
+ records: i.map((e) => ({
103
104
  dir: !1,
104
- basename: t.file.name,
105
- encodingFormat: w(t.file.name),
106
- size: t.file.size,
107
- uri: `${t.path}${t.file.name}`,
108
- blob: async () => await t.file.extract(),
109
- string: async () => (await t.file.extract()).text()
105
+ basename: e.file.name,
106
+ encodingFormat: b(e.file.name),
107
+ size: e.file.size,
108
+ uri: `${e.path}${e.file.name}`,
109
+ blob: async () => await e.file.extract(),
110
+ string: async () => (await e.file.extract()).text()
110
111
  }))
111
112
  };
112
- return u.log("Generated archive", r), r;
113
- }, gt = async (e, {
114
- mimeType: n,
113
+ return p.log("Generated archive", r), r;
114
+ }, wt = async (n, {
115
+ mimeType: t,
115
116
  direction: i
116
117
  } = { mimeType: "text/plain" }) => {
117
118
  const r = `
@@ -135,7 +136,7 @@ ${s}`), u.groupEnd();
135
136
  records: [
136
137
  {
137
138
  dir: !1,
138
- basename: v("generated.opf"),
139
+ basename: y("generated.opf"),
139
140
  uri: "generated.opf",
140
141
  blob: async () => new Blob([r]),
141
142
  string: async () => r,
@@ -143,40 +144,40 @@ ${s}`), u.groupEnd();
143
144
  },
144
145
  {
145
146
  dir: !1,
146
- basename: v("p01.txt"),
147
+ basename: y("p01.txt"),
147
148
  uri: "p01.txt",
148
- blob: async () => typeof e == "string" ? new Blob([e]) : e,
149
- string: async () => typeof e == "string" ? e : e.text(),
150
- size: typeof e == "string" ? e.length : e.size,
151
- encodingFormat: n
149
+ blob: async () => typeof n == "string" ? new Blob([n]) : n,
150
+ string: async () => typeof n == "string" ? n : n.text(),
151
+ size: typeof n == "string" ? n.length : n.size,
152
+ encodingFormat: t
152
153
  }
153
154
  ],
154
155
  close: () => Promise.resolve()
155
156
  };
156
- }, yt = async (e, n) => {
157
+ }, $t = async (n, t) => {
157
158
  const i = `
158
159
  <?xml version="1.0" encoding="UTF-8"?><package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="bookid">
159
160
  <metadata>
160
- <meta property="rendition:layout">${n?.useRenditionFlow ? "reflowable" : "pre-paginated"}</meta>
161
- ${n?.useRenditionFlow ? '<meta property="rendition:flow">scrolled-continuous</meta>' : ""}
161
+ <meta property="rendition:layout">${t?.useRenditionFlow ? "reflowable" : "pre-paginated"}</meta>
162
+ ${t?.useRenditionFlow ? '<meta property="rendition:flow">scrolled-continuous</meta>' : ""}
162
163
  </metadata>
163
164
  <manifest>
164
- ${e.map(
165
- (s) => `<item id="${v(s)}" href="${s}" media-type="${w(s)}"/>`
165
+ ${n.map(
166
+ (s) => `<item id="${y(s)}" href="${s}" media-type="${b(s)}"/>`
166
167
  ).join(`
167
168
  `)}
168
169
  </manifest>
169
170
  <spine>
170
- ${e.map((s) => `<itemref idref="${v(s)}" />`).join(`
171
+ ${n.map((s) => `<itemref idref="${y(s)}" />`).join(`
171
172
  `)}
172
173
  </spine>
173
174
  </package>
174
- `, r = e.map((s) => ({
175
+ `, r = n.map((s) => ({
175
176
  dir: !1,
176
- basename: v(s),
177
- encodingFormat: w(s),
177
+ basename: y(s),
178
+ encodingFormat: b(s),
178
179
  uri: s,
179
- size: 100 / e.length,
180
+ size: 100 / n.length,
180
181
  blob: async () => (await fetch(s)).blob(),
181
182
  string: async () => ""
182
183
  }));
@@ -192,72 +193,93 @@ ${s}`), u.groupEnd();
192
193
  }, ...r],
193
194
  close: () => Promise.resolve()
194
195
  };
195
- }, bt = ({
196
- enableReport: e
196
+ }, Ft = ({
197
+ enableReport: n
197
198
  } = {}) => {
198
- u.enable(!!e);
199
- }, A = (e) => {
200
- const i = Object.values(e.records).filter(
199
+ p.enable(!!n);
200
+ }, P = (n) => {
201
+ const i = Object.values(n.records).filter(
201
202
  (r) => !r.dir
202
203
  ).find((r) => r.uri.endsWith(".opf"));
203
204
  return {
204
205
  data: i,
205
206
  basePath: i?.uri.substring(0, i.uri.lastIndexOf("/")) || ""
206
207
  };
207
- }, Fe = ({ archive: e }) => async (n) => {
208
- const i = e.records.find(
209
- (t) => t.basename.toLowerCase() === "com.apple.ibooks.display-options.xml"
208
+ };
209
+ async function K(n) {
210
+ const { data: t, basePath: i } = P(n) || {};
211
+ if (!t || t.dir)
212
+ return;
213
+ const r = await t.string();
214
+ return {
215
+ opf: re(r),
216
+ basePath: i
217
+ };
218
+ }
219
+ const xe = X.toLowerCase(), Le = ({ archive: n }) => async (t) => {
220
+ const i = n.records.find(
221
+ (e) => !e.dir && e.basename.toLowerCase() === xe
210
222
  );
211
223
  if (!i || i.dir)
212
- return n;
213
- const r = await (await i.blob()).text();
224
+ return t;
225
+ const r = await i.string();
214
226
  try {
215
- const o = new y(r).childNamed("platform")?.childrenNamed("option")?.find((a) => a.attr.name === "fixed-layout")?.val || "false";
227
+ const e = se(r), { renditionLayout: s } = T(e);
216
228
  return {
217
- ...n,
218
- renditionLayout: o === "true" ? "pre-paginated" : n.renditionLayout
229
+ ...t,
230
+ renditionLayout: t.renditionLayout ?? s
219
231
  };
220
- } catch (t) {
232
+ } catch (e) {
221
233
  return console.error(
222
- `Unable to parse com.apple.ibooks.display-options.xml for content
234
+ `Unable to parse ${X} for content
223
235
  `,
224
236
  r
225
- ), console.error(t), n;
237
+ ), console.error(e), t;
226
238
  }
227
- }, Ae = async (e) => {
228
- const n = {
229
- renditionLayout: void 0
230
- };
231
- return await Promise.all(
232
- e.records.map(async (i) => {
233
- if (i.uri.endsWith("com.kobobooks.display-options.xml") && !i.dir) {
234
- const t = new y(await i.string()).childNamed("platform")?.childNamed("option");
235
- t?.attr?.name === "fixed-layout" && t.val === "true" && (n.renditionLayout = "pre-paginated");
236
- }
237
- })
238
- ), n;
239
- }, Te = ({ archive: e }) => async (n) => {
240
- const i = await Ae(e);
241
- return {
242
- ...n,
243
- renditionLayout: n.renditionLayout ?? i.renditionLayout
244
- };
245
- }, Ee = ({ archive: e, baseUrl: n }) => async () => {
246
- const i = Object.values(e.records).filter((r) => !r.dir);
239
+ }, U = G.toLowerCase(), Te = ({ archive: n }) => async (t) => {
240
+ const i = n.records.find(
241
+ (s) => s.basename.toLowerCase() === U && !s.dir
242
+ );
243
+ if (!i || i.dir)
244
+ return t;
245
+ const r = {
246
+ ...t,
247
+ spineItems: t.spineItems.filter(
248
+ (s) => !s.id.toLowerCase().endsWith(U)
249
+ ).map((s, o, a) => ({
250
+ ...s,
251
+ progressionWeight: 1 / a.length
252
+ }))
253
+ }, e = await i.string();
254
+ try {
255
+ const s = ie(e), o = T(s);
256
+ return {
257
+ ...r,
258
+ readingDirection: o.readingDirection ?? "ltr"
259
+ };
260
+ } catch (s) {
261
+ return console.error(
262
+ `Unable to parse ${G} for content
263
+ `,
264
+ e
265
+ ), console.error(s), r;
266
+ }
267
+ }, Ie = ({ archive: n, baseUrl: t }) => async () => {
268
+ const i = Object.values(n.records).filter((r) => !r.dir);
247
269
  return {
248
- filename: e.filename,
249
- title: e.records.find(({ dir: r }) => r)?.basename.replace(/\/$/, "") || e.filename,
270
+ filename: n.filename,
271
+ title: n.records.find(({ dir: r }) => r)?.basename.replace(/\/$/, "") || n.filename,
250
272
  renditionLayout: void 0,
251
273
  renditionSpread: "auto",
252
274
  readingDirection: "ltr",
253
- spineItems: i.filter((r) => !r.basename.endsWith(".db")).map((r, t) => {
254
- const s = n || (/^https?:\/\//.test(r.uri) ? "" : "file://");
275
+ spineItems: i.filter((r) => !r.basename.endsWith(".db")).map((r, e) => {
276
+ const s = t || (/^https?:\/\//.test(r.uri) ? "" : "file://");
255
277
  return {
256
278
  // some books such as cbz can have same basename inside different sub folder
257
279
  // we need to make sure to have unique index
258
280
  // /chap01/01.png, /chap02/01.png, etc
259
- id: `${t}.${r.basename}`,
260
- index: t,
281
+ id: `${e}.${r.basename}`,
282
+ index: e,
261
283
  href: encodeURI(`${s}${r.uri}`),
262
284
  renditionLayout: void 0,
263
285
  progressionWeight: 1 / i.length,
@@ -266,280 +288,290 @@ ${s}`), u.groupEnd();
266
288
  mediaType: r.encodingFormat
267
289
  };
268
290
  }),
269
- items: i.map((r, t) => ({
270
- id: `${t}.${r.basename}`,
271
- href: encodeURI(`${n}${r.uri}`)
291
+ items: i.map((r, e) => ({
292
+ id: `${e}.${r.basename}`,
293
+ href: encodeURI(`${t}${r.uri}`)
272
294
  }))
273
295
  };
274
- }, K = async ({
275
- archive: e
296
+ }, q = async ({
297
+ archive: n,
298
+ archiveOpf: t
276
299
  }) => {
277
- const { data: n, basePath: i } = A(e) || {}, r = await n?.string();
278
- if (!r) return [];
279
- const t = new y(r), s = t.childNamed("manifest"), a = t.childNamed("spine")?.childrenNamed("itemref").map((l) => l.attr.idref), c = s?.childrenNamed("item").filter((l) => a.includes(l.attr.id || "")) || [];
280
- return e.records.filter((l) => c.find((p) => i ? `${i}/${p.attr.href}` === l.uri : `${p.attr.href}` === l.uri));
281
- }, Re = (e) => {
282
- const n = e.attr.properties?.split(" ") || [];
283
- let i;
284
- return n.find((r) => r === "rendition:layout-reflowable") && (i = "reflowable"), n.find((r) => r === "rendition:layout-pre-paginated") && (i = "pre-paginated"), {
285
- renditionLayout: i,
286
- pageSpreadLeft: n.some((r) => r === "page-spread-left") || void 0,
287
- pageSpreadRight: n.some((r) => r === "page-spread-right") || void 0
288
- };
289
- }, Ie = (e, n, i) => {
290
- const r = e.attr.href || "", t = i?.(e);
291
- return {
292
- href: n ? `${t}${n}/${r}` : `${t}${r}`,
293
- id: e.attr.id || "",
294
- mediaType: e.attr["media-type"]
295
- };
296
- }, Y = (e, n, i) => {
297
- const r = e.childNamed("manifest"), { basePath: t } = A(n) || {};
298
- return r?.childrenNamed("item")?.map((s) => Ie(s, t, i)) || [];
299
- }, Ne = ({ archive: e, baseUrl: n }) => async (i) => {
300
- const { data: r, basePath: t } = A(e) || {};
301
- if (!r)
302
- return i;
303
- const s = await r.string();
304
- u.groupCollapsed(...u.getGroupArgs("OPF data")), u.log("data", s), u.groupEnd();
305
- const o = new y(s), a = o.childNamed("metadata"), c = o.childNamed("manifest"), d = o.childNamed("spine"), l = o.childNamed("guide"), p = a?.childNamed("dc:title"), g = a?.childrenNamed("meta") || [], b = g.find(
306
- (m) => m.attr.property === "rendition:layout"
307
- ), T = g.find(
308
- (m) => m.attr.property === "rendition:flow"
309
- ), f = g.find(
310
- (m) => m.attr.property === "rendition:spread"
311
- ), S = b?.val, h = T?.val, F = f?.val, L = p?.val || e.records.find(({ dir: m }) => m)?.basename || "", te = d?.attr["page-progression-direction"], ne = (await K({ archive: e })).reduce(
312
- (m, E) => E.size + m,
300
+ if (!t) return [];
301
+ const { opf: i, basePath: r } = t, { spineRows: e } = i;
302
+ return n.records.filter((o) => e.find((a) => r ? `${r}/${a.href}` === o.uri : `${a.href}` === o.uri));
303
+ }, J = (n, t, i) => {
304
+ const { basePath: r } = P(t) || {};
305
+ return n.map((e) => {
306
+ const s = e.href, o = i?.(s) ?? "";
307
+ return {
308
+ href: r ? `${o}${r}/${s}` : `${o}${s}`,
309
+ id: e.id,
310
+ mediaType: e.mediaType
311
+ };
312
+ });
313
+ }, Se = (n) => {
314
+ const t = n?.trim();
315
+ return t === "scrolled-continuous" || t === "scrolled-doc" || t === "paginated" || t === "auto" ? t : "auto";
316
+ }, Re = (n) => {
317
+ const t = n?.trim();
318
+ if (t === "none" || t === "landscape" || t === "portrait" || t === "both" || t === "auto")
319
+ return t;
320
+ }, Ce = (n) => {
321
+ const t = n?.trim();
322
+ if (t === "cover" || t === "title-page" || t === "copyright-page" || t === "text")
323
+ return t;
324
+ }, Ee = ({
325
+ archive: n,
326
+ baseUrl: t,
327
+ archiveOpf: i
328
+ }) => async (r) => {
329
+ if (!i)
330
+ return r;
331
+ const { opf: e, basePath: s } = i, o = T(e);
332
+ p.groupCollapsed(...p.getGroupArgs("OPF parsed")), p.log("opf", e), p.groupEnd();
333
+ const a = e.renditionLayoutMeta?.trim(), c = a === "reflowable" || a === "pre-paginated" ? a : o.renditionLayout, l = e.title?.trim() || n.records.find(({ dir: d }) => d)?.basename || "", u = o.readingDirection ?? "ltr", h = (await q({
334
+ archive: n,
335
+ archiveOpf: i
336
+ })).reduce(
337
+ (d, w) => w.size + d,
313
338
  0
314
- );
339
+ ), g = e.guide, v = [];
340
+ for (const d of g) {
341
+ const w = Ce(d.type);
342
+ w !== void 0 && v.push({ href: d.href, title: d.title, type: w });
343
+ }
315
344
  return {
316
- filename: e.filename,
317
- renditionLayout: S,
318
- renditionFlow: h || "auto",
319
- renditionSpread: F,
320
- title: L,
321
- readingDirection: te || "ltr",
345
+ filename: n.filename,
346
+ renditionLayout: c,
347
+ renditionFlow: Se(e.renditionFlowMeta),
348
+ renditionSpread: Re(e.renditionSpreadMeta),
349
+ title: l,
350
+ readingDirection: u,
322
351
  /**
323
352
  * @see https://www.w3.org/TR/epub/#sec-itemref-elem
324
353
  */
325
- spineItems: d?.childrenNamed("itemref").map((m, E) => {
326
- const $ = c?.childrenNamed("item").find((k) => k.attr.id === m?.attr.idref), O = $?.attr.href || "", re = e.records.find((k) => k.uri.endsWith(O))?.size || 0, B = n || (/^https?:\/\//.test(O) ? "" : "file://"), D = Re(m);
354
+ spineItems: e.spineRows.map((d, w) => {
355
+ const m = n.records.find((S) => S.uri.endsWith(d.href))?.size || 0, $ = t || (/^https?:\/\//.test(d.href) ? "" : "file://");
327
356
  return {
328
- ...D,
329
- id: $?.attr.id || "",
330
- index: E,
331
- href: $?.attr.href?.startsWith("https://") ? $?.attr.href : t ? `${B}${t}/${$?.attr.href}` : `${B}${$?.attr.href}`,
332
- renditionLayout: D.renditionLayout ?? S,
333
- progressionWeight: re / ne,
334
- // size: itemSize
335
- mediaType: $?.attr["media-type"]
357
+ id: d.id,
358
+ index: w,
359
+ href: d.href.startsWith("https://") ? d.href : s ? `${$}${s}/${d.href}` : `${$}${d.href}`,
360
+ renditionLayout: d.renditionLayout ?? c,
361
+ progressionWeight: m / h,
362
+ pageSpreadLeft: d.pageSpreadLeft,
363
+ pageSpreadRight: d.pageSpreadRight,
364
+ mediaType: d.mediaType
336
365
  };
337
- }) || [],
338
- items: Y(o, e, (m) => {
339
- const E = m.attr.href || "";
340
- return /^https?:\/\//.test(E) ? "" : n || "file://";
341
366
  }),
342
- guide: l?.childrenNamed("reference").map((m) => ({
343
- href: m.attr.href || "",
344
- title: m.attr.title || "",
345
- type: m.attr.type
346
- }))
367
+ items: J(e.manifestItems, n, (d) => /^https?:\/\//.test(d) ? "" : t || "file://"),
368
+ guide: v.length > 0 ? v : void 0
347
369
  };
348
- }, Se = (e) => {
349
- const n = e.descendantWithPath("head")?.childrenNamed("meta").find((i) => i.attr.name === "viewport");
350
- return !!(n && n.attr.name === "viewport");
351
- }, Le = (e) => e.reduce(async (n, i) => {
352
- if (!await n || !ie({
370
+ }, ke = (n) => {
371
+ const t = n.descendantWithPath("head")?.childrenNamed("meta").find((i) => i.attr.name === "viewport");
372
+ return !!(t && t.attr.name === "viewport");
373
+ }, We = (n) => n.reduce(async (t, i) => {
374
+ if (!await t || !te({
353
375
  mimeType: i.encodingFormat,
354
376
  uri: i.uri
355
377
  }))
356
378
  return !1;
357
- const t = i.dir ? null : await i.string();
358
- return t ? Se(new y(t)) : !1;
359
- }, Promise.resolve(!0)), ke = ({ archive: e }) => async (n) => {
360
- if (n.renditionLayout === "reflowable" && n.spineItems.every((r) => r.renditionLayout === "reflowable")) {
361
- const r = await K({ archive: e });
362
- if (await Le(r))
379
+ const e = i.dir ? null : await i.string();
380
+ return e ? ke(new I(e)) : !1;
381
+ }, Promise.resolve(!0)), Pe = ({
382
+ archive: n,
383
+ archiveOpf: t
384
+ }) => async (i) => {
385
+ if (i.renditionLayout === "reflowable" && i.spineItems.every((e) => e.renditionLayout === "reflowable")) {
386
+ const e = await q({
387
+ archive: n,
388
+ archiveOpf: t
389
+ });
390
+ if (await We(e))
363
391
  return {
364
- ...n,
365
- spineItems: n.spineItems.map((s) => ({
366
- ...s,
392
+ ...i,
393
+ spineItems: i.spineItems.map((o) => ({
394
+ ...o,
367
395
  renditionLayout: "pre-paginated"
368
396
  })),
369
397
  renditionLayout: "pre-paginated"
370
398
  };
371
399
  }
372
- return n;
373
- }, We = ({ archive: e }) => async (n) => {
374
- const i = e.records.find(
375
- (s) => s.basename.toLowerCase() === "comicinfo.xml" && !s.dir
376
- );
377
- if (!i || i.dir)
378
- return n;
379
- const r = {
380
- ...n,
381
- spineItems: n.spineItems.filter((s) => !s.id.toLowerCase().endsWith("comicinfo.xml")).map((s, o, a) => ({
382
- ...s,
383
- progressionWeight: 1 / a.length
384
- }))
385
- }, t = await i.string();
386
- try {
387
- const o = new y(t).childNamed("Manga")?.val || "unknown";
388
- return {
389
- ...r,
390
- readingDirection: o === "YesAndRightToLeft" ? "rtl" : "ltr"
391
- };
392
- } catch (s) {
393
- return console.error(`Unable to parse comicinfo.xml for content
394
- `, t), console.error(s), r;
395
- }
396
- }, Ce = (e) => e.records.some((n) => n.basename.endsWith(".opf")), Pe = ({ archive: e }) => async (n) => Ce(e) ? n : {
397
- ...n,
398
- spineItems: n.spineItems.map((r) => {
399
- const t = e.records.find(
400
+ return i;
401
+ }, Ne = async (n) => {
402
+ let t;
403
+ return await Promise.all(
404
+ n.records.map(async (i) => {
405
+ if (i.dir || !i.uri.endsWith(N)) return;
406
+ const r = await i.string();
407
+ try {
408
+ const { renditionLayout: e } = oe(r);
409
+ e && (t = e);
410
+ } catch (e) {
411
+ console.error(
412
+ `Unable to parse ${N} for content
413
+ `,
414
+ r
415
+ ), console.error(e);
416
+ }
417
+ })
418
+ ), {
419
+ kind: "kobo",
420
+ ...t !== void 0 ? { renditionLayout: t } : {}
421
+ };
422
+ }, Oe = ({ archive: n }) => async (t) => {
423
+ const i = await Ne(n), { renditionLayout: r } = T(i);
424
+ return {
425
+ ...t,
426
+ renditionLayout: t.renditionLayout ?? r
427
+ };
428
+ }, ze = (n) => n.records.some((t) => t.basename.endsWith(".opf")), Me = ({ archive: n }) => async (t) => ze(n) ? t : {
429
+ ...t,
430
+ spineItems: t.spineItems.map((r) => {
431
+ const e = n.records.find(
400
432
  (o) => decodeURI(r.href).endsWith(o.uri)
401
- ), s = q(t?.encodingFormat ?? "") || w(t?.basename ?? "");
433
+ ), s = V(e?.encodingFormat ?? "") || b(e?.basename ?? "");
402
434
  return {
403
435
  ...r,
404
- renditionLayout: s && oe(s) ? "pre-paginated" : r.renditionLayout
436
+ renditionLayout: s && ne(s) ? "pre-paginated" : r.renditionLayout
405
437
  };
406
438
  })
407
- }, Q = (e) => e ? e.children.map((n) => n instanceof ae ? n.text : n instanceof ce ? Q(n) : "").join("").trim() : "", Z = (e, { basePath: n, baseUrl: i }) => {
439
+ }, Y = (n) => n ? n.children.map((t) => t instanceof ce ? t.text : t instanceof de ? Y(t) : "").join("").trim() : "", Be = (n) => ae(n.properties).includes("nav"), Q = (n, { basePath: t, baseUrl: i }) => {
408
440
  const r = {
409
441
  contents: [],
410
442
  path: "",
411
443
  href: "",
412
444
  title: ""
413
445
  };
414
- let t = e.childNamed("span") || e.childNamed("a");
415
- r.title = (t?.attr.title || t?.val.trim() || Q(t)) ?? "";
416
- let s = t?.name;
417
- s !== "a" && (t = e.descendantWithPath(`${s}.a`), t && (s = t.name.toLowerCase())), s === "a" && t?.attr.href && (r.path = N(n, t.attr.href), r.href = N(i, n, t.attr.href));
418
- const o = e.childNamed("ol");
446
+ let e = n.childNamed("span") || n.childNamed("a");
447
+ r.title = (e?.attr.title || e?.val.trim() || Y(e)) ?? "";
448
+ let s = e?.name;
449
+ s !== "a" && (e = n.descendantWithPath(`${s}.a`), e && (s = e.name.toLowerCase())), s === "a" && e?.attr.href && (r.path = L(t, e.attr.href), r.href = L(i, t, e.attr.href));
450
+ const o = n.childNamed("ol");
419
451
  if (o) {
420
452
  const a = o.childrenNamed("li");
421
453
  a && a.length > 0 && (r.contents = a.map(
422
- (c) => Z(c, { basePath: n, baseUrl: i })
454
+ (c) => Q(c, { basePath: t, baseUrl: i })
423
455
  ));
424
456
  }
425
457
  return r;
426
- }, ze = (e, { basePath: n, baseUrl: i }) => {
458
+ }, je = (n, { basePath: t, baseUrl: i }) => {
427
459
  const r = [];
428
- let t;
429
- return e.descendantWithPath("body.nav.ol") ? t = e.descendantWithPath("body.nav.ol")?.children : e.descendantWithPath("body.section.nav.ol") && (t = e.descendantWithPath("body.section.nav.ol")?.children), t && t.length > 0 && t.filter((s) => s.name === "li").forEach((s) => {
430
- r.push(Z(s, { basePath: n, baseUrl: i }));
460
+ let e;
461
+ return n.descendantWithPath("body.nav.ol") ? e = n.descendantWithPath("body.nav.ol")?.children : n.descendantWithPath("body.section.nav.ol") && (e = n.descendantWithPath("body.section.nav.ol")?.children), e && e.length > 0 && e.filter((s) => s.name === "li").forEach((s) => {
462
+ r.push(Q(s, { basePath: t, baseUrl: i }));
431
463
  }), r;
432
- }, je = async (e, n, { baseUrl: i }) => {
433
- const r = e.childNamed("manifest")?.childrenNamed("item").find((t) => t.attr.properties === "nav");
434
- if (r) {
435
- const t = Object.values(n.records).find(
436
- (s) => s.uri.endsWith(r.attr.href || "")
464
+ }, Ue = async (n, t, { baseUrl: i }) => {
465
+ const r = n.manifestItems.find(Be);
466
+ if (r?.href) {
467
+ const e = Object.values(t.records).find(
468
+ (s) => s.uri.endsWith(r.href)
437
469
  );
438
- if (t && !t.dir) {
439
- const s = new y(await t.string()), o = we(t.uri);
440
- return ze(s, { basePath: o, baseUrl: i });
470
+ if (e && !e.dir) {
471
+ const s = new I(await e.string()), o = $e(e.uri);
472
+ return je(s, { basePath: o, baseUrl: i });
441
473
  }
442
474
  }
443
- }, ee = (e, {
444
- opfBasePath: n,
475
+ }, Z = (n, {
476
+ opfBasePath: t,
445
477
  baseUrl: i,
446
478
  prefix: r
447
479
  }) => {
448
- const t = e?.childNamed(`${r}content`)?.attr.src || "", s = {
449
- title: e?.descendantWithPath(`${r}navLabel.${r}text`)?.val || "",
450
- path: N(n, t),
451
- href: N(i, n, t),
480
+ const e = n?.childNamed(`${r}content`)?.attr.src || "", s = {
481
+ title: n?.descendantWithPath(`${r}navLabel.${r}text`)?.val || "",
482
+ path: L(t, e),
483
+ href: L(i, t, e),
452
484
  contents: []
453
- }, o = e.childrenNamed(`${r}navPoint`);
485
+ }, o = n.childrenNamed(`${r}navPoint`);
454
486
  return o && o.length > 0 && (s.contents = o.map(
455
- (a) => ee(a, { opfBasePath: n, baseUrl: i, prefix: r })
487
+ (a) => Z(a, { opfBasePath: t, baseUrl: i, prefix: r })
456
488
  )), s;
457
- }, Oe = (e, { opfBasePath: n, baseUrl: i }) => {
458
- const r = [], t = e.name;
489
+ }, De = (n, { opfBasePath: t, baseUrl: i }) => {
490
+ const r = [], e = n.name;
459
491
  let s = "";
460
- return t.indexOf(":") !== -1 && (s = `${t.split(":")[0]}:`), e.childNamed(`${s}navMap`)?.childrenNamed(`${s}navPoint`).forEach((o) => {
461
- r.push(ee(o, { opfBasePath: n, baseUrl: i, prefix: s }));
492
+ return e.indexOf(":") !== -1 && (s = `${e.split(":")[0]}:`), n.childNamed(`${s}navMap`)?.childrenNamed(`${s}navPoint`).forEach((o) => {
493
+ r.push(Z(o, { opfBasePath: t, baseUrl: i, prefix: s }));
462
494
  }), r;
463
- }, Be = async ({
464
- opfData: e,
465
- opfBasePath: n,
495
+ }, _e = async ({
496
+ opf: n,
497
+ opfBasePath: t,
466
498
  baseUrl: i,
467
499
  archive: r
468
500
  }) => {
469
- const s = e.childNamed("spine")?.attr.toc;
470
- if (s) {
471
- const o = e.childNamed("manifest")?.childrenNamed("item").find((a) => a.attr.id === s);
472
- if (o) {
473
- const a = `${n}${n === "" ? "" : "/"}${o.attr.href}`, c = Object.values(r.records).find(
474
- (d) => d.uri.endsWith(a)
501
+ const e = n.spineTocIdref;
502
+ if (e) {
503
+ const s = n.manifestItems.find((o) => o.id === e);
504
+ if (s) {
505
+ const o = `${t}${t === "" ? "" : "/"}${s.href}`, a = Object.values(r.records).find(
506
+ (c) => c.uri.endsWith(o)
475
507
  );
476
- if (c && !c.dir) {
477
- const d = new y(await c.string());
478
- return Oe(d, { opfBasePath: n, baseUrl: i });
508
+ if (a && !a.dir) {
509
+ const c = new I(await a.string());
510
+ return De(c, { opfBasePath: t, baseUrl: i });
479
511
  }
480
512
  }
481
513
  }
482
- }, De = async (e, n, { baseUrl: i }) => {
483
- const { basePath: r } = A(n) || {}, t = await je(e, n, {
514
+ }, Ve = async (n, t, { baseUrl: i }) => {
515
+ const { basePath: r } = P(t) || {}, e = await Ue(n, t, {
484
516
  baseUrl: i
485
517
  });
486
- if (t)
487
- return t;
488
- const s = await Be({
489
- opfData: e,
490
- opfBasePath: r,
491
- archive: n,
518
+ if (e)
519
+ return e;
520
+ const s = await _e({
521
+ opf: n,
522
+ opfBasePath: r ?? "",
523
+ archive: t,
492
524
  baseUrl: i
493
525
  });
494
526
  if (s)
495
527
  return s;
496
- }, Me = (e) => e.replace(/\.[^.]+$/, "").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim(), Ue = (e, n) => {
497
- if (!(e.spineItems.length === 0 || !e.spineItems.every((r) => (q(r.mediaType ?? "") || w(r.href))?.startsWith("audio/"))))
498
- return e.spineItems.map((r) => {
499
- const t = n.records.find(
528
+ }, Xe = (n) => n.replace(/\.[^.]+$/, "").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim(), Ge = (n, t) => {
529
+ if (!(n.spineItems.length === 0 || !n.spineItems.every((r) => (V(r.mediaType ?? "") || b(r.href))?.startsWith("audio/"))))
530
+ return n.spineItems.map((r) => {
531
+ const e = t.records.find(
500
532
  (s) => !s.dir && decodeURI(r.href).endsWith(s.uri)
501
533
  );
502
534
  return {
503
- title: Me(t?.basename ?? r.href),
535
+ title: Xe(e?.basename ?? r.href),
504
536
  href: r.href,
505
- path: t?.uri ?? r.href,
537
+ path: e?.uri ?? r.href,
506
538
  contents: []
507
539
  };
508
540
  });
509
- }, Ve = (e, { baseUrl: n }) => {
510
- const i = [...e.records].sort(
511
- (t, s) => j(t.uri, s.uri)
512
- ), r = (t, s, o, a, c) => {
513
- const d = t.find((g) => g.title === s), [l, ...p] = o;
514
- return d ? l ? [
515
- ...t.filter((b) => b !== d),
541
+ }, He = (n, { baseUrl: t }) => {
542
+ const i = [...n.records].sort(
543
+ (e, s) => W(e.uri, s.uri)
544
+ ), r = (e, s, o, a, c) => {
545
+ const l = e.find((h) => h.title === s), [u, ...f] = o;
546
+ return l ? u ? [
547
+ ...e.filter((g) => g !== l),
516
548
  {
517
- ...d,
549
+ ...l,
518
550
  contents: [
519
- ...d.contents,
551
+ ...l.contents,
520
552
  ...r(
521
- d.contents,
522
- l,
523
- p,
553
+ l.contents,
554
+ u,
555
+ f,
524
556
  a,
525
557
  c
526
558
  )
527
559
  ]
528
560
  }
529
- ] : d.path.split("/").length > c.split("/").length ? [
530
- ...t.filter((b) => b !== d),
561
+ ] : l.path.split("/").length > c.split("/").length ? [
562
+ ...e.filter((g) => g !== l),
531
563
  {
532
- ...d,
564
+ ...l,
533
565
  path: c,
534
566
  href: a
535
567
  }
536
- ] : t : l ? [
537
- ...t,
568
+ ] : e : u ? [
569
+ ...e,
538
570
  {
539
571
  contents: r(
540
572
  [],
541
- l,
542
- p,
573
+ u,
574
+ f,
543
575
  a,
544
576
  c
545
577
  ),
@@ -548,7 +580,7 @@ ${s}`), u.groupEnd();
548
580
  title: s
549
581
  }
550
582
  ] : [
551
- ...t,
583
+ ...e,
552
584
  {
553
585
  contents: [],
554
586
  href: a,
@@ -557,67 +589,74 @@ ${s}`), u.groupEnd();
557
589
  }
558
590
  ];
559
591
  };
560
- return i.reduce((t, s) => {
561
- if (s.dir) return t;
592
+ return i.reduce((e, s) => {
593
+ if (s.dir) return e;
562
594
  const o = s.uri.split("/").slice(0, -1), [a, ...c] = o;
563
- if (!a) return t;
564
- const d = N(n, encodeURI(s.uri)).replace(/\/$/, ""), l = s.uri.replace(/\/$/, "");
565
- return r(t, a, c, d, l);
595
+ if (!a) return e;
596
+ const l = L(t, encodeURI(s.uri)).replace(/\/$/, ""), u = s.uri.replace(/\/$/, "");
597
+ return r(e, a, c, l, u);
566
598
  }, []);
567
- }, Xe = async (e, n, { baseUrl: i }) => {
568
- const { data: r } = A(e) || {};
569
- if (r && !r.dir) {
570
- const o = new y(await r.string());
571
- return await De(o, e, { baseUrl: i }) || [];
572
- }
573
- const t = Ue(n, e);
574
- if (t) return t;
575
- const s = Ve(e, { baseUrl: i });
599
+ }, Ke = async (n, t, {
600
+ baseUrl: i,
601
+ archiveOpf: r
602
+ }) => {
603
+ if (r)
604
+ return await Ve(r.opf, n, { baseUrl: i }) || [];
605
+ const e = Ge(t, n);
606
+ if (e) return e;
607
+ const s = He(n, { baseUrl: i });
576
608
  if (s.length !== 0)
577
609
  return s;
578
- }, _e = ({ archive: e, baseUrl: n }) => async (i) => {
579
- if (i.nav) return i;
580
- const r = await Xe(e, i, { baseUrl: n });
581
- return r ? {
582
- ...i,
610
+ }, qe = ({
611
+ archive: n,
612
+ baseUrl: t,
613
+ archiveOpf: i
614
+ }) => async (r) => {
615
+ if (r.nav) return r;
616
+ const e = await Ke(n, r, {
617
+ baseUrl: t,
618
+ archiveOpf: i
619
+ });
620
+ return e ? {
621
+ ...r,
583
622
  nav: {
584
- toc: r
623
+ toc: e
585
624
  }
586
- } : i;
587
- }, He = async (e, { baseUrl: n = "" } = {}) => {
588
- const i = [
589
- Ne({ archive: e, baseUrl: n }),
590
- We({ archive: e }),
591
- Fe({ archive: e }),
592
- Pe({ archive: e }),
593
- ke({ archive: e }),
594
- Te({ archive: e }),
595
- _e({ archive: e, baseUrl: n })
625
+ } : r;
626
+ }, Je = async (n, { baseUrl: t = "" } = {}) => {
627
+ const i = await K(n), r = [
628
+ Ee({ archive: n, baseUrl: t, archiveOpf: i }),
629
+ Te({ archive: n }),
630
+ Le({ archive: n }),
631
+ Me({ archive: n }),
632
+ Pe({ archive: n, archiveOpf: i }),
633
+ Oe({ archive: n }),
634
+ qe({ archive: n, baseUrl: t, archiveOpf: i })
596
635
  ];
597
636
  try {
598
- const r = Ee({ archive: e, baseUrl: n })(), t = await i.reduce(async (s, o) => await o(await s), r);
599
- if (u.log("Generated manifest", t), process.env.NODE_ENV === "development" && u.isEnabled()) {
600
- const s = JSON.stringify(t, null, 2);
601
- u.groupCollapsed(...u.getGroupArgs("Generated manifest")), u.log(`
602
- ${s}`), u.groupEnd();
637
+ const e = Ie({ archive: n, baseUrl: t })(), s = await r.reduce(async (o, a) => await a(await o), e);
638
+ if (p.log("Generated manifest", s), process.env.NODE_ENV === "development" && p.isEnabled()) {
639
+ const o = JSON.stringify(s, null, 2);
640
+ p.groupCollapsed(...p.getGroupArgs("Generated manifest")), p.log(`
641
+ ${o}`), p.groupEnd();
603
642
  }
604
- return t;
605
- } catch (r) {
606
- throw u.error(r), r;
643
+ return s;
644
+ } catch (e) {
645
+ throw p.error(e), e;
607
646
  }
608
- }, Ge = (e) => {
609
- const n = e.descendantWithPath("head")?.childrenNamed("meta").find((i) => i.attr.name === "calibre:cover");
610
- return !!(n && n.attr.name === "calibre:cover");
611
- }, qe = (e) => e.descendantWithPath("body")?.descendantWithPath("div")?.childrenNamed("svg")?.find(
612
- (n) => n.attr.width === "100%" && n.attr.preserveAspectRatio === "none"
613
- ), Je = ({ archive: e, resourcePath: n }) => async (i) => {
614
- const r = Object.values(e.records).find(
615
- (t) => t.uri === n && !t.dir
647
+ }, Ye = (n) => {
648
+ const t = n.descendantWithPath("head")?.childrenNamed("meta").find((i) => i.attr.name === "calibre:cover");
649
+ return !!(t && t.attr.name === "calibre:cover");
650
+ }, Qe = (n) => n.descendantWithPath("body")?.descendantWithPath("div")?.childrenNamed("svg")?.find(
651
+ (t) => t.attr.width === "100%" && t.attr.preserveAspectRatio === "none"
652
+ ), Ze = ({ archive: n, resourcePath: t }) => async (i) => {
653
+ const r = Object.values(n.records).find(
654
+ (e) => e.uri === t && !e.dir
616
655
  );
617
656
  if (r && !r.dir && r.basename.endsWith(".xhtml")) {
618
- const t = i.body ?? await r.string(), s = new y(t);
619
- if (Ge(s)) {
620
- const o = qe(s);
657
+ const e = i.body ?? await r.string(), s = new I(e);
658
+ if (Ye(s)) {
659
+ const o = Qe(s);
621
660
  return o && delete o.attr.preserveAspectRatio, {
622
661
  ...i,
623
662
  body: s?.toString()
@@ -625,9 +664,9 @@ ${s}`), u.groupEnd();
625
664
  }
626
665
  }
627
666
  return i;
628
- }, Ke = ({ archive: e, resourcePath: n }) => async (i) => Je({ archive: e, resourcePath: n })(i), Ye = ({ archive: e, resourcePath: n }) => async (i) => {
629
- const r = Object.values(e.records).find(
630
- (t) => t.uri === n && !t.dir
667
+ }, et = ({ archive: n, resourcePath: t }) => async (i) => Ze({ archive: n, resourcePath: t })(i), tt = ({ archive: n, resourcePath: t }) => async (i) => {
668
+ const r = Object.values(n.records).find(
669
+ (e) => e.uri === t && !e.dir
631
670
  );
632
671
  if (r && !r.dir && r.basename.endsWith(".css")) {
633
672
  const s = (i.body ?? await r.string()).replaceAll(
@@ -640,37 +679,37 @@ ${s}`), u.groupEnd();
640
679
  };
641
680
  }
642
681
  return i;
643
- }, Qe = async (e, n) => {
644
- const r = await A(e).data?.string();
645
- if (r) {
646
- const t = new y(r), s = Y(t, e, () => "");
647
- if (s.find(
648
- (a) => n.endsWith(a.href)
682
+ }, nt = async (n, t) => {
683
+ const i = await K(n);
684
+ if (i) {
685
+ const { opf: r } = i, e = J(r.manifestItems, n, () => "");
686
+ if (e.find(
687
+ (o) => t.endsWith(o.href)
649
688
  )?.mediaType)
650
689
  return {
651
- mediaType: s.find((a) => n.endsWith(a.href))?.mediaType
690
+ mediaType: e.find((o) => t.endsWith(o.href))?.mediaType
652
691
  };
653
692
  }
654
693
  return {
655
- mediaType: Ze(n)
694
+ mediaType: rt(t)
656
695
  };
657
- }, Ze = (e) => {
658
- if (e.endsWith(".css"))
696
+ }, rt = (n) => {
697
+ if (n.endsWith(".css"))
659
698
  return "text/css; charset=UTF-8";
660
- if (e.endsWith(".jpg"))
699
+ if (n.endsWith(".jpg"))
661
700
  return "image/jpg";
662
- if (e.endsWith(".xhtml"))
701
+ if (n.endsWith(".xhtml"))
663
702
  return "application/xhtml+xml";
664
- if (e.endsWith(".mp4"))
703
+ if (n.endsWith(".mp4"))
665
704
  return "video/mp4";
666
- if (e.endsWith(".svg"))
705
+ if (n.endsWith(".svg"))
667
706
  return "image/svg+xml";
668
- }, et = ({ archive: e, resourcePath: n }) => async (i) => {
669
- const r = Object.values(e.records).find(
670
- (s) => s.uri === n && !s.dir
707
+ }, st = ({ archive: n, resourcePath: t }) => async (i) => {
708
+ const r = Object.values(n.records).find(
709
+ (s) => s.uri === t && !s.dir
671
710
  );
672
711
  if (!r || r.dir) return i;
673
- const t = await Qe(e, n);
712
+ const e = await nt(n, t);
674
713
  return {
675
714
  ...i,
676
715
  params: {
@@ -678,12 +717,12 @@ ${s}`), u.groupEnd();
678
717
  ...r?.encodingFormat && {
679
718
  contentType: r.encodingFormat
680
719
  },
681
- ...t.mediaType && {
682
- contentType: t.mediaType
720
+ ...e.mediaType && {
721
+ contentType: e.mediaType
683
722
  }
684
723
  }
685
724
  };
686
- }, H = [
725
+ }, D = [
687
726
  "div",
688
727
  "span",
689
728
  "p",
@@ -734,23 +773,23 @@ ${s}`), u.groupEnd();
734
773
  "canvas",
735
774
  "script",
736
775
  "style"
737
- ], tt = ({ archive: e, resourcePath: n }) => async (i) => {
738
- const r = Object.values(e.records).find(
739
- (t) => t.uri === n && !t.dir
776
+ ], it = ({ archive: n, resourcePath: t }) => async (i) => {
777
+ const r = Object.values(n.records).find(
778
+ (e) => e.uri === t && !e.dir
740
779
  );
741
780
  if (r && !r.dir && r.basename.endsWith(".xhtml")) {
742
- const t = i.body ?? await r.string();
781
+ const e = i.body ?? await r.string();
743
782
  if (!new RegExp(
744
- `<(${H.join("|")})[\\s/>]`,
783
+ `<(${D.join("|")})[\\s/>]`,
745
784
  "i"
746
- ).test(t))
785
+ ).test(e))
747
786
  return i;
748
787
  const o = new RegExp(
749
- `<(${H.join("|")})(\\s[^>]*)?\\s*/>`,
788
+ `<(${D.join("|")})(\\s[^>]*)?\\s*/>`,
750
789
  "gi"
751
- ), a = t.replace(
790
+ ), a = e.replace(
752
791
  o,
753
- (c, d, l = "") => `<${d} ${l.trim()}></${d}>`
792
+ (c, l, u = "") => `<${l} ${u.trim()}></${l}>`
754
793
  );
755
794
  return {
756
795
  ...i,
@@ -758,177 +797,177 @@ ${s}`), u.groupEnd();
758
797
  };
759
798
  }
760
799
  return i;
761
- }, nt = async (e, n) => {
762
- const i = Object.values(e.records).find(
763
- (s) => s.uri === n && !s.dir
800
+ }, ot = async (n, t) => {
801
+ const i = Object.values(n.records).find(
802
+ (s) => s.uri === t && !s.dir
764
803
  );
765
804
  if (!i || i.dir)
766
- throw new Error(`no file found for resourcePath:${n}`);
805
+ throw new Error(`no file found for resourcePath:${t}`);
767
806
  const r = {
768
807
  params: {}
769
- }, t = [
770
- et({ archive: e, resourcePath: n }),
771
- tt({ archive: e, resourcePath: n }),
772
- Ye({ archive: e, resourcePath: n }),
773
- Ke({ archive: e, resourcePath: n })
808
+ }, e = [
809
+ st({ archive: n, resourcePath: t }),
810
+ it({ archive: n, resourcePath: t }),
811
+ tt({ archive: n, resourcePath: t }),
812
+ et({ archive: n, resourcePath: t })
774
813
  ];
775
814
  try {
776
- const s = await t.reduce(async (o, a) => await a(await o), Promise.resolve(r));
777
- return u.log("Generated resource", n, s), {
815
+ const s = await e.reduce(async (o, a) => await a(await o), Promise.resolve(r));
816
+ return p.log("Generated resource", t, s), {
778
817
  ...s,
779
818
  body: s.body ?? await i.blob()
780
819
  };
781
820
  } catch (s) {
782
- throw u.error(s), s;
821
+ throw p.error(s), s;
783
822
  }
784
823
  };
785
- class rt {
786
- constructor(n) {
787
- this.cleanArchiveAfter = n, this.state$ = new me({
824
+ class at {
825
+ constructor(t) {
826
+ this.cleanArchiveAfter = t, this.state$ = new me({
788
827
  status: "idle",
789
828
  locks: 0
790
829
  });
791
830
  }
792
- update(n) {
793
- this.state$.next({ ...this.state$.getValue(), ...n });
831
+ update(t) {
832
+ this.state$.next({ ...this.state$.getValue(), ...t });
794
833
  }
795
834
  get locks$() {
796
- return this.state$.pipe(x(({ locks: n }) => n));
835
+ return this.state$.pipe(F(({ locks: t }) => t));
797
836
  }
798
837
  get state() {
799
838
  return this.state$.getValue();
800
839
  }
801
840
  get isUnlocked$() {
802
841
  return this.locks$.pipe(
803
- x((n) => n <= 0),
804
- fe(),
805
- he()
842
+ F((t) => t <= 0),
843
+ he(),
844
+ ge()
806
845
  );
807
846
  }
808
847
  get overTTL$() {
809
848
  return this.isUnlocked$.pipe(
810
- I(
811
- (n) => n ? this.cleanArchiveAfter === 1 / 0 ? X : ge(this.cleanArchiveAfter) : X
849
+ x(
850
+ (t) => t ? this.cleanArchiveAfter === 1 / 0 ? B : ye(this.cleanArchiveAfter) : B
812
851
  )
813
852
  );
814
853
  }
815
854
  }
816
- const st = ({
817
- getArchive: e,
818
- cleanArchiveAfter: n = 300 * 1e3
855
+ const ct = ({
856
+ getArchive: n,
857
+ cleanArchiveAfter: t = 300 * 1e3
819
858
  // 5mn
820
859
  }) => {
821
- const i = new W(), r = new W(), t = new W(), s = {}, o = i.pipe(
822
- J((d) => {
823
- const l = s[d];
824
- if (!l || l.state.status !== "idle") return M;
825
- let p = !1;
826
- const g = (h) => {
827
- u.debug(`Cleaning up archive with key: ${h}`);
828
- const F = s[h];
829
- delete s[h], p || (F?.state.archive?.close(), p = !0);
860
+ const i = new R(), r = new R(), e = new R(), s = {}, o = i.pipe(
861
+ H((l) => {
862
+ const u = s[l];
863
+ if (!u || u.state.status !== "idle") return O;
864
+ let f = !1;
865
+ const h = (m) => {
866
+ p.debug(`Cleaning up archive with key: ${m}`);
867
+ const $ = s[m];
868
+ delete s[m], f || ($?.state.archive?.close(), f = !0);
830
869
  };
831
- l.update({
870
+ u.update({
832
871
  status: "loading"
833
872
  });
834
- const b = l.locks$, T = l.isUnlocked$, f = b.pipe(
835
- de(),
836
- C(([h, F]) => F > h),
837
- le(!0)
873
+ const g = u.locks$, v = u.isUnlocked$, d = g.pipe(
874
+ le(),
875
+ C(([m, $]) => $ > m),
876
+ ue(!0)
838
877
  );
839
- return R(e(d)).pipe(
840
- P((h) => {
841
- l.update({
842
- archive: h,
878
+ return A(n(l)).pipe(
879
+ E((m) => {
880
+ u.update({
881
+ archive: m,
843
882
  status: "success"
844
883
  });
845
884
  }),
846
- z((h) => (g(d), l.update({
885
+ k((m) => (h(l), u.update({
847
886
  status: "error",
848
- error: h
849
- }), M)),
850
- I(() => {
851
- const h = f.pipe(
852
- I(() => t),
853
- I(() => T),
854
- C((L) => L)
887
+ error: m
888
+ }), O)),
889
+ x(() => {
890
+ const m = d.pipe(
891
+ x(() => e),
892
+ x(() => v),
893
+ C((S) => S)
855
894
  );
856
- return U(h, l.overTTL$).pipe(
857
- V(),
858
- P(() => {
859
- g(d);
895
+ return z(m, u.overTTL$).pipe(
896
+ M(),
897
+ E(() => {
898
+ h(l);
860
899
  })
861
900
  );
862
901
  })
863
902
  );
864
903
  }),
865
904
  pe(r)
866
- ), a = (d) => {
867
- let l = !1;
868
- const p = s[d] ?? new rt(n);
869
- s[d] = p, p.update({
870
- locks: p.state.locks + 1
905
+ ), a = (l) => {
906
+ let u = !1;
907
+ const f = s[l] ?? new at(t);
908
+ s[l] = f, f.update({
909
+ locks: f.state.locks + 1
871
910
  });
872
- const g = () => {
873
- l || (l = !0, p.update({
874
- locks: p.state.locks - 1
911
+ const h = () => {
912
+ u || (u = !0, f.update({
913
+ locks: f.state.locks - 1
875
914
  }));
876
915
  };
877
- i.next(d);
878
- const b = p.state$.pipe(
879
- x(({ archive: f }) => f),
880
- C((f) => !!f)
881
- ), T = p.state$.pipe(
882
- P(({ error: f }) => {
883
- if (f)
884
- throw f;
916
+ i.next(l);
917
+ const g = f.state$.pipe(
918
+ F(({ archive: d }) => d),
919
+ C((d) => !!d)
920
+ ), v = f.state$.pipe(
921
+ E(({ error: d }) => {
922
+ if (d)
923
+ throw d;
885
924
  }),
886
- ue()
925
+ fe()
887
926
  );
888
- return U(b, T).pipe(
889
- V(),
890
- x((f) => ({ archive: f, release: g })),
891
- z((f) => {
892
- throw g(), f;
927
+ return z(g, v).pipe(
928
+ M(),
929
+ F((d) => ({ archive: d, release: h })),
930
+ k((d) => {
931
+ throw h(), d;
893
932
  })
894
933
  );
895
934
  }, c = () => {
896
- t.next();
935
+ e.next();
897
936
  };
898
937
  return o.subscribe(), {
899
938
  access: a,
900
939
  purge: c,
901
940
  _archives: s
902
941
  };
903
- }, G = (e) => e ? /^\d+$/.test(e) ? {
942
+ }, _ = (n) => n ? /^\d+$/.test(n) ? {
904
943
  valid: !0,
905
- value: Number.parseInt(e, 10)
944
+ value: Number.parseInt(n, 10)
906
945
  } : {
907
946
  valid: !1,
908
947
  value: void 0
909
948
  } : {
910
949
  valid: !0,
911
950
  value: void 0
912
- }, it = (e) => {
913
- if (!e.toLowerCase().startsWith("bytes="))
951
+ }, dt = (n) => {
952
+ if (!n.toLowerCase().startsWith("bytes="))
914
953
  return {
915
954
  kind: "missing"
916
955
  };
917
- const n = e.slice(6).trim();
918
- if (!n)
956
+ const t = n.slice(6).trim();
957
+ if (!t)
919
958
  return {
920
959
  kind: "invalid"
921
960
  };
922
- if (n.includes(","))
961
+ if (t.includes(","))
923
962
  return {
924
963
  kind: "multi"
925
964
  };
926
- const i = /^(\d*)-(\d*)$/.exec(n);
965
+ const i = /^(\d*)-(\d*)$/.exec(t);
927
966
  if (!i)
928
967
  return {
929
968
  kind: "invalid"
930
969
  };
931
- const [, r = "", t = ""] = i, s = G(r.trim()), o = G(t.trim());
970
+ const [, r = "", e = ""] = i, s = _(r.trim()), o = _(e.trim());
932
971
  return !s.valid || !o.valid ? {
933
972
  kind: "invalid"
934
973
  } : {
@@ -936,49 +975,49 @@ const st = ({
936
975
  start: s.value,
937
976
  end: o.value
938
977
  };
939
- }, ot = (e) => {
940
- if (e instanceof Blob)
978
+ }, lt = (n) => {
979
+ if (n instanceof Blob)
941
980
  return {
942
- size: e.size,
981
+ size: n.size,
943
982
  slice: (i, r) => {
944
- const t = e.slice(i, r);
945
- return { content: t, length: t.size };
983
+ const e = n.slice(i, r);
984
+ return { content: e, length: e.size };
946
985
  }
947
986
  };
948
- const n = new TextEncoder().encode(e);
987
+ const t = new TextEncoder().encode(n);
949
988
  return {
950
- size: n.byteLength,
989
+ size: t.byteLength,
951
990
  slice: (i, r) => {
952
- const t = n.slice(i, r);
953
- return { content: t, length: t.byteLength };
991
+ const e = t.slice(i, r);
992
+ return { content: e, length: e.byteLength };
954
993
  }
955
994
  };
956
- }, at = ({
957
- body: e,
958
- contentType: n,
995
+ }, ut = ({
996
+ body: n,
997
+ contentType: t,
959
998
  rangeHeader: i
960
999
  }) => {
961
1000
  const r = new Headers();
962
- if (n && r.set("Content-Type", n), r.set("Accept-Ranges", "bytes"), !i)
963
- return e instanceof Blob && r.set("Content-Length", String(e.size)), new Response(e, {
1001
+ if (t && r.set("Content-Type", t), r.set("Accept-Ranges", "bytes"), !i)
1002
+ return n instanceof Blob && r.set("Content-Length", String(n.size)), new Response(n, {
964
1003
  status: 200,
965
1004
  headers: r
966
1005
  });
967
- const t = it(i);
968
- if (t.kind === "missing" || t.kind === "multi")
969
- return e instanceof Blob && r.set("Content-Length", String(e.size)), new Response(e, {
1006
+ const e = dt(i);
1007
+ if (e.kind === "missing" || e.kind === "multi")
1008
+ return n instanceof Blob && r.set("Content-Length", String(n.size)), new Response(n, {
970
1009
  status: 200,
971
1010
  headers: r
972
1011
  });
973
- const s = ot(e), o = s.size;
974
- if (t.kind === "invalid")
1012
+ const s = lt(n), o = s.size;
1013
+ if (e.kind === "invalid")
975
1014
  return new Response(null, {
976
1015
  status: 416,
977
1016
  headers: {
978
1017
  "Content-Range": `bytes */${o}`
979
1018
  }
980
1019
  });
981
- let a = t.start, c = t.end;
1020
+ let a = e.start, c = e.end;
982
1021
  if (a === void 0 && c === void 0)
983
1022
  return new Response(null, {
984
1023
  status: 416,
@@ -987,8 +1026,8 @@ const st = ({
987
1026
  }
988
1027
  });
989
1028
  if (a === void 0) {
990
- const l = Math.min(c ?? 0, o);
991
- a = Math.max(0, o - l), c = o - 1;
1029
+ const u = Math.min(c ?? 0, o);
1030
+ a = Math.max(0, o - u), c = o - 1;
992
1031
  } else (c === void 0 || c >= o) && (c = o - 1);
993
1032
  if (a < 0 || c < 0 || a >= o || c >= o || a > c)
994
1033
  return new Response(null, {
@@ -997,57 +1036,57 @@ const st = ({
997
1036
  "Content-Range": `bytes */${o}`
998
1037
  }
999
1038
  });
1000
- const d = s.slice(a, c + 1);
1001
- return r.set("Content-Length", String(d.length)), r.set("Content-Range", `bytes ${a}-${c}/${o}`), new Response(d.content, {
1039
+ const l = s.slice(a, c + 1);
1040
+ return r.set("Content-Length", String(l.length)), r.set("Content-Range", `bytes ${a}-${c}/${o}`), new Response(l.content, {
1002
1041
  status: 206,
1003
1042
  headers: r
1004
1043
  });
1005
1044
  };
1006
- class ct {
1045
+ class pt {
1007
1046
  constructor({
1008
- onError: n,
1047
+ onError: t,
1009
1048
  onManifestSuccess: i,
1010
1049
  ...r
1011
1050
  }) {
1012
- this.onError = (t) => (console.error(t), new Response(String(t), { status: 500 })), this.epubLoader = st(r), this.onManifestSuccess = i ?? (({ manifest: t }) => Promise.resolve(t)), this.onError = n ?? this.onError;
1051
+ this.onError = (e) => (console.error(e), new Response(String(e), { status: 500 })), this.archiveLoader = ct(r), this.onManifestSuccess = i ?? (({ manifest: e }) => Promise.resolve(e)), this.onError = t ?? this.onError;
1013
1052
  }
1014
1053
  prune() {
1015
- this.epubLoader.purge();
1054
+ this.archiveLoader.purge();
1016
1055
  }
1017
- accessArchive(n) {
1018
- return this.lastAccessedKey !== void 0 && this.lastAccessedKey !== n && this.epubLoader.purge(), this.lastAccessedKey = n, this.epubLoader.access(n);
1056
+ accessArchive(t) {
1057
+ return this.lastAccessedKey !== void 0 && this.lastAccessedKey !== t && this.archiveLoader.purge(), this.lastAccessedKey = t, this.archiveLoader.access(t);
1019
1058
  }
1020
- accessArchiveWithoutLock(n) {
1021
- return this.accessArchive(n).pipe(
1022
- x(({ archive: i, release: r }) => (r(), i))
1059
+ accessArchiveWithoutLock(t) {
1060
+ return this.accessArchive(t).pipe(
1061
+ F(({ archive: i, release: r }) => (r(), i))
1023
1062
  );
1024
1063
  }
1025
1064
  withArchiveResponse({
1026
- key: n,
1065
+ key: t,
1027
1066
  getResponse: i
1028
1067
  }) {
1029
- const r = this.accessArchive(n).pipe(
1030
- J(
1031
- ({ archive: t, release: s }) => R(i(t)).pipe(
1032
- ye(() => {
1068
+ const r = this.accessArchive(t).pipe(
1069
+ H(
1070
+ ({ archive: e, release: s }) => A(i(e)).pipe(
1071
+ be(() => {
1033
1072
  s();
1034
1073
  })
1035
1074
  )
1036
1075
  ),
1037
- z((t) => be(this.onError(t)))
1076
+ k((e) => ve(this.onError(e)))
1038
1077
  );
1039
- return ve(r);
1078
+ return we(r);
1040
1079
  }
1041
- fetchManifest({ key: n, baseUrl: i }) {
1080
+ fetchManifest({ key: t, baseUrl: i }) {
1042
1081
  return this.withArchiveResponse({
1043
- key: n,
1044
- getResponse: (r) => R(
1045
- He(r, { baseUrl: i })
1082
+ key: t,
1083
+ getResponse: (r) => A(
1084
+ Je(r, { baseUrl: i })
1046
1085
  ).pipe(
1047
- I(
1048
- (s) => R(this.onManifestSuccess({ manifest: s, archive: r }))
1049
- ),
1050
1086
  x(
1087
+ (s) => A(this.onManifestSuccess({ manifest: s, archive: r }))
1088
+ ),
1089
+ F(
1051
1090
  (s) => new Response(JSON.stringify(s), {
1052
1091
  status: 200
1053
1092
  })
@@ -1056,19 +1095,19 @@ class ct {
1056
1095
  });
1057
1096
  }
1058
1097
  fetchResource({
1059
- key: n,
1098
+ key: t,
1060
1099
  resourcePath: i,
1061
1100
  request: r
1062
1101
  }) {
1063
1102
  return this.withArchiveResponse({
1064
- key: n,
1065
- getResponse: (t) => {
1103
+ key: t,
1104
+ getResponse: (e) => {
1066
1105
  const s = i.replaceAll("file://", "");
1067
- return R(
1068
- nt(t, s)
1106
+ return A(
1107
+ ot(e, s)
1069
1108
  ).pipe(
1070
- x(
1071
- (a) => at({
1109
+ F(
1110
+ (a) => ut({
1072
1111
  body: a.body ?? "",
1073
1112
  contentType: a.params.contentType,
1074
1113
  rangeHeader: r?.headers.get("range")
@@ -1079,51 +1118,51 @@ class ct {
1079
1118
  });
1080
1119
  }
1081
1120
  }
1082
- class vt extends ct {
1121
+ class At extends pt {
1083
1122
  constructor({
1084
- getUriInfo: n,
1123
+ getUriInfo: t,
1085
1124
  ...i
1086
1125
  }) {
1087
- super(i), this.getUriInfo = n, this.fetchEventListener = this.fetchEventListener.bind(this);
1126
+ super(i), this.getUriInfo = t, this.fetchEventListener = this.fetchEventListener.bind(this);
1088
1127
  }
1089
- fetchEventListener(n) {
1128
+ fetchEventListener(t) {
1090
1129
  try {
1091
- const i = this.getUriInfo(n);
1130
+ const i = this.getUriInfo(t);
1092
1131
  if (!i) return;
1093
- const r = _(i.baseUrl), t = n.request.url.substring(
1132
+ const r = j(i.baseUrl), e = t.request.url.substring(
1094
1133
  r.length + 1
1095
- ), [s = ""] = t.split("/"), o = decodeURIComponent(
1096
- _(t.substring(s.length + 1))
1134
+ ), [s = ""] = e.split("/"), o = decodeURIComponent(
1135
+ j(e.substring(s.length + 1))
1097
1136
  );
1098
- t.endsWith("/manifest") ? n.respondWith(
1137
+ e.endsWith("/manifest") ? t.respondWith(
1099
1138
  this.fetchManifest({ key: s, baseUrl: `${r}/${s}/` })
1100
- ) : n.respondWith(
1139
+ ) : t.respondWith(
1101
1140
  this.fetchResource({
1102
1141
  key: s,
1103
1142
  resourcePath: o,
1104
- request: n.request
1143
+ request: t.request
1105
1144
  })
1106
1145
  );
1107
1146
  } catch (i) {
1108
- n.respondWith(new Response(String(i), { status: 500 }));
1147
+ t.respondWith(new Response(String(i), { status: 500 }));
1109
1148
  }
1110
1149
  }
1111
1150
  }
1112
1151
  export {
1113
- vt as ServiceWorkerStreamer,
1114
- ct as Streamer,
1115
- bt as configure,
1116
- mt as createArchiveFromArrayBufferList,
1117
- ft as createArchiveFromJszip,
1118
- ht as createArchiveFromLibArchive,
1119
- gt as createArchiveFromText,
1120
- yt as createArchiveFromUrls,
1121
- He as generateManifestFromArchive,
1122
- nt as generateResourceFromArchive,
1123
- A as getArchiveOpfInfo,
1124
- we as getUriBasePath,
1125
- v as getUriBasename,
1126
- _ as removeTrailingSlash,
1127
- j as sortByTitleComparator
1152
+ At as ServiceWorkerStreamer,
1153
+ pt as Streamer,
1154
+ Ft as configure,
1155
+ yt as createArchiveFromArrayBufferList,
1156
+ bt as createArchiveFromJszip,
1157
+ vt as createArchiveFromLibArchive,
1158
+ wt as createArchiveFromText,
1159
+ $t as createArchiveFromUrls,
1160
+ Je as generateManifestFromArchive,
1161
+ ot as generateResourceFromArchive,
1162
+ P as getArchiveOpfInfo,
1163
+ $e as getUriBasePath,
1164
+ y as getUriBasename,
1165
+ j as removeTrailingSlash,
1166
+ W as sortByTitleComparator
1128
1167
  };
1129
1168
  //# sourceMappingURL=index.js.map