@appsurify-testmap/rrweb 2.1.3-alpha.4 → 3.1.1-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.cjs +1415 -176
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.js +1415 -176
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +1453 -182
- package/dist/rrweb.umd.cjs.map +3 -3
- package/dist/rrweb.umd.min.cjs +36 -36
- package/dist/rrweb.umd.min.cjs.map +3 -3
- package/package.json +5 -5
package/dist/rrweb.umd.cjs
CHANGED
|
@@ -352,6 +352,8 @@ function stringifyRule(rule2, sheetHref) {
|
|
|
352
352
|
return importStringified;
|
|
353
353
|
} else {
|
|
354
354
|
let ruleStringified = rule2.cssText;
|
|
355
|
+
if (rule2.type === CSSRule.KEYFRAMES_RULE || rule2.type === CSSRule.KEYFRAME_RULE)
|
|
356
|
+
;
|
|
355
357
|
if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
|
|
356
358
|
ruleStringified = fixSafariColons(ruleStringified);
|
|
357
359
|
}
|
|
@@ -580,19 +582,19 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
580
582
|
_testNoPxNorm
|
|
581
583
|
);
|
|
582
584
|
const jLimit = 100;
|
|
583
|
-
let
|
|
584
|
-
for (;
|
|
585
|
+
let j2 = 3;
|
|
586
|
+
for (; j2 < textContentNorm.length; j2++) {
|
|
585
587
|
if (
|
|
586
588
|
// keep consuming css identifiers (to get a decent chunk more quickly)
|
|
587
|
-
textContentNorm[
|
|
588
|
-
textContentNorm.indexOf(textContentNorm.substring(0,
|
|
589
|
+
textContentNorm[j2].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
|
|
590
|
+
textContentNorm.indexOf(textContentNorm.substring(0, j2), 1) !== -1
|
|
589
591
|
) {
|
|
590
592
|
continue;
|
|
591
593
|
}
|
|
592
594
|
break;
|
|
593
595
|
}
|
|
594
|
-
for (;
|
|
595
|
-
let startSubstring = textContentNorm.substring(0,
|
|
596
|
+
for (; j2 < textContentNorm.length; j2++) {
|
|
597
|
+
let startSubstring = textContentNorm.substring(0, j2);
|
|
596
598
|
let cssNormSplits = cssTextNorm.split(startSubstring);
|
|
597
599
|
let splitNorm = -1;
|
|
598
600
|
if (cssNormSplits.length === 2) {
|
|
@@ -609,11 +611,11 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
609
611
|
splits.push(cssText);
|
|
610
612
|
return splits;
|
|
611
613
|
}
|
|
612
|
-
|
|
613
|
-
} else if (
|
|
614
|
+
j2 = jLimit + 1;
|
|
615
|
+
} else if (j2 === textContentNorm.length - 1) {
|
|
614
616
|
splitNorm = cssTextNorm.indexOf(startSubstring);
|
|
615
617
|
}
|
|
616
|
-
if (cssNormSplits.length >= 2 &&
|
|
618
|
+
if (cssNormSplits.length >= 2 && j2 > jLimit) {
|
|
617
619
|
const prevTextContent = childNodes2[i2 - 1].textContent;
|
|
618
620
|
if (prevTextContent && typeof prevTextContent === "string") {
|
|
619
621
|
const prevMinLength = normalizeCssString(prevTextContent).length;
|
|
@@ -624,29 +626,29 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
624
626
|
}
|
|
625
627
|
}
|
|
626
628
|
if (splitNorm !== -1) {
|
|
627
|
-
let
|
|
628
|
-
for (;
|
|
629
|
+
let k2 = Math.floor(splitNorm / normFactor);
|
|
630
|
+
for (; k2 > 0 && k2 < cssText.length; ) {
|
|
629
631
|
iterCount += 1;
|
|
630
632
|
if (iterCount > 50 * childNodes2.length) {
|
|
631
633
|
splits.push(cssText);
|
|
632
634
|
return splits;
|
|
633
635
|
}
|
|
634
636
|
const normPart = normalizeCssString(
|
|
635
|
-
cssText.substring(0,
|
|
637
|
+
cssText.substring(0, k2),
|
|
636
638
|
_testNoPxNorm
|
|
637
639
|
);
|
|
638
640
|
if (normPart.length === splitNorm) {
|
|
639
|
-
splits.push(cssText.substring(0,
|
|
640
|
-
cssText = cssText.substring(
|
|
641
|
+
splits.push(cssText.substring(0, k2));
|
|
642
|
+
cssText = cssText.substring(k2);
|
|
641
643
|
cssTextNorm = cssTextNorm.substring(splitNorm);
|
|
642
644
|
break;
|
|
643
645
|
} else if (normPart.length < splitNorm) {
|
|
644
|
-
|
|
646
|
+
k2 += Math.max(
|
|
645
647
|
1,
|
|
646
648
|
Math.floor((splitNorm - normPart.length) / normFactor)
|
|
647
649
|
);
|
|
648
650
|
} else {
|
|
649
|
-
|
|
651
|
+
k2 -= Math.max(
|
|
650
652
|
1,
|
|
651
653
|
Math.floor((normPart.length - splitNorm) * normFactor)
|
|
652
654
|
);
|
|
@@ -664,102 +666,6 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
664
666
|
function markCssSplits(cssText, style) {
|
|
665
667
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
666
668
|
}
|
|
667
|
-
function isSelectorUnique(selector, target) {
|
|
668
|
-
try {
|
|
669
|
-
const matches = document.querySelectorAll(selector);
|
|
670
|
-
return matches.length === 1 && matches[0] === target;
|
|
671
|
-
} catch (e2) {
|
|
672
|
-
return false;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
function buildSelector(node2) {
|
|
676
|
-
if (!(node2 instanceof Element))
|
|
677
|
-
return null;
|
|
678
|
-
if (node2.id) {
|
|
679
|
-
return `#${CSS.escape(node2.id)}`;
|
|
680
|
-
}
|
|
681
|
-
const parts = [];
|
|
682
|
-
const tag = node2.tagName.toLowerCase();
|
|
683
|
-
if (node2.classList.length) {
|
|
684
|
-
parts.push(...Array.from(node2.classList).map((cls) => `.${CSS.escape(cls)}`));
|
|
685
|
-
}
|
|
686
|
-
Array.from(node2.attributes).forEach((attr) => {
|
|
687
|
-
if (attr.name.startsWith("data-")) {
|
|
688
|
-
parts.push(`[${attr.name}="${CSS.escape(attr.value)}"]`);
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
const shortSelector = `${tag}${parts.join("")}`;
|
|
692
|
-
if (isSelectorUnique(shortSelector, node2)) {
|
|
693
|
-
return shortSelector;
|
|
694
|
-
}
|
|
695
|
-
const pathParts = [];
|
|
696
|
-
let current = node2;
|
|
697
|
-
while (current && current.nodeType === Node.ELEMENT_NODE) {
|
|
698
|
-
const parent = current.parentElement;
|
|
699
|
-
const tagName = current.tagName.toLowerCase();
|
|
700
|
-
let nth = "";
|
|
701
|
-
if (parent) {
|
|
702
|
-
const siblings = Array.from(parent.children).filter(
|
|
703
|
-
(el) => el.tagName.toLowerCase() === tagName
|
|
704
|
-
);
|
|
705
|
-
if (siblings.length > 1) {
|
|
706
|
-
nth = `:nth-of-type(${siblings.indexOf(current) + 1})`;
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
pathParts.unshift(`${tagName}${nth}`);
|
|
710
|
-
current = parent;
|
|
711
|
-
}
|
|
712
|
-
return pathParts.join(" > ") || null;
|
|
713
|
-
}
|
|
714
|
-
function buildXPath(node2) {
|
|
715
|
-
switch (node2.nodeType) {
|
|
716
|
-
case Node.DOCUMENT_NODE:
|
|
717
|
-
return "/";
|
|
718
|
-
case Node.DOCUMENT_TYPE_NODE:
|
|
719
|
-
return "/html/doctype";
|
|
720
|
-
case Node.ELEMENT_NODE: {
|
|
721
|
-
const element = node2;
|
|
722
|
-
if (element.id) {
|
|
723
|
-
return `//*[@id="${CSS.escape(element.id)}"]`;
|
|
724
|
-
}
|
|
725
|
-
if (element.tagName.toLowerCase() === "html")
|
|
726
|
-
return "/html";
|
|
727
|
-
if (element === document.head)
|
|
728
|
-
return "/html/head";
|
|
729
|
-
if (element === document.body)
|
|
730
|
-
return "/html/body";
|
|
731
|
-
const parent = element.parentNode;
|
|
732
|
-
if (!parent)
|
|
733
|
-
return "";
|
|
734
|
-
const tag = element.tagName.toLowerCase();
|
|
735
|
-
const siblings = Array.from(parent.children).filter(
|
|
736
|
-
(el) => el.tagName.toLowerCase() === tag
|
|
737
|
-
);
|
|
738
|
-
const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
|
|
739
|
-
return `${buildXPath(parent)}/${tag}${index2}`;
|
|
740
|
-
}
|
|
741
|
-
case Node.TEXT_NODE:
|
|
742
|
-
case Node.CDATA_SECTION_NODE:
|
|
743
|
-
case Node.COMMENT_NODE: {
|
|
744
|
-
const parent = node2.parentNode;
|
|
745
|
-
if (!parent)
|
|
746
|
-
return "";
|
|
747
|
-
const typeMap = {
|
|
748
|
-
[Node.TEXT_NODE]: "text()",
|
|
749
|
-
[Node.CDATA_SECTION_NODE]: "text()",
|
|
750
|
-
// CDATA ≡ text() в XPath
|
|
751
|
-
[Node.COMMENT_NODE]: "comment()"
|
|
752
|
-
};
|
|
753
|
-
const sameTypeSiblings = Array.from(parent.childNodes).filter(
|
|
754
|
-
(sibling) => sibling.nodeType === node2.nodeType
|
|
755
|
-
);
|
|
756
|
-
const index2 = sameTypeSiblings.length > 1 ? `[${sameTypeSiblings.indexOf(node2)}]` : "";
|
|
757
|
-
return `${buildXPath(parent)}/${typeMap[node2.nodeType]}${index2}`;
|
|
758
|
-
}
|
|
759
|
-
default:
|
|
760
|
-
return "";
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
669
|
function isTextVisible(n2) {
|
|
764
670
|
var _a2;
|
|
765
671
|
const parent = index$1.parentNode(n2);
|
|
@@ -892,6 +798,1309 @@ try {
|
|
|
892
798
|
}
|
|
893
799
|
} catch (error) {
|
|
894
800
|
}
|
|
801
|
+
const L = {
|
|
802
|
+
ANCHOR: 0.4,
|
|
803
|
+
PATH: 0.3,
|
|
804
|
+
TARGET: 0.2,
|
|
805
|
+
UNIQUENESS: 0.1
|
|
806
|
+
};
|
|
807
|
+
const I = {
|
|
808
|
+
SEMANTIC_TAG: 0.5,
|
|
809
|
+
ROLE: 0.3,
|
|
810
|
+
ARIA_LABEL: 0.1,
|
|
811
|
+
STABLE_ID: 0.1,
|
|
812
|
+
TEST_MARKER: 0.05,
|
|
813
|
+
DEPTH_PENALTY_THRESHOLD: 5,
|
|
814
|
+
DEPTH_PENALTY_FACTOR: 0.05,
|
|
815
|
+
DEGRADED_SCORE: 0.3
|
|
816
|
+
};
|
|
817
|
+
const ct = {
|
|
818
|
+
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
819
|
+
};
|
|
820
|
+
const X = [
|
|
821
|
+
"form",
|
|
822
|
+
"main",
|
|
823
|
+
"nav",
|
|
824
|
+
"section",
|
|
825
|
+
"article",
|
|
826
|
+
"footer",
|
|
827
|
+
"header"
|
|
828
|
+
];
|
|
829
|
+
const K = [
|
|
830
|
+
"form",
|
|
831
|
+
"navigation",
|
|
832
|
+
"main",
|
|
833
|
+
"region",
|
|
834
|
+
"contentinfo",
|
|
835
|
+
"complementary",
|
|
836
|
+
"banner",
|
|
837
|
+
"search"
|
|
838
|
+
];
|
|
839
|
+
const lt = [
|
|
840
|
+
// HTML5 Semantic
|
|
841
|
+
"article",
|
|
842
|
+
"aside",
|
|
843
|
+
"details",
|
|
844
|
+
"figcaption",
|
|
845
|
+
"figure",
|
|
846
|
+
"footer",
|
|
847
|
+
"header",
|
|
848
|
+
"main",
|
|
849
|
+
"mark",
|
|
850
|
+
"nav",
|
|
851
|
+
"section",
|
|
852
|
+
"summary",
|
|
853
|
+
"time",
|
|
854
|
+
// Form elements
|
|
855
|
+
"button",
|
|
856
|
+
"datalist",
|
|
857
|
+
"fieldset",
|
|
858
|
+
"form",
|
|
859
|
+
"input",
|
|
860
|
+
"label",
|
|
861
|
+
"legend",
|
|
862
|
+
"meter",
|
|
863
|
+
"optgroup",
|
|
864
|
+
"option",
|
|
865
|
+
"output",
|
|
866
|
+
"progress",
|
|
867
|
+
"select",
|
|
868
|
+
"textarea",
|
|
869
|
+
// Interactive
|
|
870
|
+
"a",
|
|
871
|
+
"audio",
|
|
872
|
+
"video",
|
|
873
|
+
"canvas",
|
|
874
|
+
"dialog",
|
|
875
|
+
"menu",
|
|
876
|
+
// Text content
|
|
877
|
+
"blockquote",
|
|
878
|
+
"dd",
|
|
879
|
+
"dl",
|
|
880
|
+
"dt",
|
|
881
|
+
"hr",
|
|
882
|
+
"li",
|
|
883
|
+
"ol",
|
|
884
|
+
"ul",
|
|
885
|
+
"p",
|
|
886
|
+
"pre",
|
|
887
|
+
"h1",
|
|
888
|
+
"h2",
|
|
889
|
+
"h3",
|
|
890
|
+
"h4",
|
|
891
|
+
"h5",
|
|
892
|
+
"h6",
|
|
893
|
+
// Table
|
|
894
|
+
"caption",
|
|
895
|
+
"col",
|
|
896
|
+
"colgroup",
|
|
897
|
+
"table",
|
|
898
|
+
"tbody",
|
|
899
|
+
"td",
|
|
900
|
+
"tfoot",
|
|
901
|
+
"th",
|
|
902
|
+
"thead",
|
|
903
|
+
"tr",
|
|
904
|
+
// SVG
|
|
905
|
+
"svg",
|
|
906
|
+
"path",
|
|
907
|
+
"circle",
|
|
908
|
+
"rect",
|
|
909
|
+
"line",
|
|
910
|
+
"polyline",
|
|
911
|
+
"polygon",
|
|
912
|
+
"ellipse",
|
|
913
|
+
"g",
|
|
914
|
+
"text",
|
|
915
|
+
"use"
|
|
916
|
+
];
|
|
917
|
+
const w = {
|
|
918
|
+
// Test attributes (highest priority)
|
|
919
|
+
"data-testid": 100,
|
|
920
|
+
"data-qa": 99,
|
|
921
|
+
"data-cy": 98,
|
|
922
|
+
"data-test": 97,
|
|
923
|
+
"data-test-id": 96,
|
|
924
|
+
// ARIA (accessibility semantics)
|
|
925
|
+
"aria-label": 90,
|
|
926
|
+
"aria-labelledby": 85,
|
|
927
|
+
"aria-describedby": 80,
|
|
928
|
+
// Semantic HTML attributes
|
|
929
|
+
name: 75,
|
|
930
|
+
href: 70,
|
|
931
|
+
// for <a>
|
|
932
|
+
src: 70,
|
|
933
|
+
// for <img>, <script>, etc.
|
|
934
|
+
type: 65,
|
|
935
|
+
role: 60,
|
|
936
|
+
alt: 55,
|
|
937
|
+
title: 50,
|
|
938
|
+
for: 45,
|
|
939
|
+
placeholder: 40,
|
|
940
|
+
// Any data-* attribute (if not above)
|
|
941
|
+
"data-*": 30,
|
|
942
|
+
// Any aria-* attribute (if not above)
|
|
943
|
+
"aria-*": 25
|
|
944
|
+
};
|
|
945
|
+
const B = /* @__PURE__ */ new Set([
|
|
946
|
+
"id",
|
|
947
|
+
// handled separately
|
|
948
|
+
"class",
|
|
949
|
+
// handled separately
|
|
950
|
+
"style",
|
|
951
|
+
// unstable
|
|
952
|
+
"xmlns",
|
|
953
|
+
// service attribute for SVG
|
|
954
|
+
"tabindex",
|
|
955
|
+
// can change
|
|
956
|
+
"contenteditable"
|
|
957
|
+
]);
|
|
958
|
+
const ut = {
|
|
959
|
+
maxPathDepth: 10,
|
|
960
|
+
enableSvgFingerprint: true,
|
|
961
|
+
confidenceThreshold: 0.1,
|
|
962
|
+
fallbackToBody: true,
|
|
963
|
+
includeUtilityClasses: false,
|
|
964
|
+
source: "dom-dsl"
|
|
965
|
+
};
|
|
966
|
+
function D(n2) {
|
|
967
|
+
return !!(/^[a-z]+-\d+$/i.test(n2) || /^[a-z]+(-[a-z]+)+-\d+$/i.test(n2) || /^[a-z]+(_[a-z]+)*_\d+$/i.test(n2) || /^\d+$/.test(n2) || /^:[a-z0-9]+:$/i.test(n2) || /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i.test(n2) || /^[a-z]{1,3}[A-Za-z0-9]{8,}$/.test(n2) && (/\d/.test(n2) || /[A-Z]/.test(n2)) || /^radix-/.test(n2) || /^mui-\d+$/.test(n2));
|
|
968
|
+
}
|
|
969
|
+
const G = /* @__PURE__ */ new Set([
|
|
970
|
+
"aria-labelledby",
|
|
971
|
+
"aria-describedby",
|
|
972
|
+
"aria-controls",
|
|
973
|
+
"aria-owns",
|
|
974
|
+
"aria-activedescendant",
|
|
975
|
+
"for",
|
|
976
|
+
"form",
|
|
977
|
+
"list",
|
|
978
|
+
"headers",
|
|
979
|
+
"aria-details",
|
|
980
|
+
"aria-errormessage",
|
|
981
|
+
"aria-flowto"
|
|
982
|
+
]);
|
|
983
|
+
function V(n2) {
|
|
984
|
+
return n2.trim().split(/\s+/).some((e2) => D(e2));
|
|
985
|
+
}
|
|
986
|
+
class ft {
|
|
987
|
+
constructor(t2, e2) {
|
|
988
|
+
var _a2;
|
|
989
|
+
this.maxDepth = (_a2 = t2.maxPathDepth) != null ? _a2 : 10, this.cache = e2;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Finds the best anchor element for the target
|
|
993
|
+
* @param target - Target element to find anchor for
|
|
994
|
+
* @returns Anchor result or null if not found
|
|
995
|
+
*/
|
|
996
|
+
findAnchor(t2) {
|
|
997
|
+
if (this.cache) {
|
|
998
|
+
const i2 = this.cache.getAnchor(t2);
|
|
999
|
+
if (i2 !== void 0)
|
|
1000
|
+
return i2;
|
|
1001
|
+
}
|
|
1002
|
+
let e2 = t2.parentElement, s2 = 0, r2 = null;
|
|
1003
|
+
for (; e2 && s2 < this.maxDepth; ) {
|
|
1004
|
+
if (e2.tagName.toLowerCase() === "body")
|
|
1005
|
+
return r2 || {
|
|
1006
|
+
element: e2,
|
|
1007
|
+
score: I.DEGRADED_SCORE,
|
|
1008
|
+
tier: "C",
|
|
1009
|
+
depth: s2
|
|
1010
|
+
};
|
|
1011
|
+
const i2 = this.scoreAnchor(e2);
|
|
1012
|
+
if (i2 > 0) {
|
|
1013
|
+
const o2 = this.applyDepthPenalty(i2, s2), l2 = this.getTier(e2), u2 = { element: e2, score: o2, tier: l2, depth: s2 };
|
|
1014
|
+
if (l2 === "A")
|
|
1015
|
+
return u2;
|
|
1016
|
+
(!r2 || o2 > r2.score) && (r2 = u2);
|
|
1017
|
+
}
|
|
1018
|
+
e2 = e2.parentElement, s2++;
|
|
1019
|
+
}
|
|
1020
|
+
const a2 = r2;
|
|
1021
|
+
return this.cache && this.cache.setAnchor(t2, a2), a2;
|
|
1022
|
+
}
|
|
1023
|
+
/**
|
|
1024
|
+
* Scores an element as anchor candidate (without depth penalty)
|
|
1025
|
+
* @param element - Element to score
|
|
1026
|
+
* @returns Raw score from 0 to 1
|
|
1027
|
+
*/
|
|
1028
|
+
scoreAnchor(t2) {
|
|
1029
|
+
let e2 = 0;
|
|
1030
|
+
const s2 = t2.tagName.toLowerCase();
|
|
1031
|
+
X.includes(s2) && (e2 += I.SEMANTIC_TAG);
|
|
1032
|
+
const r2 = t2.getAttribute("role");
|
|
1033
|
+
r2 && K.includes(r2) && (e2 += I.ROLE), (t2.hasAttribute("aria-label") || t2.hasAttribute("aria-labelledby")) && (e2 += I.ARIA_LABEL);
|
|
1034
|
+
const a2 = t2.id;
|
|
1035
|
+
return a2 && !D(a2) && (e2 += I.STABLE_ID), (t2.hasAttribute("data-testid") || t2.hasAttribute("data-qa") || t2.hasAttribute("data-test")) && (e2 += I.TEST_MARKER), Math.min(e2, 1);
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Applies depth penalty to score
|
|
1039
|
+
* Following SPECIFICATION.md §7: depthPenalty = (depth - threshold) * factor
|
|
1040
|
+
*/
|
|
1041
|
+
applyDepthPenalty(t2, e2) {
|
|
1042
|
+
if (e2 <= I.DEPTH_PENALTY_THRESHOLD)
|
|
1043
|
+
return t2;
|
|
1044
|
+
const s2 = (e2 - I.DEPTH_PENALTY_THRESHOLD) * I.DEPTH_PENALTY_FACTOR;
|
|
1045
|
+
return Math.max(0, t2 - s2);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Determines the tier of an anchor element
|
|
1049
|
+
*/
|
|
1050
|
+
getTier(t2) {
|
|
1051
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1052
|
+
if (X.includes(e2))
|
|
1053
|
+
return "A";
|
|
1054
|
+
const s2 = t2.getAttribute("role");
|
|
1055
|
+
return s2 && K.includes(s2) ? "B" : "C";
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
const gt = [
|
|
1059
|
+
// CSS-in-JS
|
|
1060
|
+
/^css-[a-z0-9]+$/i,
|
|
1061
|
+
/^sc-[a-z0-9]+-\d+$/i,
|
|
1062
|
+
/^[a-z]{5,8}$/i,
|
|
1063
|
+
// Short generated classes (abcdef)
|
|
1064
|
+
// Material-UI / MUI
|
|
1065
|
+
/^Mui[A-Z]\w+-\w+-\w+/,
|
|
1066
|
+
/^makeStyles-\w+-\d+$/,
|
|
1067
|
+
// JSS
|
|
1068
|
+
/^jss\d+$/,
|
|
1069
|
+
// Emotion / Linaria
|
|
1070
|
+
/^(emotion|linaria)-[a-z0-9]+/i,
|
|
1071
|
+
// Component libraries with hashes
|
|
1072
|
+
/^(chakra|tw-|ant-)[a-z0-9]+-\w+/i,
|
|
1073
|
+
// Hash-based (hashes in classes)
|
|
1074
|
+
/-[a-f0-9]{6,}$/i,
|
|
1075
|
+
/^_[a-z0-9]{5,}$/i,
|
|
1076
|
+
/\d{5,}/
|
|
1077
|
+
// 5+ digits in a row
|
|
1078
|
+
];
|
|
1079
|
+
const pt = [
|
|
1080
|
+
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1081
|
+
/^\[/,
|
|
1082
|
+
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
1083
|
+
// === FIX 4: Pseudo-class variants (must be before specific patterns) ===
|
|
1084
|
+
/^(first|last|odd|even|only|first-of-type|last-of-type|only-of-type):/,
|
|
1085
|
+
// first:, last:, etc.
|
|
1086
|
+
/^(hover|focus|active|disabled|enabled|checked|indeterminate|default|required|valid|invalid|in-range|out-of-range|placeholder-shown|autofill|read-only):/,
|
|
1087
|
+
// State pseudo-classes
|
|
1088
|
+
/^(focus-within|focus-visible|visited|target|open):/,
|
|
1089
|
+
// Advanced pseudo-classes
|
|
1090
|
+
// === FIX 4: Responsive variants (must be before specific patterns) ===
|
|
1091
|
+
/^(sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl):/,
|
|
1092
|
+
// === FIX 4: Dark mode and directional variants ===
|
|
1093
|
+
/^dark:/,
|
|
1094
|
+
/^(rtl|ltr):/,
|
|
1095
|
+
// === FIX 4: Group and peer variants ===
|
|
1096
|
+
/^(group|peer)(-hover|-focus|-active)?:/,
|
|
1097
|
+
// === FIX 4: Tailwind utilities with fraction values ===
|
|
1098
|
+
/\/([\d.]+|full|auto|screen)$/,
|
|
1099
|
+
// /50, /100, /full, /auto, /screen
|
|
1100
|
+
// === FIX 4: Positioning utilities ===
|
|
1101
|
+
/^(inset|top|right|bottom|left)(-|$)/,
|
|
1102
|
+
// inset-0, top-0, left-0
|
|
1103
|
+
// === Layout & Display ===
|
|
1104
|
+
/^(flex|inline-flex|grid|block|inline|inline-block|hidden|visible)$/,
|
|
1105
|
+
/^(absolute|relative|fixed|sticky|static)$/,
|
|
1106
|
+
// === Flexbox & Grid ===
|
|
1107
|
+
/^(items|justify|content|self|place)-/,
|
|
1108
|
+
/^flex-(row|col|wrap|nowrap|1|auto|initial|none)/,
|
|
1109
|
+
/^grid-(cols|rows|flow)/,
|
|
1110
|
+
// === Spacing (Tailwind) ===
|
|
1111
|
+
/^(gap|space)-/,
|
|
1112
|
+
/^[mp][trblxy]?-(\d+|auto|px)$/,
|
|
1113
|
+
// === Negative Tailwind utilities (margins, positioning, transforms) ===
|
|
1114
|
+
/^-[mp][trblxy]?-\d+$/,
|
|
1115
|
+
// -m-4, -mt-2, -mx-4, -px-4, -py-2
|
|
1116
|
+
/^-(top|right|bottom|left|inset)-\d+$/,
|
|
1117
|
+
// -top-4, -bottom-6, -left-6, -inset-0
|
|
1118
|
+
/^-z-\d+$/,
|
|
1119
|
+
// -z-10, -z-20
|
|
1120
|
+
/^-space-[xy]-\d+$/,
|
|
1121
|
+
// -space-x-2, -space-y-4
|
|
1122
|
+
/^-translate-[xy]-\d+$/,
|
|
1123
|
+
// -translate-x-4, -translate-y-2
|
|
1124
|
+
/^-rotate-\d+$/,
|
|
1125
|
+
// -rotate-45, -rotate-90
|
|
1126
|
+
/^-scale-\d+$/,
|
|
1127
|
+
// -scale-50, -scale-75
|
|
1128
|
+
/^-skew-[xy]-\d+$/,
|
|
1129
|
+
// -skew-x-12, -skew-y-6
|
|
1130
|
+
// === Sizing ===
|
|
1131
|
+
/^(w|h|min-w|min-h|max-w|max-h|size)-/,
|
|
1132
|
+
// === Colors & Styling ===
|
|
1133
|
+
// Note: text-* can be semantic (text-muted, text-primary) or utility (text-center, text-lg)
|
|
1134
|
+
// More specific patterns for utility text-* classes
|
|
1135
|
+
/^text-(center|left|right|justify|start|end|xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/,
|
|
1136
|
+
/^text-(uppercase|lowercase|capitalize|normal-case|underline|line-through|no-underline)$/,
|
|
1137
|
+
/^text-(truncate|ellipsis|clip)$/,
|
|
1138
|
+
/^(bg|border|ring|shadow|outline)-/,
|
|
1139
|
+
/^rounded(-|$)/,
|
|
1140
|
+
// === Typography ===
|
|
1141
|
+
/^(font|leading|tracking|whitespace|break|truncate)-/,
|
|
1142
|
+
/^(uppercase|lowercase|capitalize|normal-case)$/,
|
|
1143
|
+
// === Transform & Animation (IMPORTANT!) ===
|
|
1144
|
+
/^(transform|transition|duration|delay|ease|animate)-/,
|
|
1145
|
+
/^(scale|rotate|translate|skew)-/,
|
|
1146
|
+
/^transform$/,
|
|
1147
|
+
/^backdrop-blur-/,
|
|
1148
|
+
/^motion-/,
|
|
1149
|
+
// Framer Motion
|
|
1150
|
+
/^(fade|slide|zoom|bounce|pulse|spin|ping)-/,
|
|
1151
|
+
// animations
|
|
1152
|
+
// === Overflow & Scrolling ===
|
|
1153
|
+
/^(overflow|overscroll|scroll)-/,
|
|
1154
|
+
/^object-(contain|cover|fill|none|scale-down)$/,
|
|
1155
|
+
// === Interactivity ===
|
|
1156
|
+
/^(cursor|pointer-events|select|resize)-/,
|
|
1157
|
+
// === Visibility & Opacity ===
|
|
1158
|
+
/^(opacity|z)-/,
|
|
1159
|
+
/^(visible|invisible|collapse)$/,
|
|
1160
|
+
// === Bootstrap utilities ===
|
|
1161
|
+
/^d-(none|inline|inline-block|block|grid|table|flex)$/,
|
|
1162
|
+
/^(float|clearfix|text)-(left|right|center|justify|start|end)$/,
|
|
1163
|
+
/^(m|p)[trblxy]?-[0-5]$/,
|
|
1164
|
+
/^(w|h)-(25|50|75|100|auto)$/,
|
|
1165
|
+
// Note: btn-* classes are semantic (component classes), not utility
|
|
1166
|
+
// /^btn-(primary|secondary|success|danger|warning|info|light|dark|link)$/,
|
|
1167
|
+
/^btn-(sm|lg|block)$/,
|
|
1168
|
+
// Only size modifiers are utility
|
|
1169
|
+
/^text-(muted|primary|success|danger|warning|info|light|dark|white)$/,
|
|
1170
|
+
/^bg-(primary|secondary|success|danger|warning|info|light|dark|white|transparent)$/,
|
|
1171
|
+
/^border(-top|-bottom|-left|-right)?(-0)?$/,
|
|
1172
|
+
/^rounded(-top|-bottom|-left|-right|-circle|-pill|-0)?$/,
|
|
1173
|
+
/^shadow(-sm|-lg|-none)?$/,
|
|
1174
|
+
/^(align|justify|order|flex)-(start|end|center|between|around|fill|grow|shrink)$/,
|
|
1175
|
+
/^col(-sm|-md|-lg|-xl)?(-\d+|-auto)?$/,
|
|
1176
|
+
/^row(-cols)?(-\d+)?$/,
|
|
1177
|
+
/^g[xy]?-[0-5]$/,
|
|
1178
|
+
/^(show|hide|invisible|visible)$/,
|
|
1179
|
+
/^(position|top|bottom|start|end)-(static|relative|absolute|fixed|sticky|-\d+)$/,
|
|
1180
|
+
// === Common utility patterns ===
|
|
1181
|
+
/^(row|col)$/,
|
|
1182
|
+
/^clearfix$/,
|
|
1183
|
+
/^pull-(left|right)$/,
|
|
1184
|
+
/^float-(left|right|none)$/
|
|
1185
|
+
];
|
|
1186
|
+
function _(n2) {
|
|
1187
|
+
return gt.some((t2) => t2.test(n2));
|
|
1188
|
+
}
|
|
1189
|
+
function q(n2) {
|
|
1190
|
+
return n2.length <= 2 || /^\d/.test(n2) ? true : pt.some((t2) => t2.test(n2));
|
|
1191
|
+
}
|
|
1192
|
+
function St(n2) {
|
|
1193
|
+
return !_(n2) && !q(n2);
|
|
1194
|
+
}
|
|
1195
|
+
function N(n2) {
|
|
1196
|
+
return n2.filter((t2) => St(t2));
|
|
1197
|
+
}
|
|
1198
|
+
function At(n2) {
|
|
1199
|
+
const t2 = [], e2 = [];
|
|
1200
|
+
for (const s2 of n2)
|
|
1201
|
+
q(s2) || _(s2) ? e2.push(s2) : t2.push(s2);
|
|
1202
|
+
return { semantic: t2, utility: e2 };
|
|
1203
|
+
}
|
|
1204
|
+
function J(n2) {
|
|
1205
|
+
return q(n2) || _(n2);
|
|
1206
|
+
}
|
|
1207
|
+
const tt = (n2) => n2.replace(/([#:.[\]@])/g, "\\$1");
|
|
1208
|
+
class xt {
|
|
1209
|
+
constructor(t2, e2) {
|
|
1210
|
+
var _a2;
|
|
1211
|
+
this.maxDepth = (_a2 = t2.maxPathDepth) != null ? _a2 : 10, this.cache = e2;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Builds path from anchor to target (excluding both)
|
|
1215
|
+
* @param anchor - Anchor element (start)
|
|
1216
|
+
* @param target - Target element (end)
|
|
1217
|
+
* @param extractor - Semantic extractor instance
|
|
1218
|
+
* @returns Path build result with nodes and degradation info
|
|
1219
|
+
*/
|
|
1220
|
+
buildPath(t2, e2, s2) {
|
|
1221
|
+
const r2 = [];
|
|
1222
|
+
let a2 = e2.parentElement;
|
|
1223
|
+
for (; a2 && a2 !== t2 && r2.length < this.maxDepth; )
|
|
1224
|
+
r2.unshift(a2), a2 = a2.parentElement;
|
|
1225
|
+
const i2 = r2.length >= this.maxDepth && a2 !== t2;
|
|
1226
|
+
let o2 = this.filterNoise(r2);
|
|
1227
|
+
return o2 = this.ensureUniqueness(r2, o2, t2, e2, s2), {
|
|
1228
|
+
path: o2.map((u2) => {
|
|
1229
|
+
const d = u2.parentElement;
|
|
1230
|
+
let c2;
|
|
1231
|
+
if (d) {
|
|
1232
|
+
const g = Array.from(d.children).indexOf(u2);
|
|
1233
|
+
g !== -1 && (c2 = g + 1);
|
|
1234
|
+
}
|
|
1235
|
+
return {
|
|
1236
|
+
tag: u2.tagName.toLowerCase(),
|
|
1237
|
+
semantics: s2.extract(u2),
|
|
1238
|
+
score: s2.scoreElement(u2),
|
|
1239
|
+
nthChild: c2
|
|
1240
|
+
};
|
|
1241
|
+
}),
|
|
1242
|
+
degraded: i2,
|
|
1243
|
+
degradationReason: i2 ? "path-depth-overflow" : void 0
|
|
1244
|
+
};
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Legacy method for backward compatibility
|
|
1248
|
+
*/
|
|
1249
|
+
buildPathNodes(t2, e2, s2) {
|
|
1250
|
+
return this.buildPath(t2, e2, s2).path;
|
|
1251
|
+
}
|
|
1252
|
+
/**
|
|
1253
|
+
* Ensures path uniqueness by adding nodes if needed
|
|
1254
|
+
* Following SPECIFICATION.md §8 Disambiguation Algorithm
|
|
1255
|
+
*/
|
|
1256
|
+
ensureUniqueness(t2, e2, s2, r2, a2) {
|
|
1257
|
+
const i2 = this.buildTestSelector(s2, e2, r2);
|
|
1258
|
+
try {
|
|
1259
|
+
const o2 = r2.ownerDocument;
|
|
1260
|
+
if (!o2)
|
|
1261
|
+
return e2;
|
|
1262
|
+
let l2;
|
|
1263
|
+
if (this.cache) {
|
|
1264
|
+
const d = this.cache.getSelectorResults(i2);
|
|
1265
|
+
d !== void 0 ? l2 = d : (l2 = Array.from(o2.querySelectorAll(i2)), this.cache.setSelectorResults(i2, l2));
|
|
1266
|
+
} else
|
|
1267
|
+
l2 = o2.querySelectorAll(i2);
|
|
1268
|
+
if (l2.length <= 1)
|
|
1269
|
+
return e2;
|
|
1270
|
+
const u2 = t2.filter((d) => !e2.includes(d));
|
|
1271
|
+
for (const d of u2) {
|
|
1272
|
+
if (a2.scoreElement(d) < ct.MIN_CONFIDENCE_FOR_SKIP)
|
|
1273
|
+
continue;
|
|
1274
|
+
const h = this.insertNodeInOrder(e2, d, t2), g = this.buildTestSelector(s2, h, r2);
|
|
1275
|
+
try {
|
|
1276
|
+
let f2;
|
|
1277
|
+
if (this.cache) {
|
|
1278
|
+
const p = this.cache.getSelectorResults(g);
|
|
1279
|
+
p !== void 0 ? f2 = p : (f2 = Array.from(o2.querySelectorAll(g)), this.cache.setSelectorResults(g, f2));
|
|
1280
|
+
} else
|
|
1281
|
+
f2 = o2.querySelectorAll(g);
|
|
1282
|
+
if (f2.length === 1)
|
|
1283
|
+
return h;
|
|
1284
|
+
f2.length < l2.length && (e2 = h);
|
|
1285
|
+
} catch (e3) {
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
return e2;
|
|
1289
|
+
} catch (e3) {
|
|
1290
|
+
return e2;
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Inserts node into path maintaining original order
|
|
1295
|
+
*/
|
|
1296
|
+
insertNodeInOrder(t2, e2, s2) {
|
|
1297
|
+
const r2 = s2.indexOf(e2), a2 = [...t2];
|
|
1298
|
+
let i2 = 0;
|
|
1299
|
+
for (let o2 = 0; o2 < a2.length && !(s2.indexOf(a2[o2]) > r2); o2++)
|
|
1300
|
+
i2 = o2 + 1;
|
|
1301
|
+
return a2.splice(i2, 0, e2), a2;
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Builds a test CSS selector from path
|
|
1305
|
+
*/
|
|
1306
|
+
buildTestSelector(t2, e2, s2) {
|
|
1307
|
+
const r2 = [];
|
|
1308
|
+
r2.push(this.elementToSelector(t2));
|
|
1309
|
+
for (const a2 of e2)
|
|
1310
|
+
r2.push(this.elementToSelector(a2));
|
|
1311
|
+
return r2.push(this.elementToSelector(s2)), r2.join(" ");
|
|
1312
|
+
}
|
|
1313
|
+
/**
|
|
1314
|
+
* Converts element to basic CSS selector
|
|
1315
|
+
*/
|
|
1316
|
+
elementToSelector(t2) {
|
|
1317
|
+
let e2 = t2.tagName.toLowerCase();
|
|
1318
|
+
t2.id && !D(t2.id) && (e2 += `#${tt(t2.id)}`);
|
|
1319
|
+
for (const s2 of Array.from(t2.classList))
|
|
1320
|
+
J(s2) || (e2 += `.${tt(s2)}`);
|
|
1321
|
+
return e2;
|
|
1322
|
+
}
|
|
1323
|
+
/**
|
|
1324
|
+
* Filters out noise/layout elements
|
|
1325
|
+
*/
|
|
1326
|
+
filterNoise(t2) {
|
|
1327
|
+
return t2.filter((e2) => this.shouldInclude(e2));
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Determines if element should be included in path
|
|
1331
|
+
*/
|
|
1332
|
+
shouldInclude(t2) {
|
|
1333
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1334
|
+
return lt.includes(e2) ? true : e2 === "div" || e2 === "span" ? this.hasSemanticFeatures(t2) : false;
|
|
1335
|
+
}
|
|
1336
|
+
/**
|
|
1337
|
+
* Checks if element has meaningful semantic features
|
|
1338
|
+
*/
|
|
1339
|
+
hasSemanticFeatures(t2) {
|
|
1340
|
+
if (t2.hasAttribute("role"))
|
|
1341
|
+
return true;
|
|
1342
|
+
for (const s2 of Array.from(t2.attributes))
|
|
1343
|
+
if (s2.name.startsWith("aria-"))
|
|
1344
|
+
return true;
|
|
1345
|
+
if (t2.classList.length > 0) {
|
|
1346
|
+
for (const s2 of Array.from(t2.classList))
|
|
1347
|
+
if (!J(s2))
|
|
1348
|
+
return true;
|
|
1349
|
+
}
|
|
1350
|
+
if (t2.hasAttribute("data-testid") || t2.hasAttribute("data-qa") || t2.hasAttribute("data-test"))
|
|
1351
|
+
return true;
|
|
1352
|
+
const e2 = t2.id;
|
|
1353
|
+
return !!(e2 && !D(e2));
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
function Q(n2) {
|
|
1357
|
+
return n2 ? n2.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1358
|
+
}
|
|
1359
|
+
const Ct = {
|
|
1360
|
+
preserveQueryForAbsolute: true,
|
|
1361
|
+
removeDynamicHashes: true
|
|
1362
|
+
};
|
|
1363
|
+
function Tt(n2) {
|
|
1364
|
+
return n2 ? [
|
|
1365
|
+
/\d{5,}/,
|
|
1366
|
+
// 5+ digits
|
|
1367
|
+
/[a-f0-9]{8,}/i,
|
|
1368
|
+
// hex hash 8+ characters
|
|
1369
|
+
/(session|token|temp|random|timestamp|nonce|cache)/i,
|
|
1370
|
+
// dynamic words
|
|
1371
|
+
/^\d+$/,
|
|
1372
|
+
// only digits
|
|
1373
|
+
/^[a-f0-9-]{32,}$/i
|
|
1374
|
+
// UUID-like
|
|
1375
|
+
].some((e2) => e2.test(n2)) : false;
|
|
1376
|
+
}
|
|
1377
|
+
function Et(n2, t2) {
|
|
1378
|
+
if (!n2)
|
|
1379
|
+
return n2;
|
|
1380
|
+
const e2 = n2.startsWith("http://") || n2.startsWith("https://"), [s2, r2] = n2.split("#"), [a2, i2] = s2.split("?");
|
|
1381
|
+
let o2 = a2;
|
|
1382
|
+
return e2 && t2.preserveQueryForAbsolute && i2 && (o2 += `?${i2}`), r2 && (t2.removeDynamicHashes && Tt(r2) || (o2 += `#${r2}`)), o2;
|
|
1383
|
+
}
|
|
1384
|
+
function k(n2, t2, e2 = {}) {
|
|
1385
|
+
if (!t2)
|
|
1386
|
+
return t2;
|
|
1387
|
+
const s2 = __spreadValues(__spreadValues({}, Ct), e2);
|
|
1388
|
+
return n2 === "href" || n2 === "src" ? Et(t2, s2) : t2;
|
|
1389
|
+
}
|
|
1390
|
+
const wt = [
|
|
1391
|
+
"role",
|
|
1392
|
+
"aria-label",
|
|
1393
|
+
"aria-labelledby",
|
|
1394
|
+
"aria-describedby",
|
|
1395
|
+
"aria-controls",
|
|
1396
|
+
"aria-owns",
|
|
1397
|
+
"aria-level",
|
|
1398
|
+
"aria-posinset",
|
|
1399
|
+
"aria-setsize",
|
|
1400
|
+
"aria-haspopup"
|
|
1401
|
+
];
|
|
1402
|
+
const vt = [
|
|
1403
|
+
"aria-selected",
|
|
1404
|
+
"aria-checked",
|
|
1405
|
+
"aria-pressed",
|
|
1406
|
+
"aria-expanded",
|
|
1407
|
+
"aria-hidden",
|
|
1408
|
+
"aria-disabled",
|
|
1409
|
+
"aria-current",
|
|
1410
|
+
"aria-busy",
|
|
1411
|
+
"aria-invalid",
|
|
1412
|
+
"aria-grabbed",
|
|
1413
|
+
"aria-live",
|
|
1414
|
+
"aria-atomic"
|
|
1415
|
+
];
|
|
1416
|
+
const $t = [
|
|
1417
|
+
"data-state",
|
|
1418
|
+
"data-active",
|
|
1419
|
+
"data-inactive",
|
|
1420
|
+
"data-selected",
|
|
1421
|
+
"data-open",
|
|
1422
|
+
"data-closed",
|
|
1423
|
+
"data-visible",
|
|
1424
|
+
"data-hidden",
|
|
1425
|
+
"data-disabled",
|
|
1426
|
+
"data-enabled",
|
|
1427
|
+
"data-loading",
|
|
1428
|
+
"data-error",
|
|
1429
|
+
"data-success",
|
|
1430
|
+
"data-highlighted",
|
|
1431
|
+
"data-focused",
|
|
1432
|
+
"data-hover",
|
|
1433
|
+
"data-orientation",
|
|
1434
|
+
"data-theme"
|
|
1435
|
+
];
|
|
1436
|
+
const Mt = [
|
|
1437
|
+
"data-radix-",
|
|
1438
|
+
"data-headlessui-",
|
|
1439
|
+
"data-reach-",
|
|
1440
|
+
"data-mui-",
|
|
1441
|
+
"data-chakra-",
|
|
1442
|
+
"data-mantine-",
|
|
1443
|
+
"data-tw-"
|
|
1444
|
+
];
|
|
1445
|
+
const It = [
|
|
1446
|
+
"data-testid",
|
|
1447
|
+
"data-test-id",
|
|
1448
|
+
"data-test",
|
|
1449
|
+
"data-cy",
|
|
1450
|
+
"data-qa",
|
|
1451
|
+
"data-automation-id",
|
|
1452
|
+
"data-id",
|
|
1453
|
+
"data-component",
|
|
1454
|
+
"data-entity-id",
|
|
1455
|
+
"data-product-id",
|
|
1456
|
+
"data-user-id"
|
|
1457
|
+
];
|
|
1458
|
+
const Rt = [
|
|
1459
|
+
"id",
|
|
1460
|
+
"name",
|
|
1461
|
+
"type",
|
|
1462
|
+
"placeholder",
|
|
1463
|
+
"title",
|
|
1464
|
+
"for",
|
|
1465
|
+
"alt",
|
|
1466
|
+
"href"
|
|
1467
|
+
];
|
|
1468
|
+
const Nt = [
|
|
1469
|
+
"disabled",
|
|
1470
|
+
"checked",
|
|
1471
|
+
"selected",
|
|
1472
|
+
"hidden",
|
|
1473
|
+
"readonly",
|
|
1474
|
+
"required",
|
|
1475
|
+
"value"
|
|
1476
|
+
];
|
|
1477
|
+
const Dt = [
|
|
1478
|
+
/^radix-/,
|
|
1479
|
+
/^headlessui-/,
|
|
1480
|
+
/^mui-/,
|
|
1481
|
+
/:\w+:/
|
|
1482
|
+
// matches :ru:, :r1:, etc.
|
|
1483
|
+
];
|
|
1484
|
+
function Ht(n2, t2) {
|
|
1485
|
+
return wt.includes(n2) ? true : vt.includes(n2) || $t.includes(n2) || Mt.some((e2) => n2.startsWith(e2)) ? false : It.includes(n2) || n2.startsWith("data-") && n2.endsWith("-id") ? true : n2 === "id" ? !Dt.some((e2) => e2.test(t2)) : Rt.includes(n2) ? true : Nt.includes(n2) ? false : !!n2.startsWith("data-");
|
|
1486
|
+
}
|
|
1487
|
+
class Pt {
|
|
1488
|
+
constructor(t2, e2) {
|
|
1489
|
+
var _a2;
|
|
1490
|
+
this.includeUtilityClasses = (_a2 = t2.includeUtilityClasses) != null ? _a2 : false, this.cache = e2;
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Extracts semantic features from element
|
|
1494
|
+
* @param element - DOM element to extract from
|
|
1495
|
+
* @returns Semantic features object
|
|
1496
|
+
*/
|
|
1497
|
+
extract(t2) {
|
|
1498
|
+
if (this.cache) {
|
|
1499
|
+
const i2 = this.cache.getSemantics(t2);
|
|
1500
|
+
if (i2 !== void 0)
|
|
1501
|
+
return i2;
|
|
1502
|
+
}
|
|
1503
|
+
const e2 = {}, s2 = t2.id;
|
|
1504
|
+
if (s2 && !D(s2) && (e2.id = s2), t2.classList.length > 0) {
|
|
1505
|
+
const i2 = Array.from(t2.classList);
|
|
1506
|
+
if (this.includeUtilityClasses)
|
|
1507
|
+
e2.classes = i2;
|
|
1508
|
+
else {
|
|
1509
|
+
const { semantic: o2 } = At(i2);
|
|
1510
|
+
o2.length > 0 && (e2.classes = o2);
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
const r2 = this.extractAttributes(t2);
|
|
1514
|
+
Object.keys(r2).length > 0 && (e2.attributes = r2);
|
|
1515
|
+
const a2 = t2.getAttribute("role");
|
|
1516
|
+
if (a2 && (e2.role = a2), this.shouldExtractText(t2)) {
|
|
1517
|
+
const i2 = this.extractText(t2);
|
|
1518
|
+
i2 && (e2.text = i2);
|
|
1519
|
+
}
|
|
1520
|
+
return this.cache && this.cache.setSemantics(t2, e2), e2;
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Scores element based on semantic richness
|
|
1524
|
+
* @param element - Element to score
|
|
1525
|
+
* @returns Score from 0 to 1
|
|
1526
|
+
*/
|
|
1527
|
+
scoreElement(t2) {
|
|
1528
|
+
let e2 = 0.5;
|
|
1529
|
+
const s2 = this.extract(t2);
|
|
1530
|
+
return s2.id && (e2 += 0.15), s2.classes && s2.classes.length > 0 && (e2 += 0.1), s2.attributes && Object.keys(s2.attributes).length > 0 && (e2 += 0.1), s2.role && (e2 += 0.1), s2.text && (e2 += 0.05), Math.min(e2, 1);
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Checks if attribute should be ignored
|
|
1534
|
+
* @param attrName - Attribute name
|
|
1535
|
+
* @returns True if should be ignored
|
|
1536
|
+
*/
|
|
1537
|
+
shouldIgnoreAttribute(t2) {
|
|
1538
|
+
return !!(B.has(t2) || t2.startsWith("on") || t2.startsWith("ng-") || t2.startsWith("_ng") || t2.startsWith("data-reactid") || t2.startsWith("data-react") || t2.startsWith("data-v-"));
|
|
1539
|
+
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Gets attribute priority
|
|
1542
|
+
* @param attrName - Attribute name
|
|
1543
|
+
* @returns Priority number (higher = more priority)
|
|
1544
|
+
*/
|
|
1545
|
+
getAttributePriority(t2) {
|
|
1546
|
+
return w[t2] !== void 0 ? w[t2] : t2.startsWith("data-") ? w["data-*"] : t2.startsWith("aria-") ? w["aria-*"] : 0;
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Checks if attribute value is dynamic (should be ignored)
|
|
1550
|
+
* @param value - Attribute value
|
|
1551
|
+
* @returns True if value is dynamic
|
|
1552
|
+
*/
|
|
1553
|
+
isDynamicValue(t2) {
|
|
1554
|
+
return [
|
|
1555
|
+
/^[a-f0-9]{32,}$/i,
|
|
1556
|
+
// Long hashes
|
|
1557
|
+
/^\d{10,}$/,
|
|
1558
|
+
// Timestamp
|
|
1559
|
+
/^(undefined|null|\[object)/,
|
|
1560
|
+
// JS artifacts
|
|
1561
|
+
/^{{.*}}$/
|
|
1562
|
+
// Template literals
|
|
1563
|
+
].some((s2) => s2.test(t2));
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Extracts relevant semantic attributes from element
|
|
1567
|
+
* Iterates through all attributes and filters by priority
|
|
1568
|
+
*/
|
|
1569
|
+
extractAttributes(t2) {
|
|
1570
|
+
const e2 = {};
|
|
1571
|
+
for (const s2 of Array.from(t2.attributes)) {
|
|
1572
|
+
const r2 = s2.name;
|
|
1573
|
+
if (this.shouldIgnoreAttribute(r2) || !Ht(r2, s2.value) || G.has(r2) && V(s2.value) || this.getAttributePriority(r2) === 0)
|
|
1574
|
+
continue;
|
|
1575
|
+
const i2 = r2 === "href" || r2 === "src" ? k(r2, s2.value) : s2.value;
|
|
1576
|
+
!i2 || i2.trim() === "" || this.isDynamicValue(i2) || (e2[r2] = i2);
|
|
1577
|
+
}
|
|
1578
|
+
return e2;
|
|
1579
|
+
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Extracts and normalizes text content
|
|
1582
|
+
*/
|
|
1583
|
+
extractText(t2) {
|
|
1584
|
+
const e2 = this.getDirectTextContent(t2);
|
|
1585
|
+
if (!e2)
|
|
1586
|
+
return null;
|
|
1587
|
+
const s2 = Q(e2);
|
|
1588
|
+
if (!s2)
|
|
1589
|
+
return null;
|
|
1590
|
+
const r2 = 100, a2 = e2.length > r2 ? e2.slice(0, r2) + "..." : e2, i2 = s2.length > r2 ? s2.slice(0, r2) + "..." : s2;
|
|
1591
|
+
return {
|
|
1592
|
+
raw: a2,
|
|
1593
|
+
normalized: i2
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
/**
|
|
1597
|
+
* Gets direct text content excluding child elements
|
|
1598
|
+
*/
|
|
1599
|
+
getDirectTextContent(t2) {
|
|
1600
|
+
var _a2;
|
|
1601
|
+
const e2 = [];
|
|
1602
|
+
for (const s2 of Array.from(t2.childNodes))
|
|
1603
|
+
if (s2.nodeType === Node.TEXT_NODE && s2.textContent) {
|
|
1604
|
+
const r2 = s2.textContent.trim();
|
|
1605
|
+
r2 && e2.push(r2);
|
|
1606
|
+
}
|
|
1607
|
+
return e2.length > 0 ? e2.join(" ") : (_a2 = t2.textContent) != null ? _a2 : null;
|
|
1608
|
+
}
|
|
1609
|
+
/**
|
|
1610
|
+
* Determines if text should be extracted for this element
|
|
1611
|
+
*/
|
|
1612
|
+
shouldExtractText(t2) {
|
|
1613
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1614
|
+
return [
|
|
1615
|
+
"button",
|
|
1616
|
+
"a",
|
|
1617
|
+
"label",
|
|
1618
|
+
"h1",
|
|
1619
|
+
"h2",
|
|
1620
|
+
"h3",
|
|
1621
|
+
"h4",
|
|
1622
|
+
"h5",
|
|
1623
|
+
"h6",
|
|
1624
|
+
"p",
|
|
1625
|
+
"span",
|
|
1626
|
+
"li",
|
|
1627
|
+
"th",
|
|
1628
|
+
"td",
|
|
1629
|
+
"dt",
|
|
1630
|
+
"dd",
|
|
1631
|
+
"legend",
|
|
1632
|
+
"figcaption",
|
|
1633
|
+
"summary"
|
|
1634
|
+
].includes(e2);
|
|
1635
|
+
}
|
|
1636
|
+
}
|
|
1637
|
+
class kt {
|
|
1638
|
+
/**
|
|
1639
|
+
* Generates fingerprint for SVG element
|
|
1640
|
+
* @param element - SVG element to fingerprint
|
|
1641
|
+
* @returns SVG fingerprint object
|
|
1642
|
+
*/
|
|
1643
|
+
fingerprint(t2) {
|
|
1644
|
+
const e2 = t2.tagName.toLowerCase(), s2 = this.getShape(e2), r2 = {
|
|
1645
|
+
shape: s2,
|
|
1646
|
+
hasAnimation: this.hasAnimation(t2)
|
|
1647
|
+
};
|
|
1648
|
+
if (s2 === "path") {
|
|
1649
|
+
const o2 = t2.getAttribute("d");
|
|
1650
|
+
o2 && (r2.dHash = this.computePathHash(o2));
|
|
1651
|
+
} else
|
|
1652
|
+
["circle", "rect", "ellipse", "line"].includes(s2) && (r2.geomHash = this.computeGeomHash(t2, s2));
|
|
1653
|
+
const a2 = t2.getAttribute("role");
|
|
1654
|
+
a2 && (r2.role = a2);
|
|
1655
|
+
const i2 = t2.querySelector("title");
|
|
1656
|
+
return (i2 == null ? void 0 : i2.textContent) && (r2.titleText = i2.textContent.trim()), r2;
|
|
1657
|
+
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Computes hash from path data (first N commands)
|
|
1660
|
+
* @param d - SVG path d attribute value
|
|
1661
|
+
* @returns Hash string
|
|
1662
|
+
*/
|
|
1663
|
+
computePathHash(t2) {
|
|
1664
|
+
const e2 = this.normalizePathData(t2);
|
|
1665
|
+
return this.simpleHash(e2);
|
|
1666
|
+
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Gets the shape type from tag name
|
|
1669
|
+
*/
|
|
1670
|
+
getShape(t2) {
|
|
1671
|
+
var _a2;
|
|
1672
|
+
return (_a2 = [
|
|
1673
|
+
"path",
|
|
1674
|
+
"circle",
|
|
1675
|
+
"rect",
|
|
1676
|
+
"line",
|
|
1677
|
+
"polyline",
|
|
1678
|
+
"polygon",
|
|
1679
|
+
"ellipse",
|
|
1680
|
+
"g",
|
|
1681
|
+
"text",
|
|
1682
|
+
"use",
|
|
1683
|
+
"svg"
|
|
1684
|
+
].find((s2) => s2 === t2)) != null ? _a2 : "path";
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Normalizes path data for consistent hashing
|
|
1688
|
+
*/
|
|
1689
|
+
normalizePathData(t2) {
|
|
1690
|
+
var _a2;
|
|
1691
|
+
return ((_a2 = t2.match(/[MLHVCSQTAZ][^MLHVCSQTAZ]*/gi)) != null ? _a2 : []).slice(0, 5).map((r2) => r2.trim().replace(/(-?\d+\.?\d*)/g, (a2) => parseFloat(a2).toFixed(1))).join(" ");
|
|
1692
|
+
}
|
|
1693
|
+
/**
|
|
1694
|
+
* Computes geometry hash for non-path shapes
|
|
1695
|
+
*/
|
|
1696
|
+
computeGeomHash(t2, e2) {
|
|
1697
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1698
|
+
const s2 = [];
|
|
1699
|
+
switch (e2) {
|
|
1700
|
+
case "circle":
|
|
1701
|
+
s2.push(`r=${(_a2 = t2.getAttribute("r")) != null ? _a2 : "0"}`);
|
|
1702
|
+
break;
|
|
1703
|
+
case "rect":
|
|
1704
|
+
{
|
|
1705
|
+
const r2 = parseFloat((_b = t2.getAttribute("width")) != null ? _b : "0"), a2 = parseFloat((_c = t2.getAttribute("height")) != null ? _c : "0");
|
|
1706
|
+
r2 > 0 && a2 > 0 && s2.push(`ratio=${(r2 / a2).toFixed(2)}`);
|
|
1707
|
+
}
|
|
1708
|
+
break;
|
|
1709
|
+
case "ellipse":
|
|
1710
|
+
{
|
|
1711
|
+
const r2 = parseFloat((_d = t2.getAttribute("rx")) != null ? _d : "0"), a2 = parseFloat((_e = t2.getAttribute("ry")) != null ? _e : "0");
|
|
1712
|
+
r2 > 0 && a2 > 0 && s2.push(`ratio=${(r2 / a2).toFixed(2)}`);
|
|
1713
|
+
}
|
|
1714
|
+
break;
|
|
1715
|
+
case "line":
|
|
1716
|
+
{
|
|
1717
|
+
const r2 = parseFloat((_f = t2.getAttribute("x1")) != null ? _f : "0"), a2 = parseFloat((_g = t2.getAttribute("y1")) != null ? _g : "0"), i2 = parseFloat((_h = t2.getAttribute("x2")) != null ? _h : "0"), o2 = parseFloat((_i = t2.getAttribute("y2")) != null ? _i : "0"), l2 = Math.atan2(o2 - a2, i2 - r2);
|
|
1718
|
+
s2.push(`angle=${l2.toFixed(2)}`);
|
|
1719
|
+
}
|
|
1720
|
+
break;
|
|
1721
|
+
}
|
|
1722
|
+
return this.simpleHash(s2.join(";"));
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Detects animations on SVG element
|
|
1726
|
+
*/
|
|
1727
|
+
hasAnimation(t2) {
|
|
1728
|
+
if (t2.querySelector("animate, animateTransform, animateMotion"))
|
|
1729
|
+
return true;
|
|
1730
|
+
const e2 = t2.ownerDocument;
|
|
1731
|
+
if (e2 == null ? void 0 : e2.defaultView)
|
|
1732
|
+
try {
|
|
1733
|
+
const s2 = e2.defaultView.getComputedStyle(t2);
|
|
1734
|
+
if (s2.animationName !== "none" || s2.transitionProperty !== "all" && s2.transitionProperty !== "none")
|
|
1735
|
+
return true;
|
|
1736
|
+
} catch (e3) {
|
|
1737
|
+
}
|
|
1738
|
+
return false;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Simple hash function for fingerprinting (not cryptographic)
|
|
1742
|
+
*/
|
|
1743
|
+
simpleHash(t2) {
|
|
1744
|
+
let e2 = 0;
|
|
1745
|
+
for (let s2 = 0; s2 < t2.length; s2++) {
|
|
1746
|
+
const r2 = t2.charCodeAt(s2);
|
|
1747
|
+
e2 = (e2 << 5) - e2 + r2, e2 = e2 & e2;
|
|
1748
|
+
}
|
|
1749
|
+
return Math.abs(e2).toString(16).padStart(8, "0");
|
|
1750
|
+
}
|
|
1751
|
+
}
|
|
1752
|
+
function _t(n2, t2 = 0) {
|
|
1753
|
+
const e2 = n2.anchor.score, s2 = n2.path.length > 0 ? n2.path.reduce((o2, l2) => o2 + l2.score, 0) / n2.path.length : 0.5, r2 = n2.target.score, a2 = e2 * L.ANCHOR + s2 * L.PATH + r2 * L.TARGET + t2 * L.UNIQUENESS, i2 = n2.anchor.degraded ? 0.2 : 0;
|
|
1754
|
+
return Math.max(0, Math.min(1, a2 - i2));
|
|
1755
|
+
}
|
|
1756
|
+
class qt {
|
|
1757
|
+
constructor(t2) {
|
|
1758
|
+
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t2;
|
|
1759
|
+
}
|
|
1760
|
+
get(t2) {
|
|
1761
|
+
const e2 = this.cache.get(t2);
|
|
1762
|
+
if (e2 !== void 0)
|
|
1763
|
+
return this.cache.delete(t2), this.cache.set(t2, e2), e2;
|
|
1764
|
+
}
|
|
1765
|
+
set(t2, e2) {
|
|
1766
|
+
if (this.cache.has(t2))
|
|
1767
|
+
this.cache.delete(t2);
|
|
1768
|
+
else if (this.cache.size >= this.maxSize) {
|
|
1769
|
+
const s2 = this.cache.keys().next().value;
|
|
1770
|
+
s2 !== void 0 && this.cache.delete(s2);
|
|
1771
|
+
}
|
|
1772
|
+
this.cache.set(t2, e2);
|
|
1773
|
+
}
|
|
1774
|
+
has(t2) {
|
|
1775
|
+
return this.cache.has(t2);
|
|
1776
|
+
}
|
|
1777
|
+
delete(t2) {
|
|
1778
|
+
this.cache.delete(t2);
|
|
1779
|
+
}
|
|
1780
|
+
clear() {
|
|
1781
|
+
this.cache.clear();
|
|
1782
|
+
}
|
|
1783
|
+
get size() {
|
|
1784
|
+
return this.cache.size;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
class Lt {
|
|
1788
|
+
constructor(t2 = {}) {
|
|
1789
|
+
var _a2, _b;
|
|
1790
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new qt(
|
|
1791
|
+
(_a2 = t2.maxSelectorCacheSize) != null ? _a2 : 1e3
|
|
1792
|
+
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
1793
|
+
eidHits: 0,
|
|
1794
|
+
eidMisses: 0,
|
|
1795
|
+
selectorHits: 0,
|
|
1796
|
+
selectorMisses: 0,
|
|
1797
|
+
anchorHits: 0,
|
|
1798
|
+
anchorMisses: 0,
|
|
1799
|
+
semanticsHits: 0,
|
|
1800
|
+
semanticsMisses: 0,
|
|
1801
|
+
selectorCacheSize: 0,
|
|
1802
|
+
maxSelectorCacheSize: (_b = t2.maxSelectorCacheSize) != null ? _b : 1e3
|
|
1803
|
+
};
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Get cached EID for element
|
|
1807
|
+
*/
|
|
1808
|
+
getEID(t2) {
|
|
1809
|
+
const e2 = this.eidCache.get(t2);
|
|
1810
|
+
if (e2 !== void 0)
|
|
1811
|
+
return this.stats.eidHits++, e2;
|
|
1812
|
+
this.stats.eidMisses++;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Cache EID for element
|
|
1816
|
+
*/
|
|
1817
|
+
setEID(t2, e2) {
|
|
1818
|
+
this.eidCache.set(t2, e2);
|
|
1819
|
+
}
|
|
1820
|
+
/**
|
|
1821
|
+
* Get cached selector results
|
|
1822
|
+
*/
|
|
1823
|
+
getSelectorResults(t2) {
|
|
1824
|
+
const e2 = this.selectorResultCache.get(t2);
|
|
1825
|
+
if (e2 !== void 0)
|
|
1826
|
+
return this.stats.selectorHits++, this.stats.selectorCacheSize = this.selectorResultCache.size, e2;
|
|
1827
|
+
this.stats.selectorMisses++, this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Cache selector results
|
|
1831
|
+
*/
|
|
1832
|
+
setSelectorResults(t2, e2) {
|
|
1833
|
+
this.selectorResultCache.set(t2, e2), this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Get cached anchor result
|
|
1837
|
+
*/
|
|
1838
|
+
getAnchor(t2) {
|
|
1839
|
+
if (this.anchorCache.has(t2))
|
|
1840
|
+
return this.stats.anchorHits++, this.anchorCache.get(t2);
|
|
1841
|
+
this.stats.anchorMisses++;
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Cache anchor result
|
|
1845
|
+
*/
|
|
1846
|
+
setAnchor(t2, e2) {
|
|
1847
|
+
this.anchorCache.set(t2, e2);
|
|
1848
|
+
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Get cached semantics
|
|
1851
|
+
*/
|
|
1852
|
+
getSemantics(t2) {
|
|
1853
|
+
const e2 = this.semanticsCache.get(t2);
|
|
1854
|
+
if (e2 !== void 0)
|
|
1855
|
+
return this.stats.semanticsHits++, e2;
|
|
1856
|
+
this.stats.semanticsMisses++;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Cache semantics
|
|
1860
|
+
*/
|
|
1861
|
+
setSemantics(t2, e2) {
|
|
1862
|
+
this.semanticsCache.set(t2, e2);
|
|
1863
|
+
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Clear all caches
|
|
1866
|
+
*/
|
|
1867
|
+
clear() {
|
|
1868
|
+
this.selectorResultCache.clear(), this.stats.selectorCacheSize = 0, this.stats = {
|
|
1869
|
+
eidHits: 0,
|
|
1870
|
+
eidMisses: 0,
|
|
1871
|
+
selectorHits: 0,
|
|
1872
|
+
selectorMisses: 0,
|
|
1873
|
+
anchorHits: 0,
|
|
1874
|
+
anchorMisses: 0,
|
|
1875
|
+
semanticsHits: 0,
|
|
1876
|
+
semanticsMisses: 0,
|
|
1877
|
+
selectorCacheSize: 0,
|
|
1878
|
+
maxSelectorCacheSize: this.stats.maxSelectorCacheSize
|
|
1879
|
+
};
|
|
1880
|
+
}
|
|
1881
|
+
/**
|
|
1882
|
+
* Invalidate cache for a specific element
|
|
1883
|
+
* Note: WeakMaps don't support deletion, but we can clear selector cache
|
|
1884
|
+
* if needed. This method is mainly for future extensibility.
|
|
1885
|
+
*/
|
|
1886
|
+
invalidateElement(t2) {
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Invalidate a specific selector from cache
|
|
1890
|
+
*/
|
|
1891
|
+
invalidateSelector(t2) {
|
|
1892
|
+
this.selectorResultCache.delete(t2), this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Get cache statistics
|
|
1896
|
+
*/
|
|
1897
|
+
getStats() {
|
|
1898
|
+
return __spreadProps(__spreadValues({}, this.stats), {
|
|
1899
|
+
selectorCacheSize: this.selectorResultCache.size
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Get cache hit rate for EID cache
|
|
1904
|
+
*/
|
|
1905
|
+
getEIDHitRate() {
|
|
1906
|
+
const t2 = this.stats.eidHits + this.stats.eidMisses;
|
|
1907
|
+
return t2 > 0 ? this.stats.eidHits / t2 : 0;
|
|
1908
|
+
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Get cache hit rate for selector cache
|
|
1911
|
+
*/
|
|
1912
|
+
getSelectorHitRate() {
|
|
1913
|
+
const t2 = this.stats.selectorHits + this.stats.selectorMisses;
|
|
1914
|
+
return t2 > 0 ? this.stats.selectorHits / t2 : 0;
|
|
1915
|
+
}
|
|
1916
|
+
/**
|
|
1917
|
+
* Get cache hit rate for anchor cache
|
|
1918
|
+
*/
|
|
1919
|
+
getAnchorHitRate() {
|
|
1920
|
+
const t2 = this.stats.anchorHits + this.stats.anchorMisses;
|
|
1921
|
+
return t2 > 0 ? this.stats.anchorHits / t2 : 0;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1924
|
+
* Get cache hit rate for semantics cache
|
|
1925
|
+
*/
|
|
1926
|
+
getSemanticsHitRate() {
|
|
1927
|
+
const t2 = this.stats.semanticsHits + this.stats.semanticsMisses;
|
|
1928
|
+
return t2 > 0 ? this.stats.semanticsHits / t2 : 0;
|
|
1929
|
+
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Get overall cache hit rate
|
|
1932
|
+
*/
|
|
1933
|
+
getOverallHitRate() {
|
|
1934
|
+
const t2 = this.stats.eidHits + this.stats.selectorHits + this.stats.anchorHits + this.stats.semanticsHits, e2 = this.stats.eidMisses + this.stats.selectorMisses + this.stats.anchorMisses + this.stats.semanticsMisses, s2 = t2 + e2;
|
|
1935
|
+
return s2 > 0 ? t2 / s2 : 0;
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
function Ot(n2) {
|
|
1939
|
+
return new Lt(n2);
|
|
1940
|
+
}
|
|
1941
|
+
let O = null;
|
|
1942
|
+
function Z() {
|
|
1943
|
+
return O || (O = Ot()), O;
|
|
1944
|
+
}
|
|
1945
|
+
function Y(n2, t2 = {}) {
|
|
1946
|
+
var _a3, _b, _c, _d;
|
|
1947
|
+
var _a2;
|
|
1948
|
+
if (!n2 || !n2.ownerDocument || !n2.isConnected)
|
|
1949
|
+
return null;
|
|
1950
|
+
const e2 = __spreadValues(__spreadValues({}, ut), t2), s2 = (_a3 = e2.cache) != null ? _a3 : Z(), r2 = s2.getEID(n2);
|
|
1951
|
+
if (r2 !== void 0)
|
|
1952
|
+
return r2;
|
|
1953
|
+
const a2 = new ft(e2, s2), i2 = new xt(e2, s2), o2 = new Pt(e2, s2), l2 = new kt(), u2 = a2.findAnchor(n2);
|
|
1954
|
+
if (!u2 && !e2.fallbackToBody)
|
|
1955
|
+
return null;
|
|
1956
|
+
const d = (_c = (_b = u2 == null ? void 0 : u2.element) != null ? _b : (_a2 = n2.ownerDocument) == null ? void 0 : _a2.body) != null ? _c : null;
|
|
1957
|
+
if (!d)
|
|
1958
|
+
return null;
|
|
1959
|
+
const c2 = !u2 || u2.tier === "C", h = d.tagName.toLowerCase(), g = d.parentElement;
|
|
1960
|
+
let f2;
|
|
1961
|
+
if (g && h !== "body" && h !== "html") {
|
|
1962
|
+
const T = Array.from(g.children).indexOf(d);
|
|
1963
|
+
T !== -1 && (f2 = T + 1);
|
|
1964
|
+
}
|
|
1965
|
+
const p = o2.extract(d), m = {
|
|
1966
|
+
tag: d.tagName.toLowerCase(),
|
|
1967
|
+
semantics: p,
|
|
1968
|
+
score: (_d = u2 == null ? void 0 : u2.score) != null ? _d : I.DEGRADED_SCORE,
|
|
1969
|
+
degraded: c2,
|
|
1970
|
+
nthChild: f2
|
|
1971
|
+
}, b = i2.buildPath(d, n2, o2), y = o2.extract(n2);
|
|
1972
|
+
e2.enableSvgFingerprint && zt(n2) && (y.svg = l2.fingerprint(n2));
|
|
1973
|
+
const v2 = n2.parentElement;
|
|
1974
|
+
let A;
|
|
1975
|
+
if (v2) {
|
|
1976
|
+
const T = Array.from(v2.children).indexOf(n2);
|
|
1977
|
+
T !== -1 && (A = T + 1);
|
|
1978
|
+
}
|
|
1979
|
+
const S = {
|
|
1980
|
+
tag: n2.tagName.toLowerCase(),
|
|
1981
|
+
semantics: y,
|
|
1982
|
+
score: o2.scoreElement(n2),
|
|
1983
|
+
nthChild: A
|
|
1984
|
+
}, $ = [], M = {
|
|
1985
|
+
onMultiple: "best-score",
|
|
1986
|
+
onMissing: "anchor-only",
|
|
1987
|
+
maxDepth: 3
|
|
1988
|
+
}, H = m.degraded || b.degraded, E = Ut(m.degraded, b), x2 = {
|
|
1989
|
+
version: "1.0",
|
|
1990
|
+
anchor: m,
|
|
1991
|
+
path: b.path,
|
|
1992
|
+
target: S,
|
|
1993
|
+
constraints: $,
|
|
1994
|
+
fallback: M,
|
|
1995
|
+
meta: {
|
|
1996
|
+
confidence: 0,
|
|
1997
|
+
// Calculated below
|
|
1998
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1999
|
+
generator: "dom-eid@1.0",
|
|
2000
|
+
source: e2.source,
|
|
2001
|
+
degraded: H,
|
|
2002
|
+
degradationReason: E
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
return x2.meta.confidence = _t(x2), x2.meta.confidence < e2.confidenceThreshold ? null : (s2.setEID(n2, x2), x2);
|
|
2006
|
+
}
|
|
2007
|
+
function zt(n2) {
|
|
2008
|
+
return n2.namespaceURI === "http://www.w3.org/2000/svg" || n2.tagName.toLowerCase() === "svg" || n2 instanceof SVGElement;
|
|
2009
|
+
}
|
|
2010
|
+
function Ut(n2, t2) {
|
|
2011
|
+
if (n2 && t2.degraded)
|
|
2012
|
+
return "anchor-and-path-degraded";
|
|
2013
|
+
if (n2)
|
|
2014
|
+
return "no-semantic-anchor";
|
|
2015
|
+
if (t2.degraded)
|
|
2016
|
+
return t2.degradationReason;
|
|
2017
|
+
}
|
|
2018
|
+
const rt = {
|
|
2019
|
+
maxClasses: 2,
|
|
2020
|
+
maxAttributes: 5,
|
|
2021
|
+
includeText: true,
|
|
2022
|
+
maxTextLength: 50,
|
|
2023
|
+
simplifyTarget: true,
|
|
2024
|
+
includeConstraints: true
|
|
2025
|
+
};
|
|
2026
|
+
function et(n2) {
|
|
2027
|
+
return n2 === "id" ? 101 : w[n2] !== void 0 ? w[n2] : n2.startsWith("data-") ? w["data-*"] : n2.startsWith("aria-") ? w["aria-*"] : 0;
|
|
2028
|
+
}
|
|
2029
|
+
function Vt(n2) {
|
|
2030
|
+
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(n2);
|
|
2031
|
+
}
|
|
2032
|
+
function Qt(n2) {
|
|
2033
|
+
return !!(/@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/.test(n2) || /(\+?\d{1,3}[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/.test(n2) || /\d{4}[-\s]?\d{4}[-\s]?\d{4}[-\s]?\d{4}/.test(n2));
|
|
2034
|
+
}
|
|
2035
|
+
function Zt(n2, t2) {
|
|
2036
|
+
const e2 = __spreadValues(__spreadValues({}, rt), t2), s2 = `v${n2.version}`, r2 = U(n2.anchor, false, e2), a2 = n2.path.length > 0 ? n2.path.map((l2) => U(l2, false, e2)).join(" > ") + " > " : "", i2 = U(n2.target, true, e2), o2 = e2.includeConstraints ? Xt(n2) : "";
|
|
2037
|
+
return `${s2}: ${r2} :: ${a2}${i2}${o2}`;
|
|
2038
|
+
}
|
|
2039
|
+
function U(n2, t2 = false, e2 = rt) {
|
|
2040
|
+
const { tag: s2, semantics: r2 } = n2;
|
|
2041
|
+
let a2 = s2;
|
|
2042
|
+
const i2 = [], o2 = __spreadValues({}, r2.attributes);
|
|
2043
|
+
r2.id && (o2.id = r2.id), r2.role && !o2.role && (o2.role = r2.role);
|
|
2044
|
+
const l2 = Object.entries(o2).map(([c2, h]) => {
|
|
2045
|
+
const g = et(c2), f2 = c2 === "href" || c2 === "src" ? k(c2, h) : h;
|
|
2046
|
+
return { name: c2, value: f2, priority: g };
|
|
2047
|
+
}).filter((c2) => c2.name !== "id" && c2.name !== "class" && B.has(c2.name) || G.has(c2.name) && V(c2.value) ? false : c2.priority > 0 || c2.name === "role" || c2.name === "id");
|
|
2048
|
+
l2.sort((c2, h) => h.priority - c2.priority);
|
|
2049
|
+
const u2 = l2.slice(0, e2.maxAttributes);
|
|
2050
|
+
u2.sort((c2, h) => c2.name.localeCompare(h.name));
|
|
2051
|
+
for (const { name: c2, value: h } of u2)
|
|
2052
|
+
i2.push(`${c2}="${j(h)}"`);
|
|
2053
|
+
if (e2.includeText && r2.text && !Qt(r2.text.normalized)) {
|
|
2054
|
+
const c2 = r2.text.normalized;
|
|
2055
|
+
c2.length > 0 && c2.length <= e2.maxTextLength && i2.push(`text="${j(c2)}"`);
|
|
2056
|
+
}
|
|
2057
|
+
let d = i2;
|
|
2058
|
+
if (i2.length > 0 && (t2 && e2.simplifyTarget && r2.id && (d = i2.filter((c2) => {
|
|
2059
|
+
const h = c2.split("=")[0];
|
|
2060
|
+
return et(h) >= 60 || h === "text" || h === "id" || h === "role";
|
|
2061
|
+
})), d.length > 0 && d.sort((c2, h) => c2.localeCompare(h))), r2.classes && r2.classes.length > 0) {
|
|
2062
|
+
const c2 = N(r2.classes), h = !!r2.id || i2.some(
|
|
2063
|
+
(f2) => f2.startsWith("href=") || f2.startsWith("data-testid=") || f2.startsWith("text=") || f2.startsWith("role=")
|
|
2064
|
+
);
|
|
2065
|
+
if (!(t2 && e2.simplifyTarget && h) && c2.length > 0) {
|
|
2066
|
+
const f2 = c2.sort().slice(0, e2.maxClasses);
|
|
2067
|
+
a2 += f2.map((p) => `.${p}`).join("");
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
if (d.length > 0 && (a2 += `[${d.join(",")}]`), "nthChild" in n2 && n2.nthChild) {
|
|
2071
|
+
const c2 = !!r2.id || r2.attributes && Object.keys(r2.attributes).some(Vt);
|
|
2072
|
+
t2 && e2.simplifyTarget && c2 || (a2 += `#${n2.nthChild}`);
|
|
2073
|
+
}
|
|
2074
|
+
return a2;
|
|
2075
|
+
}
|
|
2076
|
+
function Xt(n2) {
|
|
2077
|
+
if (!n2.constraints || n2.constraints.length === 0)
|
|
2078
|
+
return "";
|
|
2079
|
+
const t2 = [];
|
|
2080
|
+
for (const e2 of n2.constraints)
|
|
2081
|
+
switch (e2.type) {
|
|
2082
|
+
case "uniqueness":
|
|
2083
|
+
t2.push("unique=true");
|
|
2084
|
+
break;
|
|
2085
|
+
case "position":
|
|
2086
|
+
e2.params && e2.params.strategy && t2.push(`pos=${e2.params.strategy}`);
|
|
2087
|
+
break;
|
|
2088
|
+
case "text-proximity":
|
|
2089
|
+
if (e2.params && e2.params.reference) {
|
|
2090
|
+
const s2 = j(String(e2.params.reference));
|
|
2091
|
+
t2.push(`text="${s2}"`);
|
|
2092
|
+
}
|
|
2093
|
+
break;
|
|
2094
|
+
}
|
|
2095
|
+
return t2.length === 0 ? "" : ` {${t2.join(",")}}`;
|
|
2096
|
+
}
|
|
2097
|
+
function j(n2) {
|
|
2098
|
+
return n2.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
2099
|
+
}
|
|
2100
|
+
function le(n2, t2, e2) {
|
|
2101
|
+
const s2 = Y(n2, t2);
|
|
2102
|
+
return s2 ? Zt(s2, e2) : null;
|
|
2103
|
+
}
|
|
895
2104
|
let _id = 1;
|
|
896
2105
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
897
2106
|
const IGNORED_NODE = -2;
|
|
@@ -1013,6 +2222,8 @@ function ignoreAttribute(tagName, name, _value) {
|
|
|
1013
2222
|
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
1014
2223
|
}
|
|
1015
2224
|
function isExcludeAttribute(name, exclude) {
|
|
2225
|
+
if (!exclude)
|
|
2226
|
+
return false;
|
|
1016
2227
|
return typeof exclude === "string" ? name.includes(exclude) : exclude.test(name);
|
|
1017
2228
|
}
|
|
1018
2229
|
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
@@ -1523,7 +2734,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1523
2734
|
stylesheetLoadTimeout = 5e3,
|
|
1524
2735
|
keepIframeSrcFn = () => false,
|
|
1525
2736
|
newlyAddedElement = false,
|
|
1526
|
-
cssCaptured = false
|
|
2737
|
+
cssCaptured = false,
|
|
2738
|
+
selectorOptions
|
|
1527
2739
|
} = options;
|
|
1528
2740
|
let { needsMask } = options;
|
|
1529
2741
|
let { preserveWhiteSpace = true } = options;
|
|
@@ -1568,11 +2780,20 @@ function serializeNodeWithId(n2, options) {
|
|
|
1568
2780
|
}
|
|
1569
2781
|
const serializedNode = Object.assign(_serializedNode, { id });
|
|
1570
2782
|
if (isElement(n2) || n2.nodeType === Node.TEXT_NODE) {
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
2783
|
+
if (isElement(n2) && selectorOptions !== null && selectorOptions !== void 0) {
|
|
2784
|
+
try {
|
|
2785
|
+
const seqlGeneratorOptions = {
|
|
2786
|
+
maxPathDepth: selectorOptions.maxPathDepth,
|
|
2787
|
+
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
2788
|
+
confidenceThreshold: selectorOptions.confidenceThreshold,
|
|
2789
|
+
fallbackToBody: selectorOptions.fallbackToBody
|
|
2790
|
+
};
|
|
2791
|
+
const selector = le(n2, seqlGeneratorOptions);
|
|
2792
|
+
if (selector) {
|
|
2793
|
+
serializedNode.selector = selector;
|
|
2794
|
+
}
|
|
2795
|
+
} catch (error) {
|
|
2796
|
+
console.warn("Failed to generate SEQL selector:", error);
|
|
1576
2797
|
}
|
|
1577
2798
|
}
|
|
1578
2799
|
if (n2.nodeType === Node.TEXT_NODE) {
|
|
@@ -1627,7 +2848,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1627
2848
|
onStylesheetLoad,
|
|
1628
2849
|
stylesheetLoadTimeout,
|
|
1629
2850
|
keepIframeSrcFn,
|
|
1630
|
-
cssCaptured: false
|
|
2851
|
+
cssCaptured: false,
|
|
2852
|
+
selectorOptions
|
|
1631
2853
|
};
|
|
1632
2854
|
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0)
|
|
1633
2855
|
;
|
|
@@ -1687,7 +2909,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1687
2909
|
iframeLoadTimeout,
|
|
1688
2910
|
onStylesheetLoad,
|
|
1689
2911
|
stylesheetLoadTimeout,
|
|
1690
|
-
keepIframeSrcFn
|
|
2912
|
+
keepIframeSrcFn,
|
|
2913
|
+
selectorOptions
|
|
1691
2914
|
});
|
|
1692
2915
|
if (serializedIframeNode) {
|
|
1693
2916
|
onIframeLoad(
|
|
@@ -1729,7 +2952,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1729
2952
|
iframeLoadTimeout,
|
|
1730
2953
|
onStylesheetLoad,
|
|
1731
2954
|
stylesheetLoadTimeout,
|
|
1732
|
-
keepIframeSrcFn
|
|
2955
|
+
keepIframeSrcFn,
|
|
2956
|
+
selectorOptions
|
|
1733
2957
|
});
|
|
1734
2958
|
if (serializedLinkNode) {
|
|
1735
2959
|
onStylesheetLoad(
|
|
@@ -1745,6 +2969,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
1745
2969
|
return serializedNode;
|
|
1746
2970
|
}
|
|
1747
2971
|
function snapshot(n2, options) {
|
|
2972
|
+
var _a2, _b, _c, _d;
|
|
1748
2973
|
const {
|
|
1749
2974
|
mirror: mirror2 = new Mirror(),
|
|
1750
2975
|
blockClass = "rr-block",
|
|
@@ -1766,7 +2991,8 @@ function snapshot(n2, options) {
|
|
|
1766
2991
|
iframeLoadTimeout,
|
|
1767
2992
|
onStylesheetLoad,
|
|
1768
2993
|
stylesheetLoadTimeout,
|
|
1769
|
-
keepIframeSrcFn = () => false
|
|
2994
|
+
keepIframeSrcFn = () => false,
|
|
2995
|
+
selector
|
|
1770
2996
|
} = options || {};
|
|
1771
2997
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1772
2998
|
color: true,
|
|
@@ -1804,6 +3030,22 @@ function snapshot(n2, options) {
|
|
|
1804
3030
|
headMetaVerification: true
|
|
1805
3031
|
}
|
|
1806
3032
|
) : slimDOM === false ? {} : slimDOM;
|
|
3033
|
+
const selectorOptions = selector === false ? null : selector === true ? {
|
|
3034
|
+
maxPathDepth: 10,
|
|
3035
|
+
enableSvgFingerprint: true,
|
|
3036
|
+
confidenceThreshold: 0.3,
|
|
3037
|
+
fallbackToBody: true
|
|
3038
|
+
} : selector === void 0 ? {
|
|
3039
|
+
maxPathDepth: 10,
|
|
3040
|
+
enableSvgFingerprint: true,
|
|
3041
|
+
confidenceThreshold: 0.3,
|
|
3042
|
+
fallbackToBody: true
|
|
3043
|
+
} : {
|
|
3044
|
+
maxPathDepth: (_a2 = selector.maxPathDepth) != null ? _a2 : 10,
|
|
3045
|
+
enableSvgFingerprint: (_b = selector.enableSvgFingerprint) != null ? _b : true,
|
|
3046
|
+
confidenceThreshold: (_c = selector.confidenceThreshold) != null ? _c : 0.3,
|
|
3047
|
+
fallbackToBody: (_d = selector.fallbackToBody) != null ? _d : true
|
|
3048
|
+
};
|
|
1807
3049
|
return serializeNodeWithId(n2, {
|
|
1808
3050
|
doc: n2,
|
|
1809
3051
|
mirror: mirror2,
|
|
@@ -1828,7 +3070,8 @@ function snapshot(n2, options) {
|
|
|
1828
3070
|
onStylesheetLoad,
|
|
1829
3071
|
stylesheetLoadTimeout,
|
|
1830
3072
|
keepIframeSrcFn,
|
|
1831
|
-
newlyAddedElement: false
|
|
3073
|
+
newlyAddedElement: false,
|
|
3074
|
+
selectorOptions
|
|
1832
3075
|
});
|
|
1833
3076
|
}
|
|
1834
3077
|
const MEDIA_SELECTOR = /(max|min)-device-(width|height)/;
|
|
@@ -1865,6 +3108,33 @@ const pseudoClassPlugin = {
|
|
|
1865
3108
|
};
|
|
1866
3109
|
}
|
|
1867
3110
|
};
|
|
3111
|
+
const animationFillModePlugin = {
|
|
3112
|
+
postcssPlugin: "postcss-animation-fill-mode",
|
|
3113
|
+
prepare: function() {
|
|
3114
|
+
return {
|
|
3115
|
+
Rule: function(rule2) {
|
|
3116
|
+
let hasAnimation = false;
|
|
3117
|
+
let hasAnimationFillMode = false;
|
|
3118
|
+
let animationDeclaration = null;
|
|
3119
|
+
rule2.walkDecls((decl) => {
|
|
3120
|
+
if (decl.prop === "animation") {
|
|
3121
|
+
hasAnimation = true;
|
|
3122
|
+
animationDeclaration = decl;
|
|
3123
|
+
}
|
|
3124
|
+
if (decl.prop === "animation-fill-mode") {
|
|
3125
|
+
hasAnimationFillMode = true;
|
|
3126
|
+
}
|
|
3127
|
+
});
|
|
3128
|
+
if (hasAnimation && !hasAnimationFillMode && animationDeclaration) {
|
|
3129
|
+
rule2.insertAfter(animationDeclaration, {
|
|
3130
|
+
prop: "animation-fill-mode",
|
|
3131
|
+
value: "forwards"
|
|
3132
|
+
});
|
|
3133
|
+
}
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
}
|
|
3137
|
+
};
|
|
1868
3138
|
function getDefaultExportFromCjs$1(x2) {
|
|
1869
3139
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
1870
3140
|
}
|
|
@@ -1883,12 +3153,12 @@ function getAugmentedNamespace$1(n2) {
|
|
|
1883
3153
|
} else
|
|
1884
3154
|
a2 = {};
|
|
1885
3155
|
Object.defineProperty(a2, "__esModule", { value: true });
|
|
1886
|
-
Object.keys(n2).forEach(function(
|
|
1887
|
-
var d = Object.getOwnPropertyDescriptor(n2,
|
|
1888
|
-
Object.defineProperty(a2,
|
|
3156
|
+
Object.keys(n2).forEach(function(k2) {
|
|
3157
|
+
var d = Object.getOwnPropertyDescriptor(n2, k2);
|
|
3158
|
+
Object.defineProperty(a2, k2, d.get ? d : {
|
|
1889
3159
|
enumerable: true,
|
|
1890
3160
|
get: function() {
|
|
1891
|
-
return n2[
|
|
3161
|
+
return n2[k2];
|
|
1892
3162
|
}
|
|
1893
3163
|
});
|
|
1894
3164
|
});
|
|
@@ -2335,7 +3605,7 @@ function cloneNode$1(obj, parent) {
|
|
|
2335
3605
|
} else if (i2 === "source") {
|
|
2336
3606
|
cloned[i2] = value;
|
|
2337
3607
|
} else if (Array.isArray(value)) {
|
|
2338
|
-
cloned[i2] = value.map((
|
|
3608
|
+
cloned[i2] = value.map((j2) => cloneNode$1(j2, cloned));
|
|
2339
3609
|
} else {
|
|
2340
3610
|
if (type === "object" && value !== null)
|
|
2341
3611
|
value = cloneNode$1(value);
|
|
@@ -2576,7 +3846,7 @@ let Node$5$1 = class Node2 {
|
|
|
2576
3846
|
}
|
|
2577
3847
|
return result2;
|
|
2578
3848
|
}
|
|
2579
|
-
toJSON(
|
|
3849
|
+
toJSON(_2, inputs) {
|
|
2580
3850
|
let fixed = {};
|
|
2581
3851
|
let emitInputs = inputs == null;
|
|
2582
3852
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -4292,8 +5562,8 @@ let Parser$1$1 = class Parser {
|
|
|
4292
5562
|
return;
|
|
4293
5563
|
let founded = 0;
|
|
4294
5564
|
let token;
|
|
4295
|
-
for (let
|
|
4296
|
-
token = tokens[
|
|
5565
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
5566
|
+
token = tokens[j2];
|
|
4297
5567
|
if (token[0] !== "space") {
|
|
4298
5568
|
founded += 1;
|
|
4299
5569
|
if (founded === 2)
|
|
@@ -4415,8 +5685,8 @@ let Parser$1$1 = class Parser {
|
|
|
4415
5685
|
} else if (token[1].toLowerCase() === "important") {
|
|
4416
5686
|
let cache = tokens.slice(0);
|
|
4417
5687
|
let str = "";
|
|
4418
|
-
for (let
|
|
4419
|
-
let type = cache[
|
|
5688
|
+
for (let j2 = i2; j2 > 0; j2--) {
|
|
5689
|
+
let type = cache[j2][0];
|
|
4420
5690
|
if (str.trim().indexOf("!") === 0 && type !== "space") {
|
|
4421
5691
|
break;
|
|
4422
5692
|
}
|
|
@@ -5609,7 +6879,8 @@ function adaptCssForReplay(cssText, cache) {
|
|
|
5609
6879
|
try {
|
|
5610
6880
|
const ast = postcss$1$1([
|
|
5611
6881
|
mediaSelectorPlugin,
|
|
5612
|
-
pseudoClassPlugin
|
|
6882
|
+
pseudoClassPlugin,
|
|
6883
|
+
animationFillModePlugin
|
|
5613
6884
|
]).process(cssText);
|
|
5614
6885
|
result2 = ast.css;
|
|
5615
6886
|
} catch (error) {
|
|
@@ -6142,12 +7413,12 @@ function getAugmentedNamespace(n2) {
|
|
|
6142
7413
|
} else
|
|
6143
7414
|
a2 = {};
|
|
6144
7415
|
Object.defineProperty(a2, "__esModule", { value: true });
|
|
6145
|
-
Object.keys(n2).forEach(function(
|
|
6146
|
-
var d = Object.getOwnPropertyDescriptor(n2,
|
|
6147
|
-
Object.defineProperty(a2,
|
|
7416
|
+
Object.keys(n2).forEach(function(k2) {
|
|
7417
|
+
var d = Object.getOwnPropertyDescriptor(n2, k2);
|
|
7418
|
+
Object.defineProperty(a2, k2, d.get ? d : {
|
|
6148
7419
|
enumerable: true,
|
|
6149
7420
|
get: function() {
|
|
6150
|
-
return n2[
|
|
7421
|
+
return n2[k2];
|
|
6151
7422
|
}
|
|
6152
7423
|
});
|
|
6153
7424
|
});
|
|
@@ -6594,7 +7865,7 @@ function cloneNode(obj, parent) {
|
|
|
6594
7865
|
} else if (i2 === "source") {
|
|
6595
7866
|
cloned[i2] = value;
|
|
6596
7867
|
} else if (Array.isArray(value)) {
|
|
6597
|
-
cloned[i2] = value.map((
|
|
7868
|
+
cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
|
|
6598
7869
|
} else {
|
|
6599
7870
|
if (type === "object" && value !== null)
|
|
6600
7871
|
value = cloneNode(value);
|
|
@@ -6835,7 +8106,7 @@ let Node$5 = class Node22 {
|
|
|
6835
8106
|
}
|
|
6836
8107
|
return result2;
|
|
6837
8108
|
}
|
|
6838
|
-
toJSON(
|
|
8109
|
+
toJSON(_2, inputs) {
|
|
6839
8110
|
let fixed = {};
|
|
6840
8111
|
let emitInputs = inputs == null;
|
|
6841
8112
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -8551,8 +9822,8 @@ let Parser$1 = class Parser2 {
|
|
|
8551
9822
|
return;
|
|
8552
9823
|
let founded = 0;
|
|
8553
9824
|
let token;
|
|
8554
|
-
for (let
|
|
8555
|
-
token = tokens[
|
|
9825
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
9826
|
+
token = tokens[j2];
|
|
8556
9827
|
if (token[0] !== "space") {
|
|
8557
9828
|
founded += 1;
|
|
8558
9829
|
if (founded === 2)
|
|
@@ -8674,8 +9945,8 @@ let Parser$1 = class Parser2 {
|
|
|
8674
9945
|
} else if (token[1].toLowerCase() === "important") {
|
|
8675
9946
|
let cache = tokens.slice(0);
|
|
8676
9947
|
let str = "";
|
|
8677
|
-
for (let
|
|
8678
|
-
let type = cache[
|
|
9948
|
+
for (let j2 = i2; j2 > 0; j2--) {
|
|
9949
|
+
let type = cache[j2][0];
|
|
8679
9950
|
if (str.trim().indexOf("!") === 0 && type !== "space") {
|
|
8680
9951
|
break;
|
|
8681
9952
|
}
|
|
@@ -9851,7 +11122,7 @@ const CUSTOM_PROPERTY_REGEX = /^--[a-zA-Z0-9-]+$/;
|
|
|
9851
11122
|
const camelize = (str) => {
|
|
9852
11123
|
if (CUSTOM_PROPERTY_REGEX.test(str))
|
|
9853
11124
|
return str;
|
|
9854
|
-
return str.replace(camelizeRE, (
|
|
11125
|
+
return str.replace(camelizeRE, (_2, c2) => c2 ? c2.toUpperCase() : "");
|
|
9855
11126
|
};
|
|
9856
11127
|
const hyphenateRE = /\B([A-Z])/g;
|
|
9857
11128
|
const hyphenate = (str) => {
|
|
@@ -14981,7 +16252,7 @@ class VisibilityManager {
|
|
|
14981
16252
|
}
|
|
14982
16253
|
}
|
|
14983
16254
|
}
|
|
14984
|
-
const version$1 = "
|
|
16255
|
+
const version$1 = "3.1.1-alpha.1";
|
|
14985
16256
|
let wrappedEmit;
|
|
14986
16257
|
let takeFullSnapshot$1;
|
|
14987
16258
|
let canvasManager;
|
|
@@ -15622,30 +16893,30 @@ const mittProxy = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
|
|
|
15622
16893
|
__proto__: null,
|
|
15623
16894
|
default: mitt$1
|
|
15624
16895
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
15625
|
-
function polyfill(
|
|
15626
|
-
if ("scrollBehavior" in d.documentElement.style &&
|
|
16896
|
+
function polyfill(w2 = window, d = document) {
|
|
16897
|
+
if ("scrollBehavior" in d.documentElement.style && w2.__forceSmoothScrollPolyfill__ !== true) {
|
|
15627
16898
|
return;
|
|
15628
16899
|
}
|
|
15629
|
-
const Element2 =
|
|
16900
|
+
const Element2 = w2.HTMLElement || w2.Element;
|
|
15630
16901
|
const SCROLL_TIME = 468;
|
|
15631
16902
|
const original = {
|
|
15632
|
-
scroll:
|
|
15633
|
-
scrollBy:
|
|
16903
|
+
scroll: w2.scroll || w2.scrollTo,
|
|
16904
|
+
scrollBy: w2.scrollBy,
|
|
15634
16905
|
elementScroll: Element2.prototype.scroll || scrollElement,
|
|
15635
16906
|
scrollIntoView: Element2.prototype.scrollIntoView
|
|
15636
16907
|
};
|
|
15637
|
-
const now =
|
|
16908
|
+
const now = w2.performance && w2.performance.now ? w2.performance.now.bind(w2.performance) : Date.now;
|
|
15638
16909
|
function isMicrosoftBrowser(userAgent) {
|
|
15639
16910
|
const userAgentPatterns = ["MSIE ", "Trident/", "Edge/"];
|
|
15640
16911
|
return new RegExp(userAgentPatterns.join("|")).test(userAgent);
|
|
15641
16912
|
}
|
|
15642
|
-
const ROUNDING_TOLERANCE = isMicrosoftBrowser(
|
|
16913
|
+
const ROUNDING_TOLERANCE = isMicrosoftBrowser(w2.navigator.userAgent) ? 1 : 0;
|
|
15643
16914
|
function scrollElement(x2, y) {
|
|
15644
16915
|
this.scrollLeft = x2;
|
|
15645
16916
|
this.scrollTop = y;
|
|
15646
16917
|
}
|
|
15647
|
-
function ease(
|
|
15648
|
-
return 0.5 * (1 - Math.cos(Math.PI *
|
|
16918
|
+
function ease(k2) {
|
|
16919
|
+
return 0.5 * (1 - Math.cos(Math.PI * k2));
|
|
15649
16920
|
}
|
|
15650
16921
|
function shouldBailOut(firstArg) {
|
|
15651
16922
|
if (firstArg === null || typeof firstArg !== "object" || firstArg.behavior === void 0 || firstArg.behavior === "auto" || firstArg.behavior === "instant") {
|
|
@@ -15667,7 +16938,7 @@ function polyfill(w = window, d = document) {
|
|
|
15667
16938
|
}
|
|
15668
16939
|
}
|
|
15669
16940
|
function canOverflow(el, axis) {
|
|
15670
|
-
const overflowValue =
|
|
16941
|
+
const overflowValue = w2.getComputedStyle(el, null)["overflow" + axis];
|
|
15671
16942
|
return overflowValue === "auto" || overflowValue === "scroll";
|
|
15672
16943
|
}
|
|
15673
16944
|
function isScrollable(el) {
|
|
@@ -15693,7 +16964,7 @@ function polyfill(w = window, d = document) {
|
|
|
15693
16964
|
currentY = context.startY + (context.y - context.startY) * value;
|
|
15694
16965
|
context.method.call(context.scrollable, currentX, currentY);
|
|
15695
16966
|
if (currentX !== context.x || currentY !== context.y) {
|
|
15696
|
-
|
|
16967
|
+
w2.requestAnimationFrame(step.bind(w2, context));
|
|
15697
16968
|
}
|
|
15698
16969
|
}
|
|
15699
16970
|
function smoothScroll(el, x2, y) {
|
|
@@ -15703,9 +16974,9 @@ function polyfill(w = window, d = document) {
|
|
|
15703
16974
|
let method;
|
|
15704
16975
|
const startTime = now();
|
|
15705
16976
|
if (el === d.body) {
|
|
15706
|
-
scrollable =
|
|
15707
|
-
startX =
|
|
15708
|
-
startY =
|
|
16977
|
+
scrollable = w2;
|
|
16978
|
+
startX = w2.scrollX || w2.pageXOffset;
|
|
16979
|
+
startY = w2.scrollY || w2.pageYOffset;
|
|
15709
16980
|
method = original.scroll;
|
|
15710
16981
|
} else {
|
|
15711
16982
|
scrollable = el;
|
|
@@ -15723,43 +16994,43 @@ function polyfill(w = window, d = document) {
|
|
|
15723
16994
|
y
|
|
15724
16995
|
});
|
|
15725
16996
|
}
|
|
15726
|
-
|
|
16997
|
+
w2.scroll = w2.scrollTo = function() {
|
|
15727
16998
|
if (arguments[0] === void 0) {
|
|
15728
16999
|
return;
|
|
15729
17000
|
}
|
|
15730
17001
|
if (shouldBailOut(arguments[0]) === true) {
|
|
15731
17002
|
original.scroll.call(
|
|
15732
|
-
|
|
15733
|
-
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] :
|
|
17003
|
+
w2,
|
|
17004
|
+
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] : w2.scrollX || w2.pageXOffset,
|
|
15734
17005
|
// use top prop, second argument if present or fallback to scrollY
|
|
15735
|
-
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] :
|
|
17006
|
+
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : w2.scrollY || w2.pageYOffset
|
|
15736
17007
|
);
|
|
15737
17008
|
return;
|
|
15738
17009
|
}
|
|
15739
17010
|
smoothScroll.call(
|
|
15740
|
-
|
|
17011
|
+
w2,
|
|
15741
17012
|
d.body,
|
|
15742
|
-
arguments[0].left !== void 0 ? ~~arguments[0].left :
|
|
15743
|
-
arguments[0].top !== void 0 ? ~~arguments[0].top :
|
|
17013
|
+
arguments[0].left !== void 0 ? ~~arguments[0].left : w2.scrollX || w2.pageXOffset,
|
|
17014
|
+
arguments[0].top !== void 0 ? ~~arguments[0].top : w2.scrollY || w2.pageYOffset
|
|
15744
17015
|
);
|
|
15745
17016
|
};
|
|
15746
|
-
|
|
17017
|
+
w2.scrollBy = function() {
|
|
15747
17018
|
if (arguments[0] === void 0) {
|
|
15748
17019
|
return;
|
|
15749
17020
|
}
|
|
15750
17021
|
if (shouldBailOut(arguments[0])) {
|
|
15751
17022
|
original.scrollBy.call(
|
|
15752
|
-
|
|
17023
|
+
w2,
|
|
15753
17024
|
arguments[0].left !== void 0 ? arguments[0].left : typeof arguments[0] !== "object" ? arguments[0] : 0,
|
|
15754
17025
|
arguments[0].top !== void 0 ? arguments[0].top : arguments[1] !== void 0 ? arguments[1] : 0
|
|
15755
17026
|
);
|
|
15756
17027
|
return;
|
|
15757
17028
|
}
|
|
15758
17029
|
smoothScroll.call(
|
|
15759
|
-
|
|
17030
|
+
w2,
|
|
15760
17031
|
d.body,
|
|
15761
|
-
~~arguments[0].left + (
|
|
15762
|
-
~~arguments[0].top + (
|
|
17032
|
+
~~arguments[0].left + (w2.scrollX || w2.pageXOffset),
|
|
17033
|
+
~~arguments[0].top + (w2.scrollY || w2.pageYOffset)
|
|
15763
17034
|
);
|
|
15764
17035
|
};
|
|
15765
17036
|
Element2.prototype.scroll = Element2.prototype.scrollTo = function() {
|
|
@@ -15824,15 +17095,15 @@ function polyfill(w = window, d = document) {
|
|
|
15824
17095
|
scrollableParent.scrollLeft + clientRects.left - parentRects.left,
|
|
15825
17096
|
scrollableParent.scrollTop + clientRects.top - parentRects.top
|
|
15826
17097
|
);
|
|
15827
|
-
if (
|
|
15828
|
-
|
|
17098
|
+
if (w2.getComputedStyle(scrollableParent).position !== "fixed") {
|
|
17099
|
+
w2.scrollBy({
|
|
15829
17100
|
left: parentRects.left,
|
|
15830
17101
|
top: parentRects.top,
|
|
15831
17102
|
behavior: "smooth"
|
|
15832
17103
|
});
|
|
15833
17104
|
}
|
|
15834
17105
|
} else {
|
|
15835
|
-
|
|
17106
|
+
w2.scrollBy({
|
|
15836
17107
|
left: clientRects.left,
|
|
15837
17108
|
top: clientRects.top,
|
|
15838
17109
|
behavior: "smooth"
|
|
@@ -16024,16 +17295,16 @@ function s(n2, o2) {
|
|
|
16024
17295
|
var S = b.value;
|
|
16025
17296
|
if (void 0 === S)
|
|
16026
17297
|
return c(p, g);
|
|
16027
|
-
var
|
|
17298
|
+
var w2 = "string" == typeof S ? { target: S } : S, j2 = w2.target, E = w2.actions, R = void 0 === E ? [] : E, N2 = w2.cond, O2 = void 0 === N2 ? function() {
|
|
16028
17299
|
return true;
|
|
16029
|
-
} :
|
|
16030
|
-
if (
|
|
16031
|
-
var
|
|
17300
|
+
} : N2, _2 = void 0 === j2, k2 = null != j2 ? j2 : p, T = n2.states[k2];
|
|
17301
|
+
if (O2(g, d)) {
|
|
17302
|
+
var q2 = t(f((_2 ? r(R) : [].concat(x2.exit, R, T.entry).filter(function(t2) {
|
|
16032
17303
|
return t2;
|
|
16033
17304
|
})).map(function(t2) {
|
|
16034
17305
|
return i(t2, y._options.actions);
|
|
16035
|
-
}), g, d), 3), z =
|
|
16036
|
-
return { value: C, context: A, actions: z, changed:
|
|
17306
|
+
}), g, d), 3), z = q2[0], A = q2[1], B2 = q2[2], C = null != j2 ? j2 : p;
|
|
17307
|
+
return { value: C, context: A, actions: z, changed: j2 !== p || z.length > 0 || B2, matches: a(C) };
|
|
16037
17308
|
}
|
|
16038
17309
|
}
|
|
16039
17310
|
} catch (t2) {
|
|
@@ -18518,7 +19789,7 @@ class Replayer {
|
|
|
18518
19789
|
this.config.logger.log(REPLAY_CONSOLE_PREFIX, ...args);
|
|
18519
19790
|
}
|
|
18520
19791
|
}
|
|
18521
|
-
const version = "
|
|
19792
|
+
const version = "3.1.1-alpha.1";
|
|
18522
19793
|
const { getVersion } = record;
|
|
18523
19794
|
const { isRecording } = record;
|
|
18524
19795
|
const { flushCustomEventQueue } = record;
|