const fs = require('fs');
const path = require('path');
const projectDir = 'd:/Vedhanth/studies/Coding/Hackathon/GDG/axiom-frontend/src';
function replaceInFile(filePath, replacements) {
const fullPath = path.join(projectDir, filePath);
if (!fs.existsSync(fullPath)) return;
let content = fs.readFileSync(fullPath, 'utf8');
for (const [search, replace] of replacements) {
if (typeof search === 'string') {
content = content.split(search).join(replace);
} else {
content = content.replace(search, replace);
}
}
fs.writeFileSync(fullPath, content);
}
replaceInFile('components/BiasTopologyMap.tsx', [
['critical: "#ef4444",
['high: "#f97316",
['moderate: "#eab308",
['low: "#22c55e",
['none: "#6b7280"
[` if (severity === "critical") {
material.emissiveIntensity = 0.4 + Math.sin(state.clock.elapsedTime * 3 + x) * 0.3;
} else if (hovered) {
material.emissiveIntensity = 0.8;
} else {
material.emissiveIntensity = 0;
}`, ` if (hovered) {
material.emissiveIntensity = 0.15;
} else {
material.emissiveIntensity = 0;
}`],
['metalness={0.2}', 'metalness={0.0}'],
['roughness={0.4}', 'roughness={0.85}'],
['opacity={hovered ? 0.4 : 0.1}', 'opacity={hovered ? 0.12 : 0.04}'],
['', ''],
['', ''],
['', ''],
['', ''],
['', ''],
['', ''],
['', ''],
['camera={{ position: [15, 12, 15], fov: 45 }}', 'camera={{ position: [10, 8, 10], fov: 45 }}'],
['autoRotateSpeed={0.8}', 'autoRotateSpeed={0.3}'],
['
Bias Topology Map
', 'Bias Topology Map
'],
['', '
'],
['
', '
'],
['className="text-gray-300 text-xs uppercase tracking-wider"', 'className="font-mono text-[9px] tracking-[0.12em] uppercase" style={{color:"#A0A0A0"}}'],
['className="w-3 h-3 rounded-full shadow-[0_0_8px_currentColor]"', 'className="w-3 h-3 rounded-full"'],
['className="absolute z-20 glass-panel p-4 rounded-xl pointer-events-none transition-opacity"', 'className="absolute z-20 p-4 rounded-xl pointer-events-none transition-opacity" style={{background:"#111111", border:"1px solid #222222"}}'],
['
{tooltip.attribute}
', '
{tooltip.attribute}
'],
['
{tooltip.group}
', '
{tooltip.group}
'],
['className="font-mono text-purple-400"', 'className="font-mono text-iris"'],
['
Peaks indicate severe bias.', '
Peaks indicate severe bias.']
]);
replaceInFile('components/VerdictDashboard.tsx', [
[`const getSeverityColor = (sev: string) => {
switch (sev) {
case 'critical': return 'text-red-400';
case 'high': return 'text-orange-400';
case 'moderate': return 'text-yellow-400';
case 'low': return 'text-green-400';
default: return 'text-gray-400';
}
};`, `const getSeverityColor = (sev: string) => {
switch (sev) {
case 'critical': return 'text-rose';
case 'high': return 'text-sand';
case 'moderate': return 'text-periwinkle';
case 'low': return 'text-mint';
default: return 'text-text-4';
}
};`],
[`const getSeverityBg = (sev: string) => {
switch (sev) {
case 'critical': return 'bg-red-500/10 border-red-500/30';
case 'high': return 'bg-orange-500/10 border-orange-500/30';
case 'moderate': return 'bg-yellow-500/10 border-yellow-500/30';
case 'low': return 'bg-green-500/10 border-green-500/30';
default: return 'bg-white/5 border-white/10';
}
};`, `const getSeverityBg = (sev: string) => {
switch (sev) {
case 'critical': return 'bg-[#0F0608] border-rose/15';
case 'high': return 'bg-[#0F0A04] border-sand/15';
case 'moderate': return 'bg-[#060A0F] border-periwinkle/15';
case 'low': return 'bg-[#040F08] border-mint/15';
default: return 'bg-axiom-surface border-axiom-border';
}
};`],
['
Audit Results
', '
Audit Results
'],
['
', '
'],
['bg-white/10 hover:bg-white/20 border-white/20', 'bg-transparent border-axiom-border-2 text-text-3 hover:border-axiom-border-3 hover:text-text-2'],
['', ''],
['className={`px-3 py-1 rounded-full border text-xs font-bold uppercase tracking-wider', 'className={`px-3 py-1 rounded-full border font-mono text-[9px] tracking-[0.15em] uppercase'],
['
', '
'],
['
', '
'],
['
', '
'],
['
', '
'],
['contentStyle={{ backgroundColor: \'rgba(0,0,0,0.8)\', borderColor: \'rgba(255,255,255,0.1)\' }}', 'contentStyle={{ backgroundColor: \'#111111\', borderColor: \'#222222\', borderRadius: \'10px\', fontFamily: \'JetBrains Mono\' }}'],
['fill={entry.group === data.disparities[0].reference_group ? "#22c55e" : "#ef4444"}', 'fill={entry.group === data.disparities[0].reference_group ? "var(--theme-iris)" : "var(--theme-rose)"}'],
['className="text-6xl font-bold bg-linear-to-r from-purple-400 to-indigo-400 text-transparent bg-clip-text"', 'className="text-6xl text-text-primary" style={{fontFamily:"\'DM Serif Display\', serif"}}'],
['
', ''],
['className="w-1 h-full bg-linear-to-b from-purple-500 to-transparent mr-4"', 'className="w-1 h-full bg-iris/20 mr-4"'],
['className="text-sm font-bold text-purple-400 uppercase tracking-widest mb-2"', 'className="text-sm font-medium text-iris uppercase tracking-widest mb-2"'],
['', '
'],
['className="text-4xl text-purple-500/20 absolute -top-4 -left-2"', 'className="text-4xl text-iris/6 absolute -top-4 -left-2"']
]);
replaceInFile('components/RemediationLab.tsx', [
['
', ''],
['
', '
'],
['
Recommended Actions
', '
Recommended Actions
'],
[` className={\`p-4 rounded-xl border cursor-pointer transition-colors flex items-start gap-4 \${
selectedFix === fix
? 'bg-purple-900/30 border-purple-500 shadow-[0_0_15px_rgba(168,85,247,0.2)]'
: 'bg-black/20 border-white/10 hover:border-white/30'
}\``, ` className={\`p-4 rounded-xl border cursor-pointer transition-colors flex items-start gap-4 \${
selectedFix === fix
? 'bg-axiom-surface border-iris/25'
: 'bg-transparent border-axiom-surface-2 hover:border-axiom-border-2'
}\``],
['
{fix}
', '
{fix}
'],
['
', '
'],
['
', '
'],
['className="text-xs text-purple-400 flex items-center gap-1 bg-purple-500/10 px-2 py-1 rounded"', 'className="flex items-center gap-1 bg-axiom-surface border border-axiom-border px-2 py-1 rounded text-iris font-mono text-[9px]"'],
['
', '
'],
['className="text-sm font-mono text-gray-400"', 'className="font-mono text-text-4 text-sm"'],
['bg-purple-400', 'bg-iris'],
['bg-purple-500', 'bg-iris'],
['
', '
'],
['', ''],
['className="absolute inset-0 flex items-center justify-center text-gray-600 flex-col gap-4"', 'className="absolute inset-0 flex items-center justify-center text-axiom-border-2 font-mono text-[11px] flex-col gap-4"'],
['', '']
]);