@readium/navigator 2.7.0-alpha.3 → 2.7.0-alpha.4
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 +471 -393
- package/dist/index.umd.cjs +19 -19
- package/package.json +1 -1
- package/src/audio/AudioNavigator.ts +106 -5
- package/src/audio/AudioPoolManager.ts +14 -8
- package/src/audio/engine/AudioEngine.ts +34 -1
- package/src/audio/engine/WebAudioEngine.ts +48 -3
- package/types/src/audio/AudioNavigator.d.ts +29 -0
- package/types/src/audio/engine/AudioEngine.d.ts +27 -1
- package/types/src/audio/engine/WebAudioEngine.d.ts +14 -2
package/dist/index.js
CHANGED
|
@@ -112,7 +112,7 @@ const b = class b {
|
|
|
112
112
|
};
|
|
113
113
|
b.NONE = new b("none"), b.ANNOTATIONS = new b("annotations"), b.ARIA = new b("ARIA"), b.INDEX = new b("index"), b.PAGE_BREAK_MARKERS = new b("pageBreakMarkers"), b.PAGE_NAVIGATION = new b("pageNavigation"), b.PRINT_PAGE_NUMBERS = new b("printPageNumbers"), b.READING_ORDER = new b("readingOrder"), b.STRUCTURAL_NAVIGATION = new b("structuralNavigation"), b.TABLE_OF_CONTENTS = new b("tableOfContents"), b.TAGGED_PDF = new b("taggedPDF"), b.ALTERNATIVE_TEXT = new b("alternativeText"), b.AUDIO_DESCRIPTION = new b("audioDescription"), b.CAPTIONS = new b("captions"), b.CLOSED_CAPTIONS = new b("closedCaptions"), b.DESCRIBED_MATH = new b("describedMath"), b.LONG_DESCRIPTION = new b("longDescription"), b.OPEN_CAPTIONS = new b("openCaptions"), b.SIGN_LANGUAGE = new b("signLanguage"), b.TRANSCRIPT = new b("transcript"), b.DISPLAY_TRANSFORMABILITY = new b("displayTransformability"), b.SYNCHRONIZED_AUDIO_TEXT = new b("synchronizedAudioText"), b.TIMING_CONTROL = new b("timingControl"), b.UNLOCKED = new b("unlocked"), b.CHEM_ML = new b("ChemML"), b.LATEX = new b("latex"), b.LATEX_CHEMISTRY = new b("latex-chemistry"), b.MATH_ML = new b("MathML"), b.MATH_ML_CHEMISTRY = new b("MathML-chemistry"), b.TTS_MARKUP = new b("ttsMarkup"), b.HIGH_CONTRAST_AUDIO = new b("highContrastAudio"), b.HIGH_CONTRAST_DISPLAY = new b("highContrastDisplay"), b.LARGE_PRINT = new b("largePrint"), b.BRAILLE = new b("braille"), b.TACTILE_GRAPHIC = new b("tactileGraphic"), b.TACTILE_OBJECT = new b("tactileObject"), b.FULL_RUBY_ANNOTATIONS = new b("fullRubyAnnotations"), b.HORIZONTAL_WRITING = new b("horizontalWriting"), b.RUBY_ANNOTATIONS = new b("rubyAnnotations"), b.VERTICAL_WRITING = new b("verticalWriting"), b.WITH_ADDITIONAL_WORD_SEGMENTATION = new b("withAdditionalWordSegmentation"), b.WITHOUT_ADDITIONAL_WORD_SEGMENTATION = new b("withoutAdditionalWordSegmentation");
|
|
114
114
|
let Zt = b;
|
|
115
|
-
const
|
|
115
|
+
const A = class A {
|
|
116
116
|
constructor(t) {
|
|
117
117
|
this.value = t;
|
|
118
118
|
}
|
|
@@ -121,7 +121,7 @@ const R = class R {
|
|
|
121
121
|
*/
|
|
122
122
|
static deserialize(t) {
|
|
123
123
|
if (!(!t || typeof t != "string"))
|
|
124
|
-
return new
|
|
124
|
+
return new A(t);
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Serializes a [Hazard] to its RWPM JSON representation.
|
|
@@ -130,9 +130,9 @@ const R = class R {
|
|
|
130
130
|
return this.value;
|
|
131
131
|
}
|
|
132
132
|
};
|
|
133
|
-
|
|
134
|
-
let gi =
|
|
135
|
-
const
|
|
133
|
+
A.FLASHING = new A("flashing"), A.NO_FLASHING_HAZARD = new A("noFlashingHazard"), A.UNKNOWN_FLASHING_HAZARD = new A("unknownFlashingHazard"), A.MOTION_SIMULATION = new A("motionSimulation"), A.NO_MOTION_SIMULATION_HAZARD = new A("noMotionSimulationHazard"), A.UNKNOWN_MOTION_SIMULATION_HAZARD = new A("unknownMotionSimulationHazard"), A.SOUND = new A("sound"), A.NO_SOUND_HAZARD = new A("noSoundHazard"), A.UNKNOWN_SOUND_HAZARD = new A("unknownSoundHazard"), A.UNKNOWN = new A("unknown"), A.NONE = new A("none");
|
|
134
|
+
let gi = A;
|
|
135
|
+
const R = class R {
|
|
136
136
|
constructor(t) {
|
|
137
137
|
this.value = t;
|
|
138
138
|
}
|
|
@@ -141,7 +141,7 @@ const A = class A {
|
|
|
141
141
|
*/
|
|
142
142
|
static deserialize(t) {
|
|
143
143
|
if (!(!t || typeof t != "string"))
|
|
144
|
-
return new
|
|
144
|
+
return new R(t);
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* Serializes an [Exemption] to its RWPM JSON representation.
|
|
@@ -150,8 +150,8 @@ const A = class A {
|
|
|
150
150
|
return this.value;
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
|
|
154
|
-
let yi =
|
|
153
|
+
R.NONE = new R("none"), R.DOCUMENTED = new R("documented"), R.LEGAL = new R("legal"), R.TEMPORARY = new R("temporary"), R.TECHNICAL = new R("technical"), R.EAA_DISPROPORTIONATE_BURDEN = new R("eaa-disproportionate-burden"), R.EAA_FUNDAMENTAL_ALTERATION = new R("eaa-fundamental-alteration"), R.EAA_MICROENTERPRISE = new R("eaa-microenterprise"), R.EAA_TECHNICAL_IMPOSSIBILITY = new R("eaa-technical-impossibility"), R.EAA_TEMPORARY = new R("eaa-temporary");
|
|
154
|
+
let yi = R;
|
|
155
155
|
const bi = ["en", "ar", "da", "fr", "it", "pt_PT", "sv"], un = /* @__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
156
|
publication: un
|
|
157
157
|
}, Si = {
|
|
@@ -273,7 +273,7 @@ class Ke {
|
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
275
|
var x = /* @__PURE__ */ ((o) => (o.left = "left", o.right = "right", o.center = "center", o))(x || {});
|
|
276
|
-
let Z = class
|
|
276
|
+
let Z = class Fe {
|
|
277
277
|
constructor(t) {
|
|
278
278
|
this.otherProperties = t;
|
|
279
279
|
}
|
|
@@ -285,7 +285,7 @@ let Z = class De {
|
|
|
285
285
|
*/
|
|
286
286
|
static deserialize(t) {
|
|
287
287
|
if (t)
|
|
288
|
-
return new
|
|
288
|
+
return new Fe(t);
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -300,7 +300,7 @@ let Z = class De {
|
|
|
300
300
|
const e = Object.assign({}, this.otherProperties);
|
|
301
301
|
for (const i in t)
|
|
302
302
|
e[i] = t[i];
|
|
303
|
-
return new
|
|
303
|
+
return new Fe(e);
|
|
304
304
|
}
|
|
305
305
|
};
|
|
306
306
|
Object.defineProperty(Z.prototype, "encryption", {
|
|
@@ -338,19 +338,19 @@ class g {
|
|
|
338
338
|
} else
|
|
339
339
|
throw new Error("Invalid media type");
|
|
340
340
|
const r = {};
|
|
341
|
-
for (let
|
|
342
|
-
const f = s[
|
|
341
|
+
for (let u = 1; u < s.length; u++) {
|
|
342
|
+
const f = s[u].split("=");
|
|
343
343
|
if (f.length === 2) {
|
|
344
|
-
const m = f[0].toLocaleLowerCase(),
|
|
345
|
-
r[m] =
|
|
344
|
+
const m = f[0].toLocaleLowerCase(), p = m === "charset" ? f[1].toUpperCase() : f[1];
|
|
345
|
+
r[m] = p;
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
348
|
const a = {}, l = Object.keys(r);
|
|
349
|
-
l.sort((
|
|
349
|
+
l.sort((u, f) => u.localeCompare(f)), l.forEach((u) => a[u] = r[u]);
|
|
350
350
|
let c = "";
|
|
351
|
-
for (const
|
|
352
|
-
const f = a[
|
|
353
|
-
c += `;${
|
|
351
|
+
for (const u in a) {
|
|
352
|
+
const f = a[u];
|
|
353
|
+
c += `;${u}=${f}`;
|
|
354
354
|
}
|
|
355
355
|
const h = `${e}/${i}${c}`, d = a.encoding;
|
|
356
356
|
this.string = h, this.type = e, this.subtype = i, this.parameters = a, this.encoding = d, this.name = t.name, this.fileExtension = t.fileExtension;
|
|
@@ -877,7 +877,7 @@ class et {
|
|
|
877
877
|
return this.after !== void 0 && (t.after = this.after), this.before !== void 0 && (t.before = this.before), this.highlight !== void 0 && (t.highlight = this.highlight), t;
|
|
878
878
|
}
|
|
879
879
|
}
|
|
880
|
-
class
|
|
880
|
+
class I {
|
|
881
881
|
/**
|
|
882
882
|
* Creates a [Locator].
|
|
883
883
|
*/
|
|
@@ -889,7 +889,7 @@ class F {
|
|
|
889
889
|
*/
|
|
890
890
|
static deserialize(t) {
|
|
891
891
|
if (t && t.href && t.type)
|
|
892
|
-
return new
|
|
892
|
+
return new I({
|
|
893
893
|
href: t.href,
|
|
894
894
|
type: t.type,
|
|
895
895
|
title: t.title,
|
|
@@ -908,7 +908,7 @@ class F {
|
|
|
908
908
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
909
909
|
*/
|
|
910
910
|
copyWithLocations(t) {
|
|
911
|
-
return new
|
|
911
|
+
return new I({
|
|
912
912
|
href: this.href,
|
|
913
913
|
type: this.type,
|
|
914
914
|
title: this.title,
|
|
@@ -991,7 +991,7 @@ class q {
|
|
|
991
991
|
*/
|
|
992
992
|
get locator() {
|
|
993
993
|
let t = this.href.split("#");
|
|
994
|
-
return new
|
|
994
|
+
return new I({
|
|
995
995
|
href: t.length > 0 && t[0] !== void 0 ? t[0] : this.href,
|
|
996
996
|
type: this.type ?? "",
|
|
997
997
|
title: this.title,
|
|
@@ -1239,7 +1239,7 @@ class Ze {
|
|
|
1239
1239
|
return { currency: this.currency, value: this.value };
|
|
1240
1240
|
}
|
|
1241
1241
|
}
|
|
1242
|
-
class
|
|
1242
|
+
class Dt {
|
|
1243
1243
|
/** Creates a [Acquisition]. */
|
|
1244
1244
|
constructor(t) {
|
|
1245
1245
|
this.type = t.type, this.children = t.children;
|
|
@@ -1249,14 +1249,14 @@ class Ft {
|
|
|
1249
1249
|
*/
|
|
1250
1250
|
static deserialize(t) {
|
|
1251
1251
|
if (t && t.type)
|
|
1252
|
-
return new
|
|
1252
|
+
return new Dt({
|
|
1253
1253
|
type: t.type,
|
|
1254
|
-
children:
|
|
1254
|
+
children: Dt.deserializeArray(t.children)
|
|
1255
1255
|
});
|
|
1256
1256
|
}
|
|
1257
1257
|
static deserializeArray(t) {
|
|
1258
1258
|
if (Array.isArray(t))
|
|
1259
|
-
return t.map((e) =>
|
|
1259
|
+
return t.map((e) => Dt.deserialize(e)).filter((e) => e !== void 0);
|
|
1260
1260
|
}
|
|
1261
1261
|
/**
|
|
1262
1262
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1345,7 +1345,7 @@ Z.prototype.getPrice = function() {
|
|
|
1345
1345
|
Z.prototype.getIndirectAcquisitions = function() {
|
|
1346
1346
|
const o = this.otherProperties.indirectAcquisition;
|
|
1347
1347
|
if (o && Array.isArray(o))
|
|
1348
|
-
return o.map((t) =>
|
|
1348
|
+
return o.map((t) => Dt.deserialize(t)).filter((t) => t !== void 0);
|
|
1349
1349
|
};
|
|
1350
1350
|
Z.prototype.getHolds = function() {
|
|
1351
1351
|
return Qe.deserialize(this.otherProperties.holds);
|
|
@@ -1392,7 +1392,7 @@ wn([
|
|
|
1392
1392
|
// Angular attributes
|
|
1393
1393
|
"ng-*"
|
|
1394
1394
|
]);
|
|
1395
|
-
const vn = Math.pow(2, 32), Ci = () => Math.round(Math.random() * vn).toString(36),
|
|
1395
|
+
const vn = Math.pow(2, 32), Ci = () => Math.round(Math.random() * vn).toString(36), De = () => `${Math.round(performance.now())}-${Ci()}-${Ci()}`, wt = 1;
|
|
1396
1396
|
class Pn {
|
|
1397
1397
|
constructor(t) {
|
|
1398
1398
|
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);
|
|
@@ -1467,7 +1467,7 @@ class Pn {
|
|
|
1467
1467
|
const n = {
|
|
1468
1468
|
_readium: wt,
|
|
1469
1469
|
_channel: this.channelId,
|
|
1470
|
-
id: i ??
|
|
1470
|
+
id: i ?? De(),
|
|
1471
1471
|
// scrict,
|
|
1472
1472
|
key: t,
|
|
1473
1473
|
data: e
|
|
@@ -1483,7 +1483,7 @@ class Pn {
|
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
1485
|
}
|
|
1486
|
-
class
|
|
1486
|
+
class Rt {
|
|
1487
1487
|
}
|
|
1488
1488
|
function _i(o) {
|
|
1489
1489
|
return o.split("").reverse().join("");
|
|
@@ -1506,8 +1506,8 @@ function xi(o, t, e, i) {
|
|
|
1506
1506
|
let s = o.P[e], n = o.M[e];
|
|
1507
1507
|
const r = i >>> 31, a = t[e] | r, l = a | n, c = (a & s) + s ^ s | a;
|
|
1508
1508
|
let h = n | ~(c | s), d = s & c;
|
|
1509
|
-
const
|
|
1510
|
-
return h <<= 1, d <<= 1, d |= r, h |= Le(i) - r, s = d | ~(l | h), n = h & l, o.P[e] = s, o.M[e] = n,
|
|
1509
|
+
const u = Le(h & o.lastRowMask[e]) - Le(d & o.lastRowMask[e]);
|
|
1510
|
+
return h <<= 1, d <<= 1, d |= r, h |= Le(i) - r, s = d | ~(l | h), n = h & l, o.P[e] = s, o.M[e] = n, u;
|
|
1511
1511
|
}
|
|
1512
1512
|
function ks(o, t, e) {
|
|
1513
1513
|
if (t.length === 0)
|
|
@@ -1520,39 +1520,39 @@ function ks(o, t, e) {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
r.lastRowMask.fill(1 << 31), r.lastRowMask[n] = 1 << (t.length - 1) % s;
|
|
1522
1522
|
const a = new Uint32Array(n + 1), l = /* @__PURE__ */ new Map(), c = [];
|
|
1523
|
-
for (let
|
|
1523
|
+
for (let u = 0; u < 256; u++)
|
|
1524
1524
|
c.push(a);
|
|
1525
|
-
for (let
|
|
1526
|
-
const f = t.charCodeAt(
|
|
1525
|
+
for (let u = 0; u < t.length; u += 1) {
|
|
1526
|
+
const f = t.charCodeAt(u);
|
|
1527
1527
|
if (l.has(f))
|
|
1528
1528
|
continue;
|
|
1529
1529
|
const m = new Uint32Array(n + 1);
|
|
1530
1530
|
l.set(f, m), f < c.length && (c[f] = m);
|
|
1531
|
-
for (let
|
|
1532
|
-
m[
|
|
1531
|
+
for (let p = 0; p <= n; p += 1) {
|
|
1532
|
+
m[p] = 0;
|
|
1533
1533
|
for (let y = 0; y < s; y += 1) {
|
|
1534
|
-
const w =
|
|
1534
|
+
const w = p * s + y;
|
|
1535
1535
|
if (w >= t.length)
|
|
1536
1536
|
continue;
|
|
1537
|
-
t.charCodeAt(w) === f && (m[
|
|
1537
|
+
t.charCodeAt(w) === f && (m[p] |= 1 << y);
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
1540
|
}
|
|
1541
1541
|
let h = Math.max(0, Math.ceil(e / s) - 1);
|
|
1542
1542
|
const d = new Uint32Array(n + 1);
|
|
1543
|
-
for (let
|
|
1544
|
-
d[
|
|
1543
|
+
for (let u = 0; u <= h; u += 1)
|
|
1544
|
+
d[u] = (u + 1) * s;
|
|
1545
1545
|
d[n] = t.length;
|
|
1546
|
-
for (let
|
|
1547
|
-
r.P[
|
|
1548
|
-
for (let
|
|
1549
|
-
const f = o.charCodeAt(
|
|
1546
|
+
for (let u = 0; u <= h; u += 1)
|
|
1547
|
+
r.P[u] = -1, r.M[u] = 0;
|
|
1548
|
+
for (let u = 0; u < o.length; u += 1) {
|
|
1549
|
+
const f = o.charCodeAt(u);
|
|
1550
1550
|
let m;
|
|
1551
1551
|
f < c.length ? m = c[f] : (m = l.get(f), typeof m > "u" && (m = a));
|
|
1552
|
-
let
|
|
1552
|
+
let p = 0;
|
|
1553
1553
|
for (let y = 0; y <= h; y += 1)
|
|
1554
|
-
|
|
1555
|
-
if (d[h] -
|
|
1554
|
+
p = xi(r, m, y, p), d[y] += p;
|
|
1555
|
+
if (d[h] - p <= e && h < n && (m[h + 1] & 1 || p < 0)) {
|
|
1556
1556
|
h += 1, r.P[h] = -1, r.M[h] = 0;
|
|
1557
1557
|
let y;
|
|
1558
1558
|
if (h === n) {
|
|
@@ -1560,13 +1560,13 @@ function ks(o, t, e) {
|
|
|
1560
1560
|
y = w === 0 ? s : w;
|
|
1561
1561
|
} else
|
|
1562
1562
|
y = s;
|
|
1563
|
-
d[h] = d[h - 1] + y -
|
|
1563
|
+
d[h] = d[h - 1] + y - p + xi(r, m, h, p);
|
|
1564
1564
|
} else
|
|
1565
1565
|
for (; h > 0 && d[h] >= e + s; )
|
|
1566
1566
|
h -= 1;
|
|
1567
1567
|
h === n && d[h] <= e && (d[h] < e && i.splice(0, i.length), i.push({
|
|
1568
1568
|
start: -1,
|
|
1569
|
-
end:
|
|
1569
|
+
end: u + 1,
|
|
1570
1570
|
errors: d[h]
|
|
1571
1571
|
}), e = d[h]);
|
|
1572
1572
|
}
|
|
@@ -1597,7 +1597,7 @@ function _n(o, t, e = {}) {
|
|
|
1597
1597
|
if (s.length === 0)
|
|
1598
1598
|
return null;
|
|
1599
1599
|
const n = (a) => {
|
|
1600
|
-
const
|
|
1600
|
+
const u = 1 - a.errors / t.length, f = e.prefix ? Li(
|
|
1601
1601
|
o.slice(
|
|
1602
1602
|
Math.max(0, a.start - e.prefix.length),
|
|
1603
1603
|
a.start
|
|
@@ -1607,8 +1607,8 @@ function _n(o, t, e = {}) {
|
|
|
1607
1607
|
o.slice(a.end, a.end + e.suffix.length),
|
|
1608
1608
|
e.suffix
|
|
1609
1609
|
) : 1;
|
|
1610
|
-
let
|
|
1611
|
-
return typeof e.hint == "number" && (
|
|
1610
|
+
let p = 1;
|
|
1611
|
+
return typeof e.hint == "number" && (p = 1 - Math.abs(a.start - e.hint) / o.length), (50 * u + 20 * f + 20 * m + 2 * p) / 92;
|
|
1612
1612
|
}, r = s.map((a) => ({
|
|
1613
1613
|
start: a.start,
|
|
1614
1614
|
end: a.end,
|
|
@@ -1706,7 +1706,7 @@ function Ti(o) {
|
|
|
1706
1706
|
e += Os(t), t = t.previousSibling;
|
|
1707
1707
|
return e;
|
|
1708
1708
|
}
|
|
1709
|
-
function
|
|
1709
|
+
function As(o, ...t) {
|
|
1710
1710
|
let e = t.shift();
|
|
1711
1711
|
const i = o.ownerDocument.createNodeIterator(
|
|
1712
1712
|
o,
|
|
@@ -1760,7 +1760,7 @@ class tt {
|
|
|
1760
1760
|
*/
|
|
1761
1761
|
resolve(t = {}) {
|
|
1762
1762
|
try {
|
|
1763
|
-
return
|
|
1763
|
+
return As(this.element, this.offset)[0];
|
|
1764
1764
|
} catch (e) {
|
|
1765
1765
|
if (this.offset === 0 && t.direction !== void 0) {
|
|
1766
1766
|
const i = document.createTreeWalker(
|
|
@@ -1845,7 +1845,7 @@ class lt {
|
|
|
1845
1845
|
*/
|
|
1846
1846
|
toRange() {
|
|
1847
1847
|
let t, e;
|
|
1848
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [t, e] =
|
|
1848
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [t, e] = As(
|
|
1849
1849
|
this.start.element,
|
|
1850
1850
|
this.start.offset,
|
|
1851
1851
|
this.end.offset
|
|
@@ -2007,7 +2007,7 @@ function kn(o, t, e = !1) {
|
|
|
2007
2007
|
top: h.top,
|
|
2008
2008
|
width: h.width
|
|
2009
2009
|
});
|
|
2010
|
-
const r =
|
|
2010
|
+
const r = Rs(
|
|
2011
2011
|
n,
|
|
2012
2012
|
s,
|
|
2013
2013
|
t,
|
|
@@ -2023,7 +2023,7 @@ function kn(o, t, e = !1) {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
return l;
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function Rs(o, t, e, i = !1) {
|
|
2027
2027
|
for (let s = 0; s < o.length; s++)
|
|
2028
2028
|
for (let n = s + 1; n < o.length; n++) {
|
|
2029
2029
|
const r = o[s], a = o[n];
|
|
@@ -2031,9 +2031,9 @@ function As(o, t, e, i = !1) {
|
|
|
2031
2031
|
continue;
|
|
2032
2032
|
const l = J(r.top, a.top, t) && J(r.bottom, a.bottom, t), c = J(r.left, a.left, t) && J(r.right, a.right, t);
|
|
2033
2033
|
if (l && !c && Ns(r, a, t)) {
|
|
2034
|
-
const
|
|
2035
|
-
return
|
|
2036
|
-
|
|
2034
|
+
const u = o.filter((m) => m !== r && m !== a), f = Tn(r, a);
|
|
2035
|
+
return u.push(f), Rs(
|
|
2036
|
+
u,
|
|
2037
2037
|
t,
|
|
2038
2038
|
e,
|
|
2039
2039
|
i
|
|
@@ -2061,14 +2061,14 @@ function On(o, t) {
|
|
|
2061
2061
|
continue;
|
|
2062
2062
|
}
|
|
2063
2063
|
for (const n of o)
|
|
2064
|
-
if (i !== n && e.has(n) &&
|
|
2064
|
+
if (i !== n && e.has(n) && An(n, i, t)) {
|
|
2065
2065
|
e.delete(i);
|
|
2066
2066
|
break;
|
|
2067
2067
|
}
|
|
2068
2068
|
}
|
|
2069
2069
|
return Array.from(e);
|
|
2070
2070
|
}
|
|
2071
|
-
function
|
|
2071
|
+
function An(o, t, e) {
|
|
2072
2072
|
return Et(o, t.left, t.top, e) && Et(o, t.right, t.top, e) && Et(o, t.left, t.bottom, e) && Et(o, t.right, t.bottom, e);
|
|
2073
2073
|
}
|
|
2074
2074
|
function Et(o, t, e, i) {
|
|
@@ -2094,7 +2094,7 @@ function Ms(o) {
|
|
|
2094
2094
|
return o;
|
|
2095
2095
|
}
|
|
2096
2096
|
function Oi(o, t) {
|
|
2097
|
-
const e =
|
|
2097
|
+
const e = Rn(t, o);
|
|
2098
2098
|
if (e.height === 0 || e.width === 0)
|
|
2099
2099
|
return [o];
|
|
2100
2100
|
const i = [];
|
|
@@ -2144,7 +2144,7 @@ function Oi(o, t) {
|
|
|
2144
2144
|
}
|
|
2145
2145
|
return i;
|
|
2146
2146
|
}
|
|
2147
|
-
function
|
|
2147
|
+
function Rn(o, t) {
|
|
2148
2148
|
const e = Math.max(o.left, t.left), i = Math.min(o.right, t.right), s = Math.max(o.top, t.top), n = Math.min(o.bottom, t.bottom);
|
|
2149
2149
|
return {
|
|
2150
2150
|
bottom: n,
|
|
@@ -2174,11 +2174,11 @@ const ke = () => typeof window.CSSTransformValue < "u", Mn = /* @__PURE__ */ new
|
|
|
2174
2174
|
"darkenFilter",
|
|
2175
2175
|
"invertFilter",
|
|
2176
2176
|
"invertGaiji"
|
|
2177
|
-
]),
|
|
2177
|
+
]), Ai = /--(?:USER|RS)__([\w-]+)/g;
|
|
2178
2178
|
function Nn(o, t) {
|
|
2179
2179
|
const e = o ?? "", i = t ?? "", s = /* @__PURE__ */ new Set();
|
|
2180
|
-
for (const n of e.matchAll(
|
|
2181
|
-
for (const n of i.matchAll(
|
|
2180
|
+
for (const n of e.matchAll(Ai)) s.add(n[1]);
|
|
2181
|
+
for (const n of i.matchAll(Ai)) s.add(n[1]);
|
|
2182
2182
|
for (const n of s)
|
|
2183
2183
|
if (!Mn.has(n)) return !0;
|
|
2184
2184
|
return !1;
|
|
@@ -2197,7 +2197,7 @@ function Is(o, t) {
|
|
|
2197
2197
|
e[i] !== s && Ut(o, i, s);
|
|
2198
2198
|
});
|
|
2199
2199
|
}
|
|
2200
|
-
function
|
|
2200
|
+
function Ri(o, t) {
|
|
2201
2201
|
return o.document.documentElement.style.getPropertyValue(t);
|
|
2202
2202
|
}
|
|
2203
2203
|
function Ut(o, t, e) {
|
|
@@ -2222,7 +2222,7 @@ const vt = { r: 255, g: 255, b: 255, a: 1 }, mt = /* @__PURE__ */ new Map(), In
|
|
|
2222
2222
|
});
|
|
2223
2223
|
}
|
|
2224
2224
|
return Te;
|
|
2225
|
-
},
|
|
2225
|
+
}, Fn = (o) => {
|
|
2226
2226
|
if (!o) return !0;
|
|
2227
2227
|
const t = o.trim().toLowerCase();
|
|
2228
2228
|
return t.startsWith("var(") || [
|
|
@@ -2249,7 +2249,7 @@ const vt = { r: 255, g: 255, b: 255, a: 1 }, mt = /* @__PURE__ */ new Map(), In
|
|
|
2249
2249
|
const e = t ? `${o}|${t}` : o, i = mt.get(e);
|
|
2250
2250
|
if (i !== void 0)
|
|
2251
2251
|
return i ?? vt;
|
|
2252
|
-
if (
|
|
2252
|
+
if (Fn(o))
|
|
2253
2253
|
return Kt(o, "Unsupported color format or special value."), mt.set(e, null), vt;
|
|
2254
2254
|
const s = In();
|
|
2255
2255
|
if (!s)
|
|
@@ -2263,8 +2263,8 @@ const vt = { r: 255, g: 255, b: 255, a: 1 }, mt = /* @__PURE__ */ new Map(), In
|
|
|
2263
2263
|
const [l, c, h, d] = a.data;
|
|
2264
2264
|
if (d === 0)
|
|
2265
2265
|
return Kt(o, "Fully transparent color."), mt.set(e, null), vt;
|
|
2266
|
-
const
|
|
2267
|
-
return mt.set(e,
|
|
2266
|
+
const u = { r: l, g: c, b: h, a: d / 255 };
|
|
2267
|
+
return mt.set(e, u), u;
|
|
2268
2268
|
} catch (n) {
|
|
2269
2269
|
return Kt(o, `Error: ${n instanceof Error ? n.message : String(n)}`), mt.set(e, null), vt;
|
|
2270
2270
|
}
|
|
@@ -2277,10 +2277,10 @@ const vt = { r: 255, g: 255, b: 255, a: 1 }, mt = /* @__PURE__ */ new Map(), In
|
|
|
2277
2277
|
}, se = (o, t) => {
|
|
2278
2278
|
const e = typeof o == "string" ? Bt(o) : o, i = typeof t == "string" ? Bt(t) : t, s = He(e), n = He(i), r = Math.max(s, n), a = Math.min(s, n);
|
|
2279
2279
|
return (r + 0.05) / (a + 0.05);
|
|
2280
|
-
},
|
|
2280
|
+
}, Fs = (o, t = null) => {
|
|
2281
2281
|
const e = Bt(o, t), i = se(e, { r: 255, g: 255, b: 255, a: 1 }), s = se(e, { r: 0, g: 0, b: 0, a: 1 });
|
|
2282
2282
|
return i > s;
|
|
2283
|
-
},
|
|
2283
|
+
}, Dn = (o, t = null) => Fs(o, t) ? "white" : "black", zn = (o) => {
|
|
2284
2284
|
const t = o.a !== void 0 ? o.a : 1;
|
|
2285
2285
|
return `rgba(${Math.round(o.r)}, ${Math.round(o.g)}, ${Math.round(o.b)}, ${t})`;
|
|
2286
2286
|
}, Hn = (o, t) => ({
|
|
@@ -2308,15 +2308,15 @@ const vt = { r: 255, g: 255, b: 255, a: 1 }, mt = /* @__PURE__ */ new Map(), In
|
|
|
2308
2308
|
function Un(o) {
|
|
2309
2309
|
return (o.document.documentElement.dir || o.document.body.dir).toLowerCase() === "rtl";
|
|
2310
2310
|
}
|
|
2311
|
-
function
|
|
2311
|
+
function Ds(o) {
|
|
2312
2312
|
return (o.getComputedStyle(o.document.documentElement).writingMode || o.getComputedStyle(o.document.body).writingMode) === "vertical-lr";
|
|
2313
2313
|
}
|
|
2314
2314
|
function Bn(o) {
|
|
2315
2315
|
const t = o.getComputedStyle(o.document.documentElement).writingMode || o.getComputedStyle(o.document.body).writingMode;
|
|
2316
2316
|
return t === "vertical-rl" || t === "vertical-lr";
|
|
2317
2317
|
}
|
|
2318
|
-
function
|
|
2319
|
-
const t = Bn(o), e = t &&
|
|
2318
|
+
function Ae(o) {
|
|
2319
|
+
const t = Bn(o), e = t && Ds(o), i = o.innerWidth, s = o.innerHeight, n = o.document.scrollingElement, r = n.scrollLeft, a = n.scrollTop, l = parseInt(o.getComputedStyle(o.document.documentElement).getPropertyValue("column-count")), c = t && !e ? n.scrollWidth - i + r : r, h = a;
|
|
2320
2320
|
return {
|
|
2321
2321
|
isVertical: t,
|
|
2322
2322
|
isVertLR: e,
|
|
@@ -2331,11 +2331,11 @@ function Re(o) {
|
|
|
2331
2331
|
blockStart: (d) => t ? d.left : d.top,
|
|
2332
2332
|
inlineSize: (d) => t ? d.height : d.width,
|
|
2333
2333
|
blockSize: (d) => t ? d.width : d.height,
|
|
2334
|
-
applyPosition(d,
|
|
2335
|
-
d.style.position = "absolute", t ? (d.style.top = `${
|
|
2334
|
+
applyPosition(d, u, f, m, p, y) {
|
|
2335
|
+
d.style.position = "absolute", t ? (d.style.top = `${u * y}px`, d.style.left = `${f * y}px`, d.style.height = `${m * y}px`, d.style.width = `${p * y}px`) : (d.style.left = `${u * y}px`, d.style.top = `${f * y}px`, d.style.width = `${m * y}px`, d.style.height = `${p * y}px`);
|
|
2336
2336
|
},
|
|
2337
|
-
toRect(d,
|
|
2338
|
-
return t ? new DOMRect(
|
|
2337
|
+
toRect(d, u, f, m) {
|
|
2338
|
+
return t ? new DOMRect(u, d, m, f) : new DOMRect(d, u, f, m);
|
|
2339
2339
|
}
|
|
2340
2340
|
};
|
|
2341
2341
|
}
|
|
@@ -2480,7 +2480,7 @@ function Gn(o, t) {
|
|
|
2480
2480
|
(Xn.test(s) || $n.has(s) && Yn.test(n)) && i.removeAttribute(s);
|
|
2481
2481
|
}
|
|
2482
2482
|
}
|
|
2483
|
-
function
|
|
2483
|
+
function Re(o) {
|
|
2484
2484
|
switch (o) {
|
|
2485
2485
|
case _.Mask:
|
|
2486
2486
|
return "rgba(255, 255, 255, 0.5)";
|
|
@@ -2505,7 +2505,7 @@ const _ = {
|
|
|
2505
2505
|
// Custom HTML template (HTMLDecorationTemplate).
|
|
2506
2506
|
};
|
|
2507
2507
|
var qn = /* @__PURE__ */ ((o) => (o.Wrap = "wrap", o.Viewport = "viewport", o.Bounds = "bounds", o.Page = "page", o))(qn || {}), Kn = /* @__PURE__ */ ((o) => (o.Boxes = "boxes", o.Bounds = "bounds", o))(Kn || {});
|
|
2508
|
-
const Jn = () => "Highlight" in window,
|
|
2508
|
+
const Jn = () => "Highlight" in window, Fi = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2509
2509
|
class Zn {
|
|
2510
2510
|
/**
|
|
2511
2511
|
* Creates a DecorationGroup object
|
|
@@ -2532,7 +2532,7 @@ class Zn {
|
|
|
2532
2532
|
return;
|
|
2533
2533
|
}
|
|
2534
2534
|
const s = i.commonAncestorContainer;
|
|
2535
|
-
if (s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (
|
|
2535
|
+
if (s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Fi.includes(s.nodeName.toUpperCase()) && this.notTextFlag?.set(e, !0), i.cloneContents().querySelector(Fi.join(", ").toLowerCase()) && this.notTextFlag?.set(e, !0), (s.textContent?.trim() || "").length === 0 && this.notTextFlag?.set(e, !0)), this.experimentalHighlights) {
|
|
2536
2536
|
const { type: r } = t.style, { layout: a, width: l } = t.style;
|
|
2537
2537
|
r !== _.TextColor && (r === _.Outline || r === _.Template || r === _.Mask || a !== void 0 && a !== "boxes" || l !== void 0 && l !== "wrap") && this.notTextFlag?.set(e, !0);
|
|
2538
2538
|
}
|
|
@@ -2623,16 +2623,16 @@ class Zn {
|
|
|
2623
2623
|
});
|
|
2624
2624
|
}
|
|
2625
2625
|
experimentalLayout(t) {
|
|
2626
|
-
const [e, i] = this.requireContainer(!0), s = t.decoration.style, n = s.type ?? _.Highlight, r = s.tint ??
|
|
2626
|
+
const [e, i] = this.requireContainer(!0), s = t.decoration.style, n = s.type ?? _.Highlight, r = s.tint ?? Re(n), a = s.width, l = s.layout, c = (f, m) => this.wnd.document.caretPositionFromPoint?.(f, m) ?? null;
|
|
2627
2627
|
if (n === _.TextColor && (l === "bounds" || a === "bounds" || a === "page")) {
|
|
2628
|
-
const f =
|
|
2628
|
+
const f = Ae(this.wnd);
|
|
2629
2629
|
if (f.isVertical)
|
|
2630
2630
|
console.warn("Vertical writing detected: caretPositionFromPoint has known bugs, falling back to original range"), i.add(t.range);
|
|
2631
2631
|
else {
|
|
2632
2632
|
const m = t.range.getBoundingClientRect();
|
|
2633
|
-
let
|
|
2634
|
-
a === "page" ? (
|
|
2635
|
-
const w = c(
|
|
2633
|
+
let p, y;
|
|
2634
|
+
a === "page" ? (p = Math.floor(f.inlineStart(m) / f.pageInlineSize) * f.pageInlineSize, y = f.pageInlineSize) : (p = f.inlineStart(m), y = f.inlineSize(m));
|
|
2635
|
+
const w = c(p, f.blockStart(m) + 1), C = c(p + y, f.blockStart(m) + f.blockSize(m) - 1);
|
|
2636
2636
|
if (w && C) {
|
|
2637
2637
|
const T = this.wnd.document.createRange();
|
|
2638
2638
|
T.setStart(w.offsetNode, w.offset), T.setEnd(C.offsetNode, C.offset), i.add(T), t.range = T;
|
|
@@ -2642,11 +2642,11 @@ class Zn {
|
|
|
2642
2642
|
} else
|
|
2643
2643
|
i.add(t.range);
|
|
2644
2644
|
const h = this.getBackgroundColor(), d = s.enforceContrast !== !1;
|
|
2645
|
-
let
|
|
2645
|
+
let u;
|
|
2646
2646
|
switch (n) {
|
|
2647
2647
|
case _.Underline:
|
|
2648
2648
|
const f = d ? ut(r, h) : r;
|
|
2649
|
-
|
|
2649
|
+
u = `::highlight(${this.id}) {
|
|
2650
2650
|
text-decoration: underline;
|
|
2651
2651
|
text-decoration-color: ${f};
|
|
2652
2652
|
text-decoration-thickness: 0.1em;
|
|
@@ -2654,28 +2654,28 @@ class Zn {
|
|
|
2654
2654
|
break;
|
|
2655
2655
|
case _.Outline:
|
|
2656
2656
|
const m = d ? ut(r, h) : r;
|
|
2657
|
-
|
|
2657
|
+
u = `::highlight(${this.id}) {
|
|
2658
2658
|
outline: 2px solid ${m};
|
|
2659
2659
|
outline-offset: 1px;
|
|
2660
2660
|
}`;
|
|
2661
2661
|
break;
|
|
2662
2662
|
case _.TextColor: {
|
|
2663
|
-
const
|
|
2664
|
-
|
|
2665
|
-
color: ${
|
|
2663
|
+
const p = d ? ut(r, h) : r;
|
|
2664
|
+
u = `::highlight(${this.id}) {
|
|
2665
|
+
color: ${p};
|
|
2666
2666
|
}`;
|
|
2667
2667
|
break;
|
|
2668
2668
|
}
|
|
2669
2669
|
case _.Highlight:
|
|
2670
2670
|
default: {
|
|
2671
|
-
const
|
|
2672
|
-
|
|
2673
|
-
color: ${
|
|
2674
|
-
background-color: ${
|
|
2671
|
+
const p = d ? ut(r, h) : r;
|
|
2672
|
+
u = `::highlight(${this.id}) {
|
|
2673
|
+
color: ${Dn(p, h)};
|
|
2674
|
+
background-color: ${p};
|
|
2675
2675
|
}`;
|
|
2676
2676
|
}
|
|
2677
2677
|
}
|
|
2678
|
-
e.innerHTML =
|
|
2678
|
+
e.innerHTML = u;
|
|
2679
2679
|
}
|
|
2680
2680
|
/**
|
|
2681
2681
|
* Layouts a single DecorationItem.
|
|
@@ -2686,26 +2686,26 @@ class Zn {
|
|
|
2686
2686
|
return this.experimentalLayout(t);
|
|
2687
2687
|
const e = this.wnd.document.createElement("div");
|
|
2688
2688
|
e.setAttribute("id", t.id), e.dataset.highlightId = t.decoration.id, e.style.setProperty("pointer-events", "none");
|
|
2689
|
-
const i =
|
|
2689
|
+
const i = Ae(this.wnd);
|
|
2690
2690
|
let s = 1;
|
|
2691
2691
|
if (G.UA.Blink) {
|
|
2692
|
-
const h = parseFloat(this.wnd.getComputedStyle(this.wnd.document.documentElement).zoom), d = parseFloat(this.wnd.getComputedStyle(this.wnd.document.body).zoom),
|
|
2693
|
-
|
|
2692
|
+
const h = parseFloat(this.wnd.getComputedStyle(this.wnd.document.documentElement).zoom), d = parseFloat(this.wnd.getComputedStyle(this.wnd.document.body).zoom), u = (h || 1) * (d || 1);
|
|
2693
|
+
u && (s = 1 / u);
|
|
2694
2694
|
}
|
|
2695
|
-
const n = (h, d,
|
|
2695
|
+
const n = (h, d, u, f = 0) => {
|
|
2696
2696
|
switch (t.decoration?.style?.width) {
|
|
2697
2697
|
case "viewport": {
|
|
2698
|
-
const
|
|
2699
|
-
i.applyPosition(h,
|
|
2698
|
+
const p = Math.floor(i.inlineStart(d) / i.viewportInlineSize) * i.viewportInlineSize;
|
|
2699
|
+
i.applyPosition(h, p + i.inlineScrollOffset + f, i.blockStart(d) + i.blockScrollOffset, i.viewportInlineSize - 2 * f, i.blockSize(d), s);
|
|
2700
2700
|
break;
|
|
2701
2701
|
}
|
|
2702
2702
|
case "page": {
|
|
2703
|
-
const
|
|
2704
|
-
i.applyPosition(h,
|
|
2703
|
+
const p = Math.floor(i.inlineStart(d) / i.pageInlineSize) * i.pageInlineSize;
|
|
2704
|
+
i.applyPosition(h, p + i.inlineScrollOffset + f, i.blockStart(d) + i.blockScrollOffset, i.pageInlineSize - 2 * f, i.blockSize(d), s);
|
|
2705
2705
|
break;
|
|
2706
2706
|
}
|
|
2707
2707
|
case "bounds": {
|
|
2708
|
-
i.applyPosition(h, i.inlineStart(
|
|
2708
|
+
i.applyPosition(h, i.inlineStart(u) + i.inlineScrollOffset, i.blockStart(d) + i.blockScrollOffset, i.inlineSize(u), i.blockSize(d), s);
|
|
2709
2709
|
break;
|
|
2710
2710
|
}
|
|
2711
2711
|
default:
|
|
@@ -2726,7 +2726,7 @@ class Zn {
|
|
|
2726
2726
|
}
|
|
2727
2727
|
h.style.setProperty("pointer-events", "none"), c = h;
|
|
2728
2728
|
} else {
|
|
2729
|
-
const h = a, d = h.type ?? _.Highlight,
|
|
2729
|
+
const h = a, d = h.type ?? _.Highlight, u = h.tint ?? Re(d);
|
|
2730
2730
|
if (d === _.TextColor) {
|
|
2731
2731
|
t.container = e, t.clickableElements = [];
|
|
2732
2732
|
return;
|
|
@@ -2735,10 +2735,10 @@ class Zn {
|
|
|
2735
2735
|
t.container = e, t.clickableElements = [], this.updateSharedMask();
|
|
2736
2736
|
return;
|
|
2737
2737
|
}
|
|
2738
|
-
const f = this.getCurrentDarkMode(), m = this.getBackgroundColor(),
|
|
2738
|
+
const f = this.getCurrentDarkMode(), m = this.getBackgroundColor(), p = h.enforceContrast !== !1, y = (() => {
|
|
2739
2739
|
switch (d) {
|
|
2740
2740
|
case _.Underline: {
|
|
2741
|
-
const T =
|
|
2741
|
+
const T = p ? ut(u, m) : u;
|
|
2742
2742
|
return [
|
|
2743
2743
|
h.layout === "bounds" ? `border-top: 0.1em solid ${T} !important` : null,
|
|
2744
2744
|
`border-bottom: 0.1em solid ${T} !important`,
|
|
@@ -2748,7 +2748,7 @@ class Zn {
|
|
|
2748
2748
|
}
|
|
2749
2749
|
case _.Outline:
|
|
2750
2750
|
return [
|
|
2751
|
-
`outline: 2px solid ${
|
|
2751
|
+
`outline: 2px solid ${p ? ut(u, m) : u} !important`,
|
|
2752
2752
|
"outline-offset: 1px !important",
|
|
2753
2753
|
"background-color: transparent !important",
|
|
2754
2754
|
"box-sizing: border-box !important"
|
|
@@ -2756,7 +2756,7 @@ class Zn {
|
|
|
2756
2756
|
case _.Highlight:
|
|
2757
2757
|
default:
|
|
2758
2758
|
return [
|
|
2759
|
-
`background-color: ${
|
|
2759
|
+
`background-color: ${p ? ut(u, m) : u} !important`,
|
|
2760
2760
|
`mix-blend-mode: ${f ? "exclusion" : "multiply"} !important`,
|
|
2761
2761
|
"opacity: 1 !important",
|
|
2762
2762
|
"box-sizing: border-box !important"
|
|
@@ -2776,10 +2776,10 @@ class Zn {
|
|
|
2776
2776
|
i.isVertical
|
|
2777
2777
|
// doNotMergeVerticallyAlignedRects
|
|
2778
2778
|
);
|
|
2779
|
-
h = h.sort((d,
|
|
2779
|
+
h = h.sort((d, u) => i.isVertical ? (i.isVertLR ? 1 : -1) * (d.left - u.left) : d.top - u.top);
|
|
2780
2780
|
for (let d of h) {
|
|
2781
|
-
const
|
|
2782
|
-
|
|
2781
|
+
const u = c.cloneNode(!0);
|
|
2782
|
+
u.style.setProperty("pointer-events", "none"), n(u, d, r, l), e.append(u);
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
2785
|
t.container = e, t.clickableElements = Array.from(
|
|
@@ -2806,31 +2806,31 @@ class Zn {
|
|
|
2806
2806
|
return this.container || (this.shadowRoot || (this.shadowHost = this.wnd.document.createElement("div"), this.shadowHost.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none", this.wnd.document.body.appendChild(this.shadowHost), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" })), this.container = this.wnd.document.createElement("div"), this.container.setAttribute("id", this.id), this.container.dataset.group = this.name, this.container.dataset.readium = "true", this.container.style.setProperty("pointer-events", "none"), this.container.style.display = "contents", this.shadowRoot.appendChild(this.container)), this.container;
|
|
2807
2807
|
}
|
|
2808
2808
|
getCurrentDarkMode() {
|
|
2809
|
-
return
|
|
2809
|
+
return Ri(this.wnd, "--USER__appearance") === "readium-night-on" || Fs(this.getBackgroundColor());
|
|
2810
2810
|
}
|
|
2811
2811
|
getBackgroundColor() {
|
|
2812
|
-
return
|
|
2812
|
+
return Ri(this.wnd, "--USER__backgroundColor") || this.wnd.getComputedStyle(this.wnd.document.documentElement).getPropertyValue("background-color");
|
|
2813
2813
|
}
|
|
2814
2814
|
updateSharedMask() {
|
|
2815
2815
|
const t = this.items.filter(
|
|
2816
|
-
(
|
|
2816
|
+
(u) => u.decoration.style?.type === _.Mask
|
|
2817
2817
|
);
|
|
2818
2818
|
if (t.length === 0) {
|
|
2819
2819
|
this.maskSvg && (this.maskSvg.remove(), this.maskSvg = void 0), this.shadowRoot && (this.shadowRoot.innerHTML = "");
|
|
2820
2820
|
return;
|
|
2821
2821
|
}
|
|
2822
|
-
const e =
|
|
2822
|
+
const e = Ae(this.wnd);
|
|
2823
2823
|
let i = 1;
|
|
2824
2824
|
if (G.UA.Blink) {
|
|
2825
|
-
const
|
|
2825
|
+
const u = parseFloat(this.wnd.getComputedStyle(this.wnd.document.documentElement).zoom), f = parseFloat(this.wnd.getComputedStyle(this.wnd.document.body).zoom), m = (u || 1) * (f || 1);
|
|
2826
2826
|
m && (i = 1 / m);
|
|
2827
2827
|
}
|
|
2828
2828
|
const s = this.wnd.document.documentElement, n = s.scrollWidth, r = s.scrollHeight, a = [];
|
|
2829
|
-
for (const
|
|
2830
|
-
const f =
|
|
2829
|
+
for (const u of t) {
|
|
2830
|
+
const f = u.decoration.style, m = f.layout ?? "boxes", p = f.width ?? "wrap", y = u.range.getBoundingClientRect(), w = m === "bounds" ? [y] : Array.from(u.range.getClientRects());
|
|
2831
2831
|
for (const C of w) {
|
|
2832
2832
|
let T;
|
|
2833
|
-
switch (
|
|
2833
|
+
switch (p) {
|
|
2834
2834
|
case "viewport": {
|
|
2835
2835
|
const K = Math.floor(e.inlineStart(C) / e.viewportInlineSize) * e.viewportInlineSize;
|
|
2836
2836
|
T = e.toRect(K, e.blockStart(C), e.viewportInlineSize, e.blockSize(C));
|
|
@@ -2853,17 +2853,17 @@ class Zn {
|
|
|
2853
2853
|
}
|
|
2854
2854
|
const l = [
|
|
2855
2855
|
`M0 0 H${n} V${r} H0 Z`,
|
|
2856
|
-
...a.map((
|
|
2857
|
-
const f = (
|
|
2858
|
-
return `M${f} ${m} H${
|
|
2856
|
+
...a.map((u) => {
|
|
2857
|
+
const f = (u.left + e.xDocOffset) * i, m = (u.top + e.yDocOffset) * i, p = (u.right + e.xDocOffset) * i, y = (u.bottom + e.yDocOffset) * i;
|
|
2858
|
+
return `M${f} ${m} H${p} V${y} H${f} Z`;
|
|
2859
2859
|
})
|
|
2860
2860
|
].join(" "), c = "http://www.w3.org/2000/svg";
|
|
2861
2861
|
if (!this.maskSvg) {
|
|
2862
2862
|
this.shadowRoot || (this.shadowHost = this.wnd.document.createElement("div"), this.shadowHost.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none", this.wnd.document.body.appendChild(this.shadowHost), this.shadowRoot = this.shadowHost.attachShadow({ mode: "open" })), this.maskSvg = this.wnd.document.createElementNS(c, "svg"), this.maskSvg.style.cssText = `position:absolute;top:0;left:0;width:${n}px;height:${r}px;pointer-events:none;z-index:9999`, this.maskSvg.dataset.readium = "true";
|
|
2863
|
-
const
|
|
2863
|
+
const u = this.wnd.document.createElementNS(c, "defs"), f = this.wnd.document.createElementNS(c, "clipPath"), m = `${this.id}-mask-clip`;
|
|
2864
2864
|
f.setAttribute("id", m), f.setAttribute("clipPathUnits", "userSpaceOnUse");
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2865
|
+
const p = this.wnd.document.createElementNS(c, "path");
|
|
2866
|
+
p.setAttribute("clip-rule", "evenodd"), f.appendChild(p), u.appendChild(f), this.maskSvg.appendChild(u);
|
|
2867
2867
|
const y = this.wnd.document.createElementNS(c, "rect");
|
|
2868
2868
|
y.setAttribute("id", `${this.id}-mask-rect`), y.setAttribute("clip-path", `url(#${m})`), y.style.pointerEvents = "none", this.maskSvg.appendChild(y), this.shadowRoot.appendChild(this.maskSvg);
|
|
2869
2869
|
}
|
|
@@ -2872,8 +2872,8 @@ class Zn {
|
|
|
2872
2872
|
h && h.setAttribute("d", l);
|
|
2873
2873
|
const d = this.maskSvg.querySelector("rect");
|
|
2874
2874
|
if (d) {
|
|
2875
|
-
const f = t[0].decoration.style.tint, m = f ?? this.getBackgroundColor() ??
|
|
2876
|
-
d.setAttribute("x", "0"), d.setAttribute("y", "0"), d.setAttribute("width", String(n)), d.setAttribute("height", String(r)), d.setAttribute("fill", m), d.setAttribute("fill-opacity",
|
|
2875
|
+
const f = t[0].decoration.style.tint, m = f ?? this.getBackgroundColor() ?? Re(_.Mask), p = f ? "1" : "0.5";
|
|
2876
|
+
d.setAttribute("x", "0"), d.setAttribute("y", "0"), d.setAttribute("width", String(n)), d.setAttribute("height", String(r)), d.setAttribute("fill", m), d.setAttribute("fill-opacity", p);
|
|
2877
2877
|
}
|
|
2878
2878
|
}
|
|
2879
2879
|
injectCustomStylesheet(t) {
|
|
@@ -2888,7 +2888,7 @@ class Zn {
|
|
|
2888
2888
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.wnd.document.getElementById(`${this.id}-custom-style`)?.remove(), this.container && (this.container.remove(), this.container = void 0);
|
|
2889
2889
|
}
|
|
2890
2890
|
}
|
|
2891
|
-
const _t = class _t extends
|
|
2891
|
+
const _t = class _t extends Rt {
|
|
2892
2892
|
constructor() {
|
|
2893
2893
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2894
2894
|
}
|
|
@@ -2910,7 +2910,7 @@ const _t = class _t extends At {
|
|
|
2910
2910
|
mount(t, e) {
|
|
2911
2911
|
return this.wnd = t, e.register("decorate", _t.moduleName, (i, s) => {
|
|
2912
2912
|
const n = i;
|
|
2913
|
-
(n.action === "add" || n.action === "update") && n.decoration.locator && (n.decoration.locator =
|
|
2913
|
+
(n.action === "add" || n.action === "update") && n.decoration.locator && (n.decoration.locator = I.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new Zn(
|
|
2914
2914
|
t,
|
|
2915
2915
|
e,
|
|
2916
2916
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2951,7 +2951,7 @@ const _t = class _t extends At {
|
|
|
2951
2951
|
};
|
|
2952
2952
|
_t.moduleName = "decorator";
|
|
2953
2953
|
let We = _t;
|
|
2954
|
-
const
|
|
2954
|
+
const Di = "readium-snapper-style", Ht = class Ht extends Rt {
|
|
2955
2955
|
constructor() {
|
|
2956
2956
|
super(...arguments), this.protected = !1;
|
|
2957
2957
|
}
|
|
@@ -2964,14 +2964,14 @@ const Fi = "readium-snapper-style", Ht = class Ht extends At {
|
|
|
2964
2964
|
}
|
|
2965
2965
|
mount(t, e) {
|
|
2966
2966
|
const i = t.document.createElement("style");
|
|
2967
|
-
return i.dataset.readium = "true", i.id =
|
|
2967
|
+
return i.dataset.readium = "true", i.id = Di, i.textContent = this.buildStyles(), t.document.head.appendChild(i), e.register("protect", Ht.moduleName, (s, n) => {
|
|
2968
2968
|
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2969
2969
|
}), e.register("unprotect", Ht.moduleName, (s, n) => {
|
|
2970
2970
|
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2971
2971
|
}), e.log("Snapper Mounted"), !0;
|
|
2972
2972
|
}
|
|
2973
2973
|
unmount(t, e) {
|
|
2974
|
-
return t.document.getElementById(
|
|
2974
|
+
return t.document.getElementById(Di)?.remove(), e.log("Snapper Unmounted"), !0;
|
|
2975
2975
|
}
|
|
2976
2976
|
};
|
|
2977
2977
|
Ht.moduleName = "snapper";
|
|
@@ -3011,7 +3011,7 @@ function we(o, t) {
|
|
|
3011
3011
|
const e = Vs(o, o.document.body, t), i = o._readium_cssSelectorGenerator.getCssSelector(e, {
|
|
3012
3012
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
3013
3013
|
});
|
|
3014
|
-
return new
|
|
3014
|
+
return new I({
|
|
3015
3015
|
href: "#",
|
|
3016
3016
|
type: "application/xhtml+xml",
|
|
3017
3017
|
locations: new L({
|
|
@@ -3098,19 +3098,19 @@ class ve {
|
|
|
3098
3098
|
direction: t,
|
|
3099
3099
|
velocity: s,
|
|
3100
3100
|
distance: Math.abs(e)
|
|
3101
|
-
}), this.history = this.history.filter((
|
|
3101
|
+
}), this.history = this.history.filter((p) => n - p.timestamp < 2e3).slice(-(this.options.historySize || 20)), this.history.length < 3) return !1;
|
|
3102
3102
|
if (s > this.options.maxVelocity)
|
|
3103
3103
|
return this.resetAfterDetection(), !0;
|
|
3104
|
-
const r = this.history.map((
|
|
3104
|
+
const r = this.history.map((p) => p.velocity), a = this.history.map((p) => p.distance), l = r.reduce((p, y) => p + y, 0) / r.length, c = a.reduce((p, y) => p + y, 0) / a.length, h = r.reduce((p, y) => p + Math.pow(y - l, 2), 0) / r.length, d = a.reduce((p, y) => p + Math.pow(y - c, 2), 0) / a.length;
|
|
3105
3105
|
if (h < this.options.minVariance && d < c * 0.1) {
|
|
3106
3106
|
if (this.consistentScrollCount++, this.consistentScrollCount >= (this.options.maxConsistentScrolls || 10))
|
|
3107
3107
|
return this.resetAfterDetection(), !0;
|
|
3108
3108
|
} else
|
|
3109
3109
|
this.consistentScrollCount = Math.max(0, this.consistentScrollCount - 1);
|
|
3110
|
-
let
|
|
3111
|
-
for (let
|
|
3112
|
-
this.history[
|
|
3113
|
-
return
|
|
3110
|
+
let u = 0, f = this.history[0].direction;
|
|
3111
|
+
for (let p = 1; p < this.history.length; p++)
|
|
3112
|
+
this.history[p].direction !== f && (u++, f = this.history[p].direction);
|
|
3113
|
+
return u / this.history.length > (this.options.minDirectionChanges || 0.3) ? (this.resetAfterDetection(), !0) : !1;
|
|
3114
3114
|
}
|
|
3115
3115
|
resetAfterDetection() {
|
|
3116
3116
|
this.history = this.history.slice(-3), this.consistentScrollCount = 0;
|
|
@@ -3175,18 +3175,18 @@ const zi = "readium-column-snapper-style", lr = 200, V = class V extends Ot {
|
|
|
3175
3175
|
}
|
|
3176
3176
|
// Snaps the current offset to the page width.
|
|
3177
3177
|
snapCurrentOffset(t = !1, e = !1) {
|
|
3178
|
-
const i = this.doc(), s = zs(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, r = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), l = this.rtl ? -a : a, c = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), h = Math.min(n, Math.max(0, this.snapNormOffset(r + c))), d = this.rtl ? -h : h,
|
|
3179
|
-
if (this.checkSuspiciousSnap(f, Math.abs(d -
|
|
3178
|
+
const i = this.doc(), s = zs(this.wnd), n = this.cachedScrollWidth - this.wnd.innerWidth, r = Math.min(Math.max(0, this.normScroll()), n), a = this.dragOffset(), l = this.rtl ? -a : a, c = this.wnd.innerWidth / 3 * (l > 0 ? 2 : 1), h = Math.min(n, Math.max(0, this.snapNormOffset(r + c))), d = this.rtl ? -h : h, u = this.rtl ? -r : r, f = d > u ? "right" : "left";
|
|
3179
|
+
if (this.checkSuspiciousSnap(f, Math.abs(d - u)), t && d !== u) {
|
|
3180
3180
|
this.snappingCancelled = !1;
|
|
3181
|
-
const m = (C, T, K, ft) => K > ft ? T : C + (T - C) * Qn(K / ft),
|
|
3181
|
+
const m = (C, T, K, ft) => K > ft ? T : C + (T - C) * Qn(K / ft), p = lr * s;
|
|
3182
3182
|
let y;
|
|
3183
3183
|
const w = (C) => {
|
|
3184
3184
|
if (this.snappingCancelled) return;
|
|
3185
3185
|
y || (y = C);
|
|
3186
|
-
const T = C - y, K = m(this.overscroll, 0, T,
|
|
3186
|
+
const T = C - y, K = m(this.overscroll, 0, T, p), ft = m(u, d, T, p);
|
|
3187
3187
|
i.scrollLeft = ft, this.overscroll !== 0 && (ke() ? i.attributeStyleMap.set("transform", new CSSTransformValue([
|
|
3188
3188
|
new CSSTranslate(CSS.px(-K), CSS.px(0), CSS.px(0))
|
|
3189
|
-
])) : i.style.transform = `translate3d(${-K}px, 0px, 0px)`), T <
|
|
3189
|
+
])) : i.style.transform = `translate3d(${-K}px, 0px, 0px)`), T < p ? this.wnd.requestAnimationFrame(w) : (this.clearTouches(), i.style.removeProperty("transform"), i.scrollLeft = d, e || this.reportProgress());
|
|
3190
3190
|
};
|
|
3191
3191
|
this.wnd.requestAnimationFrame(w);
|
|
3192
3192
|
} else
|
|
@@ -3302,8 +3302,8 @@ const zi = "readium-column-snapper-style", lr = 200, V = class V extends Ot {
|
|
|
3302
3302
|
}), this.resizeObserver.observe(t.document.body), this.mutationObserver = new MutationObserver((r) => {
|
|
3303
3303
|
for (const a of r)
|
|
3304
3304
|
if (a.target === this.wnd.document.documentElement) {
|
|
3305
|
-
const l = a.oldValue, c = a.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, d = l?.match(h),
|
|
3306
|
-
(!d && !
|
|
3305
|
+
const l = a.oldValue, c = a.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, d = l?.match(h), u = c?.match(h);
|
|
3306
|
+
(!d && !u && Nn(l, c) || d && !u || d && u && d[1] !== u[1]) && (t.requestAnimationFrame(() => {
|
|
3307
3307
|
t && Ni(t);
|
|
3308
3308
|
}), this.onWidthChange());
|
|
3309
3309
|
} else
|
|
@@ -3343,7 +3343,7 @@ const zi = "readium-column-snapper-style", lr = 200, V = class V extends Ot {
|
|
|
3343
3343
|
}), e.register("go_text", V.moduleName, (r, a) => {
|
|
3344
3344
|
let l;
|
|
3345
3345
|
Array.isArray(r) && (r.length > 1 && (l = r[1]), r = r[0]);
|
|
3346
|
-
const c = et.deserialize(r), h = Gt(this.wnd.document, new
|
|
3346
|
+
const c = et.deserialize(r), h = Gt(this.wnd.document, new I({
|
|
3347
3347
|
href: t.location.href,
|
|
3348
3348
|
type: "text/html",
|
|
3349
3349
|
text: c,
|
|
@@ -3494,7 +3494,7 @@ const Hi = "readium-scroll-snapper-style", X = class X extends Ot {
|
|
|
3494
3494
|
}), e.register("go_text", X.moduleName, (s, n) => {
|
|
3495
3495
|
let r;
|
|
3496
3496
|
Array.isArray(s) && (s.length > 1 && (r = s[1]), s = s[0]);
|
|
3497
|
-
const a = et.deserialize(s), l = Gt(this.wnd.document, new
|
|
3497
|
+
const a = et.deserialize(s), l = Gt(this.wnd.document, new I({
|
|
3498
3498
|
href: t.location.href,
|
|
3499
3499
|
type: "text/html",
|
|
3500
3500
|
text: a,
|
|
@@ -3617,7 +3617,7 @@ const $ = class $ extends Ot {
|
|
|
3617
3617
|
}), e.register("go_text", $.moduleName, (i, s) => {
|
|
3618
3618
|
let n;
|
|
3619
3619
|
Array.isArray(i) && (i.length > 1 && (n = i[1]), i = i[0]);
|
|
3620
|
-
const r = et.deserialize(i), a = Gt(this.wnd.document, new
|
|
3620
|
+
const r = et.deserialize(i), a = Gt(this.wnd.document, new I({
|
|
3621
3621
|
href: t.location.href,
|
|
3622
3622
|
type: "text/html",
|
|
3623
3623
|
text: r,
|
|
@@ -3834,7 +3834,7 @@ class $s {
|
|
|
3834
3834
|
};
|
|
3835
3835
|
}
|
|
3836
3836
|
}
|
|
3837
|
-
const pt = class pt extends
|
|
3837
|
+
const pt = class pt extends Rt {
|
|
3838
3838
|
constructor() {
|
|
3839
3839
|
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 $s(), this.keyDownHandler = null, this.preventBulkCopy = (t) => {
|
|
3840
3840
|
if (!this.isBulkCopyProtectionEnabled || !this.bulkCopyProtector)
|
|
@@ -4062,7 +4062,7 @@ const pt = class pt extends At {
|
|
|
4062
4062
|
};
|
|
4063
4063
|
pt.moduleName = "peripherals";
|
|
4064
4064
|
let Xe = pt;
|
|
4065
|
-
const Wt = class Wt extends
|
|
4065
|
+
const Wt = class Wt extends Rt {
|
|
4066
4066
|
constructor() {
|
|
4067
4067
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
4068
4068
|
}
|
|
@@ -4112,7 +4112,7 @@ const Wt = class Wt extends At {
|
|
|
4112
4112
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
4113
4113
|
value: {
|
|
4114
4114
|
name: "readium-ts-toolkit",
|
|
4115
|
-
version: "2.7.0-alpha.
|
|
4115
|
+
version: "2.7.0-alpha.4",
|
|
4116
4116
|
hasFeature: (s, n = "") => {
|
|
4117
4117
|
switch (s) {
|
|
4118
4118
|
case "dom-manipulation":
|
|
@@ -4236,7 +4236,7 @@ const Ui = "readium-fixed-style", Q = class Q extends ne {
|
|
|
4236
4236
|
};
|
|
4237
4237
|
Q.moduleName = "fixed_setup";
|
|
4238
4238
|
let Ye = Q;
|
|
4239
|
-
const st = class st extends
|
|
4239
|
+
const st = class st extends Rt {
|
|
4240
4240
|
wndOnErr(t) {
|
|
4241
4241
|
this.comms?.send("error", {
|
|
4242
4242
|
message: t.message,
|
|
@@ -4270,7 +4270,7 @@ const st = class st extends At {
|
|
|
4270
4270
|
st.moduleName = "webpub_setup";
|
|
4271
4271
|
let je = st;
|
|
4272
4272
|
var ct;
|
|
4273
|
-
let dr = (ct = class extends
|
|
4273
|
+
let dr = (ct = class extends Rt {
|
|
4274
4274
|
constructor() {
|
|
4275
4275
|
super(...arguments), this.styleElement = null, this.beforePrintHandler = null, this.configApplied = !1;
|
|
4276
4276
|
}
|
|
@@ -4361,7 +4361,7 @@ const Bi = "readium-cjk-vertical-snapper-style", Y = class Y extends Ot {
|
|
|
4361
4361
|
this.patternAnalyzer || (this.patternAnalyzer = new ve(ri), this.isScrollProtectionEnabled = !0, this.comms?.log("Scroll protection enabled"));
|
|
4362
4362
|
}
|
|
4363
4363
|
mount(t, e) {
|
|
4364
|
-
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR =
|
|
4364
|
+
this.wnd = t, this.comms = e, this.initialScrollHandled = !1, this.lastScrollLeft = 0, this.isResizing = !1, this.verticalLR = Ds(t), this.resizeDebounce && (this.wnd.clearTimeout(this.resizeDebounce), this.resizeDebounce = null), t.navigator.epubReadingSystem && (t.navigator.epubReadingSystem.layoutStyle = "scrolling");
|
|
4365
4365
|
const i = t.document.createElement("style");
|
|
4366
4366
|
return i.dataset.readium = "true", i.id = Bi, i.textContent = `
|
|
4367
4367
|
* {
|
|
@@ -4406,7 +4406,7 @@ const Bi = "readium-cjk-vertical-snapper-style", Y = class Y extends Ot {
|
|
|
4406
4406
|
}), e.register("go_text", Y.moduleName, (s, n) => {
|
|
4407
4407
|
let r;
|
|
4408
4408
|
Array.isArray(s) && (s.length > 1 && (r = s[1]), s = s[0]);
|
|
4409
|
-
const a = et.deserialize(s), l = Gt(this.wnd.document, new
|
|
4409
|
+
const a = et.deserialize(s), l = Gt(this.wnd.document, new I({
|
|
4410
4410
|
href: t.location.href,
|
|
4411
4411
|
type: "text/html",
|
|
4412
4412
|
text: a,
|
|
@@ -4479,7 +4479,7 @@ const ur = [
|
|
|
4479
4479
|
Ge,
|
|
4480
4480
|
dr
|
|
4481
4481
|
].map((o) => [o.moduleName, o]));
|
|
4482
|
-
class
|
|
4482
|
+
class At {
|
|
4483
4483
|
/**
|
|
4484
4484
|
* @param wnd Window instance to operate on
|
|
4485
4485
|
* @param initialModules List of initial modules to load
|
|
@@ -4740,7 +4740,7 @@ class Vt {
|
|
|
4740
4740
|
try {
|
|
4741
4741
|
this.channelId = window.crypto.randomUUID();
|
|
4742
4742
|
} catch {
|
|
4743
|
-
this.channelId =
|
|
4743
|
+
this.channelId = De();
|
|
4744
4744
|
}
|
|
4745
4745
|
this.gc = setInterval(() => {
|
|
4746
4746
|
this.registry.forEach((i, s) => {
|
|
@@ -4792,7 +4792,7 @@ class Vt {
|
|
|
4792
4792
|
* @returns Identifier associated with the message
|
|
4793
4793
|
*/
|
|
4794
4794
|
send(t, e, i, s = !1, n = []) {
|
|
4795
|
-
const r =
|
|
4795
|
+
const r = De();
|
|
4796
4796
|
return i && this.registry.set(r, {
|
|
4797
4797
|
// Add callback to the registry
|
|
4798
4798
|
cb: i,
|
|
@@ -4859,7 +4859,7 @@ class Er {
|
|
|
4859
4859
|
}
|
|
4860
4860
|
return;
|
|
4861
4861
|
}
|
|
4862
|
-
this.comms?.halt(), this.loader.destroy(), this.loader = new
|
|
4862
|
+
this.comms?.halt(), this.loader.destroy(), this.loader = new At(s, t), this.currModules = t, this.comms = void 0;
|
|
4863
4863
|
try {
|
|
4864
4864
|
e(s);
|
|
4865
4865
|
} catch {
|
|
@@ -4868,7 +4868,7 @@ class Er {
|
|
|
4868
4868
|
}
|
|
4869
4869
|
this.frame.onload = () => {
|
|
4870
4870
|
const s = this.frame.contentWindow;
|
|
4871
|
-
this.loader = new
|
|
4871
|
+
this.loader = new At(s, t), this.currModules = t;
|
|
4872
4872
|
try {
|
|
4873
4873
|
e(s);
|
|
4874
4874
|
} catch {
|
|
@@ -4967,14 +4967,14 @@ class Cr {
|
|
|
4967
4967
|
this.inprogress.has(r) && await this.inprogress.get(r);
|
|
4968
4968
|
const a = new Promise(async (l, c) => {
|
|
4969
4969
|
const h = [], d = [];
|
|
4970
|
-
t.readingOrder.items.forEach((m,
|
|
4971
|
-
|
|
4970
|
+
t.readingOrder.items.forEach((m, p) => {
|
|
4971
|
+
p !== n && p !== n - 1 && p !== n + 1 && (h.includes(m.href) || h.push(m.href)), p === n && (d.includes(m.href) || d.push(m.href));
|
|
4972
4972
|
}), h.forEach(async (m) => {
|
|
4973
4973
|
d.includes(m) || this.pool.has(m) && (await this.pool.get(m)?.destroy(), this.pool.delete(m));
|
|
4974
4974
|
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((m) => {
|
|
4975
4975
|
this.injector?.releaseBlobUrl?.(m), URL.revokeObjectURL(m);
|
|
4976
4976
|
}), this.blobs.clear()), this.currentBaseURL = t.baseURL;
|
|
4977
|
-
const
|
|
4977
|
+
const u = async (m) => {
|
|
4978
4978
|
if (this.pendingUpdates.has(m) && this.pendingUpdates.get(m)?.inPool === !1) {
|
|
4979
4979
|
const w = this.blobs.get(m);
|
|
4980
4980
|
w && (this.injector?.releaseBlobUrl?.(w), URL.revokeObjectURL(w), this.blobs.delete(m), this.pendingUpdates.delete(m));
|
|
@@ -4988,13 +4988,13 @@ class Cr {
|
|
|
4988
4988
|
return;
|
|
4989
4989
|
}
|
|
4990
4990
|
}
|
|
4991
|
-
const
|
|
4992
|
-
if (!
|
|
4991
|
+
const p = t.readingOrder.findWithHref(m);
|
|
4992
|
+
if (!p) return;
|
|
4993
4993
|
if (!this.blobs.has(m)) {
|
|
4994
4994
|
const C = await new vr(
|
|
4995
4995
|
t,
|
|
4996
4996
|
this.currentBaseURL || "",
|
|
4997
|
-
|
|
4997
|
+
p,
|
|
4998
4998
|
{
|
|
4999
4999
|
cssProperties: this.currentCssProperties,
|
|
5000
5000
|
injector: this.injector
|
|
@@ -5006,7 +5006,7 @@ class Cr {
|
|
|
5006
5006
|
m !== r && await y.hide(), this.container.appendChild(y.iframe), await y.load(i), this.pool.set(m, y);
|
|
5007
5007
|
};
|
|
5008
5008
|
try {
|
|
5009
|
-
await Promise.all(d.map((m) =>
|
|
5009
|
+
await Promise.all(d.map((m) => u(m)));
|
|
5010
5010
|
} catch (m) {
|
|
5011
5011
|
c(m);
|
|
5012
5012
|
}
|
|
@@ -5081,9 +5081,9 @@ function _r() {
|
|
|
5081
5081
|
if (!(l === d - 1 || c === 1)) if (l !== d - 1 && c === 2) {
|
|
5082
5082
|
if (r.length < 2 || a !== 2 || r.charCodeAt(r.length - 1) !== 46 || r.charCodeAt(r.length - 2) !== 46) {
|
|
5083
5083
|
if (r.length > 2) {
|
|
5084
|
-
var
|
|
5085
|
-
if (
|
|
5086
|
-
|
|
5084
|
+
var u = r.lastIndexOf("/");
|
|
5085
|
+
if (u !== r.length - 1) {
|
|
5086
|
+
u === -1 ? (r = "", a = 0) : (r = r.slice(0, u), a = r.length - 1 - r.lastIndexOf("/")), l = d, c = 0;
|
|
5087
5087
|
continue;
|
|
5088
5088
|
}
|
|
5089
5089
|
} else if (r.length === 2 || r.length === 1) {
|
|
@@ -5135,24 +5135,24 @@ function _r() {
|
|
|
5135
5135
|
;
|
|
5136
5136
|
for (var l = n.length, c = l - a, h = 1; h < r.length && r.charCodeAt(h) === 47; ++h)
|
|
5137
5137
|
;
|
|
5138
|
-
for (var d = r.length,
|
|
5139
|
-
if (
|
|
5140
|
-
if (
|
|
5141
|
-
if (r.charCodeAt(h +
|
|
5142
|
-
return r.slice(h +
|
|
5143
|
-
if (
|
|
5144
|
-
return r.slice(h +
|
|
5145
|
-
} else c > f && (n.charCodeAt(a +
|
|
5138
|
+
for (var d = r.length, u = d - h, f = c < u ? c : u, m = -1, p = 0; p <= f; ++p) {
|
|
5139
|
+
if (p === f) {
|
|
5140
|
+
if (u > f) {
|
|
5141
|
+
if (r.charCodeAt(h + p) === 47)
|
|
5142
|
+
return r.slice(h + p + 1);
|
|
5143
|
+
if (p === 0)
|
|
5144
|
+
return r.slice(h + p);
|
|
5145
|
+
} else c > f && (n.charCodeAt(a + p) === 47 ? m = p : p === 0 && (m = 0));
|
|
5146
5146
|
break;
|
|
5147
5147
|
}
|
|
5148
|
-
var y = n.charCodeAt(a +
|
|
5148
|
+
var y = n.charCodeAt(a + p), w = r.charCodeAt(h + p);
|
|
5149
5149
|
if (y !== w)
|
|
5150
5150
|
break;
|
|
5151
|
-
y === 47 && (m =
|
|
5151
|
+
y === 47 && (m = p);
|
|
5152
5152
|
}
|
|
5153
5153
|
var C = "";
|
|
5154
|
-
for (
|
|
5155
|
-
(
|
|
5154
|
+
for (p = a + m + 1; p <= l; ++p)
|
|
5155
|
+
(p === l || n.charCodeAt(p) === 47) && (C.length === 0 ? C += ".." : C += "/..");
|
|
5156
5156
|
return C.length > 0 ? C + r.slice(h + m) : (h += m, r.charCodeAt(h) === 47 && ++h, r.slice(h));
|
|
5157
5157
|
},
|
|
5158
5158
|
_makeLong: function(n) {
|
|
@@ -5176,7 +5176,7 @@ function _r() {
|
|
|
5176
5176
|
var a = 0, l = -1, c = !0, h;
|
|
5177
5177
|
if (r !== void 0 && r.length > 0 && r.length <= n.length) {
|
|
5178
5178
|
if (r.length === n.length && r === n) return "";
|
|
5179
|
-
var d = r.length - 1,
|
|
5179
|
+
var d = r.length - 1, u = -1;
|
|
5180
5180
|
for (h = n.length - 1; h >= 0; --h) {
|
|
5181
5181
|
var f = n.charCodeAt(h);
|
|
5182
5182
|
if (f === 47) {
|
|
@@ -5185,9 +5185,9 @@ function _r() {
|
|
|
5185
5185
|
break;
|
|
5186
5186
|
}
|
|
5187
5187
|
} else
|
|
5188
|
-
|
|
5188
|
+
u === -1 && (c = !1, u = h + 1), d >= 0 && (f === r.charCodeAt(d) ? --d === -1 && (l = h) : (d = -1, l = u));
|
|
5189
5189
|
}
|
|
5190
|
-
return a === l ? l =
|
|
5190
|
+
return a === l ? l = u : l === -1 && (l = n.length), n.slice(a, l);
|
|
5191
5191
|
} else {
|
|
5192
5192
|
for (h = n.length - 1; h >= 0; --h)
|
|
5193
5193
|
if (n.charCodeAt(h) === 47) {
|
|
@@ -5202,15 +5202,15 @@ function _r() {
|
|
|
5202
5202
|
extname: function(n) {
|
|
5203
5203
|
o(n);
|
|
5204
5204
|
for (var r = -1, a = 0, l = -1, c = !0, h = 0, d = n.length - 1; d >= 0; --d) {
|
|
5205
|
-
var
|
|
5206
|
-
if (
|
|
5205
|
+
var u = n.charCodeAt(d);
|
|
5206
|
+
if (u === 47) {
|
|
5207
5207
|
if (!c) {
|
|
5208
5208
|
a = d + 1;
|
|
5209
5209
|
break;
|
|
5210
5210
|
}
|
|
5211
5211
|
continue;
|
|
5212
5212
|
}
|
|
5213
|
-
l === -1 && (c = !1, l = d + 1),
|
|
5213
|
+
l === -1 && (c = !1, l = d + 1), u === 46 ? r === -1 ? r = d : h !== 1 && (h = 1) : r !== -1 && (h = -1);
|
|
5214
5214
|
}
|
|
5215
5215
|
return r === -1 || l === -1 || // We saw a non-dot character immediately before the dot
|
|
5216
5216
|
h === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
@@ -5227,7 +5227,7 @@ function _r() {
|
|
|
5227
5227
|
if (n.length === 0) return r;
|
|
5228
5228
|
var a = n.charCodeAt(0), l = a === 47, c;
|
|
5229
5229
|
l ? (r.root = "/", c = 1) : c = 0;
|
|
5230
|
-
for (var h = -1, d = 0,
|
|
5230
|
+
for (var h = -1, d = 0, u = -1, f = !0, m = n.length - 1, p = 0; m >= c; --m) {
|
|
5231
5231
|
if (a = n.charCodeAt(m), a === 47) {
|
|
5232
5232
|
if (!f) {
|
|
5233
5233
|
d = m + 1;
|
|
@@ -5235,11 +5235,11 @@ function _r() {
|
|
|
5235
5235
|
}
|
|
5236
5236
|
continue;
|
|
5237
5237
|
}
|
|
5238
|
-
|
|
5238
|
+
u === -1 && (f = !1, u = m + 1), a === 46 ? h === -1 ? h = m : p !== 1 && (p = 1) : h !== -1 && (p = -1);
|
|
5239
5239
|
}
|
|
5240
|
-
return h === -1 ||
|
|
5241
|
-
|
|
5242
|
-
|
|
5240
|
+
return h === -1 || u === -1 || // We saw a non-dot character immediately before the dot
|
|
5241
|
+
p === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
5242
|
+
p === 1 && h === u - 1 && h === d + 1 ? u !== -1 && (d === 0 && l ? r.base = r.name = n.slice(1, u) : r.base = r.name = n.slice(d, u)) : (d === 0 && l ? (r.name = n.slice(1, h), r.base = n.slice(1, u)) : (r.name = n.slice(d, h), r.base = n.slice(d, u)), r.ext = n.slice(h, u)), d > 0 ? r.dir = n.slice(0, d - 1) : l && (r.dir = "/"), r;
|
|
5243
5243
|
},
|
|
5244
5244
|
sep: "/",
|
|
5245
5245
|
delimiter: ":",
|
|
@@ -5262,18 +5262,18 @@ function Lt(o) {
|
|
|
5262
5262
|
const xr = { description: "Attempts to filter out paragraphs that are implicitly headings or part of headers", scope: "RS", value: "readium-experimentalHeaderFiltering-on" }, Lr = { description: "Attempts 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" }, kr = {
|
|
5263
5263
|
experimentalHeaderFiltering: xr,
|
|
5264
5264
|
experimentalZoom: Lr
|
|
5265
|
-
}, Tr = { disabled: [], added: [] }, Or = { disabled: ["bodyHyphens", "a11yNormalize", "letterSpacing"], added: [] },
|
|
5265
|
+
}, Tr = { disabled: [], added: [] }, Or = { disabled: ["bodyHyphens", "a11yNormalize", "letterSpacing"], added: [] }, Ar = {
|
|
5266
5266
|
ltr: Tr,
|
|
5267
5267
|
rtl: Or,
|
|
5268
5268
|
"cjk-horizontal": { disabled: ["textAlign", "bodyHyphens", "a11yNormalize", "ligatures", "paraIndent", "wordSpacing"], added: ["noRuby"] },
|
|
5269
5269
|
"cjk-vertical": { disabled: ["colCount", "textAlign", "bodyHyphens", "a11yNormalize", "ligatures", "paraIndent", "wordSpacing"], added: ["noRuby"] }
|
|
5270
|
-
},
|
|
5271
|
-
latin:
|
|
5270
|
+
}, Rr = { baseFontFamily: "var(--RS__oldStyleTf)", lineHeightCompensation: 1 }, Mr = { baseFontFamily: "Kefa, Nyala, Roboto, Noto, 'Noto Sans Ethiopic', serif", lineHeightCompensation: 1.167 }, Nr = { baseFontFamily: "'Geeza Pro', 'Arabic Typesetting', Roboto, Noto, 'Noto Naskh Arabic', 'Times New Roman', serif" }, Ir = { baseFontFamily: "'Kohinoor Bangla', 'Bangla Sangam MN', Vrinda, Roboto, Noto, 'Noto Sans Bengali', sans-serif", lineHeightCompensation: 1.067 }, Fr = { baseFontFamily: "Kailasa, 'Microsoft Himalaya', Roboto, Noto, 'Noto Sans Tibetan', sans-serif" }, Dr = { baseFontFamily: "'Plantagenet Cherokee', Roboto, Noto, 'Noto Sans Cherokee'", lineHeightCompensation: 1.167 }, zr = { baseFontFamily: "'Geeza Pro', 'Arabic Typesetting', Roboto, Noto, 'Noto Naskh Arabic', 'Times New Roman', serif" }, Hr = { baseFontFamily: "'Gujarati Sangam MN', 'Nirmala UI', Shruti, Roboto, Noto, 'Noto Sans Gujarati', sans-serif", lineHeightCompensation: 1.167 }, Wr = { baseFontFamily: "'New Peninim MT', 'Arial Hebrew', Gisha, 'Times New Roman', Roboto, Noto, 'Noto Sans Hebrew', sans-serif", lineHeightCompensation: 1.1 }, Ur = { baseFontFamily: "'Kohinoor Devanagari', 'Devanagari Sangam MN', Kokila, 'Nirmala UI', Roboto, Noto, 'Noto Sans Devanagari', sans-serif", lineHeightCompensation: 1.1 }, Br = { baseFontFamily: "Mshtakan, Sylfaen, Roboto, Noto, 'Noto Serif Armenian', serif" }, Vr = { baseFontFamily: "'Euphemia UCAS', Euphemia, Roboto, Noto, 'Noto Sans Canadian Aboriginal', sans-serif" }, Xr = { baseFontFamily: "YuGothic, 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo UI', 'MS Gothic', Roboto, Noto, 'Noto Sans CJK JP', sans-serif", lineHeightCompensation: 1.167 }, $r = { baseFontFamily: "'Khmer Sangam MN', 'Leelawadee UI', 'Khmer UI', Roboto, Noto, 'Noto Sans Khmer', sans-serif", lineHeightCompensation: 1.067 }, Yr = { baseFontFamily: "'Kannada Sangam MN', 'Nirmala UI', Tunga, Roboto, Noto, 'Noto Sans Kannada', sans-serif", lineHeightCompensation: 1.1 }, jr = { baseFontFamily: "'Nanum Gothic', 'Apple SD Gothic Neo', 'Malgun Gothic', Roboto, Noto, 'Noto Sans CJK KR', sans-serif", lineHeightCompensation: 1.167 }, Gr = { baseFontFamily: "'Lao Sangam MN', 'Leelawadee UI', 'Lao UI', Roboto, Noto, 'Noto Sans Lao', sans-serif" }, qr = { baseFontFamily: "'Malayalam Sangam MN', 'Nirmala UI', Kartika, Roboto, Noto, 'Noto Sans Malayalam', sans-serif", lineHeightCompensation: 1.067 }, Kr = { baseFontFamily: "'Oriya Sangam MN', 'Nirmala UI', Kalinga, Roboto, Noto, 'Noto Sans Oriya', sans-serif", lineHeightCompensation: 1.167 }, Jr = { baseFontFamily: "'Gurmukhi MN', 'Nirmala UI', Kartika, Roboto, Noto, 'Noto Sans Gurmukhi', sans-serif", lineHeightCompensation: 1.1 }, Zr = { baseFontFamily: "'Sinhala Sangam MN', 'Nirmala UI', 'Iskoola Pota', Roboto, Noto, 'Noto Sans Sinhala', sans-serif", lineHeightCompensation: 1.167 }, Qr = { baseFontFamily: "'Tamil Sangam MN', 'Nirmala UI', Latha, Roboto, Noto, 'Noto Sans Tamil', sans-serif", lineHeightCompensation: 1.067 }, to = { baseFontFamily: "'Kohinoor Telugu', 'Telugu Sangam MN', 'Nirmala UI', Gautami, Roboto, Noto, 'Noto Sans Telugu', sans-serif" }, eo = { baseFontFamily: "Thonburi, 'Leelawadee UI', 'Cordia New', Roboto, Noto, 'Noto Sans Thai', sans-serif", lineHeightCompensation: 1.067 }, io = { baseFontFamily: "'方体', 'PingFang SC', '黑体', 'Heiti SC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK SC', sans-serif", lineHeightCompensation: 1.167 }, so = {
|
|
5271
|
+
latin: Rr,
|
|
5272
5272
|
am: Mr,
|
|
5273
5273
|
ar: Nr,
|
|
5274
5274
|
bn: Ir,
|
|
5275
|
-
bo:
|
|
5276
|
-
chr:
|
|
5275
|
+
bo: Fr,
|
|
5276
|
+
chr: Dr,
|
|
5277
5277
|
fa: zr,
|
|
5278
5278
|
gu: Hr,
|
|
5279
5279
|
he: Wr,
|
|
@@ -5296,7 +5296,7 @@ const xr = { description: "Attempts to filter out paragraphs that are implicitly
|
|
|
5296
5296
|
"zh-Hant": { baseFontFamily: "'方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 },
|
|
5297
5297
|
"zh-TW": { baseFontFamily: "'方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 },
|
|
5298
5298
|
"zh-HK": { baseFontFamily: "'方體', 'PingFang HK', '方體', 'PingFang TC', '黑體', 'Heiti TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', Roboto, Noto, 'Noto Sans CJK TC', sans-serif", lineHeightCompensation: 1.167 }
|
|
5299
|
-
}, ai = kr,
|
|
5299
|
+
}, ai = kr, Ra = Ar, Ma = so;
|
|
5300
5300
|
var rt = /* @__PURE__ */ ((o) => (o.start = "start", o.left = "left", o.right = "right", o.justify = "justify", o))(rt || {});
|
|
5301
5301
|
const gt = {
|
|
5302
5302
|
range: [0, 100],
|
|
@@ -5485,7 +5485,7 @@ class $i {
|
|
|
5485
5485
|
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 ? (D.OS.iOS || D.OS.iPadOS) && D.iOSRequest === "mobile" : e.iOSPatch, this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : t.iPadOSPatch === !0 ? D.OS.iPadOS && D.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;
|
|
5486
5486
|
}
|
|
5487
5487
|
}
|
|
5488
|
-
class
|
|
5488
|
+
class F {
|
|
5489
5489
|
constructor({
|
|
5490
5490
|
initialValue: t = null,
|
|
5491
5491
|
effectiveValue: e,
|
|
@@ -5510,7 +5510,7 @@ class I {
|
|
|
5510
5510
|
this._value = null;
|
|
5511
5511
|
}
|
|
5512
5512
|
}
|
|
5513
|
-
class M extends
|
|
5513
|
+
class M extends F {
|
|
5514
5514
|
set value(t) {
|
|
5515
5515
|
this._value = t, this._onChange(this._value);
|
|
5516
5516
|
}
|
|
@@ -5530,7 +5530,7 @@ class M extends I {
|
|
|
5530
5530
|
this._value = !this._value, this._onChange(this._value);
|
|
5531
5531
|
}
|
|
5532
5532
|
}
|
|
5533
|
-
class li extends
|
|
5533
|
+
class li extends F {
|
|
5534
5534
|
constructor({
|
|
5535
5535
|
initialValue: t = null,
|
|
5536
5536
|
effectiveValue: e,
|
|
@@ -5561,7 +5561,7 @@ class li extends I {
|
|
|
5561
5561
|
this._value = null;
|
|
5562
5562
|
}
|
|
5563
5563
|
}
|
|
5564
|
-
class k extends
|
|
5564
|
+
class k extends F {
|
|
5565
5565
|
constructor({
|
|
5566
5566
|
initialValue: t = null,
|
|
5567
5567
|
effectiveValue: e,
|
|
@@ -5627,7 +5627,7 @@ class Yi {
|
|
|
5627
5627
|
) ?? !1;
|
|
5628
5628
|
}
|
|
5629
5629
|
get fontFamily() {
|
|
5630
|
-
return new
|
|
5630
|
+
return new F({
|
|
5631
5631
|
initialValue: this.preferences.fontFamily,
|
|
5632
5632
|
effectiveValue: this.settings.fontFamily || null,
|
|
5633
5633
|
isEffective: this.isDisplayTransformable,
|
|
@@ -5962,7 +5962,7 @@ class Qs {
|
|
|
5962
5962
|
}
|
|
5963
5963
|
}
|
|
5964
5964
|
}
|
|
5965
|
-
const Tt = (o) => o.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "),
|
|
5965
|
+
const Tt = (o) => o.replace(/\/\/.*/g, "").replace(/\/\*[\s\S]*?\*\//g, "").replace(/\n/g, "").replace(/\s+/g, " "), Ft = (o) => o.replace(/\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, "").replace(/ {2,}/g, " "), co = `/*!
|
|
5966
5966
|
* Readium CSS v.2.0.5
|
|
5967
5967
|
* Copyright (c) 2017–2026. Readium Foundation. All rights reserved.
|
|
5968
5968
|
* Use of this source code is governed by a BSD-style license which is detailed in the
|
|
@@ -6283,7 +6283,7 @@ function po(o) {
|
|
|
6283
6283
|
id: "readium-css-webpub",
|
|
6284
6284
|
as: "link",
|
|
6285
6285
|
target: "head",
|
|
6286
|
-
blob: new Blob([
|
|
6286
|
+
blob: new Blob([Ft(co)], { type: "text/css" }),
|
|
6287
6287
|
rel: "stylesheet"
|
|
6288
6288
|
}
|
|
6289
6289
|
];
|
|
@@ -6805,9 +6805,9 @@ class xo extends oi {
|
|
|
6805
6805
|
this.listeners.frameLoaded(this.framePool.currentFrames[0].iframe.contentWindow), this.listeners.positionChanged(this.currentLocation), this._reapplyDecorationsToCurrentFrame();
|
|
6806
6806
|
break;
|
|
6807
6807
|
case "first_visible_locator":
|
|
6808
|
-
const i =
|
|
6808
|
+
const i = I.deserialize(e);
|
|
6809
6809
|
if (!i) break;
|
|
6810
|
-
this.currentLocation = new
|
|
6810
|
+
this.currentLocation = new I({
|
|
6811
6811
|
href: this.currentLocation.href,
|
|
6812
6812
|
type: this.currentLocation.type,
|
|
6813
6813
|
title: this.currentLocation.title,
|
|
@@ -6817,7 +6817,7 @@ class xo extends oi {
|
|
|
6817
6817
|
break;
|
|
6818
6818
|
case "text_selected": {
|
|
6819
6819
|
const l = e;
|
|
6820
|
-
l.locator = new
|
|
6820
|
+
l.locator = new I({ href: this.currentLocation.href, type: this.currentLocation.type, text: new et({ highlight: l.text }) }), this.listeners.textSelected(l);
|
|
6821
6821
|
break;
|
|
6822
6822
|
}
|
|
6823
6823
|
case "decoration_activated": {
|
|
@@ -6853,8 +6853,8 @@ class xo extends oi {
|
|
|
6853
6853
|
if (c.startsWith("http://") || c.startsWith("https://"))
|
|
6854
6854
|
h = c;
|
|
6855
6855
|
else if (this.currentLocation.href.startsWith("http://") || this.currentLocation.href.startsWith("https://")) {
|
|
6856
|
-
const
|
|
6857
|
-
h = new URL(c,
|
|
6856
|
+
const u = new URL(this.currentLocation.href);
|
|
6857
|
+
h = new URL(c, u).href;
|
|
6858
6858
|
} else
|
|
6859
6859
|
h = re.join(re.dirname(this.currentLocation.href), c);
|
|
6860
6860
|
const d = this.pub.readingOrder.findWithHref(h);
|
|
@@ -7110,7 +7110,7 @@ class xo extends oi {
|
|
|
7110
7110
|
if (!e)
|
|
7111
7111
|
throw new Error("No current resource available");
|
|
7112
7112
|
const s = this.currentLocation && this.currentLocation.href === e.href && this.currentLocation.locations.progression ? this.currentLocation.locations.progression : 0;
|
|
7113
|
-
return this.pub.manifest.locatorFromLink(e) || new
|
|
7113
|
+
return this.pub.manifest.locatorFromLink(e) || new I({
|
|
7114
7114
|
href: e.href,
|
|
7115
7115
|
type: e.type || "text/html",
|
|
7116
7116
|
locations: new L({
|
|
@@ -7217,8 +7217,8 @@ class sn {
|
|
|
7217
7217
|
}), s.isHTML && this.pub.metadata.languages?.[0]) {
|
|
7218
7218
|
const d = this.pub.metadata.languages[0];
|
|
7219
7219
|
if (s === g.XHTML) {
|
|
7220
|
-
const
|
|
7221
|
-
f && !
|
|
7220
|
+
const u = t.documentElement.lang || t.documentElement.getAttribute("xml:lang"), f = t.body.lang || t.body.getAttribute("xml:lang");
|
|
7221
|
+
f && !u ? (t.documentElement.lang = f, t.documentElement.setAttribute("xml:lang", f), t.body.removeAttribute("xml:lang"), t.body.removeAttribute("lang")) : u || (t.documentElement.lang = d, t.documentElement.setAttribute("xml:lang", d));
|
|
7222
7222
|
} else s === g.HTML && !t.documentElement.lang && (t.documentElement.lang = d);
|
|
7223
7223
|
}
|
|
7224
7224
|
if (Lt(this.pub.metadata) === "rtl" && !t.documentElement.dir && !t.body.dir && (t.documentElement.dir = z.rtl), i !== void 0) {
|
|
@@ -7249,7 +7249,7 @@ class nn {
|
|
|
7249
7249
|
}
|
|
7250
7250
|
return;
|
|
7251
7251
|
}
|
|
7252
|
-
this.comms?.halt(), this.loader.destroy(), this.loader = new
|
|
7252
|
+
this.comms?.halt(), this.loader.destroy(), this.loader = new At(s, t), this.currModules = t, this.comms = void 0;
|
|
7253
7253
|
try {
|
|
7254
7254
|
e(s);
|
|
7255
7255
|
} catch {
|
|
@@ -7258,7 +7258,7 @@ class nn {
|
|
|
7258
7258
|
}
|
|
7259
7259
|
this.frame.onload = () => {
|
|
7260
7260
|
const s = this.frame.contentWindow;
|
|
7261
|
-
this.loader = new
|
|
7261
|
+
this.loader = new At(s, t), this.currModules = t;
|
|
7262
7262
|
try {
|
|
7263
7263
|
e(s);
|
|
7264
7264
|
} catch {
|
|
@@ -7364,29 +7364,29 @@ class ko {
|
|
|
7364
7364
|
const a = this.positions[r].href;
|
|
7365
7365
|
this.inprogress.has(a) && await this.inprogress.get(a);
|
|
7366
7366
|
const l = new Promise(async (c, h) => {
|
|
7367
|
-
const d = [],
|
|
7368
|
-
this.positions.forEach((
|
|
7369
|
-
(y > r + Ki || y < r - Ki) && (d.includes(
|
|
7370
|
-
}), d.forEach(async (
|
|
7371
|
-
|
|
7372
|
-
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((
|
|
7373
|
-
const f = async (
|
|
7374
|
-
if (this.pendingUpdates.has(
|
|
7375
|
-
const C = this.blobs.get(
|
|
7376
|
-
C && (C.reset(), this.blobs.delete(
|
|
7367
|
+
const d = [], u = [];
|
|
7368
|
+
this.positions.forEach((p, y) => {
|
|
7369
|
+
(y > r + Ki || y < r - Ki) && (d.includes(p.href) || d.push(p.href)), y < r + Ji && y > r - Ji && (u.includes(p.href) || u.push(p.href));
|
|
7370
|
+
}), d.forEach(async (p) => {
|
|
7371
|
+
u.includes(p) || this.pool.has(p) && (await this.pool.get(p)?.destroy(), this.pool.delete(p), this.pendingUpdates.has(p) && this.pendingUpdates.set(p, { inPool: !1 }));
|
|
7372
|
+
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((p) => p.reset()), this.blobs.clear()), this.currentBaseURL = t.baseURL, s && (this.blobs.forEach((p) => p.reset()), this.blobs.clear(), this.pendingUpdates.clear());
|
|
7373
|
+
const f = async (p) => {
|
|
7374
|
+
if (this.pendingUpdates.has(p) && this.pendingUpdates.get(p)?.inPool === !1) {
|
|
7375
|
+
const C = this.blobs.get(p);
|
|
7376
|
+
C && (C.reset(), this.blobs.delete(p), this.pendingUpdates.delete(p));
|
|
7377
7377
|
}
|
|
7378
|
-
if (this.pool.has(
|
|
7379
|
-
const C = this.pool.get(
|
|
7380
|
-
if (!this.blobs.has(
|
|
7381
|
-
await C.destroy(), this.pool.delete(
|
|
7378
|
+
if (this.pool.has(p)) {
|
|
7379
|
+
const C = this.pool.get(p);
|
|
7380
|
+
if (!this.blobs.has(p))
|
|
7381
|
+
await C.destroy(), this.pool.delete(p), this.pendingUpdates.delete(p);
|
|
7382
7382
|
else {
|
|
7383
7383
|
await C.load(i);
|
|
7384
7384
|
return;
|
|
7385
7385
|
}
|
|
7386
7386
|
}
|
|
7387
|
-
const y = t.readingOrder.findWithHref(
|
|
7387
|
+
const y = t.readingOrder.findWithHref(p);
|
|
7388
7388
|
if (!y) return;
|
|
7389
|
-
this.blobs.has(
|
|
7389
|
+
this.blobs.has(p) || this.blobs.set(p, new sn(
|
|
7390
7390
|
t,
|
|
7391
7391
|
this.currentBaseURL || "",
|
|
7392
7392
|
y,
|
|
@@ -7395,22 +7395,22 @@ class ko {
|
|
|
7395
7395
|
injector: this.injector
|
|
7396
7396
|
}
|
|
7397
7397
|
));
|
|
7398
|
-
const w = new nn(await this.blobs.get(
|
|
7399
|
-
return
|
|
7398
|
+
const w = new nn(await this.blobs.get(p).build(), this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
7399
|
+
return p !== a && await w.hide(), this.container.appendChild(w.iframe), await w.load(i), this.pool.set(p, w), w;
|
|
7400
7400
|
};
|
|
7401
7401
|
try {
|
|
7402
|
-
await Promise.all(
|
|
7403
|
-
} catch (
|
|
7404
|
-
h(
|
|
7402
|
+
await Promise.all(u.filter((p) => p === a).map((p) => f(p)));
|
|
7403
|
+
} catch (p) {
|
|
7404
|
+
h(p);
|
|
7405
7405
|
return;
|
|
7406
7406
|
}
|
|
7407
7407
|
if (n !== this.updateSequence) {
|
|
7408
7408
|
c();
|
|
7409
7409
|
return;
|
|
7410
7410
|
}
|
|
7411
|
-
Promise.all(
|
|
7412
|
-
const y = f(
|
|
7413
|
-
this.inprogress.set(
|
|
7411
|
+
Promise.all(u.filter((p) => p !== a).map(async (p) => {
|
|
7412
|
+
const y = f(p);
|
|
7413
|
+
this.inprogress.set(p, y), await y, this.inprogress.delete(p);
|
|
7414
7414
|
}));
|
|
7415
7415
|
const m = this.pool.get(a);
|
|
7416
7416
|
if (!m) {
|
|
@@ -7422,12 +7422,12 @@ class ko {
|
|
|
7422
7422
|
c();
|
|
7423
7423
|
return;
|
|
7424
7424
|
}
|
|
7425
|
-
const
|
|
7426
|
-
if (!
|
|
7425
|
+
const p = this.pool.get(a);
|
|
7426
|
+
if (!p) {
|
|
7427
7427
|
c();
|
|
7428
7428
|
return;
|
|
7429
7429
|
}
|
|
7430
|
-
if (await
|
|
7430
|
+
if (await p.load(i), n !== this.updateSequence) {
|
|
7431
7431
|
c();
|
|
7432
7432
|
return;
|
|
7433
7433
|
}
|
|
@@ -7535,7 +7535,7 @@ class rn {
|
|
|
7535
7535
|
};
|
|
7536
7536
|
}
|
|
7537
7537
|
}
|
|
7538
|
-
class
|
|
7538
|
+
class Ao {
|
|
7539
7539
|
constructor() {
|
|
7540
7540
|
this._DOM = {
|
|
7541
7541
|
show: !1,
|
|
@@ -7554,7 +7554,7 @@ class Ro {
|
|
|
7554
7554
|
}
|
|
7555
7555
|
}
|
|
7556
7556
|
const Zi = 6, Ie = 1.02, Qi = 50, U = () => typeof window.CSSTransformValue < "u";
|
|
7557
|
-
class
|
|
7557
|
+
class Ro {
|
|
7558
7558
|
constructor(t, e = !1) {
|
|
7559
7559
|
this.dragState = 0, this.minimumMoved = !1, this.pan = {
|
|
7560
7560
|
startX: 0,
|
|
@@ -7573,7 +7573,7 @@ class Ao {
|
|
|
7573
7573
|
target: { X: 0, Y: 0 },
|
|
7574
7574
|
touchN: 0,
|
|
7575
7575
|
startTranslate: { X: 0, Y: 0 }
|
|
7576
|
-
}, 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.dragTranslate = null, this.dragTransform = null, this.manager = t, this.coordinator = new rn(), this.attachEvents(), e && (this.debugger = new
|
|
7576
|
+
}, 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.dragTranslate = null, this.dragTransform = null, this.manager = t, this.coordinator = new rn(), this.attachEvents(), e && (this.debugger = new Ao());
|
|
7577
7577
|
}
|
|
7578
7578
|
get scale() {
|
|
7579
7579
|
return this._scale;
|
|
@@ -7713,8 +7713,8 @@ class Ao {
|
|
|
7713
7713
|
c += l.X / this.scale, this.pinch.target.X += c, l.X += this.pinch.target.X * this.scale / this.pinch.startScale;
|
|
7714
7714
|
let h = -l.Y / n;
|
|
7715
7715
|
h += l.Y / this.scale, this.pinch.target.Y += h, l.Y += this.pinch.target.Y * this.scale / this.pinch.startScale;
|
|
7716
|
-
let d = (l.X - (this.pan.startX - this.manager.width / 2)) * 1 / this.scale,
|
|
7717
|
-
this.pan.translateX = d, this.pan.translateY =
|
|
7716
|
+
let d = (l.X - (this.pan.startX - this.manager.width / 2)) * 1 / this.scale, u = (l.Y - (this.pan.startY - this.manager.height / 2)) * 1 / this.scale;
|
|
7717
|
+
this.pan.translateX = d, this.pan.translateY = u, this.debugger?.show && (this.debugger.DOM.pinchTarget.style.left = `${this.pinch.target.X * this.scale / this.pinch.startScale - 5 + this.manager.width / 2}px`, this.debugger.DOM.pinchTarget.style.top = `${this.pinch.target.Y * this.scale / this.pinch.startScale - 5 + this.manager.height / 2}px`, this.debugger.DOM.pinchTarget.innerText = `${(this.pinch.target.X * this.scale / this.pinch.startScale).toFixed(2)},${(this.pinch.target.Y * this.scale / this.pinch.startScale).toFixed(2)}`);
|
|
7718
7718
|
}
|
|
7719
7719
|
const r = this.frameBounds.width / 6, a = this.frameBounds.height / 6;
|
|
7720
7720
|
this.pan.translateX < -r && (this.pan.overscrollX = -(r + this.pan.translateX), this.pan.translateX = -r), this.pan.translateY < -a && (this.pan.overscrollY = -(a + this.pan.translateY), this.pan.translateY = -a), this.pan.translateX > r && (this.pan.overscrollX = r - this.pan.translateX, this.pan.translateX = r), this.pan.translateY > a && (this.pan.overscrollY = a - this.pan.translateY, this.pan.translateY = a), s = !0, this.debugger?.show && (this.debugger.DOM.stats.innerText = `TX: ${this.pan.translateX.toFixed(2)}
|
|
@@ -7789,7 +7789,7 @@ class Mo {
|
|
|
7789
7789
|
}
|
|
7790
7790
|
return;
|
|
7791
7791
|
}
|
|
7792
|
-
this.comms?.halt(), this.loader.destroy(), this.loader = new
|
|
7792
|
+
this.comms?.halt(), this.loader.destroy(), this.loader = new At(n, t), this.currModules = t, this.comms = void 0;
|
|
7793
7793
|
try {
|
|
7794
7794
|
i(n), this.loadPromise = void 0;
|
|
7795
7795
|
} catch {
|
|
@@ -7798,7 +7798,7 @@ class Mo {
|
|
|
7798
7798
|
}
|
|
7799
7799
|
this.frame.addEventListener("load", () => {
|
|
7800
7800
|
const n = this.frame.contentWindow;
|
|
7801
|
-
this.loader = new
|
|
7801
|
+
this.loader = new At(n, t), this.currModules = t, this.peripherals.observe(this.wrapper), this.peripherals.observe(n);
|
|
7802
7802
|
try {
|
|
7803
7803
|
i(n);
|
|
7804
7804
|
} catch {
|
|
@@ -8015,12 +8015,12 @@ class No {
|
|
|
8015
8015
|
return this.spreads.find((e) => e.includes(t)) || void 0;
|
|
8016
8016
|
}
|
|
8017
8017
|
}
|
|
8018
|
-
const ts = 8, es = 5, Io = 300,
|
|
8018
|
+
const ts = 8, es = 5, Io = 300, Fo = 15e3, Do = 250, is = 150, ss = 500;
|
|
8019
8019
|
class zo {
|
|
8020
8020
|
constructor(t, e, i, s, n, r, a) {
|
|
8021
8021
|
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.currentSlide = 0, this.spread = !0, this.orientationInternal = -1, this.bookScale = null, this.bookTranslate = null, this.bookTransform = null, this.container = t, this.positions = e, this.pub = i, this.injector = n ?? null, this.contentProtectionConfig = r || {}, this.keyboardPeripheralsConfig = a || [], this.spreadPresentation = i.metadata.otherMetadata?.spread || ye.auto, this.pub.metadata.effectiveReadingProgression !== z.rtl && this.pub.metadata.effectiveReadingProgression !== z.ltr)
|
|
8022
8022
|
throw Error("Unsupported reading progression for fixed-layout EPUB");
|
|
8023
|
-
this.spreader = new No(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
|
|
8023
|
+
this.spreader = new No(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 Ro(this);
|
|
8024
8024
|
const l = document.createDocumentFragment();
|
|
8025
8025
|
this.pub.readingOrder.items.forEach((c) => {
|
|
8026
8026
|
const h = new Mo(this.peripherals, this.pub.metadata.effectiveReadingProgression, c.href, this.contentProtectionConfig, this.keyboardPeripheralsConfig);
|
|
@@ -8050,7 +8050,7 @@ class zo {
|
|
|
8050
8050
|
n.update(this.spreadPosition(l, a));
|
|
8051
8051
|
});
|
|
8052
8052
|
});
|
|
8053
|
-
},
|
|
8053
|
+
}, Do);
|
|
8054
8054
|
}
|
|
8055
8055
|
/**
|
|
8056
8056
|
* It is important that these values be cached to avoid spamming them on redraws, they are expensive.
|
|
@@ -8235,49 +8235,49 @@ class zo {
|
|
|
8235
8235
|
await this.waitForItem(l.href);
|
|
8236
8236
|
const a = new Promise(async (l, c) => {
|
|
8237
8237
|
const h = [], d = [];
|
|
8238
|
-
this.positions.forEach((
|
|
8239
|
-
(y > n + ts || y < n - ts) && (h.includes(
|
|
8240
|
-
}), h.forEach(async (
|
|
8241
|
-
d.includes(
|
|
8242
|
-
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((
|
|
8243
|
-
const
|
|
8244
|
-
const y = t.readingOrder.findIndexWithHref(
|
|
8245
|
-
w && (this.blobs.has(
|
|
8238
|
+
this.positions.forEach((p, y) => {
|
|
8239
|
+
(y > n + ts || y < n - ts) && (h.includes(p.href) || h.push(p.href)), y < n + es && y > n - es && (d.includes(p.href) || d.push(p.href));
|
|
8240
|
+
}), h.forEach(async (p) => {
|
|
8241
|
+
d.includes(p) || this.pool.has(p) && (this.cancelShowing(p), await this.pool.get(p)?.unload(), this.blobs.get(p)?.reset());
|
|
8242
|
+
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((p) => p.reset()), this.blobs.clear()), this.currentBaseURL = t.baseURL;
|
|
8243
|
+
const u = async (p) => {
|
|
8244
|
+
const y = t.readingOrder.findIndexWithHref(p), w = t.readingOrder.items[y];
|
|
8245
|
+
w && (this.blobs.has(p) || this.blobs.set(p, new sn(
|
|
8246
8246
|
t,
|
|
8247
8247
|
this.currentBaseURL || "",
|
|
8248
8248
|
w,
|
|
8249
8249
|
{
|
|
8250
8250
|
injector: this.injector
|
|
8251
8251
|
}
|
|
8252
|
-
)), this.delayedShow.has(
|
|
8252
|
+
)), this.delayedShow.has(p) || this.delayedShow.set(p, new Promise((C, T) => {
|
|
8253
8253
|
let K = !1;
|
|
8254
8254
|
const ft = window.setTimeout(async () => {
|
|
8255
|
-
this.delayedTimeout.set(
|
|
8256
|
-
const cn = this.makeSpread(this.reAlign(y)), dn = this.spreadPosition(cn, w), ui = this.pool.get(
|
|
8257
|
-
await ui.load(i, await this.blobs.get(
|
|
8255
|
+
this.delayedTimeout.set(p, 0);
|
|
8256
|
+
const cn = this.makeSpread(this.reAlign(y)), dn = this.spreadPosition(cn, w), ui = this.pool.get(p);
|
|
8257
|
+
await ui.load(i, await this.blobs.get(p).build(!0)), this.peripherals.isScaled || await ui.show(dn), this.delayedShow.delete(p), K = !0, C();
|
|
8258
8258
|
}, Io);
|
|
8259
8259
|
setTimeout(() => {
|
|
8260
|
-
!K && this.delayedShow.has(
|
|
8261
|
-
},
|
|
8260
|
+
!K && this.delayedShow.has(p) && T(`Offscreen load timeout: ${p}`);
|
|
8261
|
+
}, Fo), this.delayedTimeout.set(p, ft);
|
|
8262
8262
|
})));
|
|
8263
8263
|
};
|
|
8264
8264
|
try {
|
|
8265
|
-
await Promise.all(d.map((
|
|
8266
|
-
} catch (
|
|
8267
|
-
c(
|
|
8265
|
+
await Promise.all(d.map((p) => u(p)));
|
|
8266
|
+
} catch (p) {
|
|
8267
|
+
c(p);
|
|
8268
8268
|
}
|
|
8269
8269
|
const f = [];
|
|
8270
|
-
for (const
|
|
8271
|
-
const y = this.pool.get(
|
|
8272
|
-
w && (this.cancelShowing(
|
|
8270
|
+
for (const p of r) {
|
|
8271
|
+
const y = this.pool.get(p.href), w = this.blobs.get(p.href);
|
|
8272
|
+
w && (this.cancelShowing(p.href), await y.load(i, await w.build(!0)), await y.show(this.spreadPosition(r, p)), this.previousFrames.push(y), await y.activate(), f.push(y));
|
|
8273
8273
|
}
|
|
8274
8274
|
for (; this.previousFrames.length > 0; ) {
|
|
8275
|
-
const
|
|
8276
|
-
|
|
8275
|
+
const p = this.previousFrames.shift();
|
|
8276
|
+
p && !f.includes(p) && await p.unfocus();
|
|
8277
8277
|
}
|
|
8278
8278
|
this.previousFrames = f;
|
|
8279
8279
|
const m = this.container.ownerDocument.activeElement;
|
|
8280
|
-
m && m.tagName === "IFRAME" && !f.some((
|
|
8280
|
+
m && m.tagName === "IFRAME" && !f.some((p) => p.iframe === m) && f[0]?.iframe.focus({ preventScroll: !0 }), l();
|
|
8281
8281
|
});
|
|
8282
8282
|
for (const l of r)
|
|
8283
8283
|
this.inprogress.set(l.href, a);
|
|
@@ -8382,7 +8382,7 @@ class ns {
|
|
|
8382
8382
|
this.preferences[t] = e;
|
|
8383
8383
|
}
|
|
8384
8384
|
get backgroundColor() {
|
|
8385
|
-
return new
|
|
8385
|
+
return new F({
|
|
8386
8386
|
initialValue: this.preferences.backgroundColor,
|
|
8387
8387
|
effectiveValue: this.settings.backgroundColor || bt.backgroundColor,
|
|
8388
8388
|
isEffective: this.preferences.backgroundColor !== null,
|
|
@@ -8402,7 +8402,7 @@ class ns {
|
|
|
8402
8402
|
});
|
|
8403
8403
|
}
|
|
8404
8404
|
get columnCount() {
|
|
8405
|
-
return new
|
|
8405
|
+
return new F({
|
|
8406
8406
|
initialValue: this.preferences.columnCount,
|
|
8407
8407
|
effectiveValue: this.settings.columnCount || null,
|
|
8408
8408
|
isEffective: this.layout !== S.fixed && !this.settings.scroll,
|
|
@@ -8412,7 +8412,7 @@ class ns {
|
|
|
8412
8412
|
});
|
|
8413
8413
|
}
|
|
8414
8414
|
get constraint() {
|
|
8415
|
-
return new
|
|
8415
|
+
return new F({
|
|
8416
8416
|
initialValue: this.preferences.constraint,
|
|
8417
8417
|
effectiveValue: this.preferences.constraint || 0,
|
|
8418
8418
|
isEffective: !0,
|
|
@@ -8444,7 +8444,7 @@ class ns {
|
|
|
8444
8444
|
});
|
|
8445
8445
|
}
|
|
8446
8446
|
get fontFamily() {
|
|
8447
|
-
return new
|
|
8447
|
+
return new F({
|
|
8448
8448
|
initialValue: this.preferences.fontFamily,
|
|
8449
8449
|
effectiveValue: this.settings.fontFamily || null,
|
|
8450
8450
|
isEffective: this.layout !== S.fixed,
|
|
@@ -8603,7 +8603,7 @@ class ns {
|
|
|
8603
8603
|
});
|
|
8604
8604
|
}
|
|
8605
8605
|
get linkColor() {
|
|
8606
|
-
return new
|
|
8606
|
+
return new F({
|
|
8607
8607
|
initialValue: this.preferences.linkColor,
|
|
8608
8608
|
effectiveValue: this.settings.linkColor || bt.linkColor,
|
|
8609
8609
|
isEffective: this.layout !== S.fixed && this.preferences.linkColor !== null,
|
|
@@ -8659,7 +8659,7 @@ class ns {
|
|
|
8659
8659
|
});
|
|
8660
8660
|
}
|
|
8661
8661
|
get pageGutter() {
|
|
8662
|
-
return new
|
|
8662
|
+
return new F({
|
|
8663
8663
|
initialValue: this.preferences.pageGutter,
|
|
8664
8664
|
effectiveValue: this.settings.pageGutter,
|
|
8665
8665
|
isEffective: this.layout !== S.fixed && !this.settings.scroll,
|
|
@@ -8703,7 +8703,7 @@ class ns {
|
|
|
8703
8703
|
});
|
|
8704
8704
|
}
|
|
8705
8705
|
get scrollPaddingTop() {
|
|
8706
|
-
return new
|
|
8706
|
+
return new F({
|
|
8707
8707
|
initialValue: this.preferences.scrollPaddingTop,
|
|
8708
8708
|
effectiveValue: this.settings.scrollPaddingTop || 0,
|
|
8709
8709
|
isEffective: this.layout !== S.fixed && !!this.settings.scroll && this.preferences.scrollPaddingTop !== null,
|
|
@@ -8713,7 +8713,7 @@ class ns {
|
|
|
8713
8713
|
});
|
|
8714
8714
|
}
|
|
8715
8715
|
get scrollPaddingBottom() {
|
|
8716
|
-
return new
|
|
8716
|
+
return new F({
|
|
8717
8717
|
initialValue: this.preferences.scrollPaddingBottom,
|
|
8718
8718
|
effectiveValue: this.settings.scrollPaddingBottom || 0,
|
|
8719
8719
|
isEffective: this.layout !== S.fixed && !!this.settings.scroll && this.preferences.scrollPaddingBottom !== null,
|
|
@@ -8723,7 +8723,7 @@ class ns {
|
|
|
8723
8723
|
});
|
|
8724
8724
|
}
|
|
8725
8725
|
get scrollPaddingLeft() {
|
|
8726
|
-
return new
|
|
8726
|
+
return new F({
|
|
8727
8727
|
initialValue: this.preferences.scrollPaddingLeft,
|
|
8728
8728
|
effectiveValue: this.settings.scrollPaddingLeft || 0,
|
|
8729
8729
|
isEffective: this.layout !== S.fixed && !!this.settings.scroll && this.preferences.scrollPaddingLeft !== null,
|
|
@@ -8733,7 +8733,7 @@ class ns {
|
|
|
8733
8733
|
});
|
|
8734
8734
|
}
|
|
8735
8735
|
get scrollPaddingRight() {
|
|
8736
|
-
return new
|
|
8736
|
+
return new F({
|
|
8737
8737
|
initialValue: this.preferences.scrollPaddingRight,
|
|
8738
8738
|
effectiveValue: this.settings.scrollPaddingRight || 0,
|
|
8739
8739
|
isEffective: this.layout !== S.fixed && !!this.settings.scroll && this.preferences.scrollPaddingRight !== null,
|
|
@@ -8743,7 +8743,7 @@ class ns {
|
|
|
8743
8743
|
});
|
|
8744
8744
|
}
|
|
8745
8745
|
get selectionBackgroundColor() {
|
|
8746
|
-
return new
|
|
8746
|
+
return new F({
|
|
8747
8747
|
initialValue: this.preferences.selectionBackgroundColor,
|
|
8748
8748
|
effectiveValue: this.settings.selectionBackgroundColor || bt.selectionBackgroundColor,
|
|
8749
8749
|
isEffective: this.layout !== S.fixed && this.preferences.selectionBackgroundColor !== null,
|
|
@@ -8753,7 +8753,7 @@ class ns {
|
|
|
8753
8753
|
});
|
|
8754
8754
|
}
|
|
8755
8755
|
get selectionTextColor() {
|
|
8756
|
-
return new
|
|
8756
|
+
return new F({
|
|
8757
8757
|
initialValue: this.preferences.selectionTextColor,
|
|
8758
8758
|
effectiveValue: this.settings.selectionTextColor || bt.selectionTextColor,
|
|
8759
8759
|
isEffective: this.layout !== S.fixed && this.preferences.selectionTextColor !== null,
|
|
@@ -8774,7 +8774,7 @@ class ns {
|
|
|
8774
8774
|
});
|
|
8775
8775
|
}
|
|
8776
8776
|
get textColor() {
|
|
8777
|
-
return new
|
|
8777
|
+
return new F({
|
|
8778
8778
|
initialValue: this.preferences.textColor,
|
|
8779
8779
|
effectiveValue: this.settings.textColor || bt.textColor,
|
|
8780
8780
|
isEffective: this.layout !== S.fixed && this.preferences.textColor !== null,
|
|
@@ -8794,7 +8794,7 @@ class ns {
|
|
|
8794
8794
|
});
|
|
8795
8795
|
}
|
|
8796
8796
|
get visitedColor() {
|
|
8797
|
-
return new
|
|
8797
|
+
return new F({
|
|
8798
8798
|
initialValue: this.preferences.visitedColor,
|
|
8799
8799
|
effectiveValue: this.settings.visitedColor || bt.visitedColor,
|
|
8800
8800
|
isEffective: this.layout !== S.fixed && this.preferences.visitedColor !== null,
|
|
@@ -8919,47 +8919,47 @@ class Go {
|
|
|
8919
8919
|
// should be the same as uncompensated when scale >= 1
|
|
8920
8920
|
paginate(t, e, i) {
|
|
8921
8921
|
const s = Math.round(Ct(this.containerParent) - this.constraint), n = this.getCompensatedMetrics(t, e), { zoomCompensation: r, optimal: a, minimal: l, maximal: c } = n, h = () => s >= a && c !== null ? Math.min(Math.round(c * r), s) : s;
|
|
8922
|
-
let d = 1,
|
|
8922
|
+
let d = 1, u = s;
|
|
8923
8923
|
if (i === void 0)
|
|
8924
8924
|
return {
|
|
8925
8925
|
colCount: void 0,
|
|
8926
|
-
effectiveContainerWidth:
|
|
8927
|
-
effectiveLineLength: Math.round(
|
|
8926
|
+
effectiveContainerWidth: u,
|
|
8927
|
+
effectiveLineLength: Math.round(u / d * r)
|
|
8928
8928
|
};
|
|
8929
8929
|
if (i === null)
|
|
8930
8930
|
if (s >= a && c !== null) {
|
|
8931
8931
|
d = Math.floor(s / a);
|
|
8932
8932
|
const f = Math.round(d * (c * r));
|
|
8933
|
-
|
|
8933
|
+
u = Math.min(f, s);
|
|
8934
8934
|
} else
|
|
8935
|
-
|
|
8935
|
+
u = h();
|
|
8936
8936
|
else if (i > 1) {
|
|
8937
8937
|
const f = Math.round(i * (l !== null ? l : a));
|
|
8938
8938
|
if (s >= f)
|
|
8939
8939
|
if (d = i, c === null)
|
|
8940
|
-
|
|
8940
|
+
u = s;
|
|
8941
8941
|
else {
|
|
8942
8942
|
const m = Math.round(d * (c * r));
|
|
8943
|
-
|
|
8943
|
+
u = Math.min(m, s);
|
|
8944
8944
|
}
|
|
8945
8945
|
else if (l !== null && s < Math.round(i * l))
|
|
8946
8946
|
if (d = Math.floor(s / l), d <= 1)
|
|
8947
|
-
d = 1,
|
|
8947
|
+
d = 1, u = h();
|
|
8948
8948
|
else {
|
|
8949
8949
|
const m = Math.round(d * (a * r));
|
|
8950
|
-
|
|
8950
|
+
u = Math.min(m, s);
|
|
8951
8951
|
}
|
|
8952
8952
|
else {
|
|
8953
8953
|
d = i;
|
|
8954
8954
|
const m = Math.round(d * (a * r));
|
|
8955
|
-
|
|
8955
|
+
u = Math.min(m, s);
|
|
8956
8956
|
}
|
|
8957
8957
|
} else
|
|
8958
|
-
d = 1,
|
|
8958
|
+
d = 1, u = h();
|
|
8959
8959
|
return {
|
|
8960
8960
|
colCount: d,
|
|
8961
|
-
effectiveContainerWidth:
|
|
8962
|
-
effectiveLineLength: Math.round(
|
|
8961
|
+
effectiveContainerWidth: u,
|
|
8962
|
+
effectiveLineLength: Math.round(u / d / (t && t >= 1 ? t : 1) * r)
|
|
8963
8963
|
};
|
|
8964
8964
|
}
|
|
8965
8965
|
computeCJKVerticalLength(t, e) {
|
|
@@ -9088,21 +9088,21 @@ async function Ko(o, t) {
|
|
|
9088
9088
|
let l, c, h;
|
|
9089
9089
|
switch (a) {
|
|
9090
9090
|
case "rtl": {
|
|
9091
|
-
const [d,
|
|
9091
|
+
const [d, u, f] = await Promise.all([
|
|
9092
9092
|
import("./ReadiumCSS-before-DwBLxUVH.js"),
|
|
9093
9093
|
import("./ReadiumCSS-default-BhdLiyWp.js"),
|
|
9094
9094
|
import("./ReadiumCSS-after-d5mC4cme.js")
|
|
9095
9095
|
]);
|
|
9096
|
-
l = d.default, c =
|
|
9096
|
+
l = d.default, c = u.default, h = f.default;
|
|
9097
9097
|
break;
|
|
9098
9098
|
}
|
|
9099
9099
|
case "cjk-horizontal": {
|
|
9100
|
-
const [d,
|
|
9100
|
+
const [d, u, f] = await Promise.all([
|
|
9101
9101
|
import("./ReadiumCSS-before-CG-KmDa3.js"),
|
|
9102
9102
|
import("./ReadiumCSS-default-N65xNiIp.js"),
|
|
9103
9103
|
import("./ReadiumCSS-after-XUKPAxfT.js")
|
|
9104
9104
|
]);
|
|
9105
|
-
l = d.default, c =
|
|
9105
|
+
l = d.default, c = u.default, h = f.default;
|
|
9106
9106
|
break;
|
|
9107
9107
|
}
|
|
9108
9108
|
case "cjk-vertical":
|
|
@@ -9110,21 +9110,21 @@ async function Ko(o, t) {
|
|
|
9110
9110
|
// layout as CJK vertical-rl — it is an outlier handled by the
|
|
9111
9111
|
// same stylesheet set per the Readium CSS spec.
|
|
9112
9112
|
case "mongolian-vertical": {
|
|
9113
|
-
const [d,
|
|
9113
|
+
const [d, u, f] = await Promise.all([
|
|
9114
9114
|
import("./ReadiumCSS-before-BNTwR8Qm.js"),
|
|
9115
9115
|
import("./ReadiumCSS-default-BesyZHRU.js"),
|
|
9116
9116
|
import("./ReadiumCSS-after-ClF4TBzj.js")
|
|
9117
9117
|
]);
|
|
9118
|
-
l = d.default, c =
|
|
9118
|
+
l = d.default, c = u.default, h = f.default;
|
|
9119
9119
|
break;
|
|
9120
9120
|
}
|
|
9121
9121
|
default: {
|
|
9122
|
-
const [d,
|
|
9122
|
+
const [d, u, f] = await Promise.all([
|
|
9123
9123
|
import("./ReadiumCSS-before-8FMq19-x.js"),
|
|
9124
9124
|
import("./ReadiumCSS-default-AIAk8uwU.js"),
|
|
9125
9125
|
import("./ReadiumCSS-after-D7unrNI9.js")
|
|
9126
9126
|
]);
|
|
9127
|
-
l = d.default, c =
|
|
9127
|
+
l = d.default, c = u.default, h = f.default;
|
|
9128
9128
|
break;
|
|
9129
9129
|
}
|
|
9130
9130
|
}
|
|
@@ -9132,7 +9132,7 @@ async function Ko(o, t) {
|
|
|
9132
9132
|
id: "readium-css-before",
|
|
9133
9133
|
as: "link",
|
|
9134
9134
|
target: "head",
|
|
9135
|
-
blob: new Blob([
|
|
9135
|
+
blob: new Blob([Ft(l)], { type: "text/css" }),
|
|
9136
9136
|
rel: "stylesheet"
|
|
9137
9137
|
}), r.unshift(
|
|
9138
9138
|
// Readium CSS Default - only for reflowable AND no existing styles
|
|
@@ -9140,7 +9140,7 @@ async function Ko(o, t) {
|
|
|
9140
9140
|
id: "readium-css-default",
|
|
9141
9141
|
as: "link",
|
|
9142
9142
|
target: "head",
|
|
9143
|
-
blob: new Blob([
|
|
9143
|
+
blob: new Blob([Ft(c)], { type: "text/css" }),
|
|
9144
9144
|
rel: "stylesheet",
|
|
9145
9145
|
condition: (d) => !(d.querySelector("link[rel='stylesheet']") || d.querySelector("style") || d.querySelector("[style]:not([style=''])"))
|
|
9146
9146
|
},
|
|
@@ -9149,16 +9149,16 @@ async function Ko(o, t) {
|
|
|
9149
9149
|
id: "readium-css-after",
|
|
9150
9150
|
as: "link",
|
|
9151
9151
|
target: "head",
|
|
9152
|
-
blob: new Blob([
|
|
9152
|
+
blob: new Blob([Ft(h)], { type: "text/css" }),
|
|
9153
9153
|
rel: "stylesheet"
|
|
9154
9154
|
}
|
|
9155
9155
|
), (a === "cjk-horizontal" || a === "cjk-vertical") && (o.description === "ebpaj-guide-1.0" || o.otherMetadata?.["ebpaj:guide-version"] !== void 0)) {
|
|
9156
|
-
const { default:
|
|
9156
|
+
const { default: u } = await import("./ReadiumCSS-ebpaj_fonts_patch-Dt2XliTg.js");
|
|
9157
9157
|
r.push({
|
|
9158
9158
|
id: "readium-css-ebpaj",
|
|
9159
9159
|
as: "link",
|
|
9160
9160
|
target: "head",
|
|
9161
|
-
blob: new Blob([
|
|
9161
|
+
blob: new Blob([Ft(u)], { type: "text/css" }),
|
|
9162
9162
|
rel: "stylesheet"
|
|
9163
9163
|
});
|
|
9164
9164
|
}
|
|
@@ -9203,7 +9203,7 @@ class an extends oi {
|
|
|
9203
9203
|
progressions: /* @__PURE__ */ new Map(),
|
|
9204
9204
|
positions: null
|
|
9205
9205
|
}, this.pub = e, this.container = t, this.listeners = Jo(i), this.currentLocation = n, s.length && (this.positions = s), this._preferences = new Yt(r.preferences), this._defaults = new Ho(r.defaults), this._settings = new rs(this._preferences, this._defaults);
|
|
9206
|
-
const a = Lt(e.metadata), l = a === "cjk-horizontal", c = a === "cjk-vertical", d = c || a === "mongolian-vertical",
|
|
9206
|
+
const a = Lt(e.metadata), l = a === "cjk-horizontal", c = a === "cjk-vertical", d = c || a === "mongolian-vertical", u = l || c;
|
|
9207
9207
|
this._css = new Go({
|
|
9208
9208
|
rsProperties: new jo({ noVerticalPagination: d || void 0 }),
|
|
9209
9209
|
userProperties: new on({}),
|
|
@@ -9215,7 +9215,7 @@ class an extends oi {
|
|
|
9215
9215
|
fontFace: this._settings.fontFamily,
|
|
9216
9216
|
letterSpacing: this._settings.letterSpacing,
|
|
9217
9217
|
wordSpacing: this._settings.wordSpacing,
|
|
9218
|
-
isCJK:
|
|
9218
|
+
isCJK: u
|
|
9219
9219
|
// sample: this.pub.metadata.description
|
|
9220
9220
|
}),
|
|
9221
9221
|
container: t,
|
|
@@ -9225,8 +9225,8 @@ class an extends oi {
|
|
|
9225
9225
|
this._contentProtection,
|
|
9226
9226
|
r.keyboardPeripherals || []
|
|
9227
9227
|
), (this._contentProtection.disableContextMenu || this._contentProtection.checkAutomation || this._contentProtection.checkIFrameEmbedding || this._contentProtection.monitorDevTools || this._contentProtection.protectPrinting?.disable) && (this._navigatorProtector = new Ce(this._contentProtection), this._suspiciousActivityListener = (f) => {
|
|
9228
|
-
const { type: m, ...
|
|
9229
|
-
m === "context_menu" ? this.listeners.contextMenu(
|
|
9228
|
+
const { type: m, ...p } = f.detail;
|
|
9229
|
+
m === "context_menu" ? this.listeners.contextMenu(p) : this.listeners.contentProtection(m, p);
|
|
9230
9230
|
}, window.addEventListener(ot, this._suspiciousActivityListener)), this._keyboardPeripherals.length > 0 && (this._keyboardPeripheralsManager = new _e({
|
|
9231
9231
|
keyboardPeripherals: this._keyboardPeripherals
|
|
9232
9232
|
}), this._keyboardPeripheralListener = (f) => {
|
|
@@ -9363,15 +9363,15 @@ class an extends oi {
|
|
|
9363
9363
|
switch (t) {
|
|
9364
9364
|
case "_pong":
|
|
9365
9365
|
if (this.listeners.frameLoaded(this._cframes[0].iframe.contentWindow), this.listeners.positionChanged(this.currentLocation), i) {
|
|
9366
|
-
const h = this._cframes.filter((
|
|
9366
|
+
const h = this._cframes.filter((u) => !!u).indexOf(i), d = h >= 0 ? this.viewport.readingOrder[h] : void 0;
|
|
9367
9367
|
d && this._reapplyDecorationsToFrame(i, d);
|
|
9368
9368
|
} else
|
|
9369
9369
|
this._reapplyDecorationsToCurrentFrames();
|
|
9370
9370
|
break;
|
|
9371
9371
|
case "first_visible_locator":
|
|
9372
|
-
const s =
|
|
9372
|
+
const s = I.deserialize(e);
|
|
9373
9373
|
if (!s) break;
|
|
9374
|
-
this.currentLocation = new
|
|
9374
|
+
this.currentLocation = new I({
|
|
9375
9375
|
href: this.currentLocation.href,
|
|
9376
9376
|
type: this.currentLocation.type,
|
|
9377
9377
|
title: this.currentLocation.title,
|
|
@@ -9382,10 +9382,10 @@ class an extends oi {
|
|
|
9382
9382
|
case "text_selected": {
|
|
9383
9383
|
const c = e;
|
|
9384
9384
|
if (i) {
|
|
9385
|
-
const d = this._cframes.filter((f) => !!f).indexOf(i),
|
|
9386
|
-
if (
|
|
9387
|
-
const f = this.pub.readingOrder.findWithHref(
|
|
9388
|
-
c.locator = new
|
|
9385
|
+
const d = this._cframes.filter((f) => !!f).indexOf(i), u = d >= 0 ? this.viewport.readingOrder[d] : void 0;
|
|
9386
|
+
if (u) {
|
|
9387
|
+
const f = this.pub.readingOrder.findWithHref(u);
|
|
9388
|
+
c.locator = new I({ href: u, type: f.type || "application/xhtml+xml", text: new et({ highlight: c.text }) });
|
|
9389
9389
|
}
|
|
9390
9390
|
}
|
|
9391
9391
|
this.listeners.textSelected(c);
|
|
@@ -9542,14 +9542,14 @@ class an extends oi {
|
|
|
9542
9542
|
if (!c.msg) return;
|
|
9543
9543
|
const d = l[h];
|
|
9544
9544
|
if (d) {
|
|
9545
|
-
for (const
|
|
9546
|
-
const f = a.get(
|
|
9547
|
-
!f || f.locator.href !== d || c.msg.send("decorate", { group: t, action: "remove", decoration: { id:
|
|
9545
|
+
for (const u of e) {
|
|
9546
|
+
const f = a.get(u);
|
|
9547
|
+
!f || f.locator.href !== d || c.msg.send("decorate", { group: t, action: "remove", decoration: { id: u } });
|
|
9548
9548
|
}
|
|
9549
|
-
for (const
|
|
9550
|
-
|
|
9551
|
-
for (const
|
|
9552
|
-
|
|
9549
|
+
for (const u of i)
|
|
9550
|
+
u.locator.href === d && c.msg.send("decorate", { group: t, action: "add", decoration: xt(u, this._decoratorConfig.decorationTemplates) });
|
|
9551
|
+
for (const u of s)
|
|
9552
|
+
u.locator.href === d && c.msg.send("decorate", { group: t, action: "update", decoration: xt(u, this._decoratorConfig.decorationTemplates) });
|
|
9553
9553
|
}
|
|
9554
9554
|
});
|
|
9555
9555
|
}
|
|
@@ -10950,7 +10950,7 @@ class ws {
|
|
|
10950
10950
|
return this.metadata.effectiveLayout === S.scrolled;
|
|
10951
10951
|
}
|
|
10952
10952
|
get backgroundColor() {
|
|
10953
|
-
return new
|
|
10953
|
+
return new F({
|
|
10954
10954
|
initialValue: this.preferences.backgroundColor,
|
|
10955
10955
|
effectiveValue: this.settings.backgroundColor,
|
|
10956
10956
|
isEffective: !0,
|
|
@@ -11590,7 +11590,7 @@ class ci {
|
|
|
11590
11590
|
}
|
|
11591
11591
|
class Ca {
|
|
11592
11592
|
constructor(t) {
|
|
11593
|
-
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;
|
|
11593
|
+
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.mseLoader = null, this.currentHref = "", 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.mseLoaderFactory = t.mseLoaderFactory ?? null, 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;
|
|
11594
11594
|
}
|
|
11595
11595
|
/**
|
|
11596
11596
|
* Adds an event listener to the audio engine.
|
|
@@ -11789,6 +11789,12 @@ class Ca {
|
|
|
11789
11789
|
*/
|
|
11790
11790
|
async activateWebAudio() {
|
|
11791
11791
|
if (this.webAudioActive) return;
|
|
11792
|
+
if (this.usesMse) {
|
|
11793
|
+
this.sourceNode = new MediaElementAudioSourceNode(this.getOrCreateAudioContext(), { mediaElement: this.mediaElement });
|
|
11794
|
+
const n = this.getOrCreateAudioContext();
|
|
11795
|
+
this.gainNode = n.createGain(), this.gainNode.gain.value = this.mediaElement.volume, this.mediaElement.volume = 1, this.sourceNode.connect(this.gainNode), this.gainNode.connect(n.destination), this.webAudioActive = !0;
|
|
11796
|
+
return;
|
|
11797
|
+
}
|
|
11792
11798
|
const t = this.mediaElement.src;
|
|
11793
11799
|
if (!t) return;
|
|
11794
11800
|
const e = this.mediaElement.currentTime, i = this.isPlayingValue;
|
|
@@ -11817,6 +11823,10 @@ class Ca {
|
|
|
11817
11823
|
get isWebAudioActive() {
|
|
11818
11824
|
return this.webAudioActive;
|
|
11819
11825
|
}
|
|
11826
|
+
/** True when this engine streams media through Media Source Extensions. */
|
|
11827
|
+
get usesMse() {
|
|
11828
|
+
return this.mseLoaderFactory !== null;
|
|
11829
|
+
}
|
|
11820
11830
|
/**
|
|
11821
11831
|
* Tears down the Web Audio graph and restores the media element to standalone
|
|
11822
11832
|
* playback. Safe to call even if Web Audio was never activated.
|
|
@@ -11832,20 +11842,25 @@ class Ca {
|
|
|
11832
11842
|
* the required headers), the graph is torn down and the src is reloaded
|
|
11833
11843
|
* without CORS so playback continues — just without pitch correction.
|
|
11834
11844
|
*/
|
|
11835
|
-
changeSrc(t) {
|
|
11836
|
-
if (this.mediaElement.src
|
|
11837
|
-
if (this.mediaElement.pause(), this.isPlayingValue = !1, this.isPausedValue = !1, this.isLoadedValue = !1, this.isLoadingValue = !0, this.isEndedValue = !1, this.
|
|
11845
|
+
changeSrc(t, e) {
|
|
11846
|
+
if (!(this.currentHref === t || this.mediaElement.src === t)) {
|
|
11847
|
+
if (this.currentHref = t, this.mediaElement.pause(), this.isPlayingValue = !1, this.isPausedValue = !1, this.isLoadedValue = !1, this.isLoadingValue = !0, this.isEndedValue = !1, this.mseLoaderFactory) {
|
|
11848
|
+
this.mseLoader?.destroy(), this.mseLoader = this.mseLoaderFactory(this.mediaElement, t, e), this.mseLoader.start();
|
|
11849
|
+
return;
|
|
11850
|
+
}
|
|
11851
|
+
if (this.webAudioActive) {
|
|
11838
11852
|
this.mediaElement.crossOrigin = "anonymous", this.mediaElement.src = t, this.mediaElement.load();
|
|
11839
|
-
const
|
|
11840
|
-
|
|
11841
|
-
}, i = () => {
|
|
11842
|
-
s(), console.warn("CORS reload failed for new track — disabling Web Audio graph:", t), this.tearDownWebAudio(), this.mediaElement.removeAttribute("crossorigin"), this.mediaElement.src = t, this.mediaElement.load();
|
|
11853
|
+
const i = () => {
|
|
11854
|
+
n();
|
|
11843
11855
|
}, s = () => {
|
|
11844
|
-
|
|
11856
|
+
n(), console.warn("CORS reload failed for new track — disabling Web Audio graph:", t), this.tearDownWebAudio(), this.mediaElement.removeAttribute("crossorigin"), this.mediaElement.src = t, this.mediaElement.load();
|
|
11857
|
+
}, n = () => {
|
|
11858
|
+
this.mediaElement.removeEventListener("canplaythrough", i), this.mediaElement.removeEventListener("error", s);
|
|
11845
11859
|
};
|
|
11846
|
-
this.mediaElement.addEventListener("canplaythrough",
|
|
11860
|
+
this.mediaElement.addEventListener("canplaythrough", i), this.mediaElement.addEventListener("error", s);
|
|
11847
11861
|
} else
|
|
11848
11862
|
this.mediaElement.src = t, this.mediaElement.load();
|
|
11863
|
+
}
|
|
11849
11864
|
}
|
|
11850
11865
|
/**
|
|
11851
11866
|
* Returns the HTML media element used for playback.
|
|
@@ -11853,6 +11868,13 @@ class Ca {
|
|
|
11853
11868
|
getMediaElement() {
|
|
11854
11869
|
return this.mediaElement;
|
|
11855
11870
|
}
|
|
11871
|
+
/**
|
|
11872
|
+
* Releases loader resources (in-flight fetches, MediaSource object URL).
|
|
11873
|
+
* The media element itself is left intact.
|
|
11874
|
+
*/
|
|
11875
|
+
destroy() {
|
|
11876
|
+
this.mseLoader?.destroy(), this.mseLoader = null;
|
|
11877
|
+
}
|
|
11856
11878
|
}
|
|
11857
11879
|
class xe {
|
|
11858
11880
|
constructor(t = {}) {
|
|
@@ -11944,7 +11966,7 @@ class Ps {
|
|
|
11944
11966
|
});
|
|
11945
11967
|
}
|
|
11946
11968
|
get pollInterval() {
|
|
11947
|
-
return new
|
|
11969
|
+
return new F({
|
|
11948
11970
|
initialValue: this.preferences.pollInterval,
|
|
11949
11971
|
effectiveValue: this.settings.pollInterval,
|
|
11950
11972
|
isEffective: this.preferences.pollInterval !== null,
|
|
@@ -12001,10 +12023,10 @@ class xa {
|
|
|
12001
12023
|
const r = this._supportedAudioTypes.get(n.type);
|
|
12002
12024
|
if (!r) continue;
|
|
12003
12025
|
const a = n.toURL(e) ?? n.href;
|
|
12004
|
-
if (r === "probably") return a;
|
|
12005
|
-
s || (s = { href: a, confidence: r });
|
|
12026
|
+
if (r === "probably") return { href: a, type: n.type };
|
|
12027
|
+
s || (s = { href: a, type: n.type, confidence: r });
|
|
12006
12028
|
}
|
|
12007
|
-
return s
|
|
12029
|
+
return s ? { href: s.href, type: s.type } : { href: t.toURL(e) ?? t.href, type: t.type };
|
|
12008
12030
|
}
|
|
12009
12031
|
get audioEngine() {
|
|
12010
12032
|
return this._audioEngine;
|
|
@@ -12023,10 +12045,11 @@ class xa {
|
|
|
12023
12045
|
* The current track is excluded — the primary engine element represents it.
|
|
12024
12046
|
*/
|
|
12025
12047
|
update(t) {
|
|
12048
|
+
if (this._audioEngine.usesMse) return;
|
|
12026
12049
|
const e = this._publication.readingOrder.items, i = /* @__PURE__ */ new Set();
|
|
12027
12050
|
for (let s = 0; s < e.length; s++) {
|
|
12028
12051
|
if (s === t) continue;
|
|
12029
|
-
const n = this.pickPlayableHref(e[s]);
|
|
12052
|
+
const { href: n } = this.pickPlayableHref(e[s]);
|
|
12030
12053
|
s >= t - Cs && s <= t + Cs ? (this.ensure(n), i.add(n)) : s >= t - Es && s <= t + Es && this.pool.has(n) && i.add(n);
|
|
12031
12054
|
}
|
|
12032
12055
|
for (const [s, n] of this.pool)
|
|
@@ -12038,15 +12061,15 @@ class xa {
|
|
|
12038
12061
|
* session and any Web Audio graph connections across track changes.
|
|
12039
12062
|
*/
|
|
12040
12063
|
setCurrentAudio(t, e) {
|
|
12041
|
-
const i = this.pickPlayableHref(this._publication.readingOrder.items[t]);
|
|
12042
|
-
if (this.audioEngine.changeSrc(i), this.pool.has(i)) {
|
|
12043
|
-
const
|
|
12044
|
-
|
|
12064
|
+
const { href: i, type: s } = this.pickPlayableHref(this._publication.readingOrder.items[t]);
|
|
12065
|
+
if (this.audioEngine.changeSrc(i, s), this.pool.has(i)) {
|
|
12066
|
+
const n = this.pool.get(i);
|
|
12067
|
+
n.removeAttribute("src"), n.load(), this.pool.delete(i);
|
|
12045
12068
|
}
|
|
12046
12069
|
this.update(t);
|
|
12047
12070
|
}
|
|
12048
12071
|
destroy() {
|
|
12049
|
-
this.audioEngine.stop();
|
|
12072
|
+
this.audioEngine.stop(), this.audioEngine.destroy();
|
|
12050
12073
|
for (const [, t] of this.pool)
|
|
12051
12074
|
t.removeAttribute("src"), t.load();
|
|
12052
12075
|
this.pool.clear();
|
|
@@ -12103,21 +12126,21 @@ const ka = (o) => ({
|
|
|
12103
12126
|
remotePlaybackStateChanged: o.remotePlaybackStateChanged ?? (() => {
|
|
12104
12127
|
})
|
|
12105
12128
|
});
|
|
12106
|
-
class
|
|
12129
|
+
class Fa extends Sr {
|
|
12107
12130
|
constructor(t, e, i, s = {
|
|
12108
12131
|
preferences: {},
|
|
12109
12132
|
defaults: {}
|
|
12110
12133
|
}) {
|
|
12111
|
-
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._isStalled = !1, this._stalledWatchdog = null, this._stalledCheckTime = 0, this.pub = t, this.listeners = ka(e), this._preferences = new xe(s.preferences), this._defaults = new _a(s.defaults), this._settings = new vs(this._preferences, this._defaults), t.readingOrder.items.length === 0)
|
|
12134
|
+
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._isStalled = !1, this._destroyed = !1, this._stalledWatchdog = null, this._stalledCheckTime = 0, this.pub = t, this.listeners = ka(e), this._preferences = new xe(s.preferences), this._defaults = new _a(s.defaults), this._settings = new vs(this._preferences, this._defaults), t.readingOrder.items.length === 0)
|
|
12112
12135
|
throw new Error("AudioNavigator: publication has an empty reading order");
|
|
12113
12136
|
if (i)
|
|
12114
12137
|
this.currentLocation = this.ensureLocatorLocations(i);
|
|
12115
12138
|
else {
|
|
12116
|
-
const
|
|
12117
|
-
this.currentLocation = new
|
|
12118
|
-
href:
|
|
12119
|
-
type:
|
|
12120
|
-
title:
|
|
12139
|
+
const u = this.pub.readingOrder.items[0];
|
|
12140
|
+
this.currentLocation = new I({
|
|
12141
|
+
href: u.href,
|
|
12142
|
+
type: u.type || "audio/mpeg",
|
|
12143
|
+
title: u.title,
|
|
12121
12144
|
locations: new L({
|
|
12122
12145
|
position: 1,
|
|
12123
12146
|
progression: 0,
|
|
@@ -12126,9 +12149,16 @@ class Da extends Sr {
|
|
|
12126
12149
|
})
|
|
12127
12150
|
});
|
|
12128
12151
|
}
|
|
12129
|
-
const n = this.currentLocation.href.split("#")[0]
|
|
12130
|
-
|
|
12131
|
-
|
|
12152
|
+
const n = this.currentLocation.href.split("#")[0];
|
|
12153
|
+
let r = this.hrefToTrackIndex(n);
|
|
12154
|
+
if (r === -1) {
|
|
12155
|
+
const u = this.currentLocation.locations?.totalProgression;
|
|
12156
|
+
if (u !== void 0) {
|
|
12157
|
+
const f = this.locatorFromTotalProgression(u);
|
|
12158
|
+
this.currentLocation = f.locator, r = f.trackIndex;
|
|
12159
|
+
} else
|
|
12160
|
+
throw new Error(`AudioNavigator: initial href "${n}" not found in reading order`);
|
|
12161
|
+
}
|
|
12132
12162
|
const a = this.currentLocation.locations?.time() || 0, l = new Ca({
|
|
12133
12163
|
playback: {
|
|
12134
12164
|
state: {
|
|
@@ -12137,7 +12167,8 @@ class Da extends Sr {
|
|
|
12137
12167
|
},
|
|
12138
12168
|
playWhenReady: !1,
|
|
12139
12169
|
index: r
|
|
12140
|
-
}
|
|
12170
|
+
},
|
|
12171
|
+
mseLoaderFactory: s.mseLoaderFactory
|
|
12141
12172
|
});
|
|
12142
12173
|
this.pool = new xa(l, t, s.contentProtection);
|
|
12143
12174
|
const c = s.contentProtection || {};
|
|
@@ -12146,16 +12177,24 @@ class Da extends Sr {
|
|
|
12146
12177
|
c,
|
|
12147
12178
|
s.keyboardPeripherals || []
|
|
12148
12179
|
);
|
|
12149
|
-
(c.disableContextMenu || c.checkAutomation || c.checkIFrameEmbedding || c.monitorDevTools || c.protectPrinting?.disable || c.disableDragAndDrop || c.protectCopy) && (this._navigatorProtector = new La(c), this._suspiciousActivityListener = (
|
|
12150
|
-
const { type:
|
|
12151
|
-
|
|
12152
|
-
}, window.addEventListener(ot, this._suspiciousActivityListener)), h.length > 0 && (this._keyboardPeripheralsManager = new _e({ keyboardPeripherals: h }), this._keyboardPeripheralListener = (
|
|
12153
|
-
this.listeners.peripheral(
|
|
12154
|
-
}, window.addEventListener(at, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0
|
|
12180
|
+
(c.disableContextMenu || c.checkAutomation || c.checkIFrameEmbedding || c.monitorDevTools || c.protectPrinting?.disable || c.disableDragAndDrop || c.protectCopy) && (this._navigatorProtector = new La(c), this._suspiciousActivityListener = (u) => {
|
|
12181
|
+
const { type: f, ...m } = u.detail;
|
|
12182
|
+
f === "context_menu" ? this.listeners.contextMenu(m) : this.listeners.contentProtection(f, m);
|
|
12183
|
+
}, window.addEventListener(ot, this._suspiciousActivityListener)), h.length > 0 && (this._keyboardPeripheralsManager = new _e({ keyboardPeripherals: h }), this._keyboardPeripheralListener = (u) => {
|
|
12184
|
+
this.listeners.peripheral(u.detail);
|
|
12185
|
+
}, window.addEventListener(at, this._keyboardPeripheralListener)), this.setupEventListeners(), this._isNavigating = !0;
|
|
12186
|
+
const d = () => this.startInitialLoad(r, a);
|
|
12187
|
+
s.mediaElementSetup ? Promise.resolve().then(() => s.mediaElementSetup(this.pool.audioEngine.getMediaElement())).catch((u) => {
|
|
12188
|
+
this.listeners.error(u, this.currentLocator);
|
|
12189
|
+
}).then(d) : d();
|
|
12190
|
+
}
|
|
12191
|
+
/** Sets the initial track on the primary element and seeks to the starting position. */
|
|
12192
|
+
startInitialLoad(t, e) {
|
|
12193
|
+
this._destroyed || (this.pool.setCurrentAudio(t, "forward"), this.applyPreferences(), this.waitForLoadedAndSeeked(e).then(() => {
|
|
12155
12194
|
this._isNavigating = !1, this.listeners.trackLoaded(this.pool.audioEngine.getMediaElement()), this._notifyTimelineChange(this.currentLocator), this.listeners.positionChanged(this.currentLocator), this._setupRemotePlayback();
|
|
12156
12195
|
}).catch(() => {
|
|
12157
12196
|
this._isNavigating = !1;
|
|
12158
|
-
});
|
|
12197
|
+
}));
|
|
12159
12198
|
}
|
|
12160
12199
|
get settings() {
|
|
12161
12200
|
return this._settings;
|
|
@@ -12180,7 +12219,7 @@ class Da extends Sr {
|
|
|
12180
12219
|
e !== this._currentTimelineItem && (this._currentTimelineItem = e, this.listeners.timelineItemChanged(e), this._settings.enableMediaSession && this.updateMediaSessionMetadata());
|
|
12181
12220
|
}
|
|
12182
12221
|
ensureLocatorLocations(t) {
|
|
12183
|
-
return new
|
|
12222
|
+
return new I({
|
|
12184
12223
|
...t,
|
|
12185
12224
|
locations: t.locations instanceof L ? t.locations : t.locations ? new L(t.locations) : void 0
|
|
12186
12225
|
});
|
|
@@ -12194,6 +12233,41 @@ class Da extends Sr {
|
|
|
12194
12233
|
currentTrackIndex() {
|
|
12195
12234
|
return this.hrefToTrackIndex(this.currentLocation.href);
|
|
12196
12235
|
}
|
|
12236
|
+
/**
|
|
12237
|
+
* Builds a locator for an overall publication progression (0–1) by walking
|
|
12238
|
+
* the cumulative track durations. Falls back to the start of the first
|
|
12239
|
+
* track when the reading order carries no duration metadata.
|
|
12240
|
+
*/
|
|
12241
|
+
locatorFromTotalProgression(t) {
|
|
12242
|
+
const e = this.pub.readingOrder.items, i = e.map((l) => l.duration ?? 0), s = i.reduce((l, c) => l + c, 0);
|
|
12243
|
+
let n = 0, r = 0;
|
|
12244
|
+
if (s > 0) {
|
|
12245
|
+
let l = Math.min(Math.max(t, 0), 1) * s;
|
|
12246
|
+
for (let c = 0; c < i.length; c++) {
|
|
12247
|
+
if (n = c, l <= i[c] || c === i.length - 1) {
|
|
12248
|
+
r = l;
|
|
12249
|
+
break;
|
|
12250
|
+
}
|
|
12251
|
+
l -= i[c];
|
|
12252
|
+
}
|
|
12253
|
+
}
|
|
12254
|
+
const a = e[n];
|
|
12255
|
+
return {
|
|
12256
|
+
trackIndex: n,
|
|
12257
|
+
locator: new I({
|
|
12258
|
+
href: a.href,
|
|
12259
|
+
type: a.type || "",
|
|
12260
|
+
// Should have a mimetype
|
|
12261
|
+
title: a.title,
|
|
12262
|
+
locations: new L({
|
|
12263
|
+
position: n + 1,
|
|
12264
|
+
progression: i[n] > 0 ? r / i[n] : 0,
|
|
12265
|
+
totalProgression: Math.min(Math.max(t, 0), 1),
|
|
12266
|
+
fragments: [`t=${r}`]
|
|
12267
|
+
})
|
|
12268
|
+
})
|
|
12269
|
+
};
|
|
12270
|
+
}
|
|
12197
12271
|
get currentLocator() {
|
|
12198
12272
|
return this.currentLocation;
|
|
12199
12273
|
}
|
|
@@ -12213,7 +12287,7 @@ class Da extends Sr {
|
|
|
12213
12287
|
const i = this.pub.readingOrder.items[t];
|
|
12214
12288
|
if (!i) throw new Error(`Invalid track index: ${t}`);
|
|
12215
12289
|
const s = this.pool.audioEngine.duration();
|
|
12216
|
-
return new
|
|
12290
|
+
return new I({
|
|
12217
12291
|
href: i.href,
|
|
12218
12292
|
type: i.type || "audio/mpeg",
|
|
12219
12293
|
title: i.title,
|
|
@@ -12261,11 +12335,15 @@ class Da extends Sr {
|
|
|
12261
12335
|
this.pool.audioEngine.on("error", (t) => {
|
|
12262
12336
|
this.listeners.error(t, this.currentLocator);
|
|
12263
12337
|
}), this.pool.audioEngine.on("ended", async () => {
|
|
12264
|
-
this.stopPositionPolling(), this.currentLocation = this.currentLocation.copyWithLocations(new L({
|
|
12338
|
+
if (this.stopPositionPolling(), this.currentLocation = this.currentLocation.copyWithLocations(new L({
|
|
12265
12339
|
position: this.currentTrackIndex() + 1,
|
|
12266
12340
|
progression: 1,
|
|
12267
12341
|
fragments: [`t=${this.duration}`]
|
|
12268
|
-
})), this.listeners.trackEnded(this.currentLocator), this.canGoForward
|
|
12342
|
+
})), this.listeners.trackEnded(this.currentLocator), !this.canGoForward) {
|
|
12343
|
+
this.listeners.positionChanged(this.currentLocator);
|
|
12344
|
+
return;
|
|
12345
|
+
}
|
|
12346
|
+
await this.nextTrack(), this._settings.autoPlay && this.play();
|
|
12269
12347
|
}), this.pool.audioEngine.on("play", () => {
|
|
12270
12348
|
this._isNavigating || (this.startPositionPolling(), this.listeners.play(this.currentLocator));
|
|
12271
12349
|
}), this.pool.audioEngine.on("playing", () => {
|
|
@@ -12459,15 +12537,15 @@ class Da extends Sr {
|
|
|
12459
12537
|
"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));
|
|
12460
12538
|
}
|
|
12461
12539
|
destroy() {
|
|
12462
|
-
this.stopPositionPolling(), this._stopStalledWatchdog(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
|
|
12540
|
+
this._destroyed = !0, this.stopPositionPolling(), this._stopStalledWatchdog(), this.destroyMediaSession(), this._suspiciousActivityListener && window.removeEventListener(ot, this._suspiciousActivityListener), this._keyboardPeripheralListener && window.removeEventListener(at, this._keyboardPeripheralListener), this._navigatorProtector?.destroy(), this._keyboardPeripheralsManager?.destroy(), this.pool.destroy();
|
|
12463
12541
|
}
|
|
12464
12542
|
}
|
|
12465
12543
|
const Ta = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'URW Palladio L', P052, serif", Oa = {
|
|
12466
12544
|
oldStyleTf: Ta
|
|
12467
|
-
},
|
|
12545
|
+
}, Aa = 16, _s = Oa.oldStyleTf;
|
|
12468
12546
|
class zt {
|
|
12469
12547
|
constructor(t) {
|
|
12470
|
-
this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize ||
|
|
12548
|
+
this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize || Aa, this._fontFace = t.fontFace || _s, 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 = zt.approximateWordSpaces(this._optimalChars, this._sample);
|
|
12471
12549
|
}
|
|
12472
12550
|
updateMultipliers() {
|
|
12473
12551
|
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;
|
|
@@ -12541,7 +12619,7 @@ class zt {
|
|
|
12541
12619
|
}
|
|
12542
12620
|
export {
|
|
12543
12621
|
_a as AudioDefaults,
|
|
12544
|
-
|
|
12622
|
+
Fa as AudioNavigator,
|
|
12545
12623
|
xe as AudioPreferences,
|
|
12546
12624
|
Ps as AudioPreferencesEditor,
|
|
12547
12625
|
vs as AudioSettings,
|
|
@@ -12572,7 +12650,7 @@ export {
|
|
|
12572
12650
|
rn as FXLCoordinator,
|
|
12573
12651
|
Mo as FXLFrameManager,
|
|
12574
12652
|
zo as FXLFramePoolManager,
|
|
12575
|
-
|
|
12653
|
+
Ro as FXLPeripherals,
|
|
12576
12654
|
No as FXLSpreader,
|
|
12577
12655
|
Vt as FrameComms,
|
|
12578
12656
|
nn as FrameManager,
|
|
@@ -12585,7 +12663,7 @@ export {
|
|
|
12585
12663
|
Sr as MediaNavigator,
|
|
12586
12664
|
Ys as Navigator,
|
|
12587
12665
|
$t as Orientation,
|
|
12588
|
-
|
|
12666
|
+
F as Preference,
|
|
12589
12667
|
Ee as Properties,
|
|
12590
12668
|
jo as RSProperties,
|
|
12591
12669
|
k as RangePreference,
|
|
@@ -12635,7 +12713,7 @@ export {
|
|
|
12635
12713
|
me as playbackRateRangeConfig,
|
|
12636
12714
|
xt as resolveDecorationForWire,
|
|
12637
12715
|
na as selectVariant,
|
|
12638
|
-
|
|
12716
|
+
Ra as settings,
|
|
12639
12717
|
ht as skipIntervalRangeConfig,
|
|
12640
12718
|
be as stripWidthRangeConfig,
|
|
12641
12719
|
fe as volumeRangeConfig,
|