const fs = require('fs');
const content = fs.readFileSync('dist/assets/index-D9sWWWv_.js', 'utf8');

// Find all occurrences where O is called with a list containing spread of something,
// which is typically how vouchers state is updated, or look for updates to vouchers state.
// We know O is the setter for vouchers because O is the 2nd element of useState for vouchers.
// Let's search for "O(" in the file.
const regex = /O\(\s*[^)]*\[[^]]{0,100}/g;
let match;
console.log("Searching for O(...) calls:");
while ((match = regex.exec(content)) !== null) {
  const idx = match.index;
  console.log(`\nMatch at index ${idx}:`);
  console.log(content.substring(idx - 100, idx + 200));
}
