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

// Find keywords related to login, registration, register
const keywords = [
  'Daftar Akun',
  'Pendaftaran',
  'register',
  'Register'
];

keywords.forEach(kw => {
  let idx = 0;
  let matches = [];
  while ((idx = content.indexOf(kw, idx)) !== -1) {
    matches.push(idx);
    idx += kw.length;
  }
  console.log(`Keyword "${kw}": found ${matches.length} matches`);
  if (matches.length > 0) {
    console.log(`Snippet of first match of "${kw}":`);
    const firstIdx = matches[0];
    const start = Math.max(0, firstIdx - 150);
    const end = Math.min(content.length, firstIdx + 150);
    console.log(content.substring(start, end));
    console.log('--------------------------------------------------');
  }
});
