@readium/navigator-html-injectables 2.0.0-beta.3 → 2.0.0-beta.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 +570 -525
- package/dist/index.umd.cjs +9 -9
- package/package.json +1 -1
- package/src/comms/keys.ts +2 -1
- package/src/helpers/document.ts +16 -0
- package/src/modules/snapper/ColumnSnapper.ts +8 -1
- package/src/modules/snapper/ScrollSnapper.ts +31 -15
- package/types/src/comms/keys.d.ts +1 -1
- package/types/src/helpers/document.d.ts +9 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const at = Math.pow(2, 32), ve = () => Math.round(Math.random() * at).toString(36), lt = () => `${Math.round(performance.now())}-${ve()}-${ve()}`, V = 1;
|
|
2
|
+
class ht {
|
|
3
3
|
constructor(e) {
|
|
4
4
|
this.destination = null, this.registrar = /* @__PURE__ */ new Map(), this.origin = "", this.channelId = "", this.receiver = this.receive.bind(this), this.preLog = [], this.wnd = e, e.addEventListener("message", this.receiver);
|
|
5
5
|
}
|
|
@@ -12,8 +12,8 @@ class at {
|
|
|
12
12
|
if (!(!("_readium" in t) || !t._readium || t._readium <= 0)) {
|
|
13
13
|
if (t.key === "_ping") {
|
|
14
14
|
if (!this.destination) {
|
|
15
|
-
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !==
|
|
16
|
-
t._readium >
|
|
15
|
+
if (this.destination = e.source, this.origin = e.origin, this.channelId = t._channel, t._readium !== V) {
|
|
16
|
+
t._readium > V ? this.send("error", `received comms version ${t._readium} higher than ${V}`) : this.send("error", `received comms version ${t._readium} lower than ${V}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
|
|
@@ -41,7 +41,7 @@ class at {
|
|
|
41
41
|
Array.isArray(e) || (e = [e]), e.forEach((s) => {
|
|
42
42
|
const n = this.registrar.get(s);
|
|
43
43
|
if (n && n.length >= 0) {
|
|
44
|
-
if (n.find((
|
|
44
|
+
if (n.find((l) => l.module === t))
|
|
45
45
|
throw new Error(`Trying to register another callback for combination of event ${s} and module ${t}`);
|
|
46
46
|
n.push({
|
|
47
47
|
cb: i,
|
|
@@ -76,9 +76,9 @@ class at {
|
|
|
76
76
|
if (!this.destination)
|
|
77
77
|
throw Error("Attempted to send comms message before destination has been initialized");
|
|
78
78
|
const n = {
|
|
79
|
-
_readium:
|
|
79
|
+
_readium: V,
|
|
80
80
|
_channel: this.channelId,
|
|
81
|
-
id: i ??
|
|
81
|
+
id: i ?? lt(),
|
|
82
82
|
// scrict,
|
|
83
83
|
key: e,
|
|
84
84
|
data: t
|
|
@@ -95,34 +95,41 @@ class at {
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
class
|
|
99
|
-
/**
|
|
100
|
-
* Creates a [Encryption].
|
|
101
|
-
*/
|
|
98
|
+
const L = class B {
|
|
102
99
|
constructor(e) {
|
|
103
|
-
|
|
100
|
+
if (typeof e == "string") {
|
|
101
|
+
if (!B.VALID_MODES.has(e.toLowerCase()))
|
|
102
|
+
return;
|
|
103
|
+
this.value = e.toLowerCase();
|
|
104
|
+
} else {
|
|
105
|
+
const t = e.filter(
|
|
106
|
+
(i) => B.VALID_MODES.has(i.toLowerCase())
|
|
107
|
+
);
|
|
108
|
+
if (t.length === 0)
|
|
109
|
+
return;
|
|
110
|
+
this.value = Array.from(new Set(t));
|
|
111
|
+
}
|
|
104
112
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Parses a [Encryption] from its RWPM JSON representation.
|
|
107
|
-
*/
|
|
108
113
|
static deserialize(e) {
|
|
109
|
-
if (e
|
|
110
|
-
return
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
if (!e)
|
|
115
|
+
return;
|
|
116
|
+
if (typeof e == "string")
|
|
117
|
+
return new B(e);
|
|
118
|
+
if (!Array.isArray(e))
|
|
119
|
+
return;
|
|
120
|
+
const t = e.filter((i) => i ? B.VALID_MODES.has(i.toLowerCase()) : !1);
|
|
121
|
+
if (t.length !== 0)
|
|
122
|
+
return new B(t);
|
|
117
123
|
}
|
|
118
|
-
/**
|
|
119
|
-
* Serializes a [Encryption] to its RWPM JSON representation.
|
|
120
|
-
*/
|
|
121
124
|
serialize() {
|
|
122
|
-
|
|
123
|
-
return this.compression !== void 0 && (e.compression = this.compression), this.originalLength !== void 0 && (e.originalLength = this.originalLength), this.profile !== void 0 && (e.profile = this.profile), this.scheme !== void 0 && (e.scheme = this.scheme), e;
|
|
125
|
+
return this.value;
|
|
124
126
|
}
|
|
125
|
-
}
|
|
127
|
+
};
|
|
128
|
+
L.VALID_MODES = /* @__PURE__ */ new Set(["auditory", "tactile", "textual", "visual"]);
|
|
129
|
+
L.AUDITORY = new L("auditory");
|
|
130
|
+
L.TACTILE = new L("tactile");
|
|
131
|
+
L.TEXTUAL = new L("textual");
|
|
132
|
+
L.VISUAL = new L("visual");
|
|
126
133
|
class E {
|
|
127
134
|
constructor(e) {
|
|
128
135
|
this.otherProperties = e;
|
|
@@ -150,18 +157,13 @@ class E {
|
|
|
150
157
|
return new E(t);
|
|
151
158
|
}
|
|
152
159
|
}
|
|
153
|
-
Object.defineProperty(E.prototype, "encryption", {
|
|
154
|
-
get: function() {
|
|
155
|
-
return ie.deserialize(this.otherProperties.encrypted);
|
|
156
|
-
}
|
|
157
|
-
});
|
|
158
160
|
E.prototype.getContains = function() {
|
|
159
161
|
return new Set(this.otherProperties.contains || []);
|
|
160
162
|
};
|
|
161
163
|
E.prototype.getLayout = function() {
|
|
162
164
|
return this.otherProperties.layout;
|
|
163
165
|
};
|
|
164
|
-
class
|
|
166
|
+
class a {
|
|
165
167
|
/** Creates a MediaType object. */
|
|
166
168
|
constructor(e) {
|
|
167
169
|
let t, i, s = e.mediaType.replace(/\s/g, "").split(";");
|
|
@@ -179,18 +181,18 @@ class l {
|
|
|
179
181
|
o[g] = m;
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
const
|
|
183
|
-
c.sort((d, f) => d.localeCompare(f)), c.forEach((d) =>
|
|
184
|
+
const l = {}, c = Object.keys(o);
|
|
185
|
+
c.sort((d, f) => d.localeCompare(f)), c.forEach((d) => l[d] = o[d]);
|
|
184
186
|
let h = "";
|
|
185
|
-
for (const d in
|
|
186
|
-
const f =
|
|
187
|
+
for (const d in l) {
|
|
188
|
+
const f = l[d];
|
|
187
189
|
h += `;${d}=${f}`;
|
|
188
190
|
}
|
|
189
|
-
const u = `${t}/${i}${h}`, p =
|
|
190
|
-
this.string = u, this.type = t, this.subtype = i, this.parameters =
|
|
191
|
+
const u = `${t}/${i}${h}`, p = l.encoding;
|
|
192
|
+
this.string = u, this.type = t, this.subtype = i, this.parameters = l, this.encoding = p, this.name = e.name, this.fileExtension = e.fileExtension;
|
|
191
193
|
}
|
|
192
194
|
static parse(e) {
|
|
193
|
-
return new
|
|
195
|
+
return new a(e);
|
|
194
196
|
}
|
|
195
197
|
/** Structured syntax suffix, e.g. `+zip` in `application/epub+zip`.
|
|
196
198
|
* Gives a hint on the underlying structure of this media type.
|
|
@@ -220,7 +222,7 @@ class l {
|
|
|
220
222
|
* - Wildcards are supported, meaning that `image/*` contains `image/png`
|
|
221
223
|
*/
|
|
222
224
|
contains(e) {
|
|
223
|
-
const t = typeof e == "string" ?
|
|
225
|
+
const t = typeof e == "string" ? a.parse({ mediaType: e }) : e;
|
|
224
226
|
if (!((this.type === "*" || this.type === t.type) && (this.subtype === "*" || this.subtype === t.subtype)))
|
|
225
227
|
return !1;
|
|
226
228
|
const i = new Set(
|
|
@@ -239,7 +241,7 @@ class l {
|
|
|
239
241
|
* doesn't. This is basically like `contains`, but working in both direction.
|
|
240
242
|
*/
|
|
241
243
|
matches(e) {
|
|
242
|
-
const t = typeof e == "string" ?
|
|
244
|
+
const t = typeof e == "string" ? a.parse({ mediaType: e }) : e;
|
|
243
245
|
return this.contains(t) || t.contains(this);
|
|
244
246
|
}
|
|
245
247
|
/**
|
|
@@ -258,38 +260,38 @@ class l {
|
|
|
258
260
|
/** Returns whether this media type is structured as a ZIP archive. */
|
|
259
261
|
get isZIP() {
|
|
260
262
|
return this.matchesAny(
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
263
|
+
a.ZIP,
|
|
264
|
+
a.LCP_PROTECTED_AUDIOBOOK,
|
|
265
|
+
a.LCP_PROTECTED_PDF
|
|
264
266
|
) || this.structuredSyntaxSuffix === "+zip";
|
|
265
267
|
}
|
|
266
268
|
/** Returns whether this media type is structured as a JSON file. */
|
|
267
269
|
get isJSON() {
|
|
268
|
-
return this.matchesAny(
|
|
270
|
+
return this.matchesAny(a.JSON) || this.structuredSyntaxSuffix === "+json";
|
|
269
271
|
}
|
|
270
272
|
/** Returns whether this media type is of an OPDS feed. */
|
|
271
273
|
get isOPDS() {
|
|
272
274
|
return this.matchesAny(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
a.OPDS1,
|
|
276
|
+
a.OPDS1_ENTRY,
|
|
277
|
+
a.OPDS2,
|
|
278
|
+
a.OPDS2_PUBLICATION,
|
|
279
|
+
a.OPDS_AUTHENTICATION
|
|
278
280
|
) || this.structuredSyntaxSuffix === "+json";
|
|
279
281
|
}
|
|
280
282
|
/** Returns whether this media type is of an HTML document. */
|
|
281
283
|
get isHTML() {
|
|
282
|
-
return this.matchesAny(
|
|
284
|
+
return this.matchesAny(a.HTML, a.XHTML);
|
|
283
285
|
}
|
|
284
286
|
/** Returns whether this media type is of a bitmap image, so excluding vectorial formats. */
|
|
285
287
|
get isBitmap() {
|
|
286
288
|
return this.matchesAny(
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
289
|
+
a.BMP,
|
|
290
|
+
a.GIF,
|
|
291
|
+
a.JPEG,
|
|
292
|
+
a.PNG,
|
|
293
|
+
a.TIFF,
|
|
294
|
+
a.WEBP
|
|
293
295
|
);
|
|
294
296
|
}
|
|
295
297
|
/** Returns whether this media type is of an audio clip. */
|
|
@@ -303,320 +305,320 @@ class l {
|
|
|
303
305
|
/** Returns whether this media type is of a Readium Web Publication Manifest. */
|
|
304
306
|
get isRWPM() {
|
|
305
307
|
return this.matchesAny(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
a.READIUM_AUDIOBOOK_MANIFEST,
|
|
309
|
+
a.DIVINA_MANIFEST,
|
|
310
|
+
a.READIUM_WEBPUB_MANIFEST
|
|
309
311
|
);
|
|
310
312
|
}
|
|
311
313
|
/** Returns whether this media type is of a publication file. */
|
|
312
314
|
get isPublication() {
|
|
313
315
|
return this.matchesAny(
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
316
|
+
a.READIUM_AUDIOBOOK,
|
|
317
|
+
a.READIUM_AUDIOBOOK_MANIFEST,
|
|
318
|
+
a.CBZ,
|
|
319
|
+
a.DIVINA,
|
|
320
|
+
a.DIVINA_MANIFEST,
|
|
321
|
+
a.EPUB,
|
|
322
|
+
a.LCP_PROTECTED_AUDIOBOOK,
|
|
323
|
+
a.LCP_PROTECTED_PDF,
|
|
324
|
+
a.LPF,
|
|
325
|
+
a.PDF,
|
|
326
|
+
a.W3C_WPUB_MANIFEST,
|
|
327
|
+
a.READIUM_WEBPUB,
|
|
328
|
+
a.READIUM_WEBPUB_MANIFEST,
|
|
329
|
+
a.ZAB
|
|
328
330
|
);
|
|
329
331
|
}
|
|
330
332
|
// Known Media Types
|
|
331
333
|
static get AAC() {
|
|
332
|
-
return
|
|
334
|
+
return a.parse({ mediaType: "audio/aac", fileExtension: "aac" });
|
|
333
335
|
}
|
|
334
336
|
static get ACSM() {
|
|
335
|
-
return
|
|
337
|
+
return a.parse({
|
|
336
338
|
mediaType: "application/vnd.adobe.adept+xml",
|
|
337
339
|
name: "Adobe Content Server Message",
|
|
338
340
|
fileExtension: "acsm"
|
|
339
341
|
});
|
|
340
342
|
}
|
|
341
343
|
static get AIFF() {
|
|
342
|
-
return
|
|
344
|
+
return a.parse({ mediaType: "audio/aiff", fileExtension: "aiff" });
|
|
343
345
|
}
|
|
344
346
|
static get AVI() {
|
|
345
|
-
return
|
|
347
|
+
return a.parse({
|
|
346
348
|
mediaType: "video/x-msvideo",
|
|
347
349
|
fileExtension: "avi"
|
|
348
350
|
});
|
|
349
351
|
}
|
|
350
352
|
static get BINARY() {
|
|
351
|
-
return
|
|
353
|
+
return a.parse({ mediaType: "application/octet-stream" });
|
|
352
354
|
}
|
|
353
355
|
static get BMP() {
|
|
354
|
-
return
|
|
356
|
+
return a.parse({ mediaType: "image/bmp", fileExtension: "bmp" });
|
|
355
357
|
}
|
|
356
358
|
static get CBZ() {
|
|
357
|
-
return
|
|
359
|
+
return a.parse({
|
|
358
360
|
mediaType: "application/vnd.comicbook+zip",
|
|
359
361
|
name: "Comic Book Archive",
|
|
360
362
|
fileExtension: "cbz"
|
|
361
363
|
});
|
|
362
364
|
}
|
|
363
365
|
static get CSS() {
|
|
364
|
-
return
|
|
366
|
+
return a.parse({ mediaType: "text/css", fileExtension: "css" });
|
|
365
367
|
}
|
|
366
368
|
static get DIVINA() {
|
|
367
|
-
return
|
|
369
|
+
return a.parse({
|
|
368
370
|
mediaType: "application/divina+zip",
|
|
369
371
|
name: "Digital Visual Narratives",
|
|
370
372
|
fileExtension: "divina"
|
|
371
373
|
});
|
|
372
374
|
}
|
|
373
375
|
static get DIVINA_MANIFEST() {
|
|
374
|
-
return
|
|
376
|
+
return a.parse({
|
|
375
377
|
mediaType: "application/divina+json",
|
|
376
378
|
name: "Digital Visual Narratives",
|
|
377
379
|
fileExtension: "json"
|
|
378
380
|
});
|
|
379
381
|
}
|
|
380
382
|
static get EPUB() {
|
|
381
|
-
return
|
|
383
|
+
return a.parse({
|
|
382
384
|
mediaType: "application/epub+zip",
|
|
383
385
|
name: "EPUB",
|
|
384
386
|
fileExtension: "epub"
|
|
385
387
|
});
|
|
386
388
|
}
|
|
387
389
|
static get GIF() {
|
|
388
|
-
return
|
|
390
|
+
return a.parse({ mediaType: "image/gif", fileExtension: "gif" });
|
|
389
391
|
}
|
|
390
392
|
static get GZ() {
|
|
391
|
-
return
|
|
393
|
+
return a.parse({
|
|
392
394
|
mediaType: "application/gzip",
|
|
393
395
|
fileExtension: "gz"
|
|
394
396
|
});
|
|
395
397
|
}
|
|
396
398
|
static get HTML() {
|
|
397
|
-
return
|
|
399
|
+
return a.parse({ mediaType: "text/html", fileExtension: "html" });
|
|
398
400
|
}
|
|
399
401
|
static get JAVASCRIPT() {
|
|
400
|
-
return
|
|
402
|
+
return a.parse({
|
|
401
403
|
mediaType: "text/javascript",
|
|
402
404
|
fileExtension: "js"
|
|
403
405
|
});
|
|
404
406
|
}
|
|
405
407
|
static get JPEG() {
|
|
406
|
-
return
|
|
408
|
+
return a.parse({ mediaType: "image/jpeg", fileExtension: "jpeg" });
|
|
407
409
|
}
|
|
408
410
|
static get JSON() {
|
|
409
|
-
return
|
|
411
|
+
return a.parse({ mediaType: "application/json" });
|
|
410
412
|
}
|
|
411
413
|
static get LCP_LICENSE_DOCUMENT() {
|
|
412
|
-
return
|
|
414
|
+
return a.parse({
|
|
413
415
|
mediaType: "application/vnd.readium.lcp.license.v1.0+json",
|
|
414
416
|
name: "LCP License",
|
|
415
417
|
fileExtension: "lcpl"
|
|
416
418
|
});
|
|
417
419
|
}
|
|
418
420
|
static get LCP_PROTECTED_AUDIOBOOK() {
|
|
419
|
-
return
|
|
421
|
+
return a.parse({
|
|
420
422
|
mediaType: "application/audiobook+lcp",
|
|
421
423
|
name: "LCP Protected Audiobook",
|
|
422
424
|
fileExtension: "lcpa"
|
|
423
425
|
});
|
|
424
426
|
}
|
|
425
427
|
static get LCP_PROTECTED_PDF() {
|
|
426
|
-
return
|
|
428
|
+
return a.parse({
|
|
427
429
|
mediaType: "application/pdf+lcp",
|
|
428
430
|
name: "LCP Protected PDF",
|
|
429
431
|
fileExtension: "lcpdf"
|
|
430
432
|
});
|
|
431
433
|
}
|
|
432
434
|
static get LCP_STATUS_DOCUMENT() {
|
|
433
|
-
return
|
|
435
|
+
return a.parse({
|
|
434
436
|
mediaType: "application/vnd.readium.license.status.v1.0+json"
|
|
435
437
|
});
|
|
436
438
|
}
|
|
437
439
|
static get LPF() {
|
|
438
|
-
return
|
|
440
|
+
return a.parse({
|
|
439
441
|
mediaType: "application/lpf+zip",
|
|
440
442
|
fileExtension: "lpf"
|
|
441
443
|
});
|
|
442
444
|
}
|
|
443
445
|
static get MP3() {
|
|
444
|
-
return
|
|
446
|
+
return a.parse({ mediaType: "audio/mpeg", fileExtension: "mp3" });
|
|
445
447
|
}
|
|
446
448
|
static get MPEG() {
|
|
447
|
-
return
|
|
449
|
+
return a.parse({ mediaType: "video/mpeg", fileExtension: "mpeg" });
|
|
448
450
|
}
|
|
449
451
|
static get NCX() {
|
|
450
|
-
return
|
|
452
|
+
return a.parse({
|
|
451
453
|
mediaType: "application/x-dtbncx+xml",
|
|
452
454
|
fileExtension: "ncx"
|
|
453
455
|
});
|
|
454
456
|
}
|
|
455
457
|
static get OGG() {
|
|
456
|
-
return
|
|
458
|
+
return a.parse({ mediaType: "audio/ogg", fileExtension: "oga" });
|
|
457
459
|
}
|
|
458
460
|
static get OGV() {
|
|
459
|
-
return
|
|
461
|
+
return a.parse({ mediaType: "video/ogg", fileExtension: "ogv" });
|
|
460
462
|
}
|
|
461
463
|
static get OPDS1() {
|
|
462
|
-
return
|
|
464
|
+
return a.parse({
|
|
463
465
|
mediaType: "application/atom+xml;profile=opds-catalog"
|
|
464
466
|
});
|
|
465
467
|
}
|
|
466
468
|
static get OPDS1_ENTRY() {
|
|
467
|
-
return
|
|
469
|
+
return a.parse({
|
|
468
470
|
mediaType: "application/atom+xml;type=entry;profile=opds-catalog"
|
|
469
471
|
});
|
|
470
472
|
}
|
|
471
473
|
static get OPDS2() {
|
|
472
|
-
return
|
|
474
|
+
return a.parse({ mediaType: "application/opds+json" });
|
|
473
475
|
}
|
|
474
476
|
static get OPDS2_PUBLICATION() {
|
|
475
|
-
return
|
|
477
|
+
return a.parse({ mediaType: "application/opds-publication+json" });
|
|
476
478
|
}
|
|
477
479
|
static get OPDS_AUTHENTICATION() {
|
|
478
|
-
return
|
|
480
|
+
return a.parse({
|
|
479
481
|
mediaType: "application/opds-authentication+json"
|
|
480
482
|
});
|
|
481
483
|
}
|
|
482
484
|
static get OPUS() {
|
|
483
|
-
return
|
|
485
|
+
return a.parse({ mediaType: "audio/opus", fileExtension: "opus" });
|
|
484
486
|
}
|
|
485
487
|
static get OTF() {
|
|
486
|
-
return
|
|
488
|
+
return a.parse({ mediaType: "font/otf", fileExtension: "otf" });
|
|
487
489
|
}
|
|
488
490
|
static get PDF() {
|
|
489
|
-
return
|
|
491
|
+
return a.parse({
|
|
490
492
|
mediaType: "application/pdf",
|
|
491
493
|
name: "PDF",
|
|
492
494
|
fileExtension: "pdf"
|
|
493
495
|
});
|
|
494
496
|
}
|
|
495
497
|
static get PNG() {
|
|
496
|
-
return
|
|
498
|
+
return a.parse({ mediaType: "image/png", fileExtension: "png" });
|
|
497
499
|
}
|
|
498
500
|
static get READIUM_AUDIOBOOK() {
|
|
499
|
-
return
|
|
501
|
+
return a.parse({
|
|
500
502
|
mediaType: "application/audiobook+zip",
|
|
501
503
|
name: "Readium Audiobook",
|
|
502
504
|
fileExtension: "audiobook"
|
|
503
505
|
});
|
|
504
506
|
}
|
|
505
507
|
static get READIUM_AUDIOBOOK_MANIFEST() {
|
|
506
|
-
return
|
|
508
|
+
return a.parse({
|
|
507
509
|
mediaType: "application/audiobook+json",
|
|
508
510
|
name: "Readium Audiobook",
|
|
509
511
|
fileExtension: "json"
|
|
510
512
|
});
|
|
511
513
|
}
|
|
512
514
|
static get READIUM_CONTENT_DOCUMENT() {
|
|
513
|
-
return
|
|
515
|
+
return a.parse({
|
|
514
516
|
mediaType: "application/vnd.readium.content+json",
|
|
515
517
|
name: "Readium Content Document",
|
|
516
518
|
fileExtension: "json"
|
|
517
519
|
});
|
|
518
520
|
}
|
|
519
521
|
static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
|
|
520
|
-
return
|
|
522
|
+
return a.parse({
|
|
521
523
|
mediaType: "application/guided-navigation+json",
|
|
522
524
|
name: "Readium Guided Navigation Document",
|
|
523
525
|
fileExtension: "json"
|
|
524
526
|
});
|
|
525
527
|
}
|
|
526
528
|
static get READIUM_POSITION_LIST() {
|
|
527
|
-
return
|
|
529
|
+
return a.parse({
|
|
528
530
|
mediaType: "application/vnd.readium.position-list+json",
|
|
529
531
|
name: "Readium Position List",
|
|
530
532
|
fileExtension: "json"
|
|
531
533
|
});
|
|
532
534
|
}
|
|
533
535
|
static get READIUM_WEBPUB() {
|
|
534
|
-
return
|
|
536
|
+
return a.parse({
|
|
535
537
|
mediaType: "application/webpub+zip",
|
|
536
538
|
name: "Readium Web Publication",
|
|
537
539
|
fileExtension: "webpub"
|
|
538
540
|
});
|
|
539
541
|
}
|
|
540
542
|
static get READIUM_WEBPUB_MANIFEST() {
|
|
541
|
-
return
|
|
543
|
+
return a.parse({
|
|
542
544
|
mediaType: "application/webpub+json",
|
|
543
545
|
name: "Readium Web Publication",
|
|
544
546
|
fileExtension: "json"
|
|
545
547
|
});
|
|
546
548
|
}
|
|
547
549
|
static get SMIL() {
|
|
548
|
-
return
|
|
550
|
+
return a.parse({
|
|
549
551
|
mediaType: "application/smil+xml",
|
|
550
552
|
fileExtension: "smil"
|
|
551
553
|
});
|
|
552
554
|
}
|
|
553
555
|
static get SVG() {
|
|
554
|
-
return
|
|
556
|
+
return a.parse({
|
|
555
557
|
mediaType: "image/svg+xml",
|
|
556
558
|
fileExtension: "svg"
|
|
557
559
|
});
|
|
558
560
|
}
|
|
559
561
|
static get TEXT() {
|
|
560
|
-
return
|
|
562
|
+
return a.parse({ mediaType: "text/plain", fileExtension: "txt" });
|
|
561
563
|
}
|
|
562
564
|
static get TIFF() {
|
|
563
|
-
return
|
|
565
|
+
return a.parse({ mediaType: "image/tiff", fileExtension: "tiff" });
|
|
564
566
|
}
|
|
565
567
|
static get TTF() {
|
|
566
|
-
return
|
|
568
|
+
return a.parse({ mediaType: "font/ttf", fileExtension: "ttf" });
|
|
567
569
|
}
|
|
568
570
|
static get W3C_WPUB_MANIFEST() {
|
|
569
|
-
return
|
|
571
|
+
return a.parse({
|
|
570
572
|
mediaType: "application/x.readium.w3c.wpub+json",
|
|
571
573
|
name: "Web Publication",
|
|
572
574
|
fileExtension: "json"
|
|
573
575
|
});
|
|
574
576
|
}
|
|
575
577
|
static get WAV() {
|
|
576
|
-
return
|
|
578
|
+
return a.parse({ mediaType: "audio/wav", fileExtension: "wav" });
|
|
577
579
|
}
|
|
578
580
|
static get WEBM_AUDIO() {
|
|
579
|
-
return
|
|
581
|
+
return a.parse({ mediaType: "audio/webm", fileExtension: "webm" });
|
|
580
582
|
}
|
|
581
583
|
static get WEBM_VIDEO() {
|
|
582
|
-
return
|
|
584
|
+
return a.parse({ mediaType: "video/webm", fileExtension: "webm" });
|
|
583
585
|
}
|
|
584
586
|
static get WEBP() {
|
|
585
|
-
return
|
|
587
|
+
return a.parse({ mediaType: "image/webp", fileExtension: "webp" });
|
|
586
588
|
}
|
|
587
589
|
static get WOFF() {
|
|
588
|
-
return
|
|
590
|
+
return a.parse({ mediaType: "font/woff", fileExtension: "woff" });
|
|
589
591
|
}
|
|
590
592
|
static get WOFF2() {
|
|
591
|
-
return
|
|
593
|
+
return a.parse({ mediaType: "font/woff2", fileExtension: "woff2" });
|
|
592
594
|
}
|
|
593
595
|
static get XHTML() {
|
|
594
|
-
return
|
|
596
|
+
return a.parse({
|
|
595
597
|
mediaType: "application/xhtml+xml",
|
|
596
598
|
fileExtension: "xhtml"
|
|
597
599
|
});
|
|
598
600
|
}
|
|
599
601
|
static get XML() {
|
|
600
|
-
return
|
|
602
|
+
return a.parse({
|
|
601
603
|
mediaType: "application/xml",
|
|
602
604
|
fileExtension: "xml"
|
|
603
605
|
});
|
|
604
606
|
}
|
|
605
607
|
static get ZAB() {
|
|
606
|
-
return
|
|
608
|
+
return a.parse({
|
|
607
609
|
mediaType: "application/x.readium.zab+zip",
|
|
608
610
|
name: "Zipped Audio Book",
|
|
609
611
|
fileExtension: "zab"
|
|
610
612
|
});
|
|
611
613
|
}
|
|
612
614
|
static get ZIP() {
|
|
613
|
-
return
|
|
615
|
+
return a.parse({
|
|
614
616
|
mediaType: "application/zip",
|
|
615
617
|
fileExtension: "zip"
|
|
616
618
|
});
|
|
617
619
|
}
|
|
618
620
|
}
|
|
619
|
-
class
|
|
621
|
+
class Ee {
|
|
620
622
|
constructor(e) {
|
|
621
623
|
this.uri = e, this.parameters = this.getParameters(e);
|
|
622
624
|
}
|
|
@@ -638,28 +640,28 @@ class ye {
|
|
|
638
640
|
const o = e[n];
|
|
639
641
|
return o ? encodeURIComponent(o) : "";
|
|
640
642
|
}).join(","), i = (s) => "?" + s.split(",").map((n) => {
|
|
641
|
-
const o = n.split("=")[0],
|
|
642
|
-
return
|
|
643
|
+
const o = n.split("=")[0], l = e[o];
|
|
644
|
+
return l ? `${o}=${encodeURIComponent(l)}` : "";
|
|
643
645
|
}).join("&");
|
|
644
646
|
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? i(s[2]) : t(s[2]));
|
|
645
647
|
}
|
|
646
648
|
}
|
|
647
|
-
function
|
|
649
|
+
function ct(r) {
|
|
648
650
|
return r && r instanceof Array ? r : void 0;
|
|
649
651
|
}
|
|
650
|
-
function
|
|
651
|
-
return r && typeof r == "string" ? [r] :
|
|
652
|
+
function Ue(r) {
|
|
653
|
+
return r && typeof r == "string" ? [r] : ct(r);
|
|
652
654
|
}
|
|
653
|
-
function
|
|
655
|
+
function be(r) {
|
|
654
656
|
return typeof r == "string" ? new Date(r) : void 0;
|
|
655
657
|
}
|
|
656
|
-
function
|
|
658
|
+
function q(r) {
|
|
657
659
|
return isNaN(r) ? void 0 : r;
|
|
658
660
|
}
|
|
659
661
|
function C(r) {
|
|
660
|
-
return
|
|
662
|
+
return q(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
661
663
|
}
|
|
662
|
-
function
|
|
664
|
+
function ut(r) {
|
|
663
665
|
const e = new Array();
|
|
664
666
|
return r.forEach((t) => e.push(t)), e;
|
|
665
667
|
}
|
|
@@ -676,17 +678,17 @@ class x {
|
|
|
676
678
|
static deserialize(e) {
|
|
677
679
|
if (!e)
|
|
678
680
|
return;
|
|
679
|
-
const t =
|
|
681
|
+
const t = q(e.progression), i = q(e.totalProgression), s = q(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
680
682
|
"fragment",
|
|
681
683
|
"fragments",
|
|
682
684
|
"progression",
|
|
683
685
|
"totalProgression",
|
|
684
686
|
"position"
|
|
685
687
|
]);
|
|
686
|
-
return Object.entries(e).forEach(([
|
|
687
|
-
o.has(
|
|
688
|
+
return Object.entries(e).forEach(([l, c]) => {
|
|
689
|
+
o.has(l) || n.set(l, c);
|
|
688
690
|
}), new x({
|
|
689
|
-
fragments:
|
|
691
|
+
fragments: Ue(e.fragments || e.fragment),
|
|
690
692
|
progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
|
|
691
693
|
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
692
694
|
position: s !== void 0 && s > 0 ? s : void 0,
|
|
@@ -701,7 +703,7 @@ class x {
|
|
|
701
703
|
return this.fragments && (e.fragments = this.fragments), this.progression !== void 0 && (e.progression = this.progression), this.totalProgression !== void 0 && (e.totalProgression = this.totalProgression), this.position !== void 0 && (e.position = this.position), this.otherLocations && this.otherLocations.forEach((t, i) => e[i] = t), e;
|
|
702
704
|
}
|
|
703
705
|
}
|
|
704
|
-
class
|
|
706
|
+
class k {
|
|
705
707
|
/**
|
|
706
708
|
* Creates a [Text].
|
|
707
709
|
*/
|
|
@@ -713,7 +715,7 @@ class U {
|
|
|
713
715
|
*/
|
|
714
716
|
static deserialize(e) {
|
|
715
717
|
if (e)
|
|
716
|
-
return new
|
|
718
|
+
return new k({
|
|
717
719
|
after: e.after,
|
|
718
720
|
before: e.before,
|
|
719
721
|
highlight: e.highlight
|
|
@@ -727,7 +729,7 @@ class U {
|
|
|
727
729
|
return this.after !== void 0 && (e.after = this.after), this.before !== void 0 && (e.before = this.before), this.highlight !== void 0 && (e.highlight = this.highlight), e;
|
|
728
730
|
}
|
|
729
731
|
}
|
|
730
|
-
class
|
|
732
|
+
class W {
|
|
731
733
|
/**
|
|
732
734
|
* Creates a [Locator].
|
|
733
735
|
*/
|
|
@@ -739,12 +741,12 @@ class D {
|
|
|
739
741
|
*/
|
|
740
742
|
static deserialize(e) {
|
|
741
743
|
if (e && e.href && e.type)
|
|
742
|
-
return new
|
|
744
|
+
return new W({
|
|
743
745
|
href: e.href,
|
|
744
746
|
type: e.type,
|
|
745
747
|
title: e.title,
|
|
746
748
|
locations: x.deserialize(e.locations),
|
|
747
|
-
text:
|
|
749
|
+
text: k.deserialize(e.text)
|
|
748
750
|
});
|
|
749
751
|
}
|
|
750
752
|
/**
|
|
@@ -758,7 +760,7 @@ class D {
|
|
|
758
760
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
759
761
|
*/
|
|
760
762
|
copyWithLocations(e) {
|
|
761
|
-
return new
|
|
763
|
+
return new W({
|
|
762
764
|
href: this.href,
|
|
763
765
|
type: this.type,
|
|
764
766
|
title: this.title,
|
|
@@ -767,7 +769,7 @@ class D {
|
|
|
767
769
|
});
|
|
768
770
|
}
|
|
769
771
|
}
|
|
770
|
-
class
|
|
772
|
+
class $ {
|
|
771
773
|
/**
|
|
772
774
|
* Creates a [Link].
|
|
773
775
|
*/
|
|
@@ -778,8 +780,8 @@ class B {
|
|
|
778
780
|
* Parses a [Link] from its RWPM JSON representation.
|
|
779
781
|
*/
|
|
780
782
|
static deserialize(e) {
|
|
781
|
-
if (e
|
|
782
|
-
return new
|
|
783
|
+
if (!(!e || typeof e.href != "string"))
|
|
784
|
+
return new $({
|
|
783
785
|
href: e.href,
|
|
784
786
|
templated: e.templated,
|
|
785
787
|
type: e.type,
|
|
@@ -790,9 +792,9 @@ class B {
|
|
|
790
792
|
width: C(e.width),
|
|
791
793
|
duration: C(e.duration),
|
|
792
794
|
bitrate: C(e.bitrate),
|
|
793
|
-
languages:
|
|
794
|
-
alternates:
|
|
795
|
-
children:
|
|
795
|
+
languages: Ue(e.language),
|
|
796
|
+
alternates: _.deserialize(e.alternate),
|
|
797
|
+
children: _.deserialize(e.children)
|
|
796
798
|
});
|
|
797
799
|
}
|
|
798
800
|
/**
|
|
@@ -800,11 +802,11 @@ class B {
|
|
|
800
802
|
*/
|
|
801
803
|
serialize() {
|
|
802
804
|
const e = { href: this.href };
|
|
803
|
-
return this.templated !== void 0 && (e.templated = this.templated), this.type !== void 0 && (e.type = this.type), this.title !== void 0 && (e.title = this.title), this.rels && (e.rel =
|
|
805
|
+
return this.templated !== void 0 && (e.templated = this.templated), this.type !== void 0 && (e.type = this.type), this.title !== void 0 && (e.title = this.title), this.rels && (e.rel = ut(this.rels)), this.properties && (e.properties = this.properties.serialize()), this.height !== void 0 && (e.height = this.height), this.width !== void 0 && (e.width = this.width), this.duration !== void 0 && (e.duration = this.duration), this.bitrate !== void 0 && (e.bitrate = this.bitrate), this.languages && (e.language = this.languages), this.alternates && (e.alternate = this.alternates.serialize()), this.children && (e.children = this.children.serialize()), e;
|
|
804
806
|
}
|
|
805
807
|
/** MediaType of the linked resource. */
|
|
806
808
|
get mediaType() {
|
|
807
|
-
return this.type !== void 0 ?
|
|
809
|
+
return this.type !== void 0 ? a.parse({ mediaType: this.type }) : a.BINARY;
|
|
808
810
|
}
|
|
809
811
|
/** Computes an absolute URL to the link, relative to the given `baseURL`.
|
|
810
812
|
* If the link's `href` is already absolute, the `baseURL` is ignored.
|
|
@@ -818,14 +820,14 @@ class B {
|
|
|
818
820
|
}
|
|
819
821
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
820
822
|
get templateParameters() {
|
|
821
|
-
return this.templated ? new
|
|
823
|
+
return this.templated ? new Ee(this.href).parameters : /* @__PURE__ */ new Set();
|
|
822
824
|
}
|
|
823
825
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
824
826
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
825
827
|
*/
|
|
826
828
|
expandTemplate(e) {
|
|
827
|
-
return new
|
|
828
|
-
href: new
|
|
829
|
+
return new $({
|
|
830
|
+
href: new Ee(this.href).expand(e),
|
|
829
831
|
templated: !1
|
|
830
832
|
});
|
|
831
833
|
}
|
|
@@ -834,7 +836,7 @@ class B {
|
|
|
834
836
|
*/
|
|
835
837
|
addProperties(e) {
|
|
836
838
|
var t;
|
|
837
|
-
const i =
|
|
839
|
+
const i = $.deserialize(this.serialize());
|
|
838
840
|
return i.properties = i.properties ? (t = i.properties) == null ? void 0 : t.add(e) : new E(e), i;
|
|
839
841
|
}
|
|
840
842
|
/**
|
|
@@ -842,7 +844,7 @@ class B {
|
|
|
842
844
|
*/
|
|
843
845
|
get locator() {
|
|
844
846
|
let e = this.href.split("#");
|
|
845
|
-
return new
|
|
847
|
+
return new W({
|
|
846
848
|
href: e.length > 0 && e[0] !== void 0 ? e[0] : this.href,
|
|
847
849
|
type: this.type ?? "",
|
|
848
850
|
title: this.title,
|
|
@@ -852,7 +854,7 @@ class B {
|
|
|
852
854
|
});
|
|
853
855
|
}
|
|
854
856
|
}
|
|
855
|
-
class
|
|
857
|
+
class _ {
|
|
856
858
|
/**
|
|
857
859
|
* Creates a [Links].
|
|
858
860
|
*/
|
|
@@ -864,8 +866,8 @@ class V {
|
|
|
864
866
|
*/
|
|
865
867
|
static deserialize(e) {
|
|
866
868
|
if (e && e instanceof Array)
|
|
867
|
-
return new
|
|
868
|
-
e.map((t) =>
|
|
869
|
+
return new _(
|
|
870
|
+
e.map((t) => $.deserialize(t)).filter((t) => t !== void 0)
|
|
869
871
|
);
|
|
870
872
|
}
|
|
871
873
|
/**
|
|
@@ -946,7 +948,40 @@ class V {
|
|
|
946
948
|
return this.items.filter((e) => e.type);
|
|
947
949
|
}
|
|
948
950
|
}
|
|
949
|
-
class
|
|
951
|
+
class se {
|
|
952
|
+
/**
|
|
953
|
+
* Creates a [Encryption].
|
|
954
|
+
*/
|
|
955
|
+
constructor(e) {
|
|
956
|
+
this.algorithm = e.algorithm, this.compression = e.compression, this.originalLength = e.originalLength, this.profile = e.profile, this.scheme = e.scheme;
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Parses a [Encryption] from its RWPM JSON representation.
|
|
960
|
+
*/
|
|
961
|
+
static deserialize(e) {
|
|
962
|
+
if (e && e.algorithm)
|
|
963
|
+
return new se({
|
|
964
|
+
algorithm: e.algorithm,
|
|
965
|
+
compression: e.compression,
|
|
966
|
+
originalLength: e.originalLength,
|
|
967
|
+
profile: e.profile,
|
|
968
|
+
scheme: e.scheme
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Serializes a [Encryption] to its RWPM JSON representation.
|
|
973
|
+
*/
|
|
974
|
+
serialize() {
|
|
975
|
+
const e = { algorithm: this.algorithm };
|
|
976
|
+
return this.compression !== void 0 && (e.compression = this.compression), this.originalLength !== void 0 && (e.originalLength = this.originalLength), this.profile !== void 0 && (e.profile = this.profile), this.scheme !== void 0 && (e.scheme = this.scheme), e;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
Object.defineProperty(E.prototype, "encryption", {
|
|
980
|
+
get: function() {
|
|
981
|
+
return se.deserialize(this.otherProperties.encrypted);
|
|
982
|
+
}
|
|
983
|
+
});
|
|
984
|
+
class X {
|
|
950
985
|
/**
|
|
951
986
|
* Creates a [DomRange].
|
|
952
987
|
*/
|
|
@@ -963,7 +998,7 @@ class q {
|
|
|
963
998
|
if (t === void 0)
|
|
964
999
|
return;
|
|
965
1000
|
let i = C(e.charOffset);
|
|
966
|
-
return i === void 0 && (i = C(e.offset)), new
|
|
1001
|
+
return i === void 0 && (i = C(e.offset)), new X({
|
|
967
1002
|
cssSelector: e.cssSelector,
|
|
968
1003
|
textNodeIndex: t,
|
|
969
1004
|
charOffset: i
|
|
@@ -980,7 +1015,7 @@ class q {
|
|
|
980
1015
|
return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
|
|
981
1016
|
}
|
|
982
1017
|
}
|
|
983
|
-
class
|
|
1018
|
+
class ne {
|
|
984
1019
|
/**
|
|
985
1020
|
* Creates a [DomRange].
|
|
986
1021
|
*/
|
|
@@ -993,11 +1028,11 @@ class re {
|
|
|
993
1028
|
static deserialize(e) {
|
|
994
1029
|
if (!e)
|
|
995
1030
|
return;
|
|
996
|
-
let t =
|
|
1031
|
+
let t = X.deserialize(e.start);
|
|
997
1032
|
if (t)
|
|
998
|
-
return new
|
|
1033
|
+
return new ne({
|
|
999
1034
|
start: t,
|
|
1000
|
-
end:
|
|
1035
|
+
end: X.deserialize(e.end)
|
|
1001
1036
|
});
|
|
1002
1037
|
}
|
|
1003
1038
|
/**
|
|
@@ -1018,7 +1053,7 @@ x.prototype.getPartialCfi = function() {
|
|
|
1018
1053
|
};
|
|
1019
1054
|
x.prototype.getDomRange = function() {
|
|
1020
1055
|
var r;
|
|
1021
|
-
return
|
|
1056
|
+
return ne.deserialize((r = this.otherLocations) == null ? void 0 : r.get("domRange"));
|
|
1022
1057
|
};
|
|
1023
1058
|
x.prototype.fragmentParameters = function() {
|
|
1024
1059
|
return new Map(
|
|
@@ -1056,7 +1091,7 @@ x.prototype.space = function() {
|
|
|
1056
1091
|
if (e.length === 4 && !e.some(isNaN))
|
|
1057
1092
|
return e;
|
|
1058
1093
|
};
|
|
1059
|
-
class
|
|
1094
|
+
class oe {
|
|
1060
1095
|
/** Creates a [Price]. */
|
|
1061
1096
|
constructor(e) {
|
|
1062
1097
|
this.currency = e.currency, this.value = e.value;
|
|
@@ -1072,7 +1107,7 @@ class se {
|
|
|
1072
1107
|
return;
|
|
1073
1108
|
let i = C(e.value);
|
|
1074
1109
|
if (i !== void 0)
|
|
1075
|
-
return new
|
|
1110
|
+
return new oe({ currency: t, value: i });
|
|
1076
1111
|
}
|
|
1077
1112
|
/**
|
|
1078
1113
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1081,7 +1116,7 @@ class se {
|
|
|
1081
1116
|
return { currency: this.currency, value: this.value };
|
|
1082
1117
|
}
|
|
1083
1118
|
}
|
|
1084
|
-
class
|
|
1119
|
+
class j {
|
|
1085
1120
|
/** Creates a [Acquisition]. */
|
|
1086
1121
|
constructor(e) {
|
|
1087
1122
|
this.type = e.type, this.children = e.children;
|
|
@@ -1091,14 +1126,14 @@ class H {
|
|
|
1091
1126
|
*/
|
|
1092
1127
|
static deserialize(e) {
|
|
1093
1128
|
if (e && e.type)
|
|
1094
|
-
return new
|
|
1129
|
+
return new j({
|
|
1095
1130
|
type: e.type,
|
|
1096
|
-
children:
|
|
1131
|
+
children: j.deserializeArray(e.children)
|
|
1097
1132
|
});
|
|
1098
1133
|
}
|
|
1099
1134
|
static deserializeArray(e) {
|
|
1100
1135
|
if (e instanceof Array)
|
|
1101
|
-
return e.map((t) =>
|
|
1136
|
+
return e.map((t) => j.deserialize(t)).filter((t) => t !== void 0);
|
|
1102
1137
|
}
|
|
1103
1138
|
/**
|
|
1104
1139
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1108,7 +1143,7 @@ class H {
|
|
|
1108
1143
|
return this.children && (e.children = this.children.map((t) => t.serialize())), e;
|
|
1109
1144
|
}
|
|
1110
1145
|
}
|
|
1111
|
-
class
|
|
1146
|
+
class ae {
|
|
1112
1147
|
/** Creates a [Price]. */
|
|
1113
1148
|
constructor(e) {
|
|
1114
1149
|
this.total = e.total, this.position = e.position;
|
|
@@ -1118,7 +1153,7 @@ class ne {
|
|
|
1118
1153
|
*/
|
|
1119
1154
|
static deserialize(e) {
|
|
1120
1155
|
if (e)
|
|
1121
|
-
return new
|
|
1156
|
+
return new ae({
|
|
1122
1157
|
total: C(e.total),
|
|
1123
1158
|
position: C(e.position)
|
|
1124
1159
|
});
|
|
@@ -1131,7 +1166,7 @@ class ne {
|
|
|
1131
1166
|
return this.total !== void 0 && (e.total = this.total), this.position !== void 0 && (e.position = this.position), e;
|
|
1132
1167
|
}
|
|
1133
1168
|
}
|
|
1134
|
-
class
|
|
1169
|
+
class le {
|
|
1135
1170
|
/** Creates a [Copies]. */
|
|
1136
1171
|
constructor(e) {
|
|
1137
1172
|
this.total = e.total, this.available = e.available;
|
|
@@ -1141,7 +1176,7 @@ class oe {
|
|
|
1141
1176
|
*/
|
|
1142
1177
|
static deserialize(e) {
|
|
1143
1178
|
if (e)
|
|
1144
|
-
return new
|
|
1179
|
+
return new le({
|
|
1145
1180
|
total: C(e.total),
|
|
1146
1181
|
available: C(e.available)
|
|
1147
1182
|
});
|
|
@@ -1154,7 +1189,7 @@ class oe {
|
|
|
1154
1189
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1155
1190
|
}
|
|
1156
1191
|
}
|
|
1157
|
-
class
|
|
1192
|
+
class he {
|
|
1158
1193
|
/** Creates a [Availability]. */
|
|
1159
1194
|
constructor(e) {
|
|
1160
1195
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1164,10 +1199,10 @@ class ae {
|
|
|
1164
1199
|
*/
|
|
1165
1200
|
static deserialize(e) {
|
|
1166
1201
|
if (e && e.state)
|
|
1167
|
-
return new
|
|
1202
|
+
return new he({
|
|
1168
1203
|
state: e.state,
|
|
1169
|
-
since:
|
|
1170
|
-
until:
|
|
1204
|
+
since: be(e.since),
|
|
1205
|
+
until: be(e.until)
|
|
1171
1206
|
});
|
|
1172
1207
|
}
|
|
1173
1208
|
/**
|
|
@@ -1182,24 +1217,24 @@ E.prototype.getNumberOfItems = function() {
|
|
|
1182
1217
|
return C(this.otherProperties.numberOfItems);
|
|
1183
1218
|
};
|
|
1184
1219
|
E.prototype.getPrice = function() {
|
|
1185
|
-
return
|
|
1220
|
+
return oe.deserialize(this.otherProperties.price);
|
|
1186
1221
|
};
|
|
1187
1222
|
E.prototype.getIndirectAcquisitions = function() {
|
|
1188
1223
|
const r = this.otherProperties.indirectAcquisition;
|
|
1189
1224
|
if (r && r instanceof Array)
|
|
1190
|
-
return r.map((e) =>
|
|
1225
|
+
return r.map((e) => j.deserialize(e)).filter((e) => e !== void 0);
|
|
1191
1226
|
};
|
|
1192
1227
|
E.prototype.getHolds = function() {
|
|
1193
|
-
return
|
|
1228
|
+
return ae.deserialize(this.otherProperties.holds);
|
|
1194
1229
|
};
|
|
1195
1230
|
E.prototype.getCopies = function() {
|
|
1196
|
-
return
|
|
1231
|
+
return le.deserialize(this.otherProperties.copies);
|
|
1197
1232
|
};
|
|
1198
1233
|
E.prototype.getAvailability = function() {
|
|
1199
|
-
return
|
|
1234
|
+
return he.deserialize(this.otherProperties.availability);
|
|
1200
1235
|
};
|
|
1201
1236
|
E.prototype.getAuthenticate = function() {
|
|
1202
|
-
return
|
|
1237
|
+
return $.deserialize(this.otherProperties.authenticate);
|
|
1203
1238
|
};
|
|
1204
1239
|
E.prototype.getClipped = function() {
|
|
1205
1240
|
return this.otherProperties.clipped;
|
|
@@ -1219,78 +1254,78 @@ E.prototype.getPage = function() {
|
|
|
1219
1254
|
E.prototype.getSpread = function() {
|
|
1220
1255
|
return this.otherProperties.spread || void 0;
|
|
1221
1256
|
};
|
|
1222
|
-
var
|
|
1257
|
+
var D;
|
|
1223
1258
|
(function(r) {
|
|
1224
1259
|
r.NONE = "none", r.DESCENDANT = "descendant", r.CHILD = "child";
|
|
1225
|
-
})(
|
|
1226
|
-
var
|
|
1260
|
+
})(D || (D = {}));
|
|
1261
|
+
var A;
|
|
1227
1262
|
(function(r) {
|
|
1228
1263
|
r.id = "id", r.class = "class", r.tag = "tag", r.attribute = "attribute", r.nthchild = "nthchild", r.nthoftype = "nthoftype";
|
|
1229
|
-
})(
|
|
1230
|
-
const
|
|
1231
|
-
function
|
|
1232
|
-
console.warn(`${
|
|
1264
|
+
})(A || (A = {}));
|
|
1265
|
+
const dt = "CssSelectorGenerator";
|
|
1266
|
+
function xe(r = "unknown problem", ...e) {
|
|
1267
|
+
console.warn(`${dt}: ${r}`, ...e);
|
|
1233
1268
|
}
|
|
1234
|
-
|
|
1235
|
-
function
|
|
1269
|
+
A.id, A.class, A.tag, A.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
|
|
1270
|
+
function pt(r) {
|
|
1236
1271
|
return r instanceof RegExp;
|
|
1237
1272
|
}
|
|
1238
|
-
function
|
|
1273
|
+
function ft(r) {
|
|
1239
1274
|
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1240
1275
|
}
|
|
1241
|
-
function
|
|
1276
|
+
function mt(r) {
|
|
1242
1277
|
const e = r.map((t) => {
|
|
1243
|
-
if (
|
|
1278
|
+
if (pt(t))
|
|
1244
1279
|
return (i) => t.test(i);
|
|
1245
1280
|
if (typeof t == "function")
|
|
1246
1281
|
return (i) => {
|
|
1247
1282
|
const s = t(i);
|
|
1248
|
-
return typeof s != "boolean" ? (
|
|
1283
|
+
return typeof s != "boolean" ? (xe("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", t), !1) : s;
|
|
1249
1284
|
};
|
|
1250
1285
|
if (typeof t == "string") {
|
|
1251
|
-
const i = new RegExp("^" +
|
|
1286
|
+
const i = new RegExp("^" + ft(t) + "$");
|
|
1252
1287
|
return (s) => i.test(s);
|
|
1253
1288
|
}
|
|
1254
|
-
return
|
|
1289
|
+
return xe("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", t), () => !1;
|
|
1255
1290
|
});
|
|
1256
1291
|
return (t) => e.some((i) => i(t));
|
|
1257
1292
|
}
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1293
|
+
const gt = "", yt = " > ", vt = " ";
|
|
1294
|
+
D.NONE + "", D.NONE, D.DESCENDANT + "", D.DESCENDANT, D.CHILD + "", D.CHILD;
|
|
1295
|
+
A.nthoftype, A.tag, A.id, A.class, A.attribute, A.nthchild;
|
|
1296
|
+
mt([
|
|
1262
1297
|
"class",
|
|
1263
1298
|
"id",
|
|
1264
1299
|
// Angular attributes
|
|
1265
1300
|
"ng-*"
|
|
1266
1301
|
]);
|
|
1267
|
-
class
|
|
1302
|
+
class K {
|
|
1268
1303
|
}
|
|
1269
|
-
function
|
|
1304
|
+
function Se(r) {
|
|
1270
1305
|
return r.split("").reverse().join("");
|
|
1271
1306
|
}
|
|
1272
|
-
function
|
|
1273
|
-
const i =
|
|
1307
|
+
function Et(r, e, t) {
|
|
1308
|
+
const i = Se(e);
|
|
1274
1309
|
return t.map((s) => {
|
|
1275
|
-
const n = Math.max(0, s.end - e.length - s.errors), o =
|
|
1310
|
+
const n = Math.max(0, s.end - e.length - s.errors), o = Se(r.slice(n, s.end));
|
|
1276
1311
|
return {
|
|
1277
|
-
start:
|
|
1312
|
+
start: Be(o, i, s.errors).reduce((c, h) => s.end - h.end < c ? s.end - h.end : c, s.end),
|
|
1278
1313
|
end: s.end,
|
|
1279
1314
|
errors: s.errors
|
|
1280
1315
|
};
|
|
1281
1316
|
});
|
|
1282
1317
|
}
|
|
1283
|
-
function
|
|
1318
|
+
function Q(r) {
|
|
1284
1319
|
return (r | -r) >> 31 & 1;
|
|
1285
1320
|
}
|
|
1286
|
-
function
|
|
1321
|
+
function we(r, e, t, i) {
|
|
1287
1322
|
let s = r.P[t], n = r.M[t];
|
|
1288
|
-
const o = i >>> 31,
|
|
1323
|
+
const o = i >>> 31, l = e[t] | o, c = l | n, h = (l & s) + s ^ s | l;
|
|
1289
1324
|
let u = n | ~(h | s), p = s & h;
|
|
1290
|
-
const d =
|
|
1291
|
-
return u <<= 1, p <<= 1, p |= o, u |=
|
|
1325
|
+
const d = Q(u & r.lastRowMask[t]) - Q(p & r.lastRowMask[t]);
|
|
1326
|
+
return u <<= 1, p <<= 1, p |= o, u |= Q(i) - o, s = p | ~(c | u), n = u & c, r.P[t] = s, r.M[t] = n, d;
|
|
1292
1327
|
}
|
|
1293
|
-
function
|
|
1328
|
+
function Be(r, e, t) {
|
|
1294
1329
|
if (e.length === 0)
|
|
1295
1330
|
return [];
|
|
1296
1331
|
t = Math.min(t, e.length);
|
|
@@ -1300,9 +1335,9 @@ function Fe(r, e, t) {
|
|
|
1300
1335
|
lastRowMask: new Uint32Array(n + 1)
|
|
1301
1336
|
};
|
|
1302
1337
|
o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % s;
|
|
1303
|
-
const
|
|
1338
|
+
const l = new Uint32Array(n + 1), c = /* @__PURE__ */ new Map(), h = [];
|
|
1304
1339
|
for (let d = 0; d < 256; d++)
|
|
1305
|
-
h.push(
|
|
1340
|
+
h.push(l);
|
|
1306
1341
|
for (let d = 0; d < e.length; d += 1) {
|
|
1307
1342
|
const f = e.charCodeAt(d);
|
|
1308
1343
|
if (c.has(f))
|
|
@@ -1329,10 +1364,10 @@ function Fe(r, e, t) {
|
|
|
1329
1364
|
for (let d = 0; d < r.length; d += 1) {
|
|
1330
1365
|
const f = r.charCodeAt(d);
|
|
1331
1366
|
let g;
|
|
1332
|
-
f < h.length ? g = h[f] : (g = c.get(f), typeof g > "u" && (g =
|
|
1367
|
+
f < h.length ? g = h[f] : (g = c.get(f), typeof g > "u" && (g = l));
|
|
1333
1368
|
let m = 0;
|
|
1334
1369
|
for (let v = 0; v <= u; v += 1)
|
|
1335
|
-
m =
|
|
1370
|
+
m = we(o, g, v, m), p[v] += m;
|
|
1336
1371
|
if (p[u] - m <= t && u < n && (g[u + 1] & 1 || m < 0)) {
|
|
1337
1372
|
u += 1, o.P[u] = -1, o.M[u] = 0;
|
|
1338
1373
|
let v;
|
|
@@ -1341,7 +1376,7 @@ function Fe(r, e, t) {
|
|
|
1341
1376
|
v = S === 0 ? s : S;
|
|
1342
1377
|
} else
|
|
1343
1378
|
v = s;
|
|
1344
|
-
p[u] = p[u - 1] + v - m +
|
|
1379
|
+
p[u] = p[u - 1] + v - m + we(o, g, u, m);
|
|
1345
1380
|
} else
|
|
1346
1381
|
for (; u > 0 && p[u] >= t + s; )
|
|
1347
1382
|
u -= 1;
|
|
@@ -1353,11 +1388,11 @@ function Fe(r, e, t) {
|
|
|
1353
1388
|
}
|
|
1354
1389
|
return i;
|
|
1355
1390
|
}
|
|
1356
|
-
function
|
|
1357
|
-
const i =
|
|
1358
|
-
return
|
|
1391
|
+
function bt(r, e, t) {
|
|
1392
|
+
const i = Be(r, e, t);
|
|
1393
|
+
return Et(r, e, i);
|
|
1359
1394
|
}
|
|
1360
|
-
function
|
|
1395
|
+
function $e(r, e, t) {
|
|
1361
1396
|
let i = 0;
|
|
1362
1397
|
const s = [];
|
|
1363
1398
|
for (; i !== -1; )
|
|
@@ -1366,40 +1401,40 @@ function Be(r, e, t) {
|
|
|
1366
1401
|
end: i + e.length,
|
|
1367
1402
|
errors: 0
|
|
1368
1403
|
}), i += 1);
|
|
1369
|
-
return s.length > 0 ? s :
|
|
1404
|
+
return s.length > 0 ? s : bt(r, e, t);
|
|
1370
1405
|
}
|
|
1371
|
-
function
|
|
1372
|
-
return e.length === 0 || r.length === 0 ? 0 : 1 -
|
|
1406
|
+
function Te(r, e) {
|
|
1407
|
+
return e.length === 0 || r.length === 0 ? 0 : 1 - $e(r, e, e.length)[0].errors / e.length;
|
|
1373
1408
|
}
|
|
1374
|
-
function
|
|
1409
|
+
function xt(r, e, t = {}) {
|
|
1375
1410
|
if (e.length === 0)
|
|
1376
1411
|
return null;
|
|
1377
|
-
const i = Math.min(256, e.length / 2), s =
|
|
1412
|
+
const i = Math.min(256, e.length / 2), s = $e(r, e, i);
|
|
1378
1413
|
if (s.length === 0)
|
|
1379
1414
|
return null;
|
|
1380
|
-
const n = (
|
|
1381
|
-
const d = 1 -
|
|
1415
|
+
const n = (l) => {
|
|
1416
|
+
const d = 1 - l.errors / e.length, f = t.prefix ? Te(
|
|
1382
1417
|
r.slice(
|
|
1383
|
-
Math.max(0,
|
|
1384
|
-
|
|
1418
|
+
Math.max(0, l.start - t.prefix.length),
|
|
1419
|
+
l.start
|
|
1385
1420
|
),
|
|
1386
1421
|
t.prefix
|
|
1387
|
-
) : 1, g = t.suffix ?
|
|
1388
|
-
r.slice(
|
|
1422
|
+
) : 1, g = t.suffix ? Te(
|
|
1423
|
+
r.slice(l.end, l.end + t.suffix.length),
|
|
1389
1424
|
t.suffix
|
|
1390
1425
|
) : 1;
|
|
1391
1426
|
let m = 1;
|
|
1392
|
-
typeof t.hint == "number" && (m = 1 - Math.abs(
|
|
1427
|
+
typeof t.hint == "number" && (m = 1 - Math.abs(l.start - t.hint) / r.length);
|
|
1393
1428
|
const v = 50 * d + 20 * f + 20 * g + 2 * m, S = 50 + 20 + 20 + 2;
|
|
1394
1429
|
return v / S;
|
|
1395
|
-
}, o = s.map((
|
|
1396
|
-
start:
|
|
1397
|
-
end:
|
|
1398
|
-
score: n(
|
|
1430
|
+
}, o = s.map((l) => ({
|
|
1431
|
+
start: l.start,
|
|
1432
|
+
end: l.end,
|
|
1433
|
+
score: n(l)
|
|
1399
1434
|
}));
|
|
1400
|
-
return o.sort((
|
|
1435
|
+
return o.sort((l, c) => c.score - l.score), o[0];
|
|
1401
1436
|
}
|
|
1402
|
-
function
|
|
1437
|
+
function ee(r, e, t) {
|
|
1403
1438
|
const i = t === 1 ? e : e - 1;
|
|
1404
1439
|
if (r.charAt(i).trim() !== "")
|
|
1405
1440
|
return e;
|
|
@@ -1409,7 +1444,7 @@ function J(r, e, t) {
|
|
|
1409
1444
|
const o = s.length - n.length;
|
|
1410
1445
|
return t === 2 ? e - o : e + o;
|
|
1411
1446
|
}
|
|
1412
|
-
function
|
|
1447
|
+
function Ce(r, e) {
|
|
1413
1448
|
const t = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1414
1449
|
r.commonAncestorContainer,
|
|
1415
1450
|
NodeFilter.SHOW_TEXT
|
|
@@ -1419,19 +1454,19 @@ function we(r, e) {
|
|
|
1419
1454
|
n = t.nextNode();
|
|
1420
1455
|
e === 2 && (n = t.previousNode());
|
|
1421
1456
|
let o = -1;
|
|
1422
|
-
const
|
|
1457
|
+
const l = () => {
|
|
1423
1458
|
if (n = e === 1 ? t.nextNode() : t.previousNode(), n) {
|
|
1424
1459
|
const c = n.textContent, h = e === 1 ? 0 : c.length;
|
|
1425
|
-
o =
|
|
1460
|
+
o = ee(c, h, e);
|
|
1426
1461
|
}
|
|
1427
1462
|
};
|
|
1428
1463
|
for (; n && o === -1 && n !== s; )
|
|
1429
|
-
|
|
1464
|
+
l();
|
|
1430
1465
|
if (n && o >= 0)
|
|
1431
1466
|
return { node: n, offset: o };
|
|
1432
1467
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1433
1468
|
}
|
|
1434
|
-
function
|
|
1469
|
+
function St(r) {
|
|
1435
1470
|
if (!r.toString().trim().length)
|
|
1436
1471
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1437
1472
|
if (r.startContainer.nodeType !== Node.TEXT_NODE)
|
|
@@ -1441,13 +1476,13 @@ function bt(r) {
|
|
|
1441
1476
|
const e = r.cloneRange();
|
|
1442
1477
|
let t = !1, i = !1;
|
|
1443
1478
|
const s = {
|
|
1444
|
-
start:
|
|
1479
|
+
start: ee(
|
|
1445
1480
|
r.startContainer.textContent,
|
|
1446
1481
|
r.startOffset,
|
|
1447
1482
|
1
|
|
1448
1483
|
/* Forwards */
|
|
1449
1484
|
),
|
|
1450
|
-
end:
|
|
1485
|
+
end: ee(
|
|
1451
1486
|
r.endContainer.textContent,
|
|
1452
1487
|
r.endOffset,
|
|
1453
1488
|
2
|
|
@@ -1457,7 +1492,7 @@ function bt(r) {
|
|
|
1457
1492
|
if (s.start >= 0 && (e.setStart(r.startContainer, s.start), t = !0), s.end > 0 && (e.setEnd(r.endContainer, s.end), i = !0), t && i)
|
|
1458
1493
|
return e;
|
|
1459
1494
|
if (!t) {
|
|
1460
|
-
const { node: n, offset: o } =
|
|
1495
|
+
const { node: n, offset: o } = Ce(
|
|
1461
1496
|
e,
|
|
1462
1497
|
1
|
|
1463
1498
|
/* Forwards */
|
|
@@ -1465,7 +1500,7 @@ function bt(r) {
|
|
|
1465
1500
|
n && o >= 0 && e.setStart(n, o);
|
|
1466
1501
|
}
|
|
1467
1502
|
if (!i) {
|
|
1468
|
-
const { node: n, offset: o } =
|
|
1503
|
+
const { node: n, offset: o } = Ce(
|
|
1469
1504
|
e,
|
|
1470
1505
|
2
|
|
1471
1506
|
/* Backwards */
|
|
@@ -1474,7 +1509,7 @@ function bt(r) {
|
|
|
1474
1509
|
}
|
|
1475
1510
|
return e;
|
|
1476
1511
|
}
|
|
1477
|
-
function
|
|
1512
|
+
function ke(r) {
|
|
1478
1513
|
var e;
|
|
1479
1514
|
switch (r.nodeType) {
|
|
1480
1515
|
case Node.ELEMENT_NODE:
|
|
@@ -1484,28 +1519,28 @@ function Ue(r) {
|
|
|
1484
1519
|
return 0;
|
|
1485
1520
|
}
|
|
1486
1521
|
}
|
|
1487
|
-
function
|
|
1522
|
+
function Pe(r) {
|
|
1488
1523
|
let e = r.previousSibling, t = 0;
|
|
1489
1524
|
for (; e; )
|
|
1490
|
-
t +=
|
|
1525
|
+
t += ke(e), e = e.previousSibling;
|
|
1491
1526
|
return t;
|
|
1492
1527
|
}
|
|
1493
|
-
function
|
|
1528
|
+
function Ve(r, ...e) {
|
|
1494
1529
|
let t = e.shift();
|
|
1495
1530
|
const i = r.ownerDocument.createNodeIterator(
|
|
1496
1531
|
r,
|
|
1497
1532
|
NodeFilter.SHOW_TEXT
|
|
1498
1533
|
), s = [];
|
|
1499
|
-
let n = i.nextNode(), o,
|
|
1534
|
+
let n = i.nextNode(), o, l = 0;
|
|
1500
1535
|
for (; t !== void 0 && n; )
|
|
1501
|
-
o = n,
|
|
1502
|
-
for (; t !== void 0 && o &&
|
|
1536
|
+
o = n, l + o.data.length > t ? (s.push({ node: o, offset: t - l }), t = e.shift()) : (n = i.nextNode(), l += o.data.length);
|
|
1537
|
+
for (; t !== void 0 && o && l === t; )
|
|
1503
1538
|
s.push({ node: o, offset: o.data.length }), t = e.shift();
|
|
1504
1539
|
if (t !== void 0)
|
|
1505
1540
|
throw new RangeError("Offset exceeds text length");
|
|
1506
1541
|
return s;
|
|
1507
1542
|
}
|
|
1508
|
-
class
|
|
1543
|
+
class N {
|
|
1509
1544
|
constructor(e, t) {
|
|
1510
1545
|
if (t < 0)
|
|
1511
1546
|
throw new Error("Offset is invalid");
|
|
@@ -1522,8 +1557,8 @@ class M {
|
|
|
1522
1557
|
throw new Error("Parent is not an ancestor of current element");
|
|
1523
1558
|
let t = this.element, i = this.offset;
|
|
1524
1559
|
for (; t !== e; )
|
|
1525
|
-
i +=
|
|
1526
|
-
return new
|
|
1560
|
+
i += Pe(t), t = t.parentElement;
|
|
1561
|
+
return new N(t, i);
|
|
1527
1562
|
}
|
|
1528
1563
|
/**
|
|
1529
1564
|
* Resolve the position to a specific text node and offset within that node.
|
|
@@ -1544,7 +1579,7 @@ class M {
|
|
|
1544
1579
|
*/
|
|
1545
1580
|
resolve(e = {}) {
|
|
1546
1581
|
try {
|
|
1547
|
-
return
|
|
1582
|
+
return Ve(this.element, this.offset)[0];
|
|
1548
1583
|
} catch (t) {
|
|
1549
1584
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
1550
1585
|
const i = document.createTreeWalker(
|
|
@@ -1567,9 +1602,9 @@ class M {
|
|
|
1567
1602
|
static fromCharOffset(e, t) {
|
|
1568
1603
|
switch (e.nodeType) {
|
|
1569
1604
|
case Node.TEXT_NODE:
|
|
1570
|
-
return
|
|
1605
|
+
return N.fromPoint(e, t);
|
|
1571
1606
|
case Node.ELEMENT_NODE:
|
|
1572
|
-
return new
|
|
1607
|
+
return new N(e, t);
|
|
1573
1608
|
default:
|
|
1574
1609
|
throw new Error("Node is not an element or text node");
|
|
1575
1610
|
}
|
|
@@ -1587,16 +1622,16 @@ class M {
|
|
|
1587
1622
|
throw new Error("Text node offset is out of range");
|
|
1588
1623
|
if (!e.parentElement)
|
|
1589
1624
|
throw new Error("Text node has no parent");
|
|
1590
|
-
const i =
|
|
1591
|
-
return new
|
|
1625
|
+
const i = Pe(e) + t;
|
|
1626
|
+
return new N(e.parentElement, i);
|
|
1592
1627
|
}
|
|
1593
1628
|
case Node.ELEMENT_NODE: {
|
|
1594
1629
|
if (t < 0 || t > e.childNodes.length)
|
|
1595
1630
|
throw new Error("Child node offset is out of range");
|
|
1596
1631
|
let i = 0;
|
|
1597
1632
|
for (let s = 0; s < t; s++)
|
|
1598
|
-
i +=
|
|
1599
|
-
return new
|
|
1633
|
+
i += ke(e.childNodes[s]);
|
|
1634
|
+
return new N(e, i);
|
|
1600
1635
|
}
|
|
1601
1636
|
default:
|
|
1602
1637
|
throw new Error("Point is not in an element or text node");
|
|
@@ -1629,7 +1664,7 @@ class z {
|
|
|
1629
1664
|
*/
|
|
1630
1665
|
toRange() {
|
|
1631
1666
|
let e, t;
|
|
1632
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
1667
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = Ve(
|
|
1633
1668
|
this.start.element,
|
|
1634
1669
|
this.start.offset,
|
|
1635
1670
|
this.end.offset
|
|
@@ -1647,10 +1682,10 @@ class z {
|
|
|
1647
1682
|
* Create a TextRange from a (DOM) Range
|
|
1648
1683
|
*/
|
|
1649
1684
|
static fromRange(e) {
|
|
1650
|
-
const t =
|
|
1685
|
+
const t = N.fromPoint(
|
|
1651
1686
|
e.startContainer,
|
|
1652
1687
|
e.startOffset
|
|
1653
|
-
), i =
|
|
1688
|
+
), i = N.fromPoint(e.endContainer, e.endOffset);
|
|
1654
1689
|
return new z(t, i);
|
|
1655
1690
|
}
|
|
1656
1691
|
/**
|
|
@@ -1659,8 +1694,8 @@ class z {
|
|
|
1659
1694
|
*/
|
|
1660
1695
|
static fromOffsets(e, t, i) {
|
|
1661
1696
|
return new z(
|
|
1662
|
-
new
|
|
1663
|
-
new
|
|
1697
|
+
new N(e, t),
|
|
1698
|
+
new N(e, i)
|
|
1664
1699
|
);
|
|
1665
1700
|
}
|
|
1666
1701
|
/**
|
|
@@ -1668,23 +1703,23 @@ class z {
|
|
|
1668
1703
|
* whitespace
|
|
1669
1704
|
*/
|
|
1670
1705
|
static trimmedRange(e) {
|
|
1671
|
-
return
|
|
1706
|
+
return St(z.fromRange(e).toRange());
|
|
1672
1707
|
}
|
|
1673
1708
|
}
|
|
1674
|
-
class
|
|
1709
|
+
class G {
|
|
1675
1710
|
constructor(e, t, i) {
|
|
1676
1711
|
this.root = e, this.start = t, this.end = i;
|
|
1677
1712
|
}
|
|
1678
1713
|
static fromRange(e, t) {
|
|
1679
1714
|
const i = z.fromRange(t).relativeTo(e);
|
|
1680
|
-
return new
|
|
1715
|
+
return new G(
|
|
1681
1716
|
e,
|
|
1682
1717
|
i.start.offset,
|
|
1683
1718
|
i.end.offset
|
|
1684
1719
|
);
|
|
1685
1720
|
}
|
|
1686
1721
|
static fromSelector(e, t) {
|
|
1687
|
-
return new
|
|
1722
|
+
return new G(e, t.start, t.end);
|
|
1688
1723
|
}
|
|
1689
1724
|
toSelector() {
|
|
1690
1725
|
return {
|
|
@@ -1697,7 +1732,7 @@ class _ {
|
|
|
1697
1732
|
return z.fromOffsets(this.root, this.start, this.end).toRange();
|
|
1698
1733
|
}
|
|
1699
1734
|
}
|
|
1700
|
-
class
|
|
1735
|
+
class Y {
|
|
1701
1736
|
/**
|
|
1702
1737
|
* @param root - A root element from which to anchor.
|
|
1703
1738
|
*/
|
|
@@ -1710,15 +1745,15 @@ class X {
|
|
|
1710
1745
|
* Will throw if `range` does not contain any text nodes.
|
|
1711
1746
|
*/
|
|
1712
1747
|
static fromRange(e, t) {
|
|
1713
|
-
const i = e.textContent, s = z.fromRange(t).relativeTo(e), n = s.start.offset, o = s.end.offset,
|
|
1714
|
-
return new
|
|
1715
|
-
prefix: i.slice(Math.max(0, n -
|
|
1716
|
-
suffix: i.slice(o, Math.min(i.length, o +
|
|
1748
|
+
const i = e.textContent, s = z.fromRange(t).relativeTo(e), n = s.start.offset, o = s.end.offset, l = 32;
|
|
1749
|
+
return new Y(e, i.slice(n, o), {
|
|
1750
|
+
prefix: i.slice(Math.max(0, n - l), n),
|
|
1751
|
+
suffix: i.slice(o, Math.min(i.length, o + l))
|
|
1717
1752
|
});
|
|
1718
1753
|
}
|
|
1719
1754
|
static fromSelector(e, t) {
|
|
1720
1755
|
const { prefix: i, suffix: s } = t;
|
|
1721
|
-
return new
|
|
1756
|
+
return new Y(e, t.exact, { prefix: i, suffix: s });
|
|
1722
1757
|
}
|
|
1723
1758
|
toSelector() {
|
|
1724
1759
|
return {
|
|
@@ -1732,26 +1767,26 @@ class X {
|
|
|
1732
1767
|
return this.toPositionAnchor(e).toRange();
|
|
1733
1768
|
}
|
|
1734
1769
|
toPositionAnchor(e = {}) {
|
|
1735
|
-
const t = this.root.textContent, i =
|
|
1770
|
+
const t = this.root.textContent, i = xt(t, this.exact, {
|
|
1736
1771
|
...this.context,
|
|
1737
1772
|
hint: e.hint
|
|
1738
1773
|
});
|
|
1739
1774
|
if (!i)
|
|
1740
1775
|
throw new Error("Quote not found");
|
|
1741
|
-
return new
|
|
1776
|
+
return new G(this.root, i.start, i.end);
|
|
1742
1777
|
}
|
|
1743
1778
|
}
|
|
1744
|
-
function
|
|
1779
|
+
function wt(r) {
|
|
1745
1780
|
const e = r.tagName.toUpperCase();
|
|
1746
1781
|
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
1747
1782
|
}
|
|
1748
|
-
function
|
|
1783
|
+
function ce(r, e) {
|
|
1749
1784
|
try {
|
|
1750
1785
|
const t = e.locations, i = e.text;
|
|
1751
1786
|
if (i && i.highlight) {
|
|
1752
1787
|
let s;
|
|
1753
1788
|
t && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), s || (s = r.body);
|
|
1754
|
-
const n = new
|
|
1789
|
+
const n = new Y(s, i.highlight, {
|
|
1755
1790
|
prefix: i.before,
|
|
1756
1791
|
suffix: i.after
|
|
1757
1792
|
});
|
|
@@ -1770,7 +1805,7 @@ function le(r, e) {
|
|
|
1770
1805
|
}
|
|
1771
1806
|
if (s) {
|
|
1772
1807
|
const n = r.createRange();
|
|
1773
|
-
return s.childNodes.length === 0 ||
|
|
1808
|
+
return s.childNodes.length === 0 || wt(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1774
1809
|
}
|
|
1775
1810
|
}
|
|
1776
1811
|
} catch (t) {
|
|
@@ -1778,7 +1813,7 @@ function le(r, e) {
|
|
|
1778
1813
|
}
|
|
1779
1814
|
return null;
|
|
1780
1815
|
}
|
|
1781
|
-
function
|
|
1816
|
+
function Tt(r, e) {
|
|
1782
1817
|
let t = r.getClientRects();
|
|
1783
1818
|
t.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = r.commonAncestorContainer.getClientRects());
|
|
1784
1819
|
const i = 1, s = [];
|
|
@@ -1791,31 +1826,31 @@ function St(r, e) {
|
|
|
1791
1826
|
top: h.top,
|
|
1792
1827
|
width: h.width
|
|
1793
1828
|
});
|
|
1794
|
-
const n =
|
|
1829
|
+
const n = je(
|
|
1795
1830
|
s,
|
|
1796
1831
|
i,
|
|
1797
1832
|
e
|
|
1798
|
-
), o =
|
|
1799
|
-
for (let h =
|
|
1800
|
-
const u =
|
|
1833
|
+
), o = Pt(n, i), l = He(o), c = 2 * 2;
|
|
1834
|
+
for (let h = l.length - 1; h >= 0; h--) {
|
|
1835
|
+
const u = l[h];
|
|
1801
1836
|
if (!(u.width * u.height > c))
|
|
1802
|
-
if (
|
|
1803
|
-
|
|
1837
|
+
if (l.length > 1)
|
|
1838
|
+
l.splice(h, 1);
|
|
1804
1839
|
else
|
|
1805
1840
|
break;
|
|
1806
1841
|
}
|
|
1807
|
-
return
|
|
1842
|
+
return l;
|
|
1808
1843
|
}
|
|
1809
|
-
function
|
|
1844
|
+
function je(r, e, t) {
|
|
1810
1845
|
for (let i = 0; i < r.length; i++)
|
|
1811
1846
|
for (let s = i + 1; s < r.length; s++) {
|
|
1812
1847
|
const n = r[i], o = r[s];
|
|
1813
1848
|
if (n === o)
|
|
1814
1849
|
continue;
|
|
1815
|
-
const
|
|
1816
|
-
if ((c && !t ||
|
|
1817
|
-
const d = r.filter((g) => g !== n && g !== o), f =
|
|
1818
|
-
return d.push(f),
|
|
1850
|
+
const l = M(n.top, o.top, e) && M(n.bottom, o.bottom, e), c = M(n.left, o.left, e) && M(n.right, o.right, e);
|
|
1851
|
+
if ((c && !t || l && !c) && qe(n, o, e)) {
|
|
1852
|
+
const d = r.filter((g) => g !== n && g !== o), f = Ct(n, o);
|
|
1853
|
+
return d.push(f), je(
|
|
1819
1854
|
d,
|
|
1820
1855
|
e,
|
|
1821
1856
|
t
|
|
@@ -1824,7 +1859,7 @@ function He(r, e, t) {
|
|
|
1824
1859
|
}
|
|
1825
1860
|
return r;
|
|
1826
1861
|
}
|
|
1827
|
-
function
|
|
1862
|
+
function Ct(r, e) {
|
|
1828
1863
|
const t = Math.min(r.left, e.left), i = Math.max(r.right, e.right), s = Math.min(r.top, e.top), n = Math.max(r.bottom, e.bottom);
|
|
1829
1864
|
return {
|
|
1830
1865
|
bottom: n,
|
|
@@ -1835,7 +1870,7 @@ function wt(r, e) {
|
|
|
1835
1870
|
width: i - t
|
|
1836
1871
|
};
|
|
1837
1872
|
}
|
|
1838
|
-
function
|
|
1873
|
+
function Pt(r, e) {
|
|
1839
1874
|
const t = new Set(r);
|
|
1840
1875
|
for (const i of r) {
|
|
1841
1876
|
if (!(i.width > 1 && i.height > 1)) {
|
|
@@ -1843,40 +1878,40 @@ function Tt(r, e) {
|
|
|
1843
1878
|
continue;
|
|
1844
1879
|
}
|
|
1845
1880
|
for (const n of r)
|
|
1846
|
-
if (i !== n && t.has(n) &&
|
|
1881
|
+
if (i !== n && t.has(n) && At(n, i, e)) {
|
|
1847
1882
|
t.delete(i);
|
|
1848
1883
|
break;
|
|
1849
1884
|
}
|
|
1850
1885
|
}
|
|
1851
1886
|
return Array.from(t);
|
|
1852
1887
|
}
|
|
1853
|
-
function
|
|
1854
|
-
return
|
|
1888
|
+
function At(r, e, t) {
|
|
1889
|
+
return H(r, e.left, e.top, t) && H(r, e.right, e.top, t) && H(r, e.left, e.bottom, t) && H(r, e.right, e.bottom, t);
|
|
1855
1890
|
}
|
|
1856
|
-
function
|
|
1857
|
-
return (r.left < e ||
|
|
1891
|
+
function H(r, e, t, i) {
|
|
1892
|
+
return (r.left < e || M(r.left, e, i)) && (r.right > e || M(r.right, e, i)) && (r.top < t || M(r.top, t, i)) && (r.bottom > t || M(r.bottom, t, i));
|
|
1858
1893
|
}
|
|
1859
|
-
function
|
|
1894
|
+
function He(r) {
|
|
1860
1895
|
for (let e = 0; e < r.length; e++)
|
|
1861
1896
|
for (let t = e + 1; t < r.length; t++) {
|
|
1862
1897
|
const i = r[e], s = r[t];
|
|
1863
|
-
if (i !== s &&
|
|
1898
|
+
if (i !== s && qe(i, s, -1)) {
|
|
1864
1899
|
let n = [], o;
|
|
1865
|
-
const
|
|
1866
|
-
if (
|
|
1867
|
-
n =
|
|
1900
|
+
const l = Ae(i, s);
|
|
1901
|
+
if (l.length === 1)
|
|
1902
|
+
n = l, o = i;
|
|
1868
1903
|
else {
|
|
1869
|
-
const h =
|
|
1870
|
-
|
|
1904
|
+
const h = Ae(s, i);
|
|
1905
|
+
l.length < h.length ? (n = l, o = i) : (n = h, o = s);
|
|
1871
1906
|
}
|
|
1872
1907
|
const c = r.filter((h) => h !== o);
|
|
1873
|
-
return Array.prototype.push.apply(c, n),
|
|
1908
|
+
return Array.prototype.push.apply(c, n), He(c);
|
|
1874
1909
|
}
|
|
1875
1910
|
}
|
|
1876
1911
|
return r;
|
|
1877
1912
|
}
|
|
1878
|
-
function
|
|
1879
|
-
const t =
|
|
1913
|
+
function Ae(r, e) {
|
|
1914
|
+
const t = Mt(e, r);
|
|
1880
1915
|
if (t.height === 0 || t.width === 0)
|
|
1881
1916
|
return [r];
|
|
1882
1917
|
const i = [];
|
|
@@ -1926,7 +1961,7 @@ function Ce(r, e) {
|
|
|
1926
1961
|
}
|
|
1927
1962
|
return i;
|
|
1928
1963
|
}
|
|
1929
|
-
function
|
|
1964
|
+
function Mt(r, e) {
|
|
1930
1965
|
const t = Math.max(r.left, e.left), i = Math.min(r.right, e.right), s = Math.max(r.top, e.top), n = Math.min(r.bottom, e.bottom);
|
|
1931
1966
|
return {
|
|
1932
1967
|
bottom: n,
|
|
@@ -1937,36 +1972,36 @@ function Pt(r, e) {
|
|
|
1937
1972
|
width: Math.max(0, i - t)
|
|
1938
1973
|
};
|
|
1939
1974
|
}
|
|
1940
|
-
function
|
|
1941
|
-
return (r.left < e.right || t >= 0 &&
|
|
1975
|
+
function qe(r, e, t) {
|
|
1976
|
+
return (r.left < e.right || t >= 0 && M(r.left, e.right, t)) && (e.left < r.right || t >= 0 && M(e.left, r.right, t)) && (r.top < e.bottom || t >= 0 && M(r.top, e.bottom, t)) && (e.top < r.bottom || t >= 0 && M(e.top, r.bottom, t));
|
|
1942
1977
|
}
|
|
1943
|
-
function
|
|
1978
|
+
function M(r, e, t) {
|
|
1944
1979
|
return Math.abs(r - e) <= t;
|
|
1945
1980
|
}
|
|
1946
|
-
function
|
|
1981
|
+
function _e(r) {
|
|
1947
1982
|
const e = {}, t = r.document.documentElement.style;
|
|
1948
1983
|
for (const i in r.document.documentElement.style)
|
|
1949
1984
|
Object.hasOwn(t, i) && !Number.isNaN(Number.parseInt(i)) && (e[t[i]] = t.getPropertyValue(t[i]));
|
|
1950
1985
|
return e;
|
|
1951
1986
|
}
|
|
1952
1987
|
function Nt(r, e) {
|
|
1953
|
-
const t =
|
|
1988
|
+
const t = _e(r);
|
|
1954
1989
|
Object.keys(t).forEach((i) => {
|
|
1955
|
-
e.hasOwnProperty(i) ||
|
|
1990
|
+
e.hasOwnProperty(i) || ue(r, i);
|
|
1956
1991
|
}), Object.entries(e).forEach(([i, s]) => {
|
|
1957
|
-
t[i] !== s &&
|
|
1992
|
+
t[i] !== s && Z(r, i, s);
|
|
1958
1993
|
});
|
|
1959
1994
|
}
|
|
1960
|
-
function
|
|
1995
|
+
function Me(r, e) {
|
|
1961
1996
|
return r.document.documentElement.style.getPropertyValue(e);
|
|
1962
1997
|
}
|
|
1963
|
-
function
|
|
1998
|
+
function Z(r, e, t) {
|
|
1964
1999
|
r.document.documentElement.style.setProperty(e, t);
|
|
1965
2000
|
}
|
|
1966
|
-
function
|
|
2001
|
+
function ue(r, e) {
|
|
1967
2002
|
r.document.documentElement.style.removeProperty(e);
|
|
1968
2003
|
}
|
|
1969
|
-
const
|
|
2004
|
+
const Ot = (r) => {
|
|
1970
2005
|
if (r.startsWith("rgb")) {
|
|
1971
2006
|
const e = r.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
|
|
1972
2007
|
if (e)
|
|
@@ -1994,20 +2029,20 @@ const At = (r) => {
|
|
|
1994
2029
|
};
|
|
1995
2030
|
}
|
|
1996
2031
|
return { r: 0, g: 0, b: 0, a: 1 };
|
|
1997
|
-
},
|
|
1998
|
-
const e =
|
|
1999
|
-
return
|
|
2032
|
+
}, It = (r) => 0.2126 * r.r * r.a + 0.7152 * r.g * r.a + 0.0722 * r.b * r.a, Lt = (r) => {
|
|
2033
|
+
const e = Ot(r);
|
|
2034
|
+
return It(e) < 128;
|
|
2000
2035
|
};
|
|
2001
|
-
var
|
|
2002
|
-
const
|
|
2003
|
-
class
|
|
2036
|
+
var Rt = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(Rt || {}), Dt = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(Dt || {});
|
|
2037
|
+
const zt = () => "Highlight" in window, Ne = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2038
|
+
class Wt {
|
|
2004
2039
|
/**
|
|
2005
2040
|
* Creates a DecorationGroup object
|
|
2006
2041
|
* @param id Unique HTML ID-adhering name of the group
|
|
2007
2042
|
* @param name Human-readable name of the group
|
|
2008
2043
|
*/
|
|
2009
2044
|
constructor(e, t, i, s) {
|
|
2010
|
-
this.wnd = e, this.comms = t, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0,
|
|
2045
|
+
this.wnd = e, this.comms = t, this.id = i, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, zt() && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2011
2046
|
}
|
|
2012
2047
|
get activeable() {
|
|
2013
2048
|
return this.activateable;
|
|
@@ -2020,14 +2055,14 @@ class zt {
|
|
|
2020
2055
|
* @param decoration Decoration to add
|
|
2021
2056
|
*/
|
|
2022
2057
|
add(e) {
|
|
2023
|
-
var o,
|
|
2024
|
-
const t = `${this.id}-${this.lastItemId++}`, i =
|
|
2058
|
+
var o, l, c, h;
|
|
2059
|
+
const t = `${this.id}-${this.lastItemId++}`, i = ce(this.wnd.document, e.locator);
|
|
2025
2060
|
if (!i) {
|
|
2026
2061
|
this.comms.log("Can't locate DOM range for decoration", e);
|
|
2027
2062
|
return;
|
|
2028
2063
|
}
|
|
2029
2064
|
const s = i.commonAncestorContainer;
|
|
2030
|
-
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(s.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), s.querySelector(Ne.join(", ").toLowerCase()) && ((
|
|
2065
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Ne.includes(s.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), s.querySelector(Ne.join(", ").toLowerCase()) && ((l = this.notTextFlag) == null || l.set(t, !0)), (((c = s.textContent) == null ? void 0 : c.trim()) || "").length === 0 && ((h = this.notTextFlag) == null || h.set(t, !0)));
|
|
2031
2066
|
const n = {
|
|
2032
2067
|
decoration: e,
|
|
2033
2068
|
id: t,
|
|
@@ -2095,23 +2130,23 @@ class zt {
|
|
|
2095
2130
|
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2096
2131
|
"column-count"
|
|
2097
2132
|
)
|
|
2098
|
-
), n = i / (s || 1), o = this.wnd.document.scrollingElement,
|
|
2099
|
-
var
|
|
2100
|
-
if (y.style.position = "absolute", ((
|
|
2133
|
+
), n = i / (s || 1), o = this.wnd.document.scrollingElement, l = o.scrollLeft, c = o.scrollTop, h = (y, b, I) => {
|
|
2134
|
+
var de, pe, fe, me, ge, ye;
|
|
2135
|
+
if (y.style.position = "absolute", ((pe = (de = e.decoration) == null ? void 0 : de.style) == null ? void 0 : pe.width) === "viewport") {
|
|
2101
2136
|
y.style.width = `${i}px`, y.style.height = `${b.height}px`;
|
|
2102
|
-
let
|
|
2103
|
-
y.style.left = `${
|
|
2104
|
-
} else if (((
|
|
2105
|
-
y.style.width = `${I.width}px`, y.style.height = `${b.height}px`, y.style.left = `${I.left +
|
|
2106
|
-
else if (((
|
|
2137
|
+
let J = Math.floor(b.left / i) * i;
|
|
2138
|
+
y.style.left = `${J + l}px`, y.style.top = `${b.top + c}px`;
|
|
2139
|
+
} else if (((me = (fe = e.decoration) == null ? void 0 : fe.style) == null ? void 0 : me.width) === "bounds")
|
|
2140
|
+
y.style.width = `${I.width}px`, y.style.height = `${b.height}px`, y.style.left = `${I.left + l}px`, y.style.top = `${b.top + c}px`;
|
|
2141
|
+
else if (((ye = (ge = e.decoration) == null ? void 0 : ge.style) == null ? void 0 : ye.width) === "page") {
|
|
2107
2142
|
y.style.width = `${n}px`, y.style.height = `${b.height}px`;
|
|
2108
|
-
let
|
|
2109
|
-
y.style.left = `${
|
|
2143
|
+
let J = Math.floor(b.left / n) * n;
|
|
2144
|
+
y.style.left = `${J + l}px`, y.style.top = `${b.top + c}px`;
|
|
2110
2145
|
} else
|
|
2111
|
-
y.style.width = `${b.width}px`, y.style.height = `${b.height}px`, y.style.left = `${b.left +
|
|
2146
|
+
y.style.width = `${b.width}px`, y.style.height = `${b.height}px`, y.style.left = `${b.left + l}px`, y.style.top = `${b.top + c}px`;
|
|
2112
2147
|
}, u = e.range.getBoundingClientRect();
|
|
2113
2148
|
let p = this.wnd.document.createElement("template");
|
|
2114
|
-
const d =
|
|
2149
|
+
const d = Me(this.wnd, "--USER__appearance") === "readium-night-on" || Lt(Me(this.wnd, "--USER__backgroundColor"));
|
|
2115
2150
|
p.innerHTML = `
|
|
2116
2151
|
<div
|
|
2117
2152
|
class="r2-highlight-0"
|
|
@@ -2130,7 +2165,7 @@ class zt {
|
|
|
2130
2165
|
const y = f.cloneNode(!0);
|
|
2131
2166
|
y.style.setProperty("pointer-events", "none"), h(y, u, u), t.append(y);
|
|
2132
2167
|
} else {
|
|
2133
|
-
let y =
|
|
2168
|
+
let y = Tt(
|
|
2134
2169
|
e.range,
|
|
2135
2170
|
!0
|
|
2136
2171
|
// doNotMergeHorizontallyAlignedRects
|
|
@@ -2175,7 +2210,7 @@ class zt {
|
|
|
2175
2210
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2176
2211
|
}
|
|
2177
2212
|
}
|
|
2178
|
-
const
|
|
2213
|
+
const Xe = class te extends K {
|
|
2179
2214
|
constructor() {
|
|
2180
2215
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2181
2216
|
}
|
|
@@ -2190,9 +2225,9 @@ const qe = class Q extends Y {
|
|
|
2190
2225
|
}, 50);
|
|
2191
2226
|
}
|
|
2192
2227
|
mount(e, t) {
|
|
2193
|
-
return this.wnd = e, t.register("decorate",
|
|
2228
|
+
return this.wnd = e, t.register("decorate", te.moduleName, (i, s) => {
|
|
2194
2229
|
const n = i;
|
|
2195
|
-
n.decoration && n.decoration.locator && (n.decoration.locator =
|
|
2230
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = W.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new Wt(
|
|
2196
2231
|
e,
|
|
2197
2232
|
t,
|
|
2198
2233
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -2217,12 +2252,12 @@ const qe = class Q extends Y {
|
|
|
2217
2252
|
}), this.resizeObserver = new ResizeObserver(() => e.requestAnimationFrame(() => this.handleResize())), this.resizeObserver.observe(e.document.body), e.addEventListener("orientationchange", this.handleResizer), e.addEventListener("resize", this.handleResizer), t.log("Decorator Mounted"), !0;
|
|
2218
2253
|
}
|
|
2219
2254
|
unmount(e, t) {
|
|
2220
|
-
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(
|
|
2255
|
+
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(te.moduleName), this.resizeObserver.disconnect(), this.cleanup(), t.log("Decorator Unmounted"), !0;
|
|
2221
2256
|
}
|
|
2222
2257
|
};
|
|
2223
|
-
|
|
2224
|
-
let
|
|
2225
|
-
const
|
|
2258
|
+
Xe.moduleName = "decorator";
|
|
2259
|
+
let Ft = Xe;
|
|
2260
|
+
const Oe = "readium-snapper-style", Ge = class ie extends K {
|
|
2226
2261
|
constructor() {
|
|
2227
2262
|
super(...arguments), this.protected = !1;
|
|
2228
2263
|
}
|
|
@@ -2235,56 +2270,60 @@ const Ae = "readium-snapper-style", _e = class ee extends Y {
|
|
|
2235
2270
|
}
|
|
2236
2271
|
mount(e, t) {
|
|
2237
2272
|
const i = e.document.createElement("style");
|
|
2238
|
-
return i.dataset.readium = "true", i.id =
|
|
2273
|
+
return i.dataset.readium = "true", i.id = Oe, i.textContent = this.buildStyles(), e.document.head.appendChild(i), t.register("protect", ie.moduleName, (s, n) => {
|
|
2239
2274
|
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2240
|
-
}), t.register("unprotect",
|
|
2275
|
+
}), t.register("unprotect", ie.moduleName, (s, n) => {
|
|
2241
2276
|
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2242
2277
|
}), t.log("Snapper Mounted"), !0;
|
|
2243
2278
|
}
|
|
2244
2279
|
unmount(e, t) {
|
|
2245
2280
|
var i;
|
|
2246
|
-
return (i = e.document.getElementById(
|
|
2281
|
+
return (i = e.document.getElementById(Oe)) == null || i.remove(), t.log("Snapper Unmounted"), !0;
|
|
2247
2282
|
}
|
|
2248
2283
|
};
|
|
2249
|
-
|
|
2250
|
-
let
|
|
2251
|
-
function
|
|
2284
|
+
Ge.moduleName = "snapper";
|
|
2285
|
+
let Ye = Ge;
|
|
2286
|
+
function F(r) {
|
|
2252
2287
|
return r.document.body.dir.toLowerCase() === "rtl";
|
|
2253
2288
|
}
|
|
2254
|
-
function
|
|
2289
|
+
function Ze(r) {
|
|
2255
2290
|
return parseInt(
|
|
2256
2291
|
r.getComputedStyle(
|
|
2257
2292
|
r.document.documentElement
|
|
2258
2293
|
).getPropertyValue("column-count")
|
|
2259
2294
|
);
|
|
2260
2295
|
}
|
|
2261
|
-
function
|
|
2296
|
+
function Ie(r) {
|
|
2262
2297
|
const e = getComputedStyle(r), t = parseFloat(e.paddingTop || "0"), i = parseFloat(e.paddingBottom || "0");
|
|
2263
2298
|
return r.clientHeight - t - i;
|
|
2264
2299
|
}
|
|
2265
|
-
function
|
|
2266
|
-
const e =
|
|
2300
|
+
function Le(r) {
|
|
2301
|
+
const e = Ze(r);
|
|
2267
2302
|
if (!e)
|
|
2268
2303
|
return !1;
|
|
2269
2304
|
const t = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
2270
2305
|
for (const h of t)
|
|
2271
2306
|
h.remove();
|
|
2272
|
-
const i = t.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width,
|
|
2307
|
+
const i = t.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, l = Math.round(s / n * e) % e, c = e === 1 || l === 0 ? 0 : e - l;
|
|
2273
2308
|
if (c > 0)
|
|
2274
2309
|
for (let h = 0; h < c; h++) {
|
|
2275
2310
|
const u = r.document.createElement("div");
|
|
2276
|
-
u.setAttribute("id", `readium-virtual-page-${h}`), u.dataset.readium = "true", CSS.supports("break-before", "column") ? u.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (u.style.breakInside = "avoid-column"), u.style.height =
|
|
2311
|
+
u.setAttribute("id", `readium-virtual-page-${h}`), u.dataset.readium = "true", CSS.supports("break-before", "column") ? u.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (u.style.breakInside = "avoid-column"), u.style.height = Ie(r.document.documentElement) + "px"), u.innerHTML = "​", r.document.body.appendChild(u);
|
|
2277
2312
|
}
|
|
2278
2313
|
return i !== c;
|
|
2279
2314
|
}
|
|
2280
|
-
function
|
|
2315
|
+
function Ut(r) {
|
|
2316
|
+
const e = r.document.createElement("style");
|
|
2317
|
+
e.appendChild(r.document.createTextNode("*{}")), r.document.body.appendChild(e), r.document.body.removeChild(e);
|
|
2318
|
+
}
|
|
2319
|
+
function Bt(r) {
|
|
2281
2320
|
return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
|
|
2282
2321
|
}
|
|
2283
2322
|
function w(r) {
|
|
2284
2323
|
const e = r.getSelection();
|
|
2285
2324
|
e && e.removeAllRanges();
|
|
2286
2325
|
}
|
|
2287
|
-
const
|
|
2326
|
+
const $t = [
|
|
2288
2327
|
"a",
|
|
2289
2328
|
"audio",
|
|
2290
2329
|
"button",
|
|
@@ -2298,15 +2337,15 @@ const Ft = [
|
|
|
2298
2337
|
"textarea",
|
|
2299
2338
|
"video"
|
|
2300
2339
|
];
|
|
2301
|
-
function
|
|
2340
|
+
function Ke(r) {
|
|
2302
2341
|
var e;
|
|
2303
|
-
return
|
|
2342
|
+
return $t.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && ((e = r.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? r : r.parentElement ? Ke(r.parentElement) : null;
|
|
2304
2343
|
}
|
|
2305
|
-
function
|
|
2306
|
-
const t =
|
|
2344
|
+
function Je(r, e) {
|
|
2345
|
+
const t = Qe(r, r.document.body, e), i = r._readium_cssSelectorGenerator.getCssSelector(t, {
|
|
2307
2346
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2308
2347
|
});
|
|
2309
|
-
return new
|
|
2348
|
+
return new W({
|
|
2310
2349
|
href: "#",
|
|
2311
2350
|
type: "application/xhtml+xml",
|
|
2312
2351
|
locations: new x({
|
|
@@ -2314,20 +2353,20 @@ function Ke(r, e) {
|
|
|
2314
2353
|
["cssSelector", i]
|
|
2315
2354
|
])
|
|
2316
2355
|
}),
|
|
2317
|
-
text: new
|
|
2356
|
+
text: new k({
|
|
2318
2357
|
highlight: t.textContent || void 0
|
|
2319
2358
|
})
|
|
2320
2359
|
});
|
|
2321
2360
|
}
|
|
2322
|
-
function
|
|
2361
|
+
function Qe(r, e, t) {
|
|
2323
2362
|
for (var i = 0; i < e.children.length; i++) {
|
|
2324
2363
|
const s = e.children[i];
|
|
2325
|
-
if (!
|
|
2326
|
-
return
|
|
2364
|
+
if (!jt(s) && kt(r, s, t))
|
|
2365
|
+
return Vt(r, s) ? s : Qe(r, s, t);
|
|
2327
2366
|
}
|
|
2328
2367
|
return e;
|
|
2329
2368
|
}
|
|
2330
|
-
function
|
|
2369
|
+
function kt(r, e, t) {
|
|
2331
2370
|
if (e === document.body || e === document.documentElement)
|
|
2332
2371
|
return !0;
|
|
2333
2372
|
if (!document || !document.documentElement || !document.body)
|
|
@@ -2335,11 +2374,11 @@ function Bt(r, e, t) {
|
|
|
2335
2374
|
const i = e.getBoundingClientRect();
|
|
2336
2375
|
return t ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
|
|
2337
2376
|
}
|
|
2338
|
-
function
|
|
2377
|
+
function Vt(r, e) {
|
|
2339
2378
|
const t = e.getBoundingClientRect();
|
|
2340
2379
|
return t.top >= 0 && t.left >= 0 && t.bottom <= r.innerHeight && t.right <= r.innerWidth;
|
|
2341
2380
|
}
|
|
2342
|
-
function
|
|
2381
|
+
function jt(r) {
|
|
2343
2382
|
const e = getComputedStyle(r);
|
|
2344
2383
|
if (e) {
|
|
2345
2384
|
const t = e.getPropertyValue("display");
|
|
@@ -2348,7 +2387,7 @@ function kt(r) {
|
|
|
2348
2387
|
}
|
|
2349
2388
|
return !1;
|
|
2350
2389
|
}
|
|
2351
|
-
const
|
|
2390
|
+
const Re = "readium-column-snapper-style", Ht = 200, et = class T extends Ye {
|
|
2352
2391
|
constructor() {
|
|
2353
2392
|
super(...arguments), this.shakeTimeout = 0, this.snappingCancelled = !1, this.alreadyScrollLeft = 0, this.overscroll = 0, this.cachedScrollWidth = 0, this.touchState = 0, this.startingX = void 0, this.endingX = void 0, this.onTouchStarter = this.onTouchStart.bind(this), this.onTouchEnder = this.onTouchEnd.bind(this), this.onWidthChanger = this.onWidthChange.bind(this), this.onTouchMover = this.onTouchMove.bind(this);
|
|
2354
2393
|
}
|
|
@@ -2359,17 +2398,21 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2359
2398
|
return this.doc().scrollLeft > 0 ? this.doc().scrollLeft : this.alreadyScrollLeft;
|
|
2360
2399
|
}
|
|
2361
2400
|
snapOffset(e) {
|
|
2362
|
-
const t = e + (
|
|
2401
|
+
const t = e + (F(this.wnd) ? -1 : 1);
|
|
2363
2402
|
return t - t % this.wnd.innerWidth;
|
|
2364
2403
|
}
|
|
2365
2404
|
reportProgress() {
|
|
2366
|
-
this.
|
|
2405
|
+
const e = this.wnd.scrollX, t = this.cachedScrollWidth, i = Math.max(0, Math.min(1, e / t)), s = Math.max(0, Math.min(1, (e + this.wnd.innerWidth) / t));
|
|
2406
|
+
this.comms.send("progress", {
|
|
2407
|
+
start: i,
|
|
2408
|
+
end: s
|
|
2409
|
+
});
|
|
2367
2410
|
}
|
|
2368
2411
|
shake() {
|
|
2369
2412
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0)
|
|
2370
2413
|
return;
|
|
2371
2414
|
const e = this.doc();
|
|
2372
|
-
e.classList.add(
|
|
2415
|
+
e.classList.add(F(this.wnd) ? "readium-bounce-l" : "readium-bounce-r");
|
|
2373
2416
|
const t = this.scrollOffset();
|
|
2374
2417
|
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
2375
2418
|
e.classList.remove("readium-bounce-l"), e.classList.remove("readium-bounce-r"), this.shakeTimeout = 0, this.doc().scrollLeft = t;
|
|
@@ -2384,13 +2427,13 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2384
2427
|
}
|
|
2385
2428
|
// Snaps the current offset to the page width.
|
|
2386
2429
|
snapCurrentOffset(e = !1, t = !1) {
|
|
2387
|
-
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o =
|
|
2430
|
+
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = Ze(this.wnd), l = Math.min(Math.max(0, i), this.cachedScrollWidth), c = F(this.wnd) ? -1 : 1, h = (
|
|
2388
2431
|
// The hurdle to overcome in order to change pages
|
|
2389
2432
|
c * (this.wnd.innerWidth / 3) * (c * n > 0 ? 2 : 1)
|
|
2390
|
-
), u = this.snapOffset(
|
|
2433
|
+
), u = this.snapOffset(l + h);
|
|
2391
2434
|
if (e && u !== this.scrollOffset()) {
|
|
2392
2435
|
this.snappingCancelled = !1;
|
|
2393
|
-
const p = (m, v, S, O) => S > O ? v : m + (v - m) *
|
|
2436
|
+
const p = (m, v, S, O) => S > O ? v : m + (v - m) * Bt(S / O), d = (
|
|
2394
2437
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2395
2438
|
Ht * o
|
|
2396
2439
|
);
|
|
@@ -2450,7 +2493,7 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2450
2493
|
return !1;
|
|
2451
2494
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2452
2495
|
const i = e.document.createElement("style");
|
|
2453
|
-
i.dataset.readium = "true", i.id =
|
|
2496
|
+
i.dataset.readium = "true", i.id = Re, i.textContent = `
|
|
2454
2497
|
@keyframes readium-bounce-l-animation {
|
|
2455
2498
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2456
2499
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2486,14 +2529,14 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2486
2529
|
}
|
|
2487
2530
|
`, e.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2488
2531
|
e.requestAnimationFrame(() => {
|
|
2489
|
-
e &&
|
|
2532
|
+
e && Le(e);
|
|
2490
2533
|
}), this.onWidthChange();
|
|
2491
2534
|
}), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver((n) => {
|
|
2492
2535
|
for (const o of n)
|
|
2493
2536
|
if (o.target === this.wnd.document.documentElement) {
|
|
2494
|
-
const
|
|
2537
|
+
const l = o.oldValue, c = o.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, u = l == null ? void 0 : l.match(h), p = c == null ? void 0 : c.match(h);
|
|
2495
2538
|
(!u && !p || u && !p || u && p && u[1] !== p[1]) && (e.requestAnimationFrame(() => {
|
|
2496
|
-
e &&
|
|
2539
|
+
e && Le(e);
|
|
2497
2540
|
}), this.onWidthChange());
|
|
2498
2541
|
} else
|
|
2499
2542
|
e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
@@ -2503,8 +2546,8 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2503
2546
|
return this.doc().scrollLeft = this.snapOffset(n), o !== this.doc().scrollLeft;
|
|
2504
2547
|
};
|
|
2505
2548
|
return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression", T.moduleName, (n, o) => {
|
|
2506
|
-
const
|
|
2507
|
-
if (
|
|
2549
|
+
const l = n;
|
|
2550
|
+
if (l < 0 || l > 1) {
|
|
2508
2551
|
t.send("error", {
|
|
2509
2552
|
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2510
2553
|
}), o(!1);
|
|
@@ -2512,28 +2555,28 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2512
2555
|
}
|
|
2513
2556
|
this.wnd.requestAnimationFrame(() => {
|
|
2514
2557
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2515
|
-
const c = this.cachedScrollWidth, h =
|
|
2558
|
+
const c = this.cachedScrollWidth, h = F(e) ? -1 : 1, u = c * l * h;
|
|
2516
2559
|
this.doc().scrollLeft = this.snapOffset(u), this.reportProgress(), w(this.wnd), o(!0);
|
|
2517
2560
|
});
|
|
2518
2561
|
}), t.register("go_id", T.moduleName, (n, o) => {
|
|
2519
|
-
const
|
|
2520
|
-
if (!
|
|
2562
|
+
const l = e.document.getElementById(n);
|
|
2563
|
+
if (!l) {
|
|
2521
2564
|
o(!1);
|
|
2522
2565
|
return;
|
|
2523
2566
|
}
|
|
2524
2567
|
this.wnd.requestAnimationFrame(() => {
|
|
2525
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2568
|
+
this.doc().scrollLeft = this.snapOffset(l.getBoundingClientRect().left + e.scrollX), this.reportProgress(), w(this.wnd), o(!0);
|
|
2526
2569
|
});
|
|
2527
2570
|
}), t.register("go_text", T.moduleName, (n, o) => {
|
|
2528
|
-
let
|
|
2529
|
-
Array.isArray(n) && (n.length > 1 && (
|
|
2530
|
-
const c =
|
|
2571
|
+
let l;
|
|
2572
|
+
Array.isArray(n) && (n.length > 1 && (l = n[1]), n = n[0]);
|
|
2573
|
+
const c = k.deserialize(n), h = ce(this.wnd.document, new W({
|
|
2531
2574
|
href: e.location.href,
|
|
2532
2575
|
type: "text/html",
|
|
2533
2576
|
text: c,
|
|
2534
|
-
locations:
|
|
2577
|
+
locations: l ? new x({
|
|
2535
2578
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2536
|
-
["cssSelector",
|
|
2579
|
+
["cssSelector", l]
|
|
2537
2580
|
])
|
|
2538
2581
|
}) : void 0
|
|
2539
2582
|
}));
|
|
@@ -2545,10 +2588,10 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2545
2588
|
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), w(this.wnd), o(!0);
|
|
2546
2589
|
});
|
|
2547
2590
|
}), t.register("go_end", T.moduleName, (n, o) => {
|
|
2548
|
-
const
|
|
2591
|
+
const l = F(e) ? -1 : 1;
|
|
2549
2592
|
this.wnd.requestAnimationFrame(() => {
|
|
2550
2593
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2551
|
-
const c = this.cachedScrollWidth *
|
|
2594
|
+
const c = this.cachedScrollWidth * l;
|
|
2552
2595
|
if (this.doc().scrollLeft === c)
|
|
2553
2596
|
return o(!1);
|
|
2554
2597
|
this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), w(this.wnd), o(!0);
|
|
@@ -2562,13 +2605,13 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2562
2605
|
}), t.register("go_prev", T.moduleName, (n, o) => {
|
|
2563
2606
|
this.wnd.requestAnimationFrame(() => {
|
|
2564
2607
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2565
|
-
const
|
|
2608
|
+
const l = e.scrollX - e.innerWidth, c = F(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, h = s(Math.max(l, c));
|
|
2566
2609
|
h && (this.reportProgress(), w(this.wnd)), o(h);
|
|
2567
2610
|
});
|
|
2568
2611
|
}), t.register("go_next", T.moduleName, (n, o) => {
|
|
2569
2612
|
this.wnd.requestAnimationFrame(() => {
|
|
2570
2613
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2571
|
-
const
|
|
2614
|
+
const l = e.scrollX + e.innerWidth, c = F(e) ? 0 : this.cachedScrollWidth - e.innerWidth, h = s(Math.min(l, c));
|
|
2572
2615
|
h && (this.reportProgress(), w(this.wnd)), o(h);
|
|
2573
2616
|
});
|
|
2574
2617
|
}), t.register("unfocus", T.moduleName, (n, o) => {
|
|
@@ -2580,37 +2623,40 @@ const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
|
2580
2623
|
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), o(!0);
|
|
2581
2624
|
});
|
|
2582
2625
|
}), t.register("first_visible_locator", T.moduleName, (n, o) => {
|
|
2583
|
-
const
|
|
2584
|
-
this.comms.send("first_visible_locator",
|
|
2626
|
+
const l = Je(e, !1);
|
|
2627
|
+
this.comms.send("first_visible_locator", l.serialize()), o(!0);
|
|
2585
2628
|
}), e.addEventListener("touchstart", this.onTouchStarter, { passive: !0 }), e.addEventListener("touchend", this.onTouchEnder, { passive: !0 }), e.addEventListener("touchmove", this.onTouchMover, { passive: !0 }), e.document.addEventListener("touchstart", () => {
|
|
2586
2629
|
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2587
2630
|
}
|
|
2588
2631
|
unmount(e, t) {
|
|
2589
2632
|
var i;
|
|
2590
|
-
return this.snappingCancelled = !0, t.unregisterAll(T.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), e.removeEventListener("touchstart", this.onTouchStarter), e.removeEventListener("touchend", this.onTouchEnder), e.removeEventListener("touchmove", this.onTouchMover), e.removeEventListener("orientationchange", this.onWidthChanger), e.removeEventListener("resize", this.onWidthChanger), (i = e.document.getElementById(
|
|
2633
|
+
return this.snappingCancelled = !0, t.unregisterAll(T.moduleName), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), e.removeEventListener("touchstart", this.onTouchStarter), e.removeEventListener("touchend", this.onTouchEnder), e.removeEventListener("touchmove", this.onTouchMover), e.removeEventListener("orientationchange", this.onWidthChanger), e.removeEventListener("resize", this.onWidthChanger), (i = e.document.getElementById(Re)) == null || i.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
|
|
2591
2634
|
}
|
|
2592
2635
|
};
|
|
2593
|
-
|
|
2594
|
-
let
|
|
2595
|
-
const
|
|
2636
|
+
et.moduleName = "column_snapper";
|
|
2637
|
+
let qt = et;
|
|
2638
|
+
const De = "readium-scroll-snapper-style", tt = class P extends Ye {
|
|
2596
2639
|
constructor() {
|
|
2597
2640
|
super(...arguments), this.isScrolling = !1, this.handleScroll = () => {
|
|
2598
2641
|
this.isScrolling || (this.isScrolling = !0, this.wnd.requestAnimationFrame(() => {
|
|
2599
|
-
|
|
2600
|
-
this.reportProgress({ progress: e, reference: this.wnd.innerHeight / this.doc().scrollHeight }), this.isScrolling = !1;
|
|
2642
|
+
this.reportProgress(), this.isScrolling = !1;
|
|
2601
2643
|
}));
|
|
2602
2644
|
};
|
|
2603
2645
|
}
|
|
2604
2646
|
doc() {
|
|
2605
2647
|
return this.wnd.document.scrollingElement;
|
|
2606
2648
|
}
|
|
2607
|
-
reportProgress(
|
|
2608
|
-
this.
|
|
2649
|
+
reportProgress() {
|
|
2650
|
+
const e = this.doc().scrollTop, t = this.doc().scrollHeight, i = Math.max(0, Math.min(1, e / t)), s = Math.max(0, Math.min(1, (e + this.wnd.innerHeight) / t));
|
|
2651
|
+
this.comms.send("progress", {
|
|
2652
|
+
start: i,
|
|
2653
|
+
end: s
|
|
2654
|
+
});
|
|
2609
2655
|
}
|
|
2610
2656
|
mount(e, t) {
|
|
2611
2657
|
this.wnd = e, this.comms = t, e.navigator.epubReadingSystem.layoutStyle = "scrolling";
|
|
2612
2658
|
const i = e.document.createElement("style");
|
|
2613
|
-
return i.dataset.readium = "true", i.id =
|
|
2659
|
+
return i.dataset.readium = "true", i.id = De, i.textContent = `
|
|
2614
2660
|
* {
|
|
2615
2661
|
scrollbar-width: none; /* for Firefox */
|
|
2616
2662
|
}
|
|
@@ -2622,7 +2668,11 @@ const Le = "readium-scroll-snapper-style", Qe = class A extends Xe {
|
|
|
2622
2668
|
this.comms.ready && this.handleScroll();
|
|
2623
2669
|
}), this.resizeObserver.observe(e.document.body), e.addEventListener("scroll", this.handleScroll, {
|
|
2624
2670
|
passive: !0
|
|
2625
|
-
}), t.register("
|
|
2671
|
+
}), t.register("force_webkit_recalc", P.moduleName, () => {
|
|
2672
|
+
Ut(this.wnd);
|
|
2673
|
+
const s = this.doc().scrollTop;
|
|
2674
|
+
this.doc().scrollTop = s + 1, this.doc().scrollTop = s;
|
|
2675
|
+
}), t.register("go_progression", P.moduleName, (s, n) => {
|
|
2626
2676
|
const o = s;
|
|
2627
2677
|
if (o < 0 || o > 1) {
|
|
2628
2678
|
t.send("error", {
|
|
@@ -2631,26 +2681,24 @@ const Le = "readium-scroll-snapper-style", Qe = class A extends Xe {
|
|
|
2631
2681
|
return;
|
|
2632
2682
|
}
|
|
2633
2683
|
this.wnd.requestAnimationFrame(() => {
|
|
2634
|
-
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(
|
|
2684
|
+
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(), w(this.wnd), n(!0);
|
|
2635
2685
|
});
|
|
2636
|
-
}), t.register("go_id",
|
|
2686
|
+
}), t.register("go_id", P.moduleName, (s, n) => {
|
|
2637
2687
|
const o = e.document.getElementById(s);
|
|
2638
2688
|
if (!o) {
|
|
2639
2689
|
n(!1);
|
|
2640
2690
|
return;
|
|
2641
2691
|
}
|
|
2642
2692
|
this.wnd.requestAnimationFrame(() => {
|
|
2643
|
-
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2644
|
-
const a = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2645
|
-
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }), w(this.wnd), n(!0);
|
|
2693
|
+
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(), w(this.wnd), n(!0);
|
|
2646
2694
|
});
|
|
2647
|
-
}), t.register("go_text",
|
|
2695
|
+
}), t.register("go_text", P.moduleName, (s, n) => {
|
|
2648
2696
|
let o;
|
|
2649
2697
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2650
|
-
const
|
|
2698
|
+
const l = k.deserialize(s), c = ce(this.wnd.document, new W({
|
|
2651
2699
|
href: e.location.href,
|
|
2652
2700
|
type: "text/html",
|
|
2653
|
-
text:
|
|
2701
|
+
text: l,
|
|
2654
2702
|
locations: o ? new x({
|
|
2655
2703
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2656
2704
|
["cssSelector", o]
|
|
@@ -2662,44 +2710,41 @@ const Le = "readium-scroll-snapper-style", Qe = class A extends Xe {
|
|
|
2662
2710
|
return;
|
|
2663
2711
|
}
|
|
2664
2712
|
this.wnd.requestAnimationFrame(() => {
|
|
2665
|
-
this.doc().scrollTop = c.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2666
|
-
const h = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2667
|
-
this.reportProgress({ progress: h, reference: this.wnd.innerHeight / this.doc().scrollHeight }), w(this.wnd), n(!0);
|
|
2713
|
+
this.doc().scrollTop = c.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2, this.reportProgress(), w(this.wnd), n(!0);
|
|
2668
2714
|
});
|
|
2669
|
-
}), t.register("go_start",
|
|
2715
|
+
}), t.register("go_start", P.moduleName, (s, n) => {
|
|
2670
2716
|
if (this.doc().scrollTop === 0)
|
|
2671
2717
|
return n(!1);
|
|
2672
|
-
this.doc().scrollTop = 0, this.reportProgress(
|
|
2673
|
-
}), t.register("go_end",
|
|
2674
|
-
if (this.doc().scrollTop ===
|
|
2718
|
+
this.doc().scrollTop = 0, this.reportProgress(), n(!0);
|
|
2719
|
+
}), t.register("go_end", P.moduleName, (s, n) => {
|
|
2720
|
+
if (this.doc().scrollTop === this.doc().scrollHeight - this.doc().offsetHeight)
|
|
2675
2721
|
return n(!1);
|
|
2676
|
-
this.doc().scrollTop =
|
|
2677
|
-
}), t.register("unfocus",
|
|
2722
|
+
this.doc().scrollTop = this.doc().scrollHeight - this.doc().offsetHeight, this.reportProgress(), n(!0);
|
|
2723
|
+
}), t.register("unfocus", P.moduleName, (s, n) => {
|
|
2678
2724
|
w(this.wnd), n(!0);
|
|
2679
2725
|
}), t.register([
|
|
2680
2726
|
"go_next",
|
|
2681
2727
|
"go_prev"
|
|
2682
|
-
],
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
const o = Ke(e, !0);
|
|
2728
|
+
], P.moduleName, (s, n) => n(!1)), t.register("focus", P.moduleName, (s, n) => {
|
|
2729
|
+
this.reportProgress(), n(!0);
|
|
2730
|
+
}), t.register("first_visible_locator", P.moduleName, (s, n) => {
|
|
2731
|
+
const o = Je(e, !0);
|
|
2687
2732
|
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2688
2733
|
}), t.log("ScrollSnapper Mounted"), !0;
|
|
2689
2734
|
}
|
|
2690
2735
|
unmount(e, t) {
|
|
2691
2736
|
var i;
|
|
2692
|
-
return t.unregisterAll(
|
|
2737
|
+
return t.unregisterAll(P.moduleName), this.resizeObserver.disconnect(), this.handleScroll && e.removeEventListener("scroll", this.handleScroll), (i = e.document.getElementById(De)) == null || i.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2693
2738
|
}
|
|
2694
2739
|
};
|
|
2695
|
-
|
|
2696
|
-
let
|
|
2697
|
-
class
|
|
2740
|
+
tt.moduleName = "scroll_snapper";
|
|
2741
|
+
let _t = tt;
|
|
2742
|
+
class it extends K {
|
|
2698
2743
|
constructor() {
|
|
2699
2744
|
super(...arguments), this.pointerMoved = !1, this.onPointerUp = this.onPointUp.bind(this), this.onPointerMove = this.onPointMove.bind(this), this.onPointerDown = this.onPointDown.bind(this), this.onContextMenu = this.onContext.bind(this), this.onClicker = this.onClick.bind(this);
|
|
2700
2745
|
}
|
|
2701
2746
|
onPointUp(e) {
|
|
2702
|
-
var s, n, o,
|
|
2747
|
+
var s, n, o, l, c;
|
|
2703
2748
|
const t = this.wnd.getSelection();
|
|
2704
2749
|
if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
|
|
2705
2750
|
const h = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
|
|
@@ -2711,7 +2756,7 @@ class et extends Y {
|
|
|
2711
2756
|
y: u.y,
|
|
2712
2757
|
width: u.width,
|
|
2713
2758
|
height: u.height,
|
|
2714
|
-
targetFrameSrc: (
|
|
2759
|
+
targetFrameSrc: (l = (o = this.wnd) == null ? void 0 : o.location) == null ? void 0 : l.href
|
|
2715
2760
|
};
|
|
2716
2761
|
this.comms.send("text_selected", p);
|
|
2717
2762
|
}
|
|
@@ -2728,7 +2773,7 @@ class et extends Y {
|
|
|
2728
2773
|
y: e.clientY * i,
|
|
2729
2774
|
targetFrameSrc: this.wnd.location.href,
|
|
2730
2775
|
targetElement: e.target.outerHTML,
|
|
2731
|
-
interactiveElement: (c =
|
|
2776
|
+
interactiveElement: (c = Ke(e.target)) == null ? void 0 : c.outerHTML,
|
|
2732
2777
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2733
2778
|
}), this.pointerMoved = !1;
|
|
2734
2779
|
}
|
|
@@ -2764,8 +2809,8 @@ class et extends Y {
|
|
|
2764
2809
|
return e.document.removeEventListener("pointerdown", this.onPointerDown), e.document.removeEventListener("pointerup", this.onPointerUp), e.document.removeEventListener("contextmenu", this.onContextMenu), e.document.removeEventListener("pointermove", this.onPointerMove), e.document.removeEventListener("click", this.onClicker), t.log("Peripherals Unmounted"), !0;
|
|
2765
2810
|
}
|
|
2766
2811
|
}
|
|
2767
|
-
|
|
2768
|
-
const
|
|
2812
|
+
it.moduleName = "peripherals";
|
|
2813
|
+
const rt = class re extends K {
|
|
2769
2814
|
constructor() {
|
|
2770
2815
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
2771
2816
|
}
|
|
@@ -2819,7 +2864,7 @@ const tt = class te extends Y {
|
|
|
2819
2864
|
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
2820
2865
|
value: {
|
|
2821
2866
|
name: "readium-ts-toolkit",
|
|
2822
|
-
version: "2.0.0-beta.
|
|
2867
|
+
version: "2.0.0-beta.4",
|
|
2823
2868
|
hasFeature: (s, n = "") => {
|
|
2824
2869
|
switch (s) {
|
|
2825
2870
|
case "dom-manipulation":
|
|
@@ -2844,11 +2889,11 @@ const tt = class te extends Y {
|
|
|
2844
2889
|
writable: !1
|
|
2845
2890
|
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
2846
2891
|
s.cancel(), this.allAnimations.add(s);
|
|
2847
|
-
}), t.register("activate",
|
|
2892
|
+
}), t.register("activate", re.moduleName, (s, n) => {
|
|
2848
2893
|
this.allAnimations.forEach((o) => {
|
|
2849
2894
|
o.cancel(), o.play();
|
|
2850
2895
|
}), n(!0);
|
|
2851
|
-
}), t.register("unfocus",
|
|
2896
|
+
}), t.register("unfocus", re.moduleName, (s, n) => {
|
|
2852
2897
|
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
2853
2898
|
});
|
|
2854
2899
|
const i = e.document.querySelectorAll("audio,video");
|
|
@@ -2866,49 +2911,49 @@ const tt = class te extends Y {
|
|
|
2866
2911
|
return e.removeEventListener("error", this.wndOnErr), e.removeEventListener("play", this.onMediaPlayEvent), e.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((i) => i.cancel()), this.allAnimations.clear(), t.log("Setup Unmounted"), !0;
|
|
2867
2912
|
}
|
|
2868
2913
|
};
|
|
2869
|
-
|
|
2870
|
-
let
|
|
2871
|
-
const
|
|
2914
|
+
rt.moduleName = "setup";
|
|
2915
|
+
let st = rt;
|
|
2916
|
+
const ze = "readium-viewport", nt = class U extends st {
|
|
2872
2917
|
onViewportWidthChanged(e) {
|
|
2873
2918
|
const t = e.target;
|
|
2874
|
-
|
|
2919
|
+
Z(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
2875
2920
|
}
|
|
2876
2921
|
mount(e, t) {
|
|
2877
2922
|
if (!super.mount(e, t))
|
|
2878
2923
|
return !1;
|
|
2879
2924
|
const i = e.document.createElement("meta");
|
|
2880
|
-
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id",
|
|
2925
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", ze), i.setAttribute(
|
|
2881
2926
|
"content",
|
|
2882
2927
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
2883
2928
|
), e.document.head.appendChild(i), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
2884
2929
|
target: e
|
|
2885
|
-
}), t.register("get_properties",
|
|
2886
|
-
|
|
2887
|
-
}), t.register("update_properties",
|
|
2930
|
+
}), t.register("get_properties", U.moduleName, (s, n) => {
|
|
2931
|
+
_e(e), n(!0);
|
|
2932
|
+
}), t.register("update_properties", U.moduleName, (s, n) => {
|
|
2888
2933
|
s["--RS__viewportWidth"] = `${e.innerWidth}px`, Nt(e, s), n(!0);
|
|
2889
|
-
}), t.register("set_property",
|
|
2934
|
+
}), t.register("set_property", U.moduleName, (s, n) => {
|
|
2890
2935
|
const o = s;
|
|
2891
|
-
|
|
2892
|
-
}), t.register("remove_property",
|
|
2893
|
-
|
|
2894
|
-
}), t.register("activate",
|
|
2936
|
+
Z(e, o[0], o[1]), n(!0);
|
|
2937
|
+
}), t.register("remove_property", U.moduleName, (s, n) => {
|
|
2938
|
+
ue(e, s), n(!0);
|
|
2939
|
+
}), t.register("activate", U.moduleName, (s, n) => {
|
|
2895
2940
|
this.unblock(e), n(!0);
|
|
2896
2941
|
}), t.log("ReflowableSetup Mounted"), !0;
|
|
2897
2942
|
}
|
|
2898
2943
|
unmount(e, t) {
|
|
2899
2944
|
var i;
|
|
2900
|
-
return t.unregisterAll(
|
|
2945
|
+
return t.unregisterAll(U.moduleName), (i = e.document.head.querySelector(`#${ze}`)) == null || i.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
2901
2946
|
}
|
|
2902
2947
|
};
|
|
2903
|
-
|
|
2904
|
-
let
|
|
2905
|
-
const
|
|
2948
|
+
nt.moduleName = "reflowable_setup";
|
|
2949
|
+
let Xt = nt;
|
|
2950
|
+
const We = "readium-fixed-style", ot = class R extends st {
|
|
2906
2951
|
mount(e, t) {
|
|
2907
2952
|
if (!super.mount(e, t))
|
|
2908
2953
|
return !1;
|
|
2909
2954
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2910
2955
|
const i = e.document.createElement("style");
|
|
2911
|
-
return i.id =
|
|
2956
|
+
return i.id = We, i.dataset.readium = "true", i.textContent = `
|
|
2912
2957
|
html, body {
|
|
2913
2958
|
text-size-adjust: none;
|
|
2914
2959
|
-ms-text-size-adjust: none;
|
|
@@ -2920,12 +2965,12 @@ const ze = "readium-fixed-style", st = class L extends it {
|
|
|
2920
2965
|
min-height: 100%;
|
|
2921
2966
|
|
|
2922
2967
|
/*cursor: var() TODO*/
|
|
2923
|
-
}`, e.document.head.appendChild(i), t.register("set_property",
|
|
2968
|
+
}`, e.document.head.appendChild(i), t.register("set_property", R.moduleName, (s, n) => {
|
|
2924
2969
|
const o = s;
|
|
2925
|
-
|
|
2926
|
-
}), t.register("remove_property",
|
|
2927
|
-
|
|
2928
|
-
}), t.register("first_visible_locator",
|
|
2970
|
+
Z(e, o[0], o[1]), n(!0);
|
|
2971
|
+
}), t.register("remove_property", R.moduleName, (s, n) => {
|
|
2972
|
+
ue(e, s), n(!0);
|
|
2973
|
+
}), t.register("first_visible_locator", R.moduleName, (s, n) => n(!1)), t.register("unfocus", R.moduleName, (s, n) => {
|
|
2929
2974
|
w(e), n(!0);
|
|
2930
2975
|
}), t.register([
|
|
2931
2976
|
"focus",
|
|
@@ -2936,43 +2981,43 @@ const ze = "readium-fixed-style", st = class L extends it {
|
|
|
2936
2981
|
"go_start",
|
|
2937
2982
|
"go_text",
|
|
2938
2983
|
"go_progression"
|
|
2939
|
-
],
|
|
2984
|
+
], R.moduleName, (s, n) => n(!0)), t.register("activate", R.moduleName, (s, n) => {
|
|
2940
2985
|
this.unblock(e), n(!0);
|
|
2941
2986
|
}), t.log("FixedSetup Mounted"), !0;
|
|
2942
2987
|
}
|
|
2943
2988
|
unmount(e, t) {
|
|
2944
2989
|
var i;
|
|
2945
|
-
return t.unregisterAll(
|
|
2990
|
+
return t.unregisterAll(R.moduleName), (i = e.document.getElementById(We)) == null || i.remove(), t.log("FixedSetup Unmounted"), super.unmount(e, t);
|
|
2946
2991
|
}
|
|
2947
2992
|
};
|
|
2948
|
-
|
|
2949
|
-
let
|
|
2950
|
-
const
|
|
2993
|
+
ot.moduleName = "fixed_setup";
|
|
2994
|
+
let Gt = ot;
|
|
2995
|
+
const Yt = [
|
|
2951
2996
|
"fixed_setup",
|
|
2952
2997
|
"decorator",
|
|
2953
2998
|
"peripherals"
|
|
2954
|
-
],
|
|
2999
|
+
], Zt = [
|
|
2955
3000
|
"reflowable_setup",
|
|
2956
3001
|
"decorator",
|
|
2957
3002
|
"peripherals",
|
|
2958
3003
|
"column_snapper",
|
|
2959
3004
|
"scroll_snapper"
|
|
2960
|
-
],
|
|
3005
|
+
], Fe = new Map([
|
|
2961
3006
|
// All modules go here
|
|
3007
|
+
Gt,
|
|
3008
|
+
Xt,
|
|
3009
|
+
it,
|
|
3010
|
+
Ft,
|
|
2962
3011
|
qt,
|
|
2963
|
-
|
|
2964
|
-
et,
|
|
2965
|
-
Dt,
|
|
2966
|
-
$t,
|
|
2967
|
-
jt
|
|
3012
|
+
_t
|
|
2968
3013
|
].map((r) => [r.moduleName, r]));
|
|
2969
|
-
class
|
|
3014
|
+
class Kt {
|
|
2970
3015
|
/**
|
|
2971
3016
|
* @param wnd Window instance to operate on
|
|
2972
3017
|
* @param initialModules List of initial modules to load
|
|
2973
3018
|
*/
|
|
2974
3019
|
constructor(e = window, t = []) {
|
|
2975
|
-
this.loadedModules = [], this.wnd = e, this.comms = new
|
|
3020
|
+
this.loadedModules = [], this.wnd = e, this.comms = new ht(e);
|
|
2976
3021
|
const i = [...new Set(t)];
|
|
2977
3022
|
if (i.length) {
|
|
2978
3023
|
if (typeof e > "u")
|
|
@@ -2985,7 +3030,7 @@ class Gt {
|
|
|
2985
3030
|
}
|
|
2986
3031
|
}
|
|
2987
3032
|
loadModule(e) {
|
|
2988
|
-
const t =
|
|
3033
|
+
const t = Fe.get(e);
|
|
2989
3034
|
return t === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), t) : new t();
|
|
2990
3035
|
}
|
|
2991
3036
|
/**
|
|
@@ -3003,7 +3048,7 @@ class Gt {
|
|
|
3003
3048
|
* @returns Success
|
|
3004
3049
|
*/
|
|
3005
3050
|
removeModule(e) {
|
|
3006
|
-
const t =
|
|
3051
|
+
const t = Fe.get(e);
|
|
3007
3052
|
if (t === void 0)
|
|
3008
3053
|
return this.comms.log(`Module "${e}" does not exist in the library`), !1;
|
|
3009
3054
|
const i = this.loadedModules.findIndex((s) => s instanceof t);
|
|
@@ -3017,16 +3062,16 @@ class Gt {
|
|
|
3017
3062
|
}
|
|
3018
3063
|
}
|
|
3019
3064
|
export {
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3065
|
+
V as COMMS_VERSION,
|
|
3066
|
+
ht as Comms,
|
|
3067
|
+
Ft as Decorator,
|
|
3068
|
+
Yt as FXLModules,
|
|
3069
|
+
Dt as Layout,
|
|
3070
|
+
Kt as Loader,
|
|
3071
|
+
K as Module,
|
|
3072
|
+
Fe as ModuleLibrary,
|
|
3073
|
+
it as Peripherals,
|
|
3074
|
+
Zt as ReflowableModules,
|
|
3075
|
+
Rt as Width,
|
|
3076
|
+
lt as mid
|
|
3032
3077
|
};
|