@appsurify-testmap/rrweb-snapshot 3.10.0-alpha.1 → 3.12.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/rrweb-snapshot.cjs +320 -213
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +320 -213
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +335 -213
- package/dist/rrweb-snapshot.umd.cjs.map +3 -3
- package/dist/rrweb-snapshot.umd.min.cjs +18 -18
- package/dist/rrweb-snapshot.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-snapshot.cjs
CHANGED
|
@@ -172,16 +172,30 @@ function describeNode(el) {
|
|
|
172
172
|
const classes = el.classList.length ? "." + Array.from(el.classList).join(".") : "";
|
|
173
173
|
return `${tag}${id}${classes}`;
|
|
174
174
|
}
|
|
175
|
+
function isAncestorOpacityVisible(el, win) {
|
|
176
|
+
var _a;
|
|
177
|
+
let node2 = el.parentElement;
|
|
178
|
+
while (node2) {
|
|
179
|
+
const s = (_a = win.getComputedStyle) == null ? void 0 : _a.call(win, node2);
|
|
180
|
+
if (s && (parseFloat(s.opacity) || 0) <= 0) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
node2 = node2.parentElement;
|
|
184
|
+
}
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
175
187
|
function getElementVisibility(el) {
|
|
176
188
|
var _a, _b;
|
|
177
189
|
const win = ((_a = el.ownerDocument) == null ? void 0 : _a.defaultView) ?? window;
|
|
178
190
|
const rect = el.getBoundingClientRect();
|
|
179
191
|
const viewportWidth = win.innerWidth || win.document.documentElement.clientWidth || 0;
|
|
180
192
|
const viewportHeight = win.innerHeight || win.document.documentElement.clientHeight || 0;
|
|
181
|
-
const
|
|
193
|
+
const elHasSize = rect.width > 0 && rect.height > 0;
|
|
194
|
+
const isViewportVisible = elHasSize && rect.bottom > 0 && rect.right > 0 && rect.top < viewportHeight && rect.left < viewportWidth;
|
|
182
195
|
const style = (_b = win.getComputedStyle) == null ? void 0 : _b.call(win, el);
|
|
183
|
-
const
|
|
184
|
-
const
|
|
196
|
+
const isOwnStyleVisible = !!style && style.display !== "none" && style.visibility !== "hidden" && (parseFloat(style.opacity) || 0) > 0;
|
|
197
|
+
const isCSSVisible = isOwnStyleVisible && isAncestorOpacityVisible(el, win);
|
|
198
|
+
const isVisible = isCSSVisible && isViewportVisible;
|
|
185
199
|
let ratio = 0;
|
|
186
200
|
if (isVisible) {
|
|
187
201
|
const xOverlap = Math.max(
|
|
@@ -198,6 +212,9 @@ function getElementVisibility(el) {
|
|
|
198
212
|
}
|
|
199
213
|
return {
|
|
200
214
|
isVisible,
|
|
215
|
+
isCSSVisible,
|
|
216
|
+
isViewportVisible,
|
|
217
|
+
hasSize: elHasSize,
|
|
201
218
|
ratio
|
|
202
219
|
};
|
|
203
220
|
}
|
|
@@ -649,19 +666,18 @@ function isTextVisible(n) {
|
|
|
649
666
|
var _a;
|
|
650
667
|
const parent = index.parentNode(n);
|
|
651
668
|
const parentElement2 = parent && parent;
|
|
652
|
-
if (!parentElement2) {
|
|
669
|
+
if (!parentElement2 || parentElement2.nodeType !== Node.ELEMENT_NODE) {
|
|
653
670
|
return false;
|
|
654
671
|
}
|
|
655
|
-
const
|
|
656
|
-
if (!
|
|
672
|
+
const parentVis = isElementVisible(parentElement2);
|
|
673
|
+
if (!parentVis.isVisible) {
|
|
657
674
|
return false;
|
|
658
675
|
}
|
|
659
676
|
const textContent2 = (_a = n.textContent) == null ? void 0 : _a.trim();
|
|
660
677
|
return textContent2 !== "";
|
|
661
678
|
}
|
|
662
679
|
function isElementVisible(el) {
|
|
663
|
-
|
|
664
|
-
return visibility.isVisible;
|
|
680
|
+
return index.getElementVisibility(el);
|
|
665
681
|
}
|
|
666
682
|
const interactiveEvents = [
|
|
667
683
|
"change",
|
|
@@ -777,7 +793,7 @@ try {
|
|
|
777
793
|
}
|
|
778
794
|
} catch (error) {
|
|
779
795
|
}
|
|
780
|
-
const
|
|
796
|
+
const z = {
|
|
781
797
|
ANCHOR: 0.4,
|
|
782
798
|
PATH: 0.3,
|
|
783
799
|
TARGET: 0.2,
|
|
@@ -791,9 +807,9 @@ const U = {
|
|
|
791
807
|
DEPTH_PENALTY_THRESHOLD: 5,
|
|
792
808
|
DEPTH_PENALTY_FACTOR: 0.05,
|
|
793
809
|
DEGRADED_SCORE: 0.3
|
|
794
|
-
},
|
|
810
|
+
}, bt = {
|
|
795
811
|
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
796
|
-
},
|
|
812
|
+
}, tt = [
|
|
797
813
|
"form",
|
|
798
814
|
"main",
|
|
799
815
|
"nav",
|
|
@@ -801,7 +817,7 @@ const U = {
|
|
|
801
817
|
"article",
|
|
802
818
|
"footer",
|
|
803
819
|
"header"
|
|
804
|
-
],
|
|
820
|
+
], et = [
|
|
805
821
|
"form",
|
|
806
822
|
"navigation",
|
|
807
823
|
"main",
|
|
@@ -810,7 +826,7 @@ const U = {
|
|
|
810
826
|
"complementary",
|
|
811
827
|
"banner",
|
|
812
828
|
"search"
|
|
813
|
-
],
|
|
829
|
+
], St = [
|
|
814
830
|
// HTML5 Semantic
|
|
815
831
|
"article",
|
|
816
832
|
"aside",
|
|
@@ -914,7 +930,7 @@ const U = {
|
|
|
914
930
|
"data-*": 30,
|
|
915
931
|
// Any aria-* attribute (if not above)
|
|
916
932
|
"aria-*": 25
|
|
917
|
-
},
|
|
933
|
+
}, Y = /* @__PURE__ */ new Set([
|
|
918
934
|
"id",
|
|
919
935
|
// handled separately
|
|
920
936
|
"class",
|
|
@@ -926,7 +942,7 @@ const U = {
|
|
|
926
942
|
"tabindex",
|
|
927
943
|
// can change
|
|
928
944
|
"contenteditable"
|
|
929
|
-
]),
|
|
945
|
+
]), At = {
|
|
930
946
|
maxPathDepth: 10,
|
|
931
947
|
enableSvgFingerprint: true,
|
|
932
948
|
confidenceThreshold: 0,
|
|
@@ -934,7 +950,7 @@ const U = {
|
|
|
934
950
|
includeUtilityClasses: false,
|
|
935
951
|
source: "dom-dsl"
|
|
936
952
|
};
|
|
937
|
-
function
|
|
953
|
+
function L(r) {
|
|
938
954
|
if (/^[a-z]+-\d+$/i.test(r) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(r) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(r) || /^\d+$/.test(r) || /^:[a-z0-9]+:$/i.test(r) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(r))
|
|
939
955
|
return true;
|
|
940
956
|
if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r)) {
|
|
@@ -944,7 +960,7 @@ function P(r) {
|
|
|
944
960
|
}
|
|
945
961
|
return !!(/^radix-/.test(r) || /^mui-\d+$/.test(r));
|
|
946
962
|
}
|
|
947
|
-
const
|
|
963
|
+
const Z = /* @__PURE__ */ new Set([
|
|
948
964
|
"aria-labelledby",
|
|
949
965
|
"aria-describedby",
|
|
950
966
|
"aria-controls",
|
|
@@ -958,10 +974,10 @@ const Q = /* @__PURE__ */ new Set([
|
|
|
958
974
|
"aria-errormessage",
|
|
959
975
|
"aria-flowto"
|
|
960
976
|
]);
|
|
961
|
-
function
|
|
962
|
-
return r.trim().split(/\s+/).some((e) =>
|
|
977
|
+
function K(r) {
|
|
978
|
+
return r.trim().split(/\s+/).some((e) => L(e));
|
|
963
979
|
}
|
|
964
|
-
class
|
|
980
|
+
class Ct {
|
|
965
981
|
constructor(t, e) {
|
|
966
982
|
this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
|
|
967
983
|
}
|
|
@@ -994,25 +1010,25 @@ class St {
|
|
|
994
1010
|
if (e === "head" || this.isInsideHead(t)) {
|
|
995
1011
|
const c = s == null ? void 0 : s.documentElement;
|
|
996
1012
|
if (c) {
|
|
997
|
-
const
|
|
1013
|
+
const l = {
|
|
998
1014
|
element: c,
|
|
999
1015
|
score: 1,
|
|
1000
1016
|
tier: "A",
|
|
1001
1017
|
depth: 0
|
|
1002
1018
|
};
|
|
1003
|
-
return this.cacheResult(t,
|
|
1019
|
+
return this.cacheResult(t, l), l;
|
|
1004
1020
|
}
|
|
1005
1021
|
}
|
|
1006
1022
|
if (e === "body") {
|
|
1007
1023
|
const c = s == null ? void 0 : s.documentElement;
|
|
1008
1024
|
if (c) {
|
|
1009
|
-
const
|
|
1025
|
+
const l = {
|
|
1010
1026
|
element: c,
|
|
1011
1027
|
score: 1,
|
|
1012
1028
|
tier: "A",
|
|
1013
1029
|
depth: 0
|
|
1014
1030
|
};
|
|
1015
|
-
return this.cacheResult(t,
|
|
1031
|
+
return this.cacheResult(t, l), l;
|
|
1016
1032
|
}
|
|
1017
1033
|
}
|
|
1018
1034
|
let n = t.parentElement, a = 0, i = null;
|
|
@@ -1026,10 +1042,10 @@ class St {
|
|
|
1026
1042
|
};
|
|
1027
1043
|
const c = this.scoreAnchor(n);
|
|
1028
1044
|
if (c > 0) {
|
|
1029
|
-
const
|
|
1030
|
-
if (
|
|
1031
|
-
return
|
|
1032
|
-
(!i ||
|
|
1045
|
+
const l = this.applyDepthPenalty(c, a), f = this.getTier(n), h = { element: n, score: l, tier: f, depth: a };
|
|
1046
|
+
if (f === "A")
|
|
1047
|
+
return h;
|
|
1048
|
+
(!i || l > i.score) && (i = h);
|
|
1033
1049
|
}
|
|
1034
1050
|
n = n.parentElement, a++;
|
|
1035
1051
|
}
|
|
@@ -1044,11 +1060,11 @@ class St {
|
|
|
1044
1060
|
scoreAnchor(t) {
|
|
1045
1061
|
let e = 0;
|
|
1046
1062
|
const s = t.tagName.toLowerCase();
|
|
1047
|
-
|
|
1063
|
+
tt.includes(s) && (e += I.SEMANTIC_TAG);
|
|
1048
1064
|
const n = t.getAttribute("role");
|
|
1049
|
-
n &&
|
|
1065
|
+
n && et.includes(n) && (e += I.ROLE), (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) && (e += I.ARIA_LABEL);
|
|
1050
1066
|
const a = t.id;
|
|
1051
|
-
return a && !
|
|
1067
|
+
return a && !L(a) && (e += I.STABLE_ID), (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test")) && (e += I.TEST_MARKER), Math.min(e, 1);
|
|
1052
1068
|
}
|
|
1053
1069
|
/**
|
|
1054
1070
|
* Applies depth penalty to score
|
|
@@ -1065,10 +1081,10 @@ class St {
|
|
|
1065
1081
|
*/
|
|
1066
1082
|
getTier(t) {
|
|
1067
1083
|
const e = t.tagName.toLowerCase();
|
|
1068
|
-
if (
|
|
1084
|
+
if (tt.includes(e))
|
|
1069
1085
|
return "A";
|
|
1070
1086
|
const s = t.getAttribute("role");
|
|
1071
|
-
return s &&
|
|
1087
|
+
return s && et.includes(s) ? "B" : "C";
|
|
1072
1088
|
}
|
|
1073
1089
|
/**
|
|
1074
1090
|
* Checks if element is inside <head> section.
|
|
@@ -1101,7 +1117,7 @@ class St {
|
|
|
1101
1117
|
this.cache && this.cache.setAnchor(t, e);
|
|
1102
1118
|
}
|
|
1103
1119
|
}
|
|
1104
|
-
const
|
|
1120
|
+
const Tt = [
|
|
1105
1121
|
// CSS-in-JS
|
|
1106
1122
|
/^css-[a-z0-9]+$/i,
|
|
1107
1123
|
/^sc-[a-z0-9]+-\d+$/i,
|
|
@@ -1121,7 +1137,7 @@ const At = [
|
|
|
1121
1137
|
/^_[a-z0-9]{5,}$/i,
|
|
1122
1138
|
/\d{5,}/
|
|
1123
1139
|
// 5+ digits in a row
|
|
1124
|
-
],
|
|
1140
|
+
], Et = [
|
|
1125
1141
|
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1126
1142
|
/^\[/,
|
|
1127
1143
|
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
@@ -1233,29 +1249,81 @@ const At = [
|
|
|
1233
1249
|
/^pull-(left|right)$/,
|
|
1234
1250
|
/^float-(left|right|none)$/
|
|
1235
1251
|
];
|
|
1236
|
-
function
|
|
1237
|
-
return
|
|
1252
|
+
function q(r) {
|
|
1253
|
+
return Tt.some((t) => t.test(r));
|
|
1238
1254
|
}
|
|
1239
|
-
function
|
|
1240
|
-
return r.length <= 2 || /^\d/.test(r) ? true :
|
|
1255
|
+
function U(r) {
|
|
1256
|
+
return r.length <= 2 || /^\d/.test(r) ? true : Et.some((t) => t.test(r));
|
|
1241
1257
|
}
|
|
1242
|
-
function
|
|
1243
|
-
return !
|
|
1258
|
+
function $t(r) {
|
|
1259
|
+
return !q(r) && !U(r);
|
|
1244
1260
|
}
|
|
1245
1261
|
function M(r) {
|
|
1246
|
-
return r.filter((t) =>
|
|
1262
|
+
return r.filter((t) => $t(t));
|
|
1247
1263
|
}
|
|
1248
|
-
function
|
|
1264
|
+
function It(r) {
|
|
1249
1265
|
const t = [], e = [];
|
|
1250
1266
|
for (const s of r)
|
|
1251
|
-
|
|
1267
|
+
U(s) || q(s) ? e.push(s) : t.push(s);
|
|
1252
1268
|
return { semantic: t, utility: e };
|
|
1253
1269
|
}
|
|
1254
|
-
function
|
|
1255
|
-
return
|
|
1270
|
+
function st(r) {
|
|
1271
|
+
return U(r) || q(r);
|
|
1272
|
+
}
|
|
1273
|
+
const Rt = /* @__PURE__ */ new Set([
|
|
1274
|
+
"tr",
|
|
1275
|
+
"td",
|
|
1276
|
+
"th",
|
|
1277
|
+
"thead",
|
|
1278
|
+
"tbody",
|
|
1279
|
+
"tfoot"
|
|
1280
|
+
]), Dt = /* @__PURE__ */ new Set([
|
|
1281
|
+
"data-testid",
|
|
1282
|
+
"data-qa",
|
|
1283
|
+
"data-cy",
|
|
1284
|
+
"data-test",
|
|
1285
|
+
"aria-label",
|
|
1286
|
+
"name",
|
|
1287
|
+
"href"
|
|
1288
|
+
]);
|
|
1289
|
+
function Mt(r) {
|
|
1290
|
+
if (r.id) return true;
|
|
1291
|
+
if (r.attributes) {
|
|
1292
|
+
for (const t of Object.keys(r.attributes))
|
|
1293
|
+
if (Dt.has(t)) return true;
|
|
1294
|
+
}
|
|
1295
|
+
return false;
|
|
1296
|
+
}
|
|
1297
|
+
function Lt(r, t, e) {
|
|
1298
|
+
var _a;
|
|
1299
|
+
const s = r.parentElement;
|
|
1300
|
+
if (!s) return true;
|
|
1301
|
+
for (const n of Array.from(s.children)) {
|
|
1302
|
+
if (n === r || n.tagName.toLowerCase() !== t) continue;
|
|
1303
|
+
if ((((_a = n.textContent) == null ? void 0 : _a.trim()) ?? "") === e) return false;
|
|
1304
|
+
}
|
|
1305
|
+
return true;
|
|
1306
|
+
}
|
|
1307
|
+
function _(r, t, e) {
|
|
1308
|
+
var _a;
|
|
1309
|
+
if (Rt.has(r)) return true;
|
|
1310
|
+
if (Mt(t)) return false;
|
|
1311
|
+
if (e) {
|
|
1312
|
+
const s = e.parentElement;
|
|
1313
|
+
if (s) {
|
|
1314
|
+
const n = (_a = t.text) == null ? void 0 : _a.normalized;
|
|
1315
|
+
if (n && Lt(e, r, n))
|
|
1316
|
+
return false;
|
|
1317
|
+
if (Array.from(s.children).some(
|
|
1318
|
+
(i) => i !== e && i.tagName.toLowerCase() === r
|
|
1319
|
+
)) return true;
|
|
1320
|
+
}
|
|
1321
|
+
return false;
|
|
1322
|
+
}
|
|
1323
|
+
return true;
|
|
1256
1324
|
}
|
|
1257
|
-
const
|
|
1258
|
-
class
|
|
1325
|
+
const rt = (r) => r.replace(/([#:.[\]@])/g, "\\$1");
|
|
1326
|
+
class Pt {
|
|
1259
1327
|
constructor(t, e) {
|
|
1260
1328
|
this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
|
|
1261
1329
|
}
|
|
@@ -1290,19 +1358,22 @@ class $t {
|
|
|
1290
1358
|
degraded: true,
|
|
1291
1359
|
degradationReason: "target-not-descendant-of-anchor"
|
|
1292
1360
|
};
|
|
1293
|
-
let
|
|
1294
|
-
return
|
|
1295
|
-
path:
|
|
1296
|
-
const h =
|
|
1361
|
+
let l = this.filterNoise(i);
|
|
1362
|
+
return l = this.ensureUniqueness(i, l, t, e, s), {
|
|
1363
|
+
path: l.map((h) => {
|
|
1364
|
+
const d = h.tagName.toLowerCase(), u = s.extract(h);
|
|
1297
1365
|
let g;
|
|
1298
|
-
if (h) {
|
|
1299
|
-
const m =
|
|
1300
|
-
|
|
1366
|
+
if (_(d, u, h)) {
|
|
1367
|
+
const m = h.parentElement;
|
|
1368
|
+
if (m) {
|
|
1369
|
+
const b = Array.from(m.children).indexOf(h);
|
|
1370
|
+
b !== -1 && (g = b + 1);
|
|
1371
|
+
}
|
|
1301
1372
|
}
|
|
1302
1373
|
return {
|
|
1303
|
-
tag:
|
|
1304
|
-
semantics:
|
|
1305
|
-
score: s.scoreElement(
|
|
1374
|
+
tag: d,
|
|
1375
|
+
semantics: u,
|
|
1376
|
+
score: s.scoreElement(h),
|
|
1306
1377
|
nthChild: g
|
|
1307
1378
|
};
|
|
1308
1379
|
}),
|
|
@@ -1327,27 +1398,27 @@ class $t {
|
|
|
1327
1398
|
if (!o) return e;
|
|
1328
1399
|
let c;
|
|
1329
1400
|
if (this.cache) {
|
|
1330
|
-
const
|
|
1331
|
-
|
|
1401
|
+
const f = this.cache.getSelectorResults(i);
|
|
1402
|
+
f !== void 0 ? c = f : (c = Array.from(o.querySelectorAll(i)), this.cache.setSelectorResults(i, c));
|
|
1332
1403
|
} else
|
|
1333
1404
|
c = o.querySelectorAll(i);
|
|
1334
1405
|
if (c.length <= 1)
|
|
1335
1406
|
return e;
|
|
1336
|
-
const
|
|
1337
|
-
for (const
|
|
1338
|
-
if (a.scoreElement(
|
|
1407
|
+
const l = t.filter((f) => !e.includes(f));
|
|
1408
|
+
for (const f of l) {
|
|
1409
|
+
if (a.scoreElement(f) < bt.MIN_CONFIDENCE_FOR_SKIP)
|
|
1339
1410
|
continue;
|
|
1340
|
-
const
|
|
1411
|
+
const d = this.insertNodeInOrder(e, f, t), u = this.buildTestSelector(s, d, n);
|
|
1341
1412
|
try {
|
|
1342
|
-
let
|
|
1413
|
+
let g;
|
|
1343
1414
|
if (this.cache) {
|
|
1344
|
-
const m = this.cache.getSelectorResults(
|
|
1345
|
-
m !== void 0 ?
|
|
1415
|
+
const m = this.cache.getSelectorResults(u);
|
|
1416
|
+
m !== void 0 ? g = m : (g = Array.from(o.querySelectorAll(u)), this.cache.setSelectorResults(u, g));
|
|
1346
1417
|
} else
|
|
1347
|
-
|
|
1348
|
-
if (
|
|
1349
|
-
return
|
|
1350
|
-
|
|
1418
|
+
g = o.querySelectorAll(u);
|
|
1419
|
+
if (g.length === 1)
|
|
1420
|
+
return d;
|
|
1421
|
+
g.length < c.length && (e = d);
|
|
1351
1422
|
} catch {
|
|
1352
1423
|
}
|
|
1353
1424
|
}
|
|
@@ -1381,9 +1452,9 @@ class $t {
|
|
|
1381
1452
|
*/
|
|
1382
1453
|
elementToSelector(t) {
|
|
1383
1454
|
let e = t.tagName.toLowerCase();
|
|
1384
|
-
t.id && !
|
|
1455
|
+
t.id && !L(t.id) && (e += `#${rt(t.id)}`);
|
|
1385
1456
|
for (const s of Array.from(t.classList))
|
|
1386
|
-
|
|
1457
|
+
st(s) || (e += `.${rt(s)}`);
|
|
1387
1458
|
return e;
|
|
1388
1459
|
}
|
|
1389
1460
|
/**
|
|
@@ -1397,7 +1468,7 @@ class $t {
|
|
|
1397
1468
|
*/
|
|
1398
1469
|
shouldInclude(t) {
|
|
1399
1470
|
const e = t.tagName.toLowerCase();
|
|
1400
|
-
return
|
|
1471
|
+
return St.includes(e) ? true : e === "div" || e === "span" ? this.hasSemanticFeatures(t) : false;
|
|
1401
1472
|
}
|
|
1402
1473
|
/**
|
|
1403
1474
|
* Checks if element has meaningful semantic features
|
|
@@ -1408,12 +1479,12 @@ class $t {
|
|
|
1408
1479
|
if (s.name.startsWith("aria-")) return true;
|
|
1409
1480
|
if (t.classList.length > 0) {
|
|
1410
1481
|
for (const s of Array.from(t.classList))
|
|
1411
|
-
if (!
|
|
1482
|
+
if (!st(s)) return true;
|
|
1412
1483
|
}
|
|
1413
1484
|
if (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test"))
|
|
1414
1485
|
return true;
|
|
1415
1486
|
const e = t.id;
|
|
1416
|
-
return !!(e && !
|
|
1487
|
+
return !!(e && !L(e));
|
|
1417
1488
|
}
|
|
1418
1489
|
/**
|
|
1419
1490
|
* Checks if element is inside <head> section.
|
|
@@ -1460,31 +1531,34 @@ class $t {
|
|
|
1460
1531
|
degradationReason: "head-not-found-in-path"
|
|
1461
1532
|
} : {
|
|
1462
1533
|
path: n.map((c) => {
|
|
1463
|
-
const
|
|
1464
|
-
let
|
|
1465
|
-
if (
|
|
1466
|
-
const
|
|
1467
|
-
|
|
1534
|
+
const l = c.tagName.toLowerCase(), f = s.extract(c);
|
|
1535
|
+
let h;
|
|
1536
|
+
if (_(l, f, c)) {
|
|
1537
|
+
const d = c.parentElement;
|
|
1538
|
+
if (d) {
|
|
1539
|
+
const g = Array.from(d.children).indexOf(c);
|
|
1540
|
+
g !== -1 && (h = g + 1);
|
|
1541
|
+
}
|
|
1468
1542
|
}
|
|
1469
1543
|
return {
|
|
1470
|
-
tag:
|
|
1471
|
-
semantics:
|
|
1544
|
+
tag: l,
|
|
1545
|
+
semantics: f,
|
|
1472
1546
|
score: s.scoreElement(c),
|
|
1473
|
-
nthChild:
|
|
1547
|
+
nthChild: h
|
|
1474
1548
|
};
|
|
1475
1549
|
}),
|
|
1476
1550
|
degraded: false
|
|
1477
1551
|
};
|
|
1478
1552
|
}
|
|
1479
1553
|
}
|
|
1480
|
-
function
|
|
1554
|
+
function j(r) {
|
|
1481
1555
|
return r ? r.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1482
1556
|
}
|
|
1483
|
-
const
|
|
1557
|
+
const Ht = {
|
|
1484
1558
|
preserveQueryForAbsolute: true,
|
|
1485
1559
|
removeDynamicHashes: true
|
|
1486
1560
|
};
|
|
1487
|
-
function
|
|
1561
|
+
function kt(r) {
|
|
1488
1562
|
return r ? [
|
|
1489
1563
|
/\d{5,}/,
|
|
1490
1564
|
// 5+ digits
|
|
@@ -1498,18 +1572,18 @@ function It(r) {
|
|
|
1498
1572
|
// UUID-like
|
|
1499
1573
|
].some((e) => e.test(r)) : false;
|
|
1500
1574
|
}
|
|
1501
|
-
function
|
|
1575
|
+
function _t(r, t) {
|
|
1502
1576
|
if (!r) return r;
|
|
1503
1577
|
const e = r.startsWith("http://") || r.startsWith("https://"), [s, n] = r.split("#"), [a, i] = s.split("?");
|
|
1504
1578
|
let o = a;
|
|
1505
|
-
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes &&
|
|
1579
|
+
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes && kt(n) || (o += `#${n}`)), o;
|
|
1506
1580
|
}
|
|
1507
1581
|
function D(r, t, e = {}) {
|
|
1508
1582
|
if (!t) return t;
|
|
1509
|
-
const s = { ...
|
|
1510
|
-
return r === "href" || r === "src" ?
|
|
1583
|
+
const s = { ...Ht, ...e };
|
|
1584
|
+
return r === "href" || r === "src" ? _t(t, s) : t;
|
|
1511
1585
|
}
|
|
1512
|
-
const
|
|
1586
|
+
const Ot = [
|
|
1513
1587
|
"role",
|
|
1514
1588
|
"aria-label",
|
|
1515
1589
|
"aria-labelledby",
|
|
@@ -1520,7 +1594,7 @@ const Dt = [
|
|
|
1520
1594
|
"aria-posinset",
|
|
1521
1595
|
"aria-setsize",
|
|
1522
1596
|
"aria-haspopup"
|
|
1523
|
-
],
|
|
1597
|
+
], qt = [
|
|
1524
1598
|
"aria-selected",
|
|
1525
1599
|
"aria-checked",
|
|
1526
1600
|
"aria-pressed",
|
|
@@ -1533,7 +1607,7 @@ const Dt = [
|
|
|
1533
1607
|
"aria-grabbed",
|
|
1534
1608
|
"aria-live",
|
|
1535
1609
|
"aria-atomic"
|
|
1536
|
-
],
|
|
1610
|
+
], Ut = [
|
|
1537
1611
|
"data-state",
|
|
1538
1612
|
"data-active",
|
|
1539
1613
|
"data-inactive",
|
|
@@ -1552,7 +1626,7 @@ const Dt = [
|
|
|
1552
1626
|
"data-hover",
|
|
1553
1627
|
"data-orientation",
|
|
1554
1628
|
"data-theme"
|
|
1555
|
-
],
|
|
1629
|
+
], zt = [
|
|
1556
1630
|
"data-radix-",
|
|
1557
1631
|
"data-headlessui-",
|
|
1558
1632
|
"data-reach-",
|
|
@@ -1560,7 +1634,7 @@ const Dt = [
|
|
|
1560
1634
|
"data-chakra-",
|
|
1561
1635
|
"data-mantine-",
|
|
1562
1636
|
"data-tw-"
|
|
1563
|
-
],
|
|
1637
|
+
], Ft = [
|
|
1564
1638
|
"data-testid",
|
|
1565
1639
|
"data-test-id",
|
|
1566
1640
|
"data-test",
|
|
@@ -1572,7 +1646,7 @@ const Dt = [
|
|
|
1572
1646
|
"data-entity-id",
|
|
1573
1647
|
"data-product-id",
|
|
1574
1648
|
"data-user-id"
|
|
1575
|
-
],
|
|
1649
|
+
], jt = [
|
|
1576
1650
|
// Google Analytics / GTM
|
|
1577
1651
|
"data-ga",
|
|
1578
1652
|
"data-gtm",
|
|
@@ -1608,7 +1682,7 @@ const Dt = [
|
|
|
1608
1682
|
"data-conversion",
|
|
1609
1683
|
"data-segment",
|
|
1610
1684
|
"data-analytics"
|
|
1611
|
-
],
|
|
1685
|
+
], Wt = [
|
|
1612
1686
|
"data-category",
|
|
1613
1687
|
// Google Analytics category
|
|
1614
1688
|
"data-action",
|
|
@@ -1617,7 +1691,7 @@ const Dt = [
|
|
|
1617
1691
|
// Google Analytics label
|
|
1618
1692
|
"data-value"
|
|
1619
1693
|
// Google Analytics value
|
|
1620
|
-
],
|
|
1694
|
+
], Bt = [
|
|
1621
1695
|
"id",
|
|
1622
1696
|
"name",
|
|
1623
1697
|
"type",
|
|
@@ -1626,7 +1700,7 @@ const Dt = [
|
|
|
1626
1700
|
"for",
|
|
1627
1701
|
"alt",
|
|
1628
1702
|
"href"
|
|
1629
|
-
],
|
|
1703
|
+
], Gt = [
|
|
1630
1704
|
"disabled",
|
|
1631
1705
|
"checked",
|
|
1632
1706
|
"selected",
|
|
@@ -1634,17 +1708,17 @@ const Dt = [
|
|
|
1634
1708
|
"readonly",
|
|
1635
1709
|
"required",
|
|
1636
1710
|
"value"
|
|
1637
|
-
],
|
|
1711
|
+
], Vt = [
|
|
1638
1712
|
/^radix-/,
|
|
1639
1713
|
/^headlessui-/,
|
|
1640
1714
|
/^mui-/,
|
|
1641
1715
|
/:\w+:/
|
|
1642
1716
|
// matches :ru:, :r1:, etc.
|
|
1643
1717
|
];
|
|
1644
|
-
function
|
|
1645
|
-
return
|
|
1718
|
+
function Qt(r, t) {
|
|
1719
|
+
return Ot.includes(r) ? true : qt.includes(r) || Ut.includes(r) || zt.some((e) => r.startsWith(e)) ? false : Ft.includes(r) ? true : jt.some((e) => r.startsWith(e)) || Wt.includes(r) ? false : r.startsWith("data-") && r.endsWith("-id") ? true : r === "id" ? !Vt.some((e) => e.test(t)) : Bt.includes(r) ? true : Gt.includes(r) ? false : !!r.startsWith("data-");
|
|
1646
1720
|
}
|
|
1647
|
-
class
|
|
1721
|
+
class nt {
|
|
1648
1722
|
constructor(t, e) {
|
|
1649
1723
|
this.includeUtilityClasses = t.includeUtilityClasses ?? false, this.cache = e;
|
|
1650
1724
|
}
|
|
@@ -1660,12 +1734,12 @@ class st {
|
|
|
1660
1734
|
return i;
|
|
1661
1735
|
}
|
|
1662
1736
|
const e = {}, s = t.id;
|
|
1663
|
-
if (s && !
|
|
1737
|
+
if (s && !L(s) && (e.id = s), t.classList.length > 0) {
|
|
1664
1738
|
const i = Array.from(t.classList);
|
|
1665
1739
|
if (this.includeUtilityClasses)
|
|
1666
1740
|
e.classes = i;
|
|
1667
1741
|
else {
|
|
1668
|
-
const { semantic: o } =
|
|
1742
|
+
const { semantic: o } = It(i);
|
|
1669
1743
|
o.length > 0 && (e.classes = o);
|
|
1670
1744
|
}
|
|
1671
1745
|
}
|
|
@@ -1694,7 +1768,7 @@ class st {
|
|
|
1694
1768
|
* @returns True if should be ignored
|
|
1695
1769
|
*/
|
|
1696
1770
|
shouldIgnoreAttribute(t) {
|
|
1697
|
-
return !!(
|
|
1771
|
+
return !!(Y.has(t) || t.startsWith("on") || t.startsWith("ng-") || t.startsWith("_ng") || t.startsWith("data-reactid") || t.startsWith("data-react") || t.startsWith("data-v-"));
|
|
1698
1772
|
}
|
|
1699
1773
|
/**
|
|
1700
1774
|
* Gets attribute priority
|
|
@@ -1729,7 +1803,7 @@ class st {
|
|
|
1729
1803
|
const e = {};
|
|
1730
1804
|
for (const s of Array.from(t.attributes)) {
|
|
1731
1805
|
const n = s.name;
|
|
1732
|
-
if (this.shouldIgnoreAttribute(n) || !
|
|
1806
|
+
if (this.shouldIgnoreAttribute(n) || !Qt(n, s.value) || Z.has(n) && K(s.value) || this.getAttributePriority(n) === 0) continue;
|
|
1733
1807
|
const i = n === "href" || n === "src" ? D(n, s.value) : s.value;
|
|
1734
1808
|
!i || i.trim() === "" || this.isDynamicValue(i) || (e[n] = i);
|
|
1735
1809
|
}
|
|
@@ -1741,7 +1815,7 @@ class st {
|
|
|
1741
1815
|
extractText(t) {
|
|
1742
1816
|
const e = this.getDirectTextContent(t);
|
|
1743
1817
|
if (!e) return null;
|
|
1744
|
-
const s =
|
|
1818
|
+
const s = j(e);
|
|
1745
1819
|
if (!s) return null;
|
|
1746
1820
|
const n = 100, a = e.length > n ? e.slice(0, n) + "..." : e, i = s.length > n ? s.slice(0, n) + "..." : s;
|
|
1747
1821
|
return {
|
|
@@ -1789,7 +1863,7 @@ class st {
|
|
|
1789
1863
|
].includes(e);
|
|
1790
1864
|
}
|
|
1791
1865
|
}
|
|
1792
|
-
class
|
|
1866
|
+
class Yt {
|
|
1793
1867
|
/**
|
|
1794
1868
|
* Generates fingerprint for SVG element
|
|
1795
1869
|
* @param element - SVG element to fingerprint
|
|
@@ -1900,11 +1974,11 @@ class Ft {
|
|
|
1900
1974
|
return Math.abs(e).toString(16).padStart(8, "0");
|
|
1901
1975
|
}
|
|
1902
1976
|
}
|
|
1903
|
-
function
|
|
1904
|
-
const e = r.anchor.score, s = r.path.length > 0 ? r.path.reduce((o, c) => o + c.score, 0) / r.path.length : 0.5, n = r.target.score, a = e *
|
|
1977
|
+
function Zt(r, t = 0) {
|
|
1978
|
+
const e = r.anchor.score, s = r.path.length > 0 ? r.path.reduce((o, c) => o + c.score, 0) / r.path.length : 0.5, n = r.target.score, a = e * z.ANCHOR + s * z.PATH + n * z.TARGET + t * z.UNIQUENESS, i = r.anchor.degraded ? 0.2 : 0;
|
|
1905
1979
|
return Math.max(0, Math.min(1, a - i));
|
|
1906
1980
|
}
|
|
1907
|
-
class
|
|
1981
|
+
class Kt {
|
|
1908
1982
|
constructor(t) {
|
|
1909
1983
|
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t;
|
|
1910
1984
|
}
|
|
@@ -1935,9 +2009,9 @@ class Wt {
|
|
|
1935
2009
|
return this.cache.size;
|
|
1936
2010
|
}
|
|
1937
2011
|
}
|
|
1938
|
-
class
|
|
2012
|
+
class Xt {
|
|
1939
2013
|
constructor(t = {}) {
|
|
1940
|
-
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new
|
|
2014
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new Kt(
|
|
1941
2015
|
t.maxSelectorCacheSize ?? 1e3
|
|
1942
2016
|
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
1943
2017
|
eidHits: 0,
|
|
@@ -2086,12 +2160,12 @@ class Bt {
|
|
|
2086
2160
|
return s > 0 ? t / s : 0;
|
|
2087
2161
|
}
|
|
2088
2162
|
}
|
|
2089
|
-
function
|
|
2090
|
-
return new
|
|
2163
|
+
function Jt(r) {
|
|
2164
|
+
return new Xt(r);
|
|
2091
2165
|
}
|
|
2092
|
-
let
|
|
2093
|
-
function
|
|
2094
|
-
return
|
|
2166
|
+
let F = null;
|
|
2167
|
+
function X() {
|
|
2168
|
+
return F || (F = Jt()), F;
|
|
2095
2169
|
}
|
|
2096
2170
|
function k(r) {
|
|
2097
2171
|
if (r.ownerDocument)
|
|
@@ -2109,7 +2183,7 @@ function k(r) {
|
|
|
2109
2183
|
3. You are working with a document node instead of an element`
|
|
2110
2184
|
);
|
|
2111
2185
|
}
|
|
2112
|
-
function
|
|
2186
|
+
function te(r, t) {
|
|
2113
2187
|
if (!t)
|
|
2114
2188
|
return;
|
|
2115
2189
|
const e = k(r), s = t instanceof Document ? t : k(t);
|
|
@@ -2124,64 +2198,65 @@ Common causes:
|
|
|
2124
2198
|
Solution: Ensure element and root parameter are from the same document context.`
|
|
2125
2199
|
);
|
|
2126
2200
|
}
|
|
2127
|
-
function
|
|
2201
|
+
function J(r, t = {}) {
|
|
2128
2202
|
var _a;
|
|
2129
2203
|
if (!r || !r.ownerDocument || !r.isConnected)
|
|
2130
2204
|
return null;
|
|
2131
|
-
const e = { ...
|
|
2205
|
+
const e = { ...At, ...t };
|
|
2132
2206
|
if (e.root)
|
|
2133
2207
|
try {
|
|
2134
|
-
|
|
2208
|
+
te(r, e.root);
|
|
2135
2209
|
} catch (x2) {
|
|
2136
2210
|
return console.error("Cross-document generation detected:", x2), null;
|
|
2137
2211
|
}
|
|
2138
|
-
const s = e.cache ??
|
|
2212
|
+
const s = e.cache ?? X(), n = s.getEID(r);
|
|
2139
2213
|
if (n !== void 0)
|
|
2140
2214
|
return n;
|
|
2141
|
-
|
|
2142
|
-
|
|
2215
|
+
const a = r.tagName.toLowerCase();
|
|
2216
|
+
if (a === "html") {
|
|
2217
|
+
const x2 = new nt(e, s), y = re(r, e, x2);
|
|
2143
2218
|
return s.setEID(r, y), y;
|
|
2144
2219
|
}
|
|
2145
|
-
const i = new
|
|
2146
|
-
if (!
|
|
2220
|
+
const i = new Ct(e, s), o = new Pt(e, s), c = new nt(e, s), l = new Yt(), f = i.findAnchor(r);
|
|
2221
|
+
if (!f && !e.fallbackToBody)
|
|
2147
2222
|
return null;
|
|
2148
|
-
const
|
|
2149
|
-
if (!
|
|
2150
|
-
const
|
|
2151
|
-
let
|
|
2152
|
-
if (
|
|
2153
|
-
const y = Array.from(
|
|
2154
|
-
y !== -1 && (
|
|
2155
|
-
}
|
|
2156
|
-
const
|
|
2157
|
-
tag:
|
|
2158
|
-
semantics:
|
|
2159
|
-
score: (
|
|
2160
|
-
degraded:
|
|
2161
|
-
nthChild:
|
|
2162
|
-
}, S = o.buildPath(
|
|
2163
|
-
e.enableSvgFingerprint &&
|
|
2223
|
+
const h = (f == null ? void 0 : f.element) ?? ((_a = r.ownerDocument) == null ? void 0 : _a.body) ?? null;
|
|
2224
|
+
if (!h) return null;
|
|
2225
|
+
const d = !f || f.tier === "C", u = h.tagName.toLowerCase(), g = c.extract(h), m = h.parentElement;
|
|
2226
|
+
let p;
|
|
2227
|
+
if (m && u !== "body" && u !== "html" && _(u, g, h)) {
|
|
2228
|
+
const y = Array.from(m.children).indexOf(h);
|
|
2229
|
+
y !== -1 && (p = y + 1);
|
|
2230
|
+
}
|
|
2231
|
+
const b = {
|
|
2232
|
+
tag: h.tagName.toLowerCase(),
|
|
2233
|
+
semantics: g,
|
|
2234
|
+
score: (f == null ? void 0 : f.score) ?? I.DEGRADED_SCORE,
|
|
2235
|
+
degraded: d,
|
|
2236
|
+
nthChild: p
|
|
2237
|
+
}, S = o.buildPath(h, r, c), T = c.extract(r);
|
|
2238
|
+
e.enableSvgFingerprint && ee(r) && (T.svg = l.fingerprint(r));
|
|
2164
2239
|
const C = r.parentElement;
|
|
2165
2240
|
let A;
|
|
2166
|
-
if (C) {
|
|
2241
|
+
if (C && _(a, T, r)) {
|
|
2167
2242
|
const y = Array.from(C.children).indexOf(r);
|
|
2168
2243
|
y !== -1 && (A = y + 1);
|
|
2169
2244
|
}
|
|
2170
2245
|
const v = {
|
|
2171
2246
|
tag: r.tagName.toLowerCase(),
|
|
2172
|
-
semantics:
|
|
2247
|
+
semantics: T,
|
|
2173
2248
|
score: c.scoreElement(r),
|
|
2174
2249
|
nthChild: A
|
|
2175
|
-
},
|
|
2250
|
+
}, P = [], $ = {
|
|
2176
2251
|
onMultiple: "best-score",
|
|
2177
2252
|
onMissing: "anchor-only",
|
|
2178
2253
|
maxDepth: 3
|
|
2179
|
-
},
|
|
2254
|
+
}, E = b.degraded || S.degraded, R = se(b.degraded, S), N = {
|
|
2180
2255
|
version: "1.0",
|
|
2181
2256
|
anchor: b,
|
|
2182
2257
|
path: S.path,
|
|
2183
2258
|
target: v,
|
|
2184
|
-
constraints:
|
|
2259
|
+
constraints: P,
|
|
2185
2260
|
fallback: $,
|
|
2186
2261
|
meta: {
|
|
2187
2262
|
confidence: 0,
|
|
@@ -2189,16 +2264,16 @@ function X(r, t = {}) {
|
|
|
2189
2264
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2190
2265
|
generator: "dom-eid@1.0",
|
|
2191
2266
|
source: e.source,
|
|
2192
|
-
degraded:
|
|
2267
|
+
degraded: E,
|
|
2193
2268
|
degradationReason: R
|
|
2194
2269
|
}
|
|
2195
2270
|
};
|
|
2196
|
-
return N.meta.confidence =
|
|
2271
|
+
return N.meta.confidence = Zt(N), N.meta.confidence < e.confidenceThreshold ? null : (s.setEID(r, N), N);
|
|
2197
2272
|
}
|
|
2198
|
-
function
|
|
2273
|
+
function ee(r) {
|
|
2199
2274
|
return r.namespaceURI === "http://www.w3.org/2000/svg" || r.tagName.toLowerCase() === "svg" || r instanceof SVGElement;
|
|
2200
2275
|
}
|
|
2201
|
-
function
|
|
2276
|
+
function se(r, t) {
|
|
2202
2277
|
if (r && t.degraded)
|
|
2203
2278
|
return "anchor-and-path-degraded";
|
|
2204
2279
|
if (r)
|
|
@@ -2206,7 +2281,7 @@ function Yt(r, t) {
|
|
|
2206
2281
|
if (t.degraded)
|
|
2207
2282
|
return t.degradationReason;
|
|
2208
2283
|
}
|
|
2209
|
-
function
|
|
2284
|
+
function re(r, t, e, s) {
|
|
2210
2285
|
const a = {
|
|
2211
2286
|
tag: "html",
|
|
2212
2287
|
semantics: e.extract(r),
|
|
@@ -2235,91 +2310,119 @@ function Zt(r, t, e, s) {
|
|
|
2235
2310
|
}
|
|
2236
2311
|
};
|
|
2237
2312
|
}
|
|
2238
|
-
const
|
|
2313
|
+
const ht = {
|
|
2314
|
+
id: "i",
|
|
2315
|
+
"data-testid": "tid",
|
|
2316
|
+
"data-qa": "qa",
|
|
2317
|
+
"data-cy": "cy",
|
|
2318
|
+
"data-test": "dt",
|
|
2319
|
+
"aria-label": "al",
|
|
2320
|
+
"aria-labelledby": "alb",
|
|
2321
|
+
"aria-describedby": "adb",
|
|
2322
|
+
name: "n",
|
|
2323
|
+
href: "h",
|
|
2324
|
+
src: "s",
|
|
2325
|
+
type: "t",
|
|
2326
|
+
role: "r",
|
|
2327
|
+
alt: "at",
|
|
2328
|
+
title: "tt",
|
|
2329
|
+
for: "f",
|
|
2330
|
+
placeholder: "ph",
|
|
2331
|
+
text: "x"
|
|
2332
|
+
}, G = Object.fromEntries(
|
|
2333
|
+
Object.entries(ht).map(([r, t]) => [t, r])
|
|
2334
|
+
), ut = {
|
|
2239
2335
|
maxClasses: 2,
|
|
2240
2336
|
maxAttributes: 5,
|
|
2241
2337
|
includeText: true,
|
|
2242
2338
|
maxTextLength: 50,
|
|
2243
2339
|
simplifyTarget: true,
|
|
2244
|
-
includeConstraints: true
|
|
2340
|
+
includeConstraints: true,
|
|
2341
|
+
format: "compact"
|
|
2245
2342
|
};
|
|
2246
|
-
function
|
|
2343
|
+
function ct(r) {
|
|
2247
2344
|
return r === "id" ? 101 : w[r] !== void 0 ? w[r] : r.startsWith("data-") ? w["data-*"] : r.startsWith("aria-") ? w["aria-*"] : 0;
|
|
2248
2345
|
}
|
|
2249
|
-
function
|
|
2346
|
+
function de(r) {
|
|
2250
2347
|
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(r);
|
|
2251
2348
|
}
|
|
2252
|
-
function
|
|
2349
|
+
function fe(r) {
|
|
2253
2350
|
return !!(/@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/.test(r) || /(\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/.test(r) || /\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}/.test(r));
|
|
2254
2351
|
}
|
|
2255
|
-
function
|
|
2256
|
-
const e = { ...
|
|
2257
|
-
return `${
|
|
2258
|
-
}
|
|
2259
|
-
function
|
|
2260
|
-
const { tag:
|
|
2261
|
-
let
|
|
2262
|
-
const
|
|
2263
|
-
|
|
2264
|
-
const
|
|
2265
|
-
const
|
|
2266
|
-
return { name:
|
|
2267
|
-
}).filter((
|
|
2268
|
-
|
|
2269
|
-
const
|
|
2270
|
-
|
|
2271
|
-
for (const { name:
|
|
2272
|
-
i
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
);
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2352
|
+
function ge(r, t) {
|
|
2353
|
+
const e = { ...ut, ...t }, s = e.format === "compact", n = s ? "v1" : `v${r.version}`, a = s ? ":" : ": ", i = s ? "::" : " :: ", o = s ? ">" : " > ", c = e.includeText && r.target.semantics.text ? r.target.semantics.text.normalized : void 0, l = W(r.anchor, false, e), f = r.path.length > 0 ? r.path.map((u) => W(u, false, e, c)).join(o) + o : "", h = W(r.target, true, e), d = e.includeConstraints ? pe(r, e) : "";
|
|
2354
|
+
return `${n}${a}${l}${i}${f}${h}${d}`;
|
|
2355
|
+
}
|
|
2356
|
+
function W(r, t = false, e = ut, s) {
|
|
2357
|
+
const { tag: n, semantics: a } = r, i = e.format === "compact";
|
|
2358
|
+
let o = n;
|
|
2359
|
+
const c = [], l = { ...a.attributes };
|
|
2360
|
+
a.id && (l.id = a.id), a.role && !l.role && (l.role = a.role);
|
|
2361
|
+
const f = Object.entries(l).map(([u, g]) => {
|
|
2362
|
+
const m = ct(u), p = u === "href" || u === "src" ? D(u, g) : g;
|
|
2363
|
+
return { name: u, value: p, priority: m };
|
|
2364
|
+
}).filter((u) => u.name !== "id" && u.name !== "class" && Y.has(u.name) || Z.has(u.name) && K(u.value) ? false : u.priority > 0 || u.name === "role" || u.name === "id");
|
|
2365
|
+
f.sort((u, g) => g.priority - u.priority);
|
|
2366
|
+
const h = f.slice(0, e.maxAttributes);
|
|
2367
|
+
h.sort((u, g) => u.name.localeCompare(g.name));
|
|
2368
|
+
for (const { name: u, value: g } of h) {
|
|
2369
|
+
const m = i ? ht[u] ?? u : u;
|
|
2370
|
+
c.push(`${m}="${V(g)}"`);
|
|
2371
|
+
}
|
|
2372
|
+
if (e.includeText && a.text && !fe(a.text.normalized)) {
|
|
2373
|
+
const u = a.text.normalized;
|
|
2374
|
+
if (u.length > 0 && u.length <= e.maxTextLength && !(!t && s !== void 0 && u === s)) {
|
|
2375
|
+
const m = i ? "x" : "text";
|
|
2376
|
+
c.push(`${m}="${V(u)}"`);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
let d = c;
|
|
2380
|
+
if (c.length > 0 && t && e.simplifyTarget && a.id && (d = c.filter((u) => {
|
|
2381
|
+
const g = u.split("=")[0], m = G[g] ?? g;
|
|
2382
|
+
return ct(m) >= 60 || m === "text" || m === "id" || m === "role";
|
|
2383
|
+
})), a.classes && a.classes.length > 0) {
|
|
2384
|
+
const u = M(a.classes), g = !!a.id || c.some((p) => {
|
|
2385
|
+
const b = p.split("=")[0], S = G[b] ?? b;
|
|
2386
|
+
return S === "href" || S === "data-testid" || S === "text" || S === "role";
|
|
2387
|
+
});
|
|
2388
|
+
if (!(t && e.simplifyTarget && g) && u.length > 0) {
|
|
2389
|
+
const p = u.sort().slice(0, e.maxClasses);
|
|
2390
|
+
o += p.map((b) => `.${b}`).join("");
|
|
2288
2391
|
}
|
|
2289
2392
|
}
|
|
2290
|
-
if (d.length > 0 && (
|
|
2291
|
-
const
|
|
2292
|
-
t && e.simplifyTarget &&
|
|
2393
|
+
if (d.length > 0 && (o += `[${d.join(",")}]`), "nthChild" in r && r.nthChild) {
|
|
2394
|
+
const u = !!a.id || a.attributes && Object.keys(a.attributes).some(de);
|
|
2395
|
+
t && e.simplifyTarget && u || (o += `#${r.nthChild}`);
|
|
2293
2396
|
}
|
|
2294
|
-
return
|
|
2397
|
+
return o;
|
|
2295
2398
|
}
|
|
2296
|
-
function
|
|
2399
|
+
function pe(r, t) {
|
|
2297
2400
|
if (!r.constraints || r.constraints.length === 0)
|
|
2298
2401
|
return "";
|
|
2299
|
-
const
|
|
2300
|
-
for (const
|
|
2301
|
-
switch (
|
|
2402
|
+
const e = [];
|
|
2403
|
+
for (const n of r.constraints)
|
|
2404
|
+
switch (n.type) {
|
|
2302
2405
|
case "uniqueness":
|
|
2303
|
-
|
|
2406
|
+
e.push("unique=true");
|
|
2304
2407
|
break;
|
|
2305
2408
|
case "position":
|
|
2306
|
-
|
|
2409
|
+
n.params && n.params.strategy && e.push(`pos=${n.params.strategy}`);
|
|
2307
2410
|
break;
|
|
2308
2411
|
case "text-proximity":
|
|
2309
|
-
if (
|
|
2310
|
-
const
|
|
2311
|
-
|
|
2412
|
+
if (n.params && n.params.reference) {
|
|
2413
|
+
const a = V(String(n.params.reference));
|
|
2414
|
+
e.push(`text="${a}"`);
|
|
2312
2415
|
}
|
|
2313
2416
|
break;
|
|
2314
2417
|
}
|
|
2315
|
-
return
|
|
2418
|
+
return e.length === 0 ? "" : `${t.format === "verbose" ? " " : ""}{${e.join(",")}}`;
|
|
2316
2419
|
}
|
|
2317
|
-
function
|
|
2420
|
+
function V(r) {
|
|
2318
2421
|
return r.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
2319
2422
|
}
|
|
2320
|
-
function
|
|
2321
|
-
const s =
|
|
2322
|
-
return s ?
|
|
2423
|
+
function Ne(r, t, e) {
|
|
2424
|
+
const s = J(r, t);
|
|
2425
|
+
return s ? ge(s, e) : null;
|
|
2323
2426
|
}
|
|
2324
2427
|
let _id = 1;
|
|
2325
2428
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
@@ -2992,7 +3095,7 @@ function serializeNodeWithId(n, options) {
|
|
|
2992
3095
|
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
2993
3096
|
fallbackToBody: selectorOptions.fallbackToBody
|
|
2994
3097
|
};
|
|
2995
|
-
const selector =
|
|
3098
|
+
const selector = Ne(n, seqlGeneratorOptions);
|
|
2996
3099
|
if (selector) {
|
|
2997
3100
|
serializedNode.selector = selector;
|
|
2998
3101
|
}
|
|
@@ -3004,7 +3107,11 @@ function serializeNodeWithId(n, options) {
|
|
|
3004
3107
|
serializedNode.isVisible = isTextVisible(n);
|
|
3005
3108
|
}
|
|
3006
3109
|
if (n.nodeType === Node.ELEMENT_NODE) {
|
|
3007
|
-
|
|
3110
|
+
const vis = isElementVisible(n);
|
|
3111
|
+
serializedNode.isVisible = vis.isVisible;
|
|
3112
|
+
serializedNode.isCSSVisible = vis.isCSSVisible;
|
|
3113
|
+
serializedNode.isViewportVisible = vis.isViewportVisible;
|
|
3114
|
+
serializedNode.hasSize = vis.hasSize;
|
|
3008
3115
|
serializedNode.isInteractive = isElementInteractive(n);
|
|
3009
3116
|
}
|
|
3010
3117
|
}
|