@drskillissue/ganko 0.1.22 → 0.1.24

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.
@@ -8559,7 +8559,7 @@ function resolveMessage(template, data) {
8559
8559
  }
8560
8560
  return result;
8561
8561
  }
8562
- function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix) {
8562
+ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity, fix, suggest) {
8563
8563
  const result = {
8564
8564
  file,
8565
8565
  rule,
@@ -8569,13 +8569,14 @@ function createDiagnosticFromLoc(file, loc, rule, messageId, message, severity,
8569
8569
  loc: firstLine(loc)
8570
8570
  };
8571
8571
  if (fix !== void 0) result.fix = fix;
8572
+ if (suggest !== void 0 && suggest.length > 0) result.suggest = suggest;
8572
8573
  return result;
8573
8574
  }
8574
- function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix) {
8575
- return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix);
8575
+ function createDiagnosticFromComment(file, comment, rule, messageId, message, severity, fix, suggest) {
8576
+ return createDiagnosticFromLoc(file, comment.loc, rule, messageId, message, severity, fix, suggest);
8576
8577
  }
8577
- function createDiagnostic(file, node, rule, messageId, message, severity, fix) {
8578
- return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix);
8578
+ function createDiagnostic(file, node, rule, messageId, message, severity, fix, suggest) {
8579
+ return createDiagnosticFromLoc(file, node.loc, rule, messageId, message, severity, fix, suggest);
8579
8580
  }
8580
8581
 
8581
8582
  // src/solid/rule.ts
@@ -11731,8 +11732,9 @@ var CONDITIONAL_MOUNT_TAGS = /* @__PURE__ */ new Set([
11731
11732
  "TabPanel"
11732
11733
  ]);
11733
11734
  var messages16 = {
11734
- loadingMismatch: "createResource '{{name}}' has no initialValue but uses manual loading checks ({{name}}.loading). Without initialValue, Suspense intercepts before your loading UI renders. Add initialValue to the options: createResource(fetcher, { initialValue: ... })",
11735
- conditionalSuspense: "createResource '{{name}}' has no initialValue and is rendered inside a conditional mount point ({{mountTag}}). This will trigger a distant Suspense boundary and unmount the entire subtree. Add initialValue to the options: createResource(fetcher, { initialValue: ... })"
11735
+ loadingMismatch: "createResource '{{name}}' has no initialValue but uses {{name}}.loading for manual loading UI. Suspense intercepts before your loading UI renders \u2014 the component is unmounted before the <Show>/<Switch> evaluates. Replace createResource with onMount + createSignal to decouple from Suspense entirely.",
11736
+ conditionalSuspense: "createResource '{{name}}' is inside a conditional mount point ({{mountTag}}) with a distant Suspense boundary. The SuspenseContext increment fires when the fetcher's Promise is pending and unmounts the entire page subtree \u2014 initialValue does NOT prevent this. Replace createResource with onMount + createSignal to avoid Suspense interaction.",
11737
+ missingErrorBoundary: "createResource '{{name}}' has no <ErrorBoundary> between its component and the nearest <Suspense>. When the fetcher throws (network error, 401/403/503, timeout), the error propagates to Suspense which has no error handling \u2014 the boundary breaks permanently. Wrap the component in <ErrorBoundary> or replace createResource with onMount + createSignal and catch errors in the fetcher."
11736
11738
  };
11737
11739
  var options16 = {};
11738
11740
  function hasInitialValue(call) {
@@ -11775,35 +11777,95 @@ function hasLoadingRead(resourceVariable) {
11775
11777
  }
11776
11778
  return false;
11777
11779
  }
11778
- function findConditionalMountAncestor(graph, componentName) {
11780
+ function resolveFetcherFunction(graph, call) {
11781
+ const args = call.node.arguments;
11782
+ if (args.length === 0) return null;
11783
+ let fetcherNode;
11784
+ if (args.length === 1) {
11785
+ fetcherNode = args[0];
11786
+ } else if (args.length === 2) {
11787
+ const lastArg = args[1];
11788
+ fetcherNode = lastArg && lastArg.type === "ObjectExpression" ? args[0] : args[1];
11789
+ } else {
11790
+ fetcherNode = args[1];
11791
+ }
11792
+ if (!fetcherNode) return null;
11793
+ if (fetcherNode.type === "ArrowFunctionExpression" || fetcherNode.type === "FunctionExpression") {
11794
+ return graph.functionsByNode.get(fetcherNode) ?? null;
11795
+ }
11796
+ if (fetcherNode.type === "Identifier") {
11797
+ const fns = graph.functionsByName.get(fetcherNode.name);
11798
+ if (fns && fns.length > 0) {
11799
+ const fn = fns[0];
11800
+ if (fn) return fn;
11801
+ }
11802
+ }
11803
+ return null;
11804
+ }
11805
+ function fetcherCanThrow(graph, fn, visited) {
11806
+ if (visited.has(fn.id)) return false;
11807
+ visited.add(fn.id);
11808
+ if (fn.async && fn.awaitRanges.length > 0) return true;
11809
+ if (fn.hasThrowStatement) return true;
11810
+ const callSites = fn.callSites;
11811
+ for (let i = 0, len = callSites.length; i < len; i++) {
11812
+ const callSite = callSites[i];
11813
+ if (!callSite) continue;
11814
+ if (!callSite.resolvedTarget) return true;
11815
+ if (fetcherCanThrow(graph, callSite.resolvedTarget, visited)) return true;
11816
+ }
11817
+ return false;
11818
+ }
11819
+ function analyzeComponentBoundaries(graph, componentName) {
11820
+ const result = {
11821
+ conditionalMountTag: null,
11822
+ suspenseDistance: 0,
11823
+ lacksErrorBoundary: false,
11824
+ usagesLackingErrorBoundary: []
11825
+ };
11779
11826
  const usages = graph.jsxByTag.get(componentName) ?? [];
11827
+ if (usages.length === 0) return result;
11780
11828
  for (let i = 0, len = usages.length; i < len; i++) {
11781
11829
  const usage = usages[i];
11782
11830
  if (!usage) continue;
11783
11831
  let current = usage.parent;
11784
11832
  let conditionalTag = null;
11785
11833
  let componentLevels = 0;
11834
+ let foundErrorBoundary = false;
11835
+ let foundSuspense = false;
11786
11836
  while (current) {
11787
11837
  const tag = current.tag;
11788
11838
  if (tag && !current.isDomElement) {
11789
11839
  componentLevels++;
11790
- if (tag === "Suspense") {
11840
+ if (tag === "ErrorBoundary") {
11841
+ foundErrorBoundary = true;
11842
+ } else if (tag === "Suspense") {
11843
+ foundSuspense = true;
11844
+ if (!foundErrorBoundary) {
11845
+ result.lacksErrorBoundary = true;
11846
+ result.usagesLackingErrorBoundary.push(usage);
11847
+ }
11791
11848
  if (conditionalTag !== null && componentLevels > 1) {
11792
- return { tag: conditionalTag, suspenseDistance: componentLevels };
11849
+ result.conditionalMountTag = conditionalTag;
11850
+ result.suspenseDistance = componentLevels;
11793
11851
  }
11794
- return null;
11795
- }
11796
- if (conditionalTag === null && CONDITIONAL_MOUNT_TAGS.has(tag)) {
11852
+ break;
11853
+ } else if (conditionalTag === null && CONDITIONAL_MOUNT_TAGS.has(tag)) {
11797
11854
  conditionalTag = tag;
11798
11855
  }
11799
11856
  }
11800
11857
  current = current.parent;
11801
11858
  }
11802
- if (conditionalTag !== null) {
11803
- return { tag: conditionalTag, suspenseDistance: componentLevels };
11859
+ if (!foundSuspense && !foundErrorBoundary) {
11860
+ result.lacksErrorBoundary = true;
11861
+ result.usagesLackingErrorBoundary.push(usage);
11862
+ if (conditionalTag !== null) {
11863
+ result.conditionalMountTag = conditionalTag;
11864
+ result.suspenseDistance = componentLevels;
11865
+ }
11804
11866
  }
11805
11867
  }
11806
- return null;
11868
+ return result;
11807
11869
  }
11808
11870
  function getContainingComponentName(graph, call) {
11809
11871
  const selfComponent = graph.componentScopes.get(call.scope);
@@ -11820,43 +11882,65 @@ function findResourceVariable(graph, name) {
11820
11882
  }
11821
11883
  return null;
11822
11884
  }
11885
+ function buildErrorBoundaryFix(usages, graph) {
11886
+ if (usages.length === 0) return null;
11887
+ const usage = usages[0];
11888
+ if (!usage) return null;
11889
+ const jsxNode = usage.node;
11890
+ const startPos = jsxNode.range[0];
11891
+ const endPos = jsxNode.range[1];
11892
+ const ops = [
11893
+ { range: [startPos, startPos], text: "<ErrorBoundary fallback={<div>Error</div>}>" },
11894
+ { range: [endPos, endPos], text: "</ErrorBoundary>" }
11895
+ ];
11896
+ const importFix = buildSolidImportFix(graph, "ErrorBoundary");
11897
+ if (importFix) ops.unshift(importFix);
11898
+ return ops;
11899
+ }
11823
11900
  var resourceImplicitSuspense = defineSolidRule({
11824
11901
  id: "resource-implicit-suspense",
11825
11902
  severity: "warn",
11826
11903
  messages: messages16,
11827
11904
  meta: {
11828
- description: "Detect createResource without initialValue that implicitly triggers Suspense boundaries.",
11829
- fixable: false,
11905
+ description: "Detect createResource that implicitly triggers or permanently breaks Suspense boundaries.",
11906
+ fixable: true,
11830
11907
  category: "reactivity"
11831
11908
  },
11832
11909
  options: options16,
11833
11910
  check(graph, emit) {
11834
11911
  const resourceCalls = getCallsByPrimitive(graph, "createResource");
11835
11912
  if (resourceCalls.length === 0) return;
11913
+ const throwVisited = /* @__PURE__ */ new Set();
11914
+ const boundaryCache = /* @__PURE__ */ new Map();
11836
11915
  for (let i = 0, len = resourceCalls.length; i < len; i++) {
11837
11916
  const call = resourceCalls[i];
11838
11917
  if (!call) continue;
11839
- if (hasInitialValue(call)) continue;
11840
11918
  const resourceName = getResourceVariableName(call);
11841
11919
  if (!resourceName) continue;
11842
- const resourceVariable = findResourceVariable(graph, resourceName);
11843
- if (resourceVariable && hasLoadingRead(resourceVariable)) {
11844
- emit(
11845
- createDiagnostic(
11846
- graph.file,
11847
- call.node,
11848
- "resource-implicit-suspense",
11849
- "loadingMismatch",
11850
- resolveMessage(messages16.loadingMismatch, { name: resourceName }),
11851
- "warn"
11852
- )
11853
- );
11854
- continue;
11855
- }
11920
+ const hasInitial = hasInitialValue(call);
11856
11921
  const componentName = getContainingComponentName(graph, call);
11922
+ if (!hasInitial) {
11923
+ const resourceVariable = findResourceVariable(graph, resourceName);
11924
+ if (resourceVariable && hasLoadingRead(resourceVariable)) {
11925
+ emit(
11926
+ createDiagnostic(
11927
+ graph.file,
11928
+ call.node,
11929
+ "resource-implicit-suspense",
11930
+ "loadingMismatch",
11931
+ resolveMessage(messages16.loadingMismatch, { name: resourceName }),
11932
+ "warn"
11933
+ )
11934
+ );
11935
+ }
11936
+ }
11857
11937
  if (!componentName) continue;
11858
- const conditional = findConditionalMountAncestor(graph, componentName);
11859
- if (conditional) {
11938
+ let analysis = boundaryCache.get(componentName);
11939
+ if (!analysis) {
11940
+ analysis = analyzeComponentBoundaries(graph, componentName);
11941
+ boundaryCache.set(componentName, analysis);
11942
+ }
11943
+ if (analysis.conditionalMountTag) {
11860
11944
  emit(
11861
11945
  createDiagnostic(
11862
11946
  graph.file,
@@ -11865,12 +11949,32 @@ var resourceImplicitSuspense = defineSolidRule({
11865
11949
  "conditionalSuspense",
11866
11950
  resolveMessage(messages16.conditionalSuspense, {
11867
11951
  name: resourceName,
11868
- mountTag: conditional.tag
11952
+ mountTag: analysis.conditionalMountTag
11869
11953
  }),
11870
11954
  "error"
11871
11955
  )
11872
11956
  );
11873
11957
  }
11958
+ if (analysis.lacksErrorBoundary) {
11959
+ const fetcherFn = resolveFetcherFunction(graph, call);
11960
+ if (fetcherFn && fetcherCanThrow(graph, fetcherFn, throwVisited)) {
11961
+ const errorBoundaryFix = buildErrorBoundaryFix(
11962
+ analysis.usagesLackingErrorBoundary,
11963
+ graph
11964
+ );
11965
+ emit(
11966
+ createDiagnostic(
11967
+ graph.file,
11968
+ call.node,
11969
+ "resource-implicit-suspense",
11970
+ "missingErrorBoundary",
11971
+ resolveMessage(messages16.missingErrorBoundary, { name: resourceName }),
11972
+ "error",
11973
+ errorBoundaryFix ?? void 0
11974
+ )
11975
+ );
11976
+ }
11977
+ }
11874
11978
  }
11875
11979
  }
11876
11980
  });
@@ -29369,6 +29473,11 @@ function toLayoutElementKey(solidFile, elementId) {
29369
29473
  return `${solidFile}::${elementId}`;
29370
29474
  }
29371
29475
 
29476
+ // src/cross-file/layout/context-model.ts
29477
+ function deriveAlignmentContext(base, overrides) {
29478
+ return { ...base, ...overrides };
29479
+ }
29480
+
29372
29481
  // src/cross-file/layout/signal-model.ts
29373
29482
  var layoutSignalNames = [
29374
29483
  "line-height",
@@ -29397,6 +29506,8 @@ var layoutSignalNames = [
29397
29506
  "justify-items",
29398
29507
  "place-items",
29399
29508
  "place-self",
29509
+ "flex-direction",
29510
+ "grid-auto-flow",
29400
29511
  "appearance",
29401
29512
  "box-sizing",
29402
29513
  "padding-top",
@@ -29515,13 +29626,44 @@ function expandShorthand(property, value2) {
29515
29626
  { name: blockTarget[1], value: parsed.end }
29516
29627
  ];
29517
29628
  }
29629
+ if (property === "flex-flow") {
29630
+ return expandFlexFlow(value2);
29631
+ }
29518
29632
  return void 0;
29519
29633
  }
29634
+ var FLEX_DIRECTION_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse", "column", "column-reverse"]);
29635
+ function expandFlexFlow(value2) {
29636
+ const tokens = splitWhitespaceTokens(value2.trim().toLowerCase());
29637
+ if (tokens.length === 0) return null;
29638
+ if (tokens.length > 2) return null;
29639
+ let direction = null;
29640
+ let wrap = null;
29641
+ for (let i = 0; i < tokens.length; i++) {
29642
+ const token = tokens[i];
29643
+ if (!token) continue;
29644
+ if (FLEX_DIRECTION_VALUES.has(token)) {
29645
+ if (direction !== null) return null;
29646
+ direction = token;
29647
+ } else {
29648
+ if (wrap !== null) return null;
29649
+ wrap = token;
29650
+ }
29651
+ }
29652
+ const out = [];
29653
+ if (direction !== null) {
29654
+ out.push({ name: "flex-direction", value: direction });
29655
+ }
29656
+ if (wrap !== null) {
29657
+ out.push({ name: "flex-wrap", value: wrap });
29658
+ }
29659
+ return out.length > 0 ? out : null;
29660
+ }
29520
29661
  function getShorthandLonghandNames(property) {
29521
29662
  const quad = QUAD_EXPANSIONS.get(property);
29522
29663
  if (quad !== void 0) return [...quad];
29523
29664
  const block = BLOCK_EXPANSIONS.get(property);
29524
29665
  if (block !== void 0) return [...block];
29666
+ if (property === "flex-flow") return ["flex-direction", "flex-wrap"];
29525
29667
  return null;
29526
29668
  }
29527
29669
 
@@ -29532,27 +29674,90 @@ var CONTROL_ELEMENT_TAGS = /* @__PURE__ */ new Set([
29532
29674
  "textarea",
29533
29675
  "button"
29534
29676
  ]);
29677
+ var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
29678
+ "img",
29679
+ "svg",
29680
+ "video",
29681
+ "canvas",
29682
+ "iframe",
29683
+ "object",
29684
+ "embed"
29685
+ ]);
29686
+ var WHITESPACE_RE3 = /\s+/;
29535
29687
  function clamp(value2, min, max) {
29536
29688
  if (value2 < min) return min;
29537
29689
  if (value2 > max) return max;
29538
29690
  return value2;
29539
29691
  }
29540
- function kindRank(kind) {
29541
- if (kind === "exact") return 0;
29542
- if (kind === "interval") return 1;
29543
- if (kind === "conditional") return 2;
29544
- return 3;
29545
- }
29546
29692
  function mergeEvidenceKind(left, right) {
29547
- if (kindRank(left) >= kindRank(right)) return left;
29548
- return right;
29693
+ return left > right ? left : right;
29694
+ }
29695
+ function selectKth(values, targetIndex) {
29696
+ let left = 0;
29697
+ let right = values.length - 1;
29698
+ while (left <= right) {
29699
+ if (left === right) {
29700
+ const result = values[left];
29701
+ if (result === void 0) return 0;
29702
+ return result;
29703
+ }
29704
+ const pivotIndex = choosePivotIndex(values, left, right);
29705
+ const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
29706
+ if (partitionIndex === targetIndex) {
29707
+ const result = values[partitionIndex];
29708
+ if (result === void 0) return 0;
29709
+ return result;
29710
+ }
29711
+ if (partitionIndex < targetIndex) {
29712
+ left = partitionIndex + 1;
29713
+ continue;
29714
+ }
29715
+ right = partitionIndex - 1;
29716
+ }
29717
+ const fallback = values[targetIndex];
29718
+ if (fallback === void 0) return 0;
29719
+ return fallback;
29720
+ }
29721
+ function choosePivotIndex(values, left, right) {
29722
+ const middle = Math.floor((left + right) / 2);
29723
+ const leftValue = values[left] ?? 0;
29724
+ const middleValue = values[middle] ?? 0;
29725
+ const rightValue = values[right] ?? 0;
29726
+ if (leftValue < middleValue) {
29727
+ if (middleValue < rightValue) return middle;
29728
+ if (leftValue < rightValue) return right;
29729
+ return left;
29730
+ }
29731
+ if (leftValue < rightValue) return left;
29732
+ if (middleValue < rightValue) return right;
29733
+ return middle;
29734
+ }
29735
+ function partitionAroundPivot(values, left, right, pivotIndex) {
29736
+ const pivotValue = values[pivotIndex] ?? 0;
29737
+ swap(values, pivotIndex, right);
29738
+ let storeIndex = left;
29739
+ for (let i = left; i < right; i++) {
29740
+ const current = values[i];
29741
+ if (current === void 0 || current > pivotValue) continue;
29742
+ swap(values, storeIndex, i);
29743
+ storeIndex++;
29744
+ }
29745
+ swap(values, storeIndex, right);
29746
+ return storeIndex;
29747
+ }
29748
+ function swap(values, left, right) {
29749
+ if (left === right) return;
29750
+ const leftValue = values[left] ?? 0;
29751
+ const rightValue = values[right] ?? 0;
29752
+ values[left] = rightValue;
29753
+ values[right] = leftValue;
29549
29754
  }
29550
29755
  function toComparableExactValue(value2) {
29551
29756
  if (value2.value !== null) {
29552
- if (value2.kind !== "exact") return null;
29757
+ if (value2.kind !== 0 /* Exact */) return null;
29553
29758
  return value2.value;
29554
29759
  }
29555
- if (value2.kind === "exact") return 0;
29760
+ if (value2.kind === 0 /* Exact */) return 0;
29556
29761
  return null;
29557
29762
  }
29558
29763
 
@@ -29566,7 +29771,8 @@ var MONITORED_SHORTHAND_SET = /* @__PURE__ */ new Set([
29566
29771
  "border-width",
29567
29772
  "margin-block",
29568
29773
  "padding-block",
29569
- "inset-block"
29774
+ "inset-block",
29775
+ "flex-flow"
29570
29776
  ]);
29571
29777
  var LENGTH_SIGNAL_SET = /* @__PURE__ */ new Set([
29572
29778
  "font-size",
@@ -29608,13 +29814,22 @@ var KEYWORD_SIGNAL_SET = /* @__PURE__ */ new Set([
29608
29814
  "justify-items",
29609
29815
  "place-items",
29610
29816
  "place-self",
29817
+ "flex-direction",
29818
+ "grid-auto-flow",
29611
29819
  "appearance",
29612
29820
  "box-sizing",
29613
29821
  "position",
29614
29822
  "writing-mode",
29615
29823
  "direction"
29616
29824
  ]);
29617
- var REPLACED_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "img", "video", "canvas", "svg", "iframe"]);
29825
+ var REPLACED_ELEMENT_TAGS = /* @__PURE__ */ new Set([
29826
+ ...CONTROL_ELEMENT_TAGS,
29827
+ "img",
29828
+ "video",
29829
+ "canvas",
29830
+ "svg",
29831
+ "iframe"
29832
+ ]);
29618
29833
  function isMonitoredSignal(property) {
29619
29834
  if (MONITORED_SIGNAL_SET.has(property)) return true;
29620
29835
  return MONITORED_SHORTHAND_SET.has(property);
@@ -29625,7 +29840,7 @@ function isControlTag(tag) {
29625
29840
  }
29626
29841
  function isReplacedTag(tag) {
29627
29842
  if (tag === null) return false;
29628
- return REPLACED_TAGS.has(tag.toLowerCase());
29843
+ return REPLACED_ELEMENT_TAGS.has(tag.toLowerCase());
29629
29844
  }
29630
29845
  function normalizeSignalMapWithCounts(values) {
29631
29846
  const out = /* @__PURE__ */ new Map();
@@ -29636,12 +29851,11 @@ function normalizeSignalMapWithCounts(values) {
29636
29851
  "font-size",
29637
29852
  fontSizeEntry.value,
29638
29853
  fontSizeEntry.source,
29639
- fontSizeEntry.guard,
29640
29854
  fontSizeEntry.guardProvenance,
29641
29855
  null
29642
29856
  );
29643
29857
  out.set("font-size", parsedFontSize);
29644
- if (parsedFontSize.kind === "known" && parsedFontSize.guard === "unconditional") {
29858
+ if (parsedFontSize.kind === "known" && parsedFontSize.guard.kind === 0 /* Unconditional */) {
29645
29859
  fontSizePx = parsedFontSize.px;
29646
29860
  }
29647
29861
  }
@@ -29657,7 +29871,6 @@ function normalizeSignalMapWithCounts(values) {
29657
29871
  name,
29658
29872
  declaration.value,
29659
29873
  declaration.source,
29660
- declaration.guard,
29661
29874
  declaration.guardProvenance,
29662
29875
  fontSizePx
29663
29876
  );
@@ -29667,7 +29880,7 @@ function normalizeSignalMapWithCounts(values) {
29667
29880
  let unknownSignalCount = 0;
29668
29881
  let conditionalSignalCount = 0;
29669
29882
  for (const value2 of out.values()) {
29670
- if (value2.guard === "conditional") {
29883
+ if (value2.guard.kind === 1 /* Conditional */) {
29671
29884
  conditionalSignalCount++;
29672
29885
  continue;
29673
29886
  }
@@ -29695,7 +29908,7 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
29695
29908
  if (!longhand) continue;
29696
29909
  const name = MONITORED_SIGNAL_NAME_MAP.get(longhand);
29697
29910
  if (name === void 0) continue;
29698
- out.set(name, createUnknown(name, declaration.value, declaration.source, declaration.guard, declaration.guardProvenance, reason));
29911
+ out.set(name, createUnknown(name, declaration.source, declaration.guardProvenance, reason));
29699
29912
  }
29700
29913
  return;
29701
29914
  }
@@ -29705,127 +29918,139 @@ function applyExpandedShorthand(out, property, declaration, fontSizePx) {
29705
29918
  if (!entry) continue;
29706
29919
  const name = MONITORED_SIGNAL_NAME_MAP.get(entry.name);
29707
29920
  if (name === void 0) continue;
29708
- out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guard, declaration.guardProvenance, fontSizePx));
29921
+ out.set(name, normalizeSignal(name, entry.value, declaration.source, declaration.guardProvenance, fontSizePx));
29709
29922
  }
29710
29923
  }
29711
29924
  function toMonitoredSignalName(property) {
29712
29925
  return MONITORED_SIGNAL_NAME_MAP.get(property) ?? null;
29713
29926
  }
29714
- function normalizeSignal(name, raw, source, guard, guardProvenance, fontSizePx) {
29927
+ function normalizeSignal(name, raw, source, guard, fontSizePx) {
29715
29928
  switch (name) {
29716
29929
  case "line-height":
29717
- return parseLineHeight(name, raw, source, guard, guardProvenance, fontSizePx);
29930
+ return parseLineHeight(name, raw, source, guard, fontSizePx);
29718
29931
  case "aspect-ratio":
29719
- return parseAspectRatio(name, raw, source, guard, guardProvenance);
29932
+ return parseAspectRatio(name, raw, source, guard);
29720
29933
  case "contain-intrinsic-size":
29721
- return parseContainIntrinsicSize(name, raw, source, guard, guardProvenance);
29934
+ return parseContainIntrinsicSize(name, raw, source, guard);
29722
29935
  case "transform":
29723
- return parseTransform(name, raw, source, guard, guardProvenance);
29936
+ return parseTransform(name, raw, source, guard);
29724
29937
  case "translate":
29725
- return parseTranslateProperty(name, raw, source, guard, guardProvenance);
29938
+ return parseTranslateProperty(name, raw, source, guard);
29726
29939
  default:
29727
29940
  break;
29728
29941
  }
29729
- if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard, guardProvenance);
29730
- if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard, guardProvenance);
29731
- return createUnknown(name, raw, source, guard, guardProvenance, "unsupported signal");
29942
+ if (LENGTH_SIGNAL_SET.has(name)) return parseLength(name, raw, source, guard);
29943
+ if (KEYWORD_SIGNAL_SET.has(name)) return parseKeyword(name, raw, source, guard);
29944
+ return createUnknown(name, source, guard, "unsupported signal");
29732
29945
  }
29733
- function parseAspectRatio(name, raw, source, guard, guardProvenance) {
29946
+ function parseAspectRatio(name, raw, source, guard) {
29734
29947
  const trimmed = raw.trim().toLowerCase();
29735
29948
  if (trimmed.length === 0) {
29736
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio value is empty");
29949
+ return createUnknown(name, source, guard, "aspect-ratio value is empty");
29737
29950
  }
29738
29951
  if (hasDynamicExpression(trimmed)) {
29739
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio uses runtime-dependent function");
29952
+ return createUnknown(name, source, guard, "aspect-ratio uses runtime-dependent function");
29740
29953
  }
29741
29954
  if (trimmed === "auto") {
29742
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio auto does not reserve ratio");
29955
+ return createUnknown(name, source, guard, "aspect-ratio auto does not reserve ratio");
29743
29956
  }
29744
29957
  const slash = trimmed.indexOf("/");
29745
29958
  if (slash !== -1) {
29746
29959
  const left = Number(trimmed.slice(0, slash).trim());
29747
29960
  const right = Number(trimmed.slice(slash + 1).trim());
29748
29961
  if (!Number.isFinite(left) || !Number.isFinite(right) || left <= 0 || right <= 0) {
29749
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio ratio is invalid");
29962
+ return createUnknown(name, source, guard, "aspect-ratio ratio is invalid");
29750
29963
  }
29751
- return createKnown(name, raw, source, guard, guardProvenance, null, "unitless", "exact");
29964
+ return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
29752
29965
  }
29753
29966
  const ratio = Number(trimmed);
29754
29967
  if (!Number.isFinite(ratio) || ratio <= 0) {
29755
- return createUnknown(name, raw, source, guard, guardProvenance, "aspect-ratio is not statically parseable");
29968
+ return createUnknown(name, source, guard, "aspect-ratio is not statically parseable");
29756
29969
  }
29757
- return createKnown(name, raw, source, guard, guardProvenance, null, "unitless", "exact");
29970
+ return createKnown(name, raw, source, guard, null, 1 /* Unitless */, "exact");
29758
29971
  }
29759
- function parseContainIntrinsicSize(name, raw, source, guard, guardProvenance) {
29972
+ function parseContainIntrinsicSize(name, raw, source, guard) {
29760
29973
  const trimmed = raw.trim().toLowerCase();
29761
29974
  if (trimmed.length === 0) {
29762
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size value is empty");
29975
+ return createUnknown(name, source, guard, "contain-intrinsic-size value is empty");
29763
29976
  }
29764
29977
  if (hasDynamicExpression(trimmed)) {
29765
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size uses runtime-dependent function");
29978
+ return createUnknown(name, source, guard, "contain-intrinsic-size uses runtime-dependent function");
29766
29979
  }
29767
29980
  if (trimmed === "none" || trimmed === "auto") {
29768
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size does not reserve space");
29981
+ return createUnknown(name, source, guard, "contain-intrinsic-size does not reserve space");
29769
29982
  }
29770
29983
  const parts = splitWhitespaceTokens(trimmed);
29771
29984
  for (let i = 0; i < parts.length; i++) {
29772
29985
  const part = parts[i];
29773
29986
  if (!part) continue;
29774
29987
  const px = parseSignedPxValue(part);
29775
- if (px !== null) return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
29988
+ if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
29776
29989
  }
29777
- return createUnknown(name, raw, source, guard, guardProvenance, "contain-intrinsic-size is not statically parseable in px");
29990
+ return createUnknown(name, source, guard, "contain-intrinsic-size is not statically parseable in px");
29778
29991
  }
29779
- function parseLineHeight(name, raw, source, guard, guardProvenance, fontSizePx) {
29992
+ function parseLineHeight(name, raw, source, guard, fontSizePx) {
29780
29993
  const unitless = parseUnitlessValue(raw);
29781
29994
  if (unitless !== null) {
29782
29995
  const base = fontSizePx === null ? 16 : fontSizePx;
29783
- return createKnown(name, raw, source, guard, guardProvenance, unitless * base, "unitless", "estimated");
29996
+ return createKnown(name, raw, source, guard, unitless * base, 1 /* Unitless */, "estimated");
29784
29997
  }
29785
29998
  const px = parseSignedPxValue(raw);
29786
- if (px !== null) return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
29787
- return createUnknown(name, raw, source, guard, guardProvenance, "line-height is not statically parseable");
29999
+ if (px !== null) return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
30000
+ return createUnknown(name, source, guard, "line-height is not statically parseable");
29788
30001
  }
29789
- function parseLength(name, raw, source, guard, guardProvenance) {
30002
+ var DIMENSION_KEYWORD_SET = /* @__PURE__ */ new Set([
30003
+ "auto",
30004
+ "none",
30005
+ "fit-content",
30006
+ "min-content",
30007
+ "max-content",
30008
+ "stretch"
30009
+ ]);
30010
+ function parseLength(name, raw, source, guard) {
29790
30011
  const px = parseSignedPxValue(raw);
29791
- if (px === null) {
29792
- return createUnknown(name, raw, source, guard, guardProvenance, "length is not statically parseable in px");
30012
+ if (px !== null) {
30013
+ return createKnown(name, raw, source, guard, px, 0 /* Px */, "exact");
30014
+ }
30015
+ const normalized = raw.trim().toLowerCase();
30016
+ if (DIMENSION_KEYWORD_SET.has(normalized) || normalized.startsWith("fit-content(")) {
30017
+ return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
29793
30018
  }
29794
- return createKnown(name, raw, source, guard, guardProvenance, px, "px", "exact");
30019
+ return createUnknown(name, source, guard, "length is not statically parseable in px");
29795
30020
  }
29796
- function parseKeyword(name, raw, source, guard, guardProvenance) {
30021
+ function parseKeyword(name, raw, source, guard) {
29797
30022
  const normalized = raw.trim().toLowerCase();
29798
30023
  if (normalized.length === 0) {
29799
- return createUnknown(name, raw, source, guard, guardProvenance, "keyword value is empty");
30024
+ return createUnknown(name, source, guard, "keyword value is empty");
29800
30025
  }
29801
30026
  if (hasDynamicExpression(normalized)) {
29802
- return createUnknown(name, raw, source, guard, guardProvenance, "keyword uses runtime-dependent function");
30027
+ return createUnknown(name, source, guard, "keyword uses runtime-dependent function");
29803
30028
  }
29804
- return createKnown(name, raw, source, guard, guardProvenance, null, "keyword", "exact");
30029
+ return createKnown(name, raw, source, guard, null, 2 /* Keyword */, "exact");
29805
30030
  }
29806
- function parseTransform(name, raw, source, guard, guardProvenance) {
30031
+ function parseTransform(name, raw, source, guard) {
29807
30032
  const normalized = raw.trim().toLowerCase();
29808
30033
  if (normalized.length === 0) {
29809
- return createUnknown(name, raw, source, guard, guardProvenance, "transform value is empty");
30034
+ return createUnknown(name, source, guard, "transform value is empty");
29810
30035
  }
29811
30036
  if (hasDynamicExpression(normalized)) {
29812
- return createUnknown(name, raw, source, guard, guardProvenance, "transform uses runtime-dependent function");
30037
+ return createUnknown(name, source, guard, "transform uses runtime-dependent function");
29813
30038
  }
29814
30039
  const y = extractTransformYPx(normalized);
29815
- if (y !== null) return createKnown(name, raw, source, guard, guardProvenance, y, "px", "exact");
29816
- return createUnknown(name, raw, source, guard, guardProvenance, "transform has non-translational or non-px functions");
30040
+ if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
30041
+ return createUnknown(name, source, guard, "transform has non-translational or non-px functions");
29817
30042
  }
29818
- function parseTranslateProperty(name, raw, source, guard, guardProvenance) {
30043
+ function parseTranslateProperty(name, raw, source, guard) {
29819
30044
  const trimmed = raw.trim().toLowerCase();
29820
30045
  if (trimmed.length === 0) {
29821
- return createUnknown(name, raw, source, guard, guardProvenance, "translate value is empty");
30046
+ return createUnknown(name, source, guard, "translate value is empty");
29822
30047
  }
29823
30048
  if (hasDynamicExpression(trimmed)) {
29824
- return createUnknown(name, raw, source, guard, guardProvenance, "translate uses runtime-dependent function");
30049
+ return createUnknown(name, source, guard, "translate uses runtime-dependent function");
29825
30050
  }
29826
30051
  const y = extractTranslatePropertyYPx(trimmed);
29827
- if (y !== null) return createKnown(name, raw, source, guard, guardProvenance, y, "px", "exact");
29828
- return createUnknown(name, raw, source, guard, guardProvenance, "translate property vertical component is not px");
30052
+ if (y !== null) return createKnown(name, raw, source, guard, y, 0 /* Px */, "exact");
30053
+ return createUnknown(name, source, guard, "translate property vertical component is not px");
29829
30054
  }
29830
30055
  function hasDynamicExpression(raw) {
29831
30056
  if (raw.includes("var(")) return true;
@@ -29837,28 +30062,24 @@ function hasDynamicExpression(raw) {
29837
30062
  if (raw.includes("clamp(")) return true;
29838
30063
  return false;
29839
30064
  }
29840
- function createKnown(name, raw, source, guard, guardProvenance, px, unit, quality) {
30065
+ function createKnown(name, raw, source, guard, px, unit, quality) {
29841
30066
  return {
29842
30067
  kind: "known",
29843
30068
  name,
29844
- raw,
29845
30069
  normalized: raw.trim().toLowerCase(),
29846
30070
  source,
29847
30071
  guard,
29848
- guardProvenance,
29849
30072
  unit,
29850
30073
  px,
29851
30074
  quality
29852
30075
  };
29853
30076
  }
29854
- function createUnknown(name, raw, source, guard, guardProvenance, reason) {
30077
+ function createUnknown(name, source, guard, reason) {
29855
30078
  return {
29856
30079
  kind: "unknown",
29857
30080
  name,
29858
- raw,
29859
30081
  source,
29860
30082
  guard,
29861
- guardProvenance,
29862
30083
  reason
29863
30084
  };
29864
30085
  }
@@ -29905,13 +30126,7 @@ function buildSnapshotForNode(node, cascadeByElementNode, snapshotByElementNode,
29905
30126
  const unknownSignalCount = normalized.unknownSignalCount + inherited.unknownDelta;
29906
30127
  const conditionalSignalCount = normalized.conditionalSignalCount + inherited.conditionalDelta;
29907
30128
  const snapshot = {
29908
- solidFile: node.solidFile,
29909
- elementId: node.elementId,
29910
- elementKey: node.key,
29911
- tag: node.tag,
29912
- textualContent: node.textualContent,
29913
- isControl: node.isControl,
29914
- isReplaced: node.isReplaced,
30129
+ node,
29915
30130
  signals: inherited.signals,
29916
30131
  knownSignalCount,
29917
30132
  unknownSignalCount,
@@ -29942,7 +30157,7 @@ function inheritSignalsFromParent(parentSnapshot, local) {
29942
30157
  if (!inheritedValue) continue;
29943
30158
  if (out === null) out = new Map(local);
29944
30159
  out.set(signal, inheritedValue);
29945
- if (inheritedValue.guard === "conditional") {
30160
+ if (inheritedValue.guard.kind === 1 /* Conditional */) {
29946
30161
  conditionalDelta++;
29947
30162
  continue;
29948
30163
  }
@@ -29986,7 +30201,7 @@ var EMPTY_LAYOUT_RESERVED_SPACE_FACT = Object.freeze({
29986
30201
  });
29987
30202
  var EMPTY_LAYOUT_SCROLL_CONTAINER_FACT = Object.freeze({
29988
30203
  isScrollContainer: false,
29989
- axis: "none",
30204
+ axis: 0 /* None */,
29990
30205
  overflow: null,
29991
30206
  overflowY: null,
29992
30207
  hasConditionalScroll: false,
@@ -30019,53 +30234,28 @@ function readKnownSignalWithGuard(snapshot, name) {
30019
30234
  return value2;
30020
30235
  }
30021
30236
  function toEvidenceKind(value2) {
30022
- if (value2.guard === "conditional") return "conditional";
30023
- if (value2.quality === "estimated") return "interval";
30024
- return "exact";
30025
- }
30026
- function readNumericSignalEvidence(snapshot, name) {
30027
- const value2 = snapshot.signals.get(name);
30028
- if (!value2) {
30029
- return {
30030
- value: null,
30031
- kind: "unknown"
30032
- };
30033
- }
30034
- if (value2.kind !== "known") {
30035
- if (value2.guard === "conditional") {
30036
- return {
30037
- value: null,
30038
- kind: "conditional"
30039
- };
30040
- }
30041
- return {
30042
- value: null,
30043
- kind: "unknown"
30044
- };
30045
- }
30046
- return {
30047
- value: value2.px,
30048
- kind: toEvidenceKind(value2)
30049
- };
30237
+ if (value2.guard.kind === 1 /* Conditional */) return 2 /* Conditional */;
30238
+ if (value2.quality === "estimated") return 1 /* Interval */;
30239
+ return 0 /* Exact */;
30050
30240
  }
30051
30241
  function readNormalizedSignalEvidence(snapshot, name) {
30052
30242
  const value2 = snapshot.signals.get(name);
30053
30243
  if (!value2) {
30054
30244
  return {
30055
30245
  value: null,
30056
- kind: "unknown"
30246
+ kind: 3 /* Unknown */
30057
30247
  };
30058
30248
  }
30059
30249
  if (value2.kind !== "known") {
30060
- if (value2.guard === "conditional") {
30250
+ if (value2.guard.kind === 1 /* Conditional */) {
30061
30251
  return {
30062
30252
  value: null,
30063
- kind: "conditional"
30253
+ kind: 2 /* Conditional */
30064
30254
  };
30065
30255
  }
30066
30256
  return {
30067
30257
  value: null,
30068
- kind: "unknown"
30258
+ kind: 3 /* Unknown */
30069
30259
  };
30070
30260
  }
30071
30261
  return {
@@ -30076,7 +30266,7 @@ function readNormalizedSignalEvidence(snapshot, name) {
30076
30266
  function readKnownSignal(snapshot, name) {
30077
30267
  const value2 = readKnownSignalWithGuard(snapshot, name);
30078
30268
  if (!value2) return null;
30079
- if (value2.guard !== "unconditional") return null;
30269
+ if (value2.guard.kind !== 0 /* Unconditional */) return null;
30080
30270
  return value2;
30081
30271
  }
30082
30272
  function readKnownPx(snapshot, name) {
@@ -30110,19 +30300,19 @@ function hasEffectivePosition(snapshot) {
30110
30300
  return position !== "static";
30111
30301
  }
30112
30302
  function readReservedSpaceFact(graph, node) {
30113
- return graph.reservedSpaceFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
30303
+ return graph.reservedSpaceFactsByNode.get(node) ?? EMPTY_LAYOUT_RESERVED_SPACE_FACT;
30114
30304
  }
30115
30305
  function readScrollContainerFact(graph, node) {
30116
- return graph.scrollContainerFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
30306
+ return graph.scrollContainerFactsByNode.get(node) ?? EMPTY_LAYOUT_SCROLL_CONTAINER_FACT;
30117
30307
  }
30118
30308
  function readFlowParticipationFact(graph, node) {
30119
- return graph.flowParticipationFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
30309
+ return graph.flowParticipationFactsByNode.get(node) ?? EMPTY_LAYOUT_FLOW_PARTICIPATION_FACT;
30120
30310
  }
30121
30311
  function readContainingBlockFact(graph, node) {
30122
- return graph.containingBlockFactsByElementKey.get(node.key) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
30312
+ return graph.containingBlockFactsByNode.get(node) ?? EMPTY_LAYOUT_CONTAINING_BLOCK_FACT;
30123
30313
  }
30124
30314
  function readConditionalSignalDeltaFact(graph, node, name) {
30125
- const byProperty = graph.conditionalSignalDeltaFactsByElementKey.get(node.key);
30315
+ const byProperty = graph.conditionalSignalDeltaFactsByNode.get(node);
30126
30316
  if (!byProperty) return EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
30127
30317
  return byProperty.get(name) ?? EMPTY_LAYOUT_CONDITIONAL_DELTA_FACT;
30128
30318
  }
@@ -30150,7 +30340,7 @@ function readScrollContainerElements(graph) {
30150
30340
  return graph.scrollContainerElements;
30151
30341
  }
30152
30342
  function readBaselineOffsetFacts(graph, node) {
30153
- return graph.baselineOffsetFactsByElementKey.get(node.key) ?? EMPTY_BASELINE_FACTS;
30343
+ return graph.baselineOffsetFactsByNode.get(node) ?? EMPTY_BASELINE_FACTS;
30154
30344
  }
30155
30345
  function readElementRef(graph, node) {
30156
30346
  return readElementRefById(graph, node.solidFile, node.elementId);
@@ -30172,7 +30362,6 @@ function readStatefulBaseValueIndex(graph) {
30172
30362
  }
30173
30363
 
30174
30364
  // src/cross-file/layout/context-classification.ts
30175
- var WHITESPACE_RE3 = /\s+/;
30176
30365
  var TABLE_SEMANTIC_TAGS = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th"]);
30177
30366
  var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
30178
30367
  "table",
@@ -30189,7 +30378,6 @@ var TABLE_DISPLAY_VALUES = /* @__PURE__ */ new Set([
30189
30378
  var FLEX_DISPLAY_VALUES = /* @__PURE__ */ new Set(["flex", "inline-flex"]);
30190
30379
  var GRID_DISPLAY_VALUES = /* @__PURE__ */ new Set(["grid", "inline-grid"]);
30191
30380
  var INLINE_DISPLAY_VALUES = /* @__PURE__ */ new Set(["inline", "inline-block", "inline-list-item"]);
30192
- var DISPLAY_TOKEN_SPLIT_RE = /\s+/;
30193
30381
  function createAlignmentContextForParent(parent, snapshot) {
30194
30382
  const axis = resolveAxis(snapshot);
30195
30383
  const inlineDirection = resolveInlineDirection(snapshot);
@@ -30212,6 +30400,7 @@ function createAlignmentContextForParent(parent, snapshot) {
30212
30400
  const contextCertainty = combineCertainty(classified.certainty, axis.certainty);
30213
30401
  const certainty = combineCertainty(contextCertainty, inlineDirection.certainty);
30214
30402
  const baselineRelevance = computeBaselineRelevance(classified.kind, parentAlignItems, parentPlaceItems);
30403
+ const crossAxisInfo = resolveCrossAxisIsBlockAxis(classified.kind, snapshot, axis.value);
30215
30404
  const out = {
30216
30405
  kind: classified.kind,
30217
30406
  certainty,
@@ -30227,6 +30416,8 @@ function createAlignmentContextForParent(parent, snapshot) {
30227
30416
  parentAlignItems,
30228
30417
  parentPlaceItems,
30229
30418
  hasPositionedOffset: positionedOffset.hasPositionedOffset,
30419
+ crossAxisIsBlockAxis: crossAxisInfo.value,
30420
+ crossAxisIsBlockAxisCertainty: crossAxisInfo.certainty,
30230
30421
  baselineRelevance,
30231
30422
  evidence
30232
30423
  };
@@ -30236,7 +30427,7 @@ function classifyKind(evidence) {
30236
30427
  if (evidence.hasTableSemantics) {
30237
30428
  return {
30238
30429
  kind: "table-cell",
30239
- certainty: "resolved"
30430
+ certainty: 0 /* Resolved */
30240
30431
  };
30241
30432
  }
30242
30433
  if (evidence.containerKind === "table") {
@@ -30323,7 +30514,7 @@ function resolveContainerKind(parentDisplay, certainty) {
30323
30514
  certainty
30324
30515
  };
30325
30516
  }
30326
- const tokens = display.split(DISPLAY_TOKEN_SPLIT_RE);
30517
+ const tokens = display.split(WHITESPACE_RE3);
30327
30518
  if (tokens.length === 2) {
30328
30519
  const outside = tokens[0];
30329
30520
  const inside = tokens[1];
@@ -30373,7 +30564,7 @@ function resolveAxis(snapshot) {
30373
30564
  if (!snapshot.signals.has("writing-mode")) {
30374
30565
  return {
30375
30566
  value: "horizontal-tb",
30376
- certainty: "resolved"
30567
+ certainty: 0 /* Resolved */
30377
30568
  };
30378
30569
  }
30379
30570
  const writingMode = readNormalizedSignalEvidence(snapshot, "writing-mode");
@@ -30398,7 +30589,7 @@ function resolveInlineDirection(snapshot) {
30398
30589
  if (!snapshot.signals.has("direction")) {
30399
30590
  return {
30400
30591
  value: "ltr",
30401
- certainty: "resolved"
30592
+ certainty: 0 /* Resolved */
30402
30593
  };
30403
30594
  }
30404
30595
  const direction = readNormalizedSignalEvidence(snapshot, "direction");
@@ -30414,16 +30605,16 @@ function resolveInlineDirection(snapshot) {
30414
30605
  };
30415
30606
  }
30416
30607
  function toContextCertainty(kind) {
30417
- if (kind === "exact") return "resolved";
30418
- if (kind === "interval" || kind === "conditional") return "conditional";
30419
- return "unknown";
30608
+ if (kind === 0 /* Exact */) return 0 /* Resolved */;
30609
+ if (kind === 1 /* Interval */ || kind === 2 /* Conditional */) return 1 /* Conditional */;
30610
+ return 2 /* Unknown */;
30420
30611
  }
30421
30612
  function resolvePositionedOffset(snapshot) {
30422
30613
  const position = readKnownSignalWithGuard(snapshot, "position");
30423
30614
  if (!position) {
30424
30615
  return {
30425
30616
  hasPositionedOffset: false,
30426
- certainty: "unknown"
30617
+ certainty: 2 /* Unknown */
30427
30618
  };
30428
30619
  }
30429
30620
  const certainty = resolveSignalCertainty(position);
@@ -30438,15 +30629,33 @@ function resolvePositionedOffset(snapshot) {
30438
30629
  certainty
30439
30630
  };
30440
30631
  }
30632
+ var FLEX_ROW_VALUES = /* @__PURE__ */ new Set(["row", "row-reverse"]);
30633
+ function resolveCrossAxisIsBlockAxis(kind, snapshot, _axis) {
30634
+ if (kind !== "flex-cross-axis" && kind !== "grid-cross-axis") {
30635
+ return { value: true, certainty: 0 /* Resolved */ };
30636
+ }
30637
+ if (kind === "flex-cross-axis") {
30638
+ const signal2 = readKnownSignalWithGuard(snapshot, "flex-direction");
30639
+ if (!signal2) {
30640
+ return { value: true, certainty: 0 /* Resolved */ };
30641
+ }
30642
+ const certainty2 = resolveSignalCertainty(signal2);
30643
+ return { value: FLEX_ROW_VALUES.has(signal2.normalized), certainty: certainty2 };
30644
+ }
30645
+ const signal = readKnownSignalWithGuard(snapshot, "grid-auto-flow");
30646
+ if (!signal) {
30647
+ return { value: true, certainty: 0 /* Resolved */ };
30648
+ }
30649
+ const certainty = resolveSignalCertainty(signal);
30650
+ return { value: !signal.normalized.startsWith("column"), certainty };
30651
+ }
30441
30652
  function resolveSignalCertainty(value2) {
30442
- if (!value2) return "unknown";
30443
- if (value2.guard === "conditional") return "conditional";
30444
- return "resolved";
30653
+ if (!value2) return 2 /* Unknown */;
30654
+ if (value2.guard.kind === 1 /* Conditional */) return 1 /* Conditional */;
30655
+ return 0 /* Resolved */;
30445
30656
  }
30446
30657
  function combineCertainty(left, right) {
30447
- if (left === "unknown" || right === "unknown") return "unknown";
30448
- if (left === "conditional" || right === "conditional") return "conditional";
30449
- return "resolved";
30658
+ return left > right ? left : right;
30450
30659
  }
30451
30660
  var FLEX_GRID_GEOMETRIC_ALIGN_ITEMS = /* @__PURE__ */ new Set([
30452
30661
  "center",
@@ -30485,24 +30694,7 @@ function finalizeTableCellBaselineRelevance(contextByParentNode, cohortVerticalA
30485
30694
  if (context.kind !== "table-cell") continue;
30486
30695
  if (consensusValue === null) continue;
30487
30696
  if (!TABLE_CELL_GEOMETRIC_VERTICAL_ALIGN.has(consensusValue)) continue;
30488
- contextByParentNode.set(parent, {
30489
- kind: context.kind,
30490
- certainty: context.certainty,
30491
- parentSolidFile: context.parentSolidFile,
30492
- parentElementId: context.parentElementId,
30493
- parentElementKey: context.parentElementKey,
30494
- parentTag: context.parentTag,
30495
- axis: context.axis,
30496
- axisCertainty: context.axisCertainty,
30497
- inlineDirection: context.inlineDirection,
30498
- inlineDirectionCertainty: context.inlineDirectionCertainty,
30499
- parentDisplay: context.parentDisplay,
30500
- parentAlignItems: context.parentAlignItems,
30501
- parentPlaceItems: context.parentPlaceItems,
30502
- hasPositionedOffset: context.hasPositionedOffset,
30503
- baselineRelevance: "irrelevant",
30504
- evidence: context.evidence
30505
- });
30697
+ contextByParentNode.set(parent, deriveAlignmentContext(context, { baselineRelevance: "irrelevant" }));
30506
30698
  }
30507
30699
  }
30508
30700
 
@@ -31049,6 +31241,20 @@ function collectTransitiveCSSScope(entryPath, resolver, cssFilesByNormalizedPath
31049
31241
  }
31050
31242
 
31051
31243
  // src/cross-file/layout/perf.ts
31244
+ function createReservoir(capacity) {
31245
+ return { buffer: [], count: 0, capacity };
31246
+ }
31247
+ function reservoirPush(r, value2) {
31248
+ r.count++;
31249
+ if (r.buffer.length < r.capacity) {
31250
+ r.buffer.push(value2);
31251
+ return;
31252
+ }
31253
+ const j = Math.floor(Math.random() * r.count);
31254
+ if (j < r.capacity) {
31255
+ r.buffer[j] = value2;
31256
+ }
31257
+ }
31052
31258
  var EMPTY_STATS = {
31053
31259
  elementsScanned: 0,
31054
31260
  selectorCandidatesChecked: 0,
@@ -31105,7 +31311,7 @@ function createLayoutPerfStats() {
31105
31311
  cohortUnimodalFalse: 0,
31106
31312
  factorCoverageSum: 0,
31107
31313
  factorCoverageCount: 0,
31108
- posteriorWidths: [],
31314
+ posteriorWidths: createReservoir(200),
31109
31315
  uncertaintyEscalations: 0,
31110
31316
  signalSnapshotsBuilt: 0,
31111
31317
  signalSnapshotCacheHits: 0,
@@ -31170,14 +31376,12 @@ function maybeLogLayoutPerf(stats, log) {
31170
31376
  `[layout] elements=${view.elementsScanned} candidates=${view.selectorCandidatesChecked} compiledSelectors=${view.compiledSelectorCount} unsupportedSelectors=${view.selectorsRejectedUnsupported} conditionalSelectors=${view.selectorsGuardedConditional} ancestryChecks=${view.ancestryChecks} edges=${view.matchEdgesCreated} collected=${view.casesCollected} cases=${view.casesScored} rejectLowEvidence=${view.casesRejectedLowEvidence} rejectThreshold=${view.casesRejectedThreshold} rejectUndecidable=${view.casesRejectedUndecidable} rejectIdentifiability=${view.casesRejectedIdentifiability} undecidableInterval=${view.undecidableInterval} conditionalSignalRatio=${Math.round(view.conditionalSignalRatio * 1e3) / 1e3} conditionalSignals=${view.conditionalSignals} totalSignals=${view.totalSignals} cohortUnimodalFalse=${view.cohortUnimodalFalse} factorCoverageMean=${Math.round(view.factorCoverageMean * 1e3) / 1e3} posteriorWidthP95=${Math.round(view.posteriorWidthP95 * 1e3) / 1e3} uncertaintyEscalations=${view.uncertaintyEscalations} snapshots=${view.signalSnapshotsBuilt} snapshotHits=${view.signalSnapshotCacheHits} measurementIndexHits=${view.measurementIndexHits} contexts=${view.contextsClassified} diagnostics=${view.diagnosticsEmitted} selectorIndexMs=${Math.round(view.selectorIndexMs * 100) / 100} selectorMatchMs=${Math.round(view.selectorMatchMs * 100) / 100} cascadeBuildMs=${Math.round(view.cascadeBuildMs * 100) / 100} caseBuildMs=${Math.round(view.caseBuildMs * 100) / 100} scoringMs=${Math.round(view.scoringMs * 100) / 100} elapsedMs=${Math.round(view.elapsedMs * 100) / 100}`
31171
31377
  );
31172
31378
  }
31173
- function computeP95(values) {
31174
- if (values.length === 0) return 0;
31175
- const sorted = [...values];
31176
- sorted.sort((left, right) => left - right);
31177
- const index = Math.ceil(sorted.length * 0.95) - 1;
31178
- if (index <= 0) return sorted[0] ?? 0;
31179
- if (index >= sorted.length) return sorted[sorted.length - 1] ?? 0;
31180
- return sorted[index] ?? 0;
31379
+ function computeP95(sampler) {
31380
+ if (sampler.buffer.length === 0) return 0;
31381
+ const scratch = [...sampler.buffer];
31382
+ const index = Math.ceil(scratch.length * 0.95) - 1;
31383
+ const clamped = index <= 0 ? 0 : index >= scratch.length ? scratch.length - 1 : index;
31384
+ return selectKth(scratch, clamped);
31181
31385
  }
31182
31386
 
31183
31387
  // src/cross-file/layout/component-host.ts
@@ -33196,16 +33400,16 @@ function includesAttributeWord(value2, word) {
33196
33400
 
33197
33401
  // src/cross-file/layout/guard-model.ts
33198
33402
  var UNCONDITIONAL_GUARD = {
33199
- kind: "unconditional",
33403
+ kind: 0 /* Unconditional */,
33200
33404
  conditions: [],
33201
33405
  key: "always"
33202
33406
  };
33203
- var WHITESPACE_RE4 = /\s+/g;
33407
+ var WHITESPACE_RE_GLOBAL = /\s+/g;
33204
33408
  function resolveRuleGuard(rule) {
33205
33409
  const conditions = collectRuleConditions(rule);
33206
33410
  if (conditions.length === 0) return UNCONDITIONAL_GUARD;
33207
33411
  return {
33208
- kind: "conditional",
33412
+ kind: 1 /* Conditional */,
33209
33413
  conditions,
33210
33414
  key: conditions.map((condition) => condition.key).join("&")
33211
33415
  };
@@ -33259,7 +33463,7 @@ function buildCondition(kind, query) {
33259
33463
  }
33260
33464
  function normalizeQuery(query) {
33261
33465
  if (query === null) return null;
33262
- const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE4, " ");
33466
+ const normalized = query.trim().toLowerCase().replace(WHITESPACE_RE_GLOBAL, " ");
33263
33467
  if (normalized.length === 0) return null;
33264
33468
  return normalized;
33265
33469
  }
@@ -33329,7 +33533,7 @@ function summarizeSignalFacts(snapshots) {
33329
33533
  }
33330
33534
  function accumulateSnapshotFacts(snapshot, sink) {
33331
33535
  for (const value2 of snapshot.signals.values()) {
33332
- if (value2.guard === "conditional") {
33536
+ if (value2.guard.kind === 1 /* Conditional */) {
33333
33537
  sink.addConditional();
33334
33538
  continue;
33335
33539
  }
@@ -33523,15 +33727,6 @@ function assertUnitInterval(name, value2) {
33523
33727
  }
33524
33728
 
33525
33729
  // src/cross-file/layout/content-composition.ts
33526
- var INTRINSIC_REPLACED_TAGS = /* @__PURE__ */ new Set([
33527
- "img",
33528
- "svg",
33529
- "video",
33530
- "canvas",
33531
- "iframe",
33532
- "object",
33533
- "embed"
33534
- ]);
33535
33730
  var BLOCK_FORMATTING_CONTEXT_DISPLAYS = /* @__PURE__ */ new Set([
33536
33731
  "block",
33537
33732
  "flex",
@@ -33565,7 +33760,7 @@ var VERTICAL_ALIGN_MITIGATIONS = /* @__PURE__ */ new Set([
33565
33760
  "text-top",
33566
33761
  "text-bottom"
33567
33762
  ]);
33568
- function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey) {
33763
+ function computeContentCompositionFingerprint(elementNode, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
33569
33764
  const state = {
33570
33765
  hasTextContent: false,
33571
33766
  hasInlineReplaced: false,
@@ -33579,10 +33774,10 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33579
33774
  blockChildCount: 0,
33580
33775
  inlineChildCount: 0
33581
33776
  };
33582
- if (elementNode.textualContent === "yes" || elementNode.textualContent === "dynamic-text") {
33777
+ if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
33583
33778
  state.hasTextContent = true;
33584
33779
  }
33585
- const elementHotSignals = snapshotHotSignalsByElementKey.get(elementNode.key);
33780
+ const elementHotSignals = snapshotHotSignalsByNode.get(elementNode);
33586
33781
  const elementDisplay = elementHotSignals?.display.value ?? null;
33587
33782
  if (elementDisplay !== null && establishesFormattingContext(elementDisplay)) {
33588
33783
  return {
@@ -33593,7 +33788,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33593
33788
  wrappingContextMitigates: false,
33594
33789
  hasVerticalAlignMitigation: false,
33595
33790
  mixedContentDepth: 0,
33596
- classification: "block-segmented",
33791
+ classification: 4 /* BlockSegmented */,
33597
33792
  analyzableChildCount: 0,
33598
33793
  totalChildCount: 0,
33599
33794
  hasOnlyBlockChildren: false
@@ -33603,7 +33798,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33603
33798
  elementNode,
33604
33799
  childrenByParentNode,
33605
33800
  snapshotByElementNode,
33606
- snapshotHotSignalsByElementKey,
33801
+ snapshotHotSignalsByNode,
33607
33802
  state,
33608
33803
  0
33609
33804
  );
@@ -33623,7 +33818,7 @@ function computeContentCompositionFingerprint(elementNode, childrenByParentNode,
33623
33818
  hasOnlyBlockChildren
33624
33819
  };
33625
33820
  }
33626
- function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, state, depth) {
33821
+ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, state, depth) {
33627
33822
  const children = childrenByParentNode.get(node);
33628
33823
  if (!children) return;
33629
33824
  for (let i = 0; i < children.length; i++) {
@@ -33634,7 +33829,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33634
33829
  if (!snapshot) continue;
33635
33830
  if (depth === 0) state.analyzableChildCount++;
33636
33831
  const childTag = child.tagName?.toLowerCase() ?? null;
33637
- const hotSignals = snapshotHotSignalsByElementKey.get(child.key);
33832
+ const hotSignals = snapshotHotSignalsByNode.get(child);
33638
33833
  const childDisplay = hotSignals?.display.value ?? null;
33639
33834
  if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
33640
33835
  state.hasInlineReplaced = true;
@@ -33656,16 +33851,16 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33656
33851
  checkVerticalAlignMitigation(snapshot, state);
33657
33852
  updateMixedContentDepth(state, depth);
33658
33853
  if (depth === 0) state.inlineChildCount++;
33659
- const parentHotSignals = snapshotHotSignalsByElementKey.get(node.key);
33854
+ const parentHotSignals = snapshotHotSignalsByNode.get(node);
33660
33855
  const parentDisplay = parentHotSignals?.display.value ?? null;
33661
33856
  if (parentDisplay !== null && isAlignmentContextWithNonBaselineAlignment(parentDisplay, parentHotSignals)) {
33662
33857
  state.wrappingContextMitigates = true;
33663
- } else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey)) {
33858
+ } else if (isAlignmentContextWithNonBaselineAlignment(childDisplay, hotSignals) && containsMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode)) {
33664
33859
  state.wrappingContextMitigates = true;
33665
33860
  }
33666
33861
  continue;
33667
33862
  }
33668
- if (child.textualContent === "yes" || child.textualContent === "dynamic-text") {
33863
+ if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
33669
33864
  state.hasTextContent = true;
33670
33865
  }
33671
33866
  checkHeightContributions(snapshot, state);
@@ -33675,7 +33870,7 @@ function walkInlineDescendants(node, childrenByParentNode, snapshotByElementNode
33675
33870
  child,
33676
33871
  childrenByParentNode,
33677
33872
  snapshotByElementNode,
33678
- snapshotHotSignalsByElementKey,
33873
+ snapshotHotSignalsByNode,
33679
33874
  state,
33680
33875
  depth + 1
33681
33876
  );
@@ -33710,19 +33905,19 @@ function isAlignmentContextWithNonBaselineAlignment(display, hotSignals) {
33710
33905
  if (alignItems === null) return false;
33711
33906
  return alignItems !== "baseline";
33712
33907
  }
33713
- function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey) {
33714
- const hasText = node.textualContent === "yes" || node.textualContent === "dynamic-text";
33908
+ function containsMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode) {
33909
+ const hasText = node.textualContent === 0 /* Yes */ || node.textualContent === 3 /* DynamicText */;
33715
33910
  const hasReplaced = false;
33716
- return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, { hasText, hasReplaced });
33911
+ return scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, { hasText, hasReplaced });
33717
33912
  }
33718
- function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, found) {
33913
+ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found) {
33719
33914
  const children = childrenByParentNode.get(node);
33720
33915
  if (!children) return false;
33721
33916
  for (let i = 0; i < children.length; i++) {
33722
33917
  const child = children[i];
33723
33918
  if (!child) continue;
33724
33919
  const childTag = child.tagName?.toLowerCase() ?? null;
33725
- const hotSignals = snapshotHotSignalsByElementKey.get(child.key);
33920
+ const hotSignals = snapshotHotSignalsByNode.get(child);
33726
33921
  const childDisplay = hotSignals?.display.value ?? null;
33727
33922
  if (childTag !== null && (isIntrinsicReplacedTag(childTag) || isControlReplacedTag(childTag))) {
33728
33923
  found.hasReplaced = true;
@@ -33737,12 +33932,12 @@ function scanMixedContent(node, childrenByParentNode, snapshotByElementNode, sna
33737
33932
  if (found.hasText) return true;
33738
33933
  continue;
33739
33934
  }
33740
- if (child.textualContent === "yes" || child.textualContent === "dynamic-text") {
33935
+ if (child.textualContent === 0 /* Yes */ || child.textualContent === 3 /* DynamicText */) {
33741
33936
  found.hasText = true;
33742
33937
  if (found.hasReplaced) return true;
33743
33938
  }
33744
33939
  if (childDisplay === null || isInlineContinuationDisplay(childDisplay)) {
33745
- if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByElementKey, found)) {
33940
+ if (scanMixedContent(child, childrenByParentNode, snapshotByElementNode, snapshotHotSignalsByNode, found)) {
33746
33941
  return true;
33747
33942
  }
33748
33943
  }
@@ -33765,30 +33960,30 @@ function updateMixedContentDepth(state, depth) {
33765
33960
  }
33766
33961
  function classifyFromState(state, elementNode, hasOnlyBlockChildren) {
33767
33962
  if (hasOnlyBlockChildren) {
33768
- return "block-segmented";
33963
+ return 4 /* BlockSegmented */;
33769
33964
  }
33770
33965
  if (state.totalChildCount === 0 && !state.hasTextContent) {
33771
- if (elementNode.textualContent === "unknown") return "unknown";
33772
- if (elementNode.textualContent === "yes" || elementNode.textualContent === "dynamic-text") {
33773
- return "text-only";
33966
+ if (elementNode.textualContent === 2 /* Unknown */) return 5 /* Unknown */;
33967
+ if (elementNode.textualContent === 0 /* Yes */ || elementNode.textualContent === 3 /* DynamicText */) {
33968
+ return 0 /* TextOnly */;
33774
33969
  }
33775
- return "unknown";
33970
+ return 5 /* Unknown */;
33776
33971
  }
33777
33972
  if (state.analyzableChildCount === 0 && state.totalChildCount > 0) {
33778
- return "unknown";
33973
+ return 5 /* Unknown */;
33779
33974
  }
33780
33975
  if (state.hasTextContent && state.hasInlineReplaced) {
33781
- if (state.wrappingContextMitigates) return "mixed-mitigated";
33782
- if (state.hasVerticalAlignMitigation) return "mixed-mitigated";
33783
- return "mixed-unmitigated";
33976
+ if (state.wrappingContextMitigates) return 3 /* MixedMitigated */;
33977
+ if (state.hasVerticalAlignMitigation) return 3 /* MixedMitigated */;
33978
+ return 2 /* MixedUnmitigated */;
33784
33979
  }
33785
33980
  if (!state.hasTextContent && state.hasInlineReplaced) {
33786
- return "replaced-only";
33981
+ return 1 /* ReplacedOnly */;
33787
33982
  }
33788
33983
  if (state.hasTextContent && !state.hasInlineReplaced) {
33789
- return "text-only";
33984
+ return 0 /* TextOnly */;
33790
33985
  }
33791
- return "unknown";
33986
+ return 5 /* Unknown */;
33792
33987
  }
33793
33988
  function isIntrinsicReplacedTag(tag) {
33794
33989
  return INTRINSIC_REPLACED_TAGS.has(tag);
@@ -33808,10 +34003,14 @@ function isInlineReplacedDisplay(display) {
33808
34003
  function isInlineContinuationDisplay(display) {
33809
34004
  return INLINE_CONTINUATION_DISPLAYS.has(display);
33810
34005
  }
33811
- function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprints, parentContext) {
33812
- if (allFingerprints.length < 2) return 0;
34006
+ var NO_DIVERGENCE = Object.freeze({
34007
+ strength: 0,
34008
+ majorityClassification: 5 /* Unknown */
34009
+ });
34010
+ function resolveCompositionDivergence(subjectFingerprint, allFingerprints, parentContext) {
34011
+ if (allFingerprints.length < 2) return NO_DIVERGENCE;
33813
34012
  if (parentContext !== null && !hasSharedBaselineAlignment(parentContext)) {
33814
- return 0;
34013
+ return NO_DIVERGENCE;
33815
34014
  }
33816
34015
  const countByClassification = /* @__PURE__ */ new Map();
33817
34016
  for (let i = 0; i < allFingerprints.length; i++) {
@@ -33823,10 +34022,7 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
33823
34022
  }
33824
34023
  const subjectNormalized = normalizeClassificationForComparison(subjectFingerprint.classification);
33825
34024
  const subjectCount = countByClassification.get(subjectNormalized) ?? 0;
33826
- if (subjectCount === allFingerprints.length) {
33827
- return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
33828
- }
33829
- let majorityClassification = "unknown";
34025
+ let majorityClassification = 5 /* Unknown */;
33830
34026
  let majorityCount = 0;
33831
34027
  for (const [classification, count] of countByClassification) {
33832
34028
  if (count > majorityCount) {
@@ -33834,35 +34030,38 @@ function resolveCompositionDivergenceStrength(subjectFingerprint, allFingerprint
33834
34030
  majorityClassification = classification;
33835
34031
  }
33836
34032
  }
34033
+ if (subjectCount === allFingerprints.length) {
34034
+ return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
34035
+ }
33837
34036
  if (subjectNormalized === majorityClassification) {
33838
- return resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints);
34037
+ return { strength: resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints), majorityClassification };
33839
34038
  }
33840
- if (subjectNormalized === "unknown") {
33841
- return 0;
34039
+ if (subjectNormalized === 5 /* Unknown */) {
34040
+ return { strength: 0, majorityClassification };
33842
34041
  }
33843
34042
  const cal = alignmentStrengthCalibration;
33844
- if (majorityClassification === "text-only" && subjectNormalized === "mixed-unmitigated") {
33845
- return cal.compositionMixedUnmitigatedOutlierStrength;
34043
+ if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
34044
+ return { strength: cal.compositionMixedUnmitigatedOutlierStrength, majorityClassification };
33846
34045
  }
33847
- if (majorityClassification === "replaced-only" && subjectNormalized === "mixed-unmitigated") {
33848
- return cal.compositionMixedOutlierAmongReplacedStrength;
34046
+ if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 2 /* MixedUnmitigated */) {
34047
+ return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
33849
34048
  }
33850
- if (majorityClassification === "mixed-unmitigated" && subjectNormalized === "text-only") {
33851
- return cal.compositionTextOutlierAmongMixedStrength;
34049
+ if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 0 /* TextOnly */) {
34050
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
33852
34051
  }
33853
- if (majorityClassification === "mixed-unmitigated" && subjectNormalized === "replaced-only") {
33854
- return cal.compositionTextOutlierAmongMixedStrength;
34052
+ if (majorityClassification === 2 /* MixedUnmitigated */ && subjectNormalized === 1 /* ReplacedOnly */) {
34053
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
33855
34054
  }
33856
- if (majorityClassification === "text-only" && subjectNormalized === "replaced-only") {
33857
- return cal.compositionMixedOutlierAmongReplacedStrength;
34055
+ if (majorityClassification === 0 /* TextOnly */ && subjectNormalized === 1 /* ReplacedOnly */) {
34056
+ return { strength: cal.compositionMixedOutlierAmongReplacedStrength, majorityClassification };
33858
34057
  }
33859
- if (majorityClassification === "replaced-only" && subjectNormalized === "text-only") {
33860
- return cal.compositionTextOutlierAmongMixedStrength;
34058
+ if (majorityClassification === 1 /* ReplacedOnly */ && subjectNormalized === 0 /* TextOnly */) {
34059
+ return { strength: cal.compositionTextOutlierAmongMixedStrength, majorityClassification };
33861
34060
  }
33862
- if (majorityClassification === "unknown") {
33863
- return 0;
34061
+ if (majorityClassification === 5 /* Unknown */) {
34062
+ return { strength: 0, majorityClassification };
33864
34063
  }
33865
- return cal.compositionUnknownPenalty;
34064
+ return { strength: cal.compositionUnknownPenalty, majorityClassification };
33866
34065
  }
33867
34066
  function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints) {
33868
34067
  if (subjectFingerprint.inlineReplacedKind === null) return 0;
@@ -33883,28 +34082,9 @@ function resolveInlineReplacedKindDivergence(subjectFingerprint, allFingerprints
33883
34082
  function hasSharedBaselineAlignment(context) {
33884
34083
  return context.baselineRelevance === "relevant";
33885
34084
  }
33886
- function resolveMajorityClassification(allFingerprints) {
33887
- const countByClassification = /* @__PURE__ */ new Map();
33888
- for (let i = 0; i < allFingerprints.length; i++) {
33889
- const fp = allFingerprints[i];
33890
- if (!fp) continue;
33891
- const normalized = normalizeClassificationForComparison(fp.classification);
33892
- const existing = countByClassification.get(normalized) ?? 0;
33893
- countByClassification.set(normalized, existing + 1);
33894
- }
33895
- let majorityClassification = "unknown";
33896
- let majorityCount = 0;
33897
- for (const [classification, count] of countByClassification) {
33898
- if (count > majorityCount) {
33899
- majorityCount = count;
33900
- majorityClassification = classification;
33901
- }
33902
- }
33903
- return majorityClassification;
33904
- }
33905
34085
  function normalizeClassificationForComparison(classification) {
33906
- if (classification === "mixed-mitigated") return "text-only";
33907
- if (classification === "block-segmented") return "text-only";
34086
+ if (classification === 3 /* MixedMitigated */) return 0 /* TextOnly */;
34087
+ if (classification === 4 /* BlockSegmented */) return 0 /* TextOnly */;
33908
34088
  return classification;
33909
34089
  }
33910
34090
  function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
@@ -33912,12 +34092,12 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
33912
34092
  let analyzableCount = 0;
33913
34093
  for (let i = 0; i < allFingerprints.length; i++) {
33914
34094
  const fp = allFingerprints[i];
33915
- if (fp && fp.classification !== "unknown") {
34095
+ if (fp && fp.classification !== 5 /* Unknown */) {
33916
34096
  analyzableCount++;
33917
34097
  }
33918
34098
  }
33919
34099
  const analyzableShare = analyzableCount / allFingerprints.length;
33920
- if (subjectFingerprint.classification === "unknown") {
34100
+ if (subjectFingerprint.classification === 5 /* Unknown */) {
33921
34101
  return analyzableShare * 0.3;
33922
34102
  }
33923
34103
  if (subjectFingerprint.totalChildCount > 0 && subjectFingerprint.analyzableChildCount === 0) {
@@ -33925,24 +34105,19 @@ function resolveCompositionCoverage(subjectFingerprint, allFingerprints) {
33925
34105
  }
33926
34106
  return analyzableShare;
33927
34107
  }
34108
+ var COMPOSITION_LABELS = {
34109
+ [0 /* TextOnly */]: "text-only",
34110
+ [1 /* ReplacedOnly */]: "inline-replaced-only",
34111
+ [2 /* MixedUnmitigated */]: "mixed text + inline-replaced",
34112
+ [3 /* MixedMitigated */]: "mixed (alignment mitigated)",
34113
+ [4 /* BlockSegmented */]: "block-segmented",
34114
+ [5 /* Unknown */]: "unknown"
34115
+ };
33928
34116
  function formatCompositionClassification(classification) {
33929
- switch (classification) {
33930
- case "text-only":
33931
- return "text-only";
33932
- case "replaced-only":
33933
- return "inline-replaced-only";
33934
- case "mixed-unmitigated":
33935
- return "mixed text + inline-replaced";
33936
- case "mixed-mitigated":
33937
- return "mixed (alignment mitigated)";
33938
- case "block-segmented":
33939
- return "block-segmented";
33940
- case "unknown":
33941
- return "unknown";
33942
- }
34117
+ return COMPOSITION_LABELS[classification];
33943
34118
  }
33944
34119
  function formatCompositionFixSuggestion(subjectFingerprint) {
33945
- if (subjectFingerprint.classification === "mixed-unmitigated") {
34120
+ if (subjectFingerprint.classification === 2 /* MixedUnmitigated */) {
33946
34121
  if (subjectFingerprint.hasVerticalAlignMitigation) {
33947
34122
  return "verify vertical-align resolves the baseline shift";
33948
34123
  }
@@ -33977,12 +34152,12 @@ function estimateBlockOffsetWithDeclaredFromHotSignals(hot, axis) {
33977
34152
  function estimateBlockOffsetWithDeclaredFromSources(axis, position, readNumeric) {
33978
34153
  let declaredTotal = 0;
33979
34154
  let declaredCount = 0;
33980
- let declaredKind = "exact";
33981
- let declaredMissingKind = "exact";
34155
+ let declaredKind = 0 /* Exact */;
34156
+ let declaredMissingKind = 0 /* Exact */;
33982
34157
  let effectiveTotal = 0;
33983
34158
  let effectiveCount = 0;
33984
- let effectiveKind = "exact";
33985
- let effectiveMissingKind = "exact";
34159
+ let effectiveKind = 0 /* Exact */;
34160
+ let effectiveMissingKind = 0 /* Exact */;
33986
34161
  const positioned = position.value !== null && position.value !== "static";
33987
34162
  const add = (name, sign, requiresPositioning) => {
33988
34163
  const v = readNumeric(name);
@@ -34053,7 +34228,7 @@ function buildCohortIndex(input) {
34053
34228
  axisCertainty: context.axisCertainty,
34054
34229
  measurementNodeByRootKey: input.measurementNodeByRootKey,
34055
34230
  snapshotByElementNode: input.snapshotByElementNode,
34056
- snapshotHotSignalsByElementKey: input.snapshotHotSignalsByElementKey
34231
+ snapshotHotSignalsByNode: input.snapshotHotSignalsByNode
34057
34232
  });
34058
34233
  measurementIndexHits += cohortMetricsResult.measurementHits;
34059
34234
  const metrics = cohortMetricsResult.metrics;
@@ -34087,7 +34262,7 @@ function buildCohortIndex(input) {
34087
34262
  subjectMetrics.rootNode,
34088
34263
  input.childrenByParentNode,
34089
34264
  input.snapshotByElementNode,
34090
- input.snapshotHotSignalsByElementKey
34265
+ input.snapshotHotSignalsByNode
34091
34266
  );
34092
34267
  subjectsByElementKey.set(subjectMetrics.key, {
34093
34268
  element: subjectMetrics.element,
@@ -34153,7 +34328,7 @@ function collectCohortMetrics(input) {
34153
34328
  if (!snapshot) {
34154
34329
  throw new Error(`missing snapshot for measurement node ${measurementNode.key}`);
34155
34330
  }
34156
- const hotSignals = input.snapshotHotSignalsByElementKey.get(measurementNode.key);
34331
+ const hotSignals = input.snapshotHotSignalsByNode.get(measurementNode);
34157
34332
  if (!hotSignals) {
34158
34333
  throw new Error(`missing hot signals for measurement node ${measurementNode.key}`);
34159
34334
  }
@@ -34478,9 +34653,9 @@ function buildCohortSignalIndex(metrics) {
34478
34653
  const verticalAlignCounts = /* @__PURE__ */ new Map();
34479
34654
  const alignSelfCounts = /* @__PURE__ */ new Map();
34480
34655
  const placeSelfCounts = /* @__PURE__ */ new Map();
34481
- let verticalAlignMergedKind = "exact";
34482
- let alignSelfMergedKind = "exact";
34483
- let placeSelfMergedKind = "exact";
34656
+ let verticalAlignMergedKind = 0 /* Exact */;
34657
+ let alignSelfMergedKind = 0 /* Exact */;
34658
+ let placeSelfMergedKind = 0 /* Exact */;
34484
34659
  let verticalAlignComparableCount = 0;
34485
34660
  let alignSelfComparableCount = 0;
34486
34661
  let placeSelfComparableCount = 0;
@@ -34494,12 +34669,12 @@ function buildCohortSignalIndex(metrics) {
34494
34669
  const snapshot = metric.element.snapshot;
34495
34670
  const alignSelf = metric.hotSignals.alignSelf;
34496
34671
  const placeSelf = metric.hotSignals.placeSelf;
34497
- const isControlOrReplaced = snapshot.isControl || snapshot.isReplaced;
34672
+ const isControlOrReplaced = snapshot.node.isControl || snapshot.node.isReplaced;
34498
34673
  const verticalAlign = resolveComparableVerticalAlign(metric.hotSignals.verticalAlign, isControlOrReplaced);
34499
34674
  if (isControlOrReplaced) controlOrReplacedCount++;
34500
- if (snapshot.textualContent === "yes" || snapshot.textualContent === "dynamic-text") textYesCount++;
34501
- if (snapshot.textualContent === "no") textNoCount++;
34502
- if (snapshot.textualContent === "unknown") textUnknownCount++;
34675
+ if (snapshot.node.textualContent === 0 /* Yes */ || snapshot.node.textualContent === 3 /* DynamicText */) textYesCount++;
34676
+ if (snapshot.node.textualContent === 1 /* No */) textNoCount++;
34677
+ if (snapshot.node.textualContent === 2 /* Unknown */) textUnknownCount++;
34503
34678
  if (verticalAlign.value !== null) {
34504
34679
  verticalAlignMergedKind = mergeEvidenceKind(verticalAlignMergedKind, verticalAlign.kind);
34505
34680
  verticalAlignComparableCount++;
@@ -34519,24 +34694,24 @@ function buildCohortSignalIndex(metrics) {
34519
34694
  verticalAlign,
34520
34695
  alignSelf,
34521
34696
  placeSelf,
34522
- textualContent: snapshot.textualContent,
34697
+ textualContent: snapshot.node.textualContent,
34523
34698
  isControlOrReplaced
34524
34699
  });
34525
34700
  }
34526
34701
  return {
34527
34702
  byKey,
34528
34703
  verticalAlign: {
34529
- mergedKind: verticalAlignComparableCount === 0 ? "unknown" : verticalAlignMergedKind,
34704
+ mergedKind: verticalAlignComparableCount === 0 ? 3 /* Unknown */ : verticalAlignMergedKind,
34530
34705
  comparableCount: verticalAlignComparableCount,
34531
34706
  countsByValue: verticalAlignCounts
34532
34707
  },
34533
34708
  alignSelf: {
34534
- mergedKind: alignSelfComparableCount === 0 ? "unknown" : alignSelfMergedKind,
34709
+ mergedKind: alignSelfComparableCount === 0 ? 3 /* Unknown */ : alignSelfMergedKind,
34535
34710
  comparableCount: alignSelfComparableCount,
34536
34711
  countsByValue: alignSelfCounts
34537
34712
  },
34538
34713
  placeSelf: {
34539
- mergedKind: placeSelfComparableCount === 0 ? "unknown" : placeSelfMergedKind,
34714
+ mergedKind: placeSelfComparableCount === 0 ? 3 /* Unknown */ : placeSelfMergedKind,
34540
34715
  comparableCount: placeSelfComparableCount,
34541
34716
  countsByValue: placeSelfCounts
34542
34717
  },
@@ -34573,9 +34748,9 @@ function collectSubjectCohortSignals(index, subjectMetrics, context) {
34573
34748
  sawComparableVerticalAlign,
34574
34749
  sawVerticalAlignConflict
34575
34750
  );
34576
- const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === "unknown" && index.byKey.size > index.controlOrReplacedCount;
34751
+ const tableCellControlFallback = context.kind === "table-cell" && subject.isControlOrReplaced && verticalAlign.value === 2 /* Unknown */ && index.byKey.size > index.controlOrReplacedCount;
34577
34752
  const normalizedVerticalAlign = tableCellControlFallback ? {
34578
- value: "conflict",
34753
+ value: 0 /* Conflict */,
34579
34754
  kind: verticalAlignKind
34580
34755
  } : verticalAlign;
34581
34756
  const textContrastWithPeers = resolveIndexedTextContrastWithPeers(
@@ -34608,7 +34783,7 @@ function resolveComparableVerticalAlign(verticalAlign, isControlOrReplaced) {
34608
34783
  return {
34609
34784
  present: verticalAlign.present,
34610
34785
  value: "baseline",
34611
- kind: "exact"
34786
+ kind: 0 /* Exact */
34612
34787
  };
34613
34788
  }
34614
34789
  function hasComparablePeer(aggregate, subjectValue) {
@@ -34625,37 +34800,37 @@ function hasConflictPeer(aggregate, subjectValue) {
34625
34800
  function finalizeConflictEvidence(subjectValue, kind, sawComparablePeer, sawConflict) {
34626
34801
  if (subjectValue === null) {
34627
34802
  return {
34628
- value: "unknown",
34803
+ value: 2 /* Unknown */,
34629
34804
  kind
34630
34805
  };
34631
34806
  }
34632
34807
  if (!sawComparablePeer) {
34633
34808
  return {
34634
- value: "unknown",
34809
+ value: 2 /* Unknown */,
34635
34810
  kind
34636
34811
  };
34637
34812
  }
34638
34813
  return {
34639
- value: sawConflict ? "conflict" : "aligned",
34814
+ value: sawConflict ? 0 /* Conflict */ : 1 /* Aligned */,
34640
34815
  kind
34641
34816
  };
34642
34817
  }
34643
34818
  function resolveIndexedTextContrastWithPeers(index, subjectTextualContent, subjectIsControlOrReplaced, tableCellControlFallback) {
34644
- if (subjectTextualContent === "unknown") return "unknown";
34819
+ if (subjectTextualContent === 2 /* Unknown */) return 2 /* Unknown */;
34645
34820
  const unknownPeers = index.textUnknownCount;
34646
34821
  const cohortSize = index.byKey.size;
34647
- if (subjectTextualContent === "yes" || subjectTextualContent === "dynamic-text") {
34648
- if (index.textNoCount > 0) return "different";
34649
- if (unknownPeers > 0) return "unknown";
34650
- return "same";
34822
+ if (subjectTextualContent === 0 /* Yes */ || subjectTextualContent === 3 /* DynamicText */) {
34823
+ if (index.textNoCount > 0) return 0 /* Different */;
34824
+ if (unknownPeers > 0) return 2 /* Unknown */;
34825
+ return 1 /* Same */;
34651
34826
  }
34652
- if (index.textYesCount > 0) return "different";
34653
- if (tableCellControlFallback) return "different";
34827
+ if (index.textYesCount > 0) return 0 /* Different */;
34828
+ if (tableCellControlFallback) return 0 /* Different */;
34654
34829
  if (subjectIsControlOrReplaced && index.controlOrReplacedCount === 1 && cohortSize >= 3 && unknownPeers > 0) {
34655
- return "different";
34830
+ return 0 /* Different */;
34656
34831
  }
34657
- if (unknownPeers > 0) return "unknown";
34658
- return "same";
34832
+ if (unknownPeers > 0) return 2 /* Unknown */;
34833
+ return 1 /* Same */;
34659
34834
  }
34660
34835
  function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineProfile, clusterSummary, signalIndex, cohortKind, cohortSize) {
34661
34836
  const subjectClusterKey = toComparableClusterKey(subjectMetrics);
@@ -34671,7 +34846,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34671
34846
  return {
34672
34847
  dominantShare: profile.dominantClusterShare,
34673
34848
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34674
- subjectMembership: "insufficient",
34849
+ subjectMembership: 3 /* Insufficient */,
34675
34850
  ambiguous: true,
34676
34851
  kind
34677
34852
  };
@@ -34680,7 +34855,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34680
34855
  return {
34681
34856
  dominantShare: profile.dominantClusterShare,
34682
34857
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34683
- subjectMembership: "dominant",
34858
+ subjectMembership: 0 /* Dominant */,
34684
34859
  ambiguous: false,
34685
34860
  kind
34686
34861
  };
@@ -34689,7 +34864,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34689
34864
  return {
34690
34865
  dominantShare: profile.dominantClusterShare,
34691
34866
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34692
- subjectMembership: "insufficient",
34867
+ subjectMembership: 3 /* Insufficient */,
34693
34868
  ambiguous: true,
34694
34869
  kind
34695
34870
  };
@@ -34699,7 +34874,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34699
34874
  return {
34700
34875
  dominantShare: profile.dominantClusterShare,
34701
34876
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34702
- subjectMembership: "insufficient",
34877
+ subjectMembership: 3 /* Insufficient */,
34703
34878
  ambiguous: true,
34704
34879
  kind
34705
34880
  };
@@ -34709,7 +34884,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34709
34884
  return {
34710
34885
  dominantShare: profile.dominantClusterShare,
34711
34886
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34712
- subjectMembership: "ambiguous",
34887
+ subjectMembership: 2 /* Ambiguous */,
34713
34888
  ambiguous: true,
34714
34889
  kind
34715
34890
  };
@@ -34718,7 +34893,7 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34718
34893
  return {
34719
34894
  dominantShare: profile.dominantClusterShare,
34720
34895
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34721
- subjectMembership: "dominant",
34896
+ subjectMembership: 0 /* Dominant */,
34722
34897
  ambiguous: false,
34723
34898
  kind
34724
34899
  };
@@ -34726,13 +34901,13 @@ function resolveSubjectIdentifiability(subjectMetrics, profile, subjectBaselineP
34726
34901
  return {
34727
34902
  dominantShare: profile.dominantClusterShare,
34728
34903
  subjectExcludedDominantShare: subjectBaselineProfile.dominantClusterShare,
34729
- subjectMembership: "nondominant",
34904
+ subjectMembership: 1 /* Nondominant */,
34730
34905
  ambiguous: false,
34731
34906
  kind
34732
34907
  };
34733
34908
  }
34734
34909
  function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, cohortSize) {
34735
- const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.isControl || subjectMetrics.element.snapshot.isReplaced;
34910
+ const subjectIsControlOrReplaced = subjectMetrics.element.snapshot.node.isControl || subjectMetrics.element.snapshot.node.isReplaced;
34736
34911
  const controlCount = signalIndex.controlOrReplacedCount;
34737
34912
  const nonControlCount = cohortSize - controlCount;
34738
34913
  if (controlCount <= 0 || nonControlCount <= 0) return null;
@@ -34747,12 +34922,12 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
34747
34922
  return {
34748
34923
  dominantShare,
34749
34924
  subjectExcludedDominantShare: excludedDominantShare,
34750
- subjectMembership: subjectMembership === "ambiguous" ? "dominant" : subjectMembership,
34925
+ subjectMembership: subjectMembership === 2 /* Ambiguous */ ? 0 /* Dominant */ : subjectMembership,
34751
34926
  ambiguous: false,
34752
34927
  kind
34753
34928
  };
34754
34929
  }
34755
- if (subjectMembership === "ambiguous") {
34930
+ if (subjectMembership === 2 /* Ambiguous */) {
34756
34931
  return {
34757
34932
  dominantShare,
34758
34933
  subjectExcludedDominantShare: excludedDominantShare,
@@ -34770,9 +34945,9 @@ function resolveControlRoleIdentifiability(subjectMetrics, signalIndex, kind, co
34770
34945
  };
34771
34946
  }
34772
34947
  function resolveRoleMembership(controlCount, nonControlCount, subjectIsControlOrReplaced) {
34773
- if (controlCount === nonControlCount) return "ambiguous";
34948
+ if (controlCount === nonControlCount) return 2 /* Ambiguous */;
34774
34949
  const dominantRoleIsControl = controlCount > nonControlCount;
34775
- return dominantRoleIsControl === subjectIsControlOrReplaced ? "dominant" : "nondominant";
34950
+ return dominantRoleIsControl === subjectIsControlOrReplaced ? 0 /* Dominant */ : 1 /* Nondominant */;
34776
34951
  }
34777
34952
  function resolveExcludedRoleDominantShare(controlCount, nonControlCount, subjectIsControlOrReplaced) {
34778
34953
  const controlAfterExclusion = controlCount - (subjectIsControlOrReplaced ? 1 : 0);
@@ -34810,8 +34985,8 @@ function collectCohortProvenanceFromSnapshots(snapshots) {
34810
34985
  const snapshot = snapshots[i];
34811
34986
  if (!snapshot) continue;
34812
34987
  for (const signal of snapshot.signals.values()) {
34813
- for (let j = 0; j < signal.guardProvenance.conditions.length; j++) {
34814
- const guard = signal.guardProvenance.conditions[j];
34988
+ for (let j = 0; j < signal.guard.conditions.length; j++) {
34989
+ const guard = signal.guard.conditions[j];
34815
34990
  if (!guard) continue;
34816
34991
  if (!byKey.has(guard.key)) byKey.set(guard.key, guard);
34817
34992
  }
@@ -34841,7 +35016,7 @@ function buildGuardKey(guards) {
34841
35016
  return keys.join("&");
34842
35017
  }
34843
35018
  function resolveCohortEvidenceKind(metrics) {
34844
- let kind = "exact";
35019
+ let kind = 0 /* Exact */;
34845
35020
  for (let i = 0; i < metrics.length; i++) {
34846
35021
  const metric = metrics[i];
34847
35022
  if (!metric) continue;
@@ -34858,9 +35033,9 @@ function incrementCount(counts, key) {
34858
35033
  counts.set(key, existing + 1);
34859
35034
  }
34860
35035
  function toEvidenceKind2(certainty) {
34861
- if (certainty === "resolved") return "exact";
34862
- if (certainty === "conditional") return "conditional";
34863
- return "unknown";
35036
+ if (certainty === 0 /* Resolved */) return 0 /* Exact */;
35037
+ if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
35038
+ return 3 /* Unknown */;
34864
35039
  }
34865
35040
  function computeMedian(values) {
34866
35041
  if (values.length === 0) return null;
@@ -34880,66 +35055,6 @@ function computeMedianAbsoluteDeviation(values, median, scratch) {
34880
35055
  }
34881
35056
  return computeMedian(scratch);
34882
35057
  }
34883
- function selectKth(values, targetIndex) {
34884
- let left = 0;
34885
- let right = values.length - 1;
34886
- while (left <= right) {
34887
- if (left === right) {
34888
- const result = values[left];
34889
- if (result === void 0) return 0;
34890
- return result;
34891
- }
34892
- const pivotIndex = choosePivotIndex(values, left, right);
34893
- const partitionIndex = partitionAroundPivot(values, left, right, pivotIndex);
34894
- if (partitionIndex === targetIndex) {
34895
- const result = values[partitionIndex];
34896
- if (result === void 0) return 0;
34897
- return result;
34898
- }
34899
- if (partitionIndex < targetIndex) {
34900
- left = partitionIndex + 1;
34901
- continue;
34902
- }
34903
- right = partitionIndex - 1;
34904
- }
34905
- const fallback = values[targetIndex];
34906
- if (fallback === void 0) return 0;
34907
- return fallback;
34908
- }
34909
- function choosePivotIndex(values, left, right) {
34910
- const middle = Math.floor((left + right) / 2);
34911
- const leftValue = values[left] ?? 0;
34912
- const middleValue = values[middle] ?? 0;
34913
- const rightValue = values[right] ?? 0;
34914
- if (leftValue < middleValue) {
34915
- if (middleValue < rightValue) return middle;
34916
- if (leftValue < rightValue) return right;
34917
- return left;
34918
- }
34919
- if (leftValue < rightValue) return left;
34920
- if (middleValue < rightValue) return right;
34921
- return middle;
34922
- }
34923
- function partitionAroundPivot(values, left, right, pivotIndex) {
34924
- const pivotValue = values[pivotIndex] ?? 0;
34925
- swap(values, pivotIndex, right);
34926
- let storeIndex = left;
34927
- for (let i = left; i < right; i++) {
34928
- const current = values[i];
34929
- if (current === void 0 || current > pivotValue) continue;
34930
- swap(values, storeIndex, i);
34931
- storeIndex++;
34932
- }
34933
- swap(values, storeIndex, right);
34934
- return storeIndex;
34935
- }
34936
- function swap(values, left, right) {
34937
- if (left === right) return;
34938
- const leftValue = values[left] ?? 0;
34939
- const rightValue = values[right] ?? 0;
34940
- values[left] = rightValue;
34941
- values[right] = leftValue;
34942
- }
34943
35058
  function resolveVerticalAlignConsensus(aggregate) {
34944
35059
  if (aggregate.comparableCount === 0) return null;
34945
35060
  if (aggregate.countsByValue.size !== 1) return null;
@@ -35038,7 +35153,7 @@ function resolveMeasurementCandidates(root, childrenByParentNode, snapshotByElem
35038
35153
  if (firstControlOrReplacedDescendant === null && (child.isControl || child.isReplaced)) {
35039
35154
  firstControlOrReplacedDescendant = child;
35040
35155
  }
35041
- if (firstTextualDescendant === null && child.textualContent === "yes") {
35156
+ if (firstTextualDescendant === null && child.textualContent === 0 /* Yes */) {
35042
35157
  firstTextualDescendant = child;
35043
35158
  }
35044
35159
  if (firstControlOrReplacedDescendant !== null && firstTextualDescendant !== null) break;
@@ -35064,7 +35179,7 @@ function resolveMeasurementNode(root, candidates) {
35064
35179
  if (candidates.firstControlOrReplacedDescendant !== null) return candidates.firstControlOrReplacedDescendant;
35065
35180
  if (root.isControl || root.isReplaced) return root;
35066
35181
  if (candidates.firstTextualDescendant !== null) return candidates.firstTextualDescendant;
35067
- if (root.textualContent === "yes") return root;
35182
+ if (root.textualContent === 0 /* Yes */) return root;
35068
35183
  return root;
35069
35184
  }
35070
35185
 
@@ -35111,7 +35226,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
35111
35226
  seenSelectorIds.add(selector.id);
35112
35227
  const metadata = selectorMetadataById.get(selector.id);
35113
35228
  if (!metadata) continue;
35114
- if (metadata.guard.kind === "conditional") {
35229
+ if (metadata.guard.kind === 1 /* Conditional */) {
35115
35230
  if (!conditionalSelectorIds.has(selector.id)) {
35116
35231
  conditionalSelectorIds.add(selector.id);
35117
35232
  perf.selectorsGuardedConditional++;
@@ -35153,7 +35268,7 @@ function buildScopedSelectorIndexBySolidFile(cssScopeBySolidFile, css, selectorM
35153
35268
  }
35154
35269
  return out;
35155
35270
  }
35156
- function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFile, perf) {
35271
+ function buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf) {
35157
35272
  const out = /* @__PURE__ */ new Map();
35158
35273
  for (let i = 0; i < elements.length; i++) {
35159
35274
  const node = elements[i];
@@ -35163,7 +35278,7 @@ function buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFil
35163
35278
  const byTag = node.tagName !== null ? collectSelectorCandidates(scoped.bySubjectTag.get(node.tagName), node.selectorDispatchKeys) : EMPTY_SELECTOR_LIST;
35164
35279
  const withoutTag = collectSelectorCandidates(scoped.withoutSubjectTag, node.selectorDispatchKeys);
35165
35280
  const merged = mergeSelectorCandidateIds(byTag, withoutTag);
35166
- out.set(node.key, merged);
35281
+ out.set(node, merged);
35167
35282
  perf.elementsScanned++;
35168
35283
  perf.selectorCandidatesChecked += merged.length;
35169
35284
  }
@@ -35622,12 +35737,6 @@ var EMPTY_EXPANSION_RESULT = [];
35622
35737
  function collectMonitoredDeclarations(selector, layerOrder, guard) {
35623
35738
  const out = [];
35624
35739
  const declarations = selector.rule.declarations;
35625
- const signalGuard = guard.kind === "conditional" ? "conditional" : "unconditional";
35626
- const guardProvenance = {
35627
- kind: signalGuard,
35628
- conditions: guard.conditions,
35629
- key: guard.key
35630
- };
35631
35740
  for (let i = 0; i < declarations.length; i++) {
35632
35741
  const declaration = declarations[i];
35633
35742
  if (!declaration) continue;
@@ -35638,8 +35747,7 @@ function collectMonitoredDeclarations(selector, layerOrder, guard) {
35638
35747
  out.push({
35639
35748
  property: monitored,
35640
35749
  value: declaration.value,
35641
- guard: signalGuard,
35642
- guardProvenance,
35750
+ guardProvenance: guard,
35643
35751
  position: {
35644
35752
  layer: declaration.cascadePosition.layer,
35645
35753
  layerOrder,
@@ -35661,6 +35769,7 @@ function toMonitoredSignalKey(property) {
35661
35769
  case "margin-block":
35662
35770
  case "padding-block":
35663
35771
  case "inset-block":
35772
+ case "flex-flow":
35664
35773
  return property;
35665
35774
  default:
35666
35775
  return null;
@@ -35684,30 +35793,27 @@ function expandMonitoredDeclarationForDelta(declaration) {
35684
35793
  if (signalName === void 0) return EMPTY_EXPANSION_RESULT;
35685
35794
  return [{ name: signalName, value: value2 }];
35686
35795
  }
35687
- function appendMatchingEdgesFromSelectorIds(selectorIds, node, selectorMetadataById, selectorsById, applies, appliesByElementNodeMutable, perf, rootElementsByFile, logger) {
35688
- const fileRoots = rootElementsByFile.get(node.solidFile) ?? null;
35796
+ function appendMatchingEdgesFromSelectorIds(ctx, selectorIds, node, applies, appliesByElementNodeMutable) {
35797
+ const fileRoots = ctx.rootElementsByFile.get(node.solidFile) ?? null;
35689
35798
  for (let i = 0; i < selectorIds.length; i++) {
35690
35799
  const selectorId = selectorIds[i];
35691
35800
  if (selectorId === void 0) continue;
35692
- const metadata = selectorMetadataById.get(selectorId);
35801
+ const metadata = ctx.selectorMetadataById.get(selectorId);
35693
35802
  if (!metadata || !metadata.matcher) {
35694
35803
  throw new Error(`missing compiled selector matcher for selector ${selectorId}`);
35695
35804
  }
35696
- const selector = selectorsById.get(selectorId);
35805
+ const selector = ctx.selectorsById.get(selectorId);
35697
35806
  if (!selector) {
35698
35807
  throw new Error(`missing selector ${selectorId}`);
35699
35808
  }
35700
- if (!selectorMatchesLayoutElement(metadata.matcher, node, perf, fileRoots, logger)) continue;
35809
+ if (!selectorMatchesLayoutElement(metadata.matcher, node, ctx.perf, fileRoots, ctx.logger)) continue;
35701
35810
  const edge = {
35702
- solidFile: node.solidFile,
35703
- elementId: node.elementId,
35704
- elementKey: node.key,
35705
35811
  selectorId: selector.id,
35706
35812
  specificityScore: selector.specificityScore,
35707
35813
  sourceOrder: selector.rule.sourceOrder
35708
35814
  };
35709
35815
  applies.push(edge);
35710
- perf.matchEdgesCreated++;
35816
+ ctx.perf.matchEdgesCreated++;
35711
35817
  const existing = appliesByElementNodeMutable.get(node);
35712
35818
  if (existing) {
35713
35819
  existing.push(edge);
@@ -35733,7 +35839,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
35733
35839
  const classTokens = node.classTokens;
35734
35840
  if (classTokens.length === 0) return;
35735
35841
  const guardProvenance = {
35736
- kind: "unconditional",
35842
+ kind: 0 /* Unconditional */,
35737
35843
  conditions: [],
35738
35844
  key: "always"
35739
35845
  };
@@ -35750,8 +35856,7 @@ function augmentCascadeWithTailwind(cascade, node, tailwind) {
35750
35856
  if (cascade.has(property)) continue;
35751
35857
  cascade.set(property, {
35752
35858
  value: value2,
35753
- source: "selector",
35754
- guard: "unconditional",
35859
+ source: 0 /* Selector */,
35755
35860
  guardProvenance
35756
35861
  });
35757
35862
  }
@@ -35771,8 +35876,7 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
35771
35876
  const property = declaration.property;
35772
35877
  const newDeclaration = {
35773
35878
  value: declaration.value,
35774
- source: "selector",
35775
- guard: declaration.guard,
35879
+ source: 0 /* Selector */,
35776
35880
  guardProvenance: declaration.guardProvenance
35777
35881
  };
35778
35882
  const existingPosition = positions.get(property);
@@ -35791,33 +35895,26 @@ function buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorI
35791
35895
  positions.set(property, declaration.position);
35792
35896
  }
35793
35897
  }
35794
- const inlinePosition = createInlineCascadePosition();
35795
- const inlineGuardProvenance = {
35796
- kind: "unconditional",
35797
- conditions: [],
35798
- key: "always"
35799
- };
35800
35898
  for (const [property, value2] of node.inlineStyleValues) {
35801
35899
  const newDeclaration = {
35802
35900
  value: value2,
35803
- source: "inline-style",
35804
- guard: "unconditional",
35805
- guardProvenance: inlineGuardProvenance
35901
+ source: 1 /* InlineStyle */,
35902
+ guardProvenance: INLINE_GUARD_PROVENANCE
35806
35903
  };
35807
35904
  const existingPosition = positions.get(property);
35808
35905
  if (existingPosition === void 0) {
35809
35906
  out.set(property, newDeclaration);
35810
- positions.set(property, inlinePosition);
35907
+ positions.set(property, INLINE_CASCADE_POSITION);
35811
35908
  continue;
35812
35909
  }
35813
35910
  const existingDeclaration = out.get(property);
35814
35911
  if (existingDeclaration === void 0) continue;
35815
35912
  if (!doesCandidateOverride(
35816
35913
  { declaration: existingDeclaration, position: existingPosition },
35817
- { declaration: newDeclaration, position: inlinePosition }
35914
+ { declaration: newDeclaration, position: INLINE_CASCADE_POSITION }
35818
35915
  )) continue;
35819
35916
  out.set(property, newDeclaration);
35820
- positions.set(property, inlinePosition);
35917
+ positions.set(property, INLINE_CASCADE_POSITION);
35821
35918
  }
35822
35919
  if (tailwind !== null) {
35823
35920
  augmentCascadeWithTailwind(out, node, tailwind);
@@ -35834,7 +35931,7 @@ function doesCandidateOverride(existing, incoming) {
35834
35931
  const existingSource = existing.declaration.source;
35835
35932
  const incomingSource = incoming.declaration.source;
35836
35933
  if (existingSource !== incomingSource) {
35837
- if (incomingSource === "inline-style") {
35934
+ if (incomingSource === 1 /* InlineStyle */) {
35838
35935
  if (existing.position.isImportant && !incoming.position.isImportant) return false;
35839
35936
  return true;
35840
35937
  }
@@ -35842,16 +35939,19 @@ function doesCandidateOverride(existing, incoming) {
35842
35939
  }
35843
35940
  return compareCascadePositions(incoming.position, existing.position) > 0;
35844
35941
  }
35845
- function createInlineCascadePosition() {
35846
- return {
35847
- layer: null,
35848
- layerOrder: Number.MAX_SAFE_INTEGER,
35849
- sourceOrder: Number.MAX_SAFE_INTEGER,
35850
- specificity: [1, 0, 0, 0],
35851
- specificityScore: Number.MAX_SAFE_INTEGER,
35852
- isImportant: false
35853
- };
35854
- }
35942
+ var INLINE_CASCADE_POSITION = Object.freeze({
35943
+ layer: null,
35944
+ layerOrder: Number.MAX_SAFE_INTEGER,
35945
+ sourceOrder: Number.MAX_SAFE_INTEGER,
35946
+ specificity: [1, 0, 0, 0],
35947
+ specificityScore: Number.MAX_SAFE_INTEGER,
35948
+ isImportant: false
35949
+ });
35950
+ var INLINE_GUARD_PROVENANCE = Object.freeze({
35951
+ kind: 0 /* Unconditional */,
35952
+ conditions: [],
35953
+ key: "always"
35954
+ });
35855
35955
  function resolveRuleLayerOrder(rule, css) {
35856
35956
  const layer = rule.containingLayer;
35857
35957
  if (!layer) return 0;
@@ -35859,14 +35959,14 @@ function resolveRuleLayerOrder(rule, css) {
35859
35959
  if (!name) return 0;
35860
35960
  return css.layerOrder.get(name) ?? 0;
35861
35961
  }
35862
- function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDeclarationsBySelectorId) {
35863
- const conditionalSignalDeltaFactsByElementKey = /* @__PURE__ */ new Map();
35962
+ function buildConditionalDeltaIndex(elements, appliesByNode, monitoredDeclarationsBySelectorId) {
35963
+ const conditionalSignalDeltaFactsByNode = /* @__PURE__ */ new Map();
35864
35964
  const elementsWithConditionalDeltaBySignal = /* @__PURE__ */ new Map();
35865
- const baselineOffsetFactsByElementKey = /* @__PURE__ */ new Map();
35965
+ const baselineOffsetFactsByNode = /* @__PURE__ */ new Map();
35866
35966
  for (let i = 0; i < elements.length; i++) {
35867
35967
  const node = elements[i];
35868
35968
  if (!node) continue;
35869
- const edges = appliesByElementKey.get(node.key);
35969
+ const edges = appliesByNode.get(node);
35870
35970
  let factByProperty = null;
35871
35971
  if (edges !== void 0 && edges.length > 0) {
35872
35972
  const byProperty = /* @__PURE__ */ new Map();
@@ -35891,7 +35991,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
35891
35991
  };
35892
35992
  byProperty.set(property, bucket);
35893
35993
  }
35894
- if (declaration.guard === "conditional") {
35994
+ if (declaration.guardProvenance.kind === 1 /* Conditional */) {
35895
35995
  bucket.conditional.add(expandedEntry.value);
35896
35996
  continue;
35897
35997
  }
@@ -35931,7 +36031,7 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
35931
36031
  }
35932
36032
  if (facts.size > 0) {
35933
36033
  factByProperty = facts;
35934
- conditionalSignalDeltaFactsByElementKey.set(node.key, facts);
36034
+ conditionalSignalDeltaFactsByNode.set(node, facts);
35935
36035
  for (const [signal, fact] of facts) {
35936
36036
  if (!fact.hasConditional) continue;
35937
36037
  const existing = elementsWithConditionalDeltaBySignal.get(signal);
@@ -35968,13 +36068,13 @@ function buildConditionalDeltaIndex(elements, appliesByElementKey, monitoredDecl
35968
36068
  baselineBySignal.set(signal, [...values]);
35969
36069
  }
35970
36070
  if (baselineBySignal.size > 0) {
35971
- baselineOffsetFactsByElementKey.set(node.key, baselineBySignal);
36071
+ baselineOffsetFactsByNode.set(node, baselineBySignal);
35972
36072
  }
35973
36073
  }
35974
36074
  return {
35975
- conditionalSignalDeltaFactsByElementKey,
36075
+ conditionalSignalDeltaFactsByNode,
35976
36076
  elementsWithConditionalDeltaBySignal,
35977
- baselineOffsetFactsByElementKey
36077
+ baselineOffsetFactsByNode
35978
36078
  };
35979
36079
  }
35980
36080
  var EMPTY_NODE_LIST2 = [];
@@ -36101,8 +36201,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36101
36201
  if (child.kind === "expression") {
36102
36202
  if (isStructuralExpression(child.node)) {
36103
36203
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (structural expression child)`);
36104
- memo.set(element.id, "unknown");
36105
- return "unknown";
36204
+ memo.set(element.id, 2 /* Unknown */);
36205
+ return 2 /* Unknown */;
36106
36206
  }
36107
36207
  hasTextOnlyExpression = true;
36108
36208
  continue;
@@ -36110,8 +36210,8 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36110
36210
  if (child.kind !== "text") continue;
36111
36211
  if (child.node.type !== "JSXText") continue;
36112
36212
  if (isBlank(child.node.value)) continue;
36113
- memo.set(element.id, "yes");
36114
- return "yes";
36213
+ memo.set(element.id, 0 /* Yes */);
36214
+ return 0 /* Yes */;
36115
36215
  }
36116
36216
  let childHasUnknown = false;
36117
36217
  let childHasDynamicText = false;
@@ -36125,31 +36225,31 @@ function getTextualContentState(element, memo, compositionMetaByElementId, logge
36125
36225
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag}#${child.id} resolves to control tag=${childMeta.tagName}, skipping`);
36126
36226
  continue;
36127
36227
  }
36128
- if (childState !== "no") {
36228
+ if (childState !== 1 /* No */) {
36129
36229
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id}: non-DOM child ${child.tag ?? child.id}#${child.id} has state=${childState} \u2192 childHasUnknown`);
36130
36230
  childHasUnknown = true;
36131
36231
  }
36132
36232
  continue;
36133
36233
  }
36134
- if (childState === "yes") {
36135
- memo.set(element.id, "yes");
36136
- return "yes";
36234
+ if (childState === 0 /* Yes */) {
36235
+ memo.set(element.id, 0 /* Yes */);
36236
+ return 0 /* Yes */;
36137
36237
  }
36138
- if (childState === "unknown") childHasUnknown = true;
36139
- if (childState === "dynamic-text") childHasDynamicText = true;
36238
+ if (childState === 2 /* Unknown */) childHasUnknown = true;
36239
+ if (childState === 3 /* DynamicText */) childHasDynamicText = true;
36140
36240
  }
36141
36241
  if (childHasUnknown) {
36142
36242
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 unknown (child has unknown)`);
36143
- memo.set(element.id, "unknown");
36144
- return "unknown";
36243
+ memo.set(element.id, 2 /* Unknown */);
36244
+ return 2 /* Unknown */;
36145
36245
  }
36146
36246
  if (hasTextOnlyExpression || childHasDynamicText) {
36147
36247
  if (logger.enabled) logger.trace(`[textual-content] element=${element.tagName ?? element.tag}#${element.id} \u2192 dynamic-text`);
36148
- memo.set(element.id, "dynamic-text");
36149
- return "dynamic-text";
36248
+ memo.set(element.id, 3 /* DynamicText */);
36249
+ return 3 /* DynamicText */;
36150
36250
  }
36151
- memo.set(element.id, "no");
36152
- return "no";
36251
+ memo.set(element.id, 1 /* No */);
36252
+ return 1 /* No */;
36153
36253
  }
36154
36254
  function isStructuralExpression(node) {
36155
36255
  if (node.type !== "JSXExpressionContainer") return false;
@@ -36448,8 +36548,6 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36448
36548
  classTokens: record.classTokens,
36449
36549
  classTokenSet: record.classTokenSet,
36450
36550
  inlineStyleKeys: record.inlineStyleKeys,
36451
- parentElementId,
36452
- parentElementKey: parentNode ? parentNode.key : parentElementId === null ? null : toLayoutElementKey(solid.file, parentElementId),
36453
36551
  parentElementNode: parentNode,
36454
36552
  previousSiblingNode,
36455
36553
  siblingIndex,
@@ -36490,22 +36588,25 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36490
36588
  logger.debug(`[build] rootElementsByFile file=${file} count=${roots.length}: ${descs.join(", ")}`);
36491
36589
  }
36492
36590
  }
36493
- const selectorCandidatesByElementKey = buildSelectorCandidatesByElementKey(elements, scopedSelectorsBySolidFile, perf);
36591
+ const selectorCandidatesByNode = buildSelectorCandidatesByNode(elements, scopedSelectorsBySolidFile, perf);
36592
+ const selectorMatchCtx = {
36593
+ selectorMetadataById,
36594
+ selectorsById,
36595
+ rootElementsByFile,
36596
+ perf,
36597
+ logger
36598
+ };
36494
36599
  for (let i = 0; i < elements.length; i++) {
36495
36600
  const node = elements[i];
36496
36601
  if (!node) continue;
36497
- const selectorIds = selectorCandidatesByElementKey.get(node.key) ?? EMPTY_NUMBER_LIST2;
36602
+ const selectorIds = selectorCandidatesByNode.get(node) ?? EMPTY_NUMBER_LIST2;
36498
36603
  if (selectorIds.length === 0) continue;
36499
36604
  appendMatchingEdgesFromSelectorIds(
36605
+ selectorMatchCtx,
36500
36606
  selectorIds,
36501
36607
  node,
36502
- selectorMetadataById,
36503
- selectorsById,
36504
36608
  applies,
36505
- appliesByElementNodeMutable,
36506
- perf,
36507
- rootElementsByFile,
36508
- logger
36609
+ appliesByElementNodeMutable
36509
36610
  );
36510
36611
  }
36511
36612
  perf.selectorMatchMs = performance.now() - selectorMatchStartedAt;
@@ -36513,7 +36614,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36513
36614
  for (const edges of appliesByElementNodeMutable.values()) {
36514
36615
  edges.sort(compareLayoutEdge);
36515
36616
  }
36516
- const appliesByElementKey = /* @__PURE__ */ new Map();
36617
+ const appliesByNode = /* @__PURE__ */ new Map();
36517
36618
  const tailwind = css.tailwind;
36518
36619
  for (let i = 0; i < elements.length; i++) {
36519
36620
  const node = elements[i];
@@ -36521,7 +36622,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36521
36622
  const edges = appliesByElementNodeMutable.get(node) ?? [];
36522
36623
  const cascade = buildCascadeMapForElement(node, edges, monitoredDeclarationsBySelectorId, tailwind);
36523
36624
  cascadeByElementNode.set(node, cascade);
36524
- appliesByElementKey.set(node.key, edges);
36625
+ appliesByNode.set(node, edges);
36525
36626
  }
36526
36627
  perf.cascadeBuildMs = performance.now() - cascadeStartedAt;
36527
36628
  const snapshotByElementNode = buildSignalSnapshotIndex(elements, cascadeByElementNode, perf);
@@ -36529,7 +36630,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36529
36630
  const factIndex = buildElementFactIndex(elements, snapshotByElementNode);
36530
36631
  const conditionalDeltaIndex = buildConditionalDeltaIndex(
36531
36632
  elements,
36532
- appliesByElementKey,
36633
+ appliesByNode,
36533
36634
  monitoredDeclarationsBySelectorId
36534
36635
  );
36535
36636
  const elementsWithConditionalOverflowDelta = buildConditionalDeltaSignalGroupElements(
@@ -36547,7 +36648,7 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36547
36648
  contextByParentNode,
36548
36649
  measurementNodeByRootKey,
36549
36650
  snapshotByElementNode,
36550
- snapshotHotSignalsByElementKey: factIndex.snapshotHotSignalsByElementKey
36651
+ snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode
36551
36652
  });
36552
36653
  finalizeTableCellBaselineRelevance(contextByParentNode, cohortIndex.verticalAlignConsensusByParent);
36553
36654
  perf.conditionalSignals = cohortIndex.conditionalSignals;
@@ -36563,11 +36664,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36563
36664
  childrenByParentNode: childrenByParentNodeMutable,
36564
36665
  elementBySolidFileAndId: elementBySolidFileAndIdMutable,
36565
36666
  elementRefsBySolidFileAndId: elementRefsBySolidFileAndIdMutable,
36566
- appliesByElementKey,
36567
- selectorCandidatesByElementKey,
36667
+ appliesByNode,
36668
+ selectorCandidatesByNode,
36568
36669
  selectorsById,
36569
36670
  measurementNodeByRootKey,
36570
- snapshotHotSignalsByElementKey: factIndex.snapshotHotSignalsByElementKey,
36671
+ snapshotHotSignalsByNode: factIndex.snapshotHotSignalsByNode,
36571
36672
  elementsByTagName: factIndex.elementsByTagName,
36572
36673
  elementsWithConditionalDeltaBySignal: conditionalDeltaIndex.elementsWithConditionalDeltaBySignal,
36573
36674
  elementsWithConditionalOverflowDelta,
@@ -36575,12 +36676,12 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36575
36676
  elementsByKnownSignalValue: factIndex.elementsByKnownSignalValue,
36576
36677
  dynamicSlotCandidateElements: factIndex.dynamicSlotCandidateElements,
36577
36678
  scrollContainerElements: factIndex.scrollContainerElements,
36578
- reservedSpaceFactsByElementKey: factIndex.reservedSpaceFactsByElementKey,
36579
- scrollContainerFactsByElementKey: factIndex.scrollContainerFactsByElementKey,
36580
- flowParticipationFactsByElementKey: factIndex.flowParticipationFactsByElementKey,
36581
- containingBlockFactsByElementKey: factIndex.containingBlockFactsByElementKey,
36582
- conditionalSignalDeltaFactsByElementKey: conditionalDeltaIndex.conditionalSignalDeltaFactsByElementKey,
36583
- baselineOffsetFactsByElementKey: conditionalDeltaIndex.baselineOffsetFactsByElementKey,
36679
+ reservedSpaceFactsByNode: factIndex.reservedSpaceFactsByNode,
36680
+ scrollContainerFactsByNode: factIndex.scrollContainerFactsByNode,
36681
+ flowParticipationFactsByNode: factIndex.flowParticipationFactsByNode,
36682
+ containingBlockFactsByNode: factIndex.containingBlockFactsByNode,
36683
+ conditionalSignalDeltaFactsByNode: conditionalDeltaIndex.conditionalSignalDeltaFactsByNode,
36684
+ baselineOffsetFactsByNode: conditionalDeltaIndex.baselineOffsetFactsByNode,
36584
36685
  statefulSelectorEntriesByRuleId: statefulRuleIndexes.selectorEntriesByRuleId,
36585
36686
  statefulNormalizedDeclarationsByRuleId: statefulRuleIndexes.normalizedDeclarationsByRuleId,
36586
36687
  statefulBaseValueIndex: statefulRuleIndexes.baseValueIndex,
@@ -36592,11 +36693,11 @@ function buildLayoutGraph(solids, css, logger = noopLogger) {
36592
36693
  };
36593
36694
  }
36594
36695
  function buildElementFactIndex(elements, snapshotByElementNode) {
36595
- const reservedSpaceFactsByElementKey = /* @__PURE__ */ new Map();
36596
- const scrollContainerFactsByElementKey = /* @__PURE__ */ new Map();
36597
- const flowParticipationFactsByElementKey = /* @__PURE__ */ new Map();
36598
- const containingBlockFactsByElementKey = /* @__PURE__ */ new Map();
36599
- const snapshotHotSignalsByElementKey = /* @__PURE__ */ new Map();
36696
+ const reservedSpaceFactsByNode = /* @__PURE__ */ new Map();
36697
+ const scrollContainerFactsByNode = /* @__PURE__ */ new Map();
36698
+ const flowParticipationFactsByNode = /* @__PURE__ */ new Map();
36699
+ const containingBlockFactsByNode = /* @__PURE__ */ new Map();
36700
+ const snapshotHotSignalsByNode = /* @__PURE__ */ new Map();
36600
36701
  const elementsByTagName = /* @__PURE__ */ new Map();
36601
36702
  const elementsByKnownSignalValue = /* @__PURE__ */ new Map();
36602
36703
  const dynamicSlotCandidateElements = [];
@@ -36606,7 +36707,7 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36606
36707
  const node = elements[i];
36607
36708
  if (!node) continue;
36608
36709
  const snapshot = snapshotByElementNode.get(node);
36609
- if (node.textualContent === "unknown" && node.siblingCount >= 2) {
36710
+ if (node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2) {
36610
36711
  dynamicSlotCandidateElements.push(node);
36611
36712
  }
36612
36713
  if (node.tagName) {
@@ -36627,18 +36728,18 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36627
36728
  nearestPositionedAncestorHasReservedSpace = parentPositioned.hasReservedSpace;
36628
36729
  }
36629
36730
  }
36630
- containingBlockFactsByElementKey.set(node.key, {
36731
+ containingBlockFactsByNode.set(node, {
36631
36732
  nearestPositionedAncestorKey,
36632
36733
  nearestPositionedAncestorHasReservedSpace
36633
36734
  });
36634
36735
  if (!snapshot) continue;
36635
36736
  const reservedSpaceFact = computeReservedSpaceFact(snapshot);
36636
- reservedSpaceFactsByElementKey.set(node.key, reservedSpaceFact);
36737
+ reservedSpaceFactsByNode.set(node, reservedSpaceFact);
36637
36738
  const scrollFact = computeScrollContainerFact(snapshot);
36638
- scrollContainerFactsByElementKey.set(node.key, scrollFact);
36739
+ scrollContainerFactsByNode.set(node, scrollFact);
36639
36740
  if (scrollFact.isScrollContainer) scrollContainerElements.push(node);
36640
- flowParticipationFactsByElementKey.set(node.key, computeFlowParticipationFact(snapshot));
36641
- snapshotHotSignalsByElementKey.set(node.key, computeHotSignals(snapshot));
36741
+ flowParticipationFactsByNode.set(node, computeFlowParticipationFact(snapshot));
36742
+ snapshotHotSignalsByNode.set(node, computeHotSignals(snapshot));
36642
36743
  const positionSignal = snapshot.signals.get("position");
36643
36744
  const isPositioned = positionSignal !== void 0 && positionSignal.kind === "known" && positionSignal.normalized !== "static";
36644
36745
  if (isPositioned) {
@@ -36669,49 +36770,163 @@ function buildElementFactIndex(elements, snapshotByElementNode) {
36669
36770
  }
36670
36771
  }
36671
36772
  return {
36672
- reservedSpaceFactsByElementKey,
36673
- scrollContainerFactsByElementKey,
36773
+ reservedSpaceFactsByNode,
36774
+ scrollContainerFactsByNode,
36674
36775
  scrollContainerElements,
36675
- flowParticipationFactsByElementKey,
36676
- containingBlockFactsByElementKey,
36677
- snapshotHotSignalsByElementKey,
36776
+ flowParticipationFactsByNode,
36777
+ containingBlockFactsByNode,
36778
+ snapshotHotSignalsByNode,
36678
36779
  elementsByTagName,
36679
36780
  elementsByKnownSignalValue,
36680
36781
  dynamicSlotCandidateElements
36681
36782
  };
36682
36783
  }
36683
- function computeHotSignals(snapshot) {
36784
+ var ABSENT_NUMERIC = Object.freeze({
36785
+ present: false,
36786
+ value: null,
36787
+ kind: 3 /* Unknown */
36788
+ });
36789
+ var ABSENT_NORMALIZED = Object.freeze({
36790
+ present: false,
36791
+ value: null,
36792
+ kind: 3 /* Unknown */
36793
+ });
36794
+ function toHotNumeric(signal) {
36795
+ if (signal.kind !== "known") {
36796
+ return {
36797
+ present: true,
36798
+ value: null,
36799
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
36800
+ };
36801
+ }
36684
36802
  return {
36685
- lineHeight: computeHotNumeric(snapshot, "line-height"),
36686
- verticalAlign: computeHotNormalized(snapshot, "vertical-align"),
36687
- alignSelf: computeHotNormalized(snapshot, "align-self"),
36688
- placeSelf: computeHotNormalized(snapshot, "place-self"),
36689
- writingMode: computeHotNormalized(snapshot, "writing-mode"),
36690
- direction: computeHotNormalized(snapshot, "direction"),
36691
- display: computeHotNormalized(snapshot, "display"),
36692
- alignItems: computeHotNormalized(snapshot, "align-items"),
36693
- placeItems: computeHotNormalized(snapshot, "place-items"),
36694
- position: computeHotNormalized(snapshot, "position"),
36695
- insetBlockStart: computeHotNumeric(snapshot, "inset-block-start"),
36696
- insetBlockEnd: computeHotNumeric(snapshot, "inset-block-end"),
36697
- transform: computeHotNumeric(snapshot, "transform"),
36698
- translate: computeHotNumeric(snapshot, "translate"),
36699
- top: computeHotNumeric(snapshot, "top"),
36700
- bottom: computeHotNumeric(snapshot, "bottom"),
36701
- marginTop: computeHotNumeric(snapshot, "margin-top"),
36702
- marginBottom: computeHotNumeric(snapshot, "margin-bottom")
36803
+ present: true,
36804
+ value: signal.px,
36805
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
36703
36806
  };
36704
36807
  }
36705
- function computeHotNumeric(snapshot, name) {
36808
+ function toHotNormalized(signal) {
36809
+ if (signal.kind !== "known") {
36810
+ return {
36811
+ present: true,
36812
+ value: null,
36813
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : 3 /* Unknown */
36814
+ };
36815
+ }
36706
36816
  return {
36707
- present: snapshot.signals.has(name),
36708
- ...readNumericSignalEvidence(snapshot, name)
36817
+ present: true,
36818
+ value: signal.normalized,
36819
+ kind: signal.guard.kind === 1 /* Conditional */ ? 2 /* Conditional */ : signal.quality === "estimated" ? 1 /* Interval */ : 0 /* Exact */
36709
36820
  };
36710
36821
  }
36711
- function computeHotNormalized(snapshot, name) {
36822
+ function computeHotSignals(snapshot) {
36823
+ let lineHeight = ABSENT_NUMERIC;
36824
+ let verticalAlign = ABSENT_NORMALIZED;
36825
+ let alignSelf = ABSENT_NORMALIZED;
36826
+ let placeSelf = ABSENT_NORMALIZED;
36827
+ let flexDirection = ABSENT_NORMALIZED;
36828
+ let gridAutoFlow = ABSENT_NORMALIZED;
36829
+ let writingMode = ABSENT_NORMALIZED;
36830
+ let direction = ABSENT_NORMALIZED;
36831
+ let display = ABSENT_NORMALIZED;
36832
+ let alignItems = ABSENT_NORMALIZED;
36833
+ let placeItems = ABSENT_NORMALIZED;
36834
+ let position = ABSENT_NORMALIZED;
36835
+ let insetBlockStart = ABSENT_NUMERIC;
36836
+ let insetBlockEnd = ABSENT_NUMERIC;
36837
+ let transform = ABSENT_NUMERIC;
36838
+ let translate = ABSENT_NUMERIC;
36839
+ let top = ABSENT_NUMERIC;
36840
+ let bottom = ABSENT_NUMERIC;
36841
+ let marginTop = ABSENT_NUMERIC;
36842
+ let marginBottom = ABSENT_NUMERIC;
36843
+ for (const [name, value2] of snapshot.signals) {
36844
+ switch (name) {
36845
+ case "line-height":
36846
+ lineHeight = toHotNumeric(value2);
36847
+ break;
36848
+ case "vertical-align":
36849
+ verticalAlign = toHotNormalized(value2);
36850
+ break;
36851
+ case "align-self":
36852
+ alignSelf = toHotNormalized(value2);
36853
+ break;
36854
+ case "place-self":
36855
+ placeSelf = toHotNormalized(value2);
36856
+ break;
36857
+ case "flex-direction":
36858
+ flexDirection = toHotNormalized(value2);
36859
+ break;
36860
+ case "grid-auto-flow":
36861
+ gridAutoFlow = toHotNormalized(value2);
36862
+ break;
36863
+ case "writing-mode":
36864
+ writingMode = toHotNormalized(value2);
36865
+ break;
36866
+ case "direction":
36867
+ direction = toHotNormalized(value2);
36868
+ break;
36869
+ case "display":
36870
+ display = toHotNormalized(value2);
36871
+ break;
36872
+ case "align-items":
36873
+ alignItems = toHotNormalized(value2);
36874
+ break;
36875
+ case "place-items":
36876
+ placeItems = toHotNormalized(value2);
36877
+ break;
36878
+ case "position":
36879
+ position = toHotNormalized(value2);
36880
+ break;
36881
+ case "inset-block-start":
36882
+ insetBlockStart = toHotNumeric(value2);
36883
+ break;
36884
+ case "inset-block-end":
36885
+ insetBlockEnd = toHotNumeric(value2);
36886
+ break;
36887
+ case "transform":
36888
+ transform = toHotNumeric(value2);
36889
+ break;
36890
+ case "translate":
36891
+ translate = toHotNumeric(value2);
36892
+ break;
36893
+ case "top":
36894
+ top = toHotNumeric(value2);
36895
+ break;
36896
+ case "bottom":
36897
+ bottom = toHotNumeric(value2);
36898
+ break;
36899
+ case "margin-top":
36900
+ marginTop = toHotNumeric(value2);
36901
+ break;
36902
+ case "margin-bottom":
36903
+ marginBottom = toHotNumeric(value2);
36904
+ break;
36905
+ default:
36906
+ break;
36907
+ }
36908
+ }
36712
36909
  return {
36713
- present: snapshot.signals.has(name),
36714
- ...readNormalizedSignalEvidence(snapshot, name)
36910
+ lineHeight,
36911
+ verticalAlign,
36912
+ alignSelf,
36913
+ placeSelf,
36914
+ flexDirection,
36915
+ gridAutoFlow,
36916
+ writingMode,
36917
+ direction,
36918
+ display,
36919
+ alignItems,
36920
+ placeItems,
36921
+ position,
36922
+ insetBlockStart,
36923
+ insetBlockEnd,
36924
+ transform,
36925
+ translate,
36926
+ top,
36927
+ bottom,
36928
+ marginTop,
36929
+ marginBottom
36715
36930
  };
36716
36931
  }
36717
36932
  function computeReservedSpaceFact(snapshot) {
@@ -36746,15 +36961,14 @@ function computeReservedSpaceFact(snapshot) {
36746
36961
  function hasPositiveOrDeclaredDimension(snapshot, property) {
36747
36962
  const signal = snapshot.signals.get(property);
36748
36963
  if (!signal) return false;
36749
- if (signal.guard !== "unconditional") return false;
36964
+ if (signal.guard.kind !== 0 /* Unconditional */) return false;
36750
36965
  let normalized = "";
36751
36966
  if (signal.kind === "known") {
36752
36967
  if (signal.px !== null) return signal.px > 0;
36753
36968
  normalized = signal.normalized.trim().toLowerCase();
36754
36969
  }
36755
36970
  if (signal.kind === "unknown") {
36756
- if (signal.raw === null) return false;
36757
- normalized = signal.raw.trim().toLowerCase();
36971
+ return signal.source !== null;
36758
36972
  }
36759
36973
  if (normalized.length === 0) return false;
36760
36974
  if (isNonReservingDimension(normalized)) return false;
@@ -36763,15 +36977,14 @@ function hasPositiveOrDeclaredDimension(snapshot, property) {
36763
36977
  function hasUsableAspectRatio(snapshot) {
36764
36978
  const signal = snapshot.signals.get("aspect-ratio");
36765
36979
  if (!signal) return false;
36766
- if (signal.guard !== "unconditional") return false;
36980
+ if (signal.guard.kind !== 0 /* Unconditional */) return false;
36981
+ if (signal.kind === "unknown") {
36982
+ return false;
36983
+ }
36767
36984
  let normalized = "";
36768
36985
  if (signal.kind === "known") {
36769
36986
  normalized = signal.normalized.trim().toLowerCase();
36770
36987
  }
36771
- if (signal.kind === "unknown") {
36772
- if (signal.raw === null) return false;
36773
- normalized = signal.raw.trim().toLowerCase();
36774
- }
36775
36988
  if (normalized.length === 0) return false;
36776
36989
  return normalized !== "auto";
36777
36990
  }
@@ -36789,8 +37002,8 @@ function computeScrollContainerFact(snapshot) {
36789
37002
  const yFromLonghand = parseSingleAxisScroll(overflowY);
36790
37003
  const xScroll = shorthandAxis.x;
36791
37004
  const yScroll = yFromLonghand === null ? shorthandAxis.y : yFromLonghand;
36792
- const hasConditionalScroll = overflowSignal?.guard === "conditional" && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard === "conditional" && yFromLonghand === true;
36793
- const hasUnconditionalScroll = overflowSignal?.guard === "unconditional" && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard === "unconditional" && yFromLonghand === true;
37005
+ const hasConditionalScroll = overflowSignal?.guard.kind === 1 /* Conditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 1 /* Conditional */ && yFromLonghand === true;
37006
+ const hasUnconditionalScroll = overflowSignal?.guard.kind === 0 /* Unconditional */ && (shorthandAxis.x || shorthandAxis.y) || overflowYSignal?.guard.kind === 0 /* Unconditional */ && yFromLonghand === true;
36794
37007
  return {
36795
37008
  isScrollContainer: xScroll || yScroll,
36796
37009
  axis: toScrollAxis(xScroll, yScroll),
@@ -36800,18 +37013,18 @@ function computeScrollContainerFact(snapshot) {
36800
37013
  hasUnconditionalScroll
36801
37014
  };
36802
37015
  }
37016
+ var NO_SCROLL = Object.freeze({ x: false, y: false });
37017
+ var BOTH_SCROLL = Object.freeze({ x: true, y: true });
36803
37018
  function parseOverflowShorthandAxis(value2) {
36804
- if (value2 === null) return { x: false, y: false };
36805
- const tokens = splitWhitespaceTokens(value2);
36806
- if (tokens.length === 0) return { x: false, y: false };
36807
- const first = tokens[0];
36808
- if (!first) return { x: false, y: false };
36809
- if (tokens.length === 1) {
36810
- const scroll = SCROLLABLE_VALUES.has(first);
36811
- return { x: scroll, y: scroll };
36812
- }
36813
- const second = tokens[1];
36814
- if (!second) return { x: SCROLLABLE_VALUES.has(first), y: false };
37019
+ if (value2 === null) return NO_SCROLL;
37020
+ const trimmed = value2.trim();
37021
+ const spaceIdx = trimmed.indexOf(" ");
37022
+ if (spaceIdx === -1) {
37023
+ const scroll = SCROLLABLE_VALUES.has(trimmed);
37024
+ return scroll ? BOTH_SCROLL : NO_SCROLL;
37025
+ }
37026
+ const first = trimmed.slice(0, spaceIdx);
37027
+ const second = trimmed.slice(spaceIdx + 1).trimStart();
36815
37028
  return {
36816
37029
  x: SCROLLABLE_VALUES.has(first),
36817
37030
  y: SCROLLABLE_VALUES.has(second)
@@ -36819,16 +37032,16 @@ function parseOverflowShorthandAxis(value2) {
36819
37032
  }
36820
37033
  function parseSingleAxisScroll(value2) {
36821
37034
  if (value2 === null) return null;
36822
- const tokens = splitWhitespaceTokens(value2);
36823
- const first = tokens[0];
36824
- if (!first) return null;
37035
+ const trimmed = value2.trim();
37036
+ const spaceIdx = trimmed.indexOf(" ");
37037
+ const first = spaceIdx === -1 ? trimmed : trimmed.slice(0, spaceIdx);
36825
37038
  return SCROLLABLE_VALUES.has(first);
36826
37039
  }
36827
37040
  function toScrollAxis(x, y) {
36828
- if (x && y) return "both";
36829
- if (x) return "x";
36830
- if (y) return "y";
36831
- return "none";
37041
+ if (x && y) return 3 /* Both */;
37042
+ if (x) return 1 /* X */;
37043
+ if (y) return 2 /* Y */;
37044
+ return 0 /* None */;
36832
37045
  }
36833
37046
  function computeFlowParticipationFact(snapshot) {
36834
37047
  const signal = snapshot.signals.get("position");
@@ -36845,8 +37058,8 @@ function computeFlowParticipationFact(snapshot) {
36845
37058
  return {
36846
37059
  inFlow: !outOfFlow,
36847
37060
  position,
36848
- hasConditionalOutOfFlow: signal.guard === "conditional" && outOfFlow,
36849
- hasUnconditionalOutOfFlow: signal.guard === "unconditional" && outOfFlow
37061
+ hasConditionalOutOfFlow: signal.guard.kind === 1 /* Conditional */ && outOfFlow,
37062
+ hasUnconditionalOutOfFlow: signal.guard.kind === 0 /* Unconditional */ && outOfFlow
36850
37063
  };
36851
37064
  }
36852
37065
  function buildContextIndex(childrenByParentNode, snapshotByElementNode, perf) {
@@ -36921,7 +37134,7 @@ function collectAlignmentCases(context) {
36921
37134
  subjectDeclaredOffsetDeviation,
36922
37135
  subjectEffectiveOffsetDeviation,
36923
37136
  subjectLineHeightDeviation,
36924
- subjectStats.element.snapshot.textualContent,
37137
+ subjectStats.element.snapshot.node.textualContent,
36925
37138
  subjectStats.element,
36926
37139
  subjectStats.contentComposition,
36927
37140
  cohortContentCompositions
@@ -37014,26 +37227,26 @@ function coverageFromNumeric(value2) {
37014
37227
  }
37015
37228
  function coverageFromConflict(value2) {
37016
37229
  const certainty = coverageFromKind(value2.kind);
37017
- if (value2.value === "unknown") return certainty * 0.4;
37230
+ if (value2.value === 2 /* Unknown */) return certainty * 0.4;
37018
37231
  return certainty;
37019
37232
  }
37020
37233
  function coverageFromTextContrast(value2) {
37021
- if (value2 === "unknown") return 0.35;
37234
+ if (value2 === 2 /* Unknown */) return 0.35;
37022
37235
  return 1;
37023
37236
  }
37024
37237
  function coverageFromSubjectText(subjectTextualContent) {
37025
- if (subjectTextualContent === "unknown") return 0.35;
37238
+ if (subjectTextualContent === 2 /* Unknown */) return 0.35;
37026
37239
  return 1;
37027
37240
  }
37028
37241
  function coverageFromContextCertainty(certainty) {
37029
- if (certainty === "resolved") return 1;
37030
- if (certainty === "conditional") return 0.55;
37242
+ if (certainty === 0 /* Resolved */) return 1;
37243
+ if (certainty === 1 /* Conditional */) return 0.55;
37031
37244
  return 0.25;
37032
37245
  }
37033
37246
  function coverageFromKind(kind) {
37034
- if (kind === "exact") return 1;
37035
- if (kind === "interval") return 0.78;
37036
- if (kind === "conditional") return 0.5;
37247
+ if (kind === 0 /* Exact */) return 1;
37248
+ if (kind === 1 /* Interval */) return 0.78;
37249
+ if (kind === 2 /* Conditional */) return 0.5;
37037
37250
  return 0.2;
37038
37251
  }
37039
37252
  function averageCoverage(...values) {
@@ -37066,24 +37279,7 @@ function resolveEffectiveAlignmentContext(parentContext, child, measurementNode,
37066
37279
  const childContext = contextByParentNode.get(child);
37067
37280
  if (!childContext) return parentContext;
37068
37281
  if (childContext.baselineRelevance !== "irrelevant") return parentContext;
37069
- return {
37070
- kind: parentContext.kind,
37071
- certainty: parentContext.certainty,
37072
- parentSolidFile: parentContext.parentSolidFile,
37073
- parentElementId: parentContext.parentElementId,
37074
- parentElementKey: parentContext.parentElementKey,
37075
- parentTag: parentContext.parentTag,
37076
- axis: parentContext.axis,
37077
- axisCertainty: parentContext.axisCertainty,
37078
- inlineDirection: parentContext.inlineDirection,
37079
- inlineDirectionCertainty: parentContext.inlineDirectionCertainty,
37080
- parentDisplay: parentContext.parentDisplay,
37081
- parentAlignItems: parentContext.parentAlignItems,
37082
- parentPlaceItems: parentContext.parentPlaceItems,
37083
- hasPositionedOffset: parentContext.hasPositionedOffset,
37084
- baselineRelevance: "irrelevant",
37085
- evidence: parentContext.evidence
37086
- };
37282
+ return deriveAlignmentContext(parentContext, { baselineRelevance: "irrelevant" });
37087
37283
  }
37088
37284
  function compareAlignmentCaseOrder(left, right) {
37089
37285
  if (left.subject.solidFile < right.subject.solidFile) return -1;
@@ -37102,12 +37298,12 @@ function buildConsistencyEvidence(input) {
37102
37298
  input.cohortProfile.medianLineHeightPx,
37103
37299
  input.cohortProfile.medianDeclaredOffsetPx
37104
37300
  );
37105
- const offset = normalizeDeviation(
37301
+ const offsetRaw = normalizeDeviation(
37106
37302
  input.subjectEffectiveOffsetDeviation,
37107
37303
  input.cohortProfile.effectiveOffsetDispersionPx,
37108
37304
  effectiveOffsetScaleReference
37109
37305
  );
37110
- const declaredOffset = normalizeDeviation(
37306
+ const declaredOffsetRaw = normalizeDeviation(
37111
37307
  input.subjectDeclaredOffsetDeviation,
37112
37308
  input.cohortProfile.declaredOffsetDispersionPx,
37113
37309
  declaredOffsetScaleReference
@@ -37118,10 +37314,15 @@ function buildConsistencyEvidence(input) {
37118
37314
  input.cohortProfile.medianLineHeightPx
37119
37315
  );
37120
37316
  const baselinesIrrelevant = input.context.baselineRelevance === "irrelevant";
37121
- const baselineStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
37122
- const contextStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
37123
- const replacedStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
37124
- const compositionStrength = baselinesIrrelevant ? ZERO_STRENGTH : resolveContentCompositionStrength(input);
37317
+ const blockAxisIsMainAxis = !input.context.crossAxisIsBlockAxis;
37318
+ const suppressAll = blockAxisIsMainAxis;
37319
+ const offset = suppressAll ? ZERO_STRENGTH : offsetRaw;
37320
+ const declaredOffset = suppressAll ? ZERO_STRENGTH : declaredOffsetRaw;
37321
+ const baselineStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveBaselineStrength(input, lineHeight);
37322
+ const contextStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveContextStrength(input, lineHeight);
37323
+ const replacedStrength = baselinesIrrelevant || suppressAll ? ZERO_STRENGTH : resolveReplacedControlStrength(input, lineHeight);
37324
+ const compositionResult = baselinesIrrelevant || suppressAll ? null : resolveContentCompositionStrength(input);
37325
+ const compositionStrength = compositionResult ? compositionResult.evidence : ZERO_STRENGTH;
37125
37326
  const contextCertaintyPenalty = resolveContextCertaintyPenalty(input);
37126
37327
  const provenance = input.cohortProvenance;
37127
37328
  const atoms = buildEvidenceAtoms(
@@ -37142,6 +37343,7 @@ function buildConsistencyEvidence(input) {
37142
37343
  contextStrength: contextStrength.strength,
37143
37344
  replacedStrength: replacedStrength.strength,
37144
37345
  compositionStrength: compositionStrength.strength,
37346
+ majorityClassification: compositionResult ? compositionResult.divergence.majorityClassification : 5 /* Unknown */,
37145
37347
  identifiability: input.subjectIdentifiability,
37146
37348
  factSummary,
37147
37349
  atoms
@@ -37177,7 +37379,7 @@ function resolveOffsetScaleReference(medianLineHeightPx, fallbackMedianOffsetPx)
37177
37379
  }
37178
37380
  function resolveBaselineStrength(input, lineHeight) {
37179
37381
  const verticalAlign = input.cohortSignals.verticalAlign;
37180
- const hasConflict = verticalAlign.value === "conflict";
37382
+ const hasConflict = verticalAlign.value === 0 /* Conflict */;
37181
37383
  const conflict = hasConflict ? alignmentStrengthCalibration.baselineConflictBoost : 0;
37182
37384
  const kind = resolveBaselineEvidenceKind(lineHeight.kind, verticalAlign.kind, hasConflict);
37183
37385
  return {
@@ -37187,7 +37389,7 @@ function resolveBaselineStrength(input, lineHeight) {
37187
37389
  }
37188
37390
  function resolveBaselineEvidenceKind(lineHeightKind, verticalAlignKind, hasConflict) {
37189
37391
  if (!hasConflict) return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
37190
- if (lineHeightKind === "unknown") return verticalAlignKind;
37392
+ if (lineHeightKind === 3 /* Unknown */) return verticalAlignKind;
37191
37393
  return mergeEvidenceKind(lineHeightKind, verticalAlignKind);
37192
37394
  }
37193
37395
  function resolveContextStrength(input, lineHeight) {
@@ -37215,7 +37417,7 @@ function resolveContextConflictEvidence(input) {
37215
37417
  const alignSelf = input.cohortSignals.alignSelf;
37216
37418
  const placeSelf = input.cohortSignals.placeSelf;
37217
37419
  const kind = mergeEvidenceKind(alignSelf.kind, placeSelf.kind);
37218
- const hasConflict = alignSelf.value === "conflict" || placeSelf.value === "conflict";
37420
+ const hasConflict = alignSelf.value === 0 /* Conflict */ || placeSelf.value === 0 /* Conflict */;
37219
37421
  if (!hasConflict) {
37220
37422
  return {
37221
37423
  strength: 0,
@@ -37229,23 +37431,23 @@ function resolveContextConflictEvidence(input) {
37229
37431
  }
37230
37432
  function resolveReplacedControlStrength(input, lineHeight) {
37231
37433
  const subject = input.subject.snapshot;
37232
- const hasReplacedPair = subject.isControl || subject.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
37434
+ const hasReplacedPair = subject.node.isControl || subject.node.isReplaced || input.cohortSignals.hasControlOrReplacedPeer;
37233
37435
  if (!hasReplacedPair) {
37234
37436
  return {
37235
37437
  strength: 0,
37236
37438
  kind: lineHeight.kind
37237
37439
  };
37238
37440
  }
37239
- if (input.cohortSignals.textContrastWithPeers === "different") {
37441
+ if (input.cohortSignals.textContrastWithPeers === 0 /* Different */) {
37240
37442
  return {
37241
37443
  strength: alignmentStrengthCalibration.replacedDifferentTextBoost,
37242
- kind: "exact"
37444
+ kind: 0 /* Exact */
37243
37445
  };
37244
37446
  }
37245
- if (input.cohortSignals.textContrastWithPeers === "unknown") {
37447
+ if (input.cohortSignals.textContrastWithPeers === 2 /* Unknown */) {
37246
37448
  return {
37247
37449
  strength: alignmentStrengthCalibration.replacedUnknownTextBoost,
37248
- kind: "conditional"
37450
+ kind: 2 /* Conditional */
37249
37451
  };
37250
37452
  }
37251
37453
  return {
@@ -37254,22 +37456,28 @@ function resolveReplacedControlStrength(input, lineHeight) {
37254
37456
  };
37255
37457
  }
37256
37458
  function resolveContentCompositionStrength(input) {
37257
- const divergenceStrength = resolveCompositionDivergenceStrength(
37459
+ const divergence = resolveCompositionDivergence(
37258
37460
  input.subjectContentComposition,
37259
37461
  input.cohortContentCompositions,
37260
37462
  input.context
37261
37463
  );
37262
- if (divergenceStrength <= 0) {
37464
+ if (divergence.strength <= 0) {
37263
37465
  return {
37264
- strength: 0,
37265
- kind: "exact"
37466
+ evidence: {
37467
+ strength: 0,
37468
+ kind: 0 /* Exact */
37469
+ },
37470
+ divergence
37266
37471
  };
37267
37472
  }
37268
37473
  const subjectClassification = input.subjectContentComposition.classification;
37269
- const kind = subjectClassification === "unknown" ? "conditional" : "exact";
37474
+ const kind = subjectClassification === 5 /* Unknown */ ? 2 /* Conditional */ : 0 /* Exact */;
37270
37475
  return {
37271
- strength: clamp(divergenceStrength, 0, 1),
37272
- kind
37476
+ evidence: {
37477
+ strength: clamp(divergence.strength, 0, 1),
37478
+ kind
37479
+ },
37480
+ divergence
37273
37481
  };
37274
37482
  }
37275
37483
  function resolveContextCertaintyPenalty(input) {
@@ -37341,9 +37549,9 @@ function buildEvidenceAtoms(input, offset, declaredOffset, baselineStrength, con
37341
37549
  return out;
37342
37550
  }
37343
37551
  function mapContextCertaintyToEvidenceKind(certainty) {
37344
- if (certainty === "resolved") return "exact";
37345
- if (certainty === "conditional") return "conditional";
37346
- return "unknown";
37552
+ if (certainty === 0 /* Resolved */) return 0 /* Exact */;
37553
+ if (certainty === 1 /* Conditional */) return 2 /* Conditional */;
37554
+ return 3 /* Unknown */;
37347
37555
  }
37348
37556
  function pushSupportAtom(out, factorId, valueKind, strength, coverage, provenance) {
37349
37557
  pushAtom(out, factorId, valueKind, strength, coverage, provenance, "support");
@@ -37369,19 +37577,19 @@ function pushAtom(out, factorId, valueKind, strength, coverage, provenance, expe
37369
37577
  }
37370
37578
  function toPositiveContribution(strength, maxWeight, valueKind) {
37371
37579
  const contribution = clamp(strength, 0, 2) * maxWeight;
37372
- if (valueKind === "exact") {
37580
+ if (valueKind === 0 /* Exact */) {
37373
37581
  return {
37374
37582
  min: contribution,
37375
37583
  max: contribution
37376
37584
  };
37377
37585
  }
37378
- if (valueKind === "interval") {
37586
+ if (valueKind === 1 /* Interval */) {
37379
37587
  return {
37380
37588
  min: contribution * evidenceContributionCalibration.supportIntervalLowerScale,
37381
37589
  max: contribution
37382
37590
  };
37383
37591
  }
37384
- if (valueKind === "conditional") {
37592
+ if (valueKind === 2 /* Conditional */) {
37385
37593
  return {
37386
37594
  min: 0,
37387
37595
  max: contribution * evidenceContributionCalibration.supportConditionalUpperScale
@@ -37394,19 +37602,19 @@ function toPositiveContribution(strength, maxWeight, valueKind) {
37394
37602
  }
37395
37603
  function toNegativeContribution(strength, maxPenalty, valueKind) {
37396
37604
  const penalty = clamp(strength, 0, 1) * maxPenalty;
37397
- if (valueKind === "exact") {
37605
+ if (valueKind === 0 /* Exact */) {
37398
37606
  return {
37399
37607
  min: -penalty,
37400
37608
  max: -penalty
37401
37609
  };
37402
37610
  }
37403
- if (valueKind === "interval") {
37611
+ if (valueKind === 1 /* Interval */) {
37404
37612
  return {
37405
37613
  min: -penalty,
37406
37614
  max: -penalty * evidenceContributionCalibration.penaltyIntervalUpperScale
37407
37615
  };
37408
37616
  }
37409
- if (valueKind === "conditional") {
37617
+ if (valueKind === 2 /* Conditional */) {
37410
37618
  return {
37411
37619
  min: -penalty,
37412
37620
  max: 0
@@ -37417,7 +37625,7 @@ function toNegativeContribution(strength, maxPenalty, valueKind) {
37417
37625
  max: 0
37418
37626
  };
37419
37627
  }
37420
- var ZERO_STRENGTH = { strength: 0, kind: "exact" };
37628
+ var ZERO_STRENGTH = { strength: 0, kind: 0 /* Exact */ };
37421
37629
 
37422
37630
  // src/cross-file/layout/consistency-policy.ts
37423
37631
  function applyConsistencyPolicy(input) {
@@ -37501,23 +37709,38 @@ function resolveConfidence(posterior, evidenceMass) {
37501
37709
  const confidence = posterior.lower * weightedMass * (1 - intervalWidth * alignmentPolicyCalibration.confidenceIntervalPenalty);
37502
37710
  return clamp(confidence, 0, 1);
37503
37711
  }
37712
+ var EMPTY_FACTOR_LIST = Object.freeze([]);
37504
37713
  function selectTopFactors(evidence) {
37505
- const sorted = [...evidence.atoms];
37506
- sorted.sort((left, right) => {
37507
- const leftMagnitude = Math.abs((left.contribution.min + left.contribution.max) / 2);
37508
- const rightMagnitude = Math.abs((right.contribution.min + right.contribution.max) / 2);
37509
- if (leftMagnitude !== rightMagnitude) return rightMagnitude - leftMagnitude;
37510
- if (left.factorId < right.factorId) return -1;
37511
- if (left.factorId > right.factorId) return 1;
37714
+ const atoms = evidence.atoms;
37715
+ if (atoms.length === 0) return EMPTY_FACTOR_LIST;
37716
+ const top = [];
37717
+ for (let i = 0; i < atoms.length; i++) {
37718
+ const atom = atoms[i];
37719
+ if (!atom) continue;
37720
+ const mag = Math.abs((atom.contribution.min + atom.contribution.max) / 2);
37721
+ if (mag <= 0) continue;
37722
+ if (top.length < 4) {
37723
+ top.push({ id: atom.factorId, mag });
37724
+ continue;
37725
+ }
37726
+ let minIdx = 0;
37727
+ for (let j = 1; j < top.length; j++) {
37728
+ const curr = top[j];
37729
+ const best = top[minIdx];
37730
+ if (curr && best && curr.mag < best.mag) minIdx = j;
37731
+ }
37732
+ const minEntry = top[minIdx];
37733
+ if (minEntry && mag > minEntry.mag) {
37734
+ top[minIdx] = { id: atom.factorId, mag };
37735
+ }
37736
+ }
37737
+ top.sort((a, b) => {
37738
+ if (a.mag !== b.mag) return b.mag - a.mag;
37739
+ if (a.id < b.id) return -1;
37740
+ if (a.id > b.id) return 1;
37512
37741
  return 0;
37513
37742
  });
37514
- const out = [];
37515
- for (let i = 0; i < sorted.length && i < 4; i++) {
37516
- const item = sorted[i];
37517
- if (!item) continue;
37518
- out.push(item.factorId);
37519
- }
37520
- return out;
37743
+ return top.map((t) => t.id);
37521
37744
  }
37522
37745
  function logistic(value2) {
37523
37746
  if (value2 > 30) return 1;
@@ -37538,7 +37761,7 @@ function evaluateAlignmentCase(input) {
37538
37761
  evidenceMass: policy.evidenceMass
37539
37762
  };
37540
37763
  }
37541
- const signalFindings = buildFindingsFromAtoms(evidence.atoms, input);
37764
+ const signalFindings = buildFindingsFromAtoms(evidence.atoms, input, evidence);
37542
37765
  return {
37543
37766
  kind: "accept",
37544
37767
  evaluation: {
@@ -37558,12 +37781,12 @@ function evaluateAlignmentCase(input) {
37558
37781
  }
37559
37782
  };
37560
37783
  }
37561
- function buildFindingsFromAtoms(atoms, input) {
37784
+ function buildFindingsFromAtoms(atoms, input, evidence) {
37562
37785
  const byKind = /* @__PURE__ */ new Map();
37563
37786
  for (let i = 0; i < atoms.length; i++) {
37564
37787
  const atom = atoms[i];
37565
37788
  if (!atom) continue;
37566
- const factor = toFindingFactor(atom.factorId, input);
37789
+ const factor = toFindingFactor(atom.factorId, input, evidence);
37567
37790
  if (factor === null) continue;
37568
37791
  const meanContribution = (atom.contribution.min + atom.contribution.max) / 2;
37569
37792
  if (meanContribution <= 0) continue;
@@ -37584,7 +37807,7 @@ function buildFindingsFromAtoms(atoms, input) {
37584
37807
  }
37585
37808
  return [...byKind.values()];
37586
37809
  }
37587
- function toFindingFactor(factorId, input) {
37810
+ function toFindingFactor(factorId, input, evidence) {
37588
37811
  switch (factorId) {
37589
37812
  case "offset-delta":
37590
37813
  return {
@@ -37614,17 +37837,15 @@ function toFindingFactor(factorId, input) {
37614
37837
  case "content-composition-conflict":
37615
37838
  return {
37616
37839
  kind: "content-composition-conflict",
37617
- message: formatContentCompositionFinding(input)
37840
+ message: formatContentCompositionFinding(input, evidence)
37618
37841
  };
37619
37842
  default:
37620
37843
  return null;
37621
37844
  }
37622
37845
  }
37623
- function formatContentCompositionFinding(input) {
37846
+ function formatContentCompositionFinding(input, evidence) {
37624
37847
  const subjectClassification = formatCompositionClassification(input.subjectContentComposition.classification);
37625
- const majorityClassification = formatCompositionClassification(
37626
- resolveMajorityClassification(input.cohortContentCompositions)
37627
- );
37848
+ const majorityClassification = formatCompositionClassification(evidence.majorityClassification);
37628
37849
  const fixSuggestion = formatCompositionFixSuggestion(input.subjectContentComposition);
37629
37850
  return `siblings have identical CSS but different content composition (subject: ${subjectClassification}, majority: ${majorityClassification}; fix: ${fixSuggestion})`;
37630
37851
  }
@@ -37683,7 +37904,7 @@ function recordPolicyMetrics(context, evidenceMass, posteriorLower, posteriorUpp
37683
37904
  context.layout.perf.factorCoverageSum += clamp(evidenceMass, 0, 1);
37684
37905
  context.layout.perf.factorCoverageCount++;
37685
37906
  const width = clamp(posteriorUpper - posteriorLower, 0, 1);
37686
- context.layout.perf.posteriorWidths.push(width);
37907
+ reservoirPush(context.layout.perf.posteriorWidths, width);
37687
37908
  if (width > 1e-3) context.layout.perf.uncertaintyEscalations++;
37688
37909
  }
37689
37910
 
@@ -37796,16 +38017,16 @@ function readNodeRefById(layout, solidFile, elementId) {
37796
38017
  }
37797
38018
  function isFlowRelevantBySiblingsOrText(node, textualContent) {
37798
38019
  if (node.siblingCount >= 2) return true;
37799
- return textualContent === "yes" || textualContent === "unknown" || textualContent === "dynamic-text";
38020
+ return textualContent === 0 /* Yes */ || textualContent === 2 /* Unknown */ || textualContent === 3 /* DynamicText */;
37800
38021
  }
37801
38022
  function isDeferredContainerLike(node, textualContent) {
37802
38023
  if (node.siblingCount >= 2) return true;
37803
- if (textualContent === "unknown") return true;
38024
+ if (textualContent === 2 /* Unknown */) return true;
37804
38025
  if (node.tagName !== null && SECTIONING_CONTAINER_TAGS.has(node.tagName)) return true;
37805
38026
  return false;
37806
38027
  }
37807
38028
  function isDynamicContainerLike(node) {
37808
- return node.textualContent === "unknown" && node.siblingCount >= 2;
38029
+ return node.textualContent === 2 /* Unknown */ && node.siblingCount >= 2;
37809
38030
  }
37810
38031
  function isLikelyViewportAffectingContainer(node) {
37811
38032
  if (node.siblingCount >= 2) return true;
@@ -39045,7 +39266,7 @@ var cssLayoutScrollbarGutterInstability = defineCrossRule({
39045
39266
  const snapshot = collectSignalSnapshot(context, node);
39046
39267
  const scroll = readScrollContainerFact(context.layout, node);
39047
39268
  if (!scroll.isScrollContainer) continue;
39048
- if (scroll.axis !== "y" && scroll.axis !== "both") continue;
39269
+ if (scroll.axis !== 2 /* Y */ && scroll.axis !== 3 /* Both */) continue;
39049
39270
  const scrollbarWidth = readKnownNormalized(snapshot, "scrollbar-width");
39050
39271
  if (scrollbarWidth === "none") continue;
39051
39272
  const gutter = readKnownNormalized(snapshot, "scrollbar-gutter");
@@ -39175,10 +39396,10 @@ var cssLayoutConditionalDisplayCollapse = defineCrossRule({
39175
39396
  const display = readKnownNormalizedWithGuard(snapshot, "display");
39176
39397
  if (!display || !COLLAPSING_DISPLAYS.has(display)) continue;
39177
39398
  const displaySignal = snapshot.signals.get("display");
39178
- if (!displaySignal || displaySignal.guard !== "conditional") continue;
39399
+ if (!displaySignal || displaySignal.guard.kind !== 1 /* Conditional */) continue;
39179
39400
  const flow = readFlowParticipationFact(context.layout, node);
39180
39401
  if (!flow.inFlow) continue;
39181
- if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
39402
+ if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
39182
39403
  const reservedSpace = readReservedSpaceFact(context.layout, node);
39183
39404
  if (reservedSpace.hasReservedSpace) continue;
39184
39405
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalDisplayCollapse.id, "conditionalDisplayCollapse", messages152.conditionalDisplayCollapse, cssLayoutConditionalDisplayCollapse.severity, { display })) continue;
@@ -39214,10 +39435,10 @@ var cssLayoutConditionalWhiteSpaceWrapShift = defineCrossRule({
39214
39435
  if (!hasWrapShiftDelta(whiteSpaceDelta)) continue;
39215
39436
  if (!whiteSpace) continue;
39216
39437
  const whiteSpaceSignal = snapshot.signals.get("white-space");
39217
- if (!whiteSpaceSignal || whiteSpaceSignal.guard !== "conditional") continue;
39438
+ if (!whiteSpaceSignal || whiteSpaceSignal.guard.kind !== 1 /* Conditional */) continue;
39218
39439
  const flow = readFlowParticipationFact(context.layout, node);
39219
39440
  if (!flow.inFlow) continue;
39220
- if (!isFlowRelevantBySiblingsOrText(node, snapshot.textualContent)) continue;
39441
+ if (!isFlowRelevantBySiblingsOrText(node, snapshot.node.textualContent)) continue;
39221
39442
  if (hasStableTextShell(snapshot)) continue;
39222
39443
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutConditionalWhiteSpaceWrapShift.id, "conditionalWhiteSpaceShift", messages153.conditionalWhiteSpaceShift, cssLayoutConditionalWhiteSpaceWrapShift.severity, { whiteSpace })) continue;
39223
39444
  }
@@ -39354,7 +39575,7 @@ var cssLayoutContentVisibilityNoIntrinsicSize = defineCrossRule({
39354
39575
  const node = candidates[i];
39355
39576
  if (!node) continue;
39356
39577
  const snapshot = collectSignalSnapshot(context, node);
39357
- if (!isDeferredContainerLike(node, snapshot.textualContent)) continue;
39578
+ if (!isDeferredContainerLike(node, snapshot.node.textualContent)) continue;
39358
39579
  const reservedSpace = readReservedSpaceFact(context.layout, node);
39359
39580
  if (reservedSpace.hasReservedSpace) continue;
39360
39581
  if (!emitLayoutDiagnostic(context.layout, node, emit, cssLayoutContentVisibilityNoIntrinsicSize.id, "missingIntrinsicSize", messages156.missingIntrinsicSize, cssLayoutContentVisibilityNoIntrinsicSize.severity)) continue;
@@ -39413,11 +39634,11 @@ function collectConditionalOffsets(layout, node, snapshot) {
39413
39634
  if (!delta.hasConditional || !delta.hasDelta) continue;
39414
39635
  const signal = snapshot.signals.get(name);
39415
39636
  if (!signal) continue;
39416
- if (signal.guard !== "conditional") continue;
39637
+ if (signal.guard.kind !== 1 /* Conditional */) continue;
39417
39638
  if (signal.kind !== "known") continue;
39418
39639
  if (signal.px === null) continue;
39419
39640
  if (Math.abs(signal.px) <= 0.25) continue;
39420
- out.push({ property: name, value: signal.px, guardKey: signal.guardProvenance.key });
39641
+ out.push({ property: name, value: signal.px, guardKey: signal.guard.key });
39421
39642
  }
39422
39643
  return out;
39423
39644
  }
@@ -39438,8 +39659,8 @@ function hasEffectivePositionForConditionalOffset(snapshot, guardKey) {
39438
39659
  const position = snapshot.signals.get("position");
39439
39660
  if (!position) return false;
39440
39661
  if (position.kind !== "known") return false;
39441
- if (position.guard !== "conditional") return false;
39442
- if (position.guardProvenance.key !== guardKey) return false;
39662
+ if (position.guard.kind !== 1 /* Conditional */) return false;
39663
+ if (position.guard.key !== guardKey) return false;
39443
39664
  return position.normalized !== "static";
39444
39665
  }
39445
39666
  function hasStableBaseline(baselineBySignal, property, expectedPx) {