PageSourceSearch

https://www.englishexpress.ai/_next/static/chunks/5178.8b5a222b215f17e2.js

js englishexpress.ai collected 2026-10-05 12:16:10 UTC 31,684 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5178],{5178:(e,t,a)=>{a.r(t),a.d(t,{default:()=>m});var s=a(74848),r=a(45703),i=a.n(r),n=a(96540),l=a(86715),o=a(13252),d=a(84961),c=a(33877),u=a(78885);function m(){let e=(0,l.useRouter)(),{topic:t,me:a,room:r}=e.query,[m,x]=(0,n.useState)(null),[h,p]=(0,n.useState)(null),[f,b]=(0,n.useState)(null),[g,j]=(0,n.useState)(!0),[y,w]=(0,n.useState)(""),[v,N]=(0,n.useState)(!1),[k,_]=(0,n.useState)(""),[S,T]=(0,n.useState)(!1),[C,E]=(0,n.useState)(""),[I,O]=(0,n.useState)(!1),[z,A]=(0,n.useState)(null),[P,D]=(0,n.useState)(!1),[F,M]=(0,n.useState)(!1),[R,B]=(0,n.useState)(!1),[L]=(0,n.useState)(()=>Math.floor(1e3+9e3*Math.random())),[J]=(0,n.useState)(()=>String(Date.now())+Math.floor(1e4*Math.random())+"abcd"),U=(0,o.Nt)(),[G,V]=(0,n.useState)(!1),[W,q]=(0,n.useState)(!1),[H,Y]=(0,n.useState)(!1),[$,K]=(0,n.useState)(!1),[Z,Q]=(0,n.useState)(null),[X,ee]=(0,n.useState)(null),[et,ea]=(0,n.useState)(180),[es,er]=(0,n.useState)(!1),ei=(0,n.useRef)(null),en=(0,n.useRef)(!1),[el,eo]=(0,n.useState)(!1),[ed,ec]=(0,n.useState)(!1),{localMicrophoneTrack:eu}=(0,o.QG)(ed);(0,o.ZR)([eu]);let em=(0,o.iT)(),ex="69250cc1f3d94d07b4729ad46fdf15ff",eh="https://backend.englishexpress.ai",[ep,ef]=(0,n.useState)(!1),[eb,eg]=(0,n.useState)("Keep your responses conversational and engaging. Start by a short greeting. Ask questions to encourage the student to speak. Help with vocabulary and grammar when needed, but focus on maintaining a natural conversation flow."),[ej,ey]=(0,n.useState)("alloy"),[ew,ev]=(0,n.use
1State)(!0),[eN,ek]=(0,n.useState)(!1),[e_,eS]=(0,n.useState)(null),[eT,eC]=(0,n.useState)([]),eE=(0,n.useRef)([]),eI=(0,n.useRef)(null),eO=(0,o.iw)();(0,o.o9)({appid:ex,channel:J,token:f,uid:L},F&&R),(0,n.useEffect)(()=>{eE.current=eT},[eT]),(0,n.useEffect)(()=>{eI.current&&eI.current.scrollTo({top:eI.current.scrollHeight,behavior:"smooth"})},[eT]),(0,n.useEffect)(()=>{if(!eO)return;let e={},t=(t,a)=>{try{let t=new TextDecoder().decode(a),r=t.indexOf("|"),i=t.indexOf("|",r+1),n=t.indexOf("|",i+1);if(-1===r||-1===i||-1===n)return;let l=t.slice(0,r),o=parseInt(t.slice(r+1,i)),d=parseInt(t.slice(i+1,n)),c=t.slice(n+1);if(e[l]||(e[l]={total:d,parts:{}}),e[l].parts[o]=c,Object.keys(e[l].parts).length===d){let t="";for(let a=1;a<=d;a++)t+=e[l].parts[a];delete e[l];let a=JSON.parse(atob(t));if("response.audio_transcript.delta"===a.type)eC(e=>{let t=e.findIndex(e=>e.id===a.item_id&&e.is_agent);if(-1!==t){let s=[...e];return s[t]={...s[t],text:s[t].text+a.delta},s}return[...e,{id:a.item_id,text:a.delta||"",is_agent:!0,is_final:!1,timestamp:Date.now()}]});else if("response.audio_transcript.done"===a.type)eC(e=>{let t=e.findIndex(e=>e.id===a.item_id&&e.is_agent);if(-1!==t){let s=[...e];return s[t]={...s[t],text:a.transcript,is_final:!0},s}return[...e,{id:a.item_id,text:a.transcript||"",is_agent:!0,is_final:!0,timestamp:Date.now()}]});else if("conversation.item.input_audio_transcription.completed"===a.type){var s;(null===(s=a.transcript)||void 0===s?void 0:s.trim())&&eC(e=>{let t={id:a.item_id,text:a.transcript,is_agent:!1,is_final:!0,timestamp:Date.now()},s=e.findIndex(e=>e.is_agent&&!e.is_final);if(-1!==s){let a=[...e];return a.splice(s,0,t),a}return[...e,t]})}}}catch(e){console.error("stream-message parse error:",e)}};return eO.on("stream-message",t),()=>eO.off("stream-message",t)},[eO]),(0,n.useEffect)(()=>{a&&(_(a),localStorage.clear(),sessionStorage.clear()),"activity"===r&&a&&N(!0)},[r,a]);let ez=()=>{let e=localStorage.getItem("myuser")||sessionStorage.getItem("myuser"),t=localStorage.getItem("temp_myuser");return e?{...JSON.parse(e),is_temp:!1}:t?{...JSON.parse(t),is_temp:!0}:null},eA=async e=>{O(!0),w("");try{let a=localStorage.getItem("temp_myuser");if(a){let e=JSON.parse(a),s=await fetch("".concat(eh,"/ai-topics/auth/verify/"),{method:"GET",headers:{Authorization:"Bearer ".concat(e.token),"Content-Type":"application/json"}}),r=await s.json();if(r.success&&r.user)return x(r.user),p(e.token),T(!1),await eD(t,e.token),!0}let s=await fetch("".concat(eh,"/ai-topics/create-temp-user/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e.trim()})}),r=await s.json();if(!r.success)return w(r.error||"Failed to create temporary user"),!1;{let e={user:r.user,token:r.token,is_temp:!0};return localStorage.setItem("temp_myuser",JSON.stringify(e)),x(r.user),p(r.token),T(!1),await eD(t,r.token),!0}}catch(e){return w("Failed to create temporary user. Please try again."),!1}finally{O(!1)}},eP=async()=>{try{if(k){await eD(t||"activity",null);return}let e=ez();if(!e||!e.token){j(!1),T(!0);return}let a=await fetch("".concat(eh,"/ai-topics/auth/verify/"),{method:"GET",headers:{Authorization:"Bearer ".concat(e.token),"Content-Type":"application/json"}}),s=await a.json();s.success&&s.user?(x(s.user),p(e.token),await eD(t,e.token)):(e.is_temp||(localStorage.removeItem("myuser"),sessionStorage.removeItem("myuser")),j(!1),T(!0))}catch(e){w("Authentication failed. Please try again."),j(!1)}},eD=async(e,t)=>{try{let a="".concat(eh,"/ai-topics/get-topic/"),s=new URLSearchParams;k?(s.append("me",k),"activity"===r&&s.append("room","activity"),e&&"activity"!==e&&s.append("topic",e)):e&&s.append("topic",e),a+="?".concat(s.toString());let i={"Content-Type":"application/json"};t&&!k&&(i.Authorization="Bearer ".concat(t));let n=await fetch(a,{method:"GET",headers:i}),l=await n.json();if("trial_expired"===l.error_type||l.upgrade_required){eS("trial_expired"),w(l.error||"Your trial has ended. Please upgrade to continue."),j(!1);return}if("topic_not_found"===l.error_type||!l.success&&404===n.status){eS("topic_not_found"),w(l.error||"Topic not found."),j(!1);return}if(!l.success){eS("other"),w(l.error||"Failed to load topic"),j(!1);return}l.success&&(eS(null),A(l.topic),D(l.already_discussed),eg(l.prompt||eb),ey(l.voice||ej),l.user&&(x(l.user),E(l.user.name.split(" ")[0]),localStorage.getItem("phone_auth_completed")===k&&T(!1)),l.token&&p(l.token),l.topic.time_limit_minutes&&ea(60*l.topic.time_limit_minutes),j(!1))}catch(e){eS("other"),w("Failed to load topic information. Please try again later."),j(!1)}},eF=async()=>{try{Y(!0);let e=await eM();if(!e||!e.success)throw Error("Failed to start recording");await eJ(),await eR(e.sid,e.resourceId,e.fileName,e.s3Url)}catch(e){console.error("Setup failed:",e),w("Failed to start discussion. Please try again."),Y(!1),M(!1)}},eM=async()=>{try{let e=await fetch("/api/start-recording",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channelName:J})}),t=await e.json();if(e.ok&&t.success)return K(!0),Q({resourceId:t.resourceId,sid:t.sid}),ee(t.fileName),{success:!0,sid:t.sid,resourceId:t.resourceId,fileName:t.fileName,s3Url:t.s3Url};return{success:!1,error:t.error||"Failed to start recording",details:t.details}}catch(e){return{success:!1,error:e.message}}},eR=async(e,t,a,s)=>{try{var r;let i=h||(null===(r=ez())||void 0===r?void 0:r.token);if(!i)return;await fetch("".concat(eh,"/ai-topics/update-recording/"),{method:"POST",headers:{Authorization:"Bearer ".concat(i),"Content-Type":"application/json"},body:JSON.stringify({topic_id:z.id,recording_id:e,resource_id:t,channel_name:J,predicted_mp4_file:a,s3_url:s,recording_started_at:new Date().toISOString()})})}catch(e){console.error("Backend update error:",e)}},eB=async()=>{try{let e=await fetch("/api/generate-token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channelName:J,uid:L,role:"publisher"})}),t=await e.json();if(t.token)return b(t.token),B(!0),t.token;throw Error("Failed to generate token")}catch(e){return w("Failed to generate voice chat token. Please try again."),null}},eL=async()=>{try{(await navigator.mediaDevices.getUserMedia({audio:!0}
1)).getTracks().forEach(e=>e.stop())}catch(e){ef(!0);return}if(!ex||!J){w("Voice chat configuration is missing.");return}ec(!0),M(!0),er(!0),await eU()},eJ=async()=>{if(!U||!z)throw Error("Not connected or topic data missing");q(!0);try{var e;let t="You are an English language tutor having a conversation with ".concat((null==m?void 0:m.name)||"the student",' about the topic "').concat(z.ai_topic_title,'". \n\n').concat(z.ai_topic_description,"\n\nINSTRUCTIONS:\n").concat(eb);(null===(e=z.followups)||void 0===e?void 0:e.length)>0&&(t+="\n\nCONVERSATION STARTERS (use these naturally in the conversation):\n".concat(z.followups.map(e=>"- ".concat(e)).join("\n"))),z.time_limit_minutes&&(t+="\n\nTIME LIMIT: This discussion should last approximately ".concat(z.time_limit_minutes," minutes."));let a={channel_name:J,uid:Math.floor(8889*Math.random())+1111,language:"en",voice:ej,system_instruction:t};if((await fetch("https://agorasdk.englishexpress.ai/start_agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).ok)V(!0);else throw Error("Failed to connect with AI tutor")}finally{q(!1)}},eU=async()=>{try{var e;let t=h||(null===(e=ez())||void 0===e?void 0:e.token);if(!t)return!1;let a=await fetch("".concat(eh,"/ai-topics/mark-discussed/"),{method:"POST",headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify({topic_id:z.id,channel_name:J,token:t})});return(await a.json()).success}catch(e){return!1}},eG=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!en.current&&(en.current=!0,(null==Z?void 0:Z.sid)&&X&&await eV("completed"),er(!1),ei.current&&clearInterval(ei.current),G&&eW(),M(!1),V(!1),K(!1),Q(null),ee(null),Y(!1),!e)){if(t&&a&&"activity"!==r&&!["free chat","free%20chat","general"].includes(t.toLowerCase())&&(null==Z?void 0:Z.sid)){let e=new URLSearchParams;e.append("session",Z.sid),e.append("me",a),window.location.href="/leaderboard?".concat(e.toString())}else window.location.href="/thankyou"}},eV=async e=>{try{var t;let a=h||(null===(t=ez())||void 0===t?void 0:t.token);if(!a)return;await fetch("".concat(eh,"/ai-topics/update-recording-status/"),{method:"PUT",headers:{Authorization:"Bearer ".concat(a),"Content-Type":"application/json"},body:JSON.stringify({recording_id:Z.sid,topic_id:z.id,recording_status:e,completed_at:new Date().toISOString(),token:a,transcript:eE.current.filter(e=>e.is_final).map(e=>({speaker:e.is_agent?"AI":"User",text:e.text,timestamp:e.timestamp}))})})}catch(e){console.error("Failed to update recording status:",e)}},eW=async()=>{try{await fetch("https://agorasdk.englishexpress.ai/stop_agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel_name:J,uid:123,language:"en",voice:"alloy"})})}catch(e){console.error("Error stopping AI Agent:",e)}},eq=async e=>{if(e.preventDefault(),C.trim()){if(k&&m&&h){localStorage.setItem("phone_auth_completed",k),T(!1);return}await eA(C.trim())}};if((0,n.useEffect)(()=>{(t||k)&&eP()},[t,k]),(0,n.useEffect)(()=>{em.forEach(e=>{e.audioTrack&&e.uid!==L&&e.audioTrack.play()})},[em,L]),(0,n.useEffect)(()=>{F&&!R&&eB().catch(console.error)},[F,R]),(0,n.useEffect)(()=>{!U||$||G||H||eF()},[U]),(0,n.useEffect)(()=>{G&&$&&Y(!1)},[G,$]),(0,n.useEffect)(()=>(es&&et>0?ei.current=setInterval(()=>{ea(e=>e<=1?(clearInterval(ei.current),er(!1),eG(),0):e-1)},1e3):0===et&&(clearInterval(ei.current),er(!1)),()=>{ei.current&&clearInterval(ei.current)}),[es,et]),(0,n.useEffect)(()=>{let e=()=>{U&&!en.current&&eG(!0)};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[U]),(0,n.useEffect)(()=>{if(!$||!(null==Z?void 0:Z.sid))return;let e=setInterval(()=>{var e;let t=h||(null===(e=ez())||void 0===e?void 0:e.token);t&&fetch("".concat(eh,"/ai-topics/heartbeat/"),{method:"POST",headers:{Authorization:"Bearer ".concat(t),"Content-Type":"application/json"},body:JSON.stringify({recording_id:Z.sid,resource_id:Z.resourceId,channel_name:J,transcript:eE.current.filter(e=>e.is_final).map(e=>({speaker:e.is_agent?"AI":"User",text:e.text,timestamp:e.timestamp}))})}).catch(()=>{})},1e4);return()=>clearInterval(e)},[$,Z,h]),(0,n.useEffect)(()=>
1{if(U&&G&&ew){let e=setTimeout(()=>ev(!1),2e4);return()=>clearTimeout(e)}},[U,G,ew]),g)return(0,s.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50",children:(0,s.jsxs)("div",{className:"text-center p-8",children:[(0,s.jsx)("div",{className:"w-16 h-16 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mx-auto mb-6"}),(0,s.jsx)("h2",{className:"text-xl font-medium text-gray-800 mb-2",children:"Loading"}),(0,s.jsx)("p",{className:"text-gray-600",children:"Preparing your AI discussion..."})]})});if("trial_expired"===e_)return(0,s.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50",children:(0,s.jsxs)("div",{className:"max-w-md w-full bg-white p-8 rounded-lg shadow-md",children:[(0,s.jsx)("div",{className:"text-center mb-4",children:(0,s.jsx)("div",{className:"text-6xl mb-2",children:"\uD83D\uDD12"})}),(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-2 text-center",children:"Trial Expired"}),(0,s.jsx)("p",{className:"text-gray-600 mb-6 text-center",children:y}),(0,s.jsx)("button",{onClick:()=>{window.location.href="https://englishexpress.ai/whatsapp-subscription?me=".concat(k)},className:"w-full bg-blue-600 hover:bg-blue-700 text-white py-3 rounded-lg transition duration-200 font-semibold",children:"Upgrade to Pro"})]})});if("topic_not_found"===e_)return(0,s.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50",children:(0,s.jsxs)("div",{className:"max-w-md w-full bg-white p-8 rounded-lg shadow-md",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-2 text-center",children:"Topic Not Found"}),(0,s.jsx)("p",{className:"text-gray-600 mb-6 text-center",children:y}),(0,s.jsx)("button",{onClick:()=>window.location.href="https://wa.me/+918484037551",className:"w-full bg-blue-500 hover:bg-blue-600 text-white py-2.5 rounded-lg transition duration-200",children:"Back to WhatsApp"})]})});if(S&&!v&&!k)return(0,s.jsx)("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50",children:(0,s.jsxs)("div",{className:"bg-white rounded-2xl p-8 w-full max-w-md mx-4 shadow-2xl",children:[(0,s.jsxs)("div",{className:"text-center mb-6",children:[(0,s.jsx)("div",{className:"w-16 h-16 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)(d.CV$,{className:"w-8 h-8 text-blue-600"})}),(0,s.jsx)("h2",{className:"text-2xl font-bold text-gray-800 mb-2",children:"English Express – AI Audio Room"}),(0,s.jsx)("p",{className:"text-gray-600",children:"Enter your name to start practicing English with our AI tutor"})]}),(0,s.jsxs)("form",{onSubmit:eq,className:"space-y-6",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Your Name"}),(0,s.jsx)("input",{type:"text",value:C,onChange:e=>E(e.target.value),placeholder:"Enter your name",className:"w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500",required:!0,disabled:I})]}),y&&(0,s.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg",children:(0,s.jsx)("p",{className:"text-red-600 text-sm",children:y})}),(0,s.jsxs)("div",{className:"flex gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:()=>e.push("/room"),className:"flex-1 px-4 py-3 text-gray-600 bg-gray-100 hover:bg-gray-200 rounded-lg",disabled:I,children:"Back"}),(0,s.jsx)("button",{type:"submit",disabled:!C.trim()||I,className:"flex-1 px-4 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-lg disabled:opacity-50 flex items-center justify-center",children:I?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin mr-2"}),"Setting up..."]}):"Start Chat"})]})]})]})});if(y&&!S){let e=y.includes("trial")||y.includes("upgrade");return(0,s.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50",children:(0,s.jsxs)("div",{className:"max-w-md w-full bg-white p-8 rounded-lg shadow-md",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb
1-2 text-center",children:e?"Trial Expired":"Error"}),(0,s.jsx)("p",{className:"text-gray-600 mb-6 text-center",children:y}),(0,s.jsx)("div",{className:"flex gap-3",children:e?(0,s.jsx)("button",{onClick:()=>{window.location.href="https://englishexpress.ai/whatsapp-subscription?me=".concat(k)},className:"flex-1 bg-blue-600 hover:bg-blue-700 text-white py-2.5 rounded-lg font-semibold",children:"Upgrade to Pro"}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>window.location.href="https://wa.me/+918484037551",className:"flex-1 bg-gray-500 hover:bg-gray-600 text-white py-2.5 rounded-lg",children:"Back to WhatsApp"}),(0,s.jsx)("button",{onClick:()=>{w(""),eP()},className:"flex-1 bg-blue-500 hover:bg-blue-600 text-white py-2.5 rounded-lg",children:"Try Again"})]})})]})})}return z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i(),{id:"d04b237aa006a56d",children:".hide-scrollbar::-webkit-scrollbar{display:none}@-webkit-keyframes pulse-slow{0%,100%{opacity:.4;-webkit-transform:scale(1);transform:scale(1)}50%{opacity:.7;-webkit-transform:scale(1.05);transform:scale(1.05)}}@-moz-keyframes pulse-slow{0%,100%{opacity:.4;-moz-transform:scale(1);transform:scale(1)}50%{opacity:.7;-moz-transform:scale(1.05);transform:scale(1.05)}}@-o-keyframes pulse-slow{0%,100%{opacity:.4;-o-transform:scale(1);transform:scale(1)}50%{opacity:.7;-o-transform:scale(1.05);transform:scale(1.05)}}@keyframes pulse-slow{0%,100%{opacity:.4;-webkit-transform:scale(1);-moz-transform:scale(1);-o-transform:scale(1);transform:scale(1)}50%{opacity:.7;-webkit-transform:scale(1.05);-moz-transform:scale(1.05);-o-transform:scale(1.05);transform:scale(1.05)}}@-webkit-keyframes float{0%,100%{-webkit-transform:translatey(0px);transform:translatey(0px)}50%{-webkit-transform:translatey(-12px);transform:translatey(-12px)}}@-moz-keyframes float{0%,100%{-moz-transform:translatey(0px);transform:translatey(0px)}50%{-moz-transform:translatey(-12px);transform:translatey(-12px)}}@-o-keyframes float{0%,100%{-o-transform:translatey(0px);transform:translatey(0px)}50%{-o-transform:translatey(-12px);transform:translatey(-12px)}}@keyframes float{0%,100%{-webkit-transform:translatey(0px);-moz-transform:translatey(0px);-o-transform:translatey(0px);transform:translatey(0px)}50%{-webkit-transform:translatey(-12px);-moz-transform:translatey(-12px);-o-transform:translatey(-12px);transform:translatey(-12px)}}.animate-pulse-slow{-webkit-animation:pulse-slow 4s ease-in-out infinite;-moz-animation:pulse-slow 4s ease-in-out infinite;-o-animation:pulse-slow 4s ease-in-out infinite;animation:pulse-slow 4s ease-in-out infinite}.animate-float{-webkit-animation:float 3s ease-in-out infinite;-moz-animation:float 3s ease-in-out infinite;-o-animation:float 3s ease-in-out infinite;animation:float 3s ease-in-out infinite}.animation-delay-1000{-webkit-animation-delay:1s;-moz-animation-delay:1s;-o-animation-delay:1s;animation-delay:1s}.animation-delay-2000{-webkit-animation-delay:2s;-moz-animation-delay:2s;-o-animation-delay:2s;animation-delay:2s}"}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d min-h-screen bg-[#0a0b0d] relative overflow-hidden",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d absolute inset-0 overflow-hidden pointer-events-none",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute top-20 left-10 w-40 h-40 bg-blue-500/10 rounded-full blur-3xl animate-pulse-slow"}),(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute top-40 right-20 w-48 h-48 bg-purple-500/10 rounded-full blur-3xl animate-pulse-slow animation-delay-1000"}),(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute bottom-20 left-1/4 w-44 h-44 bg-indigo-500/10 rounded-full blur-3xl animate-pulse-slow animation-delay-2000"}),(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute bottom-40 right-1/3 w-36 h-36 bg-pink-500/10 rounded-full blur-3xl animate-pulse-slow"})]}),(0,s.jsx)("div",{style:{position:"absolute",top:"-9999px",left:"-9999px"},className:"jsx-d04b237aa006a56d",children:U&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.Fd,{audioTrack:eu,micOn:ed,playAudio:!1}),em.map(e=>(0,s.jsx)(o.aG,{user:e},e.uid))]})}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d relative z-10 min-h-screen flex flex-col",children:[!U&&(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex-1 flex flex-col",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex items-center justify-between px-6 py-6",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex-1",children:[(0,s.jsx)("h1",{className:"jsx-d04b237aa006a56d text-2xl md:text-3xl font-bold text-white/90 mb-1",children:z.ai_topic_title}),v&&z.context&&(0,s.jsxs)("p",{className:"jsx-d04b237aa006a56d text-sm text-white/50",children:[z.context.module_title," • ",z.context.lesson_title]})]}),z.ai_topic_description&&(0,s.jsx)("button",{onClick:()=>ek(!eN),className:"jsx-d04b237aa006a56d ml-3 flex-shrink-0 text-white/40 hover:text-white/70 transition-colors",children:(0,s.jsx)(u.tEG,{className:"w-6 h-6"})})]}),eN&&z.ai_topic_description&&(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d mx-6 mb-2 bg-white/5 backdrop-blur-md rounded-2xl p-4 border border-white/10",children:(0,s.jsx)("p",{className:"jsx-d04b237aa006a56d text-white/60 leading-relaxed text-sm",children:z.ai_topic_description})}),(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d flex-1 flex flex-col items-center justify-center px-6 pb-12",children:(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d text-center max-w-2xl mx-auto",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d relative inline-block mb-4",children:(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d relative w-48 h-48 md:w-56 md:h-56",children:(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute inset-0 rounded-full shadow-2xl bg-gradient-to-br from-gray-600 to-gray-700",children:(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d flex items-center justify-center w-full h-full",children:(0,s.jsx)(d.CV$,{className:"w-20 h-20 md:w-24 md:h-24 text-white"})})})})}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex gap-4 justify-center flex-wrap",children:[!P&&(0,s.jsx)("button",{onClick:eL,className:"jsx-d04b237aa006a56d px-8 py-4 bg-gradient-to-r from-blue-500 via-purple-600 to-pink-600 text-white rounded-full font-bold transition-all duration-300 hover:scale-105 active:scale-95 text-lg hover:shadow-lg hover:shadow-
1purple-500/30",children:"Start Discussion →"}),(0,s.jsx)("a",{href:"https://wa.me/+918484037551",className:"jsx-d04b237aa006a56d px-8 py-4 bg-white/10 hover:bg-white/15 text-white/80 rounded-full font-bold transition-all duration-300 hover:scale-105 active:scale-95 text-lg border border-white/20 backdrop-blur-md",children:"← Back"})]})]})})]}),U&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d fixed top-0 left-0 right-0 z-30 px-6 py-6",children:(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex items-center space-x-3",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d w-12 h-12 rounded-full bg-gradient-to-br from-blue-500 via-purple-600 to-pink-600 shadow-lg shadow-purple-500/20 flex items-center justify-center flex-shrink-0",children:(0,s.jsx)(d.CV$,{className:"w-6 h-6 text-white"})}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d",children:[(0,s.jsx)("h1",{className:"jsx-d04b237aa006a56d text-xl md:text-2xl font-bold text-white/90",children:z.ai_topic_title}),!G&&H&&(0,s.jsx)("span",{className:"jsx-d04b237aa006a56d text-sm text-blue-300 animate-pulse block",children:"Getting ready..."})]})]}),es&&(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex items-center space-x-2 bg-white/5 backdrop-blur-md px-4 py-2 rounded-full border border-white/10",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d w-2 h-2 bg-red-400 rounded-full animate-pulse"}),(0,s.jsx)("span",{className:"jsx-d04b237aa006a56d font-mono text-lg font-semibold text-white/80",children:(e=>{let t=Math.floor(e/60);return"".concat(t.toString().padStart(2,"0"),":").concat((e%60).toString().padStart(2,"0"))})(et)})]})]})}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d fixed bottom-0 left-0 right-0 z-30 pb-10 pt-6",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex items-center justify-center space-x-6",children:[(0,s.jsx)("button",{onClick:()=>ec(!ed),className:"jsx-d04b237aa006a56d "+"w-14 h-14 rounded-full flex items-center justify-center transition-all duration-200 active:scale-90 ".concat(ed?"bg-white/10 border border-white/20":"bg-white/20 border border-white/30"),children:ed?(0,s.jsx)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-d04b237aa006a56d w-6 h-6 text-white",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4M12 15a3 3 0 003-3V5a3 3 0 00-6 0v7a3 3 0 003 3z",className:"jsx-d04b237aa006a56d"})}):(0,s.jsxs)("svg",{fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,className:"jsx-d04b237aa006a56d w-6 h-6 text-white/60",children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.586 15H4a1 1 0 01-1-1v-4a1 1 0 011-1h1.586l4.707-4.707C10.923 3.663 12 4.109 12 5v14c0 .891-1.077 1.337-1.707.707L5.586 15z",className:"jsx-d04b237aa006a56d"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2",className:"jsx-d04b237aa006a56d"})]})}),(0,s.jsx)("button",{onClick:()=>eo(!0),disabled:H,className:"jsx-d04b237aa006a56d "+"w-16 h-16 rounded-full flex items-center justify-center transition-all duration-200 active:scale-90 ".concat(H?"bg-gray-600/30 cursor-not-allowed":"bg-red-500 hover:bg-red-600 shadow-lg shadow-red-500/30"),children:(0,s.jsx)(c.ZCw,{className:"w-7 h-7 text-white"})})]}),G&&ew&&(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d "+"flex justify-center mt-4 transition-opacity duration-1000 ".concat(ew?"opacity-100":"opacity-0"),children:(0,s.jsx)("p",{className:"jsx-d04b237aa006a56d text-white/40 text-sm",children:'Say "Hi" to get started'})})]}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d fixed inset-0 z-20 overflow-hidden",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute top-0 left-0 right-0 h-28 bg-gradient-to-b from-[#0a0b0d] via-[#0a0b0d]/70 to-transparent z-10 pointer-events-none"}),(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d absolute bottom-0 left-0 right-0 h-44 bg-gradient-to-t from-[#0a0b0d] via-[#0a0b0d]/80 to-transparent z-10 pointer-events-none"}),(0,s.jsxs)("div",{ref:eI,style:{scrollbarWidth:"none",msOverflowStyle:"none",WebkitOverflowScrolling:"touch"},className:"jsx-d04b237aa006a56d h-full overflow-y-auto px-8 md:px-12 scroll-smooth hide-scrollbar",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d h-[65vh]"}),0===eT.length?(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d text-center py-8",children:(0,s.jsx)("p",{className:"jsx-d04b237aa006a56d text-white/10 text-2xl font-bold",children:"Listening..."})}):eT.map((e,t)=>{let a=t===eT.length-1,r=t===eT.length-2;return(0,s.jsx)("div",{style:{opacity:a?1:r?.7:.55},className:"jsx-d04b237aa006a56d mb-5 max-w-2xl mx-auto transition-all duration-700 ease-out",children:(0,s.jsxs)("p",{className:"jsx-d04b237aa006a56d "+"font-bold leading-snug transition-all duration-700 ".concat(a?"text-[22px] md:text-[28px] lg:text-[32px]":r?"text-[18px] md:text-[22px] lg:text-[26px]":"text-[16px] md:text-[18px] lg:text-[20px]"," ").concat(e.is_agent?a?"text-white":"text-white/60":a?"text-purple-300":"text-purple-300/60"),children:[e.text,!e.is_final&&a&&(0,s.jsx)("span",{className:"jsx-d04b237aa006a56d inline-block w-[3px] h-[0.85em] bg-white ml-1.5 animate-pulse rounded-full align-middle"})]})},e.id+(e.is_agent?"_ai":"_user"))}),(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d h-[30vh]"})]})]})]})]}),el&&(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d bg-[#1a1b1e] rounded-3xl p-8 w-full max-w-md 
1shadow-2xl border border-white/10",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d text-center mb-6",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d w-16 h-16 bg-orange-500/20 rounded-full flex items-center justify-center mx-auto mb-4 border border-orange-400/30",children:(0,s.jsx)("span",{className:"jsx-d04b237aa006a56d text-3xl",children:"\uD83D\uDC4B"})}),(0,s.jsx)("h3",{className:"jsx-d04b237aa006a56d text-2xl font-bold text-white/90 mb-2",children:"End Discussion?"}),(0,s.jsx)("p",{className:"jsx-d04b237aa006a56d text-white/60",children:"Are you sure you want to finish this practice session?"})]}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex gap-3",children:[(0,s.jsx)("button",{onClick:()=>eo(!1),className:"jsx-d04b237aa006a56d flex-1 px-6 py-4 text-white/80 bg-white/10 hover:bg-white/15 rounded-2xl font-bold transition-all active:scale-95 border border-white/10",children:"Keep Practicing"}),(0,s.jsx)("button",{onClick:()=>{eo(!1),eG()},className:"jsx-d04b237aa006a56d flex-1 px-6 py-4 bg-red-500/80 hover:bg-red-500 text-white rounded-2xl font-bold transition-all active:scale-95 border border-red-400/30",children:"Yes, End Now"})]})]})}),ep&&(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d fixed inset-0 bg-black/70 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d bg-[#1a1b1e] rounded-3xl p-8 w-full max-w-md 
1shadow-2xl border border-white/10",children:[(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d text-center mb-6",children:[(0,s.jsx)("div",{className:"jsx-d04b237aa006a56d w-16 h-16 bg-red-500/20 rounded-full flex items-center justify-center mx-auto mb-4 border border-red-400/30",children:(0,s.jsx)("span",{className:"jsx-d04b237aa006a56d text-3xl",children:"\uD83C\uDFA4"})}),(0,s.jsx)("h3",{className:"jsx-d04b237aa006a56d text-2xl font-bold text-white/90 mb-2",children:"Microphone Permission Required"}),(0,s.jsx)("p",{className:"jsx-d04b237aa006a56d text-white/60",children:"Please allow microphone access to start the discussion."})]}),(0,s.jsxs)("div",{className:"jsx-d04b237aa006a56d flex gap-3",children:[(0,s.jsx)("button",{onClick:()=>ef(!1),className:"jsx-d04b237aa006a56d flex-1 px-6 py-4 text-white/80 bg-white/10 hover:bg-white/15 rounded-2xl font-bold transition-all active:scale-95 border border-white/10",children:"Cancel"}),(0,s.jsx)("button",{onClick:async()=>{try{if((await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop()),ef(!1),!ex||!J){w("Voice chat configuration is missing.");return}M(!0),er(!0),await eU()}catch(e){alert("Please allow microphone access in your browser settings to continue.")}},className:"jsx-d04b237aa006a56d flex-1 px-6 py-4 bg-blue-500/80 hover:bg-blue-500 text-white rounded-2xl font-bold transition-all active:scale-95 border border-blue-400/30",children:"Allow Microphone"})]})]})})]})]}):(0,s.jsx)("div",{className:"flex justify-center items-center min-h-screen bg-gray-50",children:(0,s.jsxs)("div",{className:"max-w-md w-full bg-white p-8 rounded-lg shadow-md text-center",children:[(0,s.jsx)("h2",{className:"text-xl font-semibold text-gray-800 mb-2",children:v?"Activity Not Found":"Topic Not Found"}),(0,s.jsx)("button",{onClick:()=>e.push("/room"),className:"bg-blue-500 hover:bg-blue-600 text-white w-full py-2.5 rounded-lg mt-4",children:"Return to Rooms"})]})})}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.