
//#region src/translation-alignment/planActions.ts
const planAlignmentActions = (alignment, changedEnglishBlockIndexes, similarityOptions) => {
	const actions = [];
	const seenFrench = /* @__PURE__ */ new Set();
	alignment.forEach((pair) => {
		const englishIndex = pair.englishIndex;
		const frenchIndex = pair.frenchIndex;
		if (englishIndex === -1 && frenchIndex !== null) {
			if (!seenFrench.has(frenchIndex)) {
				actions.push({
					kind: "delete",
					frenchIndex
				});
				seenFrench.add(frenchIndex);
			}
			return;
		}
		if (englishIndex >= 0 && frenchIndex === null) {
			actions.push({
				kind: "insert_new",
				englishIndex
			});
			return;
		}
		if (englishIndex >= 0 && frenchIndex !== null) {
			const isChanged = changedEnglishBlockIndexes.has(englishIndex);
			const isHighSimilarity = pair.similarityScore >= similarityOptions.minimumMatchForReuse;
			if (!isChanged && isHighSimilarity) actions.push({
				kind: "reuse",
				englishIndex,
				frenchIndex
			});
			else actions.push({
				kind: "review",
				englishIndex,
				frenchIndex
			});
			seenFrench.add(frenchIndex);
			return;
		}
	});
	return { actions };
};

//#endregion
exports.planAlignmentActions = planAlignmentActions;
//# sourceMappingURL=planActions.cjs.map