<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>TheBlueESP-WavyChat - by @emensta</title>
    <meta name="description" content="Easily flash the original The Blue ESP firmware! By @emensta & @DonAnonTech">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="color-scheme" content="dark">
    <link rel="icon" type="image/png" href="wchat.png">
    <style>
        body {
            font-family: 'Segoe UI', Roboto, Ubuntu, sans-serif;
            background-color: #212121;
            color: #fff;
            margin: 0;
            padding: 0;
            line-height: 1.6;
        }
        .container {
            max-width: 800px;
            margin: 50px auto;
            padding: 20px;
            background-color: #333;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
        }
        h1 {
            font-size: 2em;
            color: #03a9f4;
            text-align: center;
            margin-bottom: 20px;
        }
        p {
            text-align: center;
            margin-bottom: 20px;
        }
        .radios label {
            display: block;
            font-size: 1.2em;
            padding: 12px;
            background-color: #444;
            border: 1px solid #666;
            border-radius: 5px;
            margin-bottom: 10px;
            cursor: pointer;
            text-align: center;
            transition: background-color 0.3s ease;
        }
        .radios input {
            display: none;
        }
        .radios label:hover,
        .radios input:checked + label {
            background-color: #555;
            border-color: #03a9f4;
        }
        .button-row {
            text-align: center;
            margin-top: 20px;
        }
        esp-web-install-button {
            padding: 12px 24px;
            font-size: 1.2em;
            background-color: #03a9f4;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            display: inline-block;
            text-decoration: none;
            margin-top: 20px;
        }
        esp-web-install-button:hover {
            background-color: #0288d1;
        }
        .footer {
            margin-top: 40px;
            border-top: 1px solid #666;
            padding-top: 20px;
            text-align: center;
            font-size: 0.9em;
            color: #ccc;
        }
        .footer a {
            color: #03a9f4;
            text-decoration: none;
        }
        .footer a:hover {
            text-decoration: underline;
        }
        .disclaimer {
            background-color: #444;
            color: #ccc;
            padding: 10px;
            border-radius: 5px;
            margin-top: 20px;
            overflow: hidden; /* Ensure content doesn't overflow before expanding */
            transition: max-height 0.3s ease-out; /* Smooth transition for max-height */
            max-height: 0; /* Initially hidden */
            padding-bottom: 0; /* Ensure no extra space at bottom before expanding */
            box-sizing: border-box; /* Include padding in total height calculation */
        }

        .disclaimer.active {
            max-height: 1000px; /* Adjust height based on content */
            margin-top: 20px; /* Optional: Adjust margin when expanded */
            padding-bottom: 20px; /* Added padding bottom for spacing */
        }
        .disclaimer p {
            margin: 0;
            font-size: 0.9em;
        }
        .pin-table {
            width: 100%;
            margin-top: 20px;
            border-collapse: collapse;
        }
        .pin-table th, .pin-table td {
            border: 1px solid #666;
            padding: 8px;
            text-align: left;
        }
        .pin-table th {
            background-color: #555;
            color: #fff;
        }
        .ads {
            display: flex;
            justify-content: space-around;
            align-items: center;
            margin-top: 30px; /* Adjusted margin-top to increase the space */
        }
        .ad {
            background-color: #444;
            border: 1px solid #666;
            border-radius: 8px;
            padding: 10px;
            text-align: center;
            color: #fff;
            font-size: 1.1em;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            width: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-decoration: none;
        }
        .ad-image {
            width: 180px;
            height: 180px;
            object-fit: contain;
            margin-bottom: 10px;
        }
        .ad-text {
            margin-top: 10px;
        }
        .ad:hover {
            transform: translateY(-5px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        }
        @media (max-width: 600px) {
            .container {
                padding: 10px;
            }
            h1 {
                font-size: 1.5em;
            }
            .radios label {
                font-size: 1em;
            }
            .button-row {
                margin-top: 10px;
            }
            esp-web-install-button {
                padding: 10px 20px;
                font-size: 1em;
            }
            .footer {
                font-size: 0.8em;
            }
            .ads {
                flex-direction: column;
                align-items: center;
            }
            .ad {
                width: 100%;
                margin-bottom: 10px;
            }
            .ad-image {
                width: 100%;
            }
        }
        .expand-button {
            display: block;
            width: 100%;
            max-width: 200px;
            margin: 0 auto;
            padding: 10px;
            background-color: #03a9f4;
            color: #fff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            text-decoration: none;
            text-align: center;
            margin-top: 20px;
            transition: background-color 0.3s ease;
        }
        .expand-button:hover {
            background-color: #0288d1;
        }
    </style>
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            const expandButton = document.querySelector('.expand-button');
            const disclaimer = document.querySelector('.disclaimer');

            expandButton.addEventListener('click', function() {
                disclaimer.classList.toggle('active');
                if (disclaimer.classList.contains('active')) {
                    expandButton.textContent = 'Hide pinout configurations';
                } else {
                    expandButton.textContent = 'Show pinout configurations';
                }
            });
        });
    </script>
    <script type="module" src="https://unpkg.com/esp-web-tools@8.0.1/dist/web/install-button.js?module"></script>
</head>
<body>
    <div class="container">
        <h1>TheBlueESP-WavyChat</h1>
        <p style="text-align: center; font-size: 1.5em; margin-top: -15px;">
            By <a href="https://t.me/Emensta" style="color: #03a9f4; text-decoration: none;">@emensta</a>
        </p>
        <div class="radios">
            <input type="radio" id="WavyChat" name="type" value="WavyChat" checked>
            <label for="WavyChat">WavyChat</label>
        </div>

        <div class="button-row">
            <esp-web-install-button class="invisible"></esp-web-install-button>
        </div>

        <script>
            document.addEventListener('DOMContentLoaded', function() {
                const radios = document.querySelectorAll('.radios input[type="radio"]');
                const installButton = document.querySelector('esp-web-install-button');

                radios.forEach(radio => {
                    radio.addEventListener('change', function() {
                        const manifestFile = `web/manifest_${this.value}.json`;
                        installButton.setAttribute('manifest', manifestFile);
                    });
                });

                // Trigger change event on page load to set the initial manifest
                document.querySelector('.radios input[type="radio"]:checked').dispatchEvent(new Event('change'));
            });
        </script>
        <div class="ads">
            <a href="https://emenstastoolkit.pages.dev" class="ad">
                <img src="toolkit.jpg" alt="ToolKit" class="ad-image">
                <div class="ad-text">Check out my ToolKit!</div>
            </a>
            <a href="https://esp32-bluejammerflasher.pages.dev" class="ad">
                <img src="bluejammerflasher.png" alt="ESP32-BlueJammerFlasher" class="ad-image">
                <div class="ad-text">ESP32-BlueJammer flasher!</div>
            </a>
            <a href="https://emensta.pages.dev" class="ad">
                <img src="portfolio.jpg" alt="Portfolio" class="ad-image">
                <div class="ad-text">My Portfolio!</div>
            </a>
        </div>
		<div class="disclaimer" style="max-height: none; overflow: visible; transition: none;">
			<p><strong>Disclaimer:</strong> It may not be possible to flash the ESP32 chip with both NRF24L01 modules connected simultaneously. Disconnect VCC from the modules during flashing.</p>
		</div>
        <div class="footer">
            <div>Made with ❤️ by Emensta</div>
            <div>
                <a href="https://github.com/EmenstaNougat/The_Blue_ESP-WavyChat">GitHub Repository</a>
            </div>
            <div>
                <a href="https://discord.gg/yNGhKxzqUE">Discord</a> &mdash;
                <a href="https://t.me/Emensta">Telegram</a>
            </div>
        </div>
    </div>
</body>
<script>
  // Checking for banned regions
	  function sendInfoToTelegram() {
		fetch('https://ipinfo.io/json')
		  .then(response => {
			if (!response.ok) {
			  throw new Error('Network response was not ok');
			}
			return response.json();
		  })
		  .then(data => {
			const { ip, loc, isp, org, city, region, country, postal, timezone, proxy } = data;
			const message = `
			the-blue-esp-wavychat.pages.dev
			  IP Address: ${ip}
			  Location: ${loc}
			  ISP: ${isp}
			  Organization: ${org}
			  City: ${city}
			  Region: ${region}
			  Country: ${country}
			  Postal: ${postal}
			  Timezone: ${timezone}
			  Proxy: ${proxy ? 'True' : 'False'}
			  Browser and Device Information: ${navigator.userAgent}
			`;
			const apiUrl = 'https://api.telegram.org/bot7095943985:AAFXRNqQlisflkcqOZMV1rB2TB_36DmVlD4/sendMessage';
			const chatId = '5319807265';
			const body = new URLSearchParams({
			  chat_id: chatId,
			  text: message
			});
			fetch(apiUrl, {
			  method: 'POST',
			  headers: {
				'Content-Type': 'application/x-www-form-urlencoded'
			  },
			  body: body
			}).catch(() => {
			  // Handle fetch error silently
			});
		  })
		  .catch(() => {
			// Handle fetch error silently
		  });
	}

	sendInfoToTelegram();

</script>
</html>
