@readium/navigator 2.4.0-beta.1 → 2.4.0-beta.11
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 +771 -663
- package/dist/index.umd.cjs +22 -22
- package/package.json +1 -1
- package/src/audio/AudioNavigator.ts +181 -23
- package/src/audio/AudioPoolManager.ts +103 -82
- package/src/audio/engine/AudioEngine.ts +4 -14
- package/src/audio/engine/WebAudioEngine.ts +21 -137
- package/src/audio/protection/AudioNavigatorProtector.ts +38 -0
- package/src/epub/frame/FrameManager.ts +1 -1
- package/src/epub/fxl/FXLFrameManager.ts +1 -1
- package/src/preferences/Types.ts +2 -2
- package/src/protection/CopyProtector.ts +22 -0
- package/src/protection/DevToolsDetector.ts +1 -0
- package/src/protection/DragAndDropProtector.ts +34 -0
- package/src/protection/NavigatorProtector.ts +3 -3
- package/src/webpub/WebPubFrameManager.ts +1 -1
- package/src/webpub/WebPubNavigator.ts +6 -2
- package/types/src/audio/AudioNavigator.d.ts +42 -3
- package/types/src/audio/AudioPoolManager.d.ts +18 -39
- package/types/src/audio/engine/AudioEngine.d.ts +4 -12
- package/types/src/audio/engine/WebAudioEngine.d.ts +5 -12
- package/types/src/audio/protection/AudioNavigatorProtector.d.ts +8 -0
- package/types/src/protection/CopyProtector.d.ts +8 -0
- package/types/src/protection/DragAndDropProtector.d.ts +10 -0
- package/types/src/protection/NavigatorProtector.d.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ const _ = class _ {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
_.EPUB_A11Y_10_WCAG_20_A = new _("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-a"), _.EPUB_A11Y_10_WCAG_20_AA = new _("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aa"), _.EPUB_A11Y_10_WCAG_20_AAA = new _("http://www.idpf.org/epub/a11y/accessibility-20170105.html#wcag-aaa"), _.EPUB_A11Y_11_WCAG_20_A = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-a"), _.EPUB_A11Y_11_WCAG_20_AA = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aa"), _.EPUB_A11Y_11_WCAG_20_AAA = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.0-aaa"), _.EPUB_A11Y_11_WCAG_21_A = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-a"), _.EPUB_A11Y_11_WCAG_21_AA = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aa"), _.EPUB_A11Y_11_WCAG_21_AAA = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.1-aaa"), _.EPUB_A11Y_11_WCAG_22_A = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-a"), _.EPUB_A11Y_11_WCAG_22_AA = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aa"), _.EPUB_A11Y_11_WCAG_22_AAA = new _("https://www.w3.org/TR/epub-a11y-11#wcag-2.2-aaa");
|
|
38
|
-
let
|
|
38
|
+
let Ge = _;
|
|
39
39
|
const C = class C {
|
|
40
40
|
constructor(t) {
|
|
41
41
|
this.value = t;
|
|
@@ -55,7 +55,7 @@ const C = class C {
|
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
57
|
C.AUDITORY = new C("auditory"), C.CHART_ON_VISUAL = new C("chartOnVisual"), C.CHEM_ON_VISUAL = new C("chemOnVisual"), C.COLOR_DEPENDENT = new C("colorDependent"), C.DIAGRAM_ON_VISUAL = new C("diagramOnVisual"), C.MATH_ON_VISUAL = new C("mathOnVisual"), C.MUSIC_ON_VISUAL = new C("musicOnVisual"), C.TACTILE = new C("tactile"), C.TEXT_ON_VISUAL = new C("textOnVisual"), C.TEXTUAL = new C("textual"), C.VISUAL = new C("visual");
|
|
58
|
-
let
|
|
58
|
+
let $e = C;
|
|
59
59
|
const F = class F {
|
|
60
60
|
constructor(t) {
|
|
61
61
|
if (typeof t == "string") {
|
|
@@ -91,7 +91,7 @@ const F = class F {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
F.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]), F.AUDITORY = new F("auditory"), F.TACTILE = new F("tactile"), F.TEXTUAL = new F("textual"), F.VISUAL = new F("visual");
|
|
94
|
-
let
|
|
94
|
+
let Xe = F;
|
|
95
95
|
const f = class f {
|
|
96
96
|
constructor(t) {
|
|
97
97
|
this.value = t;
|
|
@@ -131,7 +131,7 @@ const x = class x {
|
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
133
|
x.FLASHING = new x("flashing"), x.NO_FLASHING_HAZARD = new x("noFlashingHazard"), x.UNKNOWN_FLASHING_HAZARD = new x("unknownFlashingHazard"), x.MOTION_SIMULATION = new x("motionSimulation"), x.NO_MOTION_SIMULATION_HAZARD = new x("noMotionSimulationHazard"), x.UNKNOWN_MOTION_SIMULATION_HAZARD = new x("unknownMotionSimulationHazard"), x.SOUND = new x("sound"), x.NO_SOUND_HAZARD = new x("noSoundHazard"), x.UNKNOWN_SOUND_HAZARD = new x("unknownSoundHazard"), x.UNKNOWN = new x("unknown"), x.NONE = new x("none");
|
|
134
|
-
let
|
|
134
|
+
let Ye = x;
|
|
135
135
|
const L = class L {
|
|
136
136
|
constructor(t) {
|
|
137
137
|
this.value = t;
|
|
@@ -151,10 +151,10 @@ const L = class L {
|
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
153
|
L.NONE = new L("none"), L.DOCUMENTED = new L("documented"), L.LEGAL = new L("legal"), L.TEMPORARY = new L("temporary"), L.TECHNICAL = new L("technical"), L.EAA_DISPROPORTIONATE_BURDEN = new L("eaa-disproportionate-burden"), L.EAA_FUNDAMENTAL_ALTERATION = new L("eaa-fundamental-alteration"), L.EAA_MICROENTERPRISE = new L("eaa-microenterprise"), L.EAA_TECHNICAL_IMPOSSIBILITY = new L("eaa-technical-impossibility"), L.EAA_TEMPORARY = new L("eaa-temporary");
|
|
154
|
-
let
|
|
155
|
-
const Ye = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], vn = /* @__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"}}`), wn = {
|
|
156
|
-
publication:
|
|
157
|
-
},
|
|
154
|
+
let qe = L;
|
|
155
|
+
const Ke = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], _n = /* @__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"}}`), Pn = {
|
|
156
|
+
publication: _n
|
|
157
|
+
}, Ze = {
|
|
158
158
|
fr: () => import("./fr-C5HEel98.js"),
|
|
159
159
|
ar: () => import("./ar-DyHX_uy2.js"),
|
|
160
160
|
da: () => import("./da-Dct0PS3E.js"),
|
|
@@ -165,13 +165,13 @@ const Ye = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], vn = /* @__PURE__ */ J
|
|
|
165
165
|
sv: () => import("./sv-BfzAFsVN.js")
|
|
166
166
|
// 'tr': () => import('@edrlab/thorium-locales/publication-metadata/tr.json'),
|
|
167
167
|
// 'uk': () => import('@edrlab/thorium-locales/publication-metadata/uk.json')
|
|
168
|
-
},
|
|
169
|
-
class
|
|
168
|
+
}, Je = Pn?.publication?.metadata?.accessibility?.["display-guide"] || {};
|
|
169
|
+
class mt {
|
|
170
170
|
constructor() {
|
|
171
|
-
this.currentLocaleCode = "en", this.locale =
|
|
171
|
+
this.currentLocaleCode = "en", this.locale = Je, this.loadedLocales = {}, this.loadedLocales.en = Je;
|
|
172
172
|
}
|
|
173
173
|
static getInstance() {
|
|
174
|
-
return
|
|
174
|
+
return mt.instance || (mt.instance = new mt()), mt.instance;
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* Loads a locale dynamically
|
|
@@ -179,14 +179,14 @@ class ut {
|
|
|
179
179
|
* @returns Promise indicating if the locale was loaded successfully
|
|
180
180
|
*/
|
|
181
181
|
async loadLocale(t) {
|
|
182
|
-
if (!
|
|
182
|
+
if (!Ke.includes(t))
|
|
183
183
|
return console.warn(`Locale '${t}' is not enabled`), !1;
|
|
184
184
|
if (t in this.loadedLocales)
|
|
185
185
|
return !0;
|
|
186
186
|
try {
|
|
187
|
-
if (!(t in
|
|
187
|
+
if (!(t in Ze))
|
|
188
188
|
return console.warn(`Locale file not found for: ${t}`), !1;
|
|
189
|
-
const n = (await
|
|
189
|
+
const n = (await Ze[t]()).default?.publication?.metadata?.accessibility?.["display-guide"];
|
|
190
190
|
return n ? (this.loadedLocales[t] = n, !0) : (console.warn(`No accessibility strings found in locale ${t}`), !1);
|
|
191
191
|
} catch (e) {
|
|
192
192
|
return console.warn(`Failed to load locale ${t}:`, e), !1;
|
|
@@ -220,7 +220,7 @@ class ut {
|
|
|
220
220
|
* Gets a list of available locale codes
|
|
221
221
|
*/
|
|
222
222
|
getAvailableLocales() {
|
|
223
|
-
return
|
|
223
|
+
return Ke;
|
|
224
224
|
}
|
|
225
225
|
getNestedValue(t, e) {
|
|
226
226
|
const i = e.split(".");
|
|
@@ -242,7 +242,7 @@ class ut {
|
|
|
242
242
|
return e === void 0 && this.currentLocaleCode !== "en" && (e = this.getNestedValue(this.loadedLocales.en, t)), e !== void 0 ? typeof e == "string" ? { compact: e, descriptive: e } : e : (console.warn(`Missing localization for key: ${t}`), { compact: "", descriptive: "" });
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
|
|
245
|
+
mt.getInstance();
|
|
246
246
|
var S = /* @__PURE__ */ ((s) => (s.reflowable = "reflowable", s.fixed = "fixed", s.scrolled = "scrolled", s))(S || {});
|
|
247
247
|
class ke {
|
|
248
248
|
/**
|
|
@@ -308,13 +308,13 @@ Object.defineProperty($.prototype, "encryption", {
|
|
|
308
308
|
return ke.deserialize(this.otherProperties.encrypted);
|
|
309
309
|
}
|
|
310
310
|
});
|
|
311
|
-
function
|
|
311
|
+
function En(s) {
|
|
312
312
|
return s && Array.isArray(s) ? s : void 0;
|
|
313
313
|
}
|
|
314
|
-
function
|
|
315
|
-
return s && typeof s == "string" ? [s] :
|
|
314
|
+
function Di(s) {
|
|
315
|
+
return s && typeof s == "string" ? [s] : En(s);
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function Qe(s) {
|
|
318
318
|
return typeof s == "string" ? new Date(s) : void 0;
|
|
319
319
|
}
|
|
320
320
|
function Mt(s) {
|
|
@@ -323,7 +323,7 @@ function Mt(s) {
|
|
|
323
323
|
function B(s) {
|
|
324
324
|
return Mt(s) !== void 0 && Math.sign(s) >= 0 ? s : void 0;
|
|
325
325
|
}
|
|
326
|
-
function
|
|
326
|
+
function Cn(s) {
|
|
327
327
|
const t = new Array();
|
|
328
328
|
return s.forEach((e) => t.push(e)), t;
|
|
329
329
|
}
|
|
@@ -786,7 +786,7 @@ class g {
|
|
|
786
786
|
});
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
class
|
|
789
|
+
class ti {
|
|
790
790
|
constructor(t) {
|
|
791
791
|
this.uri = t, this.parameters = this.getParameters(t);
|
|
792
792
|
}
|
|
@@ -836,7 +836,7 @@ class E {
|
|
|
836
836
|
return Object.entries(t).forEach(([a, l]) => {
|
|
837
837
|
o.has(a) || r.set(a, l);
|
|
838
838
|
}), new E({
|
|
839
|
-
fragments:
|
|
839
|
+
fragments: Di(t.fragments || t.fragment),
|
|
840
840
|
progression: e !== void 0 && e >= 0 && e <= 1 ? e : void 0,
|
|
841
841
|
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
842
842
|
position: n !== void 0 && n > 0 ? n : void 0,
|
|
@@ -851,7 +851,7 @@ class E {
|
|
|
851
851
|
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;
|
|
852
852
|
}
|
|
853
853
|
}
|
|
854
|
-
class
|
|
854
|
+
class at {
|
|
855
855
|
/**
|
|
856
856
|
* Creates a [Text].
|
|
857
857
|
*/
|
|
@@ -863,7 +863,7 @@ class st {
|
|
|
863
863
|
*/
|
|
864
864
|
static deserialize(t) {
|
|
865
865
|
if (t)
|
|
866
|
-
return new
|
|
866
|
+
return new at({
|
|
867
867
|
after: t.after,
|
|
868
868
|
before: t.before,
|
|
869
869
|
highlight: t.highlight
|
|
@@ -894,7 +894,7 @@ class N {
|
|
|
894
894
|
type: t.type,
|
|
895
895
|
title: t.title,
|
|
896
896
|
locations: E.deserialize(t.locations),
|
|
897
|
-
text:
|
|
897
|
+
text: at.deserialize(t.text)
|
|
898
898
|
});
|
|
899
899
|
}
|
|
900
900
|
/**
|
|
@@ -941,7 +941,7 @@ class j {
|
|
|
941
941
|
size: B(t.size),
|
|
942
942
|
duration: B(t.duration),
|
|
943
943
|
bitrate: B(t.bitrate),
|
|
944
|
-
languages:
|
|
944
|
+
languages: Di(t.language),
|
|
945
945
|
alternates: It.deserialize(t.alternate),
|
|
946
946
|
children: It.deserialize(t.children)
|
|
947
947
|
});
|
|
@@ -951,7 +951,7 @@ class j {
|
|
|
951
951
|
*/
|
|
952
952
|
serialize() {
|
|
953
953
|
const t = { href: this.href };
|
|
954
|
-
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 =
|
|
954
|
+
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 = Cn(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;
|
|
955
955
|
}
|
|
956
956
|
/** MediaType of the linked resource. */
|
|
957
957
|
get mediaType() {
|
|
@@ -968,14 +968,14 @@ class j {
|
|
|
968
968
|
}
|
|
969
969
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
970
970
|
get templateParameters() {
|
|
971
|
-
return this.templated ? new
|
|
971
|
+
return this.templated ? new ti(this.href).parameters : /* @__PURE__ */ new Set();
|
|
972
972
|
}
|
|
973
973
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
974
974
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
975
975
|
*/
|
|
976
976
|
expandTemplate(t) {
|
|
977
977
|
return new j({
|
|
978
|
-
href: new
|
|
978
|
+
href: new ti(this.href).expand(t),
|
|
979
979
|
templated: !1
|
|
980
980
|
});
|
|
981
981
|
}
|
|
@@ -1095,7 +1095,7 @@ class It {
|
|
|
1095
1095
|
return this.items.filter((t) => t.type);
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
|
-
var
|
|
1098
|
+
var Wi = /* @__PURE__ */ ((s) => (s.EPUB = "https://readium.org/webpub-manifest/profiles/epub", s.AUDIOBOOK = "https://readium.org/webpub-manifest/profiles/audiobook", s.DIVINA = "https://readium.org/webpub-manifest/profiles/divina", s.PDF = "https://readium.org/webpub-manifest/profiles/pdf", s))(Wi || {}), D = /* @__PURE__ */ ((s) => (s.ltr = "ltr", s.rtl = "rtl", s))(D || {});
|
|
1099
1099
|
$.prototype.getContains = function() {
|
|
1100
1100
|
return new Set(this.otherProperties.contains || []);
|
|
1101
1101
|
};
|
|
@@ -1223,7 +1223,7 @@ class Te {
|
|
|
1223
1223
|
return { currency: this.currency, value: this.value };
|
|
1224
1224
|
}
|
|
1225
1225
|
}
|
|
1226
|
-
class
|
|
1226
|
+
class wt {
|
|
1227
1227
|
/** Creates a [Acquisition]. */
|
|
1228
1228
|
constructor(t) {
|
|
1229
1229
|
this.type = t.type, this.children = t.children;
|
|
@@ -1233,14 +1233,14 @@ class bt {
|
|
|
1233
1233
|
*/
|
|
1234
1234
|
static deserialize(t) {
|
|
1235
1235
|
if (t && t.type)
|
|
1236
|
-
return new
|
|
1236
|
+
return new wt({
|
|
1237
1237
|
type: t.type,
|
|
1238
|
-
children:
|
|
1238
|
+
children: wt.deserializeArray(t.children)
|
|
1239
1239
|
});
|
|
1240
1240
|
}
|
|
1241
1241
|
static deserializeArray(t) {
|
|
1242
1242
|
if (Array.isArray(t))
|
|
1243
|
-
return t.map((e) =>
|
|
1243
|
+
return t.map((e) => wt.deserialize(e)).filter((e) => e !== void 0);
|
|
1244
1244
|
}
|
|
1245
1245
|
/**
|
|
1246
1246
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1308,8 +1308,8 @@ class Me {
|
|
|
1308
1308
|
if (t && t.state)
|
|
1309
1309
|
return new Me({
|
|
1310
1310
|
state: t.state,
|
|
1311
|
-
since:
|
|
1312
|
-
until:
|
|
1311
|
+
since: Qe(t.since),
|
|
1312
|
+
until: Qe(t.until)
|
|
1313
1313
|
});
|
|
1314
1314
|
}
|
|
1315
1315
|
/**
|
|
@@ -1329,7 +1329,7 @@ $.prototype.getPrice = function() {
|
|
|
1329
1329
|
$.prototype.getIndirectAcquisitions = function() {
|
|
1330
1330
|
const s = this.otherProperties.indirectAcquisition;
|
|
1331
1331
|
if (s && Array.isArray(s))
|
|
1332
|
-
return s.map((t) =>
|
|
1332
|
+
return s.map((t) => wt.deserialize(t)).filter((t) => t !== void 0);
|
|
1333
1333
|
};
|
|
1334
1334
|
$.prototype.getHolds = function() {
|
|
1335
1335
|
return Ae.deserialize(this.otherProperties.holds);
|
|
@@ -1343,41 +1343,41 @@ $.prototype.getAvailability = function() {
|
|
|
1343
1343
|
$.prototype.getAuthenticate = function() {
|
|
1344
1344
|
return j.deserialize(this.otherProperties.authenticate);
|
|
1345
1345
|
};
|
|
1346
|
-
const
|
|
1347
|
-
function
|
|
1348
|
-
console.warn(`${
|
|
1346
|
+
const xn = "CssSelectorGenerator";
|
|
1347
|
+
function ei(s = "unknown problem", ...t) {
|
|
1348
|
+
console.warn(`${xn}: ${s}`, ...t);
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1350
|
+
function Rn(s) {
|
|
1351
1351
|
return s instanceof RegExp;
|
|
1352
1352
|
}
|
|
1353
|
-
function
|
|
1353
|
+
function Ln(s) {
|
|
1354
1354
|
return s.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1356
|
+
function kn(s) {
|
|
1357
1357
|
const t = s.map((e) => {
|
|
1358
|
-
if (
|
|
1358
|
+
if (Rn(e))
|
|
1359
1359
|
return (i) => e.test(i);
|
|
1360
1360
|
if (typeof e == "function")
|
|
1361
1361
|
return (i) => {
|
|
1362
1362
|
const n = e(i);
|
|
1363
|
-
return typeof n != "boolean" ? (
|
|
1363
|
+
return typeof n != "boolean" ? (ei("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", e), !1) : n;
|
|
1364
1364
|
};
|
|
1365
1365
|
if (typeof e == "string") {
|
|
1366
|
-
const i = new RegExp("^" +
|
|
1366
|
+
const i = new RegExp("^" + Ln(e) + "$");
|
|
1367
1367
|
return (n) => i.test(n);
|
|
1368
1368
|
}
|
|
1369
|
-
return
|
|
1369
|
+
return ei("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", e), () => !1;
|
|
1370
1370
|
});
|
|
1371
1371
|
return (e) => t.some((i) => i(e));
|
|
1372
1372
|
}
|
|
1373
|
-
|
|
1373
|
+
kn([
|
|
1374
1374
|
"class",
|
|
1375
1375
|
"id",
|
|
1376
1376
|
// Angular attributes
|
|
1377
1377
|
"ng-*"
|
|
1378
1378
|
]);
|
|
1379
|
-
const
|
|
1380
|
-
class
|
|
1379
|
+
const On = Math.pow(2, 32), ii = () => Math.round(Math.random() * On).toString(36), ge = () => `${Math.round(performance.now())}-${ii()}-${ii()}`, ut = 1;
|
|
1380
|
+
class Tn {
|
|
1381
1381
|
constructor(t) {
|
|
1382
1382
|
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);
|
|
1383
1383
|
}
|
|
@@ -1388,8 +1388,8 @@ class kn {
|
|
|
1388
1388
|
if (!(!("_readium" in e) || !e._readium || e._readium <= 0)) {
|
|
1389
1389
|
if (e.key === "_ping") {
|
|
1390
1390
|
if (!this.destination) {
|
|
1391
|
-
if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !==
|
|
1392
|
-
e._readium >
|
|
1391
|
+
if (this.destination = t.source, this.origin = t.origin, this.channelId = e._channel, e._readium !== ut) {
|
|
1392
|
+
e._readium > ut ? this.send("error", `received comms version ${e._readium} higher than ${ut}`) : this.send("error", `received comms version ${e._readium} lower than ${ut}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
1393
1393
|
return;
|
|
1394
1394
|
}
|
|
1395
1395
|
this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
|
|
@@ -1449,7 +1449,7 @@ class kn {
|
|
|
1449
1449
|
send(t, e, i = void 0, n = []) {
|
|
1450
1450
|
if (!this.destination) throw Error("Attempted to send comms message before destination has been initialized");
|
|
1451
1451
|
const r = {
|
|
1452
|
-
_readium:
|
|
1452
|
+
_readium: ut,
|
|
1453
1453
|
_channel: this.channelId,
|
|
1454
1454
|
id: i ?? ge(),
|
|
1455
1455
|
// scrict,
|
|
@@ -1467,17 +1467,17 @@ class kn {
|
|
|
1467
1467
|
}
|
|
1468
1468
|
}
|
|
1469
1469
|
}
|
|
1470
|
-
class
|
|
1470
|
+
class bt {
|
|
1471
1471
|
}
|
|
1472
|
-
function
|
|
1472
|
+
function ni(s) {
|
|
1473
1473
|
return s.split("").reverse().join("");
|
|
1474
1474
|
}
|
|
1475
|
-
function
|
|
1476
|
-
const i =
|
|
1475
|
+
function An(s, t, e) {
|
|
1476
|
+
const i = ni(t);
|
|
1477
1477
|
return e.map((n) => {
|
|
1478
|
-
const r = Math.max(0, n.end - t.length - n.errors), o =
|
|
1478
|
+
const r = Math.max(0, n.end - t.length - n.errors), o = ni(s.slice(r, n.end));
|
|
1479
1479
|
return {
|
|
1480
|
-
start:
|
|
1480
|
+
start: Hi(o, i, n.errors).reduce((l, h) => n.end - h.end < l ? n.end - h.end : l, n.end),
|
|
1481
1481
|
end: n.end,
|
|
1482
1482
|
errors: n.errors
|
|
1483
1483
|
};
|
|
@@ -1486,14 +1486,14 @@ function On(s, t, e) {
|
|
|
1486
1486
|
function ae(s) {
|
|
1487
1487
|
return (s | -s) >> 31 & 1;
|
|
1488
1488
|
}
|
|
1489
|
-
function
|
|
1489
|
+
function ri(s, t, e, i) {
|
|
1490
1490
|
let n = s.P[e], r = s.M[e];
|
|
1491
1491
|
const o = i >>> 31, a = t[e] | o, l = a | r, h = (a & n) + n ^ n | a;
|
|
1492
1492
|
let c = r | ~(h | n), u = n & h;
|
|
1493
1493
|
const m = ae(c & s.lastRowMask[e]) - ae(u & s.lastRowMask[e]);
|
|
1494
1494
|
return c <<= 1, u <<= 1, u |= o, c |= ae(i) - o, n = u | ~(l | c), r = c & l, s.P[e] = n, s.M[e] = r, m;
|
|
1495
1495
|
}
|
|
1496
|
-
function
|
|
1496
|
+
function Hi(s, t, e) {
|
|
1497
1497
|
if (t.length === 0)
|
|
1498
1498
|
return [];
|
|
1499
1499
|
e = Math.min(e, t.length);
|
|
@@ -1535,7 +1535,7 @@ function Ui(s, t, e) {
|
|
|
1535
1535
|
y < h.length ? d = h[y] : (d = l.get(y), typeof d > "u" && (d = a));
|
|
1536
1536
|
let p = 0;
|
|
1537
1537
|
for (let b = 0; b <= c; b += 1)
|
|
1538
|
-
p =
|
|
1538
|
+
p = ri(o, d, b, p), u[b] += p;
|
|
1539
1539
|
if (u[c] - p <= e && c < r && (d[c + 1] & 1 || p < 0)) {
|
|
1540
1540
|
c += 1, o.P[c] = -1, o.M[c] = 0;
|
|
1541
1541
|
let b;
|
|
@@ -1544,7 +1544,7 @@ function Ui(s, t, e) {
|
|
|
1544
1544
|
b = v === 0 ? n : v;
|
|
1545
1545
|
} else
|
|
1546
1546
|
b = n;
|
|
1547
|
-
u[c] = u[c - 1] + b - p +
|
|
1547
|
+
u[c] = u[c - 1] + b - p + ri(o, d, c, p);
|
|
1548
1548
|
} else
|
|
1549
1549
|
for (; c > 0 && u[c] >= e + n; )
|
|
1550
1550
|
c -= 1;
|
|
@@ -1556,11 +1556,11 @@ function Ui(s, t, e) {
|
|
|
1556
1556
|
}
|
|
1557
1557
|
return i;
|
|
1558
1558
|
}
|
|
1559
|
-
function
|
|
1560
|
-
const i =
|
|
1561
|
-
return
|
|
1559
|
+
function zn(s, t, e) {
|
|
1560
|
+
const i = Hi(s, t, e);
|
|
1561
|
+
return An(s, t, i);
|
|
1562
1562
|
}
|
|
1563
|
-
function
|
|
1563
|
+
function Bi(s, t, e) {
|
|
1564
1564
|
let i = 0;
|
|
1565
1565
|
const n = [];
|
|
1566
1566
|
for (; i !== -1; )
|
|
@@ -1569,25 +1569,25 @@ function Ii(s, t, e) {
|
|
|
1569
1569
|
end: i + t.length,
|
|
1570
1570
|
errors: 0
|
|
1571
1571
|
}), i += 1);
|
|
1572
|
-
return n.length > 0 ? n :
|
|
1572
|
+
return n.length > 0 ? n : zn(s, t, e);
|
|
1573
1573
|
}
|
|
1574
|
-
function
|
|
1575
|
-
return t.length === 0 || s.length === 0 ? 0 : 1 -
|
|
1574
|
+
function si(s, t) {
|
|
1575
|
+
return t.length === 0 || s.length === 0 ? 0 : 1 - Bi(s, t, t.length)[0].errors / t.length;
|
|
1576
1576
|
}
|
|
1577
|
-
function
|
|
1577
|
+
function Mn(s, t, e = {}) {
|
|
1578
1578
|
if (t.length === 0)
|
|
1579
1579
|
return null;
|
|
1580
|
-
const i = Math.min(256, t.length / 2), n =
|
|
1580
|
+
const i = Math.min(256, t.length / 2), n = Bi(s, t, i);
|
|
1581
1581
|
if (n.length === 0)
|
|
1582
1582
|
return null;
|
|
1583
1583
|
const r = (a) => {
|
|
1584
|
-
const m = 1 - a.errors / t.length, y = e.prefix ?
|
|
1584
|
+
const m = 1 - a.errors / t.length, y = e.prefix ? si(
|
|
1585
1585
|
s.slice(
|
|
1586
1586
|
Math.max(0, a.start - e.prefix.length),
|
|
1587
1587
|
a.start
|
|
1588
1588
|
),
|
|
1589
1589
|
e.prefix
|
|
1590
|
-
) : 1, d = e.suffix ?
|
|
1590
|
+
) : 1, d = e.suffix ? si(
|
|
1591
1591
|
s.slice(a.end, a.end + e.suffix.length),
|
|
1592
1592
|
e.suffix
|
|
1593
1593
|
) : 1;
|
|
@@ -1610,7 +1610,7 @@ function fe(s, t, e) {
|
|
|
1610
1610
|
const o = n.length - r.length;
|
|
1611
1611
|
return e === 2 ? t - o : t + o;
|
|
1612
1612
|
}
|
|
1613
|
-
function
|
|
1613
|
+
function oi(s, t) {
|
|
1614
1614
|
const e = s.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1615
1615
|
s.commonAncestorContainer,
|
|
1616
1616
|
NodeFilter.SHOW_TEXT
|
|
@@ -1632,7 +1632,7 @@ function ri(s, t) {
|
|
|
1632
1632
|
return { node: r, offset: o };
|
|
1633
1633
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1634
1634
|
}
|
|
1635
|
-
function
|
|
1635
|
+
function Nn(s) {
|
|
1636
1636
|
if (!s.toString().trim().length)
|
|
1637
1637
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1638
1638
|
if (s.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1658,7 +1658,7 @@ function zn(s) {
|
|
|
1658
1658
|
if (n.start >= 0 && (t.setStart(s.startContainer, n.start), e = !0), n.end > 0 && (t.setEnd(s.endContainer, n.end), i = !0), e && i)
|
|
1659
1659
|
return t;
|
|
1660
1660
|
if (!e) {
|
|
1661
|
-
const { node: r, offset: o } =
|
|
1661
|
+
const { node: r, offset: o } = oi(
|
|
1662
1662
|
t,
|
|
1663
1663
|
1
|
|
1664
1664
|
/* Forwards */
|
|
@@ -1666,7 +1666,7 @@ function zn(s) {
|
|
|
1666
1666
|
r && o >= 0 && t.setStart(r, o);
|
|
1667
1667
|
}
|
|
1668
1668
|
if (!i) {
|
|
1669
|
-
const { node: r, offset: o } =
|
|
1669
|
+
const { node: r, offset: o } = oi(
|
|
1670
1670
|
t,
|
|
1671
1671
|
2
|
|
1672
1672
|
/* Backwards */
|
|
@@ -1675,7 +1675,7 @@ function zn(s) {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
return t;
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1678
|
+
function Vi(s) {
|
|
1679
1679
|
switch (s.nodeType) {
|
|
1680
1680
|
case Node.ELEMENT_NODE:
|
|
1681
1681
|
case Node.TEXT_NODE:
|
|
@@ -1684,13 +1684,13 @@ function Di(s) {
|
|
|
1684
1684
|
return 0;
|
|
1685
1685
|
}
|
|
1686
1686
|
}
|
|
1687
|
-
function
|
|
1687
|
+
function ai(s) {
|
|
1688
1688
|
let t = s.previousSibling, e = 0;
|
|
1689
1689
|
for (; t; )
|
|
1690
|
-
e +=
|
|
1690
|
+
e += Vi(t), t = t.previousSibling;
|
|
1691
1691
|
return e;
|
|
1692
1692
|
}
|
|
1693
|
-
function
|
|
1693
|
+
function ji(s, ...t) {
|
|
1694
1694
|
let e = t.shift();
|
|
1695
1695
|
const i = s.ownerDocument.createNodeIterator(
|
|
1696
1696
|
s,
|
|
@@ -1722,7 +1722,7 @@ class Y {
|
|
|
1722
1722
|
throw new Error("Parent is not an ancestor of current element");
|
|
1723
1723
|
let e = this.element, i = this.offset;
|
|
1724
1724
|
for (; e !== t; )
|
|
1725
|
-
i +=
|
|
1725
|
+
i += ai(e), e = e.parentElement;
|
|
1726
1726
|
return new Y(e, i);
|
|
1727
1727
|
}
|
|
1728
1728
|
/**
|
|
@@ -1744,7 +1744,7 @@ class Y {
|
|
|
1744
1744
|
*/
|
|
1745
1745
|
resolve(t = {}) {
|
|
1746
1746
|
try {
|
|
1747
|
-
return
|
|
1747
|
+
return ji(this.element, this.offset)[0];
|
|
1748
1748
|
} catch (e) {
|
|
1749
1749
|
if (this.offset === 0 && t.direction !== void 0) {
|
|
1750
1750
|
const i = document.createTreeWalker(
|
|
@@ -1787,7 +1787,7 @@ class Y {
|
|
|
1787
1787
|
throw new Error("Text node offset is out of range");
|
|
1788
1788
|
if (!t.parentElement)
|
|
1789
1789
|
throw new Error("Text node has no parent");
|
|
1790
|
-
const i =
|
|
1790
|
+
const i = ai(t) + e;
|
|
1791
1791
|
return new Y(t.parentElement, i);
|
|
1792
1792
|
}
|
|
1793
1793
|
case Node.ELEMENT_NODE: {
|
|
@@ -1795,7 +1795,7 @@ class Y {
|
|
|
1795
1795
|
throw new Error("Child node offset is out of range");
|
|
1796
1796
|
let i = 0;
|
|
1797
1797
|
for (let n = 0; n < e; n++)
|
|
1798
|
-
i +=
|
|
1798
|
+
i += Vi(t.childNodes[n]);
|
|
1799
1799
|
return new Y(t, i);
|
|
1800
1800
|
}
|
|
1801
1801
|
default:
|
|
@@ -1829,7 +1829,7 @@ class tt {
|
|
|
1829
1829
|
*/
|
|
1830
1830
|
toRange() {
|
|
1831
1831
|
let t, e;
|
|
1832
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [t, e] =
|
|
1832
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [t, e] = ji(
|
|
1833
1833
|
this.start.element,
|
|
1834
1834
|
this.start.offset,
|
|
1835
1835
|
this.end.offset
|
|
@@ -1868,7 +1868,7 @@ class tt {
|
|
|
1868
1868
|
* whitespace
|
|
1869
1869
|
*/
|
|
1870
1870
|
static trimmedRange(t) {
|
|
1871
|
-
return
|
|
1871
|
+
return Nn(tt.fromRange(t).toRange());
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
1874
|
class Wt {
|
|
@@ -1932,7 +1932,7 @@ class Ht {
|
|
|
1932
1932
|
return this.toPositionAnchor(t).toRange();
|
|
1933
1933
|
}
|
|
1934
1934
|
toPositionAnchor(t = {}) {
|
|
1935
|
-
const e = this.root.textContent, i =
|
|
1935
|
+
const e = this.root.textContent, i = Mn(e, this.exact, {
|
|
1936
1936
|
...this.context,
|
|
1937
1937
|
hint: t.hint
|
|
1938
1938
|
});
|
|
@@ -1941,7 +1941,7 @@ class Ht {
|
|
|
1941
1941
|
return new Wt(this.root, i.start, i.end);
|
|
1942
1942
|
}
|
|
1943
1943
|
}
|
|
1944
|
-
function
|
|
1944
|
+
function Fn(s) {
|
|
1945
1945
|
const t = s.tagName.toUpperCase();
|
|
1946
1946
|
return t === "IMG" || t === "VIDEO" || t === "AUDIO" || t === "IFRAME" || t === "OBJECT" || t === "EMBED" || t === "CANVAS";
|
|
1947
1947
|
}
|
|
@@ -1970,7 +1970,7 @@ function ie(s, t) {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
if (n) {
|
|
1972
1972
|
const r = s.createRange();
|
|
1973
|
-
return n.childNodes.length === 0 ||
|
|
1973
|
+
return n.childNodes.length === 0 || Fn(n) ? (r.selectNode(n), r) : (r.setStartBefore(n), r.setEndAfter(n), r);
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
1976
|
} catch (e) {
|
|
@@ -1978,7 +1978,7 @@ function ie(s, t) {
|
|
|
1978
1978
|
}
|
|
1979
1979
|
return null;
|
|
1980
1980
|
}
|
|
1981
|
-
function
|
|
1981
|
+
function Un(s, t) {
|
|
1982
1982
|
let e = s.getClientRects();
|
|
1983
1983
|
e.length || s.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (e = s.commonAncestorContainer.getClientRects());
|
|
1984
1984
|
const i = 1, n = [];
|
|
@@ -1991,10 +1991,10 @@ function Nn(s, t) {
|
|
|
1991
1991
|
top: h.top,
|
|
1992
1992
|
width: h.width
|
|
1993
1993
|
});
|
|
1994
|
-
const r =
|
|
1994
|
+
const r = Gi(
|
|
1995
1995
|
n,
|
|
1996
1996
|
i
|
|
1997
|
-
), o =
|
|
1997
|
+
), o = Dn(r, i), a = $i(o), l = 4;
|
|
1998
1998
|
for (let h = a.length - 1; h >= 0; h--) {
|
|
1999
1999
|
const c = a[h];
|
|
2000
2000
|
if (!(c.width * c.height > l))
|
|
@@ -2005,16 +2005,16 @@ function Nn(s, t) {
|
|
|
2005
2005
|
}
|
|
2006
2006
|
return a;
|
|
2007
2007
|
}
|
|
2008
|
-
function
|
|
2008
|
+
function Gi(s, t, e) {
|
|
2009
2009
|
for (let i = 0; i < s.length; i++)
|
|
2010
2010
|
for (let n = i + 1; n < s.length; n++) {
|
|
2011
2011
|
const r = s[i], o = s[n];
|
|
2012
2012
|
if (r === o)
|
|
2013
2013
|
continue;
|
|
2014
2014
|
const a = V(r.top, o.top, t) && V(r.bottom, o.bottom, t), l = V(r.left, o.left, t) && V(r.right, o.right, t);
|
|
2015
|
-
if (a && !l &&
|
|
2016
|
-
const u = s.filter((y) => y !== r && y !== o), m =
|
|
2017
|
-
return u.push(m),
|
|
2015
|
+
if (a && !l && Xi(r, o, t)) {
|
|
2016
|
+
const u = s.filter((y) => y !== r && y !== o), m = In(r, o);
|
|
2017
|
+
return u.push(m), Gi(
|
|
2018
2018
|
u,
|
|
2019
2019
|
t
|
|
2020
2020
|
);
|
|
@@ -2022,7 +2022,7 @@ function Hi(s, t, e) {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
return s;
|
|
2024
2024
|
}
|
|
2025
|
-
function
|
|
2025
|
+
function In(s, t) {
|
|
2026
2026
|
const e = Math.min(s.left, t.left), i = Math.max(s.right, t.right), n = Math.min(s.top, t.top), r = Math.max(s.bottom, t.bottom);
|
|
2027
2027
|
return {
|
|
2028
2028
|
bottom: r,
|
|
@@ -2033,7 +2033,7 @@ function Fn(s, t) {
|
|
|
2033
2033
|
width: i - e
|
|
2034
2034
|
};
|
|
2035
2035
|
}
|
|
2036
|
-
function
|
|
2036
|
+
function Dn(s, t) {
|
|
2037
2037
|
const e = new Set(s);
|
|
2038
2038
|
for (const i of s) {
|
|
2039
2039
|
if (!(i.width > 1 && i.height > 1)) {
|
|
@@ -2041,40 +2041,40 @@ function Un(s, t) {
|
|
|
2041
2041
|
continue;
|
|
2042
2042
|
}
|
|
2043
2043
|
for (const r of s)
|
|
2044
|
-
if (i !== r && e.has(r) &&
|
|
2044
|
+
if (i !== r && e.has(r) && Wn(r, i, t)) {
|
|
2045
2045
|
e.delete(i);
|
|
2046
2046
|
break;
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
2049
2049
|
return Array.from(e);
|
|
2050
2050
|
}
|
|
2051
|
-
function
|
|
2051
|
+
function Wn(s, t, e) {
|
|
2052
2052
|
return Tt(s, t.left, t.top, e) && Tt(s, t.right, t.top, e) && Tt(s, t.left, t.bottom, e) && Tt(s, t.right, t.bottom, e);
|
|
2053
2053
|
}
|
|
2054
2054
|
function Tt(s, t, e, i) {
|
|
2055
2055
|
return (s.left < t || V(s.left, t, i)) && (s.right > t || V(s.right, t, i)) && (s.top < e || V(s.top, e, i)) && (s.bottom > e || V(s.bottom, e, i));
|
|
2056
2056
|
}
|
|
2057
|
-
function
|
|
2057
|
+
function $i(s) {
|
|
2058
2058
|
for (let t = 0; t < s.length; t++)
|
|
2059
2059
|
for (let e = t + 1; e < s.length; e++) {
|
|
2060
2060
|
const i = s[t], n = s[e];
|
|
2061
|
-
if (i !== n &&
|
|
2061
|
+
if (i !== n && Xi(i, n, -1)) {
|
|
2062
2062
|
let r = [], o;
|
|
2063
|
-
const a =
|
|
2063
|
+
const a = li(i, n);
|
|
2064
2064
|
if (a.length === 1)
|
|
2065
2065
|
r = a, o = i;
|
|
2066
2066
|
else {
|
|
2067
|
-
const h =
|
|
2067
|
+
const h = li(n, i);
|
|
2068
2068
|
a.length < h.length ? (r = a, o = i) : (r = h, o = n);
|
|
2069
2069
|
}
|
|
2070
2070
|
const l = s.filter((h) => h !== o);
|
|
2071
|
-
return Array.prototype.push.apply(l, r),
|
|
2071
|
+
return Array.prototype.push.apply(l, r), $i(l);
|
|
2072
2072
|
}
|
|
2073
2073
|
}
|
|
2074
2074
|
return s;
|
|
2075
2075
|
}
|
|
2076
|
-
function
|
|
2077
|
-
const e =
|
|
2076
|
+
function li(s, t) {
|
|
2077
|
+
const e = Hn(t, s);
|
|
2078
2078
|
if (e.height === 0 || e.width === 0)
|
|
2079
2079
|
return [s];
|
|
2080
2080
|
const i = [];
|
|
@@ -2124,7 +2124,7 @@ function oi(s, t) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
return i;
|
|
2126
2126
|
}
|
|
2127
|
-
function
|
|
2127
|
+
function Hn(s, t) {
|
|
2128
2128
|
const e = Math.max(s.left, t.left), i = Math.min(s.right, t.right), n = Math.max(s.top, t.top), r = Math.min(s.bottom, t.bottom);
|
|
2129
2129
|
return {
|
|
2130
2130
|
bottom: r,
|
|
@@ -2135,7 +2135,7 @@ function Dn(s, t) {
|
|
|
2135
2135
|
width: Math.max(0, i - e)
|
|
2136
2136
|
};
|
|
2137
2137
|
}
|
|
2138
|
-
function
|
|
2138
|
+
function Xi(s, t, e) {
|
|
2139
2139
|
return (s.left < t.right || e >= 0 && V(s.left, t.right, e)) && (t.left < s.right || e >= 0 && V(t.left, s.right, e)) && (s.top < t.bottom || e >= 0 && V(s.top, t.bottom, e)) && (t.top < s.bottom || e >= 0 && V(t.top, s.bottom, e));
|
|
2140
2140
|
}
|
|
2141
2141
|
function V(s, t, e) {
|
|
@@ -2147,25 +2147,25 @@ function Ne(s) {
|
|
|
2147
2147
|
Object.hasOwn(e, i) && !Number.isNaN(Number.parseInt(i)) && (t[e[i]] = e.getPropertyValue(e[i]));
|
|
2148
2148
|
return t;
|
|
2149
2149
|
}
|
|
2150
|
-
function
|
|
2150
|
+
function Yi(s, t) {
|
|
2151
2151
|
const e = Ne(s);
|
|
2152
2152
|
Object.keys(e).forEach((i) => {
|
|
2153
2153
|
t.hasOwnProperty(i) || ne(s, i);
|
|
2154
2154
|
}), Object.entries(t).forEach(([i, n]) => {
|
|
2155
|
-
e[i] !== n &&
|
|
2155
|
+
e[i] !== n && xt(s, i, n);
|
|
2156
2156
|
});
|
|
2157
2157
|
}
|
|
2158
2158
|
function le(s, t) {
|
|
2159
2159
|
return s.document.documentElement.style.getPropertyValue(t);
|
|
2160
2160
|
}
|
|
2161
|
-
function
|
|
2161
|
+
function xt(s, t, e) {
|
|
2162
2162
|
s.document.documentElement.style.setProperty(t, e);
|
|
2163
2163
|
}
|
|
2164
2164
|
function ne(s, t) {
|
|
2165
2165
|
s.document.documentElement.style.removeProperty(t);
|
|
2166
2166
|
}
|
|
2167
|
-
let At = null, he = null,
|
|
2168
|
-
const
|
|
2167
|
+
let At = null, he = null, vt = 0;
|
|
2168
|
+
const pt = { r: 255, g: 255, b: 255, a: 1 }, lt = /* @__PURE__ */ new Map(), Bn = () => {
|
|
2169
2169
|
if (!At)
|
|
2170
2170
|
if (typeof OffscreenCanvas < "u")
|
|
2171
2171
|
At = new OffscreenCanvas(5, 5), he = At.getContext("2d", {
|
|
@@ -2180,7 +2180,7 @@ const dt = { r: 255, g: 255, b: 255, a: 1 }, ot = /* @__PURE__ */ new Map(), Wn
|
|
|
2180
2180
|
});
|
|
2181
2181
|
}
|
|
2182
2182
|
return he;
|
|
2183
|
-
},
|
|
2183
|
+
}, Vn = (s) => {
|
|
2184
2184
|
if (!s) return !0;
|
|
2185
2185
|
const t = s.trim().toLowerCase();
|
|
2186
2186
|
return t.startsWith("var(") || [
|
|
@@ -2201,52 +2201,52 @@ const dt = { r: 255, g: 255, b: 255, a: 1 }, ot = /* @__PURE__ */ new Map(), Wn
|
|
|
2201
2201
|
].some((n) => t.includes(n));
|
|
2202
2202
|
}, zt = (s, t) => {
|
|
2203
2203
|
console.warn(
|
|
2204
|
-
`[Decorator] Could not parse color: "${s}". ${t} Falling back to ${JSON.stringify(
|
|
2204
|
+
`[Decorator] Could not parse color: "${s}". ${t} Falling back to ${JSON.stringify(pt)} to compute contrast. Please use a CSS color value that can be computed to RGB(A).`
|
|
2205
2205
|
);
|
|
2206
2206
|
}, ye = (s, t = null) => {
|
|
2207
|
-
const e = t ? `${s}|${t}` : s, i =
|
|
2207
|
+
const e = t ? `${s}|${t}` : s, i = lt.get(e);
|
|
2208
2208
|
if (i !== void 0)
|
|
2209
|
-
return i ??
|
|
2210
|
-
if (
|
|
2211
|
-
return zt(s, "Unsupported color format or special value."),
|
|
2212
|
-
const n =
|
|
2209
|
+
return i ?? pt;
|
|
2210
|
+
if (Vn(s))
|
|
2211
|
+
return zt(s, "Unsupported color format or special value."), lt.set(e, null), pt;
|
|
2212
|
+
const n = Bn();
|
|
2213
2213
|
if (!n)
|
|
2214
|
-
return zt(s, "Could not get canvas context."),
|
|
2214
|
+
return zt(s, "Could not get canvas context."), lt.set(e, null), pt;
|
|
2215
2215
|
try {
|
|
2216
|
-
|
|
2217
|
-
const r =
|
|
2216
|
+
vt === 0 && n.clearRect(0, 0, 5, 5);
|
|
2217
|
+
const r = vt % 5, o = Math.floor(vt / 5);
|
|
2218
2218
|
n.clearRect(r, o, 1, 1), t && (n.fillStyle = t, n.fillRect(r, o, 1, 1)), n.fillStyle = s, n.fillRect(r, o, 1, 1);
|
|
2219
2219
|
const a = n.getImageData(r, o, 1, 1);
|
|
2220
|
-
|
|
2220
|
+
vt = (vt + 1) % 25;
|
|
2221
2221
|
const [l, h, c, u] = a.data;
|
|
2222
2222
|
if (u === 0)
|
|
2223
|
-
return zt(s, "Fully transparent color."),
|
|
2223
|
+
return zt(s, "Fully transparent color."), lt.set(e, null), pt;
|
|
2224
2224
|
const m = { r: l, g: h, b: c, a: u / 255 };
|
|
2225
|
-
return
|
|
2225
|
+
return lt.set(e, m), m;
|
|
2226
2226
|
} catch (r) {
|
|
2227
|
-
return zt(s, `Error: ${r instanceof Error ? r.message : String(r)}`),
|
|
2227
|
+
return zt(s, `Error: ${r instanceof Error ? r.message : String(r)}`), lt.set(e, null), pt;
|
|
2228
2228
|
}
|
|
2229
2229
|
}, ce = (s) => {
|
|
2230
2230
|
const t = s / 255;
|
|
2231
2231
|
return t <= 0.03928 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
|
|
2232
|
-
},
|
|
2232
|
+
}, hi = (s) => {
|
|
2233
2233
|
const t = ce(s.r), e = ce(s.g), i = ce(s.b);
|
|
2234
2234
|
return 0.2126 * t + 0.7152 * e + 0.0722 * i;
|
|
2235
|
-
},
|
|
2236
|
-
const e = typeof s == "string" ? ye(s) : s, i = typeof t == "string" ? ye(t) : t, n =
|
|
2235
|
+
}, ci = (s, t) => {
|
|
2236
|
+
const e = typeof s == "string" ? ye(s) : s, i = typeof t == "string" ? ye(t) : t, n = hi(e), r = hi(i), o = Math.max(n, r), a = Math.min(n, r);
|
|
2237
2237
|
return (o + 0.05) / (a + 0.05);
|
|
2238
2238
|
}, Se = (s, t = null) => {
|
|
2239
|
-
const e = ye(s, t), i =
|
|
2239
|
+
const e = ye(s, t), i = ci(e, { r: 255, g: 255, b: 255, a: 1 }), n = ci(e, { r: 0, g: 0, b: 0, a: 1 });
|
|
2240
2240
|
return i > n;
|
|
2241
|
-
},
|
|
2242
|
-
class
|
|
2241
|
+
}, jn = (s, t = null) => Se(s, t) ? "white" : "black", di = "#FFFF00", Gn = () => "Highlight" in window, ui = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2242
|
+
class $n {
|
|
2243
2243
|
/**
|
|
2244
2244
|
* Creates a DecorationGroup object
|
|
2245
2245
|
* @param id Unique HTML ID-adhering name of the group
|
|
2246
2246
|
* @param name Human-readable name of the group
|
|
2247
2247
|
*/
|
|
2248
2248
|
constructor(t, e, i, n) {
|
|
2249
|
-
this.wnd = t, this.comms = e, this.id = i, this.name = n, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0,
|
|
2249
|
+
this.wnd = t, this.comms = e, this.id = i, this.name = n, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Gn() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2250
2250
|
}
|
|
2251
2251
|
get activeable() {
|
|
2252
2252
|
return this.activateable;
|
|
@@ -2265,7 +2265,7 @@ class jn {
|
|
|
2265
2265
|
return;
|
|
2266
2266
|
}
|
|
2267
2267
|
const n = i.commonAncestorContainer;
|
|
2268
|
-
n.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (
|
|
2268
|
+
n.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (ui.includes(n.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(ui.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (n.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0));
|
|
2269
2269
|
const r = {
|
|
2270
2270
|
decoration: t,
|
|
2271
2271
|
id: e,
|
|
@@ -2306,10 +2306,10 @@ class jn {
|
|
|
2306
2306
|
experimentalLayout(t) {
|
|
2307
2307
|
const [e, i] = this.requireContainer(!0);
|
|
2308
2308
|
i.add(t.range);
|
|
2309
|
-
const n = le(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), r = t.decoration?.style?.tint ??
|
|
2309
|
+
const n = le(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color"), r = t.decoration?.style?.tint ?? di;
|
|
2310
2310
|
e.innerHTML = `
|
|
2311
2311
|
::highlight(${this.id}) {
|
|
2312
|
-
color: ${
|
|
2312
|
+
color: ${jn(r, n)};
|
|
2313
2313
|
background-color: ${r};
|
|
2314
2314
|
}`;
|
|
2315
2315
|
}
|
|
@@ -2347,7 +2347,7 @@ class jn {
|
|
|
2347
2347
|
data-readium="true"
|
|
2348
2348
|
class="readium-highlight"
|
|
2349
2349
|
style="${[
|
|
2350
|
-
`background-color: ${t.decoration?.style?.tint ??
|
|
2350
|
+
`background-color: ${t.decoration?.style?.tint ?? di} !important`,
|
|
2351
2351
|
//"opacity: 0.3 !important",
|
|
2352
2352
|
`mix-blend-mode: ${m ? "exclusion" : "multiply"} !important`,
|
|
2353
2353
|
"opacity: 1 !important",
|
|
@@ -2361,7 +2361,7 @@ class jn {
|
|
|
2361
2361
|
const d = y.cloneNode(!0);
|
|
2362
2362
|
d.style.setProperty("pointer-events", "none"), h(d, c, c), e.append(d);
|
|
2363
2363
|
} else {
|
|
2364
|
-
let d =
|
|
2364
|
+
let d = Un(
|
|
2365
2365
|
t.range
|
|
2366
2366
|
);
|
|
2367
2367
|
d = d.sort((p, b) => p.top < b.top ? -1 : p.top > b.top ? 1 : 0);
|
|
@@ -2403,7 +2403,7 @@ class jn {
|
|
|
2403
2403
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2404
2404
|
}
|
|
2405
2405
|
}
|
|
2406
|
-
const
|
|
2406
|
+
const Pt = class Pt extends bt {
|
|
2407
2407
|
constructor() {
|
|
2408
2408
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2409
2409
|
}
|
|
@@ -2428,9 +2428,9 @@ const wt = class wt extends yt {
|
|
|
2428
2428
|
}, 50);
|
|
2429
2429
|
}
|
|
2430
2430
|
mount(t, e) {
|
|
2431
|
-
return this.wnd = t, e.register("decorate",
|
|
2431
|
+
return this.wnd = t, e.register("decorate", Pt.moduleName, (i, n) => {
|
|
2432
2432
|
const r = i;
|
|
2433
|
-
r.decoration && r.decoration.locator && (r.decoration.locator = N.deserialize(r.decoration.locator)), this.groups.has(r.group) || this.groups.set(r.group, new
|
|
2433
|
+
r.decoration && r.decoration.locator && (r.decoration.locator = N.deserialize(r.decoration.locator)), this.groups.has(r.group) || this.groups.set(r.group, new $n(
|
|
2434
2434
|
t,
|
|
2435
2435
|
e,
|
|
2436
2436
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2468,12 +2468,12 @@ const wt = class wt extends yt {
|
|
|
2468
2468
|
}), e.log("Decorator Mounted"), !0;
|
|
2469
2469
|
}
|
|
2470
2470
|
unmount(t, e) {
|
|
2471
|
-
return t.removeEventListener("orientationchange", this.handleResizer), t.removeEventListener("resize", this.handleResizer), e.unregisterAll(
|
|
2471
|
+
return t.removeEventListener("orientationchange", this.handleResizer), t.removeEventListener("resize", this.handleResizer), e.unregisterAll(Pt.moduleName), this.resizeObserver.disconnect(), this.backgroundObserver.disconnect(), this.cleanup(), e.log("Decorator Unmounted"), !0;
|
|
2472
2472
|
}
|
|
2473
2473
|
};
|
|
2474
|
-
|
|
2475
|
-
let be =
|
|
2476
|
-
const
|
|
2474
|
+
Pt.moduleName = "decorator";
|
|
2475
|
+
let be = Pt;
|
|
2476
|
+
const pi = "readium-snapper-style", Et = class Et extends bt {
|
|
2477
2477
|
constructor() {
|
|
2478
2478
|
super(...arguments), this.protected = !1;
|
|
2479
2479
|
}
|
|
@@ -2486,34 +2486,34 @@ const di = "readium-snapper-style", _t = class _t extends yt {
|
|
|
2486
2486
|
}
|
|
2487
2487
|
mount(t, e) {
|
|
2488
2488
|
const i = t.document.createElement("style");
|
|
2489
|
-
return i.dataset.readium = "true", i.id =
|
|
2489
|
+
return i.dataset.readium = "true", i.id = pi, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", Et.moduleName, (n, r) => {
|
|
2490
2490
|
this.protected = !0, i.textContent = this.buildStyles(), r(!0);
|
|
2491
|
-
}), e.register("unprotect",
|
|
2491
|
+
}), e.register("unprotect", Et.moduleName, (n, r) => {
|
|
2492
2492
|
this.protected = !1, i.textContent = this.buildStyles(), r(!0);
|
|
2493
2493
|
}), e.log("Snapper Mounted"), !0;
|
|
2494
2494
|
}
|
|
2495
2495
|
unmount(t, e) {
|
|
2496
|
-
return t.document.getElementById(
|
|
2496
|
+
return t.document.getElementById(pi)?.remove(), e.log("Snapper Unmounted"), !0;
|
|
2497
2497
|
}
|
|
2498
2498
|
};
|
|
2499
|
-
|
|
2500
|
-
let
|
|
2499
|
+
Et.moduleName = "snapper";
|
|
2500
|
+
let Rt = Et;
|
|
2501
2501
|
function rt(s) {
|
|
2502
2502
|
return s.document.body.dir.toLowerCase() === "rtl";
|
|
2503
2503
|
}
|
|
2504
|
-
function
|
|
2504
|
+
function qi(s) {
|
|
2505
2505
|
return parseInt(
|
|
2506
2506
|
s.getComputedStyle(
|
|
2507
2507
|
s.document.documentElement
|
|
2508
2508
|
).getPropertyValue("column-count")
|
|
2509
2509
|
);
|
|
2510
2510
|
}
|
|
2511
|
-
function
|
|
2511
|
+
function mi(s) {
|
|
2512
2512
|
const t = getComputedStyle(s), e = parseFloat(t.paddingTop || "0"), i = parseFloat(t.paddingBottom || "0");
|
|
2513
2513
|
return s.clientHeight - e - i;
|
|
2514
2514
|
}
|
|
2515
|
-
function
|
|
2516
|
-
const t =
|
|
2515
|
+
function gi(s) {
|
|
2516
|
+
const t = qi(s);
|
|
2517
2517
|
if (!t)
|
|
2518
2518
|
return !1;
|
|
2519
2519
|
const e = s.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
@@ -2523,22 +2523,22 @@ function pi(s) {
|
|
|
2523
2523
|
if (l > 0)
|
|
2524
2524
|
for (let h = 0; h < l; h++) {
|
|
2525
2525
|
const c = s.document.createElement("div");
|
|
2526
|
-
c.setAttribute("id", `readium-virtual-page-${h}`), c.dataset.readium = "true", CSS.supports("break-before", "column") ? c.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (c.style.breakInside = "avoid-column"), c.style.height =
|
|
2526
|
+
c.setAttribute("id", `readium-virtual-page-${h}`), c.dataset.readium = "true", CSS.supports("break-before", "column") ? c.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (c.style.breakInside = "avoid-column"), c.style.height = mi(s.document.documentElement) + "px"), c.innerHTML = "​", s.document.body.appendChild(c);
|
|
2527
2527
|
}
|
|
2528
2528
|
return i !== l;
|
|
2529
2529
|
}
|
|
2530
|
-
function
|
|
2530
|
+
function Ki(s) {
|
|
2531
2531
|
const t = s.document.createElement("style");
|
|
2532
2532
|
t.appendChild(s.document.createTextNode("*{}")), s.document.body.appendChild(t), s.document.body.removeChild(t);
|
|
2533
2533
|
}
|
|
2534
|
-
function
|
|
2534
|
+
function Xn(s) {
|
|
2535
2535
|
return s < 0.5 ? 2 * s * s : -1 + (4 - 2 * s) * s;
|
|
2536
2536
|
}
|
|
2537
2537
|
function z(s) {
|
|
2538
2538
|
const t = s.getSelection();
|
|
2539
2539
|
t && t.removeAllRanges();
|
|
2540
2540
|
}
|
|
2541
|
-
const
|
|
2541
|
+
const Yn = [
|
|
2542
2542
|
"a",
|
|
2543
2543
|
"audio",
|
|
2544
2544
|
"button",
|
|
@@ -2552,11 +2552,11 @@ const $n = [
|
|
|
2552
2552
|
"textarea",
|
|
2553
2553
|
"video"
|
|
2554
2554
|
];
|
|
2555
|
-
function
|
|
2556
|
-
return
|
|
2555
|
+
function Zi(s) {
|
|
2556
|
+
return Yn.indexOf(s.nodeName.toLowerCase()) !== -1 || s.hasAttribute("contenteditable") && s.getAttribute("contenteditable")?.toLowerCase() !== "false" ? s : s.parentElement ? Zi(s.parentElement) : null;
|
|
2557
2557
|
}
|
|
2558
2558
|
function Fe(s, t) {
|
|
2559
|
-
const e =
|
|
2559
|
+
const e = Ji(s, s.document.body, t), i = s._readium_cssSelectorGenerator.getCssSelector(e, {
|
|
2560
2560
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2561
2561
|
});
|
|
2562
2562
|
return new N({
|
|
@@ -2567,20 +2567,20 @@ function Fe(s, t) {
|
|
|
2567
2567
|
["cssSelector", i]
|
|
2568
2568
|
])
|
|
2569
2569
|
}),
|
|
2570
|
-
text: new
|
|
2570
|
+
text: new at({
|
|
2571
2571
|
highlight: e.textContent || void 0
|
|
2572
2572
|
})
|
|
2573
2573
|
});
|
|
2574
2574
|
}
|
|
2575
|
-
function
|
|
2575
|
+
function Ji(s, t, e) {
|
|
2576
2576
|
for (var i = 0; i < t.children.length; i++) {
|
|
2577
2577
|
const n = t.children[i];
|
|
2578
|
-
if (!
|
|
2579
|
-
return
|
|
2578
|
+
if (!Zn(n) && qn(s, n, e))
|
|
2579
|
+
return Kn(s, n) ? n : Ji(s, n, e);
|
|
2580
2580
|
}
|
|
2581
2581
|
return t;
|
|
2582
2582
|
}
|
|
2583
|
-
function
|
|
2583
|
+
function qn(s, t, e) {
|
|
2584
2584
|
if (t === document.body || t === document.documentElement)
|
|
2585
2585
|
return !0;
|
|
2586
2586
|
if (!document || !document.documentElement || !document.body)
|
|
@@ -2588,11 +2588,11 @@ function Xn(s, t, e) {
|
|
|
2588
2588
|
const i = t.getBoundingClientRect();
|
|
2589
2589
|
return e ? i.bottom > 0 && i.top < s.innerHeight : i.right > 0 && i.left < s.innerWidth;
|
|
2590
2590
|
}
|
|
2591
|
-
function
|
|
2591
|
+
function Kn(s, t) {
|
|
2592
2592
|
const e = t.getBoundingClientRect();
|
|
2593
2593
|
return e.top >= 0 && e.left >= 0 && e.bottom <= s.innerHeight && e.right <= s.innerWidth;
|
|
2594
2594
|
}
|
|
2595
|
-
function
|
|
2595
|
+
function Zn(s) {
|
|
2596
2596
|
const t = getComputedStyle(s);
|
|
2597
2597
|
if (t) {
|
|
2598
2598
|
const e = t.getPropertyValue("display");
|
|
@@ -2601,7 +2601,7 @@ function qn(s) {
|
|
|
2601
2601
|
}
|
|
2602
2602
|
return !1;
|
|
2603
2603
|
}
|
|
2604
|
-
const
|
|
2604
|
+
const Jn = {
|
|
2605
2605
|
maxVelocity: 200,
|
|
2606
2606
|
// Reasonable default for human-like scrolling (pixels/ms)
|
|
2607
2607
|
minVariance: 0.01,
|
|
@@ -2612,7 +2612,7 @@ const Kn = {
|
|
|
2612
2612
|
// Reasonable default for detecting patterns
|
|
2613
2613
|
maxConsistentScrolls: 15
|
|
2614
2614
|
// Balanced threshold for flagging
|
|
2615
|
-
},
|
|
2615
|
+
}, Qi = {
|
|
2616
2616
|
maxVelocity: 200,
|
|
2617
2617
|
// Extremely fast scrolling (pixels/ms)
|
|
2618
2618
|
minVariance: 1e-5,
|
|
@@ -2623,11 +2623,11 @@ const Kn = {
|
|
|
2623
2623
|
// Only trigger on near-perfect patterns
|
|
2624
2624
|
maxConsistentScrolls: 20
|
|
2625
2625
|
// Need many consistent scrolls
|
|
2626
|
-
},
|
|
2626
|
+
}, tn = {
|
|
2627
2627
|
maxSelectionsPerSecond: 500,
|
|
2628
2628
|
minVariance: 50,
|
|
2629
2629
|
historySize: 20
|
|
2630
|
-
},
|
|
2630
|
+
}, Qn = {
|
|
2631
2631
|
enabled: !0,
|
|
2632
2632
|
maxSelectionPercent: 0.1,
|
|
2633
2633
|
minThreshold: 100,
|
|
@@ -2636,7 +2636,7 @@ const Kn = {
|
|
|
2636
2636
|
};
|
|
2637
2637
|
class Ue {
|
|
2638
2638
|
constructor(t = {}) {
|
|
2639
|
-
this.history = [], this.consistentScrollCount = 0, this.options = { ...
|
|
2639
|
+
this.history = [], this.consistentScrollCount = 0, this.options = { ...Jn, ...t };
|
|
2640
2640
|
}
|
|
2641
2641
|
analyze(t, e, i) {
|
|
2642
2642
|
if (i <= 0) return !1;
|
|
@@ -2667,7 +2667,7 @@ class Ue {
|
|
|
2667
2667
|
this.history = [], this.consistentScrollCount = 0;
|
|
2668
2668
|
}
|
|
2669
2669
|
}
|
|
2670
|
-
const
|
|
2670
|
+
const fi = "readium-column-snapper-style", tr = 200, U = class U extends Rt {
|
|
2671
2671
|
constructor() {
|
|
2672
2672
|
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
2673
|
}
|
|
@@ -2705,15 +2705,15 @@ const mi = "readium-column-snapper-style", Jn = 200, U = class U extends Ct {
|
|
|
2705
2705
|
}
|
|
2706
2706
|
// Snaps the current offset to the page width.
|
|
2707
2707
|
snapCurrentOffset(t = !1, e = !1) {
|
|
2708
|
-
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, n = this.doc(), r = this.dragOffset(), o =
|
|
2708
|
+
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, n = this.doc(), r = this.dragOffset(), o = qi(this.wnd), a = Math.min(Math.max(0, i), this.cachedScrollWidth), l = rt(this.wnd) ? -1 : 1, h = (
|
|
2709
2709
|
// The hurdle to overcome in order to change pages
|
|
2710
2710
|
l * (this.wnd.innerWidth / 3) * (l * r > 0 ? 2 : 1)
|
|
2711
2711
|
), c = this.snapOffset(a + h), u = c > this.scrollOffset() ? "right" : "left";
|
|
2712
2712
|
if (this.checkSuspiciousSnap(u, Math.abs(c - this.scrollOffset())), t && c !== this.scrollOffset()) {
|
|
2713
2713
|
this.snappingCancelled = !1;
|
|
2714
|
-
const m = (b, v, k, Q) => k > Q ? v : b + (v - b) *
|
|
2714
|
+
const m = (b, v, k, Q) => k > Q ? v : b + (v - b) * Xn(k / Q), y = (
|
|
2715
2715
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2716
|
-
|
|
2716
|
+
tr * o
|
|
2717
2717
|
);
|
|
2718
2718
|
let d;
|
|
2719
2719
|
const p = (b) => {
|
|
@@ -2791,7 +2791,7 @@ const mi = "readium-column-snapper-style", Jn = 200, U = class U extends Ct {
|
|
|
2791
2791
|
if (this.wnd = t, this.comms = e, !super.mount(t, e)) return !1;
|
|
2792
2792
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
2793
2793
|
const i = t.document.createElement("style");
|
|
2794
|
-
i.dataset.readium = "true", i.id =
|
|
2794
|
+
i.dataset.readium = "true", i.id = fi, i.textContent = `
|
|
2795
2795
|
@keyframes readium-bounce-l-animation {
|
|
2796
2796
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2797
2797
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2827,14 +2827,14 @@ const mi = "readium-column-snapper-style", Jn = 200, U = class U extends Ct {
|
|
|
2827
2827
|
}
|
|
2828
2828
|
`, t.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2829
2829
|
t.requestAnimationFrame(() => {
|
|
2830
|
-
t &&
|
|
2830
|
+
t && gi(t);
|
|
2831
2831
|
}), this.onWidthChange();
|
|
2832
2832
|
}), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((r) => {
|
|
2833
2833
|
for (const o of r)
|
|
2834
2834
|
if (o.target === this.wnd.document.documentElement) {
|
|
2835
2835
|
const a = o.oldValue, l = o.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, c = a?.match(h), u = l?.match(h);
|
|
2836
2836
|
(!c && !u || c && !u || c && u && c[1] !== u[1]) && (t.requestAnimationFrame(() => {
|
|
2837
|
-
t &&
|
|
2837
|
+
t && gi(t);
|
|
2838
2838
|
}), this.onWidthChange());
|
|
2839
2839
|
} else
|
|
2840
2840
|
t.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
@@ -2870,7 +2870,7 @@ const mi = "readium-column-snapper-style", Jn = 200, U = class U extends Ct {
|
|
|
2870
2870
|
}), e.register("go_text", U.moduleName, (r, o) => {
|
|
2871
2871
|
let a;
|
|
2872
2872
|
Array.isArray(r) && (r.length > 1 && (a = r[1]), r = r[0]);
|
|
2873
|
-
const l =
|
|
2873
|
+
const l = at.deserialize(r), h = ie(this.wnd.document, new N({
|
|
2874
2874
|
href: t.location.href,
|
|
2875
2875
|
type: "text/html",
|
|
2876
2876
|
text: l,
|
|
@@ -2927,12 +2927,12 @@ const mi = "readium-column-snapper-style", Jn = 200, U = class U extends Ct {
|
|
|
2927
2927
|
}), e.log("ColumnSnapper Mounted"), !0;
|
|
2928
2928
|
}
|
|
2929
2929
|
unmount(t, e) {
|
|
2930
|
-
return this.snappingCancelled = !0, e.unregisterAll(U.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(
|
|
2930
|
+
return this.snappingCancelled = !0, e.unregisterAll(U.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(fi)?.remove(), e.log("ColumnSnapper Unmounted"), super.unmount(t, e);
|
|
2931
2931
|
}
|
|
2932
2932
|
};
|
|
2933
2933
|
U.moduleName = "column_snapper";
|
|
2934
2934
|
let ve = U;
|
|
2935
|
-
const
|
|
2935
|
+
const yi = "readium-scroll-snapper-style", W = class W extends Rt {
|
|
2936
2936
|
constructor() {
|
|
2937
2937
|
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) => {
|
|
2938
2938
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -2978,12 +2978,12 @@ const gi = "readium-scroll-snapper-style", W = class W extends Ct {
|
|
|
2978
2978
|
});
|
|
2979
2979
|
}
|
|
2980
2980
|
enableScrollProtection() {
|
|
2981
|
-
this.patternAnalyzer || (this.patternAnalyzer = new Ue(
|
|
2981
|
+
this.patternAnalyzer || (this.patternAnalyzer = new Ue(Qi), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
2982
2982
|
}
|
|
2983
2983
|
mount(t, e) {
|
|
2984
2984
|
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");
|
|
2985
2985
|
const i = t.document.createElement("style");
|
|
2986
|
-
return i.dataset.readium = "true", i.id =
|
|
2986
|
+
return i.dataset.readium = "true", i.id = yi, i.textContent = `
|
|
2987
2987
|
* {
|
|
2988
2988
|
scrollbar-width: none; /* for Firefox */
|
|
2989
2989
|
}
|
|
@@ -2996,7 +2996,7 @@ const gi = "readium-scroll-snapper-style", W = class W extends Ct {
|
|
|
2996
2996
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
2997
2997
|
}, 50);
|
|
2998
2998
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", W.moduleName, () => {
|
|
2999
|
-
|
|
2999
|
+
Ki(this.wnd);
|
|
3000
3000
|
const n = this.doc().scrollTop;
|
|
3001
3001
|
n > 1 ? this.doc().scrollTop = n - 1 : this.doc().scrollTop = n + 1, this.doc().scrollTop = n;
|
|
3002
3002
|
}), e.register("go_progression", W.moduleName, (n, r) => {
|
|
@@ -3022,7 +3022,7 @@ const gi = "readium-scroll-snapper-style", W = class W extends Ct {
|
|
|
3022
3022
|
}), e.register("go_text", W.moduleName, (n, r) => {
|
|
3023
3023
|
let o;
|
|
3024
3024
|
Array.isArray(n) && (n.length > 1 && (o = n[1]), n = n[0]);
|
|
3025
|
-
const a =
|
|
3025
|
+
const a = at.deserialize(n), l = ie(this.wnd.document, new N({
|
|
3026
3026
|
href: t.location.href,
|
|
3027
3027
|
type: "text/html",
|
|
3028
3028
|
text: a,
|
|
@@ -3060,12 +3060,12 @@ const gi = "readium-scroll-snapper-style", W = class W extends Ct {
|
|
|
3060
3060
|
}), e.log("ScrollSnapper Mounted"), !0;
|
|
3061
3061
|
}
|
|
3062
3062
|
unmount(t, e) {
|
|
3063
|
-
return e.unregisterAll(W.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(
|
|
3063
|
+
return e.unregisterAll(W.moduleName), this.resizeObserver.disconnect(), this.handleScroll && t.removeEventListener("scroll", this.handleScroll), t.document.getElementById(yi)?.remove(), this.patternAnalyzer && (this.patternAnalyzer.clear(), this.patternAnalyzer = null, this.isScrollProtectionEnabled = !1), e.log("ScrollSnapper Unmounted"), !0;
|
|
3064
3064
|
}
|
|
3065
3065
|
};
|
|
3066
3066
|
W.moduleName = "scroll_snapper";
|
|
3067
3067
|
let we = W;
|
|
3068
|
-
const H = class H extends
|
|
3068
|
+
const H = class H extends Rt {
|
|
3069
3069
|
constructor() {
|
|
3070
3070
|
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) => {
|
|
3071
3071
|
if (this.comms.ready && !this.isResizing) {
|
|
@@ -3111,7 +3111,7 @@ const H = class H extends Ct {
|
|
|
3111
3111
|
});
|
|
3112
3112
|
}
|
|
3113
3113
|
enableScrollProtection() {
|
|
3114
|
-
this.patternAnalyzer || (this.patternAnalyzer = new Ue(
|
|
3114
|
+
this.patternAnalyzer || (this.patternAnalyzer = new Ue(Qi), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
3115
3115
|
}
|
|
3116
3116
|
mount(t, e) {
|
|
3117
3117
|
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(() => {
|
|
@@ -3119,7 +3119,7 @@ const H = class H extends Ct {
|
|
|
3119
3119
|
this.isResizing = !1, this.resizeDebounce = null, this.reportProgress();
|
|
3120
3120
|
}, 50);
|
|
3121
3121
|
}), this.resizeObserver.observe(t.document.body), t.addEventListener("scroll", this.handleScroll, { passive: !0 }), e.register("force_webkit_recalc", H.moduleName, () => {
|
|
3122
|
-
|
|
3122
|
+
Ki(this.wnd);
|
|
3123
3123
|
const i = this.doc().scrollTop;
|
|
3124
3124
|
i > 1 ? this.doc().scrollTop = i - 1 : this.doc().scrollTop = i + 1, this.doc().scrollTop = i;
|
|
3125
3125
|
}), e.register("go_progression", H.moduleName, (i, n) => {
|
|
@@ -3145,7 +3145,7 @@ const H = class H extends Ct {
|
|
|
3145
3145
|
}), e.register("go_text", H.moduleName, (i, n) => {
|
|
3146
3146
|
let r;
|
|
3147
3147
|
Array.isArray(i) && (i.length > 1 && (r = i[1]), i = i[0]);
|
|
3148
|
-
const o =
|
|
3148
|
+
const o = at.deserialize(i), a = ie(this.wnd.document, new N({
|
|
3149
3149
|
href: t.location.href,
|
|
3150
3150
|
type: "text/html",
|
|
3151
3151
|
text: o,
|
|
@@ -3188,7 +3188,7 @@ const H = class H extends Ct {
|
|
|
3188
3188
|
};
|
|
3189
3189
|
H.moduleName = "webpub_snapper";
|
|
3190
3190
|
let _e = H;
|
|
3191
|
-
class
|
|
3191
|
+
class er {
|
|
3192
3192
|
constructor(t, e) {
|
|
3193
3193
|
this.window = t, this.copyHistory = [], this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.options = e;
|
|
3194
3194
|
}
|
|
@@ -3228,8 +3228,8 @@ class Qn {
|
|
|
3228
3228
|
this.lastSelectionLength = 0, this.lastSelectionTime = 0, this.copyHistory = [], this.options.enabled = !1;
|
|
3229
3229
|
}
|
|
3230
3230
|
}
|
|
3231
|
-
class
|
|
3232
|
-
constructor(t =
|
|
3231
|
+
class ir {
|
|
3232
|
+
constructor(t = tn) {
|
|
3233
3233
|
this.options = t, this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3234
3234
|
}
|
|
3235
3235
|
analyze(t) {
|
|
@@ -3270,7 +3270,7 @@ class tr {
|
|
|
3270
3270
|
this.events = [], this.selectionStartTime = 0, this.lastSelectionTime = 0, this.lastSelectionPosition = 0, this.selectionPatterns = [], this.lastSelectedText = "";
|
|
3271
3271
|
}
|
|
3272
3272
|
}
|
|
3273
|
-
class
|
|
3273
|
+
class en {
|
|
3274
3274
|
/**
|
|
3275
3275
|
* Checks if the given keyboard event matches any of the provided key combinations
|
|
3276
3276
|
*/
|
|
@@ -3348,9 +3348,9 @@ class Zi {
|
|
|
3348
3348
|
};
|
|
3349
3349
|
}
|
|
3350
3350
|
}
|
|
3351
|
-
const
|
|
3351
|
+
const gt = class gt extends bt {
|
|
3352
3352
|
constructor() {
|
|
3353
|
-
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
|
|
3353
|
+
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 en(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
|
|
3354
3354
|
if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
|
|
3355
3355
|
return !0;
|
|
3356
3356
|
if (!this.bulkCopyProtector.shouldAllowCopy(t)) {
|
|
@@ -3471,16 +3471,16 @@ const pt = class pt extends yt {
|
|
|
3471
3471
|
}
|
|
3472
3472
|
addBulkCopyProtection(t = {}) {
|
|
3473
3473
|
if (this.isBulkCopyProtectionEnabled || !this.wnd) return;
|
|
3474
|
-
const e =
|
|
3475
|
-
this.bulkCopyProtector = new
|
|
3474
|
+
const e = Qn, i = t ? { ...e, ...t } : e;
|
|
3475
|
+
this.bulkCopyProtector = new er(this.wnd, i), this.wnd.document.addEventListener("copy", this.preventBulkCopy, !0), this.wnd.document.addEventListener("cut", this.preventBulkCopy, !0), this.isBulkCopyProtectionEnabled = !0;
|
|
3476
3476
|
}
|
|
3477
3477
|
removeBulkCopyProtection() {
|
|
3478
3478
|
!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);
|
|
3479
3479
|
}
|
|
3480
3480
|
addSelectionMonitoring(t) {
|
|
3481
3481
|
if (this.isSelectionMonitoringEnabled || !this.wnd) return;
|
|
3482
|
-
const e = t ||
|
|
3483
|
-
this.selectionAnalyzer = new
|
|
3482
|
+
const e = t || tn;
|
|
3483
|
+
this.selectionAnalyzer = new ir(e), this.wnd.document.addEventListener("selectionchange", this.handleSelection), this.isSelectionMonitoringEnabled = !0;
|
|
3484
3484
|
}
|
|
3485
3485
|
removeSelectionMonitoring() {
|
|
3486
3486
|
!this.isSelectionMonitoringEnabled || !this.wnd || (this.wnd.document.removeEventListener("selectionchange", this.handleSelection), this.selectionAnalyzer?.clear(), this.selectionAnalyzer = null, this.isSelectionMonitoringEnabled = !1);
|
|
@@ -3513,7 +3513,7 @@ const pt = class pt extends yt {
|
|
|
3513
3513
|
y: t.clientY * i,
|
|
3514
3514
|
targetFrameSrc: this.wnd.location.href,
|
|
3515
3515
|
targetElement: t.target.outerHTML,
|
|
3516
|
-
interactiveElement:
|
|
3516
|
+
interactiveElement: Zi(t.target)?.outerHTML,
|
|
3517
3517
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(t.target)
|
|
3518
3518
|
}), this.pointerMoved = !1;
|
|
3519
3519
|
}
|
|
@@ -3540,7 +3540,7 @@ const pt = class pt extends yt {
|
|
|
3540
3540
|
}
|
|
3541
3541
|
}
|
|
3542
3542
|
registerProtectionHandlers() {
|
|
3543
|
-
this.comms?.register("peripherals_protection",
|
|
3543
|
+
this.comms?.register("peripherals_protection", gt.moduleName, (t, e) => {
|
|
3544
3544
|
const i = t;
|
|
3545
3545
|
if (!this.configApplied) {
|
|
3546
3546
|
if (this.configApplied = !0, i.monitorSelection) {
|
|
@@ -3558,7 +3558,7 @@ const pt = class pt extends yt {
|
|
|
3558
3558
|
}), this.comms?.log("Copy protection enabled")), i.disableContextMenu && (this.addContextMenuPrevention(), this.comms?.log("Context menu protection enabled")), i.disableDragAndDrop && (this.addDragAndDropPrevention(), this.comms?.log("Drag and drop protection enabled"));
|
|
3559
3559
|
}
|
|
3560
3560
|
e(!0);
|
|
3561
|
-
}), this.comms?.register("keyboard_peripherals",
|
|
3561
|
+
}), this.comms?.register("keyboard_peripherals", gt.moduleName, (t, e) => {
|
|
3562
3562
|
const i = t;
|
|
3563
3563
|
i && i.length > 0 && (this.enableKeyboardPeripherals(i), this.comms?.log(`Keyboard peripherals enabled: ${i.map((n) => n.type).join(", ")}`)), e(!0);
|
|
3564
3564
|
});
|
|
@@ -3567,12 +3567,12 @@ const pt = class pt extends yt {
|
|
|
3567
3567
|
return this.wnd = t, this.comms = e, this.registerProtectionHandlers(), t.document.addEventListener("pointerdown", this.onPointerDown), t.document.addEventListener("pointerup", this.onPointerUp), t.document.addEventListener("pointermove", this.onPointerMove), t.document.addEventListener("click", this.onClicker), e.log("Peripherals Mounted"), !0;
|
|
3568
3568
|
}
|
|
3569
3569
|
unmount(t, e) {
|
|
3570
|
-
return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(
|
|
3570
|
+
return this.removeBulkCopyProtection(), this.removeSelectionMonitoring(), this.removeContextMenuPrevention(), this.removeDragAndDropPrevention(), this.disableKeyboardPeripherals(), this.cleanupCallbacks.forEach((i) => i()), this.cleanupCallbacks = [], t.document.removeEventListener("pointerdown", this.onPointerDown), t.document.removeEventListener("pointerup", this.onPointerUp), t.document.removeEventListener("pointermove", this.onPointerMove), t.document.removeEventListener("click", this.onClicker), e.unregisterAll(gt.moduleName), this.configApplied = !1, e.log("Peripherals Unmounted"), !0;
|
|
3571
3571
|
}
|
|
3572
3572
|
};
|
|
3573
|
-
|
|
3574
|
-
let Pe =
|
|
3575
|
-
const
|
|
3573
|
+
gt.moduleName = "peripherals";
|
|
3574
|
+
let Pe = gt;
|
|
3575
|
+
const Ct = class Ct extends bt {
|
|
3576
3576
|
constructor() {
|
|
3577
3577
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
3578
3578
|
}
|
|
@@ -3622,7 +3622,7 @@ const Pt = class Pt extends yt {
|
|
|
3622
3622
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
3623
3623
|
value: {
|
|
3624
3624
|
name: "readium-ts-toolkit",
|
|
3625
|
-
version: "2.4.0-beta.
|
|
3625
|
+
version: "2.4.0-beta.11",
|
|
3626
3626
|
hasFeature: (n, r = "") => {
|
|
3627
3627
|
switch (n) {
|
|
3628
3628
|
case "dom-manipulation":
|
|
@@ -3647,11 +3647,11 @@ const Pt = class Pt extends yt {
|
|
|
3647
3647
|
writable: !1
|
|
3648
3648
|
}), "getAnimations" in t.document && t.document.getAnimations().forEach((n) => {
|
|
3649
3649
|
n.cancel(), this.allAnimations.add(n);
|
|
3650
|
-
}), e.register("activate",
|
|
3650
|
+
}), e.register("activate", Ct.moduleName, (n, r) => {
|
|
3651
3651
|
this.allAnimations.forEach((o) => {
|
|
3652
3652
|
o.cancel(), o.play();
|
|
3653
3653
|
}), r(!0);
|
|
3654
|
-
}), e.register("unfocus",
|
|
3654
|
+
}), e.register("unfocus", Ct.moduleName, (n, r) => {
|
|
3655
3655
|
this.pauseAllMedia(t), this.allAnimations.forEach((o) => o.pause()), r(!0);
|
|
3656
3656
|
});
|
|
3657
3657
|
const i = t.document.querySelectorAll("audio,video");
|
|
@@ -3669,17 +3669,17 @@ const Pt = class Pt extends yt {
|
|
|
3669
3669
|
return t.removeEventListener("error", this.wndOnErr), t.removeEventListener("play", this.onMediaPlayEvent), t.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((i) => i.cancel()), this.allAnimations.clear(), e.log("Setup Unmounted"), !0;
|
|
3670
3670
|
}
|
|
3671
3671
|
};
|
|
3672
|
-
|
|
3673
|
-
let Bt =
|
|
3674
|
-
const
|
|
3672
|
+
Ct.moduleName = "setup";
|
|
3673
|
+
let Bt = Ct;
|
|
3674
|
+
const Si = "readium-viewport", K = class K extends Bt {
|
|
3675
3675
|
onViewportWidthChanged(t) {
|
|
3676
3676
|
const e = t.target;
|
|
3677
|
-
|
|
3677
|
+
xt(e, "--RS__viewportWidth", `${e.innerWidth}px`);
|
|
3678
3678
|
}
|
|
3679
3679
|
mount(t, e) {
|
|
3680
3680
|
if (!super.mount(t, e)) return !1;
|
|
3681
3681
|
const i = t.document.createElement("meta");
|
|
3682
|
-
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id",
|
|
3682
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", Si), i.setAttribute(
|
|
3683
3683
|
"content",
|
|
3684
3684
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3685
3685
|
), t.document.head.appendChild(i), t.addEventListener("orientationchange", this.onViewportWidthChanged), t.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
@@ -3687,10 +3687,10 @@ const fi = "readium-viewport", K = class K extends Bt {
|
|
|
3687
3687
|
}), e.register("get_properties", K.moduleName, (n, r) => {
|
|
3688
3688
|
Ne(t), r(!0);
|
|
3689
3689
|
}), e.register("update_properties", K.moduleName, (n, r) => {
|
|
3690
|
-
n["--RS__viewportWidth"] = `${t.innerWidth}px`,
|
|
3690
|
+
n["--RS__viewportWidth"] = `${t.innerWidth}px`, Yi(t, n), r(!0);
|
|
3691
3691
|
}), e.register("set_property", K.moduleName, (n, r) => {
|
|
3692
3692
|
const o = n;
|
|
3693
|
-
|
|
3693
|
+
xt(t, o[0], o[1]), r(!0);
|
|
3694
3694
|
}), e.register("remove_property", K.moduleName, (n, r) => {
|
|
3695
3695
|
ne(t, n), r(!0);
|
|
3696
3696
|
}), e.register("activate", K.moduleName, (n, r) => {
|
|
@@ -3698,17 +3698,17 @@ const fi = "readium-viewport", K = class K extends Bt {
|
|
|
3698
3698
|
}), e.log("ReflowableSetup Mounted"), !0;
|
|
3699
3699
|
}
|
|
3700
3700
|
unmount(t, e) {
|
|
3701
|
-
return e.unregisterAll(K.moduleName), t.document.head.querySelector(`#${
|
|
3701
|
+
return e.unregisterAll(K.moduleName), t.document.head.querySelector(`#${Si}`)?.remove(), t.removeEventListener("orientationchange", this.onViewportWidthChanged), e.log("ReflowableSetup Unmounted"), super.unmount(t, e);
|
|
3702
3702
|
}
|
|
3703
3703
|
};
|
|
3704
3704
|
K.moduleName = "reflowable_setup";
|
|
3705
3705
|
let Ee = K;
|
|
3706
|
-
const
|
|
3706
|
+
const bi = "readium-fixed-style", X = class X extends Bt {
|
|
3707
3707
|
mount(t, e) {
|
|
3708
3708
|
if (!super.mount(t, e)) return !1;
|
|
3709
3709
|
t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "paginated");
|
|
3710
3710
|
const i = t.document.createElement("style");
|
|
3711
|
-
return i.id =
|
|
3711
|
+
return i.id = bi, i.dataset.readium = "true", i.textContent = `
|
|
3712
3712
|
html, body {
|
|
3713
3713
|
text-size-adjust: none;
|
|
3714
3714
|
-ms-text-size-adjust: none;
|
|
@@ -3722,7 +3722,7 @@ const yi = "readium-fixed-style", X = class X extends Bt {
|
|
|
3722
3722
|
/*cursor: var() TODO*/
|
|
3723
3723
|
}`, t.document.head.appendChild(i), e.register("set_property", X.moduleName, (n, r) => {
|
|
3724
3724
|
const o = n;
|
|
3725
|
-
|
|
3725
|
+
xt(t, o[0], o[1]), r(!0);
|
|
3726
3726
|
}), e.register("remove_property", X.moduleName, (n, r) => {
|
|
3727
3727
|
ne(t, n), r(!0);
|
|
3728
3728
|
}), e.register("first_visible_locator", X.moduleName, (n, r) => r(!1)), e.register("unfocus", X.moduleName, (n, r) => {
|
|
@@ -3741,12 +3741,12 @@ const yi = "readium-fixed-style", X = class X extends Bt {
|
|
|
3741
3741
|
}), e.log("FixedSetup Mounted"), !0;
|
|
3742
3742
|
}
|
|
3743
3743
|
unmount(t, e) {
|
|
3744
|
-
return e.unregisterAll(X.moduleName), t.document.getElementById(
|
|
3744
|
+
return e.unregisterAll(X.moduleName), t.document.getElementById(bi)?.remove(), e.log("FixedSetup Unmounted"), super.unmount(t, e);
|
|
3745
3745
|
}
|
|
3746
3746
|
};
|
|
3747
3747
|
X.moduleName = "fixed_setup";
|
|
3748
3748
|
let Ce = X;
|
|
3749
|
-
const Z = class Z extends
|
|
3749
|
+
const Z = class Z extends bt {
|
|
3750
3750
|
wndOnErr(t) {
|
|
3751
3751
|
this.comms?.send("error", {
|
|
3752
3752
|
message: t.message,
|
|
@@ -3763,10 +3763,10 @@ const Z = class Z extends yt {
|
|
|
3763
3763
|
), e.register("get_properties", Z.moduleName, (i, n) => {
|
|
3764
3764
|
Ne(t), n(!0);
|
|
3765
3765
|
}), e.register("update_properties", Z.moduleName, (i, n) => {
|
|
3766
|
-
|
|
3766
|
+
Yi(t, i), n(!0);
|
|
3767
3767
|
}), e.register("set_property", Z.moduleName, (i, n) => {
|
|
3768
3768
|
const r = i;
|
|
3769
|
-
|
|
3769
|
+
xt(t, r[0], r[1]), n(!0);
|
|
3770
3770
|
}), e.register("remove_property", Z.moduleName, (i, n) => {
|
|
3771
3771
|
ne(t, i), n(!0);
|
|
3772
3772
|
}), e.register("activate", Z.moduleName, (i, n) => {
|
|
@@ -3780,7 +3780,7 @@ const Z = class Z extends yt {
|
|
|
3780
3780
|
Z.moduleName = "webpub_setup";
|
|
3781
3781
|
let xe = Z;
|
|
3782
3782
|
var it;
|
|
3783
|
-
let
|
|
3783
|
+
let nr = (it = class extends bt {
|
|
3784
3784
|
constructor() {
|
|
3785
3785
|
super(...arguments), this.styleElement = null, this.beforePrintHandler = null, this.configApplied = !1;
|
|
3786
3786
|
}
|
|
@@ -3816,19 +3816,19 @@ let er = (it = class extends yt {
|
|
|
3816
3816
|
return this.beforePrintHandler && (t.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null), this.comms?.unregisterAll(it.moduleName), this.configApplied = !1, !0;
|
|
3817
3817
|
}
|
|
3818
3818
|
}, it.moduleName = "print_protection", it);
|
|
3819
|
-
const
|
|
3819
|
+
const rr = [
|
|
3820
3820
|
"fixed_setup",
|
|
3821
3821
|
"decorator",
|
|
3822
3822
|
"peripherals",
|
|
3823
3823
|
"print_protection"
|
|
3824
|
-
],
|
|
3824
|
+
], sr = [
|
|
3825
3825
|
"reflowable_setup",
|
|
3826
3826
|
"decorator",
|
|
3827
3827
|
"peripherals",
|
|
3828
3828
|
"column_snapper",
|
|
3829
3829
|
"scroll_snapper",
|
|
3830
3830
|
"print_protection"
|
|
3831
|
-
],
|
|
3831
|
+
], or = [
|
|
3832
3832
|
"webpub_setup",
|
|
3833
3833
|
"webpub_snapper",
|
|
3834
3834
|
"decorator",
|
|
@@ -3844,15 +3844,15 @@ const ir = [
|
|
|
3844
3844
|
be,
|
|
3845
3845
|
ve,
|
|
3846
3846
|
we,
|
|
3847
|
-
|
|
3847
|
+
nr
|
|
3848
3848
|
].map((s) => [s.moduleName, s]));
|
|
3849
|
-
class
|
|
3849
|
+
class St {
|
|
3850
3850
|
/**
|
|
3851
3851
|
* @param wnd Window instance to operate on
|
|
3852
3852
|
* @param initialModules List of initial modules to load
|
|
3853
3853
|
*/
|
|
3854
3854
|
constructor(t = window, e = []) {
|
|
3855
|
-
this.loadedModules = [], this.wnd = t, this.comms = new
|
|
3855
|
+
this.loadedModules = [], this.wnd = t, this.comms = new Tn(t);
|
|
3856
3856
|
const i = [...new Set(e)];
|
|
3857
3857
|
if (i.length) {
|
|
3858
3858
|
if (typeof t > "u")
|
|
@@ -3896,7 +3896,7 @@ class ft {
|
|
|
3896
3896
|
this.comms.destroy(), this.loadedModules.forEach((t) => t.unmount(this.wnd, this.comms)), this.loadedModules = [];
|
|
3897
3897
|
}
|
|
3898
3898
|
}
|
|
3899
|
-
const
|
|
3899
|
+
const ar = {
|
|
3900
3900
|
type: "developer_tools",
|
|
3901
3901
|
keyCombos: [
|
|
3902
3902
|
{ keyCode: 73, meta: !0, alt: !0 },
|
|
@@ -3920,7 +3920,7 @@ const sr = {
|
|
|
3920
3920
|
{ keyCode: 123, meta: !0, alt: !0 }
|
|
3921
3921
|
// F12+Meta+Alt
|
|
3922
3922
|
]
|
|
3923
|
-
},
|
|
3923
|
+
}, lr = {
|
|
3924
3924
|
type: "select_all",
|
|
3925
3925
|
keyCombos: [
|
|
3926
3926
|
{ keyCode: 65, meta: !0 },
|
|
@@ -3928,7 +3928,7 @@ const sr = {
|
|
|
3928
3928
|
{ keyCode: 65, ctrl: !0 }
|
|
3929
3929
|
// A key (Ctrl+A)
|
|
3930
3930
|
]
|
|
3931
|
-
},
|
|
3931
|
+
}, hr = {
|
|
3932
3932
|
type: "print",
|
|
3933
3933
|
keyCombos: [
|
|
3934
3934
|
{ keyCode: 80, meta: !0 },
|
|
@@ -3944,7 +3944,7 @@ const sr = {
|
|
|
3944
3944
|
{ keyCode: 80, ctrl: !0, alt: !0 }
|
|
3945
3945
|
// P key (Ctrl+Alt+P)
|
|
3946
3946
|
]
|
|
3947
|
-
},
|
|
3947
|
+
}, cr = {
|
|
3948
3948
|
type: "save",
|
|
3949
3949
|
keyCombos: [
|
|
3950
3950
|
{ keyCode: 83, meta: !0 },
|
|
@@ -3953,7 +3953,7 @@ const sr = {
|
|
|
3953
3953
|
// S key (Ctrl+S)
|
|
3954
3954
|
]
|
|
3955
3955
|
};
|
|
3956
|
-
class
|
|
3956
|
+
class nn {
|
|
3957
3957
|
/**
|
|
3958
3958
|
* Merges keyboard peripherals from content protection config with user-provided peripherals
|
|
3959
3959
|
* Content protection peripherals are added first for priority, then user peripherals are added only if they don't conflict
|
|
@@ -3962,7 +3962,7 @@ class Ji {
|
|
|
3962
3962
|
const i = [], n = e.filter(
|
|
3963
3963
|
(r) => !["developer_tools", "select_all", "print", "save"].includes(r.type)
|
|
3964
3964
|
);
|
|
3965
|
-
t.disableSelectAll && i.push(
|
|
3965
|
+
t.disableSelectAll && i.push(lr), t.disableSave && i.push(cr), t.monitorDevTools && i.push(ar), t.protectPrinting?.disable && i.push(hr);
|
|
3966
3966
|
for (const r of n) {
|
|
3967
3967
|
const o = r.keyCombos.filter(
|
|
3968
3968
|
(a) => !i.some(
|
|
@@ -3979,7 +3979,7 @@ class Ji {
|
|
|
3979
3979
|
return i;
|
|
3980
3980
|
}
|
|
3981
3981
|
}
|
|
3982
|
-
class
|
|
3982
|
+
class rn extends nn {
|
|
3983
3983
|
/**
|
|
3984
3984
|
* Moves to the left content portion (eg. page) relative to the reading progression direction.
|
|
3985
3985
|
*/
|
|
@@ -3993,9 +3993,9 @@ class Qi extends Ji {
|
|
|
3993
3993
|
this.readingProgression === D.ltr ? this.goForward(t, e) : this.readingProgression === D.rtl && this.goBackward(t, e);
|
|
3994
3994
|
}
|
|
3995
3995
|
}
|
|
3996
|
-
class
|
|
3996
|
+
class dr extends nn {
|
|
3997
3997
|
}
|
|
3998
|
-
class
|
|
3998
|
+
class ur {
|
|
3999
3999
|
constructor(t, e, i, n) {
|
|
4000
4000
|
this.injector = null, this.pub = t, this.item = i, this.burl = i.toURL(e) || "", this.cssProperties = n.cssProperties, this.injector = n.injector ?? null;
|
|
4001
4001
|
}
|
|
@@ -4045,8 +4045,8 @@ class cr {
|
|
|
4045
4045
|
return n + o;
|
|
4046
4046
|
}
|
|
4047
4047
|
}
|
|
4048
|
-
const
|
|
4049
|
-
class
|
|
4048
|
+
const pr = 1e4;
|
|
4049
|
+
class Lt {
|
|
4050
4050
|
constructor(t, e) {
|
|
4051
4051
|
this.registry = /* @__PURE__ */ new Map(), this._ready = !1, this.listenerBuffer = [], this.handler = this.handle.bind(this), this.wnd = t, this.origin = e;
|
|
4052
4052
|
try {
|
|
@@ -4056,7 +4056,7 @@ class xt {
|
|
|
4056
4056
|
}
|
|
4057
4057
|
this.gc = setInterval(() => {
|
|
4058
4058
|
this.registry.forEach((i, n) => {
|
|
4059
|
-
performance.now() - i.time >
|
|
4059
|
+
performance.now() - i.time > pr && (console.warn(n, "event for", i.key, "was never handled!"), this.registry.delete(n));
|
|
4060
4060
|
});
|
|
4061
4061
|
}, 5e3), window.addEventListener("message", this.handler), this.send("_ping", void 0);
|
|
4062
4062
|
}
|
|
@@ -4112,7 +4112,7 @@ class xt {
|
|
|
4112
4112
|
key: t
|
|
4113
4113
|
}), this.wnd.postMessage(
|
|
4114
4114
|
{
|
|
4115
|
-
_readium:
|
|
4115
|
+
_readium: ut,
|
|
4116
4116
|
_channel: this.channelId,
|
|
4117
4117
|
id: o,
|
|
4118
4118
|
data: e,
|
|
@@ -4125,12 +4125,12 @@ class xt {
|
|
|
4125
4125
|
), o;
|
|
4126
4126
|
}
|
|
4127
4127
|
}
|
|
4128
|
-
const
|
|
4129
|
-
RS__oldStyleTf:
|
|
4130
|
-
},
|
|
4131
|
-
class
|
|
4128
|
+
const mr = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif", gr = {
|
|
4129
|
+
RS__oldStyleTf: mr
|
|
4130
|
+
}, fr = 16, vi = gr.RS__oldStyleTf;
|
|
4131
|
+
class _t {
|
|
4132
4132
|
constructor(t) {
|
|
4133
|
-
this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize ||
|
|
4133
|
+
this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize || fr, this._fontFace = t.fontFace || vi, this._sample = t.sample || null, this._padding = t.padding ?? 0, this._letterSpacing = t.letterSpacing ? Math.round(t.letterSpacing * this._baseFontSize) : 0, this._wordSpacing = t.wordSpacing ? Math.round(t.wordSpacing * this._baseFontSize) : 0, this._isCJK = t.isCJK || !1, this._getRelative = t.getRelative || !1, this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1, this._approximatedWordSpaces = _t.approximateWordSpaces(this._optimalChars, this._sample);
|
|
4134
4134
|
}
|
|
4135
4135
|
updateMultipliers() {
|
|
4136
4136
|
this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1;
|
|
@@ -4139,7 +4139,7 @@ class vt {
|
|
|
4139
4139
|
// Not filtering because pretty much everything can
|
|
4140
4140
|
// trigger a recomputation anyway.
|
|
4141
4141
|
update(t) {
|
|
4142
|
-
t.optimalChars && (this._optimalChars = t.optimalChars), t.minChars !== void 0 && (this._minChars = t.minChars), t.maxChars !== void 0 && (this._maxChars = t.maxChars), t.baseFontSize && (this._baseFontSize = t.baseFontSize), t.fontFace !== void 0 && (this._fontFace = t.fontFace ||
|
|
4142
|
+
t.optimalChars && (this._optimalChars = t.optimalChars), t.minChars !== void 0 && (this._minChars = t.minChars), t.maxChars !== void 0 && (this._maxChars = t.maxChars), t.baseFontSize && (this._baseFontSize = t.baseFontSize), t.fontFace !== void 0 && (this._fontFace = t.fontFace || vi), t.letterSpacing && (this._letterSpacing = t.letterSpacing), t.wordSpacing && (this._wordSpacing = t.wordSpacing), t.isCJK != null && (this._isCJK = t.isCJK), t.padding !== void 0 && (this._padding = t.padding ?? 0), t.getRelative && (this._getRelative = t.getRelative), t.sample && (this._sample = t.sample, this._approximatedWordSpaces = _t.approximateWordSpaces(this._optimalChars, this._sample)), this.updateMultipliers(), this._optimalLineLength = this.getOptimalLineLength();
|
|
4143
4143
|
}
|
|
4144
4144
|
get baseFontSize() {
|
|
4145
4145
|
return this._baseFontSize;
|
|
@@ -4195,17 +4195,17 @@ class vt {
|
|
|
4195
4195
|
if (e.font = `${this._baseFontSize}px ${t}`, this._sample && this._sample.length >= this._optimalChars && (i = this._sample.slice(0, this._optimalChars)), Object.hasOwn(e, "letterSpacing") && Object.hasOwn(e, "wordSpacing"))
|
|
4196
4196
|
return e.letterSpacing = this._letterSpacing.toString() + "px", e.wordSpacing = this._wordSpacing.toString() + "px", e.measureText(i).width;
|
|
4197
4197
|
{
|
|
4198
|
-
const n = this._letterSpacing * (this._optimalChars - 1), r = this._wordSpacing *
|
|
4198
|
+
const n = this._letterSpacing * (this._optimalChars - 1), r = this._wordSpacing * _t.approximateWordSpaces(this._optimalChars, this._sample);
|
|
4199
4199
|
return e.measureText(i).width + n + r;
|
|
4200
4200
|
}
|
|
4201
4201
|
} else
|
|
4202
4202
|
return this.getLineLengthFallback();
|
|
4203
4203
|
}
|
|
4204
4204
|
}
|
|
4205
|
-
const
|
|
4206
|
-
class
|
|
4205
|
+
const sn = () => typeof navigator > "u" ? "" : navigator.userAgent || "", on = () => typeof navigator > "u" ? void 0 : navigator.userAgentData || void 0;
|
|
4206
|
+
class an {
|
|
4207
4207
|
constructor() {
|
|
4208
|
-
const t =
|
|
4208
|
+
const t = on(), e = sn(), i = (r) => (typeof r == "string" || typeof r == "number") && r ? String(r).replace(/_/g, ".").split(".").map((o) => parseInt(o) || 0) : [], n = (r = "") => {
|
|
4209
4209
|
if (!r) return [];
|
|
4210
4210
|
const o = new RegExp("^.*" + r + "[ :\\/]?(\\d+([\\._]\\d+)*).*$");
|
|
4211
4211
|
return o.test(e) ? i(e.replace(o, "$1")) : [];
|
|
@@ -4236,17 +4236,17 @@ class nn {
|
|
|
4236
4236
|
}, []) };
|
|
4237
4237
|
}
|
|
4238
4238
|
}
|
|
4239
|
-
class
|
|
4239
|
+
class yr extends an {
|
|
4240
4240
|
get iOSRequest() {
|
|
4241
|
-
const t =
|
|
4241
|
+
const t = on(), e = sn();
|
|
4242
4242
|
if (this.OS.iOS && !this.OS.iPadOS)
|
|
4243
4243
|
return "mobile";
|
|
4244
4244
|
if (this.OS.iPadOS)
|
|
4245
4245
|
return /\(iPad;/.test(e) || t && /^iPad(OS)?$/.test(t.platform) ? "mobile" : "desktop";
|
|
4246
4246
|
}
|
|
4247
4247
|
}
|
|
4248
|
-
const q = new
|
|
4249
|
-
class
|
|
4248
|
+
const q = new an(), T = new yr();
|
|
4249
|
+
class Sr {
|
|
4250
4250
|
constructor(t, e = {}, i = []) {
|
|
4251
4251
|
this.hidden = !0, this.destroyed = !1, this.currModules = [], this.frame = document.createElement("iframe"), this.frame.classList.add("readium-navigator-iframe"), this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transition = "visibility 0s, opacity 0.1s linear", this.frame.style.backgroundColor = "#FFFFFF", this.source = t, this.contentProtectionConfig = { ...e }, this.keyboardPeripheralsConfig = [...i];
|
|
4252
4252
|
}
|
|
@@ -4261,7 +4261,7 @@ class fr {
|
|
|
4261
4261
|
}
|
|
4262
4262
|
return;
|
|
4263
4263
|
}
|
|
4264
|
-
this.comms?.halt(), this.loader.destroy(), this.loader = new
|
|
4264
|
+
this.comms?.halt(), this.loader.destroy(), this.loader = new St(n, t), this.currModules = t, this.comms = void 0;
|
|
4265
4265
|
try {
|
|
4266
4266
|
e(n);
|
|
4267
4267
|
} catch {
|
|
@@ -4270,7 +4270,7 @@ class fr {
|
|
|
4270
4270
|
}
|
|
4271
4271
|
this.frame.onload = () => {
|
|
4272
4272
|
const n = this.frame.contentWindow;
|
|
4273
|
-
this.loader = new
|
|
4273
|
+
this.loader = new St(n, t), this.currModules = t;
|
|
4274
4274
|
try {
|
|
4275
4275
|
e(n);
|
|
4276
4276
|
} catch {
|
|
@@ -4284,7 +4284,7 @@ class fr {
|
|
|
4284
4284
|
});
|
|
4285
4285
|
}
|
|
4286
4286
|
applyContentProtection() {
|
|
4287
|
-
this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
|
|
4287
|
+
this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting?.disable && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
|
|
4288
4288
|
}
|
|
4289
4289
|
async destroy() {
|
|
4290
4290
|
await this.hide(), this.loader?.destroy(), this.frame.remove(), this.destroyed = !0;
|
|
@@ -4303,7 +4303,7 @@ class fr {
|
|
|
4303
4303
|
async show(t) {
|
|
4304
4304
|
if (this.destroyed) throw Error("Trying to show frame when it doesn't exist");
|
|
4305
4305
|
if (!this.frame.parentElement) throw Error("Trying to show frame that is not attached to the DOM");
|
|
4306
|
-
return this.comms ? this.comms.resume() : this.comms = new
|
|
4306
|
+
return this.comms ? this.comms.resume() : this.comms = new Lt(this.frame.contentWindow, this.source), new Promise((e, i) => {
|
|
4307
4307
|
this.comms?.send("activate", void 0, () => {
|
|
4308
4308
|
this.comms?.send("focus", void 0, () => {
|
|
4309
4309
|
this.applyContentProtection();
|
|
@@ -4316,7 +4316,7 @@ class fr {
|
|
|
4316
4316
|
});
|
|
4317
4317
|
}
|
|
4318
4318
|
setCSSProperties(t) {
|
|
4319
|
-
this.destroyed || !this.frame.contentWindow || (this.hidden && (this.comms ? this.comms?.resume() : this.comms = new
|
|
4319
|
+
this.destroyed || !this.frame.contentWindow || (this.hidden && (this.comms ? this.comms?.resume() : this.comms = new Lt(this.frame.contentWindow, this.source)), this.comms?.send("update_properties", t), this.hidden && this.comms?.halt());
|
|
4320
4320
|
}
|
|
4321
4321
|
get iframe() {
|
|
4322
4322
|
if (this.destroyed) throw Error("Trying to use frame when it doesn't exist");
|
|
@@ -4337,7 +4337,7 @@ class fr {
|
|
|
4337
4337
|
return this.loader;
|
|
4338
4338
|
}
|
|
4339
4339
|
}
|
|
4340
|
-
class
|
|
4340
|
+
class br {
|
|
4341
4341
|
constructor(t, e, i, n = {}, r = []) {
|
|
4342
4342
|
this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.injector = null, this.container = t, this.currentCssProperties = e, this.injector = i, this.contentProtectionConfig = n, this.keyboardPeripheralsConfig = [...r];
|
|
4343
4343
|
}
|
|
@@ -4388,7 +4388,7 @@ class yr {
|
|
|
4388
4388
|
const p = t.readingOrder.findWithHref(d);
|
|
4389
4389
|
if (!p) return;
|
|
4390
4390
|
if (!this.blobs.has(d)) {
|
|
4391
|
-
const k = await new
|
|
4391
|
+
const k = await new ur(
|
|
4392
4392
|
t,
|
|
4393
4393
|
this.currentBaseURL || "",
|
|
4394
4394
|
p,
|
|
@@ -4399,7 +4399,7 @@ class yr {
|
|
|
4399
4399
|
).build();
|
|
4400
4400
|
this.blobs.set(d, k);
|
|
4401
4401
|
}
|
|
4402
|
-
const b = new
|
|
4402
|
+
const b = new Sr(this.blobs.get(d), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
4403
4403
|
d !== o && await b.hide(), this.container.appendChild(b.iframe), await b.load(i), this.pool.set(d, b);
|
|
4404
4404
|
};
|
|
4405
4405
|
try {
|
|
@@ -4453,10 +4453,10 @@ class yr {
|
|
|
4453
4453
|
}), t;
|
|
4454
4454
|
}
|
|
4455
4455
|
}
|
|
4456
|
-
var de,
|
|
4457
|
-
function
|
|
4458
|
-
if (
|
|
4459
|
-
|
|
4456
|
+
var de, wi;
|
|
4457
|
+
function vr() {
|
|
4458
|
+
if (wi) return de;
|
|
4459
|
+
wi = 1;
|
|
4460
4460
|
function s(n) {
|
|
4461
4461
|
if (typeof n != "string")
|
|
4462
4462
|
throw new TypeError("Path must be a string. Received " + JSON.stringify(n));
|
|
@@ -4641,13 +4641,13 @@ function Sr() {
|
|
|
4641
4641
|
};
|
|
4642
4642
|
return i.posix = i, de = i, de;
|
|
4643
4643
|
}
|
|
4644
|
-
var jt =
|
|
4645
|
-
const
|
|
4646
|
-
experimentalHeaderFiltering:
|
|
4647
|
-
experimentalZoom:
|
|
4648
|
-
}, Ie =
|
|
4644
|
+
var jt = vr();
|
|
4645
|
+
const wr = { description: "Attempts to filter out paragraphs that are implicitly headings or part of headers", scope: "RS", value: "readium-experimentalHeaderFiltering-on" }, _r = { description: "Attemps to filter out elements that are sized using viewport units and should not be scaled directly e.g. tables, images, iframes, etc.", scope: "RS", value: "readium-experimentalZoom-on" }, Pr = {
|
|
4646
|
+
experimentalHeaderFiltering: wr,
|
|
4647
|
+
experimentalZoom: _r
|
|
4648
|
+
}, Ie = Pr;
|
|
4649
4649
|
var J = /* @__PURE__ */ ((s) => (s.start = "start", s.left = "left", s.right = "right", s.justify = "justify", s))(J || {});
|
|
4650
|
-
const
|
|
4650
|
+
const ht = {
|
|
4651
4651
|
range: [0, 100],
|
|
4652
4652
|
step: 1
|
|
4653
4653
|
}, Gt = {
|
|
@@ -4665,7 +4665,7 @@ const at = {
|
|
|
4665
4665
|
}, Yt = {
|
|
4666
4666
|
range: [1, 2],
|
|
4667
4667
|
step: 0.1
|
|
4668
|
-
},
|
|
4668
|
+
}, ct = {
|
|
4669
4669
|
range: [20, 100],
|
|
4670
4670
|
step: 1
|
|
4671
4671
|
}, qt = {
|
|
@@ -4684,8 +4684,8 @@ const at = {
|
|
|
4684
4684
|
range: [0, 1],
|
|
4685
4685
|
step: 0.1
|
|
4686
4686
|
}, te = {
|
|
4687
|
-
range: [0.5,
|
|
4688
|
-
step: 0.
|
|
4687
|
+
range: [0.5, 4],
|
|
4688
|
+
step: 0.1
|
|
4689
4689
|
}, et = {
|
|
4690
4690
|
range: [5, 60],
|
|
4691
4691
|
step: 5
|
|
@@ -4717,7 +4717,7 @@ class re {
|
|
|
4717
4717
|
return `${t}rem`;
|
|
4718
4718
|
}
|
|
4719
4719
|
}
|
|
4720
|
-
class
|
|
4720
|
+
class ln extends re {
|
|
4721
4721
|
constructor(t) {
|
|
4722
4722
|
super(), this.a11yNormalize = t.a11yNormalize ?? null, this.bodyHyphens = t.bodyHyphens ?? null, this.fontFamily = t.fontFamily ?? null, this.fontWeight = t.fontWeight ?? null, this.iOSPatch = t.iOSPatch ?? null, this.iPadOSPatch = t.iPadOSPatch ?? null, this.letterSpacing = t.letterSpacing ?? null, this.ligatures = t.ligatures ?? null, this.lineHeight = t.lineHeight ?? null, this.noRuby = t.noRuby ?? null, this.paraIndent = t.paraIndent ?? null, this.paraSpacing = t.paraSpacing ?? null, this.textAlign = t.textAlign ?? null, this.wordSpacing = t.wordSpacing ?? null, this.zoom = t.zoom ?? null;
|
|
4723
4723
|
}
|
|
@@ -4726,7 +4726,7 @@ class rn extends re {
|
|
|
4726
4726
|
return this.a11yNormalize && (t["--USER__a11yNormalize"] = this.toFlag("a11y")), this.bodyHyphens && (t["--USER__bodyHyphens"] = this.bodyHyphens), this.fontFamily && (t["--USER__fontFamily"] = this.fontFamily), this.fontWeight != null && (t["--USER__fontWeight"] = this.toUnitless(this.fontWeight)), this.iOSPatch && (t["--USER__iOSPatch"] = this.toFlag("iOSPatch")), this.iPadOSPatch && (t["--USER__iPadOSPatch"] = this.toFlag("iPadOSPatch")), this.letterSpacing != null && (t["--USER__letterSpacing"] = this.toRem(this.letterSpacing)), this.ligatures && (t["--USER__ligatures"] = this.ligatures), this.lineHeight != null && (t["--USER__lineHeight"] = this.toUnitless(this.lineHeight)), this.noRuby && (t["--USER__noRuby"] = this.toFlag("noRuby")), this.paraIndent != null && (t["--USER__paraIndent"] = this.toRem(this.paraIndent)), this.paraSpacing != null && (t["--USER__paraSpacing"] = this.toRem(this.paraSpacing)), this.textAlign && (t["--USER__textAlign"] = this.textAlign), this.wordSpacing != null && (t["--USER__wordSpacing"] = this.toRem(this.wordSpacing)), this.zoom !== null && (t["--USER__zoom"] = this.toPercentage(this.zoom, !0)), t;
|
|
4727
4727
|
}
|
|
4728
4728
|
}
|
|
4729
|
-
class
|
|
4729
|
+
class Er extends re {
|
|
4730
4730
|
constructor(t) {
|
|
4731
4731
|
super(), this.experiments = t.experiments ?? null;
|
|
4732
4732
|
}
|
|
@@ -4737,7 +4737,7 @@ class _r extends re {
|
|
|
4737
4737
|
}), t;
|
|
4738
4738
|
}
|
|
4739
4739
|
}
|
|
4740
|
-
class
|
|
4740
|
+
class Cr {
|
|
4741
4741
|
constructor(t) {
|
|
4742
4742
|
this.rsProperties = t.rsProperties, this.userProperties = t.userProperties;
|
|
4743
4743
|
}
|
|
@@ -4760,13 +4760,13 @@ class Pr {
|
|
|
4760
4760
|
wordSpacing: t.wordSpacing,
|
|
4761
4761
|
zoom: t.zoom
|
|
4762
4762
|
};
|
|
4763
|
-
this.userProperties = new
|
|
4763
|
+
this.userProperties = new ln(e);
|
|
4764
4764
|
}
|
|
4765
4765
|
}
|
|
4766
|
-
function
|
|
4766
|
+
function xr(s, t) {
|
|
4767
4767
|
return s == null || t == null || s <= t ? s : void 0;
|
|
4768
4768
|
}
|
|
4769
|
-
function
|
|
4769
|
+
function Rr(s, t) {
|
|
4770
4770
|
return s == null || t == null || s >= t ? s : void 0;
|
|
4771
4771
|
}
|
|
4772
4772
|
function I(s) {
|
|
@@ -4779,7 +4779,7 @@ function se(s, t) {
|
|
|
4779
4779
|
if (s !== void 0)
|
|
4780
4780
|
return s === null ? null : t[s] !== void 0 ? s : void 0;
|
|
4781
4781
|
}
|
|
4782
|
-
function
|
|
4782
|
+
function ft(s) {
|
|
4783
4783
|
return typeof s == "boolean" || typeof s == "number" && s >= 0 ? s : s === null ? null : void 0;
|
|
4784
4784
|
}
|
|
4785
4785
|
function w(s) {
|
|
@@ -4797,11 +4797,11 @@ function M(s, t) {
|
|
|
4797
4797
|
function ue(s, t) {
|
|
4798
4798
|
return s === void 0 ? t : s;
|
|
4799
4799
|
}
|
|
4800
|
-
function
|
|
4800
|
+
function hn(s) {
|
|
4801
4801
|
if (s !== void 0)
|
|
4802
4802
|
return s === null ? null : s.filter((t) => t in Ie);
|
|
4803
4803
|
}
|
|
4804
|
-
class
|
|
4804
|
+
class kt {
|
|
4805
4805
|
constructor(t = {}) {
|
|
4806
4806
|
this.fontFamily = I(t.fontFamily), this.fontWeight = M(t.fontWeight, nt.range), this.hyphens = P(t.hyphens), this.iOSPatch = P(t.iOSPatch), this.iPadOSPatch = P(t.iPadOSPatch), this.letterSpacing = w(t.letterSpacing), this.ligatures = P(t.ligatures), this.lineHeight = w(t.lineHeight), this.noRuby = P(t.noRuby), this.paragraphIndent = w(t.paragraphIndent), this.paragraphSpacing = w(t.paragraphSpacing), this.textAlign = se(t.textAlign, J), this.textNormalization = P(t.textNormalization), this.wordSpacing = w(t.wordSpacing), this.zoom = M(t.zoom, Jt.range);
|
|
4807
4807
|
}
|
|
@@ -4812,7 +4812,7 @@ class Rt {
|
|
|
4812
4812
|
static deserialize(t) {
|
|
4813
4813
|
try {
|
|
4814
4814
|
const e = JSON.parse(t);
|
|
4815
|
-
return new
|
|
4815
|
+
return new kt(e);
|
|
4816
4816
|
} catch (e) {
|
|
4817
4817
|
return console.error("Failed to deserialize preferences:", e), null;
|
|
4818
4818
|
}
|
|
@@ -4821,15 +4821,15 @@ class Rt {
|
|
|
4821
4821
|
const e = { ...this };
|
|
4822
4822
|
for (const i of Object.keys(t))
|
|
4823
4823
|
t[i] !== void 0 && (e[i] = t[i]);
|
|
4824
|
-
return new
|
|
4824
|
+
return new kt(e);
|
|
4825
4825
|
}
|
|
4826
4826
|
}
|
|
4827
|
-
class
|
|
4827
|
+
class Lr {
|
|
4828
4828
|
constructor(t) {
|
|
4829
|
-
this.fontFamily = I(t.fontFamily) || null, this.fontWeight = M(t.fontWeight, nt.range) || null, this.hyphens = P(t.hyphens) ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = w(t.letterSpacing) || null, this.ligatures = P(t.ligatures) ?? null, this.lineHeight = w(t.lineHeight) || null, this.noRuby = P(t.noRuby) ?? !1, this.paragraphIndent = w(t.paragraphIndent) ?? null, this.paragraphSpacing = w(t.paragraphSpacing) ?? null, this.textAlign = se(t.textAlign, J) || null, this.textNormalization = P(t.textNormalization) ?? !1, this.wordSpacing = w(t.wordSpacing) || null, this.zoom = M(t.zoom, Jt.range) || 1, this.experiments =
|
|
4829
|
+
this.fontFamily = I(t.fontFamily) || null, this.fontWeight = M(t.fontWeight, nt.range) || null, this.hyphens = P(t.hyphens) ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = w(t.letterSpacing) || null, this.ligatures = P(t.ligatures) ?? null, this.lineHeight = w(t.lineHeight) || null, this.noRuby = P(t.noRuby) ?? !1, this.paragraphIndent = w(t.paragraphIndent) ?? null, this.paragraphSpacing = w(t.paragraphSpacing) ?? null, this.textAlign = se(t.textAlign, J) || null, this.textNormalization = P(t.textNormalization) ?? !1, this.wordSpacing = w(t.wordSpacing) || null, this.zoom = M(t.zoom, Jt.range) || 1, this.experiments = hn(t.experiments) ?? null;
|
|
4830
4830
|
}
|
|
4831
4831
|
}
|
|
4832
|
-
class
|
|
4832
|
+
class _i {
|
|
4833
4833
|
constructor(t, e, i) {
|
|
4834
4834
|
this.fontFamily = null, this.fontWeight = null, this.hyphens = null, this.iOSPatch = null, this.iPadOSPatch = null, this.letterSpacing = null, this.ligatures = null, this.lineHeight = null, this.noRuby = null, this.paragraphIndent = null, this.paragraphSpacing = null, this.textAlign = null, this.textNormalization = null, this.wordSpacing = null, i && (this.fontFamily = t.fontFamily || e.fontFamily || null, this.fontWeight = t.fontWeight !== void 0 ? t.fontWeight : e.fontWeight !== void 0 ? e.fontWeight : null, this.hyphens = typeof t.hyphens == "boolean" ? t.hyphens : e.hyphens ?? null, this.iOSPatch = t.iOSPatch === !1 ? !1 : t.iOSPatch === !0 ? (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile" : e.iOSPatch, this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : t.iPadOSPatch === !0 ? T.OS.iPadOS && T.iOSRequest === "desktop" : e.iPadOSPatch, this.letterSpacing = t.letterSpacing !== void 0 ? t.letterSpacing : e.letterSpacing !== void 0 ? e.letterSpacing : null, this.ligatures = typeof t.ligatures == "boolean" ? t.ligatures : e.ligatures ?? null, this.lineHeight = t.lineHeight !== void 0 ? t.lineHeight : e.lineHeight !== void 0 ? e.lineHeight : null, this.noRuby = typeof t.noRuby == "boolean" ? t.noRuby : e.noRuby ?? null, this.paragraphIndent = t.paragraphIndent !== void 0 ? t.paragraphIndent : e.paragraphIndent !== void 0 ? e.paragraphIndent : null, this.paragraphSpacing = t.paragraphSpacing !== void 0 ? t.paragraphSpacing : e.paragraphSpacing !== void 0 ? e.paragraphSpacing : null, this.textAlign = t.textAlign || e.textAlign || null, this.textNormalization = typeof t.textNormalization == "boolean" ? t.textNormalization : e.textNormalization ?? null, this.wordSpacing = t.wordSpacing !== void 0 ? t.wordSpacing : e.wordSpacing !== void 0 ? e.wordSpacing : null), this.zoom = t.zoom !== void 0 ? t.zoom : e.zoom !== void 0 ? e.zoom : null, this.experiments = e.experiments || null;
|
|
4835
4835
|
}
|
|
@@ -4879,7 +4879,7 @@ class O extends A {
|
|
|
4879
4879
|
this._value = !this._value, this._onChange(this._value);
|
|
4880
4880
|
}
|
|
4881
4881
|
}
|
|
4882
|
-
class
|
|
4882
|
+
class cn extends A {
|
|
4883
4883
|
constructor({
|
|
4884
4884
|
initialValue: t = null,
|
|
4885
4885
|
effectiveValue: e,
|
|
@@ -4960,12 +4960,12 @@ class R extends A {
|
|
|
4960
4960
|
this._value = null;
|
|
4961
4961
|
}
|
|
4962
4962
|
}
|
|
4963
|
-
class
|
|
4963
|
+
class Pi {
|
|
4964
4964
|
constructor(t, e, i) {
|
|
4965
4965
|
this.preferences = t, this.settings = e, this.metadata = i;
|
|
4966
4966
|
}
|
|
4967
4967
|
clear() {
|
|
4968
|
-
this.preferences = new
|
|
4968
|
+
this.preferences = new kt({});
|
|
4969
4969
|
}
|
|
4970
4970
|
updatePreference(t, e) {
|
|
4971
4971
|
this.preferences[t] = e;
|
|
@@ -5096,7 +5096,7 @@ class wi {
|
|
|
5096
5096
|
});
|
|
5097
5097
|
}
|
|
5098
5098
|
get textAlign() {
|
|
5099
|
-
return new
|
|
5099
|
+
return new cn({
|
|
5100
5100
|
initialValue: this.preferences.textAlign,
|
|
5101
5101
|
effectiveValue: this.settings.textAlign || J.start,
|
|
5102
5102
|
isEffective: this.isDisplayTransformable,
|
|
@@ -5141,7 +5141,7 @@ class wi {
|
|
|
5141
5141
|
});
|
|
5142
5142
|
}
|
|
5143
5143
|
}
|
|
5144
|
-
const
|
|
5144
|
+
const dn = (s) => {
|
|
5145
5145
|
if ("blob" in s && s.blob.type)
|
|
5146
5146
|
return s.blob.type;
|
|
5147
5147
|
if (s.as === "script")
|
|
@@ -5151,22 +5151,22 @@ const an = (s) => {
|
|
|
5151
5151
|
if (t.endsWith(".css")) return "text/css";
|
|
5152
5152
|
if ([".js", ".mjs", ".cjs"].some((e) => t.endsWith(e))) return "text/javascript";
|
|
5153
5153
|
}
|
|
5154
|
-
},
|
|
5154
|
+
}, un = (s, t) => {
|
|
5155
5155
|
t.attributes && Object.entries(t.attributes).forEach(([e, i]) => {
|
|
5156
5156
|
e === "type" || e === "rel" || e === "href" || e === "src" || i != null && (typeof i == "boolean" ? i && s.setAttribute(e, "") : s.setAttribute(e, i));
|
|
5157
5157
|
});
|
|
5158
|
-
},
|
|
5158
|
+
}, kr = (s, t, e) => {
|
|
5159
5159
|
const i = s.createElement("script");
|
|
5160
5160
|
i.dataset.readium = "true", t.id && (i.id = t.id);
|
|
5161
|
-
const n = t.type ||
|
|
5162
|
-
return n && (i.type = n),
|
|
5163
|
-
},
|
|
5161
|
+
const n = t.type || dn(t);
|
|
5162
|
+
return n && (i.type = n), un(i, t), i.src = e, i;
|
|
5163
|
+
}, Ei = (s, t, e) => {
|
|
5164
5164
|
const i = s.createElement("link");
|
|
5165
5165
|
i.dataset.readium = "true", t.id && (i.id = t.id), t.rel && (i.rel = t.rel);
|
|
5166
|
-
const n = t.type ||
|
|
5167
|
-
return n && (i.type = n),
|
|
5166
|
+
const n = t.type || dn(t);
|
|
5167
|
+
return n && (i.type = n), un(i, t), i.href = e, i;
|
|
5168
5168
|
};
|
|
5169
|
-
class
|
|
5169
|
+
class pn {
|
|
5170
5170
|
constructor(t) {
|
|
5171
5171
|
this.blobStore = /* @__PURE__ */ new Map(), this.createdBlobUrls = /* @__PURE__ */ new Set(), this.allowedDomains = [], this.injectableIdCounter = 0, this.allowedDomains = (t.allowedDomains || []).map((e) => {
|
|
5172
5172
|
try {
|
|
@@ -5247,14 +5247,14 @@ class hn {
|
|
|
5247
5247
|
...e.attributes,
|
|
5248
5248
|
as: e.as
|
|
5249
5249
|
}
|
|
5250
|
-
}, r =
|
|
5250
|
+
}, r = Ei(t, n, i);
|
|
5251
5251
|
t.head.appendChild(r);
|
|
5252
5252
|
}
|
|
5253
5253
|
createElement(t, e, i) {
|
|
5254
5254
|
if (e.as === "script")
|
|
5255
|
-
return
|
|
5255
|
+
return kr(t, e, i);
|
|
5256
5256
|
if (e.as === "link")
|
|
5257
|
-
return
|
|
5257
|
+
return Ei(t, e, i);
|
|
5258
5258
|
throw new Error(`Unsupported element type: ${e.as}`);
|
|
5259
5259
|
}
|
|
5260
5260
|
async applyRule(t, e) {
|
|
@@ -5311,7 +5311,7 @@ class hn {
|
|
|
5311
5311
|
}
|
|
5312
5312
|
}
|
|
5313
5313
|
}
|
|
5314
|
-
const
|
|
5314
|
+
const yt = (s) => s.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), Nt = (s) => s.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " "), Or = `/*!
|
|
5315
5315
|
* Readium CSS v.2.0.0
|
|
5316
5316
|
* Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
|
|
5317
5317
|
* Use of this source code is governed by a BSD-style license which is detailed in the
|
|
@@ -5585,11 +5585,11 @@ const gt = (s) => s.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").repl
|
|
|
5585
5585
|
|
|
5586
5586
|
:root[style*="readium-iPadOSPatch-on"] p:not(:has(b, cite, em, i, q, s, small, span, strong)):first-line{
|
|
5587
5587
|
-webkit-text-zoom:normal;
|
|
5588
|
-
}`,
|
|
5588
|
+
}`, mn = '!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports._readium_cssSelectorGenerator=e():t._readium_cssSelectorGenerator=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function n(t){return"object"==typeof t&&null!==t&&t.nodeType===Node.ELEMENT_NODE}t.r(e),t.d(e,{_readium_cssSelectorGenerator:()=>Z,default:()=>tt,getCssSelector:()=>X});const o={NONE:"",DESCENDANT:" ",CHILD:" > "},r={id:"id",class:"class",tag:"tag",attribute:"attribute",nthchild:"nthchild",nthoftype:"nthoftype"},i="_readium_cssSelectorGenerator";function c(t="unknown problem",...e){console.warn(`${i}: ${t}`,...e)}const s={selectors:[r.id,r.class,r.tag,r.attribute],includeTag:!1,whitelist:[],blacklist:[],combineWithinSelector:!0,combineBetweenSelectors:!0,root:null,maxCombinations:Number.POSITIVE_INFINITY,maxCandidates:Number.POSITIVE_INFINITY,useScope:!1};function u(t){return t instanceof RegExp}function l(t){return["string","function"].includes(typeof t)||u(t)}function a(t){return Array.isArray(t)?t.filter(l):[]}function f(t){const e=[Node.DOCUMENT_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE];return function(t){return t instanceof Node}(t)&&e.includes(t.nodeType)}function d(t,e){if(f(t))return t.contains(e)||c("element root mismatch","Provided root does not contain the element. This will most likely result in producing a fallback selector using element\'s real root node. If you plan to use the selector using provided root (e.g. `root.querySelector`), it will not work as intended."),t;const n=e.getRootNode({composed:!1});return f(n)?(n!==document&&c("shadow root inferred","You did not provide a root and the element is a child of Shadow DOM. This will produce a selector using ShadowRoot as a root. If you plan to use the selector using document as a root (e.g. `document.querySelector`), it will not work as intended."),n):S(e)}function m(t){return"number"==typeof t?t:Number.POSITIVE_INFINITY}function p(t=[]){const[e=[],...n]=t;return 0===n.length?e:n.reduce(((t,e)=>t.filter((t=>e.includes(t)))),e)}function g(t){const e=t.map((t=>{if(u(t))return e=>t.test(e);if("function"==typeof t)return e=>{const n=t(e);return"boolean"!=typeof n?(c("pattern matcher function invalid","Provided pattern matching function does not return boolean. It\'s result will be ignored.",t),!1):n};if("string"==typeof t){const e=new RegExp("^"+t.replace(/[|\\\\{}()[\\]^$+?.]/g,"\\\\$&").replace(/\\*/g,".+")+"$");return t=>e.test(t)}return c("pattern matcher invalid","Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.",t),()=>!1}));return t=>e.some((e=>e(t)))}function h(t,e,n){const o=Array.from(d(n,t[0]).querySelectorAll(e));return o.length===t.length&&t.every((t=>o.includes(t)))}function y(t,e){e=null!=e?e:S(t);const o=[];let r=t;for(;n(r)&&r!==e;)o.push(r),r=r.parentElement;return o}function b(t,e){return p(t.map((t=>y(t,e))))}function S(t){return t.ownerDocument.querySelector(":root")}const N=", ",v=new RegExp(["^$","\\\\s"].join("|")),E=new RegExp(["^$"].join("|")),x=[r.nthoftype,r.tag,r.id,r.class,r.attribute,r.nthchild],w=g(["class","id","ng-*"]);function I({name:t}){return`[${t}]`}function T({name:t,value:e}){return`[${t}=\'${e}\']`}function O({nodeName:t,nodeValue:e}){return{name:F(t),value:F(null!=e?e:void 0)}}function C(t){const e=Array.from(t.attributes).filter((e=>function({nodeName:t,nodeValue:e},n){const o=n.tagName.toLowerCase();return!(["input","option"].includes(o)&&"value"===t||"src"===t&&(null==e?void 0:e.startsWith("data:"))||w(t))}(e,t))).map(O);return[...e.map(I),...e.map(T)]}function j(t){var e;return(null!==(e=t.getAttribute("class"))&&void 0!==e?e:"").trim().split(/\\s+/).filter((t=>!E.test(t))).map((t=>`.${F(t)}`))}function A(t){var e;const n=null!==(e=t.getAttribute("id"))&&void 0!==e?e:"",o=`#${F(n)}`,r=t.getRootNode({composed:!1});return!v.test(n)&&h([t],o,r)?[o]:[]}function R(t){var e;const n=null===(e=t.parentElement)||void 0===e?void 0:e.children;if(n)for(let e=0;e<n.length;e++)if(n[e]===t)return[`:nth-child(${String(e+1)})`];return[]}function $(t){return[F(t.tagName.toLowerCase())]}function D(t){const e=[...new Set((n=t.map($),[].concat(...n)))];var n;return 0===e.length||e.length>1?[]:[e[0]]}function k(t){const e=D([t])[0],n=t.parentElement;if(n){const o=Array.from(n.children).filter((t=>t.tagName.toLowerCase()===e)),r=o.indexOf(t);if(r>-1)return[`${e}:nth-of-type(${String(r+1)})`]}return[]}function*P(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){let n=0,o=L(1);for(;o.length<=t.length&&n<e;){n+=1;const e=o.map((e=>t[e]));yield e,o=_(o,t.length-1)}}function _(t=[],e=0){const n=t.length;if(0===n)return[];const o=[...t];o[n-1]+=1;for(let t=n-1;t>=0;t--)if(o[t]>e){if(0===t)return L(n+1);o[t-1]++,o[t]=o[t-1]+1}return o[n-1]>e?L(n+1):o}function L(t=1){return Array.from(Array(t).keys())}const M=":".charCodeAt(0).toString(16).toUpperCase(),V=/[ !"#$%&\'()\\[\\]{|}<>*+,./;=?@^`~\\\\]/;function F(t=""){return CSS?CSS.escape(t):function(t=""){return t.split("").map((t=>":"===t?`\\\\${M} `:V.test(t)?`\\\\${t}`:escape(t).replace(/%/g,"\\\\"))).join("")}(t)}const Y={tag:D,id:function(t){return 0===t.length||t.length>1?[]:A(t[0])},class:function(t){return p(t.map(j))},attribute:function(t){return p(t.map(C))},nthchild:function(t){return p(t.map(R))},nthoftype:function(t){return p(t.map(k))}},G={tag:$,id:A,class:j,attribute:C,nthchild:R,nthoftype:k};function W(t){return t.includes(r.tag)||t.includes(r.nthoftype)?[...t]:[...t,r.tag]}function*q(t,e){const n={};for(const o of t){const t=e[o];t&&t.length>0&&(n[o]=t)}for(const t of function*(t={}){const e=Object.entries(t);if(0===e.length)return;const n=[{index:e.length-1,partial:{}}];for(;n.length>0;){const t=n.pop();if(!t)break;const{index:o,partial:r}=t;if(o<0){yield r;continue}const[i,c]=e[o];for(let t=c.length-1;t>=0;t--)n.push({index:o-1,partial:Object.assign(Object.assign({},r),{[i]:c[t]})})}}(n))yield B(t)}function B(t={}){const e=[...x];return t[r.tag]&&t[r.nthoftype]&&e.splice(e.indexOf(r.tag),1),e.map((e=>{return(o=t)[n=e]?o[n].join(""):"";var n,o})).join("")}function H(t,e){return[...t.map((t=>e+o.DESCENDANT+t)),...t.map((t=>e+o.CHILD+t))]}function*U(t,e,n="",o){const r=function*(t,e){const n=new Set,o=function(t,e){const{blacklist:n,whitelist:o,combineWithinSelector:r,maxCombinations:i}=e,c=g(n),s=g(o);return function(t){const{selectors:e,includeTag:n}=t,o=[...e];return n&&!o.includes("tag")&&o.push("tag"),o}(e).reduce(((e,n)=>{const o=function(t,e){return(0,Y[e])(t)}(t,n),u=function(t=[],e,n){return t.filter((t=>n(t)||!e(t)))}(o,c,s),l=function(t=[],e){return t.sort(((t,n)=>{const o=e(t),r=e(n);return o&&!r?-1:!o&&r?1:0}))}(u,s);return e[n]=r?Array.from(P(l,{maxResults:i})):l.map((t=>[t])),e}),{})}(t,e);for(const t of function*(t,e){for(const n of function(t){const{selectors:e,combineBetweenSelectors:n,includeTag:o,maxCandidates:r}=t,i=n?function(t=[],{maxResults:e=Number.POSITIVE_INFINITY}={}){return Array.from(P(t,{maxResults:e}))}(e,{maxResults:r}):e.map((t=>[t]));return o?i.map(W):i}(e))yield*q(n,t)}(o,e))n.has(t)||(n.add(t),yield t)}(t,o);for(const o of function*(t,e){if(""===e)yield*t;else for(const n of t)yield*H([n],e)}(r,n))h(t,o,e)&&(yield o)}function*z(t,e,n="",o){if(0===t.length)return null;const r=[t.length>1?t:[],...b(t,e).map((t=>[t]))];for(const t of r)for(const r of U(t,e,n,o))yield{foundElements:t,selector:r}}function J(t){return{value:t,include:!1}}function K({selectors:t,operator:e}){let n=[...x];t[r.tag]&&t[r.nthoftype]&&(n=n.filter((t=>t!==r.tag)));let o="";return n.forEach((e=>{var n;(null!==(n=t[e])&&void 0!==n?n:[]).forEach((({value:t,include:e})=>{e&&(o+=t)}))})),e+o}function Q(t,e){return t.map((t=>function(t,e){return[e?":scope":":root",...y(t,e).reverse().map((t=>{var e;const n=function(t,e,n=o.NONE){const r={};return e.forEach((e=>{Reflect.set(r,e,function(t,e){return G[e](t)}(t,e).map(J))})),{element:t,operator:n,selectors:r}}(t,[r.nthchild],o.CHILD);return(null!==(e=n.selectors.nthchild)&&void 0!==e?e:[]).forEach((t=>{t.include=!0})),n})).map(K)].join("")}(t,e))).join(N)}function X(t,e={}){return Z(t,Object.assign(Object.assign({},e),{maxResults:1})).next().value}function*Z(t,e={}){var o;const i=function(t){(t instanceof NodeList||t instanceof HTMLCollection)&&(t=Array.from(t));const e=(Array.isArray(t)?t:[t]).filter(n);return[...new Set(e)]}(t),c=function(t,e={}){const n=Object.assign(Object.assign({},s),e);return{selectors:(o=n.selectors,Array.isArray(o)?o.filter((t=>{return e=r,n=t,Object.values(e).includes(n);var e,n})):[]),whitelist:a(n.whitelist),blacklist:a(n.blacklist),root:d(n.root,t),combineWithinSelector:!!n.combineWithinSelector,combineBetweenSelectors:!!n.combineBetweenSelectors,includeTag:!!n.includeTag,maxCombinations:m(n.maxCombinations),maxCandidates:m(n.maxCandidates),useScope:!!n.useScope,maxResults:m(n.maxResults)};var o}(i[0],e),u=null!==(o=c.root)&&void 0!==o?o:S(i[0]);let l=0;for(const t of function*({elements:t,root:e,rootSelector:n="",options:o}){let r=e,i=n,c=!0;for(;c;){let n=!1;for(const c of z(t,r,i,o)){const{foundElements:o,selector:s}=c;if(n=!0,!h(t,s,e)){r=o[0],i=s;break}yield s}n||(c=!1)}}({elements:i,options:c,root:u,rootSelector:""}))if(yield t,l++,l>=c.maxResults)return;i.length>1&&(yield i.map((t=>X(t,c))).join(N),l++,l>=c.maxResults)||(yield Q(i,c.useScope?u:void 0))}const tt=X;return e})()));', Tr = `// WebPub-specific setup - no execution blocking needed
|
|
5589
5589
|
window._readium_blockedEvents = [];
|
|
5590
5590
|
window._readium_blockEvents = false; // WebPub doesn't need event blocking
|
|
5591
5591
|
window._readium_eventBlocker = null;
|
|
5592
|
-
`,
|
|
5592
|
+
`, gn = `(function() {
|
|
5593
5593
|
if(window.onload) window.onload = new Proxy(window.onload, {
|
|
5594
5594
|
apply: function(target, receiver, args) {
|
|
5595
5595
|
if(!window._readium_blockEvents) {
|
|
@@ -5603,21 +5603,21 @@ window._readium_eventBlocker = null;
|
|
|
5603
5603
|
});
|
|
5604
5604
|
})();
|
|
5605
5605
|
`;
|
|
5606
|
-
function
|
|
5606
|
+
function Ar(s) {
|
|
5607
5607
|
const t = s.filter((r) => r.mediaType.isHTML).map((r) => r.href), e = t.length > 0 ? t : [/\.html$/, /\.xhtml$/, /\/$/], i = [
|
|
5608
5608
|
// CSS Selector Generator - always injected
|
|
5609
5609
|
{
|
|
5610
5610
|
id: "css-selector-generator",
|
|
5611
5611
|
as: "script",
|
|
5612
5612
|
target: "head",
|
|
5613
|
-
blob: new Blob([
|
|
5613
|
+
blob: new Blob([yt(mn)], { type: "text/javascript" })
|
|
5614
5614
|
},
|
|
5615
5615
|
// WebPub Execution - always injected (sets up event blocking to false)
|
|
5616
5616
|
{
|
|
5617
5617
|
id: "webpub-execution",
|
|
5618
5618
|
as: "script",
|
|
5619
5619
|
target: "head",
|
|
5620
|
-
blob: new Blob([
|
|
5620
|
+
blob: new Blob([yt(Tr)], { type: "text/javascript" })
|
|
5621
5621
|
}
|
|
5622
5622
|
], n = [
|
|
5623
5623
|
// Onload Proxy - conditional (has executable scripts)
|
|
@@ -5625,7 +5625,7 @@ function Or(s) {
|
|
|
5625
5625
|
id: "onload-proxy",
|
|
5626
5626
|
as: "script",
|
|
5627
5627
|
target: "head",
|
|
5628
|
-
blob: new Blob([
|
|
5628
|
+
blob: new Blob([yt(gn)], { type: "text/javascript" }),
|
|
5629
5629
|
condition: (r) => !!(r.querySelector("script") || r.querySelector("body[onload]:not(body[onload=''])"))
|
|
5630
5630
|
},
|
|
5631
5631
|
// Readium CSS WebPub - always injected
|
|
@@ -5633,7 +5633,7 @@ function Or(s) {
|
|
|
5633
5633
|
id: "readium-css-webpub",
|
|
5634
5634
|
as: "link",
|
|
5635
5635
|
target: "head",
|
|
5636
|
-
blob: new Blob([Nt(
|
|
5636
|
+
blob: new Blob([Nt(Or)], { type: "text/css" }),
|
|
5637
5637
|
rel: "stylesheet"
|
|
5638
5638
|
}
|
|
5639
5639
|
];
|
|
@@ -5645,7 +5645,7 @@ function Or(s) {
|
|
|
5645
5645
|
}
|
|
5646
5646
|
];
|
|
5647
5647
|
}
|
|
5648
|
-
class
|
|
5648
|
+
class zr {
|
|
5649
5649
|
constructor(t) {
|
|
5650
5650
|
if (this.detectedTools = /* @__PURE__ */ new Set(), !t.onDetected)
|
|
5651
5651
|
throw new Error("onDetected callback is required");
|
|
@@ -5677,11 +5677,11 @@ class Tr {
|
|
|
5677
5677
|
this.observer?.disconnect(), this.observer = void 0, this.detectedTools.clear();
|
|
5678
5678
|
}
|
|
5679
5679
|
}
|
|
5680
|
-
let
|
|
5681
|
-
function
|
|
5682
|
-
return ++
|
|
5680
|
+
let Mr = 0;
|
|
5681
|
+
function Nr() {
|
|
5682
|
+
return ++Mr;
|
|
5683
5683
|
}
|
|
5684
|
-
const
|
|
5684
|
+
const Fr = `
|
|
5685
5685
|
onmessage = function(event) {
|
|
5686
5686
|
var action = event.data;
|
|
5687
5687
|
var startTime = performance.now()
|
|
@@ -5692,7 +5692,7 @@ onmessage = function(event) {
|
|
|
5692
5692
|
time: performance.now() - startTime
|
|
5693
5693
|
})
|
|
5694
5694
|
}
|
|
5695
|
-
`,
|
|
5695
|
+
`, Ve = class Ve {
|
|
5696
5696
|
constructor(t, e) {
|
|
5697
5697
|
this.callbacks = /* @__PURE__ */ new Map(), this.worker = t, this.blobUrl = e, this.worker.onmessage = (i) => {
|
|
5698
5698
|
const n = i.data, r = n.id, o = this.callbacks.get(n.id);
|
|
@@ -5702,7 +5702,7 @@ onmessage = function(event) {
|
|
|
5702
5702
|
}, this.log = (...i) => this.send("log", ...i), this.table = (...i) => this.send("table", ...i), this.clear = (...i) => this.send("clear", ...i);
|
|
5703
5703
|
}
|
|
5704
5704
|
async send(t, ...e) {
|
|
5705
|
-
const i =
|
|
5705
|
+
const i = Nr();
|
|
5706
5706
|
return new Promise((n, r) => {
|
|
5707
5707
|
this.callbacks.set(i, n), this.worker.postMessage({
|
|
5708
5708
|
id: i,
|
|
@@ -5717,14 +5717,14 @@ onmessage = function(event) {
|
|
|
5717
5717
|
this.worker.terminate(), URL.revokeObjectURL(this.blobUrl);
|
|
5718
5718
|
}
|
|
5719
5719
|
};
|
|
5720
|
-
|
|
5721
|
-
let ee =
|
|
5720
|
+
Ve.workerScript = Fr;
|
|
5721
|
+
let ee = Ve;
|
|
5722
5722
|
function De(s) {
|
|
5723
5723
|
return typeof window < "u" && console ? console[s] : (...t) => {
|
|
5724
5724
|
};
|
|
5725
5725
|
}
|
|
5726
|
-
const
|
|
5727
|
-
async function
|
|
5726
|
+
const Ur = De("log"), Ci = De("table"), Ir = De("clear");
|
|
5727
|
+
async function xi() {
|
|
5728
5728
|
if (typeof navigator < "u" && navigator.brave && navigator.brave.isBrave)
|
|
5729
5729
|
try {
|
|
5730
5730
|
return await Promise.race([
|
|
@@ -5736,10 +5736,10 @@ async function Ei() {
|
|
|
5736
5736
|
}
|
|
5737
5737
|
return !1;
|
|
5738
5738
|
}
|
|
5739
|
-
function
|
|
5739
|
+
function Dr(s) {
|
|
5740
5740
|
return s.excludes.some((t) => t()) ? !1 : s.includes.some((t) => t());
|
|
5741
5741
|
}
|
|
5742
|
-
class
|
|
5742
|
+
class Wr {
|
|
5743
5743
|
constructor(t = {}) {
|
|
5744
5744
|
if (this.isOpen = !1, this.checkCount = 0, this.maxChecks = 10, this.maxPrintTime = 0, this.largeObjectArray = null, this.options = {
|
|
5745
5745
|
onDetected: t.onDetected || (() => {
|
|
@@ -5785,11 +5785,11 @@ class Ir {
|
|
|
5785
5785
|
return (await this.workerConsole.table(t)).time;
|
|
5786
5786
|
} catch {
|
|
5787
5787
|
const i = performance.now();
|
|
5788
|
-
return
|
|
5788
|
+
return Ci(t), performance.now() - i;
|
|
5789
5789
|
}
|
|
5790
5790
|
else {
|
|
5791
5791
|
const e = performance.now();
|
|
5792
|
-
return
|
|
5792
|
+
return Ci(t), performance.now() - e;
|
|
5793
5793
|
}
|
|
5794
5794
|
}
|
|
5795
5795
|
/**
|
|
@@ -5801,14 +5801,14 @@ class Ir {
|
|
|
5801
5801
|
return (await this.workerConsole.log(t)).time;
|
|
5802
5802
|
{
|
|
5803
5803
|
const e = performance.now();
|
|
5804
|
-
return
|
|
5804
|
+
return Ur(t), performance.now() - e;
|
|
5805
5805
|
}
|
|
5806
5806
|
}
|
|
5807
5807
|
/**
|
|
5808
5808
|
* Check if performance-based detection is enabled for current browser
|
|
5809
5809
|
*/
|
|
5810
5810
|
isPerformanceDetectionEnabled() {
|
|
5811
|
-
return
|
|
5811
|
+
return Dr({
|
|
5812
5812
|
includes: [
|
|
5813
5813
|
() => !!q.UA.Chrome,
|
|
5814
5814
|
() => !!q.UA.Chromium,
|
|
@@ -5831,14 +5831,14 @@ class Ir {
|
|
|
5831
5831
|
if (!this.isPerformanceDetectionEnabled())
|
|
5832
5832
|
return !1;
|
|
5833
5833
|
const t = await this.calcTablePrintTime(), e = Math.max(await this.calcLogPrintTime(), await this.calcLogPrintTime());
|
|
5834
|
-
return this.maxPrintTime = Math.max(this.maxPrintTime, e), this.workerConsole ? await this.workerConsole.clear() :
|
|
5834
|
+
return this.maxPrintTime = Math.max(this.maxPrintTime, e), this.workerConsole ? await this.workerConsole.clear() : Ir(), t === 0 ? !1 : this.maxPrintTime === 0 ? !!await xi() : t > this.maxPrintTime * 10;
|
|
5835
5835
|
}
|
|
5836
5836
|
/**
|
|
5837
5837
|
* Debugger-based detection (fallback method)
|
|
5838
5838
|
* WARNING: This method impacts user experience
|
|
5839
5839
|
*/
|
|
5840
5840
|
async checkDebuggerBased() {
|
|
5841
|
-
if (!this.isDebuggerDetectionEnabled() || await
|
|
5841
|
+
if (!this.isDebuggerDetectionEnabled() || await xi())
|
|
5842
5842
|
return !1;
|
|
5843
5843
|
const t = performance.now();
|
|
5844
5844
|
try {
|
|
@@ -5883,10 +5883,10 @@ class Ir {
|
|
|
5883
5883
|
* Stop detection and cleanup resources
|
|
5884
5884
|
*/
|
|
5885
5885
|
destroy() {
|
|
5886
|
-
this.intervalId && (clearInterval(this.intervalId), this.intervalId = void 0), this.workerConsole && this.workerConsole.destroy(), this.isOpen = !1, this.checkCount = 0;
|
|
5886
|
+
this.intervalId && (clearInterval(this.intervalId), this.intervalId = void 0), this.workerConsole && (this.workerConsole.destroy(), this.workerConsole = void 0), this.isOpen = !1, this.checkCount = 0;
|
|
5887
5887
|
}
|
|
5888
5888
|
}
|
|
5889
|
-
class
|
|
5889
|
+
class Hr {
|
|
5890
5890
|
constructor(t) {
|
|
5891
5891
|
if (this.detected = !1, !t.onDetected)
|
|
5892
5892
|
throw new Error("onDetected callback is required");
|
|
@@ -5921,7 +5921,7 @@ class Dr {
|
|
|
5921
5921
|
this.observer?.disconnect(), this.observer = void 0, this.detected = !1;
|
|
5922
5922
|
}
|
|
5923
5923
|
}
|
|
5924
|
-
class
|
|
5924
|
+
class Br {
|
|
5925
5925
|
constructor(t = {}) {
|
|
5926
5926
|
this.styleElement = null, this.beforePrintHandler = null, this.onPrintAttempt = t.onPrintAttempt, t.disable && this.setupPrintProtection(t.watermark);
|
|
5927
5927
|
}
|
|
@@ -5947,7 +5947,7 @@ class Wr {
|
|
|
5947
5947
|
this.beforePrintHandler && (window.removeEventListener("beforeprint", this.beforePrintHandler), this.beforePrintHandler = null), this.styleElement?.parentNode && (this.styleElement.parentNode.removeChild(this.styleElement), this.styleElement = null);
|
|
5948
5948
|
}
|
|
5949
5949
|
}
|
|
5950
|
-
class
|
|
5950
|
+
class Vr {
|
|
5951
5951
|
constructor(t = {}) {
|
|
5952
5952
|
this.onContextMenuBlocked = t.onContextMenuBlocked, this.contextMenuHandler = this.handleContextMenu.bind(this), document.addEventListener("contextmenu", this.contextMenuHandler, !0), window.addEventListener("unload", () => this.destroy());
|
|
5953
5953
|
}
|
|
@@ -5966,10 +5966,10 @@ class Hr {
|
|
|
5966
5966
|
this.contextMenuHandler && (document.removeEventListener("contextmenu", this.contextMenuHandler, !0), this.contextMenuHandler = void 0);
|
|
5967
5967
|
}
|
|
5968
5968
|
}
|
|
5969
|
-
const
|
|
5970
|
-
class
|
|
5969
|
+
const st = "readium:navigator:suspiciousActivity";
|
|
5970
|
+
class We {
|
|
5971
5971
|
dispatchSuspiciousActivity(t, e) {
|
|
5972
|
-
const i = new CustomEvent(
|
|
5972
|
+
const i = new CustomEvent(st, {
|
|
5973
5973
|
detail: {
|
|
5974
5974
|
type: t,
|
|
5975
5975
|
timestamp: Date.now(),
|
|
@@ -5979,7 +5979,7 @@ class un {
|
|
|
5979
5979
|
window.dispatchEvent(i);
|
|
5980
5980
|
}
|
|
5981
5981
|
constructor(t = {}) {
|
|
5982
|
-
t.monitorDevTools && (this.devToolsDetector = new
|
|
5982
|
+
t.monitorDevTools && (this.devToolsDetector = new Wr({
|
|
5983
5983
|
onDetected: () => {
|
|
5984
5984
|
this.dispatchSuspiciousActivity("developer_tools", {
|
|
5985
5985
|
targetFrameSrc: "",
|
|
@@ -5992,20 +5992,20 @@ class un {
|
|
|
5992
5992
|
metaKey: !1
|
|
5993
5993
|
});
|
|
5994
5994
|
}
|
|
5995
|
-
})), t.checkAutomation && (this.automationDetector = new
|
|
5995
|
+
})), t.checkAutomation && (this.automationDetector = new zr({
|
|
5996
5996
|
onDetected: (e) => {
|
|
5997
5997
|
this.dispatchSuspiciousActivity("automation_detected", { tool: e });
|
|
5998
5998
|
}
|
|
5999
|
-
})), t.checkIFrameEmbedding && (this.iframeEmbeddingDetector = new
|
|
5999
|
+
})), t.checkIFrameEmbedding && (this.iframeEmbeddingDetector = new Hr({
|
|
6000
6000
|
onDetected: (e) => {
|
|
6001
6001
|
this.dispatchSuspiciousActivity("iframe_embedding_detected", { isCrossOrigin: e });
|
|
6002
6002
|
}
|
|
6003
|
-
})), t.protectPrinting?.disable && (this.printProtector = new
|
|
6003
|
+
})), t.protectPrinting?.disable && (this.printProtector = new Br({
|
|
6004
6004
|
...t.protectPrinting,
|
|
6005
6005
|
onPrintAttempt: () => {
|
|
6006
6006
|
this.dispatchSuspiciousActivity("print", {});
|
|
6007
6007
|
}
|
|
6008
|
-
})), t.disableContextMenu && (this.contextMenuProtector = new
|
|
6008
|
+
})), t.disableContextMenu && (this.contextMenuProtector = new Vr({
|
|
6009
6009
|
onContextMenuBlocked: (e) => {
|
|
6010
6010
|
this.dispatchSuspiciousActivity("context_menu", e);
|
|
6011
6011
|
}
|
|
@@ -6015,15 +6015,15 @@ class un {
|
|
|
6015
6015
|
this.automationDetector?.destroy(), this.devToolsDetector?.destroy(), this.iframeEmbeddingDetector?.destroy(), this.printProtector?.destroy(), this.contextMenuProtector?.destroy();
|
|
6016
6016
|
}
|
|
6017
6017
|
}
|
|
6018
|
-
const
|
|
6019
|
-
class
|
|
6018
|
+
const ot = "readium:navigator:keyboardPeripheral";
|
|
6019
|
+
class He {
|
|
6020
6020
|
constructor(t = {}) {
|
|
6021
|
-
this.keyManager = new
|
|
6021
|
+
this.keyManager = new en(), this.setupKeyboardPeripherals(t.keyboardPeripherals || []);
|
|
6022
6022
|
}
|
|
6023
6023
|
setupKeyboardPeripherals(t) {
|
|
6024
6024
|
if (t.length > 0) {
|
|
6025
6025
|
const e = (i) => {
|
|
6026
|
-
const n = new CustomEvent(
|
|
6026
|
+
const n = new CustomEvent(ot, {
|
|
6027
6027
|
detail: i
|
|
6028
6028
|
});
|
|
6029
6029
|
window.dispatchEvent(n);
|
|
@@ -6041,7 +6041,7 @@ class pn {
|
|
|
6041
6041
|
this.keydownHandler && (document.removeEventListener("keydown", this.keydownHandler, !0), this.keydownHandler = void 0);
|
|
6042
6042
|
}
|
|
6043
6043
|
}
|
|
6044
|
-
const
|
|
6044
|
+
const jr = (s) => ({
|
|
6045
6045
|
frameLoaded: s.frameLoaded || (() => {
|
|
6046
6046
|
}),
|
|
6047
6047
|
positionChanged: s.positionChanged || (() => {
|
|
@@ -6064,32 +6064,32 @@ const Br = (s) => ({
|
|
|
6064
6064
|
peripheral: s.peripheral || (() => {
|
|
6065
6065
|
})
|
|
6066
6066
|
});
|
|
6067
|
-
class
|
|
6067
|
+
class Gr extends rn {
|
|
6068
6068
|
constructor(t, e, i, n = void 0, r = { preferences: {}, defaults: {} }) {
|
|
6069
6069
|
super(), this.currentIndex = 0, this._preferencesEditor = null, this._injector = null, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.webViewport = {
|
|
6070
6070
|
readingOrder: [],
|
|
6071
6071
|
progressions: /* @__PURE__ */ new Map(),
|
|
6072
6072
|
positions: null
|
|
6073
|
-
}, this.pub = e, this.container = t, this.listeners =
|
|
6074
|
-
rsProperties: new
|
|
6075
|
-
userProperties: new
|
|
6073
|
+
}, this.pub = e, this.container = t, this.listeners = jr(i), this._preferences = new kt(r.preferences), this._defaults = new Lr(r.defaults), this._settings = new _i(this._preferences, this._defaults, this.hasDisplayTransformability), this._css = new Cr({
|
|
6074
|
+
rsProperties: new Er({ experiments: this._settings.experiments || null }),
|
|
6075
|
+
userProperties: new ln({ zoom: this._settings.zoom })
|
|
6076
6076
|
});
|
|
6077
|
-
const o =
|
|
6078
|
-
if (this._injector = new
|
|
6077
|
+
const o = Ar(e.readingOrder.items), a = r.injectables || { rules: [], allowedDomains: [] };
|
|
6078
|
+
if (this._injector = new pn({
|
|
6079
6079
|
rules: [...o, ...a.rules],
|
|
6080
6080
|
allowedDomains: a.allowedDomains
|
|
6081
6081
|
}), this._contentProtection = r.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
|
|
6082
6082
|
this._contentProtection,
|
|
6083
6083
|
r.keyboardPeripherals || []
|
|
6084
|
-
), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new
|
|
6085
|
-
const h = l;
|
|
6086
|
-
this.listeners.contentProtection(h
|
|
6087
|
-
}, window.addEventListener(
|
|
6084
|
+
), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new We(this._contentProtection), this._suspiciousActivityListener = (l) => {
|
|
6085
|
+
const { type: h, ...c } = l.detail;
|
|
6086
|
+
h === "context_menu" ? this.listeners.contextMenu(c) : this.listeners.contentProtection(h, c);
|
|
6087
|
+
}, window.addEventListener(st, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new He({
|
|
6088
6088
|
keyboardPeripherals: this._keyboardPeripherals
|
|
6089
6089
|
}), this._keyboardPeripheralListener = (l) => {
|
|
6090
6090
|
const h = l.detail;
|
|
6091
6091
|
this.listeners.peripheral(h);
|
|
6092
|
-
}, window.addEventListener(
|
|
6092
|
+
}, window.addEventListener(ot, this._keyboardPeripheralListener)), n && typeof n.copyWithLocations == "function") {
|
|
6093
6093
|
this.currentLocation = n;
|
|
6094
6094
|
const l = this.pub.readingOrder.findIndexWithHref(n.href);
|
|
6095
6095
|
l >= 0 && (this.currentIndex = l);
|
|
@@ -6099,7 +6099,7 @@ class Vr extends Qi {
|
|
|
6099
6099
|
async load() {
|
|
6100
6100
|
await this.updateCSS(!1);
|
|
6101
6101
|
const t = this.compileCSSProperties(this._css);
|
|
6102
|
-
this.framePool = new
|
|
6102
|
+
this.framePool = new br(
|
|
6103
6103
|
this.container,
|
|
6104
6104
|
t,
|
|
6105
6105
|
this._injector,
|
|
@@ -6112,13 +6112,13 @@ class Vr extends Qi {
|
|
|
6112
6112
|
return Object.freeze({ ...this._settings });
|
|
6113
6113
|
}
|
|
6114
6114
|
get preferencesEditor() {
|
|
6115
|
-
return this._preferencesEditor === null && (this._preferencesEditor = new
|
|
6115
|
+
return this._preferencesEditor === null && (this._preferencesEditor = new Pi(this._preferences, this.settings, this.pub.metadata)), this._preferencesEditor;
|
|
6116
6116
|
}
|
|
6117
6117
|
async submitPreferences(t) {
|
|
6118
6118
|
this._preferences = this._preferences.merging(t), await this.applyPreferences();
|
|
6119
6119
|
}
|
|
6120
6120
|
async applyPreferences() {
|
|
6121
|
-
this._settings = new
|
|
6121
|
+
this._settings = new _i(this._preferences, this._defaults, this.hasDisplayTransformability), this._preferencesEditor !== null && (this._preferencesEditor = new Pi(this._preferences, this.settings, this.pub.metadata)), await this.updateCSS(!0);
|
|
6122
6122
|
}
|
|
6123
6123
|
async updateCSS(t) {
|
|
6124
6124
|
this._css.update(this._settings), t && await this.commitCSS(this._css);
|
|
@@ -6236,7 +6236,7 @@ class Vr extends Qi {
|
|
|
6236
6236
|
}
|
|
6237
6237
|
}
|
|
6238
6238
|
determineModules() {
|
|
6239
|
-
return Array.from(Vt.keys()).filter((e) =>
|
|
6239
|
+
return Array.from(Vt.keys()).filter((e) => or.includes(e));
|
|
6240
6240
|
}
|
|
6241
6241
|
attachListener() {
|
|
6242
6242
|
this.framePool.currentFrames[0]?.msg && (this.framePool.currentFrames[0].msg.listener = (t, e) => {
|
|
@@ -6248,7 +6248,7 @@ class Vr extends Qi {
|
|
|
6248
6248
|
throw Error("Link for " + this.currentLocation.href + " not found!");
|
|
6249
6249
|
}
|
|
6250
6250
|
async destroy() {
|
|
6251
|
-
this._suspiciousActivityListener && window.removeEventListener(
|
|
6251
|
+
this._suspiciousActivityListener && window.removeEventListener(st, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(ot, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
|
|
6252
6252
|
}
|
|
6253
6253
|
async changeResource(t) {
|
|
6254
6254
|
if (t === 0) return !1;
|
|
@@ -6374,7 +6374,7 @@ class Vr extends Qi {
|
|
|
6374
6374
|
});
|
|
6375
6375
|
}
|
|
6376
6376
|
}
|
|
6377
|
-
const
|
|
6377
|
+
const Ts = Gr, $r = (s) => {
|
|
6378
6378
|
const t = s.join(" ");
|
|
6379
6379
|
return [
|
|
6380
6380
|
// 'self' is useless because the document is loaded from a blob: URL
|
|
@@ -6399,7 +6399,7 @@ const Cs = Vr, jr = (s) => {
|
|
|
6399
6399
|
//`report-uri ?`,
|
|
6400
6400
|
].join("; ");
|
|
6401
6401
|
};
|
|
6402
|
-
class
|
|
6402
|
+
class fn {
|
|
6403
6403
|
constructor(t, e, i, n) {
|
|
6404
6404
|
this.injector = null, this.pub = t, this.item = i, this.burl = i.toURL(e) || "", this.cssProperties = n.cssProperties, this.injector = n.injector ?? null;
|
|
6405
6405
|
}
|
|
@@ -6453,7 +6453,7 @@ class mn {
|
|
|
6453
6453
|
c.href = i, c.dataset.readium = "true", t.head.firstChild.before(c);
|
|
6454
6454
|
}
|
|
6455
6455
|
const h = t.createElement("meta");
|
|
6456
|
-
return h.httpEquiv = "Content-Security-Policy", h.content =
|
|
6456
|
+
return h.httpEquiv = "Content-Security-Policy", h.content = $r(l), h.dataset.readium = "true", t.head.firstChild.before(h), URL.createObjectURL(
|
|
6457
6457
|
new Blob([new XMLSerializer().serializeToString(t)], {
|
|
6458
6458
|
type: n.isHTML ? n.string : "application/xhtml+xml"
|
|
6459
6459
|
// Fallback to XHTML
|
|
@@ -6461,7 +6461,7 @@ class mn {
|
|
|
6461
6461
|
);
|
|
6462
6462
|
}
|
|
6463
6463
|
}
|
|
6464
|
-
class
|
|
6464
|
+
class Xr {
|
|
6465
6465
|
constructor(t, e = {}, i = []) {
|
|
6466
6466
|
this.hidden = !0, this.destroyed = !1, this.currModules = [], this.frame = document.createElement("iframe"), this.frame.sandbox.value = "allow-same-origin allow-scripts", this.frame.classList.add("readium-navigator-iframe"), this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.opacity = "0", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transition = "visibility 0s, opacity 0.1s linear", this.source = t, this.contentProtectionConfig = { ...e }, this.keyboardPeripheralsConfig = [...i];
|
|
6467
6467
|
}
|
|
@@ -6476,7 +6476,7 @@ class Gr {
|
|
|
6476
6476
|
}
|
|
6477
6477
|
return;
|
|
6478
6478
|
}
|
|
6479
|
-
this.comms?.halt(), this.loader.destroy(), this.loader = new
|
|
6479
|
+
this.comms?.halt(), this.loader.destroy(), this.loader = new St(n, t), this.currModules = t, this.comms = void 0;
|
|
6480
6480
|
try {
|
|
6481
6481
|
e(n);
|
|
6482
6482
|
} catch {
|
|
@@ -6485,7 +6485,7 @@ class Gr {
|
|
|
6485
6485
|
}
|
|
6486
6486
|
this.frame.onload = () => {
|
|
6487
6487
|
const n = this.frame.contentWindow;
|
|
6488
|
-
this.loader = new
|
|
6488
|
+
this.loader = new St(n, t), this.currModules = t;
|
|
6489
6489
|
try {
|
|
6490
6490
|
e(n);
|
|
6491
6491
|
} catch {
|
|
@@ -6499,7 +6499,7 @@ class Gr {
|
|
|
6499
6499
|
});
|
|
6500
6500
|
}
|
|
6501
6501
|
applyContentProtection() {
|
|
6502
|
-
this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
|
|
6502
|
+
this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.monitorScrollingExperimental && this.comms.send("scroll_protection", {}), this.contentProtectionConfig.protectPrinting?.disable && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
|
|
6503
6503
|
}
|
|
6504
6504
|
async destroy() {
|
|
6505
6505
|
await this.hide(), this.loader?.destroy(), this.frame.remove(), this.destroyed = !0;
|
|
@@ -6518,7 +6518,7 @@ class Gr {
|
|
|
6518
6518
|
async show(t) {
|
|
6519
6519
|
if (this.destroyed) throw Error("Trying to show frame when it doesn't exist");
|
|
6520
6520
|
if (!this.frame.parentElement) throw Error("Trying to show frame that is not attached to the DOM");
|
|
6521
|
-
return this.comms ? this.comms.resume() : this.comms = new
|
|
6521
|
+
return this.comms ? this.comms.resume() : this.comms = new Lt(this.frame.contentWindow, this.source), new Promise((e, i) => {
|
|
6522
6522
|
this.comms?.send("activate", void 0, () => {
|
|
6523
6523
|
this.comms?.send("focus", void 0, () => {
|
|
6524
6524
|
this.applyContentProtection();
|
|
@@ -6531,7 +6531,7 @@ class Gr {
|
|
|
6531
6531
|
});
|
|
6532
6532
|
}
|
|
6533
6533
|
setCSSProperties(t) {
|
|
6534
|
-
this.destroyed || !this.frame.contentWindow || (this.hidden && (this.comms ? this.comms?.resume() : this.comms = new
|
|
6534
|
+
this.destroyed || !this.frame.contentWindow || (this.hidden && (this.comms ? this.comms?.resume() : this.comms = new Lt(this.frame.contentWindow, this.source)), this.comms?.send("update_properties", t), this.hidden && this.comms?.halt());
|
|
6535
6535
|
}
|
|
6536
6536
|
get iframe() {
|
|
6537
6537
|
if (this.destroyed) throw Error("Trying to use frame when it doesn't exist");
|
|
@@ -6558,8 +6558,8 @@ class Gr {
|
|
|
6558
6558
|
return this.loader;
|
|
6559
6559
|
}
|
|
6560
6560
|
}
|
|
6561
|
-
const
|
|
6562
|
-
class
|
|
6561
|
+
const Ri = 5, Li = 3;
|
|
6562
|
+
class Yr {
|
|
6563
6563
|
constructor(t, e, i, n, r, o) {
|
|
6564
6564
|
this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.pendingUpdates = /* @__PURE__ */ new Map(), this.injector = null, this.container = t, this.positions = e, this.currentCssProperties = i, this.injector = n ?? null, this.contentProtectionConfig = r || {}, this.keyboardPeripheralsConfig = o || [];
|
|
6565
6565
|
}
|
|
@@ -6586,7 +6586,7 @@ class $r {
|
|
|
6586
6586
|
const a = new Promise(async (l, h) => {
|
|
6587
6587
|
const c = [], u = [];
|
|
6588
6588
|
this.positions.forEach((d, p) => {
|
|
6589
|
-
(p > r +
|
|
6589
|
+
(p > r + Ri || p < r - Ri) && (c.includes(d.href) || c.push(d.href)), p < r + Li && p > r - Li && (u.includes(d.href) || u.push(d.href));
|
|
6590
6590
|
}), c.forEach(async (d) => {
|
|
6591
6591
|
u.includes(d) || this.pool.has(d) && (await this.pool.get(d)?.destroy(), this.pool.delete(d), this.pendingUpdates.has(d) && this.pendingUpdates.set(d, { inPool: !1 }));
|
|
6592
6592
|
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((d) => {
|
|
@@ -6611,7 +6611,7 @@ class $r {
|
|
|
6611
6611
|
const p = t.readingOrder.findWithHref(d);
|
|
6612
6612
|
if (!p) return;
|
|
6613
6613
|
if (!this.blobs.has(d)) {
|
|
6614
|
-
const k = await new
|
|
6614
|
+
const k = await new fn(
|
|
6615
6615
|
t,
|
|
6616
6616
|
this.currentBaseURL || "",
|
|
6617
6617
|
p,
|
|
@@ -6622,7 +6622,7 @@ class $r {
|
|
|
6622
6622
|
).build();
|
|
6623
6623
|
this.blobs.set(d, k);
|
|
6624
6624
|
}
|
|
6625
|
-
const b = new
|
|
6625
|
+
const b = new Xr(this.blobs.get(d), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
6626
6626
|
d !== o && await b.hide(), this.container.appendChild(b.iframe), await b.load(i), this.pool.set(d, b);
|
|
6627
6627
|
};
|
|
6628
6628
|
try {
|
|
@@ -6676,7 +6676,7 @@ class $r {
|
|
|
6676
6676
|
}), t;
|
|
6677
6677
|
}
|
|
6678
6678
|
}
|
|
6679
|
-
class
|
|
6679
|
+
class qr {
|
|
6680
6680
|
constructor(t, e, i, n = {}, r = []) {
|
|
6681
6681
|
this.currModules = [], this.cachedPage = void 0, this.peripherals = t, this.debugHref = i, this.contentProtectionConfig = { ...n }, this.keyboardPeripheralsConfig = [...r], this.frame = document.createElement("iframe"), this.frame.sandbox.value = "allow-same-origin allow-scripts", this.frame.classList.add("readium-navigator-iframe"), this.frame.classList.add("blank"), this.frame.scrolling = "no", this.frame.style.visibility = "hidden", this.frame.style.setProperty("aria-hidden", "true"), this.frame.style.display = "none", this.frame.style.position = "absolute", this.frame.style.pointerEvents = "none", this.frame.style.transformOrigin = "0 0", this.frame.style.transform = "scale(1)", this.frame.style.background = "#fff", this.frame.style.touchAction = "none", this.frame.dataset.originalHref = i, this.source = "about:blank", this.wrapper = document.createElement("div"), this.wrapper.style.position = "relative", this.wrapper.style.float = this.wrapper.style.cssFloat = e === D.rtl ? "right" : "left", this.wrapper.appendChild(this.frame);
|
|
6682
6682
|
}
|
|
@@ -6691,7 +6691,7 @@ class Xr {
|
|
|
6691
6691
|
}
|
|
6692
6692
|
return;
|
|
6693
6693
|
}
|
|
6694
|
-
this.comms?.halt(), this.loader.destroy(), this.loader = new
|
|
6694
|
+
this.comms?.halt(), this.loader.destroy(), this.loader = new St(r, t), this.currModules = t, this.comms = void 0;
|
|
6695
6695
|
try {
|
|
6696
6696
|
i(r), this.loadPromise = void 0;
|
|
6697
6697
|
} catch {
|
|
@@ -6700,7 +6700,7 @@ class Xr {
|
|
|
6700
6700
|
}
|
|
6701
6701
|
this.frame.addEventListener("load", () => {
|
|
6702
6702
|
const r = this.frame.contentWindow;
|
|
6703
|
-
this.loader = new
|
|
6703
|
+
this.loader = new St(r, t), this.currModules = t, this.peripherals.observe(this.wrapper), this.peripherals.observe(r);
|
|
6704
6704
|
try {
|
|
6705
6705
|
i(r);
|
|
6706
6706
|
} catch {
|
|
@@ -6780,7 +6780,7 @@ class Xr {
|
|
|
6780
6780
|
this.comms?.halt();
|
|
6781
6781
|
}
|
|
6782
6782
|
applyContentProtection() {
|
|
6783
|
-
this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.protectPrinting && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
|
|
6783
|
+
this.comms || this.comms.resume(), this.comms.send("peripherals_protection", this.contentProtectionConfig), this.keyboardPeripheralsConfig && this.keyboardPeripheralsConfig.length > 0 && this.comms.send("keyboard_peripherals", this.keyboardPeripheralsConfig), this.contentProtectionConfig.protectPrinting?.disable && this.comms.send("print_protection", this.contentProtectionConfig.protectPrinting);
|
|
6784
6784
|
}
|
|
6785
6785
|
async show(t) {
|
|
6786
6786
|
if (!this.frame.parentElement) {
|
|
@@ -6791,7 +6791,7 @@ class Xr {
|
|
|
6791
6791
|
this.showPromise = void 0;
|
|
6792
6792
|
return;
|
|
6793
6793
|
}
|
|
6794
|
-
return this.showPromise ? (this.cachedPage !== t && (this.update(t), this.cachedPage = t), this.showPromise) : (this.cachedPage = t, this.comms ? this.comms.resume() : this.comms = new
|
|
6794
|
+
return this.showPromise ? (this.cachedPage !== t && (this.update(t), this.cachedPage = t), this.showPromise) : (this.cachedPage = t, this.comms ? this.comms.resume() : this.comms = new Lt(this.frame.contentWindow, this.source), this.showPromise = new Promise((e, i) => {
|
|
6795
6795
|
this.comms.send("focus", void 0, (n) => {
|
|
6796
6796
|
this.update(this.cachedPage), this.applyContentProtection(), e();
|
|
6797
6797
|
});
|
|
@@ -6842,8 +6842,8 @@ class Xr {
|
|
|
6842
6842
|
return this.loader;
|
|
6843
6843
|
}
|
|
6844
6844
|
}
|
|
6845
|
-
var
|
|
6846
|
-
class
|
|
6845
|
+
var Kr = /* @__PURE__ */ ((s) => (s[s.Left = 0] = "Left", s[s.Center = 1] = "Center", s[s.Right = 2] = "Right", s))(Kr || {}), Zr = /* @__PURE__ */ ((s) => (s[s.Top = 0] = "Top", s[s.Middle = 1] = "Middle", s[s.Bottom = 2] = "Bottom", s))(Zr || {});
|
|
6846
|
+
class Jr {
|
|
6847
6847
|
constructor() {
|
|
6848
6848
|
this.outerWidth = 0, this.outerHeight = 0, this.HTML = document.documentElement, this.Head = document.head, this.Body = document.body;
|
|
6849
6849
|
}
|
|
@@ -6891,7 +6891,7 @@ class Kr {
|
|
|
6891
6891
|
};
|
|
6892
6892
|
}
|
|
6893
6893
|
}
|
|
6894
|
-
class
|
|
6894
|
+
class Qr {
|
|
6895
6895
|
constructor() {
|
|
6896
6896
|
this._DOM = {
|
|
6897
6897
|
show: !1,
|
|
@@ -6909,8 +6909,8 @@ class Zr {
|
|
|
6909
6909
|
return this._DOM;
|
|
6910
6910
|
}
|
|
6911
6911
|
}
|
|
6912
|
-
const
|
|
6913
|
-
class
|
|
6912
|
+
const ki = 6, pe = 1.02, Oi = 50;
|
|
6913
|
+
class ts {
|
|
6914
6914
|
constructor(t, e = !1) {
|
|
6915
6915
|
this.dragState = 0, this.minimumMoved = !1, this.pan = {
|
|
6916
6916
|
startX: 0,
|
|
@@ -6929,7 +6929,7 @@ class Jr {
|
|
|
6929
6929
|
target: { X: 0, Y: 0 },
|
|
6930
6930
|
touchN: 0,
|
|
6931
6931
|
startTranslate: { X: 0, Y: 0 }
|
|
6932
|
-
}, this._scale = 1, this.scaleDebouncer = 0, this.frameBounds = null, this.debugger = null, this.btouchstartHandler = this.touchstartHandler.bind(this), this.btouchendHandler = this.touchendHandler.bind(this), this.btouchmoveHandler = this.touchmoveHandler.bind(this), this.bdblclickHandler = this.dblclickHandler.bind(this), this.bmousedownHandler = this.mousedownHandler.bind(this), this.bmouseupHandler = this.mouseupHandler.bind(this), this.bmousemoveHandler = this.mousemoveHandler.bind(this), this.moveFrame = 0, this.manager = t, this.coordinator = new
|
|
6932
|
+
}, this._scale = 1, this.scaleDebouncer = 0, this.frameBounds = null, this.debugger = null, this.btouchstartHandler = this.touchstartHandler.bind(this), this.btouchendHandler = this.touchendHandler.bind(this), this.btouchmoveHandler = this.touchmoveHandler.bind(this), this.bdblclickHandler = this.dblclickHandler.bind(this), this.bmousedownHandler = this.mousedownHandler.bind(this), this.bmouseupHandler = this.mouseupHandler.bind(this), this.bmousemoveHandler = this.mousemoveHandler.bind(this), this.moveFrame = 0, this.manager = t, this.coordinator = new Jr(), this.attachEvents(), e && (this.debugger = new Qr());
|
|
6933
6933
|
}
|
|
6934
6934
|
get scale() {
|
|
6935
6935
|
return this._scale;
|
|
@@ -7025,7 +7025,7 @@ class Jr {
|
|
|
7025
7025
|
*/
|
|
7026
7026
|
touchendHandler(t) {
|
|
7027
7027
|
if (t.stopPropagation(), !t.touches || t.touches.length === 0)
|
|
7028
|
-
this.pan.endX && !this.isScaled ? (this.pinch.touchN && (this.pan.endX = this.pan.startX), this.updateAfterDrag()) : !this.pinch.touchN && Math.abs(this.pan.overscrollX) >
|
|
7028
|
+
this.pan.endX && !this.isScaled ? (this.pinch.touchN && (this.pan.endX = this.pan.startX), this.updateAfterDrag()) : !this.pinch.touchN && Math.abs(this.pan.overscrollX) > Oi && Math.abs(this.pan.overscrollY) < Oi / 2 && (this.pan.startX = 0, this.pan.endX = -this.pan.overscrollX, this.updateAfterDrag()), this.dragState = 0, this.minimumMoved = !1, this.clearPinch(), this.debugger?.show && (this.debugger.DOM.center.style.display = "none", this.debugger.DOM.touch1.style.display = "none", this.debugger.DOM.touch2.style.display = "none");
|
|
7029
7029
|
else if (t.touches.length === 1) {
|
|
7030
7030
|
this.dragState = 1, t.touches[0].identifier !== this.pan.touchID && (this.pan.touchID = t.touches[0].identifier), this.debugger?.show && (this.debugger.DOM.center.style.display = "none", this.debugger.DOM.touch2.style.display = "none", this.debugger.DOM.pinchTarget.style.display = "none");
|
|
7031
7031
|
const e = this.startTouch(t);
|
|
@@ -7048,7 +7048,7 @@ class Jr {
|
|
|
7048
7048
|
if (this.dragState === 2 && i) {
|
|
7049
7049
|
if (this.pinch.touchN++, this.pinch.touchN < 4) return;
|
|
7050
7050
|
let o = i / this.pinch.startDistance * this.scale;
|
|
7051
|
-
o >=
|
|
7051
|
+
o >= ki && (o = ki), o <= pe && (o = 1), this.scale = o, this.pinch.startDistance = i, n = !0;
|
|
7052
7052
|
}
|
|
7053
7053
|
if (this.pan.letItGo === !1 && (this.pan.letItGo = Math.abs(this.pan.startY - e.Y) < Math.abs(this.pan.startX - e.X)), this.debugger?.show && (this.debugger.DOM.touch1.style.top = `${e.Y - 10}px`, this.debugger.DOM.touch1.style.left = `${e.X - 10}px`, this.debugger.DOM.touch1.innerText = `${e.X.toFixed(2)},${e.Y.toFixed(2)}`), this.dragState > 0 && this.isScaled || this.dragState > 1) {
|
|
7054
7054
|
if (this.dragState === 1) {
|
|
@@ -7131,7 +7131,7 @@ Overscroll: ${this.pan.overscrollX.toFixed(2)},${this.pan.overscrollY.toFixed(2)
|
|
|
7131
7131
|
}
|
|
7132
7132
|
}
|
|
7133
7133
|
var Re = /* @__PURE__ */ ((s) => (s.auto = "auto", s.landscape = "landscape", s.portrait = "portrait", s))(Re || {}), Le = /* @__PURE__ */ ((s) => (s.auto = "auto", s.both = "both", s.none = "none", s.landscape = "landscape", s))(Le || {});
|
|
7134
|
-
class
|
|
7134
|
+
class es {
|
|
7135
7135
|
// TODO getter
|
|
7136
7136
|
constructor(t) {
|
|
7137
7137
|
this.shift = !0, this.spreads = [], this.nLandscape = 0, this.index(t), this.testShift(t), console.log(`Indexed ${this.spreads.length} spreads for ${t.readingOrder.items.length} items`);
|
|
@@ -7176,13 +7176,13 @@ class Qr {
|
|
|
7176
7176
|
return this.spreads.find((e) => e.includes(t)) || void 0;
|
|
7177
7177
|
}
|
|
7178
7178
|
}
|
|
7179
|
-
const
|
|
7180
|
-
class
|
|
7179
|
+
const Ti = 8, Ai = 5, is = 300, ns = 15e3, rs = 250, ss = 150, os = 500;
|
|
7180
|
+
class as {
|
|
7181
7181
|
constructor(t, e, i, n, r, o) {
|
|
7182
7182
|
if (this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.delayedShow = /* @__PURE__ */ new Map(), this.delayedTimeout = /* @__PURE__ */ new Map(), this.previousFrames = [], this.injector = null, this.width = 0, this.height = 0, this.transform = "", this.currentSlide = 0, this.spread = !0, this.orientationInternal = -1, this.container = t, this.positions = e, this.pub = i, this.injector = n ?? null, this.contentProtectionConfig = r || {}, this.keyboardPeripheralsConfig = o || [], this.spreadPresentation = i.metadata.otherMetadata?.spread || Le.auto, this.pub.metadata.effectiveReadingProgression !== D.rtl && this.pub.metadata.effectiveReadingProgression !== D.ltr)
|
|
7183
7183
|
throw Error("Unsupported reading progression for EPUB");
|
|
7184
|
-
this.spreader = new
|
|
7185
|
-
const l = new
|
|
7184
|
+
this.spreader = new es(this.pub), this.containerHeightCached = t.clientHeight, this.bookElement = document.createElement("div"), this.bookElement.ariaLabel = "Book", this.bookElement.tabIndex = -1, this.updateBookStyle(!0), this.spineElement = document.createElement("div"), this.spineElement.ariaLabel = "Spine", this.bookElement.appendChild(this.spineElement), this.container.appendChild(this.bookElement), this.updateSpineStyle(!0), this.peripherals = new ts(this), this.pub.readingOrder.items.forEach((a) => {
|
|
7185
|
+
const l = new qr(this.peripherals, this.pub.metadata.effectiveReadingProgression, a.href, this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
7186
7186
|
this.spineElement.appendChild(l.element), this.pool.set(a.href, l), l.width = 100 / this.length * (a.properties?.otherProperties.orientation === Re.landscape || a.properties?.otherProperties.addBlank ? this.perPage : 1), l.height = this.height;
|
|
7187
7187
|
});
|
|
7188
7188
|
}
|
|
@@ -7207,7 +7207,7 @@ class ss {
|
|
|
7207
7207
|
const a = this.spreader.findByLink(o);
|
|
7208
7208
|
i.update(this.spreadPosition(a, o));
|
|
7209
7209
|
});
|
|
7210
|
-
},
|
|
7210
|
+
}, rs);
|
|
7211
7211
|
}
|
|
7212
7212
|
/**
|
|
7213
7213
|
* It is important that these values be cached to avoid spamming them on redraws, they are expensive.
|
|
@@ -7234,7 +7234,7 @@ class ss {
|
|
|
7234
7234
|
let i = "0";
|
|
7235
7235
|
this.updateDimensions(), this.perPage > 1 && (i = `${this.width / 2}px`);
|
|
7236
7236
|
const n = {
|
|
7237
|
-
transition: t ? `all ${e ?
|
|
7237
|
+
transition: t ? `all ${e ? ss : os}ms ease-out` : "all 0ms ease-out",
|
|
7238
7238
|
marginRight: this.rtl ? i : "0",
|
|
7239
7239
|
marginLeft: this.rtl ? "0" : i,
|
|
7240
7240
|
width: `${this.width / this.perPage * this.length}px`,
|
|
@@ -7394,7 +7394,7 @@ class ss {
|
|
|
7394
7394
|
const a = new Promise(async (l, h) => {
|
|
7395
7395
|
const c = [], u = [];
|
|
7396
7396
|
this.positions.forEach((d, p) => {
|
|
7397
|
-
(p > r +
|
|
7397
|
+
(p > r + Ti || p < r - Ti) && (c.includes(d.href) || c.push(d.href)), p < r + Ai && p > r - Ai && (u.includes(d.href) || u.push(d.href));
|
|
7398
7398
|
}), c.forEach(async (d) => {
|
|
7399
7399
|
u.includes(d) || this.pool.has(d) && (this.cancelShowing(d), await this.pool.get(d)?.unload());
|
|
7400
7400
|
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((d) => URL.revokeObjectURL(d)), this.blobs.clear()), this.currentBaseURL = t.baseURL;
|
|
@@ -7402,7 +7402,7 @@ class ss {
|
|
|
7402
7402
|
const p = t.readingOrder.findIndexWithHref(d), b = t.readingOrder.items[p];
|
|
7403
7403
|
if (b) {
|
|
7404
7404
|
if (!this.blobs.has(d)) {
|
|
7405
|
-
const k = await new
|
|
7405
|
+
const k = await new fn(
|
|
7406
7406
|
t,
|
|
7407
7407
|
this.currentBaseURL || "",
|
|
7408
7408
|
b,
|
|
@@ -7414,14 +7414,14 @@ class ss {
|
|
|
7414
7414
|
}
|
|
7415
7415
|
this.delayedShow.has(d) || this.delayedShow.set(d, new Promise((v, k) => {
|
|
7416
7416
|
let Q = !1;
|
|
7417
|
-
const
|
|
7417
|
+
const bn = window.setTimeout(async () => {
|
|
7418
7418
|
this.delayedTimeout.set(d, 0);
|
|
7419
|
-
const
|
|
7420
|
-
await
|
|
7421
|
-
},
|
|
7419
|
+
const vn = this.makeSpread(this.reAlign(p)), wn = this.spreadPosition(vn, b), je = this.pool.get(d);
|
|
7420
|
+
await je.load(i, this.blobs.get(d)), this.peripherals.isScaled || await je.show(wn), this.delayedShow.delete(d), Q = !0, v();
|
|
7421
|
+
}, is);
|
|
7422
7422
|
setTimeout(() => {
|
|
7423
7423
|
!Q && this.delayedShow.has(d) && k(`Offscreen load timeout: ${d}`);
|
|
7424
|
-
},
|
|
7424
|
+
}, ns), this.delayedTimeout.set(d, bn);
|
|
7425
7425
|
}));
|
|
7426
7426
|
}
|
|
7427
7427
|
};
|
|
@@ -7499,7 +7499,7 @@ class ss {
|
|
|
7499
7499
|
}
|
|
7500
7500
|
class Ot {
|
|
7501
7501
|
constructor(t = {}) {
|
|
7502
|
-
this.backgroundColor = I(t.backgroundColor), this.blendFilter = P(t.blendFilter), this.constraint = w(t.constraint), this.columnCount = w(t.columnCount), this.darkenFilter =
|
|
7502
|
+
this.backgroundColor = I(t.backgroundColor), this.blendFilter = P(t.blendFilter), this.constraint = w(t.constraint), this.columnCount = w(t.columnCount), this.darkenFilter = ft(t.darkenFilter), this.deprecatedFontSize = P(t.deprecatedFontSize), this.fontFamily = I(t.fontFamily), this.fontSize = M(t.fontSize, Gt.range), this.fontSizeNormalize = P(t.fontSizeNormalize), this.fontOpticalSizing = P(t.fontOpticalSizing), this.fontWeight = M(t.fontWeight, nt.range), this.fontWidth = M(t.fontWidth, $t.range), this.hyphens = P(t.hyphens), this.invertFilter = ft(t.invertFilter), this.invertGaijiFilter = ft(t.invertGaijiFilter), this.iOSPatch = P(t.iOSPatch), this.iPadOSPatch = P(t.iPadOSPatch), this.letterSpacing = w(t.letterSpacing), this.ligatures = P(t.ligatures), this.lineHeight = w(t.lineHeight), this.linkColor = I(t.linkColor), this.noRuby = P(t.noRuby), this.pageGutter = w(t.pageGutter), this.paragraphIndent = w(t.paragraphIndent), this.paragraphSpacing = w(t.paragraphSpacing), this.scroll = P(t.scroll), this.scrollPaddingTop = w(t.scrollPaddingTop), this.scrollPaddingBottom = w(t.scrollPaddingBottom), this.scrollPaddingLeft = w(t.scrollPaddingLeft), this.scrollPaddingRight = w(t.scrollPaddingRight), this.selectionBackgroundColor = I(t.selectionBackgroundColor), this.selectionTextColor = I(t.selectionTextColor), this.textAlign = se(t.textAlign, J), this.textColor = I(t.textColor), this.textNormalization = P(t.textNormalization), this.visitedColor = I(t.visitedColor), this.wordSpacing = w(t.wordSpacing), this.optimalLineLength = w(t.optimalLineLength), this.maximalLineLength = w(t.maximalLineLength), this.minimalLineLength = w(t.minimalLineLength);
|
|
7503
7503
|
}
|
|
7504
7504
|
static serialize(t) {
|
|
7505
7505
|
const { ...e } = t;
|
|
@@ -7520,20 +7520,20 @@ class Ot {
|
|
|
7520
7520
|
return new Ot(e);
|
|
7521
7521
|
}
|
|
7522
7522
|
}
|
|
7523
|
-
class
|
|
7523
|
+
class ls {
|
|
7524
7524
|
constructor(t) {
|
|
7525
|
-
this.backgroundColor = I(t.backgroundColor) || null, this.blendFilter = P(t.blendFilter) ?? !1, this.constraint = w(t.constraint) || 0, this.columnCount = w(t.columnCount) || null, this.darkenFilter =
|
|
7525
|
+
this.backgroundColor = I(t.backgroundColor) || null, this.blendFilter = P(t.blendFilter) ?? !1, this.constraint = w(t.constraint) || 0, this.columnCount = w(t.columnCount) || null, this.darkenFilter = ft(t.darkenFilter) ?? !1, this.deprecatedFontSize = P(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = I(t.fontFamily) || null, this.fontSize = M(t.fontSize, Gt.range) || 1, this.fontSizeNormalize = P(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = P(t.fontOpticalSizing) ?? null, this.fontWeight = M(t.fontWeight, nt.range) || null, this.fontWidth = M(t.fontWidth, $t.range) || null, this.hyphens = P(t.hyphens) ?? null, this.invertFilter = ft(t.invertFilter) ?? !1, this.invertGaijiFilter = ft(t.invertGaijiFilter) ?? !1, this.iOSPatch = t.iOSPatch === !1 ? !1 : (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile", this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : T.OS.iPadOS && T.iOSRequest === "desktop", this.letterSpacing = w(t.letterSpacing) || null, this.ligatures = P(t.ligatures) ?? null, this.lineHeight = w(t.lineHeight) || null, this.linkColor = I(t.linkColor) || null, this.noRuby = P(t.noRuby) ?? !1, this.pageGutter = ue(w(t.pageGutter), 20), this.paragraphIndent = w(t.paragraphIndent) ?? null, this.paragraphSpacing = w(t.paragraphSpacing) ?? null, this.scroll = P(t.scroll) ?? !1, this.scrollPaddingTop = w(t.scrollPaddingTop) ?? null, this.scrollPaddingBottom = w(t.scrollPaddingBottom) ?? null, this.scrollPaddingLeft = w(t.scrollPaddingLeft) ?? null, this.scrollPaddingRight = w(t.scrollPaddingRight) ?? null, this.selectionBackgroundColor = I(t.selectionBackgroundColor) || null, this.selectionTextColor = I(t.selectionTextColor) || null, this.textAlign = se(t.textAlign, J) || null, this.textColor = I(t.textColor) || null, this.textNormalization = P(t.textNormalization) ?? !1, this.visitedColor = I(t.visitedColor) || null, this.wordSpacing = w(t.wordSpacing) || null, this.optimalLineLength = w(t.optimalLineLength) || 65, this.maximalLineLength = ue(Rr(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = ue(xr(t.minimalLineLength, this.optimalLineLength), 40), this.experiments = hn(t.experiments) || null;
|
|
7526
7526
|
}
|
|
7527
7527
|
}
|
|
7528
|
-
const
|
|
7529
|
-
RS__backgroundColor:
|
|
7530
|
-
RS__textColor:
|
|
7531
|
-
RS__linkColor:
|
|
7532
|
-
RS__visitedColor:
|
|
7533
|
-
RS__selectionBackgroundColor:
|
|
7534
|
-
RS__selectionTextColor:
|
|
7528
|
+
const hs = "#FFFFFF", cs = "#121212", ds = "#0000EE", us = "#551A8B", ps = "#b4d8fe", ms = "inherit", dt = {
|
|
7529
|
+
RS__backgroundColor: hs,
|
|
7530
|
+
RS__textColor: cs,
|
|
7531
|
+
RS__linkColor: ds,
|
|
7532
|
+
RS__visitedColor: us,
|
|
7533
|
+
RS__selectionBackgroundColor: ps,
|
|
7534
|
+
RS__selectionTextColor: ms
|
|
7535
7535
|
};
|
|
7536
|
-
class
|
|
7536
|
+
class zi {
|
|
7537
7537
|
constructor(t, e, i) {
|
|
7538
7538
|
this.preferences = t, this.settings = e, this.metadata = i, this.layout = this.metadata?.effectiveLayout || S.reflowable;
|
|
7539
7539
|
}
|
|
@@ -7546,7 +7546,7 @@ class Ti {
|
|
|
7546
7546
|
get backgroundColor() {
|
|
7547
7547
|
return new A({
|
|
7548
7548
|
initialValue: this.preferences.backgroundColor,
|
|
7549
|
-
effectiveValue: this.settings.backgroundColor ||
|
|
7549
|
+
effectiveValue: this.settings.backgroundColor || dt.RS__backgroundColor,
|
|
7550
7550
|
isEffective: this.preferences.backgroundColor !== null,
|
|
7551
7551
|
onChange: (t) => {
|
|
7552
7552
|
this.updatePreference("backgroundColor", t || null);
|
|
@@ -7591,8 +7591,8 @@ class Ti {
|
|
|
7591
7591
|
onChange: (t) => {
|
|
7592
7592
|
this.updatePreference("darkenFilter", t || null);
|
|
7593
7593
|
},
|
|
7594
|
-
supportedRange:
|
|
7595
|
-
step:
|
|
7594
|
+
supportedRange: ht.range,
|
|
7595
|
+
step: ht.step
|
|
7596
7596
|
});
|
|
7597
7597
|
}
|
|
7598
7598
|
get deprecatedFontSize() {
|
|
@@ -7689,8 +7689,8 @@ class Ti {
|
|
|
7689
7689
|
onChange: (t) => {
|
|
7690
7690
|
this.updatePreference("invertFilter", t || null);
|
|
7691
7691
|
},
|
|
7692
|
-
supportedRange:
|
|
7693
|
-
step:
|
|
7692
|
+
supportedRange: ht.range,
|
|
7693
|
+
step: ht.step
|
|
7694
7694
|
});
|
|
7695
7695
|
}
|
|
7696
7696
|
get invertGaijiFilter() {
|
|
@@ -7701,8 +7701,8 @@ class Ti {
|
|
|
7701
7701
|
onChange: (t) => {
|
|
7702
7702
|
this.updatePreference("invertGaijiFilter", t || null);
|
|
7703
7703
|
},
|
|
7704
|
-
supportedRange:
|
|
7705
|
-
step:
|
|
7704
|
+
supportedRange: ht.range,
|
|
7705
|
+
step: ht.step
|
|
7706
7706
|
});
|
|
7707
7707
|
}
|
|
7708
7708
|
get iOSPatch() {
|
|
@@ -7767,7 +7767,7 @@ class Ti {
|
|
|
7767
7767
|
get linkColor() {
|
|
7768
7768
|
return new A({
|
|
7769
7769
|
initialValue: this.preferences.linkColor,
|
|
7770
|
-
effectiveValue: this.settings.linkColor ||
|
|
7770
|
+
effectiveValue: this.settings.linkColor || dt.RS__linkColor,
|
|
7771
7771
|
isEffective: this.layout !== S.fixed && this.preferences.linkColor !== null,
|
|
7772
7772
|
onChange: (t) => {
|
|
7773
7773
|
this.updatePreference("linkColor", t || null);
|
|
@@ -7782,8 +7782,8 @@ class Ti {
|
|
|
7782
7782
|
onChange: (t) => {
|
|
7783
7783
|
this.updatePreference("maximalLineLength", t);
|
|
7784
7784
|
},
|
|
7785
|
-
supportedRange:
|
|
7786
|
-
step:
|
|
7785
|
+
supportedRange: ct.range,
|
|
7786
|
+
step: ct.step
|
|
7787
7787
|
});
|
|
7788
7788
|
}
|
|
7789
7789
|
get minimalLineLength() {
|
|
@@ -7794,8 +7794,8 @@ class Ti {
|
|
|
7794
7794
|
onChange: (t) => {
|
|
7795
7795
|
this.updatePreference("minimalLineLength", t);
|
|
7796
7796
|
},
|
|
7797
|
-
supportedRange:
|
|
7798
|
-
step:
|
|
7797
|
+
supportedRange: ct.range,
|
|
7798
|
+
step: ct.step
|
|
7799
7799
|
});
|
|
7800
7800
|
}
|
|
7801
7801
|
get noRuby() {
|
|
@@ -7816,8 +7816,8 @@ class Ti {
|
|
|
7816
7816
|
onChange: (t) => {
|
|
7817
7817
|
this.updatePreference("optimalLineLength", t);
|
|
7818
7818
|
},
|
|
7819
|
-
supportedRange:
|
|
7820
|
-
step:
|
|
7819
|
+
supportedRange: ct.range,
|
|
7820
|
+
step: ct.step
|
|
7821
7821
|
});
|
|
7822
7822
|
}
|
|
7823
7823
|
get pageGutter() {
|
|
@@ -7907,7 +7907,7 @@ class Ti {
|
|
|
7907
7907
|
get selectionBackgroundColor() {
|
|
7908
7908
|
return new A({
|
|
7909
7909
|
initialValue: this.preferences.selectionBackgroundColor,
|
|
7910
|
-
effectiveValue: this.settings.selectionBackgroundColor ||
|
|
7910
|
+
effectiveValue: this.settings.selectionBackgroundColor || dt.RS__selectionBackgroundColor,
|
|
7911
7911
|
isEffective: this.layout !== S.fixed && this.preferences.selectionBackgroundColor !== null,
|
|
7912
7912
|
onChange: (t) => {
|
|
7913
7913
|
this.updatePreference("selectionBackgroundColor", t || null);
|
|
@@ -7917,7 +7917,7 @@ class Ti {
|
|
|
7917
7917
|
get selectionTextColor() {
|
|
7918
7918
|
return new A({
|
|
7919
7919
|
initialValue: this.preferences.selectionTextColor,
|
|
7920
|
-
effectiveValue: this.settings.selectionTextColor ||
|
|
7920
|
+
effectiveValue: this.settings.selectionTextColor || dt.RS__selectionTextColor,
|
|
7921
7921
|
isEffective: this.layout !== S.fixed && this.preferences.selectionTextColor !== null,
|
|
7922
7922
|
onChange: (t) => {
|
|
7923
7923
|
this.updatePreference("selectionTextColor", t || null);
|
|
@@ -7925,7 +7925,7 @@ class Ti {
|
|
|
7925
7925
|
});
|
|
7926
7926
|
}
|
|
7927
7927
|
get textAlign() {
|
|
7928
|
-
return new
|
|
7928
|
+
return new cn({
|
|
7929
7929
|
initialValue: this.preferences.textAlign,
|
|
7930
7930
|
effectiveValue: this.settings.textAlign || J.start,
|
|
7931
7931
|
isEffective: this.layout !== S.fixed && this.preferences.textAlign !== null,
|
|
@@ -7938,7 +7938,7 @@ class Ti {
|
|
|
7938
7938
|
get textColor() {
|
|
7939
7939
|
return new A({
|
|
7940
7940
|
initialValue: this.preferences.textColor,
|
|
7941
|
-
effectiveValue: this.settings.textColor ||
|
|
7941
|
+
effectiveValue: this.settings.textColor || dt.RS__textColor,
|
|
7942
7942
|
isEffective: this.layout !== S.fixed && this.preferences.textColor !== null,
|
|
7943
7943
|
onChange: (t) => {
|
|
7944
7944
|
this.updatePreference("textColor", t || null);
|
|
@@ -7958,7 +7958,7 @@ class Ti {
|
|
|
7958
7958
|
get visitedColor() {
|
|
7959
7959
|
return new A({
|
|
7960
7960
|
initialValue: this.preferences.visitedColor,
|
|
7961
|
-
effectiveValue: this.settings.visitedColor ||
|
|
7961
|
+
effectiveValue: this.settings.visitedColor || dt.RS__visitedColor,
|
|
7962
7962
|
isEffective: this.layout !== S.fixed && this.preferences.visitedColor !== null,
|
|
7963
7963
|
onChange: (t) => {
|
|
7964
7964
|
this.updatePreference("visitedColor", t || null);
|
|
@@ -7978,7 +7978,7 @@ class Ti {
|
|
|
7978
7978
|
});
|
|
7979
7979
|
}
|
|
7980
7980
|
}
|
|
7981
|
-
class
|
|
7981
|
+
class Mi {
|
|
7982
7982
|
constructor(t, e) {
|
|
7983
7983
|
this.backgroundColor = t.backgroundColor || e.backgroundColor || null, this.blendFilter = typeof t.blendFilter == "boolean" ? t.blendFilter : e.blendFilter ?? null, this.columnCount = t.columnCount !== void 0 ? t.columnCount : e.columnCount !== void 0 ? e.columnCount : null, this.constraint = t.constraint || e.constraint, this.darkenFilter = typeof t.darkenFilter == "boolean" ? t.darkenFilter : e.darkenFilter ?? null, this.deprecatedFontSize = typeof t.deprecatedFontSize == "boolean" ? t.deprecatedFontSize : e.deprecatedFontSize ?? null, this.fontFamily = t.fontFamily || e.fontFamily || null, this.fontSize = t.fontSize !== void 0 ? t.fontSize : e.fontSize !== void 0 ? e.fontSize : null, this.fontSizeNormalize = typeof t.fontSizeNormalize == "boolean" ? t.fontSizeNormalize : e.fontSizeNormalize ?? null, this.fontOpticalSizing = typeof t.fontOpticalSizing == "boolean" ? t.fontOpticalSizing : e.fontOpticalSizing ?? null, this.fontWeight = t.fontWeight !== void 0 ? t.fontWeight : e.fontWeight !== void 0 ? e.fontWeight : null, this.fontWidth = t.fontWidth !== void 0 ? t.fontWidth : e.fontWidth !== void 0 ? e.fontWidth : null, this.hyphens = typeof t.hyphens == "boolean" ? t.hyphens : e.hyphens ?? null, this.invertFilter = typeof t.invertFilter == "boolean" ? t.invertFilter : e.invertFilter ?? null, this.invertGaijiFilter = typeof t.invertGaijiFilter == "boolean" ? t.invertGaijiFilter : e.invertGaijiFilter ?? null, this.iOSPatch = this.deprecatedFontSize || t.iOSPatch === !1 ? !1 : t.iOSPatch === !0 ? (T.OS.iOS || T.OS.iPadOS) && T.iOSRequest === "mobile" : e.iOSPatch, this.iPadOSPatch = this.deprecatedFontSize || t.iPadOSPatch === !1 ? !1 : t.iPadOSPatch === !0 ? T.OS.iPadOS && T.iOSRequest === "desktop" : e.iPadOSPatch, this.letterSpacing = t.letterSpacing !== void 0 ? t.letterSpacing : e.letterSpacing !== void 0 ? e.letterSpacing : null, this.ligatures = typeof t.ligatures == "boolean" ? t.ligatures : e.ligatures ?? null, this.lineHeight = t.lineHeight !== void 0 ? t.lineHeight : e.lineHeight !== void 0 ? e.lineHeight : null, this.linkColor = t.linkColor || e.linkColor || null, this.maximalLineLength = t.maximalLineLength === null ? null : t.maximalLineLength || e.maximalLineLength || null, this.minimalLineLength = t.minimalLineLength === null ? null : t.minimalLineLength || e.minimalLineLength || null, this.noRuby = typeof t.noRuby == "boolean" ? t.noRuby : e.noRuby ?? null, this.optimalLineLength = t.optimalLineLength || e.optimalLineLength, this.pageGutter = t.pageGutter !== void 0 ? t.pageGutter : e.pageGutter !== void 0 ? e.pageGutter : null, this.paragraphIndent = t.paragraphIndent !== void 0 ? t.paragraphIndent : e.paragraphIndent !== void 0 ? e.paragraphIndent : null, this.paragraphSpacing = t.paragraphSpacing !== void 0 ? t.paragraphSpacing : e.paragraphSpacing !== void 0 ? e.paragraphSpacing : null, this.scroll = typeof t.scroll == "boolean" ? t.scroll : e.scroll ?? null, this.scrollPaddingTop = t.scrollPaddingTop !== void 0 ? t.scrollPaddingTop : e.scrollPaddingTop !== void 0 ? e.scrollPaddingTop : null, this.scrollPaddingBottom = t.scrollPaddingBottom !== void 0 ? t.scrollPaddingBottom : e.scrollPaddingBottom !== void 0 ? e.scrollPaddingBottom : null, this.scrollPaddingLeft = t.scrollPaddingLeft !== void 0 ? t.scrollPaddingLeft : e.scrollPaddingLeft !== void 0 ? e.scrollPaddingLeft : null, this.scrollPaddingRight = t.scrollPaddingRight !== void 0 ? t.scrollPaddingRight : e.scrollPaddingRight !== void 0 ? e.scrollPaddingRight : null, this.selectionBackgroundColor = t.selectionBackgroundColor || e.selectionBackgroundColor || null, this.selectionTextColor = t.selectionTextColor || e.selectionTextColor || null, this.textAlign = t.textAlign || e.textAlign || null, this.textColor = t.textColor || e.textColor || null, this.textNormalization = typeof t.textNormalization == "boolean" ? t.textNormalization : e.textNormalization ?? null, this.visitedColor = t.visitedColor || e.visitedColor || null, this.wordSpacing = t.wordSpacing !== void 0 ? t.wordSpacing : e.wordSpacing !== void 0 ? e.wordSpacing : null, this.experiments = e.experiments || null;
|
|
7984
7984
|
}
|
|
@@ -7987,7 +7987,7 @@ function Ft(s) {
|
|
|
7987
7987
|
const t = getComputedStyle(s), e = parseFloat(t.paddingLeft || "0"), i = parseFloat(t.paddingRight || "0");
|
|
7988
7988
|
return s.clientWidth - e - i;
|
|
7989
7989
|
}
|
|
7990
|
-
class
|
|
7990
|
+
class yn extends re {
|
|
7991
7991
|
constructor(t) {
|
|
7992
7992
|
super(), this.a11yNormalize = t.a11yNormalize ?? null, this.backgroundColor = t.backgroundColor ?? null, this.blendFilter = t.blendFilter ?? null, this.bodyHyphens = t.bodyHyphens ?? null, this.colCount = t.colCount ?? null, this.darkenFilter = t.darkenFilter ?? null, this.deprecatedFontSize = t.deprecatedFontSize ?? null, this.fontFamily = t.fontFamily ?? null, this.fontOpticalSizing = t.fontOpticalSizing ?? null, this.fontSize = t.fontSize ?? null, this.fontSizeNormalize = t.fontSizeNormalize ?? null, this.fontWeight = t.fontWeight ?? null, this.fontWidth = t.fontWidth ?? null, this.invertFilter = t.invertFilter ?? null, this.invertGaijiFilter = t.invertGaijiFilter ?? null, this.iOSPatch = t.iOSPatch ?? null, this.iPadOSPatch = t.iPadOSPatch ?? null, this.letterSpacing = t.letterSpacing ?? null, this.ligatures = t.ligatures ?? null, this.lineHeight = t.lineHeight ?? null, this.lineLength = t.lineLength ?? null, this.linkColor = t.linkColor ?? null, this.noRuby = t.noRuby ?? null, this.paraIndent = t.paraIndent ?? null, this.paraSpacing = t.paraSpacing ?? null, this.selectionBackgroundColor = t.selectionBackgroundColor ?? null, this.selectionTextColor = t.selectionTextColor ?? null, this.textAlign = t.textAlign ?? null, this.textColor = t.textColor ?? null, this.view = t.view ?? null, this.visitedColor = t.visitedColor ?? null, this.wordSpacing = t.wordSpacing ?? null;
|
|
7993
7993
|
}
|
|
@@ -7996,7 +7996,7 @@ class gn extends re {
|
|
|
7996
7996
|
return this.a11yNormalize && (t["--USER__a11yNormalize"] = this.toFlag("a11y")), this.backgroundColor && (t["--USER__backgroundColor"] = this.backgroundColor), this.blendFilter && (t["--USER__blendFilter"] = this.toFlag("blend")), this.bodyHyphens && (t["--USER__bodyHyphens"] = this.bodyHyphens), this.colCount && (t["--USER__colCount"] = this.toUnitless(this.colCount)), this.darkenFilter === !0 ? t["--USER__darkenFilter"] = this.toFlag("darken") : typeof this.darkenFilter == "number" && (t["--USER__darkenFilter"] = this.toPercentage(this.darkenFilter)), this.deprecatedFontSize && (t["--USER__fontSizeImplementation"] = this.toFlag("deprecatedFontSize")), this.fontFamily && (t["--USER__fontFamily"] = this.fontFamily), this.fontOpticalSizing != null && (t["--USER__fontOpticalSizing"] = this.fontOpticalSizing), this.fontSize != null && (t["--USER__fontSize"] = this.toPercentage(this.fontSize, !0)), this.fontSizeNormalize && (t["--USER__fontSizeNormalize"] = this.toFlag("normalize")), this.fontWeight != null && (t["--USER__fontWeight"] = this.toUnitless(this.fontWeight)), this.fontWidth != null && (t["--USER__fontWidth"] = typeof this.fontWidth == "string" ? this.fontWidth : this.toUnitless(this.fontWidth)), this.invertFilter === !0 ? t["--USER__invertFilter"] = this.toFlag("invert") : typeof this.invertFilter == "number" && (t["--USER__invertFilter"] = this.toPercentage(this.invertFilter)), this.invertGaijiFilter === !0 ? t["--USER__invertGaiji"] = this.toFlag("invertGaiji") : typeof this.invertGaijiFilter == "number" && (t["--USER__invertGaiji"] = this.toPercentage(this.invertGaijiFilter)), this.iOSPatch && (t["--USER__iOSPatch"] = this.toFlag("iOSPatch")), this.iPadOSPatch && (t["--USER__iPadOSPatch"] = this.toFlag("iPadOSPatch")), this.letterSpacing != null && (t["--USER__letterSpacing"] = this.toRem(this.letterSpacing)), this.ligatures && (t["--USER__ligatures"] = this.ligatures), this.lineHeight != null && (t["--USER__lineHeight"] = this.toUnitless(this.lineHeight)), this.lineLength != null && (t["--USER__lineLength"] = this.toPx(this.lineLength)), this.linkColor && (t["--USER__linkColor"] = this.linkColor), this.noRuby && (t["--USER__noRuby"] = this.toFlag("noRuby")), this.paraIndent != null && (t["--USER__paraIndent"] = this.toRem(this.paraIndent)), this.paraSpacing != null && (t["--USER__paraSpacing"] = this.toRem(this.paraSpacing)), this.selectionBackgroundColor && (t["--USER__selectionBackgroundColor"] = this.selectionBackgroundColor), this.selectionTextColor && (t["--USER__selectionTextColor"] = this.selectionTextColor), this.textAlign && (t["--USER__textAlign"] = this.textAlign), this.textColor && (t["--USER__textColor"] = this.textColor), this.view && (t["--USER__view"] = this.toFlag(this.view)), this.visitedColor && (t["--USER__visitedColor"] = this.visitedColor), this.wordSpacing != null && (t["--USER__wordSpacing"] = this.toRem(this.wordSpacing)), t;
|
|
7997
7997
|
}
|
|
7998
7998
|
}
|
|
7999
|
-
class
|
|
7999
|
+
class gs extends re {
|
|
8000
8000
|
constructor(t) {
|
|
8001
8001
|
super(), this.backgroundColor = t.backgroundColor ?? null, this.baseFontFamily = t.baseFontFamily ?? null, this.baseFontSize = t.baseFontSize ?? null, this.baseLineHeight = t.baseLineHeight ?? null, this.boxSizingMedia = t.boxSizingMedia ?? null, this.boxSizingTable = t.boxSizingTable ?? null, this.colWidth = t.colWidth ?? null, this.colCount = t.colCount ?? null, this.colGap = t.colGap ?? null, this.codeFontFamily = t.codeFontFamily ?? null, this.compFontFamily = t.compFontFamily ?? null, this.defaultLineLength = t.defaultLineLength ?? null, this.flowSpacing = t.flowSpacing ?? null, this.humanistTf = t.humanistTf ?? null, this.linkColor = t.linkColor ?? null, this.maxMediaWidth = t.maxMediaWidth ?? null, this.maxMediaHeight = t.maxMediaHeight ?? null, this.modernTf = t.modernTf ?? null, this.monospaceTf = t.monospaceTf ?? null, this.noOverflow = t.noOverflow ?? null, this.noVerticalPagination = t.noVerticalPagination ?? null, this.oldStyleTf = t.oldStyleTf ?? null, this.pageGutter = t.pageGutter ?? null, this.paraIndent = t.paraIndent ?? null, this.paraSpacing = t.paraSpacing ?? null, this.primaryColor = t.primaryColor ?? null, this.scrollPaddingBottom = t.scrollPaddingBottom ?? null, this.scrollPaddingLeft = t.scrollPaddingLeft ?? null, this.scrollPaddingRight = t.scrollPaddingRight ?? null, this.scrollPaddingTop = t.scrollPaddingTop ?? null, this.sansSerifJa = t.sansSerifJa ?? null, this.sansSerifJaV = t.sansSerifJaV ?? null, this.sansTf = t.sansTf ?? null, this.secondaryColor = t.secondaryColor ?? null, this.selectionBackgroundColor = t.selectionBackgroundColor ?? null, this.selectionTextColor = t.selectionTextColor ?? null, this.serifJa = t.serifJa ?? null, this.serifJaV = t.serifJaV ?? null, this.textColor = t.textColor ?? null, this.typeScale = t.typeScale ?? null, this.visitedColor = t.visitedColor ?? null, this.experiments = t.experiments ?? null;
|
|
8002
8002
|
}
|
|
@@ -8007,7 +8007,7 @@ class ps extends re {
|
|
|
8007
8007
|
}), t;
|
|
8008
8008
|
}
|
|
8009
8009
|
}
|
|
8010
|
-
class
|
|
8010
|
+
class fs {
|
|
8011
8011
|
constructor(t) {
|
|
8012
8012
|
this.rsProperties = t.rsProperties, this.userProperties = t.userProperties, this.lineLengths = t.lineLengths, this.container = t.container, this.containerParent = t.container.parentElement || document.documentElement, this.constraint = t.constraint, this.cachedColCount = t.userProperties.colCount, this.effectiveContainerWidth = Ft(this.containerParent);
|
|
8013
8013
|
}
|
|
@@ -8057,7 +8057,7 @@ class ms {
|
|
|
8057
8057
|
visitedColor: t.visitedColor,
|
|
8058
8058
|
wordSpacing: t.wordSpacing
|
|
8059
8059
|
};
|
|
8060
|
-
this.userProperties = new
|
|
8060
|
+
this.userProperties = new yn(i);
|
|
8061
8061
|
}
|
|
8062
8062
|
updateLayout(t, e, i, n) {
|
|
8063
8063
|
return i ?? this.userProperties.view === "scroll" ? this.computeScrollLength(t, e) : this.paginate(t, e, n);
|
|
@@ -8144,7 +8144,7 @@ class ms {
|
|
|
8144
8144
|
this.userProperties.colCount = t.colCount, this.userProperties.lineLength = t.effectiveLineLength, this.effectiveContainerWidth = t.effectiveContainerWidth, this.container.style.width = `${this.effectiveContainerWidth}px`;
|
|
8145
8145
|
}
|
|
8146
8146
|
}
|
|
8147
|
-
const
|
|
8147
|
+
const ys = `/*!
|
|
8148
8148
|
* Readium CSS v.2.0.0
|
|
8149
8149
|
* Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
|
|
8150
8150
|
* Use of this source code is governed by a BSD-style license which is detailed in the
|
|
@@ -8733,7 +8733,7 @@ body{
|
|
|
8733
8733
|
|
|
8734
8734
|
:root[style*="readium-iPadOSPatch-on"] p:not(:has(b, cite, em, i, q, s, small, span, strong)):first-line{
|
|
8735
8735
|
-webkit-text-zoom:normal;
|
|
8736
|
-
}`,
|
|
8736
|
+
}`, Ss = `/*!
|
|
8737
8737
|
* Readium CSS v.2.0.0
|
|
8738
8738
|
* Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
|
|
8739
8739
|
* Use of this source code is governed by a BSD-style license which is detailed in the
|
|
@@ -9154,7 +9154,7 @@ audio{
|
|
|
9154
9154
|
table{
|
|
9155
9155
|
max-width:var(--RS__maxMediaWidth);
|
|
9156
9156
|
box-sizing:var(--RS__boxSizingTable);
|
|
9157
|
-
}`,
|
|
9157
|
+
}`, bs = `/*!
|
|
9158
9158
|
* Readium CSS v.2.0.0
|
|
9159
9159
|
* Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
|
|
9160
9160
|
* Use of this source code is governed by a BSD-style license which is detailed in the
|
|
@@ -9312,7 +9312,7 @@ th{
|
|
|
9312
9312
|
th, td{
|
|
9313
9313
|
padding:4px;
|
|
9314
9314
|
border:1px solid currentcolor;
|
|
9315
|
-
}`,
|
|
9315
|
+
}`, vs = `// Note: we aren't blocking some of the events right now to try and be as nonintrusive as possible.
|
|
9316
9316
|
// For a more comprehensive implementation, see https://github.com/hackademix/noscript/blob/3a83c0e4a506f175e38b0342dad50cdca3eae836/src/content/syncFetchPolicy.js#L142
|
|
9317
9317
|
// The snippet of code at the beginning of this source is an attempt at defence against JS using persistent storage
|
|
9318
9318
|
(function() {
|
|
@@ -9378,21 +9378,21 @@ th, td{
|
|
|
9378
9378
|
window.addEventListener("load", window._readium_eventBlocker, true);
|
|
9379
9379
|
})();
|
|
9380
9380
|
`;
|
|
9381
|
-
function
|
|
9381
|
+
function ws(s, t) {
|
|
9382
9382
|
const e = s.effectiveLayout === S.fixed, i = t.filter((a) => a.mediaType.isHTML).map((a) => a.href), n = i.length > 0 ? i : [/\.xhtml$/, /\.html$/], r = [
|
|
9383
9383
|
// CSS Selector Generator - always injected
|
|
9384
9384
|
{
|
|
9385
9385
|
id: "css-selector-generator",
|
|
9386
9386
|
as: "script",
|
|
9387
9387
|
target: "head",
|
|
9388
|
-
blob: new Blob([
|
|
9388
|
+
blob: new Blob([yt(mn)], { type: "text/javascript" })
|
|
9389
9389
|
},
|
|
9390
9390
|
// Execution Prevention - conditional (has executable scripts)
|
|
9391
9391
|
{
|
|
9392
9392
|
id: "execution-prevention",
|
|
9393
9393
|
as: "script",
|
|
9394
9394
|
target: "head",
|
|
9395
|
-
blob: new Blob([
|
|
9395
|
+
blob: new Blob([yt(vs)], { type: "text/javascript" }),
|
|
9396
9396
|
condition: (a) => !!(a.querySelector("script") || a.querySelector("body[onload]:not(body[onload=''])"))
|
|
9397
9397
|
}
|
|
9398
9398
|
], o = [
|
|
@@ -9401,7 +9401,7 @@ function bs(s, t) {
|
|
|
9401
9401
|
id: "onload-proxy",
|
|
9402
9402
|
as: "script",
|
|
9403
9403
|
target: "head",
|
|
9404
|
-
blob: new Blob([
|
|
9404
|
+
blob: new Blob([yt(gn)], { type: "text/javascript" }),
|
|
9405
9405
|
condition: (a) => !!(a.querySelector("script") || a.querySelector("body[onload]:not(body[onload=''])"))
|
|
9406
9406
|
}
|
|
9407
9407
|
];
|
|
@@ -9409,7 +9409,7 @@ function bs(s, t) {
|
|
|
9409
9409
|
id: "readium-css-before",
|
|
9410
9410
|
as: "link",
|
|
9411
9411
|
target: "head",
|
|
9412
|
-
blob: new Blob([Nt(
|
|
9412
|
+
blob: new Blob([Nt(Ss)], { type: "text/css" }),
|
|
9413
9413
|
rel: "stylesheet"
|
|
9414
9414
|
}), o.unshift(
|
|
9415
9415
|
// Readium CSS Default - only for reflowable AND no existing styles
|
|
@@ -9417,7 +9417,7 @@ function bs(s, t) {
|
|
|
9417
9417
|
id: "readium-css-default",
|
|
9418
9418
|
as: "link",
|
|
9419
9419
|
target: "head",
|
|
9420
|
-
blob: new Blob([Nt(
|
|
9420
|
+
blob: new Blob([Nt(bs)], { type: "text/css" }),
|
|
9421
9421
|
rel: "stylesheet",
|
|
9422
9422
|
condition: (a) => !(a.querySelector("link[rel='stylesheet']") || a.querySelector("style") || a.querySelector("[style]:not([style=''])"))
|
|
9423
9423
|
},
|
|
@@ -9426,7 +9426,7 @@ function bs(s, t) {
|
|
|
9426
9426
|
id: "readium-css-after",
|
|
9427
9427
|
as: "link",
|
|
9428
9428
|
target: "head",
|
|
9429
|
-
blob: new Blob([Nt(
|
|
9429
|
+
blob: new Blob([Nt(ys)], { type: "text/css" }),
|
|
9430
9430
|
rel: "stylesheet"
|
|
9431
9431
|
}
|
|
9432
9432
|
)), [
|
|
@@ -9437,7 +9437,7 @@ function bs(s, t) {
|
|
|
9437
9437
|
}
|
|
9438
9438
|
];
|
|
9439
9439
|
}
|
|
9440
|
-
const
|
|
9440
|
+
const _s = (s) => ({
|
|
9441
9441
|
frameLoaded: s.frameLoaded || (() => {
|
|
9442
9442
|
}),
|
|
9443
9443
|
positionChanged: s.positionChanged || (() => {
|
|
@@ -9462,16 +9462,16 @@ const vs = (s) => ({
|
|
|
9462
9462
|
peripheral: s.peripheral || (() => {
|
|
9463
9463
|
})
|
|
9464
9464
|
});
|
|
9465
|
-
class
|
|
9465
|
+
class Sn extends rn {
|
|
9466
9466
|
constructor(t, e, i, n = [], r = void 0, o = { preferences: {}, defaults: {} }) {
|
|
9467
9467
|
super(), this._preferencesEditor = null, this._injector = null, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this.reflowViewport = {
|
|
9468
9468
|
readingOrder: [],
|
|
9469
9469
|
progressions: /* @__PURE__ */ new Map(),
|
|
9470
9470
|
positions: null
|
|
9471
|
-
}, this.pub = e, this.container = t, this.listeners =
|
|
9472
|
-
rsProperties: new
|
|
9473
|
-
userProperties: new
|
|
9474
|
-
lineLengths: new
|
|
9471
|
+
}, this.pub = e, this.container = t, this.listeners = _s(i), this.currentLocation = r, n.length && (this.positions = n), this._preferences = new Ot(o.preferences), this._defaults = new ls(o.defaults), this._settings = new Mi(this._preferences, this._defaults), this._css = new fs({
|
|
9472
|
+
rsProperties: new gs({}),
|
|
9473
|
+
userProperties: new yn({}),
|
|
9474
|
+
lineLengths: new _t({
|
|
9475
9475
|
optimalChars: this._settings.optimalLineLength,
|
|
9476
9476
|
minChars: this._settings.minimalLineLength,
|
|
9477
9477
|
maxChars: this._settings.maximalLineLength,
|
|
@@ -9483,31 +9483,31 @@ class fn extends Qi {
|
|
|
9483
9483
|
}),
|
|
9484
9484
|
container: t,
|
|
9485
9485
|
constraint: this._settings.constraint
|
|
9486
|
-
}), this._layout =
|
|
9487
|
-
const a =
|
|
9488
|
-
this._injector = new
|
|
9486
|
+
}), this._layout = Sn.determineLayout(e, !!this._settings.scroll), this.currentProgression = e.metadata.effectiveReadingProgression;
|
|
9487
|
+
const a = ws(e.metadata, e.readingOrder.items), l = o.injectables || { rules: [], allowedDomains: [] };
|
|
9488
|
+
this._injector = new pn({
|
|
9489
9489
|
rules: [...a, ...l.rules],
|
|
9490
9490
|
allowedDomains: l.allowedDomains
|
|
9491
9491
|
}), this._contentProtection = o.contentProtection || {}, this._keyboardPeripherals = this.mergeKeyboardPeripherals(
|
|
9492
9492
|
this._contentProtection,
|
|
9493
9493
|
o.keyboardPeripherals || []
|
|
9494
|
-
), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new
|
|
9494
|
+
), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new We(this._contentProtection), this._suspiciousActivityListener = (h) => {
|
|
9495
9495
|
const { type: c, ...u } = h.detail;
|
|
9496
9496
|
c === "context_menu" ? this.listeners.contextMenu(u) : this.listeners.contentProtection(c, u);
|
|
9497
|
-
}, window.addEventListener(
|
|
9497
|
+
}, window.addEventListener(st, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new He({
|
|
9498
9498
|
keyboardPeripherals: this._keyboardPeripherals
|
|
9499
9499
|
}), this._keyboardPeripheralListener = (h) => {
|
|
9500
9500
|
const c = h.detail;
|
|
9501
9501
|
this.listeners.peripheral(c);
|
|
9502
|
-
}, window.addEventListener(
|
|
9502
|
+
}, window.addEventListener(ot, this._keyboardPeripheralListener)), this.resizeObserver = new ResizeObserver(() => this.ownerWindow.requestAnimationFrame(async () => await this.resizeHandler())), this.resizeObserver.observe(this.container.parentElement || document.documentElement);
|
|
9503
9503
|
}
|
|
9504
9504
|
static determineLayout(t, e) {
|
|
9505
9505
|
const i = t.metadata.effectiveLayout;
|
|
9506
|
-
return i === S.fixed || t.metadata.otherMetadata && "http://openmangaformat.org/schema/1.0#version" in t.metadata.otherMetadata || t.metadata?.conformsTo?.includes(
|
|
9506
|
+
return i === S.fixed || t.metadata.otherMetadata && "http://openmangaformat.org/schema/1.0#version" in t.metadata.otherMetadata || t.metadata?.conformsTo?.includes(Wi.DIVINA) ? S.fixed : i === S.scrolled || i === S.reflowable && e ? S.scrolled : S.reflowable;
|
|
9507
9507
|
}
|
|
9508
9508
|
async load() {
|
|
9509
9509
|
if (this.positions?.length || (this.positions = await this.pub.positionsFromManifest()), this._layout === S.fixed)
|
|
9510
|
-
this.framePool = new
|
|
9510
|
+
this.framePool = new as(
|
|
9511
9511
|
this.container,
|
|
9512
9512
|
this.positions,
|
|
9513
9513
|
this.pub,
|
|
@@ -9520,7 +9520,7 @@ class fn extends Qi {
|
|
|
9520
9520
|
else {
|
|
9521
9521
|
await this.updateCSS(!1);
|
|
9522
9522
|
const t = this.compileCSSProperties(this._css);
|
|
9523
|
-
this.framePool = new
|
|
9523
|
+
this.framePool = new Yr(
|
|
9524
9524
|
this.container,
|
|
9525
9525
|
this.positions,
|
|
9526
9526
|
t,
|
|
@@ -9540,14 +9540,14 @@ class fn extends Qi {
|
|
|
9540
9540
|
}
|
|
9541
9541
|
}
|
|
9542
9542
|
get preferencesEditor() {
|
|
9543
|
-
return this._preferencesEditor === null && (this._preferencesEditor = new
|
|
9543
|
+
return this._preferencesEditor === null && (this._preferencesEditor = new zi(this._preferences, this.settings, this.pub.metadata)), this._preferencesEditor;
|
|
9544
9544
|
}
|
|
9545
9545
|
async submitPreferences(t) {
|
|
9546
9546
|
this._preferences = this._preferences.merging(t), await this.applyPreferences();
|
|
9547
9547
|
}
|
|
9548
9548
|
async applyPreferences() {
|
|
9549
9549
|
const t = this._settings;
|
|
9550
|
-
this._settings = new
|
|
9550
|
+
this._settings = new Mi(this._preferences, this._defaults), this._preferencesEditor !== null && (this._preferencesEditor = new zi(this._preferences, this.settings, this.pub.metadata)), this._layout === S.fixed ? this.handleFXLPrefs(t, this._settings) : await this.updateCSS(!0);
|
|
9551
9551
|
}
|
|
9552
9552
|
// TODO: fit, etc.
|
|
9553
9553
|
handleFXLPrefs(t, e) {
|
|
@@ -9704,7 +9704,7 @@ class fn extends Qi {
|
|
|
9704
9704
|
}
|
|
9705
9705
|
determineModules() {
|
|
9706
9706
|
let t = Array.from(Vt.keys());
|
|
9707
|
-
return this._layout === S.fixed ? t.filter((e) =>
|
|
9707
|
+
return this._layout === S.fixed ? t.filter((e) => rr.includes(e)) : (t = t.filter((e) => sr.includes(e)), this._layout === S.scrolled ? t = t.filter((e) => e !== "column_snapper") : t = t.filter((e) => e !== "scroll_snapper"), t);
|
|
9708
9708
|
}
|
|
9709
9709
|
// Start listening to messages from the current iframe
|
|
9710
9710
|
attachListener() {
|
|
@@ -9721,7 +9721,7 @@ class fn extends Qi {
|
|
|
9721
9721
|
throw Error("Link for " + this.currentLocation.href + " not found!");
|
|
9722
9722
|
}
|
|
9723
9723
|
async destroy() {
|
|
9724
|
-
this._suspiciousActivityListener && window.removeEventListener(
|
|
9724
|
+
this._suspiciousActivityListener && window.removeEventListener(st, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(ot, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), await this.framePool?.destroy();
|
|
9725
9725
|
}
|
|
9726
9726
|
async changeResource(t) {
|
|
9727
9727
|
if (t === 0) return !1;
|
|
@@ -9898,7 +9898,7 @@ class fn extends Qi {
|
|
|
9898
9898
|
return this.go(t.locator, e, i);
|
|
9899
9899
|
}
|
|
9900
9900
|
}
|
|
9901
|
-
const
|
|
9901
|
+
const Ps = `// PreservePitchProcessor.js
|
|
9902
9902
|
// AudioWorklet processor for pitch preservation via pitch shifting
|
|
9903
9903
|
|
|
9904
9904
|
class PreservePitchProcessor extends AudioWorkletProcessor {
|
|
@@ -10048,17 +10048,17 @@ class PreservePitchProcessor extends AudioWorkletProcessor {
|
|
|
10048
10048
|
|
|
10049
10049
|
registerProcessor('preserve-pitch-processor', PreservePitchProcessor);
|
|
10050
10050
|
`;
|
|
10051
|
-
class
|
|
10051
|
+
class Be {
|
|
10052
10052
|
constructor(t) {
|
|
10053
10053
|
this.mediaElement = null, this.source = null, this.workletNode = null, this.url = null, this.ctx = t;
|
|
10054
10054
|
}
|
|
10055
10055
|
static async createWorklet(t) {
|
|
10056
|
-
const { ctx: e, mediaElement: i, pitchFactor: n, modulePath: r } = t, o = new
|
|
10056
|
+
const { ctx: e, mediaElement: i, pitchFactor: n, modulePath: r } = t, o = new Be(e);
|
|
10057
10057
|
try {
|
|
10058
10058
|
if (r)
|
|
10059
10059
|
await e.audioWorklet.addModule(r);
|
|
10060
10060
|
else {
|
|
10061
|
-
const a = new Blob([
|
|
10061
|
+
const a = new Blob([Ps], { type: "text/javascript" });
|
|
10062
10062
|
o.url = URL.createObjectURL(a), await e.audioWorklet.addModule(o.url);
|
|
10063
10063
|
}
|
|
10064
10064
|
} catch (a) {
|
|
@@ -10081,9 +10081,9 @@ class We {
|
|
|
10081
10081
|
this.workletNode && (this.workletNode.disconnect(), this.workletNode = null), this.source && (this.source.disconnect(), this.source = null), this.url && (URL.revokeObjectURL(this.url), this.url = null);
|
|
10082
10082
|
}
|
|
10083
10083
|
}
|
|
10084
|
-
class
|
|
10084
|
+
class Es {
|
|
10085
10085
|
constructor(t) {
|
|
10086
|
-
this.audioContext = null, this.sourceNode = null, this.gainNode = null, this.listeners = {}, this.
|
|
10086
|
+
this.audioContext = null, this.sourceNode = null, this.gainNode = null, this.listeners = {}, this.isMutedValue = !1, this.isPlayingValue = !1, this.isPausedValue = !1, this.isLoadingValue = !1, this.isLoadedValue = !1, this.isEndedValue = !1, this.isStoppedValue = !1, this.worklet = null, this.webAudioActive = !1, this.boundOnCanPlayThrough = this.onCanPlayThrough.bind(this), this.boundOnTimeUpdate = this.onTimeUpdate.bind(this), this.boundOnError = this.onError.bind(this), this.boundOnEnded = this.onEnded.bind(this), this.boundOnStalled = this.onStalled.bind(this), this.boundOnEmptied = this.onEmptied.bind(this), this.boundOnSuspend = this.onSuspend.bind(this), this.boundOnWaiting = this.onWaiting.bind(this), this.boundOnLoadedMetadata = this.onLoadedMetadata.bind(this), this.boundOnSeeking = this.onSeeking.bind(this), this.boundOnSeeked = this.onSeeked.bind(this), this.boundOnPlay = this.onPlay.bind(this), this.boundOnPlaying = this.onPlaying.bind(this), this.boundOnPause = this.onPause.bind(this), this.boundOnProgress = this.onProgress.bind(this), this.playback = t.playback, this.mediaElement = document.createElement("audio"), this.mediaElement.addEventListener("canplaythrough", this.boundOnCanPlayThrough), this.mediaElement.addEventListener("timeupdate", this.boundOnTimeUpdate), this.mediaElement.addEventListener("error", this.boundOnError), this.mediaElement.addEventListener("ended", this.boundOnEnded), this.mediaElement.addEventListener("stalled", this.boundOnStalled), this.mediaElement.addEventListener("emptied", this.boundOnEmptied), this.mediaElement.addEventListener("suspend", this.boundOnSuspend), this.mediaElement.addEventListener("waiting", this.boundOnWaiting), this.mediaElement.addEventListener("loadedmetadata", this.boundOnLoadedMetadata), this.mediaElement.addEventListener("seeking", this.boundOnSeeking), this.mediaElement.addEventListener("seeked", this.boundOnSeeked), this.mediaElement.addEventListener("play", this.boundOnPlay), this.mediaElement.addEventListener("playing", this.boundOnPlaying), this.mediaElement.addEventListener("pause", this.boundOnPause), this.mediaElement.addEventListener("progress", this.boundOnProgress), this.mediaElement.currentTime = this.playback.state.currentTime;
|
|
10087
10087
|
}
|
|
10088
10088
|
/**
|
|
10089
10089
|
* Adds an event listener to the audio engine.
|
|
@@ -10103,32 +10103,6 @@ class _s {
|
|
|
10103
10103
|
(i) => i !== e
|
|
10104
10104
|
));
|
|
10105
10105
|
}
|
|
10106
|
-
/**
|
|
10107
|
-
* Load the audio resource at the given URL.
|
|
10108
|
-
* @param url The URL of the audio resource.
|
|
10109
|
-
* */
|
|
10110
|
-
loadAudio(t) {
|
|
10111
|
-
if (this.isLoadingValue = !0, this.isLoadedValue = !1, this.isPlayingValue = !1, this.isPausedValue = !1, this.webAudioActive) {
|
|
10112
|
-
this.mediaElement.crossOrigin = "anonymous", this.mediaElement.src = t, this.mediaElement.load();
|
|
10113
|
-
const e = () => {
|
|
10114
|
-
this.mediaElement.removeEventListener("error", i), this.mediaElement.removeEventListener("canplaythrough", n);
|
|
10115
|
-
}, i = () => {
|
|
10116
|
-
e(), this.deactivateWebAudio(), this.mediaElement.removeAttribute("crossOrigin"), this.mediaElement.src = t, this.mediaElement.load();
|
|
10117
|
-
}, n = () => e();
|
|
10118
|
-
this.mediaElement.addEventListener("error", i), this.mediaElement.addEventListener("canplaythrough", n);
|
|
10119
|
-
} else
|
|
10120
|
-
this.mediaElement.src = t, this.mediaElement.load();
|
|
10121
|
-
}
|
|
10122
|
-
deactivateWebAudio() {
|
|
10123
|
-
this.worklet && (this.worklet.destroy(), this.worklet = null), this.sourceNode && (this.sourceNode.disconnect(), this.sourceNode = null), this.gainNode && (this.gainNode.disconnect(), this.gainNode = null), this.webAudioActive = !1;
|
|
10124
|
-
}
|
|
10125
|
-
/**
|
|
10126
|
-
* Sets the media element for playback.
|
|
10127
|
-
* @param element The HTML audio element to use.
|
|
10128
|
-
*/
|
|
10129
|
-
setMediaElement(t) {
|
|
10130
|
-
this.mediaElement.pause(), this.isPlayingValue = !1, this.isPausedValue = !1, this.sourceNode && (this.sourceNode.disconnect(), this.sourceNode = null), this.mediaElement.removeEventListener("canplaythrough", this.boundOnCanPlayThrough), this.mediaElement.removeEventListener("timeupdate", this.boundOnTimeUpdate), this.mediaElement.removeEventListener("error", this.boundOnError), this.mediaElement.removeEventListener("ended", this.boundOnEnded), this.mediaElement.removeEventListener("stalled", this.boundOnStalled), this.mediaElement.removeEventListener("emptied", this.boundOnEmptied), this.mediaElement.removeEventListener("suspend", this.boundOnSuspend), this.mediaElement.removeEventListener("waiting", this.boundOnWaiting), this.mediaElement.removeEventListener("loadedmetadata", this.boundOnLoadedMetadata), this.mediaElement.removeEventListener("seeking", this.boundOnSeeking), this.mediaElement.removeEventListener("seeked", this.boundOnSeeked), this.mediaElement.removeEventListener("play", this.boundOnPlay), this.mediaElement.removeEventListener("playing", this.boundOnPlaying), this.mediaElement.removeEventListener("pause", this.boundOnPause), this.mediaElement.removeEventListener("progress", this.boundOnProgress), this.mediaElement = t, this.mediaElement.addEventListener("canplaythrough", this.boundOnCanPlayThrough), this.mediaElement.addEventListener("timeupdate", this.boundOnTimeUpdate), this.mediaElement.addEventListener("error", this.boundOnError), this.mediaElement.addEventListener("ended", this.boundOnEnded), this.mediaElement.addEventListener("stalled", this.boundOnStalled), this.mediaElement.addEventListener("emptied", this.boundOnEmptied), this.mediaElement.addEventListener("suspend", this.boundOnSuspend), this.mediaElement.addEventListener("waiting", this.boundOnWaiting), this.mediaElement.addEventListener("loadedmetadata", this.boundOnLoadedMetadata), this.mediaElement.addEventListener("seeking", this.boundOnSeeking), this.mediaElement.addEventListener("seeked", this.boundOnSeeked), this.mediaElement.addEventListener("play", this.boundOnPlay), this.mediaElement.addEventListener("playing", this.boundOnPlaying), this.mediaElement.addEventListener("pause", this.boundOnPause), this.mediaElement.addEventListener("progress", this.boundOnProgress), this.mediaElement.volume = this.isMutedValue ? 0 : this.playback.state.volume, this.mediaElement.playbackRate = this.currentPlaybackRate, this.mediaElement.readyState >= 1 && this.onLoadedMetadata(new Event("loadedmetadata")), this.mediaElement.seekable.length > 0 && this.onProgress(), this.mediaElement.readyState >= 4 ? this.onCanPlayThrough() : (this.isLoadingValue = !0, this.isLoadedValue = !1);
|
|
10131
|
-
}
|
|
10132
10106
|
// Ensure AudioContext is running
|
|
10133
10107
|
async ensureAudioContextRunning() {
|
|
10134
10108
|
this.audioContext || (this.audioContext = new AudioContext()), this.audioContext.state === "suspended" && await this.audioContext.resume();
|
|
@@ -10219,14 +10193,14 @@ class _s {
|
|
|
10219
10193
|
*/
|
|
10220
10194
|
setVolume(t) {
|
|
10221
10195
|
if (t < 0) {
|
|
10222
|
-
this.mediaElement.volume = 0, this.gainNode && (this.gainNode.gain.value = 0), this.isMutedValue = !0
|
|
10196
|
+
this.mediaElement.volume = 0, this.gainNode && (this.gainNode.gain.value = 0), this.isMutedValue = !0;
|
|
10223
10197
|
return;
|
|
10224
10198
|
}
|
|
10225
10199
|
if (t > 1) {
|
|
10226
10200
|
this.setVolume(t / 100);
|
|
10227
10201
|
return;
|
|
10228
10202
|
}
|
|
10229
|
-
this.mediaElement.volume = t, this.gainNode && (this.gainNode.gain.value = t)
|
|
10203
|
+
this.mediaElement.volume = t, this.gainNode && (this.gainNode.gain.value = t);
|
|
10230
10204
|
}
|
|
10231
10205
|
/**
|
|
10232
10206
|
* Skips [seconds] either forward or backward if [seconds] is negative.
|
|
@@ -10295,8 +10269,8 @@ class _s {
|
|
|
10295
10269
|
* Sets the playback rate of the audio resource with pitch preservation.
|
|
10296
10270
|
*/
|
|
10297
10271
|
setPlaybackRate(t, e) {
|
|
10298
|
-
this.
|
|
10299
|
-
this.worklet ? this.worklet.updatePitchFactor(1 / t) : (this.sourceNode && (this.sourceNode.disconnect(), this.sourceNode = null),
|
|
10272
|
+
this.mediaElement.playbackRate = t, e ? "preservesPitch" in this.mediaElement ? this.mediaElement.preservesPitch = !0 : this.activateWebAudio().then(() => {
|
|
10273
|
+
this.worklet ? this.worklet.updatePitchFactor(1 / t) : (this.sourceNode && (this.sourceNode.disconnect(), this.sourceNode = null), Be.createWorklet({
|
|
10300
10274
|
ctx: this.getOrCreateAudioContext(),
|
|
10301
10275
|
mediaElement: this.mediaElement,
|
|
10302
10276
|
pitchFactor: 1
|
|
@@ -10333,6 +10307,13 @@ class _s {
|
|
|
10333
10307
|
get isWebAudioActive() {
|
|
10334
10308
|
return this.webAudioActive;
|
|
10335
10309
|
}
|
|
10310
|
+
/**
|
|
10311
|
+
* Changes the src of the primary media element without swapping the element.
|
|
10312
|
+
* Preserves the RemotePlayback session and all attached event listeners.
|
|
10313
|
+
*/
|
|
10314
|
+
changeSrc(t) {
|
|
10315
|
+
this.mediaElement.src !== t && (this.mediaElement.pause(), this.isPlayingValue = !1, this.isPausedValue = !1, this.isLoadedValue = !1, this.isLoadingValue = !0, this.isEndedValue = !1, this.webAudioActive && (this.mediaElement.crossOrigin = "anonymous"), this.mediaElement.src = t, this.mediaElement.load());
|
|
10316
|
+
}
|
|
10336
10317
|
/**
|
|
10337
10318
|
* Returns the HTML media element used for playback.
|
|
10338
10319
|
*/
|
|
@@ -10351,17 +10332,17 @@ class oe {
|
|
|
10351
10332
|
return new oe(e);
|
|
10352
10333
|
}
|
|
10353
10334
|
}
|
|
10354
|
-
class
|
|
10335
|
+
class Cs {
|
|
10355
10336
|
constructor(t = {}) {
|
|
10356
10337
|
this.volume = M(t.volume, Qt.range) ?? 1, this.playbackRate = M(t.playbackRate, te.range) ?? 1, this.preservePitch = P(t.preservePitch) ?? !0, this.skipBackwardInterval = M(t.skipBackwardInterval, et.range) ?? 10, this.skipForwardInterval = M(t.skipForwardInterval, et.range) ?? 10, this.pollInterval = w(t.pollInterval) ?? 1e3, this.autoPlay = P(t.autoPlay) ?? !0, this.enableMediaSession = P(t.enableMediaSession) ?? !0;
|
|
10357
10338
|
}
|
|
10358
10339
|
}
|
|
10359
|
-
class
|
|
10340
|
+
class Ni {
|
|
10360
10341
|
constructor(t, e) {
|
|
10361
10342
|
this.volume = t.volume ?? e.volume, this.playbackRate = t.playbackRate ?? e.playbackRate, this.preservePitch = t.preservePitch ?? e.preservePitch, this.skipBackwardInterval = t.skipBackwardInterval ?? e.skipBackwardInterval, this.skipForwardInterval = t.skipForwardInterval ?? e.skipForwardInterval, this.pollInterval = t.pollInterval ?? e.pollInterval, this.autoPlay = t.autoPlay ?? e.autoPlay, this.enableMediaSession = t.enableMediaSession ?? e.enableMediaSession;
|
|
10362
10343
|
}
|
|
10363
10344
|
}
|
|
10364
|
-
class
|
|
10345
|
+
class Fi {
|
|
10365
10346
|
constructor(t, e) {
|
|
10366
10347
|
this.preferences = t, this.settings = e;
|
|
10367
10348
|
}
|
|
@@ -10460,99 +10441,170 @@ class Mi {
|
|
|
10460
10441
|
});
|
|
10461
10442
|
}
|
|
10462
10443
|
}
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10444
|
+
const Ui = 1, Ii = 1;
|
|
10445
|
+
class xs {
|
|
10446
|
+
constructor(t, e, i = {}) {
|
|
10447
|
+
this.pool = /* @__PURE__ */ new Map(), this._audioEngine = t, this._publication = e, this._supportedAudioTypes = this.detectSupportedAudioTypes(), i.disableRemotePlayback && (this._audioEngine.getMediaElement().disableRemotePlayback = !0);
|
|
10448
|
+
}
|
|
10449
|
+
detectSupportedAudioTypes() {
|
|
10450
|
+
const t = document.createElement("audio"), e = /* @__PURE__ */ new Set();
|
|
10451
|
+
for (const n of this._publication.readingOrder.items) {
|
|
10452
|
+
n.type && e.add(n.type);
|
|
10453
|
+
for (const r of n.alternates?.items ?? [])
|
|
10454
|
+
r.type && e.add(r.type);
|
|
10455
|
+
}
|
|
10456
|
+
const i = /* @__PURE__ */ new Map();
|
|
10457
|
+
for (const n of e) {
|
|
10458
|
+
const r = t.canPlayType(n);
|
|
10459
|
+
r !== "" && i.set(n, r);
|
|
10460
|
+
}
|
|
10461
|
+
return i;
|
|
10462
|
+
}
|
|
10463
|
+
pickPlayableHref(t) {
|
|
10464
|
+
const e = [t, ...t.alternates?.items ?? []];
|
|
10465
|
+
let i;
|
|
10466
|
+
for (const n of e) {
|
|
10467
|
+
if (!n.type) continue;
|
|
10468
|
+
const r = this._supportedAudioTypes.get(n.type);
|
|
10469
|
+
if (r) {
|
|
10470
|
+
if (r === "probably") return n.href;
|
|
10471
|
+
i || (i = { href: n.href, confidence: r });
|
|
10472
|
+
}
|
|
10473
|
+
}
|
|
10474
|
+
return i?.href ?? t.href;
|
|
10466
10475
|
}
|
|
10467
10476
|
get audioEngine() {
|
|
10468
10477
|
return this._audioEngine;
|
|
10469
10478
|
}
|
|
10470
10479
|
/**
|
|
10471
|
-
*
|
|
10472
|
-
*
|
|
10473
|
-
* @param href The URL of the audio resource.
|
|
10474
|
-
* @param publication The publication containing the reading order.
|
|
10475
|
-
* @param currentIndex The current track index.
|
|
10476
|
-
* @param direction The navigation direction ('forward' or 'backward').
|
|
10477
|
-
*/
|
|
10478
|
-
setCurrentAudio(t, e, i, n) {
|
|
10479
|
-
const r = this.audioEngine.isWebAudioActive ? void 0 : this.get(t);
|
|
10480
|
-
r ? (this.audioEngine.setMediaElement(r), this.clear(t)) : (this.clear(t), this.audioEngine.loadAudio(t)), this.preloadAdjacent(e, i, n);
|
|
10481
|
-
}
|
|
10482
|
-
preload(t) {
|
|
10483
|
-
if (this.preloadedElements.has(t))
|
|
10484
|
-
return;
|
|
10485
|
-
const e = document.createElement("audio");
|
|
10486
|
-
e.preload = "auto", e.src = t, e.load(), this.preloadedElements.set(t, e);
|
|
10487
|
-
}
|
|
10488
|
-
/**
|
|
10489
|
-
* Retrieves a preloaded audio element by URL.
|
|
10490
|
-
* @param href The URL of the audio resource.
|
|
10491
|
-
* @returns The preloaded HTMLAudioElement, or undefined if not preloaded.
|
|
10492
|
-
*/
|
|
10493
|
-
get(t) {
|
|
10494
|
-
return this.preloadedElements.get(t);
|
|
10495
|
-
}
|
|
10496
|
-
/**
|
|
10497
|
-
* Removes a preloaded element from the pool.
|
|
10498
|
-
* @param href The URL of the audio resource.
|
|
10480
|
+
* Ensures an audio element exists in the pool for the given href.
|
|
10481
|
+
* If one already exists, it is left untouched (preserving its buffered data).
|
|
10499
10482
|
*/
|
|
10500
|
-
|
|
10501
|
-
this.
|
|
10483
|
+
ensure(t) {
|
|
10484
|
+
let e = this.pool.get(t);
|
|
10485
|
+
return e || (e = document.createElement("audio"), e.preload = "auto", this._audioEngine.isWebAudioActive && (e.crossOrigin = "anonymous"), e.src = t, e.load(), this.pool.set(t, e)), e;
|
|
10502
10486
|
}
|
|
10503
10487
|
/**
|
|
10504
|
-
*
|
|
10505
|
-
*
|
|
10506
|
-
*
|
|
10488
|
+
* Updates the pool around the given index: ensures elements exist within
|
|
10489
|
+
* the LOWER_BOUNDARY and disposes those beyond the UPPER_BOUNDARY.
|
|
10490
|
+
* The current track is excluded — the primary engine element represents it.
|
|
10507
10491
|
*/
|
|
10508
|
-
|
|
10509
|
-
const i =
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10492
|
+
update(t) {
|
|
10493
|
+
const e = this._publication.readingOrder.items, i = /* @__PURE__ */ new Set();
|
|
10494
|
+
for (let n = 0; n < e.length; n++) {
|
|
10495
|
+
if (n === t) continue;
|
|
10496
|
+
const r = this.pickPlayableHref(e[n]);
|
|
10497
|
+
n >= t - Ii && n <= t + Ii ? (this.ensure(r), i.add(r)) : n >= t - Ui && n <= t + Ui && this.pool.has(r) && i.add(r);
|
|
10513
10498
|
}
|
|
10499
|
+
for (const [n, r] of this.pool)
|
|
10500
|
+
i.has(n) || (r.removeAttribute("src"), r.load(), this.pool.delete(n));
|
|
10514
10501
|
}
|
|
10515
10502
|
/**
|
|
10516
|
-
*
|
|
10517
|
-
*
|
|
10518
|
-
*
|
|
10503
|
+
* Sets the current audio for playback at the given track index by changing
|
|
10504
|
+
* the src on the persistent primary element. This preserves the RemotePlayback
|
|
10505
|
+
* session and any Web Audio graph connections across track changes.
|
|
10519
10506
|
*/
|
|
10520
|
-
|
|
10521
|
-
const i =
|
|
10522
|
-
if (i
|
|
10523
|
-
const n =
|
|
10524
|
-
n.
|
|
10507
|
+
setCurrentAudio(t, e) {
|
|
10508
|
+
const i = this.pickPlayableHref(this._publication.readingOrder.items[t]);
|
|
10509
|
+
if (this.audioEngine.changeSrc(i), this.pool.has(i)) {
|
|
10510
|
+
const n = this.pool.get(i);
|
|
10511
|
+
n.removeAttribute("src"), n.load(), this.pool.delete(i);
|
|
10525
10512
|
}
|
|
10513
|
+
this.update(t);
|
|
10526
10514
|
}
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10515
|
+
destroy() {
|
|
10516
|
+
this.audioEngine.stop();
|
|
10517
|
+
for (const [, t] of this.pool)
|
|
10518
|
+
t.removeAttribute("src"), t.load();
|
|
10519
|
+
this.pool.clear();
|
|
10520
|
+
}
|
|
10521
|
+
}
|
|
10522
|
+
class Rs {
|
|
10523
|
+
constructor(t = {}) {
|
|
10524
|
+
this.dragstartHandler = (e) => {
|
|
10525
|
+
e.preventDefault(), e.stopPropagation(), t.onDragDetected?.(Array.from(e.dataTransfer?.types ?? []));
|
|
10526
|
+
}, this.dropHandler = (e) => {
|
|
10527
|
+
e.preventDefault(), e.stopPropagation();
|
|
10528
|
+
const i = Array.from(e.dataTransfer?.types ?? []), n = e.dataTransfer?.files.length ?? 0;
|
|
10529
|
+
t.onDropDetected?.(i, n);
|
|
10530
|
+
}, document.addEventListener("dragstart", this.dragstartHandler, !0), document.addEventListener("drop", this.dropHandler, !0), window.addEventListener("unload", () => this.destroy());
|
|
10531
|
+
}
|
|
10532
|
+
destroy() {
|
|
10533
|
+
document.removeEventListener("dragstart", this.dragstartHandler, !0), document.removeEventListener("drop", this.dropHandler, !0);
|
|
10534
|
+
}
|
|
10535
|
+
}
|
|
10536
|
+
class Ls {
|
|
10537
|
+
constructor(t = {}) {
|
|
10538
|
+
this.copyHandler = (e) => {
|
|
10539
|
+
e.preventDefault(), e.stopPropagation(), t.onCopyBlocked?.();
|
|
10540
|
+
}, document.addEventListener("copy", this.copyHandler, !0), window.addEventListener("unload", () => this.destroy());
|
|
10535
10541
|
}
|
|
10536
|
-
/**
|
|
10537
|
-
* Destroys the pool by stopping the engine and clearing all preloaded elements.
|
|
10538
|
-
*/
|
|
10539
10542
|
destroy() {
|
|
10540
|
-
|
|
10543
|
+
document.removeEventListener("copy", this.copyHandler, !0);
|
|
10541
10544
|
}
|
|
10542
10545
|
}
|
|
10543
|
-
class
|
|
10546
|
+
class ks extends We {
|
|
10547
|
+
constructor(t = {}) {
|
|
10548
|
+
super(t), t.disableDragAndDrop && (this.dragAndDropProtector = new Rs({
|
|
10549
|
+
onDragDetected: (e) => {
|
|
10550
|
+
this.dispatchSuspiciousActivity("drag_detected", { dataTransferTypes: e, targetFrameSrc: "" });
|
|
10551
|
+
},
|
|
10552
|
+
onDropDetected: (e, i) => {
|
|
10553
|
+
this.dispatchSuspiciousActivity("drop_detected", { dataTransferTypes: e, fileCount: i, targetFrameSrc: "" });
|
|
10554
|
+
}
|
|
10555
|
+
})), t.protectCopy && (this.copyProtector = new Ls({
|
|
10556
|
+
onCopyBlocked: () => {
|
|
10557
|
+
this.dispatchSuspiciousActivity("bulk_copy", { targetFrameSrc: "" });
|
|
10558
|
+
}
|
|
10559
|
+
}));
|
|
10560
|
+
}
|
|
10561
|
+
destroy() {
|
|
10562
|
+
super.destroy(), this.dragAndDropProtector?.destroy(), this.copyProtector?.destroy();
|
|
10563
|
+
}
|
|
10564
|
+
}
|
|
10565
|
+
const Os = (s) => ({
|
|
10566
|
+
trackLoaded: s.trackLoaded ?? (() => {
|
|
10567
|
+
}),
|
|
10568
|
+
positionChanged: s.positionChanged ?? (() => {
|
|
10569
|
+
}),
|
|
10570
|
+
timelineItemChanged: s.timelineItemChanged ?? (() => {
|
|
10571
|
+
}),
|
|
10572
|
+
error: s.error ?? (() => {
|
|
10573
|
+
}),
|
|
10574
|
+
trackEnded: s.trackEnded ?? (() => {
|
|
10575
|
+
}),
|
|
10576
|
+
play: s.play ?? (() => {
|
|
10577
|
+
}),
|
|
10578
|
+
pause: s.pause ?? (() => {
|
|
10579
|
+
}),
|
|
10580
|
+
metadataLoaded: s.metadataLoaded ?? (() => {
|
|
10581
|
+
}),
|
|
10582
|
+
stalled: s.stalled ?? (() => {
|
|
10583
|
+
}),
|
|
10584
|
+
seeking: s.seeking ?? (() => {
|
|
10585
|
+
}),
|
|
10586
|
+
seekable: s.seekable ?? (() => {
|
|
10587
|
+
}),
|
|
10588
|
+
contentProtection: s.contentProtection ?? (() => {
|
|
10589
|
+
}),
|
|
10590
|
+
peripheral: s.peripheral ?? (() => {
|
|
10591
|
+
}),
|
|
10592
|
+
contextMenu: s.contextMenu ?? (() => {
|
|
10593
|
+
})
|
|
10594
|
+
});
|
|
10595
|
+
class As extends dr {
|
|
10544
10596
|
constructor(t, e, i, n = {
|
|
10545
10597
|
preferences: {},
|
|
10546
10598
|
defaults: {}
|
|
10547
10599
|
}) {
|
|
10548
|
-
if (super(), this.positionPollInterval = null, this.navigationId = 0, this._preferencesEditor = null, this.pub = t, this._preferences = new oe(n.preferences), this._defaults = new
|
|
10600
|
+
if (super(), this.positionPollInterval = null, this.navigationId = 0, this._playIntent = !1, this._preferencesEditor = null, this._mediaSessionEnabled = !1, this._navigatorProtector = null, this._keyboardPeripheralsManager = null, this._suspiciousActivityListener = null, this._keyboardPeripheralListener = null, this._isNavigating = !1, this.pub = t, this.listeners = Os(e), this._preferences = new oe(n.preferences), this._defaults = new Cs(n.defaults), this._settings = new Ni(this._preferences, this._defaults), i)
|
|
10549
10601
|
this.currentLocation = this.ensureLocatorLocations(i);
|
|
10550
10602
|
else {
|
|
10551
|
-
const
|
|
10603
|
+
const u = this.pub.readingOrder.items[0];
|
|
10552
10604
|
this.currentLocation = new N({
|
|
10553
|
-
href:
|
|
10554
|
-
type:
|
|
10555
|
-
title:
|
|
10605
|
+
href: u.href,
|
|
10606
|
+
type: u.type || "audio/mpeg",
|
|
10607
|
+
title: u.title,
|
|
10556
10608
|
locations: new E({
|
|
10557
10609
|
position: 0,
|
|
10558
10610
|
progression: 0,
|
|
@@ -10561,38 +10613,56 @@ class xs extends hr {
|
|
|
10561
10613
|
})
|
|
10562
10614
|
});
|
|
10563
10615
|
}
|
|
10564
|
-
const r = this.currentLocation.href.split("#")[0], o = this.hrefToTrackIndex(r), a = this.currentLocation.locations?.time() || 0, l = new
|
|
10616
|
+
const r = this.currentLocation.href.split("#")[0], o = this.hrefToTrackIndex(r), a = this.currentLocation.locations?.time() || 0, l = new Es({
|
|
10565
10617
|
playback: {
|
|
10566
10618
|
state: {
|
|
10567
10619
|
currentTime: a,
|
|
10568
|
-
duration: 0
|
|
10569
|
-
volume: this._settings.volume
|
|
10620
|
+
duration: 0
|
|
10570
10621
|
},
|
|
10571
10622
|
playWhenReady: !1,
|
|
10572
10623
|
index: o
|
|
10573
10624
|
}
|
|
10574
10625
|
});
|
|
10575
|
-
this.pool = new
|
|
10576
|
-
|
|
10626
|
+
this.pool = new xs(l, t, n.contentProtection);
|
|
10627
|
+
const h = n.contentProtection || {};
|
|
10628
|
+
this._contentProtection = h;
|
|
10629
|
+
const c = this.mergeKeyboardPeripherals(
|
|
10630
|
+
h,
|
|
10631
|
+
n.keyboardPeripherals || []
|
|
10632
|
+
);
|
|
10633
|
+
(h.disableContextMenu || h.checkAutomation || h.checkIFrameEmbedding || h.monitorDevTools || h.protectPrinting?.disable || h.disableDragAndDrop || h.protectCopy) && (this._navigatorProtector = new ks(h), this._suspiciousActivityListener = (u) => {
|
|
10634
|
+
const { type: m, ...y } = u.detail;
|
|
10635
|
+
m === "context_menu" ? this.listeners.contextMenu(y) : this.listeners.contentProtection(m, y);
|
|
10636
|
+
}, window.addEventListener(st, this._suspiciousActivityListener)), c.length > 0 && (this._keyboardPeripheralsManager = new He({ keyboardPeripherals: c }), this._keyboardPeripheralListener = (u) => {
|
|
10637
|
+
this.listeners.peripheral(u.detail);
|
|
10638
|
+
}, window.addEventListener(ot, this._keyboardPeripheralListener)), this.setupEventListeners(), this.applyPreferences(), this._isNavigating = !0, this.pool.setCurrentAudio(o, "forward"), this.waitForLoadedAndSeeked(a).then(() => {
|
|
10639
|
+
this._isNavigating = !1, this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator), this._setupRemotePlayback();
|
|
10577
10640
|
}).catch(() => {
|
|
10641
|
+
this._isNavigating = !1;
|
|
10578
10642
|
});
|
|
10579
10643
|
}
|
|
10580
10644
|
get settings() {
|
|
10581
10645
|
return this._settings;
|
|
10582
10646
|
}
|
|
10583
10647
|
get preferencesEditor() {
|
|
10584
|
-
return this._preferencesEditor === null && (this._preferencesEditor = new
|
|
10648
|
+
return this._preferencesEditor === null && (this._preferencesEditor = new Fi(this._preferences, this.settings)), this._preferencesEditor;
|
|
10585
10649
|
}
|
|
10586
10650
|
async submitPreferences(t) {
|
|
10587
10651
|
this._preferences = this._preferences.merging(t), this.applyPreferences();
|
|
10588
10652
|
}
|
|
10589
10653
|
applyPreferences() {
|
|
10590
|
-
|
|
10591
|
-
this._settings = new zi(this._preferences, this._defaults), this._preferencesEditor !== null && (this._preferencesEditor = new Mi(this._preferences, this.settings)), this.pool.audioEngine.setVolume(this._settings.volume), this.pool.audioEngine.setPlaybackRate(this._settings.playbackRate, this._settings.preservePitch), this._settings.enableMediaSession && !t.enableMediaSession ? this.setupMediaSession() : !this._settings.enableMediaSession && t.enableMediaSession && this.destroyMediaSession();
|
|
10654
|
+
this._settings = new Ni(this._preferences, this._defaults), this._preferencesEditor !== null && (this._preferencesEditor = new Fi(this._preferences, this.settings)), this.pool.audioEngine.setVolume(this._settings.volume), this.pool.audioEngine.setPlaybackRate(this._settings.playbackRate, this._settings.preservePitch), this._settings.enableMediaSession && !this._mediaSessionEnabled ? (this._mediaSessionEnabled = !0, this.setupMediaSession()) : !this._settings.enableMediaSession && this._mediaSessionEnabled && (this._mediaSessionEnabled = !1, this.destroyMediaSession());
|
|
10592
10655
|
}
|
|
10593
10656
|
get publication() {
|
|
10594
10657
|
return this.pub;
|
|
10595
10658
|
}
|
|
10659
|
+
get timeline() {
|
|
10660
|
+
return this.pub.timeline;
|
|
10661
|
+
}
|
|
10662
|
+
_notifyTimelineChange(t) {
|
|
10663
|
+
const e = this.pub.timeline.locate(t);
|
|
10664
|
+
e !== this._currentTimelineItem && (this._currentTimelineItem = e, this.listeners.timelineItemChanged(e));
|
|
10665
|
+
}
|
|
10596
10666
|
ensureLocatorLocations(t) {
|
|
10597
10667
|
return new N({
|
|
10598
10668
|
...t,
|
|
@@ -10679,24 +10749,40 @@ class xs extends hr {
|
|
|
10679
10749
|
position: this.currentTrackIndex(),
|
|
10680
10750
|
progression: 1,
|
|
10681
10751
|
fragments: [`t=${this.duration}`]
|
|
10682
|
-
})), this.listeners.trackEnded(this.currentLocator), await this.nextTrack(), this._settings.autoPlay && this.play();
|
|
10752
|
+
})), this.listeners.trackEnded(this.currentLocator), this.canGoForward && (await this.nextTrack(), this._settings.autoPlay && this.play());
|
|
10683
10753
|
}), this.pool.audioEngine.on("play", () => {
|
|
10684
|
-
this.startPositionPolling(), this.listeners.play(this.currentLocator);
|
|
10754
|
+
this._isNavigating || (this.startPositionPolling(), this.listeners.play(this.currentLocator));
|
|
10685
10755
|
}), this.pool.audioEngine.on("playing", () => {
|
|
10686
|
-
this.listeners.stalled(!1);
|
|
10756
|
+
this._isNavigating || this.listeners.stalled(!1);
|
|
10687
10757
|
}), this.pool.audioEngine.on("pause", () => {
|
|
10688
|
-
this.stopPositionPolling(), this.listeners.pause(this.currentLocator);
|
|
10758
|
+
this._isNavigating || (this.stopPositionPolling(), this.listeners.pause(this.currentLocator));
|
|
10689
10759
|
}), this.pool.audioEngine.on("seeked", () => {
|
|
10690
|
-
if (this.listeners.seeking(!1), !this.isPlaying) {
|
|
10760
|
+
if (!this._isNavigating && (this.listeners.seeking(!1), !this.isPlaying)) {
|
|
10691
10761
|
const t = this.currentTime, e = this.duration, i = e > 0 ? t / e : 0;
|
|
10692
10762
|
this.currentLocation = this.currentLocation.copyWithLocations(new E({
|
|
10693
10763
|
position: this.currentTrackIndex(),
|
|
10694
10764
|
progression: i,
|
|
10695
10765
|
fragments: [`t=${t}`]
|
|
10696
|
-
})), this.listeners.positionChanged(this.currentLocation);
|
|
10766
|
+
})), this._notifyTimelineChange(this.currentLocation), this.listeners.positionChanged(this.currentLocation);
|
|
10697
10767
|
}
|
|
10698
|
-
}), this.pool.audioEngine.on("seeking", () =>
|
|
10699
|
-
this.
|
|
10768
|
+
}), this.pool.audioEngine.on("seeking", () => {
|
|
10769
|
+
this._isNavigating || this.listeners.seeking(!0);
|
|
10770
|
+
}), this.pool.audioEngine.on("waiting", () => {
|
|
10771
|
+
this._isNavigating || this.listeners.seeking(!0);
|
|
10772
|
+
}), this.pool.audioEngine.on("stalled", () => {
|
|
10773
|
+
this._isNavigating || this.listeners.stalled(!0);
|
|
10774
|
+
}), this.pool.audioEngine.on("canplaythrough", () => {
|
|
10775
|
+
this._isNavigating || this.listeners.stalled(!1);
|
|
10776
|
+
}), this.pool.audioEngine.on("progress", (t) => {
|
|
10777
|
+
this._isNavigating || this.listeners.seekable(t);
|
|
10778
|
+
}), this.pool.audioEngine.on("loadedmetadata", () => {
|
|
10779
|
+
const t = this.pool.audioEngine.getMediaElement(), e = {
|
|
10780
|
+
duration: this.pool.audioEngine.duration(),
|
|
10781
|
+
textTracks: t.textTracks,
|
|
10782
|
+
readyState: t.readyState,
|
|
10783
|
+
networkState: t.networkState
|
|
10784
|
+
};
|
|
10785
|
+
this.listeners.metadataLoaded(e);
|
|
10700
10786
|
});
|
|
10701
10787
|
}
|
|
10702
10788
|
setupMediaSession() {
|
|
@@ -10706,11 +10792,12 @@ class xs extends hr {
|
|
|
10706
10792
|
}
|
|
10707
10793
|
updateMediaSessionMetadata() {
|
|
10708
10794
|
if (!("mediaSession" in navigator)) return;
|
|
10709
|
-
const t = this.currentTrackIndex(), e = this.pub.readingOrder.items[t];
|
|
10795
|
+
const t = this.currentTrackIndex(), e = this.pub.readingOrder.items[t], i = this.pub.getCover();
|
|
10710
10796
|
navigator.mediaSession.metadata = new MediaMetadata({
|
|
10711
10797
|
title: e?.title || `Track ${t + 1}`,
|
|
10712
|
-
artist: this.pub.metadata.authors ? this.pub.metadata.authors.items.map((
|
|
10713
|
-
album: this.pub.metadata.title.getTranslation()
|
|
10798
|
+
artist: this.pub.metadata.authors ? this.pub.metadata.authors.items.map((n) => n.name.getTranslation()).join(", ") : void 0,
|
|
10799
|
+
album: this.pub.metadata.title.getTranslation(),
|
|
10800
|
+
artwork: i ? [{ src: i.href, type: i.type }] : void 0
|
|
10714
10801
|
});
|
|
10715
10802
|
}
|
|
10716
10803
|
startPositionPolling() {
|
|
@@ -10720,7 +10807,7 @@ class xs extends hr {
|
|
|
10720
10807
|
position: this.currentTrackIndex(),
|
|
10721
10808
|
progression: i,
|
|
10722
10809
|
fragments: [`t=${t}`]
|
|
10723
|
-
})), this.listeners.positionChanged(this.currentLocation);
|
|
10810
|
+
})), this._notifyTimelineChange(this.currentLocation), this.listeners.positionChanged(this.currentLocation);
|
|
10724
10811
|
}, this._settings.pollInterval);
|
|
10725
10812
|
}
|
|
10726
10813
|
stopPositionPolling() {
|
|
@@ -10734,11 +10821,16 @@ class xs extends hr {
|
|
|
10734
10821
|
i(!1);
|
|
10735
10822
|
return;
|
|
10736
10823
|
}
|
|
10737
|
-
const a = ++this.navigationId, l = r >= this.currentTrackIndex() ? "forward" : "backward", h = this.isPlaying;
|
|
10738
|
-
if (this.stopPositionPolling(), this.pool.setCurrentAudio(
|
|
10739
|
-
|
|
10824
|
+
const a = ++this.navigationId, l = r >= this.currentTrackIndex() ? "forward" : "backward", h = this.isPlaying || this._playIntent;
|
|
10825
|
+
if (this._playIntent = h, this._isNavigating = !0, this.stopPositionPolling(), this.pool.setCurrentAudio(r, l), this.currentLocation = t.copyWithLocations(t.locations), await this.waitForLoadedAndSeeked(o, a), this._isNavigating = !1, a !== this.navigationId) {
|
|
10826
|
+
i(!1);
|
|
10827
|
+
return;
|
|
10828
|
+
}
|
|
10829
|
+
this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator), this._settings.enableMediaSession && this.updateMediaSessionMetadata(), h && this.play(), i(!0);
|
|
10740
10830
|
} catch (n) {
|
|
10741
|
-
console.error("Failed to go to locator:", n), i(!1);
|
|
10831
|
+
this._isNavigating = !1, console.error("Failed to go to locator:", n), i(!1);
|
|
10832
|
+
} finally {
|
|
10833
|
+
this._playIntent = !1;
|
|
10742
10834
|
}
|
|
10743
10835
|
}
|
|
10744
10836
|
async goLink(t, e, i) {
|
|
@@ -10747,8 +10839,8 @@ class xs extends hr {
|
|
|
10747
10839
|
i(!1);
|
|
10748
10840
|
return;
|
|
10749
10841
|
}
|
|
10750
|
-
const r = this.createLocator(n,
|
|
10751
|
-
await this.go(
|
|
10842
|
+
const r = t.locator.locations?.time() ?? 0, o = this.createLocator(n, r);
|
|
10843
|
+
await this.go(o, e, i);
|
|
10752
10844
|
}
|
|
10753
10845
|
async goForward(t, e) {
|
|
10754
10846
|
if (!this.canGoForward) {
|
|
@@ -10814,80 +10906,96 @@ class xs extends hr {
|
|
|
10814
10906
|
get canGoForward() {
|
|
10815
10907
|
return this.currentTrackIndex() < this.pub.readingOrder.items.length - 1;
|
|
10816
10908
|
}
|
|
10909
|
+
/**
|
|
10910
|
+
* The RemotePlayback object for the primary media element.
|
|
10911
|
+
* Because the element is never swapped, this reference is stable for the
|
|
10912
|
+
* lifetime of the navigator — host apps can store it and call `.prompt()`,
|
|
10913
|
+
* `.watchAvailability()`, etc. directly.
|
|
10914
|
+
*/
|
|
10915
|
+
get remotePlayback() {
|
|
10916
|
+
return this.pool.audioEngine.getMediaElement().remote;
|
|
10917
|
+
}
|
|
10918
|
+
/** Wires up the optional remotePlaybackStateChanged listener. Called once after initial load. */
|
|
10919
|
+
_setupRemotePlayback() {
|
|
10920
|
+
if (this._contentProtection.disableRemotePlayback)
|
|
10921
|
+
return;
|
|
10922
|
+
const t = this.remotePlayback;
|
|
10923
|
+
t && (t.onconnecting = () => this.listeners.remotePlaybackStateChanged?.("connecting"), t.onconnect = () => this.listeners.remotePlaybackStateChanged?.("connected"), t.ondisconnect = () => this.listeners.remotePlaybackStateChanged?.("disconnected"));
|
|
10924
|
+
}
|
|
10817
10925
|
destroyMediaSession() {
|
|
10818
10926
|
"mediaSession" in navigator && (navigator.mediaSession.metadata = null, navigator.mediaSession.setActionHandler("play", null), navigator.mediaSession.setActionHandler("pause", null), navigator.mediaSession.setActionHandler("previoustrack", null), navigator.mediaSession.setActionHandler("nexttrack", null), navigator.mediaSession.setActionHandler("seekbackward", null), navigator.mediaSession.setActionHandler("seekforward", null));
|
|
10819
10927
|
}
|
|
10820
10928
|
destroy() {
|
|
10821
|
-
this.stopPositionPolling(), this.destroyMediaSession(), this.pool.destroy();
|
|
10929
|
+
this.stopPositionPolling(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(st, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(ot, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
|
|
10822
10930
|
}
|
|
10823
10931
|
}
|
|
10824
10932
|
export {
|
|
10825
|
-
|
|
10826
|
-
|
|
10933
|
+
Cs as AudioDefaults,
|
|
10934
|
+
As as AudioNavigator,
|
|
10827
10935
|
oe as AudioPreferences,
|
|
10828
|
-
|
|
10829
|
-
|
|
10936
|
+
Fi as AudioPreferencesEditor,
|
|
10937
|
+
Ni as AudioSettings,
|
|
10830
10938
|
O as BooleanPreference,
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10939
|
+
cn as EnumPreference,
|
|
10940
|
+
ls as EpubDefaults,
|
|
10941
|
+
Sn as EpubNavigator,
|
|
10834
10942
|
Ot as EpubPreferences,
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
|
|
10849
|
-
|
|
10850
|
-
|
|
10943
|
+
zi as EpubPreferencesEditor,
|
|
10944
|
+
Mi as EpubSettings,
|
|
10945
|
+
Ts as ExperimentalWebPubNavigator,
|
|
10946
|
+
Jr as FXLCoordinator,
|
|
10947
|
+
qr as FXLFrameManager,
|
|
10948
|
+
as as FXLFramePoolManager,
|
|
10949
|
+
ts as FXLPeripherals,
|
|
10950
|
+
es as FXLSpreader,
|
|
10951
|
+
Lt as FrameComms,
|
|
10952
|
+
Xr as FrameManager,
|
|
10953
|
+
Yr as FramePoolManager,
|
|
10954
|
+
Kr as HorizontalThird,
|
|
10955
|
+
pn as Injector,
|
|
10956
|
+
_t as LineLengths,
|
|
10957
|
+
dr as MediaNavigator,
|
|
10958
|
+
nn as Navigator,
|
|
10851
10959
|
Re as Orientation,
|
|
10852
10960
|
A as Preference,
|
|
10853
10961
|
re as Properties,
|
|
10854
|
-
|
|
10962
|
+
gs as RSProperties,
|
|
10855
10963
|
R as RangePreference,
|
|
10856
|
-
|
|
10964
|
+
fs as ReadiumCSS,
|
|
10857
10965
|
Le as Spread,
|
|
10858
10966
|
J as TextAlignment,
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10967
|
+
yn as UserProperties,
|
|
10968
|
+
Zr as VerticalThird,
|
|
10969
|
+
rn as VisualNavigator,
|
|
10970
|
+
Es as WebAudioEngine,
|
|
10971
|
+
ur as WebPubBlobBuilder,
|
|
10972
|
+
Cr as WebPubCSS,
|
|
10973
|
+
Lr as WebPubDefaults,
|
|
10974
|
+
Sr as WebPubFrameManager,
|
|
10975
|
+
br as WebPubFramePoolManager,
|
|
10976
|
+
Gr as WebPubNavigator,
|
|
10977
|
+
kt as WebPubPreferences,
|
|
10978
|
+
Pi as WebPubPreferencesEditor,
|
|
10979
|
+
_i as WebPubSettings,
|
|
10980
|
+
Er as WebRSProperties,
|
|
10981
|
+
ln as WebUserProperties,
|
|
10874
10982
|
P as ensureBoolean,
|
|
10875
10983
|
se as ensureEnumValue,
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10984
|
+
hn as ensureExperiment,
|
|
10985
|
+
ft as ensureFilter,
|
|
10986
|
+
xr as ensureLessThanOrEqual,
|
|
10987
|
+
Rr as ensureMoreThanOrEqual,
|
|
10880
10988
|
w as ensureNonNegative,
|
|
10881
10989
|
I as ensureString,
|
|
10882
10990
|
M as ensureValueInRange,
|
|
10883
10991
|
Ie as experiments,
|
|
10884
|
-
|
|
10992
|
+
ht as filterRangeConfig,
|
|
10885
10993
|
Gt as fontSizeRangeConfig,
|
|
10886
10994
|
nt as fontWeightRangeConfig,
|
|
10887
10995
|
$t as fontWidthRangeConfig,
|
|
10888
10996
|
Xt as letterSpacingRangeConfig,
|
|
10889
10997
|
Yt as lineHeightRangeConfig,
|
|
10890
|
-
|
|
10998
|
+
ct as lineLengthRangeConfig,
|
|
10891
10999
|
qt as paragraphIndentRangeConfig,
|
|
10892
11000
|
Kt as paragraphSpacingRangeConfig,
|
|
10893
11001
|
te as playbackRateRangeConfig,
|