@appsurify-testmap/rrweb-record 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-record.cjs +1349 -138
- package/dist/rrweb-record.cjs.map +1 -1
- package/dist/rrweb-record.js +1349 -138
- package/dist/rrweb-record.js.map +1 -1
- package/dist/rrweb-record.umd.cjs +1387 -144
- package/dist/rrweb-record.umd.cjs.map +2 -2
- package/dist/rrweb-record.umd.min.cjs +26 -26
- package/dist/rrweb-record.umd.min.cjs.map +3 -3
- package/package.json +4 -4
package/dist/rrweb-record.cjs
CHANGED
|
@@ -300,6 +300,7 @@ function stringifyRule(rule2, sheetHref) {
|
|
|
300
300
|
return importStringified;
|
|
301
301
|
} else {
|
|
302
302
|
let ruleStringified = rule2.cssText;
|
|
303
|
+
if (rule2.type === CSSRule.KEYFRAMES_RULE || rule2.type === CSSRule.KEYFRAME_RULE) ;
|
|
303
304
|
if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
|
|
304
305
|
ruleStringified = fixSafariColons(ruleStringified);
|
|
305
306
|
}
|
|
@@ -510,19 +511,19 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
510
511
|
_testNoPxNorm
|
|
511
512
|
);
|
|
512
513
|
const jLimit = 100;
|
|
513
|
-
let
|
|
514
|
-
for (;
|
|
514
|
+
let j2 = 3;
|
|
515
|
+
for (; j2 < textContentNorm.length; j2++) {
|
|
515
516
|
if (
|
|
516
517
|
// keep consuming css identifiers (to get a decent chunk more quickly)
|
|
517
|
-
textContentNorm[
|
|
518
|
-
textContentNorm.indexOf(textContentNorm.substring(0,
|
|
518
|
+
textContentNorm[j2].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
|
|
519
|
+
textContentNorm.indexOf(textContentNorm.substring(0, j2), 1) !== -1
|
|
519
520
|
) {
|
|
520
521
|
continue;
|
|
521
522
|
}
|
|
522
523
|
break;
|
|
523
524
|
}
|
|
524
|
-
for (;
|
|
525
|
-
let startSubstring = textContentNorm.substring(0,
|
|
525
|
+
for (; j2 < textContentNorm.length; j2++) {
|
|
526
|
+
let startSubstring = textContentNorm.substring(0, j2);
|
|
526
527
|
let cssNormSplits = cssTextNorm.split(startSubstring);
|
|
527
528
|
let splitNorm = -1;
|
|
528
529
|
if (cssNormSplits.length === 2) {
|
|
@@ -539,11 +540,11 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
539
540
|
splits.push(cssText);
|
|
540
541
|
return splits;
|
|
541
542
|
}
|
|
542
|
-
|
|
543
|
-
} else if (
|
|
543
|
+
j2 = jLimit + 1;
|
|
544
|
+
} else if (j2 === textContentNorm.length - 1) {
|
|
544
545
|
splitNorm = cssTextNorm.indexOf(startSubstring);
|
|
545
546
|
}
|
|
546
|
-
if (cssNormSplits.length >= 2 &&
|
|
547
|
+
if (cssNormSplits.length >= 2 && j2 > jLimit) {
|
|
547
548
|
const prevTextContent = childNodes2[i2 - 1].textContent;
|
|
548
549
|
if (prevTextContent && typeof prevTextContent === "string") {
|
|
549
550
|
const prevMinLength = normalizeCssString(prevTextContent).length;
|
|
@@ -554,29 +555,29 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
554
555
|
}
|
|
555
556
|
}
|
|
556
557
|
if (splitNorm !== -1) {
|
|
557
|
-
let
|
|
558
|
-
for (;
|
|
558
|
+
let k2 = Math.floor(splitNorm / normFactor);
|
|
559
|
+
for (; k2 > 0 && k2 < cssText.length; ) {
|
|
559
560
|
iterCount += 1;
|
|
560
561
|
if (iterCount > 50 * childNodes2.length) {
|
|
561
562
|
splits.push(cssText);
|
|
562
563
|
return splits;
|
|
563
564
|
}
|
|
564
565
|
const normPart = normalizeCssString(
|
|
565
|
-
cssText.substring(0,
|
|
566
|
+
cssText.substring(0, k2),
|
|
566
567
|
_testNoPxNorm
|
|
567
568
|
);
|
|
568
569
|
if (normPart.length === splitNorm) {
|
|
569
|
-
splits.push(cssText.substring(0,
|
|
570
|
-
cssText = cssText.substring(
|
|
570
|
+
splits.push(cssText.substring(0, k2));
|
|
571
|
+
cssText = cssText.substring(k2);
|
|
571
572
|
cssTextNorm = cssTextNorm.substring(splitNorm);
|
|
572
573
|
break;
|
|
573
574
|
} else if (normPart.length < splitNorm) {
|
|
574
|
-
|
|
575
|
+
k2 += Math.max(
|
|
575
576
|
1,
|
|
576
577
|
Math.floor((splitNorm - normPart.length) / normFactor)
|
|
577
578
|
);
|
|
578
579
|
} else {
|
|
579
|
-
|
|
580
|
+
k2 -= Math.max(
|
|
580
581
|
1,
|
|
581
582
|
Math.floor((normPart.length - splitNorm) * normFactor)
|
|
582
583
|
);
|
|
@@ -594,96 +595,6 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
|
|
|
594
595
|
function markCssSplits(cssText, style) {
|
|
595
596
|
return splitCssText(cssText, style).join("/* rr_split */");
|
|
596
597
|
}
|
|
597
|
-
function isSelectorUnique(selector, target) {
|
|
598
|
-
try {
|
|
599
|
-
const matches = document.querySelectorAll(selector);
|
|
600
|
-
return matches.length === 1 && matches[0] === target;
|
|
601
|
-
} catch {
|
|
602
|
-
return false;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
function buildSelector(node2) {
|
|
606
|
-
if (!(node2 instanceof Element)) return null;
|
|
607
|
-
if (node2.id) {
|
|
608
|
-
return `#${CSS.escape(node2.id)}`;
|
|
609
|
-
}
|
|
610
|
-
const parts = [];
|
|
611
|
-
const tag = node2.tagName.toLowerCase();
|
|
612
|
-
if (node2.classList.length) {
|
|
613
|
-
parts.push(...Array.from(node2.classList).map((cls) => `.${CSS.escape(cls)}`));
|
|
614
|
-
}
|
|
615
|
-
Array.from(node2.attributes).forEach((attr) => {
|
|
616
|
-
if (attr.name.startsWith("data-")) {
|
|
617
|
-
parts.push(`[${attr.name}="${CSS.escape(attr.value)}"]`);
|
|
618
|
-
}
|
|
619
|
-
});
|
|
620
|
-
const shortSelector = `${tag}${parts.join("")}`;
|
|
621
|
-
if (isSelectorUnique(shortSelector, node2)) {
|
|
622
|
-
return shortSelector;
|
|
623
|
-
}
|
|
624
|
-
const pathParts = [];
|
|
625
|
-
let current = node2;
|
|
626
|
-
while (current && current.nodeType === Node.ELEMENT_NODE) {
|
|
627
|
-
const parent = current.parentElement;
|
|
628
|
-
const tagName = current.tagName.toLowerCase();
|
|
629
|
-
let nth = "";
|
|
630
|
-
if (parent) {
|
|
631
|
-
const siblings = Array.from(parent.children).filter(
|
|
632
|
-
(el) => el.tagName.toLowerCase() === tagName
|
|
633
|
-
);
|
|
634
|
-
if (siblings.length > 1) {
|
|
635
|
-
nth = `:nth-of-type(${siblings.indexOf(current) + 1})`;
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
pathParts.unshift(`${tagName}${nth}`);
|
|
639
|
-
current = parent;
|
|
640
|
-
}
|
|
641
|
-
return pathParts.join(" > ") || null;
|
|
642
|
-
}
|
|
643
|
-
function buildXPath(node2) {
|
|
644
|
-
switch (node2.nodeType) {
|
|
645
|
-
case Node.DOCUMENT_NODE:
|
|
646
|
-
return "/";
|
|
647
|
-
case Node.DOCUMENT_TYPE_NODE:
|
|
648
|
-
return "/html/doctype";
|
|
649
|
-
case Node.ELEMENT_NODE: {
|
|
650
|
-
const element = node2;
|
|
651
|
-
if (element.id) {
|
|
652
|
-
return `//*[@id="${CSS.escape(element.id)}"]`;
|
|
653
|
-
}
|
|
654
|
-
if (element.tagName.toLowerCase() === "html") return "/html";
|
|
655
|
-
if (element === document.head) return "/html/head";
|
|
656
|
-
if (element === document.body) return "/html/body";
|
|
657
|
-
const parent = element.parentNode;
|
|
658
|
-
if (!parent) return "";
|
|
659
|
-
const tag = element.tagName.toLowerCase();
|
|
660
|
-
const siblings = Array.from(parent.children).filter(
|
|
661
|
-
(el) => el.tagName.toLowerCase() === tag
|
|
662
|
-
);
|
|
663
|
-
const index2 = siblings.length > 1 ? `[${siblings.indexOf(element) + 1}]` : "";
|
|
664
|
-
return `${buildXPath(parent)}/${tag}${index2}`;
|
|
665
|
-
}
|
|
666
|
-
case Node.TEXT_NODE:
|
|
667
|
-
case Node.CDATA_SECTION_NODE:
|
|
668
|
-
case Node.COMMENT_NODE: {
|
|
669
|
-
const parent = node2.parentNode;
|
|
670
|
-
if (!parent) return "";
|
|
671
|
-
const typeMap = {
|
|
672
|
-
[Node.TEXT_NODE]: "text()",
|
|
673
|
-
[Node.CDATA_SECTION_NODE]: "text()",
|
|
674
|
-
// CDATA ≡ text() в XPath
|
|
675
|
-
[Node.COMMENT_NODE]: "comment()"
|
|
676
|
-
};
|
|
677
|
-
const sameTypeSiblings = Array.from(parent.childNodes).filter(
|
|
678
|
-
(sibling) => sibling.nodeType === node2.nodeType
|
|
679
|
-
);
|
|
680
|
-
const index2 = sameTypeSiblings.length > 1 ? `[${sameTypeSiblings.indexOf(node2)}]` : "";
|
|
681
|
-
return `${buildXPath(parent)}/${typeMap[node2.nodeType]}${index2}`;
|
|
682
|
-
}
|
|
683
|
-
default:
|
|
684
|
-
return "";
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
598
|
function isTextVisible(n2) {
|
|
688
599
|
var _a2;
|
|
689
600
|
const parent = index$1.parentNode(n2);
|
|
@@ -816,6 +727,1274 @@ try {
|
|
|
816
727
|
}
|
|
817
728
|
} catch (error) {
|
|
818
729
|
}
|
|
730
|
+
const L = {
|
|
731
|
+
ANCHOR: 0.4,
|
|
732
|
+
PATH: 0.3,
|
|
733
|
+
TARGET: 0.2,
|
|
734
|
+
UNIQUENESS: 0.1
|
|
735
|
+
}, I = {
|
|
736
|
+
SEMANTIC_TAG: 0.5,
|
|
737
|
+
ROLE: 0.3,
|
|
738
|
+
ARIA_LABEL: 0.1,
|
|
739
|
+
STABLE_ID: 0.1,
|
|
740
|
+
TEST_MARKER: 0.05,
|
|
741
|
+
DEPTH_PENALTY_THRESHOLD: 5,
|
|
742
|
+
DEPTH_PENALTY_FACTOR: 0.05,
|
|
743
|
+
DEGRADED_SCORE: 0.3
|
|
744
|
+
}, ct = {
|
|
745
|
+
MIN_CONFIDENCE_FOR_SKIP: 0.7
|
|
746
|
+
}, X = [
|
|
747
|
+
"form",
|
|
748
|
+
"main",
|
|
749
|
+
"nav",
|
|
750
|
+
"section",
|
|
751
|
+
"article",
|
|
752
|
+
"footer",
|
|
753
|
+
"header"
|
|
754
|
+
], K = [
|
|
755
|
+
"form",
|
|
756
|
+
"navigation",
|
|
757
|
+
"main",
|
|
758
|
+
"region",
|
|
759
|
+
"contentinfo",
|
|
760
|
+
"complementary",
|
|
761
|
+
"banner",
|
|
762
|
+
"search"
|
|
763
|
+
], lt = [
|
|
764
|
+
// HTML5 Semantic
|
|
765
|
+
"article",
|
|
766
|
+
"aside",
|
|
767
|
+
"details",
|
|
768
|
+
"figcaption",
|
|
769
|
+
"figure",
|
|
770
|
+
"footer",
|
|
771
|
+
"header",
|
|
772
|
+
"main",
|
|
773
|
+
"mark",
|
|
774
|
+
"nav",
|
|
775
|
+
"section",
|
|
776
|
+
"summary",
|
|
777
|
+
"time",
|
|
778
|
+
// Form elements
|
|
779
|
+
"button",
|
|
780
|
+
"datalist",
|
|
781
|
+
"fieldset",
|
|
782
|
+
"form",
|
|
783
|
+
"input",
|
|
784
|
+
"label",
|
|
785
|
+
"legend",
|
|
786
|
+
"meter",
|
|
787
|
+
"optgroup",
|
|
788
|
+
"option",
|
|
789
|
+
"output",
|
|
790
|
+
"progress",
|
|
791
|
+
"select",
|
|
792
|
+
"textarea",
|
|
793
|
+
// Interactive
|
|
794
|
+
"a",
|
|
795
|
+
"audio",
|
|
796
|
+
"video",
|
|
797
|
+
"canvas",
|
|
798
|
+
"dialog",
|
|
799
|
+
"menu",
|
|
800
|
+
// Text content
|
|
801
|
+
"blockquote",
|
|
802
|
+
"dd",
|
|
803
|
+
"dl",
|
|
804
|
+
"dt",
|
|
805
|
+
"hr",
|
|
806
|
+
"li",
|
|
807
|
+
"ol",
|
|
808
|
+
"ul",
|
|
809
|
+
"p",
|
|
810
|
+
"pre",
|
|
811
|
+
"h1",
|
|
812
|
+
"h2",
|
|
813
|
+
"h3",
|
|
814
|
+
"h4",
|
|
815
|
+
"h5",
|
|
816
|
+
"h6",
|
|
817
|
+
// Table
|
|
818
|
+
"caption",
|
|
819
|
+
"col",
|
|
820
|
+
"colgroup",
|
|
821
|
+
"table",
|
|
822
|
+
"tbody",
|
|
823
|
+
"td",
|
|
824
|
+
"tfoot",
|
|
825
|
+
"th",
|
|
826
|
+
"thead",
|
|
827
|
+
"tr",
|
|
828
|
+
// SVG
|
|
829
|
+
"svg",
|
|
830
|
+
"path",
|
|
831
|
+
"circle",
|
|
832
|
+
"rect",
|
|
833
|
+
"line",
|
|
834
|
+
"polyline",
|
|
835
|
+
"polygon",
|
|
836
|
+
"ellipse",
|
|
837
|
+
"g",
|
|
838
|
+
"text",
|
|
839
|
+
"use"
|
|
840
|
+
], w = {
|
|
841
|
+
// Test attributes (highest priority)
|
|
842
|
+
"data-testid": 100,
|
|
843
|
+
"data-qa": 99,
|
|
844
|
+
"data-cy": 98,
|
|
845
|
+
"data-test": 97,
|
|
846
|
+
"data-test-id": 96,
|
|
847
|
+
// ARIA (accessibility semantics)
|
|
848
|
+
"aria-label": 90,
|
|
849
|
+
"aria-labelledby": 85,
|
|
850
|
+
"aria-describedby": 80,
|
|
851
|
+
// Semantic HTML attributes
|
|
852
|
+
name: 75,
|
|
853
|
+
href: 70,
|
|
854
|
+
// for <a>
|
|
855
|
+
src: 70,
|
|
856
|
+
// for <img>, <script>, etc.
|
|
857
|
+
type: 65,
|
|
858
|
+
role: 60,
|
|
859
|
+
alt: 55,
|
|
860
|
+
title: 50,
|
|
861
|
+
for: 45,
|
|
862
|
+
placeholder: 40,
|
|
863
|
+
// Any data-* attribute (if not above)
|
|
864
|
+
"data-*": 30,
|
|
865
|
+
// Any aria-* attribute (if not above)
|
|
866
|
+
"aria-*": 25
|
|
867
|
+
}, B = /* @__PURE__ */ new Set([
|
|
868
|
+
"id",
|
|
869
|
+
// handled separately
|
|
870
|
+
"class",
|
|
871
|
+
// handled separately
|
|
872
|
+
"style",
|
|
873
|
+
// unstable
|
|
874
|
+
"xmlns",
|
|
875
|
+
// service attribute for SVG
|
|
876
|
+
"tabindex",
|
|
877
|
+
// can change
|
|
878
|
+
"contenteditable"
|
|
879
|
+
]), ut = {
|
|
880
|
+
maxPathDepth: 10,
|
|
881
|
+
enableSvgFingerprint: true,
|
|
882
|
+
confidenceThreshold: 0.1,
|
|
883
|
+
fallbackToBody: true,
|
|
884
|
+
includeUtilityClasses: false,
|
|
885
|
+
source: "dom-dsl"
|
|
886
|
+
};
|
|
887
|
+
function D(n2) {
|
|
888
|
+
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));
|
|
889
|
+
}
|
|
890
|
+
const G = /* @__PURE__ */ new Set([
|
|
891
|
+
"aria-labelledby",
|
|
892
|
+
"aria-describedby",
|
|
893
|
+
"aria-controls",
|
|
894
|
+
"aria-owns",
|
|
895
|
+
"aria-activedescendant",
|
|
896
|
+
"for",
|
|
897
|
+
"form",
|
|
898
|
+
"list",
|
|
899
|
+
"headers",
|
|
900
|
+
"aria-details",
|
|
901
|
+
"aria-errormessage",
|
|
902
|
+
"aria-flowto"
|
|
903
|
+
]);
|
|
904
|
+
function V(n2) {
|
|
905
|
+
return n2.trim().split(/\s+/).some((e2) => D(e2));
|
|
906
|
+
}
|
|
907
|
+
class ft {
|
|
908
|
+
constructor(t2, e2) {
|
|
909
|
+
this.maxDepth = t2.maxPathDepth ?? 10, this.cache = e2;
|
|
910
|
+
}
|
|
911
|
+
/**
|
|
912
|
+
* Finds the best anchor element for the target
|
|
913
|
+
* @param target - Target element to find anchor for
|
|
914
|
+
* @returns Anchor result or null if not found
|
|
915
|
+
*/
|
|
916
|
+
findAnchor(t2) {
|
|
917
|
+
if (this.cache) {
|
|
918
|
+
const i2 = this.cache.getAnchor(t2);
|
|
919
|
+
if (i2 !== void 0)
|
|
920
|
+
return i2;
|
|
921
|
+
}
|
|
922
|
+
let e2 = t2.parentElement, s2 = 0, r2 = null;
|
|
923
|
+
for (; e2 && s2 < this.maxDepth; ) {
|
|
924
|
+
if (e2.tagName.toLowerCase() === "body")
|
|
925
|
+
return r2 || {
|
|
926
|
+
element: e2,
|
|
927
|
+
score: I.DEGRADED_SCORE,
|
|
928
|
+
tier: "C",
|
|
929
|
+
depth: s2
|
|
930
|
+
};
|
|
931
|
+
const i2 = this.scoreAnchor(e2);
|
|
932
|
+
if (i2 > 0) {
|
|
933
|
+
const o2 = this.applyDepthPenalty(i2, s2), l2 = this.getTier(e2), u2 = { element: e2, score: o2, tier: l2, depth: s2 };
|
|
934
|
+
if (l2 === "A")
|
|
935
|
+
return u2;
|
|
936
|
+
(!r2 || o2 > r2.score) && (r2 = u2);
|
|
937
|
+
}
|
|
938
|
+
e2 = e2.parentElement, s2++;
|
|
939
|
+
}
|
|
940
|
+
const a2 = r2;
|
|
941
|
+
return this.cache && this.cache.setAnchor(t2, a2), a2;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Scores an element as anchor candidate (without depth penalty)
|
|
945
|
+
* @param element - Element to score
|
|
946
|
+
* @returns Raw score from 0 to 1
|
|
947
|
+
*/
|
|
948
|
+
scoreAnchor(t2) {
|
|
949
|
+
let e2 = 0;
|
|
950
|
+
const s2 = t2.tagName.toLowerCase();
|
|
951
|
+
X.includes(s2) && (e2 += I.SEMANTIC_TAG);
|
|
952
|
+
const r2 = t2.getAttribute("role");
|
|
953
|
+
r2 && K.includes(r2) && (e2 += I.ROLE), (t2.hasAttribute("aria-label") || t2.hasAttribute("aria-labelledby")) && (e2 += I.ARIA_LABEL);
|
|
954
|
+
const a2 = t2.id;
|
|
955
|
+
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);
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* Applies depth penalty to score
|
|
959
|
+
* Following SPECIFICATION.md §7: depthPenalty = (depth - threshold) * factor
|
|
960
|
+
*/
|
|
961
|
+
applyDepthPenalty(t2, e2) {
|
|
962
|
+
if (e2 <= I.DEPTH_PENALTY_THRESHOLD)
|
|
963
|
+
return t2;
|
|
964
|
+
const s2 = (e2 - I.DEPTH_PENALTY_THRESHOLD) * I.DEPTH_PENALTY_FACTOR;
|
|
965
|
+
return Math.max(0, t2 - s2);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Determines the tier of an anchor element
|
|
969
|
+
*/
|
|
970
|
+
getTier(t2) {
|
|
971
|
+
const e2 = t2.tagName.toLowerCase();
|
|
972
|
+
if (X.includes(e2))
|
|
973
|
+
return "A";
|
|
974
|
+
const s2 = t2.getAttribute("role");
|
|
975
|
+
return s2 && K.includes(s2) ? "B" : "C";
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
const gt = [
|
|
979
|
+
// CSS-in-JS
|
|
980
|
+
/^css-[a-z0-9]+$/i,
|
|
981
|
+
/^sc-[a-z0-9]+-\d+$/i,
|
|
982
|
+
/^[a-z]{5,8}$/i,
|
|
983
|
+
// Short generated classes (abcdef)
|
|
984
|
+
// Material-UI / MUI
|
|
985
|
+
/^Mui[A-Z]\w+-\w+-\w+/,
|
|
986
|
+
/^makeStyles-\w+-\d+$/,
|
|
987
|
+
// JSS
|
|
988
|
+
/^jss\d+$/,
|
|
989
|
+
// Emotion / Linaria
|
|
990
|
+
/^(emotion|linaria)-[a-z0-9]+/i,
|
|
991
|
+
// Component libraries with hashes
|
|
992
|
+
/^(chakra|tw-|ant-)[a-z0-9]+-\w+/i,
|
|
993
|
+
// Hash-based (hashes in classes)
|
|
994
|
+
/-[a-f0-9]{6,}$/i,
|
|
995
|
+
/^_[a-z0-9]{5,}$/i,
|
|
996
|
+
/\d{5,}/
|
|
997
|
+
// 5+ digits in a row
|
|
998
|
+
], pt = [
|
|
999
|
+
// === FIX 4: Tailwind arbitrary values and variants (highest priority) ===
|
|
1000
|
+
/^\[/,
|
|
1001
|
+
// Any arbitrary value or variant starting with [ (e.g., [&_svg]:..., [mask-type:luminance])
|
|
1002
|
+
// === FIX 4: Pseudo-class variants (must be before specific patterns) ===
|
|
1003
|
+
/^(first|last|odd|even|only|first-of-type|last-of-type|only-of-type):/,
|
|
1004
|
+
// first:, last:, etc.
|
|
1005
|
+
/^(hover|focus|active|disabled|enabled|checked|indeterminate|default|required|valid|invalid|in-range|out-of-range|placeholder-shown|autofill|read-only):/,
|
|
1006
|
+
// State pseudo-classes
|
|
1007
|
+
/^(focus-within|focus-visible|visited|target|open):/,
|
|
1008
|
+
// Advanced pseudo-classes
|
|
1009
|
+
// === FIX 4: Responsive variants (must be before specific patterns) ===
|
|
1010
|
+
/^(sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl):/,
|
|
1011
|
+
// === FIX 4: Dark mode and directional variants ===
|
|
1012
|
+
/^dark:/,
|
|
1013
|
+
/^(rtl|ltr):/,
|
|
1014
|
+
// === FIX 4: Group and peer variants ===
|
|
1015
|
+
/^(group|peer)(-hover|-focus|-active)?:/,
|
|
1016
|
+
// === FIX 4: Tailwind utilities with fraction values ===
|
|
1017
|
+
/\/([\d.]+|full|auto|screen)$/,
|
|
1018
|
+
// /50, /100, /full, /auto, /screen
|
|
1019
|
+
// === FIX 4: Positioning utilities ===
|
|
1020
|
+
/^(inset|top|right|bottom|left)(-|$)/,
|
|
1021
|
+
// inset-0, top-0, left-0
|
|
1022
|
+
// === Layout & Display ===
|
|
1023
|
+
/^(flex|inline-flex|grid|block|inline|inline-block|hidden|visible)$/,
|
|
1024
|
+
/^(absolute|relative|fixed|sticky|static)$/,
|
|
1025
|
+
// === Flexbox & Grid ===
|
|
1026
|
+
/^(items|justify|content|self|place)-/,
|
|
1027
|
+
/^flex-(row|col|wrap|nowrap|1|auto|initial|none)/,
|
|
1028
|
+
/^grid-(cols|rows|flow)/,
|
|
1029
|
+
// === Spacing (Tailwind) ===
|
|
1030
|
+
/^(gap|space)-/,
|
|
1031
|
+
/^[mp][trblxy]?-(\d+|auto|px)$/,
|
|
1032
|
+
// === Negative Tailwind utilities (margins, positioning, transforms) ===
|
|
1033
|
+
/^-[mp][trblxy]?-\d+$/,
|
|
1034
|
+
// -m-4, -mt-2, -mx-4, -px-4, -py-2
|
|
1035
|
+
/^-(top|right|bottom|left|inset)-\d+$/,
|
|
1036
|
+
// -top-4, -bottom-6, -left-6, -inset-0
|
|
1037
|
+
/^-z-\d+$/,
|
|
1038
|
+
// -z-10, -z-20
|
|
1039
|
+
/^-space-[xy]-\d+$/,
|
|
1040
|
+
// -space-x-2, -space-y-4
|
|
1041
|
+
/^-translate-[xy]-\d+$/,
|
|
1042
|
+
// -translate-x-4, -translate-y-2
|
|
1043
|
+
/^-rotate-\d+$/,
|
|
1044
|
+
// -rotate-45, -rotate-90
|
|
1045
|
+
/^-scale-\d+$/,
|
|
1046
|
+
// -scale-50, -scale-75
|
|
1047
|
+
/^-skew-[xy]-\d+$/,
|
|
1048
|
+
// -skew-x-12, -skew-y-6
|
|
1049
|
+
// === Sizing ===
|
|
1050
|
+
/^(w|h|min-w|min-h|max-w|max-h|size)-/,
|
|
1051
|
+
// === Colors & Styling ===
|
|
1052
|
+
// Note: text-* can be semantic (text-muted, text-primary) or utility (text-center, text-lg)
|
|
1053
|
+
// More specific patterns for utility text-* classes
|
|
1054
|
+
/^text-(center|left|right|justify|start|end|xs|sm|base|lg|xl|2xl|3xl|4xl|5xl|6xl|7xl|8xl|9xl)$/,
|
|
1055
|
+
/^text-(uppercase|lowercase|capitalize|normal-case|underline|line-through|no-underline)$/,
|
|
1056
|
+
/^text-(truncate|ellipsis|clip)$/,
|
|
1057
|
+
/^(bg|border|ring|shadow|outline)-/,
|
|
1058
|
+
/^rounded(-|$)/,
|
|
1059
|
+
// === Typography ===
|
|
1060
|
+
/^(font|leading|tracking|whitespace|break|truncate)-/,
|
|
1061
|
+
/^(uppercase|lowercase|capitalize|normal-case)$/,
|
|
1062
|
+
// === Transform & Animation (IMPORTANT!) ===
|
|
1063
|
+
/^(transform|transition|duration|delay|ease|animate)-/,
|
|
1064
|
+
/^(scale|rotate|translate|skew)-/,
|
|
1065
|
+
/^transform$/,
|
|
1066
|
+
/^backdrop-blur-/,
|
|
1067
|
+
/^motion-/,
|
|
1068
|
+
// Framer Motion
|
|
1069
|
+
/^(fade|slide|zoom|bounce|pulse|spin|ping)-/,
|
|
1070
|
+
// animations
|
|
1071
|
+
// === Overflow & Scrolling ===
|
|
1072
|
+
/^(overflow|overscroll|scroll)-/,
|
|
1073
|
+
/^object-(contain|cover|fill|none|scale-down)$/,
|
|
1074
|
+
// === Interactivity ===
|
|
1075
|
+
/^(cursor|pointer-events|select|resize)-/,
|
|
1076
|
+
// === Visibility & Opacity ===
|
|
1077
|
+
/^(opacity|z)-/,
|
|
1078
|
+
/^(visible|invisible|collapse)$/,
|
|
1079
|
+
// === Bootstrap utilities ===
|
|
1080
|
+
/^d-(none|inline|inline-block|block|grid|table|flex)$/,
|
|
1081
|
+
/^(float|clearfix|text)-(left|right|center|justify|start|end)$/,
|
|
1082
|
+
/^(m|p)[trblxy]?-[0-5]$/,
|
|
1083
|
+
/^(w|h)-(25|50|75|100|auto)$/,
|
|
1084
|
+
// Note: btn-* classes are semantic (component classes), not utility
|
|
1085
|
+
// /^btn-(primary|secondary|success|danger|warning|info|light|dark|link)$/,
|
|
1086
|
+
/^btn-(sm|lg|block)$/,
|
|
1087
|
+
// Only size modifiers are utility
|
|
1088
|
+
/^text-(muted|primary|success|danger|warning|info|light|dark|white)$/,
|
|
1089
|
+
/^bg-(primary|secondary|success|danger|warning|info|light|dark|white|transparent)$/,
|
|
1090
|
+
/^border(-top|-bottom|-left|-right)?(-0)?$/,
|
|
1091
|
+
/^rounded(-top|-bottom|-left|-right|-circle|-pill|-0)?$/,
|
|
1092
|
+
/^shadow(-sm|-lg|-none)?$/,
|
|
1093
|
+
/^(align|justify|order|flex)-(start|end|center|between|around|fill|grow|shrink)$/,
|
|
1094
|
+
/^col(-sm|-md|-lg|-xl)?(-\d+|-auto)?$/,
|
|
1095
|
+
/^row(-cols)?(-\d+)?$/,
|
|
1096
|
+
/^g[xy]?-[0-5]$/,
|
|
1097
|
+
/^(show|hide|invisible|visible)$/,
|
|
1098
|
+
/^(position|top|bottom|start|end)-(static|relative|absolute|fixed|sticky|-\d+)$/,
|
|
1099
|
+
// === Common utility patterns ===
|
|
1100
|
+
/^(row|col)$/,
|
|
1101
|
+
/^clearfix$/,
|
|
1102
|
+
/^pull-(left|right)$/,
|
|
1103
|
+
/^float-(left|right|none)$/
|
|
1104
|
+
];
|
|
1105
|
+
function _(n2) {
|
|
1106
|
+
return gt.some((t2) => t2.test(n2));
|
|
1107
|
+
}
|
|
1108
|
+
function q(n2) {
|
|
1109
|
+
return n2.length <= 2 || /^\d/.test(n2) ? true : pt.some((t2) => t2.test(n2));
|
|
1110
|
+
}
|
|
1111
|
+
function St(n2) {
|
|
1112
|
+
return !_(n2) && !q(n2);
|
|
1113
|
+
}
|
|
1114
|
+
function N(n2) {
|
|
1115
|
+
return n2.filter((t2) => St(t2));
|
|
1116
|
+
}
|
|
1117
|
+
function At(n2) {
|
|
1118
|
+
const t2 = [], e2 = [];
|
|
1119
|
+
for (const s2 of n2)
|
|
1120
|
+
q(s2) || _(s2) ? e2.push(s2) : t2.push(s2);
|
|
1121
|
+
return { semantic: t2, utility: e2 };
|
|
1122
|
+
}
|
|
1123
|
+
function J(n2) {
|
|
1124
|
+
return q(n2) || _(n2);
|
|
1125
|
+
}
|
|
1126
|
+
const tt = (n2) => n2.replace(/([#:.[\]@])/g, "\\$1");
|
|
1127
|
+
class xt {
|
|
1128
|
+
constructor(t2, e2) {
|
|
1129
|
+
this.maxDepth = t2.maxPathDepth ?? 10, this.cache = e2;
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Builds path from anchor to target (excluding both)
|
|
1133
|
+
* @param anchor - Anchor element (start)
|
|
1134
|
+
* @param target - Target element (end)
|
|
1135
|
+
* @param extractor - Semantic extractor instance
|
|
1136
|
+
* @returns Path build result with nodes and degradation info
|
|
1137
|
+
*/
|
|
1138
|
+
buildPath(t2, e2, s2) {
|
|
1139
|
+
const r2 = [];
|
|
1140
|
+
let a2 = e2.parentElement;
|
|
1141
|
+
for (; a2 && a2 !== t2 && r2.length < this.maxDepth; )
|
|
1142
|
+
r2.unshift(a2), a2 = a2.parentElement;
|
|
1143
|
+
const i2 = r2.length >= this.maxDepth && a2 !== t2;
|
|
1144
|
+
let o2 = this.filterNoise(r2);
|
|
1145
|
+
return o2 = this.ensureUniqueness(r2, o2, t2, e2, s2), {
|
|
1146
|
+
path: o2.map((u2) => {
|
|
1147
|
+
const d = u2.parentElement;
|
|
1148
|
+
let c2;
|
|
1149
|
+
if (d) {
|
|
1150
|
+
const g = Array.from(d.children).indexOf(u2);
|
|
1151
|
+
g !== -1 && (c2 = g + 1);
|
|
1152
|
+
}
|
|
1153
|
+
return {
|
|
1154
|
+
tag: u2.tagName.toLowerCase(),
|
|
1155
|
+
semantics: s2.extract(u2),
|
|
1156
|
+
score: s2.scoreElement(u2),
|
|
1157
|
+
nthChild: c2
|
|
1158
|
+
};
|
|
1159
|
+
}),
|
|
1160
|
+
degraded: i2,
|
|
1161
|
+
degradationReason: i2 ? "path-depth-overflow" : void 0
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Legacy method for backward compatibility
|
|
1166
|
+
*/
|
|
1167
|
+
buildPathNodes(t2, e2, s2) {
|
|
1168
|
+
return this.buildPath(t2, e2, s2).path;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Ensures path uniqueness by adding nodes if needed
|
|
1172
|
+
* Following SPECIFICATION.md §8 Disambiguation Algorithm
|
|
1173
|
+
*/
|
|
1174
|
+
ensureUniqueness(t2, e2, s2, r2, a2) {
|
|
1175
|
+
const i2 = this.buildTestSelector(s2, e2, r2);
|
|
1176
|
+
try {
|
|
1177
|
+
const o2 = r2.ownerDocument;
|
|
1178
|
+
if (!o2) return e2;
|
|
1179
|
+
let l2;
|
|
1180
|
+
if (this.cache) {
|
|
1181
|
+
const d = this.cache.getSelectorResults(i2);
|
|
1182
|
+
d !== void 0 ? l2 = d : (l2 = Array.from(o2.querySelectorAll(i2)), this.cache.setSelectorResults(i2, l2));
|
|
1183
|
+
} else
|
|
1184
|
+
l2 = o2.querySelectorAll(i2);
|
|
1185
|
+
if (l2.length <= 1)
|
|
1186
|
+
return e2;
|
|
1187
|
+
const u2 = t2.filter((d) => !e2.includes(d));
|
|
1188
|
+
for (const d of u2) {
|
|
1189
|
+
if (a2.scoreElement(d) < ct.MIN_CONFIDENCE_FOR_SKIP)
|
|
1190
|
+
continue;
|
|
1191
|
+
const h = this.insertNodeInOrder(e2, d, t2), g = this.buildTestSelector(s2, h, r2);
|
|
1192
|
+
try {
|
|
1193
|
+
let f2;
|
|
1194
|
+
if (this.cache) {
|
|
1195
|
+
const p = this.cache.getSelectorResults(g);
|
|
1196
|
+
p !== void 0 ? f2 = p : (f2 = Array.from(o2.querySelectorAll(g)), this.cache.setSelectorResults(g, f2));
|
|
1197
|
+
} else
|
|
1198
|
+
f2 = o2.querySelectorAll(g);
|
|
1199
|
+
if (f2.length === 1)
|
|
1200
|
+
return h;
|
|
1201
|
+
f2.length < l2.length && (e2 = h);
|
|
1202
|
+
} catch {
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
return e2;
|
|
1206
|
+
} catch {
|
|
1207
|
+
return e2;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Inserts node into path maintaining original order
|
|
1212
|
+
*/
|
|
1213
|
+
insertNodeInOrder(t2, e2, s2) {
|
|
1214
|
+
const r2 = s2.indexOf(e2), a2 = [...t2];
|
|
1215
|
+
let i2 = 0;
|
|
1216
|
+
for (let o2 = 0; o2 < a2.length && !(s2.indexOf(a2[o2]) > r2); o2++)
|
|
1217
|
+
i2 = o2 + 1;
|
|
1218
|
+
return a2.splice(i2, 0, e2), a2;
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Builds a test CSS selector from path
|
|
1222
|
+
*/
|
|
1223
|
+
buildTestSelector(t2, e2, s2) {
|
|
1224
|
+
const r2 = [];
|
|
1225
|
+
r2.push(this.elementToSelector(t2));
|
|
1226
|
+
for (const a2 of e2)
|
|
1227
|
+
r2.push(this.elementToSelector(a2));
|
|
1228
|
+
return r2.push(this.elementToSelector(s2)), r2.join(" ");
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Converts element to basic CSS selector
|
|
1232
|
+
*/
|
|
1233
|
+
elementToSelector(t2) {
|
|
1234
|
+
let e2 = t2.tagName.toLowerCase();
|
|
1235
|
+
t2.id && !D(t2.id) && (e2 += `#${tt(t2.id)}`);
|
|
1236
|
+
for (const s2 of Array.from(t2.classList))
|
|
1237
|
+
J(s2) || (e2 += `.${tt(s2)}`);
|
|
1238
|
+
return e2;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Filters out noise/layout elements
|
|
1242
|
+
*/
|
|
1243
|
+
filterNoise(t2) {
|
|
1244
|
+
return t2.filter((e2) => this.shouldInclude(e2));
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Determines if element should be included in path
|
|
1248
|
+
*/
|
|
1249
|
+
shouldInclude(t2) {
|
|
1250
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1251
|
+
return lt.includes(e2) ? true : e2 === "div" || e2 === "span" ? this.hasSemanticFeatures(t2) : false;
|
|
1252
|
+
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Checks if element has meaningful semantic features
|
|
1255
|
+
*/
|
|
1256
|
+
hasSemanticFeatures(t2) {
|
|
1257
|
+
if (t2.hasAttribute("role")) return true;
|
|
1258
|
+
for (const s2 of Array.from(t2.attributes))
|
|
1259
|
+
if (s2.name.startsWith("aria-")) return true;
|
|
1260
|
+
if (t2.classList.length > 0) {
|
|
1261
|
+
for (const s2 of Array.from(t2.classList))
|
|
1262
|
+
if (!J(s2)) return true;
|
|
1263
|
+
}
|
|
1264
|
+
if (t2.hasAttribute("data-testid") || t2.hasAttribute("data-qa") || t2.hasAttribute("data-test"))
|
|
1265
|
+
return true;
|
|
1266
|
+
const e2 = t2.id;
|
|
1267
|
+
return !!(e2 && !D(e2));
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
function Q(n2) {
|
|
1271
|
+
return n2 ? n2.trim().replace(/[\n\t\r]/g, " ").replace(/\s+/g, " ") : "";
|
|
1272
|
+
}
|
|
1273
|
+
const Ct = {
|
|
1274
|
+
preserveQueryForAbsolute: true,
|
|
1275
|
+
removeDynamicHashes: true
|
|
1276
|
+
};
|
|
1277
|
+
function Tt(n2) {
|
|
1278
|
+
return n2 ? [
|
|
1279
|
+
/\d{5,}/,
|
|
1280
|
+
// 5+ digits
|
|
1281
|
+
/[a-f0-9]{8,}/i,
|
|
1282
|
+
// hex hash 8+ characters
|
|
1283
|
+
/(session|token|temp|random|timestamp|nonce|cache)/i,
|
|
1284
|
+
// dynamic words
|
|
1285
|
+
/^\d+$/,
|
|
1286
|
+
// only digits
|
|
1287
|
+
/^[a-f0-9-]{32,}$/i
|
|
1288
|
+
// UUID-like
|
|
1289
|
+
].some((e2) => e2.test(n2)) : false;
|
|
1290
|
+
}
|
|
1291
|
+
function Et(n2, t2) {
|
|
1292
|
+
if (!n2) return n2;
|
|
1293
|
+
const e2 = n2.startsWith("http://") || n2.startsWith("https://"), [s2, r2] = n2.split("#"), [a2, i2] = s2.split("?");
|
|
1294
|
+
let o2 = a2;
|
|
1295
|
+
return e2 && t2.preserveQueryForAbsolute && i2 && (o2 += `?${i2}`), r2 && (t2.removeDynamicHashes && Tt(r2) || (o2 += `#${r2}`)), o2;
|
|
1296
|
+
}
|
|
1297
|
+
function k(n2, t2, e2 = {}) {
|
|
1298
|
+
if (!t2) return t2;
|
|
1299
|
+
const s2 = { ...Ct, ...e2 };
|
|
1300
|
+
return n2 === "href" || n2 === "src" ? Et(t2, s2) : t2;
|
|
1301
|
+
}
|
|
1302
|
+
const wt = [
|
|
1303
|
+
"role",
|
|
1304
|
+
"aria-label",
|
|
1305
|
+
"aria-labelledby",
|
|
1306
|
+
"aria-describedby",
|
|
1307
|
+
"aria-controls",
|
|
1308
|
+
"aria-owns",
|
|
1309
|
+
"aria-level",
|
|
1310
|
+
"aria-posinset",
|
|
1311
|
+
"aria-setsize",
|
|
1312
|
+
"aria-haspopup"
|
|
1313
|
+
], vt = [
|
|
1314
|
+
"aria-selected",
|
|
1315
|
+
"aria-checked",
|
|
1316
|
+
"aria-pressed",
|
|
1317
|
+
"aria-expanded",
|
|
1318
|
+
"aria-hidden",
|
|
1319
|
+
"aria-disabled",
|
|
1320
|
+
"aria-current",
|
|
1321
|
+
"aria-busy",
|
|
1322
|
+
"aria-invalid",
|
|
1323
|
+
"aria-grabbed",
|
|
1324
|
+
"aria-live",
|
|
1325
|
+
"aria-atomic"
|
|
1326
|
+
], $t = [
|
|
1327
|
+
"data-state",
|
|
1328
|
+
"data-active",
|
|
1329
|
+
"data-inactive",
|
|
1330
|
+
"data-selected",
|
|
1331
|
+
"data-open",
|
|
1332
|
+
"data-closed",
|
|
1333
|
+
"data-visible",
|
|
1334
|
+
"data-hidden",
|
|
1335
|
+
"data-disabled",
|
|
1336
|
+
"data-enabled",
|
|
1337
|
+
"data-loading",
|
|
1338
|
+
"data-error",
|
|
1339
|
+
"data-success",
|
|
1340
|
+
"data-highlighted",
|
|
1341
|
+
"data-focused",
|
|
1342
|
+
"data-hover",
|
|
1343
|
+
"data-orientation",
|
|
1344
|
+
"data-theme"
|
|
1345
|
+
], Mt = [
|
|
1346
|
+
"data-radix-",
|
|
1347
|
+
"data-headlessui-",
|
|
1348
|
+
"data-reach-",
|
|
1349
|
+
"data-mui-",
|
|
1350
|
+
"data-chakra-",
|
|
1351
|
+
"data-mantine-",
|
|
1352
|
+
"data-tw-"
|
|
1353
|
+
], It = [
|
|
1354
|
+
"data-testid",
|
|
1355
|
+
"data-test-id",
|
|
1356
|
+
"data-test",
|
|
1357
|
+
"data-cy",
|
|
1358
|
+
"data-qa",
|
|
1359
|
+
"data-automation-id",
|
|
1360
|
+
"data-id",
|
|
1361
|
+
"data-component",
|
|
1362
|
+
"data-entity-id",
|
|
1363
|
+
"data-product-id",
|
|
1364
|
+
"data-user-id"
|
|
1365
|
+
], Rt = [
|
|
1366
|
+
"id",
|
|
1367
|
+
"name",
|
|
1368
|
+
"type",
|
|
1369
|
+
"placeholder",
|
|
1370
|
+
"title",
|
|
1371
|
+
"for",
|
|
1372
|
+
"alt",
|
|
1373
|
+
"href"
|
|
1374
|
+
], Nt = [
|
|
1375
|
+
"disabled",
|
|
1376
|
+
"checked",
|
|
1377
|
+
"selected",
|
|
1378
|
+
"hidden",
|
|
1379
|
+
"readonly",
|
|
1380
|
+
"required",
|
|
1381
|
+
"value"
|
|
1382
|
+
], Dt = [
|
|
1383
|
+
/^radix-/,
|
|
1384
|
+
/^headlessui-/,
|
|
1385
|
+
/^mui-/,
|
|
1386
|
+
/:\w+:/
|
|
1387
|
+
// matches :ru:, :r1:, etc.
|
|
1388
|
+
];
|
|
1389
|
+
function Ht(n2, t2) {
|
|
1390
|
+
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-");
|
|
1391
|
+
}
|
|
1392
|
+
class Pt {
|
|
1393
|
+
constructor(t2, e2) {
|
|
1394
|
+
this.includeUtilityClasses = t2.includeUtilityClasses ?? false, this.cache = e2;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Extracts semantic features from element
|
|
1398
|
+
* @param element - DOM element to extract from
|
|
1399
|
+
* @returns Semantic features object
|
|
1400
|
+
*/
|
|
1401
|
+
extract(t2) {
|
|
1402
|
+
if (this.cache) {
|
|
1403
|
+
const i2 = this.cache.getSemantics(t2);
|
|
1404
|
+
if (i2 !== void 0)
|
|
1405
|
+
return i2;
|
|
1406
|
+
}
|
|
1407
|
+
const e2 = {}, s2 = t2.id;
|
|
1408
|
+
if (s2 && !D(s2) && (e2.id = s2), t2.classList.length > 0) {
|
|
1409
|
+
const i2 = Array.from(t2.classList);
|
|
1410
|
+
if (this.includeUtilityClasses)
|
|
1411
|
+
e2.classes = i2;
|
|
1412
|
+
else {
|
|
1413
|
+
const { semantic: o2 } = At(i2);
|
|
1414
|
+
o2.length > 0 && (e2.classes = o2);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
const r2 = this.extractAttributes(t2);
|
|
1418
|
+
Object.keys(r2).length > 0 && (e2.attributes = r2);
|
|
1419
|
+
const a2 = t2.getAttribute("role");
|
|
1420
|
+
if (a2 && (e2.role = a2), this.shouldExtractText(t2)) {
|
|
1421
|
+
const i2 = this.extractText(t2);
|
|
1422
|
+
i2 && (e2.text = i2);
|
|
1423
|
+
}
|
|
1424
|
+
return this.cache && this.cache.setSemantics(t2, e2), e2;
|
|
1425
|
+
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Scores element based on semantic richness
|
|
1428
|
+
* @param element - Element to score
|
|
1429
|
+
* @returns Score from 0 to 1
|
|
1430
|
+
*/
|
|
1431
|
+
scoreElement(t2) {
|
|
1432
|
+
let e2 = 0.5;
|
|
1433
|
+
const s2 = this.extract(t2);
|
|
1434
|
+
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);
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Checks if attribute should be ignored
|
|
1438
|
+
* @param attrName - Attribute name
|
|
1439
|
+
* @returns True if should be ignored
|
|
1440
|
+
*/
|
|
1441
|
+
shouldIgnoreAttribute(t2) {
|
|
1442
|
+
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-"));
|
|
1443
|
+
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Gets attribute priority
|
|
1446
|
+
* @param attrName - Attribute name
|
|
1447
|
+
* @returns Priority number (higher = more priority)
|
|
1448
|
+
*/
|
|
1449
|
+
getAttributePriority(t2) {
|
|
1450
|
+
return w[t2] !== void 0 ? w[t2] : t2.startsWith("data-") ? w["data-*"] : t2.startsWith("aria-") ? w["aria-*"] : 0;
|
|
1451
|
+
}
|
|
1452
|
+
/**
|
|
1453
|
+
* Checks if attribute value is dynamic (should be ignored)
|
|
1454
|
+
* @param value - Attribute value
|
|
1455
|
+
* @returns True if value is dynamic
|
|
1456
|
+
*/
|
|
1457
|
+
isDynamicValue(t2) {
|
|
1458
|
+
return [
|
|
1459
|
+
/^[a-f0-9]{32,}$/i,
|
|
1460
|
+
// Long hashes
|
|
1461
|
+
/^\d{10,}$/,
|
|
1462
|
+
// Timestamp
|
|
1463
|
+
/^(undefined|null|\[object)/,
|
|
1464
|
+
// JS artifacts
|
|
1465
|
+
/^{{.*}}$/
|
|
1466
|
+
// Template literals
|
|
1467
|
+
].some((s2) => s2.test(t2));
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Extracts relevant semantic attributes from element
|
|
1471
|
+
* Iterates through all attributes and filters by priority
|
|
1472
|
+
*/
|
|
1473
|
+
extractAttributes(t2) {
|
|
1474
|
+
const e2 = {};
|
|
1475
|
+
for (const s2 of Array.from(t2.attributes)) {
|
|
1476
|
+
const r2 = s2.name;
|
|
1477
|
+
if (this.shouldIgnoreAttribute(r2) || !Ht(r2, s2.value) || G.has(r2) && V(s2.value) || this.getAttributePriority(r2) === 0) continue;
|
|
1478
|
+
const i2 = r2 === "href" || r2 === "src" ? k(r2, s2.value) : s2.value;
|
|
1479
|
+
!i2 || i2.trim() === "" || this.isDynamicValue(i2) || (e2[r2] = i2);
|
|
1480
|
+
}
|
|
1481
|
+
return e2;
|
|
1482
|
+
}
|
|
1483
|
+
/**
|
|
1484
|
+
* Extracts and normalizes text content
|
|
1485
|
+
*/
|
|
1486
|
+
extractText(t2) {
|
|
1487
|
+
const e2 = this.getDirectTextContent(t2);
|
|
1488
|
+
if (!e2) return null;
|
|
1489
|
+
const s2 = Q(e2);
|
|
1490
|
+
if (!s2) return null;
|
|
1491
|
+
const r2 = 100, a2 = e2.length > r2 ? e2.slice(0, r2) + "..." : e2, i2 = s2.length > r2 ? s2.slice(0, r2) + "..." : s2;
|
|
1492
|
+
return {
|
|
1493
|
+
raw: a2,
|
|
1494
|
+
normalized: i2
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Gets direct text content excluding child elements
|
|
1499
|
+
*/
|
|
1500
|
+
getDirectTextContent(t2) {
|
|
1501
|
+
const e2 = [];
|
|
1502
|
+
for (const s2 of Array.from(t2.childNodes))
|
|
1503
|
+
if (s2.nodeType === Node.TEXT_NODE && s2.textContent) {
|
|
1504
|
+
const r2 = s2.textContent.trim();
|
|
1505
|
+
r2 && e2.push(r2);
|
|
1506
|
+
}
|
|
1507
|
+
return e2.length > 0 ? e2.join(" ") : t2.textContent ?? null;
|
|
1508
|
+
}
|
|
1509
|
+
/**
|
|
1510
|
+
* Determines if text should be extracted for this element
|
|
1511
|
+
*/
|
|
1512
|
+
shouldExtractText(t2) {
|
|
1513
|
+
const e2 = t2.tagName.toLowerCase();
|
|
1514
|
+
return [
|
|
1515
|
+
"button",
|
|
1516
|
+
"a",
|
|
1517
|
+
"label",
|
|
1518
|
+
"h1",
|
|
1519
|
+
"h2",
|
|
1520
|
+
"h3",
|
|
1521
|
+
"h4",
|
|
1522
|
+
"h5",
|
|
1523
|
+
"h6",
|
|
1524
|
+
"p",
|
|
1525
|
+
"span",
|
|
1526
|
+
"li",
|
|
1527
|
+
"th",
|
|
1528
|
+
"td",
|
|
1529
|
+
"dt",
|
|
1530
|
+
"dd",
|
|
1531
|
+
"legend",
|
|
1532
|
+
"figcaption",
|
|
1533
|
+
"summary"
|
|
1534
|
+
].includes(e2);
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
class kt {
|
|
1538
|
+
/**
|
|
1539
|
+
* Generates fingerprint for SVG element
|
|
1540
|
+
* @param element - SVG element to fingerprint
|
|
1541
|
+
* @returns SVG fingerprint object
|
|
1542
|
+
*/
|
|
1543
|
+
fingerprint(t2) {
|
|
1544
|
+
const e2 = t2.tagName.toLowerCase(), s2 = this.getShape(e2), r2 = {
|
|
1545
|
+
shape: s2,
|
|
1546
|
+
hasAnimation: this.hasAnimation(t2)
|
|
1547
|
+
};
|
|
1548
|
+
if (s2 === "path") {
|
|
1549
|
+
const o2 = t2.getAttribute("d");
|
|
1550
|
+
o2 && (r2.dHash = this.computePathHash(o2));
|
|
1551
|
+
} else ["circle", "rect", "ellipse", "line"].includes(s2) && (r2.geomHash = this.computeGeomHash(t2, s2));
|
|
1552
|
+
const a2 = t2.getAttribute("role");
|
|
1553
|
+
a2 && (r2.role = a2);
|
|
1554
|
+
const i2 = t2.querySelector("title");
|
|
1555
|
+
return (i2 == null ? void 0 : i2.textContent) && (r2.titleText = i2.textContent.trim()), r2;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Computes hash from path data (first N commands)
|
|
1559
|
+
* @param d - SVG path d attribute value
|
|
1560
|
+
* @returns Hash string
|
|
1561
|
+
*/
|
|
1562
|
+
computePathHash(t2) {
|
|
1563
|
+
const e2 = this.normalizePathData(t2);
|
|
1564
|
+
return this.simpleHash(e2);
|
|
1565
|
+
}
|
|
1566
|
+
/**
|
|
1567
|
+
* Gets the shape type from tag name
|
|
1568
|
+
*/
|
|
1569
|
+
getShape(t2) {
|
|
1570
|
+
return [
|
|
1571
|
+
"path",
|
|
1572
|
+
"circle",
|
|
1573
|
+
"rect",
|
|
1574
|
+
"line",
|
|
1575
|
+
"polyline",
|
|
1576
|
+
"polygon",
|
|
1577
|
+
"ellipse",
|
|
1578
|
+
"g",
|
|
1579
|
+
"text",
|
|
1580
|
+
"use",
|
|
1581
|
+
"svg"
|
|
1582
|
+
].find((s2) => s2 === t2) ?? "path";
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
* Normalizes path data for consistent hashing
|
|
1586
|
+
*/
|
|
1587
|
+
normalizePathData(t2) {
|
|
1588
|
+
return (t2.match(/[MLHVCSQTAZ][^MLHVCSQTAZ]*/gi) ?? []).slice(0, 5).map((r2) => r2.trim().replace(/(-?\d+\.?\d*)/g, (a2) => parseFloat(a2).toFixed(1))).join(" ");
|
|
1589
|
+
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Computes geometry hash for non-path shapes
|
|
1592
|
+
*/
|
|
1593
|
+
computeGeomHash(t2, e2) {
|
|
1594
|
+
const s2 = [];
|
|
1595
|
+
switch (e2) {
|
|
1596
|
+
case "circle":
|
|
1597
|
+
s2.push(`r=${t2.getAttribute("r") ?? "0"}`);
|
|
1598
|
+
break;
|
|
1599
|
+
case "rect":
|
|
1600
|
+
{
|
|
1601
|
+
const r2 = parseFloat(t2.getAttribute("width") ?? "0"), a2 = parseFloat(t2.getAttribute("height") ?? "0");
|
|
1602
|
+
r2 > 0 && a2 > 0 && s2.push(`ratio=${(r2 / a2).toFixed(2)}`);
|
|
1603
|
+
}
|
|
1604
|
+
break;
|
|
1605
|
+
case "ellipse":
|
|
1606
|
+
{
|
|
1607
|
+
const r2 = parseFloat(t2.getAttribute("rx") ?? "0"), a2 = parseFloat(t2.getAttribute("ry") ?? "0");
|
|
1608
|
+
r2 > 0 && a2 > 0 && s2.push(`ratio=${(r2 / a2).toFixed(2)}`);
|
|
1609
|
+
}
|
|
1610
|
+
break;
|
|
1611
|
+
case "line":
|
|
1612
|
+
{
|
|
1613
|
+
const r2 = parseFloat(t2.getAttribute("x1") ?? "0"), a2 = parseFloat(t2.getAttribute("y1") ?? "0"), i2 = parseFloat(t2.getAttribute("x2") ?? "0"), o2 = parseFloat(t2.getAttribute("y2") ?? "0"), l2 = Math.atan2(o2 - a2, i2 - r2);
|
|
1614
|
+
s2.push(`angle=${l2.toFixed(2)}`);
|
|
1615
|
+
}
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
return this.simpleHash(s2.join(";"));
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Detects animations on SVG element
|
|
1622
|
+
*/
|
|
1623
|
+
hasAnimation(t2) {
|
|
1624
|
+
if (t2.querySelector("animate, animateTransform, animateMotion"))
|
|
1625
|
+
return true;
|
|
1626
|
+
const e2 = t2.ownerDocument;
|
|
1627
|
+
if (e2 == null ? void 0 : e2.defaultView)
|
|
1628
|
+
try {
|
|
1629
|
+
const s2 = e2.defaultView.getComputedStyle(t2);
|
|
1630
|
+
if (s2.animationName !== "none" || s2.transitionProperty !== "all" && s2.transitionProperty !== "none")
|
|
1631
|
+
return true;
|
|
1632
|
+
} catch {
|
|
1633
|
+
}
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Simple hash function for fingerprinting (not cryptographic)
|
|
1638
|
+
*/
|
|
1639
|
+
simpleHash(t2) {
|
|
1640
|
+
let e2 = 0;
|
|
1641
|
+
for (let s2 = 0; s2 < t2.length; s2++) {
|
|
1642
|
+
const r2 = t2.charCodeAt(s2);
|
|
1643
|
+
e2 = (e2 << 5) - e2 + r2, e2 = e2 & e2;
|
|
1644
|
+
}
|
|
1645
|
+
return Math.abs(e2).toString(16).padStart(8, "0");
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
function _t(n2, t2 = 0) {
|
|
1649
|
+
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;
|
|
1650
|
+
return Math.max(0, Math.min(1, a2 - i2));
|
|
1651
|
+
}
|
|
1652
|
+
class qt {
|
|
1653
|
+
constructor(t2) {
|
|
1654
|
+
this.cache = /* @__PURE__ */ new Map(), this.maxSize = t2;
|
|
1655
|
+
}
|
|
1656
|
+
get(t2) {
|
|
1657
|
+
const e2 = this.cache.get(t2);
|
|
1658
|
+
if (e2 !== void 0)
|
|
1659
|
+
return this.cache.delete(t2), this.cache.set(t2, e2), e2;
|
|
1660
|
+
}
|
|
1661
|
+
set(t2, e2) {
|
|
1662
|
+
if (this.cache.has(t2))
|
|
1663
|
+
this.cache.delete(t2);
|
|
1664
|
+
else if (this.cache.size >= this.maxSize) {
|
|
1665
|
+
const s2 = this.cache.keys().next().value;
|
|
1666
|
+
s2 !== void 0 && this.cache.delete(s2);
|
|
1667
|
+
}
|
|
1668
|
+
this.cache.set(t2, e2);
|
|
1669
|
+
}
|
|
1670
|
+
has(t2) {
|
|
1671
|
+
return this.cache.has(t2);
|
|
1672
|
+
}
|
|
1673
|
+
delete(t2) {
|
|
1674
|
+
this.cache.delete(t2);
|
|
1675
|
+
}
|
|
1676
|
+
clear() {
|
|
1677
|
+
this.cache.clear();
|
|
1678
|
+
}
|
|
1679
|
+
get size() {
|
|
1680
|
+
return this.cache.size;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
class Lt {
|
|
1684
|
+
constructor(t2 = {}) {
|
|
1685
|
+
this.eidCache = /* @__PURE__ */ new WeakMap(), this.selectorResultCache = new qt(
|
|
1686
|
+
t2.maxSelectorCacheSize ?? 1e3
|
|
1687
|
+
), this.anchorCache = /* @__PURE__ */ new WeakMap(), this.semanticsCache = /* @__PURE__ */ new WeakMap(), this.stats = {
|
|
1688
|
+
eidHits: 0,
|
|
1689
|
+
eidMisses: 0,
|
|
1690
|
+
selectorHits: 0,
|
|
1691
|
+
selectorMisses: 0,
|
|
1692
|
+
anchorHits: 0,
|
|
1693
|
+
anchorMisses: 0,
|
|
1694
|
+
semanticsHits: 0,
|
|
1695
|
+
semanticsMisses: 0,
|
|
1696
|
+
selectorCacheSize: 0,
|
|
1697
|
+
maxSelectorCacheSize: t2.maxSelectorCacheSize ?? 1e3
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
/**
|
|
1701
|
+
* Get cached EID for element
|
|
1702
|
+
*/
|
|
1703
|
+
getEID(t2) {
|
|
1704
|
+
const e2 = this.eidCache.get(t2);
|
|
1705
|
+
if (e2 !== void 0)
|
|
1706
|
+
return this.stats.eidHits++, e2;
|
|
1707
|
+
this.stats.eidMisses++;
|
|
1708
|
+
}
|
|
1709
|
+
/**
|
|
1710
|
+
* Cache EID for element
|
|
1711
|
+
*/
|
|
1712
|
+
setEID(t2, e2) {
|
|
1713
|
+
this.eidCache.set(t2, e2);
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Get cached selector results
|
|
1717
|
+
*/
|
|
1718
|
+
getSelectorResults(t2) {
|
|
1719
|
+
const e2 = this.selectorResultCache.get(t2);
|
|
1720
|
+
if (e2 !== void 0)
|
|
1721
|
+
return this.stats.selectorHits++, this.stats.selectorCacheSize = this.selectorResultCache.size, e2;
|
|
1722
|
+
this.stats.selectorMisses++, this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Cache selector results
|
|
1726
|
+
*/
|
|
1727
|
+
setSelectorResults(t2, e2) {
|
|
1728
|
+
this.selectorResultCache.set(t2, e2), this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* Get cached anchor result
|
|
1732
|
+
*/
|
|
1733
|
+
getAnchor(t2) {
|
|
1734
|
+
if (this.anchorCache.has(t2))
|
|
1735
|
+
return this.stats.anchorHits++, this.anchorCache.get(t2);
|
|
1736
|
+
this.stats.anchorMisses++;
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Cache anchor result
|
|
1740
|
+
*/
|
|
1741
|
+
setAnchor(t2, e2) {
|
|
1742
|
+
this.anchorCache.set(t2, e2);
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Get cached semantics
|
|
1746
|
+
*/
|
|
1747
|
+
getSemantics(t2) {
|
|
1748
|
+
const e2 = this.semanticsCache.get(t2);
|
|
1749
|
+
if (e2 !== void 0)
|
|
1750
|
+
return this.stats.semanticsHits++, e2;
|
|
1751
|
+
this.stats.semanticsMisses++;
|
|
1752
|
+
}
|
|
1753
|
+
/**
|
|
1754
|
+
* Cache semantics
|
|
1755
|
+
*/
|
|
1756
|
+
setSemantics(t2, e2) {
|
|
1757
|
+
this.semanticsCache.set(t2, e2);
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Clear all caches
|
|
1761
|
+
*/
|
|
1762
|
+
clear() {
|
|
1763
|
+
this.selectorResultCache.clear(), this.stats.selectorCacheSize = 0, this.stats = {
|
|
1764
|
+
eidHits: 0,
|
|
1765
|
+
eidMisses: 0,
|
|
1766
|
+
selectorHits: 0,
|
|
1767
|
+
selectorMisses: 0,
|
|
1768
|
+
anchorHits: 0,
|
|
1769
|
+
anchorMisses: 0,
|
|
1770
|
+
semanticsHits: 0,
|
|
1771
|
+
semanticsMisses: 0,
|
|
1772
|
+
selectorCacheSize: 0,
|
|
1773
|
+
maxSelectorCacheSize: this.stats.maxSelectorCacheSize
|
|
1774
|
+
};
|
|
1775
|
+
}
|
|
1776
|
+
/**
|
|
1777
|
+
* Invalidate cache for a specific element
|
|
1778
|
+
* Note: WeakMaps don't support deletion, but we can clear selector cache
|
|
1779
|
+
* if needed. This method is mainly for future extensibility.
|
|
1780
|
+
*/
|
|
1781
|
+
invalidateElement(t2) {
|
|
1782
|
+
}
|
|
1783
|
+
/**
|
|
1784
|
+
* Invalidate a specific selector from cache
|
|
1785
|
+
*/
|
|
1786
|
+
invalidateSelector(t2) {
|
|
1787
|
+
this.selectorResultCache.delete(t2), this.stats.selectorCacheSize = this.selectorResultCache.size;
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Get cache statistics
|
|
1791
|
+
*/
|
|
1792
|
+
getStats() {
|
|
1793
|
+
return {
|
|
1794
|
+
...this.stats,
|
|
1795
|
+
selectorCacheSize: this.selectorResultCache.size
|
|
1796
|
+
};
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Get cache hit rate for EID cache
|
|
1800
|
+
*/
|
|
1801
|
+
getEIDHitRate() {
|
|
1802
|
+
const t2 = this.stats.eidHits + this.stats.eidMisses;
|
|
1803
|
+
return t2 > 0 ? this.stats.eidHits / t2 : 0;
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Get cache hit rate for selector cache
|
|
1807
|
+
*/
|
|
1808
|
+
getSelectorHitRate() {
|
|
1809
|
+
const t2 = this.stats.selectorHits + this.stats.selectorMisses;
|
|
1810
|
+
return t2 > 0 ? this.stats.selectorHits / t2 : 0;
|
|
1811
|
+
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Get cache hit rate for anchor cache
|
|
1814
|
+
*/
|
|
1815
|
+
getAnchorHitRate() {
|
|
1816
|
+
const t2 = this.stats.anchorHits + this.stats.anchorMisses;
|
|
1817
|
+
return t2 > 0 ? this.stats.anchorHits / t2 : 0;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Get cache hit rate for semantics cache
|
|
1821
|
+
*/
|
|
1822
|
+
getSemanticsHitRate() {
|
|
1823
|
+
const t2 = this.stats.semanticsHits + this.stats.semanticsMisses;
|
|
1824
|
+
return t2 > 0 ? this.stats.semanticsHits / t2 : 0;
|
|
1825
|
+
}
|
|
1826
|
+
/**
|
|
1827
|
+
* Get overall cache hit rate
|
|
1828
|
+
*/
|
|
1829
|
+
getOverallHitRate() {
|
|
1830
|
+
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;
|
|
1831
|
+
return s2 > 0 ? t2 / s2 : 0;
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
function Ot(n2) {
|
|
1835
|
+
return new Lt(n2);
|
|
1836
|
+
}
|
|
1837
|
+
let O = null;
|
|
1838
|
+
function Z() {
|
|
1839
|
+
return O || (O = Ot()), O;
|
|
1840
|
+
}
|
|
1841
|
+
function Y(n2, t2 = {}) {
|
|
1842
|
+
var _a2;
|
|
1843
|
+
if (!n2 || !n2.ownerDocument || !n2.isConnected)
|
|
1844
|
+
return null;
|
|
1845
|
+
const e2 = { ...ut, ...t2 }, s2 = e2.cache ?? Z(), r2 = s2.getEID(n2);
|
|
1846
|
+
if (r2 !== void 0)
|
|
1847
|
+
return r2;
|
|
1848
|
+
const a2 = new ft(e2, s2), i2 = new xt(e2, s2), o2 = new Pt(e2, s2), l2 = new kt(), u2 = a2.findAnchor(n2);
|
|
1849
|
+
if (!u2 && !e2.fallbackToBody)
|
|
1850
|
+
return null;
|
|
1851
|
+
const d = (u2 == null ? void 0 : u2.element) ?? ((_a2 = n2.ownerDocument) == null ? void 0 : _a2.body) ?? null;
|
|
1852
|
+
if (!d) return null;
|
|
1853
|
+
const c2 = !u2 || u2.tier === "C", h = d.tagName.toLowerCase(), g = d.parentElement;
|
|
1854
|
+
let f2;
|
|
1855
|
+
if (g && h !== "body" && h !== "html") {
|
|
1856
|
+
const T = Array.from(g.children).indexOf(d);
|
|
1857
|
+
T !== -1 && (f2 = T + 1);
|
|
1858
|
+
}
|
|
1859
|
+
const p = o2.extract(d), m = {
|
|
1860
|
+
tag: d.tagName.toLowerCase(),
|
|
1861
|
+
semantics: p,
|
|
1862
|
+
score: (u2 == null ? void 0 : u2.score) ?? I.DEGRADED_SCORE,
|
|
1863
|
+
degraded: c2,
|
|
1864
|
+
nthChild: f2
|
|
1865
|
+
}, b = i2.buildPath(d, n2, o2), y = o2.extract(n2);
|
|
1866
|
+
e2.enableSvgFingerprint && zt(n2) && (y.svg = l2.fingerprint(n2));
|
|
1867
|
+
const v2 = n2.parentElement;
|
|
1868
|
+
let A;
|
|
1869
|
+
if (v2) {
|
|
1870
|
+
const T = Array.from(v2.children).indexOf(n2);
|
|
1871
|
+
T !== -1 && (A = T + 1);
|
|
1872
|
+
}
|
|
1873
|
+
const S = {
|
|
1874
|
+
tag: n2.tagName.toLowerCase(),
|
|
1875
|
+
semantics: y,
|
|
1876
|
+
score: o2.scoreElement(n2),
|
|
1877
|
+
nthChild: A
|
|
1878
|
+
}, $ = [], M = {
|
|
1879
|
+
onMultiple: "best-score",
|
|
1880
|
+
onMissing: "anchor-only",
|
|
1881
|
+
maxDepth: 3
|
|
1882
|
+
}, H = m.degraded || b.degraded, E = Ut(m.degraded, b), x2 = {
|
|
1883
|
+
version: "1.0",
|
|
1884
|
+
anchor: m,
|
|
1885
|
+
path: b.path,
|
|
1886
|
+
target: S,
|
|
1887
|
+
constraints: $,
|
|
1888
|
+
fallback: M,
|
|
1889
|
+
meta: {
|
|
1890
|
+
confidence: 0,
|
|
1891
|
+
// Calculated below
|
|
1892
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1893
|
+
generator: "dom-eid@1.0",
|
|
1894
|
+
source: e2.source,
|
|
1895
|
+
degraded: H,
|
|
1896
|
+
degradationReason: E
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
return x2.meta.confidence = _t(x2), x2.meta.confidence < e2.confidenceThreshold ? null : (s2.setEID(n2, x2), x2);
|
|
1900
|
+
}
|
|
1901
|
+
function zt(n2) {
|
|
1902
|
+
return n2.namespaceURI === "http://www.w3.org/2000/svg" || n2.tagName.toLowerCase() === "svg" || n2 instanceof SVGElement;
|
|
1903
|
+
}
|
|
1904
|
+
function Ut(n2, t2) {
|
|
1905
|
+
if (n2 && t2.degraded)
|
|
1906
|
+
return "anchor-and-path-degraded";
|
|
1907
|
+
if (n2)
|
|
1908
|
+
return "no-semantic-anchor";
|
|
1909
|
+
if (t2.degraded)
|
|
1910
|
+
return t2.degradationReason;
|
|
1911
|
+
}
|
|
1912
|
+
const rt = {
|
|
1913
|
+
maxClasses: 2,
|
|
1914
|
+
maxAttributes: 5,
|
|
1915
|
+
includeText: true,
|
|
1916
|
+
maxTextLength: 50,
|
|
1917
|
+
simplifyTarget: true,
|
|
1918
|
+
includeConstraints: true
|
|
1919
|
+
};
|
|
1920
|
+
function et(n2) {
|
|
1921
|
+
return n2 === "id" ? 101 : w[n2] !== void 0 ? w[n2] : n2.startsWith("data-") ? w["data-*"] : n2.startsWith("aria-") ? w["aria-*"] : 0;
|
|
1922
|
+
}
|
|
1923
|
+
function Vt(n2) {
|
|
1924
|
+
return ["id", "data-testid", "data-qa", "data-cy", "href", "text", "role"].includes(n2);
|
|
1925
|
+
}
|
|
1926
|
+
function Qt(n2) {
|
|
1927
|
+
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));
|
|
1928
|
+
}
|
|
1929
|
+
function Zt(n2, t2) {
|
|
1930
|
+
const e2 = { ...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) : "";
|
|
1931
|
+
return `${s2}: ${r2} :: ${a2}${i2}${o2}`;
|
|
1932
|
+
}
|
|
1933
|
+
function U(n2, t2 = false, e2 = rt) {
|
|
1934
|
+
const { tag: s2, semantics: r2 } = n2;
|
|
1935
|
+
let a2 = s2;
|
|
1936
|
+
const i2 = [], o2 = { ...r2.attributes };
|
|
1937
|
+
r2.id && (o2.id = r2.id), r2.role && !o2.role && (o2.role = r2.role);
|
|
1938
|
+
const l2 = Object.entries(o2).map(([c2, h]) => {
|
|
1939
|
+
const g = et(c2), f2 = c2 === "href" || c2 === "src" ? k(c2, h) : h;
|
|
1940
|
+
return { name: c2, value: f2, priority: g };
|
|
1941
|
+
}).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");
|
|
1942
|
+
l2.sort((c2, h) => h.priority - c2.priority);
|
|
1943
|
+
const u2 = l2.slice(0, e2.maxAttributes);
|
|
1944
|
+
u2.sort((c2, h) => c2.name.localeCompare(h.name));
|
|
1945
|
+
for (const { name: c2, value: h } of u2)
|
|
1946
|
+
i2.push(`${c2}="${j(h)}"`);
|
|
1947
|
+
if (e2.includeText && r2.text && !Qt(r2.text.normalized)) {
|
|
1948
|
+
const c2 = r2.text.normalized;
|
|
1949
|
+
c2.length > 0 && c2.length <= e2.maxTextLength && i2.push(`text="${j(c2)}"`);
|
|
1950
|
+
}
|
|
1951
|
+
let d = i2;
|
|
1952
|
+
if (i2.length > 0 && (t2 && e2.simplifyTarget && r2.id && (d = i2.filter((c2) => {
|
|
1953
|
+
const h = c2.split("=")[0];
|
|
1954
|
+
return et(h) >= 60 || h === "text" || h === "id" || h === "role";
|
|
1955
|
+
})), d.length > 0 && d.sort((c2, h) => c2.localeCompare(h))), r2.classes && r2.classes.length > 0) {
|
|
1956
|
+
const c2 = N(r2.classes), h = !!r2.id || i2.some(
|
|
1957
|
+
(f2) => f2.startsWith("href=") || f2.startsWith("data-testid=") || f2.startsWith("text=") || f2.startsWith("role=")
|
|
1958
|
+
);
|
|
1959
|
+
if (!(t2 && e2.simplifyTarget && h) && c2.length > 0) {
|
|
1960
|
+
const f2 = c2.sort().slice(0, e2.maxClasses);
|
|
1961
|
+
a2 += f2.map((p) => `.${p}`).join("");
|
|
1962
|
+
}
|
|
1963
|
+
}
|
|
1964
|
+
if (d.length > 0 && (a2 += `[${d.join(",")}]`), "nthChild" in n2 && n2.nthChild) {
|
|
1965
|
+
const c2 = !!r2.id || r2.attributes && Object.keys(r2.attributes).some(Vt);
|
|
1966
|
+
t2 && e2.simplifyTarget && c2 || (a2 += `#${n2.nthChild}`);
|
|
1967
|
+
}
|
|
1968
|
+
return a2;
|
|
1969
|
+
}
|
|
1970
|
+
function Xt(n2) {
|
|
1971
|
+
if (!n2.constraints || n2.constraints.length === 0)
|
|
1972
|
+
return "";
|
|
1973
|
+
const t2 = [];
|
|
1974
|
+
for (const e2 of n2.constraints)
|
|
1975
|
+
switch (e2.type) {
|
|
1976
|
+
case "uniqueness":
|
|
1977
|
+
t2.push("unique=true");
|
|
1978
|
+
break;
|
|
1979
|
+
case "position":
|
|
1980
|
+
e2.params && e2.params.strategy && t2.push(`pos=${e2.params.strategy}`);
|
|
1981
|
+
break;
|
|
1982
|
+
case "text-proximity":
|
|
1983
|
+
if (e2.params && e2.params.reference) {
|
|
1984
|
+
const s2 = j(String(e2.params.reference));
|
|
1985
|
+
t2.push(`text="${s2}"`);
|
|
1986
|
+
}
|
|
1987
|
+
break;
|
|
1988
|
+
}
|
|
1989
|
+
return t2.length === 0 ? "" : ` {${t2.join(",")}}`;
|
|
1990
|
+
}
|
|
1991
|
+
function j(n2) {
|
|
1992
|
+
return n2.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/>/g, "\\>").replace(/:/g, "\\:");
|
|
1993
|
+
}
|
|
1994
|
+
function le(n2, t2, e2) {
|
|
1995
|
+
const s2 = Y(n2, t2);
|
|
1996
|
+
return s2 ? Zt(s2, e2) : null;
|
|
1997
|
+
}
|
|
819
1998
|
let _id = 1;
|
|
820
1999
|
const tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
821
2000
|
const IGNORED_NODE = -2;
|
|
@@ -937,6 +2116,7 @@ function ignoreAttribute(tagName, name, _value) {
|
|
|
937
2116
|
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
938
2117
|
}
|
|
939
2118
|
function isExcludeAttribute(name, exclude) {
|
|
2119
|
+
if (!exclude) return false;
|
|
940
2120
|
return typeof exclude === "string" ? name.includes(exclude) : exclude.test(name);
|
|
941
2121
|
}
|
|
942
2122
|
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
@@ -1433,7 +2613,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1433
2613
|
stylesheetLoadTimeout = 5e3,
|
|
1434
2614
|
keepIframeSrcFn = () => false,
|
|
1435
2615
|
newlyAddedElement = false,
|
|
1436
|
-
cssCaptured = false
|
|
2616
|
+
cssCaptured = false,
|
|
2617
|
+
selectorOptions
|
|
1437
2618
|
} = options;
|
|
1438
2619
|
let { needsMask } = options;
|
|
1439
2620
|
let { preserveWhiteSpace = true } = options;
|
|
@@ -1478,11 +2659,20 @@ function serializeNodeWithId(n2, options) {
|
|
|
1478
2659
|
}
|
|
1479
2660
|
const serializedNode = Object.assign(_serializedNode, { id });
|
|
1480
2661
|
if (isElement(n2) || n2.nodeType === Node.TEXT_NODE) {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
2662
|
+
if (isElement(n2) && selectorOptions !== null && selectorOptions !== void 0) {
|
|
2663
|
+
try {
|
|
2664
|
+
const seqlGeneratorOptions = {
|
|
2665
|
+
maxPathDepth: selectorOptions.maxPathDepth,
|
|
2666
|
+
enableSvgFingerprint: selectorOptions.enableSvgFingerprint,
|
|
2667
|
+
confidenceThreshold: selectorOptions.confidenceThreshold,
|
|
2668
|
+
fallbackToBody: selectorOptions.fallbackToBody
|
|
2669
|
+
};
|
|
2670
|
+
const selector = le(n2, seqlGeneratorOptions);
|
|
2671
|
+
if (selector) {
|
|
2672
|
+
serializedNode.selector = selector;
|
|
2673
|
+
}
|
|
2674
|
+
} catch (error) {
|
|
2675
|
+
console.warn("Failed to generate SEQL selector:", error);
|
|
1486
2676
|
}
|
|
1487
2677
|
}
|
|
1488
2678
|
if (n2.nodeType === Node.TEXT_NODE) {
|
|
@@ -1537,7 +2727,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1537
2727
|
onStylesheetLoad,
|
|
1538
2728
|
stylesheetLoadTimeout,
|
|
1539
2729
|
keepIframeSrcFn,
|
|
1540
|
-
cssCaptured: false
|
|
2730
|
+
cssCaptured: false,
|
|
2731
|
+
selectorOptions
|
|
1541
2732
|
};
|
|
1542
2733
|
if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1543
2734
|
else {
|
|
@@ -1596,7 +2787,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1596
2787
|
iframeLoadTimeout,
|
|
1597
2788
|
onStylesheetLoad,
|
|
1598
2789
|
stylesheetLoadTimeout,
|
|
1599
|
-
keepIframeSrcFn
|
|
2790
|
+
keepIframeSrcFn,
|
|
2791
|
+
selectorOptions
|
|
1600
2792
|
});
|
|
1601
2793
|
if (serializedIframeNode) {
|
|
1602
2794
|
onIframeLoad(
|
|
@@ -1638,7 +2830,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1638
2830
|
iframeLoadTimeout,
|
|
1639
2831
|
onStylesheetLoad,
|
|
1640
2832
|
stylesheetLoadTimeout,
|
|
1641
|
-
keepIframeSrcFn
|
|
2833
|
+
keepIframeSrcFn,
|
|
2834
|
+
selectorOptions
|
|
1642
2835
|
});
|
|
1643
2836
|
if (serializedLinkNode) {
|
|
1644
2837
|
onStylesheetLoad(
|
|
@@ -1675,7 +2868,8 @@ function snapshot(n2, options) {
|
|
|
1675
2868
|
iframeLoadTimeout,
|
|
1676
2869
|
onStylesheetLoad,
|
|
1677
2870
|
stylesheetLoadTimeout,
|
|
1678
|
-
keepIframeSrcFn = () => false
|
|
2871
|
+
keepIframeSrcFn = () => false,
|
|
2872
|
+
selector
|
|
1679
2873
|
} = options || {};
|
|
1680
2874
|
const maskInputOptions = maskAllInputs === true ? {
|
|
1681
2875
|
color: true,
|
|
@@ -1713,6 +2907,22 @@ function snapshot(n2, options) {
|
|
|
1713
2907
|
headMetaVerification: true
|
|
1714
2908
|
}
|
|
1715
2909
|
) : slimDOM === false ? {} : slimDOM;
|
|
2910
|
+
const selectorOptions = selector === false ? null : selector === true ? {
|
|
2911
|
+
maxPathDepth: 10,
|
|
2912
|
+
enableSvgFingerprint: true,
|
|
2913
|
+
confidenceThreshold: 0.3,
|
|
2914
|
+
fallbackToBody: true
|
|
2915
|
+
} : selector === void 0 ? {
|
|
2916
|
+
maxPathDepth: 10,
|
|
2917
|
+
enableSvgFingerprint: true,
|
|
2918
|
+
confidenceThreshold: 0.3,
|
|
2919
|
+
fallbackToBody: true
|
|
2920
|
+
} : {
|
|
2921
|
+
maxPathDepth: selector.maxPathDepth ?? 10,
|
|
2922
|
+
enableSvgFingerprint: selector.enableSvgFingerprint ?? true,
|
|
2923
|
+
confidenceThreshold: selector.confidenceThreshold ?? 0.3,
|
|
2924
|
+
fallbackToBody: selector.fallbackToBody ?? true
|
|
2925
|
+
};
|
|
1716
2926
|
return serializeNodeWithId(n2, {
|
|
1717
2927
|
doc: n2,
|
|
1718
2928
|
mirror: mirror2,
|
|
@@ -1737,7 +2947,8 @@ function snapshot(n2, options) {
|
|
|
1737
2947
|
onStylesheetLoad,
|
|
1738
2948
|
stylesheetLoadTimeout,
|
|
1739
2949
|
keepIframeSrcFn,
|
|
1740
|
-
newlyAddedElement: false
|
|
2950
|
+
newlyAddedElement: false,
|
|
2951
|
+
selectorOptions
|
|
1741
2952
|
});
|
|
1742
2953
|
}
|
|
1743
2954
|
function getDefaultExportFromCjs$1(x2) {
|
|
@@ -1756,12 +2967,12 @@ function getAugmentedNamespace$1(n2) {
|
|
|
1756
2967
|
a2.prototype = f2.prototype;
|
|
1757
2968
|
} else a2 = {};
|
|
1758
2969
|
Object.defineProperty(a2, "__esModule", { value: true });
|
|
1759
|
-
Object.keys(n2).forEach(function(
|
|
1760
|
-
var d = Object.getOwnPropertyDescriptor(n2,
|
|
1761
|
-
Object.defineProperty(a2,
|
|
2970
|
+
Object.keys(n2).forEach(function(k2) {
|
|
2971
|
+
var d = Object.getOwnPropertyDescriptor(n2, k2);
|
|
2972
|
+
Object.defineProperty(a2, k2, d.get ? d : {
|
|
1762
2973
|
enumerable: true,
|
|
1763
2974
|
get: function() {
|
|
1764
|
-
return n2[
|
|
2975
|
+
return n2[k2];
|
|
1765
2976
|
}
|
|
1766
2977
|
});
|
|
1767
2978
|
});
|
|
@@ -2185,7 +3396,7 @@ function cloneNode$1(obj, parent) {
|
|
|
2185
3396
|
} else if (i2 === "source") {
|
|
2186
3397
|
cloned[i2] = value;
|
|
2187
3398
|
} else if (Array.isArray(value)) {
|
|
2188
|
-
cloned[i2] = value.map((
|
|
3399
|
+
cloned[i2] = value.map((j2) => cloneNode$1(j2, cloned));
|
|
2189
3400
|
} else {
|
|
2190
3401
|
if (type === "object" && value !== null) value = cloneNode$1(value);
|
|
2191
3402
|
cloned[i2] = value;
|
|
@@ -2420,7 +3631,7 @@ let Node$5$1 = class Node2 {
|
|
|
2420
3631
|
}
|
|
2421
3632
|
return result2;
|
|
2422
3633
|
}
|
|
2423
|
-
toJSON(
|
|
3634
|
+
toJSON(_2, inputs) {
|
|
2424
3635
|
let fixed = {};
|
|
2425
3636
|
let emitInputs = inputs == null;
|
|
2426
3637
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -4065,8 +5276,8 @@ let Parser$1$1 = class Parser {
|
|
|
4065
5276
|
if (colon === false) return;
|
|
4066
5277
|
let founded = 0;
|
|
4067
5278
|
let token;
|
|
4068
|
-
for (let
|
|
4069
|
-
token = tokens[
|
|
5279
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
5280
|
+
token = tokens[j2];
|
|
4070
5281
|
if (token[0] !== "space") {
|
|
4071
5282
|
founded += 1;
|
|
4072
5283
|
if (founded === 2) break;
|
|
@@ -4184,8 +5395,8 @@ let Parser$1$1 = class Parser {
|
|
|
4184
5395
|
} else if (token[1].toLowerCase() === "important") {
|
|
4185
5396
|
let cache = tokens.slice(0);
|
|
4186
5397
|
let str = "";
|
|
4187
|
-
for (let
|
|
4188
|
-
let type = cache[
|
|
5398
|
+
for (let j2 = i2; j2 > 0; j2--) {
|
|
5399
|
+
let type = cache[j2][0];
|
|
4189
5400
|
if (str.trim().indexOf("!") === 0 && type !== "space") {
|
|
4190
5401
|
break;
|
|
4191
5402
|
}
|
|
@@ -5390,12 +6601,12 @@ function getAugmentedNamespace(n2) {
|
|
|
5390
6601
|
a2.prototype = f2.prototype;
|
|
5391
6602
|
} else a2 = {};
|
|
5392
6603
|
Object.defineProperty(a2, "__esModule", { value: true });
|
|
5393
|
-
Object.keys(n2).forEach(function(
|
|
5394
|
-
var d = Object.getOwnPropertyDescriptor(n2,
|
|
5395
|
-
Object.defineProperty(a2,
|
|
6604
|
+
Object.keys(n2).forEach(function(k2) {
|
|
6605
|
+
var d = Object.getOwnPropertyDescriptor(n2, k2);
|
|
6606
|
+
Object.defineProperty(a2, k2, d.get ? d : {
|
|
5396
6607
|
enumerable: true,
|
|
5397
6608
|
get: function() {
|
|
5398
|
-
return n2[
|
|
6609
|
+
return n2[k2];
|
|
5399
6610
|
}
|
|
5400
6611
|
});
|
|
5401
6612
|
});
|
|
@@ -5819,7 +7030,7 @@ function cloneNode(obj, parent) {
|
|
|
5819
7030
|
} else if (i2 === "source") {
|
|
5820
7031
|
cloned[i2] = value;
|
|
5821
7032
|
} else if (Array.isArray(value)) {
|
|
5822
|
-
cloned[i2] = value.map((
|
|
7033
|
+
cloned[i2] = value.map((j2) => cloneNode(j2, cloned));
|
|
5823
7034
|
} else {
|
|
5824
7035
|
if (type === "object" && value !== null) value = cloneNode(value);
|
|
5825
7036
|
cloned[i2] = value;
|
|
@@ -6054,7 +7265,7 @@ let Node$5 = class Node22 {
|
|
|
6054
7265
|
}
|
|
6055
7266
|
return result2;
|
|
6056
7267
|
}
|
|
6057
|
-
toJSON(
|
|
7268
|
+
toJSON(_2, inputs) {
|
|
6058
7269
|
let fixed = {};
|
|
6059
7270
|
let emitInputs = inputs == null;
|
|
6060
7271
|
inputs = inputs || /* @__PURE__ */ new Map();
|
|
@@ -7699,8 +8910,8 @@ let Parser$1 = class Parser2 {
|
|
|
7699
8910
|
if (colon === false) return;
|
|
7700
8911
|
let founded = 0;
|
|
7701
8912
|
let token;
|
|
7702
|
-
for (let
|
|
7703
|
-
token = tokens[
|
|
8913
|
+
for (let j2 = colon - 1; j2 >= 0; j2--) {
|
|
8914
|
+
token = tokens[j2];
|
|
7704
8915
|
if (token[0] !== "space") {
|
|
7705
8916
|
founded += 1;
|
|
7706
8917
|
if (founded === 2) break;
|
|
@@ -7818,8 +9029,8 @@ let Parser$1 = class Parser2 {
|
|
|
7818
9029
|
} else if (token[1].toLowerCase() === "important") {
|
|
7819
9030
|
let cache = tokens.slice(0);
|
|
7820
9031
|
let str = "";
|
|
7821
|
-
for (let
|
|
7822
|
-
let type = cache[
|
|
9032
|
+
for (let j2 = i2; j2 > 0; j2--) {
|
|
9033
|
+
let type = cache[j2][0];
|
|
7823
9034
|
if (str.trim().indexOf("!") === 0 && type !== "space") {
|
|
7824
9035
|
break;
|
|
7825
9036
|
}
|
|
@@ -12609,7 +13820,7 @@ class VisibilityManager {
|
|
|
12609
13820
|
}
|
|
12610
13821
|
}
|
|
12611
13822
|
}
|
|
12612
|
-
const version$1 = "
|
|
13823
|
+
const version$1 = "3.1.1-alpha.1";
|
|
12613
13824
|
let wrappedEmit;
|
|
12614
13825
|
let takeFullSnapshot$1;
|
|
12615
13826
|
let canvasManager;
|