import { useState, useEffect } from 'react'; import { Plus, Trash2, Edit, Eye, Shield, Copy, Download, Key, AlertTriangle, CheckCircle, Globe, Lock, Users, Server } from 'lucide-react'; import { peerRegistryAPI, wireguardAPI, cellLinkAPI, getCsrfToken } from '../services/api'; import { useConfig } from '../contexts/ConfigContext'; import QRCode from 'qrcode'; const FULL_TUNNEL_IPS = '0.0.0.0/0, ::/0'; const emptyForm = () => ({ name: '', description: '', public_key: '', persistent_keepalive: 25, internet_access: true, service_access: ['calendar', 'files', 'mail', 'webdav'], peer_access: true, create_calendar: false, password: '', }); const generatePassword = () => { const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%'; const arr = new Uint8Array(14); crypto.getRandomValues(arr); return Array.from(arr).map(b => chars[b % chars.length]).join(''); }; function AccessBadge({ icon: Icon, label, active }) { return ( {label} ); } function Toggle({ checked, onChange, label, description }) { return (