@readium/shared 2.2.0-alpha.2 → 2.2.0-beta.2
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 +1032 -794
- package/dist/index.umd.cjs +3 -3
- package/package.json +11 -11
- package/src/fetcher/HttpFetcher.ts +2 -2
- package/src/fetcher/Resource.ts +4 -4
- package/src/publication/Manifest.ts +11 -13
- package/src/publication/Publication.ts +43 -0
- package/src/publication/html/Locations.ts +0 -14
- package/src/publication/services/index.ts +2 -1
- package/src/publication/services/timeline/Timeline.ts +349 -0
- package/src/publication/services/timeline/TimelineItem.ts +24 -0
- package/src/publication/services/timeline/index.ts +2 -0
- package/src/util/mediatype/MediaType.ts +4 -0
- package/types/src/fetcher/HttpFetcher.d.ts +1 -1
- package/types/src/fetcher/Resource.d.ts +1 -1
- package/types/src/publication/Manifest.d.ts +1 -1
- package/types/src/publication/Publication.d.ts +14 -0
- package/types/src/publication/html/Locations.d.ts +0 -6
- package/types/src/publication/services/index.d.ts +1 -0
- package/types/src/publication/services/timeline/Timeline.d.ts +94 -0
- package/types/src/publication/services/timeline/TimelineItem.d.ts +24 -0
- package/types/src/publication/services/timeline/index.d.ts +2 -0
- package/types/src/util/mediatype/MediaType.d.ts +1 -0
- package/types/test/AltIdentifier.test.d.ts +1 -0
- package/types/test/Contributor.test.d.ts +1 -0
- package/types/test/GuidedNavigation.test.d.ts +1 -0
- package/types/test/Link.test.d.ts +1 -0
- package/types/test/LocalizedString.test.d.ts +1 -0
- package/types/test/Locator.test.d.ts +1 -0
- package/types/test/LocatorCollection.test.d.ts +1 -0
- package/types/test/Manifest.test.d.ts +1 -0
- package/types/test/Metadata.test.d.ts +1 -0
- package/types/test/Properties.test.d.ts +1 -0
- package/types/test/Publication.test.d.ts +1 -0
- package/types/test/PublicationCollection.test.d.ts +1 -0
- package/types/test/Subject.test.d.ts +1 -0
- package/types/test/TDM.test.d.ts +1 -0
- package/types/test/Timeline.test.d.ts +1 -0
- package/types/test/accessibility/Accessibility.test.d.ts +1 -0
- package/types/test/accessibility/AccessibilityMetadataDisplayGuide.test.d.ts +1 -0
- package/types/test/accessibility/Localization.test.d.ts +1 -0
- package/types/test/encryption/Encryption.test.d.ts +1 -0
- package/types/test/encryption/Properties.test.d.ts +1 -0
- package/types/test/epub/MediaOverlay.test.d.ts +1 -0
- package/types/test/epub/Metadata.test.d.ts +1 -0
- package/types/test/epub/PropertiesTest.test.d.ts +1 -0
- package/types/test/epub/PublicationTest.test.d.ts +1 -0
- package/types/test/html/DomRange.test.d.ts +1 -0
- package/types/test/html/Locator.test.d.ts +1 -0
- package/types/test/opds/PropertiesTest.test.d.ts +1 -0
- package/types/test/opds/PublicationTest.test.d.ts +1 -0
- package/types/test/util/URITemplate.test.d.ts +1 -0
- package/types/test/util/mediatype/MediaType.test.d.ts +1 -0
- package/LICENSE +0 -28
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class ei {
|
|
2
2
|
close() {
|
|
3
3
|
}
|
|
4
4
|
links() {
|
|
@@ -8,7 +8,7 @@ class ti {
|
|
|
8
8
|
throw Error("This is an empty fetcher");
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
class
|
|
11
|
+
class er {
|
|
12
12
|
constructor(t, e) {
|
|
13
13
|
this.client = t || window.fetch.bind(window), this.baseUrl = e;
|
|
14
14
|
}
|
|
@@ -19,12 +19,12 @@ class tr {
|
|
|
19
19
|
const e = t.toURL(this.baseUrl);
|
|
20
20
|
if (e === void 0)
|
|
21
21
|
throw Error(`Invalid HREF: ${t.href}`);
|
|
22
|
-
return new
|
|
22
|
+
return new ii(this.client, t, e);
|
|
23
23
|
}
|
|
24
24
|
close() {
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
class
|
|
27
|
+
class ii {
|
|
28
28
|
constructor(t, e, i) {
|
|
29
29
|
this.client = t || window.fetch.bind(window), this._link = e, this.url = i;
|
|
30
30
|
}
|
|
@@ -84,16 +84,16 @@ class ei {
|
|
|
84
84
|
);
|
|
85
85
|
return new DOMParser().parseFromString(
|
|
86
86
|
await t.text(),
|
|
87
|
-
|
|
87
|
+
"application/xml"
|
|
88
88
|
);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
class
|
|
91
|
+
class ir {
|
|
92
92
|
constructor(t, e) {
|
|
93
93
|
this.start = t, this.endInclusive = e;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class sr {
|
|
97
97
|
readAsString() {
|
|
98
98
|
return this.read().then((t) => t === void 0 ? t : new TextDecoder().decode(t));
|
|
99
99
|
}
|
|
@@ -101,10 +101,10 @@ class ir {
|
|
|
101
101
|
return this.readAsString().then((t) => t === void 0 ? t : JSON.parse(t));
|
|
102
102
|
}
|
|
103
103
|
readAsXML() {
|
|
104
|
-
return this.
|
|
104
|
+
return this.readAsString().then((t) => t === void 0 ? t : new DOMParser().parseFromString(t, "text/xml"));
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
class
|
|
107
|
+
class V {
|
|
108
108
|
constructor(t = {}) {
|
|
109
109
|
this.conformsTo = t.conformsTo ?? [], this.certification = t.certification ?? null, this.summary = t.summary ?? null, this.accessMode = t.accessMode ?? [], this.accessModeSufficient = t.accessModeSufficient ?? [], this.feature = t.feature ?? [], this.hazard = t.hazard ?? [], this.exemption = t.exemption ?? [];
|
|
110
110
|
}
|
|
@@ -114,15 +114,15 @@ class _ {
|
|
|
114
114
|
static deserialize(t) {
|
|
115
115
|
if (!t || typeof t != "object") return;
|
|
116
116
|
const e = t;
|
|
117
|
-
return new
|
|
118
|
-
conformsTo: e.conformsTo ? e.conformsTo.map((i) =>
|
|
117
|
+
return new V({
|
|
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) =>
|
|
122
|
-
accessModeSufficient: e.accessModeSufficient ? e.accessModeSufficient.map((i) =>
|
|
123
|
-
feature: e.feature ? e.feature.map((i) =>
|
|
121
|
+
accessMode: e.accessMode ? e.accessMode.map((i) => k.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
122
|
+
accessModeSufficient: e.accessModeSufficient ? e.accessModeSufficient.map((i) => xt.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
123
|
+
feature: e.feature ? e.feature.map((i) => v.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
124
124
|
hazard: e.hazard ? e.hazard.map((i) => P.deserialize(i)).filter((i) => i !== void 0) : void 0,
|
|
125
|
-
exemption: e.exemption ? e.exemption.map((i) =>
|
|
125
|
+
exemption: e.exemption ? e.exemption.map((i) => Nt.deserialize(i)).filter((i) => i !== void 0) : void 0
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
/**
|
|
@@ -170,7 +170,7 @@ const b = class b {
|
|
|
170
170
|
}
|
|
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
|
-
let
|
|
173
|
+
let It = b;
|
|
174
174
|
class Pt {
|
|
175
175
|
constructor(t = null, e = null, i = null) {
|
|
176
176
|
this.certifiedBy = t, this.credential = e, this.report = i;
|
|
@@ -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 k = y;
|
|
217
|
+
const L = class L {
|
|
218
218
|
constructor(t) {
|
|
219
219
|
if (typeof t == "string") {
|
|
220
|
-
if (!
|
|
220
|
+
if (!L.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) => L.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 L(t);
|
|
239
239
|
if (!Array.isArray(t)) return;
|
|
240
|
-
const e = t.filter((i) => i ?
|
|
240
|
+
const e = t.filter((i) => i ? L.VALID_MODES.has(i.toLowerCase()) : !1);
|
|
241
241
|
if (e.length !== 0)
|
|
242
|
-
return new
|
|
242
|
+
return new L(e);
|
|
243
243
|
}
|
|
244
244
|
/**
|
|
245
245
|
* Serializes a [PrimaryAccessMode] to its RWPM JSON representation.
|
|
@@ -248,8 +248,8 @@ const N = class N {
|
|
|
248
248
|
return this.value;
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
|
|
252
|
-
let
|
|
251
|
+
L.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), L.AUDITORY = new L("auditory"), L.TACTILE = new L("tactile"), L.TEXTUAL = new L("textual"), L.VISUAL = new L("visual");
|
|
252
|
+
let xt = L;
|
|
253
253
|
const l = class l {
|
|
254
254
|
constructor(t) {
|
|
255
255
|
this.value = t;
|
|
@@ -269,7 +269,7 @@ const l = class l {
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
l.NONE = new l("none"), l.ANNOTATIONS = new l("annotations"), l.ARIA = new l("ARIA"), l.INDEX = new l("index"), l.PAGE_BREAK_MARKERS = new l("pageBreakMarkers"), l.PAGE_NAVIGATION = new l("pageNavigation"), l.PRINT_PAGE_NUMBERS = new l("printPageNumbers"), l.READING_ORDER = new l("readingOrder"), l.STRUCTURAL_NAVIGATION = new l("structuralNavigation"), l.TABLE_OF_CONTENTS = new l("tableOfContents"), l.TAGGED_PDF = new l("taggedPDF"), l.ALTERNATIVE_TEXT = new l("alternativeText"), l.AUDIO_DESCRIPTION = new l("audioDescription"), l.CAPTIONS = new l("captions"), l.CLOSED_CAPTIONS = new l("closedCaptions"), l.DESCRIBED_MATH = new l("describedMath"), l.LONG_DESCRIPTION = new l("longDescription"), l.OPEN_CAPTIONS = new l("openCaptions"), l.SIGN_LANGUAGE = new l("signLanguage"), l.TRANSCRIPT = new l("transcript"), l.DISPLAY_TRANSFORMABILITY = new l("displayTransformability"), l.SYNCHRONIZED_AUDIO_TEXT = new l("synchronizedAudioText"), l.TIMING_CONTROL = new l("timingControl"), l.UNLOCKED = new l("unlocked"), l.CHEM_ML = new l("ChemML"), l.LATEX = new l("latex"), l.LATEX_CHEMISTRY = new l("latex-chemistry"), l.MATH_ML = new l("MathML"), l.MATH_ML_CHEMISTRY = new l("MathML-chemistry"), l.TTS_MARKUP = new l("ttsMarkup"), l.HIGH_CONTRAST_AUDIO = new l("highContrastAudio"), l.HIGH_CONTRAST_DISPLAY = new l("highContrastDisplay"), l.LARGE_PRINT = new l("largePrint"), l.BRAILLE = new l("braille"), l.TACTILE_GRAPHIC = new l("tactileGraphic"), l.TACTILE_OBJECT = new l("tactileObject"), l.FULL_RUBY_ANNOTATIONS = new l("fullRubyAnnotations"), l.HORIZONTAL_WRITING = new l("horizontalWriting"), l.RUBY_ANNOTATIONS = new l("rubyAnnotations"), l.VERTICAL_WRITING = new l("verticalWriting"), l.WITH_ADDITIONAL_WORD_SEGMENTATION = new l("withAdditionalWordSegmentation"), l.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new l("withoutAdditionalWordSegmentation");
|
|
272
|
-
let
|
|
272
|
+
let v = l;
|
|
273
273
|
const w = class w {
|
|
274
274
|
constructor(t) {
|
|
275
275
|
this.value = t;
|
|
@@ -309,10 +309,10 @@ const S = class S {
|
|
|
309
309
|
}
|
|
310
310
|
};
|
|
311
311
|
S.NONE = new S("none"), S.DOCUMENTED = new S("documented"), S.LEGAL = new S("legal"), S.TEMPORARY = new S("temporary"), S.TECHNICAL = new S("technical"), S.EAA_DISPROPORTIONATE_BURDEN = new S("eaa-disproportionate-burden"), S.EAA_FUNDAMENTAL_ALTERATION = new S("eaa-fundamental-alteration"), S.EAA_MICROENTERPRISE = new S("eaa-microenterprise"), S.EAA_TECHNICAL_IMPOSSIBILITY = new S("eaa-technical-impossibility"), S.EAA_TEMPORARY = new S("eaa-temporary");
|
|
312
|
-
let
|
|
313
|
-
const ee = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], ii = /* @__PURE__ */ JSON.parse(`{"format":{"audiobook":"Audiobook","audiobookJSON":"Audiobook Manifest","cbz":"Comic Book Archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"LCP Protected Audiobook","lcpdf":"LCP Protected PDF","lcpl":"LCP License Document","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_one":"audiobook","audiobook_other":"audiobooks","book_one":"book","book_other":"books","comic_one":"comic","comic_other":"comics","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: ","title":"Accessibility summary"},"additional-accessibility-information":{"aria":{"compact":"ARIA roles included","descriptive":"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions","braille":"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{"compact":"Page breaks included","descriptive":"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{"compact":"Tactile graphics included","descriptive":"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","title":"Additional accessibility information","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"},"conformance":{"a":{"compact":"This publication meets minimum accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},"aa":{"compact":"This publication meets accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},"aaa":{"compact":"This publication exceeds accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},"certifier":"The publication was certified by ","certifier-credentials":"The certifier's credential is ","details":{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report","claim":"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detailed conformance information","no":"No information is available","title":"Conformance","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined"},"hazards":{"flashing":{"compact":"Flashing content","descriptive":"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{"compact":"No flashing hazards","descriptive":"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{"compact":"Flashing hazards not known","descriptive":"The presence of flashing content that can cause photosensitive seizures could not be determined"},"motion":{"compact":"Motion simulation","descriptive":"The publication contains motion simulations that can cause motion sickness"},"motion-none":{"compact":"No motion simulation hazards","descriptive":"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{"compact":"Motion simulation hazards not known","descriptive":"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available","none":{"compact":"No hazards","descriptive":"The publication contains no hazards"},"sound":{"compact":"Sounds","descriptive":"The publication contains sounds that can cause sensitivity issues"},"sound-none":{"compact":"No sound hazards","descriptive":"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{"compact":"Sound hazards not known","descriptive":"The presence of sounds that can cause sensitivity issues could not be determined"},"title":"Hazards","unknown":"The presence of hazards is unknown"},"legal-considerations":{"exempt":{"compact":"Claims an accessibility exemption in some jurisdictions","descriptive":"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available","title":"Legal considerations"},"navigation":{"index":{"compact":"Index","descriptive":"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{"compact":"Go to page","descriptive":"Page list to go to pages from the print source version"},"structural":{"compact":"Headings","descriptive":"Elements such as headings, tables, etc for structured navigation"},"title":"Navigation","toc":{"compact":"Table of contents","descriptive":"Table of contents to all chapters of the text via links"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Chemical formulas in LaTeX","descriptive":"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Chemical formulas in MathML","descriptive":"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{"compact":"Math as LaTeX","descriptive":"Math formulas in accessible format (LaTeX)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{"compact":"Videos have closed captions","descriptive":"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","math-as-mathml":{"compact":"Math as MathML","descriptive":"Math formulas in accessible format (MathML)"},"open-captions":{"compact":"Videos have open captions","descriptive":"Videos included in publications have open captions"},"title":"Rich content","transcript":"Transcript(s) provided","unknown":"No information is available"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Has alternative text","descriptive":"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available","none":{"compact":"Not readable in read aloud or dynamic braille","descriptive":"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{"compact":"Not fully readable in read aloud or dynamic braille","descriptive":"Not all of the content will be readable as read aloud speech or dynamic braille"},"readable":{"compact":"Readable in read aloud or dynamic braille","descriptive":"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{"complementary":{"compact":"Prerecorded audio clips","descriptive":"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available","only":{"compact":"Prerecorded audio only","descriptive":"Audiobook with no text alternative"},"synchronized":{"compact":"Prerecorded audio synchronized with text","descriptive":"All the content is available as prerecorded audio synchronized with text"}},"title":"Ways of reading","visual-adjustments":{"modifiable":{"compact":"Appearance can be modified","descriptive":"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},"unknown":"No information about appearance modifiability is available","unmodifiable":{"compact":"Appearance cannot be modified","descriptive":"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}}}},"altIdentifier_one":"alternate identifier","altIdentifier_other":"alternate identifiers","artist_one":"artist","artist_other":"artists","author_one":"author","author_other":"authors","collection_one":"editorial collection","collection_other":"editorial collections","colorist_one":"colorist","colorist_other":"colorists","contributor_one":"contributor","contributor_other":"contributors","description":"description","duration":"duration","editor_one":"editor","editor_other":"editors","identifier_one":"identifier","identifier_other":"identifiers","illustrator_one":"illustrator","illustrator_other":"illustrators","imprint_one":"imprint","imprint_other":"imprints","inker_one":"inker","inker_other":"inkers","language_one":"language","language_other":"languages","letterer_one":"letterer","letterer_other":"letterers","modified":"modification date","narrator_one":"narrator","narrator_other":"narrators","numberOfPages":"print length","penciler_one":"penciler","penciler_other":"pencilers","published":"publication date","publisher_one":"publisher","publisher_other":"publishers","series_one":"series","series_other":"series","subject_one":"subject","subject_other":"subjects","subtitle":"subtitle","title":"title","translator_one":"translator","translator_other":"translators"}}`), si = {
|
|
314
|
-
publication:
|
|
315
|
-
},
|
|
312
|
+
let Nt = S;
|
|
313
|
+
const ie = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], si = /* @__PURE__ */ JSON.parse(`{"format":{"audiobook":"Audiobook","audiobookJSON":"Audiobook Manifest","cbz":"Comic Book Archive","divina":"Divina Publication","divinaJSON":"Divina Publication Manifest","epub":"EPUB","lcpa":"LCP Protected Audiobook","lcpdf":"LCP Protected PDF","lcpl":"LCP License Document","pdf":"PDF","rwp":"Readium Web Publication","rwpm":"Readium Web Publication Manifest","zab":"Audiobook Archive","zip":"ZIP Archive"},"kind":{"audiobook_one":"audiobook","audiobook_other":"audiobooks","book_one":"book","book_other":"books","comic_one":"comic","comic_other":"comics","document_one":"document","document_other":"documents"},"metadata":{"accessibility":{"display-guide":{"accessibility-summary":{"no-metadata":"No information is available","publisher-contact":"For more information about the accessibility of this product, please contact the publisher: ","title":"Accessibility summary"},"additional-accessibility-information":{"aria":{"compact":"ARIA roles included","descriptive":"Content is enhanced with ARIA roles to optimize organization and facilitate navigation"},"audio-descriptions":"Audio descriptions","braille":"Braille","color-not-sole-means-of-conveying-information":"Color is not the sole means of conveying information","dyslexia-readability":"Dyslexia readability","full-ruby-annotations":"Full ruby annotations","high-contrast-between-foreground-and-background-audio":"High contrast between foreground and background audio","high-contrast-between-text-and-background":"High contrast between foreground text and background","large-print":"Large print","page-breaks":{"compact":"Page breaks included","descriptive":"Page breaks included from the original print source"},"ruby-annotations":"Some Ruby annotations","sign-language":"Sign language","tactile-graphics":{"compact":"Tactile graphics included","descriptive":"Tactile graphics have been integrated to facilitate access to visual elements for blind people"},"tactile-objects":"Tactile 3D objects","text-to-speech-hinting":"Text-to-speech hinting provided","title":"Additional accessibility information","ultra-high-contrast-between-text-and-background":"Ultra high contrast between text and background","visible-page-numbering":"Visible page numbering","without-background-sounds":"Without background sounds"},"conformance":{"a":{"compact":"This publication meets minimum accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level A standard"},"aa":{"compact":"This publication meets accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AA standard"},"aaa":{"compact":"This publication exceeds accepted accessibility standards","descriptive":"The publication contains a conformance statement that it meets the EPUB Accessibility and WCAG 2 Level AAA standard"},"certifier":"The publication was certified by ","certifier-credentials":"The certifier's credential is ","details":{"certification-info":"The publication was certified on ","certifier-report":"For more information refer to the certifier's report","claim":"This publication claims to meet","epub-accessibility-1-0":"EPUB Accessibility 1.0","epub-accessibility-1-1":"EPUB Accessibility 1.1","level-a":"Level A","level-aa":"Level AA","level-aaa":"Level AAA","wcag-2-0":{"compact":"WCAG 2.0","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.0"},"wcag-2-1":{"compact":"WCAG 2.1","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.1"},"wcag-2-2":{"compact":"WCAG 2.2","descriptive":"Web Content Accessibility Guidelines (WCAG) 2.2"}},"details-title":"Detailed conformance information","no":"No information is available","title":"Conformance","unknown-standard":"Conformance to accepted standards for accessibility of this publication cannot be determined"},"hazards":{"flashing":{"compact":"Flashing content","descriptive":"The publication contains flashing content that can cause photosensitive seizures"},"flashing-none":{"compact":"No flashing hazards","descriptive":"The publication does not contain flashing content that can cause photosensitive seizures"},"flashing-unknown":{"compact":"Flashing hazards not known","descriptive":"The presence of flashing content that can cause photosensitive seizures could not be determined"},"motion":{"compact":"Motion simulation","descriptive":"The publication contains motion simulations that can cause motion sickness"},"motion-none":{"compact":"No motion simulation hazards","descriptive":"The publication does not contain motion simulations that can cause motion sickness"},"motion-unknown":{"compact":"Motion simulation hazards not known","descriptive":"The presence of motion simulations that can cause motion sickness could not be determined"},"no-metadata":"No information is available","none":{"compact":"No hazards","descriptive":"The publication contains no hazards"},"sound":{"compact":"Sounds","descriptive":"The publication contains sounds that can cause sensitivity issues"},"sound-none":{"compact":"No sound hazards","descriptive":"The publication does not contain sounds that can cause sensitivity issues"},"sound-unknown":{"compact":"Sound hazards not known","descriptive":"The presence of sounds that can cause sensitivity issues could not be determined"},"title":"Hazards","unknown":"The presence of hazards is unknown"},"legal-considerations":{"exempt":{"compact":"Claims an accessibility exemption in some jurisdictions","descriptive":"This publication claims an accessibility exemption in some jurisdictions"},"no-metadata":"No information is available","title":"Legal considerations"},"navigation":{"index":{"compact":"Index","descriptive":"Index with links to referenced entries"},"no-metadata":"No information is available","page-navigation":{"compact":"Go to page","descriptive":"Page list to go to pages from the print source version"},"structural":{"compact":"Headings","descriptive":"Elements such as headings, tables, etc for structured navigation"},"title":"Navigation","toc":{"compact":"Table of contents","descriptive":"Table of contents to all chapters of the text via links"}},"rich-content":{"accessible-chemistry-as-latex":{"compact":"Chemical formulas in LaTeX","descriptive":"Chemical formulas in accessible format (LaTeX)"},"accessible-chemistry-as-mathml":{"compact":"Chemical formulas in MathML","descriptive":"Chemical formulas in accessible format (MathML)"},"accessible-math-as-latex":{"compact":"Math as LaTeX","descriptive":"Math formulas in accessible format (LaTeX)"},"accessible-math-described":"Text descriptions of math are provided","closed-captions":{"compact":"Videos have closed captions","descriptive":"Videos included in publications have closed captions"},"extended-descriptions":"Information-rich images are described by extended descriptions","math-as-mathml":{"compact":"Math as MathML","descriptive":"Math formulas in accessible format (MathML)"},"open-captions":{"compact":"Videos have open captions","descriptive":"Videos included in publications have open captions"},"title":"Rich content","transcript":"Transcript(s) provided","unknown":"No information is available"},"ways-of-reading":{"nonvisual-reading":{"alt-text":{"compact":"Has alternative text","descriptive":"Has alternative text descriptions for images"},"no-metadata":"No information about nonvisual reading is available","none":{"compact":"Not readable in read aloud or dynamic braille","descriptive":"The content is not readable as read aloud speech or dynamic braille"},"not-fully":{"compact":"Not fully readable in read aloud or dynamic braille","descriptive":"Not all of the content will be readable as read aloud speech or dynamic braille"},"readable":{"compact":"Readable in read aloud or dynamic braille","descriptive":"All content can be read as read aloud speech or dynamic braille"}},"prerecorded-audio":{"complementary":{"compact":"Prerecorded audio clips","descriptive":"Prerecorded audio clips are embedded in the content"},"no-metadata":"No information about prerecorded audio is available","only":{"compact":"Prerecorded audio only","descriptive":"Audiobook with no text alternative"},"synchronized":{"compact":"Prerecorded audio synchronized with text","descriptive":"All the content is available as prerecorded audio synchronized with text"}},"title":"Ways of reading","visual-adjustments":{"modifiable":{"compact":"Appearance can be modified","descriptive":"Appearance of the text and page layout can be modified according to the capabilities of the reading system (font family and font size, spaces between paragraphs, sentences, words, and letters, as well as color of background and text)"},"unknown":"No information about appearance modifiability is available","unmodifiable":{"compact":"Appearance cannot be modified","descriptive":"Text and page layout cannot be modified as the reading experience is close to a print version, but reading systems can still provide zooming options"}}}}},"altIdentifier_one":"alternate identifier","altIdentifier_other":"alternate identifiers","artist_one":"artist","artist_other":"artists","author_one":"author","author_other":"authors","collection_one":"editorial collection","collection_other":"editorial collections","colorist_one":"colorist","colorist_other":"colorists","contributor_one":"contributor","contributor_other":"contributors","description":"description","duration":"duration","editor_one":"editor","editor_other":"editors","identifier_one":"identifier","identifier_other":"identifiers","illustrator_one":"illustrator","illustrator_other":"illustrators","imprint_one":"imprint","imprint_other":"imprints","inker_one":"inker","inker_other":"inkers","language_one":"language","language_other":"languages","letterer_one":"letterer","letterer_other":"letterers","modified":"modification date","narrator_one":"narrator","narrator_other":"narrators","numberOfPages":"print length","penciler_one":"penciler","penciler_other":"pencilers","published":"publication date","publisher_one":"publisher","publisher_other":"publishers","series_one":"series","series_other":"series","subject_one":"subject","subject_other":"subjects","subtitle":"subtitle","title":"title","translator_one":"translator","translator_other":"translators"}}`), ri = {
|
|
314
|
+
publication: si
|
|
315
|
+
}, se = {
|
|
316
316
|
fr: () => import("./fr-C5HEel98.js"),
|
|
317
317
|
ar: () => import("./ar-DyHX_uy2.js"),
|
|
318
318
|
da: () => import("./da-Dct0PS3E.js"),
|
|
@@ -323,13 +323,13 @@ const ee = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], ii = /* @__PURE__ */ J
|
|
|
323
323
|
sv: () => import("./sv-BfzAFsVN.js")
|
|
324
324
|
// 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
|
|
325
325
|
// 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
|
|
326
|
-
},
|
|
327
|
-
class
|
|
326
|
+
}, re = ri?.publication?.metadata?.accessibility?.["display-guide"] || {};
|
|
327
|
+
class $ {
|
|
328
328
|
constructor() {
|
|
329
|
-
this.currentLocaleCode = "en", this.locale =
|
|
329
|
+
this.currentLocaleCode = "en", this.locale = re, this.loadedLocales = {}, this.loadedLocales.en = re;
|
|
330
330
|
}
|
|
331
331
|
static getInstance() {
|
|
332
|
-
return
|
|
332
|
+
return $.instance || ($.instance = new $()), $.instance;
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
335
|
* Loads a locale dynamically
|
|
@@ -337,14 +337,14 @@ class Y {
|
|
|
337
337
|
* @returns Promise indicating if the locale was loaded successfully
|
|
338
338
|
*/
|
|
339
339
|
async loadLocale(t) {
|
|
340
|
-
if (!
|
|
340
|
+
if (!ie.includes(t))
|
|
341
341
|
return console.warn(`Locale '${t}' is not enabled`), !1;
|
|
342
342
|
if (t in this.loadedLocales)
|
|
343
343
|
return !0;
|
|
344
344
|
try {
|
|
345
|
-
if (!(t in
|
|
345
|
+
if (!(t in se))
|
|
346
346
|
return console.warn(`Locale file not found for: ${t}`), !1;
|
|
347
|
-
const r = (await
|
|
347
|
+
const r = (await se[t]()).default?.publication?.metadata?.accessibility?.["display-guide"];
|
|
348
348
|
return r ? (this.loadedLocales[t] = r, !0) : (console.warn(`No accessibility strings found in locale ${t}`), !1);
|
|
349
349
|
} catch (e) {
|
|
350
350
|
return console.warn(`Failed to load locale ${t}:`, e), !1;
|
|
@@ -378,7 +378,7 @@ class Y {
|
|
|
378
378
|
* Gets a list of available locale codes
|
|
379
379
|
*/
|
|
380
380
|
getAvailableLocales() {
|
|
381
|
-
return
|
|
381
|
+
return ie;
|
|
382
382
|
}
|
|
383
383
|
getNestedValue(t, e) {
|
|
384
384
|
const i = e.split(".");
|
|
@@ -400,9 +400,9 @@ class Y {
|
|
|
400
400
|
return e === void 0 && this.currentLocaleCode !== "en" && (e = this.getNestedValue(this.loadedLocales.en, t)), e !== void 0 ? typeof e == "string" ? { compact: e, descriptive: e } : e : (console.warn(`Missing localization for key: ${t}`), { compact: "", descriptive: "" });
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
|
-
const f =
|
|
404
|
-
var
|
|
405
|
-
class
|
|
403
|
+
const f = $.getInstance();
|
|
404
|
+
var X = /* @__PURE__ */ ((s) => (s.reflowable = "reflowable", s.fixed = "fixed", s.scrolled = "scrolled", s))(X || {}), ni = /* @__PURE__ */ ((s) => (s.Unknown = "unknown", s.Modifiable = "modifiable", s.Unmodifiable = "unmodifiable", s))(ni || {}), ai = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Readable = "readable", s.NotFully = "notFully", s.Unreadable = "unreadable", s))(ai || {}), oi = /* @__PURE__ */ ((s) => (s.NoMetadata = "noMetadata", s.Synchronized = "synchronized", s.AudioOnly = "audioOnly", s.AudioComplementary = "audioComplementary", s))(oi || {});
|
|
405
|
+
class Dt {
|
|
406
406
|
constructor(t = "unknown", e = "noMetadata", i = !1, r = "noMetadata") {
|
|
407
407
|
this.id = "ways-of-reading.title", this.visualAdjustments = t, this.nonvisualReading = e, this.nonvisualReadingAltText = i, this.prerecordedAudio = r, this.shouldDisplay = !0;
|
|
408
408
|
const n = f.getString(this.id);
|
|
@@ -438,33 +438,33 @@ class kt {
|
|
|
438
438
|
});
|
|
439
439
|
}
|
|
440
440
|
static fromPublication(t) {
|
|
441
|
-
const e = t.metadata.accessibility ?? new
|
|
442
|
-
const
|
|
443
|
-
return Array.isArray(
|
|
444
|
-
}), m = a.some((d) => d.value ===
|
|
445
|
-
const
|
|
446
|
-
return Array.isArray(
|
|
447
|
-
}), p = !(a.length === 0 && o.length === 0) && !a.some((d) => d.value ===
|
|
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 ?? [], h = a.length > 0 && a.every((d) => d.value === k.TEXTUAL.value) || o.some((d) => {
|
|
442
|
+
const x = d.value;
|
|
443
|
+
return Array.isArray(x) ? x.every((G) => G === k.TEXTUAL.value) : x === k.TEXTUAL.value;
|
|
444
|
+
}), m = a.some((d) => d.value === k.TEXTUAL.value) || o.some((d) => {
|
|
445
|
+
const x = d.value;
|
|
446
|
+
return Array.isArray(x) ? x.some((G) => G === k.TEXTUAL.value) : x === k.TEXTUAL.value;
|
|
447
|
+
}), p = !(a.length === 0 && o.length === 0) && !a.some((d) => d.value === k.TEXTUAL.value) && !o.some((d) => {
|
|
448
|
+
const x = d.value;
|
|
449
|
+
return Array.isArray(x) ? x.some((G) => G === k.TEXTUAL.value) : x === k.TEXTUAL.value;
|
|
450
450
|
}), u = i.some((d) => [
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
].includes(d.value)), g = h ? "readable" : m || u ? "notFully" : p ? "unreadable" : "noMetadata",
|
|
456
|
-
const
|
|
457
|
-
return Array.isArray(
|
|
458
|
-
}) ? "audioOnly" : a.some((d) => d.value ===
|
|
459
|
-
return new
|
|
451
|
+
v.LONG_DESCRIPTION.value,
|
|
452
|
+
v.ALTERNATIVE_TEXT.value,
|
|
453
|
+
v.DESCRIBED_MATH.value,
|
|
454
|
+
v.TRANSCRIPT.value
|
|
455
|
+
].includes(d.value)), g = h ? "readable" : m || u ? "notFully" : p ? "unreadable" : "noMetadata", A = u, N = i.some((d) => d.value === v.SYNCHRONIZED_AUDIO_TEXT.value) ? "synchronized" : o.some((d) => {
|
|
456
|
+
const x = d.value;
|
|
457
|
+
return Array.isArray(x) ? x.some((G) => G === k.AUDITORY.value) : x === k.AUDITORY.value;
|
|
458
|
+
}) ? "audioOnly" : a.some((d) => d.value === k.AUDITORY.value) ? "audioComplementary" : "noMetadata";
|
|
459
|
+
return new Dt(
|
|
460
460
|
n,
|
|
461
461
|
g,
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
A,
|
|
463
|
+
N
|
|
464
464
|
);
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
|
-
class
|
|
467
|
+
class Ut {
|
|
468
468
|
constructor(t = !1, e = !1, i = !1, r = !1) {
|
|
469
469
|
this.id = "navigation.title", this.tableOfContents = t, this.index = e, this.headings = i, this.page = r, this.noMetadata = !t && !e && !i && !r;
|
|
470
470
|
const n = f.getString(this.id);
|
|
@@ -510,17 +510,17 @@ class Dt {
|
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
static fromPublication(t) {
|
|
513
|
-
const i = (t.metadata.accessibility ?? new
|
|
514
|
-
return new
|
|
515
|
-
i.some((r) => r.value ===
|
|
516
|
-
i.some((r) => r.value ===
|
|
517
|
-
i.some((r) => r.value ===
|
|
518
|
-
i.some((r) => r.value ===
|
|
513
|
+
const i = (t.metadata.accessibility ?? new V()).feature ?? [];
|
|
514
|
+
return new Ut(
|
|
515
|
+
i.some((r) => r.value === v.TABLE_OF_CONTENTS.value),
|
|
516
|
+
i.some((r) => r.value === v.INDEX.value),
|
|
517
|
+
i.some((r) => r.value === v.STRUCTURAL_NAVIGATION.value),
|
|
518
|
+
i.some((r) => r.value === v.PAGE_NAVIGATION.value)
|
|
519
519
|
);
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
|
-
var
|
|
523
|
-
class
|
|
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
|
+
class Mt {
|
|
524
524
|
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1) {
|
|
525
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 = h, this.transcript = m, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !m, this.shouldDisplay = !this.noMetadata;
|
|
526
526
|
const p = f.getString(this.id);
|
|
@@ -606,25 +606,25 @@ class Ut {
|
|
|
606
606
|
}
|
|
607
607
|
}
|
|
608
608
|
static fromPublication(t) {
|
|
609
|
-
const i = (t.metadata.accessibility ?? new
|
|
610
|
-
return new
|
|
611
|
-
i.some((r) => r.value ===
|
|
612
|
-
i.some((r) => r.value ===
|
|
613
|
-
i.some((r) => r.value ===
|
|
614
|
-
i.some((r) => r.value ===
|
|
615
|
-
i.some((r) => r.value ===
|
|
616
|
-
i.some((r) => r.value ===
|
|
617
|
-
i.some((r) => r.value ===
|
|
618
|
-
i.some((r) => r.value ===
|
|
619
|
-
i.some((r) => r.value ===
|
|
609
|
+
const i = (t.metadata.accessibility ?? new V()).feature ?? [];
|
|
610
|
+
return new Mt(
|
|
611
|
+
i.some((r) => r.value === v.LONG_DESCRIPTION.value),
|
|
612
|
+
i.some((r) => r.value === v.DESCRIBED_MATH.value),
|
|
613
|
+
i.some((r) => r.value === v.MATH_ML.value),
|
|
614
|
+
i.some((r) => r.value === v.LATEX.value),
|
|
615
|
+
i.some((r) => r.value === v.MATH_ML_CHEMISTRY.value),
|
|
616
|
+
i.some((r) => r.value === v.LATEX_CHEMISTRY.value),
|
|
617
|
+
i.some((r) => r.value === v.CLOSED_CAPTIONS.value),
|
|
618
|
+
i.some((r) => r.value === v.OPEN_CAPTIONS.value),
|
|
619
|
+
i.some((r) => r.value === v.TRANSCRIPT.value)
|
|
620
620
|
);
|
|
621
621
|
}
|
|
622
622
|
}
|
|
623
|
-
class
|
|
624
|
-
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1, p = !1, u = !1, g = !1,
|
|
625
|
-
this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = h, this.largePrint = m, this.signLanguage = p, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting =
|
|
626
|
-
const
|
|
627
|
-
if (this.title =
|
|
623
|
+
class Bt {
|
|
624
|
+
constructor(t = !1, e = !1, i = !1, r = !1, n = !1, a = !1, o = !1, h = !1, m = !1, p = !1, u = !1, g = !1, A = !1) {
|
|
625
|
+
this.id = "additional-accessibility-information.title", this.pageBreakMarkers = t, this.aria = e, this.audioDescriptions = i, this.braille = r, this.rubyAnnotations = n, this.fullRubyAnnotations = a, this.highAudioContrast = o, this.highDisplayContrast = h, this.largePrint = m, this.signLanguage = p, this.tactileGraphics = u, this.tactileObjects = g, this.textToSpeechHinting = A, this.noMetadata = !t && !e && !i && !r && !n && !a && !o && !h && !m && !p && !u && !g && !A, this.shouldDisplay = !this.noMetadata;
|
|
626
|
+
const N = f.getString(this.id);
|
|
627
|
+
if (this.title = N.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",
|
|
@@ -720,7 +720,7 @@ class Mt {
|
|
|
720
720
|
descriptiveString: d.descriptive
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
|
-
if (
|
|
723
|
+
if (A) {
|
|
724
724
|
const d = f.getString("additional-accessibility-information.text-to-speech-hinting");
|
|
725
725
|
this.statements.push({
|
|
726
726
|
id: "additional-accessibility-information.text-to-speech-hinting",
|
|
@@ -730,26 +730,26 @@ class Mt {
|
|
|
730
730
|
}
|
|
731
731
|
}
|
|
732
732
|
static fromPublication(t) {
|
|
733
|
-
const i = (t.metadata.accessibility ?? new
|
|
734
|
-
return new
|
|
735
|
-
i.some((r) => r.value ===
|
|
736
|
-
i.some((r) => r.value ===
|
|
737
|
-
i.some((r) => r.value ===
|
|
738
|
-
i.some((r) => r.value ===
|
|
739
|
-
i.some((r) => r.value ===
|
|
740
|
-
i.some((r) => r.value ===
|
|
741
|
-
i.some((r) => r.value ===
|
|
742
|
-
i.some((r) => r.value ===
|
|
743
|
-
i.some((r) => r.value ===
|
|
744
|
-
i.some((r) => r.value ===
|
|
745
|
-
i.some((r) => r.value ===
|
|
746
|
-
i.some((r) => r.value ===
|
|
747
|
-
i.some((r) => r.value ===
|
|
733
|
+
const i = (t.metadata.accessibility ?? new V()).feature ?? [];
|
|
734
|
+
return new Bt(
|
|
735
|
+
i.some((r) => r.value === v.PAGE_BREAK_MARKERS.value || r.value === v.PRINT_PAGE_NUMBERS.value),
|
|
736
|
+
i.some((r) => r.value === v.ARIA.value),
|
|
737
|
+
i.some((r) => r.value === v.AUDIO_DESCRIPTION.value),
|
|
738
|
+
i.some((r) => r.value === v.BRAILLE.value),
|
|
739
|
+
i.some((r) => r.value === v.RUBY_ANNOTATIONS.value),
|
|
740
|
+
i.some((r) => r.value === v.FULL_RUBY_ANNOTATIONS.value),
|
|
741
|
+
i.some((r) => r.value === v.HIGH_CONTRAST_AUDIO.value),
|
|
742
|
+
i.some((r) => r.value === v.HIGH_CONTRAST_DISPLAY.value),
|
|
743
|
+
i.some((r) => r.value === v.LARGE_PRINT.value),
|
|
744
|
+
i.some((r) => r.value === v.SIGN_LANGUAGE.value),
|
|
745
|
+
i.some((r) => r.value === v.TACTILE_GRAPHIC.value),
|
|
746
|
+
i.some((r) => r.value === v.TACTILE_OBJECT.value),
|
|
747
|
+
i.some((r) => r.value === v.TTS_MARKUP.value)
|
|
748
748
|
);
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
|
-
var
|
|
752
|
-
class
|
|
751
|
+
var li = /* @__PURE__ */ ((s) => (s.yes = "yes", s.no = "no", s.unknown = "unknown", s.noMetadata = "noMetadata", s))(li || {});
|
|
752
|
+
class Gt {
|
|
753
753
|
constructor(t = "unknown", e = "unknown", i = "unknown") {
|
|
754
754
|
this.id = "hazards.title", this.flashing = t, this.motion = e, this.sound = i;
|
|
755
755
|
const r = f.getString(this.id);
|
|
@@ -852,10 +852,10 @@ class Bt {
|
|
|
852
852
|
let n;
|
|
853
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 === 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
|
|
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
|
-
class
|
|
858
|
+
class Wt {
|
|
859
859
|
constructor(t = []) {
|
|
860
860
|
this.id = "conformance.title", this.profiles = t, this.shouldDisplay = !0;
|
|
861
861
|
const e = f.getString(this.id);
|
|
@@ -900,10 +900,10 @@ class Gt {
|
|
|
900
900
|
}
|
|
901
901
|
static fromPublication(t) {
|
|
902
902
|
const e = t.metadata.accessibility?.conformsTo ?? [];
|
|
903
|
-
return new
|
|
903
|
+
return new Wt(e);
|
|
904
904
|
}
|
|
905
905
|
}
|
|
906
|
-
class
|
|
906
|
+
class Ht {
|
|
907
907
|
constructor(t = !1) {
|
|
908
908
|
this.id = "legal-considerations.title", this.exemption = t, this.shouldDisplay = this.exemption;
|
|
909
909
|
const e = f.getString(this.id);
|
|
@@ -925,10 +925,10 @@ class Wt {
|
|
|
925
925
|
}
|
|
926
926
|
static fromPublication(t) {
|
|
927
927
|
const i = (t.metadata.accessibility?.exemption ?? []).length > 0;
|
|
928
|
-
return new
|
|
928
|
+
return new Ht(i);
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
|
-
class
|
|
931
|
+
class Ft {
|
|
932
932
|
constructor(t) {
|
|
933
933
|
this.id = "accessibility-summary.title", this.shouldDisplay = !0;
|
|
934
934
|
const e = f.getString(this.id);
|
|
@@ -950,12 +950,12 @@ class Ht {
|
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
952
|
static fromPublication(t) {
|
|
953
|
-
return new
|
|
953
|
+
return new Ft(t);
|
|
954
954
|
}
|
|
955
955
|
}
|
|
956
|
-
class
|
|
956
|
+
class rr {
|
|
957
957
|
constructor(t) {
|
|
958
|
-
this.waysOfReading =
|
|
958
|
+
this.waysOfReading = Dt.fromPublication(t), this.navigation = Ut.fromPublication(t), this.richContent = Mt.fromPublication(t), this.additionalInformation = Bt.fromPublication(t), this.hazards = Gt.fromPublication(t), this.conformance = Wt.fromPublication(t), this.legal = Ht.fromPublication(t), this.accessibilitySummary = Ft.fromPublication(t), this.fields = [
|
|
959
959
|
this.waysOfReading,
|
|
960
960
|
this.navigation,
|
|
961
961
|
this.richContent,
|
|
@@ -967,7 +967,7 @@ class sr {
|
|
|
967
967
|
];
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
class
|
|
970
|
+
class _t {
|
|
971
971
|
/**
|
|
972
972
|
* Creates a [Encryption].
|
|
973
973
|
*/
|
|
@@ -979,7 +979,7 @@ class Ft {
|
|
|
979
979
|
*/
|
|
980
980
|
static deserialize(t) {
|
|
981
981
|
if (t && t.algorithm)
|
|
982
|
-
return new
|
|
982
|
+
return new _t({
|
|
983
983
|
algorithm: t.algorithm,
|
|
984
984
|
compression: t.compression,
|
|
985
985
|
originalLength: t.originalLength,
|
|
@@ -995,8 +995,8 @@ class Ft {
|
|
|
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
|
|
999
|
-
class
|
|
998
|
+
var Lt = /* @__PURE__ */ ((s) => (s.left = "left", s.right = "right", s.center = "center", s))(Lt || {});
|
|
999
|
+
class U {
|
|
1000
1000
|
constructor(t) {
|
|
1001
1001
|
this.otherProperties = t;
|
|
1002
1002
|
}
|
|
@@ -1008,7 +1008,7 @@ class D {
|
|
|
1008
1008
|
*/
|
|
1009
1009
|
static deserialize(t) {
|
|
1010
1010
|
if (t)
|
|
1011
|
-
return new
|
|
1011
|
+
return new U(t);
|
|
1012
1012
|
}
|
|
1013
1013
|
/**
|
|
1014
1014
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -1023,15 +1023,15 @@ class D {
|
|
|
1023
1023
|
const e = Object.assign({}, this.otherProperties);
|
|
1024
1024
|
for (const i in t)
|
|
1025
1025
|
e[i] = t[i];
|
|
1026
|
-
return new
|
|
1026
|
+
return new U(e);
|
|
1027
1027
|
}
|
|
1028
1028
|
}
|
|
1029
|
-
Object.defineProperty(
|
|
1029
|
+
Object.defineProperty(U.prototype, "encryption", {
|
|
1030
1030
|
get: function() {
|
|
1031
|
-
return
|
|
1031
|
+
return _t.deserialize(this.otherProperties.encrypted);
|
|
1032
1032
|
}
|
|
1033
1033
|
});
|
|
1034
|
-
class
|
|
1034
|
+
class Vt {
|
|
1035
1035
|
/** Creates a MediaOverlay object */
|
|
1036
1036
|
constructor(t) {
|
|
1037
1037
|
this.activeClass = t.activeClass, this.playbackActiveClass = t.playbackActiveClass;
|
|
@@ -1041,7 +1041,7 @@ class _t {
|
|
|
1041
1041
|
*/
|
|
1042
1042
|
static deserialize(t) {
|
|
1043
1043
|
if (t)
|
|
1044
|
-
return new
|
|
1044
|
+
return new Vt({
|
|
1045
1045
|
activeClass: t.activeClass,
|
|
1046
1046
|
playbackActiveClass: t.playbackActiveClass
|
|
1047
1047
|
});
|
|
@@ -1054,26 +1054,26 @@ class _t {
|
|
|
1054
1054
|
return this.activeClass && (t.activeClass = this.activeClass), this.playbackActiveClass && (t.playbackActiveClass = this.playbackActiveClass), t;
|
|
1055
1055
|
}
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function hi(s) {
|
|
1058
1058
|
return s && Array.isArray(s) ? s : void 0;
|
|
1059
1059
|
}
|
|
1060
|
-
function
|
|
1061
|
-
return s && typeof s == "string" ? [s] :
|
|
1060
|
+
function _(s) {
|
|
1061
|
+
return s && typeof s == "string" ? [s] : hi(s);
|
|
1062
1062
|
}
|
|
1063
|
-
function
|
|
1063
|
+
function lt(s) {
|
|
1064
1064
|
return typeof s == "string" ? new Date(s) : void 0;
|
|
1065
1065
|
}
|
|
1066
|
-
function
|
|
1066
|
+
function Z(s) {
|
|
1067
1067
|
return isNaN(s) ? void 0 : s;
|
|
1068
1068
|
}
|
|
1069
|
-
function
|
|
1070
|
-
return
|
|
1069
|
+
function z(s) {
|
|
1070
|
+
return Z(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function ht(s) {
|
|
1073
1073
|
const t = new Array();
|
|
1074
1074
|
return s.forEach((e) => t.push(e)), t;
|
|
1075
1075
|
}
|
|
1076
|
-
class
|
|
1076
|
+
class J {
|
|
1077
1077
|
/** Creates an AltIdentifier object */
|
|
1078
1078
|
constructor(t) {
|
|
1079
1079
|
this.value = t.value, this.scheme = t.scheme;
|
|
@@ -1084,9 +1084,9 @@ class Z {
|
|
|
1084
1084
|
static deserialize(t) {
|
|
1085
1085
|
if (t) {
|
|
1086
1086
|
if (typeof t == "string")
|
|
1087
|
-
return new
|
|
1087
|
+
return new J({ value: t });
|
|
1088
1088
|
if (typeof t == "object" && t.value)
|
|
1089
|
-
return new
|
|
1089
|
+
return new J({
|
|
1090
1090
|
value: t.value,
|
|
1091
1091
|
scheme: t.scheme
|
|
1092
1092
|
});
|
|
@@ -1114,18 +1114,18 @@ class c {
|
|
|
1114
1114
|
throw new Error("Invalid media type");
|
|
1115
1115
|
const a = {};
|
|
1116
1116
|
for (let g = 1; g < r.length; g++) {
|
|
1117
|
-
const
|
|
1118
|
-
if (
|
|
1119
|
-
const
|
|
1120
|
-
a[
|
|
1117
|
+
const A = r[g].split("=");
|
|
1118
|
+
if (A.length === 2) {
|
|
1119
|
+
const N = A[0].toLocaleLowerCase(), d = N === "charset" ? A[1].toUpperCase() : A[1];
|
|
1120
|
+
a[N] = d;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
1123
|
const o = {}, h = Object.keys(a);
|
|
1124
|
-
h.sort((g,
|
|
1124
|
+
h.sort((g, A) => g.localeCompare(A)), h.forEach((g) => o[g] = a[g]);
|
|
1125
1125
|
let m = "";
|
|
1126
1126
|
for (const g in o) {
|
|
1127
|
-
const
|
|
1128
|
-
m += `;${g}=${
|
|
1127
|
+
const A = o[g];
|
|
1128
|
+
m += `;${g}=${A}`;
|
|
1129
1129
|
}
|
|
1130
1130
|
const p = `${e}/${i}${m}`, u = o.encoding;
|
|
1131
1131
|
this.string = p, this.type = e, this.subtype = i, this.parameters = o, this.encoding = u, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
@@ -1225,6 +1225,7 @@ class c {
|
|
|
1225
1225
|
/** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
|
|
1226
1226
|
get isBitmap() {
|
|
1227
1227
|
return this.matchesAny(
|
|
1228
|
+
c.AVIF,
|
|
1228
1229
|
c.BMP,
|
|
1229
1230
|
c.GIF,
|
|
1230
1231
|
c.JPEG,
|
|
@@ -1288,6 +1289,9 @@ class c {
|
|
|
1288
1289
|
fileExtension: "avi"
|
|
1289
1290
|
});
|
|
1290
1291
|
}
|
|
1292
|
+
static get AVIF() {
|
|
1293
|
+
return c.parse({ mediaType: "image/avif", fileExtension: "avif" });
|
|
1294
|
+
}
|
|
1291
1295
|
static get BINARY() {
|
|
1292
1296
|
return c.parse({ mediaType: "application/octet-stream" });
|
|
1293
1297
|
}
|
|
@@ -1557,7 +1561,7 @@ class c {
|
|
|
1557
1561
|
});
|
|
1558
1562
|
}
|
|
1559
1563
|
}
|
|
1560
|
-
class
|
|
1564
|
+
class ut {
|
|
1561
1565
|
constructor(t) {
|
|
1562
1566
|
this.uri = t, this.parameters = this.getParameters(t);
|
|
1563
1567
|
}
|
|
@@ -1597,7 +1601,7 @@ class T {
|
|
|
1597
1601
|
*/
|
|
1598
1602
|
static deserialize(t) {
|
|
1599
1603
|
if (!t) return;
|
|
1600
|
-
const e =
|
|
1604
|
+
const e = Z(t.progression), i = Z(t.totalProgression), r = Z(t.position), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set([
|
|
1601
1605
|
"fragment",
|
|
1602
1606
|
"fragments",
|
|
1603
1607
|
"progression",
|
|
@@ -1607,7 +1611,7 @@ class T {
|
|
|
1607
1611
|
return Object.entries(t).forEach(([o, h]) => {
|
|
1608
1612
|
a.has(o) || n.set(o, h);
|
|
1609
1613
|
}), new T({
|
|
1610
|
-
fragments:
|
|
1614
|
+
fragments: _(t.fragments || t.fragment),
|
|
1611
1615
|
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
|
|
1612
1616
|
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
1613
1617
|
position: r !== void 0 && r > 0 ? r : void 0,
|
|
@@ -1622,7 +1626,7 @@ class T {
|
|
|
1622
1626
|
return this.fragments && (t.fragments = this.fragments), this.progression !== void 0 && (t.progression = this.progression), this.totalProgression !== void 0 && (t.totalProgression = this.totalProgression), this.position !== void 0 && (t.position = this.position), this.otherLocations && this.otherLocations.forEach((e, i) => t[i] = e), t;
|
|
1623
1627
|
}
|
|
1624
1628
|
}
|
|
1625
|
-
class
|
|
1629
|
+
class nt {
|
|
1626
1630
|
/**
|
|
1627
1631
|
* Creates a [Text].
|
|
1628
1632
|
*/
|
|
@@ -1634,7 +1638,7 @@ class rt {
|
|
|
1634
1638
|
*/
|
|
1635
1639
|
static deserialize(t) {
|
|
1636
1640
|
if (t)
|
|
1637
|
-
return new
|
|
1641
|
+
return new nt({
|
|
1638
1642
|
after: t.after,
|
|
1639
1643
|
before: t.before,
|
|
1640
1644
|
highlight: t.highlight
|
|
@@ -1648,7 +1652,7 @@ class rt {
|
|
|
1648
1652
|
return this.after !== void 0 && (t.after = this.after), this.before !== void 0 && (t.before = this.before), this.highlight !== void 0 && (t.highlight = this.highlight), t;
|
|
1649
1653
|
}
|
|
1650
1654
|
}
|
|
1651
|
-
class
|
|
1655
|
+
class D {
|
|
1652
1656
|
/**
|
|
1653
1657
|
* Creates a [Locator].
|
|
1654
1658
|
*/
|
|
@@ -1660,12 +1664,12 @@ class k {
|
|
|
1660
1664
|
*/
|
|
1661
1665
|
static deserialize(t) {
|
|
1662
1666
|
if (t && t.href && t.type)
|
|
1663
|
-
return new
|
|
1667
|
+
return new D({
|
|
1664
1668
|
href: t.href,
|
|
1665
1669
|
type: t.type,
|
|
1666
1670
|
title: t.title,
|
|
1667
1671
|
locations: T.deserialize(t.locations),
|
|
1668
|
-
text:
|
|
1672
|
+
text: nt.deserialize(t.text)
|
|
1669
1673
|
});
|
|
1670
1674
|
}
|
|
1671
1675
|
/**
|
|
@@ -1679,7 +1683,7 @@ class k {
|
|
|
1679
1683
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
1680
1684
|
*/
|
|
1681
1685
|
copyWithLocations(t) {
|
|
1682
|
-
return new
|
|
1686
|
+
return new D({
|
|
1683
1687
|
href: this.href,
|
|
1684
1688
|
type: this.type,
|
|
1685
1689
|
title: this.title,
|
|
@@ -1688,7 +1692,7 @@ class k {
|
|
|
1688
1692
|
});
|
|
1689
1693
|
}
|
|
1690
1694
|
}
|
|
1691
|
-
class
|
|
1695
|
+
class M {
|
|
1692
1696
|
/**
|
|
1693
1697
|
* Creates a [Link].
|
|
1694
1698
|
*/
|
|
@@ -1700,21 +1704,21 @@ class U {
|
|
|
1700
1704
|
*/
|
|
1701
1705
|
static deserialize(t) {
|
|
1702
1706
|
if (!(!t || typeof t.href != "string"))
|
|
1703
|
-
return new
|
|
1707
|
+
return new M({
|
|
1704
1708
|
href: t.href,
|
|
1705
1709
|
templated: t.templated,
|
|
1706
1710
|
type: t.type,
|
|
1707
1711
|
title: t.title,
|
|
1708
1712
|
rels: t.rel ? Array.isArray(t.rel) ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
|
|
1709
|
-
properties:
|
|
1710
|
-
height:
|
|
1711
|
-
width:
|
|
1712
|
-
size:
|
|
1713
|
-
duration:
|
|
1714
|
-
bitrate:
|
|
1715
|
-
languages:
|
|
1716
|
-
alternates:
|
|
1717
|
-
children:
|
|
1713
|
+
properties: U.deserialize(t.properties),
|
|
1714
|
+
height: z(t.height),
|
|
1715
|
+
width: z(t.width),
|
|
1716
|
+
size: z(t.size),
|
|
1717
|
+
duration: z(t.duration),
|
|
1718
|
+
bitrate: z(t.bitrate),
|
|
1719
|
+
languages: _(t.language),
|
|
1720
|
+
alternates: C.deserialize(t.alternate),
|
|
1721
|
+
children: C.deserialize(t.children)
|
|
1718
1722
|
});
|
|
1719
1723
|
}
|
|
1720
1724
|
/**
|
|
@@ -1722,7 +1726,7 @@ class U {
|
|
|
1722
1726
|
*/
|
|
1723
1727
|
serialize() {
|
|
1724
1728
|
const t = { href: this.href };
|
|
1725
|
-
return this.templated !== void 0 && (t.templated = this.templated), this.type !== void 0 && (t.type = this.type), this.title !== void 0 && (t.title = this.title), this.rels && (t.rel =
|
|
1729
|
+
return this.templated !== void 0 && (t.templated = this.templated), this.type !== void 0 && (t.type = this.type), this.title !== void 0 && (t.title = this.title), this.rels && (t.rel = ht(this.rels)), this.properties && (t.properties = this.properties.serialize()), this.height !== void 0 && (t.height = this.height), this.width !== void 0 && (t.width = this.width), this.size !== void 0 && (t.size = this.size), this.duration !== void 0 && (t.duration = this.duration), this.bitrate !== void 0 && (t.bitrate = this.bitrate), this.languages && (t.language = this.languages), this.alternates && (t.alternate = this.alternates.serialize()), this.children && (t.children = this.children.serialize()), t;
|
|
1726
1730
|
}
|
|
1727
1731
|
/** MediaType of the linked resource. */
|
|
1728
1732
|
get mediaType() {
|
|
@@ -1739,14 +1743,14 @@ class U {
|
|
|
1739
1743
|
}
|
|
1740
1744
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
1741
1745
|
get templateParameters() {
|
|
1742
|
-
return this.templated ? new
|
|
1746
|
+
return this.templated ? new ut(this.href).parameters : /* @__PURE__ */ new Set();
|
|
1743
1747
|
}
|
|
1744
1748
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
1745
1749
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
1746
1750
|
*/
|
|
1747
1751
|
expandTemplate(t) {
|
|
1748
|
-
return new
|
|
1749
|
-
href: new
|
|
1752
|
+
return new M({
|
|
1753
|
+
href: new ut(this.href).expand(t),
|
|
1750
1754
|
templated: !1
|
|
1751
1755
|
});
|
|
1752
1756
|
}
|
|
@@ -1754,15 +1758,15 @@ class U {
|
|
|
1754
1758
|
* Makes a copy of this [Link] after merging in the given additional other [properties].
|
|
1755
1759
|
*/
|
|
1756
1760
|
addProperties(t) {
|
|
1757
|
-
const e =
|
|
1758
|
-
return e.properties = e.properties ? e.properties?.add(t) : new
|
|
1761
|
+
const e = M.deserialize(this.serialize());
|
|
1762
|
+
return e.properties = e.properties ? e.properties?.add(t) : new U(t), e;
|
|
1759
1763
|
}
|
|
1760
1764
|
/**
|
|
1761
1765
|
* Creates a [Locator] from a reading order [Link].
|
|
1762
1766
|
*/
|
|
1763
1767
|
get locator() {
|
|
1764
1768
|
let t = this.href.split("#");
|
|
1765
|
-
return new
|
|
1769
|
+
return new D({
|
|
1766
1770
|
href: t.length > 0 && t[0] !== void 0 ? t[0] : this.href,
|
|
1767
1771
|
type: this.type ?? "",
|
|
1768
1772
|
title: this.title,
|
|
@@ -1772,7 +1776,7 @@ class U {
|
|
|
1772
1776
|
});
|
|
1773
1777
|
}
|
|
1774
1778
|
}
|
|
1775
|
-
class
|
|
1779
|
+
class C {
|
|
1776
1780
|
/**
|
|
1777
1781
|
* Creates a [Links].
|
|
1778
1782
|
*/
|
|
@@ -1784,8 +1788,8 @@ class x {
|
|
|
1784
1788
|
*/
|
|
1785
1789
|
static deserialize(t) {
|
|
1786
1790
|
if (t && Array.isArray(t))
|
|
1787
|
-
return new
|
|
1788
|
-
t.map((e) =>
|
|
1791
|
+
return new C(
|
|
1792
|
+
t.map((e) => M.deserialize(e)).filter((e) => e !== void 0)
|
|
1789
1793
|
);
|
|
1790
1794
|
}
|
|
1791
1795
|
/**
|
|
@@ -1866,13 +1870,13 @@ class x {
|
|
|
1866
1870
|
return this.items.filter((t) => t.type);
|
|
1867
1871
|
}
|
|
1868
1872
|
}
|
|
1869
|
-
const
|
|
1873
|
+
const W = class W {
|
|
1870
1874
|
/**
|
|
1871
1875
|
* translations can be a string or a collection of language/translation pairs,
|
|
1872
1876
|
* for a single string the language is assumed to be undefined
|
|
1873
1877
|
*/
|
|
1874
1878
|
constructor(t) {
|
|
1875
|
-
this.translations = typeof t == "string" ? { [
|
|
1879
|
+
this.translations = typeof t == "string" ? { [W.UNDEFINED_LANGUAGE]: t } : t;
|
|
1876
1880
|
}
|
|
1877
1881
|
/**
|
|
1878
1882
|
* Parses a [LocalizedString] from its RWPM JSON representation.
|
|
@@ -1896,7 +1900,7 @@ const G = class G {
|
|
|
1896
1900
|
*/
|
|
1897
1901
|
static deserialize(t) {
|
|
1898
1902
|
if (t && (typeof t == "string" || t.constructor === Object))
|
|
1899
|
-
return new
|
|
1903
|
+
return new W(t);
|
|
1900
1904
|
}
|
|
1901
1905
|
serialize() {
|
|
1902
1906
|
return this.translations;
|
|
@@ -1910,12 +1914,12 @@ const G = class G {
|
|
|
1910
1914
|
* 4. returns empty string
|
|
1911
1915
|
*/
|
|
1912
1916
|
getTranslation(t) {
|
|
1913
|
-
return this.translations[t ||
|
|
1917
|
+
return this.translations[t || W.UNDEFINED_LANGUAGE] || this.translations[W.UNDEFINED_LANGUAGE] || this.translations[W.LANGUAGE_EN] || (Object.values(this.translations).length === 0 ? "" : Object.values(this.translations)[0]);
|
|
1914
1918
|
}
|
|
1915
1919
|
};
|
|
1916
|
-
|
|
1917
|
-
let
|
|
1918
|
-
class
|
|
1920
|
+
W.UNDEFINED_LANGUAGE = "und", W.LANGUAGE_EN = "en";
|
|
1921
|
+
let B = W;
|
|
1922
|
+
class dt {
|
|
1919
1923
|
/**
|
|
1920
1924
|
* Creates a [Contributor] object.
|
|
1921
1925
|
*/
|
|
@@ -1929,16 +1933,16 @@ class ut {
|
|
|
1929
1933
|
*/
|
|
1930
1934
|
static deserialize(t) {
|
|
1931
1935
|
if (t)
|
|
1932
|
-
return typeof t == "string" ? new
|
|
1933
|
-
name:
|
|
1934
|
-
}) : t.name ? new
|
|
1935
|
-
name:
|
|
1936
|
-
sortAs:
|
|
1936
|
+
return typeof t == "string" ? new dt({
|
|
1937
|
+
name: B.deserialize(t)
|
|
1938
|
+
}) : t.name ? new dt({
|
|
1939
|
+
name: B.deserialize(t.name),
|
|
1940
|
+
sortAs: B.deserialize(t.sortAs),
|
|
1937
1941
|
identifier: t.identifier,
|
|
1938
|
-
altIdentifiers: t.altIdentifier ? Array.isArray(t.altIdentifier) ? new Set(t.altIdentifier.map((e) =>
|
|
1939
|
-
roles: t.role ? new Set(
|
|
1940
|
-
links:
|
|
1941
|
-
position:
|
|
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
|
+
roles: t.role ? new Set(_(t.role)) : void 0,
|
|
1944
|
+
links: C.deserialize(t.links),
|
|
1945
|
+
position: Z(t.position)
|
|
1942
1946
|
}) : void 0;
|
|
1943
1947
|
}
|
|
1944
1948
|
/**
|
|
@@ -1946,10 +1950,10 @@ class ut {
|
|
|
1946
1950
|
*/
|
|
1947
1951
|
serialize() {
|
|
1948
1952
|
const t = { name: this.name.serialize() };
|
|
1949
|
-
return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.identifier !== void 0 && (t.identifier = this.identifier), this.altIdentifiers && (t.altIdentifier =
|
|
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;
|
|
1950
1954
|
}
|
|
1951
1955
|
}
|
|
1952
|
-
class
|
|
1956
|
+
class O {
|
|
1953
1957
|
/**
|
|
1954
1958
|
* Creates a [Contributors] object.
|
|
1955
1959
|
*/
|
|
@@ -1963,8 +1967,8 @@ class L {
|
|
|
1963
1967
|
static deserialize(t) {
|
|
1964
1968
|
if (!t) return;
|
|
1965
1969
|
const e = Array.isArray(t) ? t : [t];
|
|
1966
|
-
return new
|
|
1967
|
-
e.map((i) =>
|
|
1970
|
+
return new O(
|
|
1971
|
+
e.map((i) => dt.deserialize(i)).filter((i) => i !== void 0)
|
|
1968
1972
|
);
|
|
1969
1973
|
}
|
|
1970
1974
|
/**
|
|
@@ -1974,7 +1978,7 @@ class L {
|
|
|
1974
1978
|
return this.items.map((t) => t.serialize());
|
|
1975
1979
|
}
|
|
1976
1980
|
}
|
|
1977
|
-
class
|
|
1981
|
+
class Q {
|
|
1978
1982
|
/** Creates an Array of [Subject]. */
|
|
1979
1983
|
constructor(t) {
|
|
1980
1984
|
this.items = t && t.items ? t.items : /* @__PURE__ */ new Map();
|
|
@@ -1986,9 +1990,9 @@ class q {
|
|
|
1986
1990
|
if (!(t && typeof t == "object")) return;
|
|
1987
1991
|
const e = /* @__PURE__ */ new Map();
|
|
1988
1992
|
return Object.entries(t).forEach(([i, r]) => {
|
|
1989
|
-
const n =
|
|
1993
|
+
const n = O.deserialize(r);
|
|
1990
1994
|
n && n.items.length > 0 && e.set(i, n);
|
|
1991
|
-
}), new
|
|
1995
|
+
}), new Q({ items: e });
|
|
1992
1996
|
}
|
|
1993
1997
|
/**
|
|
1994
1998
|
* Serializes a [BelongsTo] to its RWPM JSON representation.
|
|
@@ -2000,11 +2004,11 @@ class q {
|
|
|
2000
2004
|
), t;
|
|
2001
2005
|
}
|
|
2002
2006
|
}
|
|
2003
|
-
var
|
|
2004
|
-
function
|
|
2005
|
-
return s === "rtl" ?
|
|
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
|
+
function nr(s) {
|
|
2009
|
+
return s === "rtl" ? Lt.right : Lt.left;
|
|
2006
2010
|
}
|
|
2007
|
-
class
|
|
2011
|
+
class ft {
|
|
2008
2012
|
/** Creates a [Subject]. */
|
|
2009
2013
|
constructor(t) {
|
|
2010
2014
|
this.name = t.name, this.sortAs = t.sortAs, this.code = t.code, this.scheme = t.scheme, this.links = t.links;
|
|
@@ -2016,14 +2020,14 @@ class dt {
|
|
|
2016
2020
|
*/
|
|
2017
2021
|
static deserialize(t) {
|
|
2018
2022
|
if (t)
|
|
2019
|
-
return typeof t == "string" ? new
|
|
2020
|
-
name:
|
|
2021
|
-
}) : t.name ? new
|
|
2022
|
-
name:
|
|
2023
|
-
sortAs: t.sortAs ?
|
|
2023
|
+
return typeof t == "string" ? new ft({
|
|
2024
|
+
name: B.deserialize(t)
|
|
2025
|
+
}) : t.name ? new ft({
|
|
2026
|
+
name: B.deserialize(t.name),
|
|
2027
|
+
sortAs: t.sortAs ? B.deserialize(t.sortAs) : void 0,
|
|
2024
2028
|
code: t.code,
|
|
2025
2029
|
scheme: t.scheme,
|
|
2026
|
-
links:
|
|
2030
|
+
links: C.deserialize(t.links)
|
|
2027
2031
|
}) : void 0;
|
|
2028
2032
|
}
|
|
2029
2033
|
/**
|
|
@@ -2034,7 +2038,7 @@ class dt {
|
|
|
2034
2038
|
return this.sortAs !== void 0 && (t.sortAs = this.sortAs.serialize()), this.code !== void 0 && (t.code = this.code), this.scheme !== void 0 && (t.scheme = this.scheme), this.links && (t.links = this.links.serialize()), t;
|
|
2035
2039
|
}
|
|
2036
2040
|
}
|
|
2037
|
-
class
|
|
2041
|
+
class Yt {
|
|
2038
2042
|
/** Creates an Array of [Subject]. */
|
|
2039
2043
|
constructor(t) {
|
|
2040
2044
|
this.items = t;
|
|
@@ -2045,8 +2049,8 @@ class Vt {
|
|
|
2045
2049
|
static deserialize(t) {
|
|
2046
2050
|
if (!t) return;
|
|
2047
2051
|
const e = Array.isArray(t) ? t : [t];
|
|
2048
|
-
return new
|
|
2049
|
-
e.map((i) =>
|
|
2052
|
+
return new Yt(
|
|
2053
|
+
e.map((i) => ft.deserialize(i)).filter((i) => i !== void 0)
|
|
2050
2054
|
);
|
|
2051
2055
|
}
|
|
2052
2056
|
/**
|
|
@@ -2056,8 +2060,8 @@ class Vt {
|
|
|
2056
2060
|
return this.items.map((t) => t.serialize());
|
|
2057
2061
|
}
|
|
2058
2062
|
}
|
|
2059
|
-
var
|
|
2060
|
-
class
|
|
2063
|
+
var ui = /* @__PURE__ */ ((s) => (s.all = "all", s.none = "none", s))(ui || {});
|
|
2064
|
+
class $t {
|
|
2061
2065
|
/** Creates a [TDM] object */
|
|
2062
2066
|
constructor(t) {
|
|
2063
2067
|
this.reservation = t.reservation, this.policy = t.policy;
|
|
@@ -2067,7 +2071,7 @@ class Yt {
|
|
|
2067
2071
|
*/
|
|
2068
2072
|
static deserialize(t) {
|
|
2069
2073
|
if (t)
|
|
2070
|
-
return new
|
|
2074
|
+
return new $t({
|
|
2071
2075
|
reservation: t.reservation,
|
|
2072
2076
|
policy: t.policy
|
|
2073
2077
|
});
|
|
@@ -2080,10 +2084,10 @@ class Yt {
|
|
|
2080
2084
|
return this.reservation !== void 0 && (t.reservation = this.reservation), this.policy !== void 0 && (t.policy = this.policy), t;
|
|
2081
2085
|
}
|
|
2082
2086
|
}
|
|
2083
|
-
const
|
|
2087
|
+
const et = class et {
|
|
2084
2088
|
/** Creates [Metadata] object */
|
|
2085
2089
|
constructor(t) {
|
|
2086
|
-
this.title = t.title, this.typeUri = t.typeUri, this.conformsTo = t.conformsTo, this.identifier = t.identifier, this.altIdentifier = t.altIdentifier, this.subtitle = t.subtitle, this.sortAs = t.sortAs, this.artists = t.artists, this.authors = t.authors, this.colorists = t.colorists, this.contributors = t.contributors, this.editors = t.editors, this.illustrators = t.illustrators, this.inkers = t.inkers, this.letterers = t.letterers, this.narrators = t.narrators, this.pencilers = t.pencilers, this.translators = t.translators, this.languages = t.languages, this.description = t.description, this.publishers = t.publishers, this.imprints = t.imprints, this.published = t.published, this.modified = t.modified, this.subjects = t.subjects, this.belongsTo = t.belongsTo, this.belongsToCollections = t.belongsToCollections, this.belongsToSeries = t.belongsToSeries, this.belongsToCollections && this.belongsToCollections.items.length > 0 && (this.belongsTo || (this.belongsTo = new
|
|
2090
|
+
this.title = t.title, this.typeUri = t.typeUri, this.conformsTo = t.conformsTo, this.identifier = t.identifier, this.altIdentifier = t.altIdentifier, this.subtitle = t.subtitle, this.sortAs = t.sortAs, this.artists = t.artists, this.authors = t.authors, this.colorists = t.colorists, this.contributors = t.contributors, this.editors = t.editors, this.illustrators = t.illustrators, this.inkers = t.inkers, this.letterers = t.letterers, this.narrators = t.narrators, this.pencilers = t.pencilers, this.translators = t.translators, this.languages = t.languages, this.description = t.description, this.publishers = t.publishers, this.imprints = t.imprints, this.published = t.published, this.modified = t.modified, this.subjects = t.subjects, this.belongsTo = t.belongsTo, this.belongsToCollections = t.belongsToCollections, this.belongsToSeries = t.belongsToSeries, this.belongsToCollections && this.belongsToCollections.items.length > 0 && (this.belongsTo || (this.belongsTo = new Q()), this.belongsTo.items.set("collection", this.belongsToCollections)), this.belongsToSeries && this.belongsToSeries.items.length > 0 && (this.belongsTo || (this.belongsTo = new Q()), this.belongsTo.items.set("series", this.belongsToSeries)), this.layout = t.layout, this.readingProgression = t.readingProgression, this.duration = t.duration, this.numberOfPages = t.numberOfPages, this.accessibility = t.accessibility, this.tdm = t.tdm, this.otherMetadata = t.otherMetadata;
|
|
2087
2091
|
}
|
|
2088
2092
|
/**
|
|
2089
2093
|
* Parses a [Metadata] from its RWPM JSON representation.
|
|
@@ -2092,9 +2096,9 @@ const tt = class tt {
|
|
|
2092
2096
|
*/
|
|
2093
2097
|
static deserialize(t) {
|
|
2094
2098
|
if (!(t && t.title)) return;
|
|
2095
|
-
const e =
|
|
2096
|
-
let
|
|
2097
|
-
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), h = B.deserialize(t.sortAs), m = O.deserialize(t.artist), p = O.deserialize(t.author), u = O.deserialize(t.colorist), g = O.deserialize(t.contributor), A = O.deserialize(t.editor), N = O.deserialize(t.illustrator), d = O.deserialize(t.inker), x = O.deserialize(t.letterer), G = O.deserialize(t.narrator), Be = O.deserialize(t.penciler), Ge = O.deserialize(t.translator), We = _(t.language), He = t.description, Fe = O.deserialize(t.publisher), _e = O.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 = z(t.duration), Qe = z(t.numberOfPages), je = $t.deserialize(t.tdm);
|
|
2100
|
+
let ot = Object.assign({}, t);
|
|
2101
|
+
return et.mappedProperties.forEach((ti) => delete ot[ti]), Object.keys(ot).length === 0 && (ot = void 0), new et({
|
|
2098
2102
|
title: e,
|
|
2099
2103
|
typeUri: i,
|
|
2100
2104
|
conformsTo: r,
|
|
@@ -2106,28 +2110,28 @@ const tt = class tt {
|
|
|
2106
2110
|
authors: p,
|
|
2107
2111
|
colorists: u,
|
|
2108
2112
|
contributors: g,
|
|
2109
|
-
editors:
|
|
2110
|
-
illustrators:
|
|
2113
|
+
editors: A,
|
|
2114
|
+
illustrators: N,
|
|
2111
2115
|
inkers: d,
|
|
2112
|
-
letterers:
|
|
2113
|
-
narrators:
|
|
2114
|
-
pencilers:
|
|
2115
|
-
translators:
|
|
2116
|
-
languages:
|
|
2117
|
-
description:
|
|
2118
|
-
publishers:
|
|
2119
|
-
imprints:
|
|
2120
|
-
published:
|
|
2121
|
-
modified:
|
|
2122
|
-
subjects:
|
|
2123
|
-
belongsTo:
|
|
2124
|
-
layout:
|
|
2125
|
-
readingProgression:
|
|
2126
|
-
duration:
|
|
2127
|
-
numberOfPages:
|
|
2128
|
-
accessibility:
|
|
2129
|
-
tdm:
|
|
2130
|
-
otherMetadata:
|
|
2116
|
+
letterers: x,
|
|
2117
|
+
narrators: G,
|
|
2118
|
+
pencilers: Be,
|
|
2119
|
+
translators: Ge,
|
|
2120
|
+
languages: We,
|
|
2121
|
+
description: He,
|
|
2122
|
+
publishers: Fe,
|
|
2123
|
+
imprints: _e,
|
|
2124
|
+
published: Ve,
|
|
2125
|
+
modified: Ye,
|
|
2126
|
+
subjects: $e,
|
|
2127
|
+
belongsTo: Xe,
|
|
2128
|
+
layout: Ze,
|
|
2129
|
+
readingProgression: Je,
|
|
2130
|
+
duration: qe,
|
|
2131
|
+
numberOfPages: Qe,
|
|
2132
|
+
accessibility: Ke,
|
|
2133
|
+
tdm: je,
|
|
2134
|
+
otherMetadata: ot
|
|
2131
2135
|
});
|
|
2132
2136
|
}
|
|
2133
2137
|
/**
|
|
@@ -2157,12 +2161,12 @@ const tt = class tt {
|
|
|
2157
2161
|
return null;
|
|
2158
2162
|
for (const t of this.conformsTo)
|
|
2159
2163
|
switch (t) {
|
|
2160
|
-
case
|
|
2161
|
-
return this.layout ||
|
|
2162
|
-
case
|
|
2163
|
-
return this.layout ===
|
|
2164
|
-
case
|
|
2165
|
-
case
|
|
2164
|
+
case q.EPUB:
|
|
2165
|
+
return this.layout || X.reflowable;
|
|
2166
|
+
case q.DIVINA:
|
|
2167
|
+
return this.layout === X.reflowable ? X.fixed : this.layout || X.fixed;
|
|
2168
|
+
case q.AUDIOBOOK:
|
|
2169
|
+
case q.PDF:
|
|
2166
2170
|
return null;
|
|
2167
2171
|
}
|
|
2168
2172
|
return null;
|
|
@@ -2176,23 +2180,23 @@ const tt = class tt {
|
|
|
2176
2180
|
if (this.readingProgression)
|
|
2177
2181
|
return this.readingProgression;
|
|
2178
2182
|
if (this.languages?.length !== 1)
|
|
2179
|
-
return
|
|
2183
|
+
return F.ltr;
|
|
2180
2184
|
const t = this.languages[0].toLowerCase();
|
|
2181
2185
|
if (t === "zh-hant" || t === "zh-tw")
|
|
2182
|
-
return
|
|
2186
|
+
return F.rtl;
|
|
2183
2187
|
switch (t.split("-")[0]) {
|
|
2184
2188
|
case "ar":
|
|
2185
|
-
return
|
|
2189
|
+
return F.rtl;
|
|
2186
2190
|
case "fa":
|
|
2187
|
-
return
|
|
2191
|
+
return F.rtl;
|
|
2188
2192
|
case "he":
|
|
2189
|
-
return
|
|
2193
|
+
return F.rtl;
|
|
2190
2194
|
default:
|
|
2191
|
-
return
|
|
2195
|
+
return F.ltr;
|
|
2192
2196
|
}
|
|
2193
2197
|
}
|
|
2194
2198
|
};
|
|
2195
|
-
|
|
2199
|
+
et.mappedProperties = [
|
|
2196
2200
|
"title",
|
|
2197
2201
|
"@type",
|
|
2198
2202
|
"conformsTo",
|
|
@@ -2226,24 +2230,24 @@ tt.mappedProperties = [
|
|
|
2226
2230
|
"accessibility",
|
|
2227
2231
|
"tdm"
|
|
2228
2232
|
];
|
|
2229
|
-
let
|
|
2230
|
-
|
|
2233
|
+
let pt = et;
|
|
2234
|
+
pt.prototype.getMediaOverlay = function() {
|
|
2231
2235
|
const s = this.otherMetadata?.mediaOverlay;
|
|
2232
2236
|
if (s)
|
|
2233
|
-
return
|
|
2237
|
+
return Vt.deserialize(s);
|
|
2234
2238
|
};
|
|
2235
|
-
|
|
2239
|
+
U.prototype.getContains = function() {
|
|
2236
2240
|
return new Set(this.otherProperties.contains || []);
|
|
2237
2241
|
};
|
|
2238
|
-
class
|
|
2242
|
+
class Xt {
|
|
2239
2243
|
constructor(t) {
|
|
2240
2244
|
this.links = t.links, this.guided = t.guided;
|
|
2241
2245
|
}
|
|
2242
2246
|
static deserialize(t) {
|
|
2243
2247
|
if (t)
|
|
2244
|
-
return new
|
|
2245
|
-
links:
|
|
2246
|
-
guided:
|
|
2248
|
+
return new Xt({
|
|
2249
|
+
links: C.deserialize(t.links),
|
|
2250
|
+
guided: K.deserializeArray(t.guided)
|
|
2247
2251
|
});
|
|
2248
2252
|
}
|
|
2249
2253
|
serialize() {
|
|
@@ -2251,7 +2255,7 @@ class $t {
|
|
|
2251
2255
|
return this.links !== void 0 && (t.links = this.links.serialize()), this.guided !== void 0 && (t.guided = this.guided.map((e) => e.serialize())), t;
|
|
2252
2256
|
}
|
|
2253
2257
|
}
|
|
2254
|
-
class
|
|
2258
|
+
class mt {
|
|
2255
2259
|
constructor(t) {
|
|
2256
2260
|
this.plain = t.plain, this.ssml = t.ssml, this.language = t.language;
|
|
2257
2261
|
}
|
|
@@ -2261,9 +2265,9 @@ class pt {
|
|
|
2261
2265
|
static deserialize(t) {
|
|
2262
2266
|
if (t != null) {
|
|
2263
2267
|
if (typeof t == "string")
|
|
2264
|
-
return new
|
|
2268
|
+
return new mt({ plain: t });
|
|
2265
2269
|
if (t.plain || t.ssml || t.language)
|
|
2266
|
-
return new
|
|
2270
|
+
return new mt({
|
|
2267
2271
|
plain: t.plain,
|
|
2268
2272
|
ssml: t.ssml,
|
|
2269
2273
|
language: t.language
|
|
@@ -2278,7 +2282,7 @@ class pt {
|
|
|
2278
2282
|
return this.plain !== void 0 && (t.plain = this.plain), this.ssml !== void 0 && (t.ssml = this.ssml), this.language !== void 0 && (t.language = this.language), Object.keys(t).length > 0 ? t : void 0;
|
|
2279
2283
|
}
|
|
2280
2284
|
}
|
|
2281
|
-
class
|
|
2285
|
+
class K {
|
|
2282
2286
|
/**
|
|
2283
2287
|
* Creates a [GuidedNavigation] object.
|
|
2284
2288
|
*/
|
|
@@ -2309,15 +2313,15 @@ class X {
|
|
|
2309
2313
|
*/
|
|
2310
2314
|
static deserialize(t) {
|
|
2311
2315
|
if (t)
|
|
2312
|
-
return new
|
|
2316
|
+
return new K({
|
|
2313
2317
|
audioref: t.audioref,
|
|
2314
|
-
children:
|
|
2318
|
+
children: K.deserializeArray(t.children),
|
|
2315
2319
|
imgref: t.imgref,
|
|
2316
|
-
role: t.role ? new Set(
|
|
2320
|
+
role: t.role ? new Set(_(t.role)) : void 0,
|
|
2317
2321
|
level: typeof t.level == "number" ? t.level : void 0,
|
|
2318
|
-
text:
|
|
2322
|
+
text: mt.deserialize(t.text),
|
|
2319
2323
|
textref: t.textref,
|
|
2320
|
-
description:
|
|
2324
|
+
description: K.deserialize(t.description)
|
|
2321
2325
|
});
|
|
2322
2326
|
}
|
|
2323
2327
|
/**
|
|
@@ -2325,14 +2329,14 @@ class X {
|
|
|
2325
2329
|
*/
|
|
2326
2330
|
static deserializeArray(t) {
|
|
2327
2331
|
if (Array.isArray(t))
|
|
2328
|
-
return t.map((e) =>
|
|
2332
|
+
return t.map((e) => K.deserialize(e)).filter((e) => e !== void 0);
|
|
2329
2333
|
}
|
|
2330
2334
|
/**
|
|
2331
2335
|
* Serializes a [GuidedNavigationObject] to its RWPM JSON representation.
|
|
2332
2336
|
*/
|
|
2333
2337
|
serialize() {
|
|
2334
2338
|
const t = {};
|
|
2335
|
-
if (this.audioref !== void 0 && (t.audioref = this.audioref), this.children !== void 0 && (t.children = this.children.map((e) => e.serialize())), this.imgref !== void 0 && (t.imgref = this.imgref), this.role !== void 0 && (t.role =
|
|
2339
|
+
if (this.audioref !== void 0 && (t.audioref = this.audioref), this.children !== void 0 && (t.children = this.children.map((e) => e.serialize())), this.imgref !== void 0 && (t.imgref = this.imgref), this.role !== void 0 && (t.role = ht(this.role)), this.level !== void 0 && (t.level = this.level), this.text !== void 0) {
|
|
2336
2340
|
const e = this.text.serialize();
|
|
2337
2341
|
e !== void 0 && (t.text = e);
|
|
2338
2342
|
}
|
|
@@ -2369,16 +2373,16 @@ class X {
|
|
|
2369
2373
|
return e.length === 1 ? [isNaN(e[0]) ? void 0 : e[0], void 0] : e.length > 2 ? [void 0, void 0] : [isNaN(e[0]) ? void 0 : e[0], isNaN(e[1]) ? void 0 : e[1]];
|
|
2370
2374
|
}
|
|
2371
2375
|
}
|
|
2372
|
-
function
|
|
2376
|
+
function di(s, t) {
|
|
2373
2377
|
return t.length > 1 ? t.indexOf(s.slice(-1)) > -1 : s.slice(-1) === t;
|
|
2374
2378
|
}
|
|
2375
|
-
function
|
|
2379
|
+
function fi(s, t) {
|
|
2376
2380
|
return s.slice(s.length - t.length) === t;
|
|
2377
2381
|
}
|
|
2378
|
-
const
|
|
2379
|
-
endsWith:
|
|
2380
|
-
endsWithChar:
|
|
2381
|
-
},
|
|
2382
|
+
const wt = {
|
|
2383
|
+
endsWith: fi,
|
|
2384
|
+
endsWithChar: di
|
|
2385
|
+
}, pi = [
|
|
2382
2386
|
"ie",
|
|
2383
2387
|
"eg",
|
|
2384
2388
|
"ext",
|
|
@@ -2470,16 +2474,16 @@ const yt = {
|
|
|
2470
2474
|
"Fri",
|
|
2471
2475
|
"Sat"
|
|
2472
2476
|
];
|
|
2473
|
-
function
|
|
2474
|
-
return /^[A-Z][a-z].*/.test(s) ||
|
|
2475
|
-
}
|
|
2476
|
-
function pi(s) {
|
|
2477
|
-
return de(s) || /``|"|'/.test(s.substring(0, 2));
|
|
2477
|
+
function fe(s) {
|
|
2478
|
+
return /^[A-Z][a-z].*/.test(s) || Ot(s);
|
|
2478
2479
|
}
|
|
2479
2480
|
function mi(s) {
|
|
2480
|
-
return
|
|
2481
|
+
return fe(s) || /``|"|'/.test(s.substring(0, 2));
|
|
2481
2482
|
}
|
|
2482
|
-
function gi(s
|
|
2483
|
+
function gi(s) {
|
|
2484
|
+
return ~pi.indexOf(s.replace(/\W+/g, ""));
|
|
2485
|
+
}
|
|
2486
|
+
function bi(s, t) {
|
|
2483
2487
|
if (s === "a.m." || s === "p.m.") {
|
|
2484
2488
|
var e = t.replace(/\W+/g, "").slice(-3).toLowerCase();
|
|
2485
2489
|
if (e === "day")
|
|
@@ -2487,23 +2491,23 @@ function gi(s, t) {
|
|
|
2487
2491
|
}
|
|
2488
2492
|
return !1;
|
|
2489
2493
|
}
|
|
2490
|
-
function
|
|
2494
|
+
function ne(s) {
|
|
2491
2495
|
var t = s.replace(/[\(\)\[\]\{\}]/g, "").match(/(.\.)*/);
|
|
2492
2496
|
return t && t[0].length > 0;
|
|
2493
2497
|
}
|
|
2494
|
-
function
|
|
2495
|
-
return s.length <= 3 ? !0 :
|
|
2498
|
+
function ae(s) {
|
|
2499
|
+
return s.length <= 3 ? !0 : fe(s);
|
|
2496
2500
|
}
|
|
2497
|
-
function
|
|
2501
|
+
function Ot(s, t) {
|
|
2498
2502
|
return t && (s = s.slice(t - 1, t + 2)), !isNaN(Number(s));
|
|
2499
2503
|
}
|
|
2500
|
-
function
|
|
2504
|
+
function vi(s) {
|
|
2501
2505
|
return s.match(/^(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$/);
|
|
2502
2506
|
}
|
|
2503
2507
|
function Ai(s) {
|
|
2504
2508
|
return s.match(/[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/);
|
|
2505
2509
|
}
|
|
2506
|
-
function
|
|
2510
|
+
function yi(s) {
|
|
2507
2511
|
var t = 0;
|
|
2508
2512
|
if ((t = s.indexOf(".")) > -1 || (t = s.indexOf("!")) > -1 || (t = s.indexOf("?")) > -1) {
|
|
2509
2513
|
var e = s.charAt(t + 1);
|
|
@@ -2512,10 +2516,10 @@ function vi(s) {
|
|
|
2512
2516
|
}
|
|
2513
2517
|
return !1;
|
|
2514
2518
|
}
|
|
2515
|
-
function
|
|
2519
|
+
function wi(s) {
|
|
2516
2520
|
return s === "." || s === "!" || s === "?";
|
|
2517
2521
|
}
|
|
2518
|
-
function
|
|
2522
|
+
function Si(s, t) {
|
|
2519
2523
|
t = Object.assign(t || {}, {
|
|
2520
2524
|
newlineBoundary: t && t.newlineBoundary || !0
|
|
2521
2525
|
});
|
|
@@ -2525,26 +2529,26 @@ function wi(s, t) {
|
|
|
2525
2529
|
s.re(e, { split: !0 }),
|
|
2526
2530
|
// Merge words as sentences
|
|
2527
2531
|
s.splitAndMerge(function(i, r, n, a, o, h) {
|
|
2528
|
-
var m, p = [i, null], u = i, g = h.slice(o + 1).find(function(
|
|
2529
|
-
return !e.test(
|
|
2532
|
+
var m, p = [i, null], u = i, g = h.slice(o + 1).find(function(N) {
|
|
2533
|
+
return !e.test(N.value);
|
|
2530
2534
|
});
|
|
2531
2535
|
if (i === `
|
|
2532
|
-
` && t.newlineBoundary ||
|
|
2536
|
+
` && t.newlineBoundary || wi(i) || wt.endsWithChar(i, "?!"))
|
|
2533
2537
|
return p;
|
|
2534
|
-
if (
|
|
2538
|
+
if (wt.endsWithChar(i, ".")) {
|
|
2535
2539
|
if (g) {
|
|
2536
|
-
if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) ||
|
|
2540
|
+
if (i.length === 2 && isNaN(i.charAt(0)) && i.match(/[a-zA-Z]/) || gi(i))
|
|
2537
2541
|
return u;
|
|
2538
|
-
if (
|
|
2539
|
-
if (
|
|
2542
|
+
if (mi(g.value)) {
|
|
2543
|
+
if (bi(i, g.value) || Ot(g.value) && ae(i))
|
|
2540
2544
|
return u;
|
|
2541
|
-
} else if (
|
|
2545
|
+
} else if (wt.endsWith(i, "..") || ne(i) || ae(i))
|
|
2542
2546
|
return u;
|
|
2543
2547
|
}
|
|
2544
2548
|
return p;
|
|
2545
2549
|
}
|
|
2546
|
-
let
|
|
2547
|
-
return (
|
|
2550
|
+
let A;
|
|
2551
|
+
return (A = i.indexOf(".")) > -1 && (Ot(i, A) || ne(i) || Ai(i) || vi(i)) ? u : (m = yi(i)) ? [
|
|
2548
2552
|
m[0] + m[1],
|
|
2549
2553
|
null,
|
|
2550
2554
|
m[2]
|
|
@@ -2556,13 +2560,13 @@ function wi(s, t) {
|
|
|
2556
2560
|
})
|
|
2557
2561
|
);
|
|
2558
2562
|
}
|
|
2559
|
-
const
|
|
2560
|
-
function
|
|
2563
|
+
const Ei = (s, ...t) => (...e) => s(...t, ...e);
|
|
2564
|
+
function Ti(s) {
|
|
2561
2565
|
return {
|
|
2562
|
-
sentences: Si
|
|
2566
|
+
sentences: Ei(Si, s)
|
|
2563
2567
|
};
|
|
2564
2568
|
}
|
|
2565
|
-
function
|
|
2569
|
+
function Ii(s, t) {
|
|
2566
2570
|
return t ? s.reduce(function(e, i) {
|
|
2567
2571
|
var r = [
|
|
2568
2572
|
i.index,
|
|
@@ -2572,11 +2576,11 @@ function Ti(s, t) {
|
|
|
2572
2576
|
return [e, r].join(":");
|
|
2573
2577
|
}, t) : null;
|
|
2574
2578
|
}
|
|
2575
|
-
function
|
|
2579
|
+
function xi(s) {
|
|
2576
2580
|
const { index: t, offset: e, value: i, ...r } = s;
|
|
2577
2581
|
return r;
|
|
2578
2582
|
}
|
|
2579
|
-
function
|
|
2583
|
+
function Ni(s, t) {
|
|
2580
2584
|
var e = 0;
|
|
2581
2585
|
return Array.isArray(t) || (t = [t]), t.map(function(i) {
|
|
2582
2586
|
return i === null ? null : (typeof i == "string" && (i = {
|
|
@@ -2586,7 +2590,7 @@ function xi(s, t) {
|
|
|
2586
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);
|
|
2587
2591
|
});
|
|
2588
2592
|
}
|
|
2589
|
-
function
|
|
2593
|
+
function Li(s, t) {
|
|
2590
2594
|
if (s.length == 0) return null;
|
|
2591
2595
|
var e = "", i = 0, r = s[0]?.index;
|
|
2592
2596
|
return s.forEach(function(n, a) {
|
|
@@ -2603,17 +2607,17 @@ function Ni(s, t) {
|
|
|
2603
2607
|
offset: Math.max(i, e.length)
|
|
2604
2608
|
};
|
|
2605
2609
|
}
|
|
2606
|
-
const
|
|
2607
|
-
tokensId:
|
|
2608
|
-
normalize:
|
|
2609
|
-
properties:
|
|
2610
|
-
merge:
|
|
2610
|
+
const j = {
|
|
2611
|
+
tokensId: Ii,
|
|
2612
|
+
normalize: Ni,
|
|
2613
|
+
properties: xi,
|
|
2614
|
+
merge: Li
|
|
2611
2615
|
};
|
|
2612
|
-
var
|
|
2613
|
-
"([^" +
|
|
2616
|
+
var Oi = ' \r\n !"#$%&()*+,-.\\/:;<=>?@[\\]^_`{|}~', zi = new RegExp(
|
|
2617
|
+
"([^" + Oi + "]+)"
|
|
2614
2618
|
);
|
|
2615
|
-
function
|
|
2616
|
-
if (!(this instanceof
|
|
2619
|
+
function R(s) {
|
|
2620
|
+
if (!(this instanceof R)) return new R(s);
|
|
2617
2621
|
this.opts = Object.assign({
|
|
2618
2622
|
cacheGet: function(t) {
|
|
2619
2623
|
return null;
|
|
@@ -2622,7 +2626,7 @@ function z(s) {
|
|
|
2622
2626
|
}
|
|
2623
2627
|
}, s);
|
|
2624
2628
|
}
|
|
2625
|
-
|
|
2629
|
+
R.prototype.split = function(t, e = {}) {
|
|
2626
2630
|
var i = this;
|
|
2627
2631
|
return e = Object.assign({ preserveProperties: !0, cache: () => null }, e), function(r, n) {
|
|
2628
2632
|
if (arguments.length === 6) return t.apply(null, arguments);
|
|
@@ -2632,10 +2636,10 @@ z.prototype.split = function(t, e = {}) {
|
|
|
2632
2636
|
value: r,
|
|
2633
2637
|
index: 0,
|
|
2634
2638
|
offset: r.length
|
|
2635
|
-
}] : Array.isArray(r) || (r = [r]), o =
|
|
2639
|
+
}] : Array.isArray(r) || (r = [r]), o = j.tokensId(r, e.cache()), o && (h = i.opts.cacheGet(o), h))
|
|
2636
2640
|
return h;
|
|
2637
2641
|
var m = r.map(function(p, u) {
|
|
2638
|
-
var g = r[u + 1],
|
|
2642
|
+
var g = r[u + 1], A = t(
|
|
2639
2643
|
p.value,
|
|
2640
2644
|
Object.assign({}, p),
|
|
2641
2645
|
a ? Object.assign({}, a) : null,
|
|
@@ -2643,27 +2647,27 @@ z.prototype.split = function(t, e = {}) {
|
|
|
2643
2647
|
u,
|
|
2644
2648
|
r
|
|
2645
2649
|
) || [];
|
|
2646
|
-
if (
|
|
2647
|
-
var
|
|
2648
|
-
|
|
2649
|
-
return Object.assign({}, d,
|
|
2650
|
+
if (A = j.normalize(p, A), e.preserveProperties) {
|
|
2651
|
+
var N = j.properties(p);
|
|
2652
|
+
A = A.map(function(d) {
|
|
2653
|
+
return Object.assign({}, d, N);
|
|
2650
2654
|
});
|
|
2651
2655
|
}
|
|
2652
|
-
return a = p,
|
|
2656
|
+
return a = p, A;
|
|
2653
2657
|
}).filter(Boolean).flat();
|
|
2654
2658
|
return o && i.opts.cacheSet(o, m), m;
|
|
2655
2659
|
};
|
|
2656
2660
|
};
|
|
2657
|
-
|
|
2661
|
+
R.prototype.re = function(t, e = {}) {
|
|
2658
2662
|
return e = Object.assign({ split: !1 }, e), this.split(function(i, r) {
|
|
2659
2663
|
for (var n = i, a = [], o, h = 0; o = t.exec(i); ) {
|
|
2660
2664
|
var m = o.index, p = h + m, u = o[0] || "", g = u.length;
|
|
2661
2665
|
if (e.split && h < p) {
|
|
2662
|
-
var
|
|
2666
|
+
var A = n.slice(h, p);
|
|
2663
2667
|
a.push({
|
|
2664
|
-
value:
|
|
2668
|
+
value: A,
|
|
2665
2669
|
index: h,
|
|
2666
|
-
offset:
|
|
2670
|
+
offset: A.length
|
|
2667
2671
|
});
|
|
2668
2672
|
}
|
|
2669
2673
|
a.push({
|
|
@@ -2684,25 +2688,25 @@ z.prototype.re = function(t, e = {}) {
|
|
|
2684
2688
|
}
|
|
2685
2689
|
});
|
|
2686
2690
|
};
|
|
2687
|
-
|
|
2691
|
+
R.prototype.splitAndMerge = function(t, e = {}) {
|
|
2688
2692
|
var i = this;
|
|
2689
2693
|
return e = Object.assign({ mergeWith: "" }, e), function(r) {
|
|
2690
2694
|
var n = [], a = [];
|
|
2691
2695
|
function o() {
|
|
2692
2696
|
if (a.length != 0) {
|
|
2693
|
-
var h =
|
|
2697
|
+
var h = j.merge(a, e.mergeWith);
|
|
2694
2698
|
n.push(h), a = [];
|
|
2695
2699
|
}
|
|
2696
2700
|
}
|
|
2697
2701
|
return i.split(function(h, m) {
|
|
2698
2702
|
var p = t.apply(null, arguments);
|
|
2699
|
-
p =
|
|
2703
|
+
p = j.normalize(m, p), p.forEach(function(u) {
|
|
2700
2704
|
u === null ? o() : a.push(u);
|
|
2701
2705
|
});
|
|
2702
2706
|
})(r), o(), n;
|
|
2703
2707
|
};
|
|
2704
2708
|
};
|
|
2705
|
-
|
|
2709
|
+
R.prototype.filter = function(t) {
|
|
2706
2710
|
return this.split(function(e, i) {
|
|
2707
2711
|
if (t.apply(null, arguments))
|
|
2708
2712
|
return {
|
|
@@ -2712,7 +2716,7 @@ z.prototype.filter = function(t) {
|
|
|
2712
2716
|
};
|
|
2713
2717
|
});
|
|
2714
2718
|
};
|
|
2715
|
-
|
|
2719
|
+
R.prototype.extend = function(t) {
|
|
2716
2720
|
return this.split(function(e, i) {
|
|
2717
2721
|
var r = typeof t == "function" ? t.apply(null, arguments) : t;
|
|
2718
2722
|
return Object.assign({
|
|
@@ -2722,7 +2726,7 @@ z.prototype.extend = function(t) {
|
|
|
2722
2726
|
}, r);
|
|
2723
2727
|
});
|
|
2724
2728
|
};
|
|
2725
|
-
|
|
2729
|
+
R.prototype.ifthen = function(s, t) {
|
|
2726
2730
|
return this.split(function(e, i) {
|
|
2727
2731
|
if (s.apply(null, arguments))
|
|
2728
2732
|
return t.apply(null, arguments);
|
|
@@ -2730,35 +2734,35 @@ z.prototype.ifthen = function(s, t) {
|
|
|
2730
2734
|
return n;
|
|
2731
2735
|
});
|
|
2732
2736
|
};
|
|
2733
|
-
|
|
2737
|
+
R.prototype.test = function(t) {
|
|
2734
2738
|
return this.filter(function(e, i) {
|
|
2735
2739
|
return t.test(e);
|
|
2736
2740
|
}, {
|
|
2737
2741
|
cache: t.toString()
|
|
2738
2742
|
});
|
|
2739
2743
|
};
|
|
2740
|
-
|
|
2744
|
+
R.prototype.flow = function(...t) {
|
|
2741
2745
|
const e = t.reduce((i, r) => (...n) => r(i(...n)));
|
|
2742
2746
|
return this.split(e);
|
|
2743
2747
|
};
|
|
2744
|
-
|
|
2748
|
+
R.prototype.serie = function(...t) {
|
|
2745
2749
|
return t.reduce((e, i) => (...r) => i(e(...r)));
|
|
2746
2750
|
};
|
|
2747
|
-
|
|
2751
|
+
R.prototype.merge = function() {
|
|
2748
2752
|
return this.splitAndMerge((s) => [s]);
|
|
2749
2753
|
};
|
|
2750
|
-
|
|
2754
|
+
R.prototype.sections = function() {
|
|
2751
2755
|
return this.re(/([^\n\.,;!?]+)/i, { split: !1 });
|
|
2752
2756
|
};
|
|
2753
|
-
|
|
2754
|
-
return this.re(
|
|
2757
|
+
R.prototype.words = function() {
|
|
2758
|
+
return this.re(zi);
|
|
2755
2759
|
};
|
|
2756
|
-
|
|
2760
|
+
R.prototype.characters = function() {
|
|
2757
2761
|
return this.re(/[^\s]/);
|
|
2758
2762
|
};
|
|
2759
|
-
var
|
|
2760
|
-
const Ri = (s, t) => "Segmenter" in Intl ? new
|
|
2761
|
-
class
|
|
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 ki(s, t) : new Pi(s, t);
|
|
2765
|
+
class ki {
|
|
2762
2766
|
constructor(t, e) {
|
|
2763
2767
|
if (this.unit = e, t = t ?? navigator?.language, !("Segmenter" in Intl)) throw new Error("Intl.Segmenter is not supported in this environment");
|
|
2764
2768
|
if (e === "paragraph") throw new Error("IntlTextTokenizer does not handle TextUnit.Paragraph");
|
|
@@ -2770,7 +2774,7 @@ class Ci {
|
|
|
2770
2774
|
const e = this.segmenter.segment(t), i = [];
|
|
2771
2775
|
for (let r of e) {
|
|
2772
2776
|
if (this.unit === "word" && r.isWordLike === !1) continue;
|
|
2773
|
-
const n =
|
|
2777
|
+
const n = pe(r.segment);
|
|
2774
2778
|
n !== null && i.push([r.index, r.index + n.length]);
|
|
2775
2779
|
}
|
|
2776
2780
|
return i;
|
|
@@ -2779,7 +2783,7 @@ class Ci {
|
|
|
2779
2783
|
class Pi {
|
|
2780
2784
|
constructor(t, e) {
|
|
2781
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");
|
|
2782
|
-
this.tokenizer = new
|
|
2786
|
+
this.tokenizer = new R();
|
|
2783
2787
|
}
|
|
2784
2788
|
tokenize(t) {
|
|
2785
2789
|
let e = [];
|
|
@@ -2788,7 +2792,7 @@ class Pi {
|
|
|
2788
2792
|
e = this.tokenizer.words()(t);
|
|
2789
2793
|
break;
|
|
2790
2794
|
case "sentence":
|
|
2791
|
-
this.isEnglish ? e =
|
|
2795
|
+
this.isEnglish ? e = Ti(this.tokenizer).sentences()(t) : e = this.tokenizer.sections()(t);
|
|
2792
2796
|
break;
|
|
2793
2797
|
default:
|
|
2794
2798
|
e = [];
|
|
@@ -2797,18 +2801,231 @@ class Pi {
|
|
|
2797
2801
|
const i = [];
|
|
2798
2802
|
return e.forEach((r) => {
|
|
2799
2803
|
if (r.value.length === 0) return;
|
|
2800
|
-
const n =
|
|
2804
|
+
const n = pe(r.value);
|
|
2801
2805
|
n !== null && i.push([r.index, r.index + n.length]);
|
|
2802
2806
|
}), i;
|
|
2803
2807
|
}
|
|
2804
2808
|
}
|
|
2805
|
-
const
|
|
2809
|
+
const Di = new RegExp("[\\p{L}\\p{N}]+", "u"), pe = (s) => {
|
|
2806
2810
|
const t = s.trimEnd();
|
|
2807
|
-
return t.length === 0 || t.match(
|
|
2811
|
+
return t.length === 0 || t.match(Di) === null ? null : t;
|
|
2808
2812
|
};
|
|
2809
|
-
class
|
|
2813
|
+
class I {
|
|
2814
|
+
constructor(t, e) {
|
|
2815
|
+
this._allItems = t, this.linkMap = e;
|
|
2816
|
+
}
|
|
2817
|
+
static build(t, e = {}) {
|
|
2818
|
+
const i = t.toc?.items ?? [], r = t.readingOrder.items, { depth: n } = e, a = /* @__PURE__ */ new Map(), o = [];
|
|
2819
|
+
for (let h = 0; h < r.length; h++) {
|
|
2820
|
+
const m = r[h], p = I.bareHref(m.href), u = m.title ?? I.findTitleInToc(i, p, n) ?? `Resource ${h + 1}`, g = I.collectChildrenFromToc(i, p, n, 1, a), A = {
|
|
2821
|
+
title: u,
|
|
2822
|
+
references: [m.href],
|
|
2823
|
+
children: g.length > 0 ? g : void 0
|
|
2824
|
+
}, N = I.findTocLink(i, p, n);
|
|
2825
|
+
a.set(A, N ?? m), o.push(A);
|
|
2826
|
+
}
|
|
2827
|
+
return new I(o, a);
|
|
2828
|
+
}
|
|
2829
|
+
/**
|
|
2830
|
+
* The active depth limit for TOC traversal (title resolution and child
|
|
2831
|
+
* collection). `undefined` means unlimited. Setting the same value again
|
|
2832
|
+
* is a no-op; a new value invalidates the cached items and flat list.
|
|
2833
|
+
*/
|
|
2834
|
+
get depth() {
|
|
2835
|
+
return this._depth;
|
|
2836
|
+
}
|
|
2837
|
+
set depth(t) {
|
|
2838
|
+
this._depth !== t && (this._depth = t, this._items = void 0, this._flat = void 0);
|
|
2839
|
+
}
|
|
2840
|
+
/** Top-level timeline items. Cached; invalidated when `depth` changes. */
|
|
2841
|
+
get items() {
|
|
2842
|
+
return this._items || (this._items = this._depth !== void 0 ? I.trimToDepth(this._allItems, this._depth) : this._allItems), this._items;
|
|
2843
|
+
}
|
|
2844
|
+
locate(t) {
|
|
2845
|
+
const e = t.href.split("#")[0], i = t.locations?.time();
|
|
2846
|
+
let r;
|
|
2847
|
+
if (i !== void 0)
|
|
2848
|
+
for (const n of this.flat)
|
|
2849
|
+
this.itemMatchesTime(n, e, i) && (r = n);
|
|
2850
|
+
return r || (r = this.flat.find((n) => this.bareHrefFromItem(n) === e)), r;
|
|
2851
|
+
}
|
|
2852
|
+
adjacentTo(t) {
|
|
2853
|
+
const e = this.flat.indexOf(t);
|
|
2854
|
+
return {
|
|
2855
|
+
previous: e > 0 ? this.flat[e - 1] : void 0,
|
|
2856
|
+
next: e >= 0 && e < this.flat.length - 1 ? this.flat[e + 1] : void 0
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
segmentsForHref(t) {
|
|
2860
|
+
const e = t.split("#")[0], i = this.items.find((r) => this.bareHrefFromItem(r) === e);
|
|
2861
|
+
return i ? i.children?.length ? i.children : [i] : [];
|
|
2862
|
+
}
|
|
2863
|
+
itemAtProgression(t, e, i) {
|
|
2864
|
+
const r = t.split("#")[0], n = this.items.find((o) => this.bareHrefFromItem(o) === r);
|
|
2865
|
+
if (!n) return;
|
|
2866
|
+
if (!n.children?.length) return n;
|
|
2867
|
+
if (i !== void 0) {
|
|
2868
|
+
const o = e * i;
|
|
2869
|
+
let h = n;
|
|
2870
|
+
for (const m of n.children) {
|
|
2871
|
+
const p = this.timeFromItem(m);
|
|
2872
|
+
if (p === void 0 || p > o) break;
|
|
2873
|
+
h = m;
|
|
2874
|
+
}
|
|
2875
|
+
return h;
|
|
2876
|
+
}
|
|
2877
|
+
const a = Math.min(Math.floor(e * n.children.length), n.children.length - 1);
|
|
2878
|
+
return n.children[a];
|
|
2879
|
+
}
|
|
2880
|
+
ancestors(t) {
|
|
2881
|
+
return this.ancestorPath(this.items, t) ?? [];
|
|
2882
|
+
}
|
|
2883
|
+
linkFor(t) {
|
|
2884
|
+
return this.linkMap.get(t);
|
|
2885
|
+
}
|
|
2886
|
+
get flat() {
|
|
2887
|
+
return this._flat || (this._flat = this.flattenItems(this.items)), this._flat;
|
|
2888
|
+
}
|
|
2889
|
+
// -------------------------------------------------------------------------
|
|
2890
|
+
// TOC title resolution
|
|
2891
|
+
// -------------------------------------------------------------------------
|
|
2892
|
+
/**
|
|
2893
|
+
* Resolve a display title for `bare` from the TOC, looking no deeper than
|
|
2894
|
+
* `maxDepth` levels (1 = top-level entries only). Priority:
|
|
2895
|
+
* 1. A start-of-resource entry: bare href or `#t=0` (audio).
|
|
2896
|
+
* 2. Exactly one fragment entry referencing this resource — unambiguous.
|
|
2897
|
+
* 3. Multiple fragment entries — ambiguous, returns `undefined`.
|
|
2898
|
+
*/
|
|
2899
|
+
static findTitleInToc(t, e, i) {
|
|
2900
|
+
const { atStart: r, fragments: n } = I.collectTocCandidates(t, e, i, 1);
|
|
2901
|
+
if (r.length > 0) return r[0].title;
|
|
2902
|
+
if (n.length === 1) return n[0].title;
|
|
2903
|
+
}
|
|
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
|
+
/**
|
|
2913
|
+
* Collect all TOC entries that reference `bare` as flat children, walking
|
|
2914
|
+
* up to `maxDepth` levels deep. Start-of-resource entries (#t=0 or no
|
|
2915
|
+
* fragment) are excluded — they contribute to title resolution, not children.
|
|
2916
|
+
* Order follows TOC declaration (depth-first).
|
|
2917
|
+
*/
|
|
2918
|
+
static collectChildrenFromToc(t, e, i, r, n) {
|
|
2919
|
+
if (i !== void 0 && r > i) return [];
|
|
2920
|
+
const a = [];
|
|
2921
|
+
for (const o of t) {
|
|
2922
|
+
if (I.bareHref(o.href) === e && o.title && !I.isStartOfResource(o.href)) {
|
|
2923
|
+
const h = { title: o.title, references: [o.href] };
|
|
2924
|
+
n.set(h, o), a.push(h);
|
|
2925
|
+
}
|
|
2926
|
+
o.children?.items?.length && a.push(...I.collectChildrenFromToc(
|
|
2927
|
+
o.children.items,
|
|
2928
|
+
e,
|
|
2929
|
+
i,
|
|
2930
|
+
r + 1,
|
|
2931
|
+
n
|
|
2932
|
+
));
|
|
2933
|
+
}
|
|
2934
|
+
return a;
|
|
2935
|
+
}
|
|
2936
|
+
/**
|
|
2937
|
+
* Walk the TOC tree up to `maxDepth` levels and collect all entries whose
|
|
2938
|
+
* bare href matches `bare`, split into start-of-resource entries and
|
|
2939
|
+
* fragment entries.
|
|
2940
|
+
*/
|
|
2941
|
+
static collectTocCandidates(t, e, i, r) {
|
|
2942
|
+
if (i !== void 0 && r > i)
|
|
2943
|
+
return { atStart: [], fragments: [] };
|
|
2944
|
+
const n = [], a = [];
|
|
2945
|
+
for (const o of t)
|
|
2946
|
+
if (I.bareHref(o.href) === e && o.title && (I.isStartOfResource(o.href) ? n.push(o) : a.push(o)), o.children?.items?.length) {
|
|
2947
|
+
const h = I.collectTocCandidates(
|
|
2948
|
+
o.children.items,
|
|
2949
|
+
e,
|
|
2950
|
+
i,
|
|
2951
|
+
r + 1
|
|
2952
|
+
);
|
|
2953
|
+
n.push(...h.atStart), a.push(...h.fragments);
|
|
2954
|
+
}
|
|
2955
|
+
return { atStart: n, fragments: a };
|
|
2956
|
+
}
|
|
2957
|
+
/**
|
|
2958
|
+
* A TOC href points to the start of its resource when it has no fragment,
|
|
2959
|
+
* or when the fragment is `t=0` (audio: explicit beginning of the file).
|
|
2960
|
+
*/
|
|
2961
|
+
static isStartOfResource(t) {
|
|
2962
|
+
const e = t.split("#")[1];
|
|
2963
|
+
return e ? e === "t=0" : !0;
|
|
2964
|
+
}
|
|
2965
|
+
// -------------------------------------------------------------------------
|
|
2966
|
+
// Shared utilities
|
|
2967
|
+
// -------------------------------------------------------------------------
|
|
2968
|
+
static trimToDepth(t, e) {
|
|
2969
|
+
return t.map((i) => ({
|
|
2970
|
+
...i,
|
|
2971
|
+
children: e > 1 && i.children?.length ? I.trimToDepth(i.children, e - 1) : void 0
|
|
2972
|
+
}));
|
|
2973
|
+
}
|
|
2974
|
+
flattenItems(t) {
|
|
2975
|
+
const e = [];
|
|
2976
|
+
for (const i of t)
|
|
2977
|
+
e.push(i), i.children && e.push(...this.flattenItems(i.children));
|
|
2978
|
+
return e;
|
|
2979
|
+
}
|
|
2980
|
+
itemMatchesTime(t, e, i) {
|
|
2981
|
+
for (const r of t.references) {
|
|
2982
|
+
const n = r.indexOf("#"), a = n >= 0 ? r.slice(0, n) : r, o = n >= 0 ? r.slice(n + 1) : void 0;
|
|
2983
|
+
if ((a || e) === e && i >= I.parseTimeFragment(o))
|
|
2984
|
+
return !0;
|
|
2985
|
+
}
|
|
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
|
+
}
|
|
2993
|
+
bareHrefFromItem(t) {
|
|
2994
|
+
return (t.references[0] ?? "").split("#")[0];
|
|
2995
|
+
}
|
|
2996
|
+
timeFromItem(t) {
|
|
2997
|
+
const e = t.references[0];
|
|
2998
|
+
if (!e) return;
|
|
2999
|
+
const i = e.split("#")[1];
|
|
3000
|
+
if (!i) return;
|
|
3001
|
+
const r = i.match(/(?:^|&)t=(\d+(?:\.\d+)?)/);
|
|
3002
|
+
return r ? parseFloat(r[1]) : void 0;
|
|
3003
|
+
}
|
|
3004
|
+
ancestorPath(t, e) {
|
|
3005
|
+
for (const i of t) {
|
|
3006
|
+
if (i === e) return [];
|
|
3007
|
+
if (i.children) {
|
|
3008
|
+
const r = this.ancestorPath(i.children, e);
|
|
3009
|
+
if (r !== null) return [i, ...r];
|
|
3010
|
+
}
|
|
3011
|
+
}
|
|
3012
|
+
return null;
|
|
3013
|
+
}
|
|
3014
|
+
static bareHref(t) {
|
|
3015
|
+
return t.split("#")[0];
|
|
3016
|
+
}
|
|
3017
|
+
}
|
|
3018
|
+
class Y {
|
|
2810
3019
|
constructor(t) {
|
|
2811
|
-
this.fetcher = new
|
|
3020
|
+
this.fetcher = new ei(), t.fetcher && (this.fetcher = t.fetcher), this.manifest = t.manifest, this.context = t.manifest.context, this.metadata = t.manifest.metadata, this.links = t.manifest.links, this.readingOrder = t.manifest.readingOrder, this.resources = t.manifest.resources, this.toc = t.manifest.toc, this.subcollections = t.manifest.subcollections;
|
|
3021
|
+
}
|
|
3022
|
+
/**
|
|
3023
|
+
* Returns the publication's timeline, built from its reading order and table of contents.
|
|
3024
|
+
* Called with no arguments, the result is cached. Pass options to build a fresh timeline
|
|
3025
|
+
* with a specific configuration (e.g. a depth limit).
|
|
3026
|
+
*/
|
|
3027
|
+
get timeline() {
|
|
3028
|
+
return this._timeline || (this._timeline = I.build(this)), this._timeline;
|
|
2812
3029
|
}
|
|
2813
3030
|
/** The URL where this publication is served, computed from the `Link` with `self` relation.
|
|
2814
3031
|
* e.g. https://provider.com/pub1293/manifest.json gives https://provider.com/pub1293/
|
|
@@ -2838,6 +3055,28 @@ class V {
|
|
|
2838
3055
|
linkWithRel(t) {
|
|
2839
3056
|
return this.manifest.linkWithRel(t);
|
|
2840
3057
|
}
|
|
3058
|
+
/**
|
|
3059
|
+
* Gets the cover image for the publication.
|
|
3060
|
+
* First looks for rel='cover' in links/resources/readingOrder,
|
|
3061
|
+
* then falls back to any image (JPEG, PNG, GIF, AVIF, SVG) as bitmap fallback.
|
|
3062
|
+
*/
|
|
3063
|
+
getCover() {
|
|
3064
|
+
const t = [
|
|
3065
|
+
this.links,
|
|
3066
|
+
this.resources,
|
|
3067
|
+
this.readingOrder
|
|
3068
|
+
].filter(Boolean);
|
|
3069
|
+
for (const e of t) {
|
|
3070
|
+
const i = e.items.find((r) => r.rels?.has("cover"));
|
|
3071
|
+
if (i) return i;
|
|
3072
|
+
}
|
|
3073
|
+
for (const e of t) {
|
|
3074
|
+
const i = e.items.find(
|
|
3075
|
+
(r) => r.mediaType.isBitmap || r.mediaType.matches(c.SVG)
|
|
3076
|
+
);
|
|
3077
|
+
if (i) return i;
|
|
3078
|
+
}
|
|
3079
|
+
}
|
|
2841
3080
|
async positionsFromManifest() {
|
|
2842
3081
|
const t = this.manifest.links.findWithMediaType(
|
|
2843
3082
|
"application/vnd.readium.position-list+json"
|
|
@@ -2846,7 +3085,7 @@ class V {
|
|
|
2846
3085
|
const e = await this.get(
|
|
2847
3086
|
t
|
|
2848
3087
|
).readAsJSON();
|
|
2849
|
-
return e.total ? e.positions.map((i) =>
|
|
3088
|
+
return e.total ? e.positions.map((i) => D.deserialize(i)).filter((i) => i !== void 0) : [];
|
|
2850
3089
|
}
|
|
2851
3090
|
async guideForLink(t) {
|
|
2852
3091
|
const e = (a) => a.alternates?.findWithMediaType(
|
|
@@ -2862,13 +3101,13 @@ class V {
|
|
|
2862
3101
|
)), !i) return;
|
|
2863
3102
|
let r = i.href;
|
|
2864
3103
|
if (i.templated) {
|
|
2865
|
-
const a = new
|
|
2866
|
-
a.parameters.has("ref") && (o.ref = t.href), r = new
|
|
3104
|
+
const a = new ut(r), o = {};
|
|
3105
|
+
a.parameters.has("ref") && (o.ref = t.href), r = new ut(r).expand(o);
|
|
2867
3106
|
}
|
|
2868
|
-
const n = await this.get(new
|
|
3107
|
+
const n = await this.get(new M({
|
|
2869
3108
|
href: r
|
|
2870
3109
|
})).readAsJSON();
|
|
2871
|
-
return
|
|
3110
|
+
return Xt.deserialize(n);
|
|
2872
3111
|
}
|
|
2873
3112
|
/**
|
|
2874
3113
|
* Returns the resource targeted by the given non-templated [link].
|
|
@@ -2877,25 +3116,25 @@ class V {
|
|
|
2877
3116
|
return this.fetcher.get(t);
|
|
2878
3117
|
}
|
|
2879
3118
|
}
|
|
2880
|
-
|
|
3119
|
+
Y.prototype.getPageList = function() {
|
|
2881
3120
|
return this.linksWithRole("pageList");
|
|
2882
3121
|
};
|
|
2883
|
-
|
|
3122
|
+
Y.prototype.getLandmarks = function() {
|
|
2884
3123
|
return this.linksWithRole("landmarks");
|
|
2885
3124
|
};
|
|
2886
|
-
|
|
3125
|
+
Y.prototype.getListOfAudioClips = function() {
|
|
2887
3126
|
return this.linksWithRole("loa");
|
|
2888
3127
|
};
|
|
2889
|
-
|
|
3128
|
+
Y.prototype.getListOfIllustrations = function() {
|
|
2890
3129
|
return this.linksWithRole("loi");
|
|
2891
3130
|
};
|
|
2892
|
-
|
|
3131
|
+
Y.prototype.getListOfTables = function() {
|
|
2893
3132
|
return this.linksWithRole("lot");
|
|
2894
3133
|
};
|
|
2895
|
-
|
|
3134
|
+
Y.prototype.getListOfVideoClips = function() {
|
|
2896
3135
|
return this.linksWithRole("lov");
|
|
2897
3136
|
};
|
|
2898
|
-
class
|
|
3137
|
+
class gt {
|
|
2899
3138
|
/**
|
|
2900
3139
|
* Creates a [DomRange].
|
|
2901
3140
|
*/
|
|
@@ -2907,10 +3146,10 @@ class mt {
|
|
|
2907
3146
|
*/
|
|
2908
3147
|
static deserialize(t) {
|
|
2909
3148
|
if (!(t && t.cssSelector)) return;
|
|
2910
|
-
let e =
|
|
3149
|
+
let e = z(t.textNodeIndex);
|
|
2911
3150
|
if (e === void 0) return;
|
|
2912
|
-
let i =
|
|
2913
|
-
return i === void 0 && (i =
|
|
3151
|
+
let i = z(t.charOffset);
|
|
3152
|
+
return i === void 0 && (i = z(t.offset)), new gt({
|
|
2914
3153
|
cssSelector: t.cssSelector,
|
|
2915
3154
|
textNodeIndex: e,
|
|
2916
3155
|
charOffset: i
|
|
@@ -2927,7 +3166,7 @@ class mt {
|
|
|
2927
3166
|
return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
|
|
2928
3167
|
}
|
|
2929
3168
|
}
|
|
2930
|
-
class
|
|
3169
|
+
class Kt {
|
|
2931
3170
|
/**
|
|
2932
3171
|
* Creates a [DomRange].
|
|
2933
3172
|
*/
|
|
@@ -2939,11 +3178,11 @@ class Xt {
|
|
|
2939
3178
|
*/
|
|
2940
3179
|
static deserialize(t) {
|
|
2941
3180
|
if (!t) return;
|
|
2942
|
-
let e =
|
|
3181
|
+
let e = gt.deserialize(t.start);
|
|
2943
3182
|
if (e)
|
|
2944
|
-
return new
|
|
3183
|
+
return new Kt({
|
|
2945
3184
|
start: e,
|
|
2946
|
-
end:
|
|
3185
|
+
end: gt.deserialize(t.end)
|
|
2947
3186
|
});
|
|
2948
3187
|
}
|
|
2949
3188
|
/**
|
|
@@ -2961,7 +3200,7 @@ T.prototype.getPartialCfi = function() {
|
|
|
2961
3200
|
return this.otherLocations?.get("partialCfi");
|
|
2962
3201
|
};
|
|
2963
3202
|
T.prototype.getDomRange = function() {
|
|
2964
|
-
return
|
|
3203
|
+
return Kt.deserialize(this.otherLocations?.get("domRange"));
|
|
2965
3204
|
};
|
|
2966
3205
|
T.prototype.fragmentParameters = function() {
|
|
2967
3206
|
return new Map(
|
|
@@ -2995,11 +3234,7 @@ T.prototype.space = function() {
|
|
|
2995
3234
|
if (t.length === 4 && !t.some(isNaN))
|
|
2996
3235
|
return t;
|
|
2997
3236
|
};
|
|
2998
|
-
|
|
2999
|
-
const s = this.fragmentParameters();
|
|
3000
|
-
console.log(s);
|
|
3001
|
-
};
|
|
3002
|
-
class Kt {
|
|
3237
|
+
class Zt {
|
|
3003
3238
|
/** Creates a [Price]. */
|
|
3004
3239
|
constructor(t) {
|
|
3005
3240
|
this.currency = t.currency, this.value = t.value;
|
|
@@ -3012,9 +3247,9 @@ class Kt {
|
|
|
3012
3247
|
let e = t.currency;
|
|
3013
3248
|
if (!(e && typeof e == "string" && e.length > 0))
|
|
3014
3249
|
return;
|
|
3015
|
-
let i =
|
|
3250
|
+
let i = z(t.value);
|
|
3016
3251
|
if (i !== void 0)
|
|
3017
|
-
return new
|
|
3252
|
+
return new Zt({ currency: e, value: i });
|
|
3018
3253
|
}
|
|
3019
3254
|
/**
|
|
3020
3255
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -3023,7 +3258,7 @@ class Kt {
|
|
|
3023
3258
|
return { currency: this.currency, value: this.value };
|
|
3024
3259
|
}
|
|
3025
3260
|
}
|
|
3026
|
-
class
|
|
3261
|
+
class tt {
|
|
3027
3262
|
/** Creates a [Acquisition]. */
|
|
3028
3263
|
constructor(t) {
|
|
3029
3264
|
this.type = t.type, this.children = t.children;
|
|
@@ -3033,14 +3268,14 @@ class j {
|
|
|
3033
3268
|
*/
|
|
3034
3269
|
static deserialize(t) {
|
|
3035
3270
|
if (t && t.type)
|
|
3036
|
-
return new
|
|
3271
|
+
return new tt({
|
|
3037
3272
|
type: t.type,
|
|
3038
|
-
children:
|
|
3273
|
+
children: tt.deserializeArray(t.children)
|
|
3039
3274
|
});
|
|
3040
3275
|
}
|
|
3041
3276
|
static deserializeArray(t) {
|
|
3042
3277
|
if (Array.isArray(t))
|
|
3043
|
-
return t.map((e) =>
|
|
3278
|
+
return t.map((e) => tt.deserialize(e)).filter((e) => e !== void 0);
|
|
3044
3279
|
}
|
|
3045
3280
|
/**
|
|
3046
3281
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -3050,7 +3285,7 @@ class j {
|
|
|
3050
3285
|
return this.children && (t.children = this.children.map((e) => e.serialize())), t;
|
|
3051
3286
|
}
|
|
3052
3287
|
}
|
|
3053
|
-
class
|
|
3288
|
+
class Jt {
|
|
3054
3289
|
/** Creates a [Price]. */
|
|
3055
3290
|
constructor(t) {
|
|
3056
3291
|
this.total = t.total, this.position = t.position;
|
|
@@ -3060,9 +3295,9 @@ class Zt {
|
|
|
3060
3295
|
*/
|
|
3061
3296
|
static deserialize(t) {
|
|
3062
3297
|
if (t)
|
|
3063
|
-
return new
|
|
3064
|
-
total:
|
|
3065
|
-
position:
|
|
3298
|
+
return new Jt({
|
|
3299
|
+
total: z(t.total),
|
|
3300
|
+
position: z(t.position)
|
|
3066
3301
|
});
|
|
3067
3302
|
}
|
|
3068
3303
|
/**
|
|
@@ -3073,7 +3308,7 @@ class Zt {
|
|
|
3073
3308
|
return this.total !== void 0 && (t.total = this.total), this.position !== void 0 && (t.position = this.position), t;
|
|
3074
3309
|
}
|
|
3075
3310
|
}
|
|
3076
|
-
class
|
|
3311
|
+
class qt {
|
|
3077
3312
|
/** Creates a [Copies]. */
|
|
3078
3313
|
constructor(t) {
|
|
3079
3314
|
this.total = t.total, this.available = t.available;
|
|
@@ -3083,9 +3318,9 @@ class Jt {
|
|
|
3083
3318
|
*/
|
|
3084
3319
|
static deserialize(t) {
|
|
3085
3320
|
if (t)
|
|
3086
|
-
return new
|
|
3087
|
-
total:
|
|
3088
|
-
available:
|
|
3321
|
+
return new qt({
|
|
3322
|
+
total: z(t.total),
|
|
3323
|
+
available: z(t.available)
|
|
3089
3324
|
});
|
|
3090
3325
|
}
|
|
3091
3326
|
/**
|
|
@@ -3096,8 +3331,8 @@ class Jt {
|
|
|
3096
3331
|
return this.total !== void 0 && (t.total = this.total), this.available !== void 0 && (t.available = this.available), t;
|
|
3097
3332
|
}
|
|
3098
3333
|
}
|
|
3099
|
-
var
|
|
3100
|
-
class
|
|
3334
|
+
var Ui = /* @__PURE__ */ ((s) => (s.available = "available", s.reserved = "reserved", s.ready = "ready", s))(Ui || {});
|
|
3335
|
+
class Qt {
|
|
3101
3336
|
/** Creates a [Availability]. */
|
|
3102
3337
|
constructor(t) {
|
|
3103
3338
|
this.state = t.state, this.since = t.since, this.until = t.until;
|
|
@@ -3107,10 +3342,10 @@ class qt {
|
|
|
3107
3342
|
*/
|
|
3108
3343
|
static deserialize(t) {
|
|
3109
3344
|
if (t && t.state)
|
|
3110
|
-
return new
|
|
3345
|
+
return new Qt({
|
|
3111
3346
|
state: t.state,
|
|
3112
|
-
since:
|
|
3113
|
-
until:
|
|
3347
|
+
since: lt(t.since),
|
|
3348
|
+
until: lt(t.until)
|
|
3114
3349
|
});
|
|
3115
3350
|
}
|
|
3116
3351
|
/**
|
|
@@ -3121,33 +3356,33 @@ class qt {
|
|
|
3121
3356
|
return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
|
|
3122
3357
|
}
|
|
3123
3358
|
}
|
|
3124
|
-
|
|
3125
|
-
return
|
|
3359
|
+
U.prototype.getNumberOfItems = function() {
|
|
3360
|
+
return z(this.otherProperties.numberOfItems);
|
|
3126
3361
|
};
|
|
3127
|
-
|
|
3128
|
-
return
|
|
3362
|
+
U.prototype.getPrice = function() {
|
|
3363
|
+
return Zt.deserialize(this.otherProperties.price);
|
|
3129
3364
|
};
|
|
3130
|
-
|
|
3365
|
+
U.prototype.getIndirectAcquisitions = function() {
|
|
3131
3366
|
const s = this.otherProperties.indirectAcquisition;
|
|
3132
3367
|
if (s && Array.isArray(s))
|
|
3133
|
-
return s.map((t) =>
|
|
3368
|
+
return s.map((t) => tt.deserialize(t)).filter((t) => t !== void 0);
|
|
3134
3369
|
};
|
|
3135
|
-
|
|
3136
|
-
return
|
|
3370
|
+
U.prototype.getHolds = function() {
|
|
3371
|
+
return Jt.deserialize(this.otherProperties.holds);
|
|
3137
3372
|
};
|
|
3138
|
-
|
|
3139
|
-
return
|
|
3373
|
+
U.prototype.getCopies = function() {
|
|
3374
|
+
return qt.deserialize(this.otherProperties.copies);
|
|
3140
3375
|
};
|
|
3141
|
-
|
|
3142
|
-
return
|
|
3376
|
+
U.prototype.getAvailability = function() {
|
|
3377
|
+
return Qt.deserialize(this.otherProperties.availability);
|
|
3143
3378
|
};
|
|
3144
|
-
|
|
3145
|
-
return
|
|
3379
|
+
U.prototype.getAuthenticate = function() {
|
|
3380
|
+
return M.deserialize(this.otherProperties.authenticate);
|
|
3146
3381
|
};
|
|
3147
|
-
|
|
3382
|
+
Y.prototype.getImages = function() {
|
|
3148
3383
|
return this.linksWithRole("images");
|
|
3149
3384
|
};
|
|
3150
|
-
class
|
|
3385
|
+
class ar {
|
|
3151
3386
|
/**
|
|
3152
3387
|
* Extracts the full raw text, or returns null if no text content can be found.
|
|
3153
3388
|
* @param separator Separator to use between individual elements. Defaults to newline.
|
|
@@ -3166,13 +3401,13 @@ class nr {
|
|
|
3166
3401
|
return t;
|
|
3167
3402
|
}
|
|
3168
3403
|
}
|
|
3169
|
-
class
|
|
3404
|
+
class oe {
|
|
3170
3405
|
constructor(t, e) {
|
|
3171
3406
|
this.key = t, this.value = e;
|
|
3172
3407
|
}
|
|
3173
3408
|
}
|
|
3174
|
-
var
|
|
3175
|
-
class
|
|
3409
|
+
var zt = /* @__PURE__ */ ((s) => (s.ACCESSIBILITY_LABEL = "accessibilityLabel", s.LANGUAGE = "language", s))(zt || {});
|
|
3410
|
+
class me {
|
|
3176
3411
|
constructor(t = []) {
|
|
3177
3412
|
this._attributes = t;
|
|
3178
3413
|
}
|
|
@@ -3201,12 +3436,12 @@ class pe {
|
|
|
3201
3436
|
return this._attributes.filter((e) => e.key === t).map((e) => e.value);
|
|
3202
3437
|
}
|
|
3203
3438
|
}
|
|
3204
|
-
class
|
|
3439
|
+
class ge extends me {
|
|
3205
3440
|
constructor(t, e = []) {
|
|
3206
3441
|
super(e), this.locator = t;
|
|
3207
3442
|
}
|
|
3208
3443
|
}
|
|
3209
|
-
class
|
|
3444
|
+
class yt extends ge {
|
|
3210
3445
|
/**
|
|
3211
3446
|
* Human-readable text representation for this element.
|
|
3212
3447
|
*/
|
|
@@ -3214,17 +3449,17 @@ class vt extends me {
|
|
|
3214
3449
|
return this.accessibilityLabel;
|
|
3215
3450
|
}
|
|
3216
3451
|
}
|
|
3217
|
-
class
|
|
3452
|
+
class Mi extends yt {
|
|
3218
3453
|
constructor(t, e, i = []) {
|
|
3219
3454
|
super(t, i), this.embeddedLink = e;
|
|
3220
3455
|
}
|
|
3221
3456
|
}
|
|
3222
|
-
class
|
|
3457
|
+
class Bi extends yt {
|
|
3223
3458
|
constructor(t, e, i = []) {
|
|
3224
3459
|
super(t, i), this.embeddedLink = e;
|
|
3225
3460
|
}
|
|
3226
3461
|
}
|
|
3227
|
-
class
|
|
3462
|
+
class Gi extends yt {
|
|
3228
3463
|
constructor(t, e, i, r = []) {
|
|
3229
3464
|
super(t, r), this.embeddedLink = e, this.caption = i;
|
|
3230
3465
|
}
|
|
@@ -3232,12 +3467,12 @@ class Bi extends vt {
|
|
|
3232
3467
|
return (this.caption?.length || 0) > 0 ? this.caption : super.text;
|
|
3233
3468
|
}
|
|
3234
3469
|
}
|
|
3235
|
-
class
|
|
3470
|
+
class be extends me {
|
|
3236
3471
|
constructor(t, e, i = []) {
|
|
3237
3472
|
super(i), this.locator = t, this.text = e;
|
|
3238
3473
|
}
|
|
3239
3474
|
}
|
|
3240
|
-
class
|
|
3475
|
+
class Ct extends yt {
|
|
3241
3476
|
constructor(t, e, i, r = []) {
|
|
3242
3477
|
super(t, r), this.role = e, this.segments = i;
|
|
3243
3478
|
}
|
|
@@ -3245,7 +3480,7 @@ class zt extends vt {
|
|
|
3245
3480
|
return this.segments.map((t) => t.text).join("");
|
|
3246
3481
|
}
|
|
3247
3482
|
}
|
|
3248
|
-
class
|
|
3483
|
+
class Wi {
|
|
3249
3484
|
constructor(t) {
|
|
3250
3485
|
this.level = t;
|
|
3251
3486
|
}
|
|
@@ -3253,17 +3488,17 @@ class Gi {
|
|
|
3253
3488
|
return `heading-${this.level}`;
|
|
3254
3489
|
}
|
|
3255
3490
|
}
|
|
3256
|
-
const
|
|
3491
|
+
const Hi = {
|
|
3257
3492
|
role: "body"
|
|
3258
|
-
},
|
|
3493
|
+
}, Fi = {
|
|
3259
3494
|
role: "footnote"
|
|
3260
3495
|
};
|
|
3261
|
-
class
|
|
3496
|
+
class _i {
|
|
3262
3497
|
constructor(t, e) {
|
|
3263
3498
|
this.referenceUrl = t, this.referenceTitle = e, this.role = "quote";
|
|
3264
3499
|
}
|
|
3265
3500
|
}
|
|
3266
|
-
class
|
|
3501
|
+
class or {
|
|
3267
3502
|
/**
|
|
3268
3503
|
*
|
|
3269
3504
|
* @param defaultLanguage The default assumed language
|
|
@@ -3275,8 +3510,8 @@ class ar {
|
|
|
3275
3510
|
this.defaultLanguage = t, this.contextSnippetLength = i, this.textTokenizerFactory = r;
|
|
3276
3511
|
}
|
|
3277
3512
|
tokenize(t) {
|
|
3278
|
-
return t instanceof
|
|
3279
|
-
new
|
|
3513
|
+
return t instanceof Ct ? [
|
|
3514
|
+
new Ct(
|
|
3280
3515
|
t.locator,
|
|
3281
3516
|
t.role,
|
|
3282
3517
|
t.segments.map((e) => this.tokenizeSegment(e)).flat()
|
|
@@ -3284,8 +3519,8 @@ class ar {
|
|
|
3284
3519
|
] : [t];
|
|
3285
3520
|
}
|
|
3286
3521
|
tokenizeSegment(t) {
|
|
3287
|
-
return this.textTokenizerFactory(t.language ?? this.defaultLanguage).tokenize(t.text).map((e) => new
|
|
3288
|
-
new
|
|
3522
|
+
return this.textTokenizerFactory(t.language ?? this.defaultLanguage).tokenize(t.text).map((e) => new be(
|
|
3523
|
+
new D({
|
|
3289
3524
|
href: t.locator.href,
|
|
3290
3525
|
type: t.locator.type,
|
|
3291
3526
|
title: t.locator.title,
|
|
@@ -3298,19 +3533,19 @@ class ar {
|
|
|
3298
3533
|
}
|
|
3299
3534
|
extractTextContextIn(t, e) {
|
|
3300
3535
|
const i = t.substring(e[1], e[1] + this.contextSnippetLength), r = t.substring(e[0] - this.contextSnippetLength, e[0]);
|
|
3301
|
-
return new
|
|
3536
|
+
return new nt({
|
|
3302
3537
|
after: i.length > 0 ? i : void 0,
|
|
3303
3538
|
before: r.length > 0 ? r : void 0,
|
|
3304
3539
|
highlight: t.substring(e[0], e[1])
|
|
3305
3540
|
});
|
|
3306
3541
|
}
|
|
3307
3542
|
}
|
|
3308
|
-
class
|
|
3543
|
+
class it extends Error {
|
|
3309
3544
|
constructor(t) {
|
|
3310
3545
|
super(t);
|
|
3311
3546
|
}
|
|
3312
3547
|
}
|
|
3313
|
-
class
|
|
3548
|
+
class jt {
|
|
3314
3549
|
/**
|
|
3315
3550
|
* Advances to the next item and returns it, or null if we reached the end.
|
|
3316
3551
|
*/
|
|
@@ -3324,12 +3559,12 @@ class Qt {
|
|
|
3324
3559
|
return await this.hasPrevious() ? this.previous() : null;
|
|
3325
3560
|
}
|
|
3326
3561
|
}
|
|
3327
|
-
let
|
|
3562
|
+
let Vi = class {
|
|
3328
3563
|
constructor(t, e) {
|
|
3329
3564
|
this.element = t, this.direction = e;
|
|
3330
3565
|
}
|
|
3331
3566
|
};
|
|
3332
|
-
class
|
|
3567
|
+
class lr extends jt {
|
|
3333
3568
|
constructor(t, e, i) {
|
|
3334
3569
|
super(), this.publication = t, this.startLocator = e, this.resourceContentIteratorFactories = i, this._currentIterator = null, this.currentElement = null;
|
|
3335
3570
|
}
|
|
@@ -3340,7 +3575,7 @@ class cr extends Qt {
|
|
|
3340
3575
|
), this.currentElement !== null;
|
|
3341
3576
|
}
|
|
3342
3577
|
previous() {
|
|
3343
|
-
if (this.currentElement?.direction !== -1) throw new
|
|
3578
|
+
if (this.currentElement?.direction !== -1) throw new it("Called previous() without a successful call to hasPrevious() first");
|
|
3344
3579
|
return this.currentElement.element;
|
|
3345
3580
|
}
|
|
3346
3581
|
async hasNext() {
|
|
@@ -3350,7 +3585,7 @@ class cr extends Qt {
|
|
|
3350
3585
|
), this.currentElement !== null;
|
|
3351
3586
|
}
|
|
3352
3587
|
next() {
|
|
3353
|
-
if (this.currentElement?.direction !== 1) throw new
|
|
3588
|
+
if (this.currentElement?.direction !== 1) throw new it("Called next() without a successful call to hasNext() first");
|
|
3354
3589
|
return this.currentElement.element;
|
|
3355
3590
|
}
|
|
3356
3591
|
async nextIn(t) {
|
|
@@ -3361,7 +3596,7 @@ class cr extends Qt {
|
|
|
3361
3596
|
const r = this.nextIteratorIn(t, e.index);
|
|
3362
3597
|
return r ? (this._currentIterator = r, this.nextIn(t)) : null;
|
|
3363
3598
|
}
|
|
3364
|
-
return new
|
|
3599
|
+
return new Vi(i, t);
|
|
3365
3600
|
}
|
|
3366
3601
|
/**
|
|
3367
3602
|
* Returns the [Iterator] for the current [Resource] in the reading order.
|
|
@@ -3400,7 +3635,7 @@ class cr extends Qt {
|
|
|
3400
3635
|
return null;
|
|
3401
3636
|
}
|
|
3402
3637
|
}
|
|
3403
|
-
class
|
|
3638
|
+
class St extends ge {
|
|
3404
3639
|
constructor(t, e, i = []) {
|
|
3405
3640
|
super(t, i), this.element = e;
|
|
3406
3641
|
}
|
|
@@ -3408,24 +3643,24 @@ class wt extends me {
|
|
|
3408
3643
|
return this.element.text;
|
|
3409
3644
|
}
|
|
3410
3645
|
}
|
|
3411
|
-
class
|
|
3646
|
+
class ce {
|
|
3412
3647
|
constructor(t, e) {
|
|
3413
3648
|
this.element = t, this.direction = e;
|
|
3414
3649
|
}
|
|
3415
3650
|
}
|
|
3416
|
-
class
|
|
3651
|
+
class hr extends jt {
|
|
3417
3652
|
constructor(t, e) {
|
|
3418
3653
|
super(), this.pageContent = t, this.startLocator = e, this.pageContentFiltered = [], this.currentElement = null, this.currentProgression = 0, this.currentElementIndex = 0;
|
|
3419
3654
|
const i = this.pageContent.filter(
|
|
3420
3655
|
(r) => r?.str !== " " && r?.str !== ""
|
|
3421
3656
|
);
|
|
3422
|
-
if (this.pageContentFiltered = i.map((r) => new
|
|
3657
|
+
if (this.pageContentFiltered = i.map((r) => new St(r.locator, {
|
|
3423
3658
|
index: i.indexOf(r),
|
|
3424
3659
|
text: r.str,
|
|
3425
3660
|
readingDirection: r.dir
|
|
3426
3661
|
})), this.startLocator && (this.currentProgression = this.startLocator?.locations?.progression || 0, this.updateElementIndex()), this.pageContentFiltered.length > 0) {
|
|
3427
3662
|
const r = this.currentElementIndex;
|
|
3428
|
-
(r || r === 0) && (this.currentElement = new
|
|
3663
|
+
(r || r === 0) && (this.currentElement = new ce(
|
|
3429
3664
|
this.pageContentFiltered[r],
|
|
3430
3665
|
1
|
|
3431
3666
|
/* Forward */
|
|
@@ -3443,7 +3678,7 @@ class lr extends Qt {
|
|
|
3443
3678
|
) !== null;
|
|
3444
3679
|
}
|
|
3445
3680
|
previous() {
|
|
3446
|
-
if (!this.currentElement) throw new
|
|
3681
|
+
if (!this.currentElement) throw new it("Called next() without a successful call to hasNext() first");
|
|
3447
3682
|
if (this.currentElement = this.nextIn(
|
|
3448
3683
|
-1
|
|
3449
3684
|
/* Backward */
|
|
@@ -3451,7 +3686,7 @@ class lr extends Qt {
|
|
|
3451
3686
|
const t = this.currentElementIndex - 1;
|
|
3452
3687
|
this.currentProgression = t / this.pageContentFiltered.length * 100, this.currentElementIndex = t;
|
|
3453
3688
|
}
|
|
3454
|
-
return this.currentElement ? this.currentElement.element : new
|
|
3689
|
+
return this.currentElement ? this.currentElement.element : new St(new D({ href: "", type: "" }), { index: -1, text: "" });
|
|
3455
3690
|
}
|
|
3456
3691
|
async hasNext() {
|
|
3457
3692
|
return this.currentElement?.direction, this.nextIn(
|
|
@@ -3469,13 +3704,13 @@ class lr extends Qt {
|
|
|
3469
3704
|
const e = t + 1;
|
|
3470
3705
|
this.currentProgression = e / this.pageContentFiltered.length * 100, this.currentElementIndex = e;
|
|
3471
3706
|
}
|
|
3472
|
-
return this.currentElement ? this.currentElement.element : new
|
|
3707
|
+
return this.currentElement ? this.currentElement.element : new St(new D({ href: "", type: "" }), { index: -1, text: "" });
|
|
3473
3708
|
}
|
|
3474
3709
|
nextIn(t) {
|
|
3475
3710
|
const e = this.currentElementIndex;
|
|
3476
3711
|
if (e === null || e === this.pageContentFiltered.length - 1 && t === 1 || e === 0 && t === -1) return null;
|
|
3477
3712
|
const i = this.pageContentFiltered[e + t];
|
|
3478
|
-
return i ? new
|
|
3713
|
+
return i ? new ce(i, t) : null;
|
|
3479
3714
|
}
|
|
3480
3715
|
/**
|
|
3481
3716
|
* Updates the current [PDFReadableElement] position in the pageContentFiltered array
|
|
@@ -3485,7 +3720,7 @@ class lr extends Qt {
|
|
|
3485
3720
|
return this.currentProgression === 0 ? 0 : this.currentProgression < 0 || this.currentProgression >= 100 ? null : Math.floor(this.currentProgression * this.pageContentFiltered.length / 100);
|
|
3486
3721
|
}
|
|
3487
3722
|
}
|
|
3488
|
-
const
|
|
3723
|
+
const Yi = [
|
|
3489
3724
|
"OBJECT",
|
|
3490
3725
|
"BASE",
|
|
3491
3726
|
"FONT",
|
|
@@ -3553,10 +3788,10 @@ const Vi = [
|
|
|
3553
3788
|
"NOBR",
|
|
3554
3789
|
"RB"
|
|
3555
3790
|
];
|
|
3556
|
-
function
|
|
3557
|
-
return
|
|
3791
|
+
function le(s) {
|
|
3792
|
+
return Yi.includes(s.nodeName.toUpperCase());
|
|
3558
3793
|
}
|
|
3559
|
-
function
|
|
3794
|
+
function Et(s, t) {
|
|
3560
3795
|
const e = s.getAttribute("src");
|
|
3561
3796
|
if (!e?.length) return null;
|
|
3562
3797
|
try {
|
|
@@ -3565,15 +3800,15 @@ function St(s, t) {
|
|
|
3565
3800
|
return e;
|
|
3566
3801
|
}
|
|
3567
3802
|
}
|
|
3568
|
-
const
|
|
3803
|
+
const st = "[\\s\\u0085\\u00A0\\u2000-\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000]", $i = new RegExp(`^${st}+$`, "g"), Xi = new RegExp(`^${st}+|${st}+$/g`, "g"), ve = new RegExp(`^${st}+`, "g"), Ae = new RegExp(`${st}+$`, "g"), ct = (s) => (
|
|
3569
3804
|
// Normal spaces, \t, \n, \v, \f, \r, U+0085, U+00A0, U+2000 to U+200A, U+2028, U+2029, U+202F, U+205F, U+3000
|
|
3570
|
-
s?.length ?
|
|
3571
|
-
),
|
|
3572
|
-
before: t + (
|
|
3573
|
-
highlight:
|
|
3805
|
+
s?.length ? $i.test(s) : !0
|
|
3806
|
+
), ye = (s) => s.replace(Xi, ""), Ki = (s) => s.replace(ve, ""), Zi = (s) => s.replace(Ae, ""), he = (s, t = "") => new nt({
|
|
3807
|
+
before: t + (ve.exec(s)?.[0] ?? ""),
|
|
3808
|
+
highlight: ye(s),
|
|
3574
3809
|
after: Ae.exec(s)?.[0] ?? ""
|
|
3575
3810
|
});
|
|
3576
|
-
function
|
|
3811
|
+
function Ji(s) {
|
|
3577
3812
|
for (; s; ) {
|
|
3578
3813
|
let t = s.getAttribute("lang") || s.getAttributeNS("http://www.w3.org/1999/xhtml", "lang") || s.getAttributeNS("http://www.w3.org/XML/1998/namespace", "lang");
|
|
3579
3814
|
if (t) return t;
|
|
@@ -3581,11 +3816,11 @@ function Zi(s) {
|
|
|
3581
3816
|
}
|
|
3582
3817
|
return null;
|
|
3583
3818
|
}
|
|
3584
|
-
function
|
|
3819
|
+
function qi(s, t) {
|
|
3585
3820
|
const e = s.length > 0 && s[s.length - 1] === " ";
|
|
3586
3821
|
let i = !1, r = !1;
|
|
3587
3822
|
for (let n = 0; n < t.length; n++)
|
|
3588
|
-
if (
|
|
3823
|
+
if (ct(t[n])) {
|
|
3589
3824
|
if (e && !r || i)
|
|
3590
3825
|
continue;
|
|
3591
3826
|
s += " ", i = !0;
|
|
@@ -3595,10 +3830,10 @@ function Ji(s, t) {
|
|
|
3595
3830
|
}
|
|
3596
3831
|
return s;
|
|
3597
3832
|
}
|
|
3598
|
-
function
|
|
3833
|
+
function we(s) {
|
|
3599
3834
|
return typeof s == "object" && s !== null && s.nodeType === Node.ELEMENT_NODE;
|
|
3600
3835
|
}
|
|
3601
|
-
const
|
|
3836
|
+
const bt = {
|
|
3602
3837
|
NONE: "",
|
|
3603
3838
|
DESCENDANT: " ",
|
|
3604
3839
|
CHILD: " > "
|
|
@@ -3610,14 +3845,14 @@ const gt = {
|
|
|
3610
3845
|
nthchild: "nthchild",
|
|
3611
3846
|
nthoftype: "nthoftype"
|
|
3612
3847
|
};
|
|
3613
|
-
function
|
|
3848
|
+
function Qi(s, t) {
|
|
3614
3849
|
return Object.values(s).includes(t);
|
|
3615
3850
|
}
|
|
3616
|
-
const
|
|
3617
|
-
function
|
|
3618
|
-
console.warn(`${
|
|
3851
|
+
const ji = "CssSelectorGenerator";
|
|
3852
|
+
function vt(s = "unknown problem", ...t) {
|
|
3853
|
+
console.warn(`${ji}: ${s}`, ...t);
|
|
3619
3854
|
}
|
|
3620
|
-
const
|
|
3855
|
+
const ts = {
|
|
3621
3856
|
selectors: [
|
|
3622
3857
|
E.id,
|
|
3623
3858
|
E.class,
|
|
@@ -3635,165 +3870,165 @@ const ji = {
|
|
|
3635
3870
|
maxCandidates: Number.POSITIVE_INFINITY,
|
|
3636
3871
|
useScope: !1
|
|
3637
3872
|
};
|
|
3638
|
-
function
|
|
3639
|
-
return Array.isArray(s) ? s.filter((t) =>
|
|
3873
|
+
function es(s) {
|
|
3874
|
+
return Array.isArray(s) ? s.filter((t) => Qi(E, t)) : [];
|
|
3640
3875
|
}
|
|
3641
|
-
function
|
|
3876
|
+
function Se(s) {
|
|
3642
3877
|
return s instanceof RegExp;
|
|
3643
3878
|
}
|
|
3644
|
-
function
|
|
3645
|
-
return ["string", "function"].includes(typeof s) ||
|
|
3879
|
+
function is(s) {
|
|
3880
|
+
return ["string", "function"].includes(typeof s) || Se(s);
|
|
3646
3881
|
}
|
|
3647
|
-
function
|
|
3648
|
-
return Array.isArray(s) ? s.filter(
|
|
3882
|
+
function ue(s) {
|
|
3883
|
+
return Array.isArray(s) ? s.filter(is) : [];
|
|
3649
3884
|
}
|
|
3650
|
-
function
|
|
3885
|
+
function ss(s) {
|
|
3651
3886
|
return s instanceof Node;
|
|
3652
3887
|
}
|
|
3653
|
-
function
|
|
3888
|
+
function de(s) {
|
|
3654
3889
|
const t = [
|
|
3655
3890
|
Node.DOCUMENT_NODE,
|
|
3656
3891
|
Node.DOCUMENT_FRAGMENT_NODE,
|
|
3657
3892
|
// this includes Shadow DOM root
|
|
3658
3893
|
Node.ELEMENT_NODE
|
|
3659
3894
|
];
|
|
3660
|
-
return
|
|
3895
|
+
return ss(s) && t.includes(s.nodeType);
|
|
3661
3896
|
}
|
|
3662
|
-
function
|
|
3663
|
-
if (
|
|
3664
|
-
return s.contains(t) ||
|
|
3897
|
+
function Ee(s, t) {
|
|
3898
|
+
if (de(s))
|
|
3899
|
+
return s.contains(t) || vt("element root mismatch", "Provided root does not contain the element. This will most likely result in producing a fallback selector using element's real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."), s;
|
|
3665
3900
|
const e = t.getRootNode({ composed: !1 });
|
|
3666
|
-
return
|
|
3901
|
+
return de(e) ? (e !== document && vt("shadow root inferred", "You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."), e) : ee(t);
|
|
3667
3902
|
}
|
|
3668
|
-
function
|
|
3903
|
+
function Tt(s) {
|
|
3669
3904
|
return typeof s == "number" ? s : Number.POSITIVE_INFINITY;
|
|
3670
3905
|
}
|
|
3671
|
-
function
|
|
3672
|
-
const e = Object.assign(Object.assign({},
|
|
3906
|
+
function rs(s, t = {}) {
|
|
3907
|
+
const e = Object.assign(Object.assign({}, ts), t);
|
|
3673
3908
|
return {
|
|
3674
|
-
selectors:
|
|
3675
|
-
whitelist:
|
|
3676
|
-
blacklist:
|
|
3677
|
-
root:
|
|
3909
|
+
selectors: es(e.selectors),
|
|
3910
|
+
whitelist: ue(e.whitelist),
|
|
3911
|
+
blacklist: ue(e.blacklist),
|
|
3912
|
+
root: Ee(e.root, s),
|
|
3678
3913
|
combineWithinSelector: !!e.combineWithinSelector,
|
|
3679
3914
|
combineBetweenSelectors: !!e.combineBetweenSelectors,
|
|
3680
3915
|
includeTag: !!e.includeTag,
|
|
3681
|
-
maxCombinations:
|
|
3682
|
-
maxCandidates:
|
|
3916
|
+
maxCombinations: Tt(e.maxCombinations),
|
|
3917
|
+
maxCandidates: Tt(e.maxCandidates),
|
|
3683
3918
|
useScope: !!e.useScope,
|
|
3684
|
-
maxResults:
|
|
3919
|
+
maxResults: Tt(e.maxResults)
|
|
3685
3920
|
};
|
|
3686
3921
|
}
|
|
3687
|
-
function
|
|
3922
|
+
function at(s = []) {
|
|
3688
3923
|
const [t = [], ...e] = s;
|
|
3689
3924
|
return e.length === 0 ? t : e.reduce((i, r) => i.filter((n) => r.includes(n)), t);
|
|
3690
3925
|
}
|
|
3691
|
-
function
|
|
3926
|
+
function ns(s) {
|
|
3692
3927
|
return [].concat(...s);
|
|
3693
3928
|
}
|
|
3694
|
-
function
|
|
3929
|
+
function as(s) {
|
|
3695
3930
|
return s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
3696
3931
|
}
|
|
3697
3932
|
function Rt(s) {
|
|
3698
3933
|
const t = s.map((e) => {
|
|
3699
|
-
if (
|
|
3934
|
+
if (Se(e))
|
|
3700
3935
|
return (i) => e.test(i);
|
|
3701
3936
|
if (typeof e == "function")
|
|
3702
3937
|
return (i) => {
|
|
3703
3938
|
const r = e(i);
|
|
3704
|
-
return typeof r != "boolean" ? (
|
|
3939
|
+
return typeof r != "boolean" ? (vt("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : r;
|
|
3705
3940
|
};
|
|
3706
3941
|
if (typeof e == "string") {
|
|
3707
|
-
const i = new RegExp("^" +
|
|
3942
|
+
const i = new RegExp("^" + as(e) + "$");
|
|
3708
3943
|
return (r) => i.test(r);
|
|
3709
3944
|
}
|
|
3710
|
-
return
|
|
3945
|
+
return vt("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
|
|
3711
3946
|
});
|
|
3712
3947
|
return (e) => t.some((i) => i(e));
|
|
3713
3948
|
}
|
|
3714
|
-
function
|
|
3715
|
-
const i = Array.from(
|
|
3949
|
+
function te(s, t, e) {
|
|
3950
|
+
const i = Array.from(Ee(e, s[0]).querySelectorAll(t));
|
|
3716
3951
|
return i.length === s.length && s.every((r) => i.includes(r));
|
|
3717
3952
|
}
|
|
3718
|
-
function
|
|
3719
|
-
t = t ??
|
|
3953
|
+
function Te(s, t) {
|
|
3954
|
+
t = t ?? ee(s);
|
|
3720
3955
|
const e = [];
|
|
3721
3956
|
let i = s;
|
|
3722
|
-
for (;
|
|
3957
|
+
for (; we(i) && i !== t; )
|
|
3723
3958
|
e.push(i), i = i.parentElement;
|
|
3724
3959
|
return e;
|
|
3725
3960
|
}
|
|
3726
|
-
function
|
|
3727
|
-
return
|
|
3961
|
+
function os(s, t) {
|
|
3962
|
+
return at(s.map((e) => Te(e, t)));
|
|
3728
3963
|
}
|
|
3729
|
-
function
|
|
3964
|
+
function ee(s) {
|
|
3730
3965
|
return s.ownerDocument.querySelector(":root");
|
|
3731
3966
|
}
|
|
3732
|
-
const
|
|
3967
|
+
const Ie = ", ", cs = new RegExp([
|
|
3733
3968
|
"^$",
|
|
3734
3969
|
// empty or not set
|
|
3735
3970
|
"\\s"
|
|
3736
3971
|
// contains whitespace
|
|
3737
|
-
].join("|")),
|
|
3972
|
+
].join("|")), ls = new RegExp([
|
|
3738
3973
|
"^$"
|
|
3739
3974
|
// empty or not set
|
|
3740
|
-
].join("|")),
|
|
3975
|
+
].join("|")), xe = [
|
|
3741
3976
|
E.nthoftype,
|
|
3742
3977
|
E.tag,
|
|
3743
3978
|
E.id,
|
|
3744
3979
|
E.class,
|
|
3745
3980
|
E.attribute,
|
|
3746
3981
|
E.nthchild
|
|
3747
|
-
],
|
|
3982
|
+
], hs = Rt([
|
|
3748
3983
|
"class",
|
|
3749
3984
|
"id",
|
|
3750
3985
|
// Angular attributes
|
|
3751
3986
|
"ng-*"
|
|
3752
3987
|
]);
|
|
3753
|
-
function
|
|
3988
|
+
function us({ name: s }) {
|
|
3754
3989
|
return `[${s}]`;
|
|
3755
3990
|
}
|
|
3756
|
-
function
|
|
3991
|
+
function ds({ name: s, value: t }) {
|
|
3757
3992
|
return `[${s}='${t}']`;
|
|
3758
3993
|
}
|
|
3759
|
-
function
|
|
3994
|
+
function fs({ nodeName: s, nodeValue: t }, e) {
|
|
3760
3995
|
const i = e.tagName.toLowerCase();
|
|
3761
|
-
return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !
|
|
3996
|
+
return ["input", "option"].includes(i) && s === "value" || s === "src" && t?.startsWith("data:") ? !1 : !hs(s);
|
|
3762
3997
|
}
|
|
3763
|
-
function
|
|
3998
|
+
function ps({ nodeName: s, nodeValue: t }) {
|
|
3764
3999
|
return {
|
|
3765
|
-
name:
|
|
3766
|
-
value:
|
|
4000
|
+
name: rt(s),
|
|
4001
|
+
value: rt(t ?? void 0)
|
|
3767
4002
|
};
|
|
3768
4003
|
}
|
|
3769
|
-
function
|
|
3770
|
-
const t = Array.from(s.attributes).filter((e) =>
|
|
4004
|
+
function Ne(s) {
|
|
4005
|
+
const t = Array.from(s.attributes).filter((e) => fs(e, s)).map(ps);
|
|
3771
4006
|
return [
|
|
3772
|
-
...t.map(
|
|
3773
|
-
...t.map(
|
|
4007
|
+
...t.map(us),
|
|
4008
|
+
...t.map(ds)
|
|
3774
4009
|
];
|
|
3775
4010
|
}
|
|
3776
|
-
function ps(s) {
|
|
3777
|
-
const t = s.map(xe);
|
|
3778
|
-
return nt(t);
|
|
3779
|
-
}
|
|
3780
|
-
function Ne(s) {
|
|
3781
|
-
var t;
|
|
3782
|
-
return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !cs.test(e)).map((e) => `.${st(e)}`);
|
|
3783
|
-
}
|
|
3784
4011
|
function ms(s) {
|
|
3785
4012
|
const t = s.map(Ne);
|
|
3786
|
-
return
|
|
4013
|
+
return at(t);
|
|
3787
4014
|
}
|
|
3788
4015
|
function Le(s) {
|
|
3789
4016
|
var t;
|
|
3790
|
-
|
|
3791
|
-
return !os.test(e) && jt([s], i, r) ? [i] : [];
|
|
4017
|
+
return ((t = s.getAttribute("class")) !== null && t !== void 0 ? t : "").trim().split(/\s+/).filter((e) => !ls.test(e)).map((e) => `.${rt(e)}`);
|
|
3792
4018
|
}
|
|
3793
4019
|
function gs(s) {
|
|
3794
|
-
|
|
4020
|
+
const t = s.map(Le);
|
|
4021
|
+
return at(t);
|
|
3795
4022
|
}
|
|
3796
4023
|
function Oe(s) {
|
|
4024
|
+
var t;
|
|
4025
|
+
const e = (t = s.getAttribute("id")) !== null && t !== void 0 ? t : "", i = `#${rt(e)}`, r = s.getRootNode({ composed: !1 });
|
|
4026
|
+
return !cs.test(e) && te([s], i, r) ? [i] : [];
|
|
4027
|
+
}
|
|
4028
|
+
function bs(s) {
|
|
4029
|
+
return s.length === 0 || s.length > 1 ? [] : Oe(s[0]);
|
|
4030
|
+
}
|
|
4031
|
+
function ze(s) {
|
|
3797
4032
|
var t;
|
|
3798
4033
|
const e = (t = s.parentElement) === null || t === void 0 ? void 0 : t.children;
|
|
3799
4034
|
if (e) {
|
|
@@ -3803,21 +4038,21 @@ function Oe(s) {
|
|
|
3803
4038
|
}
|
|
3804
4039
|
return [];
|
|
3805
4040
|
}
|
|
3806
|
-
function
|
|
3807
|
-
return
|
|
4041
|
+
function vs(s) {
|
|
4042
|
+
return at(s.map(ze));
|
|
3808
4043
|
}
|
|
3809
|
-
function
|
|
4044
|
+
function Ce(s) {
|
|
3810
4045
|
return [
|
|
3811
|
-
|
|
4046
|
+
rt(s.tagName.toLowerCase())
|
|
3812
4047
|
];
|
|
3813
4048
|
}
|
|
3814
4049
|
function Re(s) {
|
|
3815
4050
|
const t = [
|
|
3816
|
-
...new Set(
|
|
4051
|
+
...new Set(ns(s.map(Ce)))
|
|
3817
4052
|
];
|
|
3818
4053
|
return t.length === 0 || t.length > 1 ? [] : [t[0]];
|
|
3819
4054
|
}
|
|
3820
|
-
function
|
|
4055
|
+
function ke(s) {
|
|
3821
4056
|
const t = Re([s])[0], e = s.parentElement;
|
|
3822
4057
|
if (e) {
|
|
3823
4058
|
const r = Array.from(e.children).filter((n) => n.tagName.toLowerCase() === t).indexOf(s);
|
|
@@ -3829,17 +4064,17 @@ function Ce(s) {
|
|
|
3829
4064
|
return [];
|
|
3830
4065
|
}
|
|
3831
4066
|
function As(s) {
|
|
3832
|
-
return
|
|
4067
|
+
return at(s.map(ke));
|
|
3833
4068
|
}
|
|
3834
4069
|
function* Pe(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
3835
|
-
let e = 0, i =
|
|
4070
|
+
let e = 0, i = kt(1);
|
|
3836
4071
|
for (; i.length <= s.length && e < t; )
|
|
3837
|
-
e += 1, yield i.map((n) => s[n]), i =
|
|
4072
|
+
e += 1, yield i.map((n) => s[n]), i = ws(i, s.length - 1);
|
|
3838
4073
|
}
|
|
3839
|
-
function
|
|
4074
|
+
function ys(s = [], { maxResults: t = Number.POSITIVE_INFINITY } = {}) {
|
|
3840
4075
|
return Array.from(Pe(s, { maxResults: t }));
|
|
3841
4076
|
}
|
|
3842
|
-
function
|
|
4077
|
+
function ws(s = [], t = 0) {
|
|
3843
4078
|
const e = s.length;
|
|
3844
4079
|
if (e === 0)
|
|
3845
4080
|
return [];
|
|
@@ -3848,15 +4083,15 @@ function ys(s = [], t = 0) {
|
|
|
3848
4083
|
for (let r = e - 1; r >= 0; r--)
|
|
3849
4084
|
if (i[r] > t) {
|
|
3850
4085
|
if (r === 0)
|
|
3851
|
-
return
|
|
4086
|
+
return kt(e + 1);
|
|
3852
4087
|
i[r - 1]++, i[r] = i[r - 1] + 1;
|
|
3853
4088
|
}
|
|
3854
|
-
return i[e - 1] > t ?
|
|
4089
|
+
return i[e - 1] > t ? kt(e + 1) : i;
|
|
3855
4090
|
}
|
|
3856
|
-
function
|
|
4091
|
+
function kt(s = 1) {
|
|
3857
4092
|
return Array.from(Array(s).keys());
|
|
3858
4093
|
}
|
|
3859
|
-
function*
|
|
4094
|
+
function* Ss(s = {}) {
|
|
3860
4095
|
const t = Object.entries(s);
|
|
3861
4096
|
if (t.length === 0)
|
|
3862
4097
|
return;
|
|
@@ -3880,53 +4115,53 @@ function* ws(s = {}) {
|
|
|
3880
4115
|
});
|
|
3881
4116
|
}
|
|
3882
4117
|
}
|
|
3883
|
-
const
|
|
3884
|
-
function
|
|
3885
|
-
return CSS ? CSS.escape(s) :
|
|
4118
|
+
const Es = "3a".toUpperCase(), Ts = /[ !"#$%&'()\[\]{|}<>*+,./;=?@^`~\\]/;
|
|
4119
|
+
function rt(s = "") {
|
|
4120
|
+
return CSS ? CSS.escape(s) : Is(s);
|
|
3886
4121
|
}
|
|
3887
|
-
function
|
|
3888
|
-
return s.split("").map((t) => t === ":" ? `\\${
|
|
4122
|
+
function Is(s = "") {
|
|
4123
|
+
return s.split("").map((t) => t === ":" ? `\\${Es} ` : Ts.test(t) ? `\\${t}` : escape(t).replace(/%/g, "\\")).join("");
|
|
3889
4124
|
}
|
|
3890
|
-
const
|
|
4125
|
+
const xs = {
|
|
3891
4126
|
tag: Re,
|
|
3892
|
-
id:
|
|
3893
|
-
class:
|
|
3894
|
-
attribute:
|
|
3895
|
-
nthchild:
|
|
4127
|
+
id: bs,
|
|
4128
|
+
class: gs,
|
|
4129
|
+
attribute: ms,
|
|
4130
|
+
nthchild: vs,
|
|
3896
4131
|
nthoftype: As
|
|
3897
|
-
},
|
|
3898
|
-
tag:
|
|
3899
|
-
id:
|
|
3900
|
-
class:
|
|
3901
|
-
attribute:
|
|
3902
|
-
nthchild:
|
|
3903
|
-
nthoftype:
|
|
4132
|
+
}, Ns = {
|
|
4133
|
+
tag: Ce,
|
|
4134
|
+
id: Oe,
|
|
4135
|
+
class: Le,
|
|
4136
|
+
attribute: Ne,
|
|
4137
|
+
nthchild: ze,
|
|
4138
|
+
nthoftype: ke
|
|
3904
4139
|
};
|
|
3905
|
-
function Ns(s, t) {
|
|
3906
|
-
return xs[t](s);
|
|
3907
|
-
}
|
|
3908
4140
|
function Ls(s, t) {
|
|
3909
|
-
|
|
4141
|
+
return Ns[t](s);
|
|
4142
|
+
}
|
|
4143
|
+
function Os(s, t) {
|
|
4144
|
+
const e = xs[t];
|
|
3910
4145
|
return e(s);
|
|
3911
4146
|
}
|
|
3912
|
-
function
|
|
4147
|
+
function zs(s = [], t, e) {
|
|
3913
4148
|
return s.filter((i) => e(i) || !t(i));
|
|
3914
4149
|
}
|
|
3915
|
-
function
|
|
4150
|
+
function Cs(s = [], t) {
|
|
3916
4151
|
return s.sort((e, i) => {
|
|
3917
4152
|
const r = t(e), n = t(i);
|
|
3918
4153
|
return r && !n ? -1 : !r && n ? 1 : 0;
|
|
3919
4154
|
});
|
|
3920
4155
|
}
|
|
3921
4156
|
function* Rs(s, t) {
|
|
3922
|
-
const e = /* @__PURE__ */ new Set(), i =
|
|
3923
|
-
for (const r of
|
|
4157
|
+
const e = /* @__PURE__ */ new Set(), i = ks(s, t);
|
|
4158
|
+
for (const r of Ms(i, t))
|
|
3924
4159
|
e.has(r) || (e.add(r), yield r);
|
|
3925
4160
|
}
|
|
3926
|
-
function
|
|
4161
|
+
function ks(s, t) {
|
|
3927
4162
|
const { blacklist: e, whitelist: i, combineWithinSelector: r, maxCombinations: n } = t, a = Rt(e), o = Rt(i), h = (m, p) => {
|
|
3928
|
-
const u =
|
|
3929
|
-
return m[p] = r ? Array.from(Pe(
|
|
4163
|
+
const u = Os(s, p), g = zs(u, a, o), A = Cs(g, o);
|
|
4164
|
+
return m[p] = r ? Array.from(Pe(A, { maxResults: n })) : A.map((N) => [N]), m;
|
|
3930
4165
|
};
|
|
3931
4166
|
return Ps(t).reduce(h, {});
|
|
3932
4167
|
}
|
|
@@ -3934,72 +4169,72 @@ function Ps(s) {
|
|
|
3934
4169
|
const { selectors: t, includeTag: e } = s, i = [...t];
|
|
3935
4170
|
return e && !i.includes("tag") && i.push("tag"), i;
|
|
3936
4171
|
}
|
|
3937
|
-
function ks(s) {
|
|
3938
|
-
return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
|
|
3939
|
-
}
|
|
3940
4172
|
function Ds(s) {
|
|
3941
|
-
|
|
3942
|
-
return i ? n.map(ks) : n;
|
|
4173
|
+
return s.includes(E.tag) || s.includes(E.nthoftype) ? [...s] : [...s, E.tag];
|
|
3943
4174
|
}
|
|
3944
|
-
function
|
|
3945
|
-
|
|
3946
|
-
|
|
4175
|
+
function Us(s) {
|
|
4176
|
+
const { selectors: t, combineBetweenSelectors: e, includeTag: i, maxCandidates: r } = s, n = e ? ys(t, { maxResults: r }) : t.map((a) => [a]);
|
|
4177
|
+
return i ? n.map(Ds) : n;
|
|
3947
4178
|
}
|
|
3948
4179
|
function* Ms(s, t) {
|
|
4180
|
+
for (const e of Us(t))
|
|
4181
|
+
yield* Bs(e, s);
|
|
4182
|
+
}
|
|
4183
|
+
function* Bs(s, t) {
|
|
3949
4184
|
const e = {};
|
|
3950
4185
|
for (const i of s) {
|
|
3951
4186
|
const r = t[i];
|
|
3952
4187
|
r && r.length > 0 && (e[i] = r);
|
|
3953
4188
|
}
|
|
3954
|
-
for (const i of
|
|
3955
|
-
yield
|
|
4189
|
+
for (const i of Ss(e))
|
|
4190
|
+
yield Ws(i);
|
|
3956
4191
|
}
|
|
3957
|
-
function
|
|
4192
|
+
function Gs(s, t) {
|
|
3958
4193
|
return t[s] ? t[s].join("") : "";
|
|
3959
4194
|
}
|
|
3960
|
-
function
|
|
3961
|
-
const t = [...
|
|
3962
|
-
return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) =>
|
|
4195
|
+
function Ws(s = {}) {
|
|
4196
|
+
const t = [...xe];
|
|
4197
|
+
return s[E.tag] && s[E.nthoftype] && t.splice(t.indexOf(E.tag), 1), t.map((e) => Gs(e, s)).join("");
|
|
3963
4198
|
}
|
|
3964
|
-
function
|
|
4199
|
+
function Hs(s, t) {
|
|
3965
4200
|
return [
|
|
3966
|
-
...s.map((e) => t +
|
|
3967
|
-
...s.map((e) => t +
|
|
4201
|
+
...s.map((e) => t + bt.DESCENDANT + e),
|
|
4202
|
+
...s.map((e) => t + bt.CHILD + e)
|
|
3968
4203
|
];
|
|
3969
4204
|
}
|
|
3970
|
-
function*
|
|
4205
|
+
function* Fs(s, t) {
|
|
3971
4206
|
if (t === "")
|
|
3972
4207
|
yield* s;
|
|
3973
4208
|
else
|
|
3974
4209
|
for (const e of s)
|
|
3975
|
-
yield*
|
|
4210
|
+
yield* Hs([e], t);
|
|
3976
4211
|
}
|
|
3977
|
-
function*
|
|
4212
|
+
function* _s(s, t, e = "", i) {
|
|
3978
4213
|
const r = Rs(s, i);
|
|
3979
|
-
for (const n of
|
|
3980
|
-
|
|
4214
|
+
for (const n of Fs(r, e))
|
|
4215
|
+
te(s, n, t) && (yield n);
|
|
3981
4216
|
}
|
|
3982
|
-
function*
|
|
4217
|
+
function* Vs(s, t, e = "", i) {
|
|
3983
4218
|
if (s.length === 0)
|
|
3984
4219
|
return null;
|
|
3985
4220
|
const r = [
|
|
3986
4221
|
s.length > 1 ? s : [],
|
|
3987
|
-
...
|
|
4222
|
+
...os(s, t).map((n) => [n])
|
|
3988
4223
|
];
|
|
3989
4224
|
for (const n of r)
|
|
3990
|
-
for (const a of
|
|
4225
|
+
for (const a of _s(n, t, e, i))
|
|
3991
4226
|
yield {
|
|
3992
4227
|
foundElements: n,
|
|
3993
4228
|
selector: a
|
|
3994
4229
|
};
|
|
3995
4230
|
}
|
|
3996
|
-
function*
|
|
4231
|
+
function* Ys({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
3997
4232
|
let r = t, n = e, a = !0;
|
|
3998
4233
|
for (; a; ) {
|
|
3999
4234
|
let o = !1;
|
|
4000
|
-
for (const h of
|
|
4235
|
+
for (const h of Vs(s, r, n, i)) {
|
|
4001
4236
|
const { foundElements: m, selector: p } = h;
|
|
4002
|
-
if (o = !0,
|
|
4237
|
+
if (o = !0, te(s, p, t))
|
|
4003
4238
|
yield p;
|
|
4004
4239
|
else {
|
|
4005
4240
|
r = m[0], n = p;
|
|
@@ -4009,29 +4244,29 @@ function* Vs({ elements: s, root: t, rootSelector: e = "", options: i }) {
|
|
|
4009
4244
|
o || (a = !1);
|
|
4010
4245
|
}
|
|
4011
4246
|
}
|
|
4012
|
-
function
|
|
4247
|
+
function $s(s) {
|
|
4013
4248
|
(s instanceof NodeList || s instanceof HTMLCollection) && (s = Array.from(s));
|
|
4014
|
-
const t = (Array.isArray(s) ? s : [s]).filter(
|
|
4249
|
+
const t = (Array.isArray(s) ? s : [s]).filter(we);
|
|
4015
4250
|
return [...new Set(t)];
|
|
4016
4251
|
}
|
|
4017
|
-
function
|
|
4252
|
+
function Xs(s) {
|
|
4018
4253
|
return {
|
|
4019
4254
|
value: s,
|
|
4020
4255
|
include: !1
|
|
4021
4256
|
};
|
|
4022
4257
|
}
|
|
4023
|
-
function
|
|
4258
|
+
function Ks(s, t, e = bt.NONE) {
|
|
4024
4259
|
const i = {};
|
|
4025
4260
|
return t.forEach((r) => {
|
|
4026
|
-
Reflect.set(i, r,
|
|
4261
|
+
Reflect.set(i, r, Ls(s, r).map(Xs));
|
|
4027
4262
|
}), {
|
|
4028
4263
|
element: s,
|
|
4029
4264
|
operator: e,
|
|
4030
4265
|
selectors: i
|
|
4031
4266
|
};
|
|
4032
4267
|
}
|
|
4033
|
-
function
|
|
4034
|
-
let e = [...
|
|
4268
|
+
function Zs({ selectors: s, operator: t }) {
|
|
4269
|
+
let e = [...xe];
|
|
4035
4270
|
s[E.tag] && s[E.nthoftype] && (e = e.filter((r) => r !== E.tag));
|
|
4036
4271
|
let i = "";
|
|
4037
4272
|
return e.forEach((r) => {
|
|
@@ -4041,31 +4276,31 @@ function Ks({ selectors: s, operator: t }) {
|
|
|
4041
4276
|
});
|
|
4042
4277
|
}), t + i;
|
|
4043
4278
|
}
|
|
4044
|
-
function
|
|
4045
|
-
const i =
|
|
4279
|
+
function Js(s, t) {
|
|
4280
|
+
const i = Te(s, t).reverse().map((r) => {
|
|
4046
4281
|
var n;
|
|
4047
|
-
const a =
|
|
4282
|
+
const a = Ks(r, [E.nthchild], bt.CHILD);
|
|
4048
4283
|
return ((n = a.selectors.nthchild) !== null && n !== void 0 ? n : []).forEach((o) => {
|
|
4049
4284
|
o.include = !0;
|
|
4050
4285
|
}), a;
|
|
4051
4286
|
});
|
|
4052
4287
|
return [
|
|
4053
4288
|
t ? ":scope" : ":root",
|
|
4054
|
-
...i.map(
|
|
4289
|
+
...i.map(Zs)
|
|
4055
4290
|
].join("");
|
|
4056
4291
|
}
|
|
4057
|
-
function
|
|
4058
|
-
return s.map((e) =>
|
|
4292
|
+
function qs(s, t) {
|
|
4293
|
+
return s.map((e) => Js(e, t)).join(Ie);
|
|
4059
4294
|
}
|
|
4060
|
-
function
|
|
4295
|
+
function De(s, t = {}) {
|
|
4061
4296
|
const e = Object.assign(Object.assign({}, t), { maxResults: 1 });
|
|
4062
|
-
return
|
|
4297
|
+
return Qs(s, e).next().value;
|
|
4063
4298
|
}
|
|
4064
|
-
function*
|
|
4299
|
+
function* Qs(s, t = {}) {
|
|
4065
4300
|
var e;
|
|
4066
|
-
const i =
|
|
4301
|
+
const i = $s(s), r = rs(i[0], t), n = (e = r.root) !== null && e !== void 0 ? e : ee(i[0]);
|
|
4067
4302
|
let a = 0;
|
|
4068
|
-
for (const o of
|
|
4303
|
+
for (const o of Ys({
|
|
4069
4304
|
elements: i,
|
|
4070
4305
|
options: r,
|
|
4071
4306
|
root: n,
|
|
@@ -4073,9 +4308,9 @@ function* qs(s, t = {}) {
|
|
|
4073
4308
|
}))
|
|
4074
4309
|
if (yield o, a++, a >= r.maxResults)
|
|
4075
4310
|
return;
|
|
4076
|
-
i.length > 1 && (yield i.map((o) =>
|
|
4311
|
+
i.length > 1 && (yield i.map((o) => De(o, r)).join(Ie), a++, a >= r.maxResults) || (yield qs(i, r.useScope ? n : void 0));
|
|
4077
4312
|
}
|
|
4078
|
-
class
|
|
4313
|
+
class ur extends jt {
|
|
4079
4314
|
constructor(t, e, i = 50) {
|
|
4080
4315
|
super(), this.resource = t, this.locator = e, this.beforeMaxLength = i, this.currentElement = null, this.currentIndex = null, this.parsedElementRecipes = null, this.parser = null;
|
|
4081
4316
|
}
|
|
@@ -4088,7 +4323,7 @@ class hr extends Qt {
|
|
|
4088
4323
|
}, !0) : !1;
|
|
4089
4324
|
}
|
|
4090
4325
|
previous() {
|
|
4091
|
-
if (!this.currentElement || this.currentElement.delta !== -1) throw new
|
|
4326
|
+
if (!this.currentElement || this.currentElement.delta !== -1) throw new it("Called previous() without a successful call to hasPrevious() first");
|
|
4092
4327
|
const t = this.currentElement.element;
|
|
4093
4328
|
return this.currentElement = null, t;
|
|
4094
4329
|
}
|
|
@@ -4101,7 +4336,7 @@ class hr extends Qt {
|
|
|
4101
4336
|
}, !0) : !1;
|
|
4102
4337
|
}
|
|
4103
4338
|
next() {
|
|
4104
|
-
if (!this.currentElement || this.currentElement.delta !== 1) throw new
|
|
4339
|
+
if (!this.currentElement || this.currentElement.delta !== 1) throw new it("Called next() without a successful call to hasNext() first");
|
|
4105
4340
|
const t = this.currentElement.element;
|
|
4106
4341
|
return this.currentElement = null, t;
|
|
4107
4342
|
}
|
|
@@ -4110,15 +4345,15 @@ class hr extends Qt {
|
|
|
4110
4345
|
}
|
|
4111
4346
|
async parseElements() {
|
|
4112
4347
|
const t = await this.resource.readAsString(), e = new DOMParser().parseFromString(t, this.locator.type);
|
|
4113
|
-
return this.parser = new
|
|
4348
|
+
return this.parser = new tr(
|
|
4114
4349
|
e,
|
|
4115
4350
|
this.locator,
|
|
4116
4351
|
this.locator.locations.getCssSelector() ? e.querySelector(this.locator.locations.getCssSelector()) : null,
|
|
4117
4352
|
this.beforeMaxLength
|
|
4118
|
-
),
|
|
4353
|
+
), js(this.parser, e.body), this.parser.result();
|
|
4119
4354
|
}
|
|
4120
4355
|
}
|
|
4121
|
-
function
|
|
4356
|
+
function js(s, t) {
|
|
4122
4357
|
let e = t, i = 0;
|
|
4123
4358
|
for (; e != null; )
|
|
4124
4359
|
if (s.head(e, i), e.firstChild != null)
|
|
@@ -4131,7 +4366,7 @@ function Qs(s, t) {
|
|
|
4131
4366
|
e = e?.nextSibling || null;
|
|
4132
4367
|
}
|
|
4133
4368
|
}
|
|
4134
|
-
class
|
|
4369
|
+
class tr {
|
|
4135
4370
|
constructor(t, e, i, r) {
|
|
4136
4371
|
this.doc = t, this.baseLocator = e, this.startElement = i, this.beforeMaxLength = r, this.elementRecipes = [], this.startIndex = 0, this.segmentRecipesAcc = [], this.textAcc = "", this.wholeRawTextAcc = null, this.elementRawTextAcc = "", this.rawTextAcc = "", this.currentLanguage = null, this.breadcrumbs = [], this.recipeCssSelectorCache = /* @__PURE__ */ new WeakMap();
|
|
4137
4372
|
}
|
|
@@ -4145,8 +4380,8 @@ class js {
|
|
|
4145
4380
|
const e = t.recipe.cssSelectorNode ? this.cssSelector(t.recipe.cssSelectorNode) : null;
|
|
4146
4381
|
if (t.type === 1) {
|
|
4147
4382
|
const i = t.recipe;
|
|
4148
|
-
return new
|
|
4149
|
-
new
|
|
4383
|
+
return new Gi(
|
|
4384
|
+
new D({
|
|
4150
4385
|
href: this.baseLocator.href,
|
|
4151
4386
|
type: this.baseLocator.type,
|
|
4152
4387
|
title: this.baseLocator.title,
|
|
@@ -4156,14 +4391,14 @@ class js {
|
|
|
4156
4391
|
])
|
|
4157
4392
|
} : {})
|
|
4158
4393
|
}),
|
|
4159
|
-
new
|
|
4394
|
+
new M({
|
|
4160
4395
|
href: i.href
|
|
4161
4396
|
}),
|
|
4162
4397
|
i.caption,
|
|
4163
4398
|
i.attributes
|
|
4164
4399
|
);
|
|
4165
4400
|
} else if (t.type === 2 || t.type === 3) {
|
|
4166
|
-
const i = new
|
|
4401
|
+
const i = new D({
|
|
4167
4402
|
href: this.baseLocator.href,
|
|
4168
4403
|
type: this.baseLocator.type,
|
|
4169
4404
|
title: this.baseLocator.title,
|
|
@@ -4173,22 +4408,22 @@ class js {
|
|
|
4173
4408
|
])
|
|
4174
4409
|
} : {})
|
|
4175
4410
|
}), r = t.recipe;
|
|
4176
|
-
return t.type === 3 ? new
|
|
4411
|
+
return t.type === 3 ? new Bi(
|
|
4177
4412
|
i,
|
|
4178
4413
|
r.link
|
|
4179
|
-
) : new
|
|
4414
|
+
) : new Mi(
|
|
4180
4415
|
i,
|
|
4181
4416
|
r.link
|
|
4182
4417
|
);
|
|
4183
4418
|
} else if (t.type === 0) {
|
|
4184
4419
|
const i = t.recipe, r = i.segments.map((n) => {
|
|
4185
4420
|
const a = n.cssSelectorNode ? this.cssSelector(n.cssSelectorNode) : null;
|
|
4186
|
-
return new
|
|
4187
|
-
new
|
|
4421
|
+
return new be(
|
|
4422
|
+
new D({
|
|
4188
4423
|
href: this.baseLocator.href,
|
|
4189
4424
|
type: this.baseLocator.type,
|
|
4190
4425
|
title: this.baseLocator.title,
|
|
4191
|
-
text:
|
|
4426
|
+
text: he(n.text, this.wholeRawTextAcc?.substring(n.beforeRange[0], n.beforeRange[1])),
|
|
4192
4427
|
locations: new T(a ? {
|
|
4193
4428
|
otherLocations: /* @__PURE__ */ new Map([
|
|
4194
4429
|
["cssSelector", a]
|
|
@@ -4199,12 +4434,12 @@ class js {
|
|
|
4199
4434
|
n.attributes
|
|
4200
4435
|
);
|
|
4201
4436
|
});
|
|
4202
|
-
return new
|
|
4203
|
-
new
|
|
4437
|
+
return new Ct(
|
|
4438
|
+
new D({
|
|
4204
4439
|
href: this.baseLocator.href,
|
|
4205
4440
|
type: this.baseLocator.type,
|
|
4206
4441
|
title: this.baseLocator.title,
|
|
4207
|
-
text:
|
|
4442
|
+
text: he(i.text, r.length && r[0].locator.text?.before || ""),
|
|
4208
4443
|
locations: new T(e ? {
|
|
4209
4444
|
otherLocations: /* @__PURE__ */ new Map([
|
|
4210
4445
|
["cssSelector", e]
|
|
@@ -4229,7 +4464,7 @@ class js {
|
|
|
4229
4464
|
}
|
|
4230
4465
|
n = n.parentElement;
|
|
4231
4466
|
}
|
|
4232
|
-
const a =
|
|
4467
|
+
const a = De(e, {
|
|
4233
4468
|
root: this.doc
|
|
4234
4469
|
});
|
|
4235
4470
|
return r.forEach((o, h) => o.forEach((m) => h.attributes.setNamedItem(m))), this.recipeCssSelectorCache.set(e, a), a;
|
|
@@ -4237,14 +4472,14 @@ class js {
|
|
|
4237
4472
|
// Implements NodeTraversor
|
|
4238
4473
|
head(t, e) {
|
|
4239
4474
|
if (t.nodeType == Node.ELEMENT_NODE) {
|
|
4240
|
-
const i = !
|
|
4475
|
+
const i = !le(t);
|
|
4241
4476
|
i && (this.flushText(), this.breadcrumbs.push(t));
|
|
4242
4477
|
const r = t.nodeName.toUpperCase();
|
|
4243
4478
|
if (r === "BR")
|
|
4244
4479
|
this.flushText();
|
|
4245
4480
|
else if (r === "IMG" || r === "AUDIO" || r === "VIDEO")
|
|
4246
4481
|
if (this.flushText(), r === "IMG") {
|
|
4247
|
-
const n = t, a =
|
|
4482
|
+
const n = t, a = Et(n, this.baseLocator.href);
|
|
4248
4483
|
let o = n.getAttribute("alt");
|
|
4249
4484
|
o?.length || (o = n.getAttribute("title")), a != null && this.elementRecipes.push({
|
|
4250
4485
|
type: 1,
|
|
@@ -4253,31 +4488,31 @@ class js {
|
|
|
4253
4488
|
caption: void 0,
|
|
4254
4489
|
// FIXME: Get the caption from figcaption
|
|
4255
4490
|
cssSelectorNode: t,
|
|
4256
|
-
attributes: o?.length ? [new
|
|
4257
|
-
|
|
4491
|
+
attributes: o?.length ? [new oe(
|
|
4492
|
+
zt.ACCESSIBILITY_LABEL,
|
|
4258
4493
|
o
|
|
4259
4494
|
)] : []
|
|
4260
4495
|
}
|
|
4261
4496
|
});
|
|
4262
4497
|
} else {
|
|
4263
|
-
const n = t, a =
|
|
4498
|
+
const n = t, a = Et(n, this.baseLocator.href);
|
|
4264
4499
|
let o;
|
|
4265
4500
|
if (a != null)
|
|
4266
|
-
o = new
|
|
4501
|
+
o = new M({
|
|
4267
4502
|
href: a
|
|
4268
4503
|
});
|
|
4269
4504
|
else {
|
|
4270
4505
|
const h = [...n.getElementsByTagName("source")].map((m) => {
|
|
4271
|
-
const p =
|
|
4272
|
-
return p ? new
|
|
4506
|
+
const p = Et(m, this.baseLocator.href);
|
|
4507
|
+
return p ? new M({
|
|
4273
4508
|
href: p,
|
|
4274
4509
|
type: m.getAttribute("type") || void 0
|
|
4275
4510
|
}) : null;
|
|
4276
4511
|
}).filter((m) => !!m);
|
|
4277
|
-
h.length > 0 && (o = new
|
|
4512
|
+
h.length > 0 && (o = new M({
|
|
4278
4513
|
href: h[0].href,
|
|
4279
4514
|
type: h[0].type,
|
|
4280
|
-
alternates: h.length > 1 ? new
|
|
4515
|
+
alternates: h.length > 1 ? new C(h.slice(1)) : void 0
|
|
4281
4516
|
}));
|
|
4282
4517
|
}
|
|
4283
4518
|
o && (r === "AUDIO" ? this.elementRecipes.push({
|
|
@@ -4299,24 +4534,24 @@ class js {
|
|
|
4299
4534
|
}
|
|
4300
4535
|
// Implements NodeTraversor
|
|
4301
4536
|
tail(t, e) {
|
|
4302
|
-
if (t.nodeType === Node.TEXT_NODE && !
|
|
4303
|
-
const i =
|
|
4304
|
-
this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc =
|
|
4305
|
-
} else if (t.nodeType === Node.ELEMENT_NODE && !
|
|
4537
|
+
if (t.nodeType === Node.TEXT_NODE && !ct(t.textContent)) {
|
|
4538
|
+
const i = Ji(t.parentElement);
|
|
4539
|
+
this.currentLanguage !== i && (this.flushSegment(), this.currentLanguage = i), this.rawTextAcc += t.textContent, this.textAcc = qi(this.textAcc, t.textContent);
|
|
4540
|
+
} else if (t.nodeType === Node.ELEMENT_NODE && !le(t)) {
|
|
4306
4541
|
if (!this.breadcrumbs.length || this.breadcrumbs.at(-1) !== t) throw new Error("HTMLContentIterator: breadcrumbs mismatch");
|
|
4307
4542
|
this.flushText(), this.breadcrumbs.pop();
|
|
4308
4543
|
}
|
|
4309
4544
|
}
|
|
4310
4545
|
flushText() {
|
|
4311
4546
|
if (this.flushSegment(), this.startIndex === 0 && this.startElement && this.breadcrumbs.length && this.breadcrumbs.at(-1) === this.startElement && (this.startIndex = this.elementRecipes.length), !this.segmentRecipesAcc.length) return;
|
|
4312
|
-
this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text =
|
|
4547
|
+
this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text = Zi(
|
|
4313
4548
|
this.segmentRecipesAcc[this.segmentRecipesAcc.length - 1].text
|
|
4314
4549
|
);
|
|
4315
|
-
let t =
|
|
4550
|
+
let t = Hi;
|
|
4316
4551
|
if (this.breadcrumbs.length > 0) {
|
|
4317
4552
|
const e = this.breadcrumbs.at(-1);
|
|
4318
4553
|
if (e.getAttributeNS("http://www.idpf.org/2007/ops", "type") === "footnote")
|
|
4319
|
-
t =
|
|
4554
|
+
t = Fi;
|
|
4320
4555
|
else
|
|
4321
4556
|
switch (e.nodeName.toUpperCase()) {
|
|
4322
4557
|
case "H1":
|
|
@@ -4325,11 +4560,11 @@ class js {
|
|
|
4325
4560
|
case "H4":
|
|
4326
4561
|
case "H5":
|
|
4327
4562
|
case "H6":
|
|
4328
|
-
t = new
|
|
4563
|
+
t = new Wi(parseInt(e.nodeName[1]));
|
|
4329
4564
|
break;
|
|
4330
4565
|
case "BLOCKQUOTE":
|
|
4331
4566
|
case "Q":
|
|
4332
|
-
t = new
|
|
4567
|
+
t = new _i(
|
|
4333
4568
|
e.getAttribute("cite")?.length ? new URL(e.getAttribute("cite")) : void 0,
|
|
4334
4569
|
e.getAttribute("title") || void 0
|
|
4335
4570
|
);
|
|
@@ -4348,17 +4583,17 @@ class js {
|
|
|
4348
4583
|
}
|
|
4349
4584
|
flushSegment() {
|
|
4350
4585
|
let t = this.textAcc;
|
|
4351
|
-
const e =
|
|
4352
|
-
if (!
|
|
4586
|
+
const e = ye(t);
|
|
4587
|
+
if (!ct(e)) {
|
|
4353
4588
|
if (!this.segmentRecipesAcc.length) {
|
|
4354
|
-
t =
|
|
4355
|
-
const i = t.length &&
|
|
4589
|
+
t = Ki(t);
|
|
4590
|
+
const i = t.length && ct(t[t.length - 1]) ? t[t.length - 1] : "";
|
|
4356
4591
|
t = e + i;
|
|
4357
4592
|
}
|
|
4358
4593
|
this.segmentRecipesAcc.push({
|
|
4359
4594
|
text: t,
|
|
4360
|
-
attributes: this.currentLanguage ? [new
|
|
4361
|
-
|
|
4595
|
+
attributes: this.currentLanguage ? [new oe(
|
|
4596
|
+
zt.LANGUAGE,
|
|
4362
4597
|
this.currentLanguage
|
|
4363
4598
|
)] : [],
|
|
4364
4599
|
beforeRange: this.wholeRawTextAcc ? [this.wholeRawTextAcc.length - this.beforeMaxLength, this.wholeRawTextAcc.length] : [0, 0],
|
|
@@ -4384,8 +4619,8 @@ class At {
|
|
|
4384
4619
|
return Object.entries(t).forEach(([r, n]) => {
|
|
4385
4620
|
i.has(r) || e.set(r, n);
|
|
4386
4621
|
}), new At({
|
|
4387
|
-
title:
|
|
4388
|
-
numberOfItems:
|
|
4622
|
+
title: B.deserialize(t.title),
|
|
4623
|
+
numberOfItems: Z(t.numberOfItems),
|
|
4389
4624
|
otherMetadata: e.size === 0 ? void 0 : e
|
|
4390
4625
|
});
|
|
4391
4626
|
}
|
|
@@ -4397,12 +4632,12 @@ class At {
|
|
|
4397
4632
|
return this.title && (t.title = this.title.serialize()), this.numberOfItems !== void 0 && (t.numberOfItems = this.numberOfItems), this.otherMetadata && this.otherMetadata.forEach((e, i) => t[i] = e), t;
|
|
4398
4633
|
}
|
|
4399
4634
|
}
|
|
4400
|
-
class
|
|
4635
|
+
class Ue {
|
|
4401
4636
|
/**
|
|
4402
4637
|
* Creates a [LocatorCollection].
|
|
4403
4638
|
*/
|
|
4404
4639
|
constructor(t) {
|
|
4405
|
-
this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new
|
|
4640
|
+
this.metadata = t.metadata ?? new At({}), this.links = t.links ?? new C([]), this.locators = t.locators ?? [];
|
|
4406
4641
|
}
|
|
4407
4642
|
/**
|
|
4408
4643
|
* Parses a [LocatorCollection] from its RWPM JSON representation.
|
|
@@ -4410,9 +4645,9 @@ class De {
|
|
|
4410
4645
|
static deserialize(t) {
|
|
4411
4646
|
if (!t) return;
|
|
4412
4647
|
let e, i = t.locators;
|
|
4413
|
-
return i && Array.isArray(i) && (e = i.map((r) =>
|
|
4648
|
+
return i && Array.isArray(i) && (e = i.map((r) => D.deserialize(r)).filter((r) => r !== void 0)), new Ue({
|
|
4414
4649
|
metadata: At.deserialize(t.metadata),
|
|
4415
|
-
links:
|
|
4650
|
+
links: C.deserialize(t.links),
|
|
4416
4651
|
locators: e
|
|
4417
4652
|
});
|
|
4418
4653
|
}
|
|
@@ -4428,7 +4663,7 @@ class De {
|
|
|
4428
4663
|
return this.links && this.links.items.length > 0 && (t.links = this.links.serialize()), this.locators && (t.locators = this.locators.map((e) => e.serialize())), t;
|
|
4429
4664
|
}
|
|
4430
4665
|
}
|
|
4431
|
-
class
|
|
4666
|
+
class H {
|
|
4432
4667
|
/**
|
|
4433
4668
|
* Creates a [PublicationCollection].
|
|
4434
4669
|
*/
|
|
@@ -4442,15 +4677,15 @@ class W {
|
|
|
4442
4677
|
if (!t) return;
|
|
4443
4678
|
let e, i, r;
|
|
4444
4679
|
if (Array.isArray(t))
|
|
4445
|
-
e =
|
|
4680
|
+
e = C.deserialize(t);
|
|
4446
4681
|
else if (typeof t == "object")
|
|
4447
|
-
e =
|
|
4682
|
+
e = C.deserialize(t.links), i = /* @__PURE__ */ new Map(), t.metadata && Object.entries(t.metadata).forEach(([n, a]) => {
|
|
4448
4683
|
i?.set(n, a);
|
|
4449
|
-
}), r =
|
|
4684
|
+
}), r = H.deserializeCollections(t);
|
|
4450
4685
|
else
|
|
4451
4686
|
return;
|
|
4452
4687
|
if (!(!e || e.items.length === 0))
|
|
4453
|
-
return new
|
|
4688
|
+
return new H({
|
|
4454
4689
|
metadata: i?.size ? i : void 0,
|
|
4455
4690
|
links: e,
|
|
4456
4691
|
subcollections: r?.size ? r : void 0
|
|
@@ -4465,13 +4700,13 @@ class W {
|
|
|
4465
4700
|
const e = /* @__PURE__ */ new Map();
|
|
4466
4701
|
return Object.entries(t).forEach(([i, r]) => {
|
|
4467
4702
|
if (i !== "links" && i !== "metadata") {
|
|
4468
|
-
const n =
|
|
4703
|
+
const n = H.deserialize(r);
|
|
4469
4704
|
if (n) {
|
|
4470
4705
|
const a = new Array();
|
|
4471
4706
|
a.push(n), e.set(i, a);
|
|
4472
4707
|
} else if (Array.isArray(r)) {
|
|
4473
4708
|
const a = r.map(
|
|
4474
|
-
(o) =>
|
|
4709
|
+
(o) => H.deserialize(o)
|
|
4475
4710
|
).filter((o) => o !== void 0);
|
|
4476
4711
|
e.set(i, a);
|
|
4477
4712
|
}
|
|
@@ -4485,7 +4720,7 @@ class W {
|
|
|
4485
4720
|
const t = {};
|
|
4486
4721
|
return this.metadata && (t.metadata = {}, this.metadata.forEach(
|
|
4487
4722
|
(e, i) => t.metadata[i] = e
|
|
4488
|
-
)), this.links.items.length && (t.links = this.links.serialize()),
|
|
4723
|
+
)), this.links.items.length && (t.links = this.links.serialize()), H.serializeCollection(t, this.subcollections), t;
|
|
4489
4724
|
}
|
|
4490
4725
|
static serializeCollection(t, e) {
|
|
4491
4726
|
e && e.size > 0 && e.forEach(
|
|
@@ -4495,9 +4730,9 @@ class W {
|
|
|
4495
4730
|
);
|
|
4496
4731
|
}
|
|
4497
4732
|
}
|
|
4498
|
-
class
|
|
4733
|
+
class Me {
|
|
4499
4734
|
constructor(t) {
|
|
4500
|
-
this.context = t.context, this.metadata = t.metadata, this.links = t.links
|
|
4735
|
+
this.context = t.context, this.metadata = t.metadata, this.links = t.links, this.readingOrder = t.readingOrder, this.resources = t.resources, this.toc = t.toc, this.subcollections = t.subcollections;
|
|
4501
4736
|
}
|
|
4502
4737
|
/**
|
|
4503
4738
|
* Parses a [Publication] from its RWPM JSON representation.
|
|
@@ -4507,20 +4742,22 @@ class Ue {
|
|
|
4507
4742
|
*/
|
|
4508
4743
|
static deserialize(t) {
|
|
4509
4744
|
if (!t) return;
|
|
4510
|
-
const e =
|
|
4745
|
+
const e = pt.deserialize(t.metadata);
|
|
4511
4746
|
if (!e) return;
|
|
4512
|
-
const i =
|
|
4747
|
+
const i = C.deserialize(t.links);
|
|
4748
|
+
if (!i) return;
|
|
4749
|
+
const r = C.deserialize(
|
|
4513
4750
|
t.readingOrder ? t.readingOrder : t.spine
|
|
4514
4751
|
);
|
|
4515
|
-
if (
|
|
4516
|
-
return new
|
|
4517
|
-
context:
|
|
4752
|
+
if (r)
|
|
4753
|
+
return new Me({
|
|
4754
|
+
context: _(t["@context"]),
|
|
4518
4755
|
metadata: e,
|
|
4519
|
-
links:
|
|
4520
|
-
readingOrder:
|
|
4521
|
-
resources:
|
|
4522
|
-
toc:
|
|
4523
|
-
subcollections:
|
|
4756
|
+
links: i,
|
|
4757
|
+
readingOrder: r,
|
|
4758
|
+
resources: C.deserialize(t.resources),
|
|
4759
|
+
toc: C.deserialize(t.toc),
|
|
4760
|
+
subcollections: H.deserializeCollections({
|
|
4524
4761
|
sub: t.sub
|
|
4525
4762
|
})
|
|
4526
4763
|
});
|
|
@@ -4530,12 +4767,12 @@ class Ue {
|
|
|
4530
4767
|
*/
|
|
4531
4768
|
serialize() {
|
|
4532
4769
|
const t = {};
|
|
4533
|
-
return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(),
|
|
4770
|
+
return this.context !== void 0 && (t["@context"] = this.context), t.metadata = this.metadata.serialize(), t.links = this.links.serialize(), t.readingOrder = this.readingOrder.serialize(), this.resources && (t.resources = this.resources.serialize()), this.toc && (t.toc = this.toc.serialize()), H.serializeCollection(t, this.subcollections), t;
|
|
4534
4771
|
}
|
|
4535
4772
|
/** Finds the first link with the given relation in the manifest's links. */
|
|
4536
4773
|
linkWithRel(t) {
|
|
4537
4774
|
const e = new Array();
|
|
4538
|
-
e.push(this.readingOrder), this.resources && e.push(this.resources),
|
|
4775
|
+
e.push(this.readingOrder), this.resources && e.push(this.resources), e.push(this.links);
|
|
4539
4776
|
let i;
|
|
4540
4777
|
for (const r of e)
|
|
4541
4778
|
if (i = r.findWithRel(t), i !== void 0)
|
|
@@ -4545,7 +4782,7 @@ class Ue {
|
|
|
4545
4782
|
/** Finds all the links with the given relation in the manifest's links. */
|
|
4546
4783
|
linksWithRel(t) {
|
|
4547
4784
|
const e = [];
|
|
4548
|
-
return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)),
|
|
4785
|
+
return e.push(this.readingOrder.filterByRel(t)), this.resources && e.push(this.resources.filterByRel(t)), e.push(this.links.filterByRel(t)), e.reduce((i, r) => i.concat(r), []);
|
|
4549
4786
|
}
|
|
4550
4787
|
/**
|
|
4551
4788
|
* Creates a new [Locator] object from a [Link] to a resource of this manifest.
|
|
@@ -4557,7 +4794,7 @@ class Ue {
|
|
|
4557
4794
|
const n = r.type;
|
|
4558
4795
|
if (!n) return;
|
|
4559
4796
|
const a = e.length == 2 ? e[1] : void 0;
|
|
4560
|
-
return new
|
|
4797
|
+
return new D({
|
|
4561
4798
|
href: i,
|
|
4562
4799
|
type: n,
|
|
4563
4800
|
title: r.title ?? t.title,
|
|
@@ -4582,7 +4819,7 @@ class Ue {
|
|
|
4582
4819
|
m.push(...u);
|
|
4583
4820
|
}), m.length > 0 && (h = e(m)), h;
|
|
4584
4821
|
}, i = [];
|
|
4585
|
-
i.push(this.readingOrder), this.resources && i.push(this.resources),
|
|
4822
|
+
i.push(this.readingOrder), this.resources && i.push(this.resources), i.push(this.links);
|
|
4586
4823
|
const r = e(i);
|
|
4587
4824
|
if (r !== void 0)
|
|
4588
4825
|
return r;
|
|
@@ -4614,7 +4851,7 @@ class Ue {
|
|
|
4614
4851
|
this.links.items = this.links.items.filter(
|
|
4615
4852
|
(e) => e.rels === void 0 || !e.rels?.has("self")
|
|
4616
4853
|
), this.links.items.push(
|
|
4617
|
-
new
|
|
4854
|
+
new M({
|
|
4618
4855
|
href: t,
|
|
4619
4856
|
type: c.READIUM_WEBPUB_MANIFEST.string,
|
|
4620
4857
|
rels: /* @__PURE__ */ new Set(["self"])
|
|
@@ -4623,106 +4860,107 @@ class Ue {
|
|
|
4623
4860
|
}
|
|
4624
4861
|
}
|
|
4625
4862
|
export {
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4863
|
+
k as AccessMode,
|
|
4864
|
+
V as Accessibility,
|
|
4865
|
+
rr as AccessibilityMetadataDisplayGuide,
|
|
4866
|
+
It as AccessibilityProfile,
|
|
4867
|
+
Ft as AccessibilitySummary,
|
|
4868
|
+
tt as Acquisition,
|
|
4869
|
+
Bt as AdditionalInformation,
|
|
4870
|
+
J as AltIdentifier,
|
|
4871
|
+
oe as Attribute,
|
|
4872
|
+
zt as AttributeKeys,
|
|
4873
|
+
me as AttributesHolder,
|
|
4874
|
+
Mi as AudioElement,
|
|
4875
|
+
Qt as Availability,
|
|
4876
|
+
Ui as AvailabilityStatus,
|
|
4877
|
+
Q as BelongsTo,
|
|
4878
|
+
Hi as Body,
|
|
4642
4879
|
Pt as Certification,
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4880
|
+
Wt as Conformance,
|
|
4881
|
+
ar as Content,
|
|
4882
|
+
ge as ContentElement,
|
|
4883
|
+
dt as Contributor,
|
|
4884
|
+
O as Contributors,
|
|
4885
|
+
qt as Copies,
|
|
4649
4886
|
Ri as DefaultTextContentTokenizer,
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4887
|
+
Kt as DomRange,
|
|
4888
|
+
gt as DomRangePoint,
|
|
4889
|
+
ei as EmptyFetcher,
|
|
4890
|
+
_t as Encryption,
|
|
4891
|
+
Nt as Exemption,
|
|
4892
|
+
v as Feature,
|
|
4893
|
+
Fi as Footnote,
|
|
4894
|
+
Xt as GuidedNavigationDocument,
|
|
4895
|
+
K as GuidedNavigationObject,
|
|
4896
|
+
mt as GuidedNavigationText,
|
|
4897
|
+
ur as HTMLResourceContentIterator,
|
|
4661
4898
|
P as Hazard,
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4899
|
+
li as HazardType,
|
|
4900
|
+
Gt as Hazards,
|
|
4901
|
+
Wi as Heading,
|
|
4902
|
+
Jt as Holds,
|
|
4903
|
+
er as HttpFetcher,
|
|
4904
|
+
ii as HttpResource,
|
|
4905
|
+
it as IllegalStateError,
|
|
4906
|
+
Gi as ImageElement,
|
|
4907
|
+
ki as IntlTextTokenizer,
|
|
4908
|
+
jt as Iterator,
|
|
4909
|
+
X as Layout,
|
|
4910
|
+
Ht as Legal,
|
|
4911
|
+
M as Link,
|
|
4912
|
+
C as Links,
|
|
4676
4913
|
f as Localization,
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4914
|
+
B as LocalizedString,
|
|
4915
|
+
D as Locator,
|
|
4916
|
+
Ue as LocatorCollection,
|
|
4680
4917
|
At as LocatorCollectionMetadata,
|
|
4681
4918
|
T as LocatorLocations,
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4919
|
+
nt as LocatorText,
|
|
4920
|
+
Me as Manifest,
|
|
4921
|
+
Vt as MediaOverlay,
|
|
4685
4922
|
c as MediaType,
|
|
4686
|
-
|
|
4923
|
+
pt as Metadata,
|
|
4687
4924
|
Pi as NaiveTextTokenizer,
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4925
|
+
Ut as Navigation,
|
|
4926
|
+
ai as NonvisualReading,
|
|
4927
|
+
ir as NumberRange,
|
|
4928
|
+
St as PDFContentElement,
|
|
4929
|
+
Lt as Page,
|
|
4930
|
+
hr as PageContentIteratorPDF,
|
|
4931
|
+
oi as PrerecordedAudio,
|
|
4932
|
+
Zt as Price,
|
|
4933
|
+
xt as PrimaryAccessMode,
|
|
4934
|
+
q as Profile,
|
|
4935
|
+
U as Properties,
|
|
4936
|
+
Y as Publication,
|
|
4937
|
+
H as PublicationCollection,
|
|
4938
|
+
lr as PublicationContentIterator,
|
|
4939
|
+
F as ReadingProgression,
|
|
4940
|
+
sr as Resource,
|
|
4941
|
+
Mt as RichContent,
|
|
4942
|
+
ci as RichContentType,
|
|
4943
|
+
ft as Subject,
|
|
4944
|
+
Yt as Subjects,
|
|
4945
|
+
$t as TDM,
|
|
4946
|
+
ui as TDMReservation,
|
|
4947
|
+
or as TextContentTokenizer,
|
|
4948
|
+
Ct as TextElement,
|
|
4949
|
+
_i as TextQuote,
|
|
4950
|
+
be as TextSegment,
|
|
4951
|
+
Ci as TextUnit,
|
|
4952
|
+
yt as TextualElement,
|
|
4953
|
+
I as Timeline,
|
|
4954
|
+
ut as URITemplate,
|
|
4955
|
+
Bi as VideoElement,
|
|
4956
|
+
ni as VisualAdjustments,
|
|
4957
|
+
Dt as WaysOfReading,
|
|
4958
|
+
hi as arrayfromJSON,
|
|
4959
|
+
_ as arrayfromJSONorString,
|
|
4960
|
+
lt as datefromJSON,
|
|
4961
|
+
nr as leadingPage,
|
|
4962
|
+
Z as numberfromJSON,
|
|
4963
|
+
z as positiveNumberfromJSON,
|
|
4964
|
+
ht as setToArray,
|
|
4965
|
+
pe as speakableToken
|
|
4728
4966
|
};
|