{"version":3,"file":"mapChangedLinesToBlocks.mjs","names":[],"sources":["../../../src/docReview/mapChangedLinesToBlocks.ts"],"sourcesContent":["import type { Block, LineChange } from './types';\n\n/**\n * Map a set of changed line numbers onto the indexes of the blocks that contain\n * them.\n *\n * @param blocks - The ordered blocks of the base document.\n * @param changedLines - 1-based line numbers that changed in the base document.\n * @returns The set of block indexes touched by at least one changed line.\n */\nexport const mapChangedLinesToBlocks = (\n  blocks: Block[],\n  changedLines: LineChange[]\n): Set<number> => {\n  const changedSet = new Set<number>();\n  if (!changedLines || changedLines.length === 0) return changedSet;\n\n  const changedLookup = new Set<number>(changedLines);\n\n  blocks.forEach((block, index) => {\n    for (let line = block.lineStart; line <= block.lineEnd; line += 1) {\n      if (changedLookup.has(line)) {\n        changedSet.add(index);\n        break;\n      }\n    }\n  });\n\n  return changedSet;\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,2BACX,QACA,iBACgB;CAChB,MAAM,6BAAa,IAAI,IAAY;CACnC,IAAI,CAAC,gBAAgB,aAAa,WAAW,GAAG,OAAO;CAEvD,MAAM,gBAAgB,IAAI,IAAY,YAAY;CAElD,OAAO,SAAS,OAAO,UAAU;EAC/B,KAAK,IAAI,OAAO,MAAM,WAAW,QAAQ,MAAM,SAAS,QAAQ,GAC9D,IAAI,cAAc,IAAI,IAAI,GAAG;GAC3B,WAAW,IAAI,KAAK;GACpB;EACF;CAEJ,CAAC;CAED,OAAO;AACT"}