{"repo": "abhix77753/omega", "files": {"script.js": {"e1e6dec1f77ca9ba6ab95e5785d6f6d8671557e0": {"t": 1785768941.4964619, "n": 3513, "h": "ef3eb68e4e13bbfa", "c": "import { auth, createUserWithEmailAndPassword, signInWithEmailAndPassword, signOut } from \"./firebase-config.js\";\n\nconst homeScreen=document.getElementById(\"homeScreen\");\nconst chatScreen=document.getElementById(\"chatScreen\");\nconst videoScreen=document.getElementById(\"videoScreen\");\nconst chatbotRing=document.getElementById(\"chatbotRing\");\nconst authModal=document.getElementById(\"authModal\");\nconst settingsModal=document.getElementById(\"settingsModal\");\n\ndocument.getElementById(\"textBtn\").addEventListener(\"click\",()=>{homeScreen.classList.add(\"hidden\");chatScreen.classList.remove(\"hidden\");});\ndocument.getElementById(\"videoBtn\").addEventListener(\"click\",()=>{homeScreen.classList.add(\"hidden\");videoScreen.classList.remove(\"hidden\");startVideo();});\nchatbotRing.addEventListener(\"click\",()=>{aiPopup.classList.remove(\"hidden\");});\n\ndocument.getElementById(\"signupBtn\").addEventListener(\"click\",()=>{\n const email=document.getElementById(\"authEmail\").value;\n const password=document.getElementById(\"authPassword\").value;\n createUserWithEmailAndPassword(auth,email,password)\n .then(user=>alert(\"Signup success!\"))\n .catch(err=>alert(err.message));\n});\n\ndocument.getElementById(\"loginBtn\").addEventListener(\"click\",()=>{\n const email=document.getElementById(\"authEmail\").value;\n const password=document.getElementById(\"authPassword\").value;\n signInWithEmailAndPassword(auth,email,password)\n .then(user=>alert(\"Login success!\"))\n .catch(err=>alert(err.message));\n});\n\ndocument.getElementById(\"logoutBtn\").addEventListener(\"click\",()=>signOut(auth).then(()=>alert(\"Logged out!\")));\n\nfunction startVideo(){\n navigator.mediaDevices.getUserMedia({video:true,audio:true})\n .then(stream=>{document.getElementById(\"localVideo\").srcObject=stream;})\n .catch(err=>alert(\"Video access denied: \"+err));\n}\n\ndocument.getElementById(\"settingsBtn\").addEventListener(\"click\",()=>settingsModal.classList.toggle(\"hidden\"));\ndocument.getElementById(\"darkThemeBtn\").addEventListener(\"click\",()=>document.body.style.background=\"#111\");\ndocument.getElementById(\"lightThemeBtn\").addEventListener(\"click\",()=>document.body.style.background=\"#f0f0f0\");\n\n// AI Chatbot\nconst aiPopup=document.getElementById(\"aiChatPopup\");\nconst aiChatWindow=document.getElementById(\"aiChatWindow\");\nconst aiInput=document.getElementById(\"aiInput\");\nconst aiSendBtn=document.getElementById(\"aiSendBtn\");\nconst closeAiPopup=document.getElementById(\"closeAiPopup\");\n\ncloseAiPopup.addEventListener(\"click\",()=>aiPopup.classList.add(\"hidden\"));\n\naiSendBtn.addEventListener(\"click\", async ()=>{\n const message=aiInput.value.trim();\n if(!message) return;\n appendMessage(\"You\",message);\n aiInput.value=\"\";\n const response=await fetch(\"https://api.openai.com/v1/responses\",{\n method:\"POST\",\n headers:{\n \"Content-Type\":\"application/json\",\n \"Authorization\":\"Bearer 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\"\n },\n body:JSON.stringify({model:\"gpt-4.1-mini\", input:message})\n });\n const data=await response.json();\n const aiText=data.output[0].content[0].text||\"I didn't understand that.\";\n appendMessage(\"My Omega AI\", aiText);\n});\n\nfunction appendMessage(sender,text){\n const msg=document.createElement(\"div\");\n msg.innerHTML=`${sender}: ${text}`;\n msg.style.margin=\"5px 0\";\n aiChatWindow.appendChild(msg);\n aiChatWindow.scrollTop=aiChatWindow.scrollHeight;\n}"}}}}