Spaces:
Running

File size: 6,927 Bytes
ad445a1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
document.addEventListener('DOMContentLoaded', function() {
    // Initialize radar canvas
    const canvas = document.getElementById('radarCanvas');
    const ctx = canvas.getContext('2d');
    
    // Set canvas to full container size
    function resizeCanvas() {
        const container = document.querySelector('.radar-container');
        canvas.width = container.clientWidth;
        canvas.height = container.clientHeight;
        drawRadar();
    }
    
    // Draw radar background
    function drawRadar() {
        if (!canvas) return;
        
        const centerX = canvas.width / 2;
        const centerY = canvas.height / 2;
        const radius = Math.min(canvas.width, canvas.height) / 2 - 20;
        
        // Clear canvas
        ctx.clearRect(0, 0, canvas.width, canvas.height);
        
        // Draw concentric circles
        ctx.strokeStyle = 'rgba(99, 102, 241, 0.3)';
        ctx.lineWidth = 1;
        
        for (let i = 1; i <= 4; i++) {
            const r = radius * (i / 4);
            ctx.beginPath();
            ctx.arc(centerX, centerY, r, 0, 2 * Math.PI);
            ctx.stroke();
        }
        
        // Draw cross lines
        ctx.beginPath();
        ctx.moveTo(centerX, centerY - radius);
        ctx.lineTo(centerX, centerY + radius);
        ctx.moveTo(centerX - radius, centerY);
        ctx.lineTo(centerX + radius, centerY);
        ctx.stroke();
        
        // Draw sweep line
        ctx.strokeStyle = 'rgba(99, 102, 241, 0.7)';
        ctx.lineWidth = 2;
        ctx.beginPath();
        ctx.moveTo(centerX, centerY);
        ctx.lineTo(
            centerX + radius * Math.cos(sweepAngle - Math.PI/2),
            centerY + radius * Math.sin(sweepAngle - Math.PI/2)
        );
        ctx.stroke();
        
        // Draw connection dots
        drawConnections(centerX, centerY, radius);
    }
    
    // Connection data (simulated)
    const connections = [
        { x: 0.3, y: 0.2, app: 'Chrome', destination: 'google.com', risk: 'low', data: '24.5 KB' },
        { x: -0.4, y: 0.5, app: 'Slack', destination: 'slack.com', risk: 'low', data: '12.1 KB' },
        { x: 0.7, y: -0.3, app: 'Spotify', destination: 'spotify.com', risk: 'low', data: '46.2 KB' },
        { x: -0.2, y: -0.6, app: 'Unknown', destination: 'tracker.adnetwork.com', risk: 'high', data: '8.7 KB' },
        { x: 0.5, y: 0.4, app: 'Mail', destination: 'mail.google.com', risk: 'low', data: '3.2 KB' },
        { x: -0.8, y: 0.1, app: 'System', destination: 'time.windows.com', risk: 'low', data: '0.5 KB' },
        { x: 0.1, y: 0.8, app: 'Dropbox', destination: 'dl.dropbox.com', risk: 'medium', data: '124.0 KB' }
    ];
    
    // Draw connection dots
    function drawConnections(centerX, centerY, radius) {
        connections.forEach(conn => {
            const x = centerX + conn.x * radius;
            const y = centerY + conn.y * radius;
            
            // Color based on risk
            let color;
            if (conn.risk === 'high') color = 'rgba(239, 68, 68, 0.8)';
            else if (conn.risk === 'medium') color = 'rgba(234, 179, 8, 0.8)';
            else color = 'rgba(16, 185, 129, 0.8)';
            
            // Draw dot
            ctx.fillStyle = color;
            ctx.beginPath();
            ctx.arc(x, y, 6, 0, 2 * Math.PI);
            ctx.fill();
            
            // Add pulse animation for suspicious connections
            if (conn.risk !== 'low') {
                const pulseRadius = 6 + 2 * Math.abs(Math.sin(Date.now() / 500));
                ctx.fillStyle = color.replace('0.8', '0.3');
                ctx.beginPath();
                ctx.arc(x, y, pulseRadius, 0, 2 * Math.PI);
                ctx.fill();
            }
            
            // Add hover interaction
            canvas.addEventListener('mousemove', (e) => {
                const rect = canvas.getBoundingClientRect();
                const mouseX = e.clientX - rect.left;
                const mouseY = e.clientY - rect.top;
                
                const distance = Math.sqrt((mouseX - x) ** 2 + (mouseY - y) ** 2);
                
                if (distance < 10) {
                    showConnectionInfo(conn);
                }
            });
        });
    }
    
    // Show connection info
    function showConnectionInfo(conn) {
        const infoBox = document.getElementById('connectionInfo');
        const appName = document.getElementById('appName');
        const appDestination = document.getElementById('appDestination');
        const threatLevel = document.getElementById('threatLevel');
        const dataAmount = document.getElementById('dataAmount');
        
        appName.textContent = conn.app;
        appDestination.textContent = `Destination: ${conn.destination}`;
        threatLevel.textContent = `${conn.risk.charAt(0).toUpperCase() + conn.risk.slice(1)} Risk`;
        dataAmount.textContent = conn.data;
        
        // Set threat level color
        threatLevel.className = 'px-2 py-1 rounded text-xs font-medium';
        if (conn.risk === 'high') threatLevel.classList.add('bg-red-900', 'text-red-400');
        else if (conn.risk === 'medium') threatLevel.classList.add('bg-yellow-900', 'text-yellow-400');
        else threatLevel.classList.add('bg-green-900', 'text-green-400');
        
        infoBox.classList.remove('hidden');
    }
    
    // Radar sweep animation
    let sweepAngle = 0;
    function animateRadar() {
        sweepAngle += 0.02;
        drawRadar();
        requestAnimationFrame(animateRadar);
    }
    
    // Initialize
    window.addEventListener('resize', resizeCanvas);
    resizeCanvas();
    animateRadar();
    
    // Simulate random new connections
    setInterval(() => {
        if (Math.random() > 0.7) {
            const newConn = {
                x: Math.random() * 1.8 - 0.9,
                y: Math.random() * 1.8 - 0.9,
                app: ['System', 'Updater', 'Backup', 'Service', 'Unknown'][Math.floor(Math.random() * 5)],
                destination: `server${Math.floor(Math.random() * 1000)}.${['com', 'net', 'org', 'io'][Math.floor(Math.random() * 4)]}`,
                risk: ['low', 'medium', 'high'][Math.floor(Math.random() * 3)],
                data: `${(Math.random() * 100).toFixed(1)} KB`
            };
            connections.push(newConn);
            
            // Remove old connections occasionally
            if (connections.length > 15 && Math.random() > 0.5) {
                connections.shift();
            }
        }
    }, 2000);
});

// Hover effect for pricing cards
document.querySelectorAll('.pricing-card').forEach(card => {
    card.addEventListener('mouseenter', () => {
        card.querySelector('.pricing-features').classList.add('scale-105');
    });
    card.addEventListener('mouseleave', () => {
        card.querySelector('.pricing-features').classList.remove('scale-105');
    });
});