@fern-api/fdr-sdk 1.2.56-488d16ee49 → 1.2.56-4cf0b0d54d

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.
@@ -1949,17 +1949,31 @@ function buildSidebarRootChildren(ctx, scopeSegs, scopePrefix, changelogScopePre
1949
1949
  const sectionChildren = isUnboundedSkipSlugSibling && !hasDepthMarkedChildren ? [] : buildSectionTree(ctx, ownedSegs, sec, scopePrefix, changelogScopePrefix);
1950
1950
  node = sectionNode(ctx, s, sectionChildren, scopePrefix);
1951
1951
  }
1952
- const isSharedSection = siblingBoundaries.size > 0 && scopePrefix !== "" && sec !== "" && !sec.startsWith(scopePrefix);
1953
1952
  annotated.push({
1954
1953
  node,
1955
- pos: isSharedSection ? void 0 : metaNum(s.seg.metadata, "childIndex"),
1954
+ pos: metaNum(s.seg.metadata, "childIndex"),
1956
1955
  isLeaf: false
1957
1956
  });
1958
1957
  }
1959
1958
  }
1960
1959
  const hasLeafPos = annotated.some((a) => a.isLeaf && a.pos != null);
1961
1960
  const hasSegmentPos = annotated.some((a) => !a.isLeaf && a.pos != null);
1962
- const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, seq })).sort(
1961
+ const inferredPos = annotated.map((a) => a.pos);
1962
+ if (hasLeafPos && hasSegmentPos) {
1963
+ let nextSegPos;
1964
+ for (let i = annotated.length - 1; i >= 0; i--) {
1965
+ const a = annotated[i];
1966
+ if (a == null || a.isLeaf) {
1967
+ continue;
1968
+ }
1969
+ if (a.pos != null) {
1970
+ nextSegPos = a.pos;
1971
+ } else if (nextSegPos != null) {
1972
+ inferredPos[i] = nextSegPos - 0.5;
1973
+ }
1974
+ }
1975
+ }
1976
+ const flat = hasLeafPos && hasSegmentPos ? annotated.map((a, seq) => ({ ...a, pos: inferredPos[seq], seq })).sort(
1963
1977
  (x, y) => (x.pos ?? Number.MAX_SAFE_INTEGER) - (y.pos ?? Number.MAX_SAFE_INTEGER) || // When positions tie, prefer structural nodes (sections) over
1964
1978
  // leaves (pages). This handles stale tabRoot nav entries whose
1965
1979
  // displaySortOrder wasn't updated due to content-addressing