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