Deepfake Authenticator commited on
Commit
70348ce
·
1 Parent(s): 067944e

feat: replace vanilla frontend with React + Vite UI

Browse files

- New frontend-react/ with React 18 + TypeScript + Tailwind CSS v4
- GridScan WebGL background on hero (Three.js + postprocessing)
- PillNav replaced with RadioNav icon tab bar
- Styled-components buttons: AnalyzeButton, InitiateButton, FileUploadInput
- Purple/black dark theme throughout all pages
- SVG area chart for frame-by-frame analysis
- Neumorphic cards on result page
- React Router with /pricing page
- Remove frontend-vanilla/ and stitch design artifacts

Files changed (42) hide show
  1. .gitignore +2 -0
  2. AUTHRIX_CONTEXT.md +400 -0
  3. frontend-react/.gitignore +24 -0
  4. frontend-react/README.md +73 -0
  5. frontend-react/eslint.config.js +22 -0
  6. frontend-react/index.html +14 -0
  7. frontend-react/package-lock.json +0 -0
  8. frontend-react/package.json +40 -0
  9. frontend-react/public/favicon.svg +1 -0
  10. frontend-react/public/icons.svg +24 -0
  11. frontend-react/src/App.css +184 -0
  12. frontend-react/src/App.tsx +137 -0
  13. frontend-react/src/assets/react.svg +1 -0
  14. frontend-react/src/assets/vite.svg +1 -0
  15. frontend-react/src/components/AnalyzeButton.tsx +133 -0
  16. frontend-react/src/components/Background.tsx +36 -0
  17. frontend-react/src/components/ErrorSection.tsx +32 -0
  18. frontend-react/src/components/FileUploadInput.tsx +151 -0
  19. frontend-react/src/components/GridScan.css +39 -0
  20. frontend-react/src/components/GridScan.d.ts +35 -0
  21. frontend-react/src/components/GridScan.jsx +716 -0
  22. frontend-react/src/components/HeroSection.tsx +221 -0
  23. frontend-react/src/components/InitiateButton.tsx +306 -0
  24. frontend-react/src/components/Modal.tsx +37 -0
  25. frontend-react/src/components/Navbar.tsx +111 -0
  26. frontend-react/src/components/PillNav.css +239 -0
  27. frontend-react/src/components/PillNav.tsx +271 -0
  28. frontend-react/src/components/ProcessingSection.tsx +269 -0
  29. frontend-react/src/components/RadioNav.tsx +137 -0
  30. frontend-react/src/components/ResultSection.tsx +339 -0
  31. frontend-react/src/components/UploadSection.tsx +229 -0
  32. frontend-react/src/index.css +230 -0
  33. frontend-react/src/main.tsx +17 -0
  34. frontend-react/src/pages/PricingPage.tsx +222 -0
  35. frontend-react/src/types.ts +39 -0
  36. frontend-react/tsconfig.app.json +25 -0
  37. frontend-react/tsconfig.json +7 -0
  38. frontend-react/tsconfig.node.json +24 -0
  39. frontend-react/vite.config.ts +26 -0
  40. frontend-vanilla/index.html +0 -1511
  41. frontend-vanilla/pricing.html +0 -470
  42. frontend-vanilla/script.js +0 -354
.gitignore CHANGED
@@ -66,3 +66,5 @@ logs/
66
 
67
  # Node
68
  node_modules/
 
 
 
66
 
67
  # Node
68
  node_modules/
69
+ frontend-react/dist/
70
+ frontend-react/.vite/
AUTHRIX_CONTEXT.md ADDED
@@ -0,0 +1,400 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTHRIX — Complete Project Context
2
+
3
+ > Give this file to any AI to get full context about the Authrix deepfake detection project.
4
+
5
+ ---
6
+
7
+ ## 1. What Is Authrix?
8
+
9
+ Authrix is a full-stack AI-powered deepfake detection platform. It analyzes videos and determines whether they are REAL (authentic) or FAKE (AI-generated/manipulated). It uses a multi-agent pipeline combining visual analysis, audio analysis, and metadata scanning.
10
+
11
+ **Live URL:** https://aarav13-authrix.hf.space
12
+ **GitHub:** https://github.com/Aarav-bit/Authrix
13
+ **HuggingFace Space:** https://huggingface.co/spaces/Aarav13/AuthriX
14
+ **Owner:** Aarav (Aarav13 on HuggingFace, Aarav-bit on GitHub)
15
+
16
+ ---
17
+
18
+ ## 2. Project Structure
19
+
20
+ ```
21
+ E:\DeepFake Detect\
22
+ ├── backend/ ← FastAPI Python backend (the core)
23
+ │ ├── main.py ← App entry, routes, middleware, file serving
24
+ │ ├── detector.py ← Core detection engine (all agents)
25
+ │ ├── audio_detector.py ← Audio analysis pipeline
26
+ │ ├── auth.py ← API key system, tier limits
27
+ │ ├── requirements.txt ← Python dependencies
28
+ │ └── uploads/ ← Temp video storage (auto-cleaned)
29
+
30
+ ├── extension/ ← Chrome/Edge browser extension (MV3)
31
+ │ ├── manifest.json ← Extension config, permissions
32
+ │ ├── background.js ← Service worker, tab capture, API calls
33
+ │ ├── content.js ← Overlay UI injected into pages
34
+ │ ├── offscreen.js ← MediaRecorder (MV3 requirement)
35
+ │ ├── offscreen.html ← Offscreen document host
36
+ │ ├── popup.html/js ← Extension popup UI
37
+ │ └── overlay.css ← Overlay styles
38
+
39
+ ├── frontend-vanilla/ ← The ACTIVE website (served by FastAPI)
40
+ │ ├── index.html ← Main app (cyberpunk dashboard UI)
41
+ │ ├── pricing.html ← Pricing/business page
42
+ │ └── script.js ← Frontend JS logic
43
+
44
+ ├── Dockerfile ← Docker build for HuggingFace Spaces
45
+ ├── README.md ← Full project documentation
46
+ ├── BUSINESS_MODEL.md ← Revenue strategy and pricing
47
+ └── .gitignore
48
+ ```
49
+
50
+ **Note:** `frontend/` (React) exists locally but is NOT deployed — `frontend-vanilla/` is what's live.
51
+
52
+ ---
53
+
54
+ ## 3. Backend — Detection Pipeline
55
+
56
+ ### File: `backend/detector.py`
57
+
58
+ The core engine. Uses a multi-agent architecture:
59
+
60
+ #### Agent 0: MetadataAgent
61
+ - Scans first 512KB + last 64KB of video file
62
+ - Looks for C2PA Content Credentials (cryptographic AI signatures)
63
+ - Detects AI tool names: Veo3, Sora, Runway, Pika, Kling, Stability AI, Firefly, etc.
64
+ - **Hard override**: if C2PA found → FAKE regardless of visual model
65
+ - Adds ~50ms, no ML required
66
+
67
+ #### Agent 1: FrameAnalyzerAgent
68
+ - Extracts 40 frames (20 in fast_mode) uniformly across video duration
69
+ - Resizes to 640×480 for processing
70
+ - `fast_mode=True` for short captures (<30s), `fast_mode=False` for uploads
71
+
72
+ #### Agent 2: FaceDetectorAgent
73
+ - Uses MediaPipe face detection (confidence threshold: 0.3)
74
+ - Single context for ALL frames (avoids repeated model init — 3× faster)
75
+ - Crops faces with 20% padding, resizes to 224×224
76
+ - Falls back to full-frame analysis if <5 faces detected
77
+
78
+ #### Agent 3: DecisionAgent (ViT Ensemble)
79
+ - **Model 1:** `dima806/deepfake_vs_real_image_detection` (99.3% accuracy, fake_label="Fake")
80
+ - **Model 2:** `prithivMLmods/Deep-Fake-Detector-v2-Model` (92.1% accuracy, fake_label="Deepfake")
81
+ - Per-crop inference (float32 — float16 breaks CPU inference)
82
+ - Early exit: if Model 1 score > 0.88 or < 0.12, skip Model 2
83
+ - Ensemble: Model1 × 0.55 + Model2 × 0.45
84
+ - Falls back to heuristic analysis if models unavailable
85
+
86
+ #### Agent 4: ReportGeneratorAgent
87
+ - Base threshold: 0.58 (adaptive: ±0.03–0.07 based on consistency/coverage)
88
+ - C2PA hard override: always FAKE if metadata signals found
89
+ - Audio-visual mismatch detection (face-swap signal)
90
+ - Confidence calibration: maps raw probability to 88–99% display range
91
+ - `_calibrate()`: `distance = abs(prob - 0.5)`, `conf = 0.88 + 0.11 * (distance/0.5)^0.6`
92
+
93
+ #### Orchestrator: DeepfakeAuthenticator
94
+ ```
95
+ analyze(video_path, fast_mode=False):
96
+ 1. Cache check (SHA256 hash of first 1MB + file size)
97
+ 2. MetadataAgent.analyze() — instant C2PA scan
98
+ 3. FrameAnalyzerAgent.extract_frames()
99
+ 4. [PARALLEL] FaceDetectorAgent + AudioAuthenticator (20s timeout)
100
+ 5. DecisionAgent.analyze_frames()
101
+ 6. ReportGeneratorAgent.generate()
102
+ 7. Cache result
103
+ ```
104
+
105
+ ### File: `backend/audio_detector.py`
106
+
107
+ Four-agent audio pipeline:
108
+ - **AudioExtractorAgent**: extracts first 30s of audio via moviepy, converts to 16kHz mono WAV
109
+ - **AudioAnalysisAgent**: librosa heuristics (pitch variance, MFCC delta, spectral flatness, ZCR, silence ratio)
110
+ - **AudioDecisionAgent**: Wav2Vec2 model (`Vansh180/deepfake-audio-wav2vec2`), max 3 chunks (30s)
111
+ - **AudioReportAgent**: combines model + heuristics, detects AV_MISMATCH (face-swap signal)
112
+
113
+ Audio results: `HUMAN_VOICE`, `AI_VOICE`, `AV_MISMATCH`, `NO_AUDIO`
114
+
115
+ ### File: `backend/main.py`
116
+
117
+ FastAPI app with these routes:
118
+ - `GET /health` → server status + model info
119
+ - `POST /analyze` → upload video file, returns detection result
120
+ - `POST /analyze-url` → analyze video from URL (uses yt-dlp for YouTube/TikTok/etc.)
121
+ - `GET /` → serves `frontend-vanilla/index.html`
122
+ - `GET /pricing` → serves `frontend-vanilla/pricing.html`
123
+ - `GET /script.js` → serves `frontend-vanilla/script.js`
124
+ - `GET /{filename}` → catch-all for static files
125
+
126
+ **Key logic in `/analyze`:**
127
+ - Validates file extension (mp4, avi, mov, mkv, webm, wmv)
128
+ - Max file size: 100MB
129
+ - Converts webm/mkv to mp4 via bundled ffmpeg (imageio-ffmpeg) — OpenCV can't decode webm on Windows
130
+ - Auto-detects fast_mode: videos <30s use 20 frames, ≥30s use 40 frames
131
+ - 120s request timeout
132
+
133
+ ### File: `backend/auth.py`
134
+
135
+ API key system:
136
+ - Keys stored in `backend/api_keys.json`
137
+ - Tiers: free (10/mo), pro (100/mo), business (1000/mo), enterprise/owner (unlimited)
138
+ - `validate_api_key()`, `check_usage_limit()`, `increment_usage()`
139
+ - Owner key: `authrix_vx5b5HqXIEtAuhUJw92p-aU7Ucz34RtWHzpBCzbKqKE` (unlimited)
140
+
141
+ ---
142
+
143
+ ## 4. API Response Format
144
+
145
+ ```json
146
+ {
147
+ "result": "FAKE", // "FAKE" or "REAL"
148
+ "confidence": 94.2, // 88-99% (calibrated display score)
149
+ "details": [ // Human-readable explanation bullets
150
+ "Strong deepfake indicators detected across multiple facial regions",
151
+ "Inconsistent manipulation across frames (78% flagged)",
152
+ "Unnatural texture blending detected at facial boundary regions"
153
+ ],
154
+ "frame_timeline": [ // Per-frame fake probability
155
+ {"frame": 0, "fake_pct": 82.1},
156
+ {"frame": 5, "fake_pct": 79.3}
157
+ ],
158
+ "metadata": {
159
+ "frames_analyzed": 38,
160
+ "frames_with_faces": 35,
161
+ "video_duration_sec": 12.4,
162
+ "video_fps": 30.0,
163
+ "resolution": "1280x720"
164
+ },
165
+ "audio": {
166
+ "available": true,
167
+ "result": "HUMAN_VOICE", // HUMAN_VOICE | AI_VOICE | AV_MISMATCH | NO_AUDIO
168
+ "confidence": 91.2,
169
+ "fake_probability": 0.12
170
+ },
171
+ "metadata_check": {
172
+ "ai_generated": false,
173
+ "c2pa_detected": false,
174
+ "tool_detected": null
175
+ },
176
+ "processing_time_sec": 18.4,
177
+ "cached": false // true if returned from cache
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 5. Browser Extension
184
+
185
+ **Version:** 2.2.0 (Manifest V3)
186
+ **Supported:** Chrome, Edge, Brave
187
+
188
+ ### Architecture (MV3 compliant)
189
+ ```
190
+ User clicks popup
191
+ → popup.js sends START_CAPTURE to background.js
192
+ → background.js calls tabCapture.getMediaStreamId()
193
+ → background.js creates offscreen document
194
+ → offscreen.js gets getUserMedia({chromeMediaSource:'tab'})
195
+ → offscreen.js records 8 seconds via MediaRecorder (4Mbps)
196
+ → offscreen.js sends raw byte chunks to background.js
197
+ → background.js reassembles bytes → Blob → FormData
198
+ → background.js POSTs to /analyze
199
+ → background.js sends result to content.js
200
+ → content.js renders overlay on the page
201
+ ```
202
+
203
+ ### Key Files
204
+ - `background.js`: Service worker. Handles tab capture, API calls, offscreen management. `API_BASE` points to HF Space.
205
+ - `offscreen.js`: Records tab stream. Sends raw Uint8Array chunks (not base64 — avoids message size limits).
206
+ - `content.js`: Renders overlay UI. Shows loading steps, result (FAKE/REAL), confidence bar, audio row, metadata.
207
+ - `popup.html/js`: Extension popup. Shows server status, current page info, capture button, URL input, last result.
208
+ - `manifest.json`: Permissions: `tabCapture`, `scripting`, `storage`, `offscreen`, `contextMenus`, `tabs`, `activeTab`.
209
+
210
+ ### API Base URLs
211
+ - **Local dev:** `http://localhost:8000`
212
+ - **Production (HF):** `https://aarav13-authrix.hf.space`
213
+
214
+ ### Context Menu
215
+ - Right-click page → "🔍 Analyze with Authrix" (captures tab stream)
216
+ - Right-click link → "🔗 Analyze video URL with Authrix" (sends URL to /analyze-url)
217
+
218
+ ---
219
+
220
+ ## 6. Frontend (frontend-vanilla/)
221
+
222
+ Vanilla HTML/CSS/JS — no framework. Served directly by FastAPI.
223
+
224
+ ### `index.html`
225
+ - Cyberpunk-themed dashboard
226
+ - Tailwind CSS (CDN), Space Grotesk font
227
+ - Navigation: Dashboard | Pricing | Agents | Logs | Network
228
+ - Upload zone with drag-and-drop
229
+ - Analysis progress UI with step indicators
230
+ - Results panel with confidence score, frame timeline, details
231
+ - Modals: Agents, Logs, Network
232
+
233
+ ### `pricing.html`
234
+ - Pricing tiers: Free ($0), Pro ($9.99/mo), Business ($49/mo), Enterprise (custom)
235
+ - FAQ section
236
+ - "DEMO VERSION" badge removed — looks production-ready
237
+ - Buttons show alert explaining payment integration coming soon
238
+
239
+ ---
240
+
241
+ ## 7. Deployment
242
+
243
+ ### HuggingFace Spaces (Live)
244
+ - **URL:** https://aarav13-authrix.hf.space
245
+ - **Space:** https://huggingface.co/spaces/Aarav13/AuthriX
246
+ - **Runtime:** Docker (port 7860)
247
+ - **Dockerfile:** Installs system deps, copies backend + frontend-vanilla, installs Python deps, pre-caches HF models at build time
248
+ - **User:** runs as user 1000 (HF requirement)
249
+ - Models are baked into the Docker image — no cold-start download
250
+
251
+ ### Git Remotes
252
+ ```
253
+ origin → https://github.com/Aarav-bit/Authrix.git
254
+ hf → https://huggingface.co/spaces/Aarav13/AuthriX
255
+ ```
256
+
257
+ ### Deploy Commands
258
+ ```bash
259
+ # Push to GitHub
260
+ git push origin master
261
+
262
+ # Push to HuggingFace (triggers rebuild)
263
+ git push hf master:main
264
+
265
+ # Force push (after history rewrite)
266
+ git push hf master:main --force
267
+ ```
268
+
269
+ ### Local Dev
270
+ ```bash
271
+ cd backend
272
+ python -m uvicorn main:app --host 0.0.0.0 --port 8000
273
+ # App at http://localhost:8000
274
+ ```
275
+
276
+ ---
277
+
278
+ ## 8. Python Dependencies (requirements.txt)
279
+
280
+ ```
281
+ fastapi==0.111.0
282
+ uvicorn[standard]==0.29.0
283
+ python-multipart==0.0.9
284
+ opencv-python-headless==4.9.0.80 # headless for server
285
+ mediapipe==0.10.14
286
+ numpy==1.26.4
287
+ Pillow==10.3.0
288
+ transformers>=4.41.0
289
+ torch>=2.3.0
290
+ torchvision
291
+ torchaudio
292
+ moviepy>=1.0.3
293
+ librosa>=0.10.0
294
+ soundfile>=0.12.1
295
+ imageio-ffmpeg>=0.4.9 # bundled ffmpeg binary
296
+ yt-dlp>=2024.1.0
297
+ httpx>=0.27.0
298
+ stripe>=8.0.0
299
+ ```
300
+
301
+ ---
302
+
303
+ ## 9. Known Issues & Decisions
304
+
305
+ | Issue | Decision |
306
+ |---|---|
307
+ | OpenCV can't decode .webm on Windows | Convert to .mp4 via bundled ffmpeg (imageio-ffmpeg) before analysis |
308
+ | Float16 on CPU produces wrong results | Always use float32 for ViT inference |
309
+ | Batching all 40 crops causes OOM on HF CPU | Per-crop inference with early exit |
310
+ | Audio Wav2Vec2 hangs on long videos | 20s timeout + cap to 3 chunks (30s of audio) |
311
+ | Modern AI video (Veo3, Sora) fools ViT models | C2PA metadata scan as hard override |
312
+ | Extension base64 encoding corrupts large videos | Send raw Uint8Array chunks instead |
313
+ | HF rejects PNG files in git push | Force-add icons with `git add -f`, exclude others via .gitignore |
314
+ | Temporal consistency agent caused false positives | Removed — thresholds too aggressive for real phone videos |
315
+
316
+ ---
317
+
318
+ ## 10. Business Model
319
+
320
+ ### Tiers
321
+ | Tier | Price | Analyses/Month |
322
+ |---|---|---|
323
+ | Free | $0 | 10 |
324
+ | Pro | $9.99/mo | 100 |
325
+ | Business | $49/mo | 1,000 |
326
+ | Enterprise | Custom | Unlimited |
327
+
328
+ ### Revenue Streams
329
+ 1. SaaS subscriptions (main)
330
+ 2. Pay-per-use API ($0.05–$0.25 per video)
331
+ 3. Browser extension premium ($4.99/mo)
332
+ 4. B2B enterprise deals ($5K–$50K/mo)
333
+ 5. White-label licensing
334
+ 6. Consulting & custom model training
335
+
336
+ ### Payment
337
+ - Stripe integration code exists (`backend/stripe_integration.py`) but NOT connected
338
+ - Currently demo-only — buttons show alert
339
+ - Owner API key has unlimited access
340
+
341
+ ---
342
+
343
+ ## 11. Accuracy Notes
344
+
345
+ - **Works well on:** Face-swap deepfakes, GAN-generated faces, AI voice synthesis, C2PA-signed AI video (Veo3, Sora, Runway)
346
+ - **Limitations:** Modern diffusion-based video (Veo3 without C2PA) can fool the ViT models — they were trained on older GAN-based fakes
347
+ - **Threshold:** 0.58 base (adaptive ±0.03–0.07). Raising reduces false positives on real videos. Lowering catches more deepfakes but increases false positives.
348
+ - **Confidence display:** Always 88–99% (calibrated). Raw model scores of 0.60 → ~92% displayed.
349
+
350
+ ---
351
+
352
+ ## 12. Extension Install (Developer Mode)
353
+
354
+ 1. Open `chrome://extensions`
355
+ 2. Enable **Developer Mode** (top-right toggle)
356
+ 3. Click **Load unpacked** → select `extension/` folder
357
+ 4. Authrix icon appears in toolbar
358
+ 5. Make sure backend is running at `http://localhost:8000` (local) or HF Space is live
359
+
360
+ ---
361
+
362
+ ## 13. Quick Reference — Key Variables
363
+
364
+ | Variable | Location | Value |
365
+ |---|---|---|
366
+ | `API_BASE` | extension/background.js | `https://aarav13-authrix.hf.space` |
367
+ | `API_BASE` | extension/popup.js | `https://aarav13-authrix.hf.space` |
368
+ | `CAPTURE_SEC` | extension/background.js | `8` (seconds to record) |
369
+ | `BASE_THRESHOLD` | backend/detector.py | `0.58` |
370
+ | `MAX_FILE_SIZE_MB` | backend/main.py | `100` |
371
+ | `UPLOAD_DIR` | backend/main.py | `uploads/` |
372
+ | Owner API Key | backend/api_keys.json | `authrix_vx5b5HqXIEtAuhUJw92p-aU7Ucz34RtWHzpBCzbKqKE` |
373
+ | HF Port | Dockerfile | `7860` |
374
+ | Local Port | main.py | `8000` |
375
+
376
+ ---
377
+
378
+ ## 14. How to Make Changes
379
+
380
+ ### Change detection threshold (more/less sensitive)
381
+ Edit `backend/detector.py` → `ReportGeneratorAgent.BASE_THRESHOLD`
382
+ - Higher (e.g. 0.65) = fewer false positives, may miss subtle fakes
383
+ - Lower (e.g. 0.52) = catches more fakes, more false positives on real videos
384
+
385
+ ### Change capture duration
386
+ Edit `extension/background.js` → `CAPTURE_SEC`
387
+
388
+ ### Switch extension between local and production
389
+ Edit `extension/background.js` and `extension/popup.js` → `API_BASE`
390
+
391
+ ### Add a new AI generator signature
392
+ Edit `backend/detector.py` → `MetadataAgent.AI_SIGNATURES` and `AI_TOOL_NAMES`
393
+
394
+ ### Deploy after changes
395
+ ```bash
396
+ git add -A
397
+ git commit -m "your message"
398
+ git push origin master # GitHub
399
+ git push hf master:main # HuggingFace (triggers rebuild)
400
+ ```
frontend-react/.gitignore ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+
15
+ # Editor directories and files
16
+ .vscode/*
17
+ !.vscode/extensions.json
18
+ .idea
19
+ .DS_Store
20
+ *.suo
21
+ *.ntvs*
22
+ *.njsproj
23
+ *.sln
24
+ *.sw?
frontend-react/README.md ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```
frontend-react/eslint.config.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import { defineConfig, globalIgnores } from 'eslint/config'
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist']),
10
+ {
11
+ files: ['**/*.{ts,tsx}'],
12
+ extends: [
13
+ js.configs.recommended,
14
+ tseslint.configs.recommended,
15
+ reactHooks.configs.flat.recommended,
16
+ reactRefresh.configs.vite,
17
+ ],
18
+ languageOptions: {
19
+ globals: globals.browser,
20
+ },
21
+ },
22
+ ])
frontend-react/index.html ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en" class="dark">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>AUTHRIX AI - Deepfake Detection Engine</title>
8
+ <meta name="description" content="AI-powered deepfake detection platform. Verify video authenticity in real-time." />
9
+ </head>
10
+ <body>
11
+ <div id="root"></div>
12
+ <script type="module" src="/src/main.tsx"></script>
13
+ </body>
14
+ </html>
frontend-react/package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
frontend-react/package.json ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "frontend-react",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc -b && vite build",
9
+ "lint": "eslint .",
10
+ "preview": "vite preview"
11
+ },
12
+ "dependencies": {
13
+ "@types/react-router-dom": "^5.3.3",
14
+ "@types/styled-components": "^5.1.36",
15
+ "face-api.js": "^0.22.2",
16
+ "gsap": "^3.15.0",
17
+ "postprocessing": "^6.39.1",
18
+ "react": "^19.2.5",
19
+ "react-dom": "^19.2.5",
20
+ "react-router-dom": "^7.14.2",
21
+ "styled-components": "^6.4.1",
22
+ "three": "^0.184.0"
23
+ },
24
+ "devDependencies": {
25
+ "@eslint/js": "^10.0.1",
26
+ "@tailwindcss/vite": "^4.2.4",
27
+ "@types/node": "^24.12.2",
28
+ "@types/react": "^19.2.14",
29
+ "@types/react-dom": "^19.2.3",
30
+ "@vitejs/plugin-react": "^6.0.1",
31
+ "eslint": "^10.2.1",
32
+ "eslint-plugin-react-hooks": "^7.1.1",
33
+ "eslint-plugin-react-refresh": "^0.5.2",
34
+ "globals": "^17.5.0",
35
+ "tailwindcss": "^4.2.4",
36
+ "typescript": "~6.0.2",
37
+ "typescript-eslint": "^8.58.2",
38
+ "vite": "^8.0.10"
39
+ }
40
+ }
frontend-react/public/favicon.svg ADDED
frontend-react/public/icons.svg ADDED
frontend-react/src/App.css ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .counter {
2
+ font-size: 16px;
3
+ padding: 5px 10px;
4
+ border-radius: 5px;
5
+ color: var(--accent);
6
+ background: var(--accent-bg);
7
+ border: 2px solid transparent;
8
+ transition: border-color 0.3s;
9
+ margin-bottom: 24px;
10
+
11
+ &:hover {
12
+ border-color: var(--accent-border);
13
+ }
14
+ &:focus-visible {
15
+ outline: 2px solid var(--accent);
16
+ outline-offset: 2px;
17
+ }
18
+ }
19
+
20
+ .hero {
21
+ position: relative;
22
+
23
+ .base,
24
+ .framework,
25
+ .vite {
26
+ inset-inline: 0;
27
+ margin: 0 auto;
28
+ }
29
+
30
+ .base {
31
+ width: 170px;
32
+ position: relative;
33
+ z-index: 0;
34
+ }
35
+
36
+ .framework,
37
+ .vite {
38
+ position: absolute;
39
+ }
40
+
41
+ .framework {
42
+ z-index: 1;
43
+ top: 34px;
44
+ height: 28px;
45
+ transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
46
+ scale(1.4);
47
+ }
48
+
49
+ .vite {
50
+ z-index: 0;
51
+ top: 107px;
52
+ height: 26px;
53
+ width: auto;
54
+ transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
55
+ scale(0.8);
56
+ }
57
+ }
58
+
59
+ #center {
60
+ display: flex;
61
+ flex-direction: column;
62
+ gap: 25px;
63
+ place-content: center;
64
+ place-items: center;
65
+ flex-grow: 1;
66
+
67
+ @media (max-width: 1024px) {
68
+ padding: 32px 20px 24px;
69
+ gap: 18px;
70
+ }
71
+ }
72
+
73
+ #next-steps {
74
+ display: flex;
75
+ border-top: 1px solid var(--border);
76
+ text-align: left;
77
+
78
+ & > div {
79
+ flex: 1 1 0;
80
+ padding: 32px;
81
+ @media (max-width: 1024px) {
82
+ padding: 24px 20px;
83
+ }
84
+ }
85
+
86
+ .icon {
87
+ margin-bottom: 16px;
88
+ width: 22px;
89
+ height: 22px;
90
+ }
91
+
92
+ @media (max-width: 1024px) {
93
+ flex-direction: column;
94
+ text-align: center;
95
+ }
96
+ }
97
+
98
+ #docs {
99
+ border-right: 1px solid var(--border);
100
+
101
+ @media (max-width: 1024px) {
102
+ border-right: none;
103
+ border-bottom: 1px solid var(--border);
104
+ }
105
+ }
106
+
107
+ #next-steps ul {
108
+ list-style: none;
109
+ padding: 0;
110
+ display: flex;
111
+ gap: 8px;
112
+ margin: 32px 0 0;
113
+
114
+ .logo {
115
+ height: 18px;
116
+ }
117
+
118
+ a {
119
+ color: var(--text-h);
120
+ font-size: 16px;
121
+ border-radius: 6px;
122
+ background: var(--social-bg);
123
+ display: flex;
124
+ padding: 6px 12px;
125
+ align-items: center;
126
+ gap: 8px;
127
+ text-decoration: none;
128
+ transition: box-shadow 0.3s;
129
+
130
+ &:hover {
131
+ box-shadow: var(--shadow);
132
+ }
133
+ .button-icon {
134
+ height: 18px;
135
+ width: 18px;
136
+ }
137
+ }
138
+
139
+ @media (max-width: 1024px) {
140
+ margin-top: 20px;
141
+ flex-wrap: wrap;
142
+ justify-content: center;
143
+
144
+ li {
145
+ flex: 1 1 calc(50% - 8px);
146
+ }
147
+
148
+ a {
149
+ width: 100%;
150
+ justify-content: center;
151
+ box-sizing: border-box;
152
+ }
153
+ }
154
+ }
155
+
156
+ #spacer {
157
+ height: 88px;
158
+ border-top: 1px solid var(--border);
159
+ @media (max-width: 1024px) {
160
+ height: 48px;
161
+ }
162
+ }
163
+
164
+ .ticks {
165
+ position: relative;
166
+ width: 100%;
167
+
168
+ &::before,
169
+ &::after {
170
+ content: '';
171
+ position: absolute;
172
+ top: -4.5px;
173
+ border: 5px solid transparent;
174
+ }
175
+
176
+ &::before {
177
+ left: 0;
178
+ border-left-color: var(--border);
179
+ }
180
+ &::after {
181
+ right: 0;
182
+ border-right-color: var(--border);
183
+ }
184
+ }
frontend-react/src/App.tsx ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react';
2
+ import type { AnalysisResult, AppState } from './types';
3
+ import Background from './components/Background';
4
+ import RadioNav from './components/RadioNav';
5
+ import HeroSection from './components/HeroSection';
6
+ import UploadSection from './components/UploadSection';
7
+ import ProcessingSection from './components/ProcessingSection';
8
+ import ResultSection from './components/ResultSection';
9
+ import ErrorSection from './components/ErrorSection';
10
+ import Modal from './components/Modal';
11
+
12
+ const AGENTS = [
13
+ { name: 'MetadataAgent', desc: 'Scans C2PA signatures and AI tool metadata in the first 512KB of the file.' },
14
+ { name: 'FrameAnalyzerAgent', desc: 'Extracts up to 40 frames uniformly across the video duration.' },
15
+ { name: 'FaceDetectorAgent', desc: 'Uses MediaPipe to detect and crop facial regions with 20% padding.' },
16
+ { name: 'DecisionAgent (ViT)', desc: 'Ensemble of two ViT models (99.3% + 92.1% accuracy) with early exit.' },
17
+ { name: 'AudioAuthenticator', desc: 'Wav2Vec2-based audio analysis with librosa heuristics for AV mismatch.' },
18
+ { name: 'ReportGeneratorAgent',desc: 'Adaptive threshold + confidence calibration to produce the final verdict.' },
19
+ ];
20
+
21
+ export default function App() {
22
+ const [state, setState] = useState<AppState>('hero');
23
+ const [result, setResult] = useState<AnalysisResult | null>(null);
24
+ const [error, setError] = useState('');
25
+ const [modal, setModal] = useState<string | null>(null);
26
+
27
+ async function handleAnalyze(file: File) {
28
+ setState('processing');
29
+ const fd = new FormData();
30
+ fd.append('file', file);
31
+ try {
32
+ const res = await fetch('/analyze', { method: 'POST', body: fd });
33
+ if (!res.ok) {
34
+ const e = await res.json().catch(() => ({}));
35
+ throw new Error((e as { detail?: string }).detail || `Server error ${res.status}`);
36
+ }
37
+ const data: AnalysisResult = await res.json();
38
+ setResult(data);
39
+ setState('result');
40
+ } catch (err: unknown) {
41
+ setError(err instanceof Error ? err.message : 'Connection to analysis engine failed.');
42
+ setState('error');
43
+ }
44
+ }
45
+
46
+ const activeNav =
47
+ state === 'hero' ? 'dashboard' :
48
+ state === 'upload' ? 'analyze' :
49
+ state === 'processing' ? 'analyze' :
50
+ state === 'result' ? 'analyze' : 'dashboard';
51
+
52
+ const handleNav = (id: string) => {
53
+ if (id === 'dashboard') setState('hero');
54
+ else if (id === 'analyze') setState('upload');
55
+ else if (id === 'pricing') window.location.href = '/pricing';
56
+ else if (id === 'agents') setModal('agents');
57
+ else if (id === 'settings') setModal('network');
58
+ };
59
+
60
+ return (
61
+ <div className="min-h-screen flex flex-col relative overflow-x-hidden">
62
+ <Background />
63
+
64
+ <RadioNav active={activeNav} onNavigate={handleNav} />
65
+
66
+ {state === 'hero' && <HeroSection onAnalyze={() => setState('upload')} />}
67
+ {state === 'upload' && <UploadSection onAnalyze={handleAnalyze} onBack={() => setState('hero')} />}
68
+ {state === 'processing' && <ProcessingSection />}
69
+ {state === 'result' && result && <ResultSection result={result} onReset={() => setState('upload')} />}
70
+ {state === 'error' && <ErrorSection message={error} onRetry={() => setState('upload')} />}
71
+
72
+ {/* Agents Modal */}
73
+ {modal === 'agents' && (
74
+ <Modal title="Detection Agents" onClose={() => setModal(null)}>
75
+ <div className="flex flex-col gap-4">
76
+ {AGENTS.map((ag, i) => (
77
+ <div key={i} className="flex items-start gap-4 p-4 rounded-lg"
78
+ style={{ background: 'rgba(30,15,50,0.6)', border: '1px solid rgba(124,58,237,0.2)' }}>
79
+ <div className="w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 text-xs font-bold"
80
+ style={{ background: 'rgba(124,58,237,0.15)', border: '1px solid rgba(168,85,247,0.3)', color: '#a855f7' }}>
81
+ {i}
82
+ </div>
83
+ <div>
84
+ <div className="text-sm font-semibold mb-1" style={{ color: '#c084fc' }}>{ag.name}</div>
85
+ <div className="text-xs text-purple-300/50">{ag.desc}</div>
86
+ </div>
87
+ </div>
88
+ ))}
89
+ </div>
90
+ </Modal>
91
+ )}
92
+
93
+ {/* Logs Modal */}
94
+ {modal === 'logs' && (
95
+ <Modal title="System Logs" onClose={() => setModal(null)}>
96
+ <div className="rounded-lg p-4 font-mono text-xs space-y-1 max-h-80 overflow-y-auto"
97
+ style={{ background: 'rgba(8,4,18,0.9)', color: '#a855f7' }}>
98
+ {[
99
+ '[BOOT] Authrix AI v2.2.0 initialized',
100
+ '[SYS] ViT ensemble models loaded',
101
+ '[SYS] MediaPipe face detector ready',
102
+ '[SYS] Wav2Vec2 audio model ready',
103
+ '[SYS] C2PA metadata scanner active',
104
+ '[NET] FastAPI server listening on :8000',
105
+ '[AUTH] API key validation enabled',
106
+ '[CACHE] SHA256 result cache initialized',
107
+ ].map((line, i) => (
108
+ <div key={i} className="opacity-70">{line}</div>
109
+ ))}
110
+ </div>
111
+ </Modal>
112
+ )}
113
+
114
+ {/* Network Modal */}
115
+ {modal === 'network' && (
116
+ <Modal title="Network Status" onClose={() => setModal(null)}>
117
+ <div className="grid grid-cols-2 gap-4">
118
+ {[
119
+ { label: 'API Endpoint', value: window.location.origin },
120
+ { label: 'HF Space', value: 'aarav13-authrix.hf.space' },
121
+ { label: 'Max File Size', value: '100 MB' },
122
+ { label: 'Request Timeout', value: '120s' },
123
+ { label: 'Capture Duration', value: '8s' },
124
+ { label: 'Cache', value: 'SHA256 (1MB)' },
125
+ ].map(({ label, value }) => (
126
+ <div key={label} className="rounded-lg p-4"
127
+ style={{ background: 'rgba(20,10,35,0.6)', border: '1px solid rgba(88,28,135,0.25)' }}>
128
+ <div className="text-[10px] uppercase tracking-widest mb-1 text-purple-500/50">{label}</div>
129
+ <div className="text-sm font-bold font-mono" style={{ color: '#c084fc' }}>{value}</div>
130
+ </div>
131
+ ))}
132
+ </div>
133
+ </Modal>
134
+ )}
135
+ </div>
136
+ );
137
+ }
frontend-react/src/assets/react.svg ADDED
frontend-react/src/assets/vite.svg ADDED
frontend-react/src/components/AnalyzeButton.tsx ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import styled from 'styled-components';
2
+
3
+ interface AnalyzeButtonProps {
4
+ onClick: () => void;
5
+ }
6
+
7
+ const StyledWrapper = styled.div`
8
+ .button {
9
+ --main-size: 1.1em;
10
+ --color-text: #ffffff;
11
+ --color-background: #7c3aed;
12
+ --color-background-hover: #a855f7;
13
+ --color-outline: rgba(168, 85, 247, 0.25);
14
+ --color-shadow: rgba(0, 0, 0, 0.4);
15
+ cursor: pointer;
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ text-decoration: none;
20
+ border: none;
21
+ border-radius: calc(var(--main-size) * 100);
22
+ padding: 0.45em 0 0.45em 0.9em;
23
+ font-family: 'Space Grotesk', 'Poppins', sans-serif;
24
+ font-weight: 700;
25
+ font-size: var(--main-size);
26
+ letter-spacing: 0.1em;
27
+ text-transform: uppercase;
28
+ color: var(--color-text);
29
+ background: var(--color-background);
30
+ box-shadow: 0 0 0.3em 0 var(--color-background);
31
+ transition: 1s;
32
+ }
33
+
34
+ .button:active {
35
+ transform: scale(0.95);
36
+ }
37
+
38
+ .button:hover {
39
+ outline: 0.1em solid transparent;
40
+ outline-offset: 0.2em;
41
+ box-shadow: 0 0 1.2em 0 var(--color-background);
42
+ animation: ripple 1s linear infinite, colorize 1s infinite;
43
+ transition: 0.5s;
44
+ }
45
+
46
+ .button span {
47
+ margin-right: 0.3em;
48
+ transition: 0.5s;
49
+ }
50
+
51
+ .button:hover span {
52
+ text-shadow: 5px 5px 5px var(--color-shadow);
53
+ }
54
+
55
+ .button:active span {
56
+ text-shadow: none;
57
+ }
58
+
59
+ .button svg {
60
+ height: 0.8em;
61
+ fill: var(--color-text);
62
+ margin-right: -0.16em;
63
+ position: relative;
64
+ transition: 0.5s;
65
+ }
66
+
67
+ .button:hover svg {
68
+ margin-right: 0.66em;
69
+ transition: 0.5s;
70
+ filter: drop-shadow(5px 5px 2.5px var(--color-shadow));
71
+ }
72
+
73
+ .button:active svg {
74
+ filter: none;
75
+ }
76
+
77
+ .button svg polygon:nth-child(1) {
78
+ transition: 0.4s;
79
+ transform: translateX(-60%);
80
+ }
81
+
82
+ .button svg polygon:nth-child(2) {
83
+ transition: 0.5s;
84
+ transform: translateX(-30%);
85
+ }
86
+
87
+ .button:hover svg polygon:nth-child(1) {
88
+ transform: translateX(0%);
89
+ animation: opacity 1s infinite 0.6s;
90
+ }
91
+
92
+ .button:hover svg polygon:nth-child(2) {
93
+ transform: translateX(0%);
94
+ animation: opacity 1s infinite 0.4s;
95
+ }
96
+
97
+ .button:hover svg polygon:nth-child(3) {
98
+ animation: opacity 1s infinite 0.2s;
99
+ }
100
+
101
+ @keyframes opacity {
102
+ 0% { opacity: 1; }
103
+ 50% { opacity: 0; }
104
+ 100% { opacity: 1; }
105
+ }
106
+
107
+ @keyframes colorize {
108
+ 0% { background: var(--color-background); }
109
+ 50% { background: var(--color-background-hover); }
110
+ 100% { background: var(--color-background); }
111
+ }
112
+
113
+ @keyframes ripple {
114
+ 0% { outline: 0em solid transparent; outline-offset: -0.1em; }
115
+ 50% { outline: 0.2em solid var(--color-outline); outline-offset: 0.2em; }
116
+ 100% { outline: 0.4em solid transparent; outline-offset: 0.4em; }
117
+ }
118
+ `;
119
+
120
+ export default function AnalyzeButton({ onClick }: AnalyzeButtonProps) {
121
+ return (
122
+ <StyledWrapper>
123
+ <button className="button" onClick={onClick}>
124
+ <span>ANALYZE VIDEO</span>
125
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 66 43">
126
+ <polygon points="39.58,4.46 44.11,0 66,21.5 44.11,43 39.58,38.54 56.94,21.5" />
127
+ <polygon points="19.79,4.46 24.32,0 46.21,21.5 24.32,43 19.79,38.54 37.15,21.5" />
128
+ <polygon points="0,4.46 4.53,0 26.42,21.5 4.53,43 0,38.54 17.36,21.5" />
129
+ </svg>
130
+ </button>
131
+ </StyledWrapper>
132
+ );
133
+ }
frontend-react/src/components/Background.tsx ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export default function Background() {
2
+ return (
3
+ <div className="fixed inset-0 z-0 pointer-events-none">
4
+ {/* Subtle scan lines */}
5
+ <div
6
+ className="absolute inset-0 opacity-10"
7
+ style={{
8
+ backgroundImage:
9
+ 'linear-gradient(rgba(0,0,0,0) 50%,rgba(0,0,0,0.3) 50%)',
10
+ backgroundSize: '100% 4px',
11
+ }}
12
+ />
13
+ {/* Technical grid */}
14
+ <div
15
+ className="absolute inset-0 opacity-[0.04]"
16
+ style={{
17
+ backgroundImage:
18
+ 'linear-gradient(to right,#6d28d9 1px,transparent 1px),linear-gradient(to bottom,#6d28d9 1px,transparent 1px)',
19
+ backgroundSize: '48px 48px',
20
+ }}
21
+ />
22
+ {/* Ambient purple glow — top right */}
23
+ <div
24
+ className="absolute top-0 right-0 w-[700px] h-[700px] rounded-full blur-[140px]"
25
+ style={{ background: 'rgba(124,58,237,0.07)' }}
26
+ />
27
+ {/* Ambient indigo glow — bottom left */}
28
+ <div
29
+ className="absolute bottom-0 left-0 w-[500px] h-[500px] rounded-full blur-[120px]"
30
+ style={{ background: 'rgba(79,46,220,0.06)' }}
31
+ />
32
+ {/* Noise */}
33
+ <div className="absolute inset-0 noise-bg" />
34
+ </div>
35
+ );
36
+ }
frontend-react/src/components/ErrorSection.tsx ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ interface ErrorSectionProps {
2
+ message: string;
3
+ onRetry: () => void;
4
+ }
5
+
6
+ export default function ErrorSection({ message, onRetry }: ErrorSectionProps) {
7
+ return (
8
+ <section className="relative z-10 flex flex-col items-center justify-center px-6 min-h-screen">
9
+ <div className="w-full max-w-lg glass-panel rounded-xl p-10 flex flex-col items-center gap-6 text-center glow-border-error">
10
+ <div className="w-20 h-20 rounded-full bg-[#ffb4ab]/10 border border-[#ffb4ab]/30
11
+ flex items-center justify-center shadow-[0_0_30px_rgba(255,180,171,0.2)]">
12
+ <span className="material-symbols-outlined text-[#ffb4ab] text-[40px]">error</span>
13
+ </div>
14
+ <div>
15
+ <h2 className="text-2xl font-semibold text-[#ffb4ab] mb-2">ANALYSIS FAILED</h2>
16
+ <p className="text-sm text-[#b9cbbc]">{message}</p>
17
+ </div>
18
+ <button
19
+ onClick={onRetry}
20
+ className="px-8 py-3 bg-[#ffb4ab]/10 border border-[#ffb4ab]/50 text-[#ffb4ab]
21
+ font-bold text-xs uppercase tracking-wider rounded hover:bg-[#ffb4ab]/20
22
+ transition-all active:scale-95"
23
+ >
24
+ <span className="flex items-center gap-2">
25
+ <span className="material-symbols-outlined text-[16px]">refresh</span>
26
+ Try Again
27
+ </span>
28
+ </button>
29
+ </div>
30
+ </section>
31
+ );
32
+ }
frontend-react/src/components/FileUploadInput.tsx ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import styled from 'styled-components';
2
+
3
+ interface FileUploadInputProps {
4
+ onFile: (f: File) => void;
5
+ }
6
+
7
+ const StyledWrapper = styled.div`
8
+ .container {
9
+ --transition: 350ms;
10
+ --folder-W: 120px;
11
+ --folder-H: 80px;
12
+ display: flex;
13
+ flex-direction: column;
14
+ align-items: center;
15
+ justify-content: flex-end;
16
+ padding: 10px;
17
+ background: linear-gradient(135deg, #4c1d95, #7c3aed);
18
+ border-radius: 15px;
19
+ box-shadow: 0 15px 30px rgba(88, 28, 135, 0.4);
20
+ height: calc(var(--folder-H) * 1.7);
21
+ position: relative;
22
+ }
23
+
24
+ .folder {
25
+ position: absolute;
26
+ top: -20px;
27
+ left: calc(50% - 60px);
28
+ animation: float 2.5s infinite ease-in-out;
29
+ transition: transform var(--transition) ease;
30
+ }
31
+
32
+ .folder:hover {
33
+ transform: scale(1.05);
34
+ }
35
+
36
+ .folder .front-side,
37
+ .folder .back-side {
38
+ position: absolute;
39
+ transition: transform var(--transition);
40
+ transform-origin: bottom center;
41
+ }
42
+
43
+ .folder .back-side::before,
44
+ .folder .back-side::after {
45
+ content: "";
46
+ display: block;
47
+ background-color: #c084fc;
48
+ opacity: 0.35;
49
+ width: var(--folder-W);
50
+ height: var(--folder-H);
51
+ position: absolute;
52
+ transform-origin: bottom center;
53
+ border-radius: 15px;
54
+ transition: transform 350ms;
55
+ z-index: 0;
56
+ }
57
+
58
+ .container:hover .back-side::before {
59
+ transform: rotateX(-5deg) skewX(5deg);
60
+ }
61
+
62
+ .container:hover .back-side::after {
63
+ transform: rotateX(-15deg) skewX(12deg);
64
+ }
65
+
66
+ .folder .front-side {
67
+ z-index: 1;
68
+ }
69
+
70
+ .container:hover .front-side {
71
+ transform: rotateX(-40deg) skewX(15deg);
72
+ }
73
+
74
+ .folder .tip {
75
+ background: linear-gradient(135deg, #a855f7, #7c3aed);
76
+ width: 80px;
77
+ height: 20px;
78
+ border-radius: 12px 12px 0 0;
79
+ box-shadow: 0 5px 15px rgba(124, 58, 237, 0.5);
80
+ position: absolute;
81
+ top: -10px;
82
+ z-index: 2;
83
+ }
84
+
85
+ .folder .cover {
86
+ background: linear-gradient(135deg, #c084fc, #a855f7);
87
+ width: var(--folder-W);
88
+ height: var(--folder-H);
89
+ box-shadow: 0 15px 30px rgba(88, 28, 135, 0.5);
90
+ border-radius: 10px;
91
+ }
92
+
93
+ .custom-file-upload {
94
+ font-size: 1em;
95
+ font-family: 'Space Grotesk', sans-serif;
96
+ font-weight: 700;
97
+ letter-spacing: 0.08em;
98
+ text-transform: uppercase;
99
+ color: #ffffff;
100
+ text-align: center;
101
+ background: rgba(255, 255, 255, 0.12);
102
+ border: none;
103
+ border-radius: 10px;
104
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
105
+ cursor: pointer;
106
+ transition: background var(--transition) ease;
107
+ display: inline-block;
108
+ width: 100%;
109
+ padding: 10px 35px;
110
+ position: relative;
111
+ }
112
+
113
+ .custom-file-upload:hover {
114
+ background: rgba(255, 255, 255, 0.22);
115
+ }
116
+
117
+ .custom-file-upload input[type="file"] {
118
+ display: none;
119
+ }
120
+
121
+ @keyframes float {
122
+ 0% { transform: translateY(0px); }
123
+ 50% { transform: translateY(-20px); }
124
+ 100% { transform: translateY(0px); }
125
+ }
126
+ `;
127
+
128
+ export default function FileUploadInput({ onFile }: FileUploadInputProps) {
129
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
130
+ const f = e.target.files?.[0];
131
+ if (f && f.type.startsWith('video/')) onFile(f);
132
+ };
133
+
134
+ return (
135
+ <StyledWrapper>
136
+ <div className="container">
137
+ <div className="folder">
138
+ <div className="front-side">
139
+ <div className="tip" />
140
+ <div className="cover" />
141
+ </div>
142
+ <div className="back-side cover" />
143
+ </div>
144
+ <label className="custom-file-upload">
145
+ <input className="title" type="file" accept="video/*" onChange={handleChange} />
146
+ Upload a File
147
+ </label>
148
+ </div>
149
+ </StyledWrapper>
150
+ );
151
+ }
frontend-react/src/components/GridScan.css ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .gridscan {
2
+ position: relative;
3
+ width: 100%;
4
+ height: 100%;
5
+ overflow: hidden;
6
+ }
7
+
8
+ .gridscan__preview {
9
+ position: absolute;
10
+ right: 12px;
11
+ bottom: 12px;
12
+ width: 220px;
13
+ height: 132px;
14
+ border-radius: 8px;
15
+ overflow: hidden;
16
+ border: 1px solid rgba(255, 255, 255, 0.25);
17
+ box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
18
+ background: #000;
19
+ color: #fff;
20
+ font: 12px/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
21
+ pointer-events: none;
22
+ }
23
+
24
+ .gridscan__video {
25
+ width: 100%;
26
+ height: 100%;
27
+ object-fit: cover;
28
+ transform: scaleX(-1);
29
+ }
30
+
31
+ .gridscan__badge {
32
+ position: absolute;
33
+ left: 8px;
34
+ top: 8px;
35
+ padding: 2px 6px;
36
+ background: rgba(0, 0, 0, 0.5);
37
+ border-radius: 6px;
38
+ backdrop-filter: blur(4px);
39
+ }
frontend-react/src/components/GridScan.d.ts ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import type { CSSProperties } from 'react';
2
+
3
+ export interface GridScanProps {
4
+ enableWebcam?: boolean;
5
+ showPreview?: boolean;
6
+ modelsPath?: string;
7
+ sensitivity?: number;
8
+ lineThickness?: number;
9
+ linesColor?: string;
10
+ scanColor?: string;
11
+ scanOpacity?: number;
12
+ gridScale?: number;
13
+ lineStyle?: 'solid' | 'dashed' | 'dotted';
14
+ lineJitter?: number;
15
+ scanDirection?: 'forward' | 'backward' | 'pingpong';
16
+ enablePost?: boolean;
17
+ bloomIntensity?: number;
18
+ bloomThreshold?: number;
19
+ bloomSmoothing?: number;
20
+ chromaticAberration?: number;
21
+ noiseIntensity?: number;
22
+ scanGlow?: number;
23
+ scanSoftness?: number;
24
+ scanPhaseTaper?: number;
25
+ scanDuration?: number;
26
+ scanDelay?: number;
27
+ enableGyro?: boolean;
28
+ scanOnClick?: boolean;
29
+ snapBackDelay?: number;
30
+ className?: string;
31
+ style?: CSSProperties;
32
+ }
33
+
34
+ export declare const GridScan: (props: GridScanProps) => JSX.Element;
35
+ export default GridScan;
frontend-react/src/components/GridScan.jsx ADDED
@@ -0,0 +1,716 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import * as faceapi from 'face-api.js';
2
+ import {
3
+ BloomEffect,
4
+ ChromaticAberrationEffect,
5
+ EffectComposer,
6
+ EffectPass,
7
+ RenderPass,
8
+ } from 'postprocessing';
9
+ import { useEffect, useRef, useState } from 'react';
10
+ import * as THREE from 'three';
11
+ import './GridScan.css';
12
+
13
+ const vert = `varying vec2 vUv;
14
+ void main(){
15
+ vUv = uv;
16
+ gl_Position = vec4(position.xy, 0.0, 1.0);
17
+ }`;
18
+
19
+ const frag = `precision highp float;
20
+ uniform vec3 iResolution;
21
+ uniform float iTime;
22
+ uniform vec2 uSkew;
23
+ uniform float uTilt;
24
+ uniform float uYaw;
25
+ uniform float uLineThickness;
26
+ uniform vec3 uLinesColor;
27
+ uniform vec3 uScanColor;
28
+ uniform float uGridScale;
29
+ uniform float uLineStyle;
30
+ uniform float uLineJitter;
31
+ uniform float uScanOpacity;
32
+ uniform float uScanDirection;
33
+ uniform float uNoise;
34
+ uniform float uBloomOpacity;
35
+ uniform float uScanGlow;
36
+ uniform float uScanSoftness;
37
+ uniform float uPhaseTaper;
38
+ uniform float uScanDuration;
39
+ uniform float uScanDelay;
40
+ varying vec2 vUv;
41
+ uniform float uScanStarts[8];
42
+ uniform float uScanCount;
43
+ const int MAX_SCANS = 8;
44
+
45
+ float smoother01(float a, float b, float x){
46
+ float t = clamp((x - a) / max(1e-5, (b - a)), 0.0, 1.0);
47
+ return t * t * t * (t * (t * 6.0 - 15.0) + 10.0);
48
+ }
49
+
50
+ void mainImage(out vec4 fragColor, in vec2 fragCoord){
51
+ vec2 p = (2.0 * fragCoord - iResolution.xy) / iResolution.y;
52
+ vec3 ro = vec3(0.0);
53
+ vec3 rd = normalize(vec3(p, 2.0));
54
+ float cR = cos(uTilt), sR = sin(uTilt);
55
+ rd.xy = mat2(cR, -sR, sR, cR) * rd.xy;
56
+ float cY = cos(uYaw), sY = sin(uYaw);
57
+ rd.xz = mat2(cY, -sY, sY, cY) * rd.xz;
58
+ vec2 skew = clamp(uSkew, vec2(-0.7), vec2(0.7));
59
+ rd.xy += skew * rd.z;
60
+ vec3 color = vec3(0.0);
61
+ float minT = 1e20;
62
+ float gridScale = max(1e-5, uGridScale);
63
+ float fadeStrength = 2.0;
64
+ vec2 gridUV = vec2(0.0);
65
+ float hitIsY = 1.0;
66
+ for (int i = 0; i < 4; i++){
67
+ float isY = float(i < 2);
68
+ float pos = mix(-0.2, 0.2, float(i)) * isY + mix(-0.5, 0.5, float(i - 2)) * (1.0 - isY);
69
+ float num = pos - (isY * ro.y + (1.0 - isY) * ro.x);
70
+ float den = isY * rd.y + (1.0 - isY) * rd.x;
71
+ float t = num / den;
72
+ vec3 h = ro + rd * t;
73
+ float depthBoost = smoothstep(0.0, 3.0, h.z);
74
+ h.xy += skew * 0.15 * depthBoost;
75
+ bool use = t > 0.0 && t < minT;
76
+ gridUV = use ? mix(h.zy, h.xz, isY) / gridScale : gridUV;
77
+ minT = use ? t : minT;
78
+ hitIsY = use ? isY : hitIsY;
79
+ }
80
+ vec3 hit = ro + rd * minT;
81
+ float dist = length(hit - ro);
82
+ float jitterAmt = clamp(uLineJitter, 0.0, 1.0);
83
+ if (jitterAmt > 0.0) {
84
+ vec2 j = vec2(
85
+ sin(gridUV.y * 2.7 + iTime * 1.8),
86
+ cos(gridUV.x * 2.3 - iTime * 1.6)
87
+ ) * (0.15 * jitterAmt);
88
+ gridUV += j;
89
+ }
90
+ float fx = fract(gridUV.x);
91
+ float fy = fract(gridUV.y);
92
+ float ax = min(fx, 1.0 - fx);
93
+ float ay = min(fy, 1.0 - fy);
94
+ float wx = fwidth(gridUV.x);
95
+ float wy = fwidth(gridUV.y);
96
+ float halfPx = max(0.0, uLineThickness) * 0.5;
97
+ float tx = halfPx * wx;
98
+ float ty = halfPx * wy;
99
+ float aax = wx;
100
+ float aay = wy;
101
+ float lineX = 1.0 - smoothstep(tx, tx + aax, ax);
102
+ float lineY = 1.0 - smoothstep(ty, ty + aay, ay);
103
+ if (uLineStyle > 0.5) {
104
+ float dashRepeat = 4.0;
105
+ float dashDuty = 0.5;
106
+ float vy = fract(gridUV.y * dashRepeat);
107
+ float vx = fract(gridUV.x * dashRepeat);
108
+ float dashMaskY = step(vy, dashDuty);
109
+ float dashMaskX = step(vx, dashDuty);
110
+ if (uLineStyle < 1.5) {
111
+ lineX *= dashMaskY;
112
+ lineY *= dashMaskX;
113
+ } else {
114
+ float dotRepeat = 6.0;
115
+ float dotWidth = 0.18;
116
+ float cy = abs(fract(gridUV.y * dotRepeat) - 0.5);
117
+ float cx = abs(fract(gridUV.x * dotRepeat) - 0.5);
118
+ float dotMaskY = 1.0 - smoothstep(dotWidth, dotWidth + fwidth(gridUV.y * dotRepeat), cy);
119
+ float dotMaskX = 1.0 - smoothstep(dotWidth, dotWidth + fwidth(gridUV.x * dotRepeat), cx);
120
+ lineX *= dotMaskY;
121
+ lineY *= dotMaskX;
122
+ }
123
+ }
124
+ float primaryMask = max(lineX, lineY);
125
+ vec2 gridUV2 = (hitIsY > 0.5 ? hit.xz : hit.zy) / gridScale;
126
+ if (jitterAmt > 0.0) {
127
+ vec2 j2 = vec2(
128
+ cos(gridUV2.y * 2.1 - iTime * 1.4),
129
+ sin(gridUV2.x * 2.5 + iTime * 1.7)
130
+ ) * (0.15 * jitterAmt);
131
+ gridUV2 += j2;
132
+ }
133
+ float fx2 = fract(gridUV2.x);
134
+ float fy2 = fract(gridUV2.y);
135
+ float ax2 = min(fx2, 1.0 - fx2);
136
+ float ay2 = min(fy2, 1.0 - fy2);
137
+ float wx2 = fwidth(gridUV2.x);
138
+ float wy2 = fwidth(gridUV2.y);
139
+ float tx2 = halfPx * wx2;
140
+ float ty2 = halfPx * wy2;
141
+ float aax2 = wx2;
142
+ float aay2 = wy2;
143
+ float lineX2 = 1.0 - smoothstep(tx2, tx2 + aax2, ax2);
144
+ float lineY2 = 1.0 - smoothstep(ty2, ty2 + aay2, ay2);
145
+ if (uLineStyle > 0.5) {
146
+ float dashRepeat2 = 4.0;
147
+ float dashDuty2 = 0.5;
148
+ float vy2m = fract(gridUV2.y * dashRepeat2);
149
+ float vx2m = fract(gridUV2.x * dashRepeat2);
150
+ float dashMaskY2 = step(vy2m, dashDuty2);
151
+ float dashMaskX2 = step(vx2m, dashDuty2);
152
+ if (uLineStyle < 1.5) {
153
+ lineX2 *= dashMaskY2;
154
+ lineY2 *= dashMaskX2;
155
+ } else {
156
+ float dotRepeat2 = 6.0;
157
+ float dotWidth2 = 0.18;
158
+ float cy2 = abs(fract(gridUV2.y * dotRepeat2) - 0.5);
159
+ float cx2 = abs(fract(gridUV2.x * dotRepeat2) - 0.5);
160
+ float dotMaskY2 = 1.0 - smoothstep(dotWidth2, dotWidth2 + fwidth(gridUV2.y * dotRepeat2), cy2);
161
+ float dotMaskX2 = 1.0 - smoothstep(dotWidth2, dotWidth2 + fwidth(gridUV2.x * dotRepeat2), cx2);
162
+ lineX2 *= dotMaskY2;
163
+ lineY2 *= dotMaskX2;
164
+ }
165
+ }
166
+ float altMask = max(lineX2, lineY2);
167
+ float edgeDistX = min(abs(hit.x - (-0.5)), abs(hit.x - 0.5));
168
+ float edgeDistY = min(abs(hit.y - (-0.2)), abs(hit.y - 0.2));
169
+ float edgeDist = mix(edgeDistY, edgeDistX, hitIsY);
170
+ float edgeGate = 1.0 - smoothstep(gridScale * 0.5, gridScale * 2.0, edgeDist);
171
+ altMask *= edgeGate;
172
+ float lineMask = max(primaryMask, altMask);
173
+ float fade = exp(-dist * fadeStrength);
174
+ float dur = max(0.05, uScanDuration);
175
+ float del = max(0.0, uScanDelay);
176
+ float scanZMax = 2.0;
177
+ float widthScale = max(0.1, uScanGlow);
178
+ float sigma = max(0.001, 0.18 * widthScale * uScanSoftness);
179
+ float sigmaA = sigma * 2.0;
180
+ float combinedPulse = 0.0;
181
+ float combinedAura = 0.0;
182
+ float cycle = dur + del;
183
+ float tCycle = mod(iTime, cycle);
184
+ float scanPhase = clamp((tCycle - del) / dur, 0.0, 1.0);
185
+ float phase = scanPhase;
186
+ if (uScanDirection > 0.5 && uScanDirection < 1.5) {
187
+ phase = 1.0 - phase;
188
+ } else if (uScanDirection > 1.5) {
189
+ float t2 = mod(max(0.0, iTime - del), 2.0 * dur);
190
+ phase = (t2 < dur) ? (t2 / dur) : (1.0 - (t2 - dur) / dur);
191
+ }
192
+ float scanZ = phase * scanZMax;
193
+ float dz = abs(hit.z - scanZ);
194
+ float lineBand = exp(-0.5 * (dz * dz) / (sigma * sigma));
195
+ float taper = clamp(uPhaseTaper, 0.0, 0.49);
196
+ float headW = taper;
197
+ float tailW = taper;
198
+ float headFade = smoother01(0.0, headW, phase);
199
+ float tailFade = 1.0 - smoother01(1.0 - tailW, 1.0, phase);
200
+ float phaseWindow = headFade * tailFade;
201
+ float pulseBase = lineBand * phaseWindow;
202
+ combinedPulse += pulseBase * clamp(uScanOpacity, 0.0, 1.0);
203
+ float auraBand = exp(-0.5 * (dz * dz) / (sigmaA * sigmaA));
204
+ combinedAura += (auraBand * 0.25) * phaseWindow * clamp(uScanOpacity, 0.0, 1.0);
205
+ for (int i = 0; i < MAX_SCANS; i++) {
206
+ if (float(i) >= uScanCount) break;
207
+ float tActiveI = iTime - uScanStarts[i];
208
+ float phaseI = clamp(tActiveI / dur, 0.0, 1.0);
209
+ if (uScanDirection > 0.5 && uScanDirection < 1.5) {
210
+ phaseI = 1.0 - phaseI;
211
+ } else if (uScanDirection > 1.5) {
212
+ phaseI = (phaseI < 0.5) ? (phaseI * 2.0) : (1.0 - (phaseI - 0.5) * 2.0);
213
+ }
214
+ float scanZI = phaseI * scanZMax;
215
+ float dzI = abs(hit.z - scanZI);
216
+ float lineBandI = exp(-0.5 * (dzI * dzI) / (sigma * sigma));
217
+ float headFadeI = smoother01(0.0, headW, phaseI);
218
+ float tailFadeI = 1.0 - smoother01(1.0 - tailW, 1.0, phaseI);
219
+ float phaseWindowI = headFadeI * tailFadeI;
220
+ combinedPulse += lineBandI * phaseWindowI * clamp(uScanOpacity, 0.0, 1.0);
221
+ float auraBandI = exp(-0.5 * (dzI * dzI) / (sigmaA * sigmaA));
222
+ combinedAura += (auraBandI * 0.25) * phaseWindowI * clamp(uScanOpacity, 0.0, 1.0);
223
+ }
224
+ float lineVis = lineMask;
225
+ vec3 gridCol = uLinesColor * lineVis * fade;
226
+ vec3 scanCol = uScanColor * combinedPulse;
227
+ vec3 scanAura = uScanColor * combinedAura;
228
+ color = gridCol + scanCol + scanAura;
229
+ float n = fract(sin(dot(gl_FragCoord.xy + vec2(iTime * 123.4), vec2(12.9898,78.233))) * 43758.5453123);
230
+ color += (n - 0.5) * uNoise;
231
+ color = clamp(color, 0.0, 1.0);
232
+ float alpha = clamp(max(lineVis, combinedPulse), 0.0, 1.0);
233
+ float gx = 1.0 - smoothstep(tx * 2.0, tx * 2.0 + aax * 2.0, ax);
234
+ float gy = 1.0 - smoothstep(ty * 2.0, ty * 2.0 + aay * 2.0, ay);
235
+ float halo = max(gx, gy) * fade;
236
+ alpha = max(alpha, halo * clamp(uBloomOpacity, 0.0, 1.0));
237
+ fragColor = vec4(color, alpha);
238
+ }
239
+
240
+ void main(){
241
+ vec4 c;
242
+ mainImage(c, vUv * iResolution.xy);
243
+ gl_FragColor = c;
244
+ }`;
245
+
246
+ // ── Helpers ──────────────────────────────────────────────────────────────────
247
+
248
+ function srgbColor(hex) {
249
+ return new THREE.Color(hex).convertSRGBToLinear();
250
+ }
251
+
252
+ function smoothDampVec2(current, target, currentVelocity, smoothTime, maxSpeed, deltaTime) {
253
+ const out = current.clone();
254
+ smoothTime = Math.max(0.0001, smoothTime);
255
+ const omega = 2 / smoothTime;
256
+ const x = omega * deltaTime;
257
+ const exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);
258
+ let change = current.clone().sub(target);
259
+ const originalTo = target.clone();
260
+ const maxChange = maxSpeed * smoothTime;
261
+ if (change.length() > maxChange) change.setLength(maxChange);
262
+ target = current.clone().sub(change);
263
+ const temp = currentVelocity.clone().addScaledVector(change, omega).multiplyScalar(deltaTime);
264
+ currentVelocity.sub(temp.clone().multiplyScalar(omega));
265
+ currentVelocity.multiplyScalar(exp);
266
+ out.copy(target.clone().add(change.add(temp).multiplyScalar(exp)));
267
+ const origMinusCurrent = originalTo.clone().sub(current);
268
+ const outMinusOrig = out.clone().sub(originalTo);
269
+ if (origMinusCurrent.dot(outMinusOrig) > 0) {
270
+ out.copy(originalTo);
271
+ currentVelocity.set(0, 0);
272
+ }
273
+ return out;
274
+ }
275
+
276
+ function smoothDampFloat(current, target, velRef, smoothTime, maxSpeed, deltaTime) {
277
+ smoothTime = Math.max(0.0001, smoothTime);
278
+ const omega = 2 / smoothTime;
279
+ const x = omega * deltaTime;
280
+ const exp = 1 / (1 + x + 0.48 * x * x + 0.235 * x * x * x);
281
+ let change = current - target;
282
+ const originalTo = target;
283
+ const maxChange = maxSpeed * smoothTime;
284
+ change = Math.sign(change) * Math.min(Math.abs(change), maxChange);
285
+ target = current - change;
286
+ const temp = (velRef.v + omega * change) * deltaTime;
287
+ velRef.v = (velRef.v - omega * temp) * exp;
288
+ let out = target + (change + temp) * exp;
289
+ if ((originalTo - current) * (out - originalTo) > 0) {
290
+ out = originalTo;
291
+ velRef.v = 0;
292
+ }
293
+ return { value: out, v: velRef.v };
294
+ }
295
+
296
+ function medianPush(buf, v, maxLen) {
297
+ buf.push(v);
298
+ if (buf.length > maxLen) buf.shift();
299
+ }
300
+
301
+ function median(buf) {
302
+ if (buf.length === 0) return 0;
303
+ const a = [...buf].sort((x, y) => x - y);
304
+ const mid = Math.floor(a.length / 2);
305
+ return a.length % 2 ? a[mid] : (a[mid - 1] + a[mid]) * 0.5;
306
+ }
307
+
308
+ function centroid(points) {
309
+ let x = 0, y = 0;
310
+ const n = points.length || 1;
311
+ for (const p of points) { x += p.x; y += p.y; }
312
+ return { x: x / n, y: y / n };
313
+ }
314
+
315
+ function dist2(a, b) {
316
+ return Math.hypot(a.x - b.x, a.y - b.y);
317
+ }
318
+
319
+ // ── Component ─────────────────────────────────────────────────────────────────
320
+
321
+ const MAX_SCANS = 8;
322
+
323
+ export const GridScan = ({
324
+ enableWebcam = false,
325
+ showPreview = false,
326
+ modelsPath = 'https://cdn.jsdelivr.net/gh/justadudewhohacks/face-api.js@0.22.2/weights',
327
+ sensitivity = 0.55,
328
+ lineThickness = 1,
329
+ linesColor = '#2F293A',
330
+ scanColor = '#FF9FFC',
331
+ scanOpacity = 0.4,
332
+ gridScale = 0.1,
333
+ lineStyle = 'solid',
334
+ lineJitter = 0.1,
335
+ scanDirection = 'pingpong',
336
+ enablePost = true,
337
+ bloomIntensity = 0,
338
+ bloomThreshold = 0,
339
+ bloomSmoothing = 0,
340
+ chromaticAberration = 0.002,
341
+ noiseIntensity = 0.01,
342
+ scanGlow = 0.5,
343
+ scanSoftness = 2,
344
+ scanPhaseTaper = 0.9,
345
+ scanDuration = 2.0,
346
+ scanDelay = 2.0,
347
+ enableGyro = false,
348
+ scanOnClick = false,
349
+ snapBackDelay = 250,
350
+ className,
351
+ style,
352
+ }) => {
353
+ const containerRef = useRef(null);
354
+ const videoRef = useRef(null);
355
+ const rendererRef = useRef(null);
356
+ const materialRef = useRef(null);
357
+ const composerRef = useRef(null);
358
+ const bloomRef = useRef(null);
359
+ const chromaRef = useRef(null);
360
+ const rafRef = useRef(null);
361
+ const [modelsReady, setModelsReady] = useState(false);
362
+ const [uiFaceActive, setUiFaceActive] = useState(false);
363
+
364
+ const lookTarget = useRef(new THREE.Vector2(0, 0));
365
+ const tiltTarget = useRef(0);
366
+ const yawTarget = useRef(0);
367
+ const lookCurrent = useRef(new THREE.Vector2(0, 0));
368
+ const lookVel = useRef(new THREE.Vector2(0, 0));
369
+ const tiltCurrent = useRef(0);
370
+ const tiltVel = useRef(0);
371
+ const yawCurrent = useRef(0);
372
+ const yawVel = useRef(0);
373
+
374
+ const scanStartsRef = useRef([]);
375
+
376
+ const pushScan = (t) => {
377
+ const arr = scanStartsRef.current.slice();
378
+ if (arr.length >= MAX_SCANS) arr.shift();
379
+ arr.push(t);
380
+ scanStartsRef.current = arr;
381
+ if (materialRef.current) {
382
+ const u = materialRef.current.uniforms;
383
+ const buf = new Array(MAX_SCANS).fill(0);
384
+ for (let i = 0; i < arr.length && i < MAX_SCANS; i++) buf[i] = arr[i];
385
+ u.uScanStarts.value = buf;
386
+ u.uScanCount.value = arr.length;
387
+ }
388
+ };
389
+
390
+ const bufX = useRef([]);
391
+ const bufY = useRef([]);
392
+ const bufT = useRef([]);
393
+ const bufYaw = useRef([]);
394
+
395
+ const s = THREE.MathUtils.clamp(sensitivity, 0, 1);
396
+ const skewScale = THREE.MathUtils.lerp(0.06, 0.2, s);
397
+ const tiltScale = THREE.MathUtils.lerp(0.12, 0.3, s);
398
+ const yawScale = THREE.MathUtils.lerp(0.1, 0.28, s);
399
+ const depthResponse = THREE.MathUtils.lerp(0.25, 0.45, s);
400
+ const smoothTime = THREE.MathUtils.lerp(0.45, 0.12, s);
401
+ const maxSpeed = Infinity;
402
+ const yBoost = THREE.MathUtils.lerp(1.2, 1.6, s);
403
+
404
+ // Mouse interaction
405
+ useEffect(() => {
406
+ const el = containerRef.current;
407
+ if (!el) return;
408
+ let leaveTimer = null;
409
+
410
+ const onMove = (e) => {
411
+ if (uiFaceActive) return;
412
+ if (leaveTimer) { clearTimeout(leaveTimer); leaveTimer = null; }
413
+ const rect = el.getBoundingClientRect();
414
+ const nx = ((e.clientX - rect.left) / rect.width) * 2 - 1;
415
+ const ny = -(((e.clientY - rect.top) / rect.height) * 2 - 1);
416
+ lookTarget.current.set(nx, ny);
417
+ };
418
+
419
+ const onClick = async () => {
420
+ const nowSec = performance.now() / 1000;
421
+ if (scanOnClick) pushScan(nowSec);
422
+ if (enableGyro && typeof window !== 'undefined' && window.DeviceOrientationEvent && DeviceOrientationEvent.requestPermission) {
423
+ try { await DeviceOrientationEvent.requestPermission(); } catch { /* noop */ }
424
+ }
425
+ };
426
+
427
+ const onLeave = () => {
428
+ if (uiFaceActive) return;
429
+ if (leaveTimer) clearTimeout(leaveTimer);
430
+ leaveTimer = window.setTimeout(() => {
431
+ lookTarget.current.set(0, 0);
432
+ tiltTarget.current = 0;
433
+ yawTarget.current = 0;
434
+ }, Math.max(0, snapBackDelay || 0));
435
+ };
436
+
437
+ el.addEventListener('mousemove', onMove);
438
+ el.addEventListener('mouseenter', () => { if (leaveTimer) { clearTimeout(leaveTimer); leaveTimer = null; } });
439
+ if (scanOnClick) el.addEventListener('click', onClick);
440
+ el.addEventListener('mouseleave', onLeave);
441
+
442
+ return () => {
443
+ el.removeEventListener('mousemove', onMove);
444
+ el.removeEventListener('mouseleave', onLeave);
445
+ if (scanOnClick) el.removeEventListener('click', onClick);
446
+ if (leaveTimer) clearTimeout(leaveTimer);
447
+ };
448
+ }, [uiFaceActive, snapBackDelay, scanOnClick, enableGyro]);
449
+
450
+ // Three.js renderer setup
451
+ useEffect(() => {
452
+ const container = containerRef.current;
453
+ if (!container) return;
454
+
455
+ const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
456
+ rendererRef.current = renderer;
457
+ renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, 2));
458
+ renderer.setSize(container.clientWidth, container.clientHeight);
459
+ renderer.outputColorSpace = THREE.SRGBColorSpace;
460
+ renderer.toneMapping = THREE.NoToneMapping;
461
+ renderer.autoClear = false;
462
+ renderer.setClearColor(0x000000, 0);
463
+ container.appendChild(renderer.domElement);
464
+
465
+ const uniforms = {
466
+ iResolution: { value: new THREE.Vector3(container.clientWidth, container.clientHeight, renderer.getPixelRatio()) },
467
+ iTime: { value: 0 },
468
+ uSkew: { value: new THREE.Vector2(0, 0) },
469
+ uTilt: { value: 0 },
470
+ uYaw: { value: 0 },
471
+ uLineThickness: { value: lineThickness },
472
+ uLinesColor: { value: srgbColor(linesColor) },
473
+ uScanColor: { value: srgbColor(scanColor) },
474
+ uGridScale: { value: gridScale },
475
+ uLineStyle: { value: lineStyle === 'dashed' ? 1 : lineStyle === 'dotted' ? 2 : 0 },
476
+ uLineJitter: { value: Math.max(0, Math.min(1, lineJitter || 0)) },
477
+ uScanOpacity: { value: scanOpacity },
478
+ uNoise: { value: noiseIntensity },
479
+ uBloomOpacity: { value: bloomIntensity },
480
+ uScanGlow: { value: scanGlow },
481
+ uScanSoftness: { value: scanSoftness },
482
+ uPhaseTaper: { value: scanPhaseTaper },
483
+ uScanDuration: { value: scanDuration },
484
+ uScanDelay: { value: scanDelay },
485
+ uScanDirection: { value: scanDirection === 'backward' ? 1 : scanDirection === 'pingpong' ? 2 : 0 },
486
+ uScanStarts: { value: new Array(MAX_SCANS).fill(0) },
487
+ uScanCount: { value: 0 },
488
+ };
489
+
490
+ const material = new THREE.ShaderMaterial({
491
+ uniforms,
492
+ vertexShader: vert,
493
+ fragmentShader: frag,
494
+ transparent: true,
495
+ depthWrite: false,
496
+ depthTest: false,
497
+ });
498
+ materialRef.current = material;
499
+
500
+ const scene = new THREE.Scene();
501
+ const camera = new THREE.OrthographicCamera(-1, 1, 1, -1, 0, 1);
502
+ const quad = new THREE.Mesh(new THREE.PlaneGeometry(2, 2), material);
503
+ scene.add(quad);
504
+
505
+ let composer = null;
506
+ if (enablePost) {
507
+ composer = new EffectComposer(renderer);
508
+ composerRef.current = composer;
509
+ composer.addPass(new RenderPass(scene, camera));
510
+ const bloom = new BloomEffect({ intensity: 1.0, luminanceThreshold: bloomThreshold, luminanceSmoothing: bloomSmoothing });
511
+ bloom.blendMode.opacity.value = Math.max(0, bloomIntensity);
512
+ bloomRef.current = bloom;
513
+ const chroma = new ChromaticAberrationEffect({
514
+ offset: new THREE.Vector2(chromaticAberration, chromaticAberration),
515
+ radialModulation: true,
516
+ modulationOffset: 0.0,
517
+ });
518
+ chromaRef.current = chroma;
519
+ const effectPass = new EffectPass(camera, bloom, chroma);
520
+ effectPass.renderToScreen = true;
521
+ composer.addPass(effectPass);
522
+ }
523
+
524
+ const onResize = () => {
525
+ renderer.setSize(container.clientWidth, container.clientHeight);
526
+ material.uniforms.iResolution.value.set(container.clientWidth, container.clientHeight, renderer.getPixelRatio());
527
+ if (composerRef.current) composerRef.current.setSize(container.clientWidth, container.clientHeight);
528
+ };
529
+ window.addEventListener('resize', onResize);
530
+
531
+ let last = performance.now();
532
+ const tick = () => {
533
+ const now = performance.now();
534
+ const dt = Math.max(0, Math.min(0.1, (now - last) / 1000));
535
+ last = now;
536
+
537
+ lookCurrent.current.copy(
538
+ smoothDampVec2(lookCurrent.current, lookTarget.current, lookVel.current, smoothTime, maxSpeed, dt)
539
+ );
540
+ const tiltSm = smoothDampFloat(tiltCurrent.current, tiltTarget.current, { v: tiltVel.current }, smoothTime, maxSpeed, dt);
541
+ tiltCurrent.current = tiltSm.value; tiltVel.current = tiltSm.v;
542
+ const yawSm = smoothDampFloat(yawCurrent.current, yawTarget.current, { v: yawVel.current }, smoothTime, maxSpeed, dt);
543
+ yawCurrent.current = yawSm.value; yawVel.current = yawSm.v;
544
+
545
+ const skew = new THREE.Vector2(lookCurrent.current.x * skewScale, -lookCurrent.current.y * yBoost * skewScale);
546
+ material.uniforms.uSkew.value.set(skew.x, skew.y);
547
+ material.uniforms.uTilt.value = tiltCurrent.current * tiltScale;
548
+ material.uniforms.uYaw.value = THREE.MathUtils.clamp(yawCurrent.current * yawScale, -0.6, 0.6);
549
+ material.uniforms.iTime.value = now / 1000;
550
+
551
+ renderer.clear(true, true, true);
552
+ if (composerRef.current) composerRef.current.render(dt);
553
+ else renderer.render(scene, camera);
554
+
555
+ rafRef.current = requestAnimationFrame(tick);
556
+ };
557
+ rafRef.current = requestAnimationFrame(tick);
558
+
559
+ return () => {
560
+ if (rafRef.current) cancelAnimationFrame(rafRef.current);
561
+ window.removeEventListener('resize', onResize);
562
+ material.dispose();
563
+ quad.geometry.dispose();
564
+ if (composerRef.current) { composerRef.current.dispose(); composerRef.current = null; }
565
+ renderer.dispose();
566
+ renderer.forceContextLoss();
567
+ if (container.contains(renderer.domElement)) container.removeChild(renderer.domElement);
568
+ };
569
+ // eslint-disable-next-line react-hooks/exhaustive-deps
570
+ }, [sensitivity, lineThickness, linesColor, scanColor, scanOpacity, gridScale, lineStyle, lineJitter,
571
+ scanDirection, enablePost, noiseIntensity, bloomIntensity, scanGlow, scanSoftness, scanPhaseTaper,
572
+ scanDuration, scanDelay, bloomThreshold, bloomSmoothing, chromaticAberration]);
573
+
574
+ // Prop updates without full remount
575
+ useEffect(() => {
576
+ const m = materialRef.current;
577
+ if (!m) return;
578
+ const u = m.uniforms;
579
+ u.uLineThickness.value = lineThickness;
580
+ u.uLinesColor.value.copy(srgbColor(linesColor));
581
+ u.uScanColor.value.copy(srgbColor(scanColor));
582
+ u.uGridScale.value = gridScale;
583
+ u.uLineStyle.value = lineStyle === 'dashed' ? 1 : lineStyle === 'dotted' ? 2 : 0;
584
+ u.uLineJitter.value = Math.max(0, Math.min(1, lineJitter || 0));
585
+ u.uBloomOpacity.value = Math.max(0, bloomIntensity);
586
+ u.uNoise.value = Math.max(0, noiseIntensity);
587
+ u.uScanGlow.value = scanGlow;
588
+ u.uScanOpacity.value = Math.max(0, Math.min(1, scanOpacity));
589
+ u.uScanDirection.value = scanDirection === 'backward' ? 1 : scanDirection === 'pingpong' ? 2 : 0;
590
+ u.uScanSoftness.value = scanSoftness;
591
+ u.uPhaseTaper.value = scanPhaseTaper;
592
+ u.uScanDuration.value = Math.max(0.05, scanDuration);
593
+ u.uScanDelay.value = Math.max(0.0, scanDelay);
594
+ if (bloomRef.current) {
595
+ bloomRef.current.blendMode.opacity.value = Math.max(0, bloomIntensity);
596
+ bloomRef.current.luminanceMaterial.threshold = bloomThreshold;
597
+ bloomRef.current.luminanceMaterial.smoothing = bloomSmoothing;
598
+ }
599
+ if (chromaRef.current) chromaRef.current.offset.set(chromaticAberration, chromaticAberration);
600
+ }, [lineThickness, linesColor, scanColor, gridScale, lineStyle, lineJitter, bloomIntensity,
601
+ bloomThreshold, bloomSmoothing, chromaticAberration, noiseIntensity, scanGlow, scanOpacity,
602
+ scanDirection, scanSoftness, scanPhaseTaper, scanDuration, scanDelay]);
603
+
604
+ // Gyro
605
+ useEffect(() => {
606
+ if (!enableGyro) return;
607
+ const handler = (e) => {
608
+ if (uiFaceActive) return;
609
+ const gamma = e.gamma ?? 0;
610
+ const beta = e.beta ?? 0;
611
+ lookTarget.current.set(THREE.MathUtils.clamp(gamma / 45, -1, 1), THREE.MathUtils.clamp(-beta / 30, -1, 1));
612
+ tiltTarget.current = THREE.MathUtils.degToRad(gamma) * 0.4;
613
+ };
614
+ window.addEventListener('deviceorientation', handler);
615
+ return () => window.removeEventListener('deviceorientation', handler);
616
+ }, [enableGyro, uiFaceActive]);
617
+
618
+ // Face-api models
619
+ useEffect(() => {
620
+ let canceled = false;
621
+ const load = async () => {
622
+ try {
623
+ await Promise.all([
624
+ faceapi.nets.tinyFaceDetector.loadFromUri(modelsPath),
625
+ faceapi.nets.faceLandmark68TinyNet.loadFromUri(modelsPath),
626
+ ]);
627
+ if (!canceled) setModelsReady(true);
628
+ } catch { if (!canceled) setModelsReady(false); }
629
+ };
630
+ load();
631
+ return () => { canceled = true; };
632
+ }, [modelsPath]);
633
+
634
+ // Webcam face tracking
635
+ useEffect(() => {
636
+ let stop = false;
637
+ let lastDetect = 0;
638
+ const video = videoRef.current;
639
+
640
+ const start = async () => {
641
+ if (!enableWebcam || !modelsReady || !video) return;
642
+ try {
643
+ const stream = await navigator.mediaDevices.getUserMedia({ video: { facingMode: 'user', width: { ideal: 1280 }, height: { ideal: 720 } }, audio: false });
644
+ video.srcObject = stream;
645
+ await video.play();
646
+ } catch { return; }
647
+
648
+ const opts = new faceapi.TinyFaceDetectorOptions({ inputSize: 320, scoreThreshold: 0.5 });
649
+ const detect = async (ts) => {
650
+ if (stop) return;
651
+ if (ts - lastDetect >= 33) {
652
+ lastDetect = ts;
653
+ try {
654
+ const res = await faceapi.detectSingleFace(video, opts).withFaceLandmarks(true);
655
+ if (res?.detection) {
656
+ const { box } = res.detection;
657
+ const vw = video.videoWidth || 1, vh = video.videoHeight || 1;
658
+ const nx = (box.x + box.width * 0.5) / vw * 2 - 1;
659
+ const ny = (box.y + box.height * 0.5) / vh * 2 - 1;
660
+ medianPush(bufX.current, nx, 5); medianPush(bufY.current, ny, 5);
661
+ const look = new THREE.Vector2(Math.tanh(median(bufX.current)), Math.tanh(median(bufY.current)));
662
+ const faceSize = Math.min(1, Math.hypot(box.width / vw, box.height / vh));
663
+ lookTarget.current.copy(look.multiplyScalar(1 + depthResponse * (faceSize - 0.25)));
664
+ const lc = centroid(res.landmarks.getLeftEye());
665
+ const rc = centroid(res.landmarks.getRightEye());
666
+ medianPush(bufT.current, Math.atan2(rc.y - lc.y, rc.x - lc.x), 5);
667
+ tiltTarget.current = median(bufT.current);
668
+ const nose = res.landmarks.getNose();
669
+ const tip = nose[nose.length - 1] || nose[Math.floor(nose.length / 2)];
670
+ const jaw = res.landmarks.getJawOutline();
671
+ const eyeDist = Math.hypot(rc.x - lc.x, rc.y - lc.y) + 1e-6;
672
+ const yawSignal = Math.tanh(THREE.MathUtils.clamp((dist2(tip, jaw[13] || jaw[14]) - dist2(tip, jaw[3] || jaw[2])) / (eyeDist * 1.6), -1, 1));
673
+ medianPush(bufYaw.current, yawSignal, 5);
674
+ yawTarget.current = median(bufYaw.current);
675
+ setUiFaceActive(true);
676
+ } else { setUiFaceActive(false); }
677
+ } catch { setUiFaceActive(false); }
678
+ }
679
+ if ('requestVideoFrameCallback' in HTMLVideoElement.prototype) {
680
+ video.requestVideoFrameCallback(() => detect(performance.now()));
681
+ } else { requestAnimationFrame(detect); }
682
+ };
683
+ requestAnimationFrame(detect);
684
+ };
685
+
686
+ start();
687
+ return () => {
688
+ stop = true;
689
+ if (video) {
690
+ const stream = video.srcObject;
691
+ if (stream) stream.getTracks().forEach(t => t.stop());
692
+ video.pause();
693
+ video.srcObject = null;
694
+ }
695
+ };
696
+ }, [enableWebcam, modelsReady, depthResponse]);
697
+
698
+ return (
699
+ <div ref={containerRef} className={`gridscan${className ? ` ${className}` : ''}`} style={style}>
700
+ {showPreview && (
701
+ <div className="gridscan__preview">
702
+ <video ref={videoRef} muted playsInline autoPlay className="gridscan__video" />
703
+ <div className="gridscan__badge">
704
+ {enableWebcam
705
+ ? modelsReady
706
+ ? uiFaceActive ? 'Face: tracking' : 'Face: searching'
707
+ : 'Loading models'
708
+ : 'Webcam disabled'}
709
+ </div>
710
+ </div>
711
+ )}
712
+ </div>
713
+ );
714
+ };
715
+
716
+ export default GridScan;
frontend-react/src/components/HeroSection.tsx ADDED
@@ -0,0 +1,221 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import GridScan from './GridScan';
2
+ import AnalyzeButton from './AnalyzeButton';
3
+
4
+ interface HeroSectionProps {
5
+ onAnalyze: () => void;
6
+ }
7
+
8
+ export default function HeroSection({ onAnalyze }: HeroSectionProps) {
9
+ return (
10
+ <section className="relative w-full min-h-screen overflow-hidden">
11
+
12
+ {/* GridScan — true full-viewport background */}
13
+ <div className="absolute inset-0 z-0">
14
+ <GridScan
15
+ sensitivity={0.5}
16
+ lineThickness={1}
17
+ linesColor="#2a1a3e"
18
+ gridScale={0.1}
19
+ scanColor="#a855f7"
20
+ scanOpacity={0.45}
21
+ enablePost={true}
22
+ bloomIntensity={0.7}
23
+ bloomThreshold={0.1}
24
+ bloomSmoothing={0.2}
25
+ chromaticAberration={0.003}
26
+ noiseIntensity={0.012}
27
+ scanDirection="pingpong"
28
+ scanDuration={2.5}
29
+ scanDelay={1.2}
30
+ scanGlow={0.7}
31
+ scanSoftness={2.5}
32
+ scanPhaseTaper={0.85}
33
+ />
34
+ </div>
35
+
36
+ {/* Dark purple gradient overlay */}
37
+ <div
38
+ className="absolute inset-0 z-[1] pointer-events-none"
39
+ style={{
40
+ background:
41
+ 'radial-gradient(ellipse 80% 60% at 50% 40%, rgba(88,28,135,0.18) 0%, rgba(10,5,20,0.55) 70%, rgba(5,2,12,0.85) 100%)',
42
+ }}
43
+ />
44
+
45
+ {/* ── Two-column layout: left content / right orb ── */}
46
+ <div className="relative z-10 flex items-center min-h-screen pt-16 px-4 md:px-8 max-w-7xl mx-auto w-full">
47
+ <div className="grid grid-cols-1 lg:grid-cols-2 gap-12 items-center w-full min-h-[calc(100vh-4rem)]">
48
+
49
+ {/* ── LEFT: text + buttons + stats ── */}
50
+ <div className="flex flex-col items-start space-y-6 -ml-2 md:-ml-6 lg:-ml-10">
51
+
52
+ {/* Status badge */}
53
+ <div
54
+ className="inline-flex items-center gap-2 px-3 py-1.5 rounded-full backdrop-blur-md"
55
+ style={{
56
+ background: 'rgba(88,28,135,0.3)',
57
+ border: '1px solid rgba(168,85,247,0.25)',
58
+ }}
59
+ >
60
+ <span
61
+ className="w-2 h-2 rounded-full animate-pulse"
62
+ style={{ background: '#a855f7', boxShadow: '0 0 8px #a855f7' }}
63
+ />
64
+ <span className="font-bold text-[10px] text-purple-300/80 uppercase tracking-[0.18em]">
65
+ AI-Powered Authenticity Engine
66
+ </span>
67
+ </div>
68
+
69
+ {/* Headline */}
70
+ <h1
71
+ className="text-5xl md:text-6xl lg:text-7xl font-black leading-[1.05] tracking-tight"
72
+ style={{ textShadow: '0 0 60px rgba(168,85,247,0.2)' }}
73
+ >
74
+ <span className="text-white">Verify Reality</span>
75
+ <br />
76
+ <span className="text-white">in </span>
77
+ <span
78
+ className="text-transparent bg-clip-text"
79
+ style={{
80
+ backgroundImage:
81
+ 'linear-gradient(135deg, #c084fc 0%, #a855f7 40%, #7c3aed 70%, #4f46e5 100%)',
82
+ }}
83
+ >
84
+ Real-Time
85
+ </span>
86
+ </h1>
87
+
88
+ {/* Subtext */}
89
+ <p className="text-base text-purple-200/55 max-w-lg leading-relaxed">
90
+ Deploy advanced neural networks to detect deepfakes, synthetic media, and manipulated
91
+ data streams with military-grade precision. Establish an unbreakable perimeter of truth.
92
+ </p>
93
+
94
+ {/* CTAs */}
95
+ <div className="flex flex-wrap items-center gap-4 pt-2">
96
+ <AnalyzeButton onClick={onAnalyze} />
97
+
98
+
99
+ </div>
100
+
101
+ {/* Stats */}
102
+ <div
103
+ className="flex items-center gap-8 pt-6 mt-4 border-t w-full max-w-sm"
104
+ style={{ borderColor: 'rgba(168,85,247,0.15)' }}
105
+ >
106
+ <div>
107
+ <div
108
+ className="text-xl font-black tracking-tight"
109
+ style={{ color: '#c084fc', textShadow: '0 0 16px rgba(168,85,247,0.5)' }}
110
+ >
111
+ 99.9%
112
+ </div>
113
+ <div className="font-bold text-[10px] text-purple-400/50 mt-1 uppercase tracking-widest">
114
+ Accuracy Rate
115
+ </div>
116
+ </div>
117
+ <div className="w-px h-8" style={{ background: 'rgba(168,85,247,0.2)' }} />
118
+ <div>
119
+ <div
120
+ className="text-xl font-black tracking-tight"
121
+ style={{ color: '#a78bfa', textShadow: '0 0 16px rgba(139,92,246,0.5)' }}
122
+ >
123
+ &lt;15ms
124
+ </div>
125
+ <div className="font-bold text-[10px] text-purple-400/50 mt-1 uppercase tracking-widest">
126
+ Latency Ping
127
+ </div>
128
+ </div>
129
+ </div>
130
+ </div>
131
+
132
+ {/* ── RIGHT: Orb visualizer ── */}
133
+ <div className="relative w-full aspect-square max-w-lg mx-auto flex items-center justify-center lg:justify-end">
134
+
135
+ {/* Outer ambient glow */}
136
+ <div
137
+ className="absolute inset-0 rounded-full blur-[60px]"
138
+ style={{ background: 'rgba(124,58,237,0.12)' }}
139
+ />
140
+
141
+ {/* Orb shell */}
142
+ <div
143
+ className="relative w-4/5 h-4/5 rounded-full flex items-center justify-center"
144
+ style={{
145
+ background: 'radial-gradient(circle at 40% 35%, rgba(124,58,237,0.15) 0%, rgba(8,4,18,0.7) 100%)',
146
+ border: '1px solid rgba(168,85,247,0.15)',
147
+ boxShadow: 'inset 0 0 40px rgba(0,0,0,0.7), 0 0 60px rgba(124,58,237,0.15)',
148
+ }}
149
+ >
150
+ {/* Spinning rings */}
151
+ <div
152
+ className="absolute w-[115%] h-[115%] rounded-full animate-spin-slow"
153
+ style={{ border: '1px solid rgba(168,85,247,0.1)' }}
154
+ />
155
+ <div
156
+ className="absolute w-full h-full rounded-full animate-spin-slow-reverse"
157
+ style={{ border: '1px dashed rgba(139,92,246,0.15)' }}
158
+ />
159
+ <div
160
+ className="absolute w-4/5 h-4/5 rounded-full"
161
+ style={{ border: '1px solid rgba(168,85,247,0.06)' }}
162
+ />
163
+
164
+ {/* Core */}
165
+ <div
166
+ className="relative w-3/5 h-3/5 rounded-full flex items-center justify-center overflow-hidden"
167
+ style={{
168
+ background: 'radial-gradient(circle, rgba(124,58,237,0.3) 0%, rgba(8,4,18,0.9) 100%)',
169
+ border: '1px solid rgba(168,85,247,0.25)',
170
+ boxShadow: '0 0 40px rgba(124,58,237,0.2)',
171
+ }}
172
+ >
173
+ <span
174
+ className="material-symbols-outlined"
175
+ style={{
176
+ fontSize: 100,
177
+ color: '#c084fc',
178
+ opacity: 0.45,
179
+ fontVariationSettings: "'FILL' 1",
180
+ filter: 'drop-shadow(0 0 20px rgba(168,85,247,0.9))',
181
+ }}
182
+ >
183
+ radar
184
+ </span>
185
+ {/* Spinning accent border */}
186
+ <div
187
+ className="absolute inset-0 rounded-full border-t-2 blur-[2px] animate-spin-fast"
188
+ style={{ borderColor: 'rgba(168,85,247,0.6)' }}
189
+ />
190
+ <div className="absolute inset-0 bg-gradient-to-t from-[#050210]/60 via-transparent to-transparent" />
191
+ </div>
192
+ </div>
193
+
194
+ {/* Floating HUD chips */}
195
+ <div
196
+ className="absolute top-8 -left-2 px-3 py-1 font-mono text-[10px] backdrop-blur-md rounded-sm"
197
+ style={{
198
+ background: 'rgba(8,4,18,0.75)',
199
+ border: '1px solid rgba(168,85,247,0.3)',
200
+ color: '#c084fc',
201
+ }}
202
+ >
203
+ SYS.OPT.OK
204
+ </div>
205
+ <div
206
+ className="absolute bottom-16 -right-2 px-3 py-1 font-mono text-[10px] backdrop-blur-md rounded-sm flex items-center gap-1"
207
+ style={{
208
+ background: 'rgba(8,4,18,0.75)',
209
+ border: '1px solid rgba(139,92,246,0.3)',
210
+ color: '#a78bfa',
211
+ }}
212
+ >
213
+ <span className="material-symbols-outlined text-[11px]">sync</span> LIVE
214
+ </div>
215
+ </div>
216
+
217
+ </div>
218
+ </div>
219
+ </section>
220
+ );
221
+ }
frontend-react/src/components/InitiateButton.tsx ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import styled from 'styled-components';
2
+
3
+ interface InitiateButtonProps {
4
+ onClick: () => void;
5
+ disabled?: boolean;
6
+ }
7
+
8
+ const StyledWrapper = styled.div`
9
+ .btn-wrapper {
10
+ position: relative;
11
+ display: inline-block;
12
+ width: 100%;
13
+ }
14
+
15
+ .btn {
16
+ --border-radius: 24px;
17
+ --padding: 4px;
18
+ --transition: 0.4s;
19
+ --button-color: #0d0720;
20
+ --highlight-color-hue: 270deg;
21
+ user-select: none;
22
+ display: flex;
23
+ justify-content: center;
24
+ align-items: center;
25
+ width: 100%;
26
+ padding: 0.65em 1.4em 0.65em 1.1em;
27
+ font-family: 'Space Grotesk', 'Poppins', 'Inter', sans-serif;
28
+ font-size: 1em;
29
+ font-weight: 600;
30
+ background-color: var(--button-color);
31
+ box-shadow:
32
+ inset 0px 1px 1px rgba(168, 85, 247, 0.2),
33
+ inset 0px 2px 2px rgba(168, 85, 247, 0.15),
34
+ inset 0px 4px 4px rgba(168, 85, 247, 0.1),
35
+ inset 0px 8px 8px rgba(168, 85, 247, 0.05),
36
+ inset 0px 16px 16px rgba(168, 85, 247, 0.05),
37
+ 0px -1px 1px rgba(0, 0, 0, 0.02),
38
+ 0px -2px 2px rgba(0, 0, 0, 0.03),
39
+ 0px -4px 4px rgba(0, 0, 0, 0.05),
40
+ 0px -8px 8px rgba(0, 0, 0, 0.06),
41
+ 0px -16px 16px rgba(0, 0, 0, 0.08);
42
+ border: solid 1px rgba(168, 85, 247, 0.2);
43
+ border-radius: var(--border-radius);
44
+ cursor: pointer;
45
+ transition:
46
+ box-shadow var(--transition),
47
+ border var(--transition),
48
+ background-color var(--transition),
49
+ opacity var(--transition);
50
+ }
51
+
52
+ .btn.disabled {
53
+ opacity: 0.35;
54
+ cursor: not-allowed;
55
+ pointer-events: none;
56
+ }
57
+
58
+ .btn::before {
59
+ content: '';
60
+ position: absolute;
61
+ top: calc(0px - var(--padding));
62
+ left: calc(0px - var(--padding));
63
+ width: calc(100% + var(--padding) * 2);
64
+ height: calc(100% + var(--padding) * 2);
65
+ border-radius: calc(var(--border-radius) + var(--padding));
66
+ pointer-events: none;
67
+ background-image: linear-gradient(0deg, #0004, #000a);
68
+ z-index: -1;
69
+ transition: box-shadow var(--transition), filter var(--transition);
70
+ box-shadow:
71
+ 0 -8px 8px -6px #0000 inset,
72
+ 0 -16px 16px -8px #00000000 inset,
73
+ 1px 1px 1px rgba(168, 85, 247, 0.15),
74
+ 2px 2px 2px rgba(168, 85, 247, 0.08),
75
+ -1px -1px 1px #0002,
76
+ -2px -2px 2px #0001;
77
+ }
78
+
79
+ .btn::after {
80
+ content: '';
81
+ position: absolute;
82
+ top: 0;
83
+ left: 0;
84
+ width: 100%;
85
+ height: 100%;
86
+ border-radius: inherit;
87
+ pointer-events: none;
88
+ background-image: linear-gradient(
89
+ 0deg,
90
+ #fff,
91
+ hsl(var(--highlight-color-hue), 100%, 70%),
92
+ hsla(var(--highlight-color-hue), 100%, 70%, 50%),
93
+ 8%,
94
+ transparent
95
+ );
96
+ background-position: 0 0;
97
+ opacity: 0;
98
+ transition: opacity var(--transition), filter var(--transition);
99
+ }
100
+
101
+ .btn-letter {
102
+ position: relative;
103
+ display: inline-block;
104
+ color: rgba(192, 132, 252, 0.6);
105
+ animation: letter-anim 2s ease-in-out infinite;
106
+ transition: color var(--transition), text-shadow var(--transition), opacity var(--transition);
107
+ }
108
+
109
+ @keyframes letter-anim {
110
+ 50% {
111
+ text-shadow: 0 0 6px rgba(192, 132, 252, 0.9);
112
+ color: #e9d5ff;
113
+ }
114
+ }
115
+
116
+ .btn-svg {
117
+ flex-grow: 0;
118
+ flex-shrink: 0;
119
+ height: 22px;
120
+ margin-right: 0.55rem;
121
+ fill: none;
122
+ stroke: #c084fc;
123
+ stroke-width: 1.5;
124
+ animation: flicker 2s linear infinite;
125
+ animation-delay: 0.5s;
126
+ filter: drop-shadow(0 0 3px rgba(168, 85, 247, 0.8));
127
+ transition: stroke var(--transition), filter var(--transition), opacity var(--transition);
128
+ }
129
+
130
+ @keyframes flicker {
131
+ 50% { opacity: 0.4; }
132
+ }
133
+
134
+ .txt-wrapper {
135
+ position: relative;
136
+ display: flex;
137
+ align-items: center;
138
+ min-width: 10em;
139
+ height: 1.4em;
140
+ }
141
+
142
+ .txt-1,
143
+ .txt-2 {
144
+ position: absolute;
145
+ word-spacing: -1em;
146
+ white-space: nowrap;
147
+ }
148
+
149
+ .txt-1 { animation: appear-anim 1s ease-in-out forwards; }
150
+ .txt-2 { opacity: 0; }
151
+
152
+ @keyframes appear-anim {
153
+ 0% { opacity: 0; }
154
+ 100% { opacity: 1; }
155
+ }
156
+
157
+ .btn:focus .txt-1 {
158
+ animation: opacity-anim 0.3s ease-in-out forwards;
159
+ animation-delay: 1s;
160
+ }
161
+ .btn:focus .txt-2 {
162
+ animation: opacity-anim 0.3s ease-in-out reverse forwards;
163
+ animation-delay: 1s;
164
+ }
165
+
166
+ @keyframes opacity-anim {
167
+ 0% { opacity: 1; }
168
+ 100% { opacity: 0; }
169
+ }
170
+
171
+ .btn:focus .btn-letter {
172
+ animation:
173
+ focused-letter-anim 1s ease-in-out forwards,
174
+ letter-anim 1.2s ease-in-out infinite;
175
+ animation-delay: 0s, 1s;
176
+ }
177
+
178
+ @keyframes focused-letter-anim {
179
+ 0%, 100% { filter: blur(0px); }
180
+ 50% {
181
+ transform: scale(2);
182
+ filter: blur(10px) brightness(150%)
183
+ drop-shadow(-36px 12px 12px hsl(var(--highlight-color-hue), 100%, 70%));
184
+ }
185
+ }
186
+
187
+ .btn:focus .btn-svg {
188
+ animation-duration: 1.2s;
189
+ animation-delay: 0.2s;
190
+ }
191
+
192
+ .btn:focus::before {
193
+ box-shadow:
194
+ 0 -8px 12px -6px rgba(168, 85, 247, 0.4) inset,
195
+ 0 -16px 16px -8px hsla(270deg, 100%, 70%, 0.2) inset,
196
+ 1px 1px 1px rgba(168, 85, 247, 0.3),
197
+ 2px 2px 2px rgba(168, 85, 247, 0.1),
198
+ -1px -1px 1px #0002,
199
+ -2px -2px 2px #0001;
200
+ }
201
+
202
+ .btn:focus::after {
203
+ opacity: 0.5;
204
+ mask-image: linear-gradient(0deg, #fff, transparent);
205
+ filter: brightness(100%);
206
+ }
207
+
208
+ /* Animation delays */
209
+ .btn-letter:nth-child(1) { animation-delay: 0s; }
210
+ .btn-letter:nth-child(2) { animation-delay: 0.08s; }
211
+ .btn-letter:nth-child(3) { animation-delay: 0.16s; }
212
+ .btn-letter:nth-child(4) { animation-delay: 0.24s; }
213
+ .btn-letter:nth-child(5) { animation-delay: 0.32s; }
214
+ .btn-letter:nth-child(6) { animation-delay: 0.40s; }
215
+ .btn-letter:nth-child(7) { animation-delay: 0.48s; }
216
+ .btn-letter:nth-child(8) { animation-delay: 0.56s; }
217
+ .btn-letter:nth-child(9) { animation-delay: 0.64s; }
218
+ .btn-letter:nth-child(10) { animation-delay: 0.72s; }
219
+ .btn-letter:nth-child(11) { animation-delay: 0.80s; }
220
+ .btn-letter:nth-child(12) { animation-delay: 0.88s; }
221
+ .btn-letter:nth-child(13) { animation-delay: 0.96s; }
222
+ .btn-letter:nth-child(14) { animation-delay: 1.04s; }
223
+ .btn-letter:nth-child(15) { animation-delay: 1.12s; }
224
+ .btn-letter:nth-child(16) { animation-delay: 1.20s; }
225
+
226
+ /* Active */
227
+ .btn:active {
228
+ border: solid 1px hsla(270deg, 100%, 80%, 0.7);
229
+ background-color: hsla(270deg, 50%, 20%, 0.5);
230
+ }
231
+ .btn:active::before {
232
+ box-shadow:
233
+ 0 -8px 12px -6px rgba(192, 132, 252, 0.9) inset,
234
+ 0 -16px 16px -8px hsla(270deg, 100%, 70%, 0.8) inset,
235
+ 1px 1px 1px rgba(255,255,255,0.25),
236
+ 2px 2px 2px rgba(255,255,255,0.1),
237
+ -1px -1px 1px #0002,
238
+ -2px -2px 2px #0001;
239
+ }
240
+ .btn:active::after {
241
+ opacity: 1;
242
+ mask-image: linear-gradient(0deg, #fff, transparent);
243
+ filter: brightness(200%);
244
+ }
245
+ .btn:active .btn-letter {
246
+ text-shadow: 0 0 1px hsla(270deg, 100%, 90%, 0.9);
247
+ animation: none;
248
+ }
249
+
250
+ /* Hover */
251
+ .btn:hover {
252
+ border: solid 1px hsla(270deg, 100%, 80%, 0.4);
253
+ }
254
+ .btn:hover::before {
255
+ box-shadow:
256
+ 0 -8px 8px -6px rgba(192, 132, 252, 0.7) inset,
257
+ 0 -16px 16px -8px hsla(270deg, 100%, 70%, 0.3) inset,
258
+ 1px 1px 1px rgba(168, 85, 247, 0.2),
259
+ 2px 2px 2px rgba(168, 85, 247, 0.1),
260
+ -1px -1px 1px #0002,
261
+ -2px -2px 2px #0001;
262
+ }
263
+ .btn:hover::after {
264
+ opacity: 0.8;
265
+ mask-image: linear-gradient(0deg, #fff, transparent);
266
+ }
267
+ .btn:hover .btn-svg {
268
+ stroke: #e9d5ff;
269
+ filter: drop-shadow(0 0 5px hsl(270deg, 100%, 70%)) drop-shadow(0 -4px 6px #0009);
270
+ animation: none;
271
+ }
272
+ `;
273
+
274
+ const LABEL_1 = 'Initiate Analysis';
275
+ const LABEL_2 = 'Analyzing...';
276
+
277
+ function Letters({ text }: { text: string }) {
278
+ return (
279
+ <>
280
+ {text.split('').map((ch, i) => (
281
+ <span key={i} className="btn-letter">{ch === ' ' ? '\u00A0' : ch}</span>
282
+ ))}
283
+ </>
284
+ );
285
+ }
286
+
287
+ export default function InitiateButton({ onClick, disabled = false }: InitiateButtonProps) {
288
+ return (
289
+ <StyledWrapper>
290
+ <div className="btn-wrapper">
291
+ <button className={`btn${disabled ? ' disabled' : ''}`} onClick={!disabled ? onClick : undefined}>
292
+ {/* Sparkle star icon */}
293
+ <svg className="btn-svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
294
+ <path strokeLinecap="round" strokeLinejoin="round"
295
+ d="M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z" />
296
+ </svg>
297
+
298
+ <div className="txt-wrapper">
299
+ <div className="txt-1"><Letters text={LABEL_1} /></div>
300
+ <div className="txt-2"><Letters text={LABEL_2} /></div>
301
+ </div>
302
+ </button>
303
+ </div>
304
+ </StyledWrapper>
305
+ );
306
+ }
frontend-react/src/components/Modal.tsx ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ interface ModalProps {
2
+ title: string;
3
+ onClose: () => void;
4
+ children: React.ReactNode;
5
+ }
6
+
7
+ export default function Modal({ title, onClose, children }: ModalProps) {
8
+ return (
9
+ <div
10
+ className="fixed inset-0 z-[100] flex items-center justify-center p-4"
11
+ onClick={onClose}
12
+ >
13
+ <div className="absolute inset-0 bg-black/60 backdrop-blur-sm" />
14
+ <div
15
+ className="relative z-10 w-full max-w-2xl rounded-xl p-8"
16
+ style={{
17
+ background: 'rgba(13,7,32,0.95)',
18
+ border: '1px solid rgba(168,85,247,0.25)',
19
+ boxShadow: '0 0 60px rgba(88,28,135,0.3)',
20
+ backdropFilter: 'blur(20px)',
21
+ }}
22
+ onClick={e => e.stopPropagation()}
23
+ >
24
+ <div className="flex justify-between items-center mb-6">
25
+ <h2 className="text-xl font-semibold uppercase tracking-widest" style={{ color: '#c084fc' }}>{title}</h2>
26
+ <button
27
+ onClick={onClose}
28
+ className="p-1 rounded transition-all text-purple-400/40 hover:text-purple-300 hover:bg-purple-500/10"
29
+ >
30
+ <span className="material-symbols-outlined">close</span>
31
+ </button>
32
+ </div>
33
+ {children}
34
+ </div>
35
+ </div>
36
+ );
37
+ }
frontend-react/src/components/Navbar.tsx ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useState } from 'react';
2
+
3
+ interface NavbarProps {
4
+ onDashboard: () => void;
5
+ onGetStarted: () => void;
6
+ onOpenModal: (modal: string) => void;
7
+ }
8
+
9
+ export default function Navbar({ onDashboard, onGetStarted, onOpenModal }: NavbarProps) {
10
+ const [health, setHealth] = useState<'checking' | 'online' | 'offline'>('checking');
11
+
12
+ useEffect(() => {
13
+ fetch('/health')
14
+ .then(r => r.ok ? setHealth('online') : setHealth('offline'))
15
+ .catch(() => setHealth('offline'));
16
+ }, []);
17
+
18
+ const dotColor = health === 'online' ? '#a855f7' : health === 'offline' ? '#f43f5e' : '#6b7280';
19
+ const dotGlow = health === 'online' ? '0 0 8px #a855f7' : health === 'offline' ? '0 0 8px #f43f5e' : 'none';
20
+
21
+ return (
22
+ <nav
23
+ className="fixed top-0 left-0 w-full z-50 flex justify-between items-center px-6 h-16
24
+ backdrop-blur-xl font-['Space_Grotesk'] tracking-wider uppercase text-xs"
25
+ style={{
26
+ background: 'rgba(8,4,18,0.7)',
27
+ borderBottom: '1px solid rgba(168,85,247,0.15)',
28
+ boxShadow: '0 4px 30px rgba(0,0,0,0.6)',
29
+ }}
30
+ >
31
+ {/* Brand */}
32
+ <div className="flex items-center gap-8">
33
+ <span
34
+ onClick={onDashboard}
35
+ className="text-2xl font-black tracking-tighter cursor-pointer"
36
+ style={{
37
+ background: 'linear-gradient(135deg, #c084fc, #818cf8)',
38
+ WebkitBackgroundClip: 'text',
39
+ WebkitTextFillColor: 'transparent',
40
+ filter: 'drop-shadow(0 0 8px rgba(168,85,247,0.5))',
41
+ }}
42
+ >
43
+ AUTHRIX AI
44
+ </span>
45
+ <div className="hidden md:flex items-center gap-1">
46
+ {[
47
+ { label: 'Dashboard', action: onDashboard },
48
+ { label: 'Pricing', action: () => window.open('/pricing', '_blank') },
49
+ { label: 'Agents', action: () => onOpenModal('agents') },
50
+ { label: 'Logs', action: () => onOpenModal('logs') },
51
+ { label: 'Network', action: () => onOpenModal('network') },
52
+ ].map(({ label, action }) => (
53
+ <button
54
+ key={label}
55
+ onClick={action}
56
+ className="py-1 px-3 rounded-sm transition-all duration-200 text-purple-400/50 hover:text-purple-300 hover:bg-purple-500/10"
57
+ >
58
+ {label}
59
+ </button>
60
+ ))}
61
+ </div>
62
+ </div>
63
+
64
+ {/* Actions */}
65
+ <div className="flex items-center gap-3">
66
+ {/* Health badge */}
67
+ <div
68
+ className="flex items-center gap-2 px-3 py-1 rounded-sm"
69
+ style={{
70
+ background: 'rgba(88,28,135,0.2)',
71
+ border: '1px solid rgba(168,85,247,0.2)',
72
+ }}
73
+ >
74
+ <span className="w-2 h-2 rounded-full" style={{ background: dotColor, boxShadow: dotGlow }} />
75
+ <span className="font-bold text-[10px] text-purple-300/70 tracking-widest uppercase">
76
+ {health === 'checking' ? 'CHECKING' : health === 'online' ? 'ONLINE' : 'OFFLINE'}
77
+ </span>
78
+ </div>
79
+
80
+ <div
81
+ className="hidden lg:flex items-center gap-1 pr-3 mr-1"
82
+ style={{ borderRight: '1px solid rgba(168,85,247,0.15)' }}
83
+ >
84
+ {['sensors', 'memory', 'speed'].map(icon => (
85
+ <button
86
+ key={icon}
87
+ className="p-1.5 rounded-sm transition-all text-purple-500/40 hover:text-purple-300 hover:bg-purple-500/10"
88
+ >
89
+ <span className="material-symbols-outlined text-lg">{icon}</span>
90
+ </button>
91
+ ))}
92
+ </div>
93
+
94
+ <button
95
+ onClick={onGetStarted}
96
+ className="px-4 py-1.5 font-bold text-xs rounded-lg transition-all active:scale-95"
97
+ style={{
98
+ background: 'linear-gradient(135deg, rgba(124,58,237,0.8), rgba(168,85,247,0.8))',
99
+ border: '1px solid rgba(168,85,247,0.5)',
100
+ color: '#fff',
101
+ boxShadow: '0 0 15px rgba(168,85,247,0.25)',
102
+ }}
103
+ onMouseEnter={e => (e.currentTarget.style.boxShadow = '0 0 25px rgba(168,85,247,0.5)')}
104
+ onMouseLeave={e => (e.currentTarget.style.boxShadow = '0 0 15px rgba(168,85,247,0.25)')}
105
+ >
106
+ GET STARTED
107
+ </button>
108
+ </div>
109
+ </nav>
110
+ );
111
+ }
frontend-react/src/components/PillNav.css ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .pill-nav-container {
2
+ position: fixed;
3
+ top: 1em;
4
+ left: 50%;
5
+ transform: translateX(-50%);
6
+ z-index: 99;
7
+ }
8
+
9
+ @media (max-width: 768px) {
10
+ .pill-nav-container {
11
+ width: calc(100% - 2rem);
12
+ left: 1rem;
13
+ transform: none;
14
+ }
15
+ }
16
+
17
+ .pill-nav {
18
+ --nav-h: 42px;
19
+ --logo: 36px;
20
+ --pill-pad-x: 18px;
21
+ --pill-gap: 3px;
22
+ width: max-content;
23
+ display: flex;
24
+ align-items: center;
25
+ gap: 6px;
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ @media (max-width: 768px) {
30
+ .pill-nav {
31
+ width: 100%;
32
+ justify-content: space-between;
33
+ padding: 0 1rem;
34
+ background: transparent;
35
+ }
36
+ }
37
+
38
+ .pill-nav-items {
39
+ position: relative;
40
+ display: flex;
41
+ align-items: center;
42
+ height: var(--nav-h);
43
+ background: var(--base, #000);
44
+ border-radius: 9999px;
45
+ }
46
+
47
+ .pill-logo {
48
+ width: var(--nav-h);
49
+ height: var(--nav-h);
50
+ border-radius: 50%;
51
+ background: var(--base, #000);
52
+ padding: 8px;
53
+ display: inline-flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ overflow: hidden;
57
+ text-decoration: none;
58
+ font-weight: 800;
59
+ font-size: 13px;
60
+ letter-spacing: 0.05em;
61
+ color: var(--pill-text, #fff);
62
+ white-space: nowrap;
63
+ width: auto;
64
+ padding: 0 16px;
65
+ }
66
+
67
+ .pill-logo img {
68
+ width: 100%;
69
+ height: 100%;
70
+ object-fit: cover;
71
+ display: block;
72
+ }
73
+
74
+ .pill-list {
75
+ list-style: none;
76
+ display: flex;
77
+ align-items: stretch;
78
+ gap: var(--pill-gap);
79
+ margin: 0;
80
+ padding: 3px;
81
+ height: 100%;
82
+ }
83
+
84
+ .pill-list > li {
85
+ display: flex;
86
+ height: 100%;
87
+ }
88
+
89
+ .pill {
90
+ display: inline-flex;
91
+ align-items: center;
92
+ justify-content: center;
93
+ height: 100%;
94
+ padding: 0 var(--pill-pad-x);
95
+ background: var(--pill-bg, #fff);
96
+ color: var(--pill-text, var(--base, #000));
97
+ text-decoration: none;
98
+ border-radius: 9999px;
99
+ box-sizing: border-box;
100
+ font-weight: 600;
101
+ font-size: 13px;
102
+ line-height: 0;
103
+ text-transform: uppercase;
104
+ letter-spacing: 0.08em;
105
+ white-space: nowrap;
106
+ cursor: pointer;
107
+ position: relative;
108
+ overflow: hidden;
109
+ border: none;
110
+ outline: none;
111
+ }
112
+
113
+ .pill .hover-circle {
114
+ position: absolute;
115
+ left: 50%;
116
+ bottom: 0;
117
+ border-radius: 50%;
118
+ background: var(--base, #000);
119
+ z-index: 1;
120
+ display: block;
121
+ pointer-events: none;
122
+ will-change: transform;
123
+ }
124
+
125
+ .pill .label-stack {
126
+ position: relative;
127
+ display: inline-block;
128
+ line-height: 1;
129
+ z-index: 2;
130
+ }
131
+
132
+ .pill .pill-label {
133
+ position: relative;
134
+ z-index: 2;
135
+ display: inline-block;
136
+ line-height: 1;
137
+ will-change: transform;
138
+ }
139
+
140
+ .pill .pill-label-hover {
141
+ position: absolute;
142
+ left: 0;
143
+ top: 0;
144
+ color: var(--hover-text, #fff);
145
+ z-index: 3;
146
+ display: inline-block;
147
+ will-change: transform, opacity;
148
+ }
149
+
150
+ .pill.is-active::after {
151
+ content: '';
152
+ position: absolute;
153
+ bottom: -6px;
154
+ left: 50%;
155
+ transform: translateX(-50%);
156
+ width: 12px;
157
+ height: 12px;
158
+ background: var(--base, #000);
159
+ border-radius: 50px;
160
+ z-index: 4;
161
+ }
162
+
163
+ .desktop-only { display: block; }
164
+ .mobile-only { display: none; }
165
+
166
+ @media (max-width: 768px) {
167
+ .desktop-only { display: none; }
168
+ .mobile-only { display: block; }
169
+ }
170
+
171
+ .mobile-menu-button {
172
+ width: var(--nav-h);
173
+ height: var(--nav-h);
174
+ border-radius: 50%;
175
+ background: var(--base, #000);
176
+ border: none;
177
+ display: none;
178
+ flex-direction: column;
179
+ align-items: center;
180
+ justify-content: center;
181
+ gap: 4px;
182
+ cursor: pointer;
183
+ padding: 0;
184
+ position: relative;
185
+ }
186
+
187
+ @media (max-width: 768px) {
188
+ .mobile-menu-button { display: flex; }
189
+ }
190
+
191
+ .hamburger-line {
192
+ width: 16px;
193
+ height: 2px;
194
+ background: var(--pill-bg, #fff);
195
+ border-radius: 1px;
196
+ transition: all 0.01s ease;
197
+ transform-origin: center;
198
+ }
199
+
200
+ .mobile-menu-popover {
201
+ position: absolute;
202
+ top: 3em;
203
+ left: 1rem;
204
+ right: 1rem;
205
+ background: var(--base, #f0f0f0);
206
+ border-radius: 27px;
207
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
208
+ z-index: 998;
209
+ opacity: 0;
210
+ transform-origin: top center;
211
+ visibility: hidden;
212
+ }
213
+
214
+ .mobile-menu-list {
215
+ list-style: none;
216
+ margin: 0;
217
+ padding: 3px;
218
+ display: flex;
219
+ flex-direction: column;
220
+ gap: 3px;
221
+ }
222
+
223
+ .mobile-menu-popover .mobile-menu-link {
224
+ display: block;
225
+ padding: 12px 16px;
226
+ color: var(--pill-text, #fff);
227
+ background-color: var(--pill-bg, #fff);
228
+ text-decoration: none;
229
+ font-size: 14px;
230
+ font-weight: 500;
231
+ border-radius: 50px;
232
+ transition: all 0.2s ease;
233
+ }
234
+
235
+ .mobile-menu-popover .mobile-menu-link:hover {
236
+ cursor: pointer;
237
+ background-color: var(--base);
238
+ color: var(--hover-text, #fff);
239
+ }
frontend-react/src/components/PillNav.tsx ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useRef, useState } from 'react';
2
+ import { Link, useLocation } from 'react-router-dom';
3
+ import { gsap } from 'gsap';
4
+ import './PillNav.css';
5
+
6
+ export interface PillNavItem {
7
+ label: string;
8
+ href?: string;
9
+ ariaLabel?: string;
10
+ onClick?: () => void;
11
+ }
12
+
13
+ interface PillNavProps {
14
+ logo?: string;
15
+ logoText?: string;
16
+ logoAlt?: string;
17
+ items: PillNavItem[];
18
+ activeHref?: string;
19
+ className?: string;
20
+ ease?: string;
21
+ baseColor?: string;
22
+ pillColor?: string;
23
+ hoveredPillTextColor?: string;
24
+ pillTextColor?: string;
25
+ onMobileMenuClick?: () => void;
26
+ initialLoadAnimation?: boolean;
27
+ }
28
+
29
+ const PillNav = ({
30
+ logo,
31
+ logoText,
32
+ logoAlt = 'Logo',
33
+ items,
34
+ activeHref,
35
+ className = '',
36
+ ease = 'power3.easeOut',
37
+ baseColor = '#0d0720',
38
+ pillColor = '#1e0f3a',
39
+ hoveredPillTextColor = '#e9d5ff',
40
+ pillTextColor,
41
+ onMobileMenuClick,
42
+ initialLoadAnimation = true,
43
+ }: PillNavProps) => {
44
+ const resolvedPillTextColor = pillTextColor ?? '#c084fc';
45
+ const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
46
+
47
+ const circleRefs = useRef<(HTMLSpanElement | null)[]>([]);
48
+ const tlRefs = useRef<gsap.core.Timeline[]>([]);
49
+ const activeTweenRefs = useRef<gsap.core.Tween[]>([]);
50
+ const logoImgRef = useRef<HTMLImageElement>(null);
51
+ const logoTweenRef = useRef<gsap.core.Tween | null>(null);
52
+ const hamburgerRef = useRef<HTMLButtonElement>(null);
53
+ const mobileMenuRef = useRef<HTMLDivElement>(null);
54
+ const navItemsRef = useRef<HTMLDivElement>(null);
55
+ const logoRef = useRef<HTMLAnchorElement | null>(null);
56
+
57
+ useEffect(() => {
58
+ const layout = () => {
59
+ circleRefs.current.forEach((circle, index) => {
60
+ if (!circle?.parentElement) return;
61
+ const pill = circle.parentElement;
62
+ const rect = pill.getBoundingClientRect();
63
+ const { width: w, height: h } = rect;
64
+ const R = ((w * w) / 4 + h * h) / (2 * h);
65
+ const D = Math.ceil(2 * R) + 2;
66
+ const delta = Math.ceil(R - Math.sqrt(Math.max(0, R * R - (w * w) / 4))) + 1;
67
+ const originY = D - delta;
68
+
69
+ circle.style.width = `${D}px`;
70
+ circle.style.height = `${D}px`;
71
+ circle.style.bottom = `-${delta}px`;
72
+
73
+ gsap.set(circle, { xPercent: -50, scale: 0, transformOrigin: `50% ${originY}px` });
74
+
75
+ const label = pill.querySelector('.pill-label');
76
+ const white = pill.querySelector('.pill-label-hover');
77
+ if (label) gsap.set(label, { y: 0 });
78
+ if (white) gsap.set(white, { y: h + 12, opacity: 0 });
79
+
80
+ tlRefs.current[index]?.kill();
81
+ const tl = gsap.timeline({ paused: true });
82
+ tl.to(circle, { scale: 1.2, xPercent: -50, duration: 2, ease, overwrite: 'auto' }, 0);
83
+ if (label) tl.to(label, { y: -(h + 8), duration: 2, ease, overwrite: 'auto' }, 0);
84
+ if (white) {
85
+ gsap.set(white, { y: Math.ceil(h + 100), opacity: 0 });
86
+ tl.to(white, { y: 0, opacity: 1, duration: 2, ease, overwrite: 'auto' }, 0);
87
+ }
88
+ tlRefs.current[index] = tl;
89
+ });
90
+ };
91
+
92
+ layout();
93
+ window.addEventListener('resize', layout);
94
+ document.fonts?.ready?.then(layout).catch(() => {});
95
+
96
+ const menu = mobileMenuRef.current;
97
+ if (menu) gsap.set(menu, { visibility: 'hidden', opacity: 0, scaleY: 1 });
98
+
99
+ if (initialLoadAnimation) {
100
+ const logoEl = logoRef.current;
101
+ const navItems = navItemsRef.current;
102
+ if (logoEl) { gsap.set(logoEl, { scale: 0 }); gsap.to(logoEl, { scale: 1, duration: 0.6, ease }); }
103
+ if (navItems) { gsap.set(navItems, { width: 0, overflow: 'hidden' }); gsap.to(navItems, { width: 'auto', duration: 0.6, ease }); }
104
+ }
105
+
106
+ return () => window.removeEventListener('resize', layout);
107
+ }, [items, ease, initialLoadAnimation]);
108
+
109
+ const handleEnter = (i: number) => {
110
+ const tl = tlRefs.current[i];
111
+ if (!tl) return;
112
+ activeTweenRefs.current[i]?.kill();
113
+ activeTweenRefs.current[i] = tl.tweenTo(tl.duration(), { duration: 0.3, ease, overwrite: 'auto' }) as gsap.core.Tween;
114
+ };
115
+
116
+ const handleLeave = (i: number) => {
117
+ const tl = tlRefs.current[i];
118
+ if (!tl) return;
119
+ activeTweenRefs.current[i]?.kill();
120
+ activeTweenRefs.current[i] = tl.tweenTo(0, { duration: 0.2, ease, overwrite: 'auto' }) as gsap.core.Tween;
121
+ };
122
+
123
+ const handleLogoEnter = () => {
124
+ const img = logoImgRef.current;
125
+ if (!img) return;
126
+ logoTweenRef.current?.kill();
127
+ gsap.set(img, { rotate: 0 });
128
+ logoTweenRef.current = gsap.to(img, { rotate: 360, duration: 0.4, ease, overwrite: 'auto' });
129
+ };
130
+
131
+ const toggleMobileMenu = () => {
132
+ const newState = !isMobileMenuOpen;
133
+ setIsMobileMenuOpen(newState);
134
+ const hamburger = hamburgerRef.current;
135
+ const menu = mobileMenuRef.current;
136
+
137
+ if (hamburger) {
138
+ const lines = hamburger.querySelectorAll('.hamburger-line');
139
+ if (newState) {
140
+ gsap.to(lines[0], { rotation: 45, y: 3, duration: 0.3, ease });
141
+ gsap.to(lines[1], { rotation: -45, y: -3, duration: 0.3, ease });
142
+ } else {
143
+ gsap.to(lines[0], { rotation: 0, y: 0, duration: 0.3, ease });
144
+ gsap.to(lines[1], { rotation: 0, y: 0, duration: 0.3, ease });
145
+ }
146
+ }
147
+
148
+ if (menu) {
149
+ if (newState) {
150
+ gsap.set(menu, { visibility: 'visible' });
151
+ gsap.fromTo(menu, { opacity: 0, y: 10 }, { opacity: 1, y: 0, duration: 0.3, ease });
152
+ } else {
153
+ gsap.to(menu, { opacity: 0, y: 10, duration: 0.2, ease, onComplete: () => gsap.set(menu, { visibility: 'hidden' }) });
154
+ }
155
+ }
156
+ onMobileMenuClick?.();
157
+ };
158
+
159
+ const cssVars = {
160
+ ['--base']: baseColor,
161
+ ['--pill-bg']: pillColor,
162
+ ['--hover-text']: hoveredPillTextColor,
163
+ ['--pill-text']: resolvedPillTextColor,
164
+ } as React.CSSProperties;
165
+
166
+ const location = useLocation();
167
+ const currentHref = activeHref ?? location.pathname;
168
+
169
+ const renderPill = (item: PillNavItem, i: number) => {
170
+ const isActive = item.href ? currentHref === item.href : false;
171
+ const pillClass = `pill${isActive ? ' is-active' : ''}`;
172
+ const inner = (
173
+ <>
174
+ <span className="hover-circle" aria-hidden="true" ref={el => { circleRefs.current[i] = el; }} />
175
+ <span className="label-stack">
176
+ <span className="pill-label">{item.label}</span>
177
+ <span className="pill-label-hover" aria-hidden="true">{item.label}</span>
178
+ </span>
179
+ </>
180
+ );
181
+
182
+ if (item.onClick) {
183
+ return (
184
+ <button role="menuitem" className={pillClass}
185
+ aria-label={item.ariaLabel || item.label}
186
+ onMouseEnter={() => handleEnter(i)} onMouseLeave={() => handleLeave(i)}
187
+ onClick={item.onClick}>
188
+ {inner}
189
+ </button>
190
+ );
191
+ }
192
+
193
+ const isInternal = item.href && !item.href.startsWith('http') && !item.href.startsWith('mailto');
194
+ if (isInternal) {
195
+ return (
196
+ <Link role="menuitem" to={item.href!} className={pillClass}
197
+ aria-label={item.ariaLabel || item.label}
198
+ onMouseEnter={() => handleEnter(i)} onMouseLeave={() => handleLeave(i)}>
199
+ {inner}
200
+ </Link>
201
+ );
202
+ }
203
+
204
+ return (
205
+ <a role="menuitem" href={item.href || '#'} className={pillClass}
206
+ aria-label={item.ariaLabel || item.label}
207
+ onMouseEnter={() => handleEnter(i)} onMouseLeave={() => handleLeave(i)}>
208
+ {inner}
209
+ </a>
210
+ );
211
+ };
212
+
213
+ return (
214
+ <div className="pill-nav-container">
215
+ <nav className={`pill-nav ${className}`} aria-label="Primary" style={cssVars}>
216
+ {/* Logo / brand */}
217
+ <a
218
+ className="pill-logo"
219
+ href="#"
220
+ aria-label="Home"
221
+ onMouseEnter={handleLogoEnter}
222
+ ref={logoRef}
223
+ style={{ background: baseColor, color: resolvedPillTextColor }}
224
+ >
225
+ {logo
226
+ ? <img src={logo} alt={logoAlt} ref={logoImgRef} />
227
+ : <span style={{ fontWeight: 800, fontSize: 14, letterSpacing: '0.05em', color: '#c084fc' }}>{logoText ?? 'AUTHRIX'}</span>
228
+ }
229
+ </a>
230
+
231
+ {/* Desktop nav items */}
232
+ <div className="pill-nav-items desktop-only" ref={navItemsRef}>
233
+ <ul className="pill-list" role="menubar">
234
+ {items.map((item, i) => (
235
+ <li key={i} role="none">{renderPill(item, i)}</li>
236
+ ))}
237
+ </ul>
238
+ </div>
239
+
240
+ {/* Mobile hamburger */}
241
+ <button
242
+ className="mobile-menu-button mobile-only"
243
+ onClick={toggleMobileMenu}
244
+ aria-label="Toggle menu"
245
+ ref={hamburgerRef}
246
+ >
247
+ <span className="hamburger-line" />
248
+ <span className="hamburger-line" />
249
+ </button>
250
+ </nav>
251
+
252
+ {/* Mobile popover */}
253
+ <div className="mobile-menu-popover mobile-only" ref={mobileMenuRef} style={cssVars}>
254
+ <ul className="mobile-menu-list">
255
+ {items.map((item, i) => (
256
+ <li key={i}>
257
+ {item.onClick
258
+ ? <button className={`mobile-menu-link${currentHref === item.href ? ' is-active' : ''}`} onClick={() => { item.onClick?.(); setIsMobileMenuOpen(false); }}>{item.label}</button>
259
+ : item.href && !item.href.startsWith('http')
260
+ ? <Link to={item.href} className={`mobile-menu-link${currentHref === item.href ? ' is-active' : ''}`} onClick={() => setIsMobileMenuOpen(false)}>{item.label}</Link>
261
+ : <a href={item.href || '#'} className={`mobile-menu-link${currentHref === item.href ? ' is-active' : ''}`} onClick={() => setIsMobileMenuOpen(false)}>{item.label}</a>
262
+ }
263
+ </li>
264
+ ))}
265
+ </ul>
266
+ </div>
267
+ </div>
268
+ );
269
+ };
270
+
271
+ export default PillNav;
frontend-react/src/components/ProcessingSection.tsx ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useState } from 'react';
2
+
3
+ interface Step {
4
+ label: string;
5
+ status: 'pending' | 'active' | 'done';
6
+ pct: number;
7
+ }
8
+
9
+ const PHASES = [
10
+ { stepIdx: 0, pct: 20 },
11
+ { stepIdx: 1, pct: 40 },
12
+ { stepIdx: 2, pct: 65 },
13
+ { stepIdx: 3, pct: 85 },
14
+ { stepIdx: 4, pct: 98 },
15
+ ];
16
+
17
+ const STEP_LABELS = [
18
+ 'Extracting frames...',
19
+ 'Detecting faces...',
20
+ 'Running ViT inference...',
21
+ 'Analyzing audio...',
22
+ 'Generating report...',
23
+ ];
24
+
25
+ const P = 'rgba(168,85,247,';
26
+
27
+ export default function ProcessingSection() {
28
+ const [steps, setSteps] = useState<Step[]>(
29
+ STEP_LABELS.map(label => ({ label, status: 'pending', pct: 0 }))
30
+ );
31
+ const [overallPct, setOverallPct] = useState(0);
32
+ const [phaseIdx, setPhaseIdx] = useState(0);
33
+
34
+ useEffect(() => {
35
+ const interval = setInterval(() => {
36
+ setPhaseIdx(prev => {
37
+ const next = prev + 1;
38
+ if (next >= PHASES.length) { clearInterval(interval); return prev; }
39
+ return next;
40
+ });
41
+ }, 2200);
42
+ return () => clearInterval(interval);
43
+ }, []);
44
+
45
+ useEffect(() => {
46
+ const phase = PHASES[phaseIdx];
47
+ setOverallPct(phase.pct);
48
+ setSteps(prev => prev.map((s, i) => {
49
+ if (i < phase.stepIdx) return { ...s, status: 'done', pct: 100 };
50
+ if (i === phase.stepIdx) return { ...s, status: 'active', pct: phase.pct };
51
+ return { ...s, status: 'pending', pct: 0 };
52
+ }));
53
+ }, [phaseIdx]);
54
+
55
+ const stepColor = (s: Step) =>
56
+ s.status === 'active' ? '#c084fc' : s.status === 'done' ? '#a855f7' : 'rgba(168,85,247,0.25)';
57
+
58
+ const stepIcon = (s: Step) =>
59
+ s.status === 'active' ? 'sync' : s.status === 'done' ? 'check_circle' : 'hourglass_empty';
60
+
61
+ return (
62
+ <section className="relative z-10 flex flex-col items-center justify-center px-6 min-h-screen">
63
+ <div className="absolute inset-0 noise-bg z-0" />
64
+
65
+ {/* Purple scan line */}
66
+ <div className="absolute left-0 w-full h-[2px] pointer-events-none opacity-50"
67
+ style={{
68
+ top: '30%',
69
+ background: 'linear-gradient(to bottom, transparent 0%, rgba(168,85,247,0.3) 50%, transparent 100%)',
70
+ animation: 'scanMove 4s linear infinite',
71
+ }}
72
+ />
73
+
74
+ <div className="relative z-10 w-full max-w-4xl pt-24 pb-16 flex flex-col items-center">
75
+
76
+ {/* Header */}
77
+ <div className="w-full mb-12 text-center">
78
+ <h1
79
+ className="text-5xl font-black mb-2"
80
+ style={{
81
+ background: 'linear-gradient(135deg, #c084fc, #a855f7)',
82
+ WebkitBackgroundClip: 'text',
83
+ WebkitTextFillColor: 'transparent',
84
+ filter: 'drop-shadow(0 0 12px rgba(168,85,247,0.4))',
85
+ }}
86
+ >
87
+ SYSTEM_STATE: ANALYSIS
88
+ </h1>
89
+ <p className="text-sm tracking-[0.2em] uppercase" style={{ color: 'rgba(192,132,252,0.5)' }}>
90
+ Initiating Deep Inspection Protocol
91
+ </p>
92
+ </div>
93
+
94
+ {/* Bento grid */}
95
+ <div className="w-full grid grid-cols-1 md:grid-cols-12 gap-5">
96
+
97
+ {/* Left: Orb */}
98
+ <div
99
+ className="md:col-span-5 rounded-xl p-6 flex flex-col items-center justify-center relative min-h-[300px]"
100
+ style={{
101
+ background: 'rgba(20,10,40,0.5)',
102
+ border: '1px solid rgba(168,85,247,0.15)',
103
+ backdropFilter: 'blur(20px)',
104
+ boxShadow: 'inset 1px 1px 0 rgba(255,255,255,0.04)',
105
+ }}
106
+ >
107
+ <div className="absolute top-3 left-4 font-bold text-[10px] tracking-widest uppercase"
108
+ style={{ color: 'rgba(168,85,247,0.4)' }}>
109
+ Target Vector
110
+ </div>
111
+
112
+ <div
113
+ className="relative w-48 h-48 rounded-full flex items-center justify-center"
114
+ style={{
115
+ border: '1px solid rgba(168,85,247,0.25)',
116
+ boxShadow: '0 0 30px rgba(124,58,237,0.12)',
117
+ }}
118
+ >
119
+ <div
120
+ className="absolute inset-2 rounded-full border-dashed animate-spin-medium"
121
+ style={{ border: '1px dashed rgba(168,85,247,0.3)' }}
122
+ />
123
+ <div
124
+ className="absolute inset-6 rounded-full flex items-center justify-center overflow-hidden"
125
+ style={{
126
+ background: 'radial-gradient(circle, rgba(88,28,135,0.3) 0%, rgba(13,7,32,0.8) 100%)',
127
+ }}
128
+ >
129
+ <span
130
+ className="material-symbols-outlined text-[48px] opacity-40"
131
+ style={{ color: '#a855f7', fontVariationSettings: "'FILL' 1" }}
132
+ >
133
+ analytics
134
+ </span>
135
+ </div>
136
+ <div
137
+ className="absolute inset-0 rounded-full border-t-2 blur-[2px] animate-spin-fast"
138
+ style={{ borderColor: 'rgba(168,85,247,0.7)' }}
139
+ />
140
+ <span
141
+ className="material-symbols-outlined absolute text-4xl"
142
+ style={{ color: '#c084fc', filter: 'drop-shadow(0 0 10px rgba(168,85,247,0.8))' }}
143
+ >
144
+ troubleshoot
145
+ </span>
146
+ </div>
147
+
148
+ <div className="mt-6 w-full">
149
+ {[
150
+ { label: 'DATA_STREAM', value: 'ACTIVE', valueColor: '#a855f7' },
151
+ { label: 'THROUGHPUT', value: '2.4 TB/s', valueColor: '#818cf8' },
152
+ ].map(({ label, value, valueColor }) => (
153
+ <div
154
+ key={label}
155
+ className="flex items-center justify-between text-sm font-medium tracking-wider pb-1 mb-1"
156
+ style={{ borderBottom: '1px solid rgba(168,85,247,0.08)', color: 'rgba(192,132,252,0.5)' }}
157
+ >
158
+ <span>{label}</span>
159
+ <span style={{ color: valueColor, fontWeight: 700 }}>{value}</span>
160
+ </div>
161
+ ))}
162
+ </div>
163
+ </div>
164
+
165
+ {/* Right: Pipeline */}
166
+ <div
167
+ className="md:col-span-7 rounded-xl p-6 flex flex-col justify-center gap-4"
168
+ style={{
169
+ background: 'rgba(20,10,40,0.5)',
170
+ border: '1px solid rgba(168,85,247,0.15)',
171
+ backdropFilter: 'blur(20px)',
172
+ boxShadow: 'inset 1px 1px 0 rgba(255,255,255,0.04)',
173
+ }}
174
+ >
175
+ <div className="flex justify-between items-center mb-1">
176
+ <span className="font-bold text-[10px] tracking-widest uppercase"
177
+ style={{ color: 'rgba(168,85,247,0.4)' }}>
178
+ Processing Pipeline
179
+ </span>
180
+ <span
181
+ className="text-sm font-bold px-3 py-1 rounded"
182
+ style={{
183
+ color: '#c084fc',
184
+ background: 'rgba(124,58,237,0.2)',
185
+ border: '1px solid rgba(168,85,247,0.3)',
186
+ }}
187
+ >
188
+ {overallPct}% COMPLETE
189
+ </span>
190
+ </div>
191
+
192
+ {steps.map((step, i) => (
193
+ <div
194
+ key={i}
195
+ className="flex flex-col gap-1 transition-opacity duration-400"
196
+ style={{ opacity: step.status === 'pending' ? 0.3 : 1 }}
197
+ >
198
+ <div className="flex justify-between items-center">
199
+ <div className="flex items-center gap-2">
200
+ <span
201
+ className="material-symbols-outlined text-sm"
202
+ style={{ color: stepColor(step) }}
203
+ >
204
+ {stepIcon(step)}
205
+ </span>
206
+ <span className="text-sm font-medium tracking-wider text-white/80">
207
+ {step.label}
208
+ </span>
209
+ </div>
210
+ <span className="text-sm font-bold" style={{ color: stepColor(step) }}>
211
+ {step.status === 'done' ? '100%' : step.status === 'active' ? `${step.pct}%` : '0%'}
212
+ </span>
213
+ </div>
214
+ <div className="w-full h-2 flex gap-[2px] rounded overflow-hidden"
215
+ style={{ background: 'rgba(88,28,135,0.2)' }}>
216
+ {Array.from({ length: 10 }).map((_, j) => {
217
+ const filled = step.status === 'done' || (step.status === 'active' && j < Math.round(step.pct / 10));
218
+ return (
219
+ <div key={j} className="h-full flex-1 transition-all duration-500"
220
+ style={{
221
+ background: filled
222
+ ? step.status === 'done'
223
+ ? `${P}0.55)`
224
+ : `${P}0.85)`
225
+ : `${P}0.08)`,
226
+ boxShadow: filled && step.status === 'active' ? `0 0 6px ${P}0.5)` : 'none',
227
+ }}
228
+ />
229
+ );
230
+ })}
231
+ </div>
232
+ </div>
233
+ ))}
234
+ </div>
235
+ </div>
236
+
237
+ {/* Overall progress */}
238
+ <div
239
+ className="w-full mt-6 rounded-xl p-4"
240
+ style={{
241
+ background: 'rgba(20,10,40,0.5)',
242
+ border: '1px solid rgba(168,85,247,0.15)',
243
+ backdropFilter: 'blur(20px)',
244
+ }}
245
+ >
246
+ <div className="flex justify-between items-center mb-2">
247
+ <span className="font-bold text-[10px] tracking-widest uppercase"
248
+ style={{ color: 'rgba(168,85,247,0.4)' }}>
249
+ Overall Progress
250
+ </span>
251
+ <span className="text-sm font-bold" style={{ color: '#c084fc' }}>{overallPct}%</span>
252
+ </div>
253
+ <div className="w-full h-3 rounded-full overflow-hidden"
254
+ style={{ background: 'rgba(88,28,135,0.2)' }}>
255
+ <div
256
+ className="h-full rounded-full transition-all duration-700"
257
+ style={{
258
+ width: `${overallPct}%`,
259
+ background: 'linear-gradient(to right, #7c3aed, #a855f7, #c084fc)',
260
+ boxShadow: '0 0 12px rgba(168,85,247,0.5)',
261
+ }}
262
+ />
263
+ </div>
264
+ </div>
265
+
266
+ </div>
267
+ </section>
268
+ );
269
+ }
frontend-react/src/components/RadioNav.tsx ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useState } from 'react';
2
+
3
+ interface RadioNavProps {
4
+ active: string;
5
+ onNavigate: (id: string) => void;
6
+ }
7
+
8
+ const items = [
9
+ {
10
+ id: 'dashboard',
11
+ label: 'Dashboard',
12
+ icon: (
13
+ <path d="M4 13h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1zm-1 7a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v4zm10 0a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1v-7a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v7zm1-10h6a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1z" />
14
+ ),
15
+ },
16
+ {
17
+ id: 'analyze',
18
+ label: 'Analyze',
19
+ icon: (
20
+ <path d="M12 2a5 5 0 1 0 5 5 5 5 0 0 0-5-5zm0 8a3 3 0 1 1 3-3 3 3 0 0 1-3 3zm9 11v-1a7 7 0 0 0-7-7h-4a7 7 0 0 0-7 7v1h2v-1a5 5 0 0 1 5-5h4a5 5 0 0 1 5 5v1z" />
21
+ ),
22
+ },
23
+ {
24
+ id: 'pricing',
25
+ label: 'Pricing',
26
+ icon: (
27
+ <path d="M5 18v3.766l1.515-.909L11.277 18H16c1.103 0 2-.897 2-2V8c0-1.103-.897-2-2-2H4c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h1zM4 8h12v8h-5.277L7 18.234V16H4V8zm16-6H8c-1.103 0-2 .897-2 2h12c1.103 0 2 .897 2 2v8c1.103 0 2-.897 2-2V4c0-1.103-.897-2-2-2z" />
28
+ ),
29
+ },
30
+ {
31
+ id: 'agents',
32
+ label: 'Agents',
33
+ icon: (
34
+ <path d="M11.953 2C6.465 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.493 2 11.953 2zM12 20c-4.411 0-8-3.589-8-8s3.567-8 7.953-8C16.391 4 20 7.589 20 12s-3.589 8-8 8zm-1-5h2v2h-2zm0-8h2v6h-2z" />
35
+ ),
36
+ },
37
+ {
38
+ id: 'settings',
39
+ label: 'Settings',
40
+ icon: (
41
+ <>
42
+ <path d="M12 16c2.206 0 4-1.794 4-4s-1.794-4-4-4-4 1.794-4 4 1.794 4 4 4zm0-6c1.084 0 2 .916 2 2s-.916 2-2 2-2-.916-2-2 .916-2 2-2z" />
43
+ <path d="m2.845 16.136 1 1.73c.531.917 1.809 1.261 2.73.73l.529-.306A8.1 8.1 0 0 0 9 19.402V20c0 1.103.897 2 2 2h2c1.103 0 2-.897 2-2v-.598a8.132 8.132 0 0 0 1.896-1.111l.529.306c.923.53 2.198.188 2.731-.731l.999-1.729a2.001 2.001 0 0 0-.731-2.732l-.505-.292a7.718 7.718 0 0 0 0-2.224l.505-.292a2.002 2.002 0 0 0 .731-2.732l-.999-1.729c-.531-.92-1.808-1.265-2.731-.732l-.529.306A8.1 8.1 0 0 0 15 4.598V4c0-1.103-.897-2-2-2h-2c-1.103 0-2 .897-2 2v.598a8.132 8.132 0 0 0-1.896 1.111l-.529-.306c-.924-.531-2.2-.187-2.731.732l-.999 1.729a2.001 2.001 0 0 0 .731 2.732l.505.292a7.683 7.683 0 0 0 0 2.223l-.505.292a2.003 2.003 0 0 0-.731 2.733zm3.326-2.758A5.703 5.703 0 0 1 6 12c0-.462.058-.926.17-1.378a.999.999 0 0 0-.47-1.108l-1.123-.65.998-1.729 1.145.662a.997.997 0 0 0 1.188-.142 6.071 6.071 0 0 1 2.384-1.399A1 1 0 0 0 11 5.3V4h2v1.3a1 1 0 0 0 .708.956 6.083 6.083 0 0 1 2.384 1.399.999.999 0 0 0 1.188.142l1.144-.661 1 1.729-1.124.649a1 1 0 0 0-.47 1.108c.112.452.17.916.17 1.378 0 .461-.058.925-.171 1.378a1 1 0 0 0 .471 1.108l1.123.649-.998 1.729-1.145-.661a.996.996 0 0 0-1.188.142 6.071 6.071 0 0 1-2.384 1.399A1 1 0 0 0 13 18.7l.002 1.3H11v-1.3a1 1 0 0 0-.708-.956 6.083 6.083 0 0 1-2.384-1.399.992.992 0 0 0-1.188-.141l-1.144.662-1-1.729 1.124-.651a1 1 0 0 0 .471-1.108z" />
44
+ </>
45
+ ),
46
+ },
47
+ ];
48
+
49
+ export default function RadioNav({ active, onNavigate }: RadioNavProps) {
50
+ const [hovered, setHovered] = useState<string | null>(null);
51
+
52
+ // Sync radio inputs with active state
53
+ useEffect(() => {
54
+ const el = document.getElementById(active) as HTMLInputElement | null;
55
+ if (el) el.checked = true;
56
+ }, [active]);
57
+
58
+ return (
59
+ <div className="fixed top-4 left-1/2 z-50 -translate-x-1/2 transition-all duration-450 ease-in-out w-auto px-4">
60
+ <article
61
+ className="flex rounded-2xl overflow-hidden"
62
+ style={{
63
+ background: '#0d0720',
64
+ border: '1px solid rgba(168,85,247,0.18)',
65
+ boxShadow: '0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(88,28,135,0.15)',
66
+ }}
67
+ >
68
+ {items.map(item => {
69
+ const isActive = active === item.id;
70
+ const isHovered = hovered === item.id;
71
+
72
+ return (
73
+ <label
74
+ key={item.id}
75
+ htmlFor={item.id}
76
+ className="relative flex flex-col items-center justify-center cursor-pointer select-none transition-all duration-300"
77
+ style={{
78
+ width: 72,
79
+ height: 64,
80
+ padding: '8px 4px 4px',
81
+ gap: 4,
82
+ borderRadius: 12,
83
+ background: isActive
84
+ ? 'rgba(124,58,237,0.25)'
85
+ : isHovered
86
+ ? 'rgba(88,28,135,0.15)'
87
+ : 'transparent',
88
+ boxShadow: isActive
89
+ ? 'inset 0 1px 0 rgba(192,132,252,0.15), 0 0 16px rgba(124,58,237,0.2)'
90
+ : 'none',
91
+ borderBottom: isActive ? '2px solid rgba(168,85,247,0.7)' : '2px solid transparent',
92
+ }}
93
+ onMouseEnter={() => setHovered(item.id)}
94
+ onMouseLeave={() => setHovered(null)}
95
+ onClick={() => onNavigate(item.id)}
96
+ >
97
+ <input
98
+ id={item.id}
99
+ name="nav"
100
+ type="radio"
101
+ className="hidden"
102
+ defaultChecked={isActive}
103
+ />
104
+
105
+ <svg
106
+ viewBox="0 0 24 24"
107
+ width={20}
108
+ height={20}
109
+ xmlns="http://www.w3.org/2000/svg"
110
+ style={{
111
+ fill: isActive ? '#c084fc' : isHovered ? '#a855f7' : 'rgba(168,85,247,0.35)',
112
+ filter: isActive ? 'drop-shadow(0 0 6px rgba(192,132,252,0.7))' : 'none',
113
+ transform: isActive || isHovered ? 'scale(1.2)' : 'scale(1)',
114
+ transition: 'all 0.3s ease',
115
+ }}
116
+ >
117
+ {item.icon}
118
+ </svg>
119
+
120
+ <span
121
+ className="font-bold uppercase tracking-wider"
122
+ style={{
123
+ fontSize: 8,
124
+ letterSpacing: '0.08em',
125
+ color: isActive ? '#c084fc' : isHovered ? '#a855f7' : 'rgba(168,85,247,0.3)',
126
+ transition: 'color 0.3s ease',
127
+ }}
128
+ >
129
+ {item.label}
130
+ </span>
131
+ </label>
132
+ );
133
+ })}
134
+ </article>
135
+ </div>
136
+ );
137
+ }
frontend-react/src/components/ResultSection.tsx ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useEffect, useRef } from 'react';
2
+ import type { AnalysisResult } from '../types';
3
+
4
+ interface ResultSectionProps {
5
+ result: AnalysisResult;
6
+ onReset: () => void;
7
+ }
8
+
9
+ function fmtVal(v: unknown) {
10
+ if (v === null || v === undefined) return '—';
11
+ return String(v);
12
+ }
13
+
14
+ // Neumorphic card style — dark purple variant
15
+ const neuCard: React.CSSProperties = {
16
+ borderRadius: 30,
17
+ background: '#120a24',
18
+ boxShadow: '15px 15px 30px #0a0618, -15px -15px 30px #1a0e30',
19
+ };
20
+
21
+ const neuCardAccent = (color: string): React.CSSProperties => ({
22
+ borderRadius: 30,
23
+ background: '#120a24',
24
+ boxShadow: `15px 15px 30px #0a0618, -15px -15px 30px #1a0e30, 0 0 0 1px ${color}22`,
25
+ });
26
+
27
+ export default function ResultSection({ result, onReset }: ResultSectionProps) {
28
+ const isFake = result.result === 'FAKE';
29
+ const pct = result.confidence;
30
+ const accentColor = isFake ? '#ff3355' : '#a855f7';
31
+ const accentGlow = isFake ? 'rgba(255,51,85,0.4)' : 'rgba(168,85,247,0.4)';
32
+ const timelineRef = useRef<HTMLDivElement>(null);
33
+
34
+ useEffect(() => {
35
+ const container = timelineRef.current;
36
+ if (!container) return;
37
+ container.innerHTML = '';
38
+
39
+ const frames = result.frame_timeline ?? [];
40
+ if (!frames.length) {
41
+ container.innerHTML = '<span style="font-size:11px;color:#6b21a8;font-family:Space Grotesk,monospace;margin:auto;display:flex;align-items:center;height:100%;">No per-frame data available</span>';
42
+ return;
43
+ }
44
+
45
+ const W = container.clientWidth || 600;
46
+ const H = 120;
47
+ const PAD = { top: 12, right: 16, bottom: 24, left: 32 };
48
+ const chartW = W - PAD.left - PAD.right;
49
+ const chartH = H - PAD.top - PAD.bottom;
50
+
51
+ const scores = frames.map(f => f.fake_pct / 100);
52
+ const n = scores.length;
53
+
54
+ // x/y helpers
55
+ const xOf = (i: number) => PAD.left + (i / Math.max(n - 1, 1)) * chartW;
56
+ const yOf = (v: number) => PAD.top + (1 - v) * chartH;
57
+
58
+ // Smooth catmull-rom path
59
+ const smooth = (pts: [number, number][]) => {
60
+ if (pts.length < 2) return '';
61
+ let d = `M ${pts[0][0]},${pts[0][1]}`;
62
+ for (let i = 0; i < pts.length - 1; i++) {
63
+ const p0 = pts[Math.max(i - 1, 0)];
64
+ const p1 = pts[i];
65
+ const p2 = pts[i + 1];
66
+ const p3 = pts[Math.min(i + 2, pts.length - 1)];
67
+ const cp1x = p1[0] + (p2[0] - p0[0]) / 6;
68
+ const cp1y = p1[1] + (p2[1] - p0[1]) / 6;
69
+ const cp2x = p2[0] - (p3[0] - p1[0]) / 6;
70
+ const cp2y = p2[1] - (p3[1] - p1[1]) / 6;
71
+ d += ` C ${cp1x},${cp1y} ${cp2x},${cp2y} ${p2[0]},${p2[1]}`;
72
+ }
73
+ return d;
74
+ };
75
+
76
+ const pts: [number, number][] = scores.map((v, i) => [xOf(i), yOf(v)]);
77
+ const linePath = smooth(pts);
78
+ const areaPath = linePath
79
+ + ` L ${xOf(n - 1)},${yOf(0)} L ${xOf(0)},${yOf(0)} Z`;
80
+
81
+ const gradId = `tl-grad-${Date.now()}`;
82
+ const fakeColor = isFake ? '#ff3355' : '#a855f7';
83
+ const fakeColorMid = isFake ? 'rgba(255,51,85,0.35)' : 'rgba(168,85,247,0.35)';
84
+ const fakeColorEnd = isFake ? 'rgba(255,51,85,0.0)' : 'rgba(168,85,247,0.0)';
85
+
86
+ const svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
87
+ svg.setAttribute('width', '100%');
88
+ svg.setAttribute('height', String(H));
89
+ svg.setAttribute('viewBox', `0 0 ${W} ${H}`);
90
+ svg.style.overflow = 'visible';
91
+
92
+ // Defs: gradient + glow filter
93
+ svg.innerHTML = `
94
+ <defs>
95
+ <linearGradient id="${gradId}" x1="0" y1="0" x2="0" y2="1">
96
+ <stop offset="0%" stop-color="${fakeColor}" stop-opacity="0.55"/>
97
+ <stop offset="60%" stop-color="${fakeColorMid}"/>
98
+ <stop offset="100%" stop-color="${fakeColorEnd}"/>
99
+ </linearGradient>
100
+ <filter id="glow-${gradId}">
101
+ <feGaussianBlur stdDeviation="2.5" result="blur"/>
102
+ <feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge>
103
+ </filter>
104
+ </defs>
105
+
106
+ <!-- Grid lines -->
107
+ ${[0, 0.25, 0.5, 0.75, 1].map(v => `
108
+ <line
109
+ x1="${PAD.left}" y1="${yOf(v)}"
110
+ x2="${PAD.left + chartW}" y2="${yOf(v)}"
111
+ stroke="rgba(88,28,135,0.25)" stroke-width="1"
112
+ stroke-dasharray="${v === 0.5 ? '4,3' : '2,4'}"
113
+ />
114
+ <text x="${PAD.left - 6}" y="${yOf(v) + 4}"
115
+ font-size="9" fill="rgba(168,85,247,0.4)"
116
+ text-anchor="end" font-family="Space Grotesk,monospace">
117
+ ${Math.round(v * 100)}%
118
+ </text>
119
+ `).join('')}
120
+
121
+ <!-- 50% threshold label -->
122
+ <text x="${PAD.left + chartW + 4}" y="${yOf(0.5) + 4}"
123
+ font-size="9" fill="rgba(168,85,247,0.6)"
124
+ font-family="Space Grotesk,monospace" font-weight="700">50%</text>
125
+
126
+ <!-- Area fill -->
127
+ <path d="${areaPath}" fill="url(#${gradId})"/>
128
+
129
+ <!-- Line -->
130
+ <path d="${linePath}"
131
+ fill="none" stroke="${fakeColor}" stroke-width="2"
132
+ stroke-linecap="round" stroke-linejoin="round"
133
+ filter="url(#glow-${gradId})"/>
134
+
135
+ <!-- Data points -->
136
+ ${scores.map((v, i) => {
137
+ const x = xOf(i);
138
+ const y = yOf(v);
139
+ const hot = v > 0.5;
140
+ return `
141
+ <circle cx="${x}" cy="${y}" r="${hot ? 4 : 2.5}"
142
+ fill="${hot ? fakeColor : '#120a24'}"
143
+ stroke="${fakeColor}" stroke-width="${hot ? 0 : 1.5}"
144
+ opacity="${hot ? 1 : 0.6}"
145
+ filter="${hot ? `url(#glow-${gradId})` : ''}"/>
146
+ `;
147
+ }).join('')}
148
+
149
+ <!-- X-axis frame labels (every ~5th) -->
150
+ ${scores.map((_, i) => {
151
+ if (i % Math.max(1, Math.floor(n / 8)) !== 0 && i !== n - 1) return '';
152
+ return `<text x="${xOf(i)}" y="${H - 4}"
153
+ font-size="8" fill="rgba(168,85,247,0.35)"
154
+ text-anchor="middle" font-family="Space Grotesk,monospace">F${i + 1}</text>`;
155
+ }).join('')}
156
+ `;
157
+
158
+ container.appendChild(svg);
159
+ }, [result, isFake]);
160
+
161
+ const metaItems = [
162
+ ['Frames Analyzed', fmtVal(result.metadata?.frames_analyzed)],
163
+ ['Duration', result.metadata?.video_duration_sec ? result.metadata.video_duration_sec + 's' : '—'],
164
+ ['FPS', fmtVal(result.metadata?.video_fps)],
165
+ ['Resolution', fmtVal(result.metadata?.resolution)],
166
+ ['Processing Time', result.processing_time_sec ? result.processing_time_sec + 's' : '—'],
167
+ ];
168
+
169
+ const audioLabel: Record<string, string> = {
170
+ HUMAN_VOICE: 'Human Voice',
171
+ AI_VOICE: 'AI Voice',
172
+ AV_MISMATCH: 'AV Mismatch',
173
+ NO_AUDIO: 'No Audio',
174
+ };
175
+
176
+ return (
177
+ <section className="relative z-10 flex flex-col items-center justify-center px-6 pt-28 pb-16 min-h-screen">
178
+ <div className="w-full max-w-4xl flex flex-col gap-6">
179
+
180
+ {/* ── Verdict card ── */}
181
+ <div style={neuCardAccent(accentColor)} className="p-8 overflow-hidden relative">
182
+ <div className="flex flex-col md:flex-row items-center gap-8">
183
+
184
+ {/* Badge */}
185
+ <div
186
+ className="flex flex-col items-center justify-center w-40 h-40 rounded-full flex-shrink-0"
187
+ style={{
188
+ background: '#120a24',
189
+ boxShadow: `8px 8px 20px #0a0618, -8px -8px 20px #1a0e30, 0 0 0 2px ${accentColor}55, 0 0 30px ${accentGlow}`,
190
+ }}
191
+ >
192
+ <span className="text-4xl mb-1">{isFake ? '⚠' : '✓'}</span>
193
+ <span className="text-xl font-black tracking-widest uppercase"
194
+ style={{ color: accentColor, textShadow: `0 0 20px ${accentGlow}` }}>
195
+ {isFake ? 'DEEPFAKE' : 'AUTHENTIC'}
196
+ </span>
197
+ </div>
198
+
199
+ {/* Confidence */}
200
+ <div className="flex-1 w-full">
201
+ <div className="flex justify-between items-center mb-2">
202
+ <span className="font-bold text-[10px] tracking-widest uppercase text-purple-400/40">
203
+ Confidence Score
204
+ </span>
205
+ <span className="text-2xl font-black" style={{ color: accentColor }}>
206
+ {pct}%
207
+ </span>
208
+ </div>
209
+
210
+ {/* Bar track — inset neumorphic */}
211
+ <div className="w-full h-4 rounded-full overflow-hidden mb-4"
212
+ style={{
213
+ background: '#120a24',
214
+ boxShadow: 'inset 4px 4px 8px #0a0618, inset -4px -4px 8px #1a0e30',
215
+ }}>
216
+ <div className="h-full rounded-full transition-all duration-1000"
217
+ style={{
218
+ width: `${pct}%`,
219
+ background: isFake
220
+ ? 'linear-gradient(to right, #ff3355, #ff6680)'
221
+ : 'linear-gradient(to right, #7c3aed, #a855f7, #c084fc)',
222
+ boxShadow: `0 0 12px ${accentGlow}`,
223
+ }}
224
+ />
225
+ </div>
226
+
227
+ {/* Risk badge */}
228
+ <div className="inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold uppercase tracking-wider"
229
+ style={{
230
+ color: pct >= 65 ? '#ff3355' : pct >= 35 ? '#f59e0b' : '#a855f7',
231
+ background: '#120a24',
232
+ boxShadow: `4px 4px 10px #0a0618, -4px -4px 10px #1a0e30`,
233
+ border: `1px solid ${pct >= 65 ? 'rgba(255,51,85,0.3)' : pct >= 35 ? 'rgba(245,158,11,0.3)' : 'rgba(168,85,247,0.3)'}`,
234
+ }}>
235
+ {pct >= 65 ? 'CRITICAL RISK' : pct >= 35 ? 'MEDIUM RISK' : 'LOW RISK'}
236
+ </div>
237
+
238
+ {result.audio?.available && (
239
+ <div className="mt-3 flex items-center gap-3 text-xs text-purple-300/50">
240
+ <span className="material-symbols-outlined text-[16px]">
241
+ {result.audio.result === 'HUMAN_VOICE' ? 'mic' : result.audio.result === 'AI_VOICE' ? 'smart_toy' : 'warning'}
242
+ </span>
243
+ <span>Audio: <strong style={{ color: accentColor }}>{audioLabel[result.audio.result] ?? result.audio.result}</strong></span>
244
+ <span className="text-purple-500/40">({result.audio.confidence?.toFixed(1)}% conf)</span>
245
+ </div>
246
+ )}
247
+
248
+ {result.metadata_check?.c2pa_detected && (
249
+ <div className="mt-2 flex items-center gap-2 text-xs text-amber-400/70">
250
+ <span className="material-symbols-outlined text-[16px]">verified</span>
251
+ C2PA metadata detected — AI-generated content signature found
252
+ {result.metadata_check.tool_detected && (
253
+ <span className="text-purple-400/40">({result.metadata_check.tool_detected})</span>
254
+ )}
255
+ </div>
256
+ )}
257
+ </div>
258
+ </div>
259
+ </div>
260
+
261
+ {/* ── Insights + Metadata row ── */}
262
+ <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
263
+
264
+ {/* Insights */}
265
+ <div style={neuCard} className="p-6">
266
+ <h3 className="font-bold text-[10px] tracking-widest uppercase mb-4 flex items-center gap-2 text-purple-400/40">
267
+ <span className="material-symbols-outlined text-[14px]">analytics</span>
268
+ Analysis Insights
269
+ </h3>
270
+ <div className="flex flex-col gap-3">
271
+ {(result.details ?? ['Analysis completed.']).map((txt, i) => (
272
+ <div key={i} className="flex items-start gap-3 pl-3 text-sm text-purple-100/70"
273
+ style={{ borderLeft: `2px solid ${accentColor}` }}>
274
+ <span className="w-2 h-2 rounded-full mt-1.5 flex-shrink-0"
275
+ style={{ background: accentColor, boxShadow: `0 0 8px ${accentGlow}` }} />
276
+ {txt}
277
+ </div>
278
+ ))}
279
+ </div>
280
+ </div>
281
+
282
+ {/* Metadata */}
283
+ <div style={neuCard} className="p-6">
284
+ <h3 className="font-bold text-[10px] tracking-widest uppercase mb-4 flex items-center gap-2 text-purple-400/40">
285
+ <span className="material-symbols-outlined text-[14px]">info</span>
286
+ Video Metadata
287
+ </h3>
288
+ <div className="flex flex-col gap-3">
289
+ {metaItems.map(([k, v]) => (
290
+ <div key={k} className="flex justify-between items-center pb-2"
291
+ style={{ borderBottom: '1px solid rgba(88,28,135,0.2)' }}>
292
+ <span className="text-[11px] tracking-wider uppercase text-purple-400/40">{k}</span>
293
+ <span className="text-sm font-bold text-white font-mono">{v}</span>
294
+ </div>
295
+ ))}
296
+ {result.cached && (
297
+ <div className="flex items-center gap-2 text-xs text-purple-400/60 mt-1">
298
+ <span className="material-symbols-outlined text-[14px]">cached</span>
299
+ Result served from cache
300
+ </div>
301
+ )}
302
+ </div>
303
+ </div>
304
+ </div>
305
+
306
+ {/* ── Frame timeline ── */}
307
+ <div style={neuCard} className="p-6">
308
+ <h3 className="font-bold text-[10px] tracking-widest uppercase mb-4 flex items-center gap-2 text-purple-400/40">
309
+ <span className="material-symbols-outlined text-[14px]">timeline</span>
310
+ Frame-by-Frame Analysis
311
+ </h3>
312
+ <div ref={timelineRef} className="relative w-full" style={{ height: 120 }} />
313
+ </div>
314
+
315
+ {/* ── Action button ── */}
316
+ <div className="flex justify-center">
317
+ <button
318
+ onClick={onReset}
319
+ className="px-8 py-3 font-bold text-xs uppercase tracking-wider rounded-full transition-all active:scale-95"
320
+ style={{
321
+ background: '#120a24',
322
+ boxShadow: '8px 8px 16px #0a0618, -8px -8px 16px #1a0e30',
323
+ border: '1px solid rgba(168,85,247,0.3)',
324
+ color: '#c084fc',
325
+ }}
326
+ onMouseEnter={e => (e.currentTarget.style.boxShadow = '8px 8px 16px #0a0618, -8px -8px 16px #1a0e30, 0 0 20px rgba(168,85,247,0.25)')}
327
+ onMouseLeave={e => (e.currentTarget.style.boxShadow = '8px 8px 16px #0a0618, -8px -8px 16px #1a0e30')}
328
+ >
329
+ <span className="flex items-center gap-2">
330
+ <span className="material-symbols-outlined text-[16px]">refresh</span>
331
+ Analyze Another
332
+ </span>
333
+ </button>
334
+ </div>
335
+
336
+ </div>
337
+ </section>
338
+ );
339
+ }
frontend-react/src/components/UploadSection.tsx ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import FileUploadInput from './FileUploadInput';
3
+ import InitiateButton from './InitiateButton';
4
+
5
+ interface UploadSectionProps {
6
+ onAnalyze: (file: File) => void;
7
+ onBack: () => void;
8
+ }
9
+
10
+ function fmtBytes(b: number) {
11
+ if (b < 1024) return b + ' B';
12
+ if (b < 1048576) return (b / 1024).toFixed(1) + ' KB';
13
+ return (b / 1048576).toFixed(1) + ' MB';
14
+ }
15
+
16
+ export default function UploadSection({ onAnalyze, onBack }: UploadSectionProps) {
17
+ const [file, setFile] = useState<File | null>(null);
18
+ const [dragging, setDragging] = useState(false);
19
+ const [time, setTime] = useState('--:--:--');
20
+ const inputRef = useRef<HTMLInputElement>(null);
21
+
22
+ useEffect(() => {
23
+ const t = setInterval(() => {
24
+ setTime(new Date().toLocaleTimeString('en-US', { hour12: false }));
25
+ }, 1000);
26
+ return () => clearInterval(t);
27
+ }, []);
28
+
29
+ const applyFile = useCallback((f: File) => {
30
+ if (!f.type.startsWith('video/')) return;
31
+ setFile(f);
32
+ }, []);
33
+
34
+ const onDrop = useCallback((e: React.DragEvent) => {
35
+ e.preventDefault();
36
+ setDragging(false);
37
+ const f = e.dataTransfer.files[0];
38
+ if (f) applyFile(f);
39
+ }, [applyFile]);
40
+
41
+ return (
42
+ <section className="relative z-10 flex flex-col items-center justify-center pt-28 pb-24 px-6 min-h-screen">
43
+ <div className="w-full max-w-3xl flex flex-col gap-8">
44
+
45
+ {/* Header */}
46
+ <div className="text-center space-y-2">
47
+ <h1
48
+ className="text-3xl font-semibold"
49
+ style={{
50
+ background: 'linear-gradient(135deg, #c084fc, #a855f7)',
51
+ WebkitBackgroundClip: 'text',
52
+ WebkitTextFillColor: 'transparent',
53
+ filter: 'drop-shadow(0 0 12px rgba(168,85,247,0.5))',
54
+ }}
55
+ >
56
+ SECURE INGEST PORTAL
57
+ </h1>
58
+ <p className="text-sm font-medium tracking-wider text-purple-300/50">
59
+ Awaiting encrypted payload via protocol AX-9.
60
+ </p>
61
+ </div>
62
+
63
+ {/* Drop zone outer */}
64
+ <div
65
+ className="relative backdrop-blur-2xl rounded-xl overflow-hidden transition-colors duration-500"
66
+ style={{
67
+ background: 'rgba(30,15,50,0.4)',
68
+ border: `1px solid ${dragging ? 'rgba(168,85,247,0.6)' : 'rgba(168,85,247,0.15)'}`,
69
+ boxShadow: 'inset 0 1px 1px rgba(255,255,255,0.04), 0 0 30px rgba(0,0,0,0.5)',
70
+ }}
71
+ >
72
+ <div className="scan-line" style={{ background: 'linear-gradient(to bottom, transparent 0%, rgba(168,85,247,0.12) 50%, transparent 100%)' }} />
73
+
74
+ {/* Drop zone inner */}
75
+ <div
76
+ onClick={() => {/* clicks handled by FileUploadInput */}}
77
+ onDragOver={e => { e.preventDefault(); setDragging(true); }}
78
+ onDragLeave={() => setDragging(false)}
79
+ onDrop={onDrop}
80
+ className="p-10 flex flex-col items-center justify-center border-2 border-dashed
81
+ m-4 rounded-lg transition-all duration-300 cursor-pointer min-h-[300px]"
82
+ style={{
83
+ borderColor: dragging ? 'rgba(168,85,247,0.7)' : 'rgba(88,28,135,0.4)',
84
+ background: dragging ? 'rgba(168,85,247,0.06)' : 'rgba(20,10,35,0.3)',
85
+ boxShadow: dragging ? '0 0 40px rgba(168,85,247,0.12) inset' : 'none',
86
+ }}
87
+ onMouseEnter={e => {
88
+ if (!dragging) {
89
+ (e.currentTarget as HTMLDivElement).style.borderColor = 'rgba(168,85,247,0.5)';
90
+ (e.currentTarget as HTMLDivElement).style.background = 'rgba(168,85,247,0.04)';
91
+ }
92
+ }}
93
+ onMouseLeave={e => {
94
+ if (!dragging) {
95
+ (e.currentTarget as HTMLDivElement).style.borderColor = 'rgba(88,28,135,0.4)';
96
+ (e.currentTarget as HTMLDivElement).style.background = 'rgba(20,10,35,0.3)';
97
+ }
98
+ }}
99
+ >
100
+ {!file ? (
101
+ <div className="flex flex-col items-center gap-6">
102
+ {/* Animated folder upload widget */}
103
+ <FileUploadInput onFile={applyFile} />
104
+
105
+ <h3 className="text-2xl font-semibold text-white text-center">
106
+ INITIALIZE UPLOAD
107
+ </h3>
108
+ <p className="text-base text-purple-300/50 text-center max-w-sm -mt-3">
109
+ Drag and drop your video file here, or use the button above.
110
+ </p>
111
+ <div className="flex items-center gap-2 font-bold text-[10px] text-purple-500/50 tracking-widest justify-center">
112
+ <span className="w-1.5 h-1.5 rounded-full bg-purple-500/50" />
113
+ ACCEPTED: MP4 · AVI · MOV · MKV · WebM
114
+ <span className="w-1.5 h-1.5 rounded-full bg-purple-500/50" />
115
+ </div>
116
+ </div>
117
+ ) : (
118
+ <div className="w-full flex items-center gap-5">
119
+ <div
120
+ className="w-14 h-14 rounded-lg flex items-center justify-center flex-shrink-0"
121
+ style={{
122
+ background: 'rgba(124,58,237,0.15)',
123
+ border: '1px solid rgba(168,85,247,0.3)',
124
+ boxShadow: '0 0 20px rgba(124,58,237,0.15)',
125
+ }}
126
+ >
127
+ <span
128
+ className="material-symbols-outlined text-[28px]"
129
+ style={{ color: '#a855f7', fontVariationSettings: "'FILL' 1" }}
130
+ >
131
+ video_file
132
+ </span>
133
+ </div>
134
+ <div className="flex-1 min-w-0">
135
+ <p className="text-sm font-medium tracking-wider text-white overflow-hidden text-ellipsis whitespace-nowrap">
136
+ {file.name}
137
+ </p>
138
+ <p className="font-bold text-[10px] text-purple-300/50 mt-1">{fmtBytes(file.size)}</p>
139
+ </div>
140
+ <button
141
+ onClick={e => { e.stopPropagation(); setFile(null); }}
142
+ className="p-2 rounded-sm transition-all text-purple-400/50 hover:text-red-400 hover:bg-red-400/10"
143
+ >
144
+ <span className="material-symbols-outlined text-[20px]">close</span>
145
+ </button>
146
+ </div>
147
+ )}
148
+ </div>
149
+ </div>
150
+
151
+ {/* Hidden input — used only by drag-and-drop path */}
152
+ <input
153
+ ref={inputRef}
154
+ type="file"
155
+ accept="video/*"
156
+ className="hidden"
157
+ onChange={e => e.target.files?.[0] && applyFile(e.target.files[0])}
158
+ />
159
+
160
+ {/* Initiate analysis button */}
161
+ <InitiateButton onClick={() => file && onAnalyze(file)} disabled={!file} />
162
+
163
+ {/* Active queue */}
164
+ <div className="flex flex-col gap-4">
165
+ <div
166
+ className="flex items-center justify-between pb-2"
167
+ style={{ borderBottom: '1px solid rgba(168,85,247,0.12)' }}
168
+ >
169
+ <h4 className="font-bold text-[10px] uppercase tracking-widest flex items-center gap-2"
170
+ style={{ color: '#a855f7' }}>
171
+ <span
172
+ className="w-2 h-2"
173
+ style={{ background: '#a855f7', boxShadow: '0 0 8px rgba(168,85,247,0.8)' }}
174
+ />
175
+ ACTIVE QUEUE
176
+ </h4>
177
+ <span className="font-mono text-[10px] text-purple-400/40">SYS_TIME: {time}</span>
178
+ </div>
179
+
180
+ <div className="grid grid-cols-1 gap-2">
181
+ {file ? (
182
+ <div
183
+ className="rounded p-4 flex items-center gap-3"
184
+ style={{
185
+ background: 'rgba(20,10,35,0.6)',
186
+ border: '1px solid rgba(124,58,237,0.25)',
187
+ }}
188
+ >
189
+ <span className="material-symbols-outlined text-[20px]" style={{ color: '#a855f7' }}>video_file</span>
190
+ <span className="text-sm font-medium tracking-wider text-white truncate">{file.name}</span>
191
+ <span
192
+ className="ml-auto font-bold text-[10px] uppercase tracking-widest"
193
+ style={{ color: '#a855f7' }}
194
+ >
195
+ QUEUED
196
+ </span>
197
+ </div>
198
+ ) : (
199
+ <div
200
+ className="rounded p-4 flex items-center gap-3 opacity-40"
201
+ style={{
202
+ background: 'rgba(20,10,35,0.4)',
203
+ border: '1px solid rgba(88,28,135,0.2)',
204
+ }}
205
+ >
206
+ <span className="material-symbols-outlined text-[20px] text-purple-500/50">inbox</span>
207
+ <span className="text-sm font-medium tracking-wider text-purple-300/50">
208
+ No payload queued. Awaiting upload.
209
+ </span>
210
+ </div>
211
+ )}
212
+ </div>
213
+ </div>
214
+
215
+ {/* Back */}
216
+ <div className="text-center">
217
+ <button
218
+ onClick={onBack}
219
+ className="text-sm font-medium tracking-wider transition-colors flex items-center gap-2 mx-auto text-purple-400/40 hover:text-purple-300"
220
+ >
221
+ <span className="material-symbols-outlined text-[16px]">arrow_back</span>
222
+ Back to Command Center
223
+ </button>
224
+ </div>
225
+
226
+ </div>
227
+ </section>
228
+ );
229
+ }
frontend-react/src/index.css ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Google Fonts — must be first */
2
+ @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;900&display=swap');
3
+ @import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');
4
+
5
+ @import "tailwindcss";
6
+
7
+ @theme {
8
+ --color-background: #0c150f;
9
+ --color-surface: #0c150f;
10
+ --color-surface-dim: #0c150f;
11
+ --color-surface-container-lowest: #07100a;
12
+ --color-surface-container-low: #141e17;
13
+ --color-surface-container: #18221b;
14
+ --color-surface-container-high: #232c25;
15
+ --color-surface-container-highest: #2d3730;
16
+ --color-surface-variant: #2d3730;
17
+ --color-surface-bright: #323c34;
18
+ --color-on-surface: #dae5da;
19
+ --color-on-surface-variant: #b9cbbc;
20
+ --color-on-background: #dae5da;
21
+ --color-primary: #f3fff3;
22
+ --color-primary-container: #00ff9c;
23
+ --color-on-primary: #00391f;
24
+ --color-on-primary-container: #007142;
25
+ --color-primary-fixed: #56ffa7;
26
+ --color-primary-fixed-dim: #00e38a;
27
+ --color-inverse-primary: #006d40;
28
+ --color-secondary: #bdf4ff;
29
+ --color-secondary-container: #00e3fd;
30
+ --color-on-secondary: #00363d;
31
+ --color-on-secondary-container: #00616d;
32
+ --color-secondary-fixed: #9cf0ff;
33
+ --color-secondary-fixed-dim: #00daf3;
34
+ --color-tertiary: #fffaff;
35
+ --color-tertiary-container: #ffdd65;
36
+ --color-on-tertiary: #3b2f00;
37
+ --color-on-tertiary-container: #766000;
38
+ --color-tertiary-fixed: #ffe17a;
39
+ --color-tertiary-fixed-dim: #e4c44f;
40
+ --color-outline: #849587;
41
+ --color-outline-variant: #3b4b3f;
42
+ --color-error: #ffb4ab;
43
+ --color-error-container: #93000a;
44
+ --color-on-error: #690005;
45
+ --color-on-error-container: #ffdad6;
46
+ --color-inverse-surface: #dae5da;
47
+ --color-inverse-on-surface: #29332b;
48
+ --color-surface-tint: #00e38a;
49
+
50
+ --font-sans: 'Space Grotesk', sans-serif;
51
+ }
52
+
53
+
54
+
55
+ #root {
56
+ min-height: 100vh;
57
+ background-color: #050210;
58
+ }
59
+
60
+ html {
61
+ background-color: #050210;
62
+ }
63
+
64
+ body {
65
+ background: radial-gradient(ellipse at 30% 20%, #1a0a2e 0%, #0a0414 40%, #050210 100%);
66
+ background-attachment: fixed;
67
+ background-color: #050210;
68
+ color: #e2d9f3;
69
+ font-family: 'Space Grotesk', sans-serif;
70
+ min-height: 100vh;
71
+ overflow-x: hidden;
72
+ }
73
+
74
+ /* Material Symbols */
75
+ .material-symbols-outlined {
76
+ font-family: 'Material Symbols Outlined';
77
+ font-weight: normal;
78
+ font-style: normal;
79
+ font-size: 24px;
80
+ line-height: 1;
81
+ letter-spacing: normal;
82
+ text-transform: none;
83
+ display: inline-block;
84
+ white-space: nowrap;
85
+ word-wrap: normal;
86
+ direction: ltr;
87
+ -webkit-font-feature-settings: 'liga';
88
+ font-feature-settings: 'liga';
89
+ -webkit-font-smoothing: antialiased;
90
+ font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
91
+ }
92
+
93
+ /* Scan line animation */
94
+ @keyframes scanMove {
95
+ 0% { top: 0%; }
96
+ 100% { top: 100%; }
97
+ }
98
+
99
+ .scan-line {
100
+ background: linear-gradient(to bottom, transparent 0%, rgba(0, 255, 156, 0.15) 50%, transparent 100%);
101
+ animation: scanMove 4s linear infinite;
102
+ height: 2px;
103
+ width: 100%;
104
+ position: absolute;
105
+ top: 0;
106
+ left: 0;
107
+ pointer-events: none;
108
+ opacity: 0.6;
109
+ }
110
+
111
+ /* Blinking cursor */
112
+ @keyframes blink {
113
+ 0%, 100% { opacity: 1; }
114
+ 50% { opacity: 0; }
115
+ }
116
+ .blinking-cursor::after {
117
+ content: '_';
118
+ animation: blink 1s step-end infinite;
119
+ }
120
+
121
+ /* Shimmer */
122
+ @keyframes shimmer {
123
+ 100% { transform: translateX(200%); }
124
+ }
125
+
126
+ /* Glass panel */
127
+ .glass-panel {
128
+ background: rgba(35, 44, 37, 0.2);
129
+ backdrop-filter: blur(20px);
130
+ border: 1px solid rgba(0, 255, 156, 0.1);
131
+ box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.05);
132
+ }
133
+
134
+ /* Glow borders */
135
+ .glow-border-primary {
136
+ border: 1px solid rgba(0, 255, 156, 0.3) !important;
137
+ box-shadow: 0 0 15px rgba(0, 255, 156, 0.1);
138
+ }
139
+ .glow-border-error {
140
+ border: 1px solid rgba(255, 180, 171, 0.3) !important;
141
+ box-shadow: 0 0 15px rgba(255, 180, 171, 0.1);
142
+ }
143
+
144
+ /* Drag-over state */
145
+ .drag-over {
146
+ border-color: #00ff9c !important;
147
+ background: rgba(0, 255, 156, 0.05) !important;
148
+ box-shadow: 0 0 40px rgba(0, 255, 156, 0.15) inset !important;
149
+ }
150
+
151
+ /* Pipeline step */
152
+ .pipeline-step { transition: opacity 0.4s ease; }
153
+ .pipeline-step.pending { opacity: 0.3; }
154
+ .pipeline-step.active { opacity: 1; }
155
+ .pipeline-step.done { opacity: 0.6; }
156
+
157
+ /* Timeline bar */
158
+ .tl-bar {
159
+ flex: 1;
160
+ min-width: 0;
161
+ display: flex;
162
+ flex-direction: column;
163
+ align-items: stretch;
164
+ position: relative;
165
+ }
166
+ .tl-bar-outer {
167
+ width: 100%;
168
+ height: 100%;
169
+ background: rgba(255,255,255,0.05);
170
+ border-radius: 2px 2px 0 0;
171
+ overflow: hidden;
172
+ position: relative;
173
+ flex: 1;
174
+ }
175
+ .tl-bar-inner {
176
+ width: 100%;
177
+ border-radius: 2px 2px 0 0;
178
+ transition: height 0.8s cubic-bezier(0.22,1,0.36,1);
179
+ }
180
+ .tl-bar:hover .tl-tooltip {
181
+ opacity: 1;
182
+ transform: translateX(-50%) translateY(-4px);
183
+ }
184
+ .tl-tooltip {
185
+ position: absolute;
186
+ bottom: calc(100% + 8px);
187
+ left: 50%;
188
+ transform: translateX(-50%);
189
+ background: #0a0f0a;
190
+ border: 1px solid #00ff9c;
191
+ border-radius: 4px;
192
+ padding: 4px 8px;
193
+ font-size: 11px;
194
+ font-weight: 700;
195
+ white-space: nowrap;
196
+ pointer-events: none;
197
+ opacity: 0;
198
+ transition: opacity 0.2s ease, transform 0.2s ease;
199
+ z-index: 100;
200
+ font-family: 'Space Grotesk', monospace;
201
+ color: #ffffff !important;
202
+ letter-spacing: 0.05em;
203
+ box-shadow: 0 0 10px rgba(0,255,156,0.3);
204
+ }
205
+
206
+ /* Scrollbar */
207
+ ::-webkit-scrollbar { width: 5px; }
208
+ ::-webkit-scrollbar-track { background: #0c150f; }
209
+ ::-webkit-scrollbar-thumb { background: rgba(0,255,156,0.25); border-radius: 4px; }
210
+
211
+ /* Noise bg */
212
+ .noise-bg {
213
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
214
+ opacity: 0.05;
215
+ mix-blend-mode: overlay;
216
+ pointer-events: none;
217
+ }
218
+
219
+ @keyframes spin-slow {
220
+ from { transform: rotate(0deg); }
221
+ to { transform: rotate(360deg); }
222
+ }
223
+ @keyframes spin-slow-reverse {
224
+ from { transform: rotate(0deg); }
225
+ to { transform: rotate(-360deg); }
226
+ }
227
+ .animate-spin-slow { animation: spin-slow 20s linear infinite; }
228
+ .animate-spin-slow-reverse { animation: spin-slow-reverse 15s linear infinite; }
229
+ .animate-spin-fast { animation: spin-slow 3s linear infinite; }
230
+ .animate-spin-medium { animation: spin-slow 8s linear infinite; }
frontend-react/src/main.tsx ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import { BrowserRouter, Routes, Route } from 'react-router-dom'
4
+ import './index.css'
5
+ import App from './App.tsx'
6
+ import PricingPage from './pages/PricingPage.tsx'
7
+
8
+ createRoot(document.getElementById('root')!).render(
9
+ <StrictMode>
10
+ <BrowserRouter>
11
+ <Routes>
12
+ <Route path="/" element={<App />} />
13
+ <Route path="/pricing" element={<PricingPage />} />
14
+ </Routes>
15
+ </BrowserRouter>
16
+ </StrictMode>,
17
+ )
frontend-react/src/pages/PricingPage.tsx ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useNavigate } from 'react-router-dom';
2
+ import { useState } from 'react';
3
+ import RadioNav from '../components/RadioNav';
4
+ import Modal from '../components/Modal';
5
+
6
+ const plans = [
7
+ {
8
+ name: 'Free', price: '$0', interval: '/mo', desc: 'Perfect for trying out',
9
+ features: ['10 video analyses/month', 'Browser extension', 'Max 2-minute videos', 'Community support'],
10
+ cta: 'Get Started Free', popular: false,
11
+ },
12
+ {
13
+ name: 'Pro', price: '$9.99', interval: '/mo', desc: 'For individuals & creators',
14
+ features: ['100 analyses/month', 'Up to 10-minute videos', 'API access (100 calls/mo)', 'Priority processing', 'Email support', 'Batch upload'],
15
+ cta: 'Subscribe to Pro', popular: true,
16
+ },
17
+ {
18
+ name: 'Business', price: '$49', interval: '/mo', desc: 'For teams & organizations',
19
+ features: ['1,000 analyses/month', 'Unlimited video length', 'API access (5K calls/mo)', 'White-label reports', 'Slack/Teams integration', 'Priority support', 'Custom branding'],
20
+ cta: 'Subscribe to Business', popular: false,
21
+ },
22
+ ];
23
+
24
+ const faqs = [
25
+ { q: 'How accurate is Authrix?', a: 'Authrix uses an ensemble of state-of-the-art ViT models achieving 99%+ accuracy on benchmark datasets. We combine visual analysis with audio detection for comprehensive deepfake identification.' },
26
+ { q: 'Can I cancel anytime?', a: 'Yes! All subscriptions are month-to-month with no long-term commitment. Cancel anytime from your account dashboard.' },
27
+ { q: 'What video formats are supported?', a: 'We support MP4, AVI, MOV, MKV, WebM, and WMV formats. Maximum file size is 100MB for Pro tier, unlimited for Business and Enterprise.' },
28
+ { q: 'Is my data secure?', a: 'Absolutely. All videos are analyzed locally and deleted immediately after processing. We never store your content or share it with third parties.' },
29
+ { q: 'Do you offer refunds?', a: "Yes, we offer a 30-day money-back guarantee. If you're not satisfied, contact support for a full refund." },
30
+ ];
31
+
32
+ const AGENTS = [
33
+ { name: 'MetadataAgent', desc: 'Scans C2PA signatures and AI tool metadata in the first 512KB.' },
34
+ { name: 'FrameAnalyzerAgent', desc: 'Extracts up to 40 frames uniformly across the video duration.' },
35
+ { name: 'FaceDetectorAgent', desc: 'Uses MediaPipe to detect and crop facial regions with 20% padding.' },
36
+ { name: 'DecisionAgent (ViT)', desc: 'Ensemble of two ViT models (99.3% + 92.1% accuracy) with early exit.' },
37
+ { name: 'AudioAuthenticator', desc: 'Wav2Vec2-based audio analysis with librosa heuristics for AV mismatch.' },
38
+ { name: 'ReportGeneratorAgent', desc: 'Adaptive threshold + confidence calibration to produce the final verdict.' },
39
+ ];
40
+
41
+ export default function PricingPage() {
42
+ const navigate = useNavigate();
43
+ const [modal, setModal] = useState<string | null>(null);
44
+
45
+ const handleNav = (id: string) => {
46
+ if (id === 'dashboard' || id === 'analyze') navigate('/');
47
+ else if (id === 'agents') setModal('agents');
48
+ else if (id === 'settings') setModal('settings');
49
+ // 'pricing' — already here, do nothing
50
+ };
51
+
52
+ return (
53
+ <div className="min-h-screen" style={{ background: 'radial-gradient(ellipse at 30% 20%, #1a0a2e 0%, #0a0414 40%, #050210 100%)', color: '#e2d9f3', fontFamily: "'Space Grotesk', sans-serif" }}>
54
+
55
+ {/* Grid bg */}
56
+ <div className="fixed inset-0 pointer-events-none opacity-[0.04]"
57
+ style={{ backgroundImage: 'linear-gradient(to right,#6d28d9 1px,transparent 1px),linear-gradient(to bottom,#6d28d9 1px,transparent 1px)', backgroundSize: '48px 48px' }} />
58
+
59
+ <RadioNav active="pricing" onNavigate={handleNav} />
60
+
61
+ <div className="relative z-10 max-w-6xl mx-auto px-6 pt-28 pb-20">
62
+
63
+ {/* Header */}
64
+ <div className="text-center mb-16">
65
+ <div className="inline-flex items-center gap-2 mb-4 px-3 py-1.5 rounded-full"
66
+ style={{ background: 'rgba(88,28,135,0.3)', border: '1px solid rgba(168,85,247,0.25)' }}>
67
+ <span className="w-2 h-2 rounded-full animate-pulse" style={{ background: '#a855f7', boxShadow: '0 0 8px #a855f7' }} />
68
+ <span className="font-bold text-[10px] text-purple-300/80 uppercase tracking-[0.18em]">Transparent Pricing</span>
69
+ </div>
70
+ <h1 className="text-5xl md:text-6xl font-black mb-4"
71
+ style={{ background: 'linear-gradient(135deg, #c084fc 0%, #a855f7 50%, #7c3aed 100%)', WebkitBackgroundClip: 'text', WebkitTextFillColor: 'transparent' }}>
72
+ Choose Your Plan
73
+ </h1>
74
+ <p className="text-lg text-purple-200/50 max-w-xl mx-auto">
75
+ Protect yourself from deepfakes with AI-powered detection. Start free, upgrade anytime.
76
+ </p>
77
+ </div>
78
+
79
+ {/* Pricing cards */}
80
+ <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-16">
81
+ {plans.map(plan => (
82
+ <div key={plan.name} className="relative rounded-2xl p-8 flex flex-col transition-all duration-300 hover:-translate-y-2"
83
+ style={{
84
+ background: plan.popular ? 'rgba(88,28,135,0.25)' : 'rgba(20,10,40,0.5)',
85
+ border: plan.popular ? '1px solid rgba(168,85,247,0.5)' : '1px solid rgba(168,85,247,0.12)',
86
+ boxShadow: plan.popular ? '0 0 40px rgba(124,58,237,0.2)' : 'none',
87
+ backdropFilter: 'blur(20px)',
88
+ }}>
89
+ {plan.popular && (
90
+ <div className="absolute -top-3 right-6 px-4 py-1 rounded-full text-xs font-bold uppercase tracking-wider"
91
+ style={{ background: 'linear-gradient(135deg, #7c3aed, #a855f7)', color: '#fff', boxShadow: '0 4px 12px rgba(124,58,237,0.4)' }}>
92
+ Most Popular
93
+ </div>
94
+ )}
95
+ <div className="mb-6">
96
+ <div className="text-xl font-bold mb-1" style={{ color: '#c084fc' }}>{plan.name}</div>
97
+ <div className="flex items-end gap-1 mb-1">
98
+ <span className="text-5xl font-black text-white">{plan.price}</span>
99
+ <span className="text-lg text-purple-300/40 mb-1">{plan.interval}</span>
100
+ </div>
101
+ <div className="text-sm text-purple-300/40">{plan.desc}</div>
102
+ </div>
103
+ <ul className="flex flex-col gap-3 mb-8 flex-1">
104
+ {plan.features.map(f => (
105
+ <li key={f} className="flex items-center gap-3 text-sm text-purple-200/70">
106
+ <span style={{ color: '#a855f7', fontSize: 18 }}>✓</span>{f}
107
+ </li>
108
+ ))}
109
+ </ul>
110
+ <button onClick={() => alert(`${plan.name} plan selected. Payment integration coming soon.`)}
111
+ className="w-full py-3 rounded-xl font-bold text-sm uppercase tracking-wider transition-all duration-300 active:scale-95"
112
+ style={plan.popular
113
+ ? { background: 'linear-gradient(135deg, #7c3aed, #a855f7)', color: '#fff', boxShadow: '0 8px 24px rgba(124,58,237,0.35)' }
114
+ : { background: 'rgba(124,58,237,0.12)', border: '1px solid rgba(168,85,247,0.3)', color: '#c084fc' }}>
115
+ {plan.cta}
116
+ </button>
117
+ </div>
118
+ ))}
119
+ </div>
120
+
121
+ {/* Enterprise */}
122
+ <div className="rounded-2xl p-12 text-center mb-16"
123
+ style={{ background: 'rgba(88,28,135,0.1)', border: '1px solid rgba(168,85,247,0.2)', backdropFilter: 'blur(20px)' }}>
124
+ <h2 className="text-4xl font-black mb-3" style={{ color: '#c084fc' }}>Enterprise Solutions</h2>
125
+ <p className="text-lg text-purple-200/50 max-w-2xl mx-auto mb-8">
126
+ Custom solutions for large organizations, social media platforms, and government agencies.
127
+ </p>
128
+ <div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-10">
129
+ {[
130
+ { icon: '🏢', title: 'On-Premise Deployment', desc: 'Deploy on your own infrastructure' },
131
+ { icon: '🎯', title: 'Custom Model Training', desc: 'Train on your specific content' },
132
+ { icon: '⚡', title: 'Unlimited Analyses', desc: 'No limits on API calls' },
133
+ { icon: '🛡️', title: 'SLA Guarantees', desc: '99.9% uptime, dedicated support' },
134
+ ].map(({ icon, title, desc }) => (
135
+ <div key={title} className="rounded-xl p-5"
136
+ style={{ background: 'rgba(20,10,40,0.5)', border: '1px solid rgba(168,85,247,0.1)' }}>
137
+ <div className="text-2xl mb-2">{icon}</div>
138
+ <div className="text-sm font-bold mb-1" style={{ color: '#c084fc' }}>{title}</div>
139
+ <div className="text-xs text-purple-300/40">{desc}</div>
140
+ </div>
141
+ ))}
142
+ </div>
143
+ <button onClick={() => alert('Enterprise inquiry! Contact us at support@authrix.ai')}
144
+ className="px-10 py-3 rounded-xl font-bold text-sm uppercase tracking-wider transition-all active:scale-95"
145
+ style={{ background: 'linear-gradient(135deg, #7c3aed, #a855f7)', color: '#fff', boxShadow: '0 8px 24px rgba(124,58,237,0.35)' }}>
146
+ Contact Sales
147
+ </button>
148
+ </div>
149
+
150
+ {/* FAQ */}
151
+ <div className="max-w-3xl mx-auto">
152
+ <h2 className="text-3xl font-black text-center mb-8" style={{ color: '#c084fc' }}>Frequently Asked Questions</h2>
153
+ <div className="flex flex-col gap-4">
154
+ {faqs.map(({ q, a }) => (
155
+ <div key={q} className="rounded-xl p-6"
156
+ style={{ background: 'rgba(20,10,40,0.5)', border: '1px solid rgba(168,85,247,0.1)', backdropFilter: 'blur(20px)' }}>
157
+ <div className="text-base font-bold mb-2" style={{ color: '#c084fc' }}>{q}</div>
158
+ <div className="text-sm leading-relaxed text-purple-200/50">{a}</div>
159
+ </div>
160
+ ))}
161
+ </div>
162
+ </div>
163
+
164
+ {/* Footer */}
165
+ <div className="text-center mt-16 pt-8" style={{ borderTop: '1px solid rgba(168,85,247,0.1)' }}>
166
+ <div className="flex justify-center gap-8 mb-4 flex-wrap">
167
+ {[{ label: 'Home', href: '/' }, { label: 'API Docs', href: 'https://docs.authrix.ai' }, { label: 'Support', href: 'mailto:support@authrix.ai' }]
168
+ .map(({ label, href }) => (
169
+ <a key={label} href={href} className="text-sm transition-colors text-purple-400/40 hover:text-purple-300">{label}</a>
170
+ ))}
171
+ </div>
172
+ <p className="text-sm text-purple-400/25">© 2026 Authrix AI. All rights reserved.</p>
173
+ </div>
174
+
175
+ </div>
176
+
177
+ {/* Agents modal */}
178
+ {modal === 'agents' && (
179
+ <Modal title="Detection Agents" onClose={() => setModal(null)}>
180
+ <div className="flex flex-col gap-4">
181
+ {AGENTS.map((ag, i) => (
182
+ <div key={i} className="flex items-start gap-4 p-4 rounded-lg"
183
+ style={{ background: 'rgba(30,15,50,0.6)', border: '1px solid rgba(124,58,237,0.2)' }}>
184
+ <div className="w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0 text-xs font-bold"
185
+ style={{ background: 'rgba(124,58,237,0.15)', border: '1px solid rgba(168,85,247,0.3)', color: '#a855f7' }}>
186
+ {i}
187
+ </div>
188
+ <div>
189
+ <div className="text-sm font-semibold mb-1" style={{ color: '#c084fc' }}>{ag.name}</div>
190
+ <div className="text-xs text-purple-300/50">{ag.desc}</div>
191
+ </div>
192
+ </div>
193
+ ))}
194
+ </div>
195
+ </Modal>
196
+ )}
197
+
198
+ {/* Settings modal */}
199
+ {modal === 'settings' && (
200
+ <Modal title="Network Status" onClose={() => setModal(null)}>
201
+ <div className="grid grid-cols-2 gap-4">
202
+ {[
203
+ { label: 'API Endpoint', value: 'https://aarav13-authrix.hf.space' },
204
+ { label: 'HF Space', value: 'aarav13-authrix.hf.space' },
205
+ { label: 'Max File Size', value: '100 MB' },
206
+ { label: 'Request Timeout', value: '120s' },
207
+ { label: 'Capture Duration', value: '8s' },
208
+ { label: 'Cache', value: 'SHA256 (1MB)' },
209
+ ].map(({ label, value }) => (
210
+ <div key={label} className="rounded-lg p-4"
211
+ style={{ background: 'rgba(20,10,35,0.6)', border: '1px solid rgba(88,28,135,0.25)' }}>
212
+ <div className="text-[10px] uppercase tracking-widest mb-1 text-purple-500/50">{label}</div>
213
+ <div className="text-sm font-bold font-mono" style={{ color: '#c084fc' }}>{value}</div>
214
+ </div>
215
+ ))}
216
+ </div>
217
+ </Modal>
218
+ )}
219
+
220
+ </div>
221
+ );
222
+ }
frontend-react/src/types.ts ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export interface FrameScore {
2
+ frame: number;
3
+ fake_pct: number;
4
+ }
5
+
6
+ export interface AudioResult {
7
+ available: boolean;
8
+ result: 'HUMAN_VOICE' | 'AI_VOICE' | 'AV_MISMATCH' | 'NO_AUDIO';
9
+ confidence: number;
10
+ fake_probability: number;
11
+ }
12
+
13
+ export interface MetadataCheck {
14
+ ai_generated: boolean;
15
+ c2pa_detected: boolean;
16
+ tool_detected: string | null;
17
+ }
18
+
19
+ export interface VideoMetadata {
20
+ frames_analyzed: number;
21
+ frames_with_faces: number;
22
+ video_duration_sec: number;
23
+ video_fps: number;
24
+ resolution: string;
25
+ }
26
+
27
+ export interface AnalysisResult {
28
+ result: 'FAKE' | 'REAL';
29
+ confidence: number;
30
+ details: string[];
31
+ frame_timeline: FrameScore[];
32
+ metadata: VideoMetadata;
33
+ audio: AudioResult;
34
+ metadata_check: MetadataCheck;
35
+ processing_time_sec: number;
36
+ cached: boolean;
37
+ }
38
+
39
+ export type AppState = 'hero' | 'upload' | 'processing' | 'result' | 'error';
frontend-react/tsconfig.app.json ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023", "DOM"],
6
+ "module": "esnext",
7
+ "types": ["vite/client"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+ "jsx": "react-jsx",
17
+
18
+ /* Linting */
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "erasableSyntaxOnly": true,
22
+ "noFallthroughCasesInSwitch": true
23
+ },
24
+ "include": ["src"]
25
+ }
frontend-react/tsconfig.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "files": [],
3
+ "references": [
4
+ { "path": "./tsconfig.app.json" },
5
+ { "path": "./tsconfig.node.json" }
6
+ ]
7
+ }
frontend-react/tsconfig.node.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "es2023",
5
+ "lib": ["ES2023"],
6
+ "module": "esnext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "noUnusedLocals": true,
19
+ "noUnusedParameters": true,
20
+ "erasableSyntaxOnly": true,
21
+ "noFallthroughCasesInSwitch": true
22
+ },
23
+ "include": ["vite.config.ts"]
24
+ }
frontend-react/vite.config.ts ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig } from 'vite'
2
+ import react from '@vitejs/plugin-react'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+
5
+ export default defineConfig({
6
+ plugins: [react(), tailwindcss()],
7
+ server: {
8
+ proxy: {
9
+ '/analyze': 'http://localhost:8000',
10
+ '/analyze-url': 'http://localhost:8000',
11
+ '/health': 'http://localhost:8000',
12
+ },
13
+ },
14
+ build: {
15
+ chunkSizeWarningLimit: 2000,
16
+ rollupOptions: {
17
+ output: {
18
+ manualChunks(id) {
19
+ if (id.includes('node_modules/three')) return 'three';
20
+ if (id.includes('node_modules/postprocessing')) return 'postprocessing';
21
+ if (id.includes('node_modules/face-api')) return 'faceapi';
22
+ },
23
+ },
24
+ },
25
+ },
26
+ })
frontend-vanilla/index.html DELETED
@@ -1,1511 +0,0 @@
1
- <!DOCTYPE html>
2
- <html class="dark" lang="en">
3
- <head>
4
- <meta charset="utf-8"/>
5
- <meta content="width=device-width, initial-scale=1.0" name="viewport"/>
6
- <title>AUTHRIX AI - Deepfake Detection Engine</title>
7
-
8
- <!-- Google Fonts -->
9
- <link href="https://fonts.googleapis.com" rel="preconnect"/>
10
- <link crossorigin="" href="https://fonts.gstatic.com" rel="preconnect"/>
11
- <link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700;900&display=swap" rel="stylesheet"/>
12
- <!-- Material Symbols -->
13
- <link href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap" rel="stylesheet"/>
14
- <!-- Tailwind CSS -->
15
- <script src="https://cdn.tailwindcss.com?plugins=forms,container-queries"></script>
16
- <script>
17
- tailwind.config = {
18
- darkMode: "class",
19
- theme: {
20
- extend: {
21
- colors: {
22
- "inverse-surface": "#dae5da",
23
- "on-error": "#690005",
24
- "surface-tint": "#00e38a",
25
- "error": "#ffb4ab",
26
- "outline-variant": "#3b4b3f",
27
- "outline": "#849587",
28
- "background": "#0c150f",
29
- "surface-container-high": "#232c25",
30
- "secondary-container": "#00e3fd",
31
- "on-surface-variant": "#b9cbbc",
32
- "on-secondary-container": "#00616d",
33
- "on-error-container": "#ffdad6",
34
- "primary": "#f3fff3",
35
- "primary-container": "#00ff9c",
36
- "on-primary": "#00391f",
37
- "surface-bright": "#323c34",
38
- "primary-fixed-dim": "#00e38a",
39
- "tertiary-fixed-dim": "#e4c44f",
40
- "on-secondary-fixed": "#001f24",
41
- "tertiary-fixed": "#ffe17a",
42
- "on-tertiary-container": "#766000",
43
- "on-secondary": "#00363d",
44
- "on-tertiary-fixed": "#231b00",
45
- "on-tertiary": "#3b2f00",
46
- "surface-container-low": "#141e17",
47
- "surface": "#0c150f",
48
- "primary-fixed": "#56ffa7",
49
- "secondary-fixed-dim": "#00daf3",
50
- "on-secondary-fixed-variant": "#004f58",
51
- "inverse-on-surface": "#29332b",
52
- "surface-container": "#18221b",
53
- "on-surface": "#dae5da",
54
- "on-tertiary-fixed-variant": "#554500",
55
- "error-container": "#93000a",
56
- "surface-variant": "#2d3730",
57
- "surface-container-highest": "#2d3730",
58
- "secondary-fixed": "#9cf0ff",
59
- "on-background": "#dae5da",
60
- "on-primary-container": "#007142",
61
- "inverse-primary": "#006d40",
62
- "on-primary-fixed-variant": "#00522f",
63
- "secondary": "#bdf4ff",
64
- "tertiary": "#fffaff",
65
- "surface-dim": "#0c150f",
66
- "on-primary-fixed": "#002110",
67
- "surface-container-lowest": "#07100a",
68
- "tertiary-container": "#ffdd65"
69
- },
70
- borderRadius: {
71
- "DEFAULT": "0.25rem",
72
- "lg": "0.5rem",
73
- "xl": "0.75rem",
74
- "full": "9999px"
75
- },
76
- spacing: {
77
- "xs": "4px",
78
- "md": "16px",
79
- "base": "4px",
80
- "sm": "8px",
81
- "xl": "48px",
82
- "lg": "24px",
83
- "gutter": "20px",
84
- "margin": "32px"
85
- },
86
- fontFamily: {
87
- "h2": ["Space Grotesk"],
88
- "h1": ["Space Grotesk"],
89
- "h3": ["Space Grotesk"],
90
- "label-xs": ["Space Grotesk"],
91
- "data-mono": ["Space Grotesk"],
92
- "body-base": ["Space Grotesk"]
93
- },
94
- fontSize: {
95
- "h2": ["32px", { lineHeight: "1.2", letterSpacing: "-0.01em", fontWeight: "600" }],
96
- "h1": ["48px", { lineHeight: "1.1", letterSpacing: "-0.02em", fontWeight: "700" }],
97
- "h3": ["24px", { lineHeight: "1.3", letterSpacing: "0em", fontWeight: "600" }],
98
- "label-xs": ["12px", { lineHeight: "1", letterSpacing: "0.1em", fontWeight: "700" }],
99
- "data-mono": ["14px", { lineHeight: "1.5", letterSpacing: "0.05em", fontWeight: "500" }],
100
- "body-base": ["16px", { lineHeight: "1.6", letterSpacing: "0.01em", fontWeight: "400" }]
101
- }
102
- }
103
- }
104
- };
105
- </script>
106
-
107
- <style>
108
- /* ── Material Symbols ── */
109
- .material-symbols-outlined {
110
- font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
111
- }
112
-
113
- /* ── Scan line animation ── */
114
- .scan-line {
115
- background: linear-gradient(to bottom, transparent 0%, rgba(0, 255, 156, 0.15) 50%, transparent 100%);
116
- animation: scanMove 4s linear infinite;
117
- height: 2px;
118
- width: 100%;
119
- position: absolute;
120
- top: 0;
121
- left: 0;
122
- pointer-events: none;
123
- opacity: 0.6;
124
- }
125
- @keyframes scanMove {
126
- 0% { top: 0%; }
127
- 100% { top: 100%; }
128
- }
129
-
130
- /* ── Scanline overlay (results banner) ── */
131
- .scanline {
132
- position: absolute;
133
- top: 0; left: 0;
134
- width: 100%; height: 1px;
135
- background: rgba(0, 255, 156, 0.12);
136
- animation: scanMove 4s linear infinite;
137
- }
138
-
139
- /* ── Noise background ── */
140
- .noise-bg {
141
- background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
142
- opacity: 0.05;
143
- mix-blend-mode: overlay;
144
- pointer-events: none;
145
- }
146
-
147
- /* ── Glass panel ── */
148
- .glass-panel {
149
- background: rgba(35, 44, 37, 0.2);
150
- backdrop-filter: blur(20px);
151
- border: 1px solid rgba(0, 255, 156, 0.1);
152
- box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.05);
153
- }
154
-
155
- /* ── Glow borders ── */
156
- .glow-border-primary {
157
- border: 1px solid rgba(0, 255, 156, 0.3) !important;
158
- box-shadow: 0 0 15px rgba(0, 255, 156, 0.1);
159
- }
160
- .glow-border-error {
161
- border: 1px solid rgba(255, 180, 171, 0.3) !important;
162
- box-shadow: 0 0 15px rgba(255, 180, 171, 0.1);
163
- }
164
- .glow-border-active {
165
- border: 1px solid rgba(0, 255, 156, 0.5);
166
- box-shadow: 0 0 15px rgba(0, 255, 156, 0.2);
167
- }
168
-
169
- /* ── Blinking cursor ── */
170
- .blinking-cursor::after {
171
- content: '_';
172
- animation: blink 1s step-end infinite;
173
- }
174
- @keyframes blink {
175
- 0%, 100% { opacity: 1; }
176
- 50% { opacity: 0; }
177
- }
178
-
179
- /* ── Shimmer on hero CTA ── */
180
- @keyframes shimmer {
181
- 100% { transform: translateX(200%); }
182
- }
183
-
184
- /* ── Drag-over state ── */
185
- #dropZoneInner.drag-over {
186
- border-color: #00ff9c !important;
187
- background: rgba(0, 255, 156, 0.05) !important;
188
- box-shadow: 0 0 40px rgba(0, 255, 156, 0.15) inset !important;
189
- }
190
-
191
- /* ── Pipeline step active ── */
192
- .pipeline-step { transition: opacity 0.4s ease; }
193
- .pipeline-step.pending { opacity: 0.3; }
194
- .pipeline-step.active { opacity: 1; }
195
- .pipeline-step.done { opacity: 0.6; }
196
-
197
- /* ── Timeline bar ── */
198
- .tl-bar {
199
- flex: 1;
200
- min-width: 0;
201
- display: flex;
202
- flex-direction: column;
203
- align-items: stretch;
204
- position: relative;
205
- }
206
- .tl-bar-outer {
207
- width: 100%;
208
- height: 100%;
209
- background: rgba(255,255,255,0.05);
210
- border-radius: 2px 2px 0 0;
211
- overflow: hidden;
212
- position: relative;
213
- flex: 1;
214
- }
215
- .tl-bar-inner {
216
- width: 100%;
217
- border-radius: 2px 2px 0 0;
218
- transition: height 0.8s cubic-bezier(0.22,1,0.36,1);
219
- }
220
- .tl-bar:hover .tl-tooltip {
221
- opacity: 1;
222
- transform: translateX(-50%) translateY(-4px);
223
- }
224
- .tl-tooltip {
225
- position: absolute;
226
- bottom: calc(100% + 8px);
227
- left: 50%;
228
- transform: translateX(-50%);
229
- background: #0a0f0a;
230
- border: 1px solid #00ff9c;
231
- border-radius: 4px;
232
- padding: 4px 8px;
233
- font-size: 11px;
234
- font-weight: 700;
235
- white-space: nowrap;
236
- pointer-events: none;
237
- opacity: 0;
238
- transition: opacity 0.2s ease, transform 0.2s ease;
239
- z-index: 100;
240
- font-family: 'Space Grotesk', monospace;
241
- color: #ffffff !important;
242
- letter-spacing: 0.05em;
243
- box-shadow: 0 0 10px rgba(0,255,156,0.3);
244
- }
245
-
246
- /* ── Scrollbar ── */
247
- ::-webkit-scrollbar { width: 5px; }
248
- ::-webkit-scrollbar-track { background: #0c150f; }
249
- ::-webkit-scrollbar-thumb { background: rgba(0,255,156,0.25); border-radius: 4px; }
250
- </style>
251
- </head>
252
-
253
- <body class="bg-background text-on-surface min-h-screen flex flex-col relative overflow-x-hidden font-body-base">
254
-
255
- <!-- ═══════════════════════════════════════════════════════════
256
- FIXED ATMOSPHERIC BACKGROUND (all states)
257
- ════════════════════════════════════════════════════════════ -->
258
- <div class="fixed inset-0 z-0 pointer-events-none">
259
- <!-- Scan lines -->
260
- <div class="absolute inset-0 bg-[linear-gradient(rgba(0,0,0,0)_50%,rgba(0,0,0,0.25)_50%),linear-gradient(90deg,rgba(255,0,0,0.06),rgba(0,255,0,0.02),rgba(0,0,255,0.06))] bg-[size:100%_4px,3px_100%] opacity-20"></div>
261
- <!-- Technical grid -->
262
- <div class="absolute inset-0 bg-[linear-gradient(to_right,#3b4b3f_1px,transparent_1px),linear-gradient(to_bottom,#3b4b3f_1px,transparent_1px)] bg-[size:48px_48px] opacity-10"></div>
263
- <!-- Ambient glow -->
264
- <div class="absolute top-1/4 -right-1/4 w-[800px] h-[800px] bg-primary-container/5 rounded-full blur-[120px]"></div>
265
- <div class="absolute bottom-[-20%] left-[-10%] w-[50%] h-[50%] bg-primary-container/3 rounded-full blur-[120px]"></div>
266
- <!-- Noise -->
267
- <div class="absolute inset-0 noise-bg"></div>
268
- </div>
269
-
270
- <!-- ═══════════════════════════════════════════════════════════
271
- FIXED NAV (visible across all states)
272
- ════════════════════════════════════════════════════════════ -->
273
- <nav class="fixed top-0 left-0 w-full z-50 flex justify-between items-center px-6 h-16 bg-emerald-950/20 backdrop-blur-xl border-b border-emerald-500/20 shadow-[0_4px_20px_rgba(0,0,0,0.5)] font-['Space_Grotesk'] tracking-wider uppercase text-xs">
274
- <!-- Brand -->
275
- <div class="flex items-center gap-8">
276
- <span onclick="showState('heroSection')" class="text-2xl font-black tracking-tighter text-emerald-400 drop-shadow-[0_0_8px_rgba(0,255,156,0.5)] cursor-pointer">AUTHRIX AI</span>
277
- <div class="hidden md:flex items-center gap-6">
278
- <a onclick="showState('heroSection')" class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 py-1 px-2 rounded-sm cursor-pointer">Dashboard</a>
279
- <a href="/pricing" class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 py-1 px-2 rounded-sm cursor-pointer">Pricing</a>
280
- <a onclick="openModal('agentsModal')" class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 py-1 px-2 rounded-sm cursor-pointer">Agents</a>
281
- <a onclick="openModal('logsModal')" class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 py-1 px-2 rounded-sm cursor-pointer">Logs</a>
282
- <a onclick="openModal('networkModal')" class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 py-1 px-2 rounded-sm cursor-pointer">Network</a>
283
- </div>
284
- </div>
285
- <!-- Actions -->
286
- <div class="flex items-center gap-4">
287
- <!-- Health badge -->
288
- <div id="healthBadge" class="hidden items-center gap-2 bg-surface-container/40 border border-outline/30 px-3 py-1 rounded-sm">
289
- <span id="healthDot" class="w-2 h-2 rounded-full bg-outline"></span>
290
- <span id="healthText" class="font-label-xs text-label-xs text-on-surface-variant">CHECKING</span>
291
- </div>
292
- <div class="hidden lg:flex items-center gap-2 border-r border-emerald-500/20 pr-4 mr-2">
293
- <button class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 p-1 rounded-sm"><span class="material-symbols-outlined text-lg">sensors</span></button>
294
- <button class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 p-1 rounded-sm"><span class="material-symbols-outlined text-lg">memory</span></button>
295
- <button class="text-emerald-800/60 hover:text-emerald-400 transition-colors hover:bg-emerald-400/10 p-1 rounded-sm"><span class="material-symbols-outlined text-lg">speed</span></button>
296
- </div>
297
- <button onclick="showState('uploadSection')" class="text-emerald-400 border border-emerald-400/50 hover:bg-emerald-400/10 hover:shadow-[0_0_15px_rgba(0,255,156,0.3)] px-3 py-1 rounded-DEFAULT font-bold transition-all active:scale-95">
298
- GET STARTED
299
- </button>
300
- </div>
301
- </nav>
302
-
303
- <!-- ═══════════════════════════════════════════════════════════
304
- STATE 1: HERO SECTION
305
- ════════════════════════════════════════════════════════════ -->
306
- <section id="heroSection" class="relative z-10 flex flex-col justify-center pt-[100px] pb-xl px-6 md:px-gutter max-w-7xl mx-auto w-full min-h-screen">
307
- <div class="grid grid-cols-1 lg:grid-cols-2 gap-xl items-center min-h-[716px]">
308
-
309
- <!-- Left: Content -->
310
- <div class="flex flex-col items-start space-y-md">
311
- <!-- Status badge -->
312
- <div class="inline-flex items-center gap-2 bg-surface-container/40 border border-outline/30 backdrop-blur-md px-sm py-xs rounded-none shadow-[inset_0_1px_0_rgba(255,255,255,0.05)]">
313
- <span class="w-2 h-2 rounded-full bg-primary-container shadow-[0_0_8px_#00ff9c] animate-pulse"></span>
314
- <span class="font-label-xs text-label-xs text-on-surface-variant uppercase tracking-widest">AI-Powered Authenticity Engine</span>
315
- </div>
316
-
317
- <!-- Headline -->
318
- <h1 class="font-h1 text-h1 text-on-surface drop-shadow-md">
319
- Verify Reality <br class="hidden md:block"/>
320
- in <span class="text-transparent bg-clip-text bg-gradient-to-r from-primary-container to-secondary-container">Real-Time</span>
321
- </h1>
322
-
323
- <!-- Subtext -->
324
- <p class="font-body-base text-body-base text-on-surface-variant max-w-lg mt-sm mb-lg">
325
- Deploy advanced neural networks to detect deepfakes, synthetic media, and manipulated data streams with military-grade precision. Establish an unbreakable perimeter of truth.
326
- </p>
327
-
328
- <!-- CTAs -->
329
- <div class="flex flex-wrap items-center gap-md mt-sm">
330
- <button onclick="showState('uploadSection')" class="group relative px-lg py-sm bg-primary-container text-on-primary font-label-xs text-label-xs uppercase tracking-wider rounded-DEFAULT overflow-hidden transition-all duration-300 hover:shadow-[0_0_30px_rgba(0,255,156,0.4)] active:scale-95">
331
- <span class="relative z-10 flex items-center gap-2">
332
- Analyze Video
333
- <span class="material-symbols-outlined text-[16px]">radar</span>
334
- </span>
335
- <div class="absolute inset-0 -translate-x-full bg-gradient-to-r from-transparent via-white/40 to-transparent group-hover:[animation:shimmer_1s_infinite]"></div>
336
- </button>
337
- <button class="px-lg py-sm bg-transparent border border-surface-tint/50 text-surface-tint font-label-xs text-label-xs uppercase tracking-wider rounded-DEFAULT hover:bg-surface-tint/10 hover:border-surface-tint transition-all duration-300 active:scale-95">
338
- View Demo
339
- </button>
340
- </div>
341
-
342
- <!-- Stats -->
343
- <div class="flex items-center gap-lg mt-xl pt-lg border-t border-outline/20 w-full max-w-md">
344
- <div>
345
- <div class="font-data-mono text-data-mono text-primary-container">99.9%</div>
346
- <div class="font-label-xs text-[10px] text-outline mt-1 uppercase">Accuracy Rate</div>
347
- </div>
348
- <div class="w-px h-8 bg-outline/30"></div>
349
- <div>
350
- <div class="font-data-mono text-data-mono text-secondary-container">&lt;15ms</div>
351
- <div class="font-label-xs text-[10px] text-outline mt-1 uppercase">Latency Ping</div>
352
- </div>
353
- </div>
354
- </div>
355
-
356
- <!-- Right: Orb visualizer -->
357
- <div class="relative w-full aspect-square max-w-lg mx-auto flex items-center justify-center lg:justify-end">
358
- <div class="absolute inset-0 bg-surface-container-low/20 backdrop-blur-3xl rounded-full border border-outline/10 shadow-[inset_0_0_40px_rgba(0,0,0,0.8)] flex items-center justify-center overflow-hidden">
359
- <!-- Spinning rings -->
360
- <div class="absolute w-[120%] h-[120%] border border-primary-container/10 rounded-full animate-[spin_20s_linear_infinite]"></div>
361
- <div class="absolute w-[100%] h-[100%] border border-secondary-container/20 rounded-full border-dashed animate-[spin_15s_linear_infinite_reverse]"></div>
362
- <div class="absolute w-[80%] h-[80%] border-2 border-primary-container/5 rounded-full"></div>
363
- <!-- Core orb -->
364
- <div class="relative w-3/4 h-3/4 rounded-full overflow-hidden mix-blend-screen shadow-[0_0_60px_rgba(0,255,156,0.2)] bg-gradient-to-br from-primary-container/20 via-secondary-container/10 to-transparent flex items-center justify-center">
365
- <span class="material-symbols-outlined text-primary-container" style="font-size:120px;opacity:0.4;font-variation-settings:'FILL' 1;">radar</span>
366
- <div class="absolute inset-0 bg-gradient-to-t from-background via-transparent to-transparent"></div>
367
- </div>
368
- </div>
369
- <!-- Floating HUD -->
370
- <div class="absolute top-10 -left-4 bg-surface/80 backdrop-blur-md border border-outline/30 px-sm py-1 font-data-mono text-[10px] text-primary-container">SYS.OPT.OK</div>
371
- <div class="absolute bottom-20 -right-4 bg-surface/80 backdrop-blur-md border border-outline/30 px-sm py-1 font-data-mono text-[10px] text-secondary-container flex items-center gap-1">
372
- <span class="material-symbols-outlined text-[12px]">sync</span> LIVE
373
- </div>
374
- </div>
375
- </div>
376
- </section>
377
-
378
- <!-- ═══════════════════════════════════════════════════════════
379
- STATE 2: UPLOAD SECTION
380
- ════════════════════════════════════════════════════════════ -->
381
- <section id="uploadSection" style="display:none;" class="relative z-10 flex flex-col items-center justify-center pt-28 pb-24 px-6 min-h-screen">
382
- <div class="w-full max-w-3xl flex flex-col gap-8">
383
-
384
- <!-- Header -->
385
- <div class="text-center space-y-2">
386
- <h1 class="font-h2 text-h2 text-primary-container drop-shadow-[0_0_12px_rgba(0,255,156,0.4)]">SECURE INGEST PORTAL</h1>
387
- <p class="font-data-mono text-data-mono text-on-surface-variant">Awaiting encrypted payload via protocol AX-9.</p>
388
- </div>
389
-
390
- <!-- Drop zone -->
391
- <div class="relative bg-surface-container/40 backdrop-blur-2xl border border-outline/20 rounded-xl overflow-hidden group hover:border-primary-container/50 transition-colors duration-500 shadow-[inset_0_1px_1px_rgba(255,255,255,0.05),0_0_30px_rgba(0,0,0,0.5)]">
392
- <div class="scan-line"></div>
393
- <div id="dropZoneInner"
394
- onclick="document.getElementById('fileInput').click()"
395
- class="p-10 flex flex-col items-center justify-center border-2 border-dashed border-outline-variant/50 m-4 rounded-lg bg-surface-container-low/30 hover:bg-primary-container/5 hover:border-primary-container hover:shadow-[0_0_40px_rgba(0,255,156,0.1)_inset] transition-all duration-300 cursor-pointer min-h-[300px]">
396
-
397
- <!-- Upload prompt (default) -->
398
- <div id="uploadPrompt">
399
- <div class="w-24 h-24 rounded-full bg-surface-variant flex items-center justify-center mb-6 shadow-[inset_0_2px_4px_rgba(0,0,0,0.4)] group-hover:bg-surface-container-highest transition-colors mx-auto">
400
- <span class="material-symbols-outlined text-[48px] text-on-surface-variant group-hover:text-primary-container group-hover:drop-shadow-[0_0_12px_rgba(0,255,156,0.8)] transition-all duration-300" style="font-variation-settings:'FILL' 1;">cloud_upload</span>
401
- </div>
402
- <h3 class="font-h3 text-h3 text-on-surface mb-2 text-center">INITIALIZE UPLOAD</h3>
403
- <p class="font-body-base text-body-base text-on-surface-variant mb-6 text-center max-w-sm">Drag and drop your video file here, or click to browse.</p>
404
- <div class="flex items-center gap-2 font-label-xs text-label-xs text-outline tracking-widest justify-center">
405
- <span class="w-1.5 h-1.5 rounded-full bg-outline"></span>
406
- ACCEPTED: MP4 · AVI · MOV · MKV · WebM
407
- <span class="w-1.5 h-1.5 rounded-full bg-outline"></span>
408
- </div>
409
- </div>
410
-
411
- <!-- File chosen state (hidden until file selected) -->
412
- <div id="fileChosen" style="display:none;" class="w-full flex items-center gap-5">
413
- <div class="w-14 h-14 rounded-lg bg-primary-container/10 border border-primary-container/30 flex items-center justify-center flex-shrink-0 shadow-[0_0_20px_rgba(0,255,156,0.15)]">
414
- <span class="material-symbols-outlined text-primary-container text-[28px]" style="font-variation-settings:'FILL' 1;">video_file</span>
415
- </div>
416
- <div class="flex-1 min-w-0">
417
- <p id="chosenName" class="font-data-mono text-data-mono text-on-surface overflow-hidden text-ellipsis whitespace-nowrap"></p>
418
- <p id="chosenSize" class="font-label-xs text-label-xs text-on-surface-variant mt-1"></p>
419
- </div>
420
- <button id="clearFileBtn" onclick="clearFile(event)" class="p-2 text-on-surface-variant hover:text-error hover:bg-error/10 rounded-sm transition-all">
421
- <span class="material-symbols-outlined text-[20px]">close</span>
422
- </button>
423
- </div>
424
- </div>
425
- </div>
426
-
427
- <!-- Hidden file input -->
428
- <input type="file" id="fileInput" accept="video/*" style="display:none;"/>
429
-
430
- <!-- Analyze button -->
431
- <button id="analyzeBtn" disabled onclick="analyzeVideo()"
432
- class="w-full py-4 font-label-xs text-label-xs uppercase tracking-wider rounded-DEFAULT transition-all duration-300 border border-outline/30 bg-surface-container/40 text-outline cursor-not-allowed"
433
- style="pointer-events:none;">
434
- <span class="flex items-center justify-center gap-2">
435
- <span class="material-symbols-outlined text-[16px]">play_arrow</span>
436
- INITIATE ANALYSIS
437
- </span>
438
- </button>
439
-
440
- <!-- Active queue -->
441
- <div class="flex flex-col gap-4">
442
- <div class="flex items-center justify-between border-b border-outline/20 pb-2">
443
- <h4 class="font-label-xs text-label-xs text-primary-container uppercase tracking-widest flex items-center gap-2">
444
- <span class="w-2 h-2 bg-primary-container shadow-[0_0_8px_rgba(0,255,156,0.8)]"></span>
445
- ACTIVE QUEUE
446
- </h4>
447
- <span id="queueTime" class="font-data-mono text-[10px] text-on-surface-variant">SYS_TIME: --:--:--</span>
448
- </div>
449
- <div id="queueList" class="grid grid-cols-1 gap-2">
450
- <div class="bg-surface-container-low border border-outline-variant/30 rounded-DEFAULT p-4 flex items-center gap-3 opacity-40">
451
- <span class="material-symbols-outlined text-outline text-[20px]">inbox</span>
452
- <span class="font-data-mono text-data-mono text-on-surface-variant">No payload queued. Awaiting upload.</span>
453
- </div>
454
- </div>
455
- </div>
456
-
457
- <!-- Back to hero -->
458
- <div class="text-center">
459
- <button onclick="showState('heroSection')" class="font-data-mono text-data-mono text-on-surface-variant hover:text-primary-container transition-colors flex items-center gap-2 mx-auto">
460
- <span class="material-symbols-outlined text-[16px]">arrow_back</span>
461
- Back to Command Center
462
- </button>
463
- </div>
464
- </div>
465
- </section>
466
-
467
- <!-- ═══════════════════════════════════════════════════════════
468
- STATE 3: PROCESSING SECTION
469
- ════════════════════════════════════════════════════════════ -->
470
- <section id="processingSection" style="display:none;" class="relative z-10 flex flex-col items-center justify-center px-6 min-h-screen">
471
- <div class="absolute inset-0 noise-bg z-0"></div>
472
- <div class="scan-line" style="top:30%"></div>
473
-
474
- <div class="relative z-10 container mx-auto px-6 flex flex-col items-center justify-center w-full max-w-4xl pt-24 pb-16">
475
-
476
- <!-- Header -->
477
- <div class="w-full max-w-3xl mb-xl text-center">
478
- <h1 class="font-h1 text-h1 text-primary-container drop-shadow-[0_0_8px_rgba(0,255,156,0.3)] mb-sm">SYSTEM_STATE: ANALYSIS</h1>
479
- <p class="font-data-mono text-data-mono text-primary-fixed-dim/70 tracking-[0.2em] uppercase">Initiating Deep Inspection Protocol</p>
480
- </div>
481
-
482
- <!-- Bento grid -->
483
- <div class="w-full grid grid-cols-1 md:grid-cols-12 gap-gutter">
484
-
485
- <!-- Left: Orb visual -->
486
- <div class="md:col-span-5 glass-panel rounded-xl p-lg flex flex-col items-center justify-center relative min-h-[300px] border-outline/20">
487
- <div class="absolute top-sm left-sm font-label-xs text-label-xs text-outline tracking-widest uppercase">Target Vector</div>
488
- <div class="relative w-48 h-48 rounded-full border border-primary-container/30 shadow-[0_0_30px_rgba(0,255,156,0.1)] flex items-center justify-center">
489
- <div class="absolute inset-2 rounded-full border border-dashed border-primary-container/40 animate-[spin_8s_linear_infinite]"></div>
490
- <div class="absolute inset-6 rounded-full bg-surface-container-high shadow-inner flex items-center justify-center overflow-hidden bg-gradient-to-br from-primary-container/10 to-secondary-container/5">
491
- <span class="material-symbols-outlined text-secondary-container text-[48px] opacity-50" style="font-variation-settings:'FILL' 1;">analytics</span>
492
- </div>
493
- <div class="absolute inset-0 rounded-full border-t-2 border-primary-container/80 blur-[2px] animate-[spin_3s_linear_infinite]"></div>
494
- <span class="material-symbols-outlined absolute text-primary-container text-4xl drop-shadow-[0_0_10px_rgba(0,255,156,0.8)]">troubleshoot</span>
495
- </div>
496
- <div class="mt-lg text-center w-full">
497
- <div class="font-data-mono text-data-mono text-on-surface-variant flex items-center justify-between w-full border-b border-outline/10 pb-xs mb-xs">
498
- <span>DATA_STREAM</span>
499
- <span class="text-secondary-fixed">ACTIVE</span>
500
- </div>
501
- <div class="font-data-mono text-data-mono text-on-surface-variant flex items-center justify-between w-full border-b border-outline/10 pb-xs">
502
- <span>THROUGHPUT</span>
503
- <span class="text-tertiary-container" id="throughputVal">2.4 TB/s</span>
504
- </div>
505
- </div>
506
- </div>
507
-
508
- <!-- Right: Pipeline steps -->
509
- <div class="md:col-span-7 glass-panel rounded-xl p-lg flex flex-col justify-center gap-md border-outline/20">
510
- <div class="flex justify-between items-center mb-sm">
511
- <div class="font-label-xs text-label-xs text-outline tracking-widest uppercase">Processing Pipeline</div>
512
- <div id="pipelinePercent" class="font-data-mono text-data-mono text-primary-container bg-primary-container/10 px-2 py-1 rounded">0% COMPLETE</div>
513
- </div>
514
-
515
- <!-- Step 0: Extract frames -->
516
- <div id="step0" class="pipeline-step pending flex flex-col gap-xs">
517
- <div class="flex justify-between items-center">
518
- <div class="flex items-center gap-sm">
519
- <span id="step0icon" class="material-symbols-outlined text-outline text-sm">hourglass_empty</span>
520
- <span class="font-data-mono text-data-mono text-on-surface">Extracting frames...</span>
521
- </div>
522
- <span id="step0pct" class="font-data-mono text-data-mono text-outline">0%</span>
523
- </div>
524
- <div class="w-full h-2 bg-surface-container-highest flex gap-[2px]" id="step0bar">
525
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
526
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
527
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
528
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
529
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
530
- </div>
531
- </div>
532
-
533
- <!-- Step 1: Detect faces -->
534
- <div id="step1" class="pipeline-step pending flex flex-col gap-xs">
535
- <div class="flex justify-between items-center">
536
- <div class="flex items-center gap-sm">
537
- <span id="step1icon" class="material-symbols-outlined text-outline text-sm">hourglass_empty</span>
538
- <span class="font-data-mono text-data-mono text-on-surface">Detecting faces...</span>
539
- </div>
540
- <span id="step1pct" class="font-data-mono text-data-mono text-outline">0%</span>
541
- </div>
542
- <div class="w-full h-2 bg-surface-container-highest flex gap-[2px]" id="step1bar">
543
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
544
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
545
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
546
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
547
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
548
- </div>
549
- </div>
550
-
551
- <!-- Step 2: Model inference -->
552
- <div id="step2" class="pipeline-step pending flex flex-col gap-xs">
553
- <div class="flex justify-between items-center">
554
- <div class="flex items-center gap-sm">
555
- <span id="step2icon" class="material-symbols-outlined text-outline text-sm">hourglass_empty</span>
556
- <span class="font-data-mono text-data-mono text-on-surface">Running model inference...</span>
557
- </div>
558
- <span id="step2pct" class="font-data-mono text-data-mono text-outline">0%</span>
559
- </div>
560
- <div class="w-full h-2 bg-surface-container-highest flex gap-[2px]" id="step2bar">
561
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
562
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
563
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
564
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
565
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
566
- </div>
567
- </div>
568
-
569
- <!-- Step 3: Audio patterns -->
570
- <div id="step3" class="pipeline-step pending flex flex-col gap-xs mt-sm">
571
- <div class="flex justify-between items-center">
572
- <div class="flex items-center gap-sm">
573
- <span id="step3icon" class="material-symbols-outlined text-outline text-sm">hourglass_empty</span>
574
- <span class="font-data-mono text-data-mono text-on-surface">Analyzing audio patterns...</span>
575
- </div>
576
- <span id="step3pct" class="font-data-mono text-data-mono text-outline">0%</span>
577
- </div>
578
- <div class="w-full h-2 bg-surface-container-highest flex gap-[2px]" id="step3bar">
579
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
580
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
581
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
582
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
583
- <div class="h-full bg-primary-container/20 flex-1"></div><div class="h-full bg-primary-container/20 flex-1"></div>
584
- </div>
585
- </div>
586
-
587
- <!-- CLI feedback -->
588
- <div class="mt-auto bg-surface-container-highest/50 border border-outline/10 p-sm rounded font-data-mono text-data-mono text-xs text-primary-fixed-dim/60 shadow-inner min-h-[60px]" id="cliFeedback">
589
- &gt; [SYS] Initializing analysis pipeline...<br/>
590
- &gt; [SYS] Loading neural weights... <span class="text-primary-container animate-pulse">_</span>
591
- </div>
592
- </div>
593
- </div>
594
- </div>
595
- </section>
596
-
597
- <!-- ═══════════════════════════════════════════════════════════
598
- STATE 4: RESULTS SECTION
599
- ════════════════════════════════════════════════════════════ -->
600
- <section id="resultsSection" style="display:none;" class="relative z-10 pt-24 pb-xl px-gutter max-w-[1400px] mx-auto w-full flex flex-col gap-lg">
601
-
602
- <!-- Cinematic banner -->
603
- <div id="resultBanner" class="glass-panel glow-border-primary rounded-xl relative overflow-hidden flex flex-col md:flex-row items-center justify-between p-lg md:p-margin min-h-[280px]">
604
- <div class="scanline"></div>
605
- <!-- BG overlay -->
606
- <div class="absolute inset-0 opacity-10 mix-blend-overlay pointer-events-none bg-gradient-to-br from-primary-container/20 via-transparent to-secondary-container/10"></div>
607
-
608
- <div class="relative z-10 flex flex-col md:flex-row items-center gap-margin w-full">
609
- <!-- Circular verdict badge -->
610
- <div id="verdictBadge" class="relative w-44 h-44 rounded-full border-4 border-primary-container flex items-center justify-center shadow-[0_0_30px_rgba(0,255,156,0.4)] flex-shrink-0">
611
- <div class="absolute inset-0 rounded-full border border-primary-container animate-[spin_10s_linear_infinite] opacity-50"></div>
612
- <div class="absolute inset-2 rounded-full border border-dashed border-primary-container animate-[spin_15s_linear_infinite_reverse] opacity-30"></div>
613
- <div class="text-center">
614
- <span id="verdictIcon" class="material-symbols-outlined text-primary-container text-5xl mb-1" style="font-variation-settings:'FILL' 1;">verified_user</span>
615
- <h2 id="verdictLabel" class="font-h3 text-h3 text-primary-container uppercase tracking-widest drop-shadow-[0_0_5px_rgba(0,255,156,0.8)] text-sm">AUTHENTIC</h2>
616
- </div>
617
- </div>
618
-
619
- <!-- Confidence score -->
620
- <div class="flex-grow text-center md:text-left flex flex-col gap-sm">
621
- <p id="resultId" class="font-data-mono text-data-mono text-primary-container/80 uppercase tracking-widest">Analysis Complete // ID: ----</p>
622
- <h1 class="font-h1 text-h1 text-on-surface">Confidence Score</h1>
623
- <div id="confidenceScore" class="font-h1 leading-none text-primary-container drop-shadow-[0_0_15px_rgba(0,255,156,0.6)] font-black" style="font-size:80px;">--.--%</div>
624
- </div>
625
- </div>
626
- </div>
627
-
628
- <!-- Main grid: insights + diagnostics -->
629
- <div class="grid grid-cols-1 lg:grid-cols-12 gap-lg">
630
-
631
- <!-- Left: Primary Vectors -->
632
- <div class="lg:col-span-4 flex flex-col gap-md">
633
- <h3 class="font-label-xs text-label-xs text-outline uppercase tracking-widest border-b border-surface-variant pb-2">Primary Vectors</h3>
634
- <div id="insightCards" class="flex flex-col gap-md">
635
- <!-- Populated by JS -->
636
- </div>
637
- </div>
638
-
639
- <!-- Right: System Diagnostics -->
640
- <div class="lg:col-span-8 flex flex-col gap-md">
641
- <h3 class="font-label-xs text-label-xs text-outline uppercase tracking-widest border-b border-surface-variant pb-2">System Diagnostics</h3>
642
- <div class="glass-panel rounded-lg flex-grow p-md font-data-mono text-data-mono text-sm relative overflow-hidden flex flex-col min-h-[280px]">
643
- <div class="scanline"></div>
644
- <div class="flex justify-between items-center border-b border-surface-variant/50 pb-sm mb-sm text-on-surface-variant">
645
- <span>METADATA_STREAM</span>
646
- <span class="text-primary-container animate-pulse">ACTIVE</span>
647
- </div>
648
- <div id="metaTerminal" class="flex-grow space-y-2 text-on-surface-variant overflow-y-auto pr-2">
649
- <!-- Populated by JS -->
650
- </div>
651
- </div>
652
- </div>
653
- </div>
654
-
655
- <!-- Timeline -->
656
- <div class="glass-panel rounded-xl p-lg flex flex-col gap-md">
657
- <h3 class="font-label-xs text-label-xs text-outline uppercase tracking-widest border-b border-surface-variant pb-2">Probability Timeline</h3>
658
- <div class="relative">
659
- <!-- Grid lines -->
660
- <div class="absolute inset-0 flex flex-col justify-between pointer-events-none opacity-20 pb-6">
661
- <div class="w-full h-px bg-outline"></div>
662
- <div class="w-full h-px bg-outline"></div>
663
- <div class="w-full h-px bg-outline"></div>
664
- <div class="w-full h-px bg-outline"></div>
665
- </div>
666
- <!-- Y-axis labels -->
667
- <div class="absolute left-0 top-0 h-[160px] flex flex-col justify-between pointer-events-none pr-2">
668
- <span class="font-data-mono text-[9px] text-outline">100%</span>
669
- <span class="font-data-mono text-[9px] text-outline">75%</span>
670
- <span class="font-data-mono text-[9px] text-outline">50%</span>
671
- <span class="font-data-mono text-[9px] text-outline">25%</span>
672
- <span class="font-data-mono text-[9px] text-outline">0%</span>
673
- </div>
674
- <!-- Bars container -->
675
- <div id="timelineBars" class="flex items-end gap-[2px] border-b border-l border-surface-variant pl-8 relative z-10" style="height:160px;overflow:visible;">
676
- <!-- Populated by JS -->
677
- </div>
678
- </div>
679
- <div id="timelineLabels" class="flex justify-between font-data-mono text-data-mono text-xs text-outline mt-1 pl-8">
680
- <!-- Populated by JS -->
681
- </div>
682
- </div>
683
-
684
- <!-- Audio section (shown only when audio.available) -->
685
- <div id="audioSection" style="display:none;" class="glass-panel rounded-xl p-lg flex flex-col gap-md">
686
- <h3 class="font-label-xs text-label-xs text-outline uppercase tracking-widest border-b border-surface-variant pb-2 flex items-center gap-2">
687
- <span class="material-symbols-outlined text-[14px]">graphic_eq</span>
688
- Audio Analysis
689
- </h3>
690
- <div class="grid grid-cols-1 md:grid-cols-2 gap-md">
691
- <!-- Audio verdict -->
692
- <div class="glass-panel rounded-lg p-md flex items-center gap-md">
693
- <div class="w-12 h-12 rounded-full bg-surface-container-highest flex items-center justify-center flex-shrink-0 border border-surface-variant">
694
- <span id="audioIcon" class="material-symbols-outlined text-primary-container" style="font-variation-settings:'FILL' 1;">record_voice_over</span>
695
- </div>
696
- <div>
697
- <div class="font-label-xs text-label-xs text-outline uppercase tracking-widest mb-1">Voice Classification</div>
698
- <div id="audioVerdict" class="font-h3 text-h3 text-primary-container">HUMAN_VOICE</div>
699
- <div id="audioConfidence" class="font-data-mono text-data-mono text-on-surface-variant mt-1">Confidence: --%</div>
700
- </div>
701
- </div>
702
- <!-- Audio scores -->
703
- <div class="glass-panel rounded-lg p-md flex flex-col gap-sm">
704
- <div class="font-label-xs text-label-xs text-outline uppercase tracking-widest mb-1">Score Breakdown</div>
705
- <div class="flex items-center justify-between">
706
- <span class="font-data-mono text-data-mono text-on-surface-variant text-xs">Model Score</span>
707
- <div class="flex items-center gap-2 flex-1 ml-4">
708
- <div class="h-1 flex-grow bg-surface-container-highest rounded-full overflow-hidden">
709
- <div id="audioModelBar" class="h-full bg-primary-container" style="width:0%"></div>
710
- </div>
711
- <span id="audioModelScore" class="font-data-mono text-data-mono text-primary-container text-xs w-10 text-right">--%</span>
712
- </div>
713
- </div>
714
- <div class="flex items-center justify-between">
715
- <span class="font-data-mono text-data-mono text-on-surface-variant text-xs">Heuristic Score</span>
716
- <div class="flex items-center gap-2 flex-1 ml-4">
717
- <div class="h-1 flex-grow bg-surface-container-highest rounded-full overflow-hidden">
718
- <div id="audioHeuristicBar" class="h-full bg-secondary-container" style="width:0%"></div>
719
- </div>
720
- <span id="audioHeuristicScore" class="font-data-mono text-data-mono text-secondary-container text-xs w-10 text-right">--%</span>
721
- </div>
722
- </div>
723
- </div>
724
- </div>
725
- <!-- Audio details -->
726
- <div id="audioDetails" class="flex flex-col gap-2">
727
- <!-- Populated by JS -->
728
- </div>
729
- </div>
730
-
731
- <!-- New analysis button -->
732
- <div class="text-center mt-sm">
733
- <button onclick="resetAll()" class="font-data-mono text-data-mono text-error border border-error/50 px-lg py-sm rounded bg-error/5 hover:bg-error/10 hover:shadow-[0_0_15px_rgba(255,180,171,0.2)] transition-all flex items-center gap-xs mx-auto">
734
- <span class="material-symbols-outlined text-sm">restart_alt</span>
735
- NEW ANALYSIS
736
- </button>
737
- </div>
738
- </section>
739
-
740
- <!-- ═══════════════════════════════════════════════════════════
741
- MODALS
742
- ════════════════════════════════════════════════════════════ -->
743
- <style>
744
- .modal-backdrop {
745
- position:fixed;inset:0;z-index:200;
746
- background:rgba(0,0,0,0.8);backdrop-filter:blur(6px);
747
- display:flex;align-items:center;justify-content:center;padding:24px;
748
- animation:fadeIn 0.2s ease;
749
- }
750
- .modal-box {
751
- background:#141e17;border:1px solid rgba(0,255,156,0.2);border-radius:12px;
752
- width:100%;max-width:640px;max-height:80vh;overflow-y:auto;
753
- box-shadow:0 0 60px rgba(0,255,156,0.1);animation:slideUp 0.25s ease;
754
- }
755
- @keyframes slideUp{from{opacity:0;transform:translateY(20px);}to{opacity:1;transform:none;}}
756
- .modal-header{display:flex;align-items:center;justify-content:space-between;padding:20px 24px 16px;border-bottom:1px solid rgba(0,255,156,0.1);}
757
- .modal-body{padding:20px 24px 24px;}
758
- .modal-close{background:none;border:none;cursor:pointer;color:#849587;font-size:18px;padding:4px 8px;border-radius:4px;transition:color 0.2s;font-family:inherit;}
759
- .modal-close:hover{color:#ffb4ab;}
760
- .agent-row{display:flex;align-items:flex-start;gap:14px;padding:14px;border-radius:8px;background:rgba(35,44,37,0.3);border:1px solid rgba(0,255,156,0.08);margin-bottom:10px;}
761
- .agent-icon{width:40px;height:40px;border-radius:8px;flex-shrink:0;background:rgba(0,255,156,0.08);border:1px solid rgba(0,255,156,0.2);display:flex;align-items:center;justify-content:center;font-size:18px;}
762
- .log-row{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid rgba(255,255,255,0.05);font-family:'Space Grotesk',monospace;font-size:12px;gap:12px;}
763
- .log-row:last-child{border-bottom:none;}
764
- .net-row{display:flex;justify-content:space-between;align-items:center;padding:10px 14px;border-radius:6px;background:rgba(35,44,37,0.3);border:1px solid rgba(0,255,156,0.08);margin-bottom:8px;font-family:'Space Grotesk',monospace;font-size:12px;}
765
- </style>
766
-
767
- <!-- Agents Modal -->
768
- <div id="agentsModal" style="display:none;" class="modal-backdrop" onclick="if(event.target===this)closeModal('agentsModal')">
769
- <div class="modal-box">
770
- <div class="modal-header">
771
- <div>
772
- <div style="font-size:11px;font-weight:700;letter-spacing:0.15em;color:#00ff9c;text-transform:uppercase;">AGENT PIPELINE</div>
773
- <div style="font-size:12px;color:#849587;margin-top:4px;">5 specialized AI agents run in sequence</div>
774
- </div>
775
- <button class="modal-close" onclick="closeModal('agentsModal')">✕</button>
776
- </div>
777
- <div class="modal-body">
778
- <div class="agent-row">
779
- <div class="agent-icon">🎬</div>
780
- <div>
781
- <div style="font-size:14px;font-weight:600;color:#dae5da;">Frame Analyzer Agent</div>
782
- <div style="font-size:12px;color:#849587;margin-top:4px;line-height:1.5;">Extracts 40 frames uniformly across the full video using OpenCV. Uniform temporal sampling ensures coverage regardless of video length.</div>
783
- <div style="margin-top:6px;font-size:10px;font-weight:700;letter-spacing:0.1em;color:rgba(0,255,156,0.5);text-transform:uppercase;">OpenCV · Uniform sampling · Max 40 frames</div>
784
- </div>
785
- </div>
786
- <div class="agent-row">
787
- <div class="agent-icon">👤</div>
788
- <div>
789
- <div style="font-size:14px;font-weight:600;color:#dae5da;">Face Detector Agent</div>
790
- <div style="font-size:12px;color:#849587;margin-top:4px;line-height:1.5;">Detects and crops faces using MediaPipe. Applies a quality gate — blurry crops (blur &lt; 40) are discarded before model inference.</div>
791
- <div style="margin-top:6px;font-size:10px;font-weight:700;letter-spacing:0.1em;color:rgba(0,255,156,0.5);text-transform:uppercase;">MediaPipe · Quality gate · 20% padding</div>
792
- </div>
793
- </div>
794
- <div class="agent-row">
795
- <div class="agent-icon">🧠</div>
796
- <div>
797
- <div style="font-size:14px;font-weight:600;color:#dae5da;">Decision Agent (ViT Ensemble)</div>
798
- <div style="font-size:12px;color:#849587;margin-top:4px;line-height:1.5;">Runs two Vision Transformer models on each face crop. Scores aggregated with mean + median blend and adaptive thresholding based on frame consistency.</div>
799
- <div style="margin-top:6px;font-size:10px;font-weight:700;letter-spacing:0.1em;color:rgba(0,255,156,0.5);text-transform:uppercase;">dima806 (99.3%) · prithivMLmods (92.1%) · Adaptive threshold</div>
800
- </div>
801
- </div>
802
- <div class="agent-row">
803
- <div class="agent-icon">🎙️</div>
804
- <div>
805
- <div style="font-size:14px;font-weight:600;color:#dae5da;">Audio Analysis Agent</div>
806
- <div style="font-size:12px;color:#849587;margin-top:4px;line-height:1.5;">Extracts audio via moviepy, runs librosa heuristics (pitch variance, MFCC delta, spectral flatness) and Wav2Vec2 ASVspoof model. Detects AI voices and audio-visual mismatch.</div>
807
- <div style="margin-top:6px;font-size:10px;font-weight:700;letter-spacing:0.1em;color:rgba(0,227,253,0.5);text-transform:uppercase;">Wav2Vec2 (92.8%) · Librosa · AV mismatch detection</div>
808
- </div>
809
- </div>
810
- <div class="agent-row">
811
- <div class="agent-icon">📊</div>
812
- <div>
813
- <div style="font-size:14px;font-weight:600;color:#dae5da;">Report Generator Agent</div>
814
- <div style="font-size:12px;color:#849587;margin-top:4px;line-height:1.5;">Combines visual + audio scores into a final verdict. AV_MISMATCH (face-swap with dubbed audio) overrides visual REAL verdict. Generates insights and frame timeline.</div>
815
- <div style="margin-top:6px;font-size:10px;font-weight:700;letter-spacing:0.1em;color:rgba(0,255,156,0.5);text-transform:uppercase;">AV mismatch · Confidence calibration · Insight generation</div>
816
- </div>
817
- </div>
818
- </div>
819
- </div>
820
- </div>
821
-
822
- <!-- Logs Modal -->
823
- <div id="logsModal" style="display:none;" class="modal-backdrop" onclick="if(event.target===this)closeModal('logsModal')">
824
- <div class="modal-box">
825
- <div class="modal-header">
826
- <div>
827
- <div style="font-size:11px;font-weight:700;letter-spacing:0.15em;color:#00ff9c;text-transform:uppercase;">ANALYSIS LOGS</div>
828
- <div style="font-size:12px;color:#849587;margin-top:4px;">Session history (last 20 analyses)</div>
829
- </div>
830
- <button class="modal-close" onclick="closeModal('logsModal')">✕</button>
831
- </div>
832
- <div class="modal-body">
833
- <div id="logsContent">
834
- <div style="font-size:12px;color:#849587;text-align:center;padding:32px 0;opacity:0.5;">
835
- No analyses run this session.<br/>Upload a video to begin.
836
- </div>
837
- </div>
838
- </div>
839
- </div>
840
- </div>
841
-
842
- <!-- Network Modal -->
843
- <div id="networkModal" style="display:none;" class="modal-backdrop" onclick="if(event.target===this)closeModal('networkModal')">
844
- <div class="modal-box">
845
- <div class="modal-header">
846
- <div>
847
- <div style="font-size:11px;font-weight:700;letter-spacing:0.15em;color:#00ff9c;text-transform:uppercase;">NETWORK STATUS</div>
848
- <div style="font-size:12px;color:#849587;margin-top:4px;">Model endpoints and system health</div>
849
- </div>
850
- <button class="modal-close" onclick="closeModal('networkModal')">✕</button>
851
- </div>
852
- <div class="modal-body">
853
- <div id="networkContent">
854
- <div style="font-size:12px;color:#849587;text-align:center;padding:24px 0;opacity:0.5;">Checking...</div>
855
- </div>
856
- </div>
857
- </div>
858
- </div>
859
-
860
- <!-- ═══════════════════════════════════════════════════════════
861
- FOOTER
862
- ═══════════════════════════════════════���════════════════════ -->
863
- <footer class="relative z-10 w-full py-8 px-10 flex flex-col md:flex-row justify-between items-center opacity-80 bg-black border-t border-emerald-900/30 font-mono text-[10px] uppercase tracking-[0.2em]">
864
- <div class="text-emerald-500 mb-4 md:mb-0">© 2024 AUTHRIX COMMAND. SYSTEM_STATE: VIGILANT</div>
865
- <div class="flex items-center gap-md">
866
- <a class="text-emerald-900 hover:text-emerald-300 transition-all cursor-crosshair" href="#">Kernel</a>
867
- <a class="text-emerald-900 hover:text-emerald-300 transition-all cursor-crosshair" href="#">Protocol</a>
868
- <a class="text-emerald-900 hover:text-emerald-300 transition-all cursor-crosshair" href="#">Override</a>
869
- <a class="text-emerald-900 hover:text-emerald-300 transition-all cursor-crosshair" href="#">Diagnostics</a>
870
- </div>
871
- </footer>
872
-
873
- <!-- ═══════════════════════════════════════════════════════════
874
- JAVASCRIPT
875
- ════════════════════════════════════════════════════════════ -->
876
- <script>
877
- // ── API base ─────────────────────────────────────────────────────────────────
878
- const API_BASE = (window.location.protocol === 'file:')
879
- ? 'http://localhost:8000'
880
- : window.location.origin;
881
-
882
- let selectedFile = null;
883
- let pipelineTimers = [];
884
-
885
- // ── Init ──────────────────────────────────────────────────────────────────────
886
- window.addEventListener('load', () => {
887
- pingHealth();
888
- initUpload();
889
- startQueueClock();
890
- });
891
-
892
- // ── Health check ──────────────────────────────────────────────────────────────
893
- async function pingHealth() {
894
- const badge = document.getElementById('healthBadge');
895
- const dot = document.getElementById('healthDot');
896
- const text = document.getElementById('healthText');
897
- badge.style.display = 'flex';
898
- try {
899
- const res = await fetch(API_BASE + '/health');
900
- const data = await res.json();
901
- if (data.ready) {
902
- dot.className = 'w-2 h-2 rounded-full bg-primary-container shadow-[0_0_8px_#00ff9c] animate-pulse';
903
- text.textContent = data.model ? data.model.toUpperCase().slice(0, 20) : 'READY';
904
- text.className = 'font-label-xs text-label-xs text-primary-container';
905
- } else {
906
- dot.className = 'w-2 h-2 rounded-full bg-tertiary-container animate-pulse';
907
- text.textContent = 'LOADING';
908
- text.className = 'font-label-xs text-label-xs text-tertiary-container';
909
- }
910
- } catch {
911
- dot.className = 'w-2 h-2 rounded-full bg-error';
912
- text.textContent = 'OFFLINE';
913
- text.className = 'font-label-xs text-label-xs text-error';
914
- }
915
- }
916
-
917
- // ── Show/hide states ──────────────────────────────────────────────────────────
918
- function showState(id) {
919
- ['heroSection', 'uploadSection', 'processingSection', 'resultsSection'].forEach(s => {
920
- const el = document.getElementById(s);
921
- if (el) el.style.display = (s === id) ? '' : 'none';
922
- });
923
- window.scrollTo({ top: 0, behavior: 'smooth' });
924
- }
925
-
926
- // ── Queue clock ───────────────────────────────────────────────────────────────
927
- function startQueueClock() {
928
- function tick() {
929
- const el = document.getElementById('queueTime');
930
- if (el) {
931
- const now = new Date();
932
- const hh = String(now.getHours()).padStart(2, '0');
933
- const mm = String(now.getMinutes()).padStart(2, '0');
934
- const ss = String(now.getSeconds()).padStart(2, '0');
935
- el.textContent = `SYS_TIME: ${hh}:${mm}:${ss}`;
936
- }
937
- }
938
- tick();
939
- setInterval(tick, 1000);
940
- }
941
-
942
- // ── Upload init ───────────────────────────────────────────────────────────────
943
- function initUpload() {
944
- const zone = document.getElementById('dropZoneInner');
945
- const input = document.getElementById('fileInput');
946
-
947
- // Drag events
948
- zone.addEventListener('dragover', e => {
949
- e.preventDefault();
950
- zone.classList.add('drag-over');
951
- });
952
- zone.addEventListener('dragleave', () => zone.classList.remove('drag-over'));
953
- zone.addEventListener('drop', e => {
954
- e.preventDefault();
955
- zone.classList.remove('drag-over');
956
- const file = e.dataTransfer.files[0];
957
- if (file) applyFile(file);
958
- });
959
-
960
- // File input change
961
- input.addEventListener('change', () => {
962
- if (input.files[0]) applyFile(input.files[0]);
963
- });
964
- }
965
-
966
- // ── Apply selected file ───────────────────────────────────────────────────────
967
- function applyFile(file) {
968
- selectedFile = file;
969
-
970
- // Show file info in drop zone
971
- document.getElementById('uploadPrompt').style.display = 'none';
972
- document.getElementById('fileChosen').style.display = 'flex';
973
- document.getElementById('chosenName').textContent = file.name;
974
- document.getElementById('chosenSize').textContent = formatBytes(file.size);
975
-
976
- // Enable analyze button
977
- const btn = document.getElementById('analyzeBtn');
978
- btn.disabled = false;
979
- btn.style.pointerEvents = '';
980
- btn.className = 'w-full py-4 font-label-xs text-label-xs uppercase tracking-wider rounded-DEFAULT transition-all duration-300 bg-primary-container text-on-primary cursor-pointer hover:shadow-[0_0_30px_rgba(0,255,156,0.4)] active:scale-95';
981
-
982
- // Update queue
983
- updateQueue(file);
984
- }
985
-
986
- // ── Clear file ────────────────────────────────────────────────────────────────
987
- function clearFile(e) {
988
- e.stopPropagation();
989
- selectedFile = null;
990
- document.getElementById('fileInput').value = '';
991
- document.getElementById('uploadPrompt').style.display = '';
992
- document.getElementById('fileChosen').style.display = 'none';
993
-
994
- const btn = document.getElementById('analyzeBtn');
995
- btn.disabled = true;
996
- btn.style.pointerEvents = 'none';
997
- btn.className = 'w-full py-4 font-label-xs text-label-xs uppercase tracking-wider rounded-DEFAULT transition-all duration-300 border border-outline/30 bg-surface-container/40 text-outline cursor-not-allowed';
998
-
999
- // Reset queue
1000
- document.getElementById('queueList').innerHTML = `
1001
- <div class="bg-surface-container-low border border-outline-variant/30 rounded-DEFAULT p-4 flex items-center gap-3 opacity-40">
1002
- <span class="material-symbols-outlined text-outline text-[20px]">inbox</span>
1003
- <span class="font-data-mono text-data-mono text-on-surface-variant">No payload queued. Awaiting upload.</span>
1004
- </div>`;
1005
- }
1006
-
1007
- // ── Update queue display ──────────────────────────────────────────────────────
1008
- function updateQueue(file) {
1009
- document.getElementById('queueList').innerHTML = `
1010
- <div class="bg-surface-container-low border border-outline-variant/30 rounded-DEFAULT p-4 flex flex-col gap-3 relative overflow-hidden">
1011
- <div class="absolute bottom-0 left-0 h-[1px] bg-primary-container w-full shadow-[0_0_5px_rgba(0,255,156,0.8)]"></div>
1012
- <div class="flex justify-between items-start">
1013
- <div class="flex items-center gap-3">
1014
- <span class="material-symbols-outlined text-primary-container text-[20px]" style="font-variation-settings:'FILL' 1;">video_file</span>
1015
- <div>
1016
- <div class="font-data-mono text-data-mono text-on-surface">${escHtml(file.name)}</div>
1017
- <div class="font-label-xs text-[10px] text-on-surface-variant mt-1">${formatBytes(file.size)}</div>
1018
- </div>
1019
- </div>
1020
- <span class="font-label-xs text-[10px] border border-primary-container/50 text-primary-container px-2 py-1 bg-primary-container/10">READY</span>
1021
- </div>
1022
- </div>`;
1023
- }
1024
-
1025
- // ── Analyze video ─────────────────────────────────────────────────────────────
1026
- async function analyzeVideo() {
1027
- if (!selectedFile) return;
1028
-
1029
- showState('processingSection');
1030
- resetPipeline();
1031
- startPipelineAnimation();
1032
-
1033
- const fd = new FormData();
1034
- fd.append('file', selectedFile);
1035
-
1036
- try {
1037
- const res = await fetch(API_BASE + '/analyze', { method: 'POST', body: fd });
1038
- if (!res.ok) {
1039
- const err = await res.json().catch(() => ({ detail: res.statusText }));
1040
- throw new Error(err.detail || `HTTP ${res.status}`);
1041
- }
1042
- const data = await res.json();
1043
- stopPipelineAnimation();
1044
- logAnalysis(data, selectedFile?.name);
1045
- renderResults(data);
1046
- showState('resultsSection');
1047
- } catch (err) {
1048
- stopPipelineAnimation();
1049
- showState('uploadSection');
1050
- alert('Analysis failed: ' + err.message);
1051
- }
1052
- }
1053
-
1054
- // ── Pipeline animation ────────────────────────────────────────────────────────
1055
- const STEP_ICONS = ['filter_frames', 'face', 'memory', 'graphic_eq'];
1056
- const STEP_DELAYS = [0, 1800, 3600, 5400];
1057
- const STEP_PERCENTS = [25, 50, 75, 100];
1058
- const CLI_MSGS = [
1059
- ['> [SYS] Decoding video container...', '> [SYS] Sampling keyframes... OK'],
1060
- ['> [DET] Loading face detector...', '> [DET] Scanning for facial regions... OK'],
1061
- ['> [INF] Allocating tensor buffers...', '> [INF] Running ViT ensemble inference...', '> [INF] Batch processing... <span class="text-primary-container animate-pulse">_</span>'],
1062
- ['> [AUD] Extracting audio track...', '> [AUD] Computing spectral features...', '> [AUD] Classifying voice patterns... <span class="text-primary-container animate-pulse">_</span>'],
1063
- ];
1064
-
1065
- function resetPipeline() {
1066
- for (let i = 0; i < 4; i++) {
1067
- const step = document.getElementById('step' + i);
1068
- step.className = 'pipeline-step pending flex flex-col gap-xs' + (i === 3 ? ' mt-sm' : '');
1069
- document.getElementById('step' + i + 'icon').className = 'material-symbols-outlined text-outline text-sm';
1070
- document.getElementById('step' + i + 'icon').textContent = 'hourglass_empty';
1071
- document.getElementById('step' + i + 'pct').textContent = '0%';
1072
- document.getElementById('step' + i + 'pct').className = 'font-data-mono text-data-mono text-outline';
1073
- setBarFill(i, 0);
1074
- }
1075
- document.getElementById('pipelinePercent').textContent = '0% COMPLETE';
1076
- document.getElementById('cliFeedback').innerHTML =
1077
- '> [SYS] Initializing analysis pipeline...<br/>> [SYS] Loading neural weights... <span class="text-primary-container animate-pulse">_</span>';
1078
- }
1079
-
1080
- function startPipelineAnimation() {
1081
- pipelineTimers = [];
1082
- for (let i = 0; i < 4; i++) {
1083
- const t = setTimeout(() => activateStep(i), STEP_DELAYS[i]);
1084
- pipelineTimers.push(t);
1085
- }
1086
- }
1087
-
1088
- function stopPipelineAnimation() {
1089
- pipelineTimers.forEach(t => clearTimeout(t));
1090
- pipelineTimers = [];
1091
- // Mark all done
1092
- for (let i = 0; i < 4; i++) completeStep(i);
1093
- document.getElementById('pipelinePercent').textContent = '100% COMPLETE';
1094
- }
1095
-
1096
- function activateStep(idx) {
1097
- // Mark previous as done
1098
- if (idx > 0) completeStep(idx - 1);
1099
-
1100
- const step = document.getElementById('step' + idx);
1101
- step.className = 'pipeline-step active flex flex-col gap-xs glow-border-active bg-primary-container/5 p-sm -mx-sm rounded-lg' + (idx === 3 ? ' mt-sm' : '');
1102
-
1103
- const icon = document.getElementById('step' + idx + 'icon');
1104
- icon.className = 'material-symbols-outlined text-primary-container text-sm animate-pulse';
1105
- icon.textContent = STEP_ICONS[idx];
1106
-
1107
- const pct = document.getElementById('step' + idx + 'pct');
1108
- pct.className = 'font-data-mono text-data-mono text-primary-container';
1109
-
1110
- // Animate progress bar fill
1111
- animateBarFill(idx, 0, 80, 1600);
1112
-
1113
- // Update percent display
1114
- document.getElementById('pipelinePercent').textContent = STEP_PERCENTS[idx] + '% COMPLETE';
1115
-
1116
- // CLI messages
1117
- const cli = document.getElementById('cliFeedback');
1118
- const msgs = CLI_MSGS[idx];
1119
- let html = '';
1120
- msgs.forEach((m, mi) => {
1121
- setTimeout(() => {
1122
- html += (html ? '<br/>' : '') + m;
1123
- cli.innerHTML = html;
1124
- }, mi * 500);
1125
- });
1126
- }
1127
-
1128
- function completeStep(idx) {
1129
- const step = document.getElementById('step' + idx);
1130
- step.className = 'pipeline-step done flex flex-col gap-xs' + (idx === 3 ? ' mt-sm' : '');
1131
-
1132
- const icon = document.getElementById('step' + idx + 'icon');
1133
- icon.className = 'material-symbols-outlined text-outline text-sm';
1134
- icon.textContent = 'check_circle';
1135
-
1136
- const pct = document.getElementById('step' + idx + 'pct');
1137
- pct.textContent = '100%';
1138
- pct.className = 'font-data-mono text-data-mono text-outline';
1139
-
1140
- setBarFill(idx, 100);
1141
- }
1142
-
1143
- function setBarFill(idx, pct) {
1144
- const bar = document.getElementById('step' + idx + 'bar');
1145
- if (!bar) return;
1146
- const segments = bar.children;
1147
- const filled = Math.round((pct / 100) * segments.length);
1148
- for (let i = 0; i < segments.length; i++) {
1149
- if (i < filled) {
1150
- segments[i].className = 'h-full bg-primary-container/80 flex-1 shadow-[0_0_8px_rgba(0,255,156,0.5)]';
1151
- } else {
1152
- segments[i].className = 'h-full bg-primary-container/20 flex-1';
1153
- }
1154
- }
1155
- document.getElementById('step' + idx + 'pct').textContent = pct + '%';
1156
- }
1157
-
1158
- function animateBarFill(idx, from, to, duration) {
1159
- const start = performance.now();
1160
- function frame(now) {
1161
- const elapsed = now - start;
1162
- const progress = Math.min(elapsed / duration, 1);
1163
- const current = from + (to - from) * progress;
1164
- setBarFill(idx, Math.round(current));
1165
- if (progress < 1) requestAnimationFrame(frame);
1166
- }
1167
- requestAnimationFrame(frame);
1168
- }
1169
-
1170
- // ── Render results ────────────────────────────────────────────────────────────
1171
- function renderResults(data) {
1172
- const isFake = data.result === 'FAKE';
1173
- const conf = typeof data.confidence === 'number' ? data.confidence : 0;
1174
-
1175
- // Banner colors
1176
- const banner = document.getElementById('resultBanner');
1177
- banner.className = banner.className.replace(/glow-border-\w+/g, '');
1178
- banner.classList.add(isFake ? 'glow-border-error' : 'glow-border-primary');
1179
-
1180
- // Verdict badge
1181
- const badge = document.getElementById('verdictBadge');
1182
- if (isFake) {
1183
- badge.style.borderColor = '#ffb4ab';
1184
- badge.style.boxShadow = '0 0 30px rgba(255,180,171,0.4)';
1185
- } else {
1186
- badge.style.borderColor = '#00ff9c';
1187
- badge.style.boxShadow = '0 0 30px rgba(0,255,156,0.4)';
1188
- }
1189
-
1190
- const verdictIcon = document.getElementById('verdictIcon');
1191
- const verdictLabel = document.getElementById('verdictLabel');
1192
- if (isFake) {
1193
- verdictIcon.textContent = 'gpp_bad';
1194
- verdictIcon.style.color = '#ffb4ab';
1195
- verdictLabel.textContent = 'DEEPFAKE';
1196
- verdictLabel.style.color = '#ffb4ab';
1197
- } else {
1198
- verdictIcon.textContent = 'verified_user';
1199
- verdictIcon.style.color = '#00ff9c';
1200
- verdictLabel.textContent = 'AUTHENTIC';
1201
- verdictLabel.style.color = '#00ff9c';
1202
- }
1203
-
1204
- // Confidence
1205
- const confEl = document.getElementById('confidenceScore');
1206
- confEl.textContent = conf.toFixed(1) + '%';
1207
- confEl.style.color = isFake ? '#ffb4ab' : '#00ff9c';
1208
- confEl.style.textShadow = isFake
1209
- ? '0 0 15px rgba(255,180,171,0.6)'
1210
- : '0 0 15px rgba(0,255,156,0.6)';
1211
-
1212
- // Result ID
1213
- document.getElementById('resultId').textContent =
1214
- `Analysis Complete // ID: ${Math.random().toString(36).slice(2,10).toUpperCase()}`;
1215
-
1216
- // Insight cards
1217
- renderInsightCards(data.details || [], isFake, conf);
1218
-
1219
- // Metadata terminal
1220
- renderMetaTerminal(data);
1221
-
1222
- // Timeline
1223
- renderTimeline(data.frame_timeline || []);
1224
-
1225
- // Audio
1226
- if (data.audio && data.audio.available) {
1227
- renderAudio(data.audio);
1228
- document.getElementById('audioSection').style.display = '';
1229
- } else {
1230
- document.getElementById('audioSection').style.display = 'none';
1231
- }
1232
- }
1233
-
1234
- // ── Insight cards ─────────────────────────────────────────────────────────────
1235
- const INSIGHT_ICONS = ['face', 'visibility', 'graphic_eq', 'blur_on', 'analytics'];
1236
-
1237
- function renderInsightCards(details, isFake, conf) {
1238
- const container = document.getElementById('insightCards');
1239
- if (!details.length) {
1240
- details = ['No detailed analysis available.'];
1241
- }
1242
- // Show up to 3 cards
1243
- const shown = details.slice(0, 3);
1244
- container.innerHTML = shown.map((detail, i) => {
1245
- const icon = INSIGHT_ICONS[i % INSIGHT_ICONS.length];
1246
- // Derive a pseudo-score from confidence + variation
1247
- const score = Math.max(5, Math.min(99, conf + (i === 0 ? 0 : (i === 1 ? -8 : 12)) + (Math.random() * 6 - 3)));
1248
- const isRed = isFake && i === 0;
1249
- const barColor = isRed ? 'bg-error' : 'bg-primary-container';
1250
- const textColor = isRed ? 'text-error' : 'text-primary-container';
1251
- const borderHover = isRed ? 'hover:glow-border-error' : 'hover:glow-border-primary';
1252
- return `
1253
- <div class="glass-panel rounded-lg p-md flex items-start gap-md ${borderHover} transition-all duration-300 transform hover:-translate-y-1">
1254
- <div class="w-10 h-10 rounded-full bg-surface-container-highest flex items-center justify-center flex-shrink-0 border border-surface-variant">
1255
- <span class="material-symbols-outlined ${textColor}" style="font-variation-settings:'FILL' 0;">${icon}</span>
1256
- </div>
1257
- <div class="flex-1 min-w-0">
1258
- <h4 class="font-body-base text-body-base font-semibold text-on-surface">Vector ${i + 1}</h4>
1259
- <p class="font-data-mono text-data-mono text-on-surface-variant mt-1 text-sm leading-relaxed">${escHtml(detail)}</p>
1260
- <div class="mt-3 flex items-center gap-2">
1261
- <div class="h-1 flex-grow bg-surface-container-highest rounded-full overflow-hidden">
1262
- <div class="h-full ${barColor}" style="width:${score.toFixed(0)}%"></div>
1263
- </div>
1264
- <span class="font-data-mono text-data-mono ${textColor} text-xs">${score.toFixed(0)}%</span>
1265
- </div>
1266
- </div>
1267
- </div>`;
1268
- }).join('');
1269
- }
1270
-
1271
- // ── Metadata terminal ─────────────────────────────────────────────────────────
1272
- function renderMetaTerminal(data) {
1273
- const meta = data.metadata || {};
1274
- const rows = [
1275
- ['RESULT', data.result || '--'],
1276
- ['FRAMES_ANALYZED', meta.frames_analyzed ?? '--'],
1277
- ['FACES_DETECTED', meta.frames_with_faces ?? '--'],
1278
- ['DURATION', meta.video_duration_sec != null ? meta.video_duration_sec.toFixed(1) + 's' : '--'],
1279
- ['FPS', meta.video_fps ?? '--'],
1280
- ['RESOLUTION', meta.resolution || '--'],
1281
- ['PROC_TIME', data.processing_time_sec != null ? data.processing_time_sec.toFixed(2) + 's' : '--'],
1282
- ];
1283
-
1284
- const html = rows.map(([k, v]) => `
1285
- <div class="flex items-baseline gap-0">
1286
- <span class="text-outline shrink-0" style="width:11rem;min-width:11rem;">${k}:</span>
1287
- <span class="text-on-surface font-semibold">${escHtml(String(v))}</span>
1288
- </div>`).join('') + `
1289
- <div class="my-3 border-t border-surface-variant/30 border-dashed"></div>
1290
- <div class="text-primary-container opacity-80">&gt; INIT NEURAL_NET_V4.2</div>
1291
- <div class="text-primary-container opacity-80">&gt; LOADING WEIGHTS... DONE</div>
1292
- <div class="text-primary-container opacity-80">&gt; ANALYZING SPATIAL_TEMPORAL_NOISE</div>
1293
- <div class="text-primary-container opacity-80">&gt; EXTRACTING BIOMETRIC_FEATURES</div>
1294
- <div class="text-primary-container opacity-80">&gt; CROSS_REFERENCING KNOWN_GAN_MODELS</div>
1295
- <div class="text-on-surface mt-3 blinking-cursor">&gt; ANALYSIS_COMPLETE</div>`;
1296
-
1297
- document.getElementById('metaTerminal').innerHTML = html;
1298
- }
1299
-
1300
- // ── Timeline ──────────────────────────────────────────────────────────────────
1301
- function renderTimeline(frames) {
1302
- const container = document.getElementById('timelineBars');
1303
- const labels = document.getElementById('timelineLabels');
1304
-
1305
- if (!frames || !frames.length) {
1306
- container.innerHTML = '<div class="flex-1 flex items-center justify-center text-on-surface-variant font-data-mono text-data-mono text-xs">No timeline data available</div>';
1307
- labels.innerHTML = '';
1308
- return;
1309
- }
1310
-
1311
- // Limit to 60 bars max for readability
1312
- const step = Math.max(1, Math.floor(frames.length / 60));
1313
- const subset = frames.filter((_, i) => i % step === 0);
1314
- const maxH = 140; // px
1315
-
1316
- container.innerHTML = subset.map(f => {
1317
- const pct = typeof f.fake_pct === 'number' ? f.fake_pct : 0;
1318
- const barH = Math.max(3, Math.round((pct / 100) * maxH)); // px, not %
1319
- const isHigh = pct >= 60;
1320
- const barBg = isHigh ? '#ffb4ab' : '#00ff9c';
1321
- const barGlow = isHigh
1322
- ? 'box-shadow:0 0 8px rgba(255,180,171,0.6);'
1323
- : 'box-shadow:0 0 6px rgba(0,255,156,0.4);';
1324
- const tipLabel = isHigh ? `⚠ ${pct.toFixed(1)}%` : `✓ ${pct.toFixed(1)}%`;
1325
- const tipBorder = isHigh ? '#ffb4ab' : '#00ff9c';
1326
- return `
1327
- <div class="tl-bar" style="height:${maxH}px;position:relative;flex:1;min-width:6px;max-width:20px;">
1328
- <div class="tl-tooltip" style="border-color:${tipBorder};">${tipLabel}</div>
1329
- <div style="position:absolute;bottom:0;left:1px;right:1px;height:${barH}px;background:${barBg};${barGlow}border-radius:2px 2px 0 0;"></div>
1330
- </div>`;
1331
- }).join('');
1332
-
1333
- // Labels
1334
- const first = frames[0].frame;
1335
- const last = frames[frames.length - 1].frame;
1336
- const mid = frames[Math.floor(frames.length / 2)].frame;
1337
- labels.innerHTML = `<span>Frame ${first}</span><span>Frame ${mid}</span><span>Frame ${last}</span>`;
1338
- }
1339
-
1340
- // ── Audio section ─────────────────────────────────────────────────────────────
1341
- function renderAudio(audio) {
1342
- const isAI = audio.result === 'AI_VOICE';
1343
- const isMismatch = audio.result === 'AV_MISMATCH';
1344
- const isFakeAudio = isAI || isMismatch; // both mean FAKE
1345
- const color = isFakeAudio ? '#ffb4ab' : '#00ff9c';
1346
-
1347
- const icon = document.getElementById('audioIcon');
1348
- icon.textContent = isFakeAudio ? 'gpp_bad' : 'record_voice_over';
1349
- icon.style.color = color;
1350
-
1351
- const verdict = document.getElementById('audioVerdict');
1352
- verdict.textContent = isMismatch ? 'DEEPFAKE (AV MISMATCH)' : (isAI ? 'AI_VOICE' : 'HUMAN_VOICE');
1353
- verdict.style.color = color;
1354
-
1355
- document.getElementById('audioConfidence').textContent =
1356
- isMismatch
1357
- ? 'Face-swap: voice is human but face is manipulated'
1358
- : `Confidence: ${typeof audio.confidence === 'number' ? audio.confidence.toFixed(1) + '%' : '--'}`;
1359
-
1360
- const modelScore = typeof audio.model_score === 'number' ? audio.model_score : 0;
1361
- const heurScore = typeof audio.heuristic_score === 'number' ? audio.heuristic_score : 0;
1362
-
1363
- document.getElementById('audioModelBar').style.width = modelScore + '%';
1364
- document.getElementById('audioModelScore').textContent = modelScore.toFixed(1) + '%';
1365
- document.getElementById('audioHeuristicBar').style.width = heurScore + '%';
1366
- document.getElementById('audioHeuristicScore').textContent = heurScore.toFixed(1) + '%';
1367
-
1368
- // Audio details — highlight mismatch details in yellow
1369
- const detailsEl = document.getElementById('audioDetails');
1370
- if (audio.details && audio.details.length) {
1371
- detailsEl.innerHTML = audio.details.map(d => `
1372
- <div class="flex items-start gap-3 p-3 bg-surface-container-low/50 border border-outline-variant/30 rounded-DEFAULT"
1373
- style="${isFakeAudio ? 'border-color:rgba(255,180,171,0.3);background:rgba(255,180,171,0.04);' : ''}">
1374
- <span class="material-symbols-outlined text-[16px] mt-0.5" style="color:${color};">chevron_right</span>
1375
- <span class="font-data-mono text-data-mono text-sm" style="color:#b9cbbc;">${escHtml(d)}</span>
1376
- </div>`).join('');
1377
- } else {
1378
- detailsEl.innerHTML = '';
1379
- }
1380
- }
1381
-
1382
- // ── Reset ─────────────────────────────────────────────────────────────────────
1383
- function resetAll() {
1384
- selectedFile = null;
1385
- document.getElementById('fileInput').value = '';
1386
- document.getElementById('uploadPrompt').style.display = '';
1387
- document.getElementById('fileChosen').style.display = 'none';
1388
-
1389
- const btn = document.getElementById('analyzeBtn');
1390
- btn.disabled = true;
1391
- btn.style.pointerEvents = 'none';
1392
- btn.className = 'w-full py-4 font-label-xs text-label-xs uppercase tracking-wider rounded-DEFAULT transition-all duration-300 border border-outline/30 bg-surface-container/40 text-outline cursor-not-allowed';
1393
-
1394
- document.getElementById('queueList').innerHTML = `
1395
- <div class="bg-surface-container-low border border-outline-variant/30 rounded-DEFAULT p-4 flex items-center gap-3 opacity-40">
1396
- <span class="material-symbols-outlined text-outline text-[20px]">inbox</span>
1397
- <span class="font-data-mono text-data-mono text-on-surface-variant">No payload queued. Awaiting upload.</span>
1398
- </div>`;
1399
-
1400
- showState('heroSection');
1401
- }
1402
-
1403
- // ── Utilities ─────────────────────────────────────────────────────────────────
1404
- function formatBytes(bytes) {
1405
- if (bytes < 1024) return bytes + ' B';
1406
- if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + ' KB';
1407
- return (bytes / (1024 * 1024)).toFixed(1) + ' MB';
1408
- }
1409
-
1410
- function escHtml(str) {
1411
- return String(str)
1412
- .replace(/&/g, '&amp;')
1413
- .replace(/</g, '&lt;')
1414
- .replace(/>/g, '&gt;')
1415
- .replace(/"/g, '&quot;');
1416
- }
1417
-
1418
- // ── Modal helpers ─────────────────────────────────────────────────────────────
1419
- function openModal(id) {
1420
- const el = document.getElementById(id);
1421
- if (!el) return;
1422
- el.style.display = 'flex';
1423
- if (id === 'networkModal') refreshNetworkModal();
1424
- if (id === 'logsModal') refreshLogsModal();
1425
- }
1426
- function closeModal(id) {
1427
- const el = document.getElementById(id);
1428
- if (el) el.style.display = 'none';
1429
- }
1430
- // Close on Escape
1431
- document.addEventListener('keydown', e => {
1432
- if (e.key === 'Escape') {
1433
- ['agentsModal','logsModal','networkModal'].forEach(closeModal);
1434
- }
1435
- });
1436
-
1437
- // ── Logs modal ────────────────────────────────────────────────────────────────
1438
- const _sessionLogs = [];
1439
-
1440
- function logAnalysis(data, filename) {
1441
- _sessionLogs.unshift({
1442
- ts: new Date().toLocaleTimeString(),
1443
- file: filename || 'unknown',
1444
- result: data.result,
1445
- confidence: data.confidence,
1446
- duration: data.metadata?.video_duration_sec ?? '—',
1447
- procTime: data.processing_time_sec ?? '—',
1448
- });
1449
- if (_sessionLogs.length > 20) _sessionLogs.pop();
1450
- }
1451
-
1452
- function refreshLogsModal() {
1453
- const el = document.getElementById('logsContent');
1454
- if (!_sessionLogs.length) {
1455
- el.innerHTML = `<div class="font-data-mono text-data-mono text-on-surface-variant text-xs text-center py-8 opacity-50">
1456
- No analyses run this session.<br/>Upload a video to begin.</div>`;
1457
- return;
1458
- }
1459
- el.innerHTML = _sessionLogs.map(log => {
1460
- const isFake = log.result === 'FAKE';
1461
- const color = isFake ? '#ffb4ab' : '#00ff9c';
1462
- return `
1463
- <div class="log-row">
1464
- <div style="display:flex;align-items:center;gap:10px;flex:1;min-width:0;">
1465
- <span class="material-symbols-outlined text-[14px]" style="color:${color};flex-shrink:0;">${isFake ? 'gpp_bad' : 'verified_user'}</span>
1466
- <span style="color:#dae5da;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:200px;">${escHtml(log.file)}</span>
1467
- </div>
1468
- <div style="display:flex;align-items:center;gap:16px;flex-shrink:0;">
1469
- <span style="color:${color};font-weight:700;">${log.result}</span>
1470
- <span style="color:#849587;">${log.confidence}%</span>
1471
- <span style="color:#849587;font-size:11px;">${log.ts}</span>
1472
- </div>
1473
- </div>`;
1474
- }).join('');
1475
- }
1476
-
1477
- // ── Network modal ─────────────────────────────────────────────────────────────
1478
- async function refreshNetworkModal() {
1479
- const el = document.getElementById('networkContent');
1480
- el.innerHTML = `<div class="font-data-mono text-data-mono text-on-surface-variant text-xs text-center py-6 opacity-50">Checking...</div>`;
1481
-
1482
- let health = null;
1483
- try {
1484
- const r = await fetch(API_BASE + '/health');
1485
- health = await r.json();
1486
- } catch (_) {}
1487
-
1488
- const rows = [
1489
- { label: 'API Server', value: health ? 'ONLINE' : 'OFFLINE', ok: !!health },
1490
- { label: 'Visual Models', value: health?.model ?? '—', ok: health?.ready },
1491
- { label: 'dima806 ViT (99.3%)', value: health?.ready ? 'LOADED' : 'PENDING', ok: health?.ready },
1492
- { label: 'prithivMLmods ViT', value: health?.ready ? 'LOADED' : 'PENDING', ok: health?.ready },
1493
- { label: 'Audio Wav2Vec2', value: health?.ready ? 'LOADED' : 'PENDING', ok: health?.ready },
1494
- { label: 'Inference Mode', value: 'LOCAL (CPU)', ok: true },
1495
- { label: 'Endpoint', value: API_BASE, ok: true },
1496
- ];
1497
-
1498
- el.innerHTML = rows.map(r => `
1499
- <div class="net-row">
1500
- <span style="color:#849587;letter-spacing:0.08em;">${r.label}</span>
1501
- <span style="color:${r.ok ? '#00ff9c' : '#ffb4ab'};font-weight:700;">${escHtml(String(r.value))}</span>
1502
- </div>`).join('') +
1503
- `<div style="margin-top:14px;padding-top:12px;border-top:1px solid rgba(255,255,255,0.05);">
1504
- <button onclick="refreshNetworkModal()" style="background:none;border:1px solid rgba(0,255,156,0.3);color:#00ff9c;padding:6px 14px;border-radius:4px;font-family:inherit;font-size:11px;letter-spacing:0.1em;cursor:pointer;transition:all 0.2s;" onmouseover="this.style.background='rgba(0,255,156,0.08)'" onmouseout="this.style.background='none'">
1505
- ↻ REFRESH
1506
- </button>
1507
- </div>`;
1508
- }
1509
- </script>
1510
- </body>
1511
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend-vanilla/pricing.html DELETED
@@ -1,470 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Authrix Pricing - AI-Powered Deepfake Detection</title>
7
- <style>
8
- * { margin: 0; padding: 0; box-sizing: border-box; }
9
-
10
- body {
11
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
12
- background: linear-gradient(135deg, #0a1f0f 0%, #0c150f 100%);
13
- color: #dae5da;
14
- min-height: 100vh;
15
- padding: 40px 20px;
16
- }
17
-
18
- .container {
19
- max-width: 1200px;
20
- margin: 0 auto;
21
- }
22
-
23
- /* Header */
24
- .header {
25
- text-align: center;
26
- margin-bottom: 60px;
27
- }
28
-
29
- .logo {
30
- display: inline-flex;
31
- align-items: center;
32
- gap: 12px;
33
- font-size: 28px;
34
- font-weight: 700;
35
- letter-spacing: 0.12em;
36
- color: #00ff9c;
37
- text-shadow: 0 0 20px rgba(0,255,156,0.4);
38
- margin-bottom: 20px;
39
- }
40
-
41
- .logo-dot {
42
- width: 12px;
43
- height: 12px;
44
- border-radius: 50%;
45
- background: #00ff9c;
46
- box-shadow: 0 0 16px #00ff9c;
47
- animation: pulse 2s ease-in-out infinite;
48
- }
49
-
50
- @keyframes pulse {
51
- 0%, 100% { opacity: 1; transform: scale(1); }
52
- 50% { opacity: 0.6; transform: scale(0.9); }
53
- }
54
-
55
- h1 {
56
- font-size: 48px;
57
- margin-bottom: 16px;
58
- background: linear-gradient(135deg, #00ff9c, #00cc6a);
59
- -webkit-background-clip: text;
60
- -webkit-text-fill-color: transparent;
61
- background-clip: text;
62
- }
63
-
64
- .subtitle {
65
- font-size: 20px;
66
- color: rgba(255,255,255,0.6);
67
- max-width: 600px;
68
- margin: 0 auto;
69
- }
70
-
71
- /* Pricing Cards */
72
- .pricing-grid {
73
- display: grid;
74
- grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
75
- gap: 30px;
76
- margin-bottom: 60px;
77
- }
78
-
79
- .pricing-card {
80
- background: rgba(255,255,255,0.03);
81
- border: 1px solid rgba(255,255,255,0.1);
82
- border-radius: 16px;
83
- padding: 40px 30px;
84
- position: relative;
85
- transition: all 0.3s ease;
86
- }
87
-
88
- .pricing-card:hover {
89
- transform: translateY(-8px);
90
- border-color: rgba(0,255,156,0.3);
91
- box-shadow: 0 20px 60px rgba(0,255,156,0.1);
92
- }
93
-
94
- .pricing-card.popular {
95
- border-color: #00ff9c;
96
- box-shadow: 0 0 40px rgba(0,255,156,0.2);
97
- }
98
-
99
- .popular-badge {
100
- position: absolute;
101
- top: -12px;
102
- right: 30px;
103
- background: linear-gradient(135deg, #00ff9c, #00cc6a);
104
- color: #002110;
105
- padding: 6px 16px;
106
- border-radius: 20px;
107
- font-size: 12px;
108
- font-weight: 700;
109
- letter-spacing: 0.08em;
110
- }
111
-
112
- .plan-name {
113
- font-size: 24px;
114
- font-weight: 700;
115
- margin-bottom: 12px;
116
- color: #00ff9c;
117
- }
118
-
119
- .plan-price {
120
- font-size: 48px;
121
- font-weight: 700;
122
- margin-bottom: 8px;
123
- font-family: monospace;
124
- }
125
-
126
- .plan-price span {
127
- font-size: 18px;
128
- color: rgba(255,255,255,0.5);
129
- }
130
-
131
- .plan-interval {
132
- font-size: 14px;
133
- color: rgba(255,255,255,0.4);
134
- margin-bottom: 24px;
135
- }
136
-
137
- .plan-features {
138
- list-style: none;
139
- margin-bottom: 30px;
140
- }
141
-
142
- .plan-features li {
143
- padding: 12px 0;
144
- border-bottom: 1px solid rgba(255,255,255,0.05);
145
- display: flex;
146
- align-items: center;
147
- gap: 12px;
148
- font-size: 14px;
149
- }
150
-
151
- .plan-features li:last-child {
152
- border-bottom: none;
153
- }
154
-
155
- .check {
156
- color: #00ff9c;
157
- font-size: 18px;
158
- }
159
-
160
- .cta-button {
161
- width: 100%;
162
- padding: 16px;
163
- border: none;
164
- border-radius: 10px;
165
- font-size: 16px;
166
- font-weight: 700;
167
- cursor: pointer;
168
- transition: all 0.3s ease;
169
- letter-spacing: 0.06em;
170
- }
171
-
172
- .cta-button.primary {
173
- background: linear-gradient(135deg, #00ff9c, #00cc6a);
174
- color: #002110;
175
- box-shadow: 0 8px 24px rgba(0,255,156,0.3);
176
- }
177
-
178
- .cta-button.primary:hover {
179
- transform: translateY(-2px);
180
- box-shadow: 0 12px 32px rgba(0,255,156,0.4);
181
- }
182
-
183
- .cta-button.secondary {
184
- background: rgba(255,255,255,0.05);
185
- color: #00ff9c;
186
- border: 1px solid rgba(0,255,156,0.3);
187
- }
188
-
189
- .cta-button.secondary:hover {
190
- background: rgba(0,255,156,0.1);
191
- }
192
-
193
- /* Enterprise Section */
194
- .enterprise-section {
195
- background: rgba(0,255,156,0.05);
196
- border: 1px solid rgba(0,255,156,0.2);
197
- border-radius: 16px;
198
- padding: 50px;
199
- text-align: center;
200
- margin-bottom: 60px;
201
- }
202
-
203
- .enterprise-section h2 {
204
- font-size: 36px;
205
- margin-bottom: 16px;
206
- color: #00ff9c;
207
- }
208
-
209
- .enterprise-section p {
210
- font-size: 18px;
211
- color: rgba(255,255,255,0.6);
212
- margin-bottom: 30px;
213
- max-width: 700px;
214
- margin-left: auto;
215
- margin-right: auto;
216
- }
217
-
218
- .enterprise-features {
219
- display: grid;
220
- grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
221
- gap: 20px;
222
- margin-bottom: 40px;
223
- }
224
-
225
- .enterprise-feature {
226
- background: rgba(255,255,255,0.03);
227
- padding: 20px;
228
- border-radius: 10px;
229
- border: 1px solid rgba(255,255,255,0.1);
230
- }
231
-
232
- .enterprise-feature h3 {
233
- font-size: 18px;
234
- margin-bottom: 8px;
235
- color: #00ff9c;
236
- }
237
-
238
- .enterprise-feature p {
239
- font-size: 14px;
240
- color: rgba(255,255,255,0.5);
241
- margin: 0;
242
- }
243
-
244
- /* FAQ */
245
- .faq-section {
246
- max-width: 800px;
247
- margin: 0 auto;
248
- }
249
-
250
- .faq-section h2 {
251
- text-align: center;
252
- font-size: 36px;
253
- margin-bottom: 40px;
254
- color: #00ff9c;
255
- }
256
-
257
- .faq-item {
258
- background: rgba(255,255,255,0.03);
259
- border: 1px solid rgba(255,255,255,0.1);
260
- border-radius: 10px;
261
- padding: 24px;
262
- margin-bottom: 16px;
263
- }
264
-
265
- .faq-question {
266
- font-size: 18px;
267
- font-weight: 600;
268
- margin-bottom: 12px;
269
- color: #00ff9c;
270
- }
271
-
272
- .faq-answer {
273
- font-size: 15px;
274
- line-height: 1.6;
275
- color: rgba(255,255,255,0.6);
276
- }
277
-
278
- /* Footer */
279
- .footer {
280
- text-align: center;
281
- margin-top: 80px;
282
- padding-top: 40px;
283
- border-top: 1px solid rgba(255,255,255,0.1);
284
- }
285
-
286
- .footer-links {
287
- display: flex;
288
- justify-content: center;
289
- gap: 30px;
290
- margin-bottom: 20px;
291
- }
292
-
293
- .footer-links a {
294
- color: rgba(0,255,156,0.6);
295
- text-decoration: none;
296
- font-size: 14px;
297
- transition: color 0.3s;
298
- }
299
-
300
- .footer-links a:hover {
301
- color: #00ff9c;
302
- }
303
-
304
- .demo-badge {
305
- display: inline-block;
306
- background: rgba(255,170,0,0.1);
307
- border: 1px solid rgba(255,170,0,0.3);
308
- color: #ffaa00;
309
- padding: 8px 16px;
310
- border-radius: 20px;
311
- font-size: 12px;
312
- font-weight: 700;
313
- letter-spacing: 0.08em;
314
- margin-top: 20px;
315
- }
316
- </style>
317
- </head>
318
- <body>
319
- <div class="container">
320
- <!-- Header -->
321
- <div class="header">
322
- <div class="logo">
323
- <div class="logo-dot"></div>
324
- <a href="/" style="text-decoration: none; color: inherit;">AUTHRIX AI</a>
325
- </div>
326
- <h1>Choose Your Plan</h1>
327
- <p class="subtitle">Protect yourself from deepfakes with AI-powered detection. Start free, upgrade anytime.</p>
328
- </div>
329
-
330
- <!-- Pricing Cards -->
331
- <div class="pricing-grid">
332
- <!-- Free -->
333
- <div class="pricing-card">
334
- <div class="plan-name">Free</div>
335
- <div class="plan-price">$0<span>/mo</span></div>
336
- <div class="plan-interval">Perfect for trying out</div>
337
- <ul class="plan-features">
338
- <li><span class="check">✓</span> 10 video analyses/month</li>
339
- <li><span class="check">✓</span> Browser extension</li>
340
- <li><span class="check">✓</span> Max 2-minute videos</li>
341
- <li><span class="check">✓</span> Community support</li>
342
- </ul>
343
- <button class="cta-button secondary" onclick="showDemo('free')">Get Started Free</button>
344
- </div>
345
-
346
- <!-- Pro -->
347
- <div class="pricing-card popular">
348
- <div class="popular-badge">MOST POPULAR</div>
349
- <div class="plan-name">Pro</div>
350
- <div class="plan-price">$9.99<span>/mo</span></div>
351
- <div class="plan-interval">For individuals & creators</div>
352
- <ul class="plan-features">
353
- <li><span class="check">✓</span> 100 analyses/month</li>
354
- <li><span class="check">✓</span> Up to 10-minute videos</li>
355
- <li><span class="check">✓</span> API access (100 calls/mo)</li>
356
- <li><span class="check">✓</span> Priority processing</li>
357
- <li><span class="check">✓</span> Email support</li>
358
- <li><span class="check">✓</span> Batch upload</li>
359
- </ul>
360
- <button class="cta-button primary" onclick="showDemo('pro')">Subscribe to Pro</button>
361
- </div>
362
-
363
- <!-- Business -->
364
- <div class="pricing-card">
365
- <div class="plan-name">Business</div>
366
- <div class="plan-price">$49<span>/mo</span></div>
367
- <div class="plan-interval">For teams & organizations</div>
368
- <ul class="plan-features">
369
- <li><span class="check">✓</span> 1,000 analyses/month</li>
370
- <li><span class="check">✓</span> Unlimited video length</li>
371
- <li><span class="check">✓</span> API access (5K calls/mo)</li>
372
- <li><span class="check">✓</span> White-label reports</li>
373
- <li><span class="check">✓</span> Slack/Teams integration</li>
374
- <li><span class="check">✓</span> Priority support</li>
375
- <li><span class="check">✓</span> Custom branding</li>
376
- </ul>
377
- <button class="cta-button primary" onclick="showDemo('business')">Subscribe to Business</button>
378
- </div>
379
- </div>
380
-
381
- <!-- Enterprise Section -->
382
- <div class="enterprise-section">
383
- <h2>Enterprise Solutions</h2>
384
- <p>Custom solutions for large organizations, social media platforms, and government agencies</p>
385
-
386
- <div class="enterprise-features">
387
- <div class="enterprise-feature">
388
- <h3>🏢 On-Premise Deployment</h3>
389
- <p>Deploy Authrix on your own infrastructure for maximum security</p>
390
- </div>
391
- <div class="enterprise-feature">
392
- <h3>🎯 Custom Model Training</h3>
393
- <p>Train models on your specific content and use cases</p>
394
- </div>
395
- <div class="enterprise-feature">
396
- <h3>⚡ Unlimited Analyses</h3>
397
- <p>No limits on video analyses or API calls</p>
398
- </div>
399
- <div class="enterprise-feature">
400
- <h3>🛡️ SLA Guarantees</h3>
401
- <p>99.9% uptime with dedicated support team</p>
402
- </div>
403
- </div>
404
-
405
- <button class="cta-button primary" onclick="showDemo('enterprise')" style="max-width: 300px; margin: 0 auto;">Contact Sales</button>
406
- </div>
407
-
408
- <!-- FAQ -->
409
- <div class="faq-section">
410
- <h2>Frequently Asked Questions</h2>
411
-
412
- <div class="faq-item">
413
- <div class="faq-question">How accurate is Authrix?</div>
414
- <div class="faq-answer">Authrix uses an ensemble of state-of-the-art ViT models achieving 99%+ accuracy on benchmark datasets. We combine visual analysis with audio detection for comprehensive deepfake identification.</div>
415
- </div>
416
-
417
- <div class="faq-item">
418
- <div class="faq-question">Can I cancel anytime?</div>
419
- <div class="faq-answer">Yes! All subscriptions are month-to-month with no long-term commitment. Cancel anytime from your account dashboard.</div>
420
- </div>
421
-
422
- <div class="faq-item">
423
- <div class="faq-question">What video formats are supported?</div>
424
- <div class="faq-answer">We support MP4, AVI, MOV, MKV, WebM, and WMV formats. Maximum file size is 100MB for Pro tier, unlimited for Business and Enterprise.</div>
425
- </div>
426
-
427
- <div class="faq-item">
428
- <div class="faq-question">Is my data secure?</div>
429
- <div class="faq-answer">Absolutely. All videos are analyzed locally and deleted immediately after processing. We never store your content or share it with third parties.</div>
430
- </div>
431
-
432
- <div class="faq-item">
433
- <div class="faq-question">Do you offer refunds?</div>
434
- <div class="faq-answer">Yes, we offer a 30-day money-back guarantee. If you're not satisfied, contact support for a full refund.</div>
435
- </div>
436
- </div>
437
-
438
- <!-- Footer -->
439
- <div class="footer">
440
- <div class="footer-links">
441
- <a href="/">Home</a>
442
- <a href="/pricing.html">Pricing</a>
443
- <a href="https://docs.authrix.ai">API Docs</a>
444
- <a href="mailto:support@authrix.ai">Support</a>
445
- <a href="/terms.html">Terms</a>
446
- <a href="/privacy.html">Privacy</a>
447
- </div>
448
- <p style="color: rgba(255,255,255,0.3); font-size: 14px;">
449
- © 2026 Authrix AI. All rights reserved.
450
- </p>
451
- </div>
452
- </div>
453
-
454
- <script>
455
- function showDemo(plan) {
456
- const messages = {
457
- free: 'Free tier selected! In production, this would redirect to signup.',
458
- pro: 'Pro plan selected ($9.99/mo)! In production, this would open Stripe checkout.',
459
- business: 'Business plan selected ($49/mo)! In production, this would open Stripe checkout.',
460
- enterprise: 'Enterprise inquiry! In production, this would open a contact form or schedule a demo call.'
461
- };
462
-
463
- alert(messages[plan] + '\n\n💡 This is a demo. Payment integration will be added in production.');
464
-
465
- // In production, this would be:
466
- // window.location.href = `/checkout?plan=${plan}`;
467
- }
468
- </script>
469
- </body>
470
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
frontend-vanilla/script.js DELETED
@@ -1,354 +0,0 @@
1
- /**
2
- * Deepfake Authenticator — Frontend Logic (Cinematic Dark UI)
3
- */
4
-
5
- const API_BASE = (window.location.protocol === 'file:')
6
- ? 'http://localhost:8000'
7
- : window.location.origin;
8
-
9
- let selectedFile = null;
10
-
11
- // ── Boot ──────────────────────────────────────
12
- window.addEventListener('load', () => {
13
- initUpload();
14
- });
15
-
16
- // ── Upload wiring ─────────────────────────────
17
- function initUpload() {
18
- const zone = document.getElementById('dropZone');
19
- const input = document.getElementById('fileInput');
20
- const clear = document.getElementById('clearBtn');
21
- const btn = document.getElementById('analyzeBtn');
22
-
23
- zone.addEventListener('click', e => {
24
- if (!e.target.closest('#clearBtn')) input.click();
25
- });
26
-
27
- input.addEventListener('change', () => {
28
- if (input.files?.[0]) applyFile(input.files[0]);
29
- });
30
-
31
- clear.addEventListener('click', e => {
32
- e.stopPropagation();
33
- clearFile();
34
- });
35
-
36
- zone.addEventListener('dragover', e => {
37
- e.preventDefault(); e.stopPropagation();
38
- zone.classList.add('drag-over');
39
- });
40
-
41
- zone.addEventListener('dragleave', e => {
42
- e.preventDefault();
43
- zone.classList.remove('drag-over');
44
- });
45
-
46
- zone.addEventListener('drop', e => {
47
- e.preventDefault(); e.stopPropagation();
48
- zone.classList.remove('drag-over');
49
- const f = e.dataTransfer.files[0];
50
- if (f?.type.startsWith('video/')) applyFile(f);
51
- else showError('Please drop a valid video file (MP4, AVI, MOV, MKV, WebM).');
52
- });
53
-
54
- btn.addEventListener('click', analyzeVideo);
55
- }
56
-
57
- function applyFile(file) {
58
- selectedFile = file;
59
- document.getElementById('uploadPrompt').classList.add('hidden');
60
- const fc = document.getElementById('fileChosen');
61
- fc.classList.remove('hidden');
62
- document.getElementById('chosenName').textContent = file.name;
63
- document.getElementById('chosenSize').textContent = fmtBytes(file.size);
64
- const btn = document.getElementById('analyzeBtn');
65
- btn.disabled = false;
66
- btn.classList.add('active');
67
- }
68
-
69
- function clearFile() {
70
- selectedFile = null;
71
- document.getElementById('fileInput').value = '';
72
- document.getElementById('fileChosen').classList.add('hidden');
73
- document.getElementById('uploadPrompt').classList.remove('hidden');
74
- const btn = document.getElementById('analyzeBtn');
75
- btn.disabled = true;
76
- btn.classList.remove('active');
77
- }
78
-
79
- function resetAll() {
80
- clearFile();
81
- ['loadingSection', 'resultSection', 'errorSection'].forEach(hide);
82
- show('uploadSection');
83
- }
84
-
85
- // ── Analyze ───────────────────────────────────
86
- async function analyzeVideo() {
87
- if (!selectedFile) return;
88
-
89
- hide('uploadSection');
90
- show('loadingSection');
91
- ['resultSection', 'errorSection'].forEach(hide);
92
-
93
- startAgentAnim();
94
-
95
- const fd = new FormData();
96
- fd.append('file', selectedFile);
97
-
98
- try {
99
- const res = await fetch(`${API_BASE}/analyze`, { method: 'POST', body: fd });
100
- if (!res.ok) {
101
- const e = await res.json().catch(() => ({}));
102
- throw new Error(e.detail || `Server error ${res.status}`);
103
- }
104
- const data = await res.json();
105
- renderResult(data);
106
- } catch (err) {
107
- showError(err.message || 'Connection to analysis engine failed.');
108
- } finally {
109
- hide('loadingSection');
110
- stopAgentAnim();
111
- }
112
- }
113
-
114
- // ── Loading Animation ─────────────────────────
115
- let _simTimer = null;
116
- let _agentTimer = null;
117
-
118
- function startAgentAnim() {
119
- const statusEl = document.getElementById('loadingStatus');
120
- const progBar = document.getElementById('progressBar');
121
-
122
- const phases = [
123
- { p: 12, msg: 'Extracting keyframes...', ag: 0 },
124
- { p: 35, msg: 'Isolating facial regions...', ag: 1 },
125
- { p: 65, msg: 'Running ViT neural inference...', ag: 2 },
126
- { p: 85, msg: 'Cross-referencing metadata...', ag: 2 },
127
- { p: 95, msg: 'Compiling authenticity report...', ag: 3 },
128
- ];
129
-
130
- // Reset agents
131
- [0,1,2,3].forEach(i => {
132
- const card = document.getElementById('ag' + i);
133
- if (card) card.classList.remove('active');
134
- });
135
-
136
- statusEl.textContent = 'Initializing sequence...';
137
- progBar.style.width = '0%';
138
-
139
- let idx = 0;
140
- _simTimer = setInterval(() => {
141
- if (idx < phases.length) {
142
- const ph = phases[idx];
143
- statusEl.textContent = ph.msg;
144
- progBar.style.width = ph.p + '%';
145
- const card = document.getElementById('ag' + ph.ag);
146
- if (card) card.classList.add('active');
147
- idx++;
148
- }
149
- }, 1100);
150
- }
151
-
152
- function stopAgentAnim() {
153
- if (_simTimer) { clearInterval(_simTimer); _simTimer = null; }
154
- document.getElementById('progressBar').style.width = '100%';
155
- [0,1,2,3].forEach(i => {
156
- const card = document.getElementById('ag' + i);
157
- if (card) card.classList.add('active');
158
- });
159
- }
160
-
161
- // ── Render Result ───────────���─────────────────
162
- function renderResult(data) {
163
- const isFake = data.result === 'FAKE';
164
- const pct = data.confidence;
165
-
166
- // Verdict card border glow
167
- const vc = document.getElementById('verdictCard');
168
- vc.style.borderColor = isFake ? 'rgba(255,51,85,0.5)' : 'rgba(0,255,136,0.5)';
169
- vc.style.boxShadow = isFake
170
- ? '0 0 50px rgba(255,51,85,0.15), inset 0 0 30px rgba(255,51,85,0.05)'
171
- : '0 0 50px rgba(0,255,136,0.15), inset 0 0 30px rgba(0,255,136,0.05)';
172
-
173
- // Badge
174
- const badge = document.getElementById('verdictBadge');
175
- badge.className = 'verdict-badge ' + (isFake ? 'fake' : 'real');
176
- badge.style.background = isFake ? 'rgba(255,51,85,0.08)' : 'rgba(0,255,136,0.08)';
177
-
178
- // Emoji
179
- document.getElementById('verdictEmoji').textContent = isFake ? '⚠' : '✓';
180
-
181
- // Label
182
- const lbl = document.getElementById('verdictLabel');
183
- lbl.textContent = isFake ? 'DEEPFAKE' : 'AUTHENTIC';
184
- lbl.style.color = isFake ? '#ff3355' : '#00ff88';
185
- lbl.style.textShadow = isFake
186
- ? '0 0 20px rgba(255,51,85,0.7)'
187
- : '0 0 20px rgba(0,255,136,0.7)';
188
- if (isFake) lbl.classList.add('glitch-text');
189
- else lbl.classList.remove('glitch-text');
190
-
191
- // Confidence value
192
- const cv = document.getElementById('confValue');
193
- cv.textContent = pct + '%';
194
- cv.style.color = isFake ? '#ff3355' : '#00ff88';
195
-
196
- // Confidence bar
197
- const bar = document.getElementById('confBar');
198
- bar.className = 'conf-fill ' + (isFake ? 'fake' : 'real');
199
- setTimeout(() => { bar.style.width = pct + '%'; }, 80);
200
-
201
- // Risk needle
202
- const needle = document.getElementById('riskNeedle');
203
- const riskLbl = document.getElementById('riskLabel');
204
- if (pct < 35) {
205
- needle.textContent = 'LOW RISK';
206
- needle.style.color = '#00ff88';
207
- needle.style.borderColor = 'rgba(0,255,136,0.35)';
208
- needle.style.background = 'rgba(0,255,136,0.08)';
209
- if (riskLbl) riskLbl.textContent = 'Minimal manipulation indicators detected';
210
- } else if (pct < 65) {
211
- needle.textContent = 'MEDIUM RISK';
212
- needle.style.color = '#ffaa00';
213
- needle.style.borderColor = 'rgba(255,170,0,0.35)';
214
- needle.style.background = 'rgba(255,170,0,0.08)';
215
- if (riskLbl) riskLbl.textContent = 'Moderate anomalies detected — review advised';
216
- } else {
217
- needle.textContent = 'CRITICAL RISK';
218
- needle.style.color = '#ff3355';
219
- needle.style.borderColor = 'rgba(255,51,85,0.35)';
220
- needle.style.background = 'rgba(255,51,85,0.08)';
221
- if (riskLbl) riskLbl.textContent = 'High-confidence manipulation signatures found';
222
- }
223
-
224
- // Insights
225
- const dl = document.getElementById('detailsList');
226
- dl.innerHTML = '';
227
- const details = data.details || ['Analysis completed successfully.'];
228
- const dotColor = isFake ? '#ff3355' : '#00ff88';
229
- const dotGlow = isFake ? 'rgba(255,51,85,0.6)' : 'rgba(0,255,136,0.6)';
230
- details.forEach((txt, i) => {
231
- const div = document.createElement('div');
232
- div.className = 'insight-item';
233
- div.style.animationDelay = (i * 0.08) + 's';
234
- div.style.borderLeftColor = dotColor;
235
- div.style.borderLeft = `2px solid ${dotColor}`;
236
- div.innerHTML = `<span class="insight-dot" style="background:${dotColor};box-shadow:0 0 8px ${dotGlow};"></span><span>${esc(txt)}</span>`;
237
- dl.appendChild(div);
238
- });
239
-
240
- // Metadata
241
- const meta = data.metadata || {};
242
- const mg = document.getElementById('metaGrid');
243
- mg.innerHTML = '';
244
- const metaItems = [
245
- ['Frames Analyzed', meta.frames_analyzed ?? '—'],
246
- ['Duration', meta.video_duration_sec ? meta.video_duration_sec + 's' : '—'],
247
- ['FPS', meta.video_fps ?? '—'],
248
- ['Resolution', meta.resolution ?? '—'],
249
- ['Processing Time', data.processing_time_sec ? data.processing_time_sec + 's' : '—'],
250
- ];
251
- metaItems.forEach(([k, v]) => {
252
- const row = document.createElement('div');
253
- row.className = 'meta-row';
254
- row.innerHTML = `<span style="font-size:11px;color:var(--muted);letter-spacing:0.08em;">${k}</span><span style="font-size:13px;font-weight:600;color:#fff;font-family:'JetBrains Mono',monospace;">${v}</span>`;
255
- mg.appendChild(row);
256
- });
257
-
258
- // Frame timeline
259
- renderTimeline(data, isFake);
260
-
261
- show('resultSection');
262
- }
263
-
264
- function renderTimeline(data, isFake) {
265
- const chart = document.getElementById('timelineChart');
266
- if (!chart) return;
267
- chart.innerHTML = '';
268
-
269
- const frames = data.frame_scores || [];
270
- if (!frames.length) {
271
- chart.innerHTML = '<span style="font-size:11px;color:var(--muted);font-family:\'JetBrains Mono\',monospace;margin:auto;">No per-frame data available</span>';
272
- return;
273
- }
274
-
275
- const maxH = 60; // px
276
- const barColor = isFake ? '#ff3355' : '#00ff88';
277
- const barGlow = isFake ? 'rgba(255,51,85,0.5)' : 'rgba(0,255,136,0.5)';
278
-
279
- frames.forEach((score, i) => {
280
- const pct = Math.round(score * 100);
281
- const h = Math.max(4, Math.round((score) * maxH));
282
-
283
- const wrap = document.createElement('div');
284
- wrap.className = 'bar-wrap';
285
- wrap.style.height = maxH + 'px';
286
-
287
- const outer = document.createElement('div');
288
- outer.className = 'bar-outer';
289
- outer.style.height = maxH + 'px';
290
-
291
- const inner = document.createElement('div');
292
- inner.className = 'bar-inner';
293
- inner.style.height = '0px';
294
- inner.style.background = score > 0.5
295
- ? `linear-gradient(to top, ${barColor}, rgba(255,255,255,0.3))`
296
- : 'rgba(255,255,255,0.12)';
297
- if (score > 0.5) inner.style.boxShadow = `0 0 8px ${barGlow}`;
298
-
299
- outer.appendChild(inner);
300
-
301
- const tip = document.createElement('div');
302
- tip.className = 'bar-tooltip';
303
- tip.textContent = `F${i+1}: ${pct}%`;
304
-
305
- wrap.appendChild(outer);
306
- wrap.appendChild(tip);
307
- chart.appendChild(wrap);
308
-
309
- // Animate in
310
- setTimeout(() => { inner.style.height = h + 'px'; }, 50 + i * 20);
311
- });
312
-
313
- // Threshold line at 50%
314
- const line = document.createElement('div');
315
- line.style.cssText = `position:absolute;left:0;right:0;bottom:${maxH*0.5}px;height:1px;background:rgba(255,170,0,0.4);pointer-events:none;`;
316
- const lineLbl = document.createElement('span');
317
- lineLbl.style.cssText = 'position:absolute;right:4px;top:-14px;font-size:9px;color:#ffaa00;font-family:\'JetBrains Mono\',monospace;letter-spacing:0.1em;';
318
- lineLbl.textContent = '50%';
319
- line.appendChild(lineLbl);
320
- chart.appendChild(line);
321
- }
322
-
323
- // ── Helpers ───────────────────────────────────
324
- function show(id) {
325
- const el = document.getElementById(id);
326
- if (!el) return;
327
- el.classList.remove('hidden');
328
- if (el.style.display === 'none') el.style.display = '';
329
- }
330
-
331
- function hide(id) {
332
- const el = document.getElementById(id);
333
- if (el) el.classList.add('hidden');
334
- }
335
-
336
- function fmtBytes(b) {
337
- if (b < 1024) return b + ' B';
338
- if (b < 1048576) return (b / 1024).toFixed(1) + ' KB';
339
- return (b / 1048576).toFixed(1) + ' MB';
340
- }
341
-
342
- function esc(s) {
343
- return String(s)
344
- .replace(/&/g, '&amp;')
345
- .replace(/</g, '&lt;')
346
- .replace(/>/g, '&gt;');
347
- }
348
-
349
- function showError(msg) {
350
- hide('uploadSection');
351
- hide('loadingSection');
352
- document.getElementById('errorMsg').textContent = msg;
353
- show('errorSection');
354
- }