@readium/shared 2.2.0-alpha.2 → 2.2.0-beta.1
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 +193 -169
- package/dist/index.umd.cjs +3 -3
- package/package.json +11 -11
- package/src/fetcher/HttpFetcher.ts +2 -2
- package/src/fetcher/Resource.ts +4 -4
- package/src/publication/Manifest.ts +11 -13
- package/src/publication/Publication.ts +31 -0
- package/src/publication/html/Locations.ts +0 -14
- package/src/util/mediatype/MediaType.ts +4 -0
- package/types/src/fetcher/HttpFetcher.d.ts +1 -1
- package/types/src/fetcher/Resource.d.ts +1 -1
- package/types/src/publication/Manifest.d.ts +1 -1
- package/types/src/publication/Publication.d.ts +6 -0
- package/types/src/publication/html/Locations.d.ts +0 -6
- package/types/src/util/mediatype/MediaType.d.ts +1 -0
- package/LICENSE +0 -28
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ class ei {
|
|
|
84
84
|
);
|
|
85
85
|
return new DOMParser().parseFromString(
|
|
86
86
|
await t.text(),
|
|
87
|
-
|
|
87
|
+
"application/xml"
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
@@ -101,10 +101,10 @@ class ir {
|
|
|
101
101
|
return this.readAsString().then((t) => t === void 0 ? t : JSON.parse(t));
|
|
102
102
|
}
|
|
103
103
|
readAsXML() {
|
|
104
|
-
return this.
|
|
104
|
+
return this.readAsString().then((t) => t === void 0 ? t : new DOMParser().parseFromString(t, "text/xml"));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class V {
|
|
108
108
|
constructor(t = {}) {
|
|
109
109
|
this.conformsTo = t.conformsTo ?? [], this.certification = t.certification ?? null, this.summary = t.summary ?? null, this.accessMode = t.accessMode ?? [], this.accessModeSufficient = t.accessModeSufficient ?? [], this.feature = t.feature ?? [], this.hazard = t.hazard ?? [], this.exemption = t.exemption ?? [];
|
|
110
110
|
}
|
|
@@ -114,13 +114,13 @@ class _ {
|
|
|
114
114
|
static deserialize(t) {
|
|
115
115
|
if (!t || typeof t != "object") return;
|
|
116
116
|
const e = t;
|
|
117
|
-
return new
|
|
117
|
+
return new V({
|
|
118
118
|
conformsTo: e.conformsTo ? e.conformsTo.map((i) => Tt.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
119
119
|
certification: e.certification ? Pt.deserialize(e.certification) : void 0,
|
|
120
120
|
summary: e.summary,
|
|
121
121
|
accessMode: e.accessMode ? e.accessMode.map((i) => R.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
122
122
|
accessModeSufficient: e.accessModeSufficient ? e.accessModeSufficient.map((i) => It.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
123
|
-
feature: e.feature ? e.feature.map((i) =>
|
|
123
|
+
feature: e.feature ? e.feature.map((i) => v.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
124
124
|
hazard: e.hazard ? e.hazard.map((i) => P.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
125
125
|
exemption: e.exemption ? e.exemption.map((i) => xt.deserialize(i)).filter((i) => i !== void 0) : void 0
|
|
126
126
|
});
|
|
@@ -214,15 +214,15 @@ const y = class y {
|
|
|
214
214
|
};
|
|
215
215
|
y.AUDITORY = new y("auditory"), y.CHART_ON_VISUAL = new y("chartOnVisual"), y.CHEM_ON_VISUAL = new y("chemOnVisual"), y.COLOR_DEPENDENT = new y("colorDependent"), y.DIAGRAM_ON_VISUAL = new y("diagramOnVisual"), y.MATH_ON_VISUAL = new y("mathOnVisual"), y.MUSIC_ON_VISUAL = new y("musicOnVisual"), y.TACTILE = new y("tactile"), y.TEXT_ON_VISUAL = new y("textOnVisual"), y.TEXTUAL = new y("textual"), y.VISUAL = new y("visual");
|
|
216
216
|
let R = y;
|
|
217
|
-
const
|
|
217
|
+
const x = class x {
|
|
218
218
|
constructor(t) {
|
|
219
219
|
if (typeof t == "string") {
|
|
220
|
-
if (!
|
|
220
|
+
if (!x.VALID_MODES.has(t.toLowerCase()))
|
|
221
221
|
return;
|
|
222
222
|
this.value = t.toLowerCase();
|
|
223
223
|
} else {
|
|
224
224
|
const e = t.filter(
|
|
225
|
-
(i) =>
|
|
225
|
+
(i) => x.VALID_MODES.has(i.toLowerCase())
|
|
226
226
|
);
|
|
227
227
|
if (e.length === 0)
|
|
228
228
|
return;
|
|
@@ -235,11 +235,11 @@ const N = class N {
|
|
|
235
235
|
static deserialize(t) {
|
|
236
236
|
if (!t) return;
|
|
237
237
|
if (typeof t == "string")
|
|
238
|
-
return new
|
|
238
|
+
return new x(t);
|
|
239
239
|
if (!Array.isArray(t)) return;
|
|
240
|
-
const e = t.filter((i) => i ?
|
|
240
|
+
const e = t.filter((i) => i ? x.VALID_MODES.has(i.toLowerCase()) : !1);
|
|
241
241
|
if (e.length !== 0)
|
|
242
|
-
return new
|
|
242
|
+
return new x(e);
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
245
|
* Serializes a [PrimaryAccessMode] to its RWPM JSON representation.
|
|
@@ -248,8 +248,8 @@ const N = class N {
|
|
|
248
248
|
return this.value;
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
|
|
252
|
-
let It =
|
|
251
|
+
x.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), x.AUDITORY = new x("auditory"), x.TACTILE = new x("tactile"), x.TEXTUAL = new x("textual"), x.VISUAL = new x("visual");
|
|
252
|
+
let It = x;
|
|
253
253
|
const l = class l {
|
|
254
254
|
constructor(t) {
|
|
255
255
|
this.value = t;
|
|
@@ -269,7 +269,7 @@ const l = class l {
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
l.NONE = new l("none"), l.ANNOTATIONS = new l("annotations"), l.ARIA = new l("ARIA"), l.INDEX = new l("index"), l.PAGE_BREAK_MARKERS = new l("pageBreakMarkers"), l.PAGE_NAVIGATION = new l("pageNavigation"), l.PRINT_PAGE_NUMBERS = new l("printPageNumbers"), l.READING_ORDER = new l("readingOrder"), l.STRUCTURAL_NAVIGATION = new l("structuralNavigation"), l.TABLE_OF_CONTENTS = new l("tableOfContents"), l.TAGGED_PDF = new l("taggedPDF"), l.ALTERNATIVE_TEXT = new l("alternativeText"), l.AUDIO_DESCRIPTION = new l("audioDescription"), l.CAPTIONS = new l("captions"), l.CLOSED_CAPTIONS = new l("closedCaptions"), l.DESCRIBED_MATH = new l("describedMath"), l.LONG_DESCRIPTION = new l("longDescription"), l.OPEN_CAPTIONS = new l("openCaptions"), l.SIGN_LANGUAGE = new l("signLanguage"), l.TRANSCRIPT = new l("transcript"), l.DISPLAY_TRANSFORMABILITY = new l("displayTransformability"), l.SYNCHRONIZED_AUDIO_TEXT = new l("synchronizedAudioText"), l.TIMING_CONTROL = new l("timingControl"), l.UNLOCKED = new l("unlocked"), l.CHEM_ML = new l("ChemML"), l.LATEX = new l("latex"), l.LATEX_CHEMISTRY = new l("latex-chemistry"), l.MATH_ML = new l("MathML"), l.MATH_ML_CHEMISTRY = new l("MathML-chemistry"), l.TTS_MARKUP = new l("ttsMarkup"), l.HIGH_CONTRAST_AUDIO = new l("highContrastAudio"), l.HIGH_CONTRAST_DISPLAY = new l("highContrastDisplay"), l.LARGE_PRINT = new l("largePrint"), l.BRAILLE = new l("braille"), l.TACTILE_GRAPHIC = new l("tactileGraphic"), l.TACTILE_OBJECT = new l("tactileObject"), l.FULL_RUBY_ANNOTATIONS = new l("fullRubyAnnotations"), l.HORIZONTAL_WRITING = new l("horizontalWriting"), l.RUBY_ANNOTATIONS = new l("rubyAnnotations"), l.VERTICAL_WRITING = new l("verticalWriting"), l.WITH_ADDITIONAL_WORD_SEGMENTATION = new l("withAdditionalWordSegmentation"), l.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new l("withoutAdditionalWordSegmentation");
|
|
272
|
-
let
|
|
272
|
+
let v = l;
|
|
273
273
|
const w = class w {
|
|
274
274
|
constructor(t) {
|
|
275
275
|
this.value = t;
|
|
@@ -438,7 +438,7 @@ class kt {
|
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
static fromPublication(t) {
|
|
441
|
-
const e = t.metadata.accessibility ?? new
|
|
441
|
+
const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === $.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], h = a.length > 0 && a.every((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
|
|
442
442
|
const I = d.value;
|
|
443
443
|
return Array.isArray(I) ? I.every((B) => B === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
444
444
|
}), m = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
|
|
@@ -448,18 +448,18 @@ class kt {
|
|
|
448
448
|
const I = d.value;
|
|
449
449
|
return Array.isArray(I) ? I.some((B) => B === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
450
450
|
}), u = i.some((d) => [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
].includes(d.value)), g = h ? "readable" : m || u ? "notFully" : p ? "unreadable" : "noMetadata",
|
|
451
|
+
v.LONG_DESCRIPTION.value,
|
|
452
|
+
v.ALTERNATIVE_TEXT.value,
|
|
453
|
+
v.DESCRIBED_MATH.value,
|
|
454
|
+
v.TRANSCRIPT.value
|
|
455
|
+
].includes(d.value)), g = h ? "readable" : m || u ? "notFully" : p ? "unreadable" : "noMetadata", A = u, C = i.some((d) => d.value === v.SYNCHRONIZED_AUDIO_TEXT.value) ? "synchronized" : o.some((d) => {
|
|
456
456
|
const I = d.value;
|
|
457
457
|
return Array.isArray(I) ? I.some((B) => B === R.AUDITORY.value) : I === R.AUDITORY.value;
|
|
458
458
|
}) ? "audioOnly" : a.some((d) => d.value === R.AUDITORY.value) ? "audioComplementary" : "noMetadata";
|
|
459
459
|
return new kt(
|
|
460
460
|
n,
|
|
461
461
|
g,
|
|
462
|
-
|
|
462
|
+
A,
|
|
463
463
|
C
|
|
464
464
|
);
|
|
465
465
|
}
|
|
@@ -510,12 +510,12 @@ class Dt {
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
static fromPublication(t) {
|
|
513
|
-
const i = (t.metadata.accessibility ?? new
|
|
513
|
+
const i = (t.metadata.accessibility ?? new V()).feature ?? [];
|
|
514
514
|
return new Dt(
|
|
515
|
-
i.some((r) => r.value ===
|
|
516
|
-
i.some((r) => r.value ===
|
|
517
|
-
i.some((r) => r.value ===
|
|
518
|
-
i.some((r) => r.value ===
|
|
515
|
+
i.some((r) => r.value === v.TABLE_OF_CONTENTS.value),
|
|
516
|
+
i.some((r) => r.value === v.INDEX.value),
|
|
517
|
+
i.some((r) => r.value === v.STRUCTURAL_NAVIGATION.value),
|
|
518
|
+
i.some((r) => r.value === v.PAGE_NAVIGATION.value)
|
|
519
519
|
);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
@@ -606,23 +606,23 @@ class Ut {
|
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
static fromPublication(t) {
|
|
609
|
-
const i = (t.metadata.accessibility ?? new
|
|
609
|
+
const i = (t.metadata.accessibility ?? new V()).feature ?? [];
|
|
610
610
|
return new Ut(
|
|
611
|
-
i.some((r) => r.value ===
|
|
612
|
-
i.some((r) => r.value ===
|
|
613
|
-
i.some((r) => r.value ===
|
|
614
|
-
i.some((r) => r.value ===
|
|
615
|
-
i.some((r) => r.value ===
|
|
616
|
-
i.some((r) => r.value ===
|
|
617
|
-
i.some((r) => r.value ===
|
|
618
|
-
i.some((r) => r.value ===
|
|
619
|
-
i.some((r) => r.value ===
|
|
611
|
+
i.some((r) => r.value === v.LONG_DESCRIPTION.value),
|
|
612
|
+
i.some((r) => r.value === v.DESCRIBED_MATH.value),
|
|
613
|
+
i.some((r) => r.value === v.MATH_ML.value),
|
|
614
|
+
i.some((r) => r.value === v.LATEX.value),
|
|
615
|
+
i.some((r) => r.value === v.MATH_ML_CHEMISTRY.value),
|
|
616
|
+
i.some((r) => r.value === v.LATEX_CHEMISTRY.value),
|
|
617
|
+
i.some((r) => r.value === v.CLOSED_CAPTIONS.value),
|
|
618
|
+
i.some((r) => r.value === v.OPEN_CAPTIONS.value),
|
|
619
|
+
i.some((r) => r.value === v.TRANSCRIPT.value)
|
|
620
620
|
);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
class Mt {
|
|
624
|
-
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1, p = !1, u = !1, g = !1,
|
|
625
|
-
this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = h, this.largePrint = m, this.signLanguage = p, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting =
|
|
624
|
+
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1, p = !1, u = !1, g = !1, A = !1) {
|
|
625
|
+
this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = h, this.largePrint = m, this.signLanguage = p, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting = A, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !m && !p && !u && !g && !A, this.shouldDisplay = !this.noMetadata;
|
|
626
626
|
const C = f.getString(this.id);
|
|
627
627
|
if (this.title = C.compact, this.statements = [], t) {
|
|
628
628
|
const d = f.getString("additional-accessibility-information.page-breaks");
|
|
@@ -720,7 +720,7 @@ class Mt {
|
|
|
720
720
|
descriptiveString: d.descriptive
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
if (
|
|
723
|
+
if (A) {
|
|
724
724
|
const d = f.getString("additional-accessibility-information.text-to-speech-hinting");
|
|
725
725
|
this.statements.push({
|
|
726
726
|
id: "additional-accessibility-information.text-to-speech-hinting",
|
|
@@ -730,21 +730,21 @@ class Mt {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
static fromPublication(t) {
|
|
733
|
-
const i = (t.metadata.accessibility ?? new
|
|
733
|
+
const i = (t.metadata.accessibility ?? new V()).feature ?? [];
|
|
734
734
|
return new Mt(
|
|
735
|
-
i.some((r) => r.value ===
|
|
736
|
-
i.some((r) => r.value ===
|
|
737
|
-
i.some((r) => r.value ===
|
|
738
|
-
i.some((r) => r.value ===
|
|
739
|
-
i.some((r) => r.value ===
|
|
740
|
-
i.some((r) => r.value ===
|
|
741
|
-
i.some((r) => r.value ===
|
|
742
|
-
i.some((r) => r.value ===
|
|
743
|
-
i.some((r) => r.value ===
|
|
744
|
-
i.some((r) => r.value ===
|
|
745
|
-
i.some((r) => r.value ===
|
|
746
|
-
i.some((r) => r.value ===
|
|
747
|
-
i.some((r) => r.value ===
|
|
735
|
+
i.some((r) => r.value === v.PAGE_BREAK_MARKERS.value || r.value === v.PRINT_PAGE_NUMBERS.value),
|
|
736
|
+
i.some((r) => r.value === v.ARIA.value),
|
|
737
|
+
i.some((r) => r.value === v.AUDIO_DESCRIPTION.value),
|
|
738
|
+
i.some((r) => r.value === v.BRAILLE.value),
|
|
739
|
+
i.some((r) => r.value === v.RUBY_ANNOTATIONS.value),
|
|
740
|
+
i.some((r) => r.value === v.FULL_RUBY_ANNOTATIONS.value),
|
|
741
|
+
i.some((r) => r.value === v.HIGH_CONTRAST_AUDIO.value),
|
|
742
|
+
i.some((r) => r.value === v.HIGH_CONTRAST_DISPLAY.value),
|
|
743
|
+
i.some((r) => r.value === v.LARGE_PRINT.value),
|
|
744
|
+
i.some((r) => r.value === v.SIGN_LANGUAGE.value),
|
|
745
|
+
i.some((r) => r.value === v.TACTILE_GRAPHIC.value),
|
|
746
|
+
i.some((r) => r.value === v.TACTILE_OBJECT.value),
|
|
747
|
+
i.some((r) => r.value === v.TTS_MARKUP.value)
|
|
748
748
|
);
|
|
749
749
|
}
|
|
750
750
|
}
|
|
@@ -1031,7 +1031,7 @@ Object.defineProperty(D.prototype, "encryption", {
|
|
|
1031
1031
|
return Ft.deserialize(this.otherProperties.encrypted);
|
|
1032
1032
|
}
|
|
1033
1033
|
});
|
|
1034
|
-
class
|
|
1034
|
+
class Vt {
|
|
1035
1035
|
/** Creates a MediaOverlay object */
|
|
1036
1036
|
constructor(t) {
|
|
1037
1037
|
this.activeClass = t.activeClass, this.playbackActiveClass = t.playbackActiveClass;
|
|
@@ -1041,7 +1041,7 @@ class _t {
|
|
|
1041
1041
|
*/
|
|
1042
1042
|
static deserialize(t) {
|
|
1043
1043
|
if (t)
|
|
1044
|
-
return new
|
|
1044
|
+
return new Vt({
|
|
1045
1045
|
activeClass: t.activeClass,
|
|
1046
1046
|
playbackActiveClass: t.playbackActiveClass
|
|
1047
1047
|
});
|
|
@@ -1066,7 +1066,7 @@ function ct(s) {
|
|
|
1066
1066
|
function K(s) {
|
|
1067
1067
|
return isNaN(s) ? void 0 : s;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function L(s) {
|
|
1070
1070
|
return K(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
|
|
1071
1071
|
}
|
|
1072
1072
|
function lt(s) {
|
|
@@ -1114,18 +1114,18 @@ class c {
|
|
|
1114
1114
|
throw new Error("Invalid media type");
|
|
1115
1115
|
const a = {};
|
|
1116
1116
|
for (let g = 1; g < r.length; g++) {
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1119
|
-
const C =
|
|
1117
|
+
const A = r[g].split("=");
|
|
1118
|
+
if (A.length === 2) {
|
|
1119
|
+
const C = A[0].toLocaleLowerCase(), d = C === "charset" ? A[1].toUpperCase() : A[1];
|
|
1120
1120
|
a[C] = d;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
1123
|
const o = {}, h = Object.keys(a);
|
|
1124
|
-
h.sort((g,
|
|
1124
|
+
h.sort((g, A) => g.localeCompare(A)), h.forEach((g) => o[g] = a[g]);
|
|
1125
1125
|
let m = "";
|
|
1126
1126
|
for (const g in o) {
|
|
1127
|
-
const
|
|
1128
|
-
m += `;${g}=${
|
|
1127
|
+
const A = o[g];
|
|
1128
|
+
m += `;${g}=${A}`;
|
|
1129
1129
|
}
|
|
1130
1130
|
const p = `${e}/${i}${m}`, u = o.encoding;
|
|
1131
1131
|
this.string = p, this.type = e, this.subtype = i, this.parameters = o, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
@@ -1225,6 +1225,7 @@ class c {
|
|
|
1225
1225
|
/** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
|
|
1226
1226
|
get isBitmap() {
|
|
1227
1227
|
return this.matchesAny(
|
|
1228
|
+
c.AVIF,
|
|
1228
1229
|
c.BMP,
|
|
1229
1230
|
c.GIF,
|
|
1230
1231
|
c.JPEG,
|
|
@@ -1288,6 +1289,9 @@ class c {
|
|
|
1288
1289
|
fileExtension: "avi"
|
|
1289
1290
|
});
|
|
1290
1291
|
}
|
|
1292
|
+
static get AVIF() {
|
|
1293
|
+
return c.parse({ mediaType: "image/avif", fileExtension: "avif" });
|
|
1294
|
+
}
|
|
1291
1295
|
static get BINARY() {
|
|
1292
1296
|
return c.parse({ mediaType: "application/octet-stream" });
|
|
1293
1297
|
}
|
|
@@ -1707,14 +1711,14 @@ class U {
|
|
|
1707
1711
|
title: t.title,
|
|
1708
1712
|
rels: t.rel ? Array.isArray(t.rel) ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
|
|
1709
1713
|
properties: D.deserialize(t.properties),
|
|
1710
|
-
height:
|
|
1711
|
-
width:
|
|
1712
|
-
size:
|
|
1713
|
-
duration:
|
|
1714
|
-
bitrate:
|
|
1714
|
+
height: L(t.height),
|
|
1715
|
+
width: L(t.width),
|
|
1716
|
+
size: L(t.size),
|
|
1717
|
+
duration: L(t.duration),
|
|
1718
|
+
bitrate: L(t.bitrate),
|
|
1715
1719
|
languages: F(t.language),
|
|
1716
|
-
alternates:
|
|
1717
|
-
children:
|
|
1720
|
+
alternates: O.deserialize(t.alternate),
|
|
1721
|
+
children: O.deserialize(t.children)
|
|
1718
1722
|
});
|
|
1719
1723
|
}
|
|
1720
1724
|
/**
|
|
@@ -1772,7 +1776,7 @@ class U {
|
|
|
1772
1776
|
});
|
|
1773
1777
|
}
|
|
1774
1778
|
}
|
|
1775
|
-
class
|
|
1779
|
+
class O {
|
|
1776
1780
|
/**
|
|
1777
1781
|
* Creates a [Links].
|
|
1778
1782
|
*/
|
|
@@ -1784,7 +1788,7 @@ class x {
|
|
|
1784
1788
|
*/
|
|
1785
1789
|
static deserialize(t) {
|
|
1786
1790
|
if (t && Array.isArray(t))
|
|
1787
|
-
return new
|
|
1791
|
+
return new O(
|
|
1788
1792
|
t.map((e) => U.deserialize(e)).filter((e) => e !== void 0)
|
|
1789
1793
|
);
|
|
1790
1794
|
}
|
|
@@ -1937,7 +1941,7 @@ class ut {
|
|
|
1937
1941
|
identifier: t.identifier,
|
|
1938
1942
|
altIdentifiers: t.altIdentifier ? Array.isArray(t.altIdentifier) ? new Set(t.altIdentifier.map((e) => Z.deserialize(e)).filter((e) => e !== void 0)) : new Set([Z.deserialize(t.altIdentifier)].filter((e) => e !== void 0)) : void 0,
|
|
1939
1943
|
roles: t.role ? new Set(F(t.role)) : void 0,
|
|
1940
|
-
links:
|
|
1944
|
+
links: O.deserialize(t.links),
|
|
1941
1945
|
position: K(t.position)
|
|
1942
1946
|
}) : void 0;
|
|
1943
1947
|
}
|
|
@@ -1949,7 +1953,7 @@ class ut {
|
|
|
1949
1953
|
return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.identifier !== void 0 && (t.identifier = this.identifier), this.altIdentifiers && (t.altIdentifier = lt(this.altIdentifiers).map((e) => e.serialize())), this.roles && (t.role = lt(this.roles)), this.links && (t.links = this.links.serialize()), this.position !== void 0 && (t.position = this.position), t;
|
|
1950
1954
|
}
|
|
1951
1955
|
}
|
|
1952
|
-
class
|
|
1956
|
+
class N {
|
|
1953
1957
|
/**
|
|
1954
1958
|
* Creates a [Contributors] object.
|
|
1955
1959
|
*/
|
|
@@ -1963,7 +1967,7 @@ class L {
|
|
|
1963
1967
|
static deserialize(t) {
|
|
1964
1968
|
if (!t) return;
|
|
1965
1969
|
const e = Array.isArray(t) ? t : [t];
|
|
1966
|
-
return new
|
|
1970
|
+
return new N(
|
|
1967
1971
|
e.map((i) => ut.deserialize(i)).filter((i) => i !== void 0)
|
|
1968
1972
|
);
|
|
1969
1973
|
}
|
|
@@ -1986,7 +1990,7 @@ class q {
|
|
|
1986
1990
|
if (!(t && typeof t == "object")) return;
|
|
1987
1991
|
const e = /* @__PURE__ */ new Map();
|
|
1988
1992
|
return Object.entries(t).forEach(([i, r]) => {
|
|
1989
|
-
const n =
|
|
1993
|
+
const n = N.deserialize(r);
|
|
1990
1994
|
n && n.items.length > 0 && e.set(i, n);
|
|
1991
1995
|
}), new q({ items: e });
|
|
1992
1996
|
}
|
|
@@ -2023,7 +2027,7 @@ class dt {
|
|
|
2023
2027
|
sortAs: t.sortAs ? M.deserialize(t.sortAs) : void 0,
|
|
2024
2028
|
code: t.code,
|
|
2025
2029
|
scheme: t.scheme,
|
|
2026
|
-
links:
|
|
2030
|
+
links: O.deserialize(t.links)
|
|
2027
2031
|
}) : void 0;
|
|
2028
2032
|
}
|
|
2029
2033
|
/**
|
|
@@ -2034,7 +2038,7 @@ class dt {
|
|
|
2034
2038
|
return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.code !== void 0 && (t.code = this.code), this.scheme !== void 0 && (t.scheme = this.scheme), this.links && (t.links = this.links.serialize()), t;
|
|
2035
2039
|
}
|
|
2036
2040
|
}
|
|
2037
|
-
class
|
|
2041
|
+
class _t {
|
|
2038
2042
|
/** Creates an Array of [Subject]. */
|
|
2039
2043
|
constructor(t) {
|
|
2040
2044
|
this.items = t;
|
|
@@ -2045,7 +2049,7 @@ class Vt {
|
|
|
2045
2049
|
static deserialize(t) {
|
|
2046
2050
|
if (!t) return;
|
|
2047
2051
|
const e = Array.isArray(t) ? t : [t];
|
|
2048
|
-
return new
|
|
2052
|
+
return new _t(
|
|
2049
2053
|
e.map((i) => dt.deserialize(i)).filter((i) => i !== void 0)
|
|
2050
2054
|
);
|
|
2051
2055
|
}
|
|
@@ -2092,7 +2096,7 @@ const tt = class tt {
|
|
|
2092
2096
|
*/
|
|
2093
2097
|
static deserialize(t) {
|
|
2094
2098
|
if (!(t && t.title)) return;
|
|
2095
|
-
const e = M.deserialize(t.title), i = t["@type"], r = F(t.conformsTo), n = t.identifier, a = Z.deserialize(t.altIdentifier), o = M.deserialize(t.subtitle), h = M.deserialize(t.sortAs), m =
|
|
2099
|
+
const e = M.deserialize(t.title), i = t["@type"], r = F(t.conformsTo), n = t.identifier, a = Z.deserialize(t.altIdentifier), o = M.deserialize(t.subtitle), h = M.deserialize(t.sortAs), m = N.deserialize(t.artist), p = N.deserialize(t.author), u = N.deserialize(t.colorist), g = N.deserialize(t.contributor), A = N.deserialize(t.editor), C = N.deserialize(t.illustrator), d = N.deserialize(t.inker), I = N.deserialize(t.letterer), B = N.deserialize(t.narrator), Me = N.deserialize(t.penciler), Be = N.deserialize(t.translator), Ge = F(t.language), We = t.description, He = N.deserialize(t.publisher), Fe = N.deserialize(t.imprint), Ve = ct(t.published), _e = ct(t.modified), Ye = _t.deserialize(t.subject), $e = q.deserialize(t.belongsTo), Xe = V.deserialize(t.accessibility), Ke = t.layout, Ze = t.readingProgression, Je = L(t.duration), qe = L(t.numberOfPages), Qe = Yt.deserialize(t.tdm);
|
|
2096
2100
|
let at = Object.assign({}, t);
|
|
2097
2101
|
return tt.mappedProperties.forEach((je) => delete at[je]), Object.keys(at).length === 0 && (at = void 0), new tt({
|
|
2098
2102
|
title: e,
|
|
@@ -2106,7 +2110,7 @@ const tt = class tt {
|
|
|
2106
2110
|
authors: p,
|
|
2107
2111
|
colorists: u,
|
|
2108
2112
|
contributors: g,
|
|
2109
|
-
editors:
|
|
2113
|
+
editors: A,
|
|
2110
2114
|
illustrators: C,
|
|
2111
2115
|
inkers: d,
|
|
2112
2116
|
letterers: I,
|
|
@@ -2117,8 +2121,8 @@ const tt = class tt {
|
|
|
2117
2121
|
description: We,
|
|
2118
2122
|
publishers: He,
|
|
2119
2123
|
imprints: Fe,
|
|
2120
|
-
published:
|
|
2121
|
-
modified:
|
|
2124
|
+
published: Ve,
|
|
2125
|
+
modified: _e,
|
|
2122
2126
|
subjects: Ye,
|
|
2123
2127
|
belongsTo: $e,
|
|
2124
2128
|
layout: Ke,
|
|
@@ -2230,7 +2234,7 @@ let ft = tt;
|
|
|
2230
2234
|
ft.prototype.getMediaOverlay = function() {
|
|
2231
2235
|
const s = this.otherMetadata?.mediaOverlay;
|
|
2232
2236
|
if (s)
|
|
2233
|
-
return
|
|
2237
|
+
return Vt.deserialize(s);
|
|
2234
2238
|
};
|
|
2235
2239
|
D.prototype.getContains = function() {
|
|
2236
2240
|
return new Set(this.otherProperties.contains || []);
|
|
@@ -2242,7 +2246,7 @@ class $t {
|
|
|
2242
2246
|
static deserialize(t) {
|
|
2243
2247
|
if (t)
|
|
2244
2248
|
return new $t({
|
|
2245
|
-
links:
|
|
2249
|
+
links: O.deserialize(t.links),
|
|
2246
2250
|
guided: X.deserializeArray(t.guided)
|
|
2247
2251
|
});
|
|
2248
2252
|
}
|
|
@@ -2500,10 +2504,10 @@ function Lt(s, t) {
|
|
|
2500
2504
|
function bi(s) {
|
|
2501
2505
|
return s.match(/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/);
|
|
2502
2506
|
}
|
|
2503
|
-
function
|
|
2507
|
+
function vi(s) {
|
|
2504
2508
|
return s.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/);
|
|
2505
2509
|
}
|
|
2506
|
-
function
|
|
2510
|
+
function Ai(s) {
|
|
2507
2511
|
var t = 0;
|
|
2508
2512
|
if ((t = s.indexOf(".")) > -1 || (t = s.indexOf("!")) > -1 || (t = s.indexOf("?")) > -1) {
|
|
2509
2513
|
var e = s.charAt(t + 1);
|
|
@@ -2543,8 +2547,8 @@ function wi(s, t) {
|
|
|
2543
2547
|
}
|
|
2544
2548
|
return p;
|
|
2545
2549
|
}
|
|
2546
|
-
let
|
|
2547
|
-
return (
|
|
2550
|
+
let A;
|
|
2551
|
+
return (A = i.indexOf(".")) > -1 && (Lt(i, A) || re(i) || vi(i) || bi(i)) ? u : (m = Ai(i)) ? [
|
|
2548
2552
|
m[0] + m[1],
|
|
2549
2553
|
null,
|
|
2550
2554
|
m[2]
|
|
@@ -2635,7 +2639,7 @@ z.prototype.split = function(t, e = {}) {
|
|
|
2635
2639
|
}] : Array.isArray(r) || (r = [r]), o = Q.tokensId(r, e.cache()), o && (h = i.opts.cacheGet(o), h))
|
|
2636
2640
|
return h;
|
|
2637
2641
|
var m = r.map(function(p, u) {
|
|
2638
|
-
var g = r[u + 1],
|
|
2642
|
+
var g = r[u + 1], A = t(
|
|
2639
2643
|
p.value,
|
|
2640
2644
|
Object.assign({}, p),
|
|
2641
2645
|
a ? Object.assign({}, a) : null,
|
|
@@ -2643,13 +2647,13 @@ z.prototype.split = function(t, e = {}) {
|
|
|
2643
2647
|
u,
|
|
2644
2648
|
r
|
|
2645
2649
|
) || [];
|
|
2646
|
-
if (
|
|
2650
|
+
if (A = Q.normalize(p, A), e.preserveProperties) {
|
|
2647
2651
|
var C = Q.properties(p);
|
|
2648
|
-
|
|
2652
|
+
A = A.map(function(d) {
|
|
2649
2653
|
return Object.assign({}, d, C);
|
|
2650
2654
|
});
|
|
2651
2655
|
}
|
|
2652
|
-
return a = p,
|
|
2656
|
+
return a = p, A;
|
|
2653
2657
|
}).filter(Boolean).flat();
|
|
2654
2658
|
return o && i.opts.cacheSet(o, m), m;
|
|
2655
2659
|
};
|
|
@@ -2659,11 +2663,11 @@ z.prototype.re = function(t, e = {}) {
|
|
|
2659
2663
|
for (var n = i, a = [], o, h = 0; o = t.exec(i); ) {
|
|
2660
2664
|
var m = o.index, p = h + m, u = o[0] || "", g = u.length;
|
|
2661
2665
|
if (e.split && h < p) {
|
|
2662
|
-
var
|
|
2666
|
+
var A = n.slice(h, p);
|
|
2663
2667
|
a.push({
|
|
2664
|
-
value:
|
|
2668
|
+
value: A,
|
|
2665
2669
|
index: h,
|
|
2666
|
-
offset:
|
|
2670
|
+
offset: A.length
|
|
2667
2671
|
});
|
|
2668
2672
|
}
|
|
2669
2673
|
a.push({
|
|
@@ -2806,7 +2810,7 @@ const ki = new RegExp("[\\p{L}\\p{N}]+", "u"), fe = (s) => {
|
|
|
2806
2810
|
const t = s.trimEnd();
|
|
2807
2811
|
return t.length === 0 || t.match(ki) === null ? null : t;
|
|
2808
2812
|
};
|
|
2809
|
-
class
|
|
2813
|
+
class _ {
|
|
2810
2814
|
constructor(t) {
|
|
2811
2815
|
this.fetcher = new ti(), t.fetcher && (this.fetcher = t.fetcher), this.manifest = t.manifest, this.context = t.manifest.context, this.metadata = t.manifest.metadata, this.links = t.manifest.links, this.readingOrder = t.manifest.readingOrder, this.resources = t.manifest.resources, this.toc = t.manifest.toc, this.subcollections = t.manifest.subcollections;
|
|
2812
2816
|
}
|
|
@@ -2838,6 +2842,28 @@ class V {
|
|
|
2838
2842
|
linkWithRel(t) {
|
|
2839
2843
|
return this.manifest.linkWithRel(t);
|
|
2840
2844
|
}
|
|
2845
|
+
/**
|
|
2846
|
+
* Gets the cover image for the publication.
|
|
2847
|
+
* First looks for rel='cover' in links/resources/readingOrder,
|
|
2848
|
+
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG) as bitmap fallback.
|
|
2849
|
+
*/
|
|
2850
|
+
getCover() {
|
|
2851
|
+
const t = [
|
|
2852
|
+
this.links,
|
|
2853
|
+
this.resources,
|
|
2854
|
+
this.readingOrder
|
|
2855
|
+
].filter(Boolean);
|
|
2856
|
+
for (const e of t) {
|
|
2857
|
+
const i = e.items.find((r) => r.rels?.has("cover"));
|
|
2858
|
+
if (i) return i;
|
|
2859
|
+
}
|
|
2860
|
+
for (const e of t) {
|
|
2861
|
+
const i = e.items.find(
|
|
2862
|
+
(r) => r.mediaType.isBitmap || r.mediaType.matches(c.SVG)
|
|
2863
|
+
);
|
|
2864
|
+
if (i) return i;
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2841
2867
|
async positionsFromManifest() {
|
|
2842
2868
|
const t = this.manifest.links.findWithMediaType(
|
|
2843
2869
|
"application/vnd.readium.position-list+json"
|
|
@@ -2877,22 +2903,22 @@ class V {
|
|
|
2877
2903
|
return this.fetcher.get(t);
|
|
2878
2904
|
}
|
|
2879
2905
|
}
|
|
2880
|
-
|
|
2906
|
+
_.prototype.getPageList = function() {
|
|
2881
2907
|
return this.linksWithRole("pageList");
|
|
2882
2908
|
};
|
|
2883
|
-
|
|
2909
|
+
_.prototype.getLandmarks = function() {
|
|
2884
2910
|
return this.linksWithRole("landmarks");
|
|
2885
2911
|
};
|
|
2886
|
-
|
|
2912
|
+
_.prototype.getListOfAudioClips = function() {
|
|
2887
2913
|
return this.linksWithRole("loa");
|
|
2888
2914
|
};
|
|
2889
|
-
|
|
2915
|
+
_.prototype.getListOfIllustrations = function() {
|
|
2890
2916
|
return this.linksWithRole("loi");
|
|
2891
2917
|
};
|
|
2892
|
-
|
|
2918
|
+
_.prototype.getListOfTables = function() {
|
|
2893
2919
|
return this.linksWithRole("lot");
|
|
2894
2920
|
};
|
|
2895
|
-
|
|
2921
|
+
_.prototype.getListOfVideoClips = function() {
|
|
2896
2922
|
return this.linksWithRole("lov");
|
|
2897
2923
|
};
|
|
2898
2924
|
class mt {
|
|
@@ -2907,10 +2933,10 @@ class mt {
|
|
|
2907
2933
|
*/
|
|
2908
2934
|
static deserialize(t) {
|
|
2909
2935
|
if (!(t && t.cssSelector)) return;
|
|
2910
|
-
let e =
|
|
2936
|
+
let e = L(t.textNodeIndex);
|
|
2911
2937
|
if (e === void 0) return;
|
|
2912
|
-
let i =
|
|
2913
|
-
return i === void 0 && (i =
|
|
2938
|
+
let i = L(t.charOffset);
|
|
2939
|
+
return i === void 0 && (i = L(t.offset)), new mt({
|
|
2914
2940
|
cssSelector: t.cssSelector,
|
|
2915
2941
|
textNodeIndex: e,
|
|
2916
2942
|
charOffset: i
|
|
@@ -2995,10 +3021,6 @@ T.prototype.space = function() {
|
|
|
2995
3021
|
if (t.length === 4 && !t.some(isNaN))
|
|
2996
3022
|
return t;
|
|
2997
3023
|
};
|
|
2998
|
-
T.prototype.text = function() {
|
|
2999
|
-
const s = this.fragmentParameters();
|
|
3000
|
-
console.log(s);
|
|
3001
|
-
};
|
|
3002
3024
|
class Kt {
|
|
3003
3025
|
/** Creates a [Price]. */
|
|
3004
3026
|
constructor(t) {
|
|
@@ -3012,7 +3034,7 @@ class Kt {
|
|
|
3012
3034
|
let e = t.currency;
|
|
3013
3035
|
if (!(e && typeof e == "string" && e.length > 0))
|
|
3014
3036
|
return;
|
|
3015
|
-
let i =
|
|
3037
|
+
let i = L(t.value);
|
|
3016
3038
|
if (i !== void 0)
|
|
3017
3039
|
return new Kt({ currency: e, value: i });
|
|
3018
3040
|
}
|
|
@@ -3061,8 +3083,8 @@ class Zt {
|
|
|
3061
3083
|
static deserialize(t) {
|
|
3062
3084
|
if (t)
|
|
3063
3085
|
return new Zt({
|
|
3064
|
-
total:
|
|
3065
|
-
position:
|
|
3086
|
+
total: L(t.total),
|
|
3087
|
+
position: L(t.position)
|
|
3066
3088
|
});
|
|
3067
3089
|
}
|
|
3068
3090
|
/**
|
|
@@ -3084,8 +3106,8 @@ class Jt {
|
|
|
3084
3106
|
static deserialize(t) {
|
|
3085
3107
|
if (t)
|
|
3086
3108
|
return new Jt({
|
|
3087
|
-
total:
|
|
3088
|
-
available:
|
|
3109
|
+
total: L(t.total),
|
|
3110
|
+
available: L(t.available)
|
|
3089
3111
|
});
|
|
3090
3112
|
}
|
|
3091
3113
|
/**
|
|
@@ -3122,7 +3144,7 @@ class qt {
|
|
|
3122
3144
|
}
|
|
3123
3145
|
}
|
|
3124
3146
|
D.prototype.getNumberOfItems = function() {
|
|
3125
|
-
return
|
|
3147
|
+
return L(this.otherProperties.numberOfItems);
|
|
3126
3148
|
};
|
|
3127
3149
|
D.prototype.getPrice = function() {
|
|
3128
3150
|
return Kt.deserialize(this.otherProperties.price);
|
|
@@ -3144,7 +3166,7 @@ D.prototype.getAvailability = function() {
|
|
|
3144
3166
|
D.prototype.getAuthenticate = function() {
|
|
3145
3167
|
return U.deserialize(this.otherProperties.authenticate);
|
|
3146
3168
|
};
|
|
3147
|
-
|
|
3169
|
+
_.prototype.getImages = function() {
|
|
3148
3170
|
return this.linksWithRole("images");
|
|
3149
3171
|
};
|
|
3150
3172
|
class nr {
|
|
@@ -3206,7 +3228,7 @@ class me extends pe {
|
|
|
3206
3228
|
super(e), this.locator = t;
|
|
3207
3229
|
}
|
|
3208
3230
|
}
|
|
3209
|
-
class
|
|
3231
|
+
class At extends me {
|
|
3210
3232
|
/**
|
|
3211
3233
|
* Human-readable text representation for this element.
|
|
3212
3234
|
*/
|
|
@@ -3214,17 +3236,17 @@ class vt extends me {
|
|
|
3214
3236
|
return this.accessibilityLabel;
|
|
3215
3237
|
}
|
|
3216
3238
|
}
|
|
3217
|
-
class Ui extends
|
|
3239
|
+
class Ui extends At {
|
|
3218
3240
|
constructor(t, e, i = []) {
|
|
3219
3241
|
super(t, i), this.embeddedLink = e;
|
|
3220
3242
|
}
|
|
3221
3243
|
}
|
|
3222
|
-
class Mi extends
|
|
3244
|
+
class Mi extends At {
|
|
3223
3245
|
constructor(t, e, i = []) {
|
|
3224
3246
|
super(t, i), this.embeddedLink = e;
|
|
3225
3247
|
}
|
|
3226
3248
|
}
|
|
3227
|
-
class Bi extends
|
|
3249
|
+
class Bi extends At {
|
|
3228
3250
|
constructor(t, e, i, r = []) {
|
|
3229
3251
|
super(t, r), this.embeddedLink = e, this.caption = i;
|
|
3230
3252
|
}
|
|
@@ -3237,7 +3259,7 @@ class ge extends pe {
|
|
|
3237
3259
|
super(i), this.locator = t, this.text = e;
|
|
3238
3260
|
}
|
|
3239
3261
|
}
|
|
3240
|
-
class zt extends
|
|
3262
|
+
class zt extends At {
|
|
3241
3263
|
constructor(t, e, i, r = []) {
|
|
3242
3264
|
super(t, r), this.role = e, this.segments = i;
|
|
3243
3265
|
}
|
|
@@ -3324,7 +3346,7 @@ class Qt {
|
|
|
3324
3346
|
return await this.hasPrevious() ? this.previous() : null;
|
|
3325
3347
|
}
|
|
3326
3348
|
}
|
|
3327
|
-
let
|
|
3349
|
+
let Vi = class {
|
|
3328
3350
|
constructor(t, e) {
|
|
3329
3351
|
this.element = t, this.direction = e;
|
|
3330
3352
|
}
|
|
@@ -3361,7 +3383,7 @@ class cr extends Qt {
|
|
|
3361
3383
|
const r = this.nextIteratorIn(t, e.index);
|
|
3362
3384
|
return r ? (this._currentIterator = r, this.nextIn(t)) : null;
|
|
3363
3385
|
}
|
|
3364
|
-
return new
|
|
3386
|
+
return new Vi(i, t);
|
|
3365
3387
|
}
|
|
3366
3388
|
/**
|
|
3367
3389
|
* Returns the [Iterator] for the current [Resource] in the reading order.
|
|
@@ -3485,7 +3507,7 @@ class lr extends Qt {
|
|
|
3485
3507
|
return this.currentProgression === 0 ? 0 : this.currentProgression < 0 || this.currentProgression >= 100 ? null : Math.floor(this.currentProgression * this.pageContentFiltered.length / 100);
|
|
3486
3508
|
}
|
|
3487
3509
|
}
|
|
3488
|
-
const
|
|
3510
|
+
const _i = [
|
|
3489
3511
|
"OBJECT",
|
|
3490
3512
|
"BASE",
|
|
3491
3513
|
"FONT",
|
|
@@ -3554,7 +3576,7 @@ const Vi = [
|
|
|
3554
3576
|
"RB"
|
|
3555
3577
|
];
|
|
3556
3578
|
function ce(s) {
|
|
3557
|
-
return
|
|
3579
|
+
return _i.includes(s.nodeName.toUpperCase());
|
|
3558
3580
|
}
|
|
3559
3581
|
function St(s, t) {
|
|
3560
3582
|
const e = s.getAttribute("src");
|
|
@@ -3565,13 +3587,13 @@ function St(s, t) {
|
|
|
3565
3587
|
return e;
|
|
3566
3588
|
}
|
|
3567
3589
|
}
|
|
3568
|
-
const it = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Yi = new RegExp(`^${it}+$`, "g"), $i = new RegExp(`^${it}+|${it}+$/g`, "g"), be = new RegExp(`^${it}+`, "g"),
|
|
3590
|
+
const it = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", Yi = new RegExp(`^${it}+$`, "g"), $i = new RegExp(`^${it}+|${it}+$/g`, "g"), be = new RegExp(`^${it}+`, "g"), ve = new RegExp(`${it}+$`, "g"), ot = (s) => (
|
|
3569
3591
|
// Normal spaces, \t, \n, \v, \f, \r, U+0085, U+00A0, U+2000 to U+200A, U+2028, U+2029, U+202F, U+205F, U+3000
|
|
3570
3592
|
s?.length ? Yi.test(s) : !0
|
|
3571
|
-
),
|
|
3593
|
+
), Ae = (s) => s.replace($i, ""), Xi = (s) => s.replace(be, ""), Ki = (s) => s.replace(ve, ""), le = (s, t = "") => new rt({
|
|
3572
3594
|
before: t + (be.exec(s)?.[0] ?? ""),
|
|
3573
|
-
highlight:
|
|
3574
|
-
after:
|
|
3595
|
+
highlight: Ae(s),
|
|
3596
|
+
after: ve.exec(s)?.[0] ?? ""
|
|
3575
3597
|
});
|
|
3576
3598
|
function Zi(s) {
|
|
3577
3599
|
for (; s; ) {
|
|
@@ -3828,7 +3850,7 @@ function Ce(s) {
|
|
|
3828
3850
|
}
|
|
3829
3851
|
return [];
|
|
3830
3852
|
}
|
|
3831
|
-
function
|
|
3853
|
+
function vs(s) {
|
|
3832
3854
|
return nt(s.map(Ce));
|
|
3833
3855
|
}
|
|
3834
3856
|
function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
@@ -3836,7 +3858,7 @@ function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
|
3836
3858
|
for (; i.length <= s.length && e < t; )
|
|
3837
3859
|
e += 1, yield i.map((n) => s[n]), i = ys(i, s.length - 1);
|
|
3838
3860
|
}
|
|
3839
|
-
function
|
|
3861
|
+
function As(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
3840
3862
|
return Array.from(Pe(s, { maxResults: t }));
|
|
3841
3863
|
}
|
|
3842
3864
|
function ys(s = [], t = 0) {
|
|
@@ -3893,7 +3915,7 @@ const Is = {
|
|
|
3893
3915
|
class: ms,
|
|
3894
3916
|
attribute: ps,
|
|
3895
3917
|
nthchild: bs,
|
|
3896
|
-
nthoftype:
|
|
3918
|
+
nthoftype: vs
|
|
3897
3919
|
}, xs = {
|
|
3898
3920
|
tag: ze,
|
|
3899
3921
|
id: Le,
|
|
@@ -3925,8 +3947,8 @@ function* Rs(s, t) {
|
|
|
3925
3947
|
}
|
|
3926
3948
|
function Cs(s, t) {
|
|
3927
3949
|
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), h = (m, p) => {
|
|
3928
|
-
const u = Ls(s, p), g = Os(u, a, o),
|
|
3929
|
-
return m[p] = r ? Array.from(Pe(
|
|
3950
|
+
const u = Ls(s, p), g = Os(u, a, o), A = zs(g, o);
|
|
3951
|
+
return m[p] = r ? Array.from(Pe(A, { maxResults: n })) : A.map((C) => [C]), m;
|
|
3930
3952
|
};
|
|
3931
3953
|
return Ps(t).reduce(h, {});
|
|
3932
3954
|
}
|
|
@@ -3938,7 +3960,7 @@ function ks(s) {
|
|
|
3938
3960
|
return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
|
|
3939
3961
|
}
|
|
3940
3962
|
function Ds(s) {
|
|
3941
|
-
const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ?
|
|
3963
|
+
const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ? As(t, { maxResults: r }) : t.map((a) => [a]);
|
|
3942
3964
|
return i ? n.map(ks) : n;
|
|
3943
3965
|
}
|
|
3944
3966
|
function* Us(s, t) {
|
|
@@ -3979,7 +4001,7 @@ function* Fs(s, t, e = "", i) {
|
|
|
3979
4001
|
for (const n of Hs(r, e))
|
|
3980
4002
|
jt(s, n, t) && (yield n);
|
|
3981
4003
|
}
|
|
3982
|
-
function*
|
|
4004
|
+
function* Vs(s, t, e = "", i) {
|
|
3983
4005
|
if (s.length === 0)
|
|
3984
4006
|
return null;
|
|
3985
4007
|
const r = [
|
|
@@ -3993,11 +4015,11 @@ function* _s(s, t, e = "", i) {
|
|
|
3993
4015
|
selector: a
|
|
3994
4016
|
};
|
|
3995
4017
|
}
|
|
3996
|
-
function*
|
|
4018
|
+
function* _s({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
3997
4019
|
let r = t, n = e, a = !0;
|
|
3998
4020
|
for (; a; ) {
|
|
3999
4021
|
let o = !1;
|
|
4000
|
-
for (const h of
|
|
4022
|
+
for (const h of Vs(s, r, n, i)) {
|
|
4001
4023
|
const { foundElements: m, selector: p } = h;
|
|
4002
4024
|
if (o = !0, jt(s, p, t))
|
|
4003
4025
|
yield p;
|
|
@@ -4065,7 +4087,7 @@ function* qs(s, t = {}) {
|
|
|
4065
4087
|
var e;
|
|
4066
4088
|
const i = Ys(s), r = ss(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : te(i[0]);
|
|
4067
4089
|
let a = 0;
|
|
4068
|
-
for (const o of
|
|
4090
|
+
for (const o of _s({
|
|
4069
4091
|
elements: i,
|
|
4070
4092
|
options: r,
|
|
4071
4093
|
root: n,
|
|
@@ -4277,7 +4299,7 @@ class js {
|
|
|
4277
4299
|
h.length > 0 && (o = new U({
|
|
4278
4300
|
href: h[0].href,
|
|
4279
4301
|
type: h[0].type,
|
|
4280
|
-
alternates: h.length > 1 ? new
|
|
4302
|
+
alternates: h.length > 1 ? new O(h.slice(1)) : void 0
|
|
4281
4303
|
}));
|
|
4282
4304
|
}
|
|
4283
4305
|
o && (r === "AUDIO" ? this.elementRecipes.push({
|
|
@@ -4348,7 +4370,7 @@ class js {
|
|
|
4348
4370
|
}
|
|
4349
4371
|
flushSegment() {
|
|
4350
4372
|
let t = this.textAcc;
|
|
4351
|
-
const e =
|
|
4373
|
+
const e = Ae(t);
|
|
4352
4374
|
if (!ot(e)) {
|
|
4353
4375
|
if (!this.segmentRecipesAcc.length) {
|
|
4354
4376
|
t = Xi(t);
|
|
@@ -4368,7 +4390,7 @@ class js {
|
|
|
4368
4390
|
this.rawTextAcc.length && (this.wholeRawTextAcc = (this.wholeRawTextAcc || "") + this.rawTextAcc, this.elementRawTextAcc += this.rawTextAcc), this.rawTextAcc = "", this.textAcc = "";
|
|
4369
4391
|
}
|
|
4370
4392
|
}
|
|
4371
|
-
class
|
|
4393
|
+
class vt {
|
|
4372
4394
|
/**
|
|
4373
4395
|
* Creates a [LocatorMetadata].
|
|
4374
4396
|
*/
|
|
@@ -4383,7 +4405,7 @@ class At {
|
|
|
4383
4405
|
const e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(["title", "numberOfItems"]);
|
|
4384
4406
|
return Object.entries(t).forEach(([r, n]) => {
|
|
4385
4407
|
i.has(r) || e.set(r, n);
|
|
4386
|
-
}), new
|
|
4408
|
+
}), new vt({
|
|
4387
4409
|
title: M.deserialize(t.title),
|
|
4388
4410
|
numberOfItems: K(t.numberOfItems),
|
|
4389
4411
|
otherMetadata: e.size === 0 ? void 0 : e
|
|
@@ -4402,7 +4424,7 @@ class De {
|
|
|
4402
4424
|
* Creates a [LocatorCollection].
|
|
4403
4425
|
*/
|
|
4404
4426
|
constructor(t) {
|
|
4405
|
-
this.metadata = t.metadata ?? new
|
|
4427
|
+
this.metadata = t.metadata ?? new vt({}), this.links = t.links ?? new O([]), this.locators = t.locators ?? [];
|
|
4406
4428
|
}
|
|
4407
4429
|
/**
|
|
4408
4430
|
* Parses a [LocatorCollection] from its RWPM JSON representation.
|
|
@@ -4411,8 +4433,8 @@ class De {
|
|
|
4411
4433
|
if (!t) return;
|
|
4412
4434
|
let e, i = t.locators;
|
|
4413
4435
|
return i && Array.isArray(i) && (e = i.map((r) => k.deserialize(r)).filter((r) => r !== void 0)), new De({
|
|
4414
|
-
metadata:
|
|
4415
|
-
links:
|
|
4436
|
+
metadata: vt.deserialize(t.metadata),
|
|
4437
|
+
links: O.deserialize(t.links),
|
|
4416
4438
|
locators: e
|
|
4417
4439
|
});
|
|
4418
4440
|
}
|
|
@@ -4442,9 +4464,9 @@ class W {
|
|
|
4442
4464
|
if (!t) return;
|
|
4443
4465
|
let e, i, r;
|
|
4444
4466
|
if (Array.isArray(t))
|
|
4445
|
-
e =
|
|
4467
|
+
e = O.deserialize(t);
|
|
4446
4468
|
else if (typeof t == "object")
|
|
4447
|
-
e =
|
|
4469
|
+
e = O.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
|
|
4448
4470
|
i?.set(n, a);
|
|
4449
4471
|
}), r = W.deserializeCollections(t);
|
|
4450
4472
|
else
|
|
@@ -4497,7 +4519,7 @@ class W {
|
|
|
4497
4519
|
}
|
|
4498
4520
|
class Ue {
|
|
4499
4521
|
constructor(t) {
|
|
4500
|
-
this.context = t.context, this.metadata = t.metadata, this.links = t.links
|
|
4522
|
+
this.context = t.context, this.metadata = t.metadata, this.links = t.links, this.readingOrder = t.readingOrder, this.resources = t.resources, this.toc = t.toc, this.subcollections = t.subcollections;
|
|
4501
4523
|
}
|
|
4502
4524
|
/**
|
|
4503
4525
|
* Parses a [Publication] from its RWPM JSON representation.
|
|
@@ -4509,17 +4531,19 @@ class Ue {
|
|
|
4509
4531
|
if (!t) return;
|
|
4510
4532
|
const e = ft.deserialize(t.metadata);
|
|
4511
4533
|
if (!e) return;
|
|
4512
|
-
const i =
|
|
4534
|
+
const i = O.deserialize(t.links);
|
|
4535
|
+
if (!i) return;
|
|
4536
|
+
const r = O.deserialize(
|
|
4513
4537
|
t.readingOrder ? t.readingOrder : t.spine
|
|
4514
4538
|
);
|
|
4515
|
-
if (
|
|
4539
|
+
if (r)
|
|
4516
4540
|
return new Ue({
|
|
4517
4541
|
context: F(t["@context"]),
|
|
4518
4542
|
metadata: e,
|
|
4519
|
-
links:
|
|
4520
|
-
readingOrder:
|
|
4521
|
-
resources:
|
|
4522
|
-
toc:
|
|
4543
|
+
links: i,
|
|
4544
|
+
readingOrder: r,
|
|
4545
|
+
resources: O.deserialize(t.resources),
|
|
4546
|
+
toc: O.deserialize(t.toc),
|
|
4523
4547
|
subcollections: W.deserializeCollections({
|
|
4524
4548
|
sub: t.sub
|
|
4525
4549
|
})
|
|
@@ -4530,12 +4554,12 @@ class Ue {
|
|
|
4530
4554
|
*/
|
|
4531
4555
|
serialize() {
|
|
4532
4556
|
const t = {};
|
|
4533
|
-
return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(),
|
|
4557
|
+
return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(), t.links = this.links.serialize(), t.readingOrder = this.readingOrder.serialize(), this.resources && (t.resources = this.resources.serialize()), this.toc && (t.toc = this.toc.serialize()), W.serializeCollection(t, this.subcollections), t;
|
|
4534
4558
|
}
|
|
4535
4559
|
/** Finds the first link with the given relation in the manifest's links. */
|
|
4536
4560
|
linkWithRel(t) {
|
|
4537
4561
|
const e = new Array();
|
|
4538
|
-
e.push(this.readingOrder), this.resources && e.push(this.resources),
|
|
4562
|
+
e.push(this.readingOrder), this.resources && e.push(this.resources), e.push(this.links);
|
|
4539
4563
|
let i;
|
|
4540
4564
|
for (const r of e)
|
|
4541
4565
|
if (i = r.findWithRel(t), i !== void 0)
|
|
@@ -4545,7 +4569,7 @@ class Ue {
|
|
|
4545
4569
|
/** Finds all the links with the given relation in the manifest's links. */
|
|
4546
4570
|
linksWithRel(t) {
|
|
4547
4571
|
const e = [];
|
|
4548
|
-
return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)),
|
|
4572
|
+
return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)), e.push(this.links.filterByRel(t)), e.reduce((i, r) => i.concat(r), []);
|
|
4549
4573
|
}
|
|
4550
4574
|
/**
|
|
4551
4575
|
* Creates a new [Locator] object from a [Link] to a resource of this manifest.
|
|
@@ -4582,7 +4606,7 @@ class Ue {
|
|
|
4582
4606
|
m.push(...u);
|
|
4583
4607
|
}), m.length > 0 && (h = e(m)), h;
|
|
4584
4608
|
}, i = [];
|
|
4585
|
-
i.push(this.readingOrder), this.resources && i.push(this.resources),
|
|
4609
|
+
i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
|
|
4586
4610
|
const r = e(i);
|
|
4587
4611
|
if (r !== void 0)
|
|
4588
4612
|
return r;
|
|
@@ -4624,7 +4648,7 @@ class Ue {
|
|
|
4624
4648
|
}
|
|
4625
4649
|
export {
|
|
4626
4650
|
R as AccessMode,
|
|
4627
|
-
|
|
4651
|
+
V as Accessibility,
|
|
4628
4652
|
sr as AccessibilityMetadataDisplayGuide,
|
|
4629
4653
|
Tt as AccessibilityProfile,
|
|
4630
4654
|
Ht as AccessibilitySummary,
|
|
@@ -4644,7 +4668,7 @@ export {
|
|
|
4644
4668
|
nr as Content,
|
|
4645
4669
|
me as ContentElement,
|
|
4646
4670
|
ut as Contributor,
|
|
4647
|
-
|
|
4671
|
+
N as Contributors,
|
|
4648
4672
|
Jt as Copies,
|
|
4649
4673
|
Ri as DefaultTextContentTokenizer,
|
|
4650
4674
|
Xt as DomRange,
|
|
@@ -4652,7 +4676,7 @@ export {
|
|
|
4652
4676
|
ti as EmptyFetcher,
|
|
4653
4677
|
Ft as Encryption,
|
|
4654
4678
|
xt as Exemption,
|
|
4655
|
-
|
|
4679
|
+
v as Feature,
|
|
4656
4680
|
Hi as Footnote,
|
|
4657
4681
|
$t as GuidedNavigationDocument,
|
|
4658
4682
|
X as GuidedNavigationObject,
|
|
@@ -4672,16 +4696,16 @@ export {
|
|
|
4672
4696
|
$ as Layout,
|
|
4673
4697
|
Wt as Legal,
|
|
4674
4698
|
U as Link,
|
|
4675
|
-
|
|
4699
|
+
O as Links,
|
|
4676
4700
|
f as Localization,
|
|
4677
4701
|
M as LocalizedString,
|
|
4678
4702
|
k as Locator,
|
|
4679
4703
|
De as LocatorCollection,
|
|
4680
|
-
|
|
4704
|
+
vt as LocatorCollectionMetadata,
|
|
4681
4705
|
T as LocatorLocations,
|
|
4682
4706
|
rt as LocatorText,
|
|
4683
4707
|
Ue as Manifest,
|
|
4684
|
-
|
|
4708
|
+
Vt as MediaOverlay,
|
|
4685
4709
|
c as MediaType,
|
|
4686
4710
|
ft as Metadata,
|
|
4687
4711
|
Pi as NaiveTextTokenizer,
|
|
@@ -4696,7 +4720,7 @@ export {
|
|
|
4696
4720
|
It as PrimaryAccessMode,
|
|
4697
4721
|
J as Profile,
|
|
4698
4722
|
D as Properties,
|
|
4699
|
-
|
|
4723
|
+
_ as Publication,
|
|
4700
4724
|
W as PublicationCollection,
|
|
4701
4725
|
cr as PublicationContentIterator,
|
|
4702
4726
|
H as ReadingProgression,
|
|
@@ -4704,7 +4728,7 @@ export {
|
|
|
4704
4728
|
Ut as RichContent,
|
|
4705
4729
|
oi as RichContentType,
|
|
4706
4730
|
dt as Subject,
|
|
4707
|
-
|
|
4731
|
+
_t as Subjects,
|
|
4708
4732
|
Yt as TDM,
|
|
4709
4733
|
hi as TDMReservation,
|
|
4710
4734
|
ar as TextContentTokenizer,
|
|
@@ -4712,7 +4736,7 @@ export {
|
|
|
4712
4736
|
Fi as TextQuote,
|
|
4713
4737
|
ge as TextSegment,
|
|
4714
4738
|
zi as TextUnit,
|
|
4715
|
-
|
|
4739
|
+
At as TextualElement,
|
|
4716
4740
|
ht as URITemplate,
|
|
4717
4741
|
Mi as VideoElement,
|
|
4718
4742
|
ri as VisualAdjustments,
|
|
@@ -4722,7 +4746,7 @@ export {
|
|
|
4722
4746
|
ct as datefromJSON,
|
|
4723
4747
|
rr as leadingPage,
|
|
4724
4748
|
K as numberfromJSON,
|
|
4725
|
-
|
|
4749
|
+
L as positiveNumberfromJSON,
|
|
4726
4750
|
lt as setToArray,
|
|
4727
4751
|
fe as speakableToken
|
|
4728
4752
|
};
|