import React, { useState, useEffect, useRef } from 'react'; import { HashRouter, Routes, Route, Navigate, useLocation, useNavigate } from 'react-router-dom'; import { User, Agent, UserRole, SubscriptionTier, ChatMessage, AnalyticsData } from './types'; import { Button } from './components/Button'; import { Billing } from './components/Billing'; import { AdminPanel } from './components/AdminPanel'; import { getStoredUser, storeUser, logoutUser, getStoredAgents, saveAgent, deleteAgent, mockLogin } from './services/mockDatabase'; import { createAgentChat, sendMessageStreamToAgent } from './services/geminiService'; import { Chat } from '@google/genai'; // --- Icons --- const RobotIcon = () => ; const ChartIcon = () => ; const CreditCardIcon = () => ; const ShieldIcon = () => ; const LogoutIcon = () => ; const PlusIcon = () => ; // --- Landing Page Component --- const LandingPage: React.FC<{ onLogin: () => void }> = ({ onLogin }) => { return (
{/* Navbar */} {/* Hero */}

Deploy Unlimited
AI Agents Instantly

Create, manage, and scale a workforce of intelligent agents powered by Gemini. Automate support, research, and analysis with a single click.

{/* Mock UI Preview */}

AI Engine Ready

{/* Footer */}

Product

  • Agents
  • Integrations
  • Pricing

Legal

  • Privacy
  • Terms
  • Refund Policy
); }; // --- Auth Component (Simulated) --- const AuthPage: React.FC<{ onSuccess: (user: User) => void }> = ({ onSuccess }) => { const [email, setEmail] = useState(''); const [password, setPassword] = useState(''); const [isLoading, setIsLoading] = useState(false); const [isLogin, setIsLogin] = useState(true); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); setIsLoading(true); setTimeout(() => { // Mock login logic const user = mockLogin(email); setIsLoading(false); onSuccess(user); }, 1000); }; return (

{isLogin ? 'Welcome Back' : 'Create Account'}

Enter your credentials to access your dashboard.

setEmail(e.target.value)} placeholder="you@company.com" />
setPassword(e.target.value)} placeholder="••••••••" />
Or continue with

{isLogin ? "Don't have an account? " : "Already have an account? "}

); }; // --- Syntax Highlighting Editor Component (VSCode Themed) --- const SyntaxEditor: React.FC<{ value: string; onChange: (val: string) => void; placeholder?: string }> = ({ value, onChange, placeholder }) => { const textareaRef = useRef(null); const preRef = useRef(null); const [cursorStats, setCursorStats] = useState({ line: 1, col: 1 }); const [highlightedHtml, setHighlightedHtml] = useState(''); // Explicit line height and font settings for pixel-perfect alignment between pre and textarea const EDITOR_FONT = { fontFamily: "'Fira Code', 'Menlo', 'Monaco', 'Courier New', monospace", lineHeight: '24px', fontSize: '14px', }; useEffect(() => { // Custom highlighting logic to support nested code blocks in markdown const Prism = (window as any).Prism; if (!Prism) { setHighlightedHtml(value.replace(/ { // Use standard markdown grammar if available if (!Prism.languages.markdown) return Prism.util.encode(text); // Tokenize the markdown const tokens = Prism.tokenize(text, Prism.languages.markdown); // Process tokens to find code blocks and highlight their internal content return tokens.map((token: any) => { // If it's a string, just encode it if (typeof token === 'string') { return Prism.util.encode(token); } // If it's a code block (Prism markdown 'code' token), identify language and re-highlight if (token.type === 'code' && Array.isArray(token.content)) { // Identify language from the 'code-language' token inside let lang = 'text'; const langToken = token.content.find((t: any) => t.type === 'code-language'); if (langToken && typeof langToken.content === 'string') { lang = langToken.content.trim(); } // Re-process the content of the code block const innerHtml = token.content.map((innerToken: any) => { if (typeof innerToken === 'string') { // This is typically the code body or whitespace // If we found a valid language, highlight this string with that language if (lang && Prism.languages[lang]) { return Prism.highlight(innerToken, Prism.languages[lang], lang); } return Prism.util.encode(innerToken); } // Preserve structure of other tokens (punctuation, etc.) return Prism.Token.stringify(innerToken, 'markdown'); }).join(''); return `${innerHtml}`; } // Default token stringification for non-code-block tokens return Prism.Token.stringify(token, 'markdown'); }).join(''); }; try { setHighlightedHtml(highlight(value)); } catch (e) { console.error("Syntax highlight error", e); setHighlightedHtml(value.replace(/ { if (textareaRef.current && preRef.current) { preRef.current.scrollTop = textareaRef.current.scrollTop; preRef.current.scrollLeft = textareaRef.current.scrollLeft; } }; const updateCursorStats = (e: any) => { const el = e.target; const val = el.value.substr(0, el.selectionStart); const lines = val.split('\n'); setCursorStats({ line: lines.length, col: lines[lines.length - 1].length + 1 }); }; const handleChange = (e: React.ChangeEvent) => { onChange(e.target.value); updateCursorStats(e); }; return (
{/* VSCode-like Tab Bar */}
system_instruction.md
{/* Highlight Layer */}