@readium/shared 2.2.0-beta.3 → 2.2.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 +218 -213
- package/dist/index.umd.cjs +3 -3
- package/package.json +1 -1
- package/src/fetcher/Fetcher.ts +2 -2
- package/src/fetcher/HttpFetcher.ts +3 -3
- package/src/fetcher/Resource.ts +1 -1
- package/src/fetcher/index.ts +3 -3
- package/src/index.ts +4 -4
- package/src/opds/Availability.ts +1 -1
- package/src/opds/Copies.ts +1 -1
- package/src/opds/Holds.ts +1 -1
- package/src/opds/Price.ts +1 -1
- package/src/opds/index.ts +5 -5
- package/src/publication/BelongsTo.ts +1 -1
- package/src/publication/Contributor.ts +4 -4
- package/src/publication/GuidedNavigation.ts +19 -19
- package/src/publication/Link.ts +6 -6
- package/src/publication/Locator.ts +1 -1
- package/src/publication/LocatorCollection.ts +4 -4
- package/src/publication/Manifest.ts +6 -6
- package/src/publication/Metadata.ts +13 -13
- package/src/publication/Publication.ts +12 -14
- package/src/publication/PublicationCollection.ts +1 -1
- package/src/publication/ReadingProgression.ts +1 -1
- package/src/publication/Subject.ts +2 -2
- package/src/publication/accessibility/AccessibilityMetadataDisplayGuide.ts +20 -20
- package/src/publication/accessibility/Localization.ts +15 -15
- package/src/publication/accessibility/index.ts +3 -3
- package/src/publication/encryption/Properties.ts +2 -2
- package/src/publication/encryption/index.ts +2 -2
- package/src/publication/epub/Metadata.ts +3 -3
- package/src/publication/epub/Properties.ts +1 -1
- package/src/publication/epub/Publication.ts +2 -2
- package/src/publication/epub/index.ts +4 -4
- package/src/publication/html/DomRange.ts +1 -1
- package/src/publication/html/DomRangePoint.ts +1 -1
- package/src/publication/html/Locations.ts +3 -3
- package/src/publication/html/index.ts +3 -3
- package/src/publication/index.ts +24 -24
- package/src/publication/opds/Properties.ts +4 -4
- package/src/publication/opds/Publication.ts +2 -2
- package/src/publication/opds/index.ts +2 -2
- package/src/publication/services/content/Content.ts +3 -3
- package/src/publication/services/content/ContentTokenizer.ts +6 -6
- package/src/publication/services/content/Iterator.ts +2 -2
- package/src/publication/services/content/element/attributes.ts +2 -2
- package/src/publication/services/content/element/element.ts +5 -5
- package/src/publication/services/content/element/index.ts +3 -3
- package/src/publication/services/content/index.ts +5 -5
- package/src/publication/services/content/iterators/HTMLResourceContentIterator.ts +8 -8
- package/src/publication/services/content/iterators/PDFTextContentIterator.ts +21 -21
- package/src/publication/services/content/iterators/PublicationContentIterator.ts +6 -6
- package/src/publication/services/content/iterators/helpers.ts +1 -1
- package/src/publication/services/content/iterators/index.ts +3 -3
- package/src/publication/services/index.ts +2 -2
- package/src/publication/services/timeline/Timeline.ts +52 -29
- package/src/publication/services/timeline/index.ts +2 -2
- package/src/util/index.ts +5 -5
- package/src/util/mediatype/index.ts +1 -1
- package/src/util/tokenizer/TextTokenizer.ts +5 -5
- package/src/util/tokenizer/index.ts +2 -2
- package/types/src/fetcher/Fetcher.d.ts +2 -2
- package/types/src/fetcher/HttpFetcher.d.ts +3 -3
- package/types/src/fetcher/Resource.d.ts +1 -1
- package/types/src/fetcher/index.d.ts +3 -3
- package/types/src/index.d.ts +4 -4
- package/types/src/opds/index.d.ts +5 -5
- package/types/src/publication/BelongsTo.d.ts +1 -1
- package/types/src/publication/Contributor.d.ts +3 -3
- package/types/src/publication/GuidedNavigation.d.ts +1 -1
- package/types/src/publication/Link.d.ts +3 -3
- package/types/src/publication/LocatorCollection.d.ts +3 -3
- package/types/src/publication/Manifest.d.ts +4 -4
- package/types/src/publication/Metadata.d.ts +10 -10
- package/types/src/publication/Publication.d.ts +11 -12
- package/types/src/publication/PublicationCollection.d.ts +1 -1
- package/types/src/publication/ReadingProgression.d.ts +1 -1
- package/types/src/publication/Subject.d.ts +2 -2
- package/types/src/publication/accessibility/AccessibilityMetadataDisplayGuide.d.ts +2 -2
- package/types/src/publication/accessibility/index.d.ts +3 -3
- package/types/src/publication/encryption/Properties.d.ts +1 -1
- package/types/src/publication/encryption/index.d.ts +2 -2
- package/types/src/publication/epub/Metadata.d.ts +1 -1
- package/types/src/publication/epub/Publication.d.ts +1 -1
- package/types/src/publication/epub/index.d.ts +4 -4
- package/types/src/publication/html/DomRange.d.ts +1 -1
- package/types/src/publication/html/Locations.d.ts +1 -1
- package/types/src/publication/html/index.d.ts +3 -3
- package/types/src/publication/index.d.ts +24 -24
- package/types/src/publication/opds/Properties.d.ts +2 -2
- package/types/src/publication/opds/Publication.d.ts +1 -1
- package/types/src/publication/opds/index.d.ts +2 -2
- package/types/src/publication/services/content/Content.d.ts +2 -2
- package/types/src/publication/services/content/ContentTokenizer.d.ts +2 -2
- package/types/src/publication/services/content/Iterator.d.ts +1 -1
- package/types/src/publication/services/content/element/attributes.d.ts +1 -1
- package/types/src/publication/services/content/element/element.d.ts +4 -4
- package/types/src/publication/services/content/element/index.d.ts +3 -3
- package/types/src/publication/services/content/index.d.ts +5 -5
- package/types/src/publication/services/content/iterators/HTMLResourceContentIterator.d.ts +4 -4
- package/types/src/publication/services/content/iterators/PDFTextContentIterator.d.ts +3 -3
- package/types/src/publication/services/content/iterators/PublicationContentIterator.d.ts +5 -5
- package/types/src/publication/services/content/iterators/helpers.d.ts +1 -1
- package/types/src/publication/services/content/iterators/index.d.ts +3 -3
- package/types/src/publication/services/index.d.ts +2 -2
- package/types/src/publication/services/timeline/Timeline.d.ts +9 -6
- package/types/src/publication/services/timeline/index.d.ts +2 -2
- package/types/src/util/index.d.ts +5 -5
- package/types/src/util/mediatype/index.d.ts +1 -1
- package/types/src/util/tokenizer/TextTokenizer.d.ts +2 -2
- package/types/src/util/tokenizer/index.d.ts +2 -2
- package/types/test/AltIdentifier.test.d.ts +0 -1
- package/types/test/Contributor.test.d.ts +0 -1
- package/types/test/GuidedNavigation.test.d.ts +0 -1
- package/types/test/Link.test.d.ts +0 -1
- package/types/test/LocalizedString.test.d.ts +0 -1
- package/types/test/Locator.test.d.ts +0 -1
- package/types/test/LocatorCollection.test.d.ts +0 -1
- package/types/test/Manifest.test.d.ts +0 -1
- package/types/test/Metadata.test.d.ts +0 -1
- package/types/test/Properties.test.d.ts +0 -1
- package/types/test/Publication.test.d.ts +0 -1
- package/types/test/PublicationCollection.test.d.ts +0 -1
- package/types/test/Subject.test.d.ts +0 -1
- package/types/test/TDM.test.d.ts +0 -1
- package/types/test/Timeline.test.d.ts +0 -1
- package/types/test/accessibility/Accessibility.test.d.ts +0 -1
- package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +0 -1
- package/types/test/accessibility/Localization.test.d.ts +0 -1
- package/types/test/encryption/Encryption.test.d.ts +0 -1
- package/types/test/encryption/Properties.test.d.ts +0 -1
- package/types/test/epub/MediaOverlay.test.d.ts +0 -1
- package/types/test/epub/Metadata.test.d.ts +0 -1
- package/types/test/epub/PropertiesTest.test.d.ts +0 -1
- package/types/test/epub/PublicationTest.test.d.ts +0 -1
- package/types/test/html/DomRange.test.d.ts +0 -1
- package/types/test/html/Locator.test.d.ts +0 -1
- package/types/test/opds/PropertiesTest.test.d.ts +0 -1
- package/types/test/opds/PublicationTest.test.d.ts +0 -1
- package/types/test/util/URITemplate.test.d.ts +0 -1
- package/types/test/util/mediatype/MediaType.test.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -116,12 +116,12 @@ class V {
|
|
|
116
116
|
const e = t;
|
|
117
117
|
return new V({
|
|
118
118
|
conformsTo: e.conformsTo ? e.conformsTo.map((i) => It.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
119
|
-
certification: e.certification ?
|
|
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) => xt.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
123
123
|
feature: e.feature ? e.feature.map((i) => v.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
124
|
-
hazard: e.hazard ? e.hazard.map((i) =>
|
|
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) => Nt.deserialize(i)).filter((i) => i !== void 0) : void 0
|
|
126
126
|
});
|
|
127
127
|
}
|
|
@@ -171,7 +171,7 @@ const b = class b {
|
|
|
171
171
|
};
|
|
172
172
|
b.EPUB_A11Y_10_WCAG_20_A = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), b.EPUB_A11Y_10_WCAG_20_AA = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), b.EPUB_A11Y_10_WCAG_20_AAA = new b("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), b.EPUB_A11Y_11_WCAG_20_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), b.EPUB_A11Y_11_WCAG_20_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), b.EPUB_A11Y_11_WCAG_20_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), b.EPUB_A11Y_11_WCAG_21_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), b.EPUB_A11Y_11_WCAG_21_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), b.EPUB_A11Y_11_WCAG_21_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), b.EPUB_A11Y_11_WCAG_22_A = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), b.EPUB_A11Y_11_WCAG_22_AA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), b.EPUB_A11Y_11_WCAG_22_AAA = new b("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
|
|
173
173
|
let It = b;
|
|
174
|
-
class
|
|
174
|
+
class Pt {
|
|
175
175
|
constructor(t = null, e = null, i = null) {
|
|
176
176
|
this.certifiedBy = t, this.credential = e, this.report = i;
|
|
177
177
|
}
|
|
@@ -180,7 +180,7 @@ class kt {
|
|
|
180
180
|
*/
|
|
181
181
|
static deserialize(t) {
|
|
182
182
|
if (!(!t || typeof t != "object"))
|
|
183
|
-
return new
|
|
183
|
+
return new Pt(
|
|
184
184
|
t.certifiedBy,
|
|
185
185
|
t.credential,
|
|
186
186
|
t.report
|
|
@@ -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,9 +248,9 @@ const N = class N {
|
|
|
248
248
|
return this.value;
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
|
|
252
|
-
let xt =
|
|
253
|
-
const
|
|
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 xt = x;
|
|
253
|
+
const h = class h {
|
|
254
254
|
constructor(t) {
|
|
255
255
|
this.value = t;
|
|
256
256
|
}
|
|
@@ -259,7 +259,7 @@ const l = class l {
|
|
|
259
259
|
*/
|
|
260
260
|
static deserialize(t) {
|
|
261
261
|
if (!(!t || typeof t != "string"))
|
|
262
|
-
return new
|
|
262
|
+
return new h(t);
|
|
263
263
|
}
|
|
264
264
|
/**
|
|
265
265
|
* Serializes a [Feature] to its RWPM JSON representation.
|
|
@@ -268,8 +268,8 @@ const l = class l {
|
|
|
268
268
|
return this.value;
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
|
-
|
|
272
|
-
let v =
|
|
271
|
+
h.NONE = new h("none"), h.ANNOTATIONS = new h("annotations"), h.ARIA = new h("ARIA"), h.INDEX = new h("index"), h.PAGE_BREAK_MARKERS = new h("pageBreakMarkers"), h.PAGE_NAVIGATION = new h("pageNavigation"), h.PRINT_PAGE_NUMBERS = new h("printPageNumbers"), h.READING_ORDER = new h("readingOrder"), h.STRUCTURAL_NAVIGATION = new h("structuralNavigation"), h.TABLE_OF_CONTENTS = new h("tableOfContents"), h.TAGGED_PDF = new h("taggedPDF"), h.ALTERNATIVE_TEXT = new h("alternativeText"), h.AUDIO_DESCRIPTION = new h("audioDescription"), h.CAPTIONS = new h("captions"), h.CLOSED_CAPTIONS = new h("closedCaptions"), h.DESCRIBED_MATH = new h("describedMath"), h.LONG_DESCRIPTION = new h("longDescription"), h.OPEN_CAPTIONS = new h("openCaptions"), h.SIGN_LANGUAGE = new h("signLanguage"), h.TRANSCRIPT = new h("transcript"), h.DISPLAY_TRANSFORMABILITY = new h("displayTransformability"), h.SYNCHRONIZED_AUDIO_TEXT = new h("synchronizedAudioText"), h.TIMING_CONTROL = new h("timingControl"), h.UNLOCKED = new h("unlocked"), h.CHEM_ML = new h("ChemML"), h.LATEX = new h("latex"), h.LATEX_CHEMISTRY = new h("latex-chemistry"), h.MATH_ML = new h("MathML"), h.MATH_ML_CHEMISTRY = new h("MathML-chemistry"), h.TTS_MARKUP = new h("ttsMarkup"), h.HIGH_CONTRAST_AUDIO = new h("highContrastAudio"), h.HIGH_CONTRAST_DISPLAY = new h("highContrastDisplay"), h.LARGE_PRINT = new h("largePrint"), h.BRAILLE = new h("braille"), h.TACTILE_GRAPHIC = new h("tactileGraphic"), h.TACTILE_OBJECT = new h("tactileObject"), h.FULL_RUBY_ANNOTATIONS = new h("fullRubyAnnotations"), h.HORIZONTAL_WRITING = new h("horizontalWriting"), h.RUBY_ANNOTATIONS = new h("rubyAnnotations"), h.VERTICAL_WRITING = new h("verticalWriting"), h.WITH_ADDITIONAL_WORD_SEGMENTATION = new h("withAdditionalWordSegmentation"), h.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new h("withoutAdditionalWordSegmentation");
|
|
272
|
+
let v = h;
|
|
273
273
|
const w = class w {
|
|
274
274
|
constructor(t) {
|
|
275
275
|
this.value = t;
|
|
@@ -289,7 +289,7 @@ const w = class w {
|
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
291
|
w.FLASHING = new w("flashing"), w.NO_FLASHING_HAZARD = new w("noFlashingHazard"), w.UNKNOWN_FLASHING_HAZARD = new w("unknownFlashingHazard"), w.MOTION_SIMULATION = new w("motionSimulation"), w.NO_MOTION_SIMULATION_HAZARD = new w("noMotionSimulationHazard"), w.UNKNOWN_MOTION_SIMULATION_HAZARD = new w("unknownMotionSimulationHazard"), w.SOUND = new w("sound"), w.NO_SOUND_HAZARD = new w("noSoundHazard"), w.UNKNOWN_SOUND_HAZARD = new w("unknownSoundHazard"), w.UNKNOWN = new w("unknown"), w.NONE = new w("none");
|
|
292
|
-
let
|
|
292
|
+
let P = w;
|
|
293
293
|
const S = class S {
|
|
294
294
|
constructor(t) {
|
|
295
295
|
this.value = t;
|
|
@@ -413,11 +413,11 @@ class Dt {
|
|
|
413
413
|
compactString: o.compact,
|
|
414
414
|
descriptiveString: o.descriptive
|
|
415
415
|
});
|
|
416
|
-
let
|
|
417
|
-
e === "readable" ?
|
|
418
|
-
const p = f.getString(
|
|
416
|
+
let l = "";
|
|
417
|
+
e === "readable" ? l = "ways-of-reading.nonvisual-reading.readable" : e === "notFully" ? l = "ways-of-reading.nonvisual-reading.not-fully" : e === "unreadable" ? l = "ways-of-reading.nonvisual-reading.none" : e === "noMetadata" && (l = "ways-of-reading.nonvisual-reading.no-metadata");
|
|
418
|
+
const p = f.getString(l);
|
|
419
419
|
if (this.statements.push({
|
|
420
|
-
id:
|
|
420
|
+
id: l,
|
|
421
421
|
compactString: p.compact,
|
|
422
422
|
descriptiveString: p.descriptive
|
|
423
423
|
}), i) {
|
|
@@ -438,7 +438,7 @@ class Dt {
|
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
static fromPublication(t) {
|
|
441
|
-
const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === X.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [],
|
|
441
|
+
const e = t.metadata.accessibility ?? new V(), i = e.feature ?? [], r = t.metadata.layout === X.fixed, n = i.some((d) => d.value === v.DISPLAY_TRANSFORMABILITY.value) ? "modifiable" : r ? "unmodifiable" : "unknown", a = e.accessMode ?? [], o = e.accessModeSufficient ?? [], l = 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((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
444
444
|
}), p = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
|
|
@@ -452,7 +452,7 @@ class Dt {
|
|
|
452
452
|
v.ALTERNATIVE_TEXT.value,
|
|
453
453
|
v.DESCRIBED_MATH.value,
|
|
454
454
|
v.TRANSCRIPT.value
|
|
455
|
-
].includes(d.value)), g =
|
|
455
|
+
].includes(d.value)), g = l ? "readable" : p || u ? "notFully" : m ? "unreadable" : "noMetadata", A = u, k = 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((G) => G === R.AUDITORY.value) : I === R.AUDITORY.value;
|
|
458
458
|
}) ? "audioOnly" : a.some((d) => d.value === R.AUDITORY.value) ? "audioComplementary" : "noMetadata";
|
|
@@ -460,7 +460,7 @@ class Dt {
|
|
|
460
460
|
n,
|
|
461
461
|
g,
|
|
462
462
|
A,
|
|
463
|
-
|
|
463
|
+
k
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
@@ -521,8 +521,8 @@ class Ut {
|
|
|
521
521
|
}
|
|
522
522
|
var ci = /* @__PURE__ */ ((s) => (s.Math = "math", s.Chemistry = "chemistry", s.Music = "music", s.Diagram = "diagram", s.Chart = "chart", s.Graph = "graph", s.Table = "table", s.Image = "image", s))(ci || {});
|
|
523
523
|
class Mt {
|
|
524
|
-
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1,
|
|
525
|
-
this.id = "rich-content.title", this.extendedAltTextDescriptions = t, this.mathFormula = e, this.mathFormulaAsMathML = i, this.mathFormulaAsLaTeX = r, this.chemicalFormulaAsMathML = n, this.chemicalFormulaAsLaTeX = a, this.closedCaptions = o, this.openCaptions =
|
|
524
|
+
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, l = !1, p = !1) {
|
|
525
|
+
this.id = "rich-content.title", this.extendedAltTextDescriptions = t, this.mathFormula = e, this.mathFormulaAsMathML = i, this.mathFormulaAsLaTeX = r, this.chemicalFormulaAsMathML = n, this.chemicalFormulaAsLaTeX = a, this.closedCaptions = o, this.openCaptions = l, this.transcript = p, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !l && !p, this.shouldDisplay = !this.noMetadata;
|
|
526
526
|
const m = f.getString(this.id);
|
|
527
527
|
if (this.title = m.compact, this.statements = [], t) {
|
|
528
528
|
const u = f.getString("rich-content.extended-descriptions");
|
|
@@ -580,7 +580,7 @@ class Mt {
|
|
|
580
580
|
descriptiveString: u.descriptive
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
if (
|
|
583
|
+
if (l) {
|
|
584
584
|
const u = f.getString("rich-content.open-captions");
|
|
585
585
|
this.statements.push({
|
|
586
586
|
id: "rich-content.open-captions",
|
|
@@ -621,10 +621,10 @@ class Mt {
|
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
623
|
class Bt {
|
|
624
|
-
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !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 =
|
|
626
|
-
const
|
|
627
|
-
if (this.title =
|
|
624
|
+
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, l = !1, p = !1, m = !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 = l, this.largePrint = p, this.signLanguage = m, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting = A, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !l && !p && !m && !u && !g && !A, this.shouldDisplay = !this.noMetadata;
|
|
626
|
+
const k = f.getString(this.id);
|
|
627
|
+
if (this.title = k.compact, this.statements = [], t) {
|
|
628
628
|
const d = f.getString("additional-accessibility-information.page-breaks");
|
|
629
629
|
this.statements.push({
|
|
630
630
|
id: "additional-accessibility-information.page-breaks",
|
|
@@ -680,7 +680,7 @@ class Bt {
|
|
|
680
680
|
descriptiveString: d.descriptive
|
|
681
681
|
});
|
|
682
682
|
}
|
|
683
|
-
if (
|
|
683
|
+
if (l) {
|
|
684
684
|
const d = f.getString("additional-accessibility-information.high-contrast-between-text-and-background");
|
|
685
685
|
this.statements.push({
|
|
686
686
|
id: "additional-accessibility-information.high-contrast-between-text-and-background",
|
|
@@ -846,13 +846,13 @@ class Gt {
|
|
|
846
846
|
static fromPublication(t) {
|
|
847
847
|
const e = t.metadata.accessibility?.hazard ?? [];
|
|
848
848
|
let i;
|
|
849
|
-
e.some((o) => o.value ===
|
|
849
|
+
e.some((o) => o.value === P.NONE.value) ? i = "no" : e.some((o) => o.value === P.UNKNOWN.value) ? i = "unknown" : i = "noMetadata";
|
|
850
850
|
let r;
|
|
851
|
-
e.some((o) => o.value ===
|
|
851
|
+
e.some((o) => o.value === P.FLASHING.value) ? r = "yes" : e.some((o) => o.value === P.NO_FLASHING_HAZARD.value) ? r = "no" : e.some((o) => o.value === P.UNKNOWN_FLASHING_HAZARD.value) ? r = "unknown" : r = i;
|
|
852
852
|
let n;
|
|
853
|
-
e.some((o) => o.value ===
|
|
853
|
+
e.some((o) => o.value === P.MOTION_SIMULATION.value) ? n = "yes" : e.some((o) => o.value === P.NO_MOTION_SIMULATION_HAZARD.value) ? n = "no" : e.some((o) => o.value === P.UNKNOWN_MOTION_SIMULATION_HAZARD.value) ? n = "unknown" : n = i;
|
|
854
854
|
let a;
|
|
855
|
-
return e.some((o) => o.value ===
|
|
855
|
+
return e.some((o) => o.value === P.SOUND.value) ? a = "yes" : e.some((o) => o.value === P.NO_SOUND_HAZARD.value) ? a = "no" : e.some((o) => o.value === P.UNKNOWN_SOUND_HAZARD.value) ? a = "unknown" : a = i, new Gt(r, n, a);
|
|
856
856
|
}
|
|
857
857
|
}
|
|
858
858
|
class Wt {
|
|
@@ -995,7 +995,7 @@ class _t {
|
|
|
995
995
|
return this.compression !== void 0 && (t.compression = this.compression), this.originalLength !== void 0 && (t.originalLength = this.originalLength), this.profile !== void 0 && (t.profile = this.profile), this.scheme !== void 0 && (t.scheme = this.scheme), t;
|
|
996
996
|
}
|
|
997
997
|
}
|
|
998
|
-
var
|
|
998
|
+
var Lt = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.center = "center", s))(Lt || {});
|
|
999
999
|
class U {
|
|
1000
1000
|
constructor(t) {
|
|
1001
1001
|
this.otherProperties = t;
|
|
@@ -1116,12 +1116,12 @@ class c {
|
|
|
1116
1116
|
for (let g = 1; g < r.length; g++) {
|
|
1117
1117
|
const A = r[g].split("=");
|
|
1118
1118
|
if (A.length === 2) {
|
|
1119
|
-
const
|
|
1120
|
-
a[
|
|
1119
|
+
const k = A[0].toLocaleLowerCase(), d = k === "charset" ? A[1].toUpperCase() : A[1];
|
|
1120
|
+
a[k] = d;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
const o = {},
|
|
1124
|
-
|
|
1123
|
+
const o = {}, l = Object.keys(a);
|
|
1124
|
+
l.sort((g, A) => g.localeCompare(A)), l.forEach((g) => o[g] = a[g]);
|
|
1125
1125
|
let p = "";
|
|
1126
1126
|
for (const g in o) {
|
|
1127
1127
|
const A = o[g];
|
|
@@ -1608,8 +1608,8 @@ class T {
|
|
|
1608
1608
|
"totalProgression",
|
|
1609
1609
|
"position"
|
|
1610
1610
|
]);
|
|
1611
|
-
return Object.entries(t).forEach(([o,
|
|
1612
|
-
a.has(o) || n.set(o,
|
|
1611
|
+
return Object.entries(t).forEach(([o, l]) => {
|
|
1612
|
+
a.has(o) || n.set(o, l);
|
|
1613
1613
|
}), new T({
|
|
1614
1614
|
fragments: _(t.fragments || t.fragment),
|
|
1615
1615
|
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
|
|
@@ -1717,8 +1717,8 @@ class M {
|
|
|
1717
1717
|
duration: L(t.duration),
|
|
1718
1718
|
bitrate: L(t.bitrate),
|
|
1719
1719
|
languages: _(t.language),
|
|
1720
|
-
alternates:
|
|
1721
|
-
children:
|
|
1720
|
+
alternates: O.deserialize(t.alternate),
|
|
1721
|
+
children: O.deserialize(t.children)
|
|
1722
1722
|
});
|
|
1723
1723
|
}
|
|
1724
1724
|
/**
|
|
@@ -1776,7 +1776,7 @@ class M {
|
|
|
1776
1776
|
});
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
|
-
class
|
|
1779
|
+
class O {
|
|
1780
1780
|
/**
|
|
1781
1781
|
* Creates a [Links].
|
|
1782
1782
|
*/
|
|
@@ -1788,7 +1788,7 @@ class z {
|
|
|
1788
1788
|
*/
|
|
1789
1789
|
static deserialize(t) {
|
|
1790
1790
|
if (t && Array.isArray(t))
|
|
1791
|
-
return new
|
|
1791
|
+
return new O(
|
|
1792
1792
|
t.map((e) => M.deserialize(e)).filter((e) => e !== void 0)
|
|
1793
1793
|
);
|
|
1794
1794
|
}
|
|
@@ -1941,7 +1941,7 @@ class dt {
|
|
|
1941
1941
|
identifier: t.identifier,
|
|
1942
1942
|
altIdentifiers: t.altIdentifier ? Array.isArray(t.altIdentifier) ? new Set(t.altIdentifier.map((e) => J.deserialize(e)).filter((e) => e !== void 0)) : new Set([J.deserialize(t.altIdentifier)].filter((e) => e !== void 0)) : void 0,
|
|
1943
1943
|
roles: t.role ? new Set(_(t.role)) : void 0,
|
|
1944
|
-
links:
|
|
1944
|
+
links: O.deserialize(t.links),
|
|
1945
1945
|
position: Z(t.position)
|
|
1946
1946
|
}) : void 0;
|
|
1947
1947
|
}
|
|
@@ -1953,7 +1953,7 @@ class dt {
|
|
|
1953
1953
|
return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.identifier !== void 0 && (t.identifier = this.identifier), this.altIdentifiers && (t.altIdentifier = ht(this.altIdentifiers).map((e) => e.serialize())), this.roles && (t.role = ht(this.roles)), this.links && (t.links = this.links.serialize()), this.position !== void 0 && (t.position = this.position), t;
|
|
1954
1954
|
}
|
|
1955
1955
|
}
|
|
1956
|
-
class
|
|
1956
|
+
class N {
|
|
1957
1957
|
/**
|
|
1958
1958
|
* Creates a [Contributors] object.
|
|
1959
1959
|
*/
|
|
@@ -1967,7 +1967,7 @@ class O {
|
|
|
1967
1967
|
static deserialize(t) {
|
|
1968
1968
|
if (!t) return;
|
|
1969
1969
|
const e = Array.isArray(t) ? t : [t];
|
|
1970
|
-
return new
|
|
1970
|
+
return new N(
|
|
1971
1971
|
e.map((i) => dt.deserialize(i)).filter((i) => i !== void 0)
|
|
1972
1972
|
);
|
|
1973
1973
|
}
|
|
@@ -1990,7 +1990,7 @@ class Q {
|
|
|
1990
1990
|
if (!(t && typeof t == "object")) return;
|
|
1991
1991
|
const e = /* @__PURE__ */ new Map();
|
|
1992
1992
|
return Object.entries(t).forEach(([i, r]) => {
|
|
1993
|
-
const n =
|
|
1993
|
+
const n = N.deserialize(r);
|
|
1994
1994
|
n && n.items.length > 0 && e.set(i, n);
|
|
1995
1995
|
}), new Q({ items: e });
|
|
1996
1996
|
}
|
|
@@ -2006,7 +2006,7 @@ class Q {
|
|
|
2006
2006
|
}
|
|
2007
2007
|
var q = /* @__PURE__ */ ((s) => (s.EPUB = "https://readium.org/webpub-manifest/profiles/epub", s.AUDIOBOOK = "https://readium.org/webpub-manifest/profiles/audiobook", s.DIVINA = "https://readium.org/webpub-manifest/profiles/divina", s.PDF = "https://readium.org/webpub-manifest/profiles/pdf", s))(q || {}), F = /* @__PURE__ */ ((s) => (s.ltr = "ltr", s.rtl = "rtl", s))(F || {});
|
|
2008
2008
|
function nr(s) {
|
|
2009
|
-
return s === "rtl" ?
|
|
2009
|
+
return s === "rtl" ? Lt.right : Lt.left;
|
|
2010
2010
|
}
|
|
2011
2011
|
class ft {
|
|
2012
2012
|
/** Creates a [Subject]. */
|
|
@@ -2027,7 +2027,7 @@ class ft {
|
|
|
2027
2027
|
sortAs: t.sortAs ? B.deserialize(t.sortAs) : void 0,
|
|
2028
2028
|
code: t.code,
|
|
2029
2029
|
scheme: t.scheme,
|
|
2030
|
-
links:
|
|
2030
|
+
links: O.deserialize(t.links)
|
|
2031
2031
|
}) : void 0;
|
|
2032
2032
|
}
|
|
2033
2033
|
/**
|
|
@@ -2096,7 +2096,7 @@ const et = class et {
|
|
|
2096
2096
|
*/
|
|
2097
2097
|
static deserialize(t) {
|
|
2098
2098
|
if (!(t && t.title)) return;
|
|
2099
|
-
const e = B.deserialize(t.title), i = t["@type"], r = _(t.conformsTo), n = t.identifier, a = J.deserialize(t.altIdentifier), o = B.deserialize(t.subtitle),
|
|
2099
|
+
const e = B.deserialize(t.title), i = t["@type"], r = _(t.conformsTo), n = t.identifier, a = J.deserialize(t.altIdentifier), o = B.deserialize(t.subtitle), l = B.deserialize(t.sortAs), p = N.deserialize(t.artist), m = N.deserialize(t.author), u = N.deserialize(t.colorist), g = N.deserialize(t.contributor), A = N.deserialize(t.editor), k = N.deserialize(t.illustrator), d = N.deserialize(t.inker), I = N.deserialize(t.letterer), G = N.deserialize(t.narrator), Be = N.deserialize(t.penciler), Ge = N.deserialize(t.translator), We = _(t.language), He = t.description, Fe = N.deserialize(t.publisher), _e = N.deserialize(t.imprint), Ve = lt(t.published), Ye = lt(t.modified), $e = Yt.deserialize(t.subject), Xe = Q.deserialize(t.belongsTo), Ke = V.deserialize(t.accessibility), Ze = t.layout, Je = t.readingProgression, qe = L(t.duration), Qe = L(t.numberOfPages), je = $t.deserialize(t.tdm);
|
|
2100
2100
|
let ot = Object.assign({}, t);
|
|
2101
2101
|
return et.mappedProperties.forEach((ti) => delete ot[ti]), Object.keys(ot).length === 0 && (ot = void 0), new et({
|
|
2102
2102
|
title: e,
|
|
@@ -2105,13 +2105,13 @@ const et = class et {
|
|
|
2105
2105
|
identifier: n,
|
|
2106
2106
|
altIdentifier: a,
|
|
2107
2107
|
subtitle: o,
|
|
2108
|
-
sortAs:
|
|
2108
|
+
sortAs: l,
|
|
2109
2109
|
artists: p,
|
|
2110
2110
|
authors: m,
|
|
2111
2111
|
colorists: u,
|
|
2112
2112
|
contributors: g,
|
|
2113
2113
|
editors: A,
|
|
2114
|
-
illustrators:
|
|
2114
|
+
illustrators: k,
|
|
2115
2115
|
inkers: d,
|
|
2116
2116
|
letterers: I,
|
|
2117
2117
|
narrators: G,
|
|
@@ -2147,13 +2147,13 @@ const et = class et {
|
|
|
2147
2147
|
}
|
|
2148
2148
|
/**
|
|
2149
2149
|
* Computes a [Layout] using the [conformsTo] profile and layout property.
|
|
2150
|
-
*
|
|
2150
|
+
*
|
|
2151
2151
|
* Special cases:
|
|
2152
2152
|
* - EPUB profile defaults to reflowable if layout is not present
|
|
2153
2153
|
* - Divina profile defaults to fixed if layout is not present
|
|
2154
2154
|
* - Layout is ignored for audiobook and PDF profiles
|
|
2155
2155
|
* - Layout is ignored if set to reflowable on a Divina profile
|
|
2156
|
-
*
|
|
2156
|
+
*
|
|
2157
2157
|
* Note: Stops at the first matching profile.
|
|
2158
2158
|
*/
|
|
2159
2159
|
get effectiveLayout() {
|
|
@@ -2246,7 +2246,7 @@ class Xt {
|
|
|
2246
2246
|
static deserialize(t) {
|
|
2247
2247
|
if (t)
|
|
2248
2248
|
return new Xt({
|
|
2249
|
-
links:
|
|
2249
|
+
links: O.deserialize(t.links),
|
|
2250
2250
|
guided: K.deserializeArray(t.guided)
|
|
2251
2251
|
});
|
|
2252
2252
|
}
|
|
@@ -2324,7 +2324,7 @@ class K {
|
|
|
2324
2324
|
description: K.deserialize(t.description)
|
|
2325
2325
|
});
|
|
2326
2326
|
}
|
|
2327
|
-
/**
|
|
2327
|
+
/**
|
|
2328
2328
|
* Parses a [GuidedNavigationObject] array from its RWPM JSON representation.
|
|
2329
2329
|
*/
|
|
2330
2330
|
static deserializeArray(t) {
|
|
@@ -2475,7 +2475,7 @@ const wt = {
|
|
|
2475
2475
|
"Sat"
|
|
2476
2476
|
];
|
|
2477
2477
|
function fe(s) {
|
|
2478
|
-
return /^[A-Z][a-z].*/.test(s) ||
|
|
2478
|
+
return /^[A-Z][a-z].*/.test(s) || Ot(s);
|
|
2479
2479
|
}
|
|
2480
2480
|
function mi(s) {
|
|
2481
2481
|
return fe(s) || /``|"|'/.test(s.substring(0, 2));
|
|
@@ -2498,7 +2498,7 @@ function ne(s) {
|
|
|
2498
2498
|
function ae(s) {
|
|
2499
2499
|
return s.length <= 3 ? !0 : fe(s);
|
|
2500
2500
|
}
|
|
2501
|
-
function
|
|
2501
|
+
function Ot(s, t) {
|
|
2502
2502
|
return t && (s = s.slice(t - 1, t + 2)), !isNaN(Number(s));
|
|
2503
2503
|
}
|
|
2504
2504
|
function vi(s) {
|
|
@@ -2528,9 +2528,9 @@ function Si(s, t) {
|
|
|
2528
2528
|
// Split into words
|
|
2529
2529
|
s.re(e, { split: !0 }),
|
|
2530
2530
|
// Merge words as sentences
|
|
2531
|
-
s.splitAndMerge(function(i, r, n, a, o,
|
|
2532
|
-
var p, m = [i, null], u = i, g =
|
|
2533
|
-
return !e.test(
|
|
2531
|
+
s.splitAndMerge(function(i, r, n, a, o, l) {
|
|
2532
|
+
var p, m = [i, null], u = i, g = l.slice(o + 1).find(function(k) {
|
|
2533
|
+
return !e.test(k.value);
|
|
2534
2534
|
});
|
|
2535
2535
|
if (i === `
|
|
2536
2536
|
` && t.newlineBoundary || wi(i) || wt.endsWithChar(i, "?!"))
|
|
@@ -2540,7 +2540,7 @@ function Si(s, t) {
|
|
|
2540
2540
|
if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || gi(i))
|
|
2541
2541
|
return u;
|
|
2542
2542
|
if (mi(g.value)) {
|
|
2543
|
-
if (bi(i, g.value) ||
|
|
2543
|
+
if (bi(i, g.value) || Ot(g.value) && ae(i))
|
|
2544
2544
|
return u;
|
|
2545
2545
|
} else if (wt.endsWith(i, "..") || ne(i) || ae(i))
|
|
2546
2546
|
return u;
|
|
@@ -2548,7 +2548,7 @@ function Si(s, t) {
|
|
|
2548
2548
|
return m;
|
|
2549
2549
|
}
|
|
2550
2550
|
let A;
|
|
2551
|
-
return (A = i.indexOf(".")) > -1 && (
|
|
2551
|
+
return (A = i.indexOf(".")) > -1 && (Ot(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p = yi(i)) ? [
|
|
2552
2552
|
p[0] + p[1],
|
|
2553
2553
|
null,
|
|
2554
2554
|
p[2]
|
|
@@ -2590,14 +2590,14 @@ function Ni(s, t) {
|
|
|
2590
2590
|
}), typeof i == "object" && (i.index = i.index || 0, e = e + i.index + i.offset, i.index = s.index + i.index, i.offset = i.offset || i.value.length), i);
|
|
2591
2591
|
});
|
|
2592
2592
|
}
|
|
2593
|
-
function
|
|
2593
|
+
function Li(s, t) {
|
|
2594
2594
|
if (s.length == 0) return null;
|
|
2595
2595
|
var e = "", i = 0, r = s[0]?.index;
|
|
2596
2596
|
return s.forEach(function(n, a) {
|
|
2597
2597
|
var o = s[a - 1];
|
|
2598
2598
|
s[a + 1];
|
|
2599
|
-
var
|
|
2600
|
-
e = e + new Array(
|
|
2599
|
+
var l = o ? n.index + 1 - (o.index + o.offset) : 0;
|
|
2600
|
+
e = e + new Array(l).join(t) + n.value;
|
|
2601
2601
|
var p = n.index - r + n.offset;
|
|
2602
2602
|
p > i && (i = p);
|
|
2603
2603
|
}), {
|
|
@@ -2611,13 +2611,13 @@ const j = {
|
|
|
2611
2611
|
tokensId: Ii,
|
|
2612
2612
|
normalize: Ni,
|
|
2613
2613
|
properties: xi,
|
|
2614
|
-
merge:
|
|
2614
|
+
merge: Li
|
|
2615
2615
|
};
|
|
2616
|
-
var
|
|
2617
|
-
"([^" +
|
|
2616
|
+
var Oi = ' \r\n !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
|
|
2617
|
+
"([^" + Oi + "]+)"
|
|
2618
2618
|
);
|
|
2619
|
-
function
|
|
2620
|
-
if (!(this instanceof
|
|
2619
|
+
function z(s) {
|
|
2620
|
+
if (!(this instanceof z)) return new z(s);
|
|
2621
2621
|
this.opts = Object.assign({
|
|
2622
2622
|
cacheGet: function(t) {
|
|
2623
2623
|
return null;
|
|
@@ -2626,18 +2626,18 @@ function C(s) {
|
|
|
2626
2626
|
}
|
|
2627
2627
|
}, s);
|
|
2628
2628
|
}
|
|
2629
|
-
|
|
2629
|
+
z.prototype.split = function(t, e = {}) {
|
|
2630
2630
|
var i = this;
|
|
2631
2631
|
return e = Object.assign({ preserveProperties: !0, cache: () => null }, e), function(r, n) {
|
|
2632
2632
|
if (arguments.length === 6) return t.apply(null, arguments);
|
|
2633
|
-
var a, o,
|
|
2633
|
+
var a, o, l;
|
|
2634
2634
|
if (r === void 0) return [];
|
|
2635
2635
|
if (typeof r == "string" ? r = [{
|
|
2636
2636
|
value: r,
|
|
2637
2637
|
index: 0,
|
|
2638
2638
|
offset: r.length
|
|
2639
|
-
}] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (
|
|
2640
|
-
return
|
|
2639
|
+
}] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (l = i.opts.cacheGet(o), l))
|
|
2640
|
+
return l;
|
|
2641
2641
|
var p = r.map(function(m, u) {
|
|
2642
2642
|
var g = r[u + 1], A = t(
|
|
2643
2643
|
m.value,
|
|
@@ -2648,9 +2648,9 @@ C.prototype.split = function(t, e = {}) {
|
|
|
2648
2648
|
r
|
|
2649
2649
|
) || [];
|
|
2650
2650
|
if (A = j.normalize(m, A), e.preserveProperties) {
|
|
2651
|
-
var
|
|
2651
|
+
var k = j.properties(m);
|
|
2652
2652
|
A = A.map(function(d) {
|
|
2653
|
-
return Object.assign({}, d,
|
|
2653
|
+
return Object.assign({}, d, k);
|
|
2654
2654
|
});
|
|
2655
2655
|
}
|
|
2656
2656
|
return a = m, A;
|
|
@@ -2658,15 +2658,15 @@ C.prototype.split = function(t, e = {}) {
|
|
|
2658
2658
|
return o && i.opts.cacheSet(o, p), p;
|
|
2659
2659
|
};
|
|
2660
2660
|
};
|
|
2661
|
-
|
|
2661
|
+
z.prototype.re = function(t, e = {}) {
|
|
2662
2662
|
return e = Object.assign({ split: !1 }, e), this.split(function(i, r) {
|
|
2663
|
-
for (var n = i, a = [], o,
|
|
2664
|
-
var p = o.index, m =
|
|
2665
|
-
if (e.split &&
|
|
2666
|
-
var A = n.slice(
|
|
2663
|
+
for (var n = i, a = [], o, l = 0; o = t.exec(i); ) {
|
|
2664
|
+
var p = o.index, m = l + p, u = o[0] || "", g = u.length;
|
|
2665
|
+
if (e.split && l < m) {
|
|
2666
|
+
var A = n.slice(l, m);
|
|
2667
2667
|
a.push({
|
|
2668
2668
|
value: A,
|
|
2669
|
-
index:
|
|
2669
|
+
index: l,
|
|
2670
2670
|
offset: A.length
|
|
2671
2671
|
});
|
|
2672
2672
|
}
|
|
@@ -2675,11 +2675,11 @@ C.prototype.re = function(t, e = {}) {
|
|
|
2675
2675
|
index: m,
|
|
2676
2676
|
offset: g,
|
|
2677
2677
|
match: o
|
|
2678
|
-
}), i = i.slice(p + g),
|
|
2678
|
+
}), i = i.slice(p + g), l = m + g;
|
|
2679
2679
|
}
|
|
2680
2680
|
return e.split && i && a.push({
|
|
2681
2681
|
value: i,
|
|
2682
|
-
index:
|
|
2682
|
+
index: l,
|
|
2683
2683
|
offset: i.length
|
|
2684
2684
|
}), a;
|
|
2685
2685
|
}, {
|
|
@@ -2688,17 +2688,17 @@ C.prototype.re = function(t, e = {}) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
});
|
|
2690
2690
|
};
|
|
2691
|
-
|
|
2691
|
+
z.prototype.splitAndMerge = function(t, e = {}) {
|
|
2692
2692
|
var i = this;
|
|
2693
2693
|
return e = Object.assign({ mergeWith: "" }, e), function(r) {
|
|
2694
2694
|
var n = [], a = [];
|
|
2695
2695
|
function o() {
|
|
2696
2696
|
if (a.length != 0) {
|
|
2697
|
-
var
|
|
2698
|
-
n.push(
|
|
2697
|
+
var l = j.merge(a, e.mergeWith);
|
|
2698
|
+
n.push(l), a = [];
|
|
2699
2699
|
}
|
|
2700
2700
|
}
|
|
2701
|
-
return i.split(function(
|
|
2701
|
+
return i.split(function(l, p) {
|
|
2702
2702
|
var m = t.apply(null, arguments);
|
|
2703
2703
|
m = j.normalize(p, m), m.forEach(function(u) {
|
|
2704
2704
|
u === null ? o() : a.push(u);
|
|
@@ -2706,7 +2706,7 @@ C.prototype.splitAndMerge = function(t, e = {}) {
|
|
|
2706
2706
|
})(r), o(), n;
|
|
2707
2707
|
};
|
|
2708
2708
|
};
|
|
2709
|
-
|
|
2709
|
+
z.prototype.filter = function(t) {
|
|
2710
2710
|
return this.split(function(e, i) {
|
|
2711
2711
|
if (t.apply(null, arguments))
|
|
2712
2712
|
return {
|
|
@@ -2716,7 +2716,7 @@ C.prototype.filter = function(t) {
|
|
|
2716
2716
|
};
|
|
2717
2717
|
});
|
|
2718
2718
|
};
|
|
2719
|
-
|
|
2719
|
+
z.prototype.extend = function(t) {
|
|
2720
2720
|
return this.split(function(e, i) {
|
|
2721
2721
|
var r = typeof t == "function" ? t.apply(null, arguments) : t;
|
|
2722
2722
|
return Object.assign({
|
|
@@ -2726,7 +2726,7 @@ C.prototype.extend = function(t) {
|
|
|
2726
2726
|
}, r);
|
|
2727
2727
|
});
|
|
2728
2728
|
};
|
|
2729
|
-
|
|
2729
|
+
z.prototype.ifthen = function(s, t) {
|
|
2730
2730
|
return this.split(function(e, i) {
|
|
2731
2731
|
if (s.apply(null, arguments))
|
|
2732
2732
|
return t.apply(null, arguments);
|
|
@@ -2734,35 +2734,35 @@ C.prototype.ifthen = function(s, t) {
|
|
|
2734
2734
|
return n;
|
|
2735
2735
|
});
|
|
2736
2736
|
};
|
|
2737
|
-
|
|
2737
|
+
z.prototype.test = function(t) {
|
|
2738
2738
|
return this.filter(function(e, i) {
|
|
2739
2739
|
return t.test(e);
|
|
2740
2740
|
}, {
|
|
2741
2741
|
cache: t.toString()
|
|
2742
2742
|
});
|
|
2743
2743
|
};
|
|
2744
|
-
|
|
2744
|
+
z.prototype.flow = function(...t) {
|
|
2745
2745
|
const e = t.reduce((i, r) => (...n) => r(i(...n)));
|
|
2746
2746
|
return this.split(e);
|
|
2747
2747
|
};
|
|
2748
|
-
|
|
2748
|
+
z.prototype.serie = function(...t) {
|
|
2749
2749
|
return t.reduce((e, i) => (...r) => i(e(...r)));
|
|
2750
2750
|
};
|
|
2751
|
-
|
|
2751
|
+
z.prototype.merge = function() {
|
|
2752
2752
|
return this.splitAndMerge((s) => [s]);
|
|
2753
2753
|
};
|
|
2754
|
-
|
|
2754
|
+
z.prototype.sections = function() {
|
|
2755
2755
|
return this.re(/([^\n\.,;!?]+)/i, { split: !1 });
|
|
2756
2756
|
};
|
|
2757
|
-
|
|
2757
|
+
z.prototype.words = function() {
|
|
2758
2758
|
return this.re(zi);
|
|
2759
2759
|
};
|
|
2760
|
-
|
|
2760
|
+
z.prototype.characters = function() {
|
|
2761
2761
|
return this.re(/[^\s]/);
|
|
2762
2762
|
};
|
|
2763
2763
|
var Ci = /* @__PURE__ */ ((s) => (s.Word = "word", s.Sentence = "sentence", s.Paragraph = "paragraph", s))(Ci || {});
|
|
2764
|
-
const Ri = (s, t) => "Segmenter" in Intl ? new
|
|
2765
|
-
class
|
|
2764
|
+
const Ri = (s, t) => "Segmenter" in Intl ? new ki(s, t) : new Pi(s, t);
|
|
2765
|
+
class ki {
|
|
2766
2766
|
constructor(t, e) {
|
|
2767
2767
|
if (this.unit = e, t = t ?? navigator?.language, !("Segmenter" in Intl)) throw new Error("Intl.Segmenter is not supported in this environment");
|
|
2768
2768
|
if (e === "paragraph") throw new Error("IntlTextTokenizer does not handle TextUnit.Paragraph");
|
|
@@ -2780,10 +2780,10 @@ class Pi {
|
|
|
2780
2780
|
return i;
|
|
2781
2781
|
}
|
|
2782
2782
|
}
|
|
2783
|
-
class
|
|
2783
|
+
class Pi {
|
|
2784
2784
|
constructor(t, e) {
|
|
2785
2785
|
if (this.unit = e, t = t ?? navigator?.language, this.isEnglish = t.toLowerCase().split("-")[0] === "en", e === "paragraph") throw new Error("NaiveTextTokenizer does not handle TextUnit.Paragraph");
|
|
2786
|
-
this.tokenizer = new
|
|
2786
|
+
this.tokenizer = new z();
|
|
2787
2787
|
}
|
|
2788
2788
|
tokenize(t) {
|
|
2789
2789
|
let e = [];
|
|
@@ -2810,21 +2810,21 @@ const Di = new RegExp("[\\p{L}\\p{N}]+", "u"), pe = (s) => {
|
|
|
2810
2810
|
const t = s.trimEnd();
|
|
2811
2811
|
return t.length === 0 || t.match(Di) === null ? null : t;
|
|
2812
2812
|
};
|
|
2813
|
-
class
|
|
2813
|
+
class C {
|
|
2814
2814
|
constructor(t, e) {
|
|
2815
|
-
this._allItems = t, this.linkMap = e;
|
|
2815
|
+
this._trimmedLinkMap = /* @__PURE__ */ new Map(), this._allItems = t, this.linkMap = e;
|
|
2816
2816
|
}
|
|
2817
2817
|
static build(t, e = {}) {
|
|
2818
2818
|
const i = t.toc?.items ?? [], r = t.readingOrder.items, { depth: n } = e, a = /* @__PURE__ */ new Map(), o = [];
|
|
2819
|
-
for (let
|
|
2820
|
-
const p = r[
|
|
2819
|
+
for (let l = 0; l < r.length; l++) {
|
|
2820
|
+
const p = r[l], m = C.bareHref(p.href), u = p.title ?? C.findTitleInToc(i, m, n) ?? `Resource ${l + 1}`, g = C.collectChildrenFromToc(i, m, n, 1, a), A = {
|
|
2821
2821
|
title: u,
|
|
2822
2822
|
references: [p.href],
|
|
2823
2823
|
children: g.length > 0 ? g : void 0
|
|
2824
2824
|
};
|
|
2825
2825
|
a.set(A, p), o.push(A);
|
|
2826
2826
|
}
|
|
2827
|
-
return new
|
|
2827
|
+
return new C(o, a);
|
|
2828
2828
|
}
|
|
2829
2829
|
/**
|
|
2830
2830
|
* The active depth limit for TOC traversal (title resolution and child
|
|
@@ -2839,14 +2839,18 @@ class x {
|
|
|
2839
2839
|
}
|
|
2840
2840
|
/** Top-level timeline items. Cached; invalidated when `depth` changes. */
|
|
2841
2841
|
get items() {
|
|
2842
|
-
return this._items || (this.
|
|
2842
|
+
return this._items || (this._depth !== void 0 ? (this._trimmedLinkMap = /* @__PURE__ */ new Map(), this._items = C.trimToDepth(this._allItems, this._depth, this.linkMap, this._trimmedLinkMap)) : this._items = this._allItems), this._items;
|
|
2843
2843
|
}
|
|
2844
2844
|
locate(t) {
|
|
2845
2845
|
const e = t.href.split("#")[0], i = t.locations?.time();
|
|
2846
2846
|
let r;
|
|
2847
|
-
if (i !== void 0)
|
|
2848
|
-
|
|
2849
|
-
|
|
2847
|
+
if (i !== void 0) {
|
|
2848
|
+
let n = -1 / 0;
|
|
2849
|
+
for (const a of this.flat) {
|
|
2850
|
+
const o = this.itemStartTime(a, e);
|
|
2851
|
+
o !== void 0 && o <= i && o > n && (n = o, r = a);
|
|
2852
|
+
}
|
|
2853
|
+
}
|
|
2850
2854
|
return r || (r = this.flat.find((n) => this.bareHrefFromItem(n) === e)), r;
|
|
2851
2855
|
}
|
|
2852
2856
|
adjacentTo(t) {
|
|
@@ -2866,13 +2870,12 @@ class x {
|
|
|
2866
2870
|
if (!n.children?.length) return n;
|
|
2867
2871
|
if (i !== void 0) {
|
|
2868
2872
|
const o = e * i;
|
|
2869
|
-
let
|
|
2870
|
-
for (const
|
|
2871
|
-
const
|
|
2872
|
-
|
|
2873
|
-
h = p;
|
|
2873
|
+
let l = n, p = -1 / 0;
|
|
2874
|
+
for (const m of n.children) {
|
|
2875
|
+
const u = this.timeFromItem(m);
|
|
2876
|
+
u !== void 0 && u <= o && u > p && (p = u, l = m);
|
|
2874
2877
|
}
|
|
2875
|
-
return
|
|
2878
|
+
return l;
|
|
2876
2879
|
}
|
|
2877
2880
|
const a = Math.min(Math.floor(e * n.children.length), n.children.length - 1);
|
|
2878
2881
|
return n.children[a];
|
|
@@ -2881,7 +2884,7 @@ class x {
|
|
|
2881
2884
|
return this.ancestorPath(this.items, t) ?? [];
|
|
2882
2885
|
}
|
|
2883
2886
|
linkFor(t) {
|
|
2884
|
-
return this.linkMap.get(t);
|
|
2887
|
+
return this.linkMap.get(t) ?? this._trimmedLinkMap.get(t);
|
|
2885
2888
|
}
|
|
2886
2889
|
get flat() {
|
|
2887
2890
|
return this._flat || (this._flat = this.flattenItems(this.items)), this._flat;
|
|
@@ -2897,7 +2900,7 @@ class x {
|
|
|
2897
2900
|
* 3. Multiple fragment entries — ambiguous, returns `undefined`.
|
|
2898
2901
|
*/
|
|
2899
2902
|
static findTitleInToc(t, e, i) {
|
|
2900
|
-
const { atStart: r, fragments: n } =
|
|
2903
|
+
const { atStart: r, fragments: n } = C.collectTocCandidates(t, e, i, 1);
|
|
2901
2904
|
if (r.length > 0) return r[0].title;
|
|
2902
2905
|
if (n.length === 1) return n[0].title;
|
|
2903
2906
|
}
|
|
@@ -2911,11 +2914,11 @@ class x {
|
|
|
2911
2914
|
if (i !== void 0 && r > i) return [];
|
|
2912
2915
|
const a = [];
|
|
2913
2916
|
for (const o of t) {
|
|
2914
|
-
if (
|
|
2915
|
-
const
|
|
2916
|
-
n.set(
|
|
2917
|
+
if (C.bareHref(o.href) === e && o.title && !C.isStartOfResource(o.href)) {
|
|
2918
|
+
const l = { title: o.title, references: [o.href] };
|
|
2919
|
+
n.set(l, o), a.push(l);
|
|
2917
2920
|
}
|
|
2918
|
-
o.children?.items?.length && a.push(...
|
|
2921
|
+
o.children?.items?.length && a.push(...C.collectChildrenFromToc(
|
|
2919
2922
|
o.children.items,
|
|
2920
2923
|
e,
|
|
2921
2924
|
i,
|
|
@@ -2935,33 +2938,40 @@ class x {
|
|
|
2935
2938
|
return { atStart: [], fragments: [] };
|
|
2936
2939
|
const n = [], a = [];
|
|
2937
2940
|
for (const o of t)
|
|
2938
|
-
if (
|
|
2939
|
-
const
|
|
2941
|
+
if (C.bareHref(o.href) === e && o.title && (C.isStartOfResource(o.href) ? n.push(o) : a.push(o)), o.children?.items?.length) {
|
|
2942
|
+
const l = C.collectTocCandidates(
|
|
2940
2943
|
o.children.items,
|
|
2941
2944
|
e,
|
|
2942
2945
|
i,
|
|
2943
2946
|
r + 1
|
|
2944
2947
|
);
|
|
2945
|
-
n.push(...
|
|
2948
|
+
n.push(...l.atStart), a.push(...l.fragments);
|
|
2946
2949
|
}
|
|
2947
2950
|
return { atStart: n, fragments: a };
|
|
2948
2951
|
}
|
|
2949
2952
|
/**
|
|
2950
2953
|
* A TOC href points to the start of its resource when it has no fragment,
|
|
2951
|
-
* or when the fragment
|
|
2954
|
+
* or when the fragment contains a parsable `t=` value of 0 (audio: explicit
|
|
2955
|
+
* beginning of the file). Accepts decimals and extra params, e.g. `t=0.0`
|
|
2956
|
+
* or `foo=bar&t=0`.
|
|
2952
2957
|
*/
|
|
2953
2958
|
static isStartOfResource(t) {
|
|
2954
2959
|
const e = t.split("#")[1];
|
|
2955
|
-
|
|
2960
|
+
if (!e) return !0;
|
|
2961
|
+
const i = e.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2962
|
+
return i !== null && parseFloat(i[1]) === 0;
|
|
2956
2963
|
}
|
|
2957
2964
|
// -------------------------------------------------------------------------
|
|
2958
2965
|
// Shared utilities
|
|
2959
2966
|
// -------------------------------------------------------------------------
|
|
2960
|
-
static trimToDepth(t, e) {
|
|
2961
|
-
return t.map((
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2967
|
+
static trimToDepth(t, e, i, r) {
|
|
2968
|
+
return t.map((n) => {
|
|
2969
|
+
const a = {
|
|
2970
|
+
...n,
|
|
2971
|
+
children: e > 1 && n.children?.length ? C.trimToDepth(n.children, e - 1, i, r) : void 0
|
|
2972
|
+
}, o = i.get(n);
|
|
2973
|
+
return o && r.set(a, o), a;
|
|
2974
|
+
});
|
|
2965
2975
|
}
|
|
2966
2976
|
flattenItems(t) {
|
|
2967
2977
|
const e = [];
|
|
@@ -2969,18 +2979,14 @@ class x {
|
|
|
2969
2979
|
e.push(i), i.children && e.push(...this.flattenItems(i.children));
|
|
2970
2980
|
return e;
|
|
2971
2981
|
}
|
|
2972
|
-
|
|
2973
|
-
for (const
|
|
2974
|
-
const
|
|
2975
|
-
if ((
|
|
2976
|
-
|
|
2982
|
+
itemStartTime(t, e) {
|
|
2983
|
+
for (const i of t.references) {
|
|
2984
|
+
const r = i.indexOf("#"), n = r >= 0 ? i.slice(0, r) : i, a = r >= 0 ? i.slice(r + 1) : void 0;
|
|
2985
|
+
if ((n || this.bareHrefFromItem(t)) !== e) continue;
|
|
2986
|
+
if (!a) return;
|
|
2987
|
+
const l = a.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2988
|
+
return l ? parseFloat(l[1]) : void 0;
|
|
2977
2989
|
}
|
|
2978
|
-
return !1;
|
|
2979
|
-
}
|
|
2980
|
-
static parseTimeFragment(t) {
|
|
2981
|
-
if (!t) return 0;
|
|
2982
|
-
const e = t.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2983
|
-
return e ? parseFloat(e[1]) : 0;
|
|
2984
2990
|
}
|
|
2985
2991
|
bareHrefFromItem(t) {
|
|
2986
2992
|
return (t.references[0] ?? "").split("#")[0];
|
|
@@ -3013,11 +3019,10 @@ class Y {
|
|
|
3013
3019
|
}
|
|
3014
3020
|
/**
|
|
3015
3021
|
* Returns the publication's timeline, built from its reading order and table of contents.
|
|
3016
|
-
*
|
|
3017
|
-
* with a specific configuration (e.g. a depth limit).
|
|
3022
|
+
* The result is cached after the first call.
|
|
3018
3023
|
*/
|
|
3019
3024
|
get timeline() {
|
|
3020
|
-
return this._timeline || (this._timeline =
|
|
3025
|
+
return this._timeline || (this._timeline = C.build(this)), this._timeline;
|
|
3021
3026
|
}
|
|
3022
3027
|
/** The URL where this publication is served, computed from the `Link` with `self` relation.
|
|
3023
3028
|
* e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
|
|
@@ -3050,7 +3055,7 @@ class Y {
|
|
|
3050
3055
|
/**
|
|
3051
3056
|
* Gets the cover image for the publication.
|
|
3052
3057
|
* First looks for rel='cover' in links/resources/readingOrder,
|
|
3053
|
-
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG)
|
|
3058
|
+
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG).
|
|
3054
3059
|
*/
|
|
3055
3060
|
getCover() {
|
|
3056
3061
|
const t = [
|
|
@@ -3492,7 +3497,7 @@ class _i {
|
|
|
3492
3497
|
}
|
|
3493
3498
|
class or {
|
|
3494
3499
|
/**
|
|
3495
|
-
*
|
|
3500
|
+
*
|
|
3496
3501
|
* @param defaultLanguage The default assumed language
|
|
3497
3502
|
* @param unit The unit of the produced [Locator]s.
|
|
3498
3503
|
* @param contextSnippetLength Length of `before` and `after` snippets in the produced [Locator]s.
|
|
@@ -4004,21 +4009,21 @@ function ms(s) {
|
|
|
4004
4009
|
const t = s.map(Ne);
|
|
4005
4010
|
return at(t);
|
|
4006
4011
|
}
|
|
4007
|
-
function
|
|
4012
|
+
function Le(s) {
|
|
4008
4013
|
var t;
|
|
4009
4014
|
return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !ls.test(e)).map((e) => `.${rt(e)}`);
|
|
4010
4015
|
}
|
|
4011
4016
|
function gs(s) {
|
|
4012
|
-
const t = s.map(
|
|
4017
|
+
const t = s.map(Le);
|
|
4013
4018
|
return at(t);
|
|
4014
4019
|
}
|
|
4015
|
-
function
|
|
4020
|
+
function Oe(s) {
|
|
4016
4021
|
var t;
|
|
4017
4022
|
const e = (t = s.getAttribute("id")) !== null && t !== void 0 ? t : "", i = `#${rt(e)}`, r = s.getRootNode({ composed: !1 });
|
|
4018
4023
|
return !cs.test(e) && te([s], i, r) ? [i] : [];
|
|
4019
4024
|
}
|
|
4020
4025
|
function bs(s) {
|
|
4021
|
-
return s.length === 0 || s.length > 1 ? [] :
|
|
4026
|
+
return s.length === 0 || s.length > 1 ? [] : Oe(s[0]);
|
|
4022
4027
|
}
|
|
4023
4028
|
function ze(s) {
|
|
4024
4029
|
var t;
|
|
@@ -4044,7 +4049,7 @@ function Re(s) {
|
|
|
4044
4049
|
];
|
|
4045
4050
|
return t.length === 0 || t.length > 1 ? [] : [t[0]];
|
|
4046
4051
|
}
|
|
4047
|
-
function
|
|
4052
|
+
function ke(s) {
|
|
4048
4053
|
const t = Re([s])[0], e = s.parentElement;
|
|
4049
4054
|
if (e) {
|
|
4050
4055
|
const r = Array.from(e.children).filter((n) => n.tagName.toLowerCase() === t).indexOf(s);
|
|
@@ -4056,15 +4061,15 @@ function Pe(s) {
|
|
|
4056
4061
|
return [];
|
|
4057
4062
|
}
|
|
4058
4063
|
function As(s) {
|
|
4059
|
-
return at(s.map(
|
|
4064
|
+
return at(s.map(ke));
|
|
4060
4065
|
}
|
|
4061
|
-
function*
|
|
4062
|
-
let e = 0, i =
|
|
4066
|
+
function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
4067
|
+
let e = 0, i = kt(1);
|
|
4063
4068
|
for (; i.length <= s.length && e < t; )
|
|
4064
4069
|
e += 1, yield i.map((n) => s[n]), i = ws(i, s.length - 1);
|
|
4065
4070
|
}
|
|
4066
4071
|
function ys(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
4067
|
-
return Array.from(
|
|
4072
|
+
return Array.from(Pe(s, { maxResults: t }));
|
|
4068
4073
|
}
|
|
4069
4074
|
function ws(s = [], t = 0) {
|
|
4070
4075
|
const e = s.length;
|
|
@@ -4075,12 +4080,12 @@ function ws(s = [], t = 0) {
|
|
|
4075
4080
|
for (let r = e - 1; r >= 0; r--)
|
|
4076
4081
|
if (i[r] > t) {
|
|
4077
4082
|
if (r === 0)
|
|
4078
|
-
return
|
|
4083
|
+
return kt(e + 1);
|
|
4079
4084
|
i[r - 1]++, i[r] = i[r - 1] + 1;
|
|
4080
4085
|
}
|
|
4081
|
-
return i[e - 1] > t ?
|
|
4086
|
+
return i[e - 1] > t ? kt(e + 1) : i;
|
|
4082
4087
|
}
|
|
4083
|
-
function
|
|
4088
|
+
function kt(s = 1) {
|
|
4084
4089
|
return Array.from(Array(s).keys());
|
|
4085
4090
|
}
|
|
4086
4091
|
function* Ss(s = {}) {
|
|
@@ -4100,10 +4105,10 @@ function* Ss(s = {}) {
|
|
|
4100
4105
|
continue;
|
|
4101
4106
|
}
|
|
4102
4107
|
const [a, o] = t[r];
|
|
4103
|
-
for (let
|
|
4108
|
+
for (let l = o.length - 1; l >= 0; l--)
|
|
4104
4109
|
e.push({
|
|
4105
4110
|
index: r - 1,
|
|
4106
|
-
partial: Object.assign(Object.assign({}, n), { [a]: o[
|
|
4111
|
+
partial: Object.assign(Object.assign({}, n), { [a]: o[l] })
|
|
4107
4112
|
});
|
|
4108
4113
|
}
|
|
4109
4114
|
}
|
|
@@ -4123,16 +4128,16 @@ const xs = {
|
|
|
4123
4128
|
nthoftype: As
|
|
4124
4129
|
}, Ns = {
|
|
4125
4130
|
tag: Ce,
|
|
4126
|
-
id:
|
|
4127
|
-
class:
|
|
4131
|
+
id: Oe,
|
|
4132
|
+
class: Le,
|
|
4128
4133
|
attribute: Ne,
|
|
4129
4134
|
nthchild: ze,
|
|
4130
|
-
nthoftype:
|
|
4135
|
+
nthoftype: ke
|
|
4131
4136
|
};
|
|
4132
|
-
function
|
|
4137
|
+
function Ls(s, t) {
|
|
4133
4138
|
return Ns[t](s);
|
|
4134
4139
|
}
|
|
4135
|
-
function
|
|
4140
|
+
function Os(s, t) {
|
|
4136
4141
|
const e = xs[t];
|
|
4137
4142
|
return e(s);
|
|
4138
4143
|
}
|
|
@@ -4146,18 +4151,18 @@ function Cs(s = [], t) {
|
|
|
4146
4151
|
});
|
|
4147
4152
|
}
|
|
4148
4153
|
function* Rs(s, t) {
|
|
4149
|
-
const e = /* @__PURE__ */ new Set(), i =
|
|
4154
|
+
const e = /* @__PURE__ */ new Set(), i = ks(s, t);
|
|
4150
4155
|
for (const r of Ms(i, t))
|
|
4151
4156
|
e.has(r) || (e.add(r), yield r);
|
|
4152
4157
|
}
|
|
4153
|
-
function
|
|
4154
|
-
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i),
|
|
4155
|
-
const u =
|
|
4156
|
-
return p[m] = r ? Array.from(
|
|
4158
|
+
function ks(s, t) {
|
|
4159
|
+
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), l = (p, m) => {
|
|
4160
|
+
const u = Os(s, m), g = zs(u, a, o), A = Cs(g, o);
|
|
4161
|
+
return p[m] = r ? Array.from(Pe(A, { maxResults: n })) : A.map((k) => [k]), p;
|
|
4157
4162
|
};
|
|
4158
|
-
return
|
|
4163
|
+
return Ps(t).reduce(l, {});
|
|
4159
4164
|
}
|
|
4160
|
-
function
|
|
4165
|
+
function Ps(s) {
|
|
4161
4166
|
const { selectors: t, includeTag: e } = s, i = [...t];
|
|
4162
4167
|
return e && !i.includes("tag") && i.push("tag"), i;
|
|
4163
4168
|
}
|
|
@@ -4224,8 +4229,8 @@ function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
|
4224
4229
|
let r = t, n = e, a = !0;
|
|
4225
4230
|
for (; a; ) {
|
|
4226
4231
|
let o = !1;
|
|
4227
|
-
for (const
|
|
4228
|
-
const { foundElements: p, selector: m } =
|
|
4232
|
+
for (const l of Vs(s, r, n, i)) {
|
|
4233
|
+
const { foundElements: p, selector: m } = l;
|
|
4229
4234
|
if (o = !0, te(s, m, t))
|
|
4230
4235
|
yield m;
|
|
4231
4236
|
else {
|
|
@@ -4250,7 +4255,7 @@ function Xs(s) {
|
|
|
4250
4255
|
function Ks(s, t, e = bt.NONE) {
|
|
4251
4256
|
const i = {};
|
|
4252
4257
|
return t.forEach((r) => {
|
|
4253
|
-
Reflect.set(i, r,
|
|
4258
|
+
Reflect.set(i, r, Ls(s, r).map(Xs));
|
|
4254
4259
|
}), {
|
|
4255
4260
|
element: s,
|
|
4256
4261
|
operator: e,
|
|
@@ -4263,8 +4268,8 @@ function Zs({ selectors: s, operator: t }) {
|
|
|
4263
4268
|
let i = "";
|
|
4264
4269
|
return e.forEach((r) => {
|
|
4265
4270
|
var n;
|
|
4266
|
-
((n = s[r]) !== null && n !== void 0 ? n : []).forEach(({ value: o, include:
|
|
4267
|
-
|
|
4271
|
+
((n = s[r]) !== null && n !== void 0 ? n : []).forEach(({ value: o, include: l }) => {
|
|
4272
|
+
l && (i += o);
|
|
4268
4273
|
});
|
|
4269
4274
|
}), t + i;
|
|
4270
4275
|
}
|
|
@@ -4451,15 +4456,15 @@ class tr {
|
|
|
4451
4456
|
let n = e;
|
|
4452
4457
|
for (; n && n !== this.doc.body; ) {
|
|
4453
4458
|
for (let o = 0; o < n.attributes.length; o++) {
|
|
4454
|
-
const
|
|
4455
|
-
|
|
4459
|
+
const l = n.attributes[o];
|
|
4460
|
+
l.prefix && (r.has(n) ? r.set(n, r.get(n).concat([l])) : r.set(n, [l]), n.attributes.removeNamedItem(l.name));
|
|
4456
4461
|
}
|
|
4457
4462
|
n = n.parentElement;
|
|
4458
4463
|
}
|
|
4459
4464
|
const a = De(e, {
|
|
4460
4465
|
root: this.doc
|
|
4461
4466
|
});
|
|
4462
|
-
return r.forEach((o,
|
|
4467
|
+
return r.forEach((o, l) => o.forEach((p) => l.attributes.setNamedItem(p))), this.recipeCssSelectorCache.set(e, a), a;
|
|
4463
4468
|
}
|
|
4464
4469
|
// Implements NodeTraversor
|
|
4465
4470
|
head(t, e) {
|
|
@@ -4494,17 +4499,17 @@ class tr {
|
|
|
4494
4499
|
href: a
|
|
4495
4500
|
});
|
|
4496
4501
|
else {
|
|
4497
|
-
const
|
|
4502
|
+
const l = [...n.getElementsByTagName("source")].map((p) => {
|
|
4498
4503
|
const m = Et(p, this.baseLocator.href);
|
|
4499
4504
|
return m ? new M({
|
|
4500
4505
|
href: m,
|
|
4501
4506
|
type: p.getAttribute("type") || void 0
|
|
4502
4507
|
}) : null;
|
|
4503
4508
|
}).filter((p) => !!p);
|
|
4504
|
-
|
|
4505
|
-
href:
|
|
4506
|
-
type:
|
|
4507
|
-
alternates:
|
|
4509
|
+
l.length > 0 && (o = new M({
|
|
4510
|
+
href: l[0].href,
|
|
4511
|
+
type: l[0].type,
|
|
4512
|
+
alternates: l.length > 1 ? new O(l.slice(1)) : void 0
|
|
4508
4513
|
}));
|
|
4509
4514
|
}
|
|
4510
4515
|
o && (r === "AUDIO" ? this.elementRecipes.push({
|
|
@@ -4629,7 +4634,7 @@ class Ue {
|
|
|
4629
4634
|
* Creates a [LocatorCollection].
|
|
4630
4635
|
*/
|
|
4631
4636
|
constructor(t) {
|
|
4632
|
-
this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new
|
|
4637
|
+
this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new O([]), this.locators = t.locators ?? [];
|
|
4633
4638
|
}
|
|
4634
4639
|
/**
|
|
4635
4640
|
* Parses a [LocatorCollection] from its RWPM JSON representation.
|
|
@@ -4639,7 +4644,7 @@ class Ue {
|
|
|
4639
4644
|
let e, i = t.locators;
|
|
4640
4645
|
return i && Array.isArray(i) && (e = i.map((r) => D.deserialize(r)).filter((r) => r !== void 0)), new Ue({
|
|
4641
4646
|
metadata: At.deserialize(t.metadata),
|
|
4642
|
-
links:
|
|
4647
|
+
links: O.deserialize(t.links),
|
|
4643
4648
|
locators: e
|
|
4644
4649
|
});
|
|
4645
4650
|
}
|
|
@@ -4669,9 +4674,9 @@ class H {
|
|
|
4669
4674
|
if (!t) return;
|
|
4670
4675
|
let e, i, r;
|
|
4671
4676
|
if (Array.isArray(t))
|
|
4672
|
-
e =
|
|
4677
|
+
e = O.deserialize(t);
|
|
4673
4678
|
else if (typeof t == "object")
|
|
4674
|
-
e =
|
|
4679
|
+
e = O.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
|
|
4675
4680
|
i?.set(n, a);
|
|
4676
4681
|
}), r = H.deserializeCollections(t);
|
|
4677
4682
|
else
|
|
@@ -4736,9 +4741,9 @@ class Me {
|
|
|
4736
4741
|
if (!t) return;
|
|
4737
4742
|
const e = pt.deserialize(t.metadata);
|
|
4738
4743
|
if (!e) return;
|
|
4739
|
-
const i =
|
|
4744
|
+
const i = O.deserialize(t.links);
|
|
4740
4745
|
if (!i) return;
|
|
4741
|
-
const r =
|
|
4746
|
+
const r = O.deserialize(
|
|
4742
4747
|
t.readingOrder ? t.readingOrder : t.spine
|
|
4743
4748
|
);
|
|
4744
4749
|
if (r)
|
|
@@ -4747,8 +4752,8 @@ class Me {
|
|
|
4747
4752
|
metadata: e,
|
|
4748
4753
|
links: i,
|
|
4749
4754
|
readingOrder: r,
|
|
4750
|
-
resources:
|
|
4751
|
-
toc:
|
|
4755
|
+
resources: O.deserialize(t.resources),
|
|
4756
|
+
toc: O.deserialize(t.toc),
|
|
4752
4757
|
subcollections: H.deserializeCollections({
|
|
4753
4758
|
sub: t.sub
|
|
4754
4759
|
})
|
|
@@ -4799,17 +4804,17 @@ class Me {
|
|
|
4799
4804
|
/** Finds the first Link having the given `href` in the publication's links. */
|
|
4800
4805
|
linkWithHref(t) {
|
|
4801
4806
|
const e = (o) => {
|
|
4802
|
-
let
|
|
4807
|
+
let l;
|
|
4803
4808
|
for (const m of o)
|
|
4804
|
-
if (
|
|
4805
|
-
return
|
|
4809
|
+
if (l = m.findWithHref(t), l !== void 0)
|
|
4810
|
+
return l;
|
|
4806
4811
|
const p = new Array();
|
|
4807
4812
|
return o.forEach((m) => {
|
|
4808
4813
|
const u = [];
|
|
4809
4814
|
for (const g of m.items)
|
|
4810
4815
|
g.alternates && u.push(g.alternates), g.children && u.push(g.children);
|
|
4811
4816
|
p.push(...u);
|
|
4812
|
-
}), p.length > 0 && (
|
|
4817
|
+
}), p.length > 0 && (l = e(p)), l;
|
|
4813
4818
|
}, i = [];
|
|
4814
4819
|
i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
|
|
4815
4820
|
const r = e(i);
|
|
@@ -4868,12 +4873,12 @@ export {
|
|
|
4868
4873
|
Ui as AvailabilityStatus,
|
|
4869
4874
|
Q as BelongsTo,
|
|
4870
4875
|
Hi as Body,
|
|
4871
|
-
|
|
4876
|
+
Pt as Certification,
|
|
4872
4877
|
Wt as Conformance,
|
|
4873
4878
|
ar as Content,
|
|
4874
4879
|
ge as ContentElement,
|
|
4875
4880
|
dt as Contributor,
|
|
4876
|
-
|
|
4881
|
+
N as Contributors,
|
|
4877
4882
|
qt as Copies,
|
|
4878
4883
|
Ri as DefaultTextContentTokenizer,
|
|
4879
4884
|
Kt as DomRange,
|
|
@@ -4887,7 +4892,7 @@ export {
|
|
|
4887
4892
|
K as GuidedNavigationObject,
|
|
4888
4893
|
mt as GuidedNavigationText,
|
|
4889
4894
|
ur as HTMLResourceContentIterator,
|
|
4890
|
-
|
|
4895
|
+
P as Hazard,
|
|
4891
4896
|
li as HazardType,
|
|
4892
4897
|
Gt as Hazards,
|
|
4893
4898
|
Wi as Heading,
|
|
@@ -4896,12 +4901,12 @@ export {
|
|
|
4896
4901
|
ii as HttpResource,
|
|
4897
4902
|
it as IllegalStateError,
|
|
4898
4903
|
Gi as ImageElement,
|
|
4899
|
-
|
|
4904
|
+
ki as IntlTextTokenizer,
|
|
4900
4905
|
jt as Iterator,
|
|
4901
4906
|
X as Layout,
|
|
4902
4907
|
Ht as Legal,
|
|
4903
4908
|
M as Link,
|
|
4904
|
-
|
|
4909
|
+
O as Links,
|
|
4905
4910
|
f as Localization,
|
|
4906
4911
|
B as LocalizedString,
|
|
4907
4912
|
D as Locator,
|
|
@@ -4913,12 +4918,12 @@ export {
|
|
|
4913
4918
|
Vt as MediaOverlay,
|
|
4914
4919
|
c as MediaType,
|
|
4915
4920
|
pt as Metadata,
|
|
4916
|
-
|
|
4921
|
+
Pi as NaiveTextTokenizer,
|
|
4917
4922
|
Ut as Navigation,
|
|
4918
4923
|
ai as NonvisualReading,
|
|
4919
4924
|
ir as NumberRange,
|
|
4920
4925
|
St as PDFContentElement,
|
|
4921
|
-
|
|
4926
|
+
Lt as Page,
|
|
4922
4927
|
hr as PageContentIteratorPDF,
|
|
4923
4928
|
oi as PrerecordedAudio,
|
|
4924
4929
|
Zt as Price,
|
|
@@ -4942,7 +4947,7 @@ export {
|
|
|
4942
4947
|
be as TextSegment,
|
|
4943
4948
|
Ci as TextUnit,
|
|
4944
4949
|
yt as TextualElement,
|
|
4945
|
-
|
|
4950
|
+
C as Timeline,
|
|
4946
4951
|
ut as URITemplate,
|
|
4947
4952
|
Bi as VideoElement,
|
|
4948
4953
|
ni as VisualAdjustments,
|