import { applyPatch, createPatch } from "diff";
/**
 * Applies a suggestion's line-based change to the current field value.
 *
 * Suggestion compatibility is determined by the lines the suggestion actually
 * changes. Including diff's default surrounding context makes independent
 * edits conflict on short fields (for example, changing line one and line
 * three of a three-line value), because every unchanged line becomes part of
 * both patches.
 */
export function applySuggestionPatchToValue(currentValue, oldValue, newValue) {
    const patch = createPatch("field", oldValue, newValue, undefined, undefined, {
        context: 0,
    });
    return applyPatch(currentValue, patch);
}
//# sourceMappingURL=suggestionPatch.js.map