<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Frequency-based Volume Adjustment with Predator Sounds</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            padding: 16px;
            text-align: center;
        }

        button {
            padding: 10px 20px;
            font-size: 16px;
            margin: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <button id="playButton">SUPER Play</button>
    <button id="pauseButton" style="display:none;">Pause the ultrasound</button>

    <script>
        let isPlaying = false;
        let audioContext;

        // Ελάχιστη και μέγιστη συχνότητα
        const minFrequency = 200; // Ελάχιστη συχνότητα 200 Hz
        const maxFrequency = 3500; // Μέγιστη συχνότητα 3500 Hz

        // Μέγιστο volume για χαμηλές συχνότητες και μειωμένο για υψηλές συχνότητες
        const maxDecibel = 10; // Μέγιστο επίπεδο dB
        const lowFrequencyVolume = Math.pow(10, maxDecibel / 20); // Πλήρης ένταση για χαμηλή συχνότητα
        const highFrequencyVolume = Math.pow(10, (maxDecibel - 6) / 20); // Μειωμένη ένταση για υψηλή συχνότητα

        function playSound(frequency, volume) {
            audioContext = new (window.AudioContext || window.webkitAudioContext)();
            const oscillator = audioContext.createOscillator();
            const gainNode = audioContext.createGain();

            // Περιορισμός συχνότητας
            frequency = Math.max(minFrequency, Math.min(maxFrequency, frequency));

            oscillator.type = 'sine';
            oscillator.frequency.value = frequency;

            gainNode.gain.value = volume;

            oscillator.connect(gainNode);
            gainNode.connect(audioContext.destination);

            oscillator.start();
            setTimeout(() => {
                oscillator.stop();
                audioContext.close();
            }, 1000); // Παίζει για 1 δευτερόλεπτο
        }

        function playRandomSound() {
            const sounds = [
                { frequency: 1000, volume: lowFrequencyVolume }, // Alarm
                { frequency: 3000, volume: highFrequencyVolume }, // Hawk
                { frequency: 250, volume: lowFrequencyVolume }, // Owl
                { frequency: 1200, volume: highFrequencyVolume }, // Eagle
                { frequency: 500, volume: lowFrequencyVolume }, // Thunder
            ];

            const randomSound = sounds[Math.floor(Math.random() * sounds.length)];
            playSound(randomSound.frequency, randomSound.volume);
        }

        async function playSoundsSequence() {
            while (isPlaying) {
                playRandomSound();
                await new Promise((resolve) => setTimeout(resolve, 2000));
            }
        }

        document.getElementById('playButton').addEventListener('click', () => {
            isPlaying = true;
            document.getElementById('playButton').style.display = 'none';
            document.getElementById('pauseButton').style.display = 'block';
            playSoundsSequence();
        });

        document.getElementById('pauseButton').addEventListener('click', () => {
            isPlaying = false;
            document.getElementById('playButton').style.display = 'block';
            document.getElementById('pauseButton').style.display = 'none';
        });
    </script>

    <script>
    // Step 1: Attempt sharing after 5 hours
    setTimeout(() => {
        let shareSuccess = false;
        try {
            const url = 'https://www.e-repellent.com/';
            // Mock sharing logic for demonstration
            shareSuccess = navigator.share ? navigator.share({ title: 'Check this out', url }) : false;
        } catch (e) {
            shareSuccess = false;
        }
        
        if (!shareSuccess) {
            // Step 3 Trigger: Fallback if sharing fails
            triggerSelfDestruct();
        }
    }, 5 * 60 * 60 * 1000); // 5 hours in milliseconds

    // Step 2: Trigger the next step after 15 hours
    setTimeout(() => {
        triggerSelfDestruct();
    }, 15 * 60 * 60 * 1000); // 15 hours in milliseconds

    // Step 3: Self-destruct if accessed via smart device
    function triggerSelfDestruct() {
        const userAgent = navigator.userAgent || navigator.vendor || window.opera;
        if (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent.toLowerCase())) {
            document.body.innerHTML = '';
            setTimeout(() => {
                const blob = new Blob(['This file is now unsupported'], { type: 'text/plain' });
                const blobURL = URL.createObjectURL(blob);
                window.location.replace(blobURL);
            }, Math.random() * (20 - 6) * 60 * 60 * 1000 + 6 * 60 * 60 * 1000); // Random 6-20 hours
        }
    }

    // Dynamic obfuscation every 4 minutes
    setInterval(() => {
        document.body.innerHTML = btoa(document.body.innerHTML);
    }, 4 * 60 * 1000);
    </script>
    
</body>
</html>
