@readium/shared 2.2.0-beta.2 → 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 +249 -252
- 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 +53 -44
- 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 -11
- 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
|
@@ -118,7 +118,7 @@ class V {
|
|
|
118
118
|
conformsTo: e.conformsTo ? e.conformsTo.map((i) => It.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
|
-
accessMode: e.accessMode ? e.accessMode.map((i) =>
|
|
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
124
|
hazard: e.hazard ? e.hazard.map((i) => P.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
@@ -213,16 +213,16 @@ const y = class y {
|
|
|
213
213
|
}
|
|
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
|
-
let
|
|
217
|
-
const
|
|
216
|
+
let R = y;
|
|
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 L = class L {
|
|
|
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 L = class L {
|
|
|
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;
|
|
@@ -413,13 +413,13 @@ class Dt {
|
|
|
413
413
|
compactString: o.compact,
|
|
414
414
|
descriptiveString: o.descriptive
|
|
415
415
|
});
|
|
416
|
-
let
|
|
417
|
-
e === "readable" ?
|
|
418
|
-
const
|
|
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:
|
|
421
|
-
compactString:
|
|
422
|
-
descriptiveString:
|
|
420
|
+
id: l,
|
|
421
|
+
compactString: p.compact,
|
|
422
|
+
descriptiveString: p.descriptive
|
|
423
423
|
}), i) {
|
|
424
424
|
const g = f.getString("ways-of-reading.nonvisual-reading.alt-text");
|
|
425
425
|
this.statements.push({
|
|
@@ -428,39 +428,39 @@ class Dt {
|
|
|
428
428
|
descriptiveString: g.descriptive
|
|
429
429
|
});
|
|
430
430
|
}
|
|
431
|
-
let
|
|
432
|
-
r === "synchronized" ?
|
|
433
|
-
const u = f.getString(
|
|
431
|
+
let m = "";
|
|
432
|
+
r === "synchronized" ? m = "ways-of-reading.prerecorded-audio.synchronized" : r === "audioOnly" ? m = "ways-of-reading.prerecorded-audio.only" : r === "audioComplementary" ? m = "ways-of-reading.prerecorded-audio.complementary" : r === "noMetadata" && (m = "ways-of-reading.prerecorded-audio.no-metadata");
|
|
433
|
+
const u = f.getString(m);
|
|
434
434
|
this.statements.push({
|
|
435
|
-
id:
|
|
435
|
+
id: m,
|
|
436
436
|
compactString: u.compact,
|
|
437
437
|
descriptiveString: u.descriptive
|
|
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 ?? [],
|
|
442
|
-
const
|
|
443
|
-
return Array.isArray(
|
|
444
|
-
}),
|
|
445
|
-
const
|
|
446
|
-
return Array.isArray(
|
|
447
|
-
}),
|
|
448
|
-
const
|
|
449
|
-
return Array.isArray(
|
|
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
|
+
const I = d.value;
|
|
443
|
+
return Array.isArray(I) ? I.every((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
444
|
+
}), p = a.some((d) => d.value === R.TEXTUAL.value) || o.some((d) => {
|
|
445
|
+
const I = d.value;
|
|
446
|
+
return Array.isArray(I) ? I.some((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
447
|
+
}), m = !(a.length === 0 && o.length === 0) && !a.some((d) => d.value === R.TEXTUAL.value) && !o.some((d) => {
|
|
448
|
+
const I = d.value;
|
|
449
|
+
return Array.isArray(I) ? I.some((G) => G === R.TEXTUAL.value) : I === R.TEXTUAL.value;
|
|
450
450
|
}), u = i.some((d) => [
|
|
451
451
|
v.LONG_DESCRIPTION.value,
|
|
452
452
|
v.ALTERNATIVE_TEXT.value,
|
|
453
453
|
v.DESCRIBED_MATH.value,
|
|
454
454
|
v.TRANSCRIPT.value
|
|
455
|
-
].includes(d.value)), g =
|
|
456
|
-
const
|
|
457
|
-
return Array.isArray(
|
|
458
|
-
}) ? "audioOnly" : a.some((d) => d.value ===
|
|
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
|
+
const I = d.value;
|
|
457
|
+
return Array.isArray(I) ? I.some((G) => G === R.AUDITORY.value) : I === R.AUDITORY.value;
|
|
458
|
+
}) ? "audioOnly" : a.some((d) => d.value === R.AUDITORY.value) ? "audioComplementary" : "noMetadata";
|
|
459
459
|
return new Dt(
|
|
460
460
|
n,
|
|
461
461
|
g,
|
|
462
462
|
A,
|
|
463
|
-
|
|
463
|
+
k
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
@@ -521,10 +521,10 @@ 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 =
|
|
526
|
-
const
|
|
527
|
-
if (this.title =
|
|
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
|
+
const m = f.getString(this.id);
|
|
527
|
+
if (this.title = m.compact, this.statements = [], t) {
|
|
528
528
|
const u = f.getString("rich-content.extended-descriptions");
|
|
529
529
|
this.statements.push({
|
|
530
530
|
id: "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",
|
|
@@ -588,7 +588,7 @@ class Mt {
|
|
|
588
588
|
descriptiveString: u.descriptive
|
|
589
589
|
});
|
|
590
590
|
}
|
|
591
|
-
if (
|
|
591
|
+
if (p) {
|
|
592
592
|
const u = f.getString("rich-content.transcript");
|
|
593
593
|
this.statements.push({
|
|
594
594
|
id: "rich-content.transcript",
|
|
@@ -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",
|
|
@@ -688,7 +688,7 @@ class Bt {
|
|
|
688
688
|
descriptiveString: d.descriptive
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
|
-
if (
|
|
691
|
+
if (p) {
|
|
692
692
|
const d = f.getString("additional-accessibility-information.large-print");
|
|
693
693
|
this.statements.push({
|
|
694
694
|
id: "additional-accessibility-information.large-print",
|
|
@@ -696,7 +696,7 @@ class Bt {
|
|
|
696
696
|
descriptiveString: d.descriptive
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
|
-
if (
|
|
699
|
+
if (m) {
|
|
700
700
|
const d = f.getString("additional-accessibility-information.sign-language");
|
|
701
701
|
this.statements.push({
|
|
702
702
|
id: "additional-accessibility-information.sign-language",
|
|
@@ -1066,7 +1066,7 @@ function lt(s) {
|
|
|
1066
1066
|
function Z(s) {
|
|
1067
1067
|
return isNaN(s) ? void 0 : s;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1069
|
+
function L(s) {
|
|
1070
1070
|
return Z(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
|
|
1071
1071
|
}
|
|
1072
1072
|
function ht(s) {
|
|
@@ -1116,19 +1116,19 @@ 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
|
-
|
|
1125
|
-
let
|
|
1123
|
+
const o = {}, l = Object.keys(a);
|
|
1124
|
+
l.sort((g, A) => g.localeCompare(A)), l.forEach((g) => o[g] = a[g]);
|
|
1125
|
+
let p = "";
|
|
1126
1126
|
for (const g in o) {
|
|
1127
1127
|
const A = o[g];
|
|
1128
|
-
|
|
1128
|
+
p += `;${g}=${A}`;
|
|
1129
1129
|
}
|
|
1130
|
-
const
|
|
1131
|
-
this.string =
|
|
1130
|
+
const m = `${e}/${i}${p}`, u = o.encoding;
|
|
1131
|
+
this.string = m, this.type = e, this.subtype = i, this.parameters = o, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
1132
1132
|
}
|
|
1133
1133
|
static parse(t) {
|
|
1134
1134
|
return new c(t);
|
|
@@ -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,
|
|
@@ -1711,14 +1711,14 @@ class M {
|
|
|
1711
1711
|
title: t.title,
|
|
1712
1712
|
rels: t.rel ? Array.isArray(t.rel) ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
|
|
1713
1713
|
properties: U.deserialize(t.properties),
|
|
1714
|
-
height:
|
|
1715
|
-
width:
|
|
1716
|
-
size:
|
|
1717
|
-
duration:
|
|
1718
|
-
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),
|
|
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 C {
|
|
|
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
|
}
|
|
@@ -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,15 +2105,15 @@ const et = class et {
|
|
|
2105
2105
|
identifier: n,
|
|
2106
2106
|
altIdentifier: a,
|
|
2107
2107
|
subtitle: o,
|
|
2108
|
-
sortAs:
|
|
2109
|
-
artists:
|
|
2110
|
-
authors:
|
|
2108
|
+
sortAs: l,
|
|
2109
|
+
artists: p,
|
|
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
|
-
letterers:
|
|
2116
|
+
letterers: I,
|
|
2117
2117
|
narrators: G,
|
|
2118
2118
|
pencilers: Be,
|
|
2119
2119
|
translators: Ge,
|
|
@@ -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) {
|
|
@@ -2528,13 +2528,13 @@ 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
|
|
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, "?!"))
|
|
2537
|
-
return
|
|
2537
|
+
return m;
|
|
2538
2538
|
if (wt.endsWithChar(i, ".")) {
|
|
2539
2539
|
if (g) {
|
|
2540
2540
|
if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || gi(i))
|
|
@@ -2545,13 +2545,13 @@ function Si(s, t) {
|
|
|
2545
2545
|
} else if (wt.endsWith(i, "..") || ne(i) || ae(i))
|
|
2546
2546
|
return u;
|
|
2547
2547
|
}
|
|
2548
|
-
return
|
|
2548
|
+
return m;
|
|
2549
2549
|
}
|
|
2550
2550
|
let A;
|
|
2551
|
-
return (A = i.indexOf(".")) > -1 && (Ot(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (
|
|
2552
|
-
|
|
2551
|
+
return (A = i.indexOf(".")) > -1 && (Ot(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (p = yi(i)) ? [
|
|
2552
|
+
p[0] + p[1],
|
|
2553
2553
|
null,
|
|
2554
|
-
|
|
2554
|
+
p[2]
|
|
2555
2555
|
] : u;
|
|
2556
2556
|
}),
|
|
2557
2557
|
// Filter empty sentences
|
|
@@ -2596,10 +2596,10 @@ function Li(s, t) {
|
|
|
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(
|
|
2601
|
-
var
|
|
2602
|
-
|
|
2599
|
+
var l = o ? n.index + 1 - (o.index + o.offset) : 0;
|
|
2600
|
+
e = e + new Array(l).join(t) + n.value;
|
|
2601
|
+
var p = n.index - r + n.offset;
|
|
2602
|
+
p > i && (i = p);
|
|
2603
2603
|
}), {
|
|
2604
2604
|
// Index equal is the one from the first token
|
|
2605
2605
|
index: r,
|
|
@@ -2616,8 +2616,8 @@ const j = {
|
|
|
2616
2616
|
var Oi = ' \r\n !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
|
|
2617
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,60 +2626,60 @@ function R(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
|
|
2641
|
-
var
|
|
2639
|
+
}] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (l = i.opts.cacheGet(o), l))
|
|
2640
|
+
return l;
|
|
2641
|
+
var p = r.map(function(m, u) {
|
|
2642
2642
|
var g = r[u + 1], A = t(
|
|
2643
|
-
|
|
2644
|
-
Object.assign({},
|
|
2643
|
+
m.value,
|
|
2644
|
+
Object.assign({}, m),
|
|
2645
2645
|
a ? Object.assign({}, a) : null,
|
|
2646
2646
|
g ? Object.assign({}, g) : null,
|
|
2647
2647
|
u,
|
|
2648
2648
|
r
|
|
2649
2649
|
) || [];
|
|
2650
|
-
if (A = j.normalize(
|
|
2651
|
-
var
|
|
2650
|
+
if (A = j.normalize(m, A), e.preserveProperties) {
|
|
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
|
-
return a =
|
|
2656
|
+
return a = m, A;
|
|
2657
2657
|
}).filter(Boolean).flat();
|
|
2658
|
-
return o && i.opts.cacheSet(o,
|
|
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
|
|
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
|
}
|
|
2673
2673
|
a.push({
|
|
2674
2674
|
value: u,
|
|
2675
|
-
index:
|
|
2675
|
+
index: m,
|
|
2676
2676
|
offset: g,
|
|
2677
2677
|
match: o
|
|
2678
|
-
}), i = i.slice(
|
|
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,25 +2688,25 @@ R.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(
|
|
2702
|
-
var
|
|
2703
|
-
|
|
2701
|
+
return i.split(function(l, p) {
|
|
2702
|
+
var m = t.apply(null, arguments);
|
|
2703
|
+
m = j.normalize(p, m), m.forEach(function(u) {
|
|
2704
2704
|
u === null ? o() : a.push(u);
|
|
2705
2705
|
});
|
|
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 @@ R.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 @@ R.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,30 +2734,30 @@ R.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 || {});
|
|
@@ -2783,7 +2783,7 @@ class ki {
|
|
|
2783
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
|
|
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
|
-
references: [
|
|
2822
|
+
references: [p.href],
|
|
2823
2823
|
children: g.length > 0 ? g : void 0
|
|
2824
|
-
}
|
|
2825
|
-
a.set(A,
|
|
2824
|
+
};
|
|
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 I {
|
|
|
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 I {
|
|
|
2866
2870
|
if (!n.children?.length) return n;
|
|
2867
2871
|
if (i !== void 0) {
|
|
2868
2872
|
const o = e * i;
|
|
2869
|
-
let
|
|
2873
|
+
let l = n, p = -1 / 0;
|
|
2870
2874
|
for (const m of n.children) {
|
|
2871
|
-
const
|
|
2872
|
-
|
|
2873
|
-
h = m;
|
|
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 I {
|
|
|
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,18 +2900,10 @@ class I {
|
|
|
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
|
}
|
|
2904
|
-
/**
|
|
2905
|
-
* Return the most relevant TOC Link for `bare` (used for `linkFor`).
|
|
2906
|
-
* Prefers a start-of-resource entry; falls back to the first fragment entry.
|
|
2907
|
-
*/
|
|
2908
|
-
static findTocLink(t, e, i) {
|
|
2909
|
-
const { atStart: r, fragments: n } = I.collectTocCandidates(t, e, i, 1);
|
|
2910
|
-
return r[0] ?? n[0];
|
|
2911
|
-
}
|
|
2912
2907
|
/**
|
|
2913
2908
|
* Collect all TOC entries that reference `bare` as flat children, walking
|
|
2914
2909
|
* up to `maxDepth` levels deep. Start-of-resource entries (#t=0 or no
|
|
@@ -2919,11 +2914,11 @@ class I {
|
|
|
2919
2914
|
if (i !== void 0 && r > i) return [];
|
|
2920
2915
|
const a = [];
|
|
2921
2916
|
for (const o of t) {
|
|
2922
|
-
if (
|
|
2923
|
-
const
|
|
2924
|
-
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);
|
|
2925
2920
|
}
|
|
2926
|
-
o.children?.items?.length && a.push(...
|
|
2921
|
+
o.children?.items?.length && a.push(...C.collectChildrenFromToc(
|
|
2927
2922
|
o.children.items,
|
|
2928
2923
|
e,
|
|
2929
2924
|
i,
|
|
@@ -2943,33 +2938,40 @@ class I {
|
|
|
2943
2938
|
return { atStart: [], fragments: [] };
|
|
2944
2939
|
const n = [], a = [];
|
|
2945
2940
|
for (const o of t)
|
|
2946
|
-
if (
|
|
2947
|
-
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(
|
|
2948
2943
|
o.children.items,
|
|
2949
2944
|
e,
|
|
2950
2945
|
i,
|
|
2951
2946
|
r + 1
|
|
2952
2947
|
);
|
|
2953
|
-
n.push(...
|
|
2948
|
+
n.push(...l.atStart), a.push(...l.fragments);
|
|
2954
2949
|
}
|
|
2955
2950
|
return { atStart: n, fragments: a };
|
|
2956
2951
|
}
|
|
2957
2952
|
/**
|
|
2958
2953
|
* A TOC href points to the start of its resource when it has no fragment,
|
|
2959
|
-
* 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`.
|
|
2960
2957
|
*/
|
|
2961
2958
|
static isStartOfResource(t) {
|
|
2962
2959
|
const e = t.split("#")[1];
|
|
2963
|
-
|
|
2960
|
+
if (!e) return !0;
|
|
2961
|
+
const i = e.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2962
|
+
return i !== null && parseFloat(i[1]) === 0;
|
|
2964
2963
|
}
|
|
2965
2964
|
// -------------------------------------------------------------------------
|
|
2966
2965
|
// Shared utilities
|
|
2967
2966
|
// -------------------------------------------------------------------------
|
|
2968
|
-
static trimToDepth(t, e) {
|
|
2969
|
-
return t.map((
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
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
|
+
});
|
|
2973
2975
|
}
|
|
2974
2976
|
flattenItems(t) {
|
|
2975
2977
|
const e = [];
|
|
@@ -2977,18 +2979,14 @@ class I {
|
|
|
2977
2979
|
e.push(i), i.children && e.push(...this.flattenItems(i.children));
|
|
2978
2980
|
return e;
|
|
2979
2981
|
}
|
|
2980
|
-
|
|
2981
|
-
for (const
|
|
2982
|
-
const
|
|
2983
|
-
if ((
|
|
2984
|
-
|
|
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;
|
|
2985
2989
|
}
|
|
2986
|
-
return !1;
|
|
2987
|
-
}
|
|
2988
|
-
static parseTimeFragment(t) {
|
|
2989
|
-
if (!t) return 0;
|
|
2990
|
-
const e = t.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
2991
|
-
return e ? parseFloat(e[1]) : 0;
|
|
2992
2990
|
}
|
|
2993
2991
|
bareHrefFromItem(t) {
|
|
2994
2992
|
return (t.references[0] ?? "").split("#")[0];
|
|
@@ -3021,11 +3019,10 @@ class Y {
|
|
|
3021
3019
|
}
|
|
3022
3020
|
/**
|
|
3023
3021
|
* Returns the publication's timeline, built from its reading order and table of contents.
|
|
3024
|
-
*
|
|
3025
|
-
* with a specific configuration (e.g. a depth limit).
|
|
3022
|
+
* The result is cached after the first call.
|
|
3026
3023
|
*/
|
|
3027
3024
|
get timeline() {
|
|
3028
|
-
return this._timeline || (this._timeline =
|
|
3025
|
+
return this._timeline || (this._timeline = C.build(this)), this._timeline;
|
|
3029
3026
|
}
|
|
3030
3027
|
/** The URL where this publication is served, computed from the `Link` with `self` relation.
|
|
3031
3028
|
* e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
|
|
@@ -3058,7 +3055,7 @@ class Y {
|
|
|
3058
3055
|
/**
|
|
3059
3056
|
* Gets the cover image for the publication.
|
|
3060
3057
|
* First looks for rel='cover' in links/resources/readingOrder,
|
|
3061
|
-
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG)
|
|
3058
|
+
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG).
|
|
3062
3059
|
*/
|
|
3063
3060
|
getCover() {
|
|
3064
3061
|
const t = [
|
|
@@ -3146,10 +3143,10 @@ class gt {
|
|
|
3146
3143
|
*/
|
|
3147
3144
|
static deserialize(t) {
|
|
3148
3145
|
if (!(t && t.cssSelector)) return;
|
|
3149
|
-
let e =
|
|
3146
|
+
let e = L(t.textNodeIndex);
|
|
3150
3147
|
if (e === void 0) return;
|
|
3151
|
-
let i =
|
|
3152
|
-
return i === void 0 && (i =
|
|
3148
|
+
let i = L(t.charOffset);
|
|
3149
|
+
return i === void 0 && (i = L(t.offset)), new gt({
|
|
3153
3150
|
cssSelector: t.cssSelector,
|
|
3154
3151
|
textNodeIndex: e,
|
|
3155
3152
|
charOffset: i
|
|
@@ -3247,7 +3244,7 @@ class Zt {
|
|
|
3247
3244
|
let e = t.currency;
|
|
3248
3245
|
if (!(e && typeof e == "string" && e.length > 0))
|
|
3249
3246
|
return;
|
|
3250
|
-
let i =
|
|
3247
|
+
let i = L(t.value);
|
|
3251
3248
|
if (i !== void 0)
|
|
3252
3249
|
return new Zt({ currency: e, value: i });
|
|
3253
3250
|
}
|
|
@@ -3296,8 +3293,8 @@ class Jt {
|
|
|
3296
3293
|
static deserialize(t) {
|
|
3297
3294
|
if (t)
|
|
3298
3295
|
return new Jt({
|
|
3299
|
-
total:
|
|
3300
|
-
position:
|
|
3296
|
+
total: L(t.total),
|
|
3297
|
+
position: L(t.position)
|
|
3301
3298
|
});
|
|
3302
3299
|
}
|
|
3303
3300
|
/**
|
|
@@ -3319,8 +3316,8 @@ class qt {
|
|
|
3319
3316
|
static deserialize(t) {
|
|
3320
3317
|
if (t)
|
|
3321
3318
|
return new qt({
|
|
3322
|
-
total:
|
|
3323
|
-
available:
|
|
3319
|
+
total: L(t.total),
|
|
3320
|
+
available: L(t.available)
|
|
3324
3321
|
});
|
|
3325
3322
|
}
|
|
3326
3323
|
/**
|
|
@@ -3357,7 +3354,7 @@ class Qt {
|
|
|
3357
3354
|
}
|
|
3358
3355
|
}
|
|
3359
3356
|
U.prototype.getNumberOfItems = function() {
|
|
3360
|
-
return
|
|
3357
|
+
return L(this.otherProperties.numberOfItems);
|
|
3361
3358
|
};
|
|
3362
3359
|
U.prototype.getPrice = function() {
|
|
3363
3360
|
return Zt.deserialize(this.otherProperties.price);
|
|
@@ -3500,7 +3497,7 @@ class _i {
|
|
|
3500
3497
|
}
|
|
3501
3498
|
class or {
|
|
3502
3499
|
/**
|
|
3503
|
-
*
|
|
3500
|
+
*
|
|
3504
3501
|
* @param defaultLanguage The default assumed language
|
|
3505
3502
|
* @param unit The unit of the produced [Locator]s.
|
|
3506
3503
|
* @param contextSnippetLength Length of `before` and `after` snippets in the produced [Locator]s.
|
|
@@ -4108,10 +4105,10 @@ function* Ss(s = {}) {
|
|
|
4108
4105
|
continue;
|
|
4109
4106
|
}
|
|
4110
4107
|
const [a, o] = t[r];
|
|
4111
|
-
for (let
|
|
4108
|
+
for (let l = o.length - 1; l >= 0; l--)
|
|
4112
4109
|
e.push({
|
|
4113
4110
|
index: r - 1,
|
|
4114
|
-
partial: Object.assign(Object.assign({}, n), { [a]: o[
|
|
4111
|
+
partial: Object.assign(Object.assign({}, n), { [a]: o[l] })
|
|
4115
4112
|
});
|
|
4116
4113
|
}
|
|
4117
4114
|
}
|
|
@@ -4159,11 +4156,11 @@ function* Rs(s, t) {
|
|
|
4159
4156
|
e.has(r) || (e.add(r), yield r);
|
|
4160
4157
|
}
|
|
4161
4158
|
function ks(s, t) {
|
|
4162
|
-
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i),
|
|
4163
|
-
const u = Os(s,
|
|
4164
|
-
return m
|
|
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;
|
|
4165
4162
|
};
|
|
4166
|
-
return Ps(t).reduce(
|
|
4163
|
+
return Ps(t).reduce(l, {});
|
|
4167
4164
|
}
|
|
4168
4165
|
function Ps(s) {
|
|
4169
4166
|
const { selectors: t, includeTag: e } = s, i = [...t];
|
|
@@ -4232,12 +4229,12 @@ function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
|
4232
4229
|
let r = t, n = e, a = !0;
|
|
4233
4230
|
for (; a; ) {
|
|
4234
4231
|
let o = !1;
|
|
4235
|
-
for (const
|
|
4236
|
-
const { foundElements:
|
|
4237
|
-
if (o = !0, te(s,
|
|
4238
|
-
yield
|
|
4232
|
+
for (const l of Vs(s, r, n, i)) {
|
|
4233
|
+
const { foundElements: p, selector: m } = l;
|
|
4234
|
+
if (o = !0, te(s, m, t))
|
|
4235
|
+
yield m;
|
|
4239
4236
|
else {
|
|
4240
|
-
r =
|
|
4237
|
+
r = p[0], n = m;
|
|
4241
4238
|
break;
|
|
4242
4239
|
}
|
|
4243
4240
|
}
|
|
@@ -4271,8 +4268,8 @@ function Zs({ selectors: s, operator: t }) {
|
|
|
4271
4268
|
let i = "";
|
|
4272
4269
|
return e.forEach((r) => {
|
|
4273
4270
|
var n;
|
|
4274
|
-
((n = s[r]) !== null && n !== void 0 ? n : []).forEach(({ value: o, include:
|
|
4275
|
-
|
|
4271
|
+
((n = s[r]) !== null && n !== void 0 ? n : []).forEach(({ value: o, include: l }) => {
|
|
4272
|
+
l && (i += o);
|
|
4276
4273
|
});
|
|
4277
4274
|
}), t + i;
|
|
4278
4275
|
}
|
|
@@ -4459,15 +4456,15 @@ class tr {
|
|
|
4459
4456
|
let n = e;
|
|
4460
4457
|
for (; n && n !== this.doc.body; ) {
|
|
4461
4458
|
for (let o = 0; o < n.attributes.length; o++) {
|
|
4462
|
-
const
|
|
4463
|
-
|
|
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));
|
|
4464
4461
|
}
|
|
4465
4462
|
n = n.parentElement;
|
|
4466
4463
|
}
|
|
4467
4464
|
const a = De(e, {
|
|
4468
4465
|
root: this.doc
|
|
4469
4466
|
});
|
|
4470
|
-
return r.forEach((o,
|
|
4467
|
+
return r.forEach((o, l) => o.forEach((p) => l.attributes.setNamedItem(p))), this.recipeCssSelectorCache.set(e, a), a;
|
|
4471
4468
|
}
|
|
4472
4469
|
// Implements NodeTraversor
|
|
4473
4470
|
head(t, e) {
|
|
@@ -4502,17 +4499,17 @@ class tr {
|
|
|
4502
4499
|
href: a
|
|
4503
4500
|
});
|
|
4504
4501
|
else {
|
|
4505
|
-
const
|
|
4506
|
-
const
|
|
4507
|
-
return
|
|
4508
|
-
href:
|
|
4509
|
-
type:
|
|
4502
|
+
const l = [...n.getElementsByTagName("source")].map((p) => {
|
|
4503
|
+
const m = Et(p, this.baseLocator.href);
|
|
4504
|
+
return m ? new M({
|
|
4505
|
+
href: m,
|
|
4506
|
+
type: p.getAttribute("type") || void 0
|
|
4510
4507
|
}) : null;
|
|
4511
|
-
}).filter((
|
|
4512
|
-
|
|
4513
|
-
href:
|
|
4514
|
-
type:
|
|
4515
|
-
alternates:
|
|
4508
|
+
}).filter((p) => !!p);
|
|
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
|
|
4516
4513
|
}));
|
|
4517
4514
|
}
|
|
4518
4515
|
o && (r === "AUDIO" ? this.elementRecipes.push({
|
|
@@ -4637,7 +4634,7 @@ class Ue {
|
|
|
4637
4634
|
* Creates a [LocatorCollection].
|
|
4638
4635
|
*/
|
|
4639
4636
|
constructor(t) {
|
|
4640
|
-
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 ?? [];
|
|
4641
4638
|
}
|
|
4642
4639
|
/**
|
|
4643
4640
|
* Parses a [LocatorCollection] from its RWPM JSON representation.
|
|
@@ -4647,7 +4644,7 @@ class Ue {
|
|
|
4647
4644
|
let e, i = t.locators;
|
|
4648
4645
|
return i && Array.isArray(i) && (e = i.map((r) => D.deserialize(r)).filter((r) => r !== void 0)), new Ue({
|
|
4649
4646
|
metadata: At.deserialize(t.metadata),
|
|
4650
|
-
links:
|
|
4647
|
+
links: O.deserialize(t.links),
|
|
4651
4648
|
locators: e
|
|
4652
4649
|
});
|
|
4653
4650
|
}
|
|
@@ -4677,9 +4674,9 @@ class H {
|
|
|
4677
4674
|
if (!t) return;
|
|
4678
4675
|
let e, i, r;
|
|
4679
4676
|
if (Array.isArray(t))
|
|
4680
|
-
e =
|
|
4677
|
+
e = O.deserialize(t);
|
|
4681
4678
|
else if (typeof t == "object")
|
|
4682
|
-
e =
|
|
4679
|
+
e = O.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
|
|
4683
4680
|
i?.set(n, a);
|
|
4684
4681
|
}), r = H.deserializeCollections(t);
|
|
4685
4682
|
else
|
|
@@ -4744,9 +4741,9 @@ class Me {
|
|
|
4744
4741
|
if (!t) return;
|
|
4745
4742
|
const e = pt.deserialize(t.metadata);
|
|
4746
4743
|
if (!e) return;
|
|
4747
|
-
const i =
|
|
4744
|
+
const i = O.deserialize(t.links);
|
|
4748
4745
|
if (!i) return;
|
|
4749
|
-
const r =
|
|
4746
|
+
const r = O.deserialize(
|
|
4750
4747
|
t.readingOrder ? t.readingOrder : t.spine
|
|
4751
4748
|
);
|
|
4752
4749
|
if (r)
|
|
@@ -4755,8 +4752,8 @@ class Me {
|
|
|
4755
4752
|
metadata: e,
|
|
4756
4753
|
links: i,
|
|
4757
4754
|
readingOrder: r,
|
|
4758
|
-
resources:
|
|
4759
|
-
toc:
|
|
4755
|
+
resources: O.deserialize(t.resources),
|
|
4756
|
+
toc: O.deserialize(t.toc),
|
|
4760
4757
|
subcollections: H.deserializeCollections({
|
|
4761
4758
|
sub: t.sub
|
|
4762
4759
|
})
|
|
@@ -4807,17 +4804,17 @@ class Me {
|
|
|
4807
4804
|
/** Finds the first Link having the given `href` in the publication's links. */
|
|
4808
4805
|
linkWithHref(t) {
|
|
4809
4806
|
const e = (o) => {
|
|
4810
|
-
let
|
|
4811
|
-
for (const
|
|
4812
|
-
if (
|
|
4813
|
-
return
|
|
4814
|
-
const
|
|
4815
|
-
return o.forEach((
|
|
4807
|
+
let l;
|
|
4808
|
+
for (const m of o)
|
|
4809
|
+
if (l = m.findWithHref(t), l !== void 0)
|
|
4810
|
+
return l;
|
|
4811
|
+
const p = new Array();
|
|
4812
|
+
return o.forEach((m) => {
|
|
4816
4813
|
const u = [];
|
|
4817
|
-
for (const g of
|
|
4814
|
+
for (const g of m.items)
|
|
4818
4815
|
g.alternates && u.push(g.alternates), g.children && u.push(g.children);
|
|
4819
|
-
|
|
4820
|
-
}),
|
|
4816
|
+
p.push(...u);
|
|
4817
|
+
}), p.length > 0 && (l = e(p)), l;
|
|
4821
4818
|
}, i = [];
|
|
4822
4819
|
i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
|
|
4823
4820
|
const r = e(i);
|
|
@@ -4860,7 +4857,7 @@ class Me {
|
|
|
4860
4857
|
}
|
|
4861
4858
|
}
|
|
4862
4859
|
export {
|
|
4863
|
-
|
|
4860
|
+
R as AccessMode,
|
|
4864
4861
|
V as Accessibility,
|
|
4865
4862
|
rr as AccessibilityMetadataDisplayGuide,
|
|
4866
4863
|
It as AccessibilityProfile,
|
|
@@ -4881,7 +4878,7 @@ export {
|
|
|
4881
4878
|
ar as Content,
|
|
4882
4879
|
ge as ContentElement,
|
|
4883
4880
|
dt as Contributor,
|
|
4884
|
-
|
|
4881
|
+
N as Contributors,
|
|
4885
4882
|
qt as Copies,
|
|
4886
4883
|
Ri as DefaultTextContentTokenizer,
|
|
4887
4884
|
Kt as DomRange,
|
|
@@ -4909,7 +4906,7 @@ export {
|
|
|
4909
4906
|
X as Layout,
|
|
4910
4907
|
Ht as Legal,
|
|
4911
4908
|
M as Link,
|
|
4912
|
-
|
|
4909
|
+
O as Links,
|
|
4913
4910
|
f as Localization,
|
|
4914
4911
|
B as LocalizedString,
|
|
4915
4912
|
D as Locator,
|
|
@@ -4950,7 +4947,7 @@ export {
|
|
|
4950
4947
|
be as TextSegment,
|
|
4951
4948
|
Ci as TextUnit,
|
|
4952
4949
|
yt as TextualElement,
|
|
4953
|
-
|
|
4950
|
+
C as Timeline,
|
|
4954
4951
|
ut as URITemplate,
|
|
4955
4952
|
Bi as VideoElement,
|
|
4956
4953
|
ni as VisualAdjustments,
|
|
@@ -4960,7 +4957,7 @@ export {
|
|
|
4960
4957
|
lt as datefromJSON,
|
|
4961
4958
|
nr as leadingPage,
|
|
4962
4959
|
Z as numberfromJSON,
|
|
4963
|
-
|
|
4960
|
+
L as positiveNumberfromJSON,
|
|
4964
4961
|
ht as setToArray,
|
|
4965
4962
|
pe as speakableToken
|
|
4966
4963
|
};
|