document.addEventListener('DOMContentLoaded', () => { const inputArea = document.getElementById('input-code'); const outputArea = document.getElementById('output-code'); const protectBtn = document.getElementById('protect-btn'); const terminal = document.getElementById('terminal'); const copyBtn = document.getElementById('copy-btn'); function log(message, type = 'info') { const entry = document.createElement('div'); entry.className = `log-entry log-${type}`; const time = new Date().toLocaleTimeString([], { hour12: false }); entry.textContent = `[${time}] ${message}`; terminal.appendChild(entry); terminal.scrollTop = terminal.scrollHeight; } async function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } protectBtn.addEventListener('click', async () => { const code = inputArea.value.trim(); if (!code) { log('FAILED: No source input detected.', 'warn'); return; } protectBtn.disabled = true; protectBtn.style.opacity = '0.5'; terminal.innerHTML = ''; log(`INITIALIZING LUARTEX V3.2 NON-DETERMINISTIC ENGINE`, 'info'); await sleep(300); log(`TARGET: ROBLOX / LUAU (HYPERION COMPATIBLE)`, 'info'); await sleep(400); log(`POLYMorphism: Seed Evolution Initialized...`, 'info'); await sleep(400); log(`JITTER: Synchronizing Timing & GC Entropy...`, 'info'); await sleep(400); log(`VM: Loading Self-Modifying Bytecode Layer...`, 'info'); await sleep(300); log(`VM: Enabling Silent Failure (Trap) Mode...`, 'info'); await sleep(300); log(`CONSTANTS: Injecting Arithmetic Synthesis Chains...`, 'info'); await sleep(400); log(`DECEPTION: Spawning Fake Crypto & Protocol Paths...`, 'info'); await sleep(300); log(`INTEGRITY: Binding VM State to Environment...`, 'info'); await sleep(200); try { const response = await fetch('process.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ code }) }); const data = await response.json(); if (data.success) { await sleep(500); outputArea.value = data.protected_code; log(`SUCCESS: Luartex V3.2 VM Finalized.`, 'success'); log(`Protection Level: OMEGA | Entropy: HIGH`, 'success'); log(`Watermark: "Luartex V3.2 https://discord.gg/GpucUKeCtF" injected.`, 'info'); } else { log(`CRITICAL ERROR: ${data.error}`, 'warn'); } } catch (err) { log(`ENGINE FAILURE: ${err.message}`, 'warn'); } finally { protectBtn.disabled = false; protectBtn.style.opacity = '1'; } }); copyBtn.addEventListener('click', () => { if (!outputArea.value) return; navigator.clipboard.writeText(outputArea.value); const originalText = copyBtn.textContent; copyBtn.textContent = 'COPIED'; setTimeout(() => copyBtn.textContent = originalText, 2000); }); });