@readium/navigator-html-injectables 2.3.1-alpha.2 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +344 -349
- package/dist/index.umd.cjs +12 -12
- package/package.json +8 -8
- package/src/comms/comms.ts +5 -5
- package/src/comms/index.ts +3 -3
- package/src/helpers/css.ts +2 -4
- package/src/helpers/document.ts +9 -9
- package/src/helpers/locator.ts +2 -2
- package/src/index.ts +4 -4
- package/src/modules/Decorator.ts +18 -18
- package/src/modules/Module.ts +4 -4
- package/src/modules/ModuleLibrary.ts +11 -11
- package/src/modules/Peripherals.ts +70 -61
- package/src/modules/index.ts +4 -4
- package/src/modules/setup/FixedSetup.ts +6 -6
- package/src/modules/setup/ReflowableSetup.ts +6 -6
- package/src/modules/setup/Setup.ts +5 -5
- package/src/modules/setup/WebPubSetup.ts +5 -5
- package/src/modules/snapper/ColumnSnapper.ts +20 -39
- package/src/modules/snapper/ScrollSnapper.ts +18 -18
- package/src/modules/snapper/Snapper.ts +5 -5
- package/src/modules/snapper/WebPubSnapper.ts +15 -15
- package/src/protection/BulkCopyProtector.ts +15 -15
- package/src/protection/KeyCombinationManager.ts +8 -8
- package/src/protection/PatternAnalyzer.ts +18 -18
- package/src/protection/PrintProtector.ts +12 -12
- package/src/protection/SelectionAnalyzer.ts +1 -1
- package/src/protection/config.ts +4 -4
- package/src/protection/index.ts +6 -6
- package/src/vendor/hypothesis/anchoring/html.ts +1 -1
- package/src/vendor/hypothesis/anchoring/types.ts +1 -1
- package/types/src/comms/comms.d.ts +2 -2
- package/types/src/comms/index.d.ts +3 -3
- package/types/src/helpers/css.d.ts +1 -2
- package/types/src/helpers/document.d.ts +1 -1
- package/types/src/index.d.ts +4 -4
- package/types/src/modules/Decorator.d.ts +4 -4
- package/types/src/modules/Module.d.ts +3 -3
- package/types/src/modules/ModuleLibrary.d.ts +1 -1
- package/types/src/modules/Peripherals.d.ts +10 -9
- package/types/src/modules/index.d.ts +4 -4
- package/types/src/modules/setup/FixedSetup.d.ts +4 -4
- package/types/src/modules/setup/ReflowableSetup.d.ts +3 -3
- package/types/src/modules/setup/Setup.d.ts +4 -4
- package/types/src/modules/setup/WebPubSetup.d.ts +3 -3
- package/types/src/modules/snapper/ColumnSnapper.d.ts +5 -5
- package/types/src/modules/snapper/ScrollSnapper.d.ts +5 -5
- package/types/src/modules/snapper/Snapper.d.ts +4 -4
- package/types/src/modules/snapper/WebPubSnapper.d.ts +5 -5
- package/types/src/protection/BulkCopyProtector.d.ts +1 -1
- package/types/src/protection/KeyCombinationManager.d.ts +3 -3
- package/types/src/protection/PrintProtector.d.ts +4 -4
- package/types/src/protection/config.d.ts +3 -3
- package/types/src/protection/index.d.ts +6 -6
- package/types/src/vendor/hypothesis/anchoring/html.d.ts +1 -1
- package/types/src/vendor/hypothesis/anchoring/types.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const Ie = Math.pow(2, 32), Ht = () => Math.round(Math.random() * Ie).toString(36), De = () => `${Math.round(performance.now())}-${Ht()}-${Ht()}`, K = 1;
|
|
2
|
+
class ze {
|
|
3
3
|
constructor(t) {
|
|
4
4
|
this.destination = null, this.registrar = /* @__PURE__ */ new Map(), this.origin = "", this.channelId = "", this.receiver = this.receive.bind(this), this.preLog = [], this.wnd = t, t.addEventListener("message", this.receiver);
|
|
5
5
|
}
|
|
@@ -73,7 +73,7 @@ class Me {
|
|
|
73
73
|
const n = {
|
|
74
74
|
_readium: K,
|
|
75
75
|
_channel: this.channelId,
|
|
76
|
-
id: i ??
|
|
76
|
+
id: i ?? De(),
|
|
77
77
|
// scrict,
|
|
78
78
|
key: t,
|
|
79
79
|
data: e
|
|
@@ -126,8 +126,8 @@ const y = class y {
|
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
y.EPUB_A11Y_10_WCAG_20_A = new y("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), y.EPUB_A11Y_10_WCAG_20_AA = new y("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), y.EPUB_A11Y_10_WCAG_20_AAA = new y("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), y.EPUB_A11Y_11_WCAG_20_A = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), y.EPUB_A11Y_11_WCAG_20_AA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), y.EPUB_A11Y_11_WCAG_20_AAA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), y.EPUB_A11Y_11_WCAG_21_A = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), y.EPUB_A11Y_11_WCAG_21_AA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), y.EPUB_A11Y_11_WCAG_21_AAA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), y.EPUB_A11Y_11_WCAG_22_A = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), y.EPUB_A11Y_11_WCAG_22_AA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), y.EPUB_A11Y_11_WCAG_22_AAA = new y("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
|
|
129
|
-
let
|
|
130
|
-
const
|
|
129
|
+
let _t = y;
|
|
130
|
+
const w = class w {
|
|
131
131
|
constructor(t) {
|
|
132
132
|
this.value = t;
|
|
133
133
|
}
|
|
@@ -136,7 +136,7 @@ const v = class v {
|
|
|
136
136
|
*/
|
|
137
137
|
static deserialize(t) {
|
|
138
138
|
if (!(!t || typeof t != "string"))
|
|
139
|
-
return new
|
|
139
|
+
return new w(t);
|
|
140
140
|
}
|
|
141
141
|
/**
|
|
142
142
|
* Serializes an [AccessMode] to its RWPM JSON representation.
|
|
@@ -145,8 +145,8 @@ const v = class v {
|
|
|
145
145
|
return this.value;
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
|
|
149
|
-
let
|
|
148
|
+
w.AUDITORY = new w("auditory"), w.CHART_ON_VISUAL = new w("chartOnVisual"), w.CHEM_ON_VISUAL = new w("chemOnVisual"), w.COLOR_DEPENDENT = new w("colorDependent"), w.DIAGRAM_ON_VISUAL = new w("diagramOnVisual"), w.MATH_ON_VISUAL = new w("mathOnVisual"), w.MUSIC_ON_VISUAL = new w("musicOnVisual"), w.TACTILE = new w("tactile"), w.TEXT_ON_VISUAL = new w("textOnVisual"), w.TEXTUAL = new w("textual"), w.VISUAL = new w("visual");
|
|
149
|
+
let Vt = w;
|
|
150
150
|
const T = class T {
|
|
151
151
|
constructor(t) {
|
|
152
152
|
if (typeof t == "string") {
|
|
@@ -182,7 +182,7 @@ const T = class T {
|
|
|
182
182
|
}
|
|
183
183
|
};
|
|
184
184
|
T.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), T.AUDITORY = new T("auditory"), T.TACTILE = new T("tactile"), T.TEXTUAL = new T("textual"), T.VISUAL = new T("visual");
|
|
185
|
-
let
|
|
185
|
+
let Gt = T;
|
|
186
186
|
const c = class c {
|
|
187
187
|
constructor(t) {
|
|
188
188
|
this.value = t;
|
|
@@ -202,8 +202,8 @@ const c = class c {
|
|
|
202
202
|
}
|
|
203
203
|
};
|
|
204
204
|
c.NONE = new c("none"), c.ANNOTATIONS = new c("annotations"), c.ARIA = new c("ARIA"), c.INDEX = new c("index"), c.PAGE_BREAK_MARKERS = new c("pageBreakMarkers"), c.PAGE_NAVIGATION = new c("pageNavigation"), c.PRINT_PAGE_NUMBERS = new c("printPageNumbers"), c.READING_ORDER = new c("readingOrder"), c.STRUCTURAL_NAVIGATION = new c("structuralNavigation"), c.TABLE_OF_CONTENTS = new c("tableOfContents"), c.TAGGED_PDF = new c("taggedPDF"), c.ALTERNATIVE_TEXT = new c("alternativeText"), c.AUDIO_DESCRIPTION = new c("audioDescription"), c.CAPTIONS = new c("captions"), c.CLOSED_CAPTIONS = new c("closedCaptions"), c.DESCRIBED_MATH = new c("describedMath"), c.LONG_DESCRIPTION = new c("longDescription"), c.OPEN_CAPTIONS = new c("openCaptions"), c.SIGN_LANGUAGE = new c("signLanguage"), c.TRANSCRIPT = new c("transcript"), c.DISPLAY_TRANSFORMABILITY = new c("displayTransformability"), c.SYNCHRONIZED_AUDIO_TEXT = new c("synchronizedAudioText"), c.TIMING_CONTROL = new c("timingControl"), c.UNLOCKED = new c("unlocked"), c.CHEM_ML = new c("ChemML"), c.LATEX = new c("latex"), c.LATEX_CHEMISTRY = new c("latex-chemistry"), c.MATH_ML = new c("MathML"), c.MATH_ML_CHEMISTRY = new c("MathML-chemistry"), c.TTS_MARKUP = new c("ttsMarkup"), c.HIGH_CONTRAST_AUDIO = new c("highContrastAudio"), c.HIGH_CONTRAST_DISPLAY = new c("highContrastDisplay"), c.LARGE_PRINT = new c("largePrint"), c.BRAILLE = new c("braille"), c.TACTILE_GRAPHIC = new c("tactileGraphic"), c.TACTILE_OBJECT = new c("tactileObject"), c.FULL_RUBY_ANNOTATIONS = new c("fullRubyAnnotations"), c.HORIZONTAL_WRITING = new c("horizontalWriting"), c.RUBY_ANNOTATIONS = new c("rubyAnnotations"), c.VERTICAL_WRITING = new c("verticalWriting"), c.WITH_ADDITIONAL_WORD_SEGMENTATION = new c("withAdditionalWordSegmentation"), c.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new c("withoutAdditionalWordSegmentation");
|
|
205
|
-
let
|
|
206
|
-
const
|
|
205
|
+
let Ft = c;
|
|
206
|
+
const E = class E {
|
|
207
207
|
constructor(t) {
|
|
208
208
|
this.value = t;
|
|
209
209
|
}
|
|
@@ -212,7 +212,7 @@ const S = class S {
|
|
|
212
212
|
*/
|
|
213
213
|
static deserialize(t) {
|
|
214
214
|
if (!(!t || typeof t != "string"))
|
|
215
|
-
return new
|
|
215
|
+
return new E(t);
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* Serializes a [Hazard] to its RWPM JSON representation.
|
|
@@ -221,9 +221,9 @@ const S = class S {
|
|
|
221
221
|
return this.value;
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
|
|
225
|
-
let
|
|
226
|
-
const
|
|
224
|
+
E.FLASHING = new E("flashing"), E.NO_FLASHING_HAZARD = new E("noFlashingHazard"), E.UNKNOWN_FLASHING_HAZARD = new E("unknownFlashingHazard"), E.MOTION_SIMULATION = new E("motionSimulation"), E.NO_MOTION_SIMULATION_HAZARD = new E("noMotionSimulationHazard"), E.UNKNOWN_MOTION_SIMULATION_HAZARD = new E("unknownMotionSimulationHazard"), E.SOUND = new E("sound"), E.NO_SOUND_HAZARD = new E("noSoundHazard"), E.UNKNOWN_SOUND_HAZARD = new E("unknownSoundHazard"), E.UNKNOWN = new E("unknown"), E.NONE = new E("none");
|
|
225
|
+
let $t = E;
|
|
226
|
+
const S = class S {
|
|
227
227
|
constructor(t) {
|
|
228
228
|
this.value = t;
|
|
229
229
|
}
|
|
@@ -232,7 +232,7 @@ const E = class E {
|
|
|
232
232
|
*/
|
|
233
233
|
static deserialize(t) {
|
|
234
234
|
if (!(!t || typeof t != "string"))
|
|
235
|
-
return new
|
|
235
|
+
return new S(t);
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Serializes an [Exemption] to its RWPM JSON representation.
|
|
@@ -241,11 +241,11 @@ const E = class E {
|
|
|
241
241
|
return this.value;
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
|
-
|
|
245
|
-
let
|
|
246
|
-
const qt = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], ke = /* @__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"}}`), We = {
|
|
247
|
-
publication:
|
|
248
|
-
},
|
|
244
|
+
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");
|
|
245
|
+
let Yt = S;
|
|
246
|
+
const Xt = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], Me = /* @__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"}}`), ke = {
|
|
247
|
+
publication: Me
|
|
248
|
+
}, qt = {
|
|
249
249
|
fr: () => import("./fr-C5HEel98.js"),
|
|
250
250
|
ar: () => import("./ar-DyHX_uy2.js"),
|
|
251
251
|
da: () => import("./da-Dct0PS3E.js"),
|
|
@@ -256,10 +256,10 @@ const qt = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], ke = /* @__PURE__ */ J
|
|
|
256
256
|
sv: () => import("./sv-BfzAFsVN.js")
|
|
257
257
|
// 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
|
|
258
258
|
// 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
|
|
259
|
-
},
|
|
259
|
+
}, Kt = ke?.publication?.metadata?.accessibility?.["display-guide"] || {};
|
|
260
260
|
class F {
|
|
261
261
|
constructor() {
|
|
262
|
-
this.currentLocaleCode = "en", this.locale =
|
|
262
|
+
this.currentLocaleCode = "en", this.locale = Kt, this.loadedLocales = {}, this.loadedLocales.en = Kt;
|
|
263
263
|
}
|
|
264
264
|
static getInstance() {
|
|
265
265
|
return F.instance || (F.instance = new F()), F.instance;
|
|
@@ -270,14 +270,14 @@ class F {
|
|
|
270
270
|
* @returns Promise indicating if the locale was loaded successfully
|
|
271
271
|
*/
|
|
272
272
|
async loadLocale(t) {
|
|
273
|
-
if (!
|
|
273
|
+
if (!Xt.includes(t))
|
|
274
274
|
return console.warn(`Locale '${t}' is not enabled`), !1;
|
|
275
275
|
if (t in this.loadedLocales)
|
|
276
276
|
return !0;
|
|
277
277
|
try {
|
|
278
|
-
if (!(t in
|
|
278
|
+
if (!(t in qt))
|
|
279
279
|
return console.warn(`Locale file not found for: ${t}`), !1;
|
|
280
|
-
const s = (await
|
|
280
|
+
const s = (await qt[t]()).default?.publication?.metadata?.accessibility?.["display-guide"];
|
|
281
281
|
return s ? (this.loadedLocales[t] = s, !0) : (console.warn(`No accessibility strings found in locale ${t}`), !1);
|
|
282
282
|
} catch (e) {
|
|
283
283
|
return console.warn(`Failed to load locale ${t}:`, e), !1;
|
|
@@ -311,7 +311,7 @@ class F {
|
|
|
311
311
|
* Gets a list of available locale codes
|
|
312
312
|
*/
|
|
313
313
|
getAvailableLocales() {
|
|
314
|
-
return
|
|
314
|
+
return Xt;
|
|
315
315
|
}
|
|
316
316
|
getNestedValue(t, e) {
|
|
317
317
|
const i = e.split(".");
|
|
@@ -334,7 +334,7 @@ class F {
|
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
F.getInstance();
|
|
337
|
-
class
|
|
337
|
+
class Rt {
|
|
338
338
|
/**
|
|
339
339
|
* Creates a [Encryption].
|
|
340
340
|
*/
|
|
@@ -346,7 +346,7 @@ class It {
|
|
|
346
346
|
*/
|
|
347
347
|
static deserialize(t) {
|
|
348
348
|
if (t && t.algorithm)
|
|
349
|
-
return new
|
|
349
|
+
return new Rt({
|
|
350
350
|
algorithm: t.algorithm,
|
|
351
351
|
compression: t.compression,
|
|
352
352
|
originalLength: t.originalLength,
|
|
@@ -394,16 +394,16 @@ class R {
|
|
|
394
394
|
}
|
|
395
395
|
Object.defineProperty(R.prototype, "encryption", {
|
|
396
396
|
get: function() {
|
|
397
|
-
return
|
|
397
|
+
return Rt.deserialize(this.otherProperties.encrypted);
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
|
-
function
|
|
400
|
+
function We(r) {
|
|
401
401
|
return r && Array.isArray(r) ? r : void 0;
|
|
402
402
|
}
|
|
403
|
-
function
|
|
404
|
-
return r && typeof r == "string" ? [r] :
|
|
403
|
+
function ye(r) {
|
|
404
|
+
return r && typeof r == "string" ? [r] : We(r);
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function Zt(r) {
|
|
407
407
|
return typeof r == "string" ? new Date(r) : void 0;
|
|
408
408
|
}
|
|
409
409
|
function at(r) {
|
|
@@ -412,7 +412,7 @@ function at(r) {
|
|
|
412
412
|
function O(r) {
|
|
413
413
|
return at(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
414
414
|
}
|
|
415
|
-
function
|
|
415
|
+
function Ue(r) {
|
|
416
416
|
const t = new Array();
|
|
417
417
|
return r.forEach((e) => t.push(e)), t;
|
|
418
418
|
}
|
|
@@ -428,18 +428,18 @@ class l {
|
|
|
428
428
|
throw new Error("Invalid media type");
|
|
429
429
|
const o = {};
|
|
430
430
|
for (let m = 1; m < s.length; m++) {
|
|
431
|
-
const
|
|
432
|
-
if (
|
|
433
|
-
const f =
|
|
431
|
+
const v = s[m].split("=");
|
|
432
|
+
if (v.length === 2) {
|
|
433
|
+
const f = v[0].toLocaleLowerCase(), p = f === "charset" ? v[1].toUpperCase() : v[1];
|
|
434
434
|
o[f] = p;
|
|
435
435
|
}
|
|
436
436
|
}
|
|
437
437
|
const a = {}, d = Object.keys(o);
|
|
438
|
-
d.sort((m,
|
|
438
|
+
d.sort((m, v) => m.localeCompare(v)), d.forEach((m) => a[m] = o[m]);
|
|
439
439
|
let h = "";
|
|
440
440
|
for (const m in a) {
|
|
441
|
-
const
|
|
442
|
-
h += `;${m}=${
|
|
441
|
+
const v = a[m];
|
|
442
|
+
h += `;${m}=${v}`;
|
|
443
443
|
}
|
|
444
444
|
const u = `${e}/${i}${h}`, g = a.encoding;
|
|
445
445
|
this.string = u, this.type = e, this.subtype = i, this.parameters = a, this.encoding = g, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
@@ -539,6 +539,7 @@ class l {
|
|
|
539
539
|
/** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
|
|
540
540
|
get isBitmap() {
|
|
541
541
|
return this.matchesAny(
|
|
542
|
+
l.AVIF,
|
|
542
543
|
l.BMP,
|
|
543
544
|
l.GIF,
|
|
544
545
|
l.JPEG,
|
|
@@ -602,6 +603,9 @@ class l {
|
|
|
602
603
|
fileExtension: "avi"
|
|
603
604
|
});
|
|
604
605
|
}
|
|
606
|
+
static get AVIF() {
|
|
607
|
+
return l.parse({ mediaType: "image/avif", fileExtension: "avif" });
|
|
608
|
+
}
|
|
605
609
|
static get BINARY() {
|
|
606
610
|
return l.parse({ mediaType: "application/octet-stream" });
|
|
607
611
|
}
|
|
@@ -871,7 +875,7 @@ class l {
|
|
|
871
875
|
});
|
|
872
876
|
}
|
|
873
877
|
}
|
|
874
|
-
class
|
|
878
|
+
class Jt {
|
|
875
879
|
constructor(t) {
|
|
876
880
|
this.uri = t, this.parameters = this.getParameters(t);
|
|
877
881
|
}
|
|
@@ -899,7 +903,7 @@ class Qt {
|
|
|
899
903
|
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? i(s[2]) : e(s[2]));
|
|
900
904
|
}
|
|
901
905
|
}
|
|
902
|
-
class
|
|
906
|
+
class C {
|
|
903
907
|
/**
|
|
904
908
|
* Creates a [Locations].
|
|
905
909
|
*/
|
|
@@ -920,8 +924,8 @@ class A {
|
|
|
920
924
|
]);
|
|
921
925
|
return Object.entries(t).forEach(([a, d]) => {
|
|
922
926
|
o.has(a) || n.set(a, d);
|
|
923
|
-
}), new
|
|
924
|
-
fragments:
|
|
927
|
+
}), new C({
|
|
928
|
+
fragments: ye(t.fragments || t.fragment),
|
|
925
929
|
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
|
|
926
930
|
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
927
931
|
position: s !== void 0 && s > 0 ? s : void 0,
|
|
@@ -936,7 +940,7 @@ class A {
|
|
|
936
940
|
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;
|
|
937
941
|
}
|
|
938
942
|
}
|
|
939
|
-
class
|
|
943
|
+
class H {
|
|
940
944
|
/**
|
|
941
945
|
* Creates a [Text].
|
|
942
946
|
*/
|
|
@@ -948,7 +952,7 @@ class _ {
|
|
|
948
952
|
*/
|
|
949
953
|
static deserialize(t) {
|
|
950
954
|
if (t)
|
|
951
|
-
return new
|
|
955
|
+
return new H({
|
|
952
956
|
after: t.after,
|
|
953
957
|
before: t.before,
|
|
954
958
|
highlight: t.highlight
|
|
@@ -967,7 +971,7 @@ class W {
|
|
|
967
971
|
* Creates a [Locator].
|
|
968
972
|
*/
|
|
969
973
|
constructor(t) {
|
|
970
|
-
this.href = t.href, this.type = t.type, this.title = t.title, this.locations = t.locations ? t.locations : new
|
|
974
|
+
this.href = t.href, this.type = t.type, this.title = t.title, this.locations = t.locations ? t.locations : new C({}), this.text = t.text;
|
|
971
975
|
}
|
|
972
976
|
/**
|
|
973
977
|
* Parses a [Link] from its RWPM JSON representation.
|
|
@@ -978,8 +982,8 @@ class W {
|
|
|
978
982
|
href: t.href,
|
|
979
983
|
type: t.type,
|
|
980
984
|
title: t.title,
|
|
981
|
-
locations:
|
|
982
|
-
text:
|
|
985
|
+
locations: C.deserialize(t.locations),
|
|
986
|
+
text: H.deserialize(t.text)
|
|
983
987
|
});
|
|
984
988
|
}
|
|
985
989
|
/**
|
|
@@ -998,7 +1002,7 @@ class W {
|
|
|
998
1002
|
type: this.type,
|
|
999
1003
|
title: this.title,
|
|
1000
1004
|
text: this.text,
|
|
1001
|
-
locations: new
|
|
1005
|
+
locations: new C({ ...this.locations, ...t })
|
|
1002
1006
|
});
|
|
1003
1007
|
}
|
|
1004
1008
|
}
|
|
@@ -1026,7 +1030,7 @@ class Y {
|
|
|
1026
1030
|
size: O(t.size),
|
|
1027
1031
|
duration: O(t.duration),
|
|
1028
1032
|
bitrate: O(t.bitrate),
|
|
1029
|
-
languages:
|
|
1033
|
+
languages: ye(t.language),
|
|
1030
1034
|
alternates: lt.deserialize(t.alternate),
|
|
1031
1035
|
children: lt.deserialize(t.children)
|
|
1032
1036
|
});
|
|
@@ -1036,7 +1040,7 @@ class Y {
|
|
|
1036
1040
|
*/
|
|
1037
1041
|
serialize() {
|
|
1038
1042
|
const t = { href: this.href };
|
|
1039
|
-
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 =
|
|
1043
|
+
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 = Ue(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;
|
|
1040
1044
|
}
|
|
1041
1045
|
/** MediaType of the linked resource. */
|
|
1042
1046
|
get mediaType() {
|
|
@@ -1053,14 +1057,14 @@ class Y {
|
|
|
1053
1057
|
}
|
|
1054
1058
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
1055
1059
|
get templateParameters() {
|
|
1056
|
-
return this.templated ? new
|
|
1060
|
+
return this.templated ? new Jt(this.href).parameters : /* @__PURE__ */ new Set();
|
|
1057
1061
|
}
|
|
1058
1062
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
1059
1063
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
1060
1064
|
*/
|
|
1061
1065
|
expandTemplate(t) {
|
|
1062
1066
|
return new Y({
|
|
1063
|
-
href: new
|
|
1067
|
+
href: new Jt(this.href).expand(t),
|
|
1064
1068
|
templated: !1
|
|
1065
1069
|
});
|
|
1066
1070
|
}
|
|
@@ -1080,7 +1084,7 @@ class Y {
|
|
|
1080
1084
|
href: t.length > 0 && t[0] !== void 0 ? t[0] : this.href,
|
|
1081
1085
|
type: this.type ?? "",
|
|
1082
1086
|
title: this.title,
|
|
1083
|
-
locations: new
|
|
1087
|
+
locations: new C({
|
|
1084
1088
|
fragments: t.length > 1 && t[1] !== void 0 ? [t[1]] : []
|
|
1085
1089
|
})
|
|
1086
1090
|
});
|
|
@@ -1215,7 +1219,7 @@ class ct {
|
|
|
1215
1219
|
return this.charOffset !== void 0 && (t.charOffset = this.charOffset), t;
|
|
1216
1220
|
}
|
|
1217
1221
|
}
|
|
1218
|
-
class
|
|
1222
|
+
class It {
|
|
1219
1223
|
/**
|
|
1220
1224
|
* Creates a [DomRange].
|
|
1221
1225
|
*/
|
|
@@ -1229,7 +1233,7 @@ class Dt {
|
|
|
1229
1233
|
if (!t) return;
|
|
1230
1234
|
let e = ct.deserialize(t.start);
|
|
1231
1235
|
if (e)
|
|
1232
|
-
return new
|
|
1236
|
+
return new It({
|
|
1233
1237
|
start: e,
|
|
1234
1238
|
end: ct.deserialize(t.end)
|
|
1235
1239
|
});
|
|
@@ -1242,16 +1246,16 @@ class Dt {
|
|
|
1242
1246
|
return this.end && (t.end = this.end.serialize()), t;
|
|
1243
1247
|
}
|
|
1244
1248
|
}
|
|
1245
|
-
|
|
1249
|
+
C.prototype.getCssSelector = function() {
|
|
1246
1250
|
return this.otherLocations?.get("cssSelector");
|
|
1247
1251
|
};
|
|
1248
|
-
|
|
1252
|
+
C.prototype.getPartialCfi = function() {
|
|
1249
1253
|
return this.otherLocations?.get("partialCfi");
|
|
1250
1254
|
};
|
|
1251
|
-
|
|
1252
|
-
return
|
|
1255
|
+
C.prototype.getDomRange = function() {
|
|
1256
|
+
return It.deserialize(this.otherLocations?.get("domRange"));
|
|
1253
1257
|
};
|
|
1254
|
-
|
|
1258
|
+
C.prototype.fragmentParameters = function() {
|
|
1255
1259
|
return new Map(
|
|
1256
1260
|
this.fragments.map((r) => r.startsWith("#") ? r.slice(1) : r).join("&").split("&").filter((r) => !r.startsWith("#")).map((r) => r.split("=")).filter((r) => r.length === 2).map((r) => [
|
|
1257
1261
|
r[0].trim().toLowerCase(),
|
|
@@ -1259,7 +1263,7 @@ A.prototype.fragmentParameters = function() {
|
|
|
1259
1263
|
])
|
|
1260
1264
|
);
|
|
1261
1265
|
};
|
|
1262
|
-
|
|
1266
|
+
C.prototype.htmlId = function() {
|
|
1263
1267
|
if (!this.fragments.length) return;
|
|
1264
1268
|
let r = this.fragments.find((t) => t.length && !t.includes("="));
|
|
1265
1269
|
if (!r) {
|
|
@@ -1268,26 +1272,22 @@ A.prototype.htmlId = function() {
|
|
|
1268
1272
|
}
|
|
1269
1273
|
return r?.startsWith("#") ? r.slice(1) : r;
|
|
1270
1274
|
};
|
|
1271
|
-
|
|
1275
|
+
C.prototype.page = function() {
|
|
1272
1276
|
const r = parseInt(this.fragmentParameters().get("page"));
|
|
1273
1277
|
if (!isNaN(r) && r >= 0) return r;
|
|
1274
1278
|
};
|
|
1275
|
-
|
|
1279
|
+
C.prototype.time = function() {
|
|
1276
1280
|
const r = parseInt(this.fragmentParameters().get("t"));
|
|
1277
1281
|
if (!isNaN(r)) return r;
|
|
1278
1282
|
};
|
|
1279
|
-
|
|
1283
|
+
C.prototype.space = function() {
|
|
1280
1284
|
const r = this.fragmentParameters();
|
|
1281
1285
|
if (!r.has("xywh")) return;
|
|
1282
1286
|
const t = r.get("xywh").split(",").map((e) => parseInt(e));
|
|
1283
1287
|
if (t.length === 4 && !t.some(isNaN))
|
|
1284
1288
|
return t;
|
|
1285
1289
|
};
|
|
1286
|
-
|
|
1287
|
-
const r = this.fragmentParameters();
|
|
1288
|
-
console.log(r);
|
|
1289
|
-
};
|
|
1290
|
-
class zt {
|
|
1290
|
+
class Dt {
|
|
1291
1291
|
/** Creates a [Price]. */
|
|
1292
1292
|
constructor(t) {
|
|
1293
1293
|
this.currency = t.currency, this.value = t.value;
|
|
@@ -1302,7 +1302,7 @@ class zt {
|
|
|
1302
1302
|
return;
|
|
1303
1303
|
let i = O(t.value);
|
|
1304
1304
|
if (i !== void 0)
|
|
1305
|
-
return new
|
|
1305
|
+
return new Dt({ currency: e, value: i });
|
|
1306
1306
|
}
|
|
1307
1307
|
/**
|
|
1308
1308
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1338,7 +1338,7 @@ class J {
|
|
|
1338
1338
|
return this.children && (t.children = this.children.map((e) => e.serialize())), t;
|
|
1339
1339
|
}
|
|
1340
1340
|
}
|
|
1341
|
-
class
|
|
1341
|
+
class zt {
|
|
1342
1342
|
/** Creates a [Price]. */
|
|
1343
1343
|
constructor(t) {
|
|
1344
1344
|
this.total = t.total, this.position = t.position;
|
|
@@ -1348,7 +1348,7 @@ class Mt {
|
|
|
1348
1348
|
*/
|
|
1349
1349
|
static deserialize(t) {
|
|
1350
1350
|
if (t)
|
|
1351
|
-
return new
|
|
1351
|
+
return new zt({
|
|
1352
1352
|
total: O(t.total),
|
|
1353
1353
|
position: O(t.position)
|
|
1354
1354
|
});
|
|
@@ -1361,7 +1361,7 @@ class Mt {
|
|
|
1361
1361
|
return this.total !== void 0 && (t.total = this.total), this.position !== void 0 && (t.position = this.position), t;
|
|
1362
1362
|
}
|
|
1363
1363
|
}
|
|
1364
|
-
class
|
|
1364
|
+
class Mt {
|
|
1365
1365
|
/** Creates a [Copies]. */
|
|
1366
1366
|
constructor(t) {
|
|
1367
1367
|
this.total = t.total, this.available = t.available;
|
|
@@ -1371,7 +1371,7 @@ class kt {
|
|
|
1371
1371
|
*/
|
|
1372
1372
|
static deserialize(t) {
|
|
1373
1373
|
if (t)
|
|
1374
|
-
return new
|
|
1374
|
+
return new Mt({
|
|
1375
1375
|
total: O(t.total),
|
|
1376
1376
|
available: O(t.available)
|
|
1377
1377
|
});
|
|
@@ -1384,7 +1384,7 @@ class kt {
|
|
|
1384
1384
|
return this.total !== void 0 && (t.total = this.total), this.available !== void 0 && (t.available = this.available), t;
|
|
1385
1385
|
}
|
|
1386
1386
|
}
|
|
1387
|
-
class
|
|
1387
|
+
class kt {
|
|
1388
1388
|
/** Creates a [Availability]. */
|
|
1389
1389
|
constructor(t) {
|
|
1390
1390
|
this.state = t.state, this.since = t.since, this.until = t.until;
|
|
@@ -1394,10 +1394,10 @@ class Wt {
|
|
|
1394
1394
|
*/
|
|
1395
1395
|
static deserialize(t) {
|
|
1396
1396
|
if (t && t.state)
|
|
1397
|
-
return new
|
|
1397
|
+
return new kt({
|
|
1398
1398
|
state: t.state,
|
|
1399
|
-
since:
|
|
1400
|
-
until:
|
|
1399
|
+
since: Zt(t.since),
|
|
1400
|
+
until: Zt(t.until)
|
|
1401
1401
|
});
|
|
1402
1402
|
}
|
|
1403
1403
|
/**
|
|
@@ -1412,7 +1412,7 @@ R.prototype.getNumberOfItems = function() {
|
|
|
1412
1412
|
return O(this.otherProperties.numberOfItems);
|
|
1413
1413
|
};
|
|
1414
1414
|
R.prototype.getPrice = function() {
|
|
1415
|
-
return
|
|
1415
|
+
return Dt.deserialize(this.otherProperties.price);
|
|
1416
1416
|
};
|
|
1417
1417
|
R.prototype.getIndirectAcquisitions = function() {
|
|
1418
1418
|
const r = this.otherProperties.indirectAcquisition;
|
|
@@ -1420,45 +1420,45 @@ R.prototype.getIndirectAcquisitions = function() {
|
|
|
1420
1420
|
return r.map((t) => J.deserialize(t)).filter((t) => t !== void 0);
|
|
1421
1421
|
};
|
|
1422
1422
|
R.prototype.getHolds = function() {
|
|
1423
|
-
return
|
|
1423
|
+
return zt.deserialize(this.otherProperties.holds);
|
|
1424
1424
|
};
|
|
1425
1425
|
R.prototype.getCopies = function() {
|
|
1426
|
-
return
|
|
1426
|
+
return Mt.deserialize(this.otherProperties.copies);
|
|
1427
1427
|
};
|
|
1428
1428
|
R.prototype.getAvailability = function() {
|
|
1429
|
-
return
|
|
1429
|
+
return kt.deserialize(this.otherProperties.availability);
|
|
1430
1430
|
};
|
|
1431
1431
|
R.prototype.getAuthenticate = function() {
|
|
1432
1432
|
return Y.deserialize(this.otherProperties.authenticate);
|
|
1433
1433
|
};
|
|
1434
|
-
const
|
|
1435
|
-
function
|
|
1436
|
-
console.warn(`${
|
|
1434
|
+
const Be = "CssSelectorGenerator";
|
|
1435
|
+
function Qt(r = "unknown problem", ...t) {
|
|
1436
|
+
console.warn(`${Be}: ${r}`, ...t);
|
|
1437
1437
|
}
|
|
1438
|
-
function
|
|
1438
|
+
function He(r) {
|
|
1439
1439
|
return r instanceof RegExp;
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1441
|
+
function _e(r) {
|
|
1442
1442
|
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1443
1443
|
}
|
|
1444
|
-
function
|
|
1444
|
+
function Ve(r) {
|
|
1445
1445
|
const t = r.map((e) => {
|
|
1446
|
-
if (
|
|
1446
|
+
if (He(e))
|
|
1447
1447
|
return (i) => e.test(i);
|
|
1448
1448
|
if (typeof e == "function")
|
|
1449
1449
|
return (i) => {
|
|
1450
1450
|
const s = e(i);
|
|
1451
|
-
return typeof s != "boolean" ? (
|
|
1451
|
+
return typeof s != "boolean" ? (Qt("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : s;
|
|
1452
1452
|
};
|
|
1453
1453
|
if (typeof e == "string") {
|
|
1454
|
-
const i = new RegExp("^" +
|
|
1454
|
+
const i = new RegExp("^" + _e(e) + "$");
|
|
1455
1455
|
return (s) => i.test(s);
|
|
1456
1456
|
}
|
|
1457
|
-
return
|
|
1457
|
+
return Qt("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
|
|
1458
1458
|
});
|
|
1459
1459
|
return (e) => t.some((i) => i(e));
|
|
1460
1460
|
}
|
|
1461
|
-
|
|
1461
|
+
Ve([
|
|
1462
1462
|
"class",
|
|
1463
1463
|
"id",
|
|
1464
1464
|
// Angular attributes
|
|
@@ -1466,15 +1466,15 @@ Ge([
|
|
|
1466
1466
|
]);
|
|
1467
1467
|
class X {
|
|
1468
1468
|
}
|
|
1469
|
-
function
|
|
1469
|
+
function jt(r) {
|
|
1470
1470
|
return r.split("").reverse().join("");
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1473
|
-
const i =
|
|
1472
|
+
function Ge(r, t, e) {
|
|
1473
|
+
const i = jt(t);
|
|
1474
1474
|
return e.map((s) => {
|
|
1475
|
-
const n = Math.max(0, s.end - t.length - s.errors), o =
|
|
1475
|
+
const n = Math.max(0, s.end - t.length - s.errors), o = jt(r.slice(n, s.end));
|
|
1476
1476
|
return {
|
|
1477
|
-
start:
|
|
1477
|
+
start: be(o, i, s.errors).reduce((d, h) => s.end - h.end < d ? s.end - h.end : d, s.end),
|
|
1478
1478
|
end: s.end,
|
|
1479
1479
|
errors: s.errors
|
|
1480
1480
|
};
|
|
@@ -1483,14 +1483,14 @@ function Fe(r, t, e) {
|
|
|
1483
1483
|
function ft(r) {
|
|
1484
1484
|
return (r | -r) >> 31 & 1;
|
|
1485
1485
|
}
|
|
1486
|
-
function
|
|
1486
|
+
function te(r, t, e, i) {
|
|
1487
1487
|
let s = r.P[e], n = r.M[e];
|
|
1488
1488
|
const o = i >>> 31, a = t[e] | o, d = a | n, h = (a & s) + s ^ s | a;
|
|
1489
1489
|
let u = n | ~(h | s), g = s & h;
|
|
1490
1490
|
const m = ft(u & r.lastRowMask[e]) - ft(g & r.lastRowMask[e]);
|
|
1491
1491
|
return u <<= 1, g <<= 1, g |= o, u |= ft(i) - o, s = g | ~(d | u), n = u & d, r.P[e] = s, r.M[e] = n, m;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function be(r, t, e) {
|
|
1494
1494
|
if (t.length === 0)
|
|
1495
1495
|
return [];
|
|
1496
1496
|
e = Math.min(e, t.length);
|
|
@@ -1504,18 +1504,18 @@ function we(r, t, e) {
|
|
|
1504
1504
|
for (let m = 0; m < 256; m++)
|
|
1505
1505
|
h.push(a);
|
|
1506
1506
|
for (let m = 0; m < t.length; m += 1) {
|
|
1507
|
-
const
|
|
1508
|
-
if (d.has(
|
|
1507
|
+
const v = t.charCodeAt(m);
|
|
1508
|
+
if (d.has(v))
|
|
1509
1509
|
continue;
|
|
1510
1510
|
const f = new Uint32Array(n + 1);
|
|
1511
|
-
d.set(
|
|
1511
|
+
d.set(v, f), v < h.length && (h[v] = f);
|
|
1512
1512
|
for (let p = 0; p <= n; p += 1) {
|
|
1513
1513
|
f[p] = 0;
|
|
1514
1514
|
for (let b = 0; b < s; b += 1) {
|
|
1515
1515
|
const x = p * s + b;
|
|
1516
1516
|
if (x >= t.length)
|
|
1517
1517
|
continue;
|
|
1518
|
-
t.charCodeAt(x) ===
|
|
1518
|
+
t.charCodeAt(x) === v && (f[p] |= 1 << b);
|
|
1519
1519
|
}
|
|
1520
1520
|
}
|
|
1521
1521
|
}
|
|
@@ -1527,12 +1527,12 @@ function we(r, t, e) {
|
|
|
1527
1527
|
for (let m = 0; m <= u; m += 1)
|
|
1528
1528
|
o.P[m] = -1, o.M[m] = 0;
|
|
1529
1529
|
for (let m = 0; m < r.length; m += 1) {
|
|
1530
|
-
const
|
|
1530
|
+
const v = r.charCodeAt(m);
|
|
1531
1531
|
let f;
|
|
1532
|
-
|
|
1532
|
+
v < h.length ? f = h[v] : (f = d.get(v), typeof f > "u" && (f = a));
|
|
1533
1533
|
let p = 0;
|
|
1534
1534
|
for (let b = 0; b <= u; b += 1)
|
|
1535
|
-
p =
|
|
1535
|
+
p = te(o, f, b, p), g[b] += p;
|
|
1536
1536
|
if (g[u] - p <= e && u < n && (f[u + 1] & 1 || p < 0)) {
|
|
1537
1537
|
u += 1, o.P[u] = -1, o.M[u] = 0;
|
|
1538
1538
|
let b;
|
|
@@ -1541,7 +1541,7 @@ function we(r, t, e) {
|
|
|
1541
1541
|
b = x === 0 ? s : x;
|
|
1542
1542
|
} else
|
|
1543
1543
|
b = s;
|
|
1544
|
-
g[u] = g[u - 1] + b - p +
|
|
1544
|
+
g[u] = g[u - 1] + b - p + te(o, f, u, p);
|
|
1545
1545
|
} else
|
|
1546
1546
|
for (; u > 0 && g[u] >= e + s; )
|
|
1547
1547
|
u -= 1;
|
|
@@ -1553,9 +1553,9 @@ function we(r, t, e) {
|
|
|
1553
1553
|
}
|
|
1554
1554
|
return i;
|
|
1555
1555
|
}
|
|
1556
|
-
function
|
|
1557
|
-
const i =
|
|
1558
|
-
return
|
|
1556
|
+
function Fe(r, t, e) {
|
|
1557
|
+
const i = be(r, t, e);
|
|
1558
|
+
return Ge(r, t, i);
|
|
1559
1559
|
}
|
|
1560
1560
|
function ve(r, t, e) {
|
|
1561
1561
|
let i = 0;
|
|
@@ -1566,30 +1566,30 @@ function ve(r, t, e) {
|
|
|
1566
1566
|
end: i + t.length,
|
|
1567
1567
|
errors: 0
|
|
1568
1568
|
}), i += 1);
|
|
1569
|
-
return s.length > 0 ? s :
|
|
1569
|
+
return s.length > 0 ? s : Fe(r, t, e);
|
|
1570
1570
|
}
|
|
1571
|
-
function
|
|
1571
|
+
function ee(r, t) {
|
|
1572
1572
|
return t.length === 0 || r.length === 0 ? 0 : 1 - ve(r, t, t.length)[0].errors / t.length;
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1574
|
+
function $e(r, t, e = {}) {
|
|
1575
1575
|
if (t.length === 0)
|
|
1576
1576
|
return null;
|
|
1577
1577
|
const i = Math.min(256, t.length / 2), s = ve(r, t, i);
|
|
1578
1578
|
if (s.length === 0)
|
|
1579
1579
|
return null;
|
|
1580
1580
|
const n = (a) => {
|
|
1581
|
-
const m = 1 - a.errors / t.length,
|
|
1581
|
+
const m = 1 - a.errors / t.length, v = e.prefix ? ee(
|
|
1582
1582
|
r.slice(
|
|
1583
1583
|
Math.max(0, a.start - e.prefix.length),
|
|
1584
1584
|
a.start
|
|
1585
1585
|
),
|
|
1586
1586
|
e.prefix
|
|
1587
|
-
) : 1, f = e.suffix ?
|
|
1587
|
+
) : 1, f = e.suffix ? ee(
|
|
1588
1588
|
r.slice(a.end, a.end + e.suffix.length),
|
|
1589
1589
|
e.suffix
|
|
1590
1590
|
) : 1;
|
|
1591
1591
|
let p = 1;
|
|
1592
|
-
return typeof e.hint == "number" && (p = 1 - Math.abs(a.start - e.hint) / r.length), (50 * m + 20 *
|
|
1592
|
+
return typeof e.hint == "number" && (p = 1 - Math.abs(a.start - e.hint) / r.length), (50 * m + 20 * v + 20 * f + 2 * p) / 92;
|
|
1593
1593
|
}, o = s.map((a) => ({
|
|
1594
1594
|
start: a.start,
|
|
1595
1595
|
end: a.end,
|
|
@@ -1607,7 +1607,7 @@ function vt(r, t, e) {
|
|
|
1607
1607
|
const o = s.length - n.length;
|
|
1608
1608
|
return e === 2 ? t - o : t + o;
|
|
1609
1609
|
}
|
|
1610
|
-
function
|
|
1610
|
+
function ie(r, t) {
|
|
1611
1611
|
const e = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1612
1612
|
r.commonAncestorContainer,
|
|
1613
1613
|
NodeFilter.SHOW_TEXT
|
|
@@ -1629,7 +1629,7 @@ function se(r, t) {
|
|
|
1629
1629
|
return { node: n, offset: o };
|
|
1630
1630
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1631
1631
|
}
|
|
1632
|
-
function
|
|
1632
|
+
function Ye(r) {
|
|
1633
1633
|
if (!r.toString().trim().length)
|
|
1634
1634
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1635
1635
|
if (r.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1655,7 +1655,7 @@ function Xe(r) {
|
|
|
1655
1655
|
if (s.start >= 0 && (t.setStart(r.startContainer, s.start), e = !0), s.end > 0 && (t.setEnd(r.endContainer, s.end), i = !0), e && i)
|
|
1656
1656
|
return t;
|
|
1657
1657
|
if (!e) {
|
|
1658
|
-
const { node: n, offset: o } =
|
|
1658
|
+
const { node: n, offset: o } = ie(
|
|
1659
1659
|
t,
|
|
1660
1660
|
1
|
|
1661
1661
|
/* Forwards */
|
|
@@ -1663,7 +1663,7 @@ function Xe(r) {
|
|
|
1663
1663
|
n && o >= 0 && t.setStart(n, o);
|
|
1664
1664
|
}
|
|
1665
1665
|
if (!i) {
|
|
1666
|
-
const { node: n, offset: o } =
|
|
1666
|
+
const { node: n, offset: o } = ie(
|
|
1667
1667
|
t,
|
|
1668
1668
|
2
|
|
1669
1669
|
/* Backwards */
|
|
@@ -1672,7 +1672,7 @@ function Xe(r) {
|
|
|
1672
1672
|
}
|
|
1673
1673
|
return t;
|
|
1674
1674
|
}
|
|
1675
|
-
function
|
|
1675
|
+
function we(r) {
|
|
1676
1676
|
switch (r.nodeType) {
|
|
1677
1677
|
case Node.ELEMENT_NODE:
|
|
1678
1678
|
case Node.TEXT_NODE:
|
|
@@ -1681,10 +1681,10 @@ function Se(r) {
|
|
|
1681
1681
|
return 0;
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1684
|
+
function se(r) {
|
|
1685
1685
|
let t = r.previousSibling, e = 0;
|
|
1686
1686
|
for (; t; )
|
|
1687
|
-
e +=
|
|
1687
|
+
e += we(t), t = t.previousSibling;
|
|
1688
1688
|
return e;
|
|
1689
1689
|
}
|
|
1690
1690
|
function Ee(r, ...t) {
|
|
@@ -1719,7 +1719,7 @@ class z {
|
|
|
1719
1719
|
throw new Error("Parent is not an ancestor of current element");
|
|
1720
1720
|
let e = this.element, i = this.offset;
|
|
1721
1721
|
for (; e !== t; )
|
|
1722
|
-
i +=
|
|
1722
|
+
i += se(e), e = e.parentElement;
|
|
1723
1723
|
return new z(e, i);
|
|
1724
1724
|
}
|
|
1725
1725
|
/**
|
|
@@ -1784,7 +1784,7 @@ class z {
|
|
|
1784
1784
|
throw new Error("Text node offset is out of range");
|
|
1785
1785
|
if (!t.parentElement)
|
|
1786
1786
|
throw new Error("Text node has no parent");
|
|
1787
|
-
const i =
|
|
1787
|
+
const i = se(t) + e;
|
|
1788
1788
|
return new z(t.parentElement, i);
|
|
1789
1789
|
}
|
|
1790
1790
|
case Node.ELEMENT_NODE: {
|
|
@@ -1792,7 +1792,7 @@ class z {
|
|
|
1792
1792
|
throw new Error("Child node offset is out of range");
|
|
1793
1793
|
let i = 0;
|
|
1794
1794
|
for (let s = 0; s < e; s++)
|
|
1795
|
-
i +=
|
|
1795
|
+
i += we(t.childNodes[s]);
|
|
1796
1796
|
return new z(t, i);
|
|
1797
1797
|
}
|
|
1798
1798
|
default:
|
|
@@ -1865,7 +1865,7 @@ class U {
|
|
|
1865
1865
|
* whitespace
|
|
1866
1866
|
*/
|
|
1867
1867
|
static trimmedRange(t) {
|
|
1868
|
-
return
|
|
1868
|
+
return Ye(U.fromRange(t).toRange());
|
|
1869
1869
|
}
|
|
1870
1870
|
}
|
|
1871
1871
|
class ht {
|
|
@@ -1929,7 +1929,7 @@ class dt {
|
|
|
1929
1929
|
return this.toPositionAnchor(t).toRange();
|
|
1930
1930
|
}
|
|
1931
1931
|
toPositionAnchor(t = {}) {
|
|
1932
|
-
const e = this.root.textContent, i =
|
|
1932
|
+
const e = this.root.textContent, i = $e(e, this.exact, {
|
|
1933
1933
|
...this.context,
|
|
1934
1934
|
hint: t.hint
|
|
1935
1935
|
});
|
|
@@ -1938,7 +1938,7 @@ class dt {
|
|
|
1938
1938
|
return new ht(this.root, i.start, i.end);
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
|
-
function
|
|
1941
|
+
function Xe(r) {
|
|
1942
1942
|
const t = r.tagName.toUpperCase();
|
|
1943
1943
|
return t === "IMG" || t === "VIDEO" || t === "AUDIO" || t === "IFRAME" || t === "OBJECT" || t === "EMBED" || t === "CANVAS";
|
|
1944
1944
|
}
|
|
@@ -1967,7 +1967,7 @@ function pt(r, t) {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
if (s) {
|
|
1969
1969
|
const n = r.createRange();
|
|
1970
|
-
return s.childNodes.length === 0 ||
|
|
1970
|
+
return s.childNodes.length === 0 || Xe(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1971
1971
|
}
|
|
1972
1972
|
}
|
|
1973
1973
|
} catch (e) {
|
|
@@ -1975,7 +1975,7 @@ function pt(r, t) {
|
|
|
1975
1975
|
}
|
|
1976
1976
|
return null;
|
|
1977
1977
|
}
|
|
1978
|
-
function
|
|
1978
|
+
function qe(r, t) {
|
|
1979
1979
|
let e = r.getClientRects();
|
|
1980
1980
|
e.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = r.commonAncestorContainer.getClientRects());
|
|
1981
1981
|
const i = 1, s = [];
|
|
@@ -1988,10 +1988,10 @@ function Ke(r, t) {
|
|
|
1988
1988
|
top: h.top,
|
|
1989
1989
|
width: h.width
|
|
1990
1990
|
});
|
|
1991
|
-
const n =
|
|
1991
|
+
const n = Se(
|
|
1992
1992
|
s,
|
|
1993
1993
|
i
|
|
1994
|
-
), o =
|
|
1994
|
+
), o = Ze(n, i), a = Ae(o), d = 4;
|
|
1995
1995
|
for (let h = a.length - 1; h >= 0; h--) {
|
|
1996
1996
|
const u = a[h];
|
|
1997
1997
|
if (!(u.width * u.height > d))
|
|
@@ -2002,16 +2002,16 @@ function Ke(r, t) {
|
|
|
2002
2002
|
}
|
|
2003
2003
|
return a;
|
|
2004
2004
|
}
|
|
2005
|
-
function
|
|
2005
|
+
function Se(r, t, e) {
|
|
2006
2006
|
for (let i = 0; i < r.length; i++)
|
|
2007
2007
|
for (let s = i + 1; s < r.length; s++) {
|
|
2008
2008
|
const n = r[i], o = r[s];
|
|
2009
2009
|
if (n === o)
|
|
2010
2010
|
continue;
|
|
2011
2011
|
const a = I(n.top, o.top, t) && I(n.bottom, o.bottom, t), d = I(n.left, o.left, t) && I(n.right, o.right, t);
|
|
2012
|
-
if (a && !d &&
|
|
2013
|
-
const g = r.filter((
|
|
2014
|
-
return g.push(m),
|
|
2012
|
+
if (a && !d && Ce(n, o, t)) {
|
|
2013
|
+
const g = r.filter((v) => v !== n && v !== o), m = Ke(n, o);
|
|
2014
|
+
return g.push(m), Se(
|
|
2015
2015
|
g,
|
|
2016
2016
|
t
|
|
2017
2017
|
);
|
|
@@ -2019,7 +2019,7 @@ function Ae(r, t, e) {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
return r;
|
|
2021
2021
|
}
|
|
2022
|
-
function
|
|
2022
|
+
function Ke(r, t) {
|
|
2023
2023
|
const e = Math.min(r.left, t.left), i = Math.max(r.right, t.right), s = Math.min(r.top, t.top), n = Math.max(r.bottom, t.bottom);
|
|
2024
2024
|
return {
|
|
2025
2025
|
bottom: n,
|
|
@@ -2030,7 +2030,7 @@ function Ze(r, t) {
|
|
|
2030
2030
|
width: i - e
|
|
2031
2031
|
};
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function Ze(r, t) {
|
|
2034
2034
|
const e = new Set(r);
|
|
2035
2035
|
for (const i of r) {
|
|
2036
2036
|
if (!(i.width > 1 && i.height > 1)) {
|
|
@@ -2038,40 +2038,40 @@ function Je(r, t) {
|
|
|
2038
2038
|
continue;
|
|
2039
2039
|
}
|
|
2040
2040
|
for (const n of r)
|
|
2041
|
-
if (i !== n && e.has(n) &&
|
|
2041
|
+
if (i !== n && e.has(n) && Je(n, i, t)) {
|
|
2042
2042
|
e.delete(i);
|
|
2043
2043
|
break;
|
|
2044
2044
|
}
|
|
2045
2045
|
}
|
|
2046
2046
|
return Array.from(e);
|
|
2047
2047
|
}
|
|
2048
|
-
function
|
|
2048
|
+
function Je(r, t, e) {
|
|
2049
2049
|
return nt(r, t.left, t.top, e) && nt(r, t.right, t.top, e) && nt(r, t.left, t.bottom, e) && nt(r, t.right, t.bottom, e);
|
|
2050
2050
|
}
|
|
2051
2051
|
function nt(r, t, e, i) {
|
|
2052
2052
|
return (r.left < t || I(r.left, t, i)) && (r.right > t || I(r.right, t, i)) && (r.top < e || I(r.top, e, i)) && (r.bottom > e || I(r.bottom, e, i));
|
|
2053
2053
|
}
|
|
2054
|
-
function
|
|
2054
|
+
function Ae(r) {
|
|
2055
2055
|
for (let t = 0; t < r.length; t++)
|
|
2056
2056
|
for (let e = t + 1; e < r.length; e++) {
|
|
2057
2057
|
const i = r[t], s = r[e];
|
|
2058
|
-
if (i !== s &&
|
|
2058
|
+
if (i !== s && Ce(i, s, -1)) {
|
|
2059
2059
|
let n = [], o;
|
|
2060
|
-
const a =
|
|
2060
|
+
const a = ne(i, s);
|
|
2061
2061
|
if (a.length === 1)
|
|
2062
2062
|
n = a, o = i;
|
|
2063
2063
|
else {
|
|
2064
|
-
const h =
|
|
2064
|
+
const h = ne(s, i);
|
|
2065
2065
|
a.length < h.length ? (n = a, o = i) : (n = h, o = s);
|
|
2066
2066
|
}
|
|
2067
2067
|
const d = r.filter((h) => h !== o);
|
|
2068
|
-
return Array.prototype.push.apply(d, n),
|
|
2068
|
+
return Array.prototype.push.apply(d, n), Ae(d);
|
|
2069
2069
|
}
|
|
2070
2070
|
}
|
|
2071
2071
|
return r;
|
|
2072
2072
|
}
|
|
2073
|
-
function
|
|
2074
|
-
const e =
|
|
2073
|
+
function ne(r, t) {
|
|
2074
|
+
const e = Qe(t, r);
|
|
2075
2075
|
if (e.height === 0 || e.width === 0)
|
|
2076
2076
|
return [r];
|
|
2077
2077
|
const i = [];
|
|
@@ -2121,7 +2121,7 @@ function re(r, t) {
|
|
|
2121
2121
|
}
|
|
2122
2122
|
return i;
|
|
2123
2123
|
}
|
|
2124
|
-
function
|
|
2124
|
+
function Qe(r, t) {
|
|
2125
2125
|
const e = Math.max(r.left, t.left), i = Math.min(r.right, t.right), s = Math.max(r.top, t.top), n = Math.min(r.bottom, t.bottom);
|
|
2126
2126
|
return {
|
|
2127
2127
|
bottom: n,
|
|
@@ -2132,28 +2132,27 @@ function je(r, t) {
|
|
|
2132
2132
|
width: Math.max(0, i - e)
|
|
2133
2133
|
};
|
|
2134
2134
|
}
|
|
2135
|
-
function
|
|
2135
|
+
function Ce(r, t, e) {
|
|
2136
2136
|
return (r.left < t.right || e >= 0 && I(r.left, t.right, e)) && (t.left < r.right || e >= 0 && I(t.left, r.right, e)) && (r.top < t.bottom || e >= 0 && I(r.top, t.bottom, e)) && (t.top < r.bottom || e >= 0 && I(t.top, r.bottom, e));
|
|
2137
2137
|
}
|
|
2138
2138
|
function I(r, t, e) {
|
|
2139
2139
|
return Math.abs(r - t) <= e;
|
|
2140
2140
|
}
|
|
2141
|
-
|
|
2142
|
-
function Ut(r) {
|
|
2141
|
+
function Wt(r) {
|
|
2143
2142
|
const t = {}, e = r.document.documentElement.style;
|
|
2144
2143
|
for (const i in r.document.documentElement.style)
|
|
2145
2144
|
Object.hasOwn(e, i) && !Number.isNaN(Number.parseInt(i)) && (t[e[i]] = e.getPropertyValue(e[i]));
|
|
2146
2145
|
return t;
|
|
2147
2146
|
}
|
|
2148
|
-
function
|
|
2149
|
-
const e =
|
|
2147
|
+
function xe(r, t) {
|
|
2148
|
+
const e = Wt(r);
|
|
2150
2149
|
Object.keys(e).forEach((i) => {
|
|
2151
2150
|
t.hasOwnProperty(i) || mt(r, i);
|
|
2152
2151
|
}), Object.entries(t).forEach(([i, s]) => {
|
|
2153
2152
|
e[i] !== s && it(r, i, s);
|
|
2154
2153
|
});
|
|
2155
2154
|
}
|
|
2156
|
-
function
|
|
2155
|
+
function gt(r, t) {
|
|
2157
2156
|
return r.document.documentElement.style.getPropertyValue(t);
|
|
2158
2157
|
}
|
|
2159
2158
|
function it(r, t, e) {
|
|
@@ -2162,23 +2161,23 @@ function it(r, t, e) {
|
|
|
2162
2161
|
function mt(r, t) {
|
|
2163
2162
|
r.document.documentElement.style.removeProperty(t);
|
|
2164
2163
|
}
|
|
2165
|
-
let rt = null,
|
|
2166
|
-
const G = { r: 255, g: 255, b: 255, a: 1 }, V = /* @__PURE__ */ new Map(),
|
|
2164
|
+
let rt = null, yt = null, Z = 0;
|
|
2165
|
+
const G = { r: 255, g: 255, b: 255, a: 1 }, V = /* @__PURE__ */ new Map(), je = () => {
|
|
2167
2166
|
if (!rt)
|
|
2168
2167
|
if (typeof OffscreenCanvas < "u")
|
|
2169
|
-
rt = new OffscreenCanvas(5, 5),
|
|
2168
|
+
rt = new OffscreenCanvas(5, 5), yt = rt.getContext("2d", {
|
|
2170
2169
|
willReadFrequently: !0,
|
|
2171
2170
|
desynchronized: !0
|
|
2172
2171
|
});
|
|
2173
2172
|
else {
|
|
2174
2173
|
const r = document.createElement("canvas");
|
|
2175
|
-
r.width = 5, r.height = 5, rt = r,
|
|
2174
|
+
r.width = 5, r.height = 5, rt = r, yt = r.getContext("2d", {
|
|
2176
2175
|
willReadFrequently: !0,
|
|
2177
2176
|
desynchronized: !0
|
|
2178
2177
|
});
|
|
2179
2178
|
}
|
|
2180
|
-
return
|
|
2181
|
-
},
|
|
2179
|
+
return yt;
|
|
2180
|
+
}, ti = (r) => {
|
|
2182
2181
|
if (!r) return !0;
|
|
2183
2182
|
const t = r.trim().toLowerCase();
|
|
2184
2183
|
return t.startsWith("var(") || [
|
|
@@ -2201,13 +2200,13 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, V = /* @__PURE__ */ new Map(), ti =
|
|
|
2201
2200
|
console.warn(
|
|
2202
2201
|
`[Decorator] Could not parse color: "${r}". ${t} Falling back to ${JSON.stringify(G)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
|
|
2203
2202
|
);
|
|
2204
|
-
},
|
|
2203
|
+
}, wt = (r, t = null) => {
|
|
2205
2204
|
const e = t ? `${r}|${t}` : r, i = V.get(e);
|
|
2206
2205
|
if (i !== void 0)
|
|
2207
2206
|
return i ?? G;
|
|
2208
|
-
if (
|
|
2207
|
+
if (ti(r))
|
|
2209
2208
|
return ot(r, "Unsupported color format or special value."), V.set(e, null), G;
|
|
2210
|
-
const s =
|
|
2209
|
+
const s = je();
|
|
2211
2210
|
if (!s)
|
|
2212
2211
|
return ot(r, "Could not get canvas context."), V.set(e, null), G;
|
|
2213
2212
|
try {
|
|
@@ -2224,29 +2223,29 @@ const G = { r: 255, g: 255, b: 255, a: 1 }, V = /* @__PURE__ */ new Map(), ti =
|
|
|
2224
2223
|
} catch (n) {
|
|
2225
2224
|
return ot(r, `Error: ${n instanceof Error ? n.message : String(n)}`), V.set(e, null), G;
|
|
2226
2225
|
}
|
|
2227
|
-
},
|
|
2226
|
+
}, bt = (r) => {
|
|
2228
2227
|
const t = r / 255;
|
|
2229
2228
|
return t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
|
|
2230
|
-
},
|
|
2231
|
-
const t =
|
|
2229
|
+
}, re = (r) => {
|
|
2230
|
+
const t = bt(r.r), e = bt(r.g), i = bt(r.b);
|
|
2232
2231
|
return 0.2126 * t + 0.7152 * e + 0.0722 * i;
|
|
2233
|
-
},
|
|
2234
|
-
const e = typeof r == "string" ?
|
|
2232
|
+
}, oe = (r, t) => {
|
|
2233
|
+
const e = typeof r == "string" ? wt(r) : r, i = typeof t == "string" ? wt(t) : t, s = re(e), n = re(i), o = Math.max(s, n), a = Math.min(s, n);
|
|
2235
2234
|
return (o + 0.05) / (a + 0.05);
|
|
2236
2235
|
}, Et = (r, t = null) => {
|
|
2237
|
-
const e =
|
|
2236
|
+
const e = wt(r, t), i = oe(e, { r: 255, g: 255, b: 255, a: 1 }), s = oe(e, { r: 0, g: 0, b: 0, a: 1 });
|
|
2238
2237
|
return i > s;
|
|
2239
|
-
},
|
|
2240
|
-
var
|
|
2241
|
-
const
|
|
2242
|
-
class
|
|
2238
|
+
}, ei = (r, t = null) => Et(r, t) ? "white" : "black", ae = "#FFFF00";
|
|
2239
|
+
var ii = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(ii || {}), si = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(si || {});
|
|
2240
|
+
const ni = () => "Highlight" in window, le = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2241
|
+
class ri {
|
|
2243
2242
|
/**
|
|
2244
2243
|
* Creates a DecorationGroup object
|
|
2245
2244
|
* @param id Unique HTML ID-adhering name of the group
|
|
2246
2245
|
* @param name Human-readable name of the group
|
|
2247
2246
|
*/
|
|
2248
2247
|
constructor(t, e, i, s) {
|
|
2249
|
-
this.wnd = t, this.comms = e, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0,
|
|
2248
|
+
this.wnd = t, this.comms = e, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, ni() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2250
2249
|
}
|
|
2251
2250
|
get activeable() {
|
|
2252
2251
|
return this.activateable;
|
|
@@ -2265,7 +2264,7 @@ class oi {
|
|
|
2265
2264
|
return;
|
|
2266
2265
|
}
|
|
2267
2266
|
const s = i.commonAncestorContainer;
|
|
2268
|
-
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (
|
|
2267
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (le.includes(s.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(le.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (s.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
|
|
2269
2268
|
const n = {
|
|
2270
2269
|
decoration: t,
|
|
2271
2270
|
id: e,
|
|
@@ -2306,16 +2305,16 @@ class oi {
|
|
|
2306
2305
|
experimentalLayout(t) {
|
|
2307
2306
|
const [e, i] = this.requireContainer(!0);
|
|
2308
2307
|
i.add(t.range);
|
|
2309
|
-
const s =
|
|
2308
|
+
const s = gt(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), n = t.decoration?.style?.tint ?? ae;
|
|
2310
2309
|
e.innerHTML = `
|
|
2311
2310
|
::highlight(${this.id}) {
|
|
2312
|
-
color: ${
|
|
2311
|
+
color: ${ei(n, s)};
|
|
2313
2312
|
background-color: ${n};
|
|
2314
2313
|
}`;
|
|
2315
2314
|
}
|
|
2316
2315
|
/**
|
|
2317
2316
|
* Layouts a single DecorationItem.
|
|
2318
|
-
* @param item
|
|
2317
|
+
* @param item
|
|
2319
2318
|
*/
|
|
2320
2319
|
layout(t) {
|
|
2321
2320
|
if (this.experimentalHighlights && !this.notTextFlag?.has(t.id))
|
|
@@ -2344,10 +2343,10 @@ class oi {
|
|
|
2344
2343
|
const m = this.getCurrentDarkMode();
|
|
2345
2344
|
g.innerHTML = `
|
|
2346
2345
|
<div
|
|
2347
|
-
data-readium="true"
|
|
2346
|
+
data-readium="true"
|
|
2348
2347
|
class="readium-highlight"
|
|
2349
2348
|
style="${[
|
|
2350
|
-
`background-color: ${t.decoration?.style?.tint ??
|
|
2349
|
+
`background-color: ${t.decoration?.style?.tint ?? ae} !important`,
|
|
2351
2350
|
//"opacity: 0.3 !important",
|
|
2352
2351
|
`mix-blend-mode: ${m ? "exclusion" : "multiply"} !important`,
|
|
2353
2352
|
"opacity: 1 !important",
|
|
@@ -2356,17 +2355,17 @@ class oi {
|
|
|
2356
2355
|
>
|
|
2357
2356
|
</div>
|
|
2358
2357
|
`.trim();
|
|
2359
|
-
const
|
|
2358
|
+
const v = g.content.firstElementChild;
|
|
2360
2359
|
if (t.decoration?.style?.layout === "bounds") {
|
|
2361
|
-
const f =
|
|
2360
|
+
const f = v.cloneNode(!0);
|
|
2362
2361
|
f.style.setProperty("pointer-events", "none"), h(f, u, u), e.append(f);
|
|
2363
2362
|
} else {
|
|
2364
|
-
let f =
|
|
2363
|
+
let f = qe(
|
|
2365
2364
|
t.range
|
|
2366
2365
|
);
|
|
2367
2366
|
f = f.sort((p, b) => p.top < b.top ? -1 : p.top > b.top ? 1 : 0);
|
|
2368
2367
|
for (let p of f) {
|
|
2369
|
-
const b =
|
|
2368
|
+
const b = v.cloneNode(!0);
|
|
2370
2369
|
b.style.setProperty("pointer-events", "none"), h(b, p, u), e.append(b);
|
|
2371
2370
|
}
|
|
2372
2371
|
}
|
|
@@ -2394,7 +2393,7 @@ class oi {
|
|
|
2394
2393
|
return this.container || (this.container = this.wnd.document.createElement("div"), this.container.setAttribute("id", this.id), this.container.dataset.group = this.name, this.container.dataset.readium = "true", this.container.style.setProperty("pointer-events", "none"), this.container.style.display = "contents", this.wnd.document.body.append(this.container)), this.container;
|
|
2395
2394
|
}
|
|
2396
2395
|
getCurrentDarkMode() {
|
|
2397
|
-
return
|
|
2396
|
+
return gt(this.wnd, "--USER__appearance") === "readium-night-on" || Et(gt(this.wnd, "--USER__backgroundColor")) || Et(this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"));
|
|
2398
2397
|
}
|
|
2399
2398
|
/**
|
|
2400
2399
|
* Removes the group container.
|
|
@@ -2430,7 +2429,7 @@ const Q = class Q extends X {
|
|
|
2430
2429
|
mount(t, e) {
|
|
2431
2430
|
return this.wnd = t, e.register("decorate", Q.moduleName, (i, s) => {
|
|
2432
2431
|
const n = i;
|
|
2433
|
-
n.decoration && n.decoration.locator && (n.decoration.locator = W.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new
|
|
2432
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = W.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new ri(
|
|
2434
2433
|
t,
|
|
2435
2434
|
e,
|
|
2436
2435
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2472,8 +2471,8 @@ const Q = class Q extends X {
|
|
|
2472
2471
|
}
|
|
2473
2472
|
};
|
|
2474
2473
|
Q.moduleName = "decorator";
|
|
2475
|
-
let
|
|
2476
|
-
const
|
|
2474
|
+
let St = Q;
|
|
2475
|
+
const ce = "readium-snapper-style", j = class j extends X {
|
|
2477
2476
|
constructor() {
|
|
2478
2477
|
super(...arguments), this.protected = !1;
|
|
2479
2478
|
}
|
|
@@ -2486,34 +2485,34 @@ const he = "readium-snapper-style", j = class j extends X {
|
|
|
2486
2485
|
}
|
|
2487
2486
|
mount(t, e) {
|
|
2488
2487
|
const i = t.document.createElement("style");
|
|
2489
|
-
return i.dataset.readium = "true", i.id =
|
|
2488
|
+
return i.dataset.readium = "true", i.id = ce, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", j.moduleName, (s, n) => {
|
|
2490
2489
|
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2491
2490
|
}), e.register("unprotect", j.moduleName, (s, n) => {
|
|
2492
2491
|
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2493
2492
|
}), e.log("Snapper Mounted"), !0;
|
|
2494
2493
|
}
|
|
2495
2494
|
unmount(t, e) {
|
|
2496
|
-
return t.document.getElementById(
|
|
2495
|
+
return t.document.getElementById(ce)?.remove(), e.log("Snapper Unmounted"), !0;
|
|
2497
2496
|
}
|
|
2498
2497
|
};
|
|
2499
2498
|
j.moduleName = "snapper";
|
|
2500
2499
|
let st = j;
|
|
2501
|
-
function
|
|
2500
|
+
function B(r) {
|
|
2502
2501
|
return r.document.body.dir.toLowerCase() === "rtl";
|
|
2503
2502
|
}
|
|
2504
|
-
function
|
|
2503
|
+
function Te(r) {
|
|
2505
2504
|
return parseInt(
|
|
2506
2505
|
r.getComputedStyle(
|
|
2507
2506
|
r.document.documentElement
|
|
2508
2507
|
).getPropertyValue("column-count")
|
|
2509
2508
|
);
|
|
2510
2509
|
}
|
|
2511
|
-
function
|
|
2510
|
+
function he(r) {
|
|
2512
2511
|
const t = getComputedStyle(r), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
|
|
2513
2512
|
return r.clientHeight - e - i;
|
|
2514
2513
|
}
|
|
2515
|
-
function
|
|
2516
|
-
const t =
|
|
2514
|
+
function de(r) {
|
|
2515
|
+
const t = Te(r);
|
|
2517
2516
|
if (!t)
|
|
2518
2517
|
return !1;
|
|
2519
2518
|
const e = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
@@ -2523,22 +2522,22 @@ function ue(r) {
|
|
|
2523
2522
|
if (d > 0)
|
|
2524
2523
|
for (let h = 0; h < d; h++) {
|
|
2525
2524
|
const u = r.document.createElement("div");
|
|
2526
|
-
u.setAttribute("id", `readium-virtual-page-${h}`), u.dataset.readium = "true", CSS.supports("break-before", "column") ? u.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (u.style.breakInside = "avoid-column"), u.style.height =
|
|
2525
|
+
u.setAttribute("id", `readium-virtual-page-${h}`), u.dataset.readium = "true", CSS.supports("break-before", "column") ? u.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (u.style.breakInside = "avoid-column"), u.style.height = he(r.document.documentElement) + "px"), u.innerHTML = "​", r.document.body.appendChild(u);
|
|
2527
2526
|
}
|
|
2528
2527
|
return i !== d;
|
|
2529
2528
|
}
|
|
2530
|
-
function
|
|
2529
|
+
function Pe(r) {
|
|
2531
2530
|
const t = r.document.createElement("style");
|
|
2532
2531
|
t.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(t), r.document.body.removeChild(t);
|
|
2533
2532
|
}
|
|
2534
|
-
function
|
|
2533
|
+
function oi(r) {
|
|
2535
2534
|
return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
|
|
2536
2535
|
}
|
|
2537
|
-
function
|
|
2536
|
+
function A(r) {
|
|
2538
2537
|
const t = r.getSelection();
|
|
2539
2538
|
t && t.removeAllRanges();
|
|
2540
2539
|
}
|
|
2541
|
-
const
|
|
2540
|
+
const ai = [
|
|
2542
2541
|
"a",
|
|
2543
2542
|
"audio",
|
|
2544
2543
|
"button",
|
|
@@ -2552,35 +2551,35 @@ const li = [
|
|
|
2552
2551
|
"textarea",
|
|
2553
2552
|
"video"
|
|
2554
2553
|
];
|
|
2555
|
-
function
|
|
2556
|
-
return
|
|
2554
|
+
function Ne(r) {
|
|
2555
|
+
return ai.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && r.getAttribute("contenteditable")?.toLowerCase() !== "false" ? r : r.parentElement ? Ne(r.parentElement) : null;
|
|
2557
2556
|
}
|
|
2558
|
-
function
|
|
2559
|
-
const e =
|
|
2557
|
+
function Ut(r, t) {
|
|
2558
|
+
const e = Le(r, r.document.body, t), i = r._readium_cssSelectorGenerator.getCssSelector(e, {
|
|
2560
2559
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2561
2560
|
});
|
|
2562
2561
|
return new W({
|
|
2563
2562
|
href: "#",
|
|
2564
2563
|
type: "application/xhtml+xml",
|
|
2565
|
-
locations: new
|
|
2564
|
+
locations: new C({
|
|
2566
2565
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2567
2566
|
["cssSelector", i]
|
|
2568
2567
|
])
|
|
2569
2568
|
}),
|
|
2570
|
-
text: new
|
|
2569
|
+
text: new H({
|
|
2571
2570
|
highlight: e.textContent || void 0
|
|
2572
2571
|
})
|
|
2573
2572
|
});
|
|
2574
2573
|
}
|
|
2575
|
-
function
|
|
2574
|
+
function Le(r, t, e) {
|
|
2576
2575
|
for (var i = 0; i < t.children.length; i++) {
|
|
2577
2576
|
const s = t.children[i];
|
|
2578
|
-
if (!
|
|
2579
|
-
return
|
|
2577
|
+
if (!hi(s) && li(r, s, e))
|
|
2578
|
+
return ci(r, s) ? s : Le(r, s, e);
|
|
2580
2579
|
}
|
|
2581
2580
|
return t;
|
|
2582
2581
|
}
|
|
2583
|
-
function
|
|
2582
|
+
function li(r, t, e) {
|
|
2584
2583
|
if (t === document.body || t === document.documentElement)
|
|
2585
2584
|
return !0;
|
|
2586
2585
|
if (!document || !document.documentElement || !document.body)
|
|
@@ -2588,11 +2587,11 @@ function ci(r, t, e) {
|
|
|
2588
2587
|
const i = t.getBoundingClientRect();
|
|
2589
2588
|
return e ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
|
|
2590
2589
|
}
|
|
2591
|
-
function
|
|
2590
|
+
function ci(r, t) {
|
|
2592
2591
|
const e = t.getBoundingClientRect();
|
|
2593
2592
|
return e.top >= 0 && e.left >= 0 && e.bottom <= r.innerHeight && e.right <= r.innerWidth;
|
|
2594
2593
|
}
|
|
2595
|
-
function
|
|
2594
|
+
function hi(r) {
|
|
2596
2595
|
const t = getComputedStyle(r);
|
|
2597
2596
|
if (t) {
|
|
2598
2597
|
const e = t.getPropertyValue("display");
|
|
@@ -2601,7 +2600,7 @@ function di(r) {
|
|
|
2601
2600
|
}
|
|
2602
2601
|
return !1;
|
|
2603
2602
|
}
|
|
2604
|
-
const
|
|
2603
|
+
const di = {
|
|
2605
2604
|
maxVelocity: 200,
|
|
2606
2605
|
// Reasonable default for human-like scrolling (pixels/ms)
|
|
2607
2606
|
minVariance: 0.01,
|
|
@@ -2612,7 +2611,7 @@ const ui = {
|
|
|
2612
2611
|
// Reasonable default for detecting patterns
|
|
2613
2612
|
maxConsistentScrolls: 15
|
|
2614
2613
|
// Balanced threshold for flagging
|
|
2615
|
-
},
|
|
2614
|
+
}, Oe = {
|
|
2616
2615
|
maxVelocity: 200,
|
|
2617
2616
|
// Extremely fast scrolling (pixels/ms)
|
|
2618
2617
|
minVariance: 1e-5,
|
|
@@ -2623,20 +2622,20 @@ const ui = {
|
|
|
2623
2622
|
// Only trigger on near-perfect patterns
|
|
2624
2623
|
maxConsistentScrolls: 20
|
|
2625
2624
|
// Need many consistent scrolls
|
|
2626
|
-
},
|
|
2625
|
+
}, Re = {
|
|
2627
2626
|
maxSelectionsPerSecond: 500,
|
|
2628
2627
|
minVariance: 50,
|
|
2629
2628
|
historySize: 20
|
|
2630
|
-
},
|
|
2629
|
+
}, ui = {
|
|
2631
2630
|
enabled: !0,
|
|
2632
2631
|
maxSelectionPercent: 0.1,
|
|
2633
2632
|
minThreshold: 100,
|
|
2634
2633
|
absoluteMaxChars: 5e3,
|
|
2635
2634
|
historySize: 20
|
|
2636
2635
|
};
|
|
2637
|
-
class
|
|
2636
|
+
class Bt {
|
|
2638
2637
|
constructor(t = {}) {
|
|
2639
|
-
this.history = [], this.consistentScrollCount = 0, this.options = { ...
|
|
2638
|
+
this.history = [], this.consistentScrollCount = 0, this.options = { ...di, ...t };
|
|
2640
2639
|
}
|
|
2641
2640
|
analyze(t, e, i) {
|
|
2642
2641
|
if (i <= 0) return !1;
|
|
@@ -2655,9 +2654,9 @@ class Ht {
|
|
|
2655
2654
|
return this.resetAfterDetection(), !0;
|
|
2656
2655
|
} else
|
|
2657
2656
|
this.consistentScrollCount = Math.max(0, this.consistentScrollCount - 1);
|
|
2658
|
-
let m = 0,
|
|
2657
|
+
let m = 0, v = this.history[0].direction;
|
|
2659
2658
|
for (let p = 1; p < this.history.length; p++)
|
|
2660
|
-
this.history[p].direction !==
|
|
2659
|
+
this.history[p].direction !== v && (m++, v = this.history[p].direction);
|
|
2661
2660
|
return m / this.history.length > (this.options.minDirectionChanges || 0.3) ? (this.resetAfterDetection(), !0) : !1;
|
|
2662
2661
|
}
|
|
2663
2662
|
resetAfterDetection() {
|
|
@@ -2667,7 +2666,7 @@ class Ht {
|
|
|
2667
2666
|
this.history = [], this.consistentScrollCount = 0;
|
|
2668
2667
|
}
|
|
2669
2668
|
}
|
|
2670
|
-
const
|
|
2669
|
+
const ue = "readium-column-snapper-style", pi = 200, P = class P extends st {
|
|
2671
2670
|
constructor() {
|
|
2672
2671
|
super(...arguments), this.isSnapProtectionEnabled = !1, this.patternAnalyzer = null, this.lastTurnTime = 0, this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
|
|
2673
2672
|
}
|
|
@@ -2678,7 +2677,7 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2678
2677
|
return this.doc().scrollLeft > 0 ? this.doc().scrollLeft : this.alreadyScrollLeft;
|
|
2679
2678
|
}
|
|
2680
2679
|
snapOffset(t) {
|
|
2681
|
-
const e = t + (
|
|
2680
|
+
const e = t + (B(this.wnd) ? -1 : 1);
|
|
2682
2681
|
return e - e % this.wnd.innerWidth;
|
|
2683
2682
|
}
|
|
2684
2683
|
reportProgress() {
|
|
@@ -2691,7 +2690,7 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2691
2690
|
shake() {
|
|
2692
2691
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0) return;
|
|
2693
2692
|
const t = this.doc();
|
|
2694
|
-
t.classList.add(
|
|
2693
|
+
t.classList.add(B(this.wnd) ? "readium-bounce-l" : "readium-bounce-r");
|
|
2695
2694
|
const e = this.scrollOffset();
|
|
2696
2695
|
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
2697
2696
|
t.classList.remove("readium-bounce-l"), t.classList.remove("readium-bounce-r"), this.shakeTimeout = 0, this.doc().scrollLeft = e;
|
|
@@ -2705,24 +2704,22 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2705
2704
|
}
|
|
2706
2705
|
// Snaps the current offset to the page width.
|
|
2707
2706
|
snapCurrentOffset(t = !1, e = !1) {
|
|
2708
|
-
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o =
|
|
2707
|
+
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = Te(this.wnd), a = Math.min(Math.max(0, i), this.cachedScrollWidth), d = B(this.wnd) ? -1 : 1, h = (
|
|
2709
2708
|
// The hurdle to overcome in order to change pages
|
|
2710
2709
|
d * (this.wnd.innerWidth / 3) * (d * n > 0 ? 2 : 1)
|
|
2711
2710
|
), u = this.snapOffset(a + h), g = u > this.scrollOffset() ? "right" : "left";
|
|
2712
2711
|
if (this.checkSuspiciousSnap(g, Math.abs(u - this.scrollOffset())), t && u !== this.scrollOffset()) {
|
|
2713
2712
|
this.snappingCancelled = !1;
|
|
2714
|
-
const m = (b, x,
|
|
2713
|
+
const m = (b, x, _, q) => _ > q ? x : b + (x - b) * oi(_ / q), v = (
|
|
2715
2714
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2716
|
-
|
|
2715
|
+
pi * o
|
|
2717
2716
|
);
|
|
2718
2717
|
let f;
|
|
2719
2718
|
const p = (b) => {
|
|
2720
2719
|
if (this.snappingCancelled) return;
|
|
2721
2720
|
f || (f = b);
|
|
2722
|
-
const x = b - f,
|
|
2723
|
-
s.scrollLeft = q, this.overscroll !== 0 && (
|
|
2724
|
-
new CSSTranslate(CSS.px(-B), CSS.px(0), CSS.px(0))
|
|
2725
|
-
])) : s.style.transform = `translate3d(${-B}px, 0px, 0px)`), x < w ? this.wnd.requestAnimationFrame(p) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = u, e || this.reportProgress());
|
|
2721
|
+
const x = b - f, _ = m(this.overscroll, 0, x, v), q = m(i, u, x, v);
|
|
2722
|
+
s.scrollLeft = q, this.overscroll !== 0 && (s.style.transform = `translate3d(${-_}px, 0px, 0px)`), x < v ? this.wnd.requestAnimationFrame(p) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = u, e || this.reportProgress());
|
|
2726
2723
|
};
|
|
2727
2724
|
this.wnd.requestAnimationFrame(p);
|
|
2728
2725
|
} else
|
|
@@ -2762,16 +2759,12 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2762
2759
|
}
|
|
2763
2760
|
onTouchMove(t) {
|
|
2764
2761
|
if (this.touchState === 0) return;
|
|
2765
|
-
this.touchState === 1 && (this.touchState = 2,
|
|
2762
|
+
this.touchState === 1 && (this.touchState = 2, A(this.wnd)), this.endingX = t.touches[0].clientX;
|
|
2766
2763
|
const e = this.dragOffset(), i = this.alreadyScrollLeft + e;
|
|
2767
|
-
i < 0 ? (this.overscroll = i,
|
|
2768
|
-
new CSSTranslate(CSS.px(-i), CSS.px(0), CSS.px(0))
|
|
2769
|
-
])) : this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : i + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = i, gt() ? this.doc().attributeStyleMap.set("transform", new CSSTransformValue([
|
|
2770
|
-
new CSSTranslate(CSS.px(-i), CSS.px(0), CSS.px(0))
|
|
2771
|
-
])) : this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + e);
|
|
2764
|
+
i < 0 ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + e);
|
|
2772
2765
|
}
|
|
2773
2766
|
enableSnapProtection() {
|
|
2774
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
2767
|
+
this.patternAnalyzer || (this.patternAnalyzer = new Bt({
|
|
2775
2768
|
maxVelocity: this.wnd.innerWidth,
|
|
2776
2769
|
// page width
|
|
2777
2770
|
minVariance: 0.1,
|
|
@@ -2797,7 +2790,7 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2797
2790
|
if (this.wnd = t, this.comms = e, !super.mount(t, e)) return !1;
|
|
2798
2791
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
2799
2792
|
const i = t.document.createElement("style");
|
|
2800
|
-
i.dataset.readium = "true", i.id =
|
|
2793
|
+
i.dataset.readium = "true", i.id = ue, i.textContent = `
|
|
2801
2794
|
@keyframes readium-bounce-l-animation {
|
|
2802
2795
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2803
2796
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2827,20 +2820,20 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2827
2820
|
* {
|
|
2828
2821
|
scrollbar-width: none; /* for Firefox */
|
|
2829
2822
|
}
|
|
2830
|
-
|
|
2823
|
+
|
|
2831
2824
|
body::-webkit-scrollbar {
|
|
2832
2825
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2833
2826
|
}
|
|
2834
2827
|
`, t.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2835
2828
|
t.requestAnimationFrame(() => {
|
|
2836
|
-
t &&
|
|
2829
|
+
t && de(t);
|
|
2837
2830
|
}), this.onWidthChange();
|
|
2838
2831
|
}), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((n) => {
|
|
2839
2832
|
for (const o of n)
|
|
2840
2833
|
if (o.target === this.wnd.document.documentElement) {
|
|
2841
2834
|
const a = o.oldValue, d = o.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, u = a?.match(h), g = d?.match(h);
|
|
2842
2835
|
(!u && !g || u && !g || u && g && u[1] !== g[1]) && (t.requestAnimationFrame(() => {
|
|
2843
|
-
t &&
|
|
2836
|
+
t && de(t);
|
|
2844
2837
|
}), this.onWidthChange());
|
|
2845
2838
|
} else
|
|
2846
2839
|
t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
@@ -2861,8 +2854,8 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2861
2854
|
}
|
|
2862
2855
|
this.wnd.requestAnimationFrame(() => {
|
|
2863
2856
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2864
|
-
const d = this.cachedScrollWidth, h =
|
|
2865
|
-
this.doc().scrollLeft = this.snapOffset(u), this.reportProgress(),
|
|
2857
|
+
const d = this.cachedScrollWidth, h = B(t) ? -1 : 1, u = d * a * h;
|
|
2858
|
+
this.doc().scrollLeft = this.snapOffset(u), this.reportProgress(), A(this.wnd), o(!0);
|
|
2866
2859
|
});
|
|
2867
2860
|
}), e.register("go_id", P.moduleName, (n, o) => {
|
|
2868
2861
|
const a = t.document.getElementById(n);
|
|
@@ -2871,16 +2864,16 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2871
2864
|
return;
|
|
2872
2865
|
}
|
|
2873
2866
|
this.wnd.requestAnimationFrame(() => {
|
|
2874
|
-
this.doc().scrollLeft = this.snapOffset(a.getBoundingClientRect().left + t.scrollX), this.reportProgress(),
|
|
2867
|
+
this.doc().scrollLeft = this.snapOffset(a.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), o(!0);
|
|
2875
2868
|
});
|
|
2876
2869
|
}), e.register("go_text", P.moduleName, (n, o) => {
|
|
2877
2870
|
let a;
|
|
2878
2871
|
Array.isArray(n) && (n.length > 1 && (a = n[1]), n = n[0]);
|
|
2879
|
-
const d =
|
|
2872
|
+
const d = H.deserialize(n), h = pt(this.wnd.document, new W({
|
|
2880
2873
|
href: t.location.href,
|
|
2881
2874
|
type: "text/html",
|
|
2882
2875
|
text: d,
|
|
2883
|
-
locations: a ? new
|
|
2876
|
+
locations: a ? new C({
|
|
2884
2877
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2885
2878
|
["cssSelector", a]
|
|
2886
2879
|
])
|
|
@@ -2891,35 +2884,35 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2891
2884
|
return;
|
|
2892
2885
|
}
|
|
2893
2886
|
this.wnd.requestAnimationFrame(() => {
|
|
2894
|
-
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + t.scrollX), this.reportProgress(),
|
|
2887
|
+
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + t.scrollX), this.reportProgress(), A(this.wnd), o(!0);
|
|
2895
2888
|
});
|
|
2896
2889
|
}), e.register("go_end", P.moduleName, (n, o) => {
|
|
2897
|
-
const a =
|
|
2890
|
+
const a = B(t) ? -1 : 1;
|
|
2898
2891
|
this.wnd.requestAnimationFrame(() => {
|
|
2899
2892
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2900
2893
|
const d = this.cachedScrollWidth * a;
|
|
2901
2894
|
if (this.doc().scrollLeft === d) return o(!1);
|
|
2902
|
-
this.doc().scrollLeft = this.snapOffset(d), this.reportProgress(),
|
|
2895
|
+
this.doc().scrollLeft = this.snapOffset(d), this.reportProgress(), A(this.wnd), o(!0);
|
|
2903
2896
|
});
|
|
2904
2897
|
}), e.register("go_start", P.moduleName, (n, o) => {
|
|
2905
2898
|
this.wnd.requestAnimationFrame(() => {
|
|
2906
2899
|
if (this.doc().scrollLeft === 0) return o(!1);
|
|
2907
|
-
this.doc().scrollLeft = 0, this.reportProgress(),
|
|
2900
|
+
this.doc().scrollLeft = 0, this.reportProgress(), A(this.wnd), o(!0);
|
|
2908
2901
|
});
|
|
2909
2902
|
}), e.register("go_prev", P.moduleName, (n, o) => {
|
|
2910
2903
|
this.wnd.requestAnimationFrame(() => {
|
|
2911
2904
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2912
|
-
const a = t.scrollX - t.innerWidth, d =
|
|
2913
|
-
h && (this.reportProgress(),
|
|
2905
|
+
const a = t.scrollX - t.innerWidth, d = B(t) ? -(this.cachedScrollWidth - t.innerWidth) : 0, h = s(Math.max(a, d));
|
|
2906
|
+
h && (this.reportProgress(), A(this.wnd), this.checkSuspiciousSnap("left", this.wnd.innerWidth)), o(h);
|
|
2914
2907
|
});
|
|
2915
2908
|
}), e.register("go_next", P.moduleName, (n, o) => {
|
|
2916
2909
|
this.wnd.requestAnimationFrame(() => {
|
|
2917
2910
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2918
|
-
const a = t.scrollX + t.innerWidth, d =
|
|
2919
|
-
h && (this.reportProgress(),
|
|
2911
|
+
const a = t.scrollX + t.innerWidth, d = B(t) ? 0 : this.cachedScrollWidth - t.innerWidth, h = s(Math.min(a, d));
|
|
2912
|
+
h && (this.reportProgress(), A(this.wnd), this.checkSuspiciousSnap("right", this.wnd.innerWidth)), o(h);
|
|
2920
2913
|
});
|
|
2921
2914
|
}), e.register("unfocus", P.moduleName, (n, o) => {
|
|
2922
|
-
this.snappingCancelled = !0,
|
|
2915
|
+
this.snappingCancelled = !0, A(this.wnd), o(!0);
|
|
2923
2916
|
}), e.register("shake", P.moduleName, (n, o) => {
|
|
2924
2917
|
this.shake(), o(!0);
|
|
2925
2918
|
}), e.register("focus", P.moduleName, (n, o) => {
|
|
@@ -2927,18 +2920,18 @@ const pe = "readium-column-snapper-style", mi = 200, P = class P extends st {
|
|
|
2927
2920
|
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), o(!0);
|
|
2928
2921
|
});
|
|
2929
2922
|
}), e.register("first_visible_locator", P.moduleName, (n, o) => {
|
|
2930
|
-
const a =
|
|
2923
|
+
const a = Ut(t, !1);
|
|
2931
2924
|
this.comms.send("first_visible_locator", a.serialize()), o(!0);
|
|
2932
2925
|
}), t.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), t.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), t.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), t.document.addEventListener("touchstart", () => {
|
|
2933
2926
|
}), e.log("ColumnSnapper Mounted"), !0;
|
|
2934
2927
|
}
|
|
2935
2928
|
unmount(t, e) {
|
|
2936
|
-
return this.snappingCancelled = !0, e.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isSnapProtectionEnabled = !1), t.removeEventListener("touchstart", this.onTouchStarter), t.removeEventListener("touchend", this.onTouchEnder), t.removeEventListener("touchmove", this.onTouchMover), t.removeEventListener("orientationchange", this.onWidthChanger), t.removeEventListener("resize", this.onWidthChanger), t.document.getElementById(
|
|
2929
|
+
return this.snappingCancelled = !0, e.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isSnapProtectionEnabled = !1), t.removeEventListener("touchstart", this.onTouchStarter), t.removeEventListener("touchend", this.onTouchEnder), t.removeEventListener("touchmove", this.onTouchMover), t.removeEventListener("orientationchange", this.onWidthChanger), t.removeEventListener("resize", this.onWidthChanger), t.document.getElementById(ue)?.remove(), e.log("ColumnSnapper Unmounted"), super.unmount(t, e);
|
|
2937
2930
|
}
|
|
2938
2931
|
};
|
|
2939
2932
|
P.moduleName = "column_snapper";
|
|
2940
|
-
let
|
|
2941
|
-
const
|
|
2933
|
+
let At = P;
|
|
2934
|
+
const pe = "readium-scroll-snapper-style", N = class N extends st {
|
|
2942
2935
|
constructor() {
|
|
2943
2936
|
super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = (t) => {
|
|
2944
2937
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -2984,16 +2977,16 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
2984
2977
|
});
|
|
2985
2978
|
}
|
|
2986
2979
|
enableScrollProtection() {
|
|
2987
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
2980
|
+
this.patternAnalyzer || (this.patternAnalyzer = new Bt(Oe), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
2988
2981
|
}
|
|
2989
2982
|
mount(t, e) {
|
|
2990
2983
|
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
2991
2984
|
const i = t.document.createElement("style");
|
|
2992
|
-
return i.dataset.readium = "true", i.id =
|
|
2985
|
+
return i.dataset.readium = "true", i.id = pe, i.textContent = `
|
|
2993
2986
|
* {
|
|
2994
2987
|
scrollbar-width: none; /* for Firefox */
|
|
2995
2988
|
}
|
|
2996
|
-
|
|
2989
|
+
|
|
2997
2990
|
body::-webkit-scrollbar {
|
|
2998
2991
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2999
2992
|
}
|
|
@@ -3002,7 +2995,7 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
3002
2995
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
3003
2996
|
}, 50);
|
|
3004
2997
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", N.moduleName, () => {
|
|
3005
|
-
|
|
2998
|
+
Pe(this.wnd);
|
|
3006
2999
|
const s = this.doc().scrollTop;
|
|
3007
3000
|
s > 1 ? this.doc().scrollTop = s - 1 : this.doc().scrollTop = s + 1, this.doc().scrollTop = s;
|
|
3008
3001
|
}), e.register("go_progression", N.moduleName, (s, n) => {
|
|
@@ -3014,7 +3007,7 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
3014
3007
|
return;
|
|
3015
3008
|
}
|
|
3016
3009
|
this.wnd.requestAnimationFrame(() => {
|
|
3017
|
-
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(),
|
|
3010
|
+
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), A(this.wnd), n(!0);
|
|
3018
3011
|
});
|
|
3019
3012
|
}), e.register("go_id", N.moduleName, (s, n) => {
|
|
3020
3013
|
const o = t.document.getElementById(s);
|
|
@@ -3023,16 +3016,16 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
3023
3016
|
return;
|
|
3024
3017
|
}
|
|
3025
3018
|
this.wnd.requestAnimationFrame(() => {
|
|
3026
|
-
this.doc().scrollTop = o.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(),
|
|
3019
|
+
this.doc().scrollTop = o.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), n(!0);
|
|
3027
3020
|
});
|
|
3028
3021
|
}), e.register("go_text", N.moduleName, (s, n) => {
|
|
3029
3022
|
let o;
|
|
3030
3023
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
3031
|
-
const a =
|
|
3024
|
+
const a = H.deserialize(s), d = pt(this.wnd.document, new W({
|
|
3032
3025
|
href: t.location.href,
|
|
3033
3026
|
type: "text/html",
|
|
3034
3027
|
text: a,
|
|
3035
|
-
locations: o ? new
|
|
3028
|
+
locations: o ? new C({
|
|
3036
3029
|
otherLocations: /* @__PURE__ */ new Map([
|
|
3037
3030
|
["cssSelector", o]
|
|
3038
3031
|
])
|
|
@@ -3043,7 +3036,7 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
3043
3036
|
return;
|
|
3044
3037
|
}
|
|
3045
3038
|
this.wnd.requestAnimationFrame(() => {
|
|
3046
|
-
this.doc().scrollTop = d.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(),
|
|
3039
|
+
this.doc().scrollTop = d.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), n(!0);
|
|
3047
3040
|
});
|
|
3048
3041
|
}), e.register("go_start", N.moduleName, (s, n) => {
|
|
3049
3042
|
if (this.doc().scrollTop === 0) return n(!1);
|
|
@@ -3052,7 +3045,7 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
3052
3045
|
if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight) return n(!1);
|
|
3053
3046
|
this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), n(!0);
|
|
3054
3047
|
}), e.register("unfocus", N.moduleName, (s, n) => {
|
|
3055
|
-
|
|
3048
|
+
A(this.wnd), n(!0);
|
|
3056
3049
|
}), e.register("scroll_protection", N.moduleName, (s, n) => {
|
|
3057
3050
|
this.enableScrollProtection(), n(!0);
|
|
3058
3051
|
}), e.register([
|
|
@@ -3061,16 +3054,16 @@ const me = "readium-scroll-snapper-style", N = class N extends st {
|
|
|
3061
3054
|
], N.moduleName, (s, n) => n(!1)), e.register("focus", N.moduleName, (s, n) => {
|
|
3062
3055
|
this.reportProgress(), n(!0);
|
|
3063
3056
|
}), e.register("first_visible_locator", N.moduleName, (s, n) => {
|
|
3064
|
-
const o =
|
|
3057
|
+
const o = Ut(t, !0);
|
|
3065
3058
|
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
3066
3059
|
}), e.log("ScrollSnapper Mounted"), !0;
|
|
3067
3060
|
}
|
|
3068
3061
|
unmount(t, e) {
|
|
3069
|
-
return e.unregisterAll(N.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(
|
|
3062
|
+
return e.unregisterAll(N.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(pe)?.remove(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isScrollProtectionEnabled = !1), e.log("ScrollSnapper Unmounted"), !0;
|
|
3070
3063
|
}
|
|
3071
3064
|
};
|
|
3072
3065
|
N.moduleName = "scroll_snapper";
|
|
3073
|
-
let
|
|
3066
|
+
let Ct = N;
|
|
3074
3067
|
const L = class L extends st {
|
|
3075
3068
|
constructor() {
|
|
3076
3069
|
super(...arguments), this.patternAnalyzer = null, this.lastScrollTime = 0, this.isScrollProtectionEnabled = !1, this.initialScrollHandled = !1, this.isScrolling = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce = null, this.handleScroll = (t) => {
|
|
@@ -3117,7 +3110,7 @@ const L = class L extends st {
|
|
|
3117
3110
|
});
|
|
3118
3111
|
}
|
|
3119
3112
|
enableScrollProtection() {
|
|
3120
|
-
this.patternAnalyzer || (this.patternAnalyzer = new
|
|
3113
|
+
this.patternAnalyzer || (this.patternAnalyzer = new Bt(Oe), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
3121
3114
|
}
|
|
3122
3115
|
mount(t, e) {
|
|
3123
3116
|
return this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollTop = 0, this.isResizing = !1, this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), this.resizeObserver = new ResizeObserver(() => {
|
|
@@ -3125,7 +3118,7 @@ const L = class L extends st {
|
|
|
3125
3118
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
3126
3119
|
}, 50);
|
|
3127
3120
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", L.moduleName, () => {
|
|
3128
|
-
|
|
3121
|
+
Pe(this.wnd);
|
|
3129
3122
|
const i = this.doc().scrollTop;
|
|
3130
3123
|
i > 1 ? this.doc().scrollTop = i - 1 : this.doc().scrollTop = i + 1, this.doc().scrollTop = i;
|
|
3131
3124
|
}), e.register("go_progression", L.moduleName, (i, s) => {
|
|
@@ -3137,7 +3130,7 @@ const L = class L extends st {
|
|
|
3137
3130
|
return;
|
|
3138
3131
|
}
|
|
3139
3132
|
this.wnd.requestAnimationFrame(() => {
|
|
3140
|
-
this.doc().scrollTop = this.doc().offsetHeight * n, this.reportProgress(),
|
|
3133
|
+
this.doc().scrollTop = this.doc().offsetHeight * n, this.reportProgress(), A(this.wnd), s(!0);
|
|
3141
3134
|
});
|
|
3142
3135
|
}), e.register("go_id", L.moduleName, (i, s) => {
|
|
3143
3136
|
const n = t.document.getElementById(i);
|
|
@@ -3146,16 +3139,16 @@ const L = class L extends st {
|
|
|
3146
3139
|
return;
|
|
3147
3140
|
}
|
|
3148
3141
|
this.wnd.requestAnimationFrame(() => {
|
|
3149
|
-
this.doc().scrollTop = n.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(),
|
|
3142
|
+
this.doc().scrollTop = n.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), s(!0);
|
|
3150
3143
|
});
|
|
3151
3144
|
}), e.register("go_text", L.moduleName, (i, s) => {
|
|
3152
3145
|
let n;
|
|
3153
3146
|
Array.isArray(i) && (i.length > 1 && (n = i[1]), i = i[0]);
|
|
3154
|
-
const o =
|
|
3147
|
+
const o = H.deserialize(i), a = pt(this.wnd.document, new W({
|
|
3155
3148
|
href: t.location.href,
|
|
3156
3149
|
type: "text/html",
|
|
3157
3150
|
text: o,
|
|
3158
|
-
locations: n ? new
|
|
3151
|
+
locations: n ? new C({
|
|
3159
3152
|
otherLocations: /* @__PURE__ */ new Map([
|
|
3160
3153
|
["cssSelector", n]
|
|
3161
3154
|
])
|
|
@@ -3166,7 +3159,7 @@ const L = class L extends st {
|
|
|
3166
3159
|
return;
|
|
3167
3160
|
}
|
|
3168
3161
|
this.wnd.requestAnimationFrame(() => {
|
|
3169
|
-
this.doc().scrollTop = a.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(),
|
|
3162
|
+
this.doc().scrollTop = a.getBoundingClientRect().top + t.scrollY - t.innerHeight / 2, this.reportProgress(), A(this.wnd), s(!0);
|
|
3170
3163
|
});
|
|
3171
3164
|
}), e.register("go_start", L.moduleName, (i, s) => {
|
|
3172
3165
|
if (this.doc().scrollTop === 0) return s(!1);
|
|
@@ -3175,7 +3168,7 @@ const L = class L extends st {
|
|
|
3175
3168
|
if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight) return s(!1);
|
|
3176
3169
|
this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), s(!0);
|
|
3177
3170
|
}), e.register("unfocus", L.moduleName, (i, s) => {
|
|
3178
|
-
|
|
3171
|
+
A(this.wnd), s(!0);
|
|
3179
3172
|
}), e.register("scroll_protection", L.moduleName, (i, s) => {
|
|
3180
3173
|
this.enableScrollProtection(), s(!0);
|
|
3181
3174
|
}), e.register([
|
|
@@ -3184,7 +3177,7 @@ const L = class L extends st {
|
|
|
3184
3177
|
], L.moduleName, (i, s) => s(!1)), e.register("focus", L.moduleName, (i, s) => {
|
|
3185
3178
|
this.reportProgress(), s(!0);
|
|
3186
3179
|
}), e.register("first_visible_locator", L.moduleName, (i, s) => {
|
|
3187
|
-
const n =
|
|
3180
|
+
const n = Ut(t, !0);
|
|
3188
3181
|
e.send("first_visible_locator", n.serialize()), s(!0);
|
|
3189
3182
|
}), e.log("WebPubSnapper Mounted"), !0;
|
|
3190
3183
|
}
|
|
@@ -3193,8 +3186,8 @@ const L = class L extends st {
|
|
|
3193
3186
|
}
|
|
3194
3187
|
};
|
|
3195
3188
|
L.moduleName = "webpub_snapper";
|
|
3196
|
-
let
|
|
3197
|
-
class
|
|
3189
|
+
let xt = L;
|
|
3190
|
+
class mi {
|
|
3198
3191
|
constructor(t, e) {
|
|
3199
3192
|
this.window = t, this.copyHistory = [], this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.options = e;
|
|
3200
3193
|
}
|
|
@@ -3234,8 +3227,8 @@ class fi {
|
|
|
3234
3227
|
this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.copyHistory = [], this.options.enabled = !1;
|
|
3235
3228
|
}
|
|
3236
3229
|
}
|
|
3237
|
-
class
|
|
3238
|
-
constructor(t =
|
|
3230
|
+
class fi {
|
|
3231
|
+
constructor(t = Re) {
|
|
3239
3232
|
this.options = t, this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3240
3233
|
}
|
|
3241
3234
|
analyze(t) {
|
|
@@ -3276,7 +3269,7 @@ class gi {
|
|
|
3276
3269
|
this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3277
3270
|
}
|
|
3278
3271
|
}
|
|
3279
|
-
class
|
|
3272
|
+
class gi {
|
|
3280
3273
|
/**
|
|
3281
3274
|
* Checks if the given keyboard event matches any of the provided key combinations
|
|
3282
3275
|
*/
|
|
@@ -3356,7 +3349,7 @@ class yi {
|
|
|
3356
3349
|
}
|
|
3357
3350
|
const $ = class $ extends X {
|
|
3358
3351
|
constructor() {
|
|
3359
|
-
super(...arguments), this.configApplied = !1, this.cleanupCallbacks = [], this.pointerMoved = !1, this.isContextMenuEnabled = !1, this.isDragAndDropEnabled = !1, this.isSelectionMonitoringEnabled = !1, this.isBulkCopyProtectionEnabled = !1, this.selectionAnalyzer = null, this.currentSelection = null, this.bulkCopyProtector = null, this.keyManager = new
|
|
3352
|
+
super(...arguments), this.configApplied = !1, this.cleanupCallbacks = [], this.pointerMoved = !1, this.isContextMenuEnabled = !1, this.isDragAndDropEnabled = !1, this.isSelectionMonitoringEnabled = !1, this.isBulkCopyProtectionEnabled = !1, this.selectionAnalyzer = null, this.currentSelection = null, this.bulkCopyProtector = null, this.keyManager = new gi(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
|
|
3360
3353
|
if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
|
|
3361
3354
|
return !0;
|
|
3362
3355
|
if (!this.bulkCopyProtector.shouldAllowCopy(t)) {
|
|
@@ -3402,6 +3395,8 @@ const $ = class $ extends X {
|
|
|
3402
3395
|
}
|
|
3403
3396
|
} else
|
|
3404
3397
|
this.currentSelection = null;
|
|
3398
|
+
}, this.onDragOver = (t) => {
|
|
3399
|
+
this.isDragAndDropEnabled && (t.preventDefault(), t.stopPropagation());
|
|
3405
3400
|
}, this.onDragStart = (t) => {
|
|
3406
3401
|
if (this.isDragAndDropEnabled) {
|
|
3407
3402
|
t.preventDefault();
|
|
@@ -3456,10 +3451,10 @@ const $ = class $ extends X {
|
|
|
3456
3451
|
!this.isContextMenuEnabled || !this.wnd || (this.wnd.document.removeEventListener("contextmenu", this.onContext), this.isContextMenuEnabled = !1);
|
|
3457
3452
|
}
|
|
3458
3453
|
addDragAndDropPrevention() {
|
|
3459
|
-
this.isDragAndDropEnabled || !this.wnd || (this.wnd.document.addEventListener("dragstart", this.onDragStart), this.wnd.document.addEventListener("drop", this.onDrop), this.isDragAndDropEnabled = !0);
|
|
3454
|
+
this.isDragAndDropEnabled || !this.wnd || (this.wnd.document.addEventListener("dragstart", this.onDragStart), this.wnd.document.addEventListener("dragover", this.onDragOver), this.wnd.document.addEventListener("drop", this.onDrop), this.isDragAndDropEnabled = !0);
|
|
3460
3455
|
}
|
|
3461
3456
|
removeDragAndDropPrevention() {
|
|
3462
|
-
!this.isDragAndDropEnabled || !this.wnd || (this.wnd.document.removeEventListener("dragstart", this.onDragStart), this.wnd.document.removeEventListener("drop", this.onDrop), this.isDragAndDropEnabled = !1);
|
|
3457
|
+
!this.isDragAndDropEnabled || !this.wnd || (this.wnd.document.removeEventListener("dragstart", this.onDragStart), this.wnd.document.removeEventListener("dragover", this.onDragOver), this.wnd.document.removeEventListener("drop", this.onDrop), this.isDragAndDropEnabled = !1);
|
|
3463
3458
|
}
|
|
3464
3459
|
enableKeyboardPeripherals(t = []) {
|
|
3465
3460
|
this.disableKeyboardPeripherals();
|
|
@@ -3477,16 +3472,16 @@ const $ = class $ extends X {
|
|
|
3477
3472
|
}
|
|
3478
3473
|
addBulkCopyProtection(t = {}) {
|
|
3479
3474
|
if (this.isBulkCopyProtectionEnabled || !this.wnd) return;
|
|
3480
|
-
const e =
|
|
3481
|
-
this.bulkCopyProtector = new
|
|
3475
|
+
const e = ui, i = t ? { ...e, ...t } : e;
|
|
3476
|
+
this.bulkCopyProtector = new mi(this.wnd, i), this.wnd.document.addEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.addEventListener("cut", this.preventBulkCopy, !0), this.isBulkCopyProtectionEnabled = !0;
|
|
3482
3477
|
}
|
|
3483
3478
|
removeBulkCopyProtection() {
|
|
3484
3479
|
!this.isBulkCopyProtectionEnabled || !this.wnd || (this.wnd.document.removeEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.removeEventListener("cut", this.preventBulkCopy, !0), this.bulkCopyProtector?.destroy(), this.bulkCopyProtector = null, this.isBulkCopyProtectionEnabled = !1);
|
|
3485
3480
|
}
|
|
3486
3481
|
addSelectionMonitoring(t) {
|
|
3487
3482
|
if (this.isSelectionMonitoringEnabled || !this.wnd) return;
|
|
3488
|
-
const e = t ||
|
|
3489
|
-
this.selectionAnalyzer = new
|
|
3483
|
+
const e = t || Re;
|
|
3484
|
+
this.selectionAnalyzer = new fi(e), this.wnd.document.addEventListener("selectionchange", this.handleSelection), this.isSelectionMonitoringEnabled = !0;
|
|
3490
3485
|
}
|
|
3491
3486
|
removeSelectionMonitoring() {
|
|
3492
3487
|
!this.isSelectionMonitoringEnabled || !this.wnd || (this.wnd.document.removeEventListener("selectionchange", this.handleSelection), this.selectionAnalyzer?.clear(), this.selectionAnalyzer = null, this.isSelectionMonitoringEnabled = !1);
|
|
@@ -3519,7 +3514,7 @@ const $ = class $ extends X {
|
|
|
3519
3514
|
y: t.clientY * i,
|
|
3520
3515
|
targetFrameSrc: this.wnd.location.href,
|
|
3521
3516
|
targetElement: t.target.outerHTML,
|
|
3522
|
-
interactiveElement:
|
|
3517
|
+
interactiveElement: Ne(t.target)?.outerHTML,
|
|
3523
3518
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(t.target)
|
|
3524
3519
|
}), this.pointerMoved = !1;
|
|
3525
3520
|
}
|
|
@@ -3577,7 +3572,7 @@ const $ = class $ extends X {
|
|
|
3577
3572
|
}
|
|
3578
3573
|
};
|
|
3579
3574
|
$.moduleName = "peripherals";
|
|
3580
|
-
let
|
|
3575
|
+
let Tt = $;
|
|
3581
3576
|
const tt = class tt extends X {
|
|
3582
3577
|
constructor() {
|
|
3583
3578
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
@@ -3628,7 +3623,7 @@ const tt = class tt extends X {
|
|
|
3628
3623
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
3629
3624
|
value: {
|
|
3630
3625
|
name: "readium-ts-toolkit",
|
|
3631
|
-
version: "2.3.1
|
|
3626
|
+
version: "2.3.1",
|
|
3632
3627
|
hasFeature: (s, n = "") => {
|
|
3633
3628
|
switch (s) {
|
|
3634
3629
|
case "dom-manipulation":
|
|
@@ -3677,7 +3672,7 @@ const tt = class tt extends X {
|
|
|
3677
3672
|
};
|
|
3678
3673
|
tt.moduleName = "setup";
|
|
3679
3674
|
let ut = tt;
|
|
3680
|
-
const
|
|
3675
|
+
const me = "readium-viewport", M = class M extends ut {
|
|
3681
3676
|
onViewportWidthChanged(t) {
|
|
3682
3677
|
const e = t.target;
|
|
3683
3678
|
it(e, "--RS__viewportWidth", `${e.innerWidth}px`);
|
|
@@ -3685,15 +3680,15 @@ const fe = "readium-viewport", M = class M extends ut {
|
|
|
3685
3680
|
mount(t, e) {
|
|
3686
3681
|
if (!super.mount(t, e)) return !1;
|
|
3687
3682
|
const i = t.document.createElement("meta");
|
|
3688
|
-
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id",
|
|
3683
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", me), i.setAttribute(
|
|
3689
3684
|
"content",
|
|
3690
3685
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3691
3686
|
), t.document.head.appendChild(i), t.addEventListener("orientationchange", this.onViewportWidthChanged), t.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
3692
3687
|
target: t
|
|
3693
3688
|
}), e.register("get_properties", M.moduleName, (s, n) => {
|
|
3694
|
-
|
|
3689
|
+
Wt(t), n(!0);
|
|
3695
3690
|
}), e.register("update_properties", M.moduleName, (s, n) => {
|
|
3696
|
-
s["--RS__viewportWidth"] = `${t.innerWidth}px`,
|
|
3691
|
+
s["--RS__viewportWidth"] = `${t.innerWidth}px`, xe(t, s), n(!0);
|
|
3697
3692
|
}), e.register("set_property", M.moduleName, (s, n) => {
|
|
3698
3693
|
const o = s;
|
|
3699
3694
|
it(t, o[0], o[1]), n(!0);
|
|
@@ -3704,17 +3699,17 @@ const fe = "readium-viewport", M = class M extends ut {
|
|
|
3704
3699
|
}), e.log("ReflowableSetup Mounted"), !0;
|
|
3705
3700
|
}
|
|
3706
3701
|
unmount(t, e) {
|
|
3707
|
-
return e.unregisterAll(M.moduleName), t.document.head.querySelector(`#${
|
|
3702
|
+
return e.unregisterAll(M.moduleName), t.document.head.querySelector(`#${me}`)?.remove(), t.removeEventListener("orientationchange", this.onViewportWidthChanged), e.log("ReflowableSetup Unmounted"), super.unmount(t, e);
|
|
3708
3703
|
}
|
|
3709
3704
|
};
|
|
3710
3705
|
M.moduleName = "reflowable_setup";
|
|
3711
|
-
let
|
|
3712
|
-
const
|
|
3706
|
+
let Pt = M;
|
|
3707
|
+
const fe = "readium-fixed-style", D = class D extends ut {
|
|
3713
3708
|
mount(t, e) {
|
|
3714
3709
|
if (!super.mount(t, e)) return !1;
|
|
3715
3710
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
3716
3711
|
const i = t.document.createElement("style");
|
|
3717
|
-
return i.id =
|
|
3712
|
+
return i.id = fe, i.dataset.readium = "true", i.textContent = `
|
|
3718
3713
|
html, body {
|
|
3719
3714
|
text-size-adjust: none;
|
|
3720
3715
|
-ms-text-size-adjust: none;
|
|
@@ -3732,7 +3727,7 @@ const ge = "readium-fixed-style", D = class D extends ut {
|
|
|
3732
3727
|
}), e.register("remove_property", D.moduleName, (s, n) => {
|
|
3733
3728
|
mt(t, s), n(!0);
|
|
3734
3729
|
}), e.register("first_visible_locator", D.moduleName, (s, n) => n(!1)), e.register("unfocus", D.moduleName, (s, n) => {
|
|
3735
|
-
|
|
3730
|
+
A(t), n(!0);
|
|
3736
3731
|
}), e.register([
|
|
3737
3732
|
"focus",
|
|
3738
3733
|
"go_next",
|
|
@@ -3747,11 +3742,11 @@ const ge = "readium-fixed-style", D = class D extends ut {
|
|
|
3747
3742
|
}), e.log("FixedSetup Mounted"), !0;
|
|
3748
3743
|
}
|
|
3749
3744
|
unmount(t, e) {
|
|
3750
|
-
return e.unregisterAll(D.moduleName), t.document.getElementById(
|
|
3745
|
+
return e.unregisterAll(D.moduleName), t.document.getElementById(fe)?.remove(), e.log("FixedSetup Unmounted"), super.unmount(t, e);
|
|
3751
3746
|
}
|
|
3752
3747
|
};
|
|
3753
3748
|
D.moduleName = "fixed_setup";
|
|
3754
|
-
let
|
|
3749
|
+
let Nt = D;
|
|
3755
3750
|
const k = class k extends X {
|
|
3756
3751
|
wndOnErr(t) {
|
|
3757
3752
|
this.comms?.send("error", {
|
|
@@ -3767,9 +3762,9 @@ const k = class k extends X {
|
|
|
3767
3762
|
this.wndOnErr,
|
|
3768
3763
|
!1
|
|
3769
3764
|
), e.register("get_properties", k.moduleName, (i, s) => {
|
|
3770
|
-
|
|
3765
|
+
Wt(t), s(!0);
|
|
3771
3766
|
}), e.register("update_properties", k.moduleName, (i, s) => {
|
|
3772
|
-
|
|
3767
|
+
xe(t, i), s(!0);
|
|
3773
3768
|
}), e.register("set_property", k.moduleName, (i, s) => {
|
|
3774
3769
|
const n = i;
|
|
3775
3770
|
it(t, n[0], n[1]), s(!0);
|
|
@@ -3784,7 +3779,7 @@ const k = class k extends X {
|
|
|
3784
3779
|
}
|
|
3785
3780
|
};
|
|
3786
3781
|
k.moduleName = "webpub_setup";
|
|
3787
|
-
let
|
|
3782
|
+
let Lt = k;
|
|
3788
3783
|
const et = class et extends X {
|
|
3789
3784
|
constructor() {
|
|
3790
3785
|
super(...arguments), this.styleElement = null, this.beforePrintHandler = null, this.configApplied = !1;
|
|
@@ -3822,13 +3817,13 @@ const et = class et extends X {
|
|
|
3822
3817
|
}
|
|
3823
3818
|
};
|
|
3824
3819
|
et.moduleName = "print_protection";
|
|
3825
|
-
let
|
|
3826
|
-
const
|
|
3820
|
+
let Ot = et;
|
|
3821
|
+
const yi = [
|
|
3827
3822
|
"fixed_setup",
|
|
3828
3823
|
"decorator",
|
|
3829
3824
|
"peripherals",
|
|
3830
3825
|
"print_protection"
|
|
3831
|
-
],
|
|
3826
|
+
], bi = [
|
|
3832
3827
|
"reflowable_setup",
|
|
3833
3828
|
"decorator",
|
|
3834
3829
|
"peripherals",
|
|
@@ -3841,25 +3836,25 @@ const bi = [
|
|
|
3841
3836
|
"decorator",
|
|
3842
3837
|
"peripherals",
|
|
3843
3838
|
"print_protection"
|
|
3844
|
-
],
|
|
3839
|
+
], ge = new Map([
|
|
3845
3840
|
// All modules go here
|
|
3846
|
-
Lt,
|
|
3847
3841
|
Nt,
|
|
3848
|
-
Ot,
|
|
3849
|
-
Tt,
|
|
3850
3842
|
Pt,
|
|
3843
|
+
Lt,
|
|
3844
|
+
xt,
|
|
3845
|
+
Tt,
|
|
3846
|
+
St,
|
|
3851
3847
|
At,
|
|
3852
3848
|
Ct,
|
|
3853
|
-
|
|
3854
|
-
Rt
|
|
3849
|
+
Ot
|
|
3855
3850
|
].map((r) => [r.moduleName, r]));
|
|
3856
|
-
class
|
|
3851
|
+
class wi {
|
|
3857
3852
|
/**
|
|
3858
3853
|
* @param wnd Window instance to operate on
|
|
3859
3854
|
* @param initialModules List of initial modules to load
|
|
3860
3855
|
*/
|
|
3861
3856
|
constructor(t = window, e = []) {
|
|
3862
|
-
this.loadedModules = [], this.wnd = t, this.comms = new
|
|
3857
|
+
this.loadedModules = [], this.wnd = t, this.comms = new ze(t);
|
|
3863
3858
|
const i = [...new Set(e)];
|
|
3864
3859
|
if (i.length) {
|
|
3865
3860
|
if (typeof t > "u")
|
|
@@ -3872,7 +3867,7 @@ class Si {
|
|
|
3872
3867
|
}
|
|
3873
3868
|
}
|
|
3874
3869
|
loadModule(t) {
|
|
3875
|
-
const e =
|
|
3870
|
+
const e = ge.get(t);
|
|
3876
3871
|
return e === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), e) : new e();
|
|
3877
3872
|
}
|
|
3878
3873
|
/**
|
|
@@ -3890,7 +3885,7 @@ class Si {
|
|
|
3890
3885
|
* @returns Success
|
|
3891
3886
|
*/
|
|
3892
3887
|
removeModule(t) {
|
|
3893
|
-
const e =
|
|
3888
|
+
const e = ge.get(t);
|
|
3894
3889
|
if (e === void 0)
|
|
3895
3890
|
return this.comms.log(`Module "${t}" does not exist in the library`), !1;
|
|
3896
3891
|
const i = this.loadedModules.findIndex((s) => s instanceof e);
|
|
@@ -3927,7 +3922,7 @@ const Ei = {
|
|
|
3927
3922
|
{ keyCode: 123, meta: !0, alt: !0 }
|
|
3928
3923
|
// F12+Meta+Alt
|
|
3929
3924
|
]
|
|
3930
|
-
},
|
|
3925
|
+
}, Si = {
|
|
3931
3926
|
type: "select_all",
|
|
3932
3927
|
keyCombos: [
|
|
3933
3928
|
{ keyCode: 65, meta: !0 },
|
|
@@ -3935,7 +3930,7 @@ const Ei = {
|
|
|
3935
3930
|
{ keyCode: 65, ctrl: !0 }
|
|
3936
3931
|
// A key (Ctrl+A)
|
|
3937
3932
|
]
|
|
3938
|
-
},
|
|
3933
|
+
}, Ai = {
|
|
3939
3934
|
type: "print",
|
|
3940
3935
|
keyCombos: [
|
|
3941
3936
|
{ keyCode: 80, meta: !0 },
|
|
@@ -3951,7 +3946,7 @@ const Ei = {
|
|
|
3951
3946
|
{ keyCode: 80, ctrl: !0, alt: !0 }
|
|
3952
3947
|
// P key (Ctrl+Alt+P)
|
|
3953
3948
|
]
|
|
3954
|
-
},
|
|
3949
|
+
}, Ci = {
|
|
3955
3950
|
type: "save",
|
|
3956
3951
|
keyCombos: [
|
|
3957
3952
|
{ keyCode: 83, meta: !0 },
|
|
@@ -3961,26 +3956,26 @@ const Ei = {
|
|
|
3961
3956
|
]
|
|
3962
3957
|
};
|
|
3963
3958
|
export {
|
|
3964
|
-
|
|
3959
|
+
mi as BulkCopyProtector,
|
|
3965
3960
|
K as COMMS_VERSION,
|
|
3966
|
-
|
|
3961
|
+
ze as Comms,
|
|
3967
3962
|
Ei as DEV_TOOLS,
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3963
|
+
St as Decorator,
|
|
3964
|
+
yi as FXLModules,
|
|
3965
|
+
gi as KeyCombinationManager,
|
|
3966
|
+
si as Layout,
|
|
3967
|
+
wi as Loader,
|
|
3973
3968
|
X as Module,
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3969
|
+
ge as ModuleLibrary,
|
|
3970
|
+
Ai as PRINT,
|
|
3971
|
+
Bt as PatternAnalyzer,
|
|
3972
|
+
Tt as Peripherals,
|
|
3973
|
+
Ot as PrintProtector,
|
|
3974
|
+
bi as ReflowableModules,
|
|
3975
|
+
Ci as SAVE,
|
|
3976
|
+
Si as SELECT_ALL,
|
|
3977
|
+
fi as SelectionAnalyzer,
|
|
3983
3978
|
vi as WebPubModules,
|
|
3984
|
-
|
|
3985
|
-
|
|
3979
|
+
ii as Width,
|
|
3980
|
+
De as mid
|
|
3986
3981
|
};
|