(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6916],{37124:(e,t,n)=>{Promise.resolve().then(n.bind(n,48411))},48411:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>r});var s=n(73365),o=n(64956),c=n(1521);function r(){let{socket:e,isConnected:t}=(0,o.F)(),[n,r]=(0,c.useState)(""),[l,a]=(0,c.useState)("");return(0,c.useEffect)(()=>{if(!e)return;let t=e=>{a(e.message)};return e.on("consultation:response",t),()=>{e.off("consultation:response",t)}},[e]),(0,s.jsxs)("div",{className:"p-4",children:[(0,s.jsx)("h1",{className:"text-2xl font-bold mb-4",children:"Request Consultation"}),(0,s.jsx)("textarea",{className:"w-full p-2 border rounded mb-4",value:n,onChange:e=>r(e.target.value),placeholder:"Describe your symptoms..."}),(0,s.jsx)("button",{className:"bg-blue-500 text-white px-4 py-2 rounded disabled:bg-gray-400",onClick:()=>{e&&t&&e.emit("consultation_request",{message:n,timestamp:new Date().toISOString()})},disabled:!t,children:t?"Send Request":"Connecting..."}),l&&(0,s.jsxs)("p",{className:"mt-4",children:["Status: ",l]})]})}},64956:(e,t,n)=>{"use strict";n.d(t,{F:()=>a,SocketProvider:()=>l});var s=n(73365),o=n(1521),c=n(48974);let r=(0,o.createContext)(null),l=e=>{let{children:t}=e,n=(0,o.useRef)(null),[l,a]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{n.current=(0,c.io)("http://localhost:3001",{withCredentials:!0,autoConnect:!1,reconnectionAttempts:5,reconnectionDelay:1e3,transports:["websocket"]});let e=n.current;return e.on("connect",()=>{console.log("✅ Socket connected"),a(!0)}),e.on("disconnect",()=>{console.log("❌ Socket disconnected"),a(!1)}),e.connect(),()=>{e.disconnect()}},[]),(0,s.jsx)(r.Provider,{value:{socket:n.current,isConnected:l},children:t})},a=()=>(0,o.useContext)(r)}},e=>{var t=t=>e(e.s=t);e.O(0,[3736,2347,4870,7358],()=>t(37124)),_N_E=e.O()}]);