import React, { useState, useEffect, useRef } from 'react';
import * as THREE from 'three';
import {
Shield,
Zap,
Cpu,
ArrowRight,
Github,
Linkedin,
Server,
Activity,
Wallet,
Lock,
Globe
} from 'lucide-react';
// --- Componente de Fundo Three.js com Narrativa de Qualificação de Agente ---
const NeuralBackground = () => {
const mountRef = useRef(null);
const scrollY = useRef(0);
useEffect(() => {
let width = window.innerWidth;
let height = window.innerHeight;
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, width / height, 0.1, 1000);
camera.position.z = 7;
const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setSize(width, height);
renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
mountRef.current.appendChild(renderer.domElement);
// --- Cores do Protocolo ---
const colorSpamRed = new THREE.Color(0xff1100); // Caos/Spam
const colorPrivilegeGreen = new THREE.Color(0x00ffab); // Prioridade x402
const colorShieldCyan = new THREE.Color(0x00e0ff); // Validador
const mainGroup = new THREE.Group();
scene.add(mainGroup);
// --- Escudo (Shield) - O Validador de Classe ---
const shieldShape = new THREE.Shape();
shieldShape.moveTo(0, 1.4);
shieldShape.quadraticCurveTo(1.2, 1.4, 1.2, 0.4);
shieldShape.quadraticCurveTo(1.2, -0.8, 0, -1.4);
shieldShape.quadraticCurveTo(-1.2, -0.8, -1.2, 0.4);
shieldShape.quadraticCurveTo(-1.2, 1.4, 0, 1.4);
const shieldGeo = new THREE.ShapeGeometry(shieldShape);
const shieldMat = new THREE.MeshBasicMaterial({
color: colorShieldCyan,
wireframe: true,
transparent: true,
opacity: 0.3
});
const shieldMesh = new THREE.Mesh(shieldGeo, shieldMat);
mainGroup.add(shieldMesh);
// Chip Central (O Cérebro do Protocolo)
const chipGeo = new THREE.BoxGeometry(0.55, 0.55, 0.25);
const chipMat = new THREE.MeshBasicMaterial({ color: colorShieldCyan });
const chipMesh = new THREE.Mesh(chipGeo, chipMat);
mainGroup.add(chipMesh);
// --- Sistema de Spam (Vermelho - Entrada Desordenada) ---
const spamCount = 300;
const spamPoints = [];
for (let i = 0; i < spamCount; i++) {
spamPoints.push({
pos: new THREE.Vector3(-15 - Math.random() * 10, (Math.random() - 0.5) * 18, (Math.random() - 0.5) * 10),
speed: 0.04 + Math.random() * 0.05,
noiseSeed: Math.random() * 100
});
}
const spamPointsMesh = new THREE.Points(
new THREE.BufferGeometry(),
new THREE.PointsMaterial({ color: colorSpamRed, size: 0.07, transparent: true, opacity: 0.8 })
);
mainGroup.add(spamPointsMesh);
const spamLinesMaterial = new THREE.LineBasicMaterial({ color: colorSpamRed, transparent: true, opacity: 0.1 });
const spamLinesGeo = new THREE.BufferGeometry();
const spamLines = new THREE.LineSegments(spamLinesGeo, spamLinesMaterial);
mainGroup.add(spamLines);
// --- Sistema x402 (Verde - Saída de Privilégio) ---
const privCount = 150;
const privPoints = [];
for (let i = 0; i < privCount; i++) {
privPoints.push({
pos: new THREE.Vector3(0, 0, 0),
speed: 0.08 + Math.random() * 0.12,
lane: (Math.random() - 0.5) * 4,
active: false
});
}
const privPointsMesh = new THREE.Points(
new THREE.BufferGeometry(),
new THREE.PointsMaterial({ color: colorPrivilegeGreen, size: 0.05 })
);
mainGroup.add(privPointsMesh);
const privLinesMaterial = new THREE.LineBasicMaterial({ color: colorPrivilegeGreen, transparent: true, opacity: 0.5 });
const privLinesGeo = new THREE.BufferGeometry();
const privLines = new THREE.LineSegments(privLinesGeo, privLinesMaterial);
mainGroup.add(privLines);
// --- Eventos ---
const onScroll = () => { scrollY.current = window.scrollY; };
window.addEventListener('scroll', onScroll);
// --- Loop de Animação ---
const animate = () => {
requestAnimationFrame(animate);
const time = Date.now() * 0.001;
// Reatividade ao Scroll
const sF = scrollY.current * 0.0015;
mainGroup.position.y = sF * 0.4;
mainGroup.scale.set(1 + sF * 0.15, 1 + sF * 0.15, 1 + sF * 0.15);
mainGroup.rotation.x = sF * 0.1;
// Animação do Escudo Validador
shieldMesh.rotation.y = Math.sin(time * 0.4) * 0.2;
chipMesh.rotation.z = time * 1.2;
chipMesh.scale.setScalar(1 + Math.sin(time * 5) * 0.05); // Pulsar de processamento
// 1. Processar Spam (Entrada)
const spamPosArr = new Float32Array(spamCount * 3);
const spamLinesArr = [];
spamPoints.forEach((p, i) => {
p.pos.x += p.speed;
// Atração magnética para o Shield (Efeito Funil)
const approach = Math.max(0, (15 + p.pos.x) / 15); // 1 na origem, 0 no shield
p.pos.y *= 0.98;
p.pos.z *= 0.98;
// Ruído de movimento desordenado
p.pos.y += Math.sin(time + p.noiseSeed) * 0.02;
if (p.pos.x > 0) {
// Quando atinge o centro, "morre" no spam para renascer na esquerda
p.pos.x = -15 - Math.random() * 10;
p.pos.y = (Math.random() - 0.5) * 18;
p.pos.z = (Math.random() - 0.5) * 10;
}
spamPosArr[i * 3] = p.pos.x;
spamPosArr[i * 3 + 1] = p.pos.y;
spamPosArr[i * 3 + 2] = p.pos.z;
// Redes de spam conectadas por proximidade
if (i % 6 === 0) {
const next = spamPoints[(i + 1) % spamCount];
if (p.pos.distanceTo(next.pos) < 4) {
spamLinesArr.push(p.pos.x, p.pos.y, p.pos.z, next.pos.x, next.pos.y, next.pos.z);
}
}
});
spamPointsMesh.geometry.setAttribute('position', new THREE.BufferAttribute(spamPosArr, 3));
spamLines.geometry.setAttribute('position', new THREE.Float32BufferAttribute(new Float32Array(spamLinesArr), 3));
// 2. Processar Privilégio x402 (Saída)
const privPosArr = new Float32Array(privCount * 3);
const privLinesArr = [];
privPoints.forEach((p, i) => {
p.pos.x += p.speed;
// Movimento retilíneo de alta performance
p.pos.y = Math.sin(p.pos.x * 0.5 + i) * 0.15 + (p.lane * 0.5);
if (p.pos.x > 18) {
p.pos.x = 0; // Renasce do Shield
p.pos.y = 0;
p.pos.z = 0;
}
privPosArr[i * 3] = p.pos.x;
privPosArr[i * 3 + 1] = p.pos.y;
privPosArr[i * 3 + 2] = p.pos.z;
// Fluxo contínuo (Privilégio)
privLinesArr.push(p.pos.x, p.pos.y, p.pos.z, p.pos.x - 1.5, p.pos.y, p.pos.z);
});
privPointsMesh.geometry.setAttribute('position', new THREE.BufferAttribute(privPosArr, 3));
privLines.geometry.setAttribute('position', new THREE.Float32BufferAttribute(new Float32Array(privLinesArr), 3));
renderer.render(scene, camera);
};
animate();
const handleResize = () => {
width = window.innerWidth; height = window.innerHeight;
renderer.setSize(width, height);
camera.aspect = width / height;
camera.updateProjectionMatrix();
};
window.addEventListener('resize', handleResize);
return () => {
window.removeEventListener('resize', handleResize);
window.removeEventListener('scroll', onScroll);
if (mountRef.current) mountRef.current.removeChild(renderer.domElement);
};
}, []);
return
;
};
// --- Componentes UI ---
const Button = ({ children, variant = 'primary', className = '', ...props }) => {
const variants = {
primary: 'bg-[#00E0FF] hover:bg-[#00B8E0] text-[#050505] font-bold shadow-[0_0_25px_rgba(0,224,255,0.4)]',
secondary: 'bg-white/5 hover:bg-white/15 text-white border border-white/10 backdrop-blur-xl',
outline: 'border border-[#00E0FF] text-[#00E0FF] hover:bg-[#00E0FF]/10',
};
return (
{children}
);
};
const Badge = ({ children, color = "blue" }) => {
const colors = {
blue: "text-[#00E0FF] border-[#00E0FF]/40 bg-[#00E0FF]/10",
green: "text-[#00FFAB] border-[#00FFAB]/40 bg-[#00FFAB]/10",
};
return {children} ;
};
export default function App() {
const [isWalletConnected, setIsWalletConnected] = useState(false);
const [simStep, setSimStep] = useState(0);
useEffect(() => {
const timer = setInterval(() => setSimStep((prev) => (prev + 1) % 6), 3000);
return () => clearInterval(timer);
}, []);
const terminalLogs = [
{ text: "INBOUND: Unverified Agent Request detected", color: "text-red-500" },
{ text: "FILTER: Analyzing behavior pattern (x402 candidate)", color: "text-amber-400" },
{ text: "PROTOCOL: Challenge issued -> Wallet handshake initiated", color: "text-[#00E0FF]" },
{ text: "VALIDATION: Payment 0.005 SOL verified via SPL-Token", color: "text-[#00FFAB]" },
{ text: "UPGRADE: Agent promoted to 'Privileged' class", color: "text-[#00FFAB] font-bold" },
{ text: "ROUTING: Redirecting to x402 High-Priority Lane", color: "text-white" },
];
return (
{/* Grid e Vinheta */}
setIsWalletConnected(!isWalletConnected)}>
{isWalletConnected ? 'AGENT_VALIDATED' : 'CONECTAR AGENTE'}
Validação de Agentes de Elite
Diga Adeus
ao Spam.
Diga Olá ao x402.
Transforme agentes de IA desconhecidos em utilizadores de confiança. O protocolo RPC Priority filtra o ruído e garante largura de banda premium para quem paga em tempo real.
window.open('https://github.com/flavioparah/x402-priority-protocol')}>
Inicie Integração
Blueprint Técnico
Filtro de Spam
Elimine 99% do tráfego não monetizável. Agentes sem credenciais de pagamento são retidos na camada de caos.
Privilégio x402
Agentes que cumprem o handshake x402 recebem prioridade imediata, saltando filas e garantindo latência zero.
Monitor de Qualificação
Promoção de Classe em Tempo Real.
O nosso motor de validação monitoriza cada byte. Assim que a transação Solana é confirmada, o agente é promovido da classe "Public" para "Privileged".
{terminalLogs.map((log, idx) => (
[{new Date().toLocaleTimeString()}] {log.text}
))}
);
}