@readium/navigator-html-injectables 1.3.3 → 2.0.0-beta.2
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 +980 -1211
- package/dist/index.umd.cjs +9 -9
- package/package.json +7 -8
- package/src/comms/keys.ts +2 -0
- package/src/helpers/color.ts +114 -0
- package/src/helpers/css.ts +37 -0
- package/src/helpers/document.ts +61 -23
- package/src/modules/Decorator.ts +3 -5
- package/src/modules/setup/ReflowableSetup.ts +12 -1
- package/src/modules/snapper/ColumnSnapper.ts +35 -9
- package/src/modules/snapper/ScrollSnapper.ts +24 -17
- package/types/src/comms/keys.d.ts +1 -1
- package/types/src/helpers/color.d.ts +16 -0
- package/types/src/helpers/css.d.ts +6 -0
- package/types/src/helpers/document.d.ts +12 -3
- package/types/src/modules/snapper/ScrollSnapper.d.ts +3 -3
- package/src/helpers/scrollSnapperHelper.ts +0 -43
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
class
|
|
1
|
+
const nt = Math.pow(2, 32), ge = () => Math.round(Math.random() * nt).toString(36), ot = () => `${Math.round(performance.now())}-${ge()}-${ge()}`, k = 1;
|
|
2
|
+
class at {
|
|
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,11 +12,11 @@ class zt {
|
|
|
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 !== k) {
|
|
16
|
+
t._readium > k ? this.send("error", `received comms version ${t._readium} higher than ${k}`) : this.send("error", `received comms version ${t._readium} lower than ${k}`), this.destination = null, this.origin = "", this.channelId = "";
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
this.send("_pong", void 0), this.preLog.forEach((
|
|
19
|
+
this.send("_pong", void 0), this.preLog.forEach((i) => this.send("log", i)), this.preLog = [];
|
|
20
20
|
}
|
|
21
21
|
return;
|
|
22
22
|
} else if (this.channelId) {
|
|
@@ -33,35 +33,35 @@ class zt {
|
|
|
33
33
|
e.strict && this.send("_unhandled", e);
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
t.forEach((
|
|
37
|
-
this.send("_ack",
|
|
36
|
+
t.forEach((i) => i.cb(e.data, (s) => {
|
|
37
|
+
this.send("_ack", s, e.id);
|
|
38
38
|
}));
|
|
39
39
|
}
|
|
40
|
-
register(e, t,
|
|
41
|
-
Array.isArray(e) || (e = [e]), e.forEach((
|
|
42
|
-
const
|
|
43
|
-
if (
|
|
44
|
-
if (
|
|
45
|
-
throw new Error(`Trying to register another callback for combination of event ${
|
|
46
|
-
|
|
47
|
-
cb:
|
|
40
|
+
register(e, t, i) {
|
|
41
|
+
Array.isArray(e) || (e = [e]), e.forEach((s) => {
|
|
42
|
+
const n = this.registrar.get(s);
|
|
43
|
+
if (n && n.length >= 0) {
|
|
44
|
+
if (n.find((a) => a.module === t))
|
|
45
|
+
throw new Error(`Trying to register another callback for combination of event ${s} and module ${t}`);
|
|
46
|
+
n.push({
|
|
47
|
+
cb: i,
|
|
48
48
|
module: t
|
|
49
|
-
}), this.registrar.set(
|
|
49
|
+
}), this.registrar.set(s, n);
|
|
50
50
|
} else
|
|
51
|
-
this.registrar.set(
|
|
52
|
-
cb:
|
|
51
|
+
this.registrar.set(s, [{
|
|
52
|
+
cb: i,
|
|
53
53
|
module: t
|
|
54
54
|
}]);
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
unregister(e, t) {
|
|
58
|
-
Array.isArray(e) || (e = [e]), e.forEach((
|
|
59
|
-
const
|
|
60
|
-
!
|
|
58
|
+
Array.isArray(e) || (e = [e]), e.forEach((i) => {
|
|
59
|
+
const s = this.registrar.get(i);
|
|
60
|
+
!s || s.length === 0 || s.splice(s.findIndex((n) => n.module === t), 1);
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
unregisterAll(e) {
|
|
64
|
-
this.registrar.forEach((t,
|
|
64
|
+
this.registrar.forEach((t, i) => this.registrar.set(i, t.filter((s) => s.module !== e)));
|
|
65
65
|
}
|
|
66
66
|
log(...e) {
|
|
67
67
|
this.destination ? this.send("log", e) : this.preLog.push(e);
|
|
@@ -72,30 +72,30 @@ class zt {
|
|
|
72
72
|
destroy() {
|
|
73
73
|
this.destination = null, this.channelId = "", this.preLog = [], this.registrar.clear(), this.wnd.removeEventListener("message", this.receiver);
|
|
74
74
|
}
|
|
75
|
-
send(e, t,
|
|
75
|
+
send(e, t, i = void 0, s = []) {
|
|
76
76
|
if (!this.destination)
|
|
77
77
|
throw Error("Attempted to send comms message before destination has been initialized");
|
|
78
|
-
const
|
|
79
|
-
_readium:
|
|
78
|
+
const n = {
|
|
79
|
+
_readium: k,
|
|
80
80
|
_channel: this.channelId,
|
|
81
|
-
id:
|
|
81
|
+
id: i ?? ot(),
|
|
82
82
|
// scrict,
|
|
83
83
|
key: e,
|
|
84
84
|
data: t
|
|
85
85
|
};
|
|
86
86
|
try {
|
|
87
|
-
this.destination.postMessage(
|
|
87
|
+
this.destination.postMessage(n, {
|
|
88
88
|
targetOrigin: this.origin,
|
|
89
|
-
transfer:
|
|
89
|
+
transfer: s
|
|
90
90
|
});
|
|
91
91
|
} catch (o) {
|
|
92
|
-
if (
|
|
92
|
+
if (s.length > 0)
|
|
93
93
|
throw o;
|
|
94
|
-
this.destination.postMessage(
|
|
94
|
+
this.destination.postMessage(n, this.origin, s);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class ie {
|
|
99
99
|
/**
|
|
100
100
|
* Creates a [Encryption].
|
|
101
101
|
*/
|
|
@@ -107,7 +107,7 @@ class we {
|
|
|
107
107
|
*/
|
|
108
108
|
static deserialize(e) {
|
|
109
109
|
if (e && e.algorithm)
|
|
110
|
-
return new
|
|
110
|
+
return new ie({
|
|
111
111
|
algorithm: e.algorithm,
|
|
112
112
|
compression: e.compression,
|
|
113
113
|
originalLength: e.originalLength,
|
|
@@ -123,7 +123,7 @@ class we {
|
|
|
123
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;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
class
|
|
126
|
+
class E {
|
|
127
127
|
constructor(e) {
|
|
128
128
|
this.otherProperties = e;
|
|
129
129
|
}
|
|
@@ -132,7 +132,7 @@ class b {
|
|
|
132
132
|
*/
|
|
133
133
|
static deserialize(e) {
|
|
134
134
|
if (e)
|
|
135
|
-
return new
|
|
135
|
+
return new E(e);
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
138
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -145,49 +145,49 @@ class b {
|
|
|
145
145
|
*/
|
|
146
146
|
add(e) {
|
|
147
147
|
const t = Object.assign({}, this.otherProperties);
|
|
148
|
-
for (const
|
|
149
|
-
t[
|
|
150
|
-
return new
|
|
148
|
+
for (const i in e)
|
|
149
|
+
t[i] = e[i];
|
|
150
|
+
return new E(t);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
Object.defineProperty(
|
|
153
|
+
Object.defineProperty(E.prototype, "encryption", {
|
|
154
154
|
get: function() {
|
|
155
|
-
return
|
|
155
|
+
return ie.deserialize(this.otherProperties.encrypted);
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
E.prototype.getContains = function() {
|
|
159
159
|
return new Set(this.otherProperties.contains || []);
|
|
160
160
|
};
|
|
161
|
-
|
|
161
|
+
E.prototype.getLayout = function() {
|
|
162
162
|
return this.otherProperties.layout;
|
|
163
163
|
};
|
|
164
164
|
class l {
|
|
165
165
|
/** Creates a MediaType object. */
|
|
166
166
|
constructor(e) {
|
|
167
|
-
let t,
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
170
|
-
if (t =
|
|
167
|
+
let t, i, s = e.mediaType.replace(/\s/g, "").split(";");
|
|
168
|
+
const n = s[0].split("/");
|
|
169
|
+
if (n.length === 2) {
|
|
170
|
+
if (t = n[0].toLowerCase().trim(), i = n[1].toLowerCase().trim(), t.length === 0 || i.length === 0)
|
|
171
171
|
throw new Error("Invalid media type");
|
|
172
172
|
} else
|
|
173
173
|
throw new Error("Invalid media type");
|
|
174
174
|
const o = {};
|
|
175
|
-
for (let d = 1; d <
|
|
176
|
-
const f =
|
|
175
|
+
for (let d = 1; d < s.length; d++) {
|
|
176
|
+
const f = s[d].split("=");
|
|
177
177
|
if (f.length === 2) {
|
|
178
|
-
const
|
|
179
|
-
o[
|
|
178
|
+
const g = f[0].toLocaleLowerCase(), m = g === "charset" ? f[1].toUpperCase() : f[1];
|
|
179
|
+
o[g] = m;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
const a = {},
|
|
183
|
-
|
|
184
|
-
let
|
|
182
|
+
const a = {}, c = Object.keys(o);
|
|
183
|
+
c.sort((d, f) => d.localeCompare(f)), c.forEach((d) => a[d] = o[d]);
|
|
184
|
+
let h = "";
|
|
185
185
|
for (const d in a) {
|
|
186
186
|
const f = a[d];
|
|
187
|
-
|
|
187
|
+
h += `;${d}=${f}`;
|
|
188
188
|
}
|
|
189
|
-
const u = `${t}/${
|
|
190
|
-
this.string = u, this.type = t, this.subtype =
|
|
189
|
+
const u = `${t}/${i}${h}`, p = a.encoding;
|
|
190
|
+
this.string = u, this.type = t, this.subtype = i, this.parameters = a, this.encoding = p, this.name = e.name, this.fileExtension = e.fileExtension;
|
|
191
191
|
}
|
|
192
192
|
static parse(e) {
|
|
193
193
|
return new l(e);
|
|
@@ -223,13 +223,13 @@ class l {
|
|
|
223
223
|
const t = typeof e == "string" ? l.parse({ mediaType: e }) : e;
|
|
224
224
|
if (!((this.type === "*" || this.type === t.type) && (this.subtype === "*" || this.subtype === t.subtype)))
|
|
225
225
|
return !1;
|
|
226
|
-
const
|
|
227
|
-
Object.entries(this.parameters).map(([
|
|
228
|
-
),
|
|
229
|
-
Object.entries(t.parameters).map(([
|
|
226
|
+
const i = new Set(
|
|
227
|
+
Object.entries(this.parameters).map(([n, o]) => `${n}=${o}`)
|
|
228
|
+
), s = new Set(
|
|
229
|
+
Object.entries(t.parameters).map(([n, o]) => `${n}=${o}`)
|
|
230
230
|
);
|
|
231
|
-
for (const
|
|
232
|
-
if (!
|
|
231
|
+
for (const n of Array.from(i.values()))
|
|
232
|
+
if (!s.has(n))
|
|
233
233
|
return !1;
|
|
234
234
|
return !0;
|
|
235
235
|
}
|
|
@@ -616,7 +616,7 @@ class l {
|
|
|
616
616
|
});
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
class
|
|
619
|
+
class ye {
|
|
620
620
|
constructor(e) {
|
|
621
621
|
this.uri = e, this.parameters = this.getParameters(e);
|
|
622
622
|
}
|
|
@@ -624,9 +624,9 @@ class Re {
|
|
|
624
624
|
* List of URI template parameter keys, if the [Link] is templated.
|
|
625
625
|
*/
|
|
626
626
|
getParameters(e) {
|
|
627
|
-
const t = /\{\??([^}]+)\}/g,
|
|
628
|
-
return
|
|
629
|
-
|
|
627
|
+
const t = /\{\??([^}]+)\}/g, i = e.match(t);
|
|
628
|
+
return i ? new Set(
|
|
629
|
+
i.join(",").replace(t, "$1").split(",").map((s) => s.trim())
|
|
630
630
|
) : /* @__PURE__ */ new Set();
|
|
631
631
|
}
|
|
632
632
|
/** Expands the URI by replacing the template variables by the given parameters.
|
|
@@ -634,36 +634,36 @@ class Re {
|
|
|
634
634
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
635
635
|
*/
|
|
636
636
|
expand(e) {
|
|
637
|
-
const t = (
|
|
638
|
-
const o = e[
|
|
637
|
+
const t = (s) => s.split(",").map((n) => {
|
|
638
|
+
const o = e[n];
|
|
639
639
|
return o ? encodeURIComponent(o) : "";
|
|
640
|
-
}).join(","),
|
|
641
|
-
const o =
|
|
640
|
+
}).join(","), i = (s) => "?" + s.split(",").map((n) => {
|
|
641
|
+
const o = n.split("=")[0], a = e[o];
|
|
642
642
|
return a ? `${o}=${encodeURIComponent(a)}` : "";
|
|
643
643
|
}).join("&");
|
|
644
|
-
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...
|
|
644
|
+
return this.uri.replace(/\{(\??)([^}]+)\}/g, (...s) => s[1] ? i(s[2]) : t(s[2]));
|
|
645
645
|
}
|
|
646
646
|
}
|
|
647
|
-
function
|
|
648
|
-
return
|
|
647
|
+
function lt(r) {
|
|
648
|
+
return r && r instanceof Array ? r : void 0;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
651
|
-
return
|
|
650
|
+
function We(r) {
|
|
651
|
+
return r && typeof r == "string" ? [r] : lt(r);
|
|
652
652
|
}
|
|
653
|
-
function
|
|
654
|
-
return typeof
|
|
653
|
+
function ve(r) {
|
|
654
|
+
return typeof r == "string" ? new Date(r) : void 0;
|
|
655
655
|
}
|
|
656
|
-
function
|
|
657
|
-
return isNaN(
|
|
656
|
+
function j(r) {
|
|
657
|
+
return isNaN(r) ? void 0 : r;
|
|
658
658
|
}
|
|
659
|
-
function
|
|
660
|
-
return
|
|
659
|
+
function C(r) {
|
|
660
|
+
return j(r) !== void 0 && Math.sign(r) >= 0 ? r : void 0;
|
|
661
661
|
}
|
|
662
|
-
function
|
|
662
|
+
function ht(r) {
|
|
663
663
|
const e = new Array();
|
|
664
|
-
return
|
|
664
|
+
return r.forEach((t) => e.push(t)), e;
|
|
665
665
|
}
|
|
666
|
-
class
|
|
666
|
+
class x {
|
|
667
667
|
/**
|
|
668
668
|
* Creates a [Locations].
|
|
669
669
|
*/
|
|
@@ -676,21 +676,21 @@ class w {
|
|
|
676
676
|
static deserialize(e) {
|
|
677
677
|
if (!e)
|
|
678
678
|
return;
|
|
679
|
-
const t =
|
|
679
|
+
const t = j(e.progression), i = j(e.totalProgression), s = j(e.position), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set([
|
|
680
680
|
"fragment",
|
|
681
681
|
"fragments",
|
|
682
682
|
"progression",
|
|
683
683
|
"totalProgression",
|
|
684
684
|
"position"
|
|
685
685
|
]);
|
|
686
|
-
return Object.entries(e).forEach(([a,
|
|
687
|
-
o.has(a) ||
|
|
688
|
-
}), new
|
|
689
|
-
fragments:
|
|
686
|
+
return Object.entries(e).forEach(([a, c]) => {
|
|
687
|
+
o.has(a) || n.set(a, c);
|
|
688
|
+
}), new x({
|
|
689
|
+
fragments: We(e.fragments || e.fragment),
|
|
690
690
|
progression: t !== void 0 && t >= 0 && t <= 1 ? t : void 0,
|
|
691
|
-
totalProgression:
|
|
692
|
-
position:
|
|
693
|
-
otherLocations:
|
|
691
|
+
totalProgression: i !== void 0 && i >= 0 && i <= 1 ? i : void 0,
|
|
692
|
+
position: s !== void 0 && s > 0 ? s : void 0,
|
|
693
|
+
otherLocations: n.size === 0 ? void 0 : n
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
/**
|
|
@@ -698,10 +698,10 @@ class w {
|
|
|
698
698
|
*/
|
|
699
699
|
serialize() {
|
|
700
700
|
const e = {};
|
|
701
|
-
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,
|
|
701
|
+
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
702
|
}
|
|
703
703
|
}
|
|
704
|
-
class
|
|
704
|
+
class U {
|
|
705
705
|
/**
|
|
706
706
|
* Creates a [Text].
|
|
707
707
|
*/
|
|
@@ -713,7 +713,7 @@ class _ {
|
|
|
713
713
|
*/
|
|
714
714
|
static deserialize(e) {
|
|
715
715
|
if (e)
|
|
716
|
-
return new
|
|
716
|
+
return new U({
|
|
717
717
|
after: e.after,
|
|
718
718
|
before: e.before,
|
|
719
719
|
highlight: e.highlight
|
|
@@ -727,24 +727,24 @@ class _ {
|
|
|
727
727
|
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
728
|
}
|
|
729
729
|
}
|
|
730
|
-
class
|
|
730
|
+
class D {
|
|
731
731
|
/**
|
|
732
732
|
* Creates a [Locator].
|
|
733
733
|
*/
|
|
734
734
|
constructor(e) {
|
|
735
|
-
this.href = e.href, this.type = e.type, this.title = e.title, this.locations = e.locations ? e.locations : new
|
|
735
|
+
this.href = e.href, this.type = e.type, this.title = e.title, this.locations = e.locations ? e.locations : new x({}), this.text = e.text;
|
|
736
736
|
}
|
|
737
737
|
/**
|
|
738
738
|
* Parses a [Link] from its RWPM JSON representation.
|
|
739
739
|
*/
|
|
740
740
|
static deserialize(e) {
|
|
741
741
|
if (e && e.href && e.type)
|
|
742
|
-
return new
|
|
742
|
+
return new D({
|
|
743
743
|
href: e.href,
|
|
744
744
|
type: e.type,
|
|
745
745
|
title: e.title,
|
|
746
|
-
locations:
|
|
747
|
-
text:
|
|
746
|
+
locations: x.deserialize(e.locations),
|
|
747
|
+
text: U.deserialize(e.text)
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
/**
|
|
@@ -758,16 +758,16 @@ class B {
|
|
|
758
758
|
* Shortcut to get a copy of the [Locator] with different [Locations] sub-properties.
|
|
759
759
|
*/
|
|
760
760
|
copyWithLocations(e) {
|
|
761
|
-
return new
|
|
761
|
+
return new D({
|
|
762
762
|
href: this.href,
|
|
763
763
|
type: this.type,
|
|
764
764
|
title: this.title,
|
|
765
765
|
text: this.text,
|
|
766
|
-
locations: new
|
|
766
|
+
locations: new x({ ...this.locations, ...e })
|
|
767
767
|
});
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
|
-
class
|
|
770
|
+
class B {
|
|
771
771
|
/**
|
|
772
772
|
* Creates a [Link].
|
|
773
773
|
*/
|
|
@@ -779,20 +779,20 @@ class V {
|
|
|
779
779
|
*/
|
|
780
780
|
static deserialize(e) {
|
|
781
781
|
if (e && e.href && typeof e.href == "string")
|
|
782
|
-
return new
|
|
782
|
+
return new B({
|
|
783
783
|
href: e.href,
|
|
784
784
|
templated: e.templated,
|
|
785
785
|
type: e.type,
|
|
786
786
|
title: e.title,
|
|
787
787
|
rels: e.rel ? e.rel instanceof Array ? new Set(e.rel) : /* @__PURE__ */ new Set([e.rel]) : void 0,
|
|
788
|
-
properties:
|
|
789
|
-
height:
|
|
790
|
-
width:
|
|
791
|
-
duration:
|
|
792
|
-
bitrate:
|
|
793
|
-
languages:
|
|
794
|
-
alternates:
|
|
795
|
-
children:
|
|
788
|
+
properties: E.deserialize(e.properties),
|
|
789
|
+
height: C(e.height),
|
|
790
|
+
width: C(e.width),
|
|
791
|
+
duration: C(e.duration),
|
|
792
|
+
bitrate: C(e.bitrate),
|
|
793
|
+
languages: We(e.language),
|
|
794
|
+
alternates: V.deserialize(e.alternate),
|
|
795
|
+
children: V.deserialize(e.children)
|
|
796
796
|
});
|
|
797
797
|
}
|
|
798
798
|
/**
|
|
@@ -800,7 +800,7 @@ class V {
|
|
|
800
800
|
*/
|
|
801
801
|
serialize() {
|
|
802
802
|
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 =
|
|
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 = ht(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
804
|
}
|
|
805
805
|
/** MediaType of the linked resource. */
|
|
806
806
|
get mediaType() {
|
|
@@ -813,19 +813,19 @@ class V {
|
|
|
813
813
|
const t = this.href.replace(/^(\/)/, "");
|
|
814
814
|
if (t.length === 0)
|
|
815
815
|
return;
|
|
816
|
-
let
|
|
817
|
-
return
|
|
816
|
+
let i = e || "/";
|
|
817
|
+
return i.startsWith("/") && (i = "file://" + i), new URL(t, i).href.replace(/^(file:\/\/)/, "");
|
|
818
818
|
}
|
|
819
819
|
/** List of URI template parameter keys, if the `Link` is templated. */
|
|
820
820
|
get templateParameters() {
|
|
821
|
-
return this.templated ? new
|
|
821
|
+
return this.templated ? new ye(this.href).parameters : /* @__PURE__ */ new Set();
|
|
822
822
|
}
|
|
823
823
|
/** Expands the `Link`'s HREF by replacing URI template variables by the given parameters.
|
|
824
824
|
* See RFC 6570 on URI template: https://tools.ietf.org/html/rfc6570
|
|
825
825
|
*/
|
|
826
826
|
expandTemplate(e) {
|
|
827
|
-
return new
|
|
828
|
-
href: new
|
|
827
|
+
return new B({
|
|
828
|
+
href: new ye(this.href).expand(e),
|
|
829
829
|
templated: !1
|
|
830
830
|
});
|
|
831
831
|
}
|
|
@@ -834,25 +834,25 @@ class V {
|
|
|
834
834
|
*/
|
|
835
835
|
addProperties(e) {
|
|
836
836
|
var t;
|
|
837
|
-
const
|
|
838
|
-
return
|
|
837
|
+
const i = B.deserialize(this.serialize());
|
|
838
|
+
return i.properties = i.properties ? (t = i.properties) == null ? void 0 : t.add(e) : new E(e), i;
|
|
839
839
|
}
|
|
840
840
|
/**
|
|
841
841
|
* Creates a [Locator] from a reading order [Link].
|
|
842
842
|
*/
|
|
843
843
|
get locator() {
|
|
844
844
|
let e = this.href.split("#");
|
|
845
|
-
return new
|
|
845
|
+
return new D({
|
|
846
846
|
href: e.length > 0 && e[0] !== void 0 ? e[0] : this.href,
|
|
847
847
|
type: this.type ?? "",
|
|
848
848
|
title: this.title,
|
|
849
|
-
locations: new
|
|
849
|
+
locations: new x({
|
|
850
850
|
fragments: e.length > 1 && e[1] !== void 0 ? [e[1]] : []
|
|
851
851
|
})
|
|
852
852
|
});
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
class
|
|
855
|
+
class V {
|
|
856
856
|
/**
|
|
857
857
|
* Creates a [Links].
|
|
858
858
|
*/
|
|
@@ -864,8 +864,8 @@ class ae {
|
|
|
864
864
|
*/
|
|
865
865
|
static deserialize(e) {
|
|
866
866
|
if (e && e instanceof Array)
|
|
867
|
-
return new
|
|
868
|
-
e.map((t) =>
|
|
867
|
+
return new V(
|
|
868
|
+
e.map((t) => B.deserialize(t)).filter((t) => t !== void 0)
|
|
869
869
|
);
|
|
870
870
|
}
|
|
871
871
|
/**
|
|
@@ -876,39 +876,39 @@ class ae {
|
|
|
876
876
|
}
|
|
877
877
|
/** Finds the first link with the given relation. */
|
|
878
878
|
findWithRel(e) {
|
|
879
|
-
const t = (
|
|
879
|
+
const t = (i) => i.rels && i.rels.has(e);
|
|
880
880
|
return this.items.find(t);
|
|
881
881
|
}
|
|
882
882
|
/** Finds all the links with the given relation. */
|
|
883
883
|
filterByRel(e) {
|
|
884
|
-
const t = (
|
|
884
|
+
const t = (i) => i.rels && i.rels.has(e);
|
|
885
885
|
return this.items.filter(t);
|
|
886
886
|
}
|
|
887
887
|
/** Finds the first link matching the given HREF. */
|
|
888
888
|
findWithHref(e) {
|
|
889
|
-
const t = (
|
|
889
|
+
const t = (i) => i.href === e;
|
|
890
890
|
return this.items.find(t);
|
|
891
891
|
}
|
|
892
892
|
/** Finds the index of the first link matching the given HREF. */
|
|
893
893
|
findIndexWithHref(e) {
|
|
894
|
-
const t = (
|
|
894
|
+
const t = (i) => i.href === e;
|
|
895
895
|
return this.items.findIndex(t);
|
|
896
896
|
}
|
|
897
897
|
/** Finds the first link matching the given media type. */
|
|
898
898
|
findWithMediaType(e) {
|
|
899
|
-
const t = (
|
|
899
|
+
const t = (i) => i.mediaType.matches(e);
|
|
900
900
|
return this.items.find(t);
|
|
901
901
|
}
|
|
902
902
|
/** Finds all the links matching the given media type. */
|
|
903
903
|
filterByMediaType(e) {
|
|
904
|
-
const t = (
|
|
904
|
+
const t = (i) => i.mediaType.matches(e);
|
|
905
905
|
return this.items.filter(t);
|
|
906
906
|
}
|
|
907
907
|
/** Finds all the links matching any of the given media types. */
|
|
908
908
|
filterByMediaTypes(e) {
|
|
909
|
-
const t = (
|
|
910
|
-
for (const
|
|
911
|
-
if (
|
|
909
|
+
const t = (i) => {
|
|
910
|
+
for (const s of e)
|
|
911
|
+
if (i.mediaType.matches(s))
|
|
912
912
|
return !0;
|
|
913
913
|
return !1;
|
|
914
914
|
};
|
|
@@ -937,8 +937,8 @@ class ae {
|
|
|
937
937
|
/** Returns whether all the resources in the collection are matching any of the given media types. */
|
|
938
938
|
everyMatchesMediaType(e) {
|
|
939
939
|
return Array.isArray(e) ? this.items.length > 0 && this.items.every((t) => {
|
|
940
|
-
for (const
|
|
941
|
-
return t.mediaType.matches(
|
|
940
|
+
for (const i of e)
|
|
941
|
+
return t.mediaType.matches(i);
|
|
942
942
|
return !1;
|
|
943
943
|
}) : this.items.length > 0 && this.items.every((t) => t.mediaType.matches(e));
|
|
944
944
|
}
|
|
@@ -946,7 +946,7 @@ class ae {
|
|
|
946
946
|
return this.items.filter((e) => e.type);
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
class
|
|
949
|
+
class q {
|
|
950
950
|
/**
|
|
951
951
|
* Creates a [DomRange].
|
|
952
952
|
*/
|
|
@@ -959,14 +959,14 @@ class le {
|
|
|
959
959
|
static deserialize(e) {
|
|
960
960
|
if (!(e && e.cssSelector))
|
|
961
961
|
return;
|
|
962
|
-
let t =
|
|
962
|
+
let t = C(e.textNodeIndex);
|
|
963
963
|
if (t === void 0)
|
|
964
964
|
return;
|
|
965
|
-
let
|
|
966
|
-
return
|
|
965
|
+
let i = C(e.charOffset);
|
|
966
|
+
return i === void 0 && (i = C(e.offset)), new q({
|
|
967
967
|
cssSelector: e.cssSelector,
|
|
968
968
|
textNodeIndex: t,
|
|
969
|
-
charOffset:
|
|
969
|
+
charOffset: i
|
|
970
970
|
});
|
|
971
971
|
}
|
|
972
972
|
/**
|
|
@@ -980,7 +980,7 @@ class le {
|
|
|
980
980
|
return this.charOffset !== void 0 && (e.charOffset = this.charOffset), e;
|
|
981
981
|
}
|
|
982
982
|
}
|
|
983
|
-
class
|
|
983
|
+
class re {
|
|
984
984
|
/**
|
|
985
985
|
* Creates a [DomRange].
|
|
986
986
|
*/
|
|
@@ -993,11 +993,11 @@ class Te {
|
|
|
993
993
|
static deserialize(e) {
|
|
994
994
|
if (!e)
|
|
995
995
|
return;
|
|
996
|
-
let t =
|
|
996
|
+
let t = q.deserialize(e.start);
|
|
997
997
|
if (t)
|
|
998
|
-
return new
|
|
998
|
+
return new re({
|
|
999
999
|
start: t,
|
|
1000
|
-
end:
|
|
1000
|
+
end: q.deserialize(e.end)
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
1003
|
/**
|
|
@@ -1008,55 +1008,55 @@ class Te {
|
|
|
1008
1008
|
return this.end && (e.end = this.end.serialize()), e;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
|
|
1012
|
-
var
|
|
1013
|
-
return (
|
|
1011
|
+
x.prototype.getCssSelector = function() {
|
|
1012
|
+
var r;
|
|
1013
|
+
return (r = this.otherLocations) == null ? void 0 : r.get("cssSelector");
|
|
1014
1014
|
};
|
|
1015
|
-
|
|
1016
|
-
var
|
|
1017
|
-
return (
|
|
1015
|
+
x.prototype.getPartialCfi = function() {
|
|
1016
|
+
var r;
|
|
1017
|
+
return (r = this.otherLocations) == null ? void 0 : r.get("partialCfi");
|
|
1018
1018
|
};
|
|
1019
|
-
|
|
1020
|
-
var
|
|
1021
|
-
return
|
|
1019
|
+
x.prototype.getDomRange = function() {
|
|
1020
|
+
var r;
|
|
1021
|
+
return re.deserialize((r = this.otherLocations) == null ? void 0 : r.get("domRange"));
|
|
1022
1022
|
};
|
|
1023
|
-
|
|
1023
|
+
x.prototype.fragmentParameters = function() {
|
|
1024
1024
|
return new Map(
|
|
1025
|
-
this.fragments.map((
|
|
1026
|
-
|
|
1027
|
-
|
|
1025
|
+
this.fragments.map((r) => r.startsWith("#") ? r.slice(1) : r).join("&").split("&").filter((r) => !r.startsWith("#")).map((r) => r.split("=")).filter((r) => r.length === 2).map((r) => [
|
|
1026
|
+
r[0].trim().toLowerCase(),
|
|
1027
|
+
r[1].trim()
|
|
1028
1028
|
])
|
|
1029
1029
|
);
|
|
1030
1030
|
};
|
|
1031
|
-
|
|
1031
|
+
x.prototype.htmlId = function() {
|
|
1032
1032
|
if (!this.fragments.length)
|
|
1033
1033
|
return;
|
|
1034
|
-
let
|
|
1035
|
-
if (!
|
|
1034
|
+
let r = this.fragments.find((e) => e.length && !e.includes("="));
|
|
1035
|
+
if (!r) {
|
|
1036
1036
|
const e = this.fragmentParameters();
|
|
1037
|
-
e.has("id") ?
|
|
1037
|
+
e.has("id") ? r = e.get("id") : e.has("name") && (r = e.get("name"));
|
|
1038
1038
|
}
|
|
1039
|
-
return
|
|
1039
|
+
return r != null && r.startsWith("#") ? r.slice(1) : r;
|
|
1040
1040
|
};
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
if (!isNaN(
|
|
1044
|
-
return
|
|
1041
|
+
x.prototype.page = function() {
|
|
1042
|
+
const r = parseInt(this.fragmentParameters().get("page"));
|
|
1043
|
+
if (!isNaN(r) && r >= 0)
|
|
1044
|
+
return r;
|
|
1045
1045
|
};
|
|
1046
|
-
|
|
1047
|
-
const
|
|
1048
|
-
if (!isNaN(
|
|
1049
|
-
return
|
|
1046
|
+
x.prototype.time = function() {
|
|
1047
|
+
const r = parseInt(this.fragmentParameters().get("t"));
|
|
1048
|
+
if (!isNaN(r))
|
|
1049
|
+
return r;
|
|
1050
1050
|
};
|
|
1051
|
-
|
|
1052
|
-
const
|
|
1053
|
-
if (!
|
|
1051
|
+
x.prototype.space = function() {
|
|
1052
|
+
const r = this.fragmentParameters();
|
|
1053
|
+
if (!r.has("xywh"))
|
|
1054
1054
|
return;
|
|
1055
|
-
const e =
|
|
1055
|
+
const e = r.get("xywh").split(",").map((t) => parseInt(t));
|
|
1056
1056
|
if (e.length === 4 && !e.some(isNaN))
|
|
1057
1057
|
return e;
|
|
1058
1058
|
};
|
|
1059
|
-
class
|
|
1059
|
+
class se {
|
|
1060
1060
|
/** Creates a [Price]. */
|
|
1061
1061
|
constructor(e) {
|
|
1062
1062
|
this.currency = e.currency, this.value = e.value;
|
|
@@ -1070,9 +1070,9 @@ class Se {
|
|
|
1070
1070
|
let t = e.currency;
|
|
1071
1071
|
if (!(t && typeof t == "string" && t.length > 0))
|
|
1072
1072
|
return;
|
|
1073
|
-
let
|
|
1074
|
-
if (
|
|
1075
|
-
return new
|
|
1073
|
+
let i = C(e.value);
|
|
1074
|
+
if (i !== void 0)
|
|
1075
|
+
return new se({ currency: t, value: i });
|
|
1076
1076
|
}
|
|
1077
1077
|
/**
|
|
1078
1078
|
* Serializes a [Price] to its RWPM JSON representation.
|
|
@@ -1081,7 +1081,7 @@ class Se {
|
|
|
1081
1081
|
return { currency: this.currency, value: this.value };
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
|
-
class
|
|
1084
|
+
class H {
|
|
1085
1085
|
/** Creates a [Acquisition]. */
|
|
1086
1086
|
constructor(e) {
|
|
1087
1087
|
this.type = e.type, this.children = e.children;
|
|
@@ -1091,14 +1091,14 @@ class G {
|
|
|
1091
1091
|
*/
|
|
1092
1092
|
static deserialize(e) {
|
|
1093
1093
|
if (e && e.type)
|
|
1094
|
-
return new
|
|
1094
|
+
return new H({
|
|
1095
1095
|
type: e.type,
|
|
1096
|
-
children:
|
|
1096
|
+
children: H.deserializeArray(e.children)
|
|
1097
1097
|
});
|
|
1098
1098
|
}
|
|
1099
1099
|
static deserializeArray(e) {
|
|
1100
1100
|
if (e instanceof Array)
|
|
1101
|
-
return e.map((t) =>
|
|
1101
|
+
return e.map((t) => H.deserialize(t)).filter((t) => t !== void 0);
|
|
1102
1102
|
}
|
|
1103
1103
|
/**
|
|
1104
1104
|
* Serializes a [Acquisition] to its RWPM JSON representation.
|
|
@@ -1108,7 +1108,7 @@ class G {
|
|
|
1108
1108
|
return this.children && (e.children = this.children.map((t) => t.serialize())), e;
|
|
1109
1109
|
}
|
|
1110
1110
|
}
|
|
1111
|
-
class
|
|
1111
|
+
class ne {
|
|
1112
1112
|
/** Creates a [Price]. */
|
|
1113
1113
|
constructor(e) {
|
|
1114
1114
|
this.total = e.total, this.position = e.position;
|
|
@@ -1118,9 +1118,9 @@ class Ce {
|
|
|
1118
1118
|
*/
|
|
1119
1119
|
static deserialize(e) {
|
|
1120
1120
|
if (e)
|
|
1121
|
-
return new
|
|
1122
|
-
total:
|
|
1123
|
-
position:
|
|
1121
|
+
return new ne({
|
|
1122
|
+
total: C(e.total),
|
|
1123
|
+
position: C(e.position)
|
|
1124
1124
|
});
|
|
1125
1125
|
}
|
|
1126
1126
|
/**
|
|
@@ -1131,7 +1131,7 @@ class Ce {
|
|
|
1131
1131
|
return this.total !== void 0 && (e.total = this.total), this.position !== void 0 && (e.position = this.position), e;
|
|
1132
1132
|
}
|
|
1133
1133
|
}
|
|
1134
|
-
class
|
|
1134
|
+
class oe {
|
|
1135
1135
|
/** Creates a [Copies]. */
|
|
1136
1136
|
constructor(e) {
|
|
1137
1137
|
this.total = e.total, this.available = e.available;
|
|
@@ -1141,9 +1141,9 @@ class Oe {
|
|
|
1141
1141
|
*/
|
|
1142
1142
|
static deserialize(e) {
|
|
1143
1143
|
if (e)
|
|
1144
|
-
return new
|
|
1145
|
-
total:
|
|
1146
|
-
available:
|
|
1144
|
+
return new oe({
|
|
1145
|
+
total: C(e.total),
|
|
1146
|
+
available: C(e.available)
|
|
1147
1147
|
});
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
@@ -1154,7 +1154,7 @@ class Oe {
|
|
|
1154
1154
|
return this.total !== void 0 && (e.total = this.total), this.available !== void 0 && (e.available = this.available), e;
|
|
1155
1155
|
}
|
|
1156
1156
|
}
|
|
1157
|
-
class
|
|
1157
|
+
class ae {
|
|
1158
1158
|
/** Creates a [Availability]. */
|
|
1159
1159
|
constructor(e) {
|
|
1160
1160
|
this.state = e.state, this.since = e.since, this.until = e.until;
|
|
@@ -1164,10 +1164,10 @@ class Pe {
|
|
|
1164
1164
|
*/
|
|
1165
1165
|
static deserialize(e) {
|
|
1166
1166
|
if (e && e.state)
|
|
1167
|
-
return new
|
|
1167
|
+
return new ae({
|
|
1168
1168
|
state: e.state,
|
|
1169
|
-
since:
|
|
1170
|
-
until:
|
|
1169
|
+
since: ve(e.since),
|
|
1170
|
+
until: ve(e.until)
|
|
1171
1171
|
});
|
|
1172
1172
|
}
|
|
1173
1173
|
/**
|
|
@@ -1178,334 +1178,334 @@ class Pe {
|
|
|
1178
1178
|
return this.since !== void 0 && (e.since = this.since.toISOString()), this.until !== void 0 && (e.until = this.until.toISOString()), e;
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
|
-
|
|
1182
|
-
return
|
|
1181
|
+
E.prototype.getNumberOfItems = function() {
|
|
1182
|
+
return C(this.otherProperties.numberOfItems);
|
|
1183
1183
|
};
|
|
1184
|
-
|
|
1185
|
-
return
|
|
1184
|
+
E.prototype.getPrice = function() {
|
|
1185
|
+
return se.deserialize(this.otherProperties.price);
|
|
1186
1186
|
};
|
|
1187
|
-
|
|
1188
|
-
const
|
|
1189
|
-
if (
|
|
1190
|
-
return
|
|
1187
|
+
E.prototype.getIndirectAcquisitions = function() {
|
|
1188
|
+
const r = this.otherProperties.indirectAcquisition;
|
|
1189
|
+
if (r && r instanceof Array)
|
|
1190
|
+
return r.map((e) => H.deserialize(e)).filter((e) => e !== void 0);
|
|
1191
1191
|
};
|
|
1192
|
-
|
|
1193
|
-
return
|
|
1192
|
+
E.prototype.getHolds = function() {
|
|
1193
|
+
return ne.deserialize(this.otherProperties.holds);
|
|
1194
1194
|
};
|
|
1195
|
-
|
|
1196
|
-
return
|
|
1195
|
+
E.prototype.getCopies = function() {
|
|
1196
|
+
return oe.deserialize(this.otherProperties.copies);
|
|
1197
1197
|
};
|
|
1198
|
-
|
|
1199
|
-
return
|
|
1198
|
+
E.prototype.getAvailability = function() {
|
|
1199
|
+
return ae.deserialize(this.otherProperties.availability);
|
|
1200
1200
|
};
|
|
1201
|
-
|
|
1202
|
-
return
|
|
1201
|
+
E.prototype.getAuthenticate = function() {
|
|
1202
|
+
return B.deserialize(this.otherProperties.authenticate);
|
|
1203
1203
|
};
|
|
1204
|
-
|
|
1204
|
+
E.prototype.getClipped = function() {
|
|
1205
1205
|
return this.otherProperties.clipped;
|
|
1206
1206
|
};
|
|
1207
|
-
|
|
1207
|
+
E.prototype.getFit = function() {
|
|
1208
1208
|
return this.otherProperties.fit;
|
|
1209
1209
|
};
|
|
1210
|
-
|
|
1210
|
+
E.prototype.getOrientation = function() {
|
|
1211
1211
|
return this.otherProperties.orientation;
|
|
1212
1212
|
};
|
|
1213
|
-
|
|
1213
|
+
E.prototype.getOverflow = function() {
|
|
1214
1214
|
return this.otherProperties.overflow;
|
|
1215
1215
|
};
|
|
1216
|
-
|
|
1216
|
+
E.prototype.getPage = function() {
|
|
1217
1217
|
return this.otherProperties.page || void 0;
|
|
1218
1218
|
};
|
|
1219
|
-
|
|
1219
|
+
E.prototype.getSpread = function() {
|
|
1220
1220
|
return this.otherProperties.spread || void 0;
|
|
1221
1221
|
};
|
|
1222
|
-
var
|
|
1223
|
-
(function(
|
|
1224
|
-
|
|
1225
|
-
})(
|
|
1226
|
-
var
|
|
1227
|
-
(function(
|
|
1228
|
-
|
|
1229
|
-
})(
|
|
1230
|
-
const
|
|
1231
|
-
function
|
|
1232
|
-
console.warn(`${
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
|
-
function
|
|
1236
|
-
return
|
|
1237
|
-
}
|
|
1238
|
-
function
|
|
1239
|
-
return
|
|
1240
|
-
}
|
|
1241
|
-
function
|
|
1242
|
-
const e =
|
|
1243
|
-
if (
|
|
1244
|
-
return (
|
|
1222
|
+
var R;
|
|
1223
|
+
(function(r) {
|
|
1224
|
+
r.NONE = "none", r.DESCENDANT = "descendant", r.CHILD = "child";
|
|
1225
|
+
})(R || (R = {}));
|
|
1226
|
+
var P;
|
|
1227
|
+
(function(r) {
|
|
1228
|
+
r.id = "id", r.class = "class", r.tag = "tag", r.attribute = "attribute", r.nthchild = "nthchild", r.nthoftype = "nthoftype";
|
|
1229
|
+
})(P || (P = {}));
|
|
1230
|
+
const ct = "CssSelectorGenerator";
|
|
1231
|
+
function Ee(r = "unknown problem", ...e) {
|
|
1232
|
+
console.warn(`${ct}: ${r}`, ...e);
|
|
1233
|
+
}
|
|
1234
|
+
P.id, P.class, P.tag, P.attribute, Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY;
|
|
1235
|
+
function ut(r) {
|
|
1236
|
+
return r instanceof RegExp;
|
|
1237
|
+
}
|
|
1238
|
+
function dt(r) {
|
|
1239
|
+
return r.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".+");
|
|
1240
|
+
}
|
|
1241
|
+
function pt(r) {
|
|
1242
|
+
const e = r.map((t) => {
|
|
1243
|
+
if (ut(t))
|
|
1244
|
+
return (i) => t.test(i);
|
|
1245
1245
|
if (typeof t == "function")
|
|
1246
|
-
return (
|
|
1247
|
-
const
|
|
1248
|
-
return typeof
|
|
1246
|
+
return (i) => {
|
|
1247
|
+
const s = t(i);
|
|
1248
|
+
return typeof s != "boolean" ? (Ee("pattern matcher function invalid", "Provided pattern matching function does not return boolean. It's result will be ignored.", t), !1) : s;
|
|
1249
1249
|
};
|
|
1250
1250
|
if (typeof t == "string") {
|
|
1251
|
-
const
|
|
1252
|
-
return (
|
|
1251
|
+
const i = new RegExp("^" + dt(t) + "$");
|
|
1252
|
+
return (s) => i.test(s);
|
|
1253
1253
|
}
|
|
1254
|
-
return
|
|
1254
|
+
return Ee("pattern matcher invalid", "Pattern matching only accepts strings, regular expressions and/or functions. This item is invalid and will be ignored.", t), () => !1;
|
|
1255
1255
|
});
|
|
1256
|
-
return (t) => e.some((
|
|
1256
|
+
return (t) => e.some((i) => i(t));
|
|
1257
1257
|
}
|
|
1258
|
-
const
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1258
|
+
const ft = "", mt = " > ", gt = " ";
|
|
1259
|
+
R.NONE + "", R.NONE, R.DESCENDANT + "", R.DESCENDANT, R.CHILD + "", R.CHILD;
|
|
1260
|
+
P.nthoftype, P.tag, P.id, P.class, P.attribute, P.nthchild;
|
|
1261
|
+
pt([
|
|
1262
1262
|
"class",
|
|
1263
1263
|
"id",
|
|
1264
1264
|
// Angular attributes
|
|
1265
1265
|
"ng-*"
|
|
1266
1266
|
]);
|
|
1267
|
-
class
|
|
1267
|
+
class Y {
|
|
1268
1268
|
}
|
|
1269
|
-
function
|
|
1270
|
-
return
|
|
1269
|
+
function be(r) {
|
|
1270
|
+
return r.split("").reverse().join("");
|
|
1271
1271
|
}
|
|
1272
|
-
function
|
|
1273
|
-
const
|
|
1274
|
-
return t.map((
|
|
1275
|
-
const
|
|
1272
|
+
function yt(r, e, t) {
|
|
1273
|
+
const i = be(e);
|
|
1274
|
+
return t.map((s) => {
|
|
1275
|
+
const n = Math.max(0, s.end - e.length - s.errors), o = be(r.slice(n, s.end));
|
|
1276
1276
|
return {
|
|
1277
|
-
start:
|
|
1278
|
-
end:
|
|
1279
|
-
errors:
|
|
1277
|
+
start: Fe(o, i, s.errors).reduce((c, h) => s.end - h.end < c ? s.end - h.end : c, s.end),
|
|
1278
|
+
end: s.end,
|
|
1279
|
+
errors: s.errors
|
|
1280
1280
|
};
|
|
1281
1281
|
});
|
|
1282
1282
|
}
|
|
1283
|
-
function
|
|
1284
|
-
return (
|
|
1283
|
+
function Z(r) {
|
|
1284
|
+
return (r | -r) >> 31 & 1;
|
|
1285
1285
|
}
|
|
1286
|
-
function
|
|
1287
|
-
let
|
|
1288
|
-
const o =
|
|
1289
|
-
let u =
|
|
1290
|
-
const d =
|
|
1291
|
-
return u <<= 1, p <<= 1, p |= o, u |=
|
|
1286
|
+
function xe(r, e, t, i) {
|
|
1287
|
+
let s = r.P[t], n = r.M[t];
|
|
1288
|
+
const o = i >>> 31, a = e[t] | o, c = a | n, h = (a & s) + s ^ s | a;
|
|
1289
|
+
let u = n | ~(h | s), p = s & h;
|
|
1290
|
+
const d = Z(u & r.lastRowMask[t]) - Z(p & r.lastRowMask[t]);
|
|
1291
|
+
return u <<= 1, p <<= 1, p |= o, u |= Z(i) - o, s = p | ~(c | u), n = u & c, r.P[t] = s, r.M[t] = n, d;
|
|
1292
1292
|
}
|
|
1293
|
-
function
|
|
1293
|
+
function Fe(r, e, t) {
|
|
1294
1294
|
if (e.length === 0)
|
|
1295
1295
|
return [];
|
|
1296
1296
|
t = Math.min(t, e.length);
|
|
1297
|
-
const
|
|
1298
|
-
P: new Uint32Array(
|
|
1299
|
-
M: new Uint32Array(
|
|
1300
|
-
lastRowMask: new Uint32Array(
|
|
1297
|
+
const i = [], s = 32, n = Math.ceil(e.length / s) - 1, o = {
|
|
1298
|
+
P: new Uint32Array(n + 1),
|
|
1299
|
+
M: new Uint32Array(n + 1),
|
|
1300
|
+
lastRowMask: new Uint32Array(n + 1)
|
|
1301
1301
|
};
|
|
1302
|
-
o.lastRowMask.fill(1 << 31), o.lastRowMask[
|
|
1303
|
-
const a = new Uint32Array(
|
|
1302
|
+
o.lastRowMask.fill(1 << 31), o.lastRowMask[n] = 1 << (e.length - 1) % s;
|
|
1303
|
+
const a = new Uint32Array(n + 1), c = /* @__PURE__ */ new Map(), h = [];
|
|
1304
1304
|
for (let d = 0; d < 256; d++)
|
|
1305
|
-
|
|
1305
|
+
h.push(a);
|
|
1306
1306
|
for (let d = 0; d < e.length; d += 1) {
|
|
1307
1307
|
const f = e.charCodeAt(d);
|
|
1308
|
-
if (
|
|
1308
|
+
if (c.has(f))
|
|
1309
1309
|
continue;
|
|
1310
|
-
const
|
|
1311
|
-
|
|
1312
|
-
for (let
|
|
1313
|
-
|
|
1314
|
-
for (let
|
|
1315
|
-
const
|
|
1316
|
-
if (
|
|
1310
|
+
const g = new Uint32Array(n + 1);
|
|
1311
|
+
c.set(f, g), f < h.length && (h[f] = g);
|
|
1312
|
+
for (let m = 0; m <= n; m += 1) {
|
|
1313
|
+
g[m] = 0;
|
|
1314
|
+
for (let v = 0; v < s; v += 1) {
|
|
1315
|
+
const S = m * s + v;
|
|
1316
|
+
if (S >= e.length)
|
|
1317
1317
|
continue;
|
|
1318
|
-
e.charCodeAt(
|
|
1318
|
+
e.charCodeAt(S) === f && (g[m] |= 1 << v);
|
|
1319
1319
|
}
|
|
1320
1320
|
}
|
|
1321
1321
|
}
|
|
1322
|
-
let u = Math.max(0, Math.ceil(t /
|
|
1323
|
-
const p = new Uint32Array(
|
|
1322
|
+
let u = Math.max(0, Math.ceil(t / s) - 1);
|
|
1323
|
+
const p = new Uint32Array(n + 1);
|
|
1324
1324
|
for (let d = 0; d <= u; d += 1)
|
|
1325
|
-
p[d] = (d + 1) *
|
|
1326
|
-
p[
|
|
1325
|
+
p[d] = (d + 1) * s;
|
|
1326
|
+
p[n] = e.length;
|
|
1327
1327
|
for (let d = 0; d <= u; d += 1)
|
|
1328
1328
|
o.P[d] = -1, o.M[d] = 0;
|
|
1329
|
-
for (let d = 0; d <
|
|
1330
|
-
const f =
|
|
1331
|
-
let
|
|
1332
|
-
f <
|
|
1333
|
-
let
|
|
1334
|
-
for (let
|
|
1335
|
-
|
|
1336
|
-
if (p[u] -
|
|
1329
|
+
for (let d = 0; d < r.length; d += 1) {
|
|
1330
|
+
const f = r.charCodeAt(d);
|
|
1331
|
+
let g;
|
|
1332
|
+
f < h.length ? g = h[f] : (g = c.get(f), typeof g > "u" && (g = a));
|
|
1333
|
+
let m = 0;
|
|
1334
|
+
for (let v = 0; v <= u; v += 1)
|
|
1335
|
+
m = xe(o, g, v, m), p[v] += m;
|
|
1336
|
+
if (p[u] - m <= t && u < n && (g[u + 1] & 1 || m < 0)) {
|
|
1337
1337
|
u += 1, o.P[u] = -1, o.M[u] = 0;
|
|
1338
|
-
let
|
|
1339
|
-
if (u ===
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1338
|
+
let v;
|
|
1339
|
+
if (u === n) {
|
|
1340
|
+
const S = e.length % s;
|
|
1341
|
+
v = S === 0 ? s : S;
|
|
1342
1342
|
} else
|
|
1343
|
-
|
|
1344
|
-
p[u] = p[u - 1] +
|
|
1343
|
+
v = s;
|
|
1344
|
+
p[u] = p[u - 1] + v - m + xe(o, g, u, m);
|
|
1345
1345
|
} else
|
|
1346
|
-
for (; u > 0 && p[u] >= t +
|
|
1346
|
+
for (; u > 0 && p[u] >= t + s; )
|
|
1347
1347
|
u -= 1;
|
|
1348
|
-
u ===
|
|
1348
|
+
u === n && p[u] <= t && (p[u] < t && i.splice(0, i.length), i.push({
|
|
1349
1349
|
start: -1,
|
|
1350
1350
|
end: d + 1,
|
|
1351
1351
|
errors: p[u]
|
|
1352
1352
|
}), t = p[u]);
|
|
1353
1353
|
}
|
|
1354
|
-
return
|
|
1354
|
+
return i;
|
|
1355
1355
|
}
|
|
1356
|
-
function
|
|
1357
|
-
const
|
|
1358
|
-
return
|
|
1359
|
-
}
|
|
1360
|
-
function
|
|
1361
|
-
let
|
|
1362
|
-
const
|
|
1363
|
-
for (;
|
|
1364
|
-
|
|
1365
|
-
start:
|
|
1366
|
-
end:
|
|
1356
|
+
function vt(r, e, t) {
|
|
1357
|
+
const i = Fe(r, e, t);
|
|
1358
|
+
return yt(r, e, i);
|
|
1359
|
+
}
|
|
1360
|
+
function Be(r, e, t) {
|
|
1361
|
+
let i = 0;
|
|
1362
|
+
const s = [];
|
|
1363
|
+
for (; i !== -1; )
|
|
1364
|
+
i = r.indexOf(e, i), i !== -1 && (s.push({
|
|
1365
|
+
start: i,
|
|
1366
|
+
end: i + e.length,
|
|
1367
1367
|
errors: 0
|
|
1368
|
-
}),
|
|
1369
|
-
return
|
|
1368
|
+
}), i += 1);
|
|
1369
|
+
return s.length > 0 ? s : vt(r, e, t);
|
|
1370
1370
|
}
|
|
1371
|
-
function
|
|
1372
|
-
return e.length === 0 ||
|
|
1371
|
+
function Se(r, e) {
|
|
1372
|
+
return e.length === 0 || r.length === 0 ? 0 : 1 - Be(r, e, e.length)[0].errors / e.length;
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function Et(r, e, t = {}) {
|
|
1375
1375
|
if (e.length === 0)
|
|
1376
1376
|
return null;
|
|
1377
|
-
const
|
|
1378
|
-
if (
|
|
1377
|
+
const i = Math.min(256, e.length / 2), s = Be(r, e, i);
|
|
1378
|
+
if (s.length === 0)
|
|
1379
1379
|
return null;
|
|
1380
|
-
const
|
|
1381
|
-
const d = 1 - a.errors / e.length, f = t.prefix ?
|
|
1382
|
-
|
|
1380
|
+
const n = (a) => {
|
|
1381
|
+
const d = 1 - a.errors / e.length, f = t.prefix ? Se(
|
|
1382
|
+
r.slice(
|
|
1383
1383
|
Math.max(0, a.start - t.prefix.length),
|
|
1384
1384
|
a.start
|
|
1385
1385
|
),
|
|
1386
1386
|
t.prefix
|
|
1387
|
-
) : 1,
|
|
1388
|
-
|
|
1387
|
+
) : 1, g = t.suffix ? Se(
|
|
1388
|
+
r.slice(a.end, a.end + t.suffix.length),
|
|
1389
1389
|
t.suffix
|
|
1390
1390
|
) : 1;
|
|
1391
|
-
let
|
|
1392
|
-
typeof t.hint == "number" && (
|
|
1393
|
-
const
|
|
1394
|
-
return
|
|
1395
|
-
}, o =
|
|
1391
|
+
let m = 1;
|
|
1392
|
+
typeof t.hint == "number" && (m = 1 - Math.abs(a.start - t.hint) / r.length);
|
|
1393
|
+
const v = 50 * d + 20 * f + 20 * g + 2 * m, S = 50 + 20 + 20 + 2;
|
|
1394
|
+
return v / S;
|
|
1395
|
+
}, o = s.map((a) => ({
|
|
1396
1396
|
start: a.start,
|
|
1397
1397
|
end: a.end,
|
|
1398
|
-
score:
|
|
1398
|
+
score: n(a)
|
|
1399
1399
|
}));
|
|
1400
|
-
return o.sort((a,
|
|
1400
|
+
return o.sort((a, c) => c.score - a.score), o[0];
|
|
1401
1401
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const
|
|
1404
|
-
if (
|
|
1402
|
+
function J(r, e, t) {
|
|
1403
|
+
const i = t === 1 ? e : e - 1;
|
|
1404
|
+
if (r.charAt(i).trim() !== "")
|
|
1405
1405
|
return e;
|
|
1406
|
-
let
|
|
1407
|
-
if (t === 2 ? (
|
|
1406
|
+
let s, n;
|
|
1407
|
+
if (t === 2 ? (s = r.substring(0, e), n = s.trimEnd()) : (s = r.substring(e), n = s.trimStart()), !n.length)
|
|
1408
1408
|
return -1;
|
|
1409
|
-
const o =
|
|
1409
|
+
const o = s.length - n.length;
|
|
1410
1410
|
return t === 2 ? e - o : e + o;
|
|
1411
1411
|
}
|
|
1412
|
-
function
|
|
1413
|
-
const t =
|
|
1414
|
-
|
|
1412
|
+
function we(r, e) {
|
|
1413
|
+
const t = r.commonAncestorContainer.ownerDocument.createNodeIterator(
|
|
1414
|
+
r.commonAncestorContainer,
|
|
1415
1415
|
NodeFilter.SHOW_TEXT
|
|
1416
|
-
),
|
|
1417
|
-
let
|
|
1418
|
-
for (;
|
|
1419
|
-
|
|
1420
|
-
e === 2 && (
|
|
1416
|
+
), i = e === 1 ? r.startContainer : r.endContainer, s = e === 1 ? r.endContainer : r.startContainer;
|
|
1417
|
+
let n = t.nextNode();
|
|
1418
|
+
for (; n && n !== i; )
|
|
1419
|
+
n = t.nextNode();
|
|
1420
|
+
e === 2 && (n = t.previousNode());
|
|
1421
1421
|
let o = -1;
|
|
1422
1422
|
const a = () => {
|
|
1423
|
-
if (
|
|
1424
|
-
const
|
|
1425
|
-
o =
|
|
1423
|
+
if (n = e === 1 ? t.nextNode() : t.previousNode(), n) {
|
|
1424
|
+
const c = n.textContent, h = e === 1 ? 0 : c.length;
|
|
1425
|
+
o = J(c, h, e);
|
|
1426
1426
|
}
|
|
1427
1427
|
};
|
|
1428
|
-
for (;
|
|
1428
|
+
for (; n && o === -1 && n !== s; )
|
|
1429
1429
|
a();
|
|
1430
|
-
if (
|
|
1431
|
-
return { node:
|
|
1430
|
+
if (n && o >= 0)
|
|
1431
|
+
return { node: n, offset: o };
|
|
1432
1432
|
throw new RangeError("No text nodes with non-whitespace text found in range");
|
|
1433
1433
|
}
|
|
1434
|
-
function
|
|
1435
|
-
if (!
|
|
1434
|
+
function bt(r) {
|
|
1435
|
+
if (!r.toString().trim().length)
|
|
1436
1436
|
throw new RangeError("Range contains no non-whitespace text");
|
|
1437
|
-
if (
|
|
1437
|
+
if (r.startContainer.nodeType !== Node.TEXT_NODE)
|
|
1438
1438
|
throw new RangeError("Range startContainer is not a text node");
|
|
1439
|
-
if (
|
|
1439
|
+
if (r.endContainer.nodeType !== Node.TEXT_NODE)
|
|
1440
1440
|
throw new RangeError("Range endContainer is not a text node");
|
|
1441
|
-
const e =
|
|
1442
|
-
let t = !1,
|
|
1443
|
-
const
|
|
1444
|
-
start:
|
|
1445
|
-
|
|
1446
|
-
|
|
1441
|
+
const e = r.cloneRange();
|
|
1442
|
+
let t = !1, i = !1;
|
|
1443
|
+
const s = {
|
|
1444
|
+
start: J(
|
|
1445
|
+
r.startContainer.textContent,
|
|
1446
|
+
r.startOffset,
|
|
1447
1447
|
1
|
|
1448
1448
|
/* Forwards */
|
|
1449
1449
|
),
|
|
1450
|
-
end:
|
|
1451
|
-
|
|
1452
|
-
|
|
1450
|
+
end: J(
|
|
1451
|
+
r.endContainer.textContent,
|
|
1452
|
+
r.endOffset,
|
|
1453
1453
|
2
|
|
1454
1454
|
/* Backwards */
|
|
1455
1455
|
)
|
|
1456
1456
|
};
|
|
1457
|
-
if (
|
|
1457
|
+
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
1458
|
return e;
|
|
1459
1459
|
if (!t) {
|
|
1460
|
-
const { node:
|
|
1460
|
+
const { node: n, offset: o } = we(
|
|
1461
1461
|
e,
|
|
1462
1462
|
1
|
|
1463
1463
|
/* Forwards */
|
|
1464
1464
|
);
|
|
1465
|
-
|
|
1465
|
+
n && o >= 0 && e.setStart(n, o);
|
|
1466
1466
|
}
|
|
1467
|
-
if (!
|
|
1468
|
-
const { node:
|
|
1467
|
+
if (!i) {
|
|
1468
|
+
const { node: n, offset: o } = we(
|
|
1469
1469
|
e,
|
|
1470
1470
|
2
|
|
1471
1471
|
/* Backwards */
|
|
1472
1472
|
);
|
|
1473
|
-
|
|
1473
|
+
n && o > 0 && e.setEnd(n, o);
|
|
1474
1474
|
}
|
|
1475
1475
|
return e;
|
|
1476
1476
|
}
|
|
1477
|
-
function
|
|
1477
|
+
function Ue(r) {
|
|
1478
1478
|
var e;
|
|
1479
|
-
switch (
|
|
1479
|
+
switch (r.nodeType) {
|
|
1480
1480
|
case Node.ELEMENT_NODE:
|
|
1481
1481
|
case Node.TEXT_NODE:
|
|
1482
|
-
return ((e =
|
|
1482
|
+
return ((e = r.textContent) == null ? void 0 : e.length) ?? 0;
|
|
1483
1483
|
default:
|
|
1484
1484
|
return 0;
|
|
1485
1485
|
}
|
|
1486
1486
|
}
|
|
1487
|
-
function
|
|
1488
|
-
let e =
|
|
1487
|
+
function Te(r) {
|
|
1488
|
+
let e = r.previousSibling, t = 0;
|
|
1489
1489
|
for (; e; )
|
|
1490
|
-
t +=
|
|
1490
|
+
t += Ue(e), e = e.previousSibling;
|
|
1491
1491
|
return t;
|
|
1492
1492
|
}
|
|
1493
|
-
function
|
|
1493
|
+
function ke(r, ...e) {
|
|
1494
1494
|
let t = e.shift();
|
|
1495
|
-
const
|
|
1496
|
-
|
|
1495
|
+
const i = r.ownerDocument.createNodeIterator(
|
|
1496
|
+
r,
|
|
1497
1497
|
NodeFilter.SHOW_TEXT
|
|
1498
|
-
),
|
|
1499
|
-
let
|
|
1500
|
-
for (; t !== void 0 &&
|
|
1501
|
-
o =
|
|
1498
|
+
), s = [];
|
|
1499
|
+
let n = i.nextNode(), o, a = 0;
|
|
1500
|
+
for (; t !== void 0 && n; )
|
|
1501
|
+
o = n, a + o.data.length > t ? (s.push({ node: o, offset: t - a }), t = e.shift()) : (n = i.nextNode(), a += o.data.length);
|
|
1502
1502
|
for (; t !== void 0 && o && a === t; )
|
|
1503
|
-
|
|
1503
|
+
s.push({ node: o, offset: o.data.length }), t = e.shift();
|
|
1504
1504
|
if (t !== void 0)
|
|
1505
1505
|
throw new RangeError("Offset exceeds text length");
|
|
1506
|
-
return
|
|
1506
|
+
return s;
|
|
1507
1507
|
}
|
|
1508
|
-
class
|
|
1508
|
+
class M {
|
|
1509
1509
|
constructor(e, t) {
|
|
1510
1510
|
if (t < 0)
|
|
1511
1511
|
throw new Error("Offset is invalid");
|
|
@@ -1520,10 +1520,10 @@ class L {
|
|
|
1520
1520
|
relativeTo(e) {
|
|
1521
1521
|
if (!e.contains(this.element))
|
|
1522
1522
|
throw new Error("Parent is not an ancestor of current element");
|
|
1523
|
-
let t = this.element,
|
|
1523
|
+
let t = this.element, i = this.offset;
|
|
1524
1524
|
for (; t !== e; )
|
|
1525
|
-
|
|
1526
|
-
return new
|
|
1525
|
+
i += Te(t), t = t.parentElement;
|
|
1526
|
+
return new M(t, i);
|
|
1527
1527
|
}
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Resolve the position to a specific text node and offset within that node.
|
|
@@ -1544,18 +1544,18 @@ class L {
|
|
|
1544
1544
|
*/
|
|
1545
1545
|
resolve(e = {}) {
|
|
1546
1546
|
try {
|
|
1547
|
-
return
|
|
1547
|
+
return ke(this.element, this.offset)[0];
|
|
1548
1548
|
} catch (t) {
|
|
1549
1549
|
if (this.offset === 0 && e.direction !== void 0) {
|
|
1550
|
-
const
|
|
1550
|
+
const i = document.createTreeWalker(
|
|
1551
1551
|
this.element.getRootNode(),
|
|
1552
1552
|
NodeFilter.SHOW_TEXT
|
|
1553
1553
|
);
|
|
1554
|
-
|
|
1555
|
-
const
|
|
1556
|
-
if (!
|
|
1554
|
+
i.currentNode = this.element;
|
|
1555
|
+
const s = e.direction === 1, n = s ? i.nextNode() : i.previousNode();
|
|
1556
|
+
if (!n)
|
|
1557
1557
|
throw t;
|
|
1558
|
-
return { node:
|
|
1558
|
+
return { node: n, offset: s ? 0 : n.data.length };
|
|
1559
1559
|
} else
|
|
1560
1560
|
throw t;
|
|
1561
1561
|
}
|
|
@@ -1567,9 +1567,9 @@ class L {
|
|
|
1567
1567
|
static fromCharOffset(e, t) {
|
|
1568
1568
|
switch (e.nodeType) {
|
|
1569
1569
|
case Node.TEXT_NODE:
|
|
1570
|
-
return
|
|
1570
|
+
return M.fromPoint(e, t);
|
|
1571
1571
|
case Node.ELEMENT_NODE:
|
|
1572
|
-
return new
|
|
1572
|
+
return new M(e, t);
|
|
1573
1573
|
default:
|
|
1574
1574
|
throw new Error("Node is not an element or text node");
|
|
1575
1575
|
}
|
|
@@ -1587,23 +1587,23 @@ class L {
|
|
|
1587
1587
|
throw new Error("Text node offset is out of range");
|
|
1588
1588
|
if (!e.parentElement)
|
|
1589
1589
|
throw new Error("Text node has no parent");
|
|
1590
|
-
const
|
|
1591
|
-
return new
|
|
1590
|
+
const i = Te(e) + t;
|
|
1591
|
+
return new M(e.parentElement, i);
|
|
1592
1592
|
}
|
|
1593
1593
|
case Node.ELEMENT_NODE: {
|
|
1594
1594
|
if (t < 0 || t > e.childNodes.length)
|
|
1595
1595
|
throw new Error("Child node offset is out of range");
|
|
1596
|
-
let
|
|
1597
|
-
for (let
|
|
1598
|
-
|
|
1599
|
-
return new
|
|
1596
|
+
let i = 0;
|
|
1597
|
+
for (let s = 0; s < t; s++)
|
|
1598
|
+
i += Ue(e.childNodes[s]);
|
|
1599
|
+
return new M(e, i);
|
|
1600
1600
|
}
|
|
1601
1601
|
default:
|
|
1602
1602
|
throw new Error("Point is not in an element or text node");
|
|
1603
1603
|
}
|
|
1604
1604
|
}
|
|
1605
1605
|
}
|
|
1606
|
-
class
|
|
1606
|
+
class z {
|
|
1607
1607
|
constructor(e, t) {
|
|
1608
1608
|
this.start = e, this.end = t;
|
|
1609
1609
|
}
|
|
@@ -1613,7 +1613,7 @@ class D {
|
|
|
1613
1613
|
* `end.element`.
|
|
1614
1614
|
*/
|
|
1615
1615
|
relativeTo(e) {
|
|
1616
|
-
return new
|
|
1616
|
+
return new z(
|
|
1617
1617
|
this.start.relativeTo(e),
|
|
1618
1618
|
this.end.relativeTo(e)
|
|
1619
1619
|
);
|
|
@@ -1629,7 +1629,7 @@ class D {
|
|
|
1629
1629
|
*/
|
|
1630
1630
|
toRange() {
|
|
1631
1631
|
let e, t;
|
|
1632
|
-
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] =
|
|
1632
|
+
this.start.element === this.end.element && this.start.offset <= this.end.offset ? [e, t] = ke(
|
|
1633
1633
|
this.start.element,
|
|
1634
1634
|
this.start.offset,
|
|
1635
1635
|
this.end.offset
|
|
@@ -1640,27 +1640,27 @@ class D {
|
|
|
1640
1640
|
direction: 2
|
|
1641
1641
|
/* BACKWARDS */
|
|
1642
1642
|
}));
|
|
1643
|
-
const
|
|
1644
|
-
return
|
|
1643
|
+
const i = new Range();
|
|
1644
|
+
return i.setStart(e.node, e.offset), i.setEnd(t.node, t.offset), i;
|
|
1645
1645
|
}
|
|
1646
1646
|
/**
|
|
1647
1647
|
* Create a TextRange from a (DOM) Range
|
|
1648
1648
|
*/
|
|
1649
1649
|
static fromRange(e) {
|
|
1650
|
-
const t =
|
|
1650
|
+
const t = M.fromPoint(
|
|
1651
1651
|
e.startContainer,
|
|
1652
1652
|
e.startOffset
|
|
1653
|
-
),
|
|
1654
|
-
return new
|
|
1653
|
+
), i = M.fromPoint(e.endContainer, e.endOffset);
|
|
1654
|
+
return new z(t, i);
|
|
1655
1655
|
}
|
|
1656
1656
|
/**
|
|
1657
1657
|
* Create a TextRange representing the `start`th to `end`th characters in
|
|
1658
1658
|
* `root`
|
|
1659
1659
|
*/
|
|
1660
|
-
static fromOffsets(e, t,
|
|
1661
|
-
return new
|
|
1662
|
-
new
|
|
1663
|
-
new
|
|
1660
|
+
static fromOffsets(e, t, i) {
|
|
1661
|
+
return new z(
|
|
1662
|
+
new M(e, t),
|
|
1663
|
+
new M(e, i)
|
|
1664
1664
|
);
|
|
1665
1665
|
}
|
|
1666
1666
|
/**
|
|
@@ -1668,23 +1668,23 @@ class D {
|
|
|
1668
1668
|
* whitespace
|
|
1669
1669
|
*/
|
|
1670
1670
|
static trimmedRange(e) {
|
|
1671
|
-
return
|
|
1671
|
+
return bt(z.fromRange(e).toRange());
|
|
1672
1672
|
}
|
|
1673
1673
|
}
|
|
1674
|
-
class
|
|
1675
|
-
constructor(e, t,
|
|
1676
|
-
this.root = e, this.start = t, this.end =
|
|
1674
|
+
class _ {
|
|
1675
|
+
constructor(e, t, i) {
|
|
1676
|
+
this.root = e, this.start = t, this.end = i;
|
|
1677
1677
|
}
|
|
1678
1678
|
static fromRange(e, t) {
|
|
1679
|
-
const
|
|
1680
|
-
return new
|
|
1679
|
+
const i = z.fromRange(t).relativeTo(e);
|
|
1680
|
+
return new _(
|
|
1681
1681
|
e,
|
|
1682
|
-
|
|
1683
|
-
|
|
1682
|
+
i.start.offset,
|
|
1683
|
+
i.end.offset
|
|
1684
1684
|
);
|
|
1685
1685
|
}
|
|
1686
1686
|
static fromSelector(e, t) {
|
|
1687
|
-
return new
|
|
1687
|
+
return new _(e, t.start, t.end);
|
|
1688
1688
|
}
|
|
1689
1689
|
toSelector() {
|
|
1690
1690
|
return {
|
|
@@ -1694,15 +1694,15 @@ class he {
|
|
|
1694
1694
|
};
|
|
1695
1695
|
}
|
|
1696
1696
|
toRange() {
|
|
1697
|
-
return
|
|
1697
|
+
return z.fromOffsets(this.root, this.start, this.end).toRange();
|
|
1698
1698
|
}
|
|
1699
1699
|
}
|
|
1700
|
-
class
|
|
1700
|
+
class X {
|
|
1701
1701
|
/**
|
|
1702
1702
|
* @param root - A root element from which to anchor.
|
|
1703
1703
|
*/
|
|
1704
|
-
constructor(e, t,
|
|
1705
|
-
this.root = e, this.exact = t, this.context =
|
|
1704
|
+
constructor(e, t, i = {}) {
|
|
1705
|
+
this.root = e, this.exact = t, this.context = i;
|
|
1706
1706
|
}
|
|
1707
1707
|
/**
|
|
1708
1708
|
* Create a `TextQuoteAnchor` from a range.
|
|
@@ -1710,15 +1710,15 @@ class ce {
|
|
|
1710
1710
|
* Will throw if `range` does not contain any text nodes.
|
|
1711
1711
|
*/
|
|
1712
1712
|
static fromRange(e, t) {
|
|
1713
|
-
const
|
|
1714
|
-
return new
|
|
1715
|
-
prefix:
|
|
1716
|
-
suffix:
|
|
1713
|
+
const i = e.textContent, s = z.fromRange(t).relativeTo(e), n = s.start.offset, o = s.end.offset, a = 32;
|
|
1714
|
+
return new X(e, i.slice(n, o), {
|
|
1715
|
+
prefix: i.slice(Math.max(0, n - a), n),
|
|
1716
|
+
suffix: i.slice(o, Math.min(i.length, o + a))
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
1719
|
static fromSelector(e, t) {
|
|
1720
|
-
const { prefix:
|
|
1721
|
-
return new
|
|
1720
|
+
const { prefix: i, suffix: s } = t;
|
|
1721
|
+
return new X(e, t.exact, { prefix: i, suffix: s });
|
|
1722
1722
|
}
|
|
1723
1723
|
toSelector() {
|
|
1724
1724
|
return {
|
|
@@ -1732,45 +1732,45 @@ class ce {
|
|
|
1732
1732
|
return this.toPositionAnchor(e).toRange();
|
|
1733
1733
|
}
|
|
1734
1734
|
toPositionAnchor(e = {}) {
|
|
1735
|
-
const t = this.root.textContent,
|
|
1735
|
+
const t = this.root.textContent, i = Et(t, this.exact, {
|
|
1736
1736
|
...this.context,
|
|
1737
1737
|
hint: e.hint
|
|
1738
1738
|
});
|
|
1739
|
-
if (!
|
|
1739
|
+
if (!i)
|
|
1740
1740
|
throw new Error("Quote not found");
|
|
1741
|
-
return new
|
|
1741
|
+
return new _(this.root, i.start, i.end);
|
|
1742
1742
|
}
|
|
1743
1743
|
}
|
|
1744
|
-
function
|
|
1745
|
-
const e =
|
|
1744
|
+
function xt(r) {
|
|
1745
|
+
const e = r.tagName.toUpperCase();
|
|
1746
1746
|
return e === "IMG" || e === "VIDEO" || e === "AUDIO" || e === "IFRAME" || e === "OBJECT" || e === "EMBED" || e === "CANVAS";
|
|
1747
1747
|
}
|
|
1748
|
-
function
|
|
1748
|
+
function le(r, e) {
|
|
1749
1749
|
try {
|
|
1750
|
-
const t = e.locations,
|
|
1751
|
-
if (
|
|
1752
|
-
let
|
|
1753
|
-
t && t.getCssSelector() && (
|
|
1754
|
-
const
|
|
1755
|
-
prefix:
|
|
1756
|
-
suffix:
|
|
1750
|
+
const t = e.locations, i = e.text;
|
|
1751
|
+
if (i && i.highlight) {
|
|
1752
|
+
let s;
|
|
1753
|
+
t && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), s || (s = r.body);
|
|
1754
|
+
const n = new X(s, i.highlight, {
|
|
1755
|
+
prefix: i.before,
|
|
1756
|
+
suffix: i.after
|
|
1757
1757
|
});
|
|
1758
1758
|
try {
|
|
1759
|
-
return
|
|
1759
|
+
return n.toRange();
|
|
1760
1760
|
} catch {
|
|
1761
|
-
return console.warn("Quote not found:",
|
|
1761
|
+
return console.warn("Quote not found:", n), null;
|
|
1762
1762
|
}
|
|
1763
1763
|
}
|
|
1764
1764
|
if (t) {
|
|
1765
|
-
let
|
|
1766
|
-
if (!
|
|
1767
|
-
for (const
|
|
1768
|
-
if (
|
|
1765
|
+
let s = null;
|
|
1766
|
+
if (!s && t.getCssSelector() && (s = r.querySelector(t.getCssSelector())), !s && t.fragments) {
|
|
1767
|
+
for (const n of t.fragments)
|
|
1768
|
+
if (s = r.getElementById(n), s)
|
|
1769
1769
|
break;
|
|
1770
1770
|
}
|
|
1771
|
-
if (
|
|
1772
|
-
const
|
|
1773
|
-
return
|
|
1771
|
+
if (s) {
|
|
1772
|
+
const n = r.createRange();
|
|
1773
|
+
return s.childNodes.length === 0 || xt(s) ? (n.selectNode(s), n) : (n.setStartBefore(s), n.setEndAfter(s), n);
|
|
1774
1774
|
}
|
|
1775
1775
|
}
|
|
1776
1776
|
} catch (t) {
|
|
@@ -1778,474 +1778,236 @@ function Ae(i, e) {
|
|
|
1778
1778
|
}
|
|
1779
1779
|
return null;
|
|
1780
1780
|
}
|
|
1781
|
-
function
|
|
1782
|
-
let t =
|
|
1783
|
-
t.length ||
|
|
1784
|
-
const
|
|
1785
|
-
for (const
|
|
1786
|
-
|
|
1787
|
-
bottom:
|
|
1788
|
-
height:
|
|
1789
|
-
left:
|
|
1790
|
-
right:
|
|
1791
|
-
top:
|
|
1792
|
-
width:
|
|
1781
|
+
function St(r, e) {
|
|
1782
|
+
let t = r.getClientRects();
|
|
1783
|
+
t.length || r.commonAncestorContainer.nodeType === Node.ELEMENT_NODE && (t = r.commonAncestorContainer.getClientRects());
|
|
1784
|
+
const i = 1, s = [];
|
|
1785
|
+
for (const h of t)
|
|
1786
|
+
s.push({
|
|
1787
|
+
bottom: h.bottom,
|
|
1788
|
+
height: h.height,
|
|
1789
|
+
left: h.left,
|
|
1790
|
+
right: h.right,
|
|
1791
|
+
top: h.top,
|
|
1792
|
+
width: h.width
|
|
1793
1793
|
});
|
|
1794
|
-
const
|
|
1795
|
-
|
|
1796
|
-
|
|
1794
|
+
const n = He(
|
|
1795
|
+
s,
|
|
1796
|
+
i,
|
|
1797
1797
|
e
|
|
1798
|
-
), o =
|
|
1799
|
-
for (let
|
|
1800
|
-
const u = a[
|
|
1801
|
-
if (!(u.width * u.height >
|
|
1798
|
+
), o = Tt(n, i), a = $e(o), c = 2 * 2;
|
|
1799
|
+
for (let h = a.length - 1; h >= 0; h--) {
|
|
1800
|
+
const u = a[h];
|
|
1801
|
+
if (!(u.width * u.height > c))
|
|
1802
1802
|
if (a.length > 1)
|
|
1803
|
-
a.splice(
|
|
1803
|
+
a.splice(h, 1);
|
|
1804
1804
|
else
|
|
1805
1805
|
break;
|
|
1806
1806
|
}
|
|
1807
1807
|
return a;
|
|
1808
1808
|
}
|
|
1809
|
-
function
|
|
1810
|
-
for (let
|
|
1811
|
-
for (let
|
|
1812
|
-
const
|
|
1813
|
-
if (
|
|
1809
|
+
function He(r, e, t) {
|
|
1810
|
+
for (let i = 0; i < r.length; i++)
|
|
1811
|
+
for (let s = i + 1; s < r.length; s++) {
|
|
1812
|
+
const n = r[i], o = r[s];
|
|
1813
|
+
if (n === o)
|
|
1814
1814
|
continue;
|
|
1815
|
-
const a = N(
|
|
1816
|
-
if ((
|
|
1817
|
-
const d =
|
|
1818
|
-
return d.push(f),
|
|
1815
|
+
const a = N(n.top, o.top, e) && N(n.bottom, o.bottom, e), c = N(n.left, o.left, e) && N(n.right, o.right, e);
|
|
1816
|
+
if ((c && !t || a && !c) && je(n, o, e)) {
|
|
1817
|
+
const d = r.filter((g) => g !== n && g !== o), f = wt(n, o);
|
|
1818
|
+
return d.push(f), He(
|
|
1819
1819
|
d,
|
|
1820
1820
|
e,
|
|
1821
1821
|
t
|
|
1822
1822
|
);
|
|
1823
1823
|
}
|
|
1824
1824
|
}
|
|
1825
|
-
return
|
|
1825
|
+
return r;
|
|
1826
1826
|
}
|
|
1827
|
-
function
|
|
1828
|
-
const t = Math.min(
|
|
1827
|
+
function wt(r, e) {
|
|
1828
|
+
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
1829
|
return {
|
|
1830
|
-
bottom:
|
|
1831
|
-
height:
|
|
1830
|
+
bottom: n,
|
|
1831
|
+
height: n - s,
|
|
1832
1832
|
left: t,
|
|
1833
|
-
right:
|
|
1834
|
-
top:
|
|
1835
|
-
width:
|
|
1833
|
+
right: i,
|
|
1834
|
+
top: s,
|
|
1835
|
+
width: i - t
|
|
1836
1836
|
};
|
|
1837
1837
|
}
|
|
1838
|
-
function
|
|
1839
|
-
const t = new Set(
|
|
1840
|
-
for (const
|
|
1841
|
-
if (!(
|
|
1842
|
-
t.delete(
|
|
1838
|
+
function Tt(r, e) {
|
|
1839
|
+
const t = new Set(r);
|
|
1840
|
+
for (const i of r) {
|
|
1841
|
+
if (!(i.width > 1 && i.height > 1)) {
|
|
1842
|
+
t.delete(i);
|
|
1843
1843
|
continue;
|
|
1844
1844
|
}
|
|
1845
|
-
for (const
|
|
1846
|
-
if (
|
|
1847
|
-
t.delete(
|
|
1845
|
+
for (const n of r)
|
|
1846
|
+
if (i !== n && t.has(n) && Ct(n, i, e)) {
|
|
1847
|
+
t.delete(i);
|
|
1848
1848
|
break;
|
|
1849
1849
|
}
|
|
1850
1850
|
}
|
|
1851
1851
|
return Array.from(t);
|
|
1852
1852
|
}
|
|
1853
|
-
function
|
|
1854
|
-
return
|
|
1853
|
+
function Ct(r, e, t) {
|
|
1854
|
+
return $(r, e.left, e.top, t) && $(r, e.right, e.top, t) && $(r, e.left, e.bottom, t) && $(r, e.right, e.bottom, t);
|
|
1855
1855
|
}
|
|
1856
|
-
function
|
|
1857
|
-
return (
|
|
1856
|
+
function $(r, e, t, i) {
|
|
1857
|
+
return (r.left < e || N(r.left, e, i)) && (r.right > e || N(r.right, e, i)) && (r.top < t || N(r.top, t, i)) && (r.bottom > t || N(r.bottom, t, i));
|
|
1858
1858
|
}
|
|
1859
|
-
function
|
|
1860
|
-
for (let e = 0; e <
|
|
1861
|
-
for (let t = e + 1; t <
|
|
1862
|
-
const
|
|
1863
|
-
if (
|
|
1864
|
-
let
|
|
1865
|
-
const a =
|
|
1859
|
+
function $e(r) {
|
|
1860
|
+
for (let e = 0; e < r.length; e++)
|
|
1861
|
+
for (let t = e + 1; t < r.length; t++) {
|
|
1862
|
+
const i = r[e], s = r[t];
|
|
1863
|
+
if (i !== s && je(i, s, -1)) {
|
|
1864
|
+
let n = [], o;
|
|
1865
|
+
const a = Ce(i, s);
|
|
1866
1866
|
if (a.length === 1)
|
|
1867
|
-
|
|
1867
|
+
n = a, o = i;
|
|
1868
1868
|
else {
|
|
1869
|
-
const
|
|
1870
|
-
a.length <
|
|
1869
|
+
const h = Ce(s, i);
|
|
1870
|
+
a.length < h.length ? (n = a, o = i) : (n = h, o = s);
|
|
1871
1871
|
}
|
|
1872
|
-
const
|
|
1873
|
-
return Array.prototype.push.apply(
|
|
1872
|
+
const c = r.filter((h) => h !== o);
|
|
1873
|
+
return Array.prototype.push.apply(c, n), $e(c);
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
return
|
|
1876
|
+
return r;
|
|
1877
1877
|
}
|
|
1878
|
-
function
|
|
1879
|
-
const t =
|
|
1878
|
+
function Ce(r, e) {
|
|
1879
|
+
const t = Pt(e, r);
|
|
1880
1880
|
if (t.height === 0 || t.width === 0)
|
|
1881
|
-
return [
|
|
1882
|
-
const
|
|
1881
|
+
return [r];
|
|
1882
|
+
const i = [];
|
|
1883
1883
|
{
|
|
1884
|
-
const
|
|
1885
|
-
bottom:
|
|
1884
|
+
const s = {
|
|
1885
|
+
bottom: r.bottom,
|
|
1886
1886
|
height: 0,
|
|
1887
|
-
left:
|
|
1887
|
+
left: r.left,
|
|
1888
1888
|
right: t.left,
|
|
1889
|
-
top:
|
|
1889
|
+
top: r.top,
|
|
1890
1890
|
width: 0
|
|
1891
1891
|
};
|
|
1892
|
-
|
|
1892
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1893
1893
|
}
|
|
1894
1894
|
{
|
|
1895
|
-
const
|
|
1895
|
+
const s = {
|
|
1896
1896
|
bottom: t.top,
|
|
1897
1897
|
height: 0,
|
|
1898
1898
|
left: t.left,
|
|
1899
1899
|
right: t.right,
|
|
1900
|
-
top:
|
|
1900
|
+
top: r.top,
|
|
1901
1901
|
width: 0
|
|
1902
1902
|
};
|
|
1903
|
-
|
|
1903
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1904
1904
|
}
|
|
1905
1905
|
{
|
|
1906
|
-
const
|
|
1907
|
-
bottom:
|
|
1906
|
+
const s = {
|
|
1907
|
+
bottom: r.bottom,
|
|
1908
1908
|
height: 0,
|
|
1909
1909
|
left: t.left,
|
|
1910
1910
|
right: t.right,
|
|
1911
1911
|
top: t.bottom,
|
|
1912
1912
|
width: 0
|
|
1913
1913
|
};
|
|
1914
|
-
|
|
1914
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1915
1915
|
}
|
|
1916
1916
|
{
|
|
1917
|
-
const
|
|
1918
|
-
bottom:
|
|
1917
|
+
const s = {
|
|
1918
|
+
bottom: r.bottom,
|
|
1919
1919
|
height: 0,
|
|
1920
1920
|
left: t.right,
|
|
1921
|
-
right:
|
|
1922
|
-
top:
|
|
1921
|
+
right: r.right,
|
|
1922
|
+
top: r.top,
|
|
1923
1923
|
width: 0
|
|
1924
1924
|
};
|
|
1925
|
-
|
|
1925
|
+
s.width = s.right - s.left, s.height = s.bottom - s.top, s.height !== 0 && s.width !== 0 && i.push(s);
|
|
1926
1926
|
}
|
|
1927
|
-
return
|
|
1927
|
+
return i;
|
|
1928
1928
|
}
|
|
1929
|
-
function
|
|
1930
|
-
const t = Math.max(
|
|
1929
|
+
function Pt(r, e) {
|
|
1930
|
+
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
1931
|
return {
|
|
1932
|
-
bottom:
|
|
1933
|
-
height: Math.max(0,
|
|
1932
|
+
bottom: n,
|
|
1933
|
+
height: Math.max(0, n - s),
|
|
1934
1934
|
left: t,
|
|
1935
|
-
right:
|
|
1936
|
-
top:
|
|
1937
|
-
width: Math.max(0,
|
|
1935
|
+
right: i,
|
|
1936
|
+
top: s,
|
|
1937
|
+
width: Math.max(0, i - t)
|
|
1938
1938
|
};
|
|
1939
1939
|
}
|
|
1940
|
-
function
|
|
1941
|
-
return (
|
|
1940
|
+
function je(r, e, t) {
|
|
1941
|
+
return (r.left < e.right || t >= 0 && N(r.left, e.right, t)) && (e.left < r.right || t >= 0 && N(e.left, r.right, t)) && (r.top < e.bottom || t >= 0 && N(r.top, e.bottom, t)) && (e.top < r.bottom || t >= 0 && N(e.top, r.bottom, t));
|
|
1942
1942
|
}
|
|
1943
|
-
function N(
|
|
1944
|
-
return Math.abs(
|
|
1943
|
+
function N(r, e, t) {
|
|
1944
|
+
return Math.abs(r - e) <= t;
|
|
1945
1945
|
}
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
}, ti = function() {
|
|
1951
|
-
return U.some(function(i) {
|
|
1952
|
-
return i.skippedTargets.length > 0;
|
|
1953
|
-
});
|
|
1954
|
-
}, Ue = "ResizeObserver loop completed with undelivered notifications.", ii = function() {
|
|
1955
|
-
var i;
|
|
1956
|
-
typeof ErrorEvent == "function" ? i = new ErrorEvent("error", {
|
|
1957
|
-
message: Ue
|
|
1958
|
-
}) : (i = document.createEvent("Event"), i.initEvent("error", !1, !1), i.message = Ue), window.dispatchEvent(i);
|
|
1959
|
-
}, J;
|
|
1960
|
-
(function(i) {
|
|
1961
|
-
i.BORDER_BOX = "border-box", i.CONTENT_BOX = "content-box", i.DEVICE_PIXEL_CONTENT_BOX = "device-pixel-content-box";
|
|
1962
|
-
})(J || (J = {}));
|
|
1963
|
-
var H = function(i) {
|
|
1964
|
-
return Object.freeze(i);
|
|
1965
|
-
}, ri = function() {
|
|
1966
|
-
function i(e, t) {
|
|
1967
|
-
this.inlineSize = e, this.blockSize = t, H(this);
|
|
1968
|
-
}
|
|
1969
|
-
return i;
|
|
1970
|
-
}(), ct = function() {
|
|
1971
|
-
function i(e, t, r, n) {
|
|
1972
|
-
return this.x = e, this.y = t, this.width = r, this.height = n, this.top = this.y, this.left = this.x, this.bottom = this.top + this.height, this.right = this.left + this.width, H(this);
|
|
1973
|
-
}
|
|
1974
|
-
return i.prototype.toJSON = function() {
|
|
1975
|
-
var e = this, t = e.x, r = e.y, n = e.top, s = e.right, o = e.bottom, a = e.left, h = e.width, c = e.height;
|
|
1976
|
-
return { x: t, y: r, top: n, right: s, bottom: o, left: a, width: h, height: c };
|
|
1977
|
-
}, i.fromRect = function(e) {
|
|
1978
|
-
return new i(e.x, e.y, e.width, e.height);
|
|
1979
|
-
}, i;
|
|
1980
|
-
}(), Ne = function(i) {
|
|
1981
|
-
return i instanceof SVGElement && "getBBox" in i;
|
|
1982
|
-
}, ut = function(i) {
|
|
1983
|
-
if (Ne(i)) {
|
|
1984
|
-
var e = i.getBBox(), t = e.width, r = e.height;
|
|
1985
|
-
return !t && !r;
|
|
1986
|
-
}
|
|
1987
|
-
var n = i, s = n.offsetWidth, o = n.offsetHeight;
|
|
1988
|
-
return !(s || o || i.getClientRects().length);
|
|
1989
|
-
}, He = function(i) {
|
|
1990
|
-
var e;
|
|
1991
|
-
if (i instanceof Element)
|
|
1992
|
-
return !0;
|
|
1993
|
-
var t = (e = i == null ? void 0 : i.ownerDocument) === null || e === void 0 ? void 0 : e.defaultView;
|
|
1994
|
-
return !!(t && i instanceof t.Element);
|
|
1995
|
-
}, ni = function(i) {
|
|
1996
|
-
switch (i.tagName) {
|
|
1997
|
-
case "INPUT":
|
|
1998
|
-
if (i.type !== "image")
|
|
1999
|
-
break;
|
|
2000
|
-
case "VIDEO":
|
|
2001
|
-
case "AUDIO":
|
|
2002
|
-
case "EMBED":
|
|
2003
|
-
case "OBJECT":
|
|
2004
|
-
case "CANVAS":
|
|
2005
|
-
case "IFRAME":
|
|
2006
|
-
case "IMG":
|
|
2007
|
-
return !0;
|
|
2008
|
-
}
|
|
2009
|
-
return !1;
|
|
2010
|
-
}, Y = typeof window < "u" ? window : {}, ie = /* @__PURE__ */ new WeakMap(), $e = /auto|scroll/, si = /^tb|vertical/, oi = /msie|trident/i.test(Y.navigator && Y.navigator.userAgent), R = function(i) {
|
|
2011
|
-
return parseFloat(i || "0");
|
|
2012
|
-
}, q = function(i, e, t) {
|
|
2013
|
-
return i === void 0 && (i = 0), e === void 0 && (e = 0), t === void 0 && (t = !1), new ri((t ? e : i) || 0, (t ? i : e) || 0);
|
|
2014
|
-
}, Ve = H({
|
|
2015
|
-
devicePixelContentBoxSize: q(),
|
|
2016
|
-
borderBoxSize: q(),
|
|
2017
|
-
contentBoxSize: q(),
|
|
2018
|
-
contentRect: new ct(0, 0, 0, 0)
|
|
2019
|
-
}), dt = function(i, e) {
|
|
2020
|
-
if (e === void 0 && (e = !1), ie.has(i) && !e)
|
|
2021
|
-
return ie.get(i);
|
|
2022
|
-
if (ut(i))
|
|
2023
|
-
return ie.set(i, Ve), Ve;
|
|
2024
|
-
var t = getComputedStyle(i), r = Ne(i) && i.ownerSVGElement && i.getBBox(), n = !oi && t.boxSizing === "border-box", s = si.test(t.writingMode || ""), o = !r && $e.test(t.overflowY || ""), a = !r && $e.test(t.overflowX || ""), h = r ? 0 : R(t.paddingTop), c = r ? 0 : R(t.paddingRight), u = r ? 0 : R(t.paddingBottom), p = r ? 0 : R(t.paddingLeft), d = 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 + u, S = g + f, m = d + v, E = a ? i.offsetHeight - m - i.clientHeight : 0, P = o ? i.offsetWidth - S - i.clientWidth : 0, K = n ? y + S : 0, Z = n ? x + m : 0, W = r ? r.width : R(t.width) - K - P, F = r ? r.height : R(t.height) - Z - E, Q = W + y + P + S, ee = F + x + E + m, $ = H({
|
|
2025
|
-
devicePixelContentBoxSize: q(Math.round(W * devicePixelRatio), Math.round(F * devicePixelRatio), s),
|
|
2026
|
-
borderBoxSize: q(Q, ee, s),
|
|
2027
|
-
contentBoxSize: q(W, F, s),
|
|
2028
|
-
contentRect: new ct(p, h, W, F)
|
|
2029
|
-
});
|
|
2030
|
-
return ie.set(i, $), $;
|
|
2031
|
-
}, pt = function(i, e, t) {
|
|
2032
|
-
var r = dt(i, t), n = r.borderBoxSize, s = r.contentBoxSize, o = r.devicePixelContentBoxSize;
|
|
2033
|
-
switch (e) {
|
|
2034
|
-
case J.DEVICE_PIXEL_CONTENT_BOX:
|
|
2035
|
-
return o;
|
|
2036
|
-
case J.BORDER_BOX:
|
|
2037
|
-
return n;
|
|
2038
|
-
default:
|
|
2039
|
-
return s;
|
|
2040
|
-
}
|
|
2041
|
-
}, ai = function() {
|
|
2042
|
-
function i(e) {
|
|
2043
|
-
var t = dt(e);
|
|
2044
|
-
this.target = e, this.contentRect = t.contentRect, this.borderBoxSize = H([t.borderBoxSize]), this.contentBoxSize = H([t.contentBoxSize]), this.devicePixelContentBoxSize = H([t.devicePixelContentBoxSize]);
|
|
2045
|
-
}
|
|
2046
|
-
return i;
|
|
2047
|
-
}(), ft = function(i) {
|
|
2048
|
-
if (ut(i))
|
|
2049
|
-
return 1 / 0;
|
|
2050
|
-
for (var e = 0, t = i.parentNode; t; )
|
|
2051
|
-
e += 1, t = t.parentNode;
|
|
1946
|
+
function Ve(r) {
|
|
1947
|
+
const e = {}, t = r.document.documentElement.style;
|
|
1948
|
+
for (const i in r.document.documentElement.style)
|
|
1949
|
+
Object.hasOwn(t, i) && !Number.isNaN(Number.parseInt(i)) && (e[t[i]] = t.getPropertyValue(t[i]));
|
|
2052
1950
|
return e;
|
|
2053
|
-
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
a.push(u), c.lastReportedSize = pt(c.target, c.observedBox), p < i && (i = p);
|
|
2061
|
-
}), e.push(function() {
|
|
2062
|
-
o.callback.call(o.observer, a, o.observer);
|
|
2063
|
-
}), o.activeTargets.splice(0, o.activeTargets.length);
|
|
2064
|
-
}
|
|
2065
|
-
});
|
|
2066
|
-
for (var t = 0, r = e; t < r.length; t++) {
|
|
2067
|
-
var n = r[t];
|
|
2068
|
-
n();
|
|
2069
|
-
}
|
|
2070
|
-
return i;
|
|
2071
|
-
}, qe = function(i) {
|
|
2072
|
-
U.forEach(function(t) {
|
|
2073
|
-
t.activeTargets.splice(0, t.activeTargets.length), t.skippedTargets.splice(0, t.skippedTargets.length), t.observationTargets.forEach(function(n) {
|
|
2074
|
-
n.isActive() && (ft(n.target) > i ? t.activeTargets.push(n) : t.skippedTargets.push(n));
|
|
2075
|
-
});
|
|
2076
|
-
});
|
|
2077
|
-
}, hi = function() {
|
|
2078
|
-
var i = 0;
|
|
2079
|
-
for (qe(i); ei(); )
|
|
2080
|
-
i = li(), qe(i);
|
|
2081
|
-
return ti() && ii(), i > 0;
|
|
2082
|
-
}, fe, mt = [], ci = function() {
|
|
2083
|
-
return mt.splice(0).forEach(function(i) {
|
|
2084
|
-
return i();
|
|
2085
|
-
});
|
|
2086
|
-
}, ui = function(i) {
|
|
2087
|
-
if (!fe) {
|
|
2088
|
-
var e = 0, t = document.createTextNode(""), r = { characterData: !0 };
|
|
2089
|
-
new MutationObserver(function() {
|
|
2090
|
-
return ci();
|
|
2091
|
-
}).observe(t, r), fe = function() {
|
|
2092
|
-
t.textContent = "".concat(e ? e-- : e++);
|
|
2093
|
-
};
|
|
2094
|
-
}
|
|
2095
|
-
mt.push(i), fe();
|
|
2096
|
-
}, di = function(i) {
|
|
2097
|
-
ui(function() {
|
|
2098
|
-
requestAnimationFrame(i);
|
|
1951
|
+
}
|
|
1952
|
+
function Nt(r, e) {
|
|
1953
|
+
const t = Ve(r);
|
|
1954
|
+
Object.keys(t).forEach((i) => {
|
|
1955
|
+
e.hasOwnProperty(i) || he(r, i);
|
|
1956
|
+
}), Object.entries(e).forEach(([i, s]) => {
|
|
1957
|
+
t[i] !== s && G(r, i, s);
|
|
2099
1958
|
});
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
"
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
],
|
|
2118
|
-
|
|
2119
|
-
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
return
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
if (me = !1, e = r - je(), !pi())
|
|
2137
|
-
return;
|
|
2138
|
-
n ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
|
|
2139
|
-
}
|
|
2140
|
-
});
|
|
2141
|
-
}
|
|
2142
|
-
}, i.prototype.schedule = function() {
|
|
2143
|
-
this.stop(), this.run();
|
|
2144
|
-
}, i.prototype.observe = function() {
|
|
2145
|
-
var e = this, t = function() {
|
|
2146
|
-
return e.observer && e.observer.observe(document.body, mi);
|
|
2147
|
-
};
|
|
2148
|
-
document.body ? t() : Y.addEventListener("DOMContentLoaded", t);
|
|
2149
|
-
}, i.prototype.start = function() {
|
|
2150
|
-
var e = this;
|
|
2151
|
-
this.stopped && (this.stopped = !1, this.observer = new MutationObserver(this.listener), this.observe(), _e.forEach(function(t) {
|
|
2152
|
-
return Y.addEventListener(t, e.listener, !0);
|
|
2153
|
-
}));
|
|
2154
|
-
}, i.prototype.stop = function() {
|
|
2155
|
-
var e = this;
|
|
2156
|
-
this.stopped || (this.observer && this.observer.disconnect(), _e.forEach(function(t) {
|
|
2157
|
-
return Y.removeEventListener(t, e.listener, !0);
|
|
2158
|
-
}), this.stopped = !0);
|
|
2159
|
-
}, i;
|
|
2160
|
-
}(), ve = new gi(), Xe = function(i) {
|
|
2161
|
-
!oe && i > 0 && ve.start(), oe += i, !oe && ve.stop();
|
|
2162
|
-
}, vi = function(i) {
|
|
2163
|
-
return !Ne(i) && !ni(i) && getComputedStyle(i).display === "inline";
|
|
2164
|
-
}, yi = function() {
|
|
2165
|
-
function i(e, t) {
|
|
2166
|
-
this.target = e, this.observedBox = t || J.CONTENT_BOX, this.lastReportedSize = {
|
|
2167
|
-
inlineSize: 0,
|
|
2168
|
-
blockSize: 0
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
return i.prototype.isActive = function() {
|
|
2172
|
-
var e = pt(this.target, this.observedBox, !0);
|
|
2173
|
-
return vi(this.target) && (this.lastReportedSize = e), this.lastReportedSize.inlineSize !== e.inlineSize || this.lastReportedSize.blockSize !== e.blockSize;
|
|
2174
|
-
}, i;
|
|
2175
|
-
}(), bi = function() {
|
|
2176
|
-
function i(e, t) {
|
|
2177
|
-
this.activeTargets = [], this.skippedTargets = [], this.observationTargets = [], this.observer = e, this.callback = t;
|
|
1959
|
+
}
|
|
1960
|
+
function Pe(r, e) {
|
|
1961
|
+
return r.document.documentElement.style.getPropertyValue(e);
|
|
1962
|
+
}
|
|
1963
|
+
function G(r, e, t) {
|
|
1964
|
+
r.document.documentElement.style.setProperty(e, t);
|
|
1965
|
+
}
|
|
1966
|
+
function he(r, e) {
|
|
1967
|
+
r.document.documentElement.style.removeProperty(e);
|
|
1968
|
+
}
|
|
1969
|
+
const At = (r) => {
|
|
1970
|
+
if (r.startsWith("rgb")) {
|
|
1971
|
+
const e = r.match(/rgb\((\d+),\s(\d+),\s(\d+)(?:,\s(\d+))?\)/);
|
|
1972
|
+
if (e)
|
|
1973
|
+
return {
|
|
1974
|
+
r: parseInt(e[1], 10),
|
|
1975
|
+
g: parseInt(e[2], 10),
|
|
1976
|
+
b: parseInt(e[3], 10),
|
|
1977
|
+
a: e[4] ? parseInt(e[4], 10) / 255 : 1
|
|
1978
|
+
};
|
|
1979
|
+
} else if (r.startsWith("#")) {
|
|
1980
|
+
const e = r.slice(1);
|
|
1981
|
+
if (e.length === 3 || e.length === 4)
|
|
1982
|
+
return {
|
|
1983
|
+
r: parseInt(e[0] + e[0], 16) / 255,
|
|
1984
|
+
g: parseInt(e[1] + e[1], 16) / 255,
|
|
1985
|
+
b: parseInt(e[2] + e[2], 16) / 255,
|
|
1986
|
+
a: e.length === 4 ? parseInt(e[3] + e[3], 16) / 255 : 1
|
|
1987
|
+
};
|
|
1988
|
+
if (e.length === 6 || e.length === 8)
|
|
1989
|
+
return {
|
|
1990
|
+
r: parseInt(e[0] + e[1], 16) / 255,
|
|
1991
|
+
g: parseInt(e[2] + e[3], 16) / 255,
|
|
1992
|
+
b: parseInt(e[4] + e[5], 16) / 255,
|
|
1993
|
+
a: e.length === 8 ? parseInt(e[6] + e[7], 16) / 255 : 1
|
|
1994
|
+
};
|
|
2178
1995
|
}
|
|
2179
|
-
return
|
|
2180
|
-
}
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
}
|
|
2188
|
-
return i.connect = function(e, t) {
|
|
2189
|
-
var r = new bi(e, t);
|
|
2190
|
-
re.set(e, r);
|
|
2191
|
-
}, i.observe = function(e, t, r) {
|
|
2192
|
-
var n = re.get(e), s = n.observationTargets.length === 0;
|
|
2193
|
-
Ge(n.observationTargets, t) < 0 && (s && U.push(n), n.observationTargets.push(new yi(t, r && r.box)), Xe(1), ve.schedule());
|
|
2194
|
-
}, i.unobserve = function(e, t) {
|
|
2195
|
-
var r = re.get(e), n = Ge(r.observationTargets, t), s = r.observationTargets.length === 1;
|
|
2196
|
-
n >= 0 && (s && U.splice(U.indexOf(r), 1), r.observationTargets.splice(n, 1), Xe(-1));
|
|
2197
|
-
}, i.disconnect = function(e) {
|
|
2198
|
-
var t = this, r = re.get(e);
|
|
2199
|
-
r.observationTargets.slice().forEach(function(n) {
|
|
2200
|
-
return t.unobserve(e, n.target);
|
|
2201
|
-
}), r.activeTargets.splice(0, r.activeTargets.length);
|
|
2202
|
-
}, i;
|
|
2203
|
-
}(), gt = function() {
|
|
2204
|
-
function i(e) {
|
|
2205
|
-
if (arguments.length === 0)
|
|
2206
|
-
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2207
|
-
if (typeof e != "function")
|
|
2208
|
-
throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");
|
|
2209
|
-
ne.connect(this, e);
|
|
2210
|
-
}
|
|
2211
|
-
return i.prototype.observe = function(e, t) {
|
|
2212
|
-
if (arguments.length === 0)
|
|
2213
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2214
|
-
if (!He(e))
|
|
2215
|
-
throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2216
|
-
ne.observe(this, e, t);
|
|
2217
|
-
}, i.prototype.unobserve = function(e) {
|
|
2218
|
-
if (arguments.length === 0)
|
|
2219
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
2220
|
-
if (!He(e))
|
|
2221
|
-
throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");
|
|
2222
|
-
ne.unobserve(this, e);
|
|
2223
|
-
}, i.prototype.disconnect = function() {
|
|
2224
|
-
ne.disconnect(this);
|
|
2225
|
-
}, i.toString = function() {
|
|
2226
|
-
return "function ResizeObserver () { [polyfill code] }";
|
|
2227
|
-
}, i;
|
|
2228
|
-
}();
|
|
2229
|
-
function Ei(i, e) {
|
|
2230
|
-
return i.document.documentElement.style.getPropertyValue(e);
|
|
2231
|
-
}
|
|
2232
|
-
function ye(i, e, t) {
|
|
2233
|
-
i.document.documentElement.style.setProperty(e, t);
|
|
2234
|
-
}
|
|
2235
|
-
function vt(i, e) {
|
|
2236
|
-
i.document.documentElement.style.removeProperty(e);
|
|
2237
|
-
}
|
|
2238
|
-
const xi = window.ResizeObserver || gt;
|
|
2239
|
-
var wi = /* @__PURE__ */ ((i) => (i.Wrap = "wrap", i.Viewport = "viewport", i.Bounds = "bounds", i.Page = "page", i))(wi || {}), Ti = /* @__PURE__ */ ((i) => (i.Boxes = "boxes", i.Bounds = "bounds", i))(Ti || {});
|
|
2240
|
-
const Si = "Highlight" in window, Ye = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2241
|
-
class Ci {
|
|
1996
|
+
return { r: 0, g: 0, b: 0, a: 1 };
|
|
1997
|
+
}, Mt = (r) => 0.2126 * r.r * r.a + 0.7152 * r.g * r.a + 0.0722 * r.b * r.a, Ot = (r) => {
|
|
1998
|
+
const e = At(r);
|
|
1999
|
+
return Mt(e) < 128;
|
|
2000
|
+
};
|
|
2001
|
+
var It = /* @__PURE__ */ ((r) => (r.Wrap = "wrap", r.Viewport = "viewport", r.Bounds = "bounds", r.Page = "page", r))(It || {}), Lt = /* @__PURE__ */ ((r) => (r.Boxes = "boxes", r.Bounds = "bounds", r))(Lt || {});
|
|
2002
|
+
const Rt = "Highlight" in window, Ne = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
2003
|
+
class zt {
|
|
2242
2004
|
/**
|
|
2243
2005
|
* Creates a DecorationGroup object
|
|
2244
2006
|
* @param id Unique HTML ID-adhering name of the group
|
|
2245
2007
|
* @param name Human-readable name of the group
|
|
2246
2008
|
*/
|
|
2247
|
-
constructor(e, t,
|
|
2248
|
-
this.wnd = e, this.comms = t, this.id =
|
|
2009
|
+
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, Rt && (this.experimentalHighlights = !0, this.notTextFlag = /* @__PURE__ */ new Map());
|
|
2249
2011
|
}
|
|
2250
2012
|
get activeable() {
|
|
2251
2013
|
return this.activateable;
|
|
@@ -2258,36 +2020,36 @@ class Ci {
|
|
|
2258
2020
|
* @param decoration Decoration to add
|
|
2259
2021
|
*/
|
|
2260
2022
|
add(e) {
|
|
2261
|
-
var o, a,
|
|
2262
|
-
const t = `${this.id}-${this.lastItemId++}`,
|
|
2263
|
-
if (!
|
|
2023
|
+
var o, a, c, h;
|
|
2024
|
+
const t = `${this.id}-${this.lastItemId++}`, i = le(this.wnd.document, e.locator);
|
|
2025
|
+
if (!i) {
|
|
2264
2026
|
this.comms.log("Can't locate DOM range for decoration", e);
|
|
2265
2027
|
return;
|
|
2266
2028
|
}
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2029
|
+
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()) && ((a = this.notTextFlag) == null || a.set(t, !0)), (((c = s.textContent) == null ? void 0 : c.trim()) || "").length === 0 && ((h = this.notTextFlag) == null || h.set(t, !0)));
|
|
2031
|
+
const n = {
|
|
2270
2032
|
decoration: e,
|
|
2271
2033
|
id: t,
|
|
2272
|
-
range:
|
|
2034
|
+
range: i
|
|
2273
2035
|
};
|
|
2274
|
-
this.items.push(
|
|
2036
|
+
this.items.push(n), this.layout(n), this.renderLayout([n]);
|
|
2275
2037
|
}
|
|
2276
2038
|
/**
|
|
2277
2039
|
* Removes the decoration with given ID from the group.
|
|
2278
2040
|
* @param identifier ID of item to remove
|
|
2279
2041
|
*/
|
|
2280
2042
|
remove(e) {
|
|
2281
|
-
var
|
|
2043
|
+
var s, n;
|
|
2282
2044
|
const t = this.items.findIndex((o) => o.decoration.id === e);
|
|
2283
2045
|
if (t < 0)
|
|
2284
2046
|
return;
|
|
2285
|
-
const
|
|
2286
|
-
if (this.items.splice(t, 1),
|
|
2047
|
+
const i = this.items[t];
|
|
2048
|
+
if (this.items.splice(t, 1), i.clickableElements = void 0, i.container && (i.container.remove(), i.container = void 0), this.experimentalHighlights && !((s = this.notTextFlag) != null && s.has(i.id))) {
|
|
2287
2049
|
const o = this.wnd.CSS.highlights.get(this.id);
|
|
2288
|
-
o == null || o.delete(
|
|
2050
|
+
o == null || o.delete(i.range);
|
|
2289
2051
|
}
|
|
2290
|
-
(
|
|
2052
|
+
(n = this.notTextFlag) == null || n.delete(i.id);
|
|
2291
2053
|
}
|
|
2292
2054
|
/**
|
|
2293
2055
|
* Notifies that the given decoration was modified and needs to be updated.
|
|
@@ -2311,12 +2073,12 @@ class Ci {
|
|
|
2311
2073
|
this.wnd.cancelAnimationFrame(this.currentRender), this.clearContainer(), this.items.forEach((e) => this.layout(e)), this.renderLayout(this.items);
|
|
2312
2074
|
}
|
|
2313
2075
|
experimentalLayout(e) {
|
|
2314
|
-
var
|
|
2315
|
-
const [t,
|
|
2316
|
-
|
|
2076
|
+
var s, n;
|
|
2077
|
+
const [t, i] = this.requireContainer(!0);
|
|
2078
|
+
i.add(e.range), t.innerHTML = `
|
|
2317
2079
|
::highlight(${this.id}) {
|
|
2318
2080
|
color: black;
|
|
2319
|
-
background-color: ${((
|
|
2081
|
+
background-color: ${((n = (s = e.decoration) == null ? void 0 : s.style) == null ? void 0 : n.tint) ?? "yellow"};
|
|
2320
2082
|
}`;
|
|
2321
2083
|
}
|
|
2322
2084
|
/**
|
|
@@ -2324,37 +2086,37 @@ class Ci {
|
|
|
2324
2086
|
* @param item
|
|
2325
2087
|
*/
|
|
2326
2088
|
layout(e) {
|
|
2327
|
-
var
|
|
2328
|
-
if (this.experimentalHighlights && !((
|
|
2089
|
+
var g, m, v, S, O;
|
|
2090
|
+
if (this.experimentalHighlights && !((g = this.notTextFlag) != null && g.has(e.id)))
|
|
2329
2091
|
return this.experimentalLayout(e);
|
|
2330
2092
|
const t = this.wnd.document.createElement("div");
|
|
2331
2093
|
t.setAttribute("id", e.id), t.style.setProperty("pointer-events", "none");
|
|
2332
|
-
const
|
|
2094
|
+
const i = this.wnd.innerWidth, s = parseInt(
|
|
2333
2095
|
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
2334
2096
|
"column-count"
|
|
2335
2097
|
)
|
|
2336
|
-
),
|
|
2337
|
-
var
|
|
2338
|
-
if (
|
|
2339
|
-
|
|
2340
|
-
let
|
|
2341
|
-
|
|
2342
|
-
} else if (((
|
|
2343
|
-
|
|
2344
|
-
else if (((
|
|
2345
|
-
|
|
2346
|
-
let
|
|
2347
|
-
|
|
2098
|
+
), n = i / (s || 1), o = this.wnd.document.scrollingElement, a = o.scrollLeft, c = o.scrollTop, h = (y, b, I) => {
|
|
2099
|
+
var ce, ue, de, pe, fe, me;
|
|
2100
|
+
if (y.style.position = "absolute", ((ue = (ce = e.decoration) == null ? void 0 : ce.style) == null ? void 0 : ue.width) === "viewport") {
|
|
2101
|
+
y.style.width = `${i}px`, y.style.height = `${b.height}px`;
|
|
2102
|
+
let K = Math.floor(b.left / i) * i;
|
|
2103
|
+
y.style.left = `${K + a}px`, y.style.top = `${b.top + c}px`;
|
|
2104
|
+
} else if (((pe = (de = e.decoration) == null ? void 0 : de.style) == null ? void 0 : pe.width) === "bounds")
|
|
2105
|
+
y.style.width = `${I.width}px`, y.style.height = `${b.height}px`, y.style.left = `${I.left + a}px`, y.style.top = `${b.top + c}px`;
|
|
2106
|
+
else if (((me = (fe = e.decoration) == null ? void 0 : fe.style) == null ? void 0 : me.width) === "page") {
|
|
2107
|
+
y.style.width = `${n}px`, y.style.height = `${b.height}px`;
|
|
2108
|
+
let K = Math.floor(b.left / n) * n;
|
|
2109
|
+
y.style.left = `${K + a}px`, y.style.top = `${b.top + c}px`;
|
|
2348
2110
|
} else
|
|
2349
|
-
|
|
2111
|
+
y.style.width = `${b.width}px`, y.style.height = `${b.height}px`, y.style.left = `${b.left + a}px`, y.style.top = `${b.top + c}px`;
|
|
2350
2112
|
}, u = e.range.getBoundingClientRect();
|
|
2351
2113
|
let p = this.wnd.document.createElement("template");
|
|
2352
|
-
const d =
|
|
2114
|
+
const d = Pe(this.wnd, "--USER__appearance") === "readium-night-on" || Ot(Pe(this.wnd, "--USER__backgroundColor"));
|
|
2353
2115
|
p.innerHTML = `
|
|
2354
2116
|
<div
|
|
2355
2117
|
class="r2-highlight-0"
|
|
2356
2118
|
style="${[
|
|
2357
|
-
`background-color: ${((
|
|
2119
|
+
`background-color: ${((v = (m = e.decoration) == null ? void 0 : m.style) == null ? void 0 : v.tint) ?? "yellow"} !important`,
|
|
2358
2120
|
//"opacity: 0.3 !important",
|
|
2359
2121
|
`mix-blend-mode: ${d ? "exclusion" : "multiply"} !important`,
|
|
2360
2122
|
"opacity: 1 !important",
|
|
@@ -2364,19 +2126,19 @@ class Ci {
|
|
|
2364
2126
|
</div>
|
|
2365
2127
|
`.trim();
|
|
2366
2128
|
const f = p.content.firstElementChild;
|
|
2367
|
-
if (((
|
|
2368
|
-
const
|
|
2369
|
-
|
|
2129
|
+
if (((O = (S = e.decoration) == null ? void 0 : S.style) == null ? void 0 : O.layout) === "bounds") {
|
|
2130
|
+
const y = f.cloneNode(!0);
|
|
2131
|
+
y.style.setProperty("pointer-events", "none"), h(y, u, u), t.append(y);
|
|
2370
2132
|
} else {
|
|
2371
|
-
let
|
|
2133
|
+
let y = St(
|
|
2372
2134
|
e.range,
|
|
2373
2135
|
!0
|
|
2374
2136
|
// doNotMergeHorizontallyAlignedRects
|
|
2375
2137
|
);
|
|
2376
|
-
|
|
2377
|
-
for (let
|
|
2378
|
-
const
|
|
2379
|
-
|
|
2138
|
+
y = y.sort((b, I) => b.top < I.top ? -1 : b.top > I.top ? 1 : 0);
|
|
2139
|
+
for (let b of y) {
|
|
2140
|
+
const I = f.cloneNode(!0);
|
|
2141
|
+
I.style.setProperty("pointer-events", "none"), h(I, b, u), t.append(I);
|
|
2380
2142
|
}
|
|
2381
2143
|
}
|
|
2382
2144
|
e.container = t, e.clickableElements = Array.from(
|
|
@@ -2385,12 +2147,12 @@ class Ci {
|
|
|
2385
2147
|
}
|
|
2386
2148
|
renderLayout(e) {
|
|
2387
2149
|
this.wnd.cancelAnimationFrame(this.currentRender), this.currentRender = this.wnd.requestAnimationFrame(() => {
|
|
2388
|
-
if (e = e.filter((
|
|
2389
|
-
var
|
|
2390
|
-
return !this.experimentalHighlights || !!((
|
|
2150
|
+
if (e = e.filter((i) => {
|
|
2151
|
+
var s;
|
|
2152
|
+
return !this.experimentalHighlights || !!((s = this.notTextFlag) != null && s.has(i.id));
|
|
2391
2153
|
}), !e || e.length === 0)
|
|
2392
2154
|
return;
|
|
2393
|
-
this.requireContainer().append(...e.map((
|
|
2155
|
+
this.requireContainer().append(...e.map((i) => i.container).filter((i) => !!i));
|
|
2394
2156
|
});
|
|
2395
2157
|
}
|
|
2396
2158
|
/**
|
|
@@ -2401,8 +2163,8 @@ class Ci {
|
|
|
2401
2163
|
if (e) {
|
|
2402
2164
|
let t;
|
|
2403
2165
|
this.wnd.document.getElementById(`${this.id}-style`) ? t = this.wnd.document.getElementById(`${this.id}-style`) : (t = this.wnd.document.createElement("style"), t.dataset.readium = "true", t.id = `${this.id}-style`, this.wnd.document.head.appendChild(t));
|
|
2404
|
-
let
|
|
2405
|
-
return this.wnd.CSS.highlights.has(this.id) ?
|
|
2166
|
+
let i;
|
|
2167
|
+
return this.wnd.CSS.highlights.has(this.id) ? i = this.wnd.CSS.highlights.get(this.id) : (i = new this.wnd.Highlight(), this.wnd.CSS.highlights.set(this.id, i)), [t, i];
|
|
2406
2168
|
}
|
|
2407
2169
|
return this.container || (this.container = this.wnd.document.createElement("div"), this.container.setAttribute("id", this.id), this.container.dataset.group = this.name, this.container.dataset.readium = "true", this.container.style.setProperty("pointer-events", "none"), this.container.style.display = "contents", this.wnd.document.body.append(this.container)), this.container;
|
|
2408
2170
|
}
|
|
@@ -2413,7 +2175,7 @@ class Ci {
|
|
|
2413
2175
|
this.experimentalHighlights && this.wnd.CSS.highlights.delete(this.id), this.container && (this.container.remove(), this.container = void 0);
|
|
2414
2176
|
}
|
|
2415
2177
|
}
|
|
2416
|
-
const
|
|
2178
|
+
const qe = class Q extends Y {
|
|
2417
2179
|
constructor() {
|
|
2418
2180
|
super(...arguments), this.resizeFrame = 0, this.lastGroupId = 0, this.groups = /* @__PURE__ */ new Map(), this.handleResizer = this.handleResize.bind(this);
|
|
2419
2181
|
}
|
|
@@ -2428,39 +2190,39 @@ const yt = class be extends de {
|
|
|
2428
2190
|
}, 50);
|
|
2429
2191
|
}
|
|
2430
2192
|
mount(e, t) {
|
|
2431
|
-
return this.wnd = e, t.register("decorate",
|
|
2432
|
-
const
|
|
2433
|
-
|
|
2193
|
+
return this.wnd = e, t.register("decorate", Q.moduleName, (i, s) => {
|
|
2194
|
+
const n = i;
|
|
2195
|
+
n.decoration && n.decoration.locator && (n.decoration.locator = D.deserialize(n.decoration.locator)), this.groups.has(n.group) || this.groups.set(n.group, new zt(
|
|
2434
2196
|
e,
|
|
2435
2197
|
t,
|
|
2436
2198
|
`readium-decoration-${this.lastGroupId++}`,
|
|
2437
|
-
|
|
2199
|
+
n.group
|
|
2438
2200
|
));
|
|
2439
|
-
const o = this.groups.get(
|
|
2440
|
-
switch (
|
|
2201
|
+
const o = this.groups.get(n.group);
|
|
2202
|
+
switch (n.action) {
|
|
2441
2203
|
case "add":
|
|
2442
|
-
o == null || o.add(
|
|
2204
|
+
o == null || o.add(n.decoration);
|
|
2443
2205
|
break;
|
|
2444
2206
|
case "remove":
|
|
2445
|
-
o == null || o.remove(
|
|
2207
|
+
o == null || o.remove(n.decoration.id);
|
|
2446
2208
|
break;
|
|
2447
2209
|
case "clear":
|
|
2448
2210
|
o == null || o.clear();
|
|
2449
2211
|
break;
|
|
2450
2212
|
case "update":
|
|
2451
|
-
o == null || o.update(
|
|
2213
|
+
o == null || o.update(n.decoration);
|
|
2452
2214
|
break;
|
|
2453
2215
|
}
|
|
2454
|
-
|
|
2455
|
-
}), this.resizeObserver = new
|
|
2216
|
+
s(!0);
|
|
2217
|
+
}), 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;
|
|
2456
2218
|
}
|
|
2457
2219
|
unmount(e, t) {
|
|
2458
|
-
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(
|
|
2220
|
+
return e.removeEventListener("orientationchange", this.handleResizer), e.removeEventListener("resize", this.handleResizer), t.unregisterAll(Q.moduleName), this.resizeObserver.disconnect(), this.cleanup(), t.log("Decorator Unmounted"), !0;
|
|
2459
2221
|
}
|
|
2460
2222
|
};
|
|
2461
|
-
|
|
2462
|
-
let
|
|
2463
|
-
const
|
|
2223
|
+
qe.moduleName = "decorator";
|
|
2224
|
+
let Dt = qe;
|
|
2225
|
+
const Ae = "readium-snapper-style", _e = class ee extends Y {
|
|
2464
2226
|
constructor() {
|
|
2465
2227
|
super(...arguments), this.protected = !1;
|
|
2466
2228
|
}
|
|
@@ -2472,48 +2234,57 @@ const Je = "readium-snapper-style", bt = class Ee extends de {
|
|
|
2472
2234
|
}`;
|
|
2473
2235
|
}
|
|
2474
2236
|
mount(e, t) {
|
|
2475
|
-
const
|
|
2476
|
-
return
|
|
2477
|
-
this.protected = !0,
|
|
2478
|
-
}), t.register("unprotect",
|
|
2479
|
-
this.protected = !1,
|
|
2237
|
+
const i = e.document.createElement("style");
|
|
2238
|
+
return i.dataset.readium = "true", i.id = Ae, i.textContent = this.buildStyles(), e.document.head.appendChild(i), t.register("protect", ee.moduleName, (s, n) => {
|
|
2239
|
+
this.protected = !0, i.textContent = this.buildStyles(), n(!0);
|
|
2240
|
+
}), t.register("unprotect", ee.moduleName, (s, n) => {
|
|
2241
|
+
this.protected = !1, i.textContent = this.buildStyles(), n(!0);
|
|
2480
2242
|
}), t.log("Snapper Mounted"), !0;
|
|
2481
2243
|
}
|
|
2482
2244
|
unmount(e, t) {
|
|
2483
|
-
var
|
|
2484
|
-
return (
|
|
2245
|
+
var i;
|
|
2246
|
+
return (i = e.document.getElementById(Ae)) == null || i.remove(), t.log("Snapper Unmounted"), !0;
|
|
2485
2247
|
}
|
|
2486
2248
|
};
|
|
2487
|
-
|
|
2488
|
-
let
|
|
2489
|
-
function
|
|
2490
|
-
return
|
|
2249
|
+
_e.moduleName = "snapper";
|
|
2250
|
+
let Xe = _e;
|
|
2251
|
+
function W(r) {
|
|
2252
|
+
return r.document.body.dir.toLowerCase() === "rtl";
|
|
2491
2253
|
}
|
|
2492
|
-
function
|
|
2254
|
+
function Ge(r) {
|
|
2493
2255
|
return parseInt(
|
|
2494
|
-
|
|
2495
|
-
|
|
2256
|
+
r.getComputedStyle(
|
|
2257
|
+
r.document.documentElement
|
|
2496
2258
|
).getPropertyValue("column-count")
|
|
2497
2259
|
);
|
|
2498
2260
|
}
|
|
2499
|
-
function
|
|
2500
|
-
const e = "
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2261
|
+
function Me(r) {
|
|
2262
|
+
const e = getComputedStyle(r), t = parseFloat(e.paddingTop || "0"), i = parseFloat(e.paddingBottom || "0");
|
|
2263
|
+
return r.clientHeight - t - i;
|
|
2264
|
+
}
|
|
2265
|
+
function Oe(r) {
|
|
2266
|
+
const e = Ge(r);
|
|
2267
|
+
if (!e)
|
|
2268
|
+
return !1;
|
|
2269
|
+
const t = r.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
2270
|
+
for (const h of t)
|
|
2271
|
+
h.remove();
|
|
2272
|
+
const i = t.length, s = r.document.scrollingElement.scrollWidth, n = r.visualViewport.width, a = Math.round(s / n * e) % e, c = e === 1 || a === 0 ? 0 : e - a;
|
|
2273
|
+
if (c > 0)
|
|
2274
|
+
for (let h = 0; h < c; h++) {
|
|
2275
|
+
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 = Me(r.document.documentElement) + "px"), u.innerHTML = "​", r.document.body.appendChild(u);
|
|
2277
|
+
}
|
|
2278
|
+
return i !== c;
|
|
2508
2279
|
}
|
|
2509
|
-
function
|
|
2510
|
-
return
|
|
2280
|
+
function Wt(r) {
|
|
2281
|
+
return r < 0.5 ? 2 * r * r : -1 + (4 - 2 * r) * r;
|
|
2511
2282
|
}
|
|
2512
|
-
function
|
|
2513
|
-
const e =
|
|
2283
|
+
function w(r) {
|
|
2284
|
+
const e = r.getSelection();
|
|
2514
2285
|
e && e.removeAllRanges();
|
|
2515
2286
|
}
|
|
2516
|
-
const
|
|
2287
|
+
const Ft = [
|
|
2517
2288
|
"a",
|
|
2518
2289
|
"audio",
|
|
2519
2290
|
"button",
|
|
@@ -2527,49 +2298,49 @@ const Ni = [
|
|
|
2527
2298
|
"textarea",
|
|
2528
2299
|
"video"
|
|
2529
2300
|
];
|
|
2530
|
-
function
|
|
2301
|
+
function Ye(r) {
|
|
2531
2302
|
var e;
|
|
2532
|
-
return
|
|
2303
|
+
return Ft.indexOf(r.nodeName.toLowerCase()) !== -1 || r.hasAttribute("contenteditable") && ((e = r.getAttribute("contenteditable")) == null ? void 0 : e.toLowerCase()) !== "false" ? r : r.parentElement ? Ye(r.parentElement) : null;
|
|
2533
2304
|
}
|
|
2534
|
-
function
|
|
2535
|
-
const t =
|
|
2305
|
+
function Ke(r, e) {
|
|
2306
|
+
const t = Ze(r, r.document.body, e), i = r._readium_cssSelectorGenerator.getCssSelector(t, {
|
|
2536
2307
|
selectors: ["tag", "id", "class", "nthchild", "nthoftype", "attribute"]
|
|
2537
2308
|
});
|
|
2538
|
-
return new
|
|
2309
|
+
return new D({
|
|
2539
2310
|
href: "#",
|
|
2540
2311
|
type: "application/xhtml+xml",
|
|
2541
|
-
locations: new
|
|
2312
|
+
locations: new x({
|
|
2542
2313
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2543
|
-
["cssSelector",
|
|
2314
|
+
["cssSelector", i]
|
|
2544
2315
|
])
|
|
2545
2316
|
}),
|
|
2546
|
-
text: new
|
|
2317
|
+
text: new U({
|
|
2547
2318
|
highlight: t.textContent || void 0
|
|
2548
2319
|
})
|
|
2549
2320
|
});
|
|
2550
2321
|
}
|
|
2551
|
-
function
|
|
2552
|
-
for (var
|
|
2553
|
-
const
|
|
2554
|
-
if (!
|
|
2555
|
-
return
|
|
2322
|
+
function Ze(r, e, t) {
|
|
2323
|
+
for (var i = 0; i < e.children.length; i++) {
|
|
2324
|
+
const s = e.children[i];
|
|
2325
|
+
if (!kt(s) && Bt(r, s, t))
|
|
2326
|
+
return Ut(r, s) ? s : Ze(r, s, t);
|
|
2556
2327
|
}
|
|
2557
2328
|
return e;
|
|
2558
2329
|
}
|
|
2559
|
-
function
|
|
2330
|
+
function Bt(r, e, t) {
|
|
2560
2331
|
if (e === document.body || e === document.documentElement)
|
|
2561
2332
|
return !0;
|
|
2562
2333
|
if (!document || !document.documentElement || !document.body)
|
|
2563
2334
|
return !1;
|
|
2564
|
-
const
|
|
2565
|
-
return t ?
|
|
2335
|
+
const i = e.getBoundingClientRect();
|
|
2336
|
+
return t ? i.bottom > 0 && i.top < r.innerHeight : i.right > 0 && i.left < r.innerWidth;
|
|
2566
2337
|
}
|
|
2567
|
-
function
|
|
2338
|
+
function Ut(r, e) {
|
|
2568
2339
|
const t = e.getBoundingClientRect();
|
|
2569
|
-
return t.top >= 0 && t.left >= 0 && t.bottom <=
|
|
2340
|
+
return t.top >= 0 && t.left >= 0 && t.bottom <= r.innerHeight && t.right <= r.innerWidth;
|
|
2570
2341
|
}
|
|
2571
|
-
function
|
|
2572
|
-
const e = getComputedStyle(
|
|
2342
|
+
function kt(r) {
|
|
2343
|
+
const e = getComputedStyle(r);
|
|
2573
2344
|
if (e) {
|
|
2574
2345
|
const t = e.getPropertyValue("display");
|
|
2575
2346
|
if (t != "block" && t != "list-item" || e.getPropertyValue("opacity") === "0")
|
|
@@ -2577,7 +2348,7 @@ function Li(i) {
|
|
|
2577
2348
|
}
|
|
2578
2349
|
return !1;
|
|
2579
2350
|
}
|
|
2580
|
-
const
|
|
2351
|
+
const Ie = "readium-column-snapper-style", Ht = 200, Je = class T extends Xe {
|
|
2581
2352
|
constructor() {
|
|
2582
2353
|
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);
|
|
2583
2354
|
}
|
|
@@ -2588,7 +2359,7 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2588
2359
|
return this.doc().scrollLeft > 0 ? this.doc().scrollLeft : this.alreadyScrollLeft;
|
|
2589
2360
|
}
|
|
2590
2361
|
snapOffset(e) {
|
|
2591
|
-
const t = e + (
|
|
2362
|
+
const t = e + (W(this.wnd) ? -1 : 1);
|
|
2592
2363
|
return t - t % this.wnd.innerWidth;
|
|
2593
2364
|
}
|
|
2594
2365
|
reportProgress() {
|
|
@@ -2598,7 +2369,7 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2598
2369
|
if (this.overscroll !== 0 || this.shakeTimeout !== 0)
|
|
2599
2370
|
return;
|
|
2600
2371
|
const e = this.doc();
|
|
2601
|
-
e.classList.add(
|
|
2372
|
+
e.classList.add(W(this.wnd) ? "readium-bounce-l" : "readium-bounce-r");
|
|
2602
2373
|
const t = this.scrollOffset();
|
|
2603
2374
|
this.shakeTimeout = this.wnd.setTimeout(() => {
|
|
2604
2375
|
e.classList.remove("readium-bounce-l"), e.classList.remove("readium-bounce-r"), this.shakeTimeout = 0, this.doc().scrollLeft = t;
|
|
@@ -2613,28 +2384,28 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2613
2384
|
}
|
|
2614
2385
|
// Snaps the current offset to the page width.
|
|
2615
2386
|
snapCurrentOffset(e = !1, t = !1) {
|
|
2616
|
-
const
|
|
2387
|
+
const i = this.wnd.scrollX > 0 ? this.wnd.scrollX : this.alreadyScrollLeft, s = this.doc(), n = this.dragOffset(), o = Ge(this.wnd), a = Math.min(Math.max(0, i), this.cachedScrollWidth), c = W(this.wnd) ? -1 : 1, h = (
|
|
2617
2388
|
// The hurdle to overcome in order to change pages
|
|
2618
|
-
|
|
2619
|
-
), u = this.snapOffset(a +
|
|
2389
|
+
c * (this.wnd.innerWidth / 3) * (c * n > 0 ? 2 : 1)
|
|
2390
|
+
), u = this.snapOffset(a + h);
|
|
2620
2391
|
if (e && u !== this.scrollOffset()) {
|
|
2621
2392
|
this.snappingCancelled = !1;
|
|
2622
|
-
const p = (
|
|
2393
|
+
const p = (m, v, S, O) => S > O ? v : m + (v - m) * Wt(S / O), d = (
|
|
2623
2394
|
/*Math.abs(startX - (this.useTransform ? currentOffset : 0)) < 10 ? 1 : */
|
|
2624
|
-
|
|
2395
|
+
Ht * o
|
|
2625
2396
|
);
|
|
2626
2397
|
let f;
|
|
2627
|
-
const
|
|
2398
|
+
const g = (m) => {
|
|
2628
2399
|
if (this.snappingCancelled)
|
|
2629
2400
|
return;
|
|
2630
|
-
f || (f =
|
|
2631
|
-
const
|
|
2632
|
-
|
|
2401
|
+
f || (f = m);
|
|
2402
|
+
const v = m - f, S = p(this.overscroll, 0, v, d), O = p(i, u, v, d);
|
|
2403
|
+
s.scrollLeft = O, this.overscroll !== 0 && (s.style.transform = `translate3d(${-S}px, 0px, 0px)`), v < d ? this.wnd.requestAnimationFrame(g) : (this.clearTouches(), s.style.removeProperty("transform"), s.scrollLeft = u, t || this.reportProgress());
|
|
2633
2404
|
};
|
|
2634
|
-
this.wnd.requestAnimationFrame(
|
|
2405
|
+
this.wnd.requestAnimationFrame(g);
|
|
2635
2406
|
} else
|
|
2636
|
-
|
|
2637
|
-
|
|
2407
|
+
s.style.removeProperty("transform"), this.wnd.requestAnimationFrame(() => {
|
|
2408
|
+
s.scrollLeft = u, this.clearTouches(), t || this.reportProgress();
|
|
2638
2409
|
});
|
|
2639
2410
|
}
|
|
2640
2411
|
dragOffset() {
|
|
@@ -2659,8 +2430,8 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2659
2430
|
}
|
|
2660
2431
|
onTouchEnd(e) {
|
|
2661
2432
|
if (this.touchState === 2) {
|
|
2662
|
-
const t = this.dragOffset(),
|
|
2663
|
-
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), t > 5 && this.comms.send("no_more", void 0), t < -5 && this.comms.send("no_less", void 0)) :
|
|
2433
|
+
const t = this.dragOffset(), i = this.scrollOffset();
|
|
2434
|
+
this.cachedScrollWidth <= this.wnd.innerWidth ? (this.reportProgress(), t > 5 && this.comms.send("no_more", void 0), t < -5 && this.comms.send("no_less", void 0)) : i < 5 && t < 5 ? (this.alreadyScrollLeft = 0, this.comms.send("no_less", void 0)) : this.cachedScrollWidth - i - this.wnd.innerWidth < 5 && t > 5 && (this.alreadyScrollLeft = this.cachedScrollWidth, this.comms.send("no_more", void 0)), this.snapCurrentOffset(!0), this.comms.send("swipe", t);
|
|
2664
2435
|
}
|
|
2665
2436
|
this.touchState = 0;
|
|
2666
2437
|
}
|
|
@@ -2670,16 +2441,16 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2670
2441
|
onTouchMove(e) {
|
|
2671
2442
|
if (this.touchState === 0)
|
|
2672
2443
|
return;
|
|
2673
|
-
this.touchState === 1 && (this.touchState = 2,
|
|
2674
|
-
const t = this.dragOffset(),
|
|
2675
|
-
|
|
2444
|
+
this.touchState === 1 && (this.touchState = 2, w(this.wnd)), this.endingX = e.touches[0].clientX;
|
|
2445
|
+
const t = this.dragOffset(), i = this.alreadyScrollLeft + t;
|
|
2446
|
+
i < 0 ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-this.overscroll}px, 0px, 0px)`) : i + this.wnd.innerWidth > this.cachedScrollWidth ? (this.overscroll = i, this.doc().style.transform = `translate3d(${-i}px, 0px, 0px)`) : (this.overscroll = 0, this.doc().style.removeProperty("transform"), this.doc().scrollLeft = this.alreadyScrollLeft + t);
|
|
2676
2447
|
}
|
|
2677
2448
|
mount(e, t) {
|
|
2678
2449
|
if (this.wnd = e, this.comms = t, !super.mount(e, t))
|
|
2679
2450
|
return !1;
|
|
2680
2451
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
2681
|
-
const
|
|
2682
|
-
|
|
2452
|
+
const i = e.document.createElement("style");
|
|
2453
|
+
i.dataset.readium = "true", i.id = Ie, i.textContent = `
|
|
2683
2454
|
@keyframes readium-bounce-l-animation {
|
|
2684
2455
|
0%, 100% {transform: translate3d(0, 0, 0);}
|
|
2685
2456
|
50% {transform: translate3d(-50px, 0, 0);}
|
|
@@ -2713,131 +2484,121 @@ const Ke = "readium-column-snapper-style", Ii = 200, Ct = class C extends Et {
|
|
|
2713
2484
|
body::-webkit-scrollbar {
|
|
2714
2485
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2715
2486
|
}
|
|
2716
|
-
`, e.document.head.appendChild(
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
})
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2487
|
+
`, e.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2488
|
+
e.requestAnimationFrame(() => {
|
|
2489
|
+
e && Oe(e);
|
|
2490
|
+
}), this.onWidthChange();
|
|
2491
|
+
}), this.resizeObserver.observe(e.document.body), this.mutationObserver = new MutationObserver((n) => {
|
|
2492
|
+
for (const o of n)
|
|
2493
|
+
if (o.target === this.wnd.document.documentElement) {
|
|
2494
|
+
const a = o.oldValue, c = o.target.getAttribute("style"), h = /transform\s*:\s*([^;]+)/, u = a == null ? void 0 : a.match(h), p = c == null ? void 0 : c.match(h);
|
|
2495
|
+
(!u && !p || u && !p || u && p && u[1] !== p[1]) && (e.requestAnimationFrame(() => {
|
|
2496
|
+
e && Oe(e);
|
|
2497
|
+
}), this.onWidthChange());
|
|
2498
|
+
} else
|
|
2499
|
+
e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth);
|
|
2500
|
+
}), e.frameElement && this.mutationObserver.observe(e.frameElement, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document, { attributes: !0, attributeFilter: ["style"] }), this.mutationObserver.observe(e.document.documentElement, { attributes: !0, attributeFilter: ["style"] });
|
|
2501
|
+
const s = (n) => {
|
|
2502
|
+
const o = this.doc().scrollLeft;
|
|
2503
|
+
return this.doc().scrollLeft = this.snapOffset(n), o !== this.doc().scrollLeft;
|
|
2726
2504
|
};
|
|
2727
|
-
return e.addEventListener("orientationchange", this.onWidthChanger), e.addEventListener("resize", this.onWidthChanger), e.requestAnimationFrame(() => this.cachedScrollWidth = this.doc().scrollWidth), t.register("go_progression",
|
|
2728
|
-
const
|
|
2729
|
-
if (
|
|
2505
|
+
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 a = n;
|
|
2507
|
+
if (a < 0 || a > 1) {
|
|
2730
2508
|
t.send("error", {
|
|
2731
2509
|
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2732
|
-
}),
|
|
2510
|
+
}), o(!1);
|
|
2733
2511
|
return;
|
|
2734
2512
|
}
|
|
2735
2513
|
this.wnd.requestAnimationFrame(() => {
|
|
2736
2514
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2737
|
-
const c = this.cachedScrollWidth,
|
|
2738
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2515
|
+
const c = this.cachedScrollWidth, h = W(e) ? -1 : 1, u = c * a * h;
|
|
2516
|
+
this.doc().scrollLeft = this.snapOffset(u), this.reportProgress(), w(this.wnd), o(!0);
|
|
2739
2517
|
});
|
|
2740
|
-
}), t.register("go_id",
|
|
2741
|
-
const
|
|
2742
|
-
if (!
|
|
2743
|
-
|
|
2518
|
+
}), t.register("go_id", T.moduleName, (n, o) => {
|
|
2519
|
+
const a = e.document.getElementById(n);
|
|
2520
|
+
if (!a) {
|
|
2521
|
+
o(!1);
|
|
2744
2522
|
return;
|
|
2745
2523
|
}
|
|
2746
2524
|
this.wnd.requestAnimationFrame(() => {
|
|
2747
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2525
|
+
this.doc().scrollLeft = this.snapOffset(a.getBoundingClientRect().left + e.scrollX), this.reportProgress(), w(this.wnd), o(!0);
|
|
2748
2526
|
});
|
|
2749
|
-
}), t.register("go_text",
|
|
2750
|
-
let
|
|
2751
|
-
Array.isArray(
|
|
2752
|
-
const c =
|
|
2527
|
+
}), t.register("go_text", T.moduleName, (n, o) => {
|
|
2528
|
+
let a;
|
|
2529
|
+
Array.isArray(n) && (n.length > 1 && (a = n[1]), n = n[0]);
|
|
2530
|
+
const c = U.deserialize(n), h = le(this.wnd.document, new D({
|
|
2753
2531
|
href: e.location.href,
|
|
2754
2532
|
type: "text/html",
|
|
2755
2533
|
text: c,
|
|
2756
|
-
locations:
|
|
2534
|
+
locations: a ? new x({
|
|
2757
2535
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2758
|
-
["cssSelector",
|
|
2536
|
+
["cssSelector", a]
|
|
2759
2537
|
])
|
|
2760
2538
|
}) : void 0
|
|
2761
2539
|
}));
|
|
2762
|
-
if (!
|
|
2763
|
-
|
|
2540
|
+
if (!h) {
|
|
2541
|
+
o(!1);
|
|
2764
2542
|
return;
|
|
2765
2543
|
}
|
|
2766
2544
|
this.wnd.requestAnimationFrame(() => {
|
|
2767
|
-
this.doc().scrollLeft = this.snapOffset(
|
|
2545
|
+
this.doc().scrollLeft = this.snapOffset(h.getBoundingClientRect().left + e.scrollX), this.reportProgress(), w(this.wnd), o(!0);
|
|
2768
2546
|
});
|
|
2769
|
-
}), t.register("go_end",
|
|
2770
|
-
const
|
|
2547
|
+
}), t.register("go_end", T.moduleName, (n, o) => {
|
|
2548
|
+
const a = W(e) ? -1 : 1;
|
|
2771
2549
|
this.wnd.requestAnimationFrame(() => {
|
|
2772
2550
|
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2773
|
-
const c = this.cachedScrollWidth *
|
|
2551
|
+
const c = this.cachedScrollWidth * a;
|
|
2774
2552
|
if (this.doc().scrollLeft === c)
|
|
2775
|
-
return
|
|
2776
|
-
this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(),
|
|
2553
|
+
return o(!1);
|
|
2554
|
+
this.doc().scrollLeft = this.snapOffset(c), this.reportProgress(), w(this.wnd), o(!0);
|
|
2777
2555
|
});
|
|
2778
|
-
}), t.register("go_start",
|
|
2556
|
+
}), t.register("go_start", T.moduleName, (n, o) => {
|
|
2779
2557
|
this.wnd.requestAnimationFrame(() => {
|
|
2780
2558
|
if (this.doc().scrollLeft === 0)
|
|
2781
|
-
return
|
|
2782
|
-
this.doc().scrollLeft = 0, this.reportProgress(),
|
|
2559
|
+
return o(!1);
|
|
2560
|
+
this.doc().scrollLeft = 0, this.reportProgress(), w(this.wnd), o(!0);
|
|
2783
2561
|
});
|
|
2784
|
-
}), t.register("go_prev",
|
|
2562
|
+
}), t.register("go_prev", T.moduleName, (n, o) => {
|
|
2785
2563
|
this.wnd.requestAnimationFrame(() => {
|
|
2786
|
-
|
|
2787
|
-
|
|
2564
|
+
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2565
|
+
const a = e.scrollX - e.innerWidth, c = W(e) ? -(this.cachedScrollWidth - e.innerWidth) : 0, h = s(Math.max(a, c));
|
|
2566
|
+
h && (this.reportProgress(), w(this.wnd)), o(h);
|
|
2788
2567
|
});
|
|
2789
|
-
}), t.register("go_next",
|
|
2568
|
+
}), t.register("go_next", T.moduleName, (n, o) => {
|
|
2790
2569
|
this.wnd.requestAnimationFrame(() => {
|
|
2791
|
-
|
|
2792
|
-
|
|
2570
|
+
this.cachedScrollWidth = this.doc().scrollWidth;
|
|
2571
|
+
const a = e.scrollX + e.innerWidth, c = W(e) ? 0 : this.cachedScrollWidth - e.innerWidth, h = s(Math.min(a, c));
|
|
2572
|
+
h && (this.reportProgress(), w(this.wnd)), o(h);
|
|
2793
2573
|
});
|
|
2794
|
-
}), t.register("unfocus",
|
|
2795
|
-
this.snappingCancelled = !0,
|
|
2796
|
-
}), t.register("shake",
|
|
2797
|
-
this.shake(),
|
|
2798
|
-
}), t.register("focus",
|
|
2574
|
+
}), t.register("unfocus", T.moduleName, (n, o) => {
|
|
2575
|
+
this.snappingCancelled = !0, w(this.wnd), o(!0);
|
|
2576
|
+
}), t.register("shake", T.moduleName, (n, o) => {
|
|
2577
|
+
this.shake(), o(!0);
|
|
2578
|
+
}), t.register("focus", T.moduleName, (n, o) => {
|
|
2799
2579
|
this.wnd.requestAnimationFrame(() => {
|
|
2800
|
-
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(),
|
|
2580
|
+
this.cachedScrollWidth = this.doc().scrollWidth, this.snapCurrentOffset(!1, !0), this.reportProgress(), o(!0);
|
|
2801
2581
|
});
|
|
2802
|
-
}), t.register("first_visible_locator",
|
|
2803
|
-
const
|
|
2804
|
-
this.comms.send("first_visible_locator",
|
|
2582
|
+
}), t.register("first_visible_locator", T.moduleName, (n, o) => {
|
|
2583
|
+
const a = Ke(e, !1);
|
|
2584
|
+
this.comms.send("first_visible_locator", a.serialize()), o(!0);
|
|
2805
2585
|
}), 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", () => {
|
|
2806
2586
|
}), t.log("ColumnSnapper Mounted"), !0;
|
|
2807
2587
|
}
|
|
2808
2588
|
unmount(e, t) {
|
|
2809
|
-
var
|
|
2810
|
-
return this.snappingCancelled = !0, t.unregisterAll(
|
|
2589
|
+
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(Ie)) == null || i.remove(), t.log("ColumnSnapper Unmounted"), super.unmount(e, t);
|
|
2811
2591
|
}
|
|
2812
2592
|
};
|
|
2813
|
-
|
|
2814
|
-
let
|
|
2815
|
-
const
|
|
2816
|
-
top: "js-iframe-reader-top-anchor",
|
|
2817
|
-
bottom: "js-iframe-reader-bottom-anchor"
|
|
2818
|
-
};
|
|
2819
|
-
class Di extends HTMLElement {
|
|
2820
|
-
connectedCallback() {
|
|
2821
|
-
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");
|
|
2822
|
-
}
|
|
2823
|
-
}
|
|
2824
|
-
function Bi(i) {
|
|
2825
|
-
const e = i.getElementsByTagName("body")[0], t = document.createElement("anchor-observer"), r = document.createElement("anchor-observer");
|
|
2826
|
-
t.dataset.readium = "true", r.dataset.readium = "true", t == null || t.setAttribute("id", ue.top), t == null || t.style.setProperty("height", "115px", "important"), r == null || r.setAttribute("id", ue.bottom), r == null || r.style.setProperty("height", "80px", "important"), e == null || e.insertBefore(t, e.firstChild), e == null || e.appendChild(r);
|
|
2827
|
-
}
|
|
2828
|
-
function Wi(i) {
|
|
2829
|
-
var n, s;
|
|
2830
|
-
const e = i.getElementsByTagName("body")[0], t = e == null ? void 0 : e.querySelector(`#${ue.top}`), r = e == null ? void 0 : e.querySelector(`#${ue.bottom}`);
|
|
2831
|
-
t && ((n = t.parentElement) == null || n.removeChild(t)), r && ((s = r.parentElement) == null || s.removeChild(r));
|
|
2832
|
-
}
|
|
2833
|
-
const Ze = "readium-scroll-snapper-style", Ot = class M extends Et {
|
|
2593
|
+
Je.moduleName = "column_snapper";
|
|
2594
|
+
let $t = Je;
|
|
2595
|
+
const Le = "readium-scroll-snapper-style", Qe = class A extends Xe {
|
|
2834
2596
|
constructor() {
|
|
2835
|
-
super(...arguments), this.
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
customElements.get("anchor-observer") || customElements.define("anchor-observer", Di);
|
|
2597
|
+
super(...arguments), this.isScrolling = !1, this.handleScroll = () => {
|
|
2598
|
+
this.isScrolling || (this.isScrolling = !0, this.wnd.requestAnimationFrame(() => {
|
|
2599
|
+
const e = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2600
|
+
this.reportProgress({ progress: e, reference: this.wnd.innerHeight / this.doc().scrollHeight }), this.isScrolling = !1;
|
|
2601
|
+
}));
|
|
2841
2602
|
};
|
|
2842
2603
|
}
|
|
2843
2604
|
doc() {
|
|
@@ -2848,8 +2609,8 @@ const Ze = "readium-scroll-snapper-style", Ot = class M extends Et {
|
|
|
2848
2609
|
}
|
|
2849
2610
|
mount(e, t) {
|
|
2850
2611
|
this.wnd = e, this.comms = t, e.navigator.epubReadingSystem.layoutStyle = "scrolling";
|
|
2851
|
-
const
|
|
2852
|
-
return
|
|
2612
|
+
const i = e.document.createElement("style");
|
|
2613
|
+
return i.dataset.readium = "true", i.id = Le, i.textContent = `
|
|
2853
2614
|
* {
|
|
2854
2615
|
scrollbar-width: none; /* for Firefox */
|
|
2855
2616
|
}
|
|
@@ -2857,90 +2618,94 @@ const Ze = "readium-scroll-snapper-style", Ot = class M extends Et {
|
|
|
2857
2618
|
body::-webkit-scrollbar {
|
|
2858
2619
|
display: none; /* for Chrome, Safari, and Opera */
|
|
2859
2620
|
}
|
|
2860
|
-
`, e.document.head.appendChild(
|
|
2861
|
-
|
|
2621
|
+
`, e.document.head.appendChild(i), this.resizeObserver = new ResizeObserver(() => {
|
|
2622
|
+
this.comms.ready && this.handleScroll();
|
|
2623
|
+
}), this.resizeObserver.observe(e.document.body), e.addEventListener("scroll", this.handleScroll, {
|
|
2624
|
+
passive: !0
|
|
2625
|
+
}), t.register("go_progression", A.moduleName, (s, n) => {
|
|
2626
|
+
const o = s;
|
|
2862
2627
|
if (o < 0 || o > 1) {
|
|
2863
2628
|
t.send("error", {
|
|
2864
2629
|
message: "go_progression must be given a position from 0.0 to 1.0"
|
|
2865
|
-
}),
|
|
2630
|
+
}), n(!1);
|
|
2866
2631
|
return;
|
|
2867
2632
|
}
|
|
2868
2633
|
this.wnd.requestAnimationFrame(() => {
|
|
2869
|
-
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2634
|
+
this.doc().scrollTop = this.doc().offsetHeight * o, this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), w(this.wnd), n(!0);
|
|
2870
2635
|
});
|
|
2871
|
-
}), t.register("go_id",
|
|
2872
|
-
const o = e.document.getElementById(
|
|
2636
|
+
}), t.register("go_id", A.moduleName, (s, n) => {
|
|
2637
|
+
const o = e.document.getElementById(s);
|
|
2873
2638
|
if (!o) {
|
|
2874
|
-
|
|
2639
|
+
n(!1);
|
|
2875
2640
|
return;
|
|
2876
2641
|
}
|
|
2877
2642
|
this.wnd.requestAnimationFrame(() => {
|
|
2878
2643
|
this.doc().scrollTop = o.getBoundingClientRect().top + e.scrollY - e.innerHeight / 2;
|
|
2879
2644
|
const a = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2880
|
-
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2645
|
+
this.reportProgress({ progress: a, reference: this.wnd.innerHeight / this.doc().scrollHeight }), w(this.wnd), n(!0);
|
|
2881
2646
|
});
|
|
2882
|
-
}), t.register("go_text",
|
|
2647
|
+
}), t.register("go_text", A.moduleName, (s, n) => {
|
|
2883
2648
|
let o;
|
|
2884
|
-
Array.isArray(
|
|
2885
|
-
const a =
|
|
2649
|
+
Array.isArray(s) && (s.length > 1 && (o = s[1]), s = s[0]);
|
|
2650
|
+
const a = U.deserialize(s), c = le(this.wnd.document, new D({
|
|
2886
2651
|
href: e.location.href,
|
|
2887
2652
|
type: "text/html",
|
|
2888
2653
|
text: a,
|
|
2889
|
-
locations: o ? new
|
|
2654
|
+
locations: o ? new x({
|
|
2890
2655
|
otherLocations: /* @__PURE__ */ new Map([
|
|
2891
2656
|
["cssSelector", o]
|
|
2892
2657
|
])
|
|
2893
2658
|
}) : void 0
|
|
2894
2659
|
}));
|
|
2895
|
-
if (!
|
|
2896
|
-
|
|
2660
|
+
if (!c) {
|
|
2661
|
+
n(!1);
|
|
2897
2662
|
return;
|
|
2898
2663
|
}
|
|
2899
2664
|
this.wnd.requestAnimationFrame(() => {
|
|
2900
|
-
this.doc().scrollTop =
|
|
2901
|
-
const
|
|
2902
|
-
this.reportProgress({ progress:
|
|
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);
|
|
2903
2668
|
});
|
|
2904
|
-
}), t.register("go_start",
|
|
2669
|
+
}), t.register("go_start", A.moduleName, (s, n) => {
|
|
2905
2670
|
if (this.doc().scrollTop === 0)
|
|
2906
|
-
return
|
|
2907
|
-
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2908
|
-
}), t.register("go_end",
|
|
2671
|
+
return n(!1);
|
|
2672
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2673
|
+
}), t.register("go_end", A.moduleName, (s, n) => {
|
|
2909
2674
|
if (this.doc().scrollTop === 0)
|
|
2910
|
-
return
|
|
2911
|
-
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2912
|
-
}), t.register("unfocus",
|
|
2913
|
-
|
|
2675
|
+
return n(!1);
|
|
2676
|
+
this.doc().scrollTop = 0, this.reportProgress({ progress: 0, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2677
|
+
}), t.register("unfocus", A.moduleName, (s, n) => {
|
|
2678
|
+
w(this.wnd), n(!0);
|
|
2914
2679
|
}), t.register([
|
|
2915
2680
|
"go_next",
|
|
2916
2681
|
"go_prev"
|
|
2917
|
-
],
|
|
2682
|
+
], A.moduleName, (s, n) => n(!1)), t.register("focus", A.moduleName, (s, n) => {
|
|
2918
2683
|
const o = this.doc().scrollTop / this.doc().offsetHeight;
|
|
2919
|
-
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }),
|
|
2920
|
-
}), t.register("first_visible_locator",
|
|
2921
|
-
const o =
|
|
2922
|
-
this.comms.send("first_visible_locator", o.serialize()),
|
|
2923
|
-
}), t.log("ScrollSnapper Mounted"),
|
|
2684
|
+
this.reportProgress({ progress: o, reference: this.wnd.innerHeight / this.doc().scrollHeight }), n(!0);
|
|
2685
|
+
}), t.register("first_visible_locator", A.moduleName, (s, n) => {
|
|
2686
|
+
const o = Ke(e, !0);
|
|
2687
|
+
this.comms.send("first_visible_locator", o.serialize()), n(!0);
|
|
2688
|
+
}), t.log("ScrollSnapper Mounted"), !0;
|
|
2924
2689
|
}
|
|
2925
2690
|
unmount(e, t) {
|
|
2926
|
-
var
|
|
2927
|
-
return t.unregisterAll(
|
|
2691
|
+
var i;
|
|
2692
|
+
return t.unregisterAll(A.moduleName), this.resizeObserver.disconnect(), this.handleScroll && e.removeEventListener("scroll", this.handleScroll), (i = e.document.getElementById(Le)) == null || i.remove(), t.log("ScrollSnapper Unmounted"), !0;
|
|
2928
2693
|
}
|
|
2929
2694
|
};
|
|
2930
|
-
|
|
2931
|
-
let
|
|
2932
|
-
class
|
|
2695
|
+
Qe.moduleName = "scroll_snapper";
|
|
2696
|
+
let jt = Qe;
|
|
2697
|
+
class et extends Y {
|
|
2933
2698
|
constructor() {
|
|
2934
2699
|
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);
|
|
2935
2700
|
}
|
|
2936
2701
|
onPointUp(e) {
|
|
2937
|
-
var
|
|
2702
|
+
var s, n, o, a, c;
|
|
2938
2703
|
const t = this.wnd.getSelection();
|
|
2939
|
-
if (t && ((
|
|
2940
|
-
const
|
|
2941
|
-
if (!
|
|
2704
|
+
if (t && ((s = t.toString()) == null ? void 0 : s.length) > 0) {
|
|
2705
|
+
const h = (n = t.getRangeAt(0)) == null ? void 0 : n.getClientRects();
|
|
2706
|
+
if (!h || h.length === 0)
|
|
2942
2707
|
return;
|
|
2943
|
-
const u =
|
|
2708
|
+
const u = h[0], p = {
|
|
2944
2709
|
text: t.toString(),
|
|
2945
2710
|
x: u.x,
|
|
2946
2711
|
y: u.y,
|
|
@@ -2956,14 +2721,14 @@ class Pt extends de {
|
|
|
2956
2721
|
}
|
|
2957
2722
|
if (!(t != null && t.isCollapsed) || !e.isPrimary)
|
|
2958
2723
|
return;
|
|
2959
|
-
const
|
|
2724
|
+
const i = this.wnd.devicePixelRatio;
|
|
2960
2725
|
e.preventDefault(), this.comms.send(e.pointerType === "touch" ? "tap" : "click", {
|
|
2961
2726
|
defaultPrevented: e.defaultPrevented,
|
|
2962
|
-
x: e.clientX *
|
|
2963
|
-
y: e.clientY *
|
|
2727
|
+
x: e.clientX * i,
|
|
2728
|
+
y: e.clientY * i,
|
|
2964
2729
|
targetFrameSrc: this.wnd.location.href,
|
|
2965
2730
|
targetElement: e.target.outerHTML,
|
|
2966
|
-
interactiveElement: (
|
|
2731
|
+
interactiveElement: (c = Ye(e.target)) == null ? void 0 : c.outerHTML,
|
|
2967
2732
|
cssSelector: this.wnd._readium_cssSelectorGenerator.getCssSelector(e.target)
|
|
2968
2733
|
}), this.pointerMoved = !1;
|
|
2969
2734
|
}
|
|
@@ -2999,8 +2764,8 @@ class Pt extends de {
|
|
|
2999
2764
|
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;
|
|
3000
2765
|
}
|
|
3001
2766
|
}
|
|
3002
|
-
|
|
3003
|
-
const
|
|
2767
|
+
et.moduleName = "peripherals";
|
|
2768
|
+
const tt = class te extends Y {
|
|
3004
2769
|
constructor() {
|
|
3005
2770
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
3006
2771
|
}
|
|
@@ -3016,19 +2781,19 @@ const At = class xe extends de {
|
|
|
3016
2781
|
unblock(e) {
|
|
3017
2782
|
var t;
|
|
3018
2783
|
for (e._readium_blockEvents = !1; ((t = e._readium_blockedEvents) == null ? void 0 : t.length) > 0; ) {
|
|
3019
|
-
const
|
|
3020
|
-
switch (
|
|
2784
|
+
const i = e._readium_blockedEvents.shift();
|
|
2785
|
+
switch (i[0]) {
|
|
3021
2786
|
case 0:
|
|
3022
|
-
Reflect.apply(
|
|
2787
|
+
Reflect.apply(i[1], i[2], i[3]);
|
|
3023
2788
|
break;
|
|
3024
2789
|
case 1:
|
|
3025
|
-
const
|
|
3026
|
-
e.removeEventListener(
|
|
3027
|
-
const o = new Event(
|
|
3028
|
-
bubbles:
|
|
3029
|
-
cancelable:
|
|
2790
|
+
const s = i[1], n = i[2];
|
|
2791
|
+
e.removeEventListener(s.type, e._readium_eventBlocker, !0);
|
|
2792
|
+
const o = new Event(s.type, {
|
|
2793
|
+
bubbles: s.bubbles,
|
|
2794
|
+
cancelable: s.cancelable
|
|
3030
2795
|
});
|
|
3031
|
-
|
|
2796
|
+
n ? n.dispatchEvent(o) : e.dispatchEvent(o);
|
|
3032
2797
|
break;
|
|
3033
2798
|
}
|
|
3034
2799
|
}
|
|
@@ -3043,8 +2808,8 @@ const At = class xe extends de {
|
|
|
3043
2808
|
}
|
|
3044
2809
|
pauseAllMedia(e) {
|
|
3045
2810
|
const t = e.document.querySelectorAll("audio,video");
|
|
3046
|
-
for (let
|
|
3047
|
-
t[
|
|
2811
|
+
for (let i = 0; i < t.length; i++)
|
|
2812
|
+
t[i].pause();
|
|
3048
2813
|
}
|
|
3049
2814
|
mount(e, t) {
|
|
3050
2815
|
this.comms = t, e.addEventListener(
|
|
@@ -3054,9 +2819,9 @@ const At = class xe extends de {
|
|
|
3054
2819
|
), Reflect.defineProperty(e.navigator, "epubReadingSystem", {
|
|
3055
2820
|
value: {
|
|
3056
2821
|
name: "readium-ts-toolkit",
|
|
3057
|
-
version: "
|
|
3058
|
-
hasFeature: (
|
|
3059
|
-
switch (
|
|
2822
|
+
version: "2.0.0-beta.2",
|
|
2823
|
+
hasFeature: (s, n = "") => {
|
|
2824
|
+
switch (s) {
|
|
3060
2825
|
case "dom-manipulation":
|
|
3061
2826
|
return !0;
|
|
3062
2827
|
case "layout-changes":
|
|
@@ -3077,69 +2842,73 @@ const At = class xe extends de {
|
|
|
3077
2842
|
}
|
|
3078
2843
|
},
|
|
3079
2844
|
writable: !1
|
|
3080
|
-
}), "getAnimations" in e.document && e.document.getAnimations().forEach((
|
|
3081
|
-
|
|
3082
|
-
}), t.register("activate",
|
|
2845
|
+
}), "getAnimations" in e.document && e.document.getAnimations().forEach((s) => {
|
|
2846
|
+
s.cancel(), this.allAnimations.add(s);
|
|
2847
|
+
}), t.register("activate", te.moduleName, (s, n) => {
|
|
3083
2848
|
this.allAnimations.forEach((o) => {
|
|
3084
2849
|
o.cancel(), o.play();
|
|
3085
|
-
}),
|
|
3086
|
-
}), t.register("unfocus",
|
|
3087
|
-
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()),
|
|
2850
|
+
}), n(!0);
|
|
2851
|
+
}), t.register("unfocus", te.moduleName, (s, n) => {
|
|
2852
|
+
this.pauseAllMedia(e), this.allAnimations.forEach((o) => o.pause()), n(!0);
|
|
3088
2853
|
});
|
|
3089
|
-
const
|
|
3090
|
-
for (let
|
|
3091
|
-
const
|
|
3092
|
-
|
|
2854
|
+
const i = e.document.querySelectorAll("audio,video");
|
|
2855
|
+
for (let s = 0; s < i.length; s++) {
|
|
2856
|
+
const n = i[s];
|
|
2857
|
+
n.addEventListener("play", this.onMediaPlayEvent, {
|
|
3093
2858
|
passive: !0
|
|
3094
|
-
}),
|
|
2859
|
+
}), n.addEventListener("pause", this.onMediaPauseEvent, {
|
|
3095
2860
|
passive: !0
|
|
3096
2861
|
});
|
|
3097
2862
|
}
|
|
3098
2863
|
return t.log("Setup Mounted"), !0;
|
|
3099
2864
|
}
|
|
3100
2865
|
unmount(e, t) {
|
|
3101
|
-
return e.removeEventListener("error", this.wndOnErr), e.removeEventListener("play", this.onMediaPlayEvent), e.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((
|
|
2866
|
+
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;
|
|
3102
2867
|
}
|
|
3103
2868
|
};
|
|
3104
|
-
|
|
3105
|
-
let
|
|
3106
|
-
const
|
|
2869
|
+
tt.moduleName = "setup";
|
|
2870
|
+
let it = tt;
|
|
2871
|
+
const Re = "readium-viewport", rt = class F extends it {
|
|
3107
2872
|
onViewportWidthChanged(e) {
|
|
3108
2873
|
const t = e.target;
|
|
3109
|
-
|
|
2874
|
+
G(t, "--RS__viewportWidth", `${t.innerWidth}px`);
|
|
3110
2875
|
}
|
|
3111
2876
|
mount(e, t) {
|
|
3112
2877
|
if (!super.mount(e, t))
|
|
3113
2878
|
return !1;
|
|
3114
|
-
const
|
|
3115
|
-
return
|
|
2879
|
+
const i = e.document.createElement("meta");
|
|
2880
|
+
return i.dataset.readium = "true", i.setAttribute("name", "viewport"), i.setAttribute("id", Re), i.setAttribute(
|
|
3116
2881
|
"content",
|
|
3117
2882
|
"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no"
|
|
3118
|
-
), e.document.head.appendChild(
|
|
2883
|
+
), e.document.head.appendChild(i), e.addEventListener("orientationchange", this.onViewportWidthChanged), e.addEventListener("resize", this.onViewportWidthChanged), this.onViewportWidthChanged({
|
|
3119
2884
|
target: e
|
|
3120
|
-
}), t.register("
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
2885
|
+
}), t.register("get_properties", F.moduleName, (s, n) => {
|
|
2886
|
+
Ve(e), n(!0);
|
|
2887
|
+
}), t.register("update_properties", F.moduleName, (s, n) => {
|
|
2888
|
+
s["--RS__viewportWidth"] = `${e.innerWidth}px`, Nt(e, s), n(!0);
|
|
2889
|
+
}), t.register("set_property", F.moduleName, (s, n) => {
|
|
2890
|
+
const o = s;
|
|
2891
|
+
G(e, o[0], o[1]), n(!0);
|
|
2892
|
+
}), t.register("remove_property", F.moduleName, (s, n) => {
|
|
2893
|
+
he(e, s), n(!0);
|
|
2894
|
+
}), t.register("activate", F.moduleName, (s, n) => {
|
|
2895
|
+
this.unblock(e), n(!0);
|
|
3127
2896
|
}), t.log("ReflowableSetup Mounted"), !0;
|
|
3128
2897
|
}
|
|
3129
2898
|
unmount(e, t) {
|
|
3130
|
-
var
|
|
3131
|
-
return t.unregisterAll(
|
|
2899
|
+
var i;
|
|
2900
|
+
return t.unregisterAll(F.moduleName), (i = e.document.head.querySelector(`#${Re}`)) == null || i.remove(), e.removeEventListener("orientationchange", this.onViewportWidthChanged), t.log("ReflowableSetup Unmounted"), super.unmount(e, t);
|
|
3132
2901
|
}
|
|
3133
2902
|
};
|
|
3134
|
-
|
|
3135
|
-
let
|
|
3136
|
-
const
|
|
2903
|
+
rt.moduleName = "reflowable_setup";
|
|
2904
|
+
let Vt = rt;
|
|
2905
|
+
const ze = "readium-fixed-style", st = class L extends it {
|
|
3137
2906
|
mount(e, t) {
|
|
3138
2907
|
if (!super.mount(e, t))
|
|
3139
2908
|
return !1;
|
|
3140
2909
|
e.navigator.epubReadingSystem.layoutStyle = "paginated";
|
|
3141
|
-
const
|
|
3142
|
-
return
|
|
2910
|
+
const i = e.document.createElement("style");
|
|
2911
|
+
return i.id = ze, i.dataset.readium = "true", i.textContent = `
|
|
3143
2912
|
html, body {
|
|
3144
2913
|
text-size-adjust: none;
|
|
3145
2914
|
-ms-text-size-adjust: none;
|
|
@@ -3151,13 +2920,13 @@ const et = "readium-fixed-style", Rt = class I extends Nt {
|
|
|
3151
2920
|
min-height: 100%;
|
|
3152
2921
|
|
|
3153
2922
|
/*cursor: var() TODO*/
|
|
3154
|
-
}`, e.document.head.appendChild(
|
|
3155
|
-
const o =
|
|
3156
|
-
|
|
3157
|
-
}), t.register("remove_property",
|
|
3158
|
-
|
|
3159
|
-
}), t.register("first_visible_locator",
|
|
3160
|
-
|
|
2923
|
+
}`, e.document.head.appendChild(i), t.register("set_property", L.moduleName, (s, n) => {
|
|
2924
|
+
const o = s;
|
|
2925
|
+
G(e, o[0], o[1]), n(!0);
|
|
2926
|
+
}), t.register("remove_property", L.moduleName, (s, n) => {
|
|
2927
|
+
he(e, s), n(!0);
|
|
2928
|
+
}), t.register("first_visible_locator", L.moduleName, (s, n) => n(!1)), t.register("unfocus", L.moduleName, (s, n) => {
|
|
2929
|
+
w(e), n(!0);
|
|
3161
2930
|
}), t.register([
|
|
3162
2931
|
"focus",
|
|
3163
2932
|
"go_next",
|
|
@@ -3167,56 +2936,56 @@ const et = "readium-fixed-style", Rt = class I extends Nt {
|
|
|
3167
2936
|
"go_start",
|
|
3168
2937
|
"go_text",
|
|
3169
2938
|
"go_progression"
|
|
3170
|
-
],
|
|
3171
|
-
this.unblock(e),
|
|
2939
|
+
], L.moduleName, (s, n) => n(!0)), t.register("activate", L.moduleName, (s, n) => {
|
|
2940
|
+
this.unblock(e), n(!0);
|
|
3172
2941
|
}), t.log("FixedSetup Mounted"), !0;
|
|
3173
2942
|
}
|
|
3174
2943
|
unmount(e, t) {
|
|
3175
|
-
var
|
|
3176
|
-
return t.unregisterAll(
|
|
2944
|
+
var i;
|
|
2945
|
+
return t.unregisterAll(L.moduleName), (i = e.document.getElementById(ze)) == null || i.remove(), t.log("FixedSetup Unmounted"), super.unmount(e, t);
|
|
3177
2946
|
}
|
|
3178
2947
|
};
|
|
3179
|
-
|
|
3180
|
-
let
|
|
3181
|
-
const
|
|
2948
|
+
st.moduleName = "fixed_setup";
|
|
2949
|
+
let qt = st;
|
|
2950
|
+
const _t = [
|
|
3182
2951
|
"fixed_setup",
|
|
3183
2952
|
"decorator",
|
|
3184
2953
|
"peripherals"
|
|
3185
|
-
],
|
|
2954
|
+
], Xt = [
|
|
3186
2955
|
"reflowable_setup",
|
|
3187
2956
|
"decorator",
|
|
3188
2957
|
"peripherals",
|
|
3189
2958
|
"column_snapper",
|
|
3190
2959
|
"scroll_snapper"
|
|
3191
|
-
],
|
|
2960
|
+
], De = new Map([
|
|
3192
2961
|
// All modules go here
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
].map((
|
|
3200
|
-
class
|
|
2962
|
+
qt,
|
|
2963
|
+
Vt,
|
|
2964
|
+
et,
|
|
2965
|
+
Dt,
|
|
2966
|
+
$t,
|
|
2967
|
+
jt
|
|
2968
|
+
].map((r) => [r.moduleName, r]));
|
|
2969
|
+
class Gt {
|
|
3201
2970
|
/**
|
|
3202
2971
|
* @param wnd Window instance to operate on
|
|
3203
2972
|
* @param initialModules List of initial modules to load
|
|
3204
2973
|
*/
|
|
3205
2974
|
constructor(e = window, t = []) {
|
|
3206
|
-
this.loadedModules = [], this.wnd = e, this.comms = new
|
|
3207
|
-
const
|
|
3208
|
-
if (
|
|
2975
|
+
this.loadedModules = [], this.wnd = e, this.comms = new at(e);
|
|
2976
|
+
const i = [...new Set(t)];
|
|
2977
|
+
if (i.length) {
|
|
3209
2978
|
if (typeof e > "u")
|
|
3210
2979
|
throw Error("Loader is not in a web browser");
|
|
3211
|
-
e.parent !== e && this.comms.log("Loader is probably in a frame"), this.loadedModules =
|
|
3212
|
-
const
|
|
3213
|
-
if (
|
|
3214
|
-
return
|
|
3215
|
-
}).filter((
|
|
2980
|
+
e.parent !== e && this.comms.log("Loader is probably in a frame"), this.loadedModules = i.map((s) => {
|
|
2981
|
+
const n = this.loadModule(s);
|
|
2982
|
+
if (n)
|
|
2983
|
+
return n.mount(this.wnd, this.comms), n;
|
|
2984
|
+
}).filter((s) => s !== void 0);
|
|
3216
2985
|
}
|
|
3217
2986
|
}
|
|
3218
2987
|
loadModule(e) {
|
|
3219
|
-
const t =
|
|
2988
|
+
const t = De.get(e);
|
|
3220
2989
|
return t === void 0 ? (this.comms.log(`Module "${name}" does not exist in the library`), t) : new t();
|
|
3221
2990
|
}
|
|
3222
2991
|
/**
|
|
@@ -3234,11 +3003,11 @@ class Vi {
|
|
|
3234
3003
|
* @returns Success
|
|
3235
3004
|
*/
|
|
3236
3005
|
removeModule(e) {
|
|
3237
|
-
const t =
|
|
3006
|
+
const t = De.get(e);
|
|
3238
3007
|
if (t === void 0)
|
|
3239
3008
|
return this.comms.log(`Module "${e}" does not exist in the library`), !1;
|
|
3240
|
-
const
|
|
3241
|
-
return
|
|
3009
|
+
const i = this.loadedModules.findIndex((s) => s instanceof t);
|
|
3010
|
+
return i < 0 ? !1 : (this.loadedModules[i].unmount(this.wnd, this.comms), this.loadedModules.splice(i, 1), !0);
|
|
3242
3011
|
}
|
|
3243
3012
|
/**
|
|
3244
3013
|
* Unmount and remove all modules
|
|
@@ -3248,16 +3017,16 @@ class Vi {
|
|
|
3248
3017
|
}
|
|
3249
3018
|
}
|
|
3250
3019
|
export {
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3020
|
+
k as COMMS_VERSION,
|
|
3021
|
+
at as Comms,
|
|
3022
|
+
Dt as Decorator,
|
|
3023
|
+
_t as FXLModules,
|
|
3024
|
+
Lt as Layout,
|
|
3025
|
+
Gt as Loader,
|
|
3026
|
+
Y as Module,
|
|
3027
|
+
De as ModuleLibrary,
|
|
3028
|
+
et as Peripherals,
|
|
3029
|
+
Xt as ReflowableModules,
|
|
3030
|
+
It as Width,
|
|
3031
|
+
ot as mid
|
|
3263
3032
|
};
|