@prose-reader/archive-reader 1.371.0 → 1.373.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.
@@ -77,15 +77,15 @@ var v = async (e, t = {}) => n(e, (e) => e.isDir ? {
77
77
  uri: e,
78
78
  size: 0,
79
79
  ...r(async () => (await fetch(e)).blob())
80
- }));
80
+ })), f = {
81
+ dir: !1,
82
+ basename: "content.opf",
83
+ uri: "content.opf",
84
+ size: 0,
85
+ ...r(async () => new Blob([u]))
86
+ };
81
87
  return e({
82
- records: [{
83
- dir: !1,
84
- basename: "content.opf",
85
- uri: "content.opf",
86
- size: 0,
87
- ...r(async () => new Blob([u]))
88
- }, ...d],
88
+ records: [f, ...d],
89
89
  close: () => Promise.resolve()
90
90
  });
91
91
  }, x = (e) => !e.dir, ee = (e) => e.dir, S = (e, t) => {
@@ -102,7 +102,7 @@ var v = async (e, t = {}) => n(e, (e) => e.isDir ? {
102
102
  for (let [r, i] of Object.entries(e)) {
103
103
  if (!r.startsWith(A)) continue;
104
104
  let e = r.slice(6), a = i?.trim();
105
- e.length === 0 || a === void 0 || (n ??= { ...t }, n[e] = a);
105
+ e.length !== 0 && a !== void 0 && (n ??= { ...t }, n[e] = a);
106
106
  }
107
107
  return n ?? t;
108
108
  }, ne = (e) => {
@@ -141,7 +141,7 @@ var v = async (e, t = {}) => n(e, (e) => e.isDir ? {
141
141
  35: "ARK"
142
142
  }, se = (e) => {
143
143
  let t = e?.value?.trim();
144
- if (!(t === void 0 || t.length === 0)) return e?.scheme?.trim().toLowerCase() === "onix:codelist5" ? oe[t] ?? t : t;
144
+ if (t !== void 0 && t.length !== 0) return e?.scheme?.trim().toLowerCase() === "onix:codelist5" ? oe[t] ?? t : t;
145
145
  }, ce = (e, t = ["opf"]) => re(e, t, ie), le = (e) => {
146
146
  let t = O(e);
147
147
  if (t.length === 0) return {};
@@ -257,14 +257,14 @@ var v = async (e, t = {}) => n(e, (e) => e.isDir ? {
257
257
  }), r;
258
258
  }, be = (e, t) => {
259
259
  let n = P(e, "meta").find((e) => e.attr.property === t)?.val;
260
- if (!(n === void 0 || n.trim().length === 0)) return n;
260
+ if (n !== void 0 && n.trim().length !== 0) return n;
261
261
  }, xe = (e) => {
262
262
  let t = N(e, "guide");
263
263
  if (t === void 0) return [];
264
264
  let n = [];
265
265
  for (let e of P(t, "reference")) {
266
266
  let t = e.attr.href?.trim();
267
- t === void 0 || t.length === 0 || n.push({
267
+ t !== void 0 && t.length !== 0 && n.push({
268
268
  href: t,
269
269
  title: e.attr.title?.trim() ?? "",
270
270
  type: e.attr.type?.trim() ?? ""
@@ -355,7 +355,7 @@ var v = async (e, t = {}) => n(e, (e) => e.isDir ? {
355
355
  //#region src/metadata/opf/readArchiveOpf.ts
356
356
  async function R(e) {
357
357
  let { data: t, basePath: n } = D(e) || {};
358
- if (!(!t || t.dir)) return {
358
+ return !t || t.dir ? void 0 : {
359
359
  opf: Te(await E(t)),
360
360
  basePath: n
361
361
  };
@@ -490,7 +490,8 @@ var Ee = "com.apple.ibooks.display-options.xml", De = (e) => e.childrenNamed("op
490
490
  let n = S(e, r.uri);
491
491
  if (!n || !x(n)) return !1;
492
492
  try {
493
- if (!qe(new h(await E(n)))) return !1;
493
+ let e = await E(n);
494
+ if (!qe(new h(e))) return !1;
494
495
  } catch (e) {
495
496
  return t.error(`layout scan: unable to inspect ${r.uri}`, e), !1;
496
497
  }
@@ -590,7 +591,7 @@ var rt = async ({ archive: e, archiveOpf: t }) => {
590
591
  }
591
592
  }, ut = (e) => {
592
593
  let t = W(e.Year), n = W(e.Month), r = W(e.Day);
593
- if (!(t === void 0 && n === void 0 && r === void 0)) return {
594
+ if (t !== void 0 || n !== void 0 || r !== void 0) return {
594
595
  ...t === void 0 ? {} : { year: t },
595
596
  ...n === void 0 ? {} : { month: n },
596
597
  ...r === void 0 ? {} : { day: r }
@@ -670,7 +671,7 @@ var rt = async ({ archive: e, archiveOpf: t }) => {
670
671
  return t !== void 0 && t <= 5 ? { value: t } : void 0;
671
672
  }, xt = (e) => {
672
673
  let t = pt(e), n = K(U(e.SeriesGroup).map((e) => ({ name: e })));
673
- if (!(t === void 0 && n === void 0)) return B({
674
+ if (t !== void 0 || n !== void 0) return B({
674
675
  series: t === void 0 ? void 0 : [t],
675
676
  collection: n
676
677
  });
@@ -716,7 +717,7 @@ var rt = async ({ archive: e, archiveOpf: t }) => {
716
717
  ]), kt = (e) => {
717
718
  if (e == null) return;
718
719
  let t = String(e).replace(/\D/g, "");
719
- if (!(t.length === 0 || !Ot.has(t.length))) return t;
720
+ if (t.length !== 0 && Ot.has(t.length)) return t;
720
721
  }, At = (e) => {
721
722
  let t = e.trim();
722
723
  if (/^https?:\/\//i.test(t)) try {
@@ -934,16 +935,16 @@ var rt = async ({ archive: e, archiveOpf: t }) => {
934
935
  if (e && !e.dir) return Zt(new h(await E(e)), { basePath: c(e.uri) });
935
936
  }
936
937
  }, $t = (e, { basePath: t, prefix: n }) => {
937
- let r = m(t, e?.childNamed(`${n}content`)?.attr.src || ""), i = {
938
+ let r = e?.childNamed(`${n}content`)?.attr.src || "", i = m(t, r), a = {
938
939
  title: e?.descendantWithPath(`${n}navLabel.${n}text`)?.val || "",
939
- path: r,
940
- containerHref: r,
940
+ path: i,
941
+ containerHref: i,
941
942
  contents: []
942
- }, a = e.childrenNamed(`${n}navPoint`);
943
- return a && a.length > 0 && (i.contents = a.map((e) => $t(e, {
943
+ }, o = e.childrenNamed(`${n}navPoint`);
944
+ return o && o.length > 0 && (a.contents = o.map((e) => $t(e, {
944
945
  basePath: t,
945
946
  prefix: n
946
- }))), i;
947
+ }))), a;
947
948
  }, en = (e, { basePath: t }) => {
948
949
  let n = [], r = e.name, i = "";
949
950
  return r.indexOf(":") !== -1 && (i = `${r.split(":")[0]}:`), e.childNamed(`${i}navMap`)?.childrenNamed(`${i}navPoint`).forEach((e) => {