const require_rebuildDocument = require('./rebuildDocument.cjs');
const require_alignBlocks = require('./alignBlocks.cjs');
const require_fingerprintBlock = require('./fingerprintBlock.cjs');
const require_mapChangedLinesToBlocks = require('./mapChangedLinesToBlocks.cjs');
const require_normalizeBlock = require('./normalizeBlock.cjs');
const require_planActions = require('./planActions.cjs');
const require_segmentDocument = require('./segmentDocument.cjs');

//#region ../@intlayer/cli/dist/esm/translation-alignment/pipeline.mjs
const buildAlignmentPlan = ({ englishText, frenchText, changedLines, similarityOptions }) => {
	const englishBlocksRaw = require_segmentDocument.segmentDocument(englishText);
	const frenchBlocksRaw = require_segmentDocument.segmentDocument(frenchText);
	const englishNormalized = englishBlocksRaw.map(require_normalizeBlock.normalizeBlock);
	const frenchNormalized = frenchBlocksRaw.map(require_normalizeBlock.normalizeBlock);
	const englishBlocks = englishNormalized.map((block, index, array) => require_fingerprintBlock.fingerprintBlock(block, array[index - 1] ?? null, array[index + 1] ?? null));
	const frenchBlocks = frenchNormalized.map((block, index, array) => require_fingerprintBlock.fingerprintBlock(block, array[index - 1] ?? null, array[index + 1] ?? null));
	const plan = require_planActions.planAlignmentActions(require_alignBlocks.alignEnglishAndFrenchBlocks(englishBlocks, frenchBlocks), require_mapChangedLinesToBlocks.mapChangedLinesToBlocks(englishBlocks, Array.isArray(changedLines) ? changedLines : []), {
		minimumMatchForReuse: similarityOptions?.minimumMatchForReuse ?? .9,
		minimumMatchForNearDuplicate: similarityOptions?.minimumMatchForNearDuplicate ?? .8
	});
	const { segmentsToReview } = require_rebuildDocument.identifySegmentsToReview({
		englishBlocks,
		frenchBlocks,
		plan
	});
	return {
		englishBlocks,
		frenchBlocks,
		plan,
		segmentsToReview
	};
};

//#endregion
exports.buildAlignmentPlan = buildAlignmentPlan;
//# sourceMappingURL=pipeline.cjs.map