var LAST_BLOCK_THROTTLE_CHARS = 20;
var BLOCK_BOUNDARY_TRIGGERS = /[\n`|#>*\-!~]/;
var INLINE_CONTEXT_TRIGGERS = /(?:^|\s)[$[]/;
/**
 * 流式末块：是否应重新 parse（相对上一次已 parse 的源）。
 */ export var shouldReparseLastBlock = function shouldReparseLastBlock(prevParsedSource, newSource, streaming) {
    if (!streaming) return true;
    if (!prevParsedSource) return true;
    if (newSource.length < prevParsedSource.length) return true;
    if (!newSource.startsWith(prevParsedSource)) return true;
    var added = newSource.slice(prevParsedSource.length);
    if (added.length >= LAST_BLOCK_THROTTLE_CHARS) return true;
    if (BLOCK_BOUNDARY_TRIGGERS.test(added)) return true;
    if (INLINE_CONTEXT_TRIGGERS.test(added)) return true;
    return false;
};
