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

// Find occurrences of `Re` where it represents the variable
let idx = 0;
const results = [];
while ((idx = content.indexOf('Re', idx)) !== -1) {
  // Check if it's a standalone variable or part of a destructuring list
  const charBefore = content[idx - 1];
  const charAfter = content[idx + 2];
  const isWord = /[^a-zA-Z0-9_$]/.test(charBefore) && /[^a-zA-Z0-9_$]/.test(charAfter);
  if (isWord) {
    results.push({ index: idx, snippet: content.substring(idx - 100, idx + 100) });
  }
  idx += 2;
}

console.log(`Total standalone occurrences of 'Re': ${results.length}`);
results.forEach((res, i) => {
  console.log(`${i+1}. Index ${res.index}:`);
  console.log(res.snippet);
  console.log('---------------------------');
});
