flappa-doormal 2.11.2 → 2.11.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1893,7 +1893,7 @@ const getWindowEndPosition = (remainingContent, currentFromIdx, windowEndIdx, to
1893
1893
  const advanceCursorAndIndex = (fullContent, breakPos, actualEndIdx, toIdx, pageIds, normalizedPages) => {
1894
1894
  const nextCursorPos = skipWhitespace$1(fullContent, breakPos);
1895
1895
  return {
1896
- currentFromIdx: computeNextFromIdx(fullContent.slice(nextCursorPos), actualEndIdx, toIdx, pageIds, normalizedPages),
1896
+ currentFromIdx: computeNextFromIdx(fullContent.slice(nextCursorPos, nextCursorPos + 500), actualEndIdx, toIdx, pageIds, normalizedPages),
1897
1897
  cursorPos: nextCursorPos
1898
1898
  };
1899
1899
  };
@@ -1940,7 +1940,8 @@ const processOversizedSegment = (segment, fromIdx, toIdx, pageIds, normalizedPag
1940
1940
  const MAX_SAFE_ITERATIONS = 1e5;
1941
1941
  while (cursorPos < fullContent.length && currentFromIdx <= toIdx && i < MAX_SAFE_ITERATIONS) {
1942
1942
  i++;
1943
- const remainingContent = fullContent.slice(cursorPos);
1943
+ const safeSliceLen = maxContentLength ? maxContentLength + 4e3 : void 0;
1944
+ const remainingContent = safeSliceLen ? fullContent.slice(cursorPos, cursorPos + safeSliceLen) : fullContent.slice(cursorPos);
1944
1945
  if (!remainingContent.trim()) break;
1945
1946
  if (handleOversizedSegmentFit(remainingContent, currentFromIdx, toIdx, pageIds, expandedBreakpoints, maxPages, maxContentLength, isFirstPiece, debugMetaKey, segment.meta, lastBreakpoint, result)) break;
1946
1947
  const windowEndIdx = computeWindowEndIdx(currentFromIdx, toIdx, pageIds, maxPages);