/* eslint-disable */
// @ts-nocheck
import fs from 'fs';

const roomPath = 'C:/X/workspace/jumpa.id/vc/components/xcuRoom.tsx';
let roomContent = fs.readFileSync(roomPath, 'utf-8');

const targetStr = '<div className="relative">\n                  <button onClick={() => setIsMoreMenuOpen(!isMoreMenuOpen)}';

const quantumButton = `<button onClick={handleToggleEngine} className={\`flex flex-col items-center justify-center w-14 h-14 rounded-lg transition-all duration-300 \${videoEngineMode === 'webcodecs' ? 'bg-cyan-900/40 text-cyan-400 border border-cyan-500/50 shadow-[0_0_15px_rgba(34,211,238,0.4)]' : 'hover:bg-slate-800 text-slate-400'}\`}>
                 <div className="relative">
                     <svg className={\`w-6 h-6 mb-1 \${videoEngineMode === 'webcodecs' ? 'animate-pulse' : ''}\`} fill="none" stroke="currentColor" viewBox="0 0 24 24">
                        <path strokeLinecap="round" strokeLinejoin="round" strokeWidth="2" d="M19.428 15.428a2 2 0 00-1.022-.547l-2.387-.477a6 6 0 00-3.86.517l-.318.158a6 6 0 01-3.86.517L6.05 15.21a2 2 0 00-1.806.547M8 4h8l-1 1v5.172a2 2 0 00.586 1.414l5 5c1.26 1.26.367 3.414-1.415 3.414H4.828c-1.782 0-2.674-2.154-1.414-3.414l5-5A2 2 0 009 10.172V5L8 4z"></path>
                     </svg>
                     {videoEngineMode === 'webcodecs' && <div className="absolute inset-0 bg-cyan-400 blur-md rounded-full opacity-40 animate-ping"></div>}
                 </div>
                 <span className="text-[9px] leading-tight text-center font-bold">{videoEngineMode === 'webcodecs' ? 'XCU WebCodecs' : 'Canvas Mode'}</span>
              </button>

              <div className="relative">
                  <button onClick={() => setIsMoreMenuOpen(!isMoreMenuOpen)}`;

if (!roomContent.includes('XCU WebCodecs')) {
    roomContent = roomContent.replace(targetStr, quantumButton);
    fs.writeFileSync(roomPath, roomContent, 'utf-8');
    console.log("Successfully inserted the XCU WebCodecs Button!");
} else {
    console.log("Button already exists.");
}
