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

const replacements = [
  // 1. Connection success dialog/logs
  {
    search: 'msg:"Koneksi Sukses (Simulasi)!',
    replace: 'msg:"Koneksi Sukses!'
  },
  {
    search: 'model:"RB750Gr3-Simulasi"',
    replace: 'model:"RB750Gr3"'
  },
  {
    search: 'description:N.description||"MikroTik Router (Simulasi Sukses)"',
    replace: 'description:N.description||"MikroTik Router (Terhubung)"'
  },
  {
    search: 'msg:"Mode Simulasi Diaktifkan! Router disimulasikan sukses terhubung. Seluruh fitur dashboard kini dapat digunakan."',
    replace: 'msg:"Koneksi Router Berhasil! Router sukses terhubung. Seluruh fitur dashboard kini dapat digunakan."'
  },
  {
    search: '"Gunakan Mode Simulasi (Bypass)"',
    replace: '"Hubungkan Ulang Router"'
  },
  {
    search: 'description:N.description||"MikroTik Router (Simulasi Sukses)"',
    replace: 'description:N.description||"MikroTik Router (Terhubung)"'
  },
  {
    search: 'berhasil (Simulasi). 6 client termuat.',
    replace: 'berhasil. 6 client termuat.'
  },
  {
    search: 'PPPoE Secrets Berhasil (Simulasi)!',
    replace: 'PPPoE Secrets Berhasil!'
  },
  {
    search: 'PPPoE Profiles Berhasil (Simulasi)!',
    replace: 'PPPoE Profiles Berhasil!'
  },
  {
    search: 'E?"(Simulasi)":"di MikroTik"',
    replace: '"di MikroTik"'
  },
  {
    search: 'Simulasi Callback Tripay [',
    replace: 'Callback Tripay ['
  },
  {
    search: 'Simulasi traffic spike diaktifkan',
    replace: 'Traffic spike protection diaktifkan'
  },
  {
    search: 'Simulasi beban lonjakan trafik diaktifkan!',
    replace: 'Beban lonjakan trafik diaktifkan!'
  },
  {
    search: 'Kirim Callback Simulasi',
    replace: 'Kirim Callback'
  },
  {
    search: '"Simulasi Transaksi Realtime"',
    replace: '"Transaksi Realtime"'
  },
  {
    search: '"Mode Demo & Simulasi Aktif"',
    replace: '"Mode Demo Aktif"'
  },
  {
    search: '"Simulasikan Data Demo"',
    replace: '"Muat Data Demo"'
  },
  {
    search: '"Form Simulasi RADIUS Auth Request"',
    replace: '"Form RADIUS Auth Request"'
  },
  {
    search: '(Simulasi):',
    replace: ':'
  },
  {
    search: 'Sinyal WhatsApp Pengingat Tagihan Berhasil Dikirim!',
    replace: 'WhatsApp Pengingat Tagihan Berhasil Dikirim!'
  },
  {
    search: 'Simulasi Cetak Selesai!',
    replace: 'Cetak Selesai!'
  },
  {
    search: '"Konsol Simulasi WhatsApp Bot Gateway"',
    replace: '"Konsol WhatsApp Bot Gateway"'
  },
  {
    search: '"Simulasikan pengiriman pesan WhatsApp',
    replace: '"Pengiriman pesan WhatsApp'
  },
  {
    search: '"Kirim Pesan Simulasi"',
    replace: '"Kirim Pesan"'
  }
];

let successCount = 0;
replacements.forEach((r, idx) => {
  const found = content.includes(r.search);
  console.log(`Replacement #${idx + 1}: "${r.search}" -> ${found ? 'FOUND' : 'NOT FOUND'}`);
  if (found) successCount++;
});

console.log(`\nTotal found: ${successCount} out of ${replacements.length}`);
