@readium/navigator-html-injectables 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +261 -203
- package/dist/index.umd.cjs +7 -7
- package/package.json +2 -2
- package/src/helpers/dom.ts +8 -0
- package/src/helpers/locator.ts +55 -53
- package/src/modules/setup/FixedSetup.ts +2 -0
- package/src/modules/setup/Setup.ts +30 -1
- package/src/modules/snapper/ColumnSnapper.ts +3 -1
- package/src/modules/snapper/ScrollSnapper.ts +13 -8
- package/types/src/helpers/dom.d.ts +9 -0
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const Mt = Math.pow(2, 32), Ae = () => Math.round(Math.random() * Mt).toString(36),
|
|
2
|
-
class
|
|
1
|
+
const Mt = Math.pow(2, 32), Ae = () => Math.round(Math.random() * Mt).toString(36), Rt = () => `${Math.round(performance.now())}-${Ae()}-${Ae()}`, _ = 1;
|
|
2
|
+
class Nt {
|
|
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 Rt {
|
|
|
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 !== _) {
|
|
16
|
+
t._readium > _ ? this.send("error", `received comms version ${t._readium} higher than ${_}`) : this.send("error", `received comms version ${t._readium} lower than ${_}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
this.send("_pong", void 0), this.preLog.forEach((r) => this.send("log", r)), this.preLog = [];
|
|
@@ -76,9 +76,9 @@ class Rt {
|
|
|
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: _,
|
|
80
80
|
_channel: this.channelId,
|
|
81
|
-
id: r ??
|
|
81
|
+
id: r ?? Rt(),
|
|
82
82
|
// scrict,
|
|
83
83
|
key: e,
|
|
84
84
|
data: t
|
|
@@ -116,7 +116,7 @@ var F = [], Lt = function() {
|
|
|
116
116
|
})(G || (G = {}));
|
|
117
117
|
var k = function(i) {
|
|
118
118
|
return Object.freeze(i);
|
|
119
|
-
},
|
|
119
|
+
}, Dt = function() {
|
|
120
120
|
function i(e, t) {
|
|
121
121
|
this.inlineSize = e, this.blockSize = t, k(this);
|
|
122
122
|
}
|
|
@@ -140,13 +140,13 @@ var k = function(i) {
|
|
|
140
140
|
}
|
|
141
141
|
var s = i, n = s.offsetWidth, o = s.offsetHeight;
|
|
142
142
|
return !(n || o || i.getClientRects().length);
|
|
143
|
-
},
|
|
143
|
+
}, Re = function(i) {
|
|
144
144
|
var e;
|
|
145
145
|
if (i instanceof Element)
|
|
146
146
|
return !0;
|
|
147
147
|
var t = (e = i == null ? void 0 : i.ownerDocument) === null || e === void 0 ? void 0 : e.defaultView;
|
|
148
148
|
return !!(t && i instanceof t.Element);
|
|
149
|
-
},
|
|
149
|
+
}, Bt = function(i) {
|
|
150
150
|
switch (i.tagName) {
|
|
151
151
|
case "INPUT":
|
|
152
152
|
if (i.type !== "image")
|
|
@@ -161,25 +161,25 @@ var k = function(i) {
|
|
|
161
161
|
return !0;
|
|
162
162
|
}
|
|
163
163
|
return !1;
|
|
164
|
-
},
|
|
164
|
+
}, V = typeof window < "u" ? window : {}, Q = /* @__PURE__ */ new WeakMap(), Ne = /auto|scroll/, Wt = /^tb|vertical/, Ft = /msie|trident/i.test(V.navigator && V.navigator.userAgent), R = function(i) {
|
|
165
165
|
return parseFloat(i || "0");
|
|
166
|
-
},
|
|
167
|
-
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new
|
|
166
|
+
}, H = function(i, e, t) {
|
|
167
|
+
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new Dt((t ? e : i) || 0, (t ? i : e) || 0);
|
|
168
168
|
}, Le = k({
|
|
169
|
-
devicePixelContentBoxSize:
|
|
170
|
-
borderBoxSize:
|
|
171
|
-
contentBoxSize:
|
|
169
|
+
devicePixelContentBoxSize: H(),
|
|
170
|
+
borderBoxSize: H(),
|
|
171
|
+
contentBoxSize: H(),
|
|
172
172
|
contentRect: new Qe(0, 0, 0, 0)
|
|
173
173
|
}), tt = function(i, e) {
|
|
174
174
|
if (e === void 0 && (e = !1), Q.has(i) && !e)
|
|
175
175
|
return Q.get(i);
|
|
176
176
|
if (et(i))
|
|
177
177
|
return Q.set(i, Le), Le;
|
|
178
|
-
var t = getComputedStyle(i), r = Ee(i) && i.ownerSVGElement && i.getBBox(), s = !Ft && t.boxSizing === "border-box", n = Wt.test(t.writingMode || ""), o = !r &&
|
|
179
|
-
devicePixelContentBoxSize:
|
|
180
|
-
borderBoxSize:
|
|
181
|
-
contentBoxSize:
|
|
182
|
-
contentRect: new Qe(p, h,
|
|
178
|
+
var t = getComputedStyle(i), r = Ee(i) && i.ownerSVGElement && i.getBBox(), s = !Ft && t.boxSizing === "border-box", n = Wt.test(t.writingMode || ""), o = !r && Ne.test(t.overflowY || ""), a = !r && Ne.test(t.overflowX || ""), h = r ? 0 : R(t.paddingTop), c = r ? 0 : R(t.paddingRight), d = r ? 0 : R(t.paddingBottom), p = r ? 0 : R(t.paddingLeft), u = r ? 0 : R(t.borderTopWidth), f = r ? 0 : R(t.borderRightWidth), v = r ? 0 : R(t.borderBottomWidth), g = r ? 0 : R(t.borderLeftWidth), y = p + c, x = h + d, S = g + f, m = u + v, E = a ? i.offsetHeight - m - i.clientHeight : 0, P = o ? i.offsetWidth - S - i.clientWidth : 0, Y = s ? y + S : 0, Z = s ? x + m : 0, D = r ? r.width : R(t.width) - Y - P, B = r ? r.height : R(t.height) - Z - E, J = D + y + P + S, K = B + x + E + m, U = k({
|
|
179
|
+
devicePixelContentBoxSize: H(Math.round(D * devicePixelRatio), Math.round(B * devicePixelRatio), n),
|
|
180
|
+
borderBoxSize: H(J, K, n),
|
|
181
|
+
contentBoxSize: H(D, B, n),
|
|
182
|
+
contentRect: new Qe(p, h, D, B)
|
|
183
183
|
});
|
|
184
184
|
return Q.set(i, U), U;
|
|
185
185
|
}, it = function(i, e, t) {
|
|
@@ -228,12 +228,12 @@ var k = function(i) {
|
|
|
228
228
|
s.isActive() && (rt(s.target) > i ? t.activeTargets.push(s) : t.skippedTargets.push(s));
|
|
229
229
|
});
|
|
230
230
|
});
|
|
231
|
-
},
|
|
231
|
+
}, Ht = function() {
|
|
232
232
|
var i = 0;
|
|
233
233
|
for (ze(i); Lt(); )
|
|
234
234
|
i = Ut(), ze(i);
|
|
235
235
|
return zt() && It(), i > 0;
|
|
236
|
-
}, de, st = [],
|
|
236
|
+
}, de, st = [], $t = function() {
|
|
237
237
|
return st.splice(0).forEach(function(i) {
|
|
238
238
|
return i();
|
|
239
239
|
});
|
|
@@ -241,19 +241,19 @@ var k = function(i) {
|
|
|
241
241
|
if (!de) {
|
|
242
242
|
var e = 0, t = document.createTextNode(""), r = { characterData: !0 };
|
|
243
243
|
new MutationObserver(function() {
|
|
244
|
-
return
|
|
244
|
+
return $t();
|
|
245
245
|
}).observe(t, r), de = function() {
|
|
246
246
|
t.textContent = "".concat(e ? e-- : e++);
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
249
|
st.push(i), de();
|
|
250
|
-
},
|
|
250
|
+
}, _t = function(i) {
|
|
251
251
|
qt(function() {
|
|
252
252
|
requestAnimationFrame(i);
|
|
253
253
|
});
|
|
254
|
-
}, re = 0,
|
|
254
|
+
}, re = 0, jt = function() {
|
|
255
255
|
return !!re;
|
|
256
|
-
},
|
|
256
|
+
}, Vt = 250, Xt = { attributes: !0, characterData: !0, childList: !0, subtree: !0 }, Ie = [
|
|
257
257
|
"resize",
|
|
258
258
|
"load",
|
|
259
259
|
"transitionend",
|
|
@@ -268,7 +268,7 @@ var k = function(i) {
|
|
|
268
268
|
"mouseout",
|
|
269
269
|
"blur",
|
|
270
270
|
"focus"
|
|
271
|
-
],
|
|
271
|
+
], De = function(i) {
|
|
272
272
|
return i === void 0 && (i = 0), Date.now() + i;
|
|
273
273
|
}, ue = !1, Gt = function() {
|
|
274
274
|
function i() {
|
|
@@ -279,15 +279,15 @@ var k = function(i) {
|
|
|
279
279
|
}
|
|
280
280
|
return i.prototype.run = function(e) {
|
|
281
281
|
var t = this;
|
|
282
|
-
if (e === void 0 && (e =
|
|
282
|
+
if (e === void 0 && (e = Vt), !ue) {
|
|
283
283
|
ue = !0;
|
|
284
|
-
var r =
|
|
285
|
-
|
|
284
|
+
var r = De(e);
|
|
285
|
+
_t(function() {
|
|
286
286
|
var s = !1;
|
|
287
287
|
try {
|
|
288
|
-
s =
|
|
288
|
+
s = Ht();
|
|
289
289
|
} finally {
|
|
290
|
-
if (ue = !1, e = r -
|
|
290
|
+
if (ue = !1, e = r - De(), !jt())
|
|
291
291
|
return;
|
|
292
292
|
s ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
|
|
293
293
|
}
|
|
@@ -297,24 +297,24 @@ var k = function(i) {
|
|
|
297
297
|
this.stop(), this.run();
|
|
298
298
|
}, i.prototype.observe = function() {
|
|
299
299
|
var e = this, t = function() {
|
|
300
|
-
return e.observer && e.observer.observe(document.body,
|
|
300
|
+
return e.observer && e.observer.observe(document.body, Xt);
|
|
301
301
|
};
|
|
302
|
-
document.body ? t() :
|
|
302
|
+
document.body ? t() : V.addEventListener("DOMContentLoaded", t);
|
|
303
303
|
}, i.prototype.start = function() {
|
|
304
304
|
var e = this;
|
|
305
305
|
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), Ie.forEach(function(t) {
|
|
306
|
-
return
|
|
306
|
+
return V.addEventListener(t, e.listener, !0);
|
|
307
307
|
}));
|
|
308
308
|
}, i.prototype.stop = function() {
|
|
309
309
|
var e = this;
|
|
310
310
|
this.stopped || (this.observer && this.observer.disconnect(), Ie.forEach(function(t) {
|
|
311
|
-
return
|
|
311
|
+
return V.removeEventListener(t, e.listener, !0);
|
|
312
312
|
}), this.stopped = !0);
|
|
313
313
|
}, i;
|
|
314
|
-
}(), fe = new Gt(),
|
|
314
|
+
}(), fe = new Gt(), Be = function(i) {
|
|
315
315
|
!re && i > 0 && fe.start(), re += i, !re && fe.stop();
|
|
316
316
|
}, Yt = function(i) {
|
|
317
|
-
return !Ee(i) && !
|
|
317
|
+
return !Ee(i) && !Bt(i) && getComputedStyle(i).display === "inline";
|
|
318
318
|
}, Zt = function() {
|
|
319
319
|
function i(e, t) {
|
|
320
320
|
this.target = e, this.observedBox = t || G.CONTENT_BOX, this.lastReportedSize = {
|
|
@@ -326,7 +326,7 @@ var k = function(i) {
|
|
|
326
326
|
var e = it(this.target, this.observedBox, !0);
|
|
327
327
|
return Yt(this.target) && (this.lastReportedSize = e), this.lastReportedSize.inlineSize !== e.inlineSize || this.lastReportedSize.blockSize !== e.blockSize;
|
|
328
328
|
}, i;
|
|
329
|
-
}(),
|
|
329
|
+
}(), Jt = function() {
|
|
330
330
|
function i(e, t) {
|
|
331
331
|
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = e, this.callback = t;
|
|
332
332
|
}
|
|
@@ -340,14 +340,14 @@ var k = function(i) {
|
|
|
340
340
|
function i() {
|
|
341
341
|
}
|
|
342
342
|
return i.connect = function(e, t) {
|
|
343
|
-
var r = new
|
|
343
|
+
var r = new Jt(e, t);
|
|
344
344
|
ee.set(e, r);
|
|
345
345
|
}, i.observe = function(e, t, r) {
|
|
346
346
|
var s = ee.get(e), n = s.observationTargets.length === 0;
|
|
347
|
-
We(s.observationTargets, t) < 0 && (n && F.push(s), s.observationTargets.push(new Zt(t, r && r.box)),
|
|
347
|
+
We(s.observationTargets, t) < 0 && (n && F.push(s), s.observationTargets.push(new Zt(t, r && r.box)), Be(1), fe.schedule());
|
|
348
348
|
}, i.unobserve = function(e, t) {
|
|
349
349
|
var r = ee.get(e), s = We(r.observationTargets, t), n = r.observationTargets.length === 1;
|
|
350
|
-
s >= 0 && (n && F.splice(F.indexOf(r), 1), r.observationTargets.splice(s, 1),
|
|
350
|
+
s >= 0 && (n && F.splice(F.indexOf(r), 1), r.observationTargets.splice(s, 1), Be(-1));
|
|
351
351
|
}, i.disconnect = function(e) {
|
|
352
352
|
var t = this, r = ee.get(e);
|
|
353
353
|
r.observationTargets.slice().forEach(function(s) {
|
|
@@ -365,13 +365,13 @@ var k = function(i) {
|
|
|
365
365
|
return i.prototype.observe = function(e, t) {
|
|
366
366
|
if (arguments.length === 0)
|
|
367
367
|
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
368
|
-
if (!
|
|
368
|
+
if (!Re(e))
|
|
369
369
|
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
370
370
|
te.observe(this, e, t);
|
|
371
371
|
}, i.prototype.unobserve = function(e) {
|
|
372
372
|
if (arguments.length === 0)
|
|
373
373
|
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
374
|
-
if (!
|
|
374
|
+
if (!Re(e))
|
|
375
375
|
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
376
376
|
te.unobserve(this, e);
|
|
377
377
|
}, i.prototype.disconnect = function() {
|
|
@@ -416,7 +416,7 @@ function lt(i) {
|
|
|
416
416
|
).getPropertyValue("column-count")
|
|
417
417
|
);
|
|
418
418
|
}
|
|
419
|
-
function
|
|
419
|
+
function Kt(i) {
|
|
420
420
|
const e = "readium-virtual-page";
|
|
421
421
|
let t = i.document.getElementById(e);
|
|
422
422
|
if (lt(i) !== 2)
|
|
@@ -843,6 +843,27 @@ class l {
|
|
|
843
843
|
fileExtension: "json"
|
|
844
844
|
});
|
|
845
845
|
}
|
|
846
|
+
static get READIUM_CONTENT_DOCUMENT() {
|
|
847
|
+
return l.parse({
|
|
848
|
+
mediaType: "application/vnd.readium.content+json",
|
|
849
|
+
name: "Readium Content Document",
|
|
850
|
+
fileExtension: "json"
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
static get READIUM_GUIDED_NAVIGATION_DOCUMENT() {
|
|
854
|
+
return l.parse({
|
|
855
|
+
mediaType: "application/guided-navigation+json",
|
|
856
|
+
name: "Readium Guided Navigation Document",
|
|
857
|
+
fileExtension: "json"
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
static get READIUM_POSITION_LIST() {
|
|
861
|
+
return l.parse({
|
|
862
|
+
mediaType: "application/vnd.readium.position-list+json",
|
|
863
|
+
name: "Readium Position List",
|
|
864
|
+
fileExtension: "json"
|
|
865
|
+
});
|
|
866
|
+
}
|
|
846
867
|
static get READIUM_WEBPUB() {
|
|
847
868
|
return l.parse({
|
|
848
869
|
mediaType: "application/webpub+zip",
|
|
@@ -969,7 +990,7 @@ function Ue(i) {
|
|
|
969
990
|
function se(i) {
|
|
970
991
|
return isNaN(i) ? void 0 : i;
|
|
971
992
|
}
|
|
972
|
-
function
|
|
993
|
+
function O(i) {
|
|
973
994
|
return se(i) !== void 0 && Math.sign(i) >= 0 ? i : void 0;
|
|
974
995
|
}
|
|
975
996
|
function ti(i) {
|
|
@@ -1080,7 +1101,7 @@ class I {
|
|
|
1080
1101
|
});
|
|
1081
1102
|
}
|
|
1082
1103
|
}
|
|
1083
|
-
class
|
|
1104
|
+
class $ {
|
|
1084
1105
|
/**
|
|
1085
1106
|
* Creates a [Link].
|
|
1086
1107
|
*/
|
|
@@ -1092,17 +1113,17 @@ class H {
|
|
|
1092
1113
|
*/
|
|
1093
1114
|
static deserialize(e) {
|
|
1094
1115
|
if (e && e.href && typeof e.href == "string")
|
|
1095
|
-
return new
|
|
1116
|
+
return new $({
|
|
1096
1117
|
href: e.href,
|
|
1097
1118
|
templated: e.templated,
|
|
1098
1119
|
type: e.type,
|
|
1099
1120
|
title: e.title,
|
|
1100
1121
|
rels: e.rel ? e.rel instanceof Array ? new Set(e.rel) : /* @__PURE__ */ new Set([e.rel]) : void 0,
|
|
1101
1122
|
properties: b.deserialize(e.properties),
|
|
1102
|
-
height:
|
|
1103
|
-
width:
|
|
1104
|
-
duration:
|
|
1105
|
-
bitrate:
|
|
1123
|
+
height: O(e.height),
|
|
1124
|
+
width: O(e.width),
|
|
1125
|
+
duration: O(e.duration),
|
|
1126
|
+
bitrate: O(e.bitrate),
|
|
1106
1127
|
languages: ht(e.language),
|
|
1107
1128
|
alternates: ne.deserialize(e.alternate),
|
|
1108
1129
|
children: ne.deserialize(e.children)
|
|
@@ -1137,7 +1158,7 @@ class H {
|
|
|
1137
1158
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
1138
1159
|
*/
|
|
1139
1160
|
expandTemplate(e) {
|
|
1140
|
-
return new
|
|
1161
|
+
return new $({
|
|
1141
1162
|
href: new ke(this.href).expand(e),
|
|
1142
1163
|
templated: !1
|
|
1143
1164
|
});
|
|
@@ -1147,7 +1168,7 @@ class H {
|
|
|
1147
1168
|
*/
|
|
1148
1169
|
addProperties(e) {
|
|
1149
1170
|
var t;
|
|
1150
|
-
const r =
|
|
1171
|
+
const r = $.deserialize(this.serialize());
|
|
1151
1172
|
return r.properties = r.properties ? (t = r.properties) == null ? void 0 : t.add(e) : new b(e), r;
|
|
1152
1173
|
}
|
|
1153
1174
|
/**
|
|
@@ -1178,7 +1199,7 @@ class ne {
|
|
|
1178
1199
|
static deserialize(e) {
|
|
1179
1200
|
if (e && e instanceof Array)
|
|
1180
1201
|
return new ne(
|
|
1181
|
-
e.map((t) =>
|
|
1202
|
+
e.map((t) => $.deserialize(t)).filter((t) => t !== void 0)
|
|
1182
1203
|
);
|
|
1183
1204
|
}
|
|
1184
1205
|
/**
|
|
@@ -1272,11 +1293,11 @@ class oe {
|
|
|
1272
1293
|
static deserialize(e) {
|
|
1273
1294
|
if (!(e && e.cssSelector))
|
|
1274
1295
|
return;
|
|
1275
|
-
let t =
|
|
1296
|
+
let t = O(e.textNodeIndex);
|
|
1276
1297
|
if (t === void 0)
|
|
1277
1298
|
return;
|
|
1278
|
-
let r =
|
|
1279
|
-
return r === void 0 && (r =
|
|
1299
|
+
let r = O(e.charOffset);
|
|
1300
|
+
return r === void 0 && (r = O(e.offset)), new oe({
|
|
1280
1301
|
cssSelector: e.cssSelector,
|
|
1281
1302
|
textNodeIndex: t,
|
|
1282
1303
|
charOffset: r
|
|
@@ -1383,7 +1404,7 @@ class Te {
|
|
|
1383
1404
|
let t = e.currency;
|
|
1384
1405
|
if (!(t && typeof t == "string" && t.length > 0))
|
|
1385
1406
|
return;
|
|
1386
|
-
let r =
|
|
1407
|
+
let r = O(e.value);
|
|
1387
1408
|
if (r !== void 0)
|
|
1388
1409
|
return new Te({ currency: t, value: r });
|
|
1389
1410
|
}
|
|
@@ -1394,7 +1415,7 @@ class Te {
|
|
|
1394
1415
|
return { currency: this.currency, value: this.value };
|
|
1395
1416
|
}
|
|
1396
1417
|
}
|
|
1397
|
-
class
|
|
1418
|
+
class X {
|
|
1398
1419
|
/** Creates a [Acquisition]. */
|
|
1399
1420
|
constructor(e) {
|
|
1400
1421
|
this.type = e.type, this.children = e.children;
|
|
@@ -1404,14 +1425,14 @@ class j {
|
|
|
1404
1425
|
*/
|
|
1405
1426
|
static deserialize(e) {
|
|
1406
1427
|
if (e && e.type)
|
|
1407
|
-
return new
|
|
1428
|
+
return new X({
|
|
1408
1429
|
type: e.type,
|
|
1409
|
-
children:
|
|
1430
|
+
children: X.deserializeArray(e.children)
|
|
1410
1431
|
});
|
|
1411
1432
|
}
|
|
1412
1433
|
static deserializeArray(e) {
|
|
1413
1434
|
if (e instanceof Array)
|
|
1414
|
-
return e.map((t) =>
|
|
1435
|
+
return e.map((t) => X.deserialize(t)).filter((t) => t !== void 0);
|
|
1415
1436
|
}
|
|
1416
1437
|
/**
|
|
1417
1438
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1432,8 +1453,8 @@ class Se {
|
|
|
1432
1453
|
static deserialize(e) {
|
|
1433
1454
|
if (e)
|
|
1434
1455
|
return new Se({
|
|
1435
|
-
total:
|
|
1436
|
-
position:
|
|
1456
|
+
total: O(e.total),
|
|
1457
|
+
position: O(e.position)
|
|
1437
1458
|
});
|
|
1438
1459
|
}
|
|
1439
1460
|
/**
|
|
@@ -1455,8 +1476,8 @@ class Ce {
|
|
|
1455
1476
|
static deserialize(e) {
|
|
1456
1477
|
if (e)
|
|
1457
1478
|
return new Ce({
|
|
1458
|
-
total:
|
|
1459
|
-
available:
|
|
1479
|
+
total: O(e.total),
|
|
1480
|
+
available: O(e.available)
|
|
1460
1481
|
});
|
|
1461
1482
|
}
|
|
1462
1483
|
/**
|
|
@@ -1467,7 +1488,7 @@ class Ce {
|
|
|
1467
1488
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1468
1489
|
}
|
|
1469
1490
|
}
|
|
1470
|
-
class
|
|
1491
|
+
class Oe {
|
|
1471
1492
|
/** Creates a [Availability]. */
|
|
1472
1493
|
constructor(e) {
|
|
1473
1494
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1477,7 +1498,7 @@ class Pe {
|
|
|
1477
1498
|
*/
|
|
1478
1499
|
static deserialize(e) {
|
|
1479
1500
|
if (e && e.state)
|
|
1480
|
-
return new
|
|
1501
|
+
return new Oe({
|
|
1481
1502
|
state: e.state,
|
|
1482
1503
|
since: Ue(e.since),
|
|
1483
1504
|
until: Ue(e.until)
|
|
@@ -1492,7 +1513,7 @@ class Pe {
|
|
|
1492
1513
|
}
|
|
1493
1514
|
}
|
|
1494
1515
|
b.prototype.getNumberOfItems = function() {
|
|
1495
|
-
return
|
|
1516
|
+
return O(this.otherProperties.numberOfItems);
|
|
1496
1517
|
};
|
|
1497
1518
|
b.prototype.getPrice = function() {
|
|
1498
1519
|
return Te.deserialize(this.otherProperties.price);
|
|
@@ -1500,7 +1521,7 @@ b.prototype.getPrice = function() {
|
|
|
1500
1521
|
b.prototype.getIndirectAcquisitions = function() {
|
|
1501
1522
|
const i = this.otherProperties.indirectAcquisition;
|
|
1502
1523
|
if (i && i instanceof Array)
|
|
1503
|
-
return i.map((e) =>
|
|
1524
|
+
return i.map((e) => X.deserialize(e)).filter((e) => e !== void 0);
|
|
1504
1525
|
};
|
|
1505
1526
|
b.prototype.getHolds = function() {
|
|
1506
1527
|
return Se.deserialize(this.otherProperties.holds);
|
|
@@ -1509,10 +1530,10 @@ b.prototype.getCopies = function() {
|
|
|
1509
1530
|
return Ce.deserialize(this.otherProperties.copies);
|
|
1510
1531
|
};
|
|
1511
1532
|
b.prototype.getAvailability = function() {
|
|
1512
|
-
return
|
|
1533
|
+
return Oe.deserialize(this.otherProperties.availability);
|
|
1513
1534
|
};
|
|
1514
1535
|
b.prototype.getAuthenticate = function() {
|
|
1515
|
-
return
|
|
1536
|
+
return $.deserialize(this.otherProperties.authenticate);
|
|
1516
1537
|
};
|
|
1517
1538
|
b.prototype.getClipped = function() {
|
|
1518
1539
|
return this.otherProperties.clipped;
|
|
@@ -1532,13 +1553,13 @@ b.prototype.getPage = function() {
|
|
|
1532
1553
|
b.prototype.getSpread = function() {
|
|
1533
1554
|
return this.otherProperties.spread || void 0;
|
|
1534
1555
|
};
|
|
1535
|
-
function
|
|
1556
|
+
function He(i) {
|
|
1536
1557
|
return i.split("").reverse().join("");
|
|
1537
1558
|
}
|
|
1538
1559
|
function ii(i, e, t) {
|
|
1539
|
-
const r =
|
|
1560
|
+
const r = He(e);
|
|
1540
1561
|
return t.map((s) => {
|
|
1541
|
-
const n = Math.max(0, s.end - e.length - s.errors), o =
|
|
1562
|
+
const n = Math.max(0, s.end - e.length - s.errors), o = He(i.slice(n, s.end));
|
|
1542
1563
|
return {
|
|
1543
1564
|
start: ct(o, r, s.errors).reduce((h, c) => s.end - c.end < h ? s.end - c.end : h, s.end),
|
|
1544
1565
|
end: s.end,
|
|
@@ -1549,7 +1570,7 @@ function ii(i, e, t) {
|
|
|
1549
1570
|
function pe(i) {
|
|
1550
1571
|
return (i | -i) >> 31 & 1;
|
|
1551
1572
|
}
|
|
1552
|
-
function
|
|
1573
|
+
function $e(i, e, t, r) {
|
|
1553
1574
|
let s = i.P[t], n = i.M[t];
|
|
1554
1575
|
const o = r >>> 31, a = e[t] | o, h = a | n, c = (a & s) + s ^ s | a;
|
|
1555
1576
|
let d = n | ~(c | s), p = s & c;
|
|
@@ -1598,7 +1619,7 @@ function ct(i, e, t) {
|
|
|
1598
1619
|
f < c.length ? v = c[f] : (v = h.get(f), typeof v > "u" && (v = a));
|
|
1599
1620
|
let g = 0;
|
|
1600
1621
|
for (let y = 0; y <= d; y += 1)
|
|
1601
|
-
g =
|
|
1622
|
+
g = $e(o, v, y, g), p[y] += g;
|
|
1602
1623
|
if (p[d] - g <= t && d < n && (v[d + 1] & 1 || g < 0)) {
|
|
1603
1624
|
d += 1, o.P[d] = -1, o.M[d] = 0;
|
|
1604
1625
|
let y;
|
|
@@ -1607,7 +1628,7 @@ function ct(i, e, t) {
|
|
|
1607
1628
|
y = x === 0 ? s : x;
|
|
1608
1629
|
} else
|
|
1609
1630
|
y = s;
|
|
1610
|
-
p[d] = p[d - 1] + y - g +
|
|
1631
|
+
p[d] = p[d - 1] + y - g + $e(o, v, d, g);
|
|
1611
1632
|
} else
|
|
1612
1633
|
for (; d > 0 && p[d] >= t + s; )
|
|
1613
1634
|
d -= 1;
|
|
@@ -1675,7 +1696,7 @@ function ge(i, e, t) {
|
|
|
1675
1696
|
const o = s.length - n.length;
|
|
1676
1697
|
return t === 2 ? e - o : e + o;
|
|
1677
1698
|
}
|
|
1678
|
-
function
|
|
1699
|
+
function _e(i, e) {
|
|
1679
1700
|
const t = i.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1680
1701
|
i.commonAncestorContainer,
|
|
1681
1702
|
NodeFilter.SHOW_TEXT
|
|
@@ -1723,7 +1744,7 @@ function ni(i) {
|
|
|
1723
1744
|
if (s.start >= 0 && (e.setStart(i.startContainer, s.start), t = !0), s.end > 0 && (e.setEnd(i.endContainer, s.end), r = !0), t && r)
|
|
1724
1745
|
return e;
|
|
1725
1746
|
if (!t) {
|
|
1726
|
-
const { node: n, offset: o } =
|
|
1747
|
+
const { node: n, offset: o } = _e(
|
|
1727
1748
|
e,
|
|
1728
1749
|
1
|
|
1729
1750
|
/* Forwards */
|
|
@@ -1731,7 +1752,7 @@ function ni(i) {
|
|
|
1731
1752
|
n && o >= 0 && e.setStart(n, o);
|
|
1732
1753
|
}
|
|
1733
1754
|
if (!r) {
|
|
1734
|
-
const { node: n, offset: o } =
|
|
1755
|
+
const { node: n, offset: o } = _e(
|
|
1735
1756
|
e,
|
|
1736
1757
|
2
|
|
1737
1758
|
/* Backwards */
|
|
@@ -1750,7 +1771,7 @@ function ut(i) {
|
|
|
1750
1771
|
return 0;
|
|
1751
1772
|
}
|
|
1752
1773
|
}
|
|
1753
|
-
function
|
|
1774
|
+
function je(i) {
|
|
1754
1775
|
let e = i.previousSibling, t = 0;
|
|
1755
1776
|
for (; e; )
|
|
1756
1777
|
t += ut(e), e = e.previousSibling;
|
|
@@ -1771,7 +1792,7 @@ function pt(i, ...e) {
|
|
|
1771
1792
|
throw new RangeError("Offset exceeds text length");
|
|
1772
1793
|
return s;
|
|
1773
1794
|
}
|
|
1774
|
-
class
|
|
1795
|
+
class N {
|
|
1775
1796
|
constructor(e, t) {
|
|
1776
1797
|
if (t < 0)
|
|
1777
1798
|
throw new Error("Offset is invalid");
|
|
@@ -1788,8 +1809,8 @@ class R {
|
|
|
1788
1809
|
throw new Error("Parent is not an ancestor of current element");
|
|
1789
1810
|
let t = this.element, r = this.offset;
|
|
1790
1811
|
for (; t !== e; )
|
|
1791
|
-
r +=
|
|
1792
|
-
return new
|
|
1812
|
+
r += je(t), t = t.parentElement;
|
|
1813
|
+
return new N(t, r);
|
|
1793
1814
|
}
|
|
1794
1815
|
/**
|
|
1795
1816
|
* Resolve the position to a specific text node and offset within that node.
|
|
@@ -1833,9 +1854,9 @@ class R {
|
|
|
1833
1854
|
static fromCharOffset(e, t) {
|
|
1834
1855
|
switch (e.nodeType) {
|
|
1835
1856
|
case Node.TEXT_NODE:
|
|
1836
|
-
return
|
|
1857
|
+
return N.fromPoint(e, t);
|
|
1837
1858
|
case Node.ELEMENT_NODE:
|
|
1838
|
-
return new
|
|
1859
|
+
return new N(e, t);
|
|
1839
1860
|
default:
|
|
1840
1861
|
throw new Error("Node is not an element or text node");
|
|
1841
1862
|
}
|
|
@@ -1853,8 +1874,8 @@ class R {
|
|
|
1853
1874
|
throw new Error("Text node offset is out of range");
|
|
1854
1875
|
if (!e.parentElement)
|
|
1855
1876
|
throw new Error("Text node has no parent");
|
|
1856
|
-
const r =
|
|
1857
|
-
return new
|
|
1877
|
+
const r = je(e) + t;
|
|
1878
|
+
return new N(e.parentElement, r);
|
|
1858
1879
|
}
|
|
1859
1880
|
case Node.ELEMENT_NODE: {
|
|
1860
1881
|
if (t < 0 || t > e.childNodes.length)
|
|
@@ -1862,7 +1883,7 @@ class R {
|
|
|
1862
1883
|
let r = 0;
|
|
1863
1884
|
for (let s = 0; s < t; s++)
|
|
1864
1885
|
r += ut(e.childNodes[s]);
|
|
1865
|
-
return new
|
|
1886
|
+
return new N(e, r);
|
|
1866
1887
|
}
|
|
1867
1888
|
default:
|
|
1868
1889
|
throw new Error("Point is not in an element or text node");
|
|
@@ -1913,10 +1934,10 @@ class z {
|
|
|
1913
1934
|
* Create a TextRange from a (DOM) Range
|
|
1914
1935
|
*/
|
|
1915
1936
|
static fromRange(e) {
|
|
1916
|
-
const t =
|
|
1937
|
+
const t = N.fromPoint(
|
|
1917
1938
|
e.startContainer,
|
|
1918
1939
|
e.startOffset
|
|
1919
|
-
), r =
|
|
1940
|
+
), r = N.fromPoint(e.endContainer, e.endOffset);
|
|
1920
1941
|
return new z(t, r);
|
|
1921
1942
|
}
|
|
1922
1943
|
/**
|
|
@@ -1925,8 +1946,8 @@ class z {
|
|
|
1925
1946
|
*/
|
|
1926
1947
|
static fromOffsets(e, t, r) {
|
|
1927
1948
|
return new z(
|
|
1928
|
-
new
|
|
1929
|
-
new
|
|
1949
|
+
new N(e, t),
|
|
1950
|
+
new N(e, r)
|
|
1930
1951
|
);
|
|
1931
1952
|
}
|
|
1932
1953
|
/**
|
|
@@ -2007,36 +2028,40 @@ class le {
|
|
|
2007
2028
|
return new ae(this.root, r.start, r.end);
|
|
2008
2029
|
}
|
|
2009
2030
|
}
|
|
2010
|
-
function
|
|
2031
|
+
function oi(i) {
|
|
2032
|
+
const e = i.tagName.toUpperCase();
|
|
2033
|
+
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
2034
|
+
}
|
|
2035
|
+
function Pe(i, e) {
|
|
2011
2036
|
try {
|
|
2012
|
-
|
|
2013
|
-
if (
|
|
2014
|
-
let
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
prefix:
|
|
2018
|
-
suffix:
|
|
2037
|
+
const t = e.locations, r = e.text;
|
|
2038
|
+
if (r && r.highlight) {
|
|
2039
|
+
let s;
|
|
2040
|
+
t && t.getCssSelector() && (s = i.querySelector(t.getCssSelector())), s || (s = i.body);
|
|
2041
|
+
const n = new le(s, r.highlight, {
|
|
2042
|
+
prefix: r.before,
|
|
2043
|
+
suffix: r.after
|
|
2019
2044
|
});
|
|
2020
2045
|
try {
|
|
2021
|
-
return
|
|
2046
|
+
return n.toRange();
|
|
2022
2047
|
} catch {
|
|
2023
|
-
return console.warn("Quote not found:",
|
|
2048
|
+
return console.warn("Quote not found:", n), null;
|
|
2024
2049
|
}
|
|
2025
2050
|
}
|
|
2026
|
-
if (
|
|
2027
|
-
|
|
2028
|
-
if (!
|
|
2029
|
-
for (const n of
|
|
2030
|
-
if (
|
|
2051
|
+
if (t) {
|
|
2052
|
+
let s = null;
|
|
2053
|
+
if (!s && t.getCssSelector() && (s = i.querySelector(t.getCssSelector())), !s && t.fragments) {
|
|
2054
|
+
for (const n of t.fragments)
|
|
2055
|
+
if (s = i.getElementById(n), s)
|
|
2031
2056
|
break;
|
|
2032
2057
|
}
|
|
2033
|
-
if (
|
|
2034
|
-
|
|
2035
|
-
return
|
|
2058
|
+
if (s) {
|
|
2059
|
+
const n = i.createRange();
|
|
2060
|
+
return s.childNodes.length === 0 || oi(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
2036
2061
|
}
|
|
2037
2062
|
}
|
|
2038
|
-
} catch (
|
|
2039
|
-
console.error(
|
|
2063
|
+
} catch (t) {
|
|
2064
|
+
console.error(t);
|
|
2040
2065
|
}
|
|
2041
2066
|
return null;
|
|
2042
2067
|
}
|
|
@@ -2044,7 +2069,7 @@ function T(i) {
|
|
|
2044
2069
|
const e = i.getSelection();
|
|
2045
2070
|
e && e.removeAllRanges();
|
|
2046
2071
|
}
|
|
2047
|
-
const
|
|
2072
|
+
const ai = [
|
|
2048
2073
|
"a",
|
|
2049
2074
|
"audio",
|
|
2050
2075
|
"button",
|
|
@@ -2060,7 +2085,7 @@ const oi = [
|
|
|
2060
2085
|
];
|
|
2061
2086
|
function ft(i) {
|
|
2062
2087
|
var e;
|
|
2063
|
-
return
|
|
2088
|
+
return ai.indexOf(i.nodeName.toLowerCase()) !== -1 || i.hasAttribute("contenteditable") && ((e = i.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? i : i.parentElement ? ft(i.parentElement) : null;
|
|
2064
2089
|
}
|
|
2065
2090
|
function mt(i, e) {
|
|
2066
2091
|
const t = gt(i, i.document.body, e);
|
|
@@ -2080,12 +2105,12 @@ function mt(i, e) {
|
|
|
2080
2105
|
function gt(i, e, t) {
|
|
2081
2106
|
for (var r = 0; r < e.children.length; r++) {
|
|
2082
2107
|
const s = e.children[r];
|
|
2083
|
-
if (!
|
|
2108
|
+
if (!hi(s) && li(i, s, t))
|
|
2084
2109
|
return gt(i, s, t);
|
|
2085
2110
|
}
|
|
2086
2111
|
return e;
|
|
2087
2112
|
}
|
|
2088
|
-
function
|
|
2113
|
+
function li(i, e, t) {
|
|
2089
2114
|
if (e === document.body || e === document.documentElement)
|
|
2090
2115
|
return !0;
|
|
2091
2116
|
if (!document || !document.documentElement || !document.body)
|
|
@@ -2093,11 +2118,11 @@ function ai(i, e, t) {
|
|
|
2093
2118
|
const r = e.getBoundingClientRect();
|
|
2094
2119
|
return t ? r.bottom > 0 && r.top < i.innerHeight : r.right > 0 && r.left < i.innerWidth;
|
|
2095
2120
|
}
|
|
2096
|
-
function
|
|
2121
|
+
function hi(i) {
|
|
2097
2122
|
const e = getComputedStyle(i);
|
|
2098
2123
|
return !!(e && (e.getPropertyValue("display") != "block" || e.getPropertyValue("opacity") === "0"));
|
|
2099
2124
|
}
|
|
2100
|
-
const
|
|
2125
|
+
const Ve = "readium-column-snapper-style", ci = 200, vt = class C extends at {
|
|
2101
2126
|
constructor() {
|
|
2102
2127
|
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);
|
|
2103
2128
|
}
|
|
@@ -2112,7 +2137,7 @@ const _e = "readium-column-snapper-style", hi = 200, vt = class C extends at {
|
|
|
2112
2137
|
return t - t % this.wnd.innerWidth;
|
|
2113
2138
|
}
|
|
2114
2139
|
reportProgress() {
|
|
2115
|
-
this.comms.send("progress", this.wnd.scrollX / this.cachedScrollWidth);
|
|
2140
|
+
this.comms.send("progress", { progress: this.wnd.scrollX / this.cachedScrollWidth, reference: this.wnd.innerWidth / this.doc().scrollWidth });
|
|
2116
2141
|
}
|
|
2117
2142
|
shake() {
|
|
2118
2143
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0)
|
|
@@ -2141,7 +2166,7 @@ const _e = "readium-column-snapper-style", hi = 200, vt = class C extends at {
|
|
|
2141
2166
|
this.snappingCancelled = !1;
|
|
2142
2167
|
const p = (g, y, x, S) => x > S ? y : g + (y - g) * Qt(x / S), u = (
|
|
2143
2168
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2144
|
-
|
|
2169
|
+
ci * o
|
|
2145
2170
|
);
|
|
2146
2171
|
let f;
|
|
2147
2172
|
const v = (g) => {
|
|
@@ -2197,8 +2222,9 @@ const _e = "readium-column-snapper-style", hi = 200, vt = class C extends at {
|
|
|
2197
2222
|
mount(e, t) {
|
|
2198
2223
|
if (this.wnd = e, this.comms = t, !super.mount(e, t))
|
|
2199
2224
|
return !1;
|
|
2225
|
+
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2200
2226
|
const r = e.document.createElement("style");
|
|
2201
|
-
r.dataset.readium = "true", r.id =
|
|
2227
|
+
r.dataset.readium = "true", r.id = Ve, r.textContent = `
|
|
2202
2228
|
@keyframes readium-bounce-l-animation {
|
|
2203
2229
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2204
2230
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2235,7 +2261,7 @@ const _e = "readium-column-snapper-style", hi = 200, vt = class C extends at {
|
|
|
2235
2261
|
`, e.document.head.appendChild(r);
|
|
2236
2262
|
const s = e.ResizeObserver || nt;
|
|
2237
2263
|
this.resizeObserver = new s(() => e.requestAnimationFrame(() => {
|
|
2238
|
-
e &&
|
|
2264
|
+
e && Kt(e);
|
|
2239
2265
|
})), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver(() => {
|
|
2240
2266
|
this.wnd.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
2241
2267
|
}), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] });
|
|
@@ -2268,7 +2294,7 @@ const _e = "readium-column-snapper-style", hi = 200, vt = class C extends at {
|
|
|
2268
2294
|
}), t.register("go_text", C.moduleName, (o, a) => {
|
|
2269
2295
|
let h;
|
|
2270
2296
|
Array.isArray(o) && (o.length > 1 && (h = o[1]), o = o[0]);
|
|
2271
|
-
const c = q.deserialize(o), d =
|
|
2297
|
+
const c = q.deserialize(o), d = Pe(this.wnd.document, new I({
|
|
2272
2298
|
href: e.location.href,
|
|
2273
2299
|
type: "text/html",
|
|
2274
2300
|
text: c,
|
|
@@ -2326,37 +2352,37 @@ const _e = "readium-column-snapper-style", hi = 200, vt = class C extends at {
|
|
|
2326
2352
|
}
|
|
2327
2353
|
unmount(e, t) {
|
|
2328
2354
|
var r;
|
|
2329
|
-
return this.snappingCancelled = !0, t.unregisterAll(C.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), (r = e.document.getElementById(
|
|
2355
|
+
return this.snappingCancelled = !0, t.unregisterAll(C.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), (r = e.document.getElementById(Ve)) == null || r.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
|
|
2330
2356
|
}
|
|
2331
2357
|
};
|
|
2332
2358
|
vt.moduleName = "column_snapper";
|
|
2333
|
-
let
|
|
2359
|
+
let di = vt;
|
|
2334
2360
|
const he = {
|
|
2335
2361
|
top: "js-iframe-reader-top-anchor",
|
|
2336
2362
|
bottom: "js-iframe-reader-bottom-anchor"
|
|
2337
2363
|
};
|
|
2338
|
-
class
|
|
2364
|
+
class ui extends HTMLElement {
|
|
2339
2365
|
connectedCallback() {
|
|
2340
2366
|
this.setAttribute("aria-hidden", "true"), this.style.setProperty("display", "block", "important"), this.style.setProperty("padding", "0", "important"), this.style.setProperty("margin", "0", "important"), this.style.setProperty("visibility", "hidden", "important");
|
|
2341
2367
|
}
|
|
2342
2368
|
}
|
|
2343
|
-
function
|
|
2369
|
+
function pi(i) {
|
|
2344
2370
|
const e = i.getElementsByTagName("body")[0], t = document.createElement("anchor-observer"), r = document.createElement("anchor-observer");
|
|
2345
2371
|
t.dataset.readium = "true", r.dataset.readium = "true", t == null || t.setAttribute("id", he.top), t == null || t.style.setProperty("height", "115px", "important"), r == null || r.setAttribute("id", he.bottom), r == null || r.style.setProperty("height", "80px", "important"), e == null || e.insertBefore(t, e.firstChild), e == null || e.appendChild(r);
|
|
2346
2372
|
}
|
|
2347
|
-
function
|
|
2373
|
+
function fi(i) {
|
|
2348
2374
|
var s, n;
|
|
2349
2375
|
const e = i.getElementsByTagName("body")[0], t = e == null ? void 0 : e.querySelector(`#${he.top}`), r = e == null ? void 0 : e.querySelector(`#${he.bottom}`);
|
|
2350
2376
|
t && ((s = t.parentElement) == null || s.removeChild(t)), r && ((n = r.parentElement) == null || n.removeChild(r));
|
|
2351
2377
|
}
|
|
2352
|
-
const
|
|
2378
|
+
const Xe = "readium-scroll-snapper-style", yt = class M extends at {
|
|
2353
2379
|
constructor() {
|
|
2354
2380
|
super(...arguments), this.createAnchorElements = () => {
|
|
2355
|
-
ui(this.doc());
|
|
2356
|
-
}, this.removeAnchorElements = () => {
|
|
2357
2381
|
pi(this.doc());
|
|
2382
|
+
}, this.removeAnchorElements = () => {
|
|
2383
|
+
fi(this.doc());
|
|
2358
2384
|
}, this.createCustomElement = () => {
|
|
2359
|
-
customElements.get("anchor-observer") || customElements.define("anchor-observer",
|
|
2385
|
+
customElements.get("anchor-observer") || customElements.define("anchor-observer", ui);
|
|
2360
2386
|
};
|
|
2361
2387
|
}
|
|
2362
2388
|
doc() {
|
|
@@ -2366,9 +2392,9 @@ const je = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2366
2392
|
this.comms.send("progress", e);
|
|
2367
2393
|
}
|
|
2368
2394
|
mount(e, t) {
|
|
2369
|
-
this.wnd = e, this.comms = t;
|
|
2395
|
+
this.wnd = e, this.comms = t, e.navigator.epubReadingSystem.layoutStyle = "scrolling";
|
|
2370
2396
|
const r = e.document.createElement("style");
|
|
2371
|
-
return r.dataset.readium = "true", r.id =
|
|
2397
|
+
return r.dataset.readium = "true", r.id = Xe, r.textContent = `
|
|
2372
2398
|
* {
|
|
2373
2399
|
scrollbar-width: none; /* for Firefox */
|
|
2374
2400
|
}
|
|
@@ -2385,7 +2411,7 @@ const je = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2385
2411
|
return;
|
|
2386
2412
|
}
|
|
2387
2413
|
this.wnd.requestAnimationFrame(() => {
|
|
2388
|
-
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress(o), T(this.wnd), n(!0);
|
|
2414
|
+
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2389
2415
|
});
|
|
2390
2416
|
}), t.register("go_id", M.moduleName, (s, n) => {
|
|
2391
2417
|
const o = e.document.getElementById(s);
|
|
@@ -2394,12 +2420,14 @@ const je = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2394
2420
|
return;
|
|
2395
2421
|
}
|
|
2396
2422
|
this.wnd.requestAnimationFrame(() => {
|
|
2397
|
-
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2
|
|
2423
|
+
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2424
|
+
const a = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2425
|
+
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2398
2426
|
});
|
|
2399
2427
|
}), t.register("go_text", M.moduleName, (s, n) => {
|
|
2400
2428
|
let o;
|
|
2401
2429
|
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2402
|
-
const a = q.deserialize(s), h =
|
|
2430
|
+
const a = q.deserialize(s), h = Pe(this.wnd.document, new I({
|
|
2403
2431
|
href: e.location.href,
|
|
2404
2432
|
type: "text/html",
|
|
2405
2433
|
text: a,
|
|
@@ -2414,23 +2442,26 @@ const je = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2414
2442
|
return;
|
|
2415
2443
|
}
|
|
2416
2444
|
this.wnd.requestAnimationFrame(() => {
|
|
2417
|
-
this.doc().scrollTop = h.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2
|
|
2445
|
+
this.doc().scrollTop = h.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2446
|
+
const c = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2447
|
+
this.reportProgress({ progress: c, reference: this.wnd.innerHeight / this.doc().scrollHeight }), T(this.wnd), n(!0);
|
|
2418
2448
|
});
|
|
2419
2449
|
}), t.register("go_start", M.moduleName, (s, n) => {
|
|
2420
2450
|
if (this.doc().scrollTop === 0)
|
|
2421
2451
|
return n(!1);
|
|
2422
|
-
this.doc().scrollTop = 0, this.reportProgress(0), n(!0);
|
|
2452
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2423
2453
|
}), t.register("go_end", M.moduleName, (s, n) => {
|
|
2424
2454
|
if (this.doc().scrollTop === 0)
|
|
2425
2455
|
return n(!1);
|
|
2426
|
-
this.doc().scrollTop = 0, this.reportProgress(0), n(!0);
|
|
2456
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2427
2457
|
}), t.register("unfocus", M.moduleName, (s, n) => {
|
|
2428
2458
|
T(this.wnd), n(!0);
|
|
2429
2459
|
}), t.register([
|
|
2430
2460
|
"go_next",
|
|
2431
2461
|
"go_prev"
|
|
2432
2462
|
], M.moduleName, (s, n) => n(!1)), t.register("focus", M.moduleName, (s, n) => {
|
|
2433
|
-
this.
|
|
2463
|
+
const o = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2464
|
+
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2434
2465
|
}), t.register("first_visible_locator", M.moduleName, (s, n) => {
|
|
2435
2466
|
const o = mt(e, !0);
|
|
2436
2467
|
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
@@ -2438,11 +2469,11 @@ const je = "readium-scroll-snapper-style", yt = class M extends at {
|
|
|
2438
2469
|
}
|
|
2439
2470
|
unmount(e, t) {
|
|
2440
2471
|
var r;
|
|
2441
|
-
return t.unregisterAll(M.moduleName), this.removeAnchorElements(), (r = e.document.getElementById(
|
|
2472
|
+
return t.unregisterAll(M.moduleName), this.removeAnchorElements(), (r = e.document.getElementById(Xe)) == null || r.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2442
2473
|
}
|
|
2443
2474
|
};
|
|
2444
2475
|
yt.moduleName = "scroll_snapper";
|
|
2445
|
-
let
|
|
2476
|
+
let mi = yt;
|
|
2446
2477
|
class bt extends ce {
|
|
2447
2478
|
constructor() {
|
|
2448
2479
|
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);
|
|
@@ -2565,7 +2596,33 @@ const Et = class ve extends ce {
|
|
|
2565
2596
|
"error",
|
|
2566
2597
|
this.wndOnErr,
|
|
2567
2598
|
!1
|
|
2568
|
-
),
|
|
2599
|
+
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
2600
|
+
value: {
|
|
2601
|
+
name: "readium-ts-toolkit",
|
|
2602
|
+
version: "1.3.1",
|
|
2603
|
+
hasFeature: (s, n = "") => {
|
|
2604
|
+
switch (s) {
|
|
2605
|
+
case "dom-manipulation":
|
|
2606
|
+
return !0;
|
|
2607
|
+
case "layout-changes":
|
|
2608
|
+
return !0;
|
|
2609
|
+
case "touch-events":
|
|
2610
|
+
return !0;
|
|
2611
|
+
case "mouse-events":
|
|
2612
|
+
return !0;
|
|
2613
|
+
case "keyboard-events":
|
|
2614
|
+
return !0;
|
|
2615
|
+
case "spine-scripting":
|
|
2616
|
+
return !0;
|
|
2617
|
+
case "embedded-web-content":
|
|
2618
|
+
return !0;
|
|
2619
|
+
default:
|
|
2620
|
+
return !1;
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2623
|
+
},
|
|
2624
|
+
writable: !1
|
|
2625
|
+
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
2569
2626
|
s.cancel(), this.allAnimations.add(s);
|
|
2570
2627
|
}), t.register("activate", ve.moduleName, (s, n) => {
|
|
2571
2628
|
this.allAnimations.forEach((o) => {
|
|
@@ -2591,7 +2648,7 @@ const Et = class ve extends ce {
|
|
|
2591
2648
|
};
|
|
2592
2649
|
Et.moduleName = "setup";
|
|
2593
2650
|
let xt = Et;
|
|
2594
|
-
function
|
|
2651
|
+
function gi(i, e) {
|
|
2595
2652
|
return i.document.documentElement.style.getPropertyValue(e);
|
|
2596
2653
|
}
|
|
2597
2654
|
function ye(i, e, t) {
|
|
@@ -2600,7 +2657,7 @@ function ye(i, e, t) {
|
|
|
2600
2657
|
function wt(i, e) {
|
|
2601
2658
|
i.document.documentElement.style.removeProperty(e);
|
|
2602
2659
|
}
|
|
2603
|
-
const Ge = "readium-viewport", Tt = class
|
|
2660
|
+
const Ge = "readium-viewport", Tt = class j extends xt {
|
|
2604
2661
|
onViewportWidthChanged(e) {
|
|
2605
2662
|
const t = e.target;
|
|
2606
2663
|
ye(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
@@ -2614,26 +2671,27 @@ const Ge = "readium-viewport", Tt = class V extends xt {
|
|
|
2614
2671
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
2615
2672
|
), e.document.head.appendChild(r), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
2616
2673
|
target: e
|
|
2617
|
-
}), t.register("set_property",
|
|
2674
|
+
}), t.register("set_property", j.moduleName, (s, n) => {
|
|
2618
2675
|
const o = s;
|
|
2619
2676
|
ye(e, o[0], o[1]), n(!0);
|
|
2620
|
-
}), t.register("remove_property",
|
|
2677
|
+
}), t.register("remove_property", j.moduleName, (s, n) => {
|
|
2621
2678
|
wt(e, s), n(!0);
|
|
2622
|
-
}), t.register("activate",
|
|
2679
|
+
}), t.register("activate", j.moduleName, (s, n) => {
|
|
2623
2680
|
this.unblock(e), n(!0);
|
|
2624
2681
|
}), t.log("ReflowableSetup Mounted"), !0;
|
|
2625
2682
|
}
|
|
2626
2683
|
unmount(e, t) {
|
|
2627
2684
|
var r;
|
|
2628
|
-
return t.unregisterAll(
|
|
2685
|
+
return t.unregisterAll(j.moduleName), (r = e.document.head.querySelector(`#${Ge}`)) == null || r.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
2629
2686
|
}
|
|
2630
2687
|
};
|
|
2631
2688
|
Tt.moduleName = "reflowable_setup";
|
|
2632
|
-
let
|
|
2689
|
+
let vi = Tt;
|
|
2633
2690
|
const Ye = "readium-fixed-style", St = class L extends xt {
|
|
2634
2691
|
mount(e, t) {
|
|
2635
2692
|
if (!super.mount(e, t))
|
|
2636
2693
|
return !1;
|
|
2694
|
+
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2637
2695
|
const r = e.document.createElement("style");
|
|
2638
2696
|
return r.id = Ye, r.dataset.readium = "true", r.textContent = `
|
|
2639
2697
|
html, body {
|
|
@@ -2673,8 +2731,8 @@ const Ye = "readium-fixed-style", St = class L extends xt {
|
|
|
2673
2731
|
}
|
|
2674
2732
|
};
|
|
2675
2733
|
St.moduleName = "fixed_setup";
|
|
2676
|
-
let
|
|
2677
|
-
function
|
|
2734
|
+
let yi = St;
|
|
2735
|
+
function bi(i, e) {
|
|
2678
2736
|
let t = i.getClientRects();
|
|
2679
2737
|
t.length || i.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = i.commonAncestorContainer.getClientRects());
|
|
2680
2738
|
const r = 1, s = [];
|
|
@@ -2691,7 +2749,7 @@ function yi(i, e) {
|
|
|
2691
2749
|
s,
|
|
2692
2750
|
r,
|
|
2693
2751
|
e
|
|
2694
|
-
), o =
|
|
2752
|
+
), o = xi(n, r), a = Ot(o), h = 2 * 2;
|
|
2695
2753
|
for (let c = a.length - 1; c >= 0; c--) {
|
|
2696
2754
|
const d = a[c];
|
|
2697
2755
|
if (!(d.width * d.height > h))
|
|
@@ -2709,8 +2767,8 @@ function Ct(i, e, t) {
|
|
|
2709
2767
|
if (n === o)
|
|
2710
2768
|
continue;
|
|
2711
2769
|
const a = A(n.top, o.top, e) && A(n.bottom, o.bottom, e), h = A(n.left, o.left, e) && A(n.right, o.right, e);
|
|
2712
|
-
if ((h && !t || a && !h) &&
|
|
2713
|
-
const u = i.filter((v) => v !== n && v !== o), f =
|
|
2770
|
+
if ((h && !t || a && !h) && Pt(n, o, e)) {
|
|
2771
|
+
const u = i.filter((v) => v !== n && v !== o), f = Ei(n, o);
|
|
2714
2772
|
return u.push(f), Ct(
|
|
2715
2773
|
u,
|
|
2716
2774
|
e,
|
|
@@ -2720,7 +2778,7 @@ function Ct(i, e, t) {
|
|
|
2720
2778
|
}
|
|
2721
2779
|
return i;
|
|
2722
2780
|
}
|
|
2723
|
-
function
|
|
2781
|
+
function Ei(i, e) {
|
|
2724
2782
|
const t = Math.min(i.left, e.left), r = Math.max(i.right, e.right), s = Math.min(i.top, e.top), n = Math.max(i.bottom, e.bottom);
|
|
2725
2783
|
return {
|
|
2726
2784
|
bottom: n,
|
|
@@ -2731,7 +2789,7 @@ function bi(i, e) {
|
|
|
2731
2789
|
width: r - t
|
|
2732
2790
|
};
|
|
2733
2791
|
}
|
|
2734
|
-
function
|
|
2792
|
+
function xi(i, e) {
|
|
2735
2793
|
const t = new Set(i);
|
|
2736
2794
|
for (const r of i) {
|
|
2737
2795
|
if (!(r.width > 1 && r.height > 1)) {
|
|
@@ -2739,24 +2797,24 @@ function Ei(i, e) {
|
|
|
2739
2797
|
continue;
|
|
2740
2798
|
}
|
|
2741
2799
|
for (const n of i)
|
|
2742
|
-
if (r !== n && t.has(n) &&
|
|
2800
|
+
if (r !== n && t.has(n) && wi(n, r, e)) {
|
|
2743
2801
|
t.delete(r);
|
|
2744
2802
|
break;
|
|
2745
2803
|
}
|
|
2746
2804
|
}
|
|
2747
2805
|
return Array.from(t);
|
|
2748
2806
|
}
|
|
2749
|
-
function
|
|
2807
|
+
function wi(i, e, t) {
|
|
2750
2808
|
return ie(i, e.left, e.top, t) && ie(i, e.right, e.top, t) && ie(i, e.left, e.bottom, t) && ie(i, e.right, e.bottom, t);
|
|
2751
2809
|
}
|
|
2752
2810
|
function ie(i, e, t, r) {
|
|
2753
2811
|
return (i.left < e || A(i.left, e, r)) && (i.right > e || A(i.right, e, r)) && (i.top < t || A(i.top, t, r)) && (i.bottom > t || A(i.bottom, t, r));
|
|
2754
2812
|
}
|
|
2755
|
-
function
|
|
2813
|
+
function Ot(i) {
|
|
2756
2814
|
for (let e = 0; e < i.length; e++)
|
|
2757
2815
|
for (let t = e + 1; t < i.length; t++) {
|
|
2758
2816
|
const r = i[e], s = i[t];
|
|
2759
|
-
if (r !== s &&
|
|
2817
|
+
if (r !== s && Pt(r, s, -1)) {
|
|
2760
2818
|
let n = [], o;
|
|
2761
2819
|
const a = Ze(r, s);
|
|
2762
2820
|
if (a.length === 1)
|
|
@@ -2766,13 +2824,13 @@ function Pt(i) {
|
|
|
2766
2824
|
a.length < c.length ? (n = a, o = r) : (n = c, o = s);
|
|
2767
2825
|
}
|
|
2768
2826
|
const h = i.filter((c) => c !== o);
|
|
2769
|
-
return Array.prototype.push.apply(h, n),
|
|
2827
|
+
return Array.prototype.push.apply(h, n), Ot(h);
|
|
2770
2828
|
}
|
|
2771
2829
|
}
|
|
2772
2830
|
return i;
|
|
2773
2831
|
}
|
|
2774
2832
|
function Ze(i, e) {
|
|
2775
|
-
const t =
|
|
2833
|
+
const t = Ti(e, i);
|
|
2776
2834
|
if (t.height === 0 || t.width === 0)
|
|
2777
2835
|
return [i];
|
|
2778
2836
|
const r = [];
|
|
@@ -2822,7 +2880,7 @@ function Ze(i, e) {
|
|
|
2822
2880
|
}
|
|
2823
2881
|
return r;
|
|
2824
2882
|
}
|
|
2825
|
-
function
|
|
2883
|
+
function Ti(i, e) {
|
|
2826
2884
|
const t = Math.max(i.left, e.left), r = Math.min(i.right, e.right), s = Math.max(i.top, e.top), n = Math.min(i.bottom, e.bottom);
|
|
2827
2885
|
return {
|
|
2828
2886
|
bottom: n,
|
|
@@ -2833,21 +2891,21 @@ function wi(i, e) {
|
|
|
2833
2891
|
width: Math.max(0, r - t)
|
|
2834
2892
|
};
|
|
2835
2893
|
}
|
|
2836
|
-
function
|
|
2894
|
+
function Pt(i, e, t) {
|
|
2837
2895
|
return (i.left < e.right || t >= 0 && A(i.left, e.right, t)) && (e.left < i.right || t >= 0 && A(e.left, i.right, t)) && (i.top < e.bottom || t >= 0 && A(i.top, e.bottom, t)) && (e.top < i.bottom || t >= 0 && A(e.top, i.bottom, t));
|
|
2838
2896
|
}
|
|
2839
2897
|
function A(i, e, t) {
|
|
2840
2898
|
return Math.abs(i - e) <= t;
|
|
2841
2899
|
}
|
|
2842
|
-
const
|
|
2843
|
-
class
|
|
2900
|
+
const Si = window.ResizeObserver || nt, Ci = "Highlight" in window, Je = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2901
|
+
class Oi {
|
|
2844
2902
|
/**
|
|
2845
2903
|
* Creates a DecorationGroup object
|
|
2846
2904
|
* @param id Unique HTML ID-adhering name of the group
|
|
2847
2905
|
* @param name Human-readable name of the group
|
|
2848
2906
|
*/
|
|
2849
2907
|
constructor(e, t, r, s) {
|
|
2850
|
-
this.wnd = e, this.comms = t, this.id = r, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0,
|
|
2908
|
+
this.wnd = e, this.comms = t, this.id = r, this.name = s, this.items = [], this.lastItemId = 0, this.container = void 0, this.activateable = !1, this.experimentalHighlights = !1, this.currentRender = 0, Ci && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2851
2909
|
}
|
|
2852
2910
|
get activeable() {
|
|
2853
2911
|
return this.activateable;
|
|
@@ -2861,13 +2919,13 @@ class Ci {
|
|
|
2861
2919
|
*/
|
|
2862
2920
|
add(e) {
|
|
2863
2921
|
var o, a, h, c;
|
|
2864
|
-
const t = `${this.id}-${this.lastItemId++}`, r =
|
|
2922
|
+
const t = `${this.id}-${this.lastItemId++}`, r = Pe(this.wnd.document, e.locator);
|
|
2865
2923
|
if (!r) {
|
|
2866
2924
|
this.comms.log("Can't locate DOM range for decoration", e);
|
|
2867
2925
|
return;
|
|
2868
2926
|
}
|
|
2869
2927
|
const s = r.commonAncestorContainer;
|
|
2870
|
-
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (
|
|
2928
|
+
s.nodeType !== Node.TEXT_NODE && this.experimentalHighlights && (Je.includes(s.nodeName.toUpperCase()) && ((o = this.notTextFlag) == null || o.set(t, !0)), s.querySelector(Je.join(", ").toLowerCase()) && ((a = this.notTextFlag) == null || a.set(t, !0)), (((h = s.textContent) == null ? void 0 : h.trim()) || "").length === 0 && ((c = this.notTextFlag) == null || c.set(t, !0)));
|
|
2871
2929
|
const n = {
|
|
2872
2930
|
decoration: e,
|
|
2873
2931
|
id: t,
|
|
@@ -2935,15 +2993,15 @@ class Ci {
|
|
|
2935
2993
|
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2936
2994
|
"column-count"
|
|
2937
2995
|
)
|
|
2938
|
-
), n = r / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, h = o.scrollTop, c = (m, E,
|
|
2939
|
-
var Y, Z, B,
|
|
2996
|
+
), n = r / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, h = o.scrollTop, c = (m, E, P) => {
|
|
2997
|
+
var Y, Z, D, B, J, K;
|
|
2940
2998
|
if (m.style.position = "absolute", ((Z = (Y = e.decoration) == null ? void 0 : Y.style) == null ? void 0 : Z.width) === "viewport") {
|
|
2941
2999
|
m.style.width = `${r}px`, m.style.height = `${E.height}px`;
|
|
2942
3000
|
let U = Math.floor(E.left / r) * r;
|
|
2943
3001
|
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
2944
|
-
} else if (((
|
|
2945
|
-
m.style.width = `${
|
|
2946
|
-
else if (((
|
|
3002
|
+
} else if (((B = (D = e.decoration) == null ? void 0 : D.style) == null ? void 0 : B.width) === "bounds")
|
|
3003
|
+
m.style.width = `${P.width}px`, m.style.height = `${E.height}px`, m.style.left = `${P.left + a}px`, m.style.top = `${E.top + h}px`;
|
|
3004
|
+
else if (((K = (J = e.decoration) == null ? void 0 : J.style) == null ? void 0 : K.width) === "page") {
|
|
2947
3005
|
m.style.width = `${n}px`, m.style.height = `${E.height}px`;
|
|
2948
3006
|
let U = Math.floor(E.left / n) * n;
|
|
2949
3007
|
m.style.left = `${U + a}px`, m.style.top = `${E.top + h}px`;
|
|
@@ -2951,7 +3009,7 @@ class Ci {
|
|
|
2951
3009
|
m.style.width = `${E.width}px`, m.style.height = `${E.height}px`, m.style.left = `${E.left + a}px`, m.style.top = `${E.top + h}px`;
|
|
2952
3010
|
}, d = e.range.getBoundingClientRect();
|
|
2953
3011
|
let p = this.wnd.document.createElement("template");
|
|
2954
|
-
const u =
|
|
3012
|
+
const u = gi(this.wnd, "--USER__appearance") === "readium-night-on";
|
|
2955
3013
|
p.innerHTML = `
|
|
2956
3014
|
<div
|
|
2957
3015
|
class="r2-highlight-0"
|
|
@@ -2970,15 +3028,15 @@ class Ci {
|
|
|
2970
3028
|
const m = f.cloneNode(!0);
|
|
2971
3029
|
m.style.setProperty("pointer-events", "none"), c(m, d, d), t.append(m);
|
|
2972
3030
|
} else {
|
|
2973
|
-
let m =
|
|
3031
|
+
let m = bi(
|
|
2974
3032
|
e.range,
|
|
2975
3033
|
!0
|
|
2976
3034
|
// doNotMergeHorizontallyAlignedRects
|
|
2977
3035
|
);
|
|
2978
|
-
m = m.sort((E,
|
|
3036
|
+
m = m.sort((E, P) => E.top < P.top ? -1 : E.top > P.top ? 1 : 0);
|
|
2979
3037
|
for (let E of m) {
|
|
2980
|
-
const
|
|
2981
|
-
|
|
3038
|
+
const P = f.cloneNode(!0);
|
|
3039
|
+
P.style.setProperty("pointer-events", "none"), c(P, E, d), t.append(P);
|
|
2982
3040
|
}
|
|
2983
3041
|
}
|
|
2984
3042
|
e.container = t, e.clickableElements = Array.from(
|
|
@@ -3032,7 +3090,7 @@ const At = class be extends ce {
|
|
|
3032
3090
|
mount(e, t) {
|
|
3033
3091
|
return this.wnd = e, t.register("decorate", be.moduleName, (r, s) => {
|
|
3034
3092
|
const n = r;
|
|
3035
|
-
n.decoration && n.decoration.locator && (n.decoration.locator = I.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new
|
|
3093
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = I.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new Oi(
|
|
3036
3094
|
e,
|
|
3037
3095
|
t,
|
|
3038
3096
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -3054,7 +3112,7 @@ const At = class be extends ce {
|
|
|
3054
3112
|
break;
|
|
3055
3113
|
}
|
|
3056
3114
|
s(!0);
|
|
3057
|
-
}), this.resizeObserver = new
|
|
3115
|
+
}), this.resizeObserver = new Si(() => 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;
|
|
3058
3116
|
}
|
|
3059
3117
|
unmount(e, t) {
|
|
3060
3118
|
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(be.moduleName), this.resizeObserver.disconnect(), this.cleanup(), t.log("Decorator Unmounted"), !0;
|
|
@@ -3062,32 +3120,32 @@ const At = class be extends ce {
|
|
|
3062
3120
|
};
|
|
3063
3121
|
At.moduleName = "decorator";
|
|
3064
3122
|
let Pi = At;
|
|
3065
|
-
const
|
|
3123
|
+
const Ai = [
|
|
3066
3124
|
"fixed_setup",
|
|
3067
3125
|
"decorator",
|
|
3068
3126
|
"peripherals"
|
|
3069
|
-
],
|
|
3127
|
+
], Mi = [
|
|
3070
3128
|
"reflowable_setup",
|
|
3071
3129
|
"decorator",
|
|
3072
3130
|
"peripherals",
|
|
3073
3131
|
"column_snapper",
|
|
3074
3132
|
"scroll_snapper"
|
|
3075
|
-
],
|
|
3133
|
+
], Ke = new Map([
|
|
3076
3134
|
// All modules go here
|
|
3135
|
+
yi,
|
|
3077
3136
|
vi,
|
|
3078
|
-
gi,
|
|
3079
3137
|
bt,
|
|
3080
3138
|
Pi,
|
|
3081
|
-
|
|
3082
|
-
|
|
3139
|
+
di,
|
|
3140
|
+
mi
|
|
3083
3141
|
].map((i) => [i.moduleName, i]));
|
|
3084
|
-
class
|
|
3142
|
+
class Ri {
|
|
3085
3143
|
/**
|
|
3086
3144
|
* @param wnd Window instance to operate on
|
|
3087
3145
|
* @param initialModules List of initial modules to load
|
|
3088
3146
|
*/
|
|
3089
3147
|
constructor(e = window, t = []) {
|
|
3090
|
-
this.loadedModules = [], this.wnd = e, this.comms = new
|
|
3148
|
+
this.loadedModules = [], this.wnd = e, this.comms = new Nt(e);
|
|
3091
3149
|
const r = [...new Set(t)];
|
|
3092
3150
|
if (r.length) {
|
|
3093
3151
|
if (typeof e > "u")
|
|
@@ -3100,7 +3158,7 @@ class Mi {
|
|
|
3100
3158
|
}
|
|
3101
3159
|
}
|
|
3102
3160
|
loadModule(e) {
|
|
3103
|
-
const t =
|
|
3161
|
+
const t = Ke.get(e);
|
|
3104
3162
|
return t === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), t) : new t();
|
|
3105
3163
|
}
|
|
3106
3164
|
/**
|
|
@@ -3118,7 +3176,7 @@ class Mi {
|
|
|
3118
3176
|
* @returns Success
|
|
3119
3177
|
*/
|
|
3120
3178
|
removeModule(e) {
|
|
3121
|
-
const t =
|
|
3179
|
+
const t = Ke.get(e);
|
|
3122
3180
|
if (t === void 0)
|
|
3123
3181
|
return this.comms.log(`Module "${e}" does not exist in the library`), !1;
|
|
3124
3182
|
const r = this.loadedModules.findIndex((s) => s instanceof t);
|
|
@@ -3132,13 +3190,13 @@ class Mi {
|
|
|
3132
3190
|
}
|
|
3133
3191
|
}
|
|
3134
3192
|
export {
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3193
|
+
_ as COMMS_VERSION,
|
|
3194
|
+
Nt as Comms,
|
|
3195
|
+
Ai as FXLModules,
|
|
3196
|
+
Ri as Loader,
|
|
3139
3197
|
ce as Module,
|
|
3140
|
-
|
|
3198
|
+
Ke as ModuleLibrary,
|
|
3141
3199
|
bt as Peripherals,
|
|
3142
|
-
|
|
3143
|
-
|
|
3200
|
+
Mi as ReflowableModules,
|
|
3201
|
+
Rt as mid
|
|
3144
3202
|
};
|