@appsurify-testmap/rrweb-snapshot 3.6.0-alpha.1 → 3.11.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/rrweb-snapshot.cjs +291 -204
- package/dist/rrweb-snapshot.cjs.map +1 -1
- package/dist/rrweb-snapshot.js +291 -204
- package/dist/rrweb-snapshot.js.map +1 -1
- package/dist/rrweb-snapshot.umd.cjs +306 -204
- package/dist/rrweb-snapshot.umd.cjs.map +2 -2
- 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.js
CHANGED
|
@@ -775,7 +775,7 @@ try {
|
|
|
775
775
|
}
|
|
776
776
|
} catch (error) {
|
|
777
777
|
}
|
|
778
|
-
const
|
|
778
|
+
const z = {
|
|
779
779
|
ANCHOR: 0.4,
|
|
780
780
|
PATH: 0.3,
|
|
781
781
|
TARGET: 0.2,
|
|
@@ -789,9 +789,9 @@ const U = {
|
|
|
789
789
|
DEPTH_PENALTY_THRESHOLD: 5,
|
|
790
790
|
DEPTH_PENALTY_FACTOR: 0.05,
|
|
791
791
|
DEGRADED_SCORE: 0.3
|
|
792
|
-
},
|
|
792
|
+
}, bt = {
|
|
793
793
|
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
794
|
-
},
|
|
794
|
+
}, tt = [
|
|
795
795
|
"form",
|
|
796
796
|
"main",
|
|
797
797
|
"nav",
|
|
@@ -799,7 +799,7 @@ const U = {
|
|
|
799
799
|
"article",
|
|
800
800
|
"footer",
|
|
801
801
|
"header"
|
|
802
|
-
],
|
|
802
|
+
], et = [
|
|
803
803
|
"form",
|
|
804
804
|
"navigation",
|
|
805
805
|
"main",
|
|
@@ -808,7 +808,7 @@ const U = {
|
|
|
808
808
|
"complementary",
|
|
809
809
|
"banner",
|
|
810
810
|
"search"
|
|
811
|
-
],
|
|
811
|
+
], St = [
|
|
812
812
|
// HTML5 Semantic
|
|
813
813
|
"article",
|
|
814
814
|
"aside",
|
|
@@ -912,7 +912,7 @@ const U = {
|
|
|
912
912
|
"data-*": 30,
|
|
913
913
|
// Any aria-* attribute (if not above)
|
|
914
914
|
"aria-*": 25
|
|
915
|
-
},
|
|
915
|
+
}, Y = /* @__PURE__ */ new Set([
|
|
916
916
|
"id",
|
|
917
917
|
// handled separately
|
|
918
918
|
"class",
|
|
@@ -924,7 +924,7 @@ const U = {
|
|
|
924
924
|
"tabindex",
|
|
925
925
|
// can change
|
|
926
926
|
"contenteditable"
|
|
927
|
-
]),
|
|
927
|
+
]), At = {
|
|
928
928
|
maxPathDepth: 10,
|
|
929
929
|
enableSvgFingerprint: true,
|
|
930
930
|
confidenceThreshold: 0,
|
|
@@ -932,7 +932,7 @@ const U = {
|
|
|
932
932
|
includeUtilityClasses: false,
|
|
933
933
|
source: "dom-dsl"
|
|
934
934
|
};
|
|
935
|
-
function
|
|
935
|
+
function L(r) {
|
|
936
936
|
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))
|
|
937
937
|
return true;
|
|
938
938
|
if (/^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(r)) {
|
|
@@ -942,7 +942,7 @@ function P(r) {
|
|
|
942
942
|
}
|
|
943
943
|
return !!(/^radix-/.test(r) || /^mui-\d+$/.test(r));
|
|
944
944
|
}
|
|
945
|
-
const
|
|
945
|
+
const Z = /* @__PURE__ */ new Set([
|
|
946
946
|
"aria-labelledby",
|
|
947
947
|
"aria-describedby",
|
|
948
948
|
"aria-controls",
|
|
@@ -956,10 +956,10 @@ const Q = /* @__PURE__ */ new Set([
|
|
|
956
956
|
"aria-errormessage",
|
|
957
957
|
"aria-flowto"
|
|
958
958
|
]);
|
|
959
|
-
function
|
|
960
|
-
return r.trim().split(/\s+/).some((e) =>
|
|
959
|
+
function K(r) {
|
|
960
|
+
return r.trim().split(/\s+/).some((e) => L(e));
|
|
961
961
|
}
|
|
962
|
-
class
|
|
962
|
+
class Ct {
|
|
963
963
|
constructor(t, e) {
|
|
964
964
|
this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
|
|
965
965
|
}
|
|
@@ -992,25 +992,25 @@ class St {
|
|
|
992
992
|
if (e === "head" || this.isInsideHead(t)) {
|
|
993
993
|
const c = s == null ? void 0 : s.documentElement;
|
|
994
994
|
if (c) {
|
|
995
|
-
const
|
|
995
|
+
const l = {
|
|
996
996
|
element: c,
|
|
997
997
|
score: 1,
|
|
998
998
|
tier: "A",
|
|
999
999
|
depth: 0
|
|
1000
1000
|
};
|
|
1001
|
-
return this.cacheResult(t,
|
|
1001
|
+
return this.cacheResult(t, l), l;
|
|
1002
1002
|
}
|
|
1003
1003
|
}
|
|
1004
1004
|
if (e === "body") {
|
|
1005
1005
|
const c = s == null ? void 0 : s.documentElement;
|
|
1006
1006
|
if (c) {
|
|
1007
|
-
const
|
|
1007
|
+
const l = {
|
|
1008
1008
|
element: c,
|
|
1009
1009
|
score: 1,
|
|
1010
1010
|
tier: "A",
|
|
1011
1011
|
depth: 0
|
|
1012
1012
|
};
|
|
1013
|
-
return this.cacheResult(t,
|
|
1013
|
+
return this.cacheResult(t, l), l;
|
|
1014
1014
|
}
|
|
1015
1015
|
}
|
|
1016
1016
|
let n = t.parentElement, a = 0, i = null;
|
|
@@ -1024,10 +1024,10 @@ class St {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
const c = this.scoreAnchor(n);
|
|
1026
1026
|
if (c > 0) {
|
|
1027
|
-
const
|
|
1028
|
-
if (
|
|
1029
|
-
return
|
|
1030
|
-
(!i ||
|
|
1027
|
+
const l = this.applyDepthPenalty(c, a), f = this.getTier(n), h = { element: n, score: l, tier: f, depth: a };
|
|
1028
|
+
if (f === "A")
|
|
1029
|
+
return h;
|
|
1030
|
+
(!i || l > i.score) && (i = h);
|
|
1031
1031
|
}
|
|
1032
1032
|
n = n.parentElement, a++;
|
|
1033
1033
|
}
|
|
@@ -1042,11 +1042,11 @@ class St {
|
|
|
1042
1042
|
scoreAnchor(t) {
|
|
1043
1043
|
let e = 0;
|
|
1044
1044
|
const s = t.tagName.toLowerCase();
|
|
1045
|
-
|
|
1045
|
+
tt.includes(s) && (e += I.SEMANTIC_TAG);
|
|
1046
1046
|
const n = t.getAttribute("role");
|
|
1047
|
-
n &&
|
|
1047
|
+
n && et.includes(n) && (e += I.ROLE), (t.hasAttribute("aria-label") || t.hasAttribute("aria-labelledby")) && (e += I.ARIA_LABEL);
|
|
1048
1048
|
const a = t.id;
|
|
1049
|
-
return a && !
|
|
1049
|
+
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);
|
|
1050
1050
|
}
|
|
1051
1051
|
/**
|
|
1052
1052
|
* Applies depth penalty to score
|
|
@@ -1063,10 +1063,10 @@ class St {
|
|
|
1063
1063
|
*/
|
|
1064
1064
|
getTier(t) {
|
|
1065
1065
|
const e = t.tagName.toLowerCase();
|
|
1066
|
-
if (
|
|
1066
|
+
if (tt.includes(e))
|
|
1067
1067
|
return "A";
|
|
1068
1068
|
const s = t.getAttribute("role");
|
|
1069
|
-
return s &&
|
|
1069
|
+
return s && et.includes(s) ? "B" : "C";
|
|
1070
1070
|
}
|
|
1071
1071
|
/**
|
|
1072
1072
|
* Checks if element is inside <head> section.
|
|
@@ -1099,7 +1099,7 @@ class St {
|
|
|
1099
1099
|
this.cache && this.cache.setAnchor(t, e);
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
const
|
|
1102
|
+
const Tt = [
|
|
1103
1103
|
// CSS-in-JS
|
|
1104
1104
|
/^css-[a-z0-9]+$/i,
|
|
1105
1105
|
/^sc-[a-z0-9]+-\d+$/i,
|
|
@@ -1119,7 +1119,7 @@ const At = [
|
|
|
1119
1119
|
/^_[a-z0-9]{5,}$/i,
|
|
1120
1120
|
/\d{5,}/
|
|
1121
1121
|
// 5+ digits in a row
|
|
1122
|
-
],
|
|
1122
|
+
], Et = [
|
|
1123
1123
|
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1124
1124
|
/^\[/,
|
|
1125
1125
|
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
@@ -1231,29 +1231,81 @@ const At = [
|
|
|
1231
1231
|
/^pull-(left|right)$/,
|
|
1232
1232
|
/^float-(left|right|none)$/
|
|
1233
1233
|
];
|
|
1234
|
-
function
|
|
1235
|
-
return
|
|
1234
|
+
function q(r) {
|
|
1235
|
+
return Tt.some((t) => t.test(r));
|
|
1236
1236
|
}
|
|
1237
|
-
function
|
|
1238
|
-
return r.length <= 2 || /^\d/.test(r) ? true :
|
|
1237
|
+
function U(r) {
|
|
1238
|
+
return r.length <= 2 || /^\d/.test(r) ? true : Et.some((t) => t.test(r));
|
|
1239
1239
|
}
|
|
1240
|
-
function
|
|
1241
|
-
return !
|
|
1240
|
+
function $t(r) {
|
|
1241
|
+
return !q(r) && !U(r);
|
|
1242
1242
|
}
|
|
1243
1243
|
function M(r) {
|
|
1244
|
-
return r.filter((t) =>
|
|
1244
|
+
return r.filter((t) => $t(t));
|
|
1245
1245
|
}
|
|
1246
|
-
function
|
|
1246
|
+
function It(r) {
|
|
1247
1247
|
const t = [], e = [];
|
|
1248
1248
|
for (const s of r)
|
|
1249
|
-
|
|
1249
|
+
U(s) || q(s) ? e.push(s) : t.push(s);
|
|
1250
1250
|
return { semantic: t, utility: e };
|
|
1251
1251
|
}
|
|
1252
|
-
function
|
|
1253
|
-
return
|
|
1252
|
+
function st(r) {
|
|
1253
|
+
return U(r) || q(r);
|
|
1254
|
+
}
|
|
1255
|
+
const Rt = /* @__PURE__ */ new Set([
|
|
1256
|
+
"tr",
|
|
1257
|
+
"td",
|
|
1258
|
+
"th",
|
|
1259
|
+
"thead",
|
|
1260
|
+
"tbody",
|
|
1261
|
+
"tfoot"
|
|
1262
|
+
]), Dt = /* @__PURE__ */ new Set([
|
|
1263
|
+
"data-testid",
|
|
1264
|
+
"data-qa",
|
|
1265
|
+
"data-cy",
|
|
1266
|
+
"data-test",
|
|
1267
|
+
"aria-label",
|
|
1268
|
+
"name",
|
|
1269
|
+
"href"
|
|
1270
|
+
]);
|
|
1271
|
+
function Mt(r) {
|
|
1272
|
+
if (r.id) return true;
|
|
1273
|
+
if (r.attributes) {
|
|
1274
|
+
for (const t of Object.keys(r.attributes))
|
|
1275
|
+
if (Dt.has(t)) return true;
|
|
1276
|
+
}
|
|
1277
|
+
return false;
|
|
1278
|
+
}
|
|
1279
|
+
function Lt(r, t, e) {
|
|
1280
|
+
var _a;
|
|
1281
|
+
const s = r.parentElement;
|
|
1282
|
+
if (!s) return true;
|
|
1283
|
+
for (const n of Array.from(s.children)) {
|
|
1284
|
+
if (n === r || n.tagName.toLowerCase() !== t) continue;
|
|
1285
|
+
if ((((_a = n.textContent) == null ? void 0 : _a.trim()) ?? "") === e) return false;
|
|
1286
|
+
}
|
|
1287
|
+
return true;
|
|
1288
|
+
}
|
|
1289
|
+
function _(r, t, e) {
|
|
1290
|
+
var _a;
|
|
1291
|
+
if (Rt.has(r)) return true;
|
|
1292
|
+
if (Mt(t)) return false;
|
|
1293
|
+
if (e) {
|
|
1294
|
+
const s = e.parentElement;
|
|
1295
|
+
if (s) {
|
|
1296
|
+
const n = (_a = t.text) == null ? void 0 : _a.normalized;
|
|
1297
|
+
if (n && Lt(e, r, n))
|
|
1298
|
+
return false;
|
|
1299
|
+
if (Array.from(s.children).some(
|
|
1300
|
+
(i) => i !== e && i.tagName.toLowerCase() === r
|
|
1301
|
+
)) return true;
|
|
1302
|
+
}
|
|
1303
|
+
return false;
|
|
1304
|
+
}
|
|
1305
|
+
return true;
|
|
1254
1306
|
}
|
|
1255
|
-
const
|
|
1256
|
-
class
|
|
1307
|
+
const rt = (r) => r.replace(/([#:.[\]@])/g, "\\$1");
|
|
1308
|
+
class Pt {
|
|
1257
1309
|
constructor(t, e) {
|
|
1258
1310
|
this.maxDepth = t.maxPathDepth ?? 10, this.cache = e;
|
|
1259
1311
|
}
|
|
@@ -1288,19 +1340,22 @@ class $t {
|
|
|
1288
1340
|
degraded: true,
|
|
1289
1341
|
degradationReason: "target-not-descendant-of-anchor"
|
|
1290
1342
|
};
|
|
1291
|
-
let
|
|
1292
|
-
return
|
|
1293
|
-
path:
|
|
1294
|
-
const h =
|
|
1343
|
+
let l = this.filterNoise(i);
|
|
1344
|
+
return l = this.ensureUniqueness(i, l, t, e, s), {
|
|
1345
|
+
path: l.map((h) => {
|
|
1346
|
+
const d = h.tagName.toLowerCase(), u = s.extract(h);
|
|
1295
1347
|
let g;
|
|
1296
|
-
if (h) {
|
|
1297
|
-
const m =
|
|
1298
|
-
|
|
1348
|
+
if (_(d, u, h)) {
|
|
1349
|
+
const m = h.parentElement;
|
|
1350
|
+
if (m) {
|
|
1351
|
+
const b = Array.from(m.children).indexOf(h);
|
|
1352
|
+
b !== -1 && (g = b + 1);
|
|
1353
|
+
}
|
|
1299
1354
|
}
|
|
1300
1355
|
return {
|
|
1301
|
-
tag:
|
|
1302
|
-
semantics:
|
|
1303
|
-
score: s.scoreElement(
|
|
1356
|
+
tag: d,
|
|
1357
|
+
semantics: u,
|
|
1358
|
+
score: s.scoreElement(h),
|
|
1304
1359
|
nthChild: g
|
|
1305
1360
|
};
|
|
1306
1361
|
}),
|
|
@@ -1325,27 +1380,27 @@ class $t {
|
|
|
1325
1380
|
if (!o) return e;
|
|
1326
1381
|
let c;
|
|
1327
1382
|
if (this.cache) {
|
|
1328
|
-
const
|
|
1329
|
-
|
|
1383
|
+
const f = this.cache.getSelectorResults(i);
|
|
1384
|
+
f !== void 0 ? c = f : (c = Array.from(o.querySelectorAll(i)), this.cache.setSelectorResults(i, c));
|
|
1330
1385
|
} else
|
|
1331
1386
|
c = o.querySelectorAll(i);
|
|
1332
1387
|
if (c.length <= 1)
|
|
1333
1388
|
return e;
|
|
1334
|
-
const
|
|
1335
|
-
for (const
|
|
1336
|
-
if (a.scoreElement(
|
|
1389
|
+
const l = t.filter((f) => !e.includes(f));
|
|
1390
|
+
for (const f of l) {
|
|
1391
|
+
if (a.scoreElement(f) < bt.MIN_CONFIDENCE_FOR_SKIP)
|
|
1337
1392
|
continue;
|
|
1338
|
-
const
|
|
1393
|
+
const d = this.insertNodeInOrder(e, f, t), u = this.buildTestSelector(s, d, n);
|
|
1339
1394
|
try {
|
|
1340
|
-
let
|
|
1395
|
+
let g;
|
|
1341
1396
|
if (this.cache) {
|
|
1342
|
-
const m = this.cache.getSelectorResults(
|
|
1343
|
-
m !== void 0 ?
|
|
1397
|
+
const m = this.cache.getSelectorResults(u);
|
|
1398
|
+
m !== void 0 ? g = m : (g = Array.from(o.querySelectorAll(u)), this.cache.setSelectorResults(u, g));
|
|
1344
1399
|
} else
|
|
1345
|
-
|
|
1346
|
-
if (
|
|
1347
|
-
return
|
|
1348
|
-
|
|
1400
|
+
g = o.querySelectorAll(u);
|
|
1401
|
+
if (g.length === 1)
|
|
1402
|
+
return d;
|
|
1403
|
+
g.length < c.length && (e = d);
|
|
1349
1404
|
} catch {
|
|
1350
1405
|
}
|
|
1351
1406
|
}
|
|
@@ -1379,9 +1434,9 @@ class $t {
|
|
|
1379
1434
|
*/
|
|
1380
1435
|
elementToSelector(t) {
|
|
1381
1436
|
let e = t.tagName.toLowerCase();
|
|
1382
|
-
t.id && !
|
|
1437
|
+
t.id && !L(t.id) && (e += `#${rt(t.id)}`);
|
|
1383
1438
|
for (const s of Array.from(t.classList))
|
|
1384
|
-
|
|
1439
|
+
st(s) || (e += `.${rt(s)}`);
|
|
1385
1440
|
return e;
|
|
1386
1441
|
}
|
|
1387
1442
|
/**
|
|
@@ -1395,7 +1450,7 @@ class $t {
|
|
|
1395
1450
|
*/
|
|
1396
1451
|
shouldInclude(t) {
|
|
1397
1452
|
const e = t.tagName.toLowerCase();
|
|
1398
|
-
return
|
|
1453
|
+
return St.includes(e) ? true : e === "div" || e === "span" ? this.hasSemanticFeatures(t) : false;
|
|
1399
1454
|
}
|
|
1400
1455
|
/**
|
|
1401
1456
|
* Checks if element has meaningful semantic features
|
|
@@ -1406,12 +1461,12 @@ class $t {
|
|
|
1406
1461
|
if (s.name.startsWith("aria-")) return true;
|
|
1407
1462
|
if (t.classList.length > 0) {
|
|
1408
1463
|
for (const s of Array.from(t.classList))
|
|
1409
|
-
if (!
|
|
1464
|
+
if (!st(s)) return true;
|
|
1410
1465
|
}
|
|
1411
1466
|
if (t.hasAttribute("data-testid") || t.hasAttribute("data-qa") || t.hasAttribute("data-test"))
|
|
1412
1467
|
return true;
|
|
1413
1468
|
const e = t.id;
|
|
1414
|
-
return !!(e && !
|
|
1469
|
+
return !!(e && !L(e));
|
|
1415
1470
|
}
|
|
1416
1471
|
/**
|
|
1417
1472
|
* Checks if element is inside <head> section.
|
|
@@ -1458,31 +1513,34 @@ class $t {
|
|
|
1458
1513
|
degradationReason: "head-not-found-in-path"
|
|
1459
1514
|
} : {
|
|
1460
1515
|
path: n.map((c) => {
|
|
1461
|
-
const
|
|
1462
|
-
let
|
|
1463
|
-
if (
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1516
|
+
const l = c.tagName.toLowerCase(), f = s.extract(c);
|
|
1517
|
+
let h;
|
|
1518
|
+
if (_(l, f, c)) {
|
|
1519
|
+
const d = c.parentElement;
|
|
1520
|
+
if (d) {
|
|
1521
|
+
const g = Array.from(d.children).indexOf(c);
|
|
1522
|
+
g !== -1 && (h = g + 1);
|
|
1523
|
+
}
|
|
1466
1524
|
}
|
|
1467
1525
|
return {
|
|
1468
|
-
tag:
|
|
1469
|
-
semantics:
|
|
1526
|
+
tag: l,
|
|
1527
|
+
semantics: f,
|
|
1470
1528
|
score: s.scoreElement(c),
|
|
1471
|
-
nthChild:
|
|
1529
|
+
nthChild: h
|
|
1472
1530
|
};
|
|
1473
1531
|
}),
|
|
1474
1532
|
degraded: false
|
|
1475
1533
|
};
|
|
1476
1534
|
}
|
|
1477
1535
|
}
|
|
1478
|
-
function
|
|
1536
|
+
function j(r) {
|
|
1479
1537
|
return r ? r.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1480
1538
|
}
|
|
1481
|
-
const
|
|
1539
|
+
const Ht = {
|
|
1482
1540
|
preserveQueryForAbsolute: true,
|
|
1483
1541
|
removeDynamicHashes: true
|
|
1484
1542
|
};
|
|
1485
|
-
function
|
|
1543
|
+
function kt(r) {
|
|
1486
1544
|
return r ? [
|
|
1487
1545
|
/\d{5,}/,
|
|
1488
1546
|
// 5+ digits
|
|
@@ -1496,18 +1554,18 @@ function It(r) {
|
|
|
1496
1554
|
// UUID-like
|
|
1497
1555
|
].some((e) => e.test(r)) : false;
|
|
1498
1556
|
}
|
|
1499
|
-
function
|
|
1557
|
+
function _t(r, t) {
|
|
1500
1558
|
if (!r) return r;
|
|
1501
1559
|
const e = r.startsWith("http://") || r.startsWith("https://"), [s, n] = r.split("#"), [a, i] = s.split("?");
|
|
1502
1560
|
let o = a;
|
|
1503
|
-
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes &&
|
|
1561
|
+
return e && t.preserveQueryForAbsolute && i && (o += `?${i}`), n && (t.removeDynamicHashes && kt(n) || (o += `#${n}`)), o;
|
|
1504
1562
|
}
|
|
1505
1563
|
function D(r, t, e = {}) {
|
|
1506
1564
|
if (!t) return t;
|
|
1507
|
-
const s = { ...
|
|
1508
|
-
return r === "href" || r === "src" ?
|
|
1565
|
+
const s = { ...Ht, ...e };
|
|
1566
|
+
return r === "href" || r === "src" ? _t(t, s) : t;
|
|
1509
1567
|
}
|
|
1510
|
-
const
|
|
1568
|
+
const Ot = [
|
|
1511
1569
|
"role",
|
|
1512
1570
|
"aria-label",
|
|
1513
1571
|
"aria-labelledby",
|
|
@@ -1518,7 +1576,7 @@ const Dt = [
|
|
|
1518
1576
|
"aria-posinset",
|
|
1519
1577
|
"aria-setsize",
|
|
1520
1578
|
"aria-haspopup"
|
|
1521
|
-
],
|
|
1579
|
+
], qt = [
|
|
1522
1580
|
"aria-selected",
|
|
1523
1581
|
"aria-checked",
|
|
1524
1582
|
"aria-pressed",
|
|
@@ -1531,7 +1589,7 @@ const Dt = [
|
|
|
1531
1589
|
"aria-grabbed",
|
|
1532
1590
|
"aria-live",
|
|
1533
1591
|
"aria-atomic"
|
|
1534
|
-
],
|
|
1592
|
+
], Ut = [
|
|
1535
1593
|
"data-state",
|
|
1536
1594
|
"data-active",
|
|
1537
1595
|
"data-inactive",
|
|
@@ -1550,7 +1608,7 @@ const Dt = [
|
|
|
1550
1608
|
"data-hover",
|
|
1551
1609
|
"data-orientation",
|
|
1552
1610
|
"data-theme"
|
|
1553
|
-
],
|
|
1611
|
+
], zt = [
|
|
1554
1612
|
"data-radix-",
|
|
1555
1613
|
"data-headlessui-",
|
|
1556
1614
|
"data-reach-",
|
|
@@ -1558,7 +1616,7 @@ const Dt = [
|
|
|
1558
1616
|
"data-chakra-",
|
|
1559
1617
|
"data-mantine-",
|
|
1560
1618
|
"data-tw-"
|
|
1561
|
-
],
|
|
1619
|
+
], Ft = [
|
|
1562
1620
|
"data-testid",
|
|
1563
1621
|
"data-test-id",
|
|
1564
1622
|
"data-test",
|
|
@@ -1570,7 +1628,7 @@ const Dt = [
|
|
|
1570
1628
|
"data-entity-id",
|
|
1571
1629
|
"data-product-id",
|
|
1572
1630
|
"data-user-id"
|
|
1573
|
-
],
|
|
1631
|
+
], jt = [
|
|
1574
1632
|
// Google Analytics / GTM
|
|
1575
1633
|
"data-ga",
|
|
1576
1634
|
"data-gtm",
|
|
@@ -1606,7 +1664,7 @@ const Dt = [
|
|
|
1606
1664
|
"data-conversion",
|
|
1607
1665
|
"data-segment",
|
|
1608
1666
|
"data-analytics"
|
|
1609
|
-
],
|
|
1667
|
+
], Wt = [
|
|
1610
1668
|
"data-category",
|
|
1611
1669
|
// Google Analytics category
|
|
1612
1670
|
"data-action",
|
|
@@ -1615,7 +1673,7 @@ const Dt = [
|
|
|
1615
1673
|
// Google Analytics label
|
|
1616
1674
|
"data-value"
|
|
1617
1675
|
// Google Analytics value
|
|
1618
|
-
],
|
|
1676
|
+
], Bt = [
|
|
1619
1677
|
"id",
|
|
1620
1678
|
"name",
|
|
1621
1679
|
"type",
|
|
@@ -1624,7 +1682,7 @@ const Dt = [
|
|
|
1624
1682
|
"for",
|
|
1625
1683
|
"alt",
|
|
1626
1684
|
"href"
|
|
1627
|
-
],
|
|
1685
|
+
], Gt = [
|
|
1628
1686
|
"disabled",
|
|
1629
1687
|
"checked",
|
|
1630
1688
|
"selected",
|
|
@@ -1632,17 +1690,17 @@ const Dt = [
|
|
|
1632
1690
|
"readonly",
|
|
1633
1691
|
"required",
|
|
1634
1692
|
"value"
|
|
1635
|
-
],
|
|
1693
|
+
], Vt = [
|
|
1636
1694
|
/^radix-/,
|
|
1637
1695
|
/^headlessui-/,
|
|
1638
1696
|
/^mui-/,
|
|
1639
1697
|
/:\w+:/
|
|
1640
1698
|
// matches :ru:, :r1:, etc.
|
|
1641
1699
|
];
|
|
1642
|
-
function
|
|
1643
|
-
return
|
|
1700
|
+
function Qt(r, t) {
|
|
1701
|
+
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-");
|
|
1644
1702
|
}
|
|
1645
|
-
class
|
|
1703
|
+
class nt {
|
|
1646
1704
|
constructor(t, e) {
|
|
1647
1705
|
this.includeUtilityClasses = t.includeUtilityClasses ?? false, this.cache = e;
|
|
1648
1706
|
}
|
|
@@ -1658,12 +1716,12 @@ class st {
|
|
|
1658
1716
|
return i;
|
|
1659
1717
|
}
|
|
1660
1718
|
const e = {}, s = t.id;
|
|
1661
|
-
if (s && !
|
|
1719
|
+
if (s && !L(s) && (e.id = s), t.classList.length > 0) {
|
|
1662
1720
|
const i = Array.from(t.classList);
|
|
1663
1721
|
if (this.includeUtilityClasses)
|
|
1664
1722
|
e.classes = i;
|
|
1665
1723
|
else {
|
|
1666
|
-
const { semantic: o } =
|
|
1724
|
+
const { semantic: o } = It(i);
|
|
1667
1725
|
o.length > 0 && (e.classes = o);
|
|
1668
1726
|
}
|
|
1669
1727
|
}
|
|
@@ -1692,7 +1750,7 @@ class st {
|
|
|
1692
1750
|
* @returns True if should be ignored
|
|
1693
1751
|
*/
|
|
1694
1752
|
shouldIgnoreAttribute(t) {
|
|
1695
|
-
return !!(
|
|
1753
|
+
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-"));
|
|
1696
1754
|
}
|
|
1697
1755
|
/**
|
|
1698
1756
|
* Gets attribute priority
|
|
@@ -1727,7 +1785,7 @@ class st {
|
|
|
1727
1785
|
const e = {};
|
|
1728
1786
|
for (const s of Array.from(t.attributes)) {
|
|
1729
1787
|
const n = s.name;
|
|
1730
|
-
if (this.shouldIgnoreAttribute(n) || !
|
|
1788
|
+
if (this.shouldIgnoreAttribute(n) || !Qt(n, s.value) || Z.has(n) && K(s.value) || this.getAttributePriority(n) === 0) continue;
|
|
1731
1789
|
const i = n === "href" || n === "src" ? D(n, s.value) : s.value;
|
|
1732
1790
|
!i || i.trim() === "" || this.isDynamicValue(i) || (e[n] = i);
|
|
1733
1791
|
}
|
|
@@ -1739,7 +1797,7 @@ class st {
|
|
|
1739
1797
|
extractText(t) {
|
|
1740
1798
|
const e = this.getDirectTextContent(t);
|
|
1741
1799
|
if (!e) return null;
|
|
1742
|
-
const s =
|
|
1800
|
+
const s = j(e);
|
|
1743
1801
|
if (!s) return null;
|
|
1744
1802
|
const n = 100, a = e.length > n ? e.slice(0, n) + "..." : e, i = s.length > n ? s.slice(0, n) + "..." : s;
|
|
1745
1803
|
return {
|
|
@@ -1787,7 +1845,7 @@ class st {
|
|
|
1787
1845
|
].includes(e);
|
|
1788
1846
|
}
|
|
1789
1847
|
}
|
|
1790
|
-
class
|
|
1848
|
+
class Yt {
|
|
1791
1849
|
/**
|
|
1792
1850
|
* Generates fingerprint for SVG element
|
|
1793
1851
|
* @param element - SVG element to fingerprint
|
|
@@ -1898,11 +1956,11 @@ class Ft {
|
|
|
1898
1956
|
return Math.abs(e).toString(16).padStart(8, "0");
|
|
1899
1957
|
}
|
|
1900
1958
|
}
|
|
1901
|
-
function
|
|
1902
|
-
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 *
|
|
1959
|
+
function Zt(r, t = 0) {
|
|
1960
|
+
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;
|
|
1903
1961
|
return Math.max(0, Math.min(1, a - i));
|
|
1904
1962
|
}
|
|
1905
|
-
class
|
|
1963
|
+
class Kt {
|
|
1906
1964
|
constructor(t) {
|
|
1907
1965
|
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t;
|
|
1908
1966
|
}
|
|
@@ -1933,9 +1991,9 @@ class Wt {
|
|
|
1933
1991
|
return this.cache.size;
|
|
1934
1992
|
}
|
|
1935
1993
|
}
|
|
1936
|
-
class
|
|
1994
|
+
class Xt {
|
|
1937
1995
|
constructor(t = {}) {
|
|
1938
|
-
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new
|
|
1996
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new Kt(
|
|
1939
1997
|
t.maxSelectorCacheSize ?? 1e3
|
|
1940
1998
|
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
1941
1999
|
eidHits: 0,
|
|
@@ -2084,12 +2142,12 @@ class Bt {
|
|
|
2084
2142
|
return s > 0 ? t / s : 0;
|
|
2085
2143
|
}
|
|
2086
2144
|
}
|
|
2087
|
-
function
|
|
2088
|
-
return new
|
|
2145
|
+
function Jt(r) {
|
|
2146
|
+
return new Xt(r);
|
|
2089
2147
|
}
|
|
2090
|
-
let
|
|
2091
|
-
function
|
|
2092
|
-
return
|
|
2148
|
+
let F = null;
|
|
2149
|
+
function X() {
|
|
2150
|
+
return F || (F = Jt()), F;
|
|
2093
2151
|
}
|
|
2094
2152
|
function k(r) {
|
|
2095
2153
|
if (r.ownerDocument)
|
|
@@ -2107,7 +2165,7 @@ function k(r) {
|
|
|
2107
2165
|
3. You are working with a document node instead of an element`
|
|
2108
2166
|
);
|
|
2109
2167
|
}
|
|
2110
|
-
function
|
|
2168
|
+
function te(r, t) {
|
|
2111
2169
|
if (!t)
|
|
2112
2170
|
return;
|
|
2113
2171
|
const e = k(r), s = t instanceof Document ? t : k(t);
|
|
@@ -2122,64 +2180,65 @@ Common causes:
|
|
|
2122
2180
|
Solution: Ensure element and root parameter are from the same document context.`
|
|
2123
2181
|
);
|
|
2124
2182
|
}
|
|
2125
|
-
function
|
|
2183
|
+
function J(r, t = {}) {
|
|
2126
2184
|
var _a;
|
|
2127
2185
|
if (!r || !r.ownerDocument || !r.isConnected)
|
|
2128
2186
|
return null;
|
|
2129
|
-
const e = { ...
|
|
2187
|
+
const e = { ...At, ...t };
|
|
2130
2188
|
if (e.root)
|
|
2131
2189
|
try {
|
|
2132
|
-
|
|
2190
|
+
te(r, e.root);
|
|
2133
2191
|
} catch (x2) {
|
|
2134
2192
|
return console.error("Cross-document generation detected:", x2), null;
|
|
2135
2193
|
}
|
|
2136
|
-
const s = e.cache ??
|
|
2194
|
+
const s = e.cache ?? X(), n = s.getEID(r);
|
|
2137
2195
|
if (n !== void 0)
|
|
2138
2196
|
return n;
|
|
2139
|
-
|
|
2140
|
-
|
|
2197
|
+
const a = r.tagName.toLowerCase();
|
|
2198
|
+
if (a === "html") {
|
|
2199
|
+
const x2 = new nt(e, s), y = re(r, e, x2);
|
|
2141
2200
|
return s.setEID(r, y), y;
|
|
2142
2201
|
}
|
|
2143
|
-
const i = new
|
|
2144
|
-
if (!
|
|
2202
|
+
const i = new Ct(e, s), o = new Pt(e, s), c = new nt(e, s), l = new Yt(), f = i.findAnchor(r);
|
|
2203
|
+
if (!f && !e.fallbackToBody)
|
|
2145
2204
|
return null;
|
|
2146
|
-
const
|
|
2147
|
-
if (!
|
|
2148
|
-
const
|
|
2149
|
-
let
|
|
2150
|
-
if (
|
|
2151
|
-
const y = Array.from(
|
|
2152
|
-
y !== -1 && (
|
|
2153
|
-
}
|
|
2154
|
-
const
|
|
2155
|
-
tag:
|
|
2156
|
-
semantics:
|
|
2157
|
-
score: (
|
|
2158
|
-
degraded:
|
|
2159
|
-
nthChild:
|
|
2160
|
-
}, S = o.buildPath(
|
|
2161
|
-
e.enableSvgFingerprint &&
|
|
2205
|
+
const h = (f == null ? void 0 : f.element) ?? ((_a = r.ownerDocument) == null ? void 0 : _a.body) ?? null;
|
|
2206
|
+
if (!h) return null;
|
|
2207
|
+
const d = !f || f.tier === "C", u = h.tagName.toLowerCase(), g = c.extract(h), m = h.parentElement;
|
|
2208
|
+
let p;
|
|
2209
|
+
if (m && u !== "body" && u !== "html" && _(u, g, h)) {
|
|
2210
|
+
const y = Array.from(m.children).indexOf(h);
|
|
2211
|
+
y !== -1 && (p = y + 1);
|
|
2212
|
+
}
|
|
2213
|
+
const b = {
|
|
2214
|
+
tag: h.tagName.toLowerCase(),
|
|
2215
|
+
semantics: g,
|
|
2216
|
+
score: (f == null ? void 0 : f.score) ?? I.DEGRADED_SCORE,
|
|
2217
|
+
degraded: d,
|
|
2218
|
+
nthChild: p
|
|
2219
|
+
}, S = o.buildPath(h, r, c), T = c.extract(r);
|
|
2220
|
+
e.enableSvgFingerprint && ee(r) && (T.svg = l.fingerprint(r));
|
|
2162
2221
|
const C = r.parentElement;
|
|
2163
2222
|
let A;
|
|
2164
|
-
if (C) {
|
|
2223
|
+
if (C && _(a, T, r)) {
|
|
2165
2224
|
const y = Array.from(C.children).indexOf(r);
|
|
2166
2225
|
y !== -1 && (A = y + 1);
|
|
2167
2226
|
}
|
|
2168
2227
|
const v = {
|
|
2169
2228
|
tag: r.tagName.toLowerCase(),
|
|
2170
|
-
semantics:
|
|
2229
|
+
semantics: T,
|
|
2171
2230
|
score: c.scoreElement(r),
|
|
2172
2231
|
nthChild: A
|
|
2173
|
-
},
|
|
2232
|
+
}, P = [], $ = {
|
|
2174
2233
|
onMultiple: "best-score",
|
|
2175
2234
|
onMissing: "anchor-only",
|
|
2176
2235
|
maxDepth: 3
|
|
2177
|
-
},
|
|
2236
|
+
}, E = b.degraded || S.degraded, R = se(b.degraded, S), N = {
|
|
2178
2237
|
version: "1.0",
|
|
2179
2238
|
anchor: b,
|
|
2180
2239
|
path: S.path,
|
|
2181
2240
|
target: v,
|
|
2182
|
-
constraints:
|
|
2241
|
+
constraints: P,
|
|
2183
2242
|
fallback: $,
|
|
2184
2243
|
meta: {
|
|
2185
2244
|
confidence: 0,
|
|
@@ -2187,16 +2246,16 @@ function X(r, t = {}) {
|
|
|
2187
2246
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2188
2247
|
generator: "dom-eid@1.0",
|
|
2189
2248
|
source: e.source,
|
|
2190
|
-
degraded:
|
|
2249
|
+
degraded: E,
|
|
2191
2250
|
degradationReason: R
|
|
2192
2251
|
}
|
|
2193
2252
|
};
|
|
2194
|
-
return N.meta.confidence =
|
|
2253
|
+
return N.meta.confidence = Zt(N), N.meta.confidence < e.confidenceThreshold ? null : (s.setEID(r, N), N);
|
|
2195
2254
|
}
|
|
2196
|
-
function
|
|
2255
|
+
function ee(r) {
|
|
2197
2256
|
return r.namespaceURI === "http://www.w3.org/2000/svg" || r.tagName.toLowerCase() === "svg" || r instanceof SVGElement;
|
|
2198
2257
|
}
|
|
2199
|
-
function
|
|
2258
|
+
function se(r, t) {
|
|
2200
2259
|
if (r && t.degraded)
|
|
2201
2260
|
return "anchor-and-path-degraded";
|
|
2202
2261
|
if (r)
|
|
@@ -2204,7 +2263,7 @@ function Yt(r, t) {
|
|
|
2204
2263
|
if (t.degraded)
|
|
2205
2264
|
return t.degradationReason;
|
|
2206
2265
|
}
|
|
2207
|
-
function
|
|
2266
|
+
function re(r, t, e, s) {
|
|
2208
2267
|
const a = {
|
|
2209
2268
|
tag: "html",
|
|
2210
2269
|
semantics: e.extract(r),
|
|
@@ -2233,91 +2292,119 @@ function Zt(r, t, e, s) {
|
|
|
2233
2292
|
}
|
|
2234
2293
|
};
|
|
2235
2294
|
}
|
|
2236
|
-
const
|
|
2295
|
+
const ht = {
|
|
2296
|
+
id: "i",
|
|
2297
|
+
"data-testid": "tid",
|
|
2298
|
+
"data-qa": "qa",
|
|
2299
|
+
"data-cy": "cy",
|
|
2300
|
+
"data-test": "dt",
|
|
2301
|
+
"aria-label": "al",
|
|
2302
|
+
"aria-labelledby": "alb",
|
|
2303
|
+
"aria-describedby": "adb",
|
|
2304
|
+
name: "n",
|
|
2305
|
+
href: "h",
|
|
2306
|
+
src: "s",
|
|
2307
|
+
type: "t",
|
|
2308
|
+
role: "r",
|
|
2309
|
+
alt: "at",
|
|
2310
|
+
title: "tt",
|
|
2311
|
+
for: "f",
|
|
2312
|
+
placeholder: "ph",
|
|
2313
|
+
text: "x"
|
|
2314
|
+
}, G = Object.fromEntries(
|
|
2315
|
+
Object.entries(ht).map(([r, t]) => [t, r])
|
|
2316
|
+
), ut = {
|
|
2237
2317
|
maxClasses: 2,
|
|
2238
2318
|
maxAttributes: 5,
|
|
2239
2319
|
includeText: true,
|
|
2240
2320
|
maxTextLength: 50,
|
|
2241
2321
|
simplifyTarget: true,
|
|
2242
|
-
includeConstraints: true
|
|
2322
|
+
includeConstraints: true,
|
|
2323
|
+
format: "compact"
|
|
2243
2324
|
};
|
|
2244
|
-
function
|
|
2325
|
+
function ct(r) {
|
|
2245
2326
|
return r === "id" ? 101 : w[r] !== void 0 ? w[r] : r.startsWith("data-") ? w["data-*"] : r.startsWith("aria-") ? w["aria-*"] : 0;
|
|
2246
2327
|
}
|
|
2247
|
-
function
|
|
2328
|
+
function de(r) {
|
|
2248
2329
|
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(r);
|
|
2249
2330
|
}
|
|
2250
|
-
function
|
|
2331
|
+
function fe(r) {
|
|
2251
2332
|
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));
|
|
2252
2333
|
}
|
|
2253
|
-
function
|
|
2254
|
-
const e = { ...
|
|
2255
|
-
return `${
|
|
2256
|
-
}
|
|
2257
|
-
function
|
|
2258
|
-
const { tag:
|
|
2259
|
-
let
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
const
|
|
2263
|
-
const
|
|
2264
|
-
return { name:
|
|
2265
|
-
}).filter((
|
|
2266
|
-
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
for (const { name:
|
|
2270
|
-
i
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
);
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2334
|
+
function ge(r, t) {
|
|
2335
|
+
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) : "";
|
|
2336
|
+
return `${n}${a}${l}${i}${f}${h}${d}`;
|
|
2337
|
+
}
|
|
2338
|
+
function W(r, t = false, e = ut, s) {
|
|
2339
|
+
const { tag: n, semantics: a } = r, i = e.format === "compact";
|
|
2340
|
+
let o = n;
|
|
2341
|
+
const c = [], l = { ...a.attributes };
|
|
2342
|
+
a.id && (l.id = a.id), a.role && !l.role && (l.role = a.role);
|
|
2343
|
+
const f = Object.entries(l).map(([u, g]) => {
|
|
2344
|
+
const m = ct(u), p = u === "href" || u === "src" ? D(u, g) : g;
|
|
2345
|
+
return { name: u, value: p, priority: m };
|
|
2346
|
+
}).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");
|
|
2347
|
+
f.sort((u, g) => g.priority - u.priority);
|
|
2348
|
+
const h = f.slice(0, e.maxAttributes);
|
|
2349
|
+
h.sort((u, g) => u.name.localeCompare(g.name));
|
|
2350
|
+
for (const { name: u, value: g } of h) {
|
|
2351
|
+
const m = i ? ht[u] ?? u : u;
|
|
2352
|
+
c.push(`${m}="${V(g)}"`);
|
|
2353
|
+
}
|
|
2354
|
+
if (e.includeText && a.text && !fe(a.text.normalized)) {
|
|
2355
|
+
const u = a.text.normalized;
|
|
2356
|
+
if (u.length > 0 && u.length <= e.maxTextLength && !(!t && s !== void 0 && u === s)) {
|
|
2357
|
+
const m = i ? "x" : "text";
|
|
2358
|
+
c.push(`${m}="${V(u)}"`);
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
let d = c;
|
|
2362
|
+
if (c.length > 0 && t && e.simplifyTarget && a.id && (d = c.filter((u) => {
|
|
2363
|
+
const g = u.split("=")[0], m = G[g] ?? g;
|
|
2364
|
+
return ct(m) >= 60 || m === "text" || m === "id" || m === "role";
|
|
2365
|
+
})), a.classes && a.classes.length > 0) {
|
|
2366
|
+
const u = M(a.classes), g = !!a.id || c.some((p) => {
|
|
2367
|
+
const b = p.split("=")[0], S = G[b] ?? b;
|
|
2368
|
+
return S === "href" || S === "data-testid" || S === "text" || S === "role";
|
|
2369
|
+
});
|
|
2370
|
+
if (!(t && e.simplifyTarget && g) && u.length > 0) {
|
|
2371
|
+
const p = u.sort().slice(0, e.maxClasses);
|
|
2372
|
+
o += p.map((b) => `.${b}`).join("");
|
|
2286
2373
|
}
|
|
2287
2374
|
}
|
|
2288
|
-
if (d.length > 0 && (
|
|
2289
|
-
const
|
|
2290
|
-
t && e.simplifyTarget &&
|
|
2375
|
+
if (d.length > 0 && (o += `[${d.join(",")}]`), "nthChild" in r && r.nthChild) {
|
|
2376
|
+
const u = !!a.id || a.attributes && Object.keys(a.attributes).some(de);
|
|
2377
|
+
t && e.simplifyTarget && u || (o += `#${r.nthChild}`);
|
|
2291
2378
|
}
|
|
2292
|
-
return
|
|
2379
|
+
return o;
|
|
2293
2380
|
}
|
|
2294
|
-
function
|
|
2381
|
+
function pe(r, t) {
|
|
2295
2382
|
if (!r.constraints || r.constraints.length === 0)
|
|
2296
2383
|
return "";
|
|
2297
|
-
const
|
|
2298
|
-
for (const
|
|
2299
|
-
switch (
|
|
2384
|
+
const e = [];
|
|
2385
|
+
for (const n of r.constraints)
|
|
2386
|
+
switch (n.type) {
|
|
2300
2387
|
case "uniqueness":
|
|
2301
|
-
|
|
2388
|
+
e.push("unique=true");
|
|
2302
2389
|
break;
|
|
2303
2390
|
case "position":
|
|
2304
|
-
|
|
2391
|
+
n.params && n.params.strategy && e.push(`pos=${n.params.strategy}`);
|
|
2305
2392
|
break;
|
|
2306
2393
|
case "text-proximity":
|
|
2307
|
-
if (
|
|
2308
|
-
const
|
|
2309
|
-
|
|
2394
|
+
if (n.params && n.params.reference) {
|
|
2395
|
+
const a = V(String(n.params.reference));
|
|
2396
|
+
e.push(`text="${a}"`);
|
|
2310
2397
|
}
|
|
2311
2398
|
break;
|
|
2312
2399
|
}
|
|
2313
|
-
return
|
|
2400
|
+
return e.length === 0 ? "" : `${t.format === "verbose" ? " " : ""}{${e.join(",")}}`;
|
|
2314
2401
|
}
|
|
2315
|
-
function
|
|
2402
|
+
function V(r) {
|
|
2316
2403
|
return r.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
2317
2404
|
}
|
|
2318
|
-
function
|
|
2319
|
-
const s =
|
|
2320
|
-
return s ?
|
|
2405
|
+
function Ne(r, t, e) {
|
|
2406
|
+
const s = J(r, t);
|
|
2407
|
+
return s ? ge(s, e) : null;
|
|
2321
2408
|
}
|
|
2322
2409
|
let _id = 1;
|
|
2323
2410
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
@@ -2990,7 +3077,7 @@ function serializeNodeWithId(n, options) {
|
|
|
2990
3077
|
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
2991
3078
|
fallbackToBody: selectorOptions.fallbackToBody
|
|
2992
3079
|
};
|
|
2993
|
-
const selector =
|
|
3080
|
+
const selector = Ne(n, seqlGeneratorOptions);
|
|
2994
3081
|
if (selector) {
|
|
2995
3082
|
serializedNode.selector = selector;
|
|
2996
3083
|
}
|