clarity-js 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/clarity.insight.js +1 -1
- package/build/clarity.js +1303 -1318
- package/build/clarity.min.js +1 -1
- package/build/clarity.module.js +1303 -1318
- package/package.json +1 -1
- package/src/core/config.ts +0 -1
- package/src/core/version.ts +1 -1
- package/src/data/encode.ts +1 -1
- package/src/data/extract.ts +45 -34
- package/src/data/upload.ts +22 -14
- package/src/layout/dom.ts +4 -35
- package/src/layout/mutation.ts +4 -4
- package/types/core.d.ts +0 -2
- package/types/data.d.ts +5 -3
- package/types/layout.d.ts +0 -1
package/build/clarity.module.js
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
var dom = /*#__PURE__*/Object.freeze({
|
|
2
|
-
__proto__: null,
|
|
3
|
-
get add () { return add; },
|
|
4
|
-
get get () { return get; },
|
|
5
|
-
get getId () { return getId; },
|
|
6
|
-
get getNode () { return getNode; },
|
|
7
|
-
get getValue () { return getValue; },
|
|
8
|
-
get has () { return has; },
|
|
9
|
-
get hashText () { return hashText; },
|
|
10
|
-
get iframe () { return iframe; },
|
|
11
|
-
get lookup () { return lookup; },
|
|
12
|
-
get parse () { return parse$1; },
|
|
13
|
-
get sameorigin () { return sameorigin; },
|
|
14
|
-
get start () { return start$i; },
|
|
15
|
-
get stop () { return stop$g; },
|
|
16
|
-
get update () { return update$1; },
|
|
17
|
-
get updates () { return updates$2; }
|
|
18
|
-
});
|
|
19
1
|
var upload$1 = /*#__PURE__*/Object.freeze({
|
|
20
2
|
__proto__: null,
|
|
21
3
|
get queue () { return queue; },
|
|
@@ -28,11 +10,11 @@ var extract = /*#__PURE__*/Object.freeze({
|
|
|
28
10
|
get clone () { return clone; },
|
|
29
11
|
get compute () { return compute$4; },
|
|
30
12
|
get data () { return data$5; },
|
|
31
|
-
get fragments () { return fragments; },
|
|
32
13
|
get keys () { return keys; },
|
|
33
14
|
get reset () { return reset$4; },
|
|
34
15
|
get start () { return start$c; },
|
|
35
16
|
get stop () { return stop$b; },
|
|
17
|
+
get trigger () { return trigger$1; },
|
|
36
18
|
get update () { return update; }
|
|
37
19
|
});
|
|
38
20
|
var limit = /*#__PURE__*/Object.freeze({
|
|
@@ -135,7 +117,6 @@ var config$1 = {
|
|
|
135
117
|
mask: [],
|
|
136
118
|
unmask: [],
|
|
137
119
|
regions: [],
|
|
138
|
-
extract: [],
|
|
139
120
|
cookies: [],
|
|
140
121
|
fraud: true,
|
|
141
122
|
checksum: [],
|
|
@@ -166,7 +147,7 @@ function stop$C() {
|
|
|
166
147
|
startTime = 0;
|
|
167
148
|
}
|
|
168
149
|
|
|
169
|
-
var version$1 = "0.7.
|
|
150
|
+
var version$1 = "0.7.4";
|
|
170
151
|
|
|
171
152
|
// tslint:disable: no-bitwise
|
|
172
153
|
function hash (input, precision) {
|
|
@@ -919,168 +900,540 @@ var selector = /*#__PURE__*/Object.freeze({
|
|
|
919
900
|
reset: reset$l
|
|
920
901
|
});
|
|
921
902
|
|
|
922
|
-
|
|
923
|
-
var
|
|
924
|
-
var
|
|
925
|
-
var
|
|
926
|
-
var
|
|
927
|
-
var
|
|
928
|
-
var
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
903
|
+
var index = 1;
|
|
904
|
+
var nodes = [];
|
|
905
|
+
var values = [];
|
|
906
|
+
var updateMap = [];
|
|
907
|
+
var hashMap = {};
|
|
908
|
+
var override = [];
|
|
909
|
+
var unmask = [];
|
|
910
|
+
var maskText = [];
|
|
911
|
+
var maskExclude = [];
|
|
912
|
+
var maskDisable = [];
|
|
913
|
+
var maskTags = [];
|
|
914
|
+
// The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
|
|
915
|
+
var idMap = null; // Maps node => id.
|
|
916
|
+
var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
|
|
917
|
+
var privacyMap = null; // Maps node => Privacy (enum)
|
|
918
|
+
var fraudMap = null; // Maps node => FraudId (number)
|
|
919
|
+
function start$x() {
|
|
920
|
+
reset$k();
|
|
921
|
+
parse$1(document, true);
|
|
935
922
|
}
|
|
936
|
-
function
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
923
|
+
function stop$u() {
|
|
924
|
+
reset$k();
|
|
925
|
+
}
|
|
926
|
+
function reset$k() {
|
|
927
|
+
index = 1;
|
|
928
|
+
nodes = [];
|
|
929
|
+
values = [];
|
|
930
|
+
updateMap = [];
|
|
931
|
+
hashMap = {};
|
|
932
|
+
override = [];
|
|
933
|
+
unmask = [];
|
|
934
|
+
maskText = "address,password,contact" /* Mask.Text */.split("," /* Constant.Comma */);
|
|
935
|
+
maskExclude = "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.split("," /* Constant.Comma */);
|
|
936
|
+
maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
|
|
937
|
+
maskTags = "INPUT,SELECT,TEXTAREA" /* Mask.Tags */.split("," /* Constant.Comma */);
|
|
938
|
+
idMap = new WeakMap();
|
|
939
|
+
iframeMap = new WeakMap();
|
|
940
|
+
privacyMap = new WeakMap();
|
|
941
|
+
fraudMap = new WeakMap();
|
|
942
|
+
reset$l();
|
|
943
|
+
}
|
|
944
|
+
// We parse new root nodes for any regions or masked nodes in the beginning (document) and
|
|
945
|
+
// later whenever there are new additions or modifications to DOM (mutations)
|
|
946
|
+
function parse$1(root, init) {
|
|
947
|
+
if (init === void 0) { init = false; }
|
|
948
|
+
// Wrap selectors in a try / catch block.
|
|
949
|
+
// It's possible for script to receive invalid selectors, e.g. "'#id'" with extra quotes, and cause the code below to fail
|
|
950
|
+
try {
|
|
951
|
+
// Parse unmask configuration into separate query selectors and override tokens as part of initialization
|
|
952
|
+
if (init) {
|
|
953
|
+
config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
|
|
954
|
+
}
|
|
955
|
+
// Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
|
|
956
|
+
// We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
|
|
957
|
+
if ("querySelectorAll" in root) {
|
|
958
|
+
config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$c(e, "".concat(x[0])); }); }); // Regions
|
|
959
|
+
config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
|
|
960
|
+
config$1.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
|
|
961
|
+
unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
|
|
942
962
|
}
|
|
943
963
|
}
|
|
964
|
+
catch (e) {
|
|
965
|
+
log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
|
|
966
|
+
}
|
|
944
967
|
}
|
|
945
|
-
function
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
968
|
+
function getId(node, autogen) {
|
|
969
|
+
if (autogen === void 0) { autogen = false; }
|
|
970
|
+
if (node === null) {
|
|
971
|
+
return null;
|
|
972
|
+
}
|
|
973
|
+
var id = idMap.get(node);
|
|
974
|
+
if (!id && autogen) {
|
|
975
|
+
id = index++;
|
|
976
|
+
idMap.set(node, id);
|
|
977
|
+
}
|
|
978
|
+
return id ? id : null;
|
|
950
979
|
}
|
|
951
|
-
function
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
980
|
+
function add(node, parent, data, source) {
|
|
981
|
+
var id = getId(node, true);
|
|
982
|
+
var parentId = parent ? getId(parent) : null;
|
|
983
|
+
var previousId = getPreviousId(node);
|
|
984
|
+
var parentValue = null;
|
|
985
|
+
var regionId = exists(node) ? id : null;
|
|
986
|
+
var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
|
|
987
|
+
var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
|
|
988
|
+
if (parentId >= 0 && values[parentId]) {
|
|
989
|
+
parentValue = values[parentId];
|
|
990
|
+
parentValue.children.push(id);
|
|
991
|
+
regionId = regionId === null ? parentValue.region : regionId;
|
|
992
|
+
fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
|
|
993
|
+
privacyId = parentValue.metadata.privacy;
|
|
994
|
+
}
|
|
995
|
+
// If there's an explicit region attribute set on the element, use it to mark a region on the page
|
|
996
|
+
if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
|
|
997
|
+
observe$c(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
|
|
998
|
+
regionId = id;
|
|
999
|
+
}
|
|
1000
|
+
nodes[id] = node;
|
|
1001
|
+
values[id] = {
|
|
1002
|
+
id: id,
|
|
1003
|
+
parent: parentId,
|
|
1004
|
+
previous: previousId,
|
|
1005
|
+
children: [],
|
|
1006
|
+
data: data,
|
|
1007
|
+
selector: null,
|
|
1008
|
+
hash: null,
|
|
1009
|
+
region: regionId,
|
|
1010
|
+
metadata: { active: true, suspend: false, privacy: privacyId, position: null, fraud: fraudId, size: null },
|
|
1011
|
+
};
|
|
1012
|
+
privacy(node, values[id], parentValue);
|
|
1013
|
+
updateSelector(values[id]);
|
|
1014
|
+
size$1(values[id]);
|
|
1015
|
+
track$5(id, source);
|
|
978
1016
|
}
|
|
979
|
-
function
|
|
980
|
-
var
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
1017
|
+
function update$1(node, parent, data, source) {
|
|
1018
|
+
var id = getId(node);
|
|
1019
|
+
var parentId = parent ? getId(parent) : null;
|
|
1020
|
+
var previousId = getPreviousId(node);
|
|
1021
|
+
var changed = false;
|
|
1022
|
+
var parentChanged = false;
|
|
1023
|
+
if (id in values) {
|
|
1024
|
+
var value = values[id];
|
|
1025
|
+
value.metadata.active = true;
|
|
1026
|
+
// Handle case where internal ordering may have changed
|
|
1027
|
+
if (value.previous !== previousId) {
|
|
1028
|
+
changed = true;
|
|
1029
|
+
value.previous = previousId;
|
|
1030
|
+
}
|
|
1031
|
+
// Handle case where parent might have been updated
|
|
1032
|
+
if (value.parent !== parentId) {
|
|
1033
|
+
changed = true;
|
|
1034
|
+
var oldParentId = value.parent;
|
|
1035
|
+
value.parent = parentId;
|
|
1036
|
+
// Move this node to the right location under new parent
|
|
1037
|
+
if (parentId !== null && parentId >= 0) {
|
|
1038
|
+
var childIndex = previousId === null ? 0 : values[parentId].children.indexOf(previousId) + 1;
|
|
1039
|
+
values[parentId].children.splice(childIndex, 0, id);
|
|
1040
|
+
// Update region after the move
|
|
1041
|
+
value.region = exists(node) ? id : values[parentId].region;
|
|
989
1042
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
}).catch(function (error) {
|
|
994
|
-
// If one of the scheduled tasks failed, log, recover and continue processing rest of the tasks
|
|
995
|
-
if (entry.id !== id()) {
|
|
996
|
-
return;
|
|
1043
|
+
else {
|
|
1044
|
+
// Mark this element as deleted if the parent has been updated to null
|
|
1045
|
+
remove(id, source);
|
|
997
1046
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1047
|
+
// Remove reference to this node from the old parent
|
|
1048
|
+
if (oldParentId !== null && oldParentId >= 0) {
|
|
1049
|
+
var nodeIndex = values[oldParentId].children.indexOf(id);
|
|
1050
|
+
if (nodeIndex >= 0) {
|
|
1051
|
+
values[oldParentId].children.splice(nodeIndex, 1);
|
|
1052
|
+
}
|
|
1000
1053
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1054
|
+
parentChanged = true;
|
|
1055
|
+
}
|
|
1056
|
+
// Update data
|
|
1057
|
+
for (var key in data) {
|
|
1058
|
+
if (diff(value["data"], data, key)) {
|
|
1059
|
+
changed = true;
|
|
1060
|
+
value["data"][key] = data[key];
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
// Update selector
|
|
1064
|
+
updateSelector(value);
|
|
1065
|
+
track$5(id, source, changed, parentChanged);
|
|
1004
1066
|
}
|
|
1005
1067
|
}
|
|
1006
|
-
function
|
|
1007
|
-
var
|
|
1008
|
-
if (
|
|
1009
|
-
var
|
|
1010
|
-
|
|
1068
|
+
function sameorigin(node) {
|
|
1069
|
+
var output = false;
|
|
1070
|
+
if (node.nodeType === Node.ELEMENT_NODE && node.tagName === "IFRAME" /* Constant.IFrameTag */) {
|
|
1071
|
+
var frame = node;
|
|
1072
|
+
// To determine if the iframe is same-origin or not, we try accessing it's contentDocument.
|
|
1073
|
+
// If the browser throws an exception, we assume it's cross-origin and move on.
|
|
1074
|
+
// However, if we do a get a valid document object back, we assume the contents are accessible and iframe is same-origin.
|
|
1075
|
+
try {
|
|
1076
|
+
var doc = frame.contentDocument;
|
|
1077
|
+
if (doc) {
|
|
1078
|
+
iframeMap.set(frame.contentDocument, frame);
|
|
1079
|
+
output = true;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
catch ( /* do nothing */_a) { /* do nothing */ }
|
|
1011
1083
|
}
|
|
1012
|
-
|
|
1013
|
-
return 2 /* Task.Stop */;
|
|
1084
|
+
return output;
|
|
1014
1085
|
}
|
|
1015
|
-
function
|
|
1016
|
-
|
|
1086
|
+
function iframe(node) {
|
|
1087
|
+
var doc = node.nodeType === Node.DOCUMENT_NODE ? node : null;
|
|
1088
|
+
return doc && iframeMap.has(doc) ? iframeMap.get(doc) : null;
|
|
1017
1089
|
}
|
|
1018
|
-
function
|
|
1019
|
-
var
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1090
|
+
function privacy(node, value, parent) {
|
|
1091
|
+
var data = value.data;
|
|
1092
|
+
var metadata = value.metadata;
|
|
1093
|
+
var current = metadata.privacy;
|
|
1094
|
+
var attributes = data.attributes || {};
|
|
1095
|
+
var tag = data.tag.toUpperCase();
|
|
1096
|
+
switch (true) {
|
|
1097
|
+
case maskTags.indexOf(tag) >= 0:
|
|
1098
|
+
var type = attributes["type" /* Constant.Type */];
|
|
1099
|
+
var meta_1 = "" /* Constant.Empty */;
|
|
1100
|
+
Object.keys(attributes).forEach(function (x) { return meta_1 += attributes[x].toLowerCase(); });
|
|
1101
|
+
var exclude = maskExclude.some(function (x) { return meta_1.indexOf(x) >= 0; });
|
|
1102
|
+
// Regardless of privacy mode, always mask off user input from input boxes or drop downs with two exceptions:
|
|
1103
|
+
// (1) The node is detected to be one of the excluded fields, in which case we drop everything
|
|
1104
|
+
// (2) The node's type is one of the allowed types (like checkboxes)
|
|
1105
|
+
metadata.privacy = tag === "INPUT" /* Constant.InputTag */ && maskDisable.indexOf(type) >= 0 ? current : (exclude ? 4 /* Privacy.Exclude */ : 2 /* Privacy.Text */);
|
|
1106
|
+
break;
|
|
1107
|
+
case "data-clarity-mask" /* Constant.MaskData */ in attributes:
|
|
1108
|
+
metadata.privacy = 3 /* Privacy.TextImage */;
|
|
1109
|
+
break;
|
|
1110
|
+
case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
|
|
1111
|
+
metadata.privacy = 0 /* Privacy.None */;
|
|
1112
|
+
break;
|
|
1113
|
+
case privacyMap.has(node):
|
|
1114
|
+
// If this node was explicitly configured to contain sensitive content, honor that privacy setting
|
|
1115
|
+
metadata.privacy = privacyMap.get(node);
|
|
1116
|
+
break;
|
|
1117
|
+
case fraudMap.has(node):
|
|
1118
|
+
// If this node was explicitly configured to be evaluated for fraud, then also mask content
|
|
1119
|
+
metadata.privacy = 2 /* Privacy.Text */;
|
|
1120
|
+
break;
|
|
1121
|
+
case tag === "*T" /* Constant.TextTag */:
|
|
1122
|
+
// If it's a text node belonging to a STYLE or TITLE tag or one of scrub exceptions, then capture content
|
|
1123
|
+
var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
|
|
1124
|
+
var pSelector_1 = parent && parent.selector ? parent.selector[1 /* Selector.Default */] : "" /* Constant.Empty */;
|
|
1125
|
+
var tags = ["STYLE" /* Constant.StyleTag */, "TITLE" /* Constant.TitleTag */, "svg:style" /* Constant.SvgStyle */];
|
|
1126
|
+
metadata.privacy = tags.includes(pTag) || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
|
|
1127
|
+
break;
|
|
1128
|
+
case current === 1 /* Privacy.Sensitive */:
|
|
1129
|
+
// In a mode where we mask sensitive information by default, look through class names to aggressively mask content
|
|
1130
|
+
metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
|
|
1131
|
+
break;
|
|
1026
1132
|
}
|
|
1027
1133
|
}
|
|
1028
|
-
function
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
var duration = end - tracker[id].start;
|
|
1032
|
-
sum(timer.cost, duration);
|
|
1033
|
-
count$1(5 /* Metric.InvokeCount */);
|
|
1034
|
-
// For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
|
|
1035
|
-
// However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
|
|
1036
|
-
if (tracker[id].calls > 0) {
|
|
1037
|
-
sum(4 /* Metric.TotalCost */, duration);
|
|
1134
|
+
function inspect(input, lookup, metadata) {
|
|
1135
|
+
if (input && lookup.some(function (x) { return input.indexOf(x) >= 0; })) {
|
|
1136
|
+
return 2 /* Privacy.Text */;
|
|
1038
1137
|
}
|
|
1138
|
+
return metadata.privacy;
|
|
1039
1139
|
}
|
|
1040
|
-
function
|
|
1041
|
-
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
case 0:
|
|
1046
|
-
id = key(timer);
|
|
1047
|
-
if (!(id in tracker)) return [3 /*break*/, 2];
|
|
1048
|
-
stop$u(timer);
|
|
1049
|
-
_a = tracker[id];
|
|
1050
|
-
return [4 /*yield*/, wait()];
|
|
1051
|
-
case 1:
|
|
1052
|
-
_a.yield = (_b.sent()).timeRemaining();
|
|
1053
|
-
restart$2(timer);
|
|
1054
|
-
_b.label = 2;
|
|
1055
|
-
case 2:
|
|
1056
|
-
// After we are done with suspending task, ensure that we are still operating in the right context
|
|
1057
|
-
// If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
|
|
1058
|
-
return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
|
|
1140
|
+
function diff(a, b, field) {
|
|
1141
|
+
if (typeof a[field] === "object" && typeof b[field] === "object") {
|
|
1142
|
+
for (var key in a[field]) {
|
|
1143
|
+
if (a[field][key] !== b[field][key]) {
|
|
1144
|
+
return true;
|
|
1059
1145
|
}
|
|
1146
|
+
}
|
|
1147
|
+
for (var key in b[field]) {
|
|
1148
|
+
if (b[field][key] !== a[field][key]) {
|
|
1149
|
+
return true;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
return false;
|
|
1153
|
+
}
|
|
1154
|
+
return a[field] !== b[field];
|
|
1155
|
+
}
|
|
1156
|
+
function position(parent, child) {
|
|
1157
|
+
child.metadata.position = 1;
|
|
1158
|
+
var idx = parent ? parent.children.indexOf(child.id) : -1;
|
|
1159
|
+
while (idx-- > 0) {
|
|
1160
|
+
var sibling = values[parent.children[idx]];
|
|
1161
|
+
if (child.data.tag === sibling.data.tag) {
|
|
1162
|
+
child.metadata.position = sibling.metadata.position + 1;
|
|
1163
|
+
break;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return child.metadata.position;
|
|
1167
|
+
}
|
|
1168
|
+
function updateSelector(value) {
|
|
1169
|
+
var parent = value.parent && value.parent in values ? values[value.parent] : null;
|
|
1170
|
+
var prefix = parent ? parent.selector : null;
|
|
1171
|
+
var d = value.data;
|
|
1172
|
+
var p = position(parent, value);
|
|
1173
|
+
var s = { id: value.id, tag: d.tag, prefix: prefix, position: p, attributes: d.attributes };
|
|
1174
|
+
value.selector = [get$1(s, 0 /* Selector.Alpha */), get$1(s, 1 /* Selector.Beta */)];
|
|
1175
|
+
value.hash = value.selector.map(function (x) { return x ? hash(x) : null; });
|
|
1176
|
+
value.hash.forEach(function (h) { return hashMap[h] = value.id; });
|
|
1177
|
+
}
|
|
1178
|
+
function hashText(hash) {
|
|
1179
|
+
var id = lookup(hash);
|
|
1180
|
+
var node = getNode(id);
|
|
1181
|
+
return node !== null && node.textContent !== null ? node.textContent.substr(0, 25 /* Setting.ClickText */) : '';
|
|
1182
|
+
}
|
|
1183
|
+
function getNode(id) {
|
|
1184
|
+
if (id in nodes) {
|
|
1185
|
+
return nodes[id];
|
|
1186
|
+
}
|
|
1187
|
+
return null;
|
|
1188
|
+
}
|
|
1189
|
+
function getValue(id) {
|
|
1190
|
+
if (id in values) {
|
|
1191
|
+
return values[id];
|
|
1192
|
+
}
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
function get(node) {
|
|
1196
|
+
var id = getId(node);
|
|
1197
|
+
return id in values ? values[id] : null;
|
|
1198
|
+
}
|
|
1199
|
+
function lookup(hash) {
|
|
1200
|
+
return hash in hashMap ? hashMap[hash] : null;
|
|
1201
|
+
}
|
|
1202
|
+
function has(node) {
|
|
1203
|
+
return getId(node) in nodes;
|
|
1204
|
+
}
|
|
1205
|
+
function updates$2() {
|
|
1206
|
+
var output = [];
|
|
1207
|
+
for (var _i = 0, updateMap_1 = updateMap; _i < updateMap_1.length; _i++) {
|
|
1208
|
+
var id = updateMap_1[_i];
|
|
1209
|
+
if (id in values) {
|
|
1210
|
+
output.push(values[id]);
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
updateMap = [];
|
|
1214
|
+
return output;
|
|
1215
|
+
}
|
|
1216
|
+
function remove(id, source) {
|
|
1217
|
+
if (id in values) {
|
|
1218
|
+
var value = values[id];
|
|
1219
|
+
value.metadata.active = false;
|
|
1220
|
+
value.parent = null;
|
|
1221
|
+
track$5(id, source);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
function size$1(value) {
|
|
1225
|
+
// If this element is a image node, and is masked, then track box model for the current element
|
|
1226
|
+
if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
|
|
1227
|
+
value.metadata.size = [];
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
function getPreviousId(node) {
|
|
1231
|
+
var id = null;
|
|
1232
|
+
// Some nodes may not have an ID by design since Clarity skips over tags like SCRIPT, NOSCRIPT, META, COMMENTS, etc..
|
|
1233
|
+
// In that case, we keep going back and check for their sibling until we find a sibling with ID or no more sibling nodes are left.
|
|
1234
|
+
while (id === null && node.previousSibling) {
|
|
1235
|
+
id = getId(node.previousSibling);
|
|
1236
|
+
node = node.previousSibling;
|
|
1237
|
+
}
|
|
1238
|
+
return id;
|
|
1239
|
+
}
|
|
1240
|
+
function track$5(id, source, changed, parentChanged) {
|
|
1241
|
+
if (changed === void 0) { changed = true; }
|
|
1242
|
+
if (parentChanged === void 0) { parentChanged = false; }
|
|
1243
|
+
// Keep track of the order in which mutations happened, they may not be sequential
|
|
1244
|
+
// Edge case: If an element is added later on, and pre-discovered element is moved as a child.
|
|
1245
|
+
// In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
|
|
1246
|
+
var uIndex = updateMap.indexOf(id);
|
|
1247
|
+
if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
|
|
1248
|
+
updateMap.splice(uIndex, 1);
|
|
1249
|
+
updateMap.push(id);
|
|
1250
|
+
}
|
|
1251
|
+
else if (uIndex === -1 && changed) {
|
|
1252
|
+
updateMap.push(id);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
var dom = /*#__PURE__*/Object.freeze({
|
|
1257
|
+
__proto__: null,
|
|
1258
|
+
add: add,
|
|
1259
|
+
get: get,
|
|
1260
|
+
getId: getId,
|
|
1261
|
+
getNode: getNode,
|
|
1262
|
+
getValue: getValue,
|
|
1263
|
+
has: has,
|
|
1264
|
+
hashText: hashText,
|
|
1265
|
+
iframe: iframe,
|
|
1266
|
+
lookup: lookup,
|
|
1267
|
+
parse: parse$1,
|
|
1268
|
+
sameorigin: sameorigin,
|
|
1269
|
+
start: start$x,
|
|
1270
|
+
stop: stop$u,
|
|
1271
|
+
update: update$1,
|
|
1272
|
+
updates: updates$2
|
|
1273
|
+
});
|
|
1274
|
+
|
|
1275
|
+
// Track the start time to be able to compute duration at the end of the task
|
|
1276
|
+
var idleTimeout = 5000;
|
|
1277
|
+
var tracker = {};
|
|
1278
|
+
var queuedTasks = [];
|
|
1279
|
+
var activeTask = null;
|
|
1280
|
+
var pauseTask = null;
|
|
1281
|
+
var resumeResolve = null;
|
|
1282
|
+
function pause$1() {
|
|
1283
|
+
if (pauseTask === null) {
|
|
1284
|
+
pauseTask = new Promise(function (resolve) {
|
|
1285
|
+
resumeResolve = resolve;
|
|
1060
1286
|
});
|
|
1061
|
-
}
|
|
1287
|
+
}
|
|
1062
1288
|
}
|
|
1063
|
-
function
|
|
1064
|
-
|
|
1289
|
+
function resume$1() {
|
|
1290
|
+
if (pauseTask) {
|
|
1291
|
+
resumeResolve();
|
|
1292
|
+
pauseTask = null;
|
|
1293
|
+
if (activeTask === null) {
|
|
1294
|
+
run();
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1065
1297
|
}
|
|
1066
|
-
function
|
|
1298
|
+
function reset$j() {
|
|
1299
|
+
tracker = {};
|
|
1300
|
+
queuedTasks = [];
|
|
1301
|
+
activeTask = null;
|
|
1302
|
+
pauseTask = null;
|
|
1303
|
+
}
|
|
1304
|
+
function schedule$1(task, priority) {
|
|
1305
|
+
if (priority === void 0) { priority = 0 /* Priority.Normal */; }
|
|
1067
1306
|
return __awaiter(this, void 0, void 0, function () {
|
|
1307
|
+
var _i, queuedTasks_1, q, promise;
|
|
1068
1308
|
return __generator(this, function (_a) {
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1309
|
+
// If this task is already scheduled, skip it
|
|
1310
|
+
for (_i = 0, queuedTasks_1 = queuedTasks; _i < queuedTasks_1.length; _i++) {
|
|
1311
|
+
q = queuedTasks_1[_i];
|
|
1312
|
+
if (q.task === task) {
|
|
1313
|
+
return [2 /*return*/];
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
promise = new Promise(function (resolve) {
|
|
1317
|
+
var insert = priority === 1 /* Priority.High */ ? "unshift" : "push";
|
|
1318
|
+
// Queue this task for asynchronous execution later
|
|
1319
|
+
// We also store a unique page identifier (id) along with the task to ensure
|
|
1320
|
+
// ensure that we do not accidentally execute this task in context of a different page
|
|
1321
|
+
queuedTasks[insert]({ task: task, resolve: resolve, id: id() });
|
|
1322
|
+
});
|
|
1323
|
+
// If there is no active task running, and Clarity is not in pause state,
|
|
1324
|
+
// invoke the first task in the queue synchronously. This ensures that we don't yield the thread during unload event
|
|
1325
|
+
if (activeTask === null && pauseTask === null) {
|
|
1326
|
+
run();
|
|
1079
1327
|
}
|
|
1328
|
+
return [2 /*return*/, promise];
|
|
1080
1329
|
});
|
|
1081
1330
|
});
|
|
1082
1331
|
}
|
|
1083
|
-
|
|
1332
|
+
function run() {
|
|
1333
|
+
var entry = queuedTasks.shift();
|
|
1334
|
+
if (entry) {
|
|
1335
|
+
activeTask = entry;
|
|
1336
|
+
entry.task().then(function () {
|
|
1337
|
+
// Bail out if the context in which this task was operating is different from the current page
|
|
1338
|
+
// An example scenario where task could span across pages is Single Page Applications (SPA)
|
|
1339
|
+
// A task that started on page #1, but completes on page #2
|
|
1340
|
+
if (entry.id !== id()) {
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
entry.resolve();
|
|
1344
|
+
activeTask = null; // Reset active task back to null now that the promise is resolved
|
|
1345
|
+
run();
|
|
1346
|
+
}).catch(function (error) {
|
|
1347
|
+
// If one of the scheduled tasks failed, log, recover and continue processing rest of the tasks
|
|
1348
|
+
if (entry.id !== id()) {
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
if (error) {
|
|
1352
|
+
log$1(0 /* Code.RunTask */, 1 /* Severity.Warning */, error.name, error.message, error.stack);
|
|
1353
|
+
}
|
|
1354
|
+
activeTask = null;
|
|
1355
|
+
run();
|
|
1356
|
+
});
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
function state$9(timer) {
|
|
1360
|
+
var id = key(timer);
|
|
1361
|
+
if (id in tracker) {
|
|
1362
|
+
var elapsed = performance.now() - tracker[id].start;
|
|
1363
|
+
return (elapsed > tracker[id].yield) ? 0 /* Task.Wait */ : 1 /* Task.Run */;
|
|
1364
|
+
}
|
|
1365
|
+
// If this task is no longer being tracked, send stop message to the caller
|
|
1366
|
+
return 2 /* Task.Stop */;
|
|
1367
|
+
}
|
|
1368
|
+
function start$w(timer) {
|
|
1369
|
+
tracker[key(timer)] = { start: performance.now(), calls: 0, yield: 30 /* Setting.LongTask */ };
|
|
1370
|
+
}
|
|
1371
|
+
function restart$2(timer) {
|
|
1372
|
+
var id = key(timer);
|
|
1373
|
+
if (tracker && tracker[id]) {
|
|
1374
|
+
var c = tracker[id].calls;
|
|
1375
|
+
var y = tracker[id].yield;
|
|
1376
|
+
start$w(timer);
|
|
1377
|
+
tracker[id].calls = c + 1;
|
|
1378
|
+
tracker[id].yield = y;
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
function stop$t(timer) {
|
|
1382
|
+
var end = performance.now();
|
|
1383
|
+
var id = key(timer);
|
|
1384
|
+
var duration = end - tracker[id].start;
|
|
1385
|
+
sum(timer.cost, duration);
|
|
1386
|
+
count$1(5 /* Metric.InvokeCount */);
|
|
1387
|
+
// For the first execution, which is synchronous, time is automatically counted towards TotalDuration.
|
|
1388
|
+
// However, for subsequent asynchronous runs, we need to manually update TotalDuration metric.
|
|
1389
|
+
if (tracker[id].calls > 0) {
|
|
1390
|
+
sum(4 /* Metric.TotalCost */, duration);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
function suspend$1(timer) {
|
|
1394
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1395
|
+
var id, _a;
|
|
1396
|
+
return __generator(this, function (_b) {
|
|
1397
|
+
switch (_b.label) {
|
|
1398
|
+
case 0:
|
|
1399
|
+
id = key(timer);
|
|
1400
|
+
if (!(id in tracker)) return [3 /*break*/, 2];
|
|
1401
|
+
stop$t(timer);
|
|
1402
|
+
_a = tracker[id];
|
|
1403
|
+
return [4 /*yield*/, wait()];
|
|
1404
|
+
case 1:
|
|
1405
|
+
_a.yield = (_b.sent()).timeRemaining();
|
|
1406
|
+
restart$2(timer);
|
|
1407
|
+
_b.label = 2;
|
|
1408
|
+
case 2:
|
|
1409
|
+
// After we are done with suspending task, ensure that we are still operating in the right context
|
|
1410
|
+
// If the task is still being tracked, continue running the task, otherwise ask caller to stop execution
|
|
1411
|
+
return [2 /*return*/, id in tracker ? 1 /* Task.Run */ : 2 /* Task.Stop */];
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
function key(timer) {
|
|
1417
|
+
return "".concat(timer.id, ".").concat(timer.cost);
|
|
1418
|
+
}
|
|
1419
|
+
function wait() {
|
|
1420
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1421
|
+
return __generator(this, function (_a) {
|
|
1422
|
+
switch (_a.label) {
|
|
1423
|
+
case 0:
|
|
1424
|
+
if (!pauseTask) return [3 /*break*/, 2];
|
|
1425
|
+
return [4 /*yield*/, pauseTask];
|
|
1426
|
+
case 1:
|
|
1427
|
+
_a.sent();
|
|
1428
|
+
_a.label = 2;
|
|
1429
|
+
case 2: return [2 /*return*/, new Promise(function (resolve) {
|
|
1430
|
+
requestIdleCallback(resolve, { timeout: idleTimeout });
|
|
1431
|
+
})];
|
|
1432
|
+
}
|
|
1433
|
+
});
|
|
1434
|
+
});
|
|
1435
|
+
}
|
|
1436
|
+
// Use native implementation of requestIdleCallback if it exists.
|
|
1084
1437
|
// Otherwise, fall back to a custom implementation using requestAnimationFrame & MessageChannel.
|
|
1085
1438
|
// While it's not possible to build a perfect polyfill given the nature of this API, the following code attempts to get close.
|
|
1086
1439
|
// Background context: requestAnimationFrame invokes the js code right before: style, layout and paint computation within the frame.
|
|
@@ -1157,6 +1510,41 @@ function tokenize (tokens) {
|
|
|
1157
1510
|
return output;
|
|
1158
1511
|
}
|
|
1159
1512
|
|
|
1513
|
+
var data$c;
|
|
1514
|
+
function reset$i() {
|
|
1515
|
+
data$c = null;
|
|
1516
|
+
}
|
|
1517
|
+
function start$v() {
|
|
1518
|
+
reset$i();
|
|
1519
|
+
compute$7();
|
|
1520
|
+
}
|
|
1521
|
+
function compute$7() {
|
|
1522
|
+
var body = document.body;
|
|
1523
|
+
var d = document.documentElement;
|
|
1524
|
+
var bodyClientWidth = body ? body.clientWidth : null;
|
|
1525
|
+
var bodyScrollWidth = body ? body.scrollWidth : null;
|
|
1526
|
+
var bodyOffsetWidth = body ? body.offsetWidth : null;
|
|
1527
|
+
var documentClientWidth = d ? d.clientWidth : null;
|
|
1528
|
+
var documentScrollWidth = d ? d.scrollWidth : null;
|
|
1529
|
+
var documentOffsetWidth = d ? d.offsetWidth : null;
|
|
1530
|
+
var width = Math.max(bodyClientWidth, bodyScrollWidth, bodyOffsetWidth, documentClientWidth, documentScrollWidth, documentOffsetWidth);
|
|
1531
|
+
var bodyClientHeight = body ? body.clientHeight : null;
|
|
1532
|
+
var bodyScrollHeight = body ? body.scrollHeight : null;
|
|
1533
|
+
var bodyOffsetHeight = body ? body.offsetHeight : null;
|
|
1534
|
+
var documentClientHeight = d ? d.clientHeight : null;
|
|
1535
|
+
var documentScrollHeight = d ? d.scrollHeight : null;
|
|
1536
|
+
var documentOffsetHeight = d ? d.offsetHeight : null;
|
|
1537
|
+
var height = Math.max(bodyClientHeight, bodyScrollHeight, bodyOffsetHeight, documentClientHeight, documentScrollHeight, documentOffsetHeight);
|
|
1538
|
+
// Check that width or height has changed from before, and also that width & height are not null values
|
|
1539
|
+
if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
|
|
1540
|
+
data$c = { width: width, height: height };
|
|
1541
|
+
encode$4(8 /* Event.Document */);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
function end() {
|
|
1545
|
+
reset$i();
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1160
1548
|
function encode$4 (type, timer, ts) {
|
|
1161
1549
|
if (timer === void 0) { timer = null; }
|
|
1162
1550
|
if (ts === void 0) { ts = null; }
|
|
@@ -1183,7 +1571,7 @@ function encode$4 (type, timer, ts) {
|
|
|
1183
1571
|
queue(tokens);
|
|
1184
1572
|
return [3 /*break*/, 10];
|
|
1185
1573
|
case 2:
|
|
1186
|
-
for (_i = 0, _b = state$
|
|
1574
|
+
for (_i = 0, _b = state$8; _i < _b.length; _i++) {
|
|
1187
1575
|
r = _b[_i];
|
|
1188
1576
|
tokens = [r.time, 7 /* Event.Region */];
|
|
1189
1577
|
tokens.push(r.data.id);
|
|
@@ -1192,7 +1580,7 @@ function encode$4 (type, timer, ts) {
|
|
|
1192
1580
|
tokens.push(r.data.name);
|
|
1193
1581
|
queue(tokens);
|
|
1194
1582
|
}
|
|
1195
|
-
reset$
|
|
1583
|
+
reset$h();
|
|
1196
1584
|
return [3 /*break*/, 10];
|
|
1197
1585
|
case 3:
|
|
1198
1586
|
// Check if we are operating within the context of the current page
|
|
@@ -1227,7 +1615,7 @@ function encode$4 (type, timer, ts) {
|
|
|
1227
1615
|
if (data[key]) {
|
|
1228
1616
|
switch (key) {
|
|
1229
1617
|
case "tag":
|
|
1230
|
-
box = size
|
|
1618
|
+
box = size(value);
|
|
1231
1619
|
factor = mangle ? -1 : 1;
|
|
1232
1620
|
tokens.push(value.id * factor);
|
|
1233
1621
|
if (value.parent && active) {
|
|
@@ -1275,7 +1663,7 @@ function shouldMangle(value) {
|
|
|
1275
1663
|
var privacy = value.metadata.privacy;
|
|
1276
1664
|
return value.data.tag === "*T" /* Constant.TextTag */ && !(privacy === 0 /* Privacy.None */ || privacy === 1 /* Privacy.Sensitive */);
|
|
1277
1665
|
}
|
|
1278
|
-
function size
|
|
1666
|
+
function size(value) {
|
|
1279
1667
|
if (value.metadata.size !== null && value.metadata.size.length === 0) {
|
|
1280
1668
|
var img = getNode(value.id);
|
|
1281
1669
|
if (img) {
|
|
@@ -1291,95 +1679,207 @@ function attribute(key, value, privacy) {
|
|
|
1291
1679
|
return "".concat(key, "=").concat(text$1(value, key, privacy));
|
|
1292
1680
|
}
|
|
1293
1681
|
|
|
1294
|
-
var data$c;
|
|
1295
|
-
function reset$j() {
|
|
1296
|
-
data$c = null;
|
|
1297
|
-
}
|
|
1298
|
-
function start$w() {
|
|
1299
|
-
reset$j();
|
|
1300
|
-
compute$7();
|
|
1301
|
-
}
|
|
1302
|
-
function compute$7() {
|
|
1303
|
-
var body = document.body;
|
|
1304
|
-
var d = document.documentElement;
|
|
1305
|
-
var bodyClientWidth = body ? body.clientWidth : null;
|
|
1306
|
-
var bodyScrollWidth = body ? body.scrollWidth : null;
|
|
1307
|
-
var bodyOffsetWidth = body ? body.offsetWidth : null;
|
|
1308
|
-
var documentClientWidth = d ? d.clientWidth : null;
|
|
1309
|
-
var documentScrollWidth = d ? d.scrollWidth : null;
|
|
1310
|
-
var documentOffsetWidth = d ? d.offsetWidth : null;
|
|
1311
|
-
var width = Math.max(bodyClientWidth, bodyScrollWidth, bodyOffsetWidth, documentClientWidth, documentScrollWidth, documentOffsetWidth);
|
|
1312
|
-
var bodyClientHeight = body ? body.clientHeight : null;
|
|
1313
|
-
var bodyScrollHeight = body ? body.scrollHeight : null;
|
|
1314
|
-
var bodyOffsetHeight = body ? body.offsetHeight : null;
|
|
1315
|
-
var documentClientHeight = d ? d.clientHeight : null;
|
|
1316
|
-
var documentScrollHeight = d ? d.scrollHeight : null;
|
|
1317
|
-
var documentOffsetHeight = d ? d.offsetHeight : null;
|
|
1318
|
-
var height = Math.max(bodyClientHeight, bodyScrollHeight, bodyOffsetHeight, documentClientHeight, documentScrollHeight, documentOffsetHeight);
|
|
1319
|
-
// Check that width or height has changed from before, and also that width & height are not null values
|
|
1320
|
-
if ((data$c === null || width !== data$c.width || height !== data$c.height) && width !== null && height !== null) {
|
|
1321
|
-
data$c = { width: width, height: height };
|
|
1322
|
-
encode$4(8 /* Event.Document */);
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
function end() {
|
|
1326
|
-
reset$j();
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
1682
|
var state$8 = [];
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1683
|
+
var regionMap = null; // Maps region nodes => region name
|
|
1684
|
+
var regions = {};
|
|
1685
|
+
var queue$2 = [];
|
|
1686
|
+
var watch = false;
|
|
1687
|
+
var observer$1 = null;
|
|
1688
|
+
function start$u() {
|
|
1689
|
+
reset$h();
|
|
1690
|
+
observer$1 = null;
|
|
1691
|
+
regionMap = new WeakMap();
|
|
1692
|
+
regions = {};
|
|
1693
|
+
queue$2 = [];
|
|
1694
|
+
watch = window["IntersectionObserver"] ? true : false;
|
|
1335
1695
|
}
|
|
1336
|
-
function
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1696
|
+
function observe$c(node, name) {
|
|
1697
|
+
if (regionMap.has(node) === false) {
|
|
1698
|
+
regionMap.set(node, name);
|
|
1699
|
+
observer$1 = observer$1 === null && watch ? new IntersectionObserver(handler$3, {
|
|
1700
|
+
// Get notified as intersection continues to change
|
|
1701
|
+
// This allows us to process regions that get partially hidden during the lifetime of the page
|
|
1702
|
+
// See: https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#creating_an_intersection_observer
|
|
1703
|
+
// By default, intersection observers only fire an event when even a single pixel is visible and not thereafter.
|
|
1704
|
+
threshold: [0, 0.2, 0.4, 0.6, 0.8, 1]
|
|
1705
|
+
}) : observer$1;
|
|
1706
|
+
if (observer$1 && node && node.nodeType === Node.ELEMENT_NODE) {
|
|
1707
|
+
observer$1.observe(node);
|
|
1708
|
+
}
|
|
1343
1709
|
}
|
|
1344
1710
|
}
|
|
1345
|
-
function
|
|
1346
|
-
|
|
1711
|
+
function exists(node) {
|
|
1712
|
+
// Check if regionMap is not null before looking up a node
|
|
1713
|
+
// Since, dom module stops after region module, it's possible that we may set regionMap to be null
|
|
1714
|
+
// and still attempt to call exists on a late coming DOM mutation (or addition), effectively causing a script error
|
|
1715
|
+
return regionMap && regionMap.has(node);
|
|
1347
1716
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
output.x += element.offsetLeft;
|
|
1361
|
-
output.y += element.offsetTop;
|
|
1362
|
-
element = frame ? frame : parent_1;
|
|
1363
|
-
} while (element);
|
|
1717
|
+
function track$4(id, event) {
|
|
1718
|
+
var node = getNode(id);
|
|
1719
|
+
var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
|
|
1720
|
+
// Determine the interaction state based on incoming event
|
|
1721
|
+
var interaction = 16 /* InteractionState.None */;
|
|
1722
|
+
switch (event) {
|
|
1723
|
+
case 9 /* Event.Click */:
|
|
1724
|
+
interaction = 20 /* InteractionState.Clicked */;
|
|
1725
|
+
break;
|
|
1726
|
+
case 27 /* Event.Input */:
|
|
1727
|
+
interaction = 30 /* InteractionState.Input */;
|
|
1728
|
+
break;
|
|
1364
1729
|
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
var UserInputTags = ["input", "textarea", "radio", "button", "canvas"];
|
|
1369
|
-
var state$7 = [];
|
|
1370
|
-
function start$u() {
|
|
1371
|
-
reset$h();
|
|
1372
|
-
}
|
|
1373
|
-
function observe$b(root) {
|
|
1374
|
-
bind(root, "click", handler$3.bind(this, 9 /* Event.Click */, root), true);
|
|
1730
|
+
// Process updates to this region, if applicable
|
|
1731
|
+
process$6(node, data, interaction, data.visibility);
|
|
1375
1732
|
}
|
|
1376
|
-
function
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
var
|
|
1381
|
-
|
|
1382
|
-
|
|
1733
|
+
function compute$6() {
|
|
1734
|
+
// Process any regions where we couldn't resolve an "id" for at the time of last intersection observer event
|
|
1735
|
+
// This could happen in cases where elements are not yet processed by Clarity's virtual DOM but browser reports a change, regardless.
|
|
1736
|
+
// For those cases we add them to the queue and re-process them below
|
|
1737
|
+
var q = [];
|
|
1738
|
+
for (var _i = 0, queue_1 = queue$2; _i < queue_1.length; _i++) {
|
|
1739
|
+
var r = queue_1[_i];
|
|
1740
|
+
var id = getId(r.node);
|
|
1741
|
+
if (!(id in regions)) {
|
|
1742
|
+
if (id) {
|
|
1743
|
+
r.data.id = id;
|
|
1744
|
+
regions[id] = r.data;
|
|
1745
|
+
state$8.push(clone$1(r.data));
|
|
1746
|
+
}
|
|
1747
|
+
else {
|
|
1748
|
+
q.push(r);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
queue$2 = q;
|
|
1753
|
+
// Schedule encode only when we have at least one valid data entry
|
|
1754
|
+
if (state$8.length > 0) {
|
|
1755
|
+
encode$4(7 /* Event.Region */);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
function handler$3(entries) {
|
|
1759
|
+
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
1760
|
+
var entry = entries_1[_i];
|
|
1761
|
+
var target = entry.target;
|
|
1762
|
+
var rect = entry.boundingClientRect;
|
|
1763
|
+
var overlap = entry.intersectionRect;
|
|
1764
|
+
var viewport = entry.rootBounds;
|
|
1765
|
+
// Only capture regions that have non-zero width or height to avoid tracking and sending regions
|
|
1766
|
+
// that cannot ever be seen by the user. In some cases, websites will have a multiple copy of the same region
|
|
1767
|
+
// like search box - one for desktop, and another for mobile. In those cases, CSS media queries determine which one should be visible.
|
|
1768
|
+
// Also, if these regions ever become non-zero width or height (through AJAX, user action or orientation change) - we will automatically start monitoring them from that point onwards
|
|
1769
|
+
if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
|
|
1770
|
+
var id = target ? getId(target) : null;
|
|
1771
|
+
var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
|
|
1772
|
+
// For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
|
|
1773
|
+
// However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
|
|
1774
|
+
var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
|
|
1775
|
+
var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
|
|
1776
|
+
// If an element is either visible or was visible and has been scrolled to the end
|
|
1777
|
+
// i.e. Scrolled to end is determined by if the starting position of the element + the window height is more than the total element height.
|
|
1778
|
+
// starting position is relative to the viewport - so Intersection observer returns a negative value for rect.top to indicate that the element top is above the viewport
|
|
1779
|
+
var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
|
|
1780
|
+
// Process updates to this region, if applicable
|
|
1781
|
+
process$6(target, data, data.interaction, (scrolledToEnd ?
|
|
1782
|
+
13 /* RegionVisibility.ScrolledToEnd */ :
|
|
1783
|
+
(visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
|
|
1784
|
+
// Stop observing this element now that we have already received scrolled signal
|
|
1785
|
+
if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
|
|
1786
|
+
observer$1.unobserve(target);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
}
|
|
1790
|
+
if (state$8.length > 0) {
|
|
1791
|
+
encode$4(7 /* Event.Region */);
|
|
1792
|
+
}
|
|
1793
|
+
}
|
|
1794
|
+
function process$6(n, d, s, v) {
|
|
1795
|
+
// Check if received a state that supersedes existing state
|
|
1796
|
+
var updated = s > d.interaction || v > d.visibility;
|
|
1797
|
+
d.interaction = s > d.interaction ? s : d.interaction;
|
|
1798
|
+
d.visibility = v > d.visibility ? v : d.visibility;
|
|
1799
|
+
// If the corresponding node is already discovered, update the internal state
|
|
1800
|
+
// Otherwise, track it in a queue to reprocess later.
|
|
1801
|
+
if (d.id) {
|
|
1802
|
+
if ((d.id in regions && updated) || !(d.id in regions)) {
|
|
1803
|
+
regions[d.id] = d;
|
|
1804
|
+
state$8.push(clone$1(d));
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
else {
|
|
1808
|
+
queue$2.push({ node: n, data: d });
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
function clone$1(r) {
|
|
1812
|
+
return { time: time(), data: { id: r.id, interaction: r.interaction, visibility: r.visibility, name: r.name } };
|
|
1813
|
+
}
|
|
1814
|
+
function reset$h() {
|
|
1815
|
+
state$8 = [];
|
|
1816
|
+
}
|
|
1817
|
+
function stop$s() {
|
|
1818
|
+
reset$h();
|
|
1819
|
+
regionMap = null;
|
|
1820
|
+
regions = {};
|
|
1821
|
+
queue$2 = [];
|
|
1822
|
+
if (observer$1) {
|
|
1823
|
+
observer$1.disconnect();
|
|
1824
|
+
observer$1 = null;
|
|
1825
|
+
}
|
|
1826
|
+
watch = false;
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
var state$7 = [];
|
|
1830
|
+
function start$t() {
|
|
1831
|
+
reset$g();
|
|
1832
|
+
}
|
|
1833
|
+
function observe$b(root) {
|
|
1834
|
+
bind(root, "change", recompute$8, true);
|
|
1835
|
+
}
|
|
1836
|
+
function recompute$8(evt) {
|
|
1837
|
+
var element = target(evt);
|
|
1838
|
+
if (element) {
|
|
1839
|
+
var value = element.value;
|
|
1840
|
+
var checksum = value && value.length >= 5 /* Setting.WordLength */ && config$1.fraud ? hash(value, 24 /* Setting.ChecksumPrecision */) : "" /* Constant.Empty */;
|
|
1841
|
+
state$7.push({ time: time(evt), event: 42 /* Event.Change */, data: { target: target(evt), type: element.type, value: value, checksum: checksum } });
|
|
1842
|
+
schedule$1(encode$3.bind(this, 42 /* Event.Change */));
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
function reset$g() {
|
|
1846
|
+
state$7 = [];
|
|
1847
|
+
}
|
|
1848
|
+
function stop$r() {
|
|
1849
|
+
reset$g();
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
function offset (element) {
|
|
1853
|
+
var output = { x: 0, y: 0 };
|
|
1854
|
+
// Walk up the chain to ensure we compute offset distance correctly
|
|
1855
|
+
// In case where we may have nested IFRAMEs, we keep walking up until we get to the top most parent page
|
|
1856
|
+
if (element && element.offsetParent) {
|
|
1857
|
+
do {
|
|
1858
|
+
var parent_1 = element.offsetParent;
|
|
1859
|
+
var frame = parent_1 === null ? iframe(element.ownerDocument) : null;
|
|
1860
|
+
output.x += element.offsetLeft;
|
|
1861
|
+
output.y += element.offsetTop;
|
|
1862
|
+
element = frame ? frame : parent_1;
|
|
1863
|
+
} while (element);
|
|
1864
|
+
}
|
|
1865
|
+
return output;
|
|
1866
|
+
}
|
|
1867
|
+
|
|
1868
|
+
var UserInputTags = ["input", "textarea", "radio", "button", "canvas"];
|
|
1869
|
+
var state$6 = [];
|
|
1870
|
+
function start$s() {
|
|
1871
|
+
reset$f();
|
|
1872
|
+
}
|
|
1873
|
+
function observe$a(root) {
|
|
1874
|
+
bind(root, "click", handler$2.bind(this, 9 /* Event.Click */, root), true);
|
|
1875
|
+
}
|
|
1876
|
+
function handler$2(event, root, evt) {
|
|
1877
|
+
var frame = iframe(root);
|
|
1878
|
+
var d = frame ? frame.contentDocument.documentElement : document.documentElement;
|
|
1879
|
+
var x = "pageX" in evt ? Math.round(evt.pageX) : ("clientX" in evt ? Math.round(evt["clientX"] + d.scrollLeft) : null);
|
|
1880
|
+
var y = "pageY" in evt ? Math.round(evt.pageY) : ("clientY" in evt ? Math.round(evt["clientY"] + d.scrollTop) : null);
|
|
1881
|
+
// In case of iframe, we adjust (x,y) to be relative to top parent's origin
|
|
1882
|
+
if (frame) {
|
|
1383
1883
|
var distance = offset(frame);
|
|
1384
1884
|
x = x ? x + Math.round(distance.x) : x;
|
|
1385
1885
|
y = y ? y + Math.round(distance.y) : y;
|
|
@@ -1401,7 +1901,7 @@ function handler$3(event, root, evt) {
|
|
|
1401
1901
|
var eY = l ? Math.max(Math.floor(((y - l.y) / l.h) * 32767 /* Setting.ClickPrecision */), 0) : 0;
|
|
1402
1902
|
// Check for null values before processing this event
|
|
1403
1903
|
if (x !== null && y !== null) {
|
|
1404
|
-
state$
|
|
1904
|
+
state$6.push({
|
|
1405
1905
|
time: time(evt),
|
|
1406
1906
|
event: event,
|
|
1407
1907
|
data: {
|
|
@@ -1476,39 +1976,39 @@ function context(a) {
|
|
|
1476
1976
|
}
|
|
1477
1977
|
return 0 /* BrowsingContext.Self */;
|
|
1478
1978
|
}
|
|
1479
|
-
function reset$
|
|
1480
|
-
state$
|
|
1979
|
+
function reset$f() {
|
|
1980
|
+
state$6 = [];
|
|
1481
1981
|
}
|
|
1482
|
-
function stop$
|
|
1483
|
-
reset$
|
|
1982
|
+
function stop$q() {
|
|
1983
|
+
reset$f();
|
|
1484
1984
|
}
|
|
1485
1985
|
|
|
1486
|
-
var state$
|
|
1487
|
-
function start$
|
|
1488
|
-
reset$
|
|
1986
|
+
var state$5 = [];
|
|
1987
|
+
function start$r() {
|
|
1988
|
+
reset$e();
|
|
1489
1989
|
}
|
|
1490
|
-
function observe$
|
|
1990
|
+
function observe$9(root) {
|
|
1491
1991
|
bind(root, "cut", recompute$7.bind(this, 0 /* Clipboard.Cut */), true);
|
|
1492
1992
|
bind(root, "copy", recompute$7.bind(this, 1 /* Clipboard.Copy */), true);
|
|
1493
1993
|
bind(root, "paste", recompute$7.bind(this, 2 /* Clipboard.Paste */), true);
|
|
1494
1994
|
}
|
|
1495
1995
|
function recompute$7(action, evt) {
|
|
1496
|
-
state$
|
|
1996
|
+
state$5.push({ time: time(evt), event: 38 /* Event.Clipboard */, data: { target: target(evt), action: action } });
|
|
1497
1997
|
schedule$1(encode$3.bind(this, 38 /* Event.Clipboard */));
|
|
1498
1998
|
}
|
|
1499
|
-
function reset$
|
|
1500
|
-
state$
|
|
1999
|
+
function reset$e() {
|
|
2000
|
+
state$5 = [];
|
|
1501
2001
|
}
|
|
1502
|
-
function stop$
|
|
1503
|
-
reset$
|
|
2002
|
+
function stop$p() {
|
|
2003
|
+
reset$e();
|
|
1504
2004
|
}
|
|
1505
2005
|
|
|
1506
2006
|
var timeout$5 = null;
|
|
1507
|
-
var state$
|
|
1508
|
-
function start$
|
|
1509
|
-
reset$
|
|
2007
|
+
var state$4 = [];
|
|
2008
|
+
function start$q() {
|
|
2009
|
+
reset$d();
|
|
1510
2010
|
}
|
|
1511
|
-
function observe$
|
|
2011
|
+
function observe$8(root) {
|
|
1512
2012
|
bind(root, "input", recompute$6, true);
|
|
1513
2013
|
}
|
|
1514
2014
|
function recompute$6(evt) {
|
|
@@ -1524,31 +2024,31 @@ function recompute$6(evt) {
|
|
|
1524
2024
|
}
|
|
1525
2025
|
var data = { target: input, value: v };
|
|
1526
2026
|
// If last entry in the queue is for the same target node as the current one, remove it so we can later swap it with current data.
|
|
1527
|
-
if (state$
|
|
1528
|
-
state$
|
|
2027
|
+
if (state$4.length > 0 && (state$4[state$4.length - 1].data.target === data.target)) {
|
|
2028
|
+
state$4.pop();
|
|
1529
2029
|
}
|
|
1530
|
-
state$
|
|
2030
|
+
state$4.push({ time: time(evt), event: 27 /* Event.Input */, data: data });
|
|
1531
2031
|
clearTimeout(timeout$5);
|
|
1532
|
-
timeout$5 = setTimeout(process$
|
|
2032
|
+
timeout$5 = setTimeout(process$5, 1000 /* Setting.InputLookAhead */, 27 /* Event.Input */);
|
|
1533
2033
|
}
|
|
1534
2034
|
}
|
|
1535
|
-
function process$
|
|
2035
|
+
function process$5(event) {
|
|
1536
2036
|
schedule$1(encode$3.bind(this, event));
|
|
1537
2037
|
}
|
|
1538
|
-
function reset$
|
|
1539
|
-
state$
|
|
2038
|
+
function reset$d() {
|
|
2039
|
+
state$4 = [];
|
|
1540
2040
|
}
|
|
1541
|
-
function stop$
|
|
2041
|
+
function stop$o() {
|
|
1542
2042
|
clearTimeout(timeout$5);
|
|
1543
|
-
reset$
|
|
2043
|
+
reset$d();
|
|
1544
2044
|
}
|
|
1545
2045
|
|
|
1546
|
-
var state$
|
|
2046
|
+
var state$3 = [];
|
|
1547
2047
|
var timeout$4 = null;
|
|
1548
|
-
function start$
|
|
1549
|
-
reset$
|
|
2048
|
+
function start$p() {
|
|
2049
|
+
reset$c();
|
|
1550
2050
|
}
|
|
1551
|
-
function observe$
|
|
2051
|
+
function observe$7(root) {
|
|
1552
2052
|
bind(root, "mousedown", mouse.bind(this, 13 /* Event.MouseDown */, root), true);
|
|
1553
2053
|
bind(root, "mouseup", mouse.bind(this, 14 /* Event.MouseUp */, root), true);
|
|
1554
2054
|
bind(root, "mousemove", mouse.bind(this, 12 /* Event.MouseMove */, root), true);
|
|
@@ -1572,7 +2072,7 @@ function mouse(event, root, evt) {
|
|
|
1572
2072
|
}
|
|
1573
2073
|
// Check for null values before processing this event
|
|
1574
2074
|
if (x !== null && y !== null) {
|
|
1575
|
-
handler$
|
|
2075
|
+
handler$1({ time: time(evt), event: event, data: { target: target(evt), x: x, y: y } });
|
|
1576
2076
|
}
|
|
1577
2077
|
}
|
|
1578
2078
|
function touch(event, root, evt) {
|
|
@@ -1589,36 +2089,36 @@ function touch(event, root, evt) {
|
|
|
1589
2089
|
y = y && frame ? y + Math.round(frame.offsetTop) : y;
|
|
1590
2090
|
// Check for null values before processing this event
|
|
1591
2091
|
if (x !== null && y !== null) {
|
|
1592
|
-
handler$
|
|
2092
|
+
handler$1({ time: t, event: event, data: { target: target(evt), x: x, y: y } });
|
|
1593
2093
|
}
|
|
1594
2094
|
}
|
|
1595
2095
|
}
|
|
1596
2096
|
}
|
|
1597
|
-
function handler$
|
|
2097
|
+
function handler$1(current) {
|
|
1598
2098
|
switch (current.event) {
|
|
1599
2099
|
case 12 /* Event.MouseMove */:
|
|
1600
2100
|
case 15 /* Event.MouseWheel */:
|
|
1601
2101
|
case 19 /* Event.TouchMove */:
|
|
1602
|
-
var length_1 = state$
|
|
1603
|
-
var last = length_1 > 1 ? state$
|
|
2102
|
+
var length_1 = state$3.length;
|
|
2103
|
+
var last = length_1 > 1 ? state$3[length_1 - 2] : null;
|
|
1604
2104
|
if (last && similar$1(last, current)) {
|
|
1605
|
-
state$
|
|
2105
|
+
state$3.pop();
|
|
1606
2106
|
}
|
|
1607
|
-
state$
|
|
2107
|
+
state$3.push(current);
|
|
1608
2108
|
clearTimeout(timeout$4);
|
|
1609
|
-
timeout$4 = setTimeout(process$
|
|
2109
|
+
timeout$4 = setTimeout(process$4, 500 /* Setting.LookAhead */, current.event);
|
|
1610
2110
|
break;
|
|
1611
2111
|
default:
|
|
1612
|
-
state$
|
|
1613
|
-
process$
|
|
2112
|
+
state$3.push(current);
|
|
2113
|
+
process$4(current.event);
|
|
1614
2114
|
break;
|
|
1615
2115
|
}
|
|
1616
2116
|
}
|
|
1617
|
-
function process$
|
|
2117
|
+
function process$4(event) {
|
|
1618
2118
|
schedule$1(encode$3.bind(this, event));
|
|
1619
2119
|
}
|
|
1620
|
-
function reset$
|
|
1621
|
-
state$
|
|
2120
|
+
function reset$c() {
|
|
2121
|
+
state$3 = [];
|
|
1622
2122
|
}
|
|
1623
2123
|
function similar$1(last, current) {
|
|
1624
2124
|
var dx = last.data.x - current.data.x;
|
|
@@ -1628,16 +2128,16 @@ function similar$1(last, current) {
|
|
|
1628
2128
|
var match = current.data.target === last.data.target;
|
|
1629
2129
|
return current.event === last.event && match && distance < 20 /* Setting.Distance */ && gap < 25 /* Setting.Interval */;
|
|
1630
2130
|
}
|
|
1631
|
-
function stop$
|
|
2131
|
+
function stop$n() {
|
|
1632
2132
|
clearTimeout(timeout$4);
|
|
1633
2133
|
// Send out any pending pointer events in the pipeline
|
|
1634
|
-
if (state$
|
|
1635
|
-
process$
|
|
2134
|
+
if (state$3.length > 0) {
|
|
2135
|
+
process$4(state$3[state$3.length - 1].event);
|
|
1636
2136
|
}
|
|
1637
2137
|
}
|
|
1638
2138
|
|
|
1639
2139
|
var data$b;
|
|
1640
|
-
function start$
|
|
2140
|
+
function start$o() {
|
|
1641
2141
|
bind(window, "resize", recompute$5);
|
|
1642
2142
|
recompute$5();
|
|
1643
2143
|
}
|
|
@@ -1651,20 +2151,20 @@ function recompute$5() {
|
|
|
1651
2151
|
};
|
|
1652
2152
|
encode$3(11 /* Event.Resize */);
|
|
1653
2153
|
}
|
|
1654
|
-
function reset$
|
|
2154
|
+
function reset$b() {
|
|
1655
2155
|
data$b = null;
|
|
1656
2156
|
}
|
|
1657
|
-
function stop$
|
|
1658
|
-
reset$
|
|
2157
|
+
function stop$m() {
|
|
2158
|
+
reset$b();
|
|
1659
2159
|
}
|
|
1660
2160
|
|
|
1661
|
-
var state$
|
|
2161
|
+
var state$2 = [];
|
|
1662
2162
|
var timeout$3 = null;
|
|
1663
|
-
function start$
|
|
1664
|
-
state$
|
|
2163
|
+
function start$n() {
|
|
2164
|
+
state$2 = [];
|
|
1665
2165
|
recompute$4();
|
|
1666
2166
|
}
|
|
1667
|
-
function observe$
|
|
2167
|
+
function observe$6(root) {
|
|
1668
2168
|
var frame = iframe(root);
|
|
1669
2169
|
var node = frame ? frame.contentWindow : (root === document ? window : root);
|
|
1670
2170
|
bind(node, "scroll", recompute$4, true);
|
|
@@ -1690,19 +2190,19 @@ function recompute$4(event) {
|
|
|
1690
2190
|
if ((event === null && x === 0 && y === 0) || (x === null || y === null)) {
|
|
1691
2191
|
return;
|
|
1692
2192
|
}
|
|
1693
|
-
var length = state$
|
|
1694
|
-
var last = length > 1 ? state$
|
|
2193
|
+
var length = state$2.length;
|
|
2194
|
+
var last = length > 1 ? state$2[length - 2] : null;
|
|
1695
2195
|
if (last && similar(last, current)) {
|
|
1696
|
-
state$
|
|
2196
|
+
state$2.pop();
|
|
1697
2197
|
}
|
|
1698
|
-
state$
|
|
2198
|
+
state$2.push(current);
|
|
1699
2199
|
clearTimeout(timeout$3);
|
|
1700
|
-
timeout$3 = setTimeout(process$
|
|
2200
|
+
timeout$3 = setTimeout(process$3, 500 /* Setting.LookAhead */, 10 /* Event.Scroll */);
|
|
1701
2201
|
}
|
|
1702
|
-
function reset$
|
|
1703
|
-
state$
|
|
2202
|
+
function reset$a() {
|
|
2203
|
+
state$2 = [];
|
|
1704
2204
|
}
|
|
1705
|
-
function process$
|
|
2205
|
+
function process$3(event) {
|
|
1706
2206
|
schedule$1(encode$3.bind(this, event));
|
|
1707
2207
|
}
|
|
1708
2208
|
function similar(last, current) {
|
|
@@ -1710,18 +2210,18 @@ function similar(last, current) {
|
|
|
1710
2210
|
var dy = last.data.y - current.data.y;
|
|
1711
2211
|
return (dx * dx + dy * dy < 20 /* Setting.Distance */ * 20 /* Setting.Distance */) && (current.time - last.time < 25 /* Setting.Interval */);
|
|
1712
2212
|
}
|
|
1713
|
-
function stop$
|
|
2213
|
+
function stop$l() {
|
|
1714
2214
|
clearTimeout(timeout$3);
|
|
1715
|
-
state$
|
|
2215
|
+
state$2 = [];
|
|
1716
2216
|
}
|
|
1717
2217
|
|
|
1718
2218
|
var data$a = null;
|
|
1719
2219
|
var previous = null;
|
|
1720
2220
|
var timeout$2 = null;
|
|
1721
|
-
function start$
|
|
1722
|
-
reset$
|
|
2221
|
+
function start$m() {
|
|
2222
|
+
reset$9();
|
|
1723
2223
|
}
|
|
1724
|
-
function observe$
|
|
2224
|
+
function observe$5(root) {
|
|
1725
2225
|
bind(root, "selectstart", recompute$3.bind(this, root), true);
|
|
1726
2226
|
bind(root, "selectionchange", recompute$3.bind(this, root), true);
|
|
1727
2227
|
}
|
|
@@ -1743,7 +2243,7 @@ function recompute$3(root) {
|
|
|
1743
2243
|
var startNode = data$a.start ? data$a.start : null;
|
|
1744
2244
|
if (previous !== null && data$a.start !== null && startNode !== current.anchorNode) {
|
|
1745
2245
|
clearTimeout(timeout$2);
|
|
1746
|
-
process$
|
|
2246
|
+
process$2(21 /* Event.Selection */);
|
|
1747
2247
|
}
|
|
1748
2248
|
data$a = {
|
|
1749
2249
|
start: current.anchorNode,
|
|
@@ -1753,40 +2253,40 @@ function recompute$3(root) {
|
|
|
1753
2253
|
};
|
|
1754
2254
|
previous = current;
|
|
1755
2255
|
clearTimeout(timeout$2);
|
|
1756
|
-
timeout$2 = setTimeout(process$
|
|
2256
|
+
timeout$2 = setTimeout(process$2, 500 /* Setting.LookAhead */, 21 /* Event.Selection */);
|
|
1757
2257
|
}
|
|
1758
|
-
function process$
|
|
2258
|
+
function process$2(event) {
|
|
1759
2259
|
schedule$1(encode$3.bind(this, event));
|
|
1760
2260
|
}
|
|
1761
|
-
function reset$
|
|
2261
|
+
function reset$9() {
|
|
1762
2262
|
previous = null;
|
|
1763
2263
|
data$a = { start: 0, startOffset: 0, end: 0, endOffset: 0 };
|
|
1764
2264
|
}
|
|
1765
|
-
function stop$
|
|
1766
|
-
reset$
|
|
2265
|
+
function stop$k() {
|
|
2266
|
+
reset$9();
|
|
1767
2267
|
clearTimeout(timeout$2);
|
|
1768
2268
|
}
|
|
1769
2269
|
|
|
1770
|
-
var state$
|
|
1771
|
-
function start$
|
|
1772
|
-
reset$
|
|
2270
|
+
var state$1 = [];
|
|
2271
|
+
function start$l() {
|
|
2272
|
+
reset$8();
|
|
1773
2273
|
}
|
|
1774
|
-
function observe$
|
|
2274
|
+
function observe$4(root) {
|
|
1775
2275
|
bind(root, "submit", recompute$2, true);
|
|
1776
2276
|
}
|
|
1777
2277
|
function recompute$2(evt) {
|
|
1778
|
-
state$
|
|
2278
|
+
state$1.push({ time: time(evt), event: 39 /* Event.Submit */, data: { target: target(evt) } });
|
|
1779
2279
|
schedule$1(encode$3.bind(this, 39 /* Event.Submit */));
|
|
1780
2280
|
}
|
|
1781
|
-
function reset$
|
|
1782
|
-
state$
|
|
2281
|
+
function reset$8() {
|
|
2282
|
+
state$1 = [];
|
|
1783
2283
|
}
|
|
1784
|
-
function stop$
|
|
1785
|
-
reset$
|
|
2284
|
+
function stop$j() {
|
|
2285
|
+
reset$8();
|
|
1786
2286
|
}
|
|
1787
2287
|
|
|
1788
2288
|
var data$9;
|
|
1789
|
-
function start$
|
|
2289
|
+
function start$k() {
|
|
1790
2290
|
bind(window, "pagehide", recompute$1);
|
|
1791
2291
|
}
|
|
1792
2292
|
function recompute$1(evt) {
|
|
@@ -1794,15 +2294,15 @@ function recompute$1(evt) {
|
|
|
1794
2294
|
encode$3(26 /* Event.Unload */, time(evt));
|
|
1795
2295
|
stop();
|
|
1796
2296
|
}
|
|
1797
|
-
function reset$
|
|
2297
|
+
function reset$7() {
|
|
1798
2298
|
data$9 = null;
|
|
1799
2299
|
}
|
|
1800
|
-
function stop$
|
|
1801
|
-
reset$
|
|
2300
|
+
function stop$i() {
|
|
2301
|
+
reset$7();
|
|
1802
2302
|
}
|
|
1803
2303
|
|
|
1804
2304
|
var data$8;
|
|
1805
|
-
function start$
|
|
2305
|
+
function start$j() {
|
|
1806
2306
|
bind(document, "visibilitychange", recompute);
|
|
1807
2307
|
recompute();
|
|
1808
2308
|
}
|
|
@@ -1811,61 +2311,61 @@ function recompute(evt) {
|
|
|
1811
2311
|
data$8 = { visible: "visibilityState" in document ? document.visibilityState : "default" };
|
|
1812
2312
|
encode$3(28 /* Event.Visibility */, time(evt));
|
|
1813
2313
|
}
|
|
1814
|
-
function reset$
|
|
2314
|
+
function reset$6() {
|
|
1815
2315
|
data$8 = null;
|
|
1816
2316
|
}
|
|
1817
|
-
function stop$
|
|
1818
|
-
reset$
|
|
2317
|
+
function stop$h() {
|
|
2318
|
+
reset$6();
|
|
1819
2319
|
}
|
|
1820
2320
|
|
|
1821
|
-
function start$
|
|
2321
|
+
function start$i() {
|
|
1822
2322
|
start$g();
|
|
1823
|
-
start$u();
|
|
1824
|
-
start$t();
|
|
1825
|
-
start$r();
|
|
1826
2323
|
start$s();
|
|
1827
|
-
start$
|
|
1828
|
-
start$l();
|
|
2324
|
+
start$r();
|
|
1829
2325
|
start$p();
|
|
2326
|
+
start$q();
|
|
1830
2327
|
start$o();
|
|
1831
|
-
start$
|
|
2328
|
+
start$j();
|
|
1832
2329
|
start$n();
|
|
1833
2330
|
start$m();
|
|
2331
|
+
start$t();
|
|
2332
|
+
start$l();
|
|
2333
|
+
start$k();
|
|
1834
2334
|
}
|
|
1835
|
-
function stop$
|
|
2335
|
+
function stop$g() {
|
|
1836
2336
|
stop$e();
|
|
1837
|
-
stop$s();
|
|
1838
|
-
stop$r();
|
|
1839
|
-
stop$p();
|
|
1840
2337
|
stop$q();
|
|
1841
|
-
stop$
|
|
1842
|
-
stop$j();
|
|
2338
|
+
stop$p();
|
|
1843
2339
|
stop$n();
|
|
2340
|
+
stop$o();
|
|
1844
2341
|
stop$m();
|
|
1845
|
-
stop$
|
|
2342
|
+
stop$h();
|
|
1846
2343
|
stop$l();
|
|
1847
2344
|
stop$k();
|
|
2345
|
+
stop$r();
|
|
2346
|
+
stop$j();
|
|
2347
|
+
stop$i();
|
|
1848
2348
|
}
|
|
1849
|
-
function observe$
|
|
1850
|
-
observe$
|
|
2349
|
+
function observe$3(root) {
|
|
2350
|
+
observe$6(root);
|
|
1851
2351
|
// Only monitor following interactions if the root node is a document
|
|
1852
2352
|
// In case of shadow DOM, following events automatically bubble up to the parent document.
|
|
1853
2353
|
if (root.nodeType === Node.DOCUMENT_NODE) {
|
|
1854
|
-
observe$b(root);
|
|
1855
2354
|
observe$a(root);
|
|
1856
|
-
observe$8(root);
|
|
1857
2355
|
observe$9(root);
|
|
1858
|
-
observe$
|
|
1859
|
-
observe$
|
|
2356
|
+
observe$7(root);
|
|
2357
|
+
observe$8(root);
|
|
1860
2358
|
observe$5(root);
|
|
2359
|
+
observe$b(root);
|
|
2360
|
+
observe$4(root);
|
|
1861
2361
|
}
|
|
1862
2362
|
}
|
|
1863
2363
|
|
|
1864
2364
|
var interaction = /*#__PURE__*/Object.freeze({
|
|
1865
2365
|
__proto__: null,
|
|
1866
|
-
observe: observe$
|
|
1867
|
-
start: start$
|
|
1868
|
-
stop: stop$
|
|
2366
|
+
observe: observe$3,
|
|
2367
|
+
start: start$i,
|
|
2368
|
+
stop: stop$g
|
|
1869
2369
|
});
|
|
1870
2370
|
|
|
1871
2371
|
var digitsRegex = /[^0-9\.]/g;
|
|
@@ -1968,7 +2468,7 @@ function processNode (node, source) {
|
|
|
1968
2468
|
// later whenever there are new additions or modifications to DOM (mutations)
|
|
1969
2469
|
if (node === document)
|
|
1970
2470
|
parse$1(document);
|
|
1971
|
-
observe$
|
|
2471
|
+
observe$2(node);
|
|
1972
2472
|
break;
|
|
1973
2473
|
case Node.DOCUMENT_FRAGMENT_NODE:
|
|
1974
2474
|
var shadowRoot = node;
|
|
@@ -1976,7 +2476,7 @@ function processNode (node, source) {
|
|
|
1976
2476
|
parse$1(shadowRoot);
|
|
1977
2477
|
var type = typeof (shadowRoot.constructor);
|
|
1978
2478
|
if (type === "function" /* Constant.Function */ && shadowRoot.constructor.toString().indexOf("[native code]" /* Constant.NativeCode */) >= 0) {
|
|
1979
|
-
observe$
|
|
2479
|
+
observe$2(shadowRoot);
|
|
1980
2480
|
// See: https://wicg.github.io/construct-stylesheets/ for more details on adoptedStyleSheets.
|
|
1981
2481
|
// At the moment, we are only able to capture "open" shadow DOM nodes. If they are closed, they are not accessible.
|
|
1982
2482
|
// In future we may decide to proxy "attachShadow" call to gain access, but at the moment, we don't want to
|
|
@@ -2096,931 +2596,400 @@ function processNode (node, source) {
|
|
|
2096
2596
|
child = element.shadowRoot;
|
|
2097
2597
|
}
|
|
2098
2598
|
dom[call](node, parent, data, source);
|
|
2099
|
-
break;
|
|
2100
|
-
}
|
|
2101
|
-
break;
|
|
2102
|
-
}
|
|
2103
|
-
return child;
|
|
2104
|
-
}
|
|
2105
|
-
function observe$3(root) {
|
|
2106
|
-
if (has(root)) {
|
|
2107
|
-
return;
|
|
2108
|
-
}
|
|
2109
|
-
observe$2(root); // Observe mutations for this root node
|
|
2110
|
-
observe$4(root); // Observe interactions for this root node
|
|
2111
|
-
}
|
|
2112
|
-
function getStyleValue(style) {
|
|
2113
|
-
// Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
|
|
2114
|
-
// Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
|
|
2115
|
-
var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
|
|
2116
|
-
var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
|
|
2117
|
-
if (value.length === 0 || dataset > 0) {
|
|
2118
|
-
value = getCssRules(style.sheet);
|
|
2119
|
-
}
|
|
2120
|
-
return value;
|
|
2121
|
-
}
|
|
2122
|
-
function getCssRules(sheet) {
|
|
2123
|
-
var value = "" /* Constant.Empty */;
|
|
2124
|
-
var cssRules = null;
|
|
2125
|
-
// Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
|
|
2126
|
-
try {
|
|
2127
|
-
cssRules = sheet ? sheet.cssRules : [];
|
|
2128
|
-
}
|
|
2129
|
-
catch (e) {
|
|
2130
|
-
log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
|
|
2131
|
-
if (e && e.name !== "SecurityError") {
|
|
2132
|
-
throw e;
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
if (cssRules !== null) {
|
|
2136
|
-
for (var i = 0; i < cssRules.length; i++) {
|
|
2137
|
-
value += cssRules[i].cssText;
|
|
2138
|
-
}
|
|
2139
|
-
}
|
|
2140
|
-
return value;
|
|
2141
|
-
}
|
|
2142
|
-
function getAttributes(element) {
|
|
2143
|
-
var output = {};
|
|
2144
|
-
var attributes = element.attributes;
|
|
2145
|
-
if (attributes && attributes.length > 0) {
|
|
2146
|
-
for (var i = 0; i < attributes.length; i++) {
|
|
2147
|
-
var name_1 = attributes[i].name;
|
|
2148
|
-
if (IGNORE_ATTRIBUTES.indexOf(name_1) < 0) {
|
|
2149
|
-
output[name_1] = attributes[i].value;
|
|
2150
|
-
}
|
|
2151
|
-
}
|
|
2152
|
-
}
|
|
2153
|
-
// For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
|
|
2154
|
-
if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
|
|
2155
|
-
output["value" /* Constant.Value */] = element.value;
|
|
2156
|
-
}
|
|
2157
|
-
return output;
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
function traverse (root, timer, source) {
|
|
2161
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2162
|
-
var queue, node, next, state, subnode;
|
|
2163
|
-
return __generator(this, function (_a) {
|
|
2164
|
-
switch (_a.label) {
|
|
2165
|
-
case 0:
|
|
2166
|
-
queue = [root];
|
|
2167
|
-
_a.label = 1;
|
|
2168
|
-
case 1:
|
|
2169
|
-
if (!(queue.length > 0)) return [3 /*break*/, 4];
|
|
2170
|
-
node = queue.shift();
|
|
2171
|
-
next = node.firstChild;
|
|
2172
|
-
while (next) {
|
|
2173
|
-
queue.push(next);
|
|
2174
|
-
next = next.nextSibling;
|
|
2175
|
-
}
|
|
2176
|
-
state = state$9(timer);
|
|
2177
|
-
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
|
|
2178
|
-
return [4 /*yield*/, suspend$1(timer)];
|
|
2179
|
-
case 2:
|
|
2180
|
-
state = _a.sent();
|
|
2181
|
-
_a.label = 3;
|
|
2182
|
-
case 3:
|
|
2183
|
-
if (state === 2 /* Task.Stop */) {
|
|
2184
|
-
return [3 /*break*/, 4];
|
|
2185
|
-
}
|
|
2186
|
-
subnode = processNode(node, source);
|
|
2187
|
-
if (subnode) {
|
|
2188
|
-
queue.push(subnode);
|
|
2189
|
-
}
|
|
2190
|
-
return [3 /*break*/, 1];
|
|
2191
|
-
case 4: return [2 /*return*/];
|
|
2192
|
-
}
|
|
2193
|
-
});
|
|
2194
|
-
});
|
|
2195
|
-
}
|
|
2196
|
-
|
|
2197
|
-
var observers = [];
|
|
2198
|
-
var mutations = [];
|
|
2199
|
-
var insertRule = null;
|
|
2200
|
-
var deleteRule = null;
|
|
2201
|
-
var attachShadow = null;
|
|
2202
|
-
var queue$2 = [];
|
|
2203
|
-
var timeout$1 = null;
|
|
2204
|
-
var activePeriod = null;
|
|
2205
|
-
var history$4 = {};
|
|
2206
|
-
function start$j() {
|
|
2207
|
-
observers = [];
|
|
2208
|
-
queue$2 = [];
|
|
2209
|
-
timeout$1 = null;
|
|
2210
|
-
activePeriod = 0;
|
|
2211
|
-
history$4 = {};
|
|
2212
|
-
// Some popular open source libraries, like styled-components, optimize performance
|
|
2213
|
-
// by injecting CSS using insertRule API vs. appending text node. A side effect of
|
|
2214
|
-
// using javascript API is that it doesn't trigger DOM mutation and therefore we
|
|
2215
|
-
// need to override the insertRule API and listen for changes manually.
|
|
2216
|
-
if (insertRule === null) {
|
|
2217
|
-
insertRule = CSSStyleSheet.prototype.insertRule;
|
|
2218
|
-
CSSStyleSheet.prototype.insertRule = function () {
|
|
2219
|
-
if (active()) {
|
|
2220
|
-
schedule(this.ownerNode);
|
|
2221
|
-
}
|
|
2222
|
-
return insertRule.apply(this, arguments);
|
|
2223
|
-
};
|
|
2224
|
-
}
|
|
2225
|
-
if (deleteRule === null) {
|
|
2226
|
-
deleteRule = CSSStyleSheet.prototype.deleteRule;
|
|
2227
|
-
CSSStyleSheet.prototype.deleteRule = function () {
|
|
2228
|
-
if (active()) {
|
|
2229
|
-
schedule(this.ownerNode);
|
|
2230
|
-
}
|
|
2231
|
-
return deleteRule.apply(this, arguments);
|
|
2232
|
-
};
|
|
2233
|
-
}
|
|
2234
|
-
// Add a hook to attachShadow API calls
|
|
2235
|
-
// In case we are unable to add a hook and browser throws an exception,
|
|
2236
|
-
// reset attachShadow variable and resume processing like before
|
|
2237
|
-
if (attachShadow === null) {
|
|
2238
|
-
attachShadow = Element.prototype.attachShadow;
|
|
2239
|
-
try {
|
|
2240
|
-
Element.prototype.attachShadow = function () {
|
|
2241
|
-
if (active()) {
|
|
2242
|
-
return schedule(attachShadow.apply(this, arguments));
|
|
2243
|
-
}
|
|
2244
|
-
else {
|
|
2245
|
-
return attachShadow.apply(this, arguments);
|
|
2246
|
-
}
|
|
2247
|
-
};
|
|
2248
|
-
}
|
|
2249
|
-
catch (_a) {
|
|
2250
|
-
attachShadow = null;
|
|
2251
|
-
}
|
|
2252
|
-
}
|
|
2253
|
-
}
|
|
2254
|
-
function observe$2(node) {
|
|
2255
|
-
// Create a new observer for every time a new DOM tree (e.g. root document or shadowdom root) is discovered on the page
|
|
2256
|
-
// In the case of shadow dom, any mutations that happen within the shadow dom are not bubbled up to the host document
|
|
2257
|
-
// For this reason, we need to wire up mutations every time we see a new shadow dom.
|
|
2258
|
-
// Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
|
|
2259
|
-
try {
|
|
2260
|
-
var m = api("MutationObserver" /* Constant.MutationObserver */);
|
|
2261
|
-
var observer = m in window ? new window[m](measure(handle$1)) : null;
|
|
2262
|
-
if (observer) {
|
|
2263
|
-
observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
|
|
2264
|
-
observers.push(observer);
|
|
2265
|
-
}
|
|
2266
|
-
}
|
|
2267
|
-
catch (e) {
|
|
2268
|
-
log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
|
|
2269
|
-
}
|
|
2270
|
-
}
|
|
2271
|
-
function monitor(frame) {
|
|
2272
|
-
// Bind to iframe's onload event so we get notified anytime there's an update to iframe content.
|
|
2273
|
-
// This includes cases where iframe location is updated without explicitly updating src attribute
|
|
2274
|
-
// E.g. iframe.contentWindow.location.href = "new-location";
|
|
2275
|
-
if (has(frame) === false) {
|
|
2276
|
-
bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
|
|
2277
|
-
}
|
|
2278
|
-
}
|
|
2279
|
-
function stop$h() {
|
|
2280
|
-
for (var _i = 0, observers_1 = observers; _i < observers_1.length; _i++) {
|
|
2281
|
-
var observer = observers_1[_i];
|
|
2282
|
-
if (observer) {
|
|
2283
|
-
observer.disconnect();
|
|
2284
|
-
}
|
|
2285
|
-
}
|
|
2286
|
-
observers = [];
|
|
2287
|
-
history$4 = {};
|
|
2288
|
-
mutations = [];
|
|
2289
|
-
queue$2 = [];
|
|
2290
|
-
activePeriod = 0;
|
|
2291
|
-
timeout$1 = null;
|
|
2292
|
-
}
|
|
2293
|
-
function active$2() {
|
|
2294
|
-
activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
|
|
2295
|
-
}
|
|
2296
|
-
function handle$1(m) {
|
|
2297
|
-
// Queue up mutation records for asynchronous processing
|
|
2298
|
-
var now = time();
|
|
2299
|
-
track$6(6 /* Event.Mutation */, now);
|
|
2300
|
-
mutations.push({ time: now, mutations: m });
|
|
2301
|
-
schedule$1(process$2, 1 /* Priority.High */).then(function () {
|
|
2302
|
-
setTimeout(compute$7);
|
|
2303
|
-
measure(compute$6)();
|
|
2304
|
-
});
|
|
2305
|
-
}
|
|
2306
|
-
function process$2() {
|
|
2307
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2308
|
-
var timer, record, instance, _i, _a, mutation, state, target, type, value;
|
|
2309
|
-
return __generator(this, function (_b) {
|
|
2310
|
-
switch (_b.label) {
|
|
2311
|
-
case 0:
|
|
2312
|
-
timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
|
|
2313
|
-
start$x(timer);
|
|
2314
|
-
_b.label = 1;
|
|
2315
|
-
case 1:
|
|
2316
|
-
if (!(mutations.length > 0)) return [3 /*break*/, 8];
|
|
2317
|
-
record = mutations.shift();
|
|
2318
|
-
instance = time();
|
|
2319
|
-
_i = 0, _a = record.mutations;
|
|
2320
|
-
_b.label = 2;
|
|
2321
|
-
case 2:
|
|
2322
|
-
if (!(_i < _a.length)) return [3 /*break*/, 6];
|
|
2323
|
-
mutation = _a[_i];
|
|
2324
|
-
state = state$9(timer);
|
|
2325
|
-
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
|
|
2326
|
-
return [4 /*yield*/, suspend$1(timer)];
|
|
2327
|
-
case 3:
|
|
2328
|
-
state = _b.sent();
|
|
2329
|
-
_b.label = 4;
|
|
2330
|
-
case 4:
|
|
2331
|
-
if (state === 2 /* Task.Stop */) {
|
|
2332
|
-
return [3 /*break*/, 6];
|
|
2333
|
-
}
|
|
2334
|
-
target = mutation.target;
|
|
2335
|
-
type = track$5(mutation, timer, instance);
|
|
2336
|
-
if (type && target && target.ownerDocument) {
|
|
2337
|
-
parse$1(target.ownerDocument);
|
|
2338
|
-
}
|
|
2339
|
-
if (type && target && target.nodeType == Node.DOCUMENT_FRAGMENT_NODE && target.host) {
|
|
2340
|
-
parse$1(target);
|
|
2341
|
-
}
|
|
2342
|
-
switch (type) {
|
|
2343
|
-
case "attributes" /* Constant.Attributes */:
|
|
2344
|
-
processNode(target, 3 /* Source.Attributes */);
|
|
2345
|
-
break;
|
|
2346
|
-
case "characterData" /* Constant.CharacterData */:
|
|
2347
|
-
processNode(target, 4 /* Source.CharacterData */);
|
|
2348
|
-
break;
|
|
2349
|
-
case "childList" /* Constant.ChildList */:
|
|
2350
|
-
processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
|
|
2351
|
-
processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
|
|
2352
|
-
break;
|
|
2353
|
-
case "suspend" /* Constant.Suspend */:
|
|
2354
|
-
value = get(target);
|
|
2355
|
-
if (value) {
|
|
2356
|
-
value.metadata.suspend = true;
|
|
2357
|
-
}
|
|
2358
|
-
break;
|
|
2359
|
-
}
|
|
2360
|
-
_b.label = 5;
|
|
2361
|
-
case 5:
|
|
2362
|
-
_i++;
|
|
2363
|
-
return [3 /*break*/, 2];
|
|
2364
|
-
case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
|
|
2365
|
-
case 7:
|
|
2366
|
-
_b.sent();
|
|
2367
|
-
return [3 /*break*/, 1];
|
|
2368
|
-
case 8:
|
|
2369
|
-
stop$u(timer);
|
|
2370
|
-
return [2 /*return*/];
|
|
2371
|
-
}
|
|
2372
|
-
});
|
|
2373
|
-
});
|
|
2374
|
-
}
|
|
2375
|
-
function track$5(m, timer, instance) {
|
|
2376
|
-
var value = m.target ? get(m.target.parentNode) : null;
|
|
2377
|
-
// Check if the parent is already discovered and that the parent is not the document root
|
|
2378
|
-
if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
|
|
2379
|
-
var inactive = time() > activePeriod;
|
|
2380
|
-
var target = get(m.target);
|
|
2381
|
-
var element = target && target.selector ? target.selector.join() : m.target.nodeName;
|
|
2382
|
-
var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
|
|
2383
|
-
// We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
|
|
2384
|
-
// repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
|
|
2385
|
-
// In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
|
|
2386
|
-
var key = [parent_1, element, m.attributeName, names(m.addedNodes), names(m.removedNodes)].join();
|
|
2387
|
-
// Initialize an entry if it doesn't already exist
|
|
2388
|
-
history$4[key] = key in history$4 ? history$4[key] : [0, instance];
|
|
2389
|
-
var h = history$4[key];
|
|
2390
|
-
// Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
|
|
2391
|
-
if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
|
|
2392
|
-
processNodeList(h[2], 2 /* Source.ChildListRemove */, timer);
|
|
2393
|
-
}
|
|
2394
|
-
// Update the counter
|
|
2395
|
-
h[0] = inactive ? (h[1] === instance ? h[0] : h[0] + 1) : 1;
|
|
2396
|
-
h[1] = instance;
|
|
2397
|
-
// Return updated mutation type based on if we have already hit the threshold or not
|
|
2398
|
-
if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
|
|
2399
|
-
// Store a reference to removedNodes so we can process them later
|
|
2400
|
-
// when we resume mutations again on user interactions
|
|
2401
|
-
h[2] = m.removedNodes;
|
|
2402
|
-
return "suspend" /* Constant.Suspend */;
|
|
2403
|
-
}
|
|
2404
|
-
else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
|
|
2405
|
-
return "" /* Constant.Empty */;
|
|
2406
|
-
}
|
|
2407
|
-
}
|
|
2408
|
-
return m.type;
|
|
2409
|
-
}
|
|
2410
|
-
function names(nodes) {
|
|
2411
|
-
var output = [];
|
|
2412
|
-
for (var i = 0; nodes && i < nodes.length; i++) {
|
|
2413
|
-
output.push(nodes[i].nodeName);
|
|
2414
|
-
}
|
|
2415
|
-
return output.join();
|
|
2416
|
-
}
|
|
2417
|
-
function processNodeList(list, source, timer) {
|
|
2418
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
2419
|
-
var length, i, state;
|
|
2420
|
-
return __generator(this, function (_a) {
|
|
2421
|
-
switch (_a.label) {
|
|
2422
|
-
case 0:
|
|
2423
|
-
length = list ? list.length : 0;
|
|
2424
|
-
i = 0;
|
|
2425
|
-
_a.label = 1;
|
|
2426
|
-
case 1:
|
|
2427
|
-
if (!(i < length)) return [3 /*break*/, 6];
|
|
2428
|
-
if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
|
|
2429
|
-
traverse(list[i], timer, source);
|
|
2430
|
-
return [3 /*break*/, 5];
|
|
2431
|
-
case 2:
|
|
2432
|
-
state = state$9(timer);
|
|
2433
|
-
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
|
|
2434
|
-
return [4 /*yield*/, suspend$1(timer)];
|
|
2435
|
-
case 3:
|
|
2436
|
-
state = _a.sent();
|
|
2437
|
-
_a.label = 4;
|
|
2438
|
-
case 4:
|
|
2439
|
-
if (state === 2 /* Task.Stop */) {
|
|
2440
|
-
return [3 /*break*/, 6];
|
|
2441
|
-
}
|
|
2442
|
-
processNode(list[i], source);
|
|
2443
|
-
_a.label = 5;
|
|
2444
|
-
case 5:
|
|
2445
|
-
i++;
|
|
2446
|
-
return [3 /*break*/, 1];
|
|
2447
|
-
case 6: return [2 /*return*/];
|
|
2448
|
-
}
|
|
2449
|
-
});
|
|
2450
|
-
});
|
|
2451
|
-
}
|
|
2452
|
-
function schedule(node, fragment) {
|
|
2453
|
-
if (fragment === void 0) { fragment = false; }
|
|
2454
|
-
// Only schedule manual trigger for this node if it's not already in the queue
|
|
2455
|
-
if (queue$2.indexOf(node) < 0) {
|
|
2456
|
-
queue$2.push(node);
|
|
2457
|
-
}
|
|
2458
|
-
// Cancel any previous trigger before scheduling a new one.
|
|
2459
|
-
// It's common for a webpage to call multiple synchronous "insertRule" / "deleteRule" calls.
|
|
2460
|
-
// And in those cases we do not wish to monitor changes multiple times for the same node.
|
|
2461
|
-
if (timeout$1) {
|
|
2462
|
-
clearTimeout(timeout$1);
|
|
2463
|
-
}
|
|
2464
|
-
timeout$1 = setTimeout(function () { trigger$1(fragment); }, 33 /* Setting.LookAhead */);
|
|
2465
|
-
return node;
|
|
2466
|
-
}
|
|
2467
|
-
function trigger$1(fragment) {
|
|
2468
|
-
for (var _i = 0, queue_1 = queue$2; _i < queue_1.length; _i++) {
|
|
2469
|
-
var node = queue_1[_i];
|
|
2470
|
-
// Generate a mutation for this node only if it still exists
|
|
2471
|
-
if (node) {
|
|
2472
|
-
var shadowRoot = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
2473
|
-
// Skip re-processing shadowRoot if it was already discovered
|
|
2474
|
-
if (shadowRoot && has(node)) {
|
|
2475
|
-
continue;
|
|
2476
|
-
}
|
|
2477
|
-
generate(node, shadowRoot || fragment ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
|
|
2478
|
-
}
|
|
2479
|
-
}
|
|
2480
|
-
queue$2 = [];
|
|
2481
|
-
}
|
|
2482
|
-
function generate(target, type) {
|
|
2483
|
-
measure(handle$1)([{
|
|
2484
|
-
addedNodes: [target],
|
|
2485
|
-
attributeName: null,
|
|
2486
|
-
attributeNamespace: null,
|
|
2487
|
-
nextSibling: null,
|
|
2488
|
-
oldValue: null,
|
|
2489
|
-
previousSibling: null,
|
|
2490
|
-
removedNodes: [],
|
|
2491
|
-
target: target,
|
|
2492
|
-
type: type
|
|
2493
|
-
}]);
|
|
2494
|
-
}
|
|
2495
|
-
|
|
2496
|
-
var index = 1;
|
|
2497
|
-
var nodes = [];
|
|
2498
|
-
var values = [];
|
|
2499
|
-
var updateMap = [];
|
|
2500
|
-
var hashMap = {};
|
|
2501
|
-
var override = [];
|
|
2502
|
-
var unmask = [];
|
|
2503
|
-
var updatedFragments = {};
|
|
2504
|
-
var maskText = [];
|
|
2505
|
-
var maskExclude = [];
|
|
2506
|
-
var maskDisable = [];
|
|
2507
|
-
var maskTags = [];
|
|
2508
|
-
// The WeakMap object is a collection of key/value pairs in which the keys are weakly referenced
|
|
2509
|
-
var idMap = null; // Maps node => id.
|
|
2510
|
-
var iframeMap = null; // Maps iframe's contentDocument => parent iframe element
|
|
2511
|
-
var privacyMap = null; // Maps node => Privacy (enum)
|
|
2512
|
-
var fraudMap = null; // Maps node => FraudId (number)
|
|
2513
|
-
function start$i() {
|
|
2514
|
-
reset$7();
|
|
2515
|
-
parse$1(document, true);
|
|
2516
|
-
}
|
|
2517
|
-
function stop$g() {
|
|
2518
|
-
reset$7();
|
|
2519
|
-
}
|
|
2520
|
-
function reset$7() {
|
|
2521
|
-
index = 1;
|
|
2522
|
-
nodes = [];
|
|
2523
|
-
values = [];
|
|
2524
|
-
updateMap = [];
|
|
2525
|
-
hashMap = {};
|
|
2526
|
-
override = [];
|
|
2527
|
-
unmask = [];
|
|
2528
|
-
maskText = "address,password,contact" /* Mask.Text */.split("," /* Constant.Comma */);
|
|
2529
|
-
maskExclude = "password,secret,pass,social,ssn,code,hidden" /* Mask.Exclude */.split("," /* Constant.Comma */);
|
|
2530
|
-
maskDisable = "radio,checkbox,range,button,reset,submit" /* Mask.Disable */.split("," /* Constant.Comma */);
|
|
2531
|
-
maskTags = "INPUT,SELECT,TEXTAREA" /* Mask.Tags */.split("," /* Constant.Comma */);
|
|
2532
|
-
idMap = new WeakMap();
|
|
2533
|
-
iframeMap = new WeakMap();
|
|
2534
|
-
privacyMap = new WeakMap();
|
|
2535
|
-
fraudMap = new WeakMap();
|
|
2536
|
-
reset$l();
|
|
2537
|
-
}
|
|
2538
|
-
// We parse new root nodes for any regions or masked nodes in the beginning (document) and
|
|
2539
|
-
// later whenever there are new additions or modifications to DOM (mutations)
|
|
2540
|
-
function parse$1(root, init) {
|
|
2541
|
-
if (init === void 0) { init = false; }
|
|
2542
|
-
// Wrap selectors in a try / catch block.
|
|
2543
|
-
// It's possible for script to receive invalid selectors, e.g. "'#id'" with extra quotes, and cause the code below to fail
|
|
2544
|
-
try {
|
|
2545
|
-
// Parse unmask configuration into separate query selectors and override tokens as part of initialization
|
|
2546
|
-
if (init) {
|
|
2547
|
-
config$1.unmask.forEach(function (x) { return x.indexOf("!" /* Constant.Bang */) < 0 ? unmask.push(x) : override.push(x.substr(1)); });
|
|
2548
|
-
}
|
|
2549
|
-
// Since mutations may happen on leaf nodes too, e.g. text nodes, which may not support all selector APIs.
|
|
2550
|
-
// We ensure that the root note supports querySelectorAll API before executing the code below to identify new regions.
|
|
2551
|
-
if ("querySelectorAll" in root) {
|
|
2552
|
-
config$1.regions.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return observe$1(e, "".concat(x[0])); }); }); // Regions
|
|
2553
|
-
config$1.mask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 3 /* Privacy.TextImage */); }); }); // Masked Elements
|
|
2554
|
-
config$1.checksum.forEach(function (x) { return root.querySelectorAll(x[1]).forEach(function (e) { return fraudMap.set(e, x[0]); }); }); // Fraud Checksum Check
|
|
2555
|
-
unmask.forEach(function (x) { return root.querySelectorAll(x).forEach(function (e) { return privacyMap.set(e, 0 /* Privacy.None */); }); }); // Unmasked Elements
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
2558
|
-
catch (e) {
|
|
2559
|
-
log$1(5 /* Code.Selector */, 1 /* Severity.Warning */, e ? e.name : null);
|
|
2599
|
+
break;
|
|
2600
|
+
}
|
|
2601
|
+
break;
|
|
2560
2602
|
}
|
|
2603
|
+
return child;
|
|
2561
2604
|
}
|
|
2562
|
-
function
|
|
2563
|
-
if (
|
|
2564
|
-
|
|
2565
|
-
return null;
|
|
2566
|
-
}
|
|
2567
|
-
var id = idMap.get(node);
|
|
2568
|
-
if (!id && autogen) {
|
|
2569
|
-
id = index++;
|
|
2570
|
-
idMap.set(node, id);
|
|
2605
|
+
function observe$2(root) {
|
|
2606
|
+
if (has(root)) {
|
|
2607
|
+
return;
|
|
2571
2608
|
}
|
|
2572
|
-
|
|
2609
|
+
observe$1(root); // Observe mutations for this root node
|
|
2610
|
+
observe$3(root); // Observe interactions for this root node
|
|
2573
2611
|
}
|
|
2574
|
-
function
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
var
|
|
2578
|
-
var
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
var fraudId = fraudMap.has(node) ? fraudMap.get(node) : null;
|
|
2582
|
-
var privacyId = config$1.content ? 1 /* Privacy.Sensitive */ : 3 /* Privacy.TextImage */;
|
|
2583
|
-
if (parentId >= 0 && values[parentId]) {
|
|
2584
|
-
parentValue = values[parentId];
|
|
2585
|
-
parentValue.children.push(id);
|
|
2586
|
-
regionId = regionId === null ? parentValue.region : regionId;
|
|
2587
|
-
fragmentId = parentValue.fragment;
|
|
2588
|
-
fraudId = fraudId === null ? parentValue.metadata.fraud : fraudId;
|
|
2589
|
-
privacyId = parentValue.metadata.privacy;
|
|
2590
|
-
}
|
|
2591
|
-
// If there's an explicit region attribute set on the element, use it to mark a region on the page
|
|
2592
|
-
if (data.attributes && "data-clarity-region" /* Constant.RegionData */ in data.attributes) {
|
|
2593
|
-
observe$1(node, data.attributes["data-clarity-region" /* Constant.RegionData */]);
|
|
2594
|
-
regionId = id;
|
|
2612
|
+
function getStyleValue(style) {
|
|
2613
|
+
// Call trim on the text content to ensure we do not process white spaces ( , \n, \r\n, \t, etc.)
|
|
2614
|
+
// Also, check if stylesheet has any data-* attribute, if so process rules instead of looking up text
|
|
2615
|
+
var value = style.textContent ? style.textContent.trim() : "" /* Constant.Empty */;
|
|
2616
|
+
var dataset = style.dataset ? Object.keys(style.dataset).length : 0;
|
|
2617
|
+
if (value.length === 0 || dataset > 0) {
|
|
2618
|
+
value = getCssRules(style.sheet);
|
|
2595
2619
|
}
|
|
2596
|
-
|
|
2597
|
-
values[id] = {
|
|
2598
|
-
id: id,
|
|
2599
|
-
parent: parentId,
|
|
2600
|
-
previous: previousId,
|
|
2601
|
-
children: [],
|
|
2602
|
-
data: data,
|
|
2603
|
-
selector: null,
|
|
2604
|
-
hash: null,
|
|
2605
|
-
region: regionId,
|
|
2606
|
-
metadata: { active: true, suspend: false, privacy: privacyId, position: null, fraud: fraudId, size: null },
|
|
2607
|
-
fragment: fragmentId,
|
|
2608
|
-
};
|
|
2609
|
-
privacy(node, values[id], parentValue);
|
|
2610
|
-
updateSelector(values[id]);
|
|
2611
|
-
size(values[id]);
|
|
2612
|
-
track$4(id, source, values[id].fragment);
|
|
2620
|
+
return value;
|
|
2613
2621
|
}
|
|
2614
|
-
function
|
|
2615
|
-
var
|
|
2616
|
-
var
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
changed = true;
|
|
2626
|
-
value.previous = previousId;
|
|
2627
|
-
}
|
|
2628
|
-
// Handle case where parent might have been updated
|
|
2629
|
-
if (value.parent !== parentId) {
|
|
2630
|
-
changed = true;
|
|
2631
|
-
var oldParentId = value.parent;
|
|
2632
|
-
value.parent = parentId;
|
|
2633
|
-
// Move this node to the right location under new parent
|
|
2634
|
-
if (parentId !== null && parentId >= 0) {
|
|
2635
|
-
var childIndex = previousId === null ? 0 : values[parentId].children.indexOf(previousId) + 1;
|
|
2636
|
-
values[parentId].children.splice(childIndex, 0, id);
|
|
2637
|
-
// Update region after the move
|
|
2638
|
-
value.region = exists(node) ? id : values[parentId].region;
|
|
2639
|
-
}
|
|
2640
|
-
else {
|
|
2641
|
-
// Mark this element as deleted if the parent has been updated to null
|
|
2642
|
-
remove(id, source);
|
|
2643
|
-
}
|
|
2644
|
-
// Remove reference to this node from the old parent
|
|
2645
|
-
if (oldParentId !== null && oldParentId >= 0) {
|
|
2646
|
-
var nodeIndex = values[oldParentId].children.indexOf(id);
|
|
2647
|
-
if (nodeIndex >= 0) {
|
|
2648
|
-
values[oldParentId].children.splice(nodeIndex, 1);
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2651
|
-
parentChanged = true;
|
|
2652
|
-
}
|
|
2653
|
-
// Update data
|
|
2654
|
-
for (var key in data) {
|
|
2655
|
-
if (diff(value["data"], data, key)) {
|
|
2656
|
-
changed = true;
|
|
2657
|
-
value["data"][key] = data[key];
|
|
2658
|
-
}
|
|
2622
|
+
function getCssRules(sheet) {
|
|
2623
|
+
var value = "" /* Constant.Empty */;
|
|
2624
|
+
var cssRules = null;
|
|
2625
|
+
// Firefox throws a SecurityError when trying to access cssRules of a stylesheet from a different domain
|
|
2626
|
+
try {
|
|
2627
|
+
cssRules = sheet ? sheet.cssRules : [];
|
|
2628
|
+
}
|
|
2629
|
+
catch (e) {
|
|
2630
|
+
log$1(1 /* Code.CssRules */, 1 /* Severity.Warning */, e ? e.name : null);
|
|
2631
|
+
if (e && e.name !== "SecurityError") {
|
|
2632
|
+
throw e;
|
|
2659
2633
|
}
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2634
|
+
}
|
|
2635
|
+
if (cssRules !== null) {
|
|
2636
|
+
for (var i = 0; i < cssRules.length; i++) {
|
|
2637
|
+
value += cssRules[i].cssText;
|
|
2663
2638
|
}
|
|
2664
|
-
// Update selector
|
|
2665
|
-
updateSelector(value);
|
|
2666
|
-
track$4(id, source, values[id].fragment, changed, parentChanged);
|
|
2667
2639
|
}
|
|
2640
|
+
return value;
|
|
2668
2641
|
}
|
|
2669
|
-
function
|
|
2670
|
-
var output =
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
var doc = frame.contentDocument;
|
|
2678
|
-
if (doc) {
|
|
2679
|
-
iframeMap.set(frame.contentDocument, frame);
|
|
2680
|
-
output = true;
|
|
2642
|
+
function getAttributes(element) {
|
|
2643
|
+
var output = {};
|
|
2644
|
+
var attributes = element.attributes;
|
|
2645
|
+
if (attributes && attributes.length > 0) {
|
|
2646
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
2647
|
+
var name_1 = attributes[i].name;
|
|
2648
|
+
if (IGNORE_ATTRIBUTES.indexOf(name_1) < 0) {
|
|
2649
|
+
output[name_1] = attributes[i].value;
|
|
2681
2650
|
}
|
|
2682
2651
|
}
|
|
2683
|
-
catch ( /* do nothing */_a) { /* do nothing */ }
|
|
2684
2652
|
}
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
var doc = node.nodeType === Node.DOCUMENT_NODE ? node : null;
|
|
2689
|
-
return doc && iframeMap.has(doc) ? iframeMap.get(doc) : null;
|
|
2690
|
-
}
|
|
2691
|
-
function privacy(node, value, parent) {
|
|
2692
|
-
var data = value.data;
|
|
2693
|
-
var metadata = value.metadata;
|
|
2694
|
-
var current = metadata.privacy;
|
|
2695
|
-
var attributes = data.attributes || {};
|
|
2696
|
-
var tag = data.tag.toUpperCase();
|
|
2697
|
-
switch (true) {
|
|
2698
|
-
case maskTags.indexOf(tag) >= 0:
|
|
2699
|
-
var type = attributes["type" /* Constant.Type */];
|
|
2700
|
-
var meta_1 = "" /* Constant.Empty */;
|
|
2701
|
-
Object.keys(attributes).forEach(function (x) { return meta_1 += attributes[x].toLowerCase(); });
|
|
2702
|
-
var exclude = maskExclude.some(function (x) { return meta_1.indexOf(x) >= 0; });
|
|
2703
|
-
// Regardless of privacy mode, always mask off user input from input boxes or drop downs with two exceptions:
|
|
2704
|
-
// (1) The node is detected to be one of the excluded fields, in which case we drop everything
|
|
2705
|
-
// (2) The node's type is one of the allowed types (like checkboxes)
|
|
2706
|
-
metadata.privacy = tag === "INPUT" /* Constant.InputTag */ && maskDisable.indexOf(type) >= 0 ? current : (exclude ? 4 /* Privacy.Exclude */ : 2 /* Privacy.Text */);
|
|
2707
|
-
break;
|
|
2708
|
-
case "data-clarity-mask" /* Constant.MaskData */ in attributes:
|
|
2709
|
-
metadata.privacy = 3 /* Privacy.TextImage */;
|
|
2710
|
-
break;
|
|
2711
|
-
case "data-clarity-unmask" /* Constant.UnmaskData */ in attributes:
|
|
2712
|
-
metadata.privacy = 0 /* Privacy.None */;
|
|
2713
|
-
break;
|
|
2714
|
-
case privacyMap.has(node):
|
|
2715
|
-
// If this node was explicitly configured to contain sensitive content, honor that privacy setting
|
|
2716
|
-
metadata.privacy = privacyMap.get(node);
|
|
2717
|
-
break;
|
|
2718
|
-
case fraudMap.has(node):
|
|
2719
|
-
// If this node was explicitly configured to be evaluated for fraud, then also mask content
|
|
2720
|
-
metadata.privacy = 2 /* Privacy.Text */;
|
|
2721
|
-
break;
|
|
2722
|
-
case tag === "*T" /* Constant.TextTag */:
|
|
2723
|
-
// If it's a text node belonging to a STYLE or TITLE tag or one of scrub exceptions, then capture content
|
|
2724
|
-
var pTag = parent && parent.data ? parent.data.tag : "" /* Constant.Empty */;
|
|
2725
|
-
var pSelector_1 = parent && parent.selector ? parent.selector[1 /* Selector.Default */] : "" /* Constant.Empty */;
|
|
2726
|
-
var tags = ["STYLE" /* Constant.StyleTag */, "TITLE" /* Constant.TitleTag */, "svg:style" /* Constant.SvgStyle */];
|
|
2727
|
-
metadata.privacy = tags.includes(pTag) || override.some(function (x) { return pSelector_1.indexOf(x) >= 0; }) ? 0 /* Privacy.None */ : current;
|
|
2728
|
-
break;
|
|
2729
|
-
case current === 1 /* Privacy.Sensitive */:
|
|
2730
|
-
// In a mode where we mask sensitive information by default, look through class names to aggressively mask content
|
|
2731
|
-
metadata.privacy = inspect(attributes["class" /* Constant.Class */], maskText, metadata);
|
|
2732
|
-
break;
|
|
2653
|
+
// For INPUT tags read the dynamic "value" property if an explicit "value" attribute is not set
|
|
2654
|
+
if (element.tagName === "INPUT" /* Constant.InputTag */ && !("value" /* Constant.Value */ in output) && element.value) {
|
|
2655
|
+
output["value" /* Constant.Value */] = element.value;
|
|
2733
2656
|
}
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2657
|
+
return output;
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
function traverse (root, timer, source) {
|
|
2661
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2662
|
+
var queue, node, next, state, subnode;
|
|
2663
|
+
return __generator(this, function (_a) {
|
|
2664
|
+
switch (_a.label) {
|
|
2665
|
+
case 0:
|
|
2666
|
+
queue = [root];
|
|
2667
|
+
_a.label = 1;
|
|
2668
|
+
case 1:
|
|
2669
|
+
if (!(queue.length > 0)) return [3 /*break*/, 4];
|
|
2670
|
+
node = queue.shift();
|
|
2671
|
+
next = node.firstChild;
|
|
2672
|
+
while (next) {
|
|
2673
|
+
queue.push(next);
|
|
2674
|
+
next = next.nextSibling;
|
|
2675
|
+
}
|
|
2676
|
+
state = state$9(timer);
|
|
2677
|
+
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 3];
|
|
2678
|
+
return [4 /*yield*/, suspend$1(timer)];
|
|
2679
|
+
case 2:
|
|
2680
|
+
state = _a.sent();
|
|
2681
|
+
_a.label = 3;
|
|
2682
|
+
case 3:
|
|
2683
|
+
if (state === 2 /* Task.Stop */) {
|
|
2684
|
+
return [3 /*break*/, 4];
|
|
2685
|
+
}
|
|
2686
|
+
subnode = processNode(node, source);
|
|
2687
|
+
if (subnode) {
|
|
2688
|
+
queue.push(subnode);
|
|
2689
|
+
}
|
|
2690
|
+
return [3 /*break*/, 1];
|
|
2691
|
+
case 4: return [2 /*return*/];
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2696
|
+
|
|
2697
|
+
var observers = [];
|
|
2698
|
+
var mutations = [];
|
|
2699
|
+
var insertRule = null;
|
|
2700
|
+
var deleteRule = null;
|
|
2701
|
+
var attachShadow = null;
|
|
2702
|
+
var queue$1 = [];
|
|
2703
|
+
var timeout$1 = null;
|
|
2704
|
+
var activePeriod = null;
|
|
2705
|
+
var history$4 = {};
|
|
2706
|
+
function start$h() {
|
|
2707
|
+
observers = [];
|
|
2708
|
+
queue$1 = [];
|
|
2709
|
+
timeout$1 = null;
|
|
2710
|
+
activePeriod = 0;
|
|
2711
|
+
history$4 = {};
|
|
2712
|
+
// Some popular open source libraries, like styled-components, optimize performance
|
|
2713
|
+
// by injecting CSS using insertRule API vs. appending text node. A side effect of
|
|
2714
|
+
// using javascript API is that it doesn't trigger DOM mutation and therefore we
|
|
2715
|
+
// need to override the insertRule API and listen for changes manually.
|
|
2716
|
+
if (insertRule === null) {
|
|
2717
|
+
insertRule = CSSStyleSheet.prototype.insertRule;
|
|
2718
|
+
CSSStyleSheet.prototype.insertRule = function () {
|
|
2719
|
+
if (active()) {
|
|
2720
|
+
schedule(this.ownerNode);
|
|
2721
|
+
}
|
|
2722
|
+
return insertRule.apply(this, arguments);
|
|
2723
|
+
};
|
|
2738
2724
|
}
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
function
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
if (a[field][key] !== b[field][key]) {
|
|
2745
|
-
return true;
|
|
2725
|
+
if (deleteRule === null) {
|
|
2726
|
+
deleteRule = CSSStyleSheet.prototype.deleteRule;
|
|
2727
|
+
CSSStyleSheet.prototype.deleteRule = function () {
|
|
2728
|
+
if (active()) {
|
|
2729
|
+
schedule(this.ownerNode);
|
|
2746
2730
|
}
|
|
2731
|
+
return deleteRule.apply(this, arguments);
|
|
2732
|
+
};
|
|
2733
|
+
}
|
|
2734
|
+
// Add a hook to attachShadow API calls
|
|
2735
|
+
// In case we are unable to add a hook and browser throws an exception,
|
|
2736
|
+
// reset attachShadow variable and resume processing like before
|
|
2737
|
+
if (attachShadow === null) {
|
|
2738
|
+
attachShadow = Element.prototype.attachShadow;
|
|
2739
|
+
try {
|
|
2740
|
+
Element.prototype.attachShadow = function () {
|
|
2741
|
+
if (active()) {
|
|
2742
|
+
return schedule(attachShadow.apply(this, arguments));
|
|
2743
|
+
}
|
|
2744
|
+
else {
|
|
2745
|
+
return attachShadow.apply(this, arguments);
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2747
2748
|
}
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
return true;
|
|
2751
|
-
}
|
|
2749
|
+
catch (_a) {
|
|
2750
|
+
attachShadow = null;
|
|
2752
2751
|
}
|
|
2753
|
-
return false;
|
|
2754
2752
|
}
|
|
2755
|
-
return a[field] !== b[field];
|
|
2756
2753
|
}
|
|
2757
|
-
function
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2754
|
+
function observe$1(node) {
|
|
2755
|
+
// Create a new observer for every time a new DOM tree (e.g. root document or shadowdom root) is discovered on the page
|
|
2756
|
+
// In the case of shadow dom, any mutations that happen within the shadow dom are not bubbled up to the host document
|
|
2757
|
+
// For this reason, we need to wire up mutations every time we see a new shadow dom.
|
|
2758
|
+
// Also, wrap it inside a try / catch. In certain browsers (e.g. legacy Edge), observer on shadow dom can throw errors
|
|
2759
|
+
try {
|
|
2760
|
+
var m = api("MutationObserver" /* Constant.MutationObserver */);
|
|
2761
|
+
var observer = m in window ? new window[m](measure(handle$1)) : null;
|
|
2762
|
+
if (observer) {
|
|
2763
|
+
observer.observe(node, { attributes: true, childList: true, characterData: true, subtree: true });
|
|
2764
|
+
observers.push(observer);
|
|
2765
2765
|
}
|
|
2766
2766
|
}
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
function updateSelector(value) {
|
|
2770
|
-
var parent = value.parent && value.parent in values ? values[value.parent] : null;
|
|
2771
|
-
var prefix = parent ? parent.selector : null;
|
|
2772
|
-
var d = value.data;
|
|
2773
|
-
var p = position(parent, value);
|
|
2774
|
-
var s = { id: value.id, tag: d.tag, prefix: prefix, position: p, attributes: d.attributes };
|
|
2775
|
-
value.selector = [get$1(s, 0 /* Selector.Alpha */), get$1(s, 1 /* Selector.Beta */)];
|
|
2776
|
-
value.hash = value.selector.map(function (x) { return x ? hash(x) : null; });
|
|
2777
|
-
value.hash.forEach(function (h) { return hashMap[h] = value.id; });
|
|
2778
|
-
// Match fragment configuration against both alpha and beta hash
|
|
2779
|
-
if (value.hash.some(function (h) { return fragments.indexOf(h) !== -1; })) {
|
|
2780
|
-
value.fragment = value.id;
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
function hashText(hash) {
|
|
2784
|
-
var id = lookup(hash);
|
|
2785
|
-
var node = getNode(id);
|
|
2786
|
-
return node !== null && node.textContent !== null ? node.textContent.substr(0, 25 /* Setting.ClickText */) : '';
|
|
2787
|
-
}
|
|
2788
|
-
function getNode(id) {
|
|
2789
|
-
if (id in nodes) {
|
|
2790
|
-
return nodes[id];
|
|
2767
|
+
catch (e) {
|
|
2768
|
+
log$1(2 /* Code.MutationObserver */, 0 /* Severity.Info */, e ? e.name : null);
|
|
2791
2769
|
}
|
|
2792
|
-
return null;
|
|
2793
2770
|
}
|
|
2794
|
-
function
|
|
2795
|
-
|
|
2796
|
-
|
|
2771
|
+
function monitor(frame) {
|
|
2772
|
+
// Bind to iframe's onload event so we get notified anytime there's an update to iframe content.
|
|
2773
|
+
// This includes cases where iframe location is updated without explicitly updating src attribute
|
|
2774
|
+
// E.g. iframe.contentWindow.location.href = "new-location";
|
|
2775
|
+
if (has(frame) === false) {
|
|
2776
|
+
bind(frame, "load" /* Constant.LoadEvent */, generate.bind(this, frame, "childList" /* Constant.ChildList */), true);
|
|
2797
2777
|
}
|
|
2798
|
-
return null;
|
|
2799
2778
|
}
|
|
2800
|
-
function
|
|
2801
|
-
var
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
return hash in hashMap ? hashMap[hash] : null;
|
|
2806
|
-
}
|
|
2807
|
-
function has(node) {
|
|
2808
|
-
return getId(node) in nodes;
|
|
2809
|
-
}
|
|
2810
|
-
function updates$2() {
|
|
2811
|
-
var output = [];
|
|
2812
|
-
for (var _i = 0, updateMap_1 = updateMap; _i < updateMap_1.length; _i++) {
|
|
2813
|
-
var id = updateMap_1[_i];
|
|
2814
|
-
if (id in values) {
|
|
2815
|
-
output.push(values[id]);
|
|
2779
|
+
function stop$f() {
|
|
2780
|
+
for (var _i = 0, observers_1 = observers; _i < observers_1.length; _i++) {
|
|
2781
|
+
var observer = observers_1[_i];
|
|
2782
|
+
if (observer) {
|
|
2783
|
+
observer.disconnect();
|
|
2816
2784
|
}
|
|
2817
2785
|
}
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
}
|
|
2825
|
-
function remove(id, source) {
|
|
2826
|
-
if (id in values) {
|
|
2827
|
-
var value = values[id];
|
|
2828
|
-
value.metadata.active = false;
|
|
2829
|
-
value.parent = null;
|
|
2830
|
-
track$4(id, source);
|
|
2831
|
-
}
|
|
2832
|
-
}
|
|
2833
|
-
function size(value) {
|
|
2834
|
-
// If this element is a image node, and is masked, then track box model for the current element
|
|
2835
|
-
if (value.data.tag === "IMG" /* Constant.ImageTag */ && value.metadata.privacy === 3 /* Privacy.TextImage */) {
|
|
2836
|
-
value.metadata.size = [];
|
|
2837
|
-
}
|
|
2786
|
+
observers = [];
|
|
2787
|
+
history$4 = {};
|
|
2788
|
+
mutations = [];
|
|
2789
|
+
queue$1 = [];
|
|
2790
|
+
activePeriod = 0;
|
|
2791
|
+
timeout$1 = null;
|
|
2838
2792
|
}
|
|
2839
|
-
function
|
|
2840
|
-
|
|
2841
|
-
// Some nodes may not have an ID by design since Clarity skips over tags like SCRIPT, NOSCRIPT, META, COMMENTS, etc..
|
|
2842
|
-
// In that case, we keep going back and check for their sibling until we find a sibling with ID or no more sibling nodes are left.
|
|
2843
|
-
while (id === null && node.previousSibling) {
|
|
2844
|
-
id = getId(node.previousSibling);
|
|
2845
|
-
node = node.previousSibling;
|
|
2846
|
-
}
|
|
2847
|
-
return id;
|
|
2793
|
+
function active$2() {
|
|
2794
|
+
activePeriod = time() + 3000 /* Setting.MutationActivePeriod */;
|
|
2848
2795
|
}
|
|
2849
|
-
function
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
schedule(node, true);
|
|
2859
|
-
value.hash.forEach(function (h) {
|
|
2860
|
-
if (fragments.indexOf(h) !== -1) {
|
|
2861
|
-
updatedFragments[fragment] = h;
|
|
2862
|
-
}
|
|
2863
|
-
});
|
|
2864
|
-
}
|
|
2865
|
-
}
|
|
2866
|
-
// Keep track of the order in which mutations happened, they may not be sequential
|
|
2867
|
-
// Edge case: If an element is added later on, and pre-discovered element is moved as a child.
|
|
2868
|
-
// In that case, we need to reorder the pre-discovered element in the update list to keep visualization consistent.
|
|
2869
|
-
var uIndex = updateMap.indexOf(id);
|
|
2870
|
-
if (uIndex >= 0 && source === 1 /* Source.ChildListAdd */ && parentChanged) {
|
|
2871
|
-
updateMap.splice(uIndex, 1);
|
|
2872
|
-
updateMap.push(id);
|
|
2873
|
-
}
|
|
2874
|
-
else if (uIndex === -1 && changed) {
|
|
2875
|
-
updateMap.push(id);
|
|
2876
|
-
}
|
|
2877
|
-
}
|
|
2878
|
-
|
|
2879
|
-
var state$1 = [];
|
|
2880
|
-
var regionMap = null; // Maps region nodes => region name
|
|
2881
|
-
var regions = {};
|
|
2882
|
-
var queue$1 = [];
|
|
2883
|
-
var watch = false;
|
|
2884
|
-
var observer$1 = null;
|
|
2885
|
-
function start$h() {
|
|
2886
|
-
reset$6();
|
|
2887
|
-
observer$1 = null;
|
|
2888
|
-
regionMap = new WeakMap();
|
|
2889
|
-
regions = {};
|
|
2890
|
-
queue$1 = [];
|
|
2891
|
-
watch = window["IntersectionObserver"] ? true : false;
|
|
2796
|
+
function handle$1(m) {
|
|
2797
|
+
// Queue up mutation records for asynchronous processing
|
|
2798
|
+
var now = time();
|
|
2799
|
+
track$6(6 /* Event.Mutation */, now);
|
|
2800
|
+
mutations.push({ time: now, mutations: m });
|
|
2801
|
+
schedule$1(process$1, 1 /* Priority.High */).then(function () {
|
|
2802
|
+
setTimeout(compute$7);
|
|
2803
|
+
measure(compute$6)();
|
|
2804
|
+
});
|
|
2892
2805
|
}
|
|
2893
|
-
function
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2806
|
+
function process$1() {
|
|
2807
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2808
|
+
var timer, record, instance, _i, _a, mutation, state, target, type, value;
|
|
2809
|
+
return __generator(this, function (_b) {
|
|
2810
|
+
switch (_b.label) {
|
|
2811
|
+
case 0:
|
|
2812
|
+
timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
|
|
2813
|
+
start$w(timer);
|
|
2814
|
+
_b.label = 1;
|
|
2815
|
+
case 1:
|
|
2816
|
+
if (!(mutations.length > 0)) return [3 /*break*/, 8];
|
|
2817
|
+
record = mutations.shift();
|
|
2818
|
+
instance = time();
|
|
2819
|
+
_i = 0, _a = record.mutations;
|
|
2820
|
+
_b.label = 2;
|
|
2821
|
+
case 2:
|
|
2822
|
+
if (!(_i < _a.length)) return [3 /*break*/, 6];
|
|
2823
|
+
mutation = _a[_i];
|
|
2824
|
+
state = state$9(timer);
|
|
2825
|
+
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
|
|
2826
|
+
return [4 /*yield*/, suspend$1(timer)];
|
|
2827
|
+
case 3:
|
|
2828
|
+
state = _b.sent();
|
|
2829
|
+
_b.label = 4;
|
|
2830
|
+
case 4:
|
|
2831
|
+
if (state === 2 /* Task.Stop */) {
|
|
2832
|
+
return [3 /*break*/, 6];
|
|
2833
|
+
}
|
|
2834
|
+
target = mutation.target;
|
|
2835
|
+
type = track$3(mutation, timer, instance);
|
|
2836
|
+
if (type && target && target.ownerDocument) {
|
|
2837
|
+
parse$1(target.ownerDocument);
|
|
2838
|
+
}
|
|
2839
|
+
if (type && target && target.nodeType == Node.DOCUMENT_FRAGMENT_NODE && target.host) {
|
|
2840
|
+
parse$1(target);
|
|
2841
|
+
}
|
|
2842
|
+
switch (type) {
|
|
2843
|
+
case "attributes" /* Constant.Attributes */:
|
|
2844
|
+
processNode(target, 3 /* Source.Attributes */);
|
|
2845
|
+
break;
|
|
2846
|
+
case "characterData" /* Constant.CharacterData */:
|
|
2847
|
+
processNode(target, 4 /* Source.CharacterData */);
|
|
2848
|
+
break;
|
|
2849
|
+
case "childList" /* Constant.ChildList */:
|
|
2850
|
+
processNodeList(mutation.addedNodes, 1 /* Source.ChildListAdd */, timer);
|
|
2851
|
+
processNodeList(mutation.removedNodes, 2 /* Source.ChildListRemove */, timer);
|
|
2852
|
+
break;
|
|
2853
|
+
case "suspend" /* Constant.Suspend */:
|
|
2854
|
+
value = get(target);
|
|
2855
|
+
if (value) {
|
|
2856
|
+
value.metadata.suspend = true;
|
|
2857
|
+
}
|
|
2858
|
+
break;
|
|
2859
|
+
}
|
|
2860
|
+
_b.label = 5;
|
|
2861
|
+
case 5:
|
|
2862
|
+
_i++;
|
|
2863
|
+
return [3 /*break*/, 2];
|
|
2864
|
+
case 6: return [4 /*yield*/, encode$4(6 /* Event.Mutation */, timer, record.time)];
|
|
2865
|
+
case 7:
|
|
2866
|
+
_b.sent();
|
|
2867
|
+
return [3 /*break*/, 1];
|
|
2868
|
+
case 8:
|
|
2869
|
+
stop$t(timer);
|
|
2870
|
+
return [2 /*return*/];
|
|
2871
|
+
}
|
|
2872
|
+
});
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
function track$3(m, timer, instance) {
|
|
2876
|
+
var value = m.target ? get(m.target.parentNode) : null;
|
|
2877
|
+
// Check if the parent is already discovered and that the parent is not the document root
|
|
2878
|
+
if (value && value.data.tag !== "HTML" /* Constant.HTML */) {
|
|
2879
|
+
var inactive = time() > activePeriod;
|
|
2880
|
+
var target = get(m.target);
|
|
2881
|
+
var element = target && target.selector ? target.selector.join() : m.target.nodeName;
|
|
2882
|
+
var parent_1 = value.selector ? value.selector.join() : "" /* Constant.Empty */;
|
|
2883
|
+
// We use selector, instead of id, to determine the key (signature for the mutation) because in some cases
|
|
2884
|
+
// repeated mutations can cause elements to be destroyed and then recreated as new DOM nodes
|
|
2885
|
+
// In those cases, IDs will change however the selector (which is relative to DOM xPath) remains the same
|
|
2886
|
+
var key = [parent_1, element, m.attributeName, names(m.addedNodes), names(m.removedNodes)].join();
|
|
2887
|
+
// Initialize an entry if it doesn't already exist
|
|
2888
|
+
history$4[key] = key in history$4 ? history$4[key] : [0, instance];
|
|
2889
|
+
var h = history$4[key];
|
|
2890
|
+
// Lookup any pending nodes queued up for removal, and process them now if we suspended a mutation before
|
|
2891
|
+
if (inactive === false && h[0] >= 10 /* Setting.MutationSuspendThreshold */) {
|
|
2892
|
+
processNodeList(h[2], 2 /* Source.ChildListRemove */, timer);
|
|
2893
|
+
}
|
|
2894
|
+
// Update the counter
|
|
2895
|
+
h[0] = inactive ? (h[1] === instance ? h[0] : h[0] + 1) : 1;
|
|
2896
|
+
h[1] = instance;
|
|
2897
|
+
// Return updated mutation type based on if we have already hit the threshold or not
|
|
2898
|
+
if (h[0] === 10 /* Setting.MutationSuspendThreshold */) {
|
|
2899
|
+
// Store a reference to removedNodes so we can process them later
|
|
2900
|
+
// when we resume mutations again on user interactions
|
|
2901
|
+
h[2] = m.removedNodes;
|
|
2902
|
+
return "suspend" /* Constant.Suspend */;
|
|
2903
|
+
}
|
|
2904
|
+
else if (h[0] > 10 /* Setting.MutationSuspendThreshold */) {
|
|
2905
|
+
return "" /* Constant.Empty */;
|
|
2905
2906
|
}
|
|
2906
2907
|
}
|
|
2908
|
+
return m.type;
|
|
2907
2909
|
}
|
|
2908
|
-
function
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
return regionMap && regionMap.has(node);
|
|
2913
|
-
}
|
|
2914
|
-
function track$3(id, event) {
|
|
2915
|
-
var node = getNode(id);
|
|
2916
|
-
var data = id in regions ? regions[id] : { id: id, visibility: 0 /* RegionVisibility.Rendered */, interaction: 16 /* InteractionState.None */, name: regionMap.get(node) };
|
|
2917
|
-
// Determine the interaction state based on incoming event
|
|
2918
|
-
var interaction = 16 /* InteractionState.None */;
|
|
2919
|
-
switch (event) {
|
|
2920
|
-
case 9 /* Event.Click */:
|
|
2921
|
-
interaction = 20 /* InteractionState.Clicked */;
|
|
2922
|
-
break;
|
|
2923
|
-
case 27 /* Event.Input */:
|
|
2924
|
-
interaction = 30 /* InteractionState.Input */;
|
|
2925
|
-
break;
|
|
2910
|
+
function names(nodes) {
|
|
2911
|
+
var output = [];
|
|
2912
|
+
for (var i = 0; nodes && i < nodes.length; i++) {
|
|
2913
|
+
output.push(nodes[i].nodeName);
|
|
2926
2914
|
}
|
|
2927
|
-
|
|
2928
|
-
process$1(node, data, interaction, data.visibility);
|
|
2915
|
+
return output.join();
|
|
2929
2916
|
}
|
|
2930
|
-
function
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2917
|
+
function processNodeList(list, source, timer) {
|
|
2918
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2919
|
+
var length, i, state;
|
|
2920
|
+
return __generator(this, function (_a) {
|
|
2921
|
+
switch (_a.label) {
|
|
2922
|
+
case 0:
|
|
2923
|
+
length = list ? list.length : 0;
|
|
2924
|
+
i = 0;
|
|
2925
|
+
_a.label = 1;
|
|
2926
|
+
case 1:
|
|
2927
|
+
if (!(i < length)) return [3 /*break*/, 6];
|
|
2928
|
+
if (!(source === 1 /* Source.ChildListAdd */)) return [3 /*break*/, 2];
|
|
2929
|
+
traverse(list[i], timer, source);
|
|
2930
|
+
return [3 /*break*/, 5];
|
|
2931
|
+
case 2:
|
|
2932
|
+
state = state$9(timer);
|
|
2933
|
+
if (!(state === 0 /* Task.Wait */)) return [3 /*break*/, 4];
|
|
2934
|
+
return [4 /*yield*/, suspend$1(timer)];
|
|
2935
|
+
case 3:
|
|
2936
|
+
state = _a.sent();
|
|
2937
|
+
_a.label = 4;
|
|
2938
|
+
case 4:
|
|
2939
|
+
if (state === 2 /* Task.Stop */) {
|
|
2940
|
+
return [3 /*break*/, 6];
|
|
2941
|
+
}
|
|
2942
|
+
processNode(list[i], source);
|
|
2943
|
+
_a.label = 5;
|
|
2944
|
+
case 5:
|
|
2945
|
+
i++;
|
|
2946
|
+
return [3 /*break*/, 1];
|
|
2947
|
+
case 6: return [2 /*return*/];
|
|
2946
2948
|
}
|
|
2947
|
-
}
|
|
2948
|
-
}
|
|
2949
|
-
queue$1 = q;
|
|
2950
|
-
// Schedule encode only when we have at least one valid data entry
|
|
2951
|
-
if (state$1.length > 0) {
|
|
2952
|
-
encode$4(7 /* Event.Region */);
|
|
2953
|
-
}
|
|
2949
|
+
});
|
|
2950
|
+
});
|
|
2954
2951
|
}
|
|
2955
|
-
function
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
var rect = entry.boundingClientRect;
|
|
2960
|
-
var overlap = entry.intersectionRect;
|
|
2961
|
-
var viewport = entry.rootBounds;
|
|
2962
|
-
// Only capture regions that have non-zero width or height to avoid tracking and sending regions
|
|
2963
|
-
// that cannot ever be seen by the user. In some cases, websites will have a multiple copy of the same region
|
|
2964
|
-
// like search box - one for desktop, and another for mobile. In those cases, CSS media queries determine which one should be visible.
|
|
2965
|
-
// Also, if these regions ever become non-zero width or height (through AJAX, user action or orientation change) - we will automatically start monitoring them from that point onwards
|
|
2966
|
-
if (regionMap.has(target) && rect.width + rect.height > 0 && viewport.width > 0 && viewport.height > 0) {
|
|
2967
|
-
var id = target ? getId(target) : null;
|
|
2968
|
-
var data = id in regions ? regions[id] : { id: id, name: regionMap.get(target), interaction: 16 /* InteractionState.None */, visibility: 0 /* RegionVisibility.Rendered */ };
|
|
2969
|
-
// For regions that have relatively smaller area, we look at intersection ratio and see the overlap relative to element's area
|
|
2970
|
-
// However, for larger regions, area of regions could be bigger than viewport and therefore comparison is relative to visible area
|
|
2971
|
-
var viewportRatio = overlap ? (overlap.width * overlap.height * 1.0) / (viewport.width * viewport.height) : 0;
|
|
2972
|
-
var visible = viewportRatio > 0.05 /* Setting.ViewportIntersectionRatio */ || entry.intersectionRatio > 0.8 /* Setting.IntersectionRatio */;
|
|
2973
|
-
// If an element is either visible or was visible and has been scrolled to the end
|
|
2974
|
-
// i.e. Scrolled to end is determined by if the starting position of the element + the window height is more than the total element height.
|
|
2975
|
-
// starting position is relative to the viewport - so Intersection observer returns a negative value for rect.top to indicate that the element top is above the viewport
|
|
2976
|
-
var scrolledToEnd = (visible || data.visibility == 10 /* RegionVisibility.Visible */) && Math.abs(rect.top) + viewport.height > rect.height;
|
|
2977
|
-
// Process updates to this region, if applicable
|
|
2978
|
-
process$1(target, data, data.interaction, (scrolledToEnd ?
|
|
2979
|
-
13 /* RegionVisibility.ScrolledToEnd */ :
|
|
2980
|
-
(visible ? 10 /* RegionVisibility.Visible */ : 0 /* RegionVisibility.Rendered */)));
|
|
2981
|
-
// Stop observing this element now that we have already received scrolled signal
|
|
2982
|
-
if (data.visibility >= 13 /* RegionVisibility.ScrolledToEnd */ && observer$1) {
|
|
2983
|
-
observer$1.unobserve(target);
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2952
|
+
function schedule(node) {
|
|
2953
|
+
// Only schedule manual trigger for this node if it's not already in the queue
|
|
2954
|
+
if (queue$1.indexOf(node) < 0) {
|
|
2955
|
+
queue$1.push(node);
|
|
2986
2956
|
}
|
|
2987
|
-
|
|
2988
|
-
|
|
2957
|
+
// Cancel any previous trigger before scheduling a new one.
|
|
2958
|
+
// It's common for a webpage to call multiple synchronous "insertRule" / "deleteRule" calls.
|
|
2959
|
+
// And in those cases we do not wish to monitor changes multiple times for the same node.
|
|
2960
|
+
if (timeout$1) {
|
|
2961
|
+
clearTimeout(timeout$1);
|
|
2989
2962
|
}
|
|
2963
|
+
timeout$1 = setTimeout(function () { trigger$2(); }, 33 /* Setting.LookAhead */);
|
|
2964
|
+
return node;
|
|
2990
2965
|
}
|
|
2991
|
-
function
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
2966
|
+
function trigger$2() {
|
|
2967
|
+
for (var _i = 0, queue_1 = queue$1; _i < queue_1.length; _i++) {
|
|
2968
|
+
var node = queue_1[_i];
|
|
2969
|
+
// Generate a mutation for this node only if it still exists
|
|
2970
|
+
if (node) {
|
|
2971
|
+
var shadowRoot = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
2972
|
+
// Skip re-processing shadowRoot if it was already discovered
|
|
2973
|
+
if (shadowRoot && has(node)) {
|
|
2974
|
+
continue;
|
|
2975
|
+
}
|
|
2976
|
+
generate(node, shadowRoot ? "childList" /* Constant.ChildList */ : "characterData" /* Constant.CharacterData */);
|
|
3002
2977
|
}
|
|
3003
2978
|
}
|
|
3004
|
-
else {
|
|
3005
|
-
queue$1.push({ node: n, data: d });
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
function clone$1(r) {
|
|
3009
|
-
return { time: time(), data: { id: r.id, interaction: r.interaction, visibility: r.visibility, name: r.name } };
|
|
3010
|
-
}
|
|
3011
|
-
function reset$6() {
|
|
3012
|
-
state$1 = [];
|
|
3013
|
-
}
|
|
3014
|
-
function stop$f() {
|
|
3015
|
-
reset$6();
|
|
3016
|
-
regionMap = null;
|
|
3017
|
-
regions = {};
|
|
3018
2979
|
queue$1 = [];
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
2980
|
+
}
|
|
2981
|
+
function generate(target, type) {
|
|
2982
|
+
measure(handle$1)([{
|
|
2983
|
+
addedNodes: [target],
|
|
2984
|
+
attributeName: null,
|
|
2985
|
+
attributeNamespace: null,
|
|
2986
|
+
nextSibling: null,
|
|
2987
|
+
oldValue: null,
|
|
2988
|
+
previousSibling: null,
|
|
2989
|
+
removedNodes: [],
|
|
2990
|
+
target: target,
|
|
2991
|
+
type: type
|
|
2992
|
+
}]);
|
|
3024
2993
|
}
|
|
3025
2994
|
|
|
3026
2995
|
function target(evt) {
|
|
@@ -3053,7 +3022,7 @@ function metadata$2(node, event, text) {
|
|
|
3053
3022
|
output.hash = value.hash;
|
|
3054
3023
|
output.privacy = metadata_1.privacy;
|
|
3055
3024
|
if (value.region) {
|
|
3056
|
-
track$
|
|
3025
|
+
track$4(value.region, event);
|
|
3057
3026
|
}
|
|
3058
3027
|
if (metadata_1.fraud) {
|
|
3059
3028
|
check$4(metadata_1.fraud, value.id, text || value.data.value);
|
|
@@ -3080,7 +3049,7 @@ function encode$3 (type, ts) {
|
|
|
3080
3049
|
case 18 /* Event.TouchEnd */:
|
|
3081
3050
|
case 19 /* Event.TouchMove */:
|
|
3082
3051
|
case 20 /* Event.TouchCancel */:
|
|
3083
|
-
for (_i = 0, _a = state$
|
|
3052
|
+
for (_i = 0, _a = state$3; _i < _a.length; _i++) {
|
|
3084
3053
|
entry = _a[_i];
|
|
3085
3054
|
pTarget = metadata$2(entry.data.target, entry.event);
|
|
3086
3055
|
if (pTarget.id > 0) {
|
|
@@ -3092,10 +3061,10 @@ function encode$3 (type, ts) {
|
|
|
3092
3061
|
track$7(entry.event, entry.data.x, entry.data.y);
|
|
3093
3062
|
}
|
|
3094
3063
|
}
|
|
3095
|
-
reset$
|
|
3064
|
+
reset$c();
|
|
3096
3065
|
break;
|
|
3097
3066
|
case 9 /* Event.Click */:
|
|
3098
|
-
for (_b = 0, _c = state$
|
|
3067
|
+
for (_b = 0, _c = state$6; _b < _c.length; _b++) {
|
|
3099
3068
|
entry = _c[_b];
|
|
3100
3069
|
cTarget = metadata$2(entry.data.target, entry.event, entry.data.text);
|
|
3101
3070
|
tokens = [entry.time, entry.event];
|
|
@@ -3115,10 +3084,10 @@ function encode$3 (type, ts) {
|
|
|
3115
3084
|
queue(tokens);
|
|
3116
3085
|
track$2(entry.time, entry.event, cHash, entry.data.x, entry.data.y, entry.data.reaction, entry.data.context);
|
|
3117
3086
|
}
|
|
3118
|
-
reset$
|
|
3087
|
+
reset$f();
|
|
3119
3088
|
break;
|
|
3120
3089
|
case 38 /* Event.Clipboard */:
|
|
3121
|
-
for (_d = 0, _e = state$
|
|
3090
|
+
for (_d = 0, _e = state$5; _d < _e.length; _d++) {
|
|
3122
3091
|
entry = _e[_d];
|
|
3123
3092
|
tokens = [entry.time, entry.event];
|
|
3124
3093
|
target = metadata$2(entry.data.target, entry.event);
|
|
@@ -3128,24 +3097,24 @@ function encode$3 (type, ts) {
|
|
|
3128
3097
|
queue(tokens);
|
|
3129
3098
|
}
|
|
3130
3099
|
}
|
|
3131
|
-
reset$
|
|
3100
|
+
reset$e();
|
|
3132
3101
|
break;
|
|
3133
3102
|
case 11 /* Event.Resize */:
|
|
3134
3103
|
r = data$b;
|
|
3135
3104
|
tokens.push(r.width);
|
|
3136
3105
|
tokens.push(r.height);
|
|
3137
3106
|
track$7(type, r.width, r.height);
|
|
3138
|
-
reset$
|
|
3107
|
+
reset$b();
|
|
3139
3108
|
queue(tokens);
|
|
3140
3109
|
break;
|
|
3141
3110
|
case 26 /* Event.Unload */:
|
|
3142
3111
|
u = data$9;
|
|
3143
3112
|
tokens.push(u.name);
|
|
3144
|
-
reset$
|
|
3113
|
+
reset$7();
|
|
3145
3114
|
queue(tokens);
|
|
3146
3115
|
break;
|
|
3147
3116
|
case 27 /* Event.Input */:
|
|
3148
|
-
for (_f = 0, _g = state$
|
|
3117
|
+
for (_f = 0, _g = state$4; _f < _g.length; _f++) {
|
|
3149
3118
|
entry = _g[_f];
|
|
3150
3119
|
iTarget = metadata$2(entry.data.target, entry.event, entry.data.value);
|
|
3151
3120
|
tokens = [entry.time, entry.event];
|
|
@@ -3153,7 +3122,7 @@ function encode$3 (type, ts) {
|
|
|
3153
3122
|
tokens.push(text$1(entry.data.value, "input", iTarget.privacy));
|
|
3154
3123
|
queue(tokens);
|
|
3155
3124
|
}
|
|
3156
|
-
reset$
|
|
3125
|
+
reset$d();
|
|
3157
3126
|
break;
|
|
3158
3127
|
case 21 /* Event.Selection */:
|
|
3159
3128
|
s = data$a;
|
|
@@ -3164,12 +3133,12 @@ function encode$3 (type, ts) {
|
|
|
3164
3133
|
tokens.push(s.startOffset);
|
|
3165
3134
|
tokens.push(endTarget.id);
|
|
3166
3135
|
tokens.push(s.endOffset);
|
|
3167
|
-
reset$
|
|
3136
|
+
reset$9();
|
|
3168
3137
|
queue(tokens);
|
|
3169
3138
|
}
|
|
3170
3139
|
break;
|
|
3171
3140
|
case 10 /* Event.Scroll */:
|
|
3172
|
-
for (_h = 0, _j = state$
|
|
3141
|
+
for (_h = 0, _j = state$2; _h < _j.length; _h++) {
|
|
3173
3142
|
entry = _j[_h];
|
|
3174
3143
|
sTarget = metadata$2(entry.data.target, entry.event);
|
|
3175
3144
|
if (sTarget.id > 0) {
|
|
@@ -3181,10 +3150,10 @@ function encode$3 (type, ts) {
|
|
|
3181
3150
|
track$7(entry.event, entry.data.x, entry.data.y);
|
|
3182
3151
|
}
|
|
3183
3152
|
}
|
|
3184
|
-
reset$
|
|
3153
|
+
reset$a();
|
|
3185
3154
|
break;
|
|
3186
3155
|
case 42 /* Event.Change */:
|
|
3187
|
-
for (_k = 0, _l = state$
|
|
3156
|
+
for (_k = 0, _l = state$7; _k < _l.length; _k++) {
|
|
3188
3157
|
entry = _l[_k];
|
|
3189
3158
|
tokens = [entry.time, entry.event];
|
|
3190
3159
|
target = metadata$2(entry.data.target, entry.event);
|
|
@@ -3197,10 +3166,10 @@ function encode$3 (type, ts) {
|
|
|
3197
3166
|
queue(tokens);
|
|
3198
3167
|
}
|
|
3199
3168
|
}
|
|
3200
|
-
reset$
|
|
3169
|
+
reset$g();
|
|
3201
3170
|
break;
|
|
3202
3171
|
case 39 /* Event.Submit */:
|
|
3203
|
-
for (_m = 0, _o = state$
|
|
3172
|
+
for (_m = 0, _o = state$1; _m < _o.length; _m++) {
|
|
3204
3173
|
entry = _o[_m];
|
|
3205
3174
|
tokens = [entry.time, entry.event];
|
|
3206
3175
|
target = metadata$2(entry.data.target, entry.event);
|
|
@@ -3209,7 +3178,7 @@ function encode$3 (type, ts) {
|
|
|
3209
3178
|
queue(tokens);
|
|
3210
3179
|
}
|
|
3211
3180
|
}
|
|
3212
|
-
reset$
|
|
3181
|
+
reset$8();
|
|
3213
3182
|
break;
|
|
3214
3183
|
case 22 /* Event.Timeline */:
|
|
3215
3184
|
for (_p = 0, _q = updates$1; _p < _q.length; _p++) {
|
|
@@ -3230,7 +3199,7 @@ function encode$3 (type, ts) {
|
|
|
3230
3199
|
tokens.push(v.visible);
|
|
3231
3200
|
queue(tokens);
|
|
3232
3201
|
visibility(t, v.visible);
|
|
3233
|
-
reset$
|
|
3202
|
+
reset$6();
|
|
3234
3203
|
break;
|
|
3235
3204
|
}
|
|
3236
3205
|
return [2 /*return*/];
|
|
@@ -3531,22 +3500,31 @@ function delay() {
|
|
|
3531
3500
|
return typeof config$1.upload === "string" /* Constant.String */ ? Math.max(Math.min(gap, 30000 /* Setting.MaxUploadDelay */), 100 /* Setting.MinUploadDelay */) : config$1.delay;
|
|
3532
3501
|
}
|
|
3533
3502
|
function response(payload) {
|
|
3534
|
-
var
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3503
|
+
var lines = payload && payload.length > 0 ? payload.split("\n") : [];
|
|
3504
|
+
for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
|
|
3505
|
+
var line = lines_1[_i];
|
|
3506
|
+
var parts = line && line.length > 0 ? line.split(/ (.*)/) : ["" /* Constant.Empty */];
|
|
3507
|
+
switch (parts[0]) {
|
|
3508
|
+
case "END" /* Constant.End */:
|
|
3509
|
+
// Clear out session storage and end the session so we can start fresh the next time
|
|
3510
|
+
trigger(6 /* Check.Server */);
|
|
3511
|
+
break;
|
|
3512
|
+
case "UPGRADE" /* Constant.Upgrade */:
|
|
3513
|
+
// Upgrade current session to send back playback information
|
|
3514
|
+
upgrade("Auto" /* Constant.Auto */);
|
|
3515
|
+
break;
|
|
3516
|
+
case "ACTION" /* Constant.Action */:
|
|
3517
|
+
// Invoke action callback, if configured and has a valid value
|
|
3518
|
+
if (config$1.action && parts.length > 1) {
|
|
3519
|
+
config$1.action(parts[1]);
|
|
3520
|
+
}
|
|
3521
|
+
break;
|
|
3522
|
+
case "EXTRACT" /* Constant.Extract */:
|
|
3523
|
+
if (parts.length > 1) {
|
|
3524
|
+
trigger$1(parts[1]);
|
|
3525
|
+
}
|
|
3526
|
+
break;
|
|
3527
|
+
}
|
|
3550
3528
|
}
|
|
3551
3529
|
}
|
|
3552
3530
|
|
|
@@ -3651,30 +3629,27 @@ var data$5 = {};
|
|
|
3651
3629
|
var keys = [];
|
|
3652
3630
|
var variables = {};
|
|
3653
3631
|
var selectors = {};
|
|
3654
|
-
var fragments = [];
|
|
3655
3632
|
function start$c() {
|
|
3633
|
+
reset$4();
|
|
3634
|
+
}
|
|
3635
|
+
function trigger$1(input) {
|
|
3656
3636
|
try {
|
|
3657
|
-
var
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
}
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
var
|
|
3637
|
+
var parts = input && input.length > 0 ? input.split(/ (.*)/) : ["" /* Constant.Empty */];
|
|
3638
|
+
var key = parseInt(parts[0]);
|
|
3639
|
+
var values = parts.length > 1 ? JSON.parse(parts[1]) : {};
|
|
3640
|
+
variables[key] = {};
|
|
3641
|
+
selectors[key] = {};
|
|
3642
|
+
for (var v in values) {
|
|
3643
|
+
var id = parseInt(v);
|
|
3644
|
+
var value = values[v];
|
|
3645
|
+
var source = value.startsWith("~" /* Constant.Tilde */) ? 0 /* ExtractSource.Javascript */ : 2 /* ExtractSource.Text */;
|
|
3664
3646
|
switch (source) {
|
|
3665
3647
|
case 0 /* ExtractSource.Javascript */:
|
|
3666
|
-
var variable =
|
|
3667
|
-
variables[key] = parse(variable);
|
|
3668
|
-
break;
|
|
3669
|
-
case 1 /* ExtractSource.Cookie */:
|
|
3670
|
-
/*Todo: Add cookie extract logic*/
|
|
3648
|
+
var variable = value.substring(1, value.length);
|
|
3649
|
+
variables[key][id] = parse(variable);
|
|
3671
3650
|
break;
|
|
3672
3651
|
case 2 /* ExtractSource.Text */:
|
|
3673
|
-
|
|
3674
|
-
selectors[key] = match_1;
|
|
3675
|
-
break;
|
|
3676
|
-
case 3 /* ExtractSource.Fragment */:
|
|
3677
|
-
fragments = e[i + 2];
|
|
3652
|
+
selectors[key][id] = value;
|
|
3678
3653
|
break;
|
|
3679
3654
|
}
|
|
3680
3655
|
}
|
|
@@ -3689,15 +3664,25 @@ function clone(v) {
|
|
|
3689
3664
|
function compute$4() {
|
|
3690
3665
|
try {
|
|
3691
3666
|
for (var v in variables) {
|
|
3692
|
-
var
|
|
3693
|
-
if (
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3667
|
+
var key = parseInt(v);
|
|
3668
|
+
if (!(key in keys)) {
|
|
3669
|
+
var variableData = variables[key];
|
|
3670
|
+
for (var v_1 in variableData) {
|
|
3671
|
+
var variableKey = parseInt(v_1);
|
|
3672
|
+
var value = str(evaluate(clone(variableData[variableKey])));
|
|
3673
|
+
if (value) {
|
|
3674
|
+
update(key, variableKey, value);
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
var selectorData = selectors[key];
|
|
3678
|
+
for (var s in selectorData) {
|
|
3679
|
+
var selectorKey = parseInt(s);
|
|
3680
|
+
var nodes = document.querySelectorAll(selectorData[selectorKey]);
|
|
3681
|
+
if (nodes) {
|
|
3682
|
+
var text = Array.from(nodes).map(function (e) { return e.innerText; });
|
|
3683
|
+
update(key, selectorKey, text.join("<SEP>" /* Constant.Seperator */).substring(0, 10000 /* Setting.ExtractLimit */));
|
|
3684
|
+
}
|
|
3685
|
+
}
|
|
3701
3686
|
}
|
|
3702
3687
|
}
|
|
3703
3688
|
}
|
|
@@ -3707,20 +3692,20 @@ function compute$4() {
|
|
|
3707
3692
|
encode$1(40 /* Event.Extract */);
|
|
3708
3693
|
}
|
|
3709
3694
|
function reset$4() {
|
|
3695
|
+
data$5 = {};
|
|
3710
3696
|
keys = [];
|
|
3697
|
+
variables = {};
|
|
3698
|
+
selectors = {};
|
|
3711
3699
|
}
|
|
3712
|
-
function update(key,
|
|
3713
|
-
if (
|
|
3714
|
-
|
|
3715
|
-
data$5[key] = value;
|
|
3700
|
+
function update(key, subkey, value) {
|
|
3701
|
+
if (!(key in data$5)) {
|
|
3702
|
+
data$5[key] = [];
|
|
3716
3703
|
keys.push(key);
|
|
3717
3704
|
}
|
|
3705
|
+
data$5[key].push([subkey, value]);
|
|
3718
3706
|
}
|
|
3719
3707
|
function stop$b() {
|
|
3720
|
-
|
|
3721
|
-
keys = [];
|
|
3722
|
-
variables = {};
|
|
3723
|
-
selectors = {};
|
|
3708
|
+
reset$4();
|
|
3724
3709
|
}
|
|
3725
3710
|
function parse(variable) {
|
|
3726
3711
|
var syntax = [];
|
|
@@ -3885,7 +3870,7 @@ function encode$1 (event) {
|
|
|
3885
3870
|
for (var _d = 0, extractKeys_1 = extractKeys; _d < extractKeys_1.length; _d++) {
|
|
3886
3871
|
var e = extractKeys_1[_d];
|
|
3887
3872
|
tokens.push(e);
|
|
3888
|
-
tokens.push(data$5[e]);
|
|
3873
|
+
tokens.push([].concat.apply([], data$5[e]));
|
|
3889
3874
|
}
|
|
3890
3875
|
reset$4();
|
|
3891
3876
|
queue(tokens, false);
|
|
@@ -4386,7 +4371,7 @@ var status = false;
|
|
|
4386
4371
|
function start$6() {
|
|
4387
4372
|
status = true;
|
|
4388
4373
|
start$G();
|
|
4389
|
-
reset$
|
|
4374
|
+
reset$j();
|
|
4390
4375
|
reset$1();
|
|
4391
4376
|
reset$2();
|
|
4392
4377
|
start$7();
|
|
@@ -4395,7 +4380,7 @@ function stop$5() {
|
|
|
4395
4380
|
stop$6();
|
|
4396
4381
|
reset$2();
|
|
4397
4382
|
reset$1();
|
|
4398
|
-
reset$
|
|
4383
|
+
reset$j();
|
|
4399
4384
|
stop$C();
|
|
4400
4385
|
status = false;
|
|
4401
4386
|
}
|
|
@@ -4478,14 +4463,14 @@ function discover() {
|
|
|
4478
4463
|
case 0:
|
|
4479
4464
|
ts = time();
|
|
4480
4465
|
timer = { id: id(), cost: 3 /* Metric.LayoutCost */ };
|
|
4481
|
-
start$
|
|
4466
|
+
start$w(timer);
|
|
4482
4467
|
return [4 /*yield*/, traverse(document, timer, 0 /* Source.Discover */)];
|
|
4483
4468
|
case 1:
|
|
4484
4469
|
_a.sent();
|
|
4485
4470
|
return [4 /*yield*/, encode$4(5 /* Event.Discover */, timer, ts)];
|
|
4486
4471
|
case 2:
|
|
4487
4472
|
_a.sent();
|
|
4488
|
-
stop$
|
|
4473
|
+
stop$t(timer);
|
|
4489
4474
|
return [2 /*return*/];
|
|
4490
4475
|
}
|
|
4491
4476
|
});
|
|
@@ -4495,16 +4480,16 @@ function discover() {
|
|
|
4495
4480
|
function start$3() {
|
|
4496
4481
|
// The order below is important
|
|
4497
4482
|
// and is determined by interdependencies of modules
|
|
4498
|
-
start$
|
|
4483
|
+
start$v();
|
|
4484
|
+
start$u();
|
|
4485
|
+
start$x();
|
|
4499
4486
|
start$h();
|
|
4500
|
-
start$i();
|
|
4501
|
-
start$j();
|
|
4502
4487
|
start$4();
|
|
4503
4488
|
}
|
|
4504
4489
|
function stop$3() {
|
|
4490
|
+
stop$s();
|
|
4491
|
+
stop$u();
|
|
4505
4492
|
stop$f();
|
|
4506
|
-
stop$g();
|
|
4507
|
-
stop$h();
|
|
4508
4493
|
end();
|
|
4509
4494
|
}
|
|
4510
4495
|
|