/**
 * Test to verify debug mode detection
 * Run in browser console after accessing ?debug=true
 */

// Test URL parsing
function testDebugDetection() {
  console.log('=== DEBUG MODE DETECTION TEST ===');
  console.log('window.location.href:', window.location.href);
  console.log('window.location.search:', window.location.search);
  console.log('window.location.hash:', window.location.hash);

  const urlParams = new URLSearchParams(window.location.search);
  const debugKey = Array.from(urlParams.keys()).find(
    (k) => k.toLowerCase() === "debug",
  );

  console.log('debugKey found:', debugKey);
  console.log('debugKey value:', urlParams.get(debugKey));

  const isDebug = urlParams.get(debugKey)?.toLowerCase() === "true";
  console.log('isDebugMode:', isDebug);

  // Also test if passing via hash works
  const hashParams = new URLSearchParams(window.location.hash.split('?')[1]);
  const debugKeyHash = Array.from(hashParams.keys()).find(
    (k) => k.toLowerCase() === "debug",
  );
  console.log('\n--- Via Hash ---');
  console.log('debugKeyHash found:', debugKeyHash);
  console.log('debugKeyHash value:', hashParams.get(debugKeyHash));
}

// Run it
testDebugDetection();
