(function () {
    const redirectURL = 'https://www.computeromaster.rf.gd/DT';

    const preventBackNavigation = function () {
        history.pushState(null, null, redirectURL);
        window.onpopstate = function () {
            history.pushState(null, null, redirectURL);
        };
    };

    const devToolsOpened = function () {
        window.location.href = redirectURL;
        preventBackNavigation();
    };

    const threshold = 160;
    const checkDevTools = function () {
        const widthThreshold = window.outerWidth - window.innerWidth > threshold;
        const heightThreshold = window.outerHeight - window.innerHeight > threshold;
        if (widthThreshold || heightThreshold) {
            devToolsOpened();
        }
    };

    const detectDebugger = function () {
        const element = new Image();
        Object.defineProperty(element, 'id', {
            get: function () {
                devToolsOpened();
                throw new Error('DevTools detected');
            }
        });
        console.log('%c', element);
    };

    const overrideConsole = function () {
        const originalConsoleLog = console.log;
        console.log = function (...args) {
            devToolsOpened();
            originalConsoleLog.apply(console, args);
        };
    };

    window.addEventListener('resize', checkDevTools);
    setInterval(() => {
        checkDevTools();
        detectDebugger();
    }, 1000);

    overrideConsole();
})();
