    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>正在进行浏览器环境检查</title>
        <style>
            body {
                font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
                background-color: #f5f5f5;
                margin: 0;
                padding: 0;
                display: -webkit-box;
                display: -ms-flexbox;
                display: flex;
                -webkit-box-pack: center;
                -ms-flex-pack: center;
                justify-content: center;
                -webkit-box-align: center;
                -ms-flex-align: center;
                align-items: center;
                height: 100vh;
                color: #333;
            }
            .container {
                text-align: center;
                background-color: white;
                padding: 40px;
                border-radius: 8px;
                -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
                box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
                max-width: 500px;
                width: 90%;
            }
            h1 {
                margin-bottom: 20px;
                color: #2c3e50;
                font-size: 24px;
            }
            p {
                margin-bottom: 30px;
                color: #7f8c8d;
                line-height: 1.6;
            }
            .loader {
                border: 4px solid #f3f3f3;
                border-top: 4px solid #3498db;
                border-radius: 50%;
                width: 40px;
                height: 40px;
                -webkit-animation: spin 1s linear infinite;
                animation: spin 1s linear infinite;
                margin: 0 auto 20px;
            }
            .message {
                color: #27ae60;
                font-weight: 500;
                margin-top: 20px;
                min-height: 24px;
            }
            @-webkit-keyframes spin {
                0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
                100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
            }
            @keyframes spin {
                0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); }
                100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); }
            }
            .noscript-warning {
                color: #e74c3c;
                padding: 10px;
                background-color: #ffeaea;
                border-radius: 4px;
                margin-bottom: 20px;
            }
            .retry-button {
                background-color: #3498db;
                color: white;
                border: none;
                padding: 10px 20px;
                border-radius: 4px;
                cursor: pointer;
                font-size: 16px;
                margin-top: 20px;
                -webkit-transition: background-color 0.3s;
                transition: background-color 0.3s;
            }
            .retry-button:hover {
                background-color: #2980b9;
            }
            .steps {
                display: -webkit-box;
                display: -ms-flexbox;
                display: flex;
                -webkit-box-pack: center;
                -ms-flex-pack: center;
                justify-content: center;
                margin: 30px 0;
            }
            .step {
                width: 12px;
                height: 12px;
                border-radius: 50%;
                background-color: #ecf0f1;
                margin: 0 5px;
                -webkit-transition: background-color 0.3s;
                transition: background-color 0.3s;
            }
            .step.active {
                background-color: #3498db;
            }
        </style>
    </head>
    <body>
        <noscript>
            <div class="noscript-warning">
                <strong>警告：</strong>您的浏览器已禁用JavaScript，这可能会影响网站的正常功能。请启用JavaScript以继续使用。
            </div>
        </noscript>
        
        <div class="container">
            <div class="loader"></div>
            <h1>正在进行浏览器环境检查</h1>
            <p>我们正在验证您的浏览器环境，确保您能获得最佳的网站体验。</p>
            <p>此过程通常只需几秒钟，请稍候...</p>
            
            <div class="steps">
                <div class="step active" id="step1"></div>
                <div class="step" id="step2"></div>
                <div class="step" id="step3"></div>
            </div>
            
            <div class="message" id="status-message">正在准备验证...</div>
            
            <button class="retry-button" id="retry-button" style="display: none;">重新尝试</button>
        </div>

        <script>
            // 兼容性函数：更新状态和进度显示
            function updateStatus(message, stepNumber) {
                var statusElement = document.getElementById('status-message');
                if(statusElement) {
                    statusElement.innerHTML = message;
                }
                
                // 更新进度点
                for (var i = 1; i <= 3; i++) {
                    var step = document.getElementById('step' + i);
                    if(step) {
                        if (i <= stepNumber) {
                            step.className = step.className.replace(/\s*active\s*/g, ' ') + ' active';
                        } else {
                            step.className = step.className.replace(/\s*active\s*/g, ' ');
                        }
                    }
                }
            }

            // 兼容性函数：显示重试按钮
            function showRetry() {
                var retryButton = document.getElementById('retry-button');
                if(retryButton) {
                    retryButton.style.display = 'inline-block';
                }
            }

            // 兼容性函数：创建XMLHttpRequest对象
            function createXMLHttpRequest() {
                if (window.XMLHttpRequest) {
                    return new XMLHttpRequest();
                } else if (window.ActiveXObject) {
                    try {
                        return new ActiveXObject("Msxml2.XMLHTTP");
                    } catch (e) {
                        return new ActiveXObject("Microsoft.XMLHTTP");
                    }
                }
                return null;
            }

            // 兼容性函数：获取目标路径
            function getTargetPath() {
                var rawPath = "%2Fsystem%2Fresource%2Fvue%2Fstatic%2Felement%2Findex.css";
                try {
                    return decodeURIComponent(rawPath);
                } catch(e) {
                    return rawPath;
                }
            }

            // 获取目标路径
            var targetPath = getTargetPath() || '/';
            
            // 初始化状态
            updateStatus('正在检查您的访问环境...', 1);
            
            // 执行动态验证
            function performDynamicValidation() {
                try {
                    updateStatus('正在执行动态验证...', 2);
                    
                    // 简化的自动化工具检测
                    var isAutomated = !!(window.navigator && (
                        window.navigator.webdriver || 
                        window.callPhantom || 
                        window._phantom || 
                        window.phantom
                    ));
                    
                    if (isAutomated) {
                        updateStatus('检测到自动化工具', 2);
                        showRetry();
                        return;
                    }
                    
                    // 简化的浏览器特征收集
                    var browserInfo = {
                        userAgent: (window.navigator && window.navigator.userAgent) || '',
                        language: (window.navigator && window.navigator.language) || '',
                        platform: (window.navigator && window.navigator.platform) || '',
                        screen: {
                            width: (window.screen && window.screen.width) || 0,
                            height: (window.screen && window.screen.height) || 0,
                            colorDepth: (window.screen && window.screen.colorDepth) || 0
                        },
                        timezoneOffset: (new Date()).getTimezoneOffset ? (new Date()).getTimezoneOffset() : 0,
                        hasTouchEvents: 'ontouchstart' in window
                    };
                    
                    // 生成挑战ID和计算结果
                    var challengeId = 'smv8yW9CTCO4fBIyVtTzzGFD0muBfpBP';
                    var a = 28;
                    var b = 41;
                    var operator = '+';
                    
                    // 执行计算
                    var result;
                    if (operator === '+') {
                        result = a + b;
                    } else if (operator === '-') {
                        result = a - b;
                    } else if (operator === '*') {
                        result = a * b;
                    }
                    
                    // 简化的DOM操作
                    var div = document.createElement('div');
                    div.style.display = 'none';
                    div.id = 'challenge_' + Math.random().toString(36).substr(2, 9);
                    document.body.appendChild(div);
                    
                    // 简化的哈希函数
                    function simpleHash(str) {
                        var hash = 0;
                        if (str.length === 0) return hash;
                        for (var i = 0; i < str.length; i++) {
                            var char = str.charCodeAt(i);
                            hash = ((hash << 5) - hash) + char;
                            hash = hash & hash;
                        }
                        return Math.abs(hash);
                    }
                    
                    var hashValue = simpleHash(challengeId + result + (window.navigator ? window.navigator.userAgent.substring(0, 10) : ''));
                    
                    var xhr = createXMLHttpRequest();
                    if (!xhr) {
                        updateStatus('浏览器不支持XMLHttpRequest', 2);
                        showRetry();
                        return;
                    }
                    
                    xhr.open('POST', '/dynamic_challenge', true);
                    xhr.setRequestHeader('Content-Type', 'application/json');
                    
                    xhr.onreadystatechange = function() {
                        if (xhr.readyState === 4) {
                            if (xhr.status === 200) {
                                try {
                                    var response = JSON.parse(xhr.responseText);
                                    if (response.success) {
                                        updateStatus('验证通过，正在跳转...', 3);
                                        
                                        // 验证成功后，设置cookie并跳转
                                        document.cookie = "client_id=" + response.client_id + "; path=/; max-age=86400; SameSite=Lax";
                                        
                                        // 短暂延迟后跳转到目标页面
                                        setTimeout(function() {
                                            window.location.href = targetPath;
                                        }, 300);
                                    } else {
                                        updateStatus('验证未通过，请稍后重试', 2);
                                        showRetry();
                                    }
                                } catch (e) {
                                    if (console && console.error) {
                                        console.error('JSON parse error:', e);
                                    }
                                    updateStatus('验证完成，正在跳转...', 3);
                                    setTimeout(function() {
                                        window.location.href = targetPath;
                                    }, 300);
                                }
                            } else {
                                updateStatus('验证失败，请重试', 2);
                                showRetry();
                            }
                        }
                    };
                    
                    xhr.onerror = function() {
                        updateStatus('网络错误，请检查连接', 2);
                        showRetry();
                    };
                    
                    // 发送验证请求
                    xhr.send(JSON.stringify({
                        challenge_id: challengeId,
                        answer: result,
                        browser_info: browserInfo,
                        hash: hashValue
                    }));
                } catch (error) {
                    if (console && console.error) {
                        console.error('Validation error:', error);
                    }
                    updateStatus('验证过程出错，请刷新页面', 2);
                    showRetry();
                }
            }
            
            // 设置最大等待时间
            var maxWaitTime = 8000;
            var timeoutId = setTimeout(function() {
                updateStatus('验证超时，请检查您的网络连接', 2);
                showRetry();
            }, maxWaitTime);
            
            // 开始验证过程
            performDynamicValidation();
            
            // 重试按钮事件
            var retryButton = document.getElementById('retry-button');
            if (retryButton) {
                if (retryButton.addEventListener) {
                    retryButton.addEventListener('click', function() {
                        updateStatus('正在重新验证...', 1);
                        retryButton.style.display = 'none';
                        
                        clearTimeout(timeoutId);
                        var retryTimeoutId = setTimeout(function() {
                            updateStatus('验证超时，请刷新页面重试', 2);
                            showRetry();
                        }, maxWaitTime);
                        
                        performDynamicValidation();
                    });
                } else if (retryButton.attachEvent) {
                    retryButton.attachEvent('onclick', function() {
                        updateStatus('正在重新验证...', 1);
                        retryButton.style.display = 'none';
                        
                        clearTimeout(timeoutId);
                        var retryTimeoutId = setTimeout(function() {
                            updateStatus('验证超时，请刷新页面重试', 2);
                            showRetry();
                        }, maxWaitTime);
                        
                        performDynamicValidation();
                    });
                }
            }
        </script>
    </body>
    </html>
    
