1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1131],{78250:function(e,t,r){(window.__NEXT_P=window.__NEXT_P||[]).push(["/ai-screening/In",function(){return r(6599)}])},44581:function(e,t,r){"use strict";r.d(t,{Z:function(){return useAuthReady}});var s=r(9473);function useAuthReady(){let e=(0,s.v9)(e=>e.auth.bootstrapStatus),t=(0,s.v9)(e=>e.auth.isAuthenticated);return{isReady:"succeeded"===e||"failed"===e,isAuthenticated:t}}},69413:function(e,t,r){"use strict";r.d(t,{Z:function(){return useRequireAuth}});var s=r(67294),n=r(11163),a=r(9473),l=r(55678),i=r(44581);function useRequireAuth(){let{message:e,toastId:t="sign-in-required"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=(0,n.useRouter)(),{isReady:o,isAuthenticated:c}=(0,i.Z)(),d=(0,a.v9)(e=>e.auth.isLoggingOut);return(0,s.useEffect)(()=>{o&&!c&&(e&&!d&&l.Am.info(e,{toastId:t}),r.push("/signin"))},[o,c,d,r,e,t]),{isReady:o,isAuthenticated:c}}},6599:function(e,t,r){"use strict";r.r(t),r.d(t,{__N_SSP:function(){return w},default:function(){return In}});var s=r(85893),n=r(67294),a=r(11163),l=r(9473),i=r(55678);let o=n.forwardRef(function({title:e,titleId:t,...r},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"}))});var c=r(33321),d=r(53181),u=r(35212);let h=n.forwardRef(function({title:e,titleId:t,...r},s){return n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:s,"aria-labelledby":t},r),e?n.createElement("title",{id:t},e):null,n.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"}))});var vitals_BinahErrorOverlay=e=>{let{errorCode:t,errorMessage:r,onRetry:a,onGoBack:l,onCheckCompat:i}=e,[o,c]=(0,n.useState)(!1),d=7006===t||"CLIENT_INIT_TIMEOUT"===t||r&&(r.toLowerCase().includes("wasm")||r.toLowerCase().includes("webassembly")||r.toLowerCase().includes("startfinished"));return(0,s.jsx)("div",{className:"fixed inset-0 z-[1050] flex items-center justify-center bg-black/40 p-6 font-nunito backdrop-blur-sm",children:(0,s.jsxs)("div",{className:"flex max-h-[90vh] w-full max-w-md flex-col items-center overflow-y-auto rounded-2xl border border-gray-200 bg-white p-6 text-center shadow-2xl md:p-8",children:[(0,s.jsx)("div",{className:"mb-4 flex h-16 w-16 animate-pulse items-center justify-center rounded-full border border-rose-200 bg-rose-50 text-rose-500",children:(0,s.jsx)(h,{className:"h-8 w-8"})}),(0,s.jsx)("h3",{className:"text-xl font-bold tracking-tight text-gray-900",children:d?"Screening Engine Unavailable":"Something Went Wrong"}),(0,s.jsx)("p",{className:"mt-3 text-sm leading-relaxed text-gray-600",children:d?"We were unable to start the AI camera module. This typically happens if the browser or device is missing required performance capabilities.":"An unexpected issue occurred while starting the vital signs monitor."}),(0,s.jsxs)("div",{className:"mt-4 w-full",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>c(!o),className:"mx-auto flex items-center justify-center gap-1 text-xs font-semibold text-gray-400 transition-colors hover:text-gray-600",children:[(0,s.jsx)("span",{children:o?"Hide Technical Details":"Show Technical Details"}),(0,s.jsx)("svg",{className:"h-3 w-3 transform transition-transform duration-200 ".concat(o?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o?(0,s.jsx)("div",{className:"mt-3 w-full rounded-lg border border-gray-200 bg-gray-50 p-3 text-left",children:(0,s.jsxs)("div",{className:"flex flex-col gap-1.5 font-mono text-[11px] text-gray-500",children:[t?(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-bold text-gray-700",children:"Error Code:"})," ",(0,s.jsx)("span",{className:"select-all break-all rounded bg-gray-200/50 px-1 py-0.5",children:t})]}):null,r?(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"font-bold text-gray-700",children:"Details:"})," ",(0,s.jsx)("span",{className:"select-all break-all",children:r})]}):null]})}):null]}),(0,s.jsxs)("div",{className:"mt-6 w-full rounded-xl border border-gray-200 bg-gray-50 p-4 text-left",children:[(0,s.jsx)("h4",{className:"text-xs font-semibold text-gray-800",children:"Recommended Steps:"}),(0,s.jsxs)("ul",{className:"mt-2 list-inside list-disc space-y-1.5 pl-1 text-xs leading-relaxed text-gray-600",children:[(0,s.jsx)("li",{className:"marker:text-gray-400",children:"Ensure you are using an up-to-date web browser."}),(0,s.jsx)("li",{className:"marker:text-gray-400",children:"Close other apps and tabs to free up system memory."}),(0,s.jsx)("li",{className:"marker:text-gray-400",children:"Grant camera permissions if requested by the browser."})]})]}),(0,s.jsxs)("div",{className:"mt-6 flex w-full flex-col gap-2",children:[d?(0,s.jsx)("button",{onClick:i,className:"min-h-[44px] w-full rounded-xl bg-[#03DDE2] px-4 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition-colors hover:bg-opacity-90",children:"Check device setup"}):(0,s.jsx)("button",{onClick:a,className:"min-h-[44px] w-full rounded-xl bg-[#03DDE2] px-4 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition-colors hover:bg-opacity-90",children:"Try again"}),(0,s.jsxs)("div",{className:"flex w-full gap-2",children:[d?(0,s.jsx)("button",{onClick:a,className:"min-h-[44px] flex-1 rounded-xl border border-gray-300 bg-white px-3 py-2 text-center text-xs font-semibold text-gray-700 shadow-sm transition-colors hover:bg-gray-50",children:"Force Reload"}):null,(0,s.jsx)("button",{onClick:l,className:"min-h-[44px] rounded-xl border border-gray-300 bg-white px-3 py-2 text-center text-xs font-semibold text-gray-700 shadow-sm transition-colors hover:bg-gray-50 ".concat(d?"flex-1":"w-full"),children:"Go Back to Wellness"})]})]})]})})},m=r(42720),x=r(45861),g=r(53448),f=r(69413),w=!0,In=()=>{let e=(0,l.v9)(e=>e.auth.user),{isReady:t,isAuthenticated:r}
1=(0,f.Z)(),[h,w]=(0,n.useState)(!0),p=(0,a.useRouter)(),b=(0,l.I0)(),[y,v]=(0,n.useState)(null),[j,k]=(0,n.useState)(0),[N,E]=(0,n.useState)(!1),[C,_]=(0,n.useState)(!1),[S,T]=(0,n.useState)(null),[R,L]=(0,n.useState)(!1),[I,D]=(0,n.useState)(!1),[M,O]=(0,n.useState)(!1);(0,n.useEffect)(()=>{D(!0)},[]),(0,n.useEffect)(()=>{E(!1),O(!1);let e=setTimeout(()=>{O(!0)},18e3),t=setTimeout(()=>{if(!N&&!y){let e={code:"CLIENT_INIT_TIMEOUT",message:"The screening engine did not respond in time. This could be due to browser capability limitations or network constraints."};v(e),b((0,g.Px)(e))}},9e4);return()=>{clearTimeout(e),clearTimeout(t)}},[j,N,y]),(0,n.useEffect)(()=>{if(!t||!r)return;let requestCameraPermission=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0}),i.Am.success("Camera access granted.")}catch(e){i.Am.error("Camera access is required for this screening. Please enable it in your browser settings and try again.")}};requestCameraPermission()},[t,r]),(0,n.useEffect)(()=>{let changewindth=()=>{window.innerWidth>768?w(!0):w(!1)};return window.addEventListener("resize",changewindth),()=>{window.removeEventListener("resize",changewindth)}},[]);let[z,A]=(0,n.useState)(null),[Z,q]=(0,n.useState)(null);(0,n.useEffect)(()=>{if(!t||!r||!(null==e?void 0:e._id))return;let s=!0,fetchData=async()=>{try{if(e._id){var t,r,n;let a=await d.Z.get("".concat(c.T,"/zuri_binah/get_results/").concat(null==e?void 0:e._id)),l=null!==(n=null===(r=a.data)||void 0===r?void 0:null===(t=r.data)||void 0===t?void 0:t.testCount)&&void 0!==n?n:0;s?(A(l),q(l),s=!1):(A(l),l>Z&&p.push("/ai-screening/general-results"))}}catch(e){}};fetchData();let n=setInterval(fetchData,1e4);return()=>clearInterval(n)},[t,r,null==e?void 0:e._id,z,Z]),(0,n.useEffect)(()=>{let handleMessage=e=>{if("https://ai.zuri.health"===e.origin&&(E(!0),"SDK_ERROR"===e.data.type)){console.error("Iframe SDK Error:",e.data,e.data.error);let t={code:e.data.code||7006,message:e.data.error||"Failed to initialize wasm"};v(t),b((0,g.Px)(t))}};return window.addEventListener("message",handleMessage),()=>{window.removeEventListener("message",handleMessage)}},[]);let handleRetry=()=>{v(null),b((0,g.EZ)()),k(e=>e+1)},handleCheckCompat=async()=>{_(!0);try{let e=await (0,x.j)();T(e),L(!0)}catch(e){console.error("Error re-running compatibility checks:",e)}finally{_(!1)}};return(0,s.jsxs)("div",{className:"relative flex h-screen w-screen justify-center bg-none",children:[(0,s.jsx)(u.Z,{}),(0,s.jsx)("button",{type:"button",onClick:()=>p.push("/generalwellness"),"aria-label":"Back to wellness",className:"fixed left-4 top-4 z-50 flex h-11 w-11 items-center justify-center rounded-full bg-white/90 text-gray-700 shadow-md backdrop-blur-sm transition-colors hover:bg-white",children:(0,s.jsx)(o,{className:"h-5 w-5"})}),M&&I&&e&&!y?(0,s.jsxs)("div",{className:"fixed bottom-6 left-1/2 z-50 flex -translate-x-1/2 items-center gap-2 rounded-full bg-gray-900/80 px-4 py-2 text-sm text-white shadow-lg backdrop-blur-sm",children:[(0,s.jsx)("span",{className:"h-3.5 w-3.5 flex-shrink-0 animate-spin rounded-full border-2 border-white/40 border-t-white"}),"Still connecting to the screening engineâ¦"]}):null,I&&e&&!y?(0,s.jsx)("iframe",{src:"https://ai.zuri.health?id=".concat(e._id),allow:"camera; microphone; autoplay; document-domain; cross-origin-isolated; gyroscope; identity-credentials-get; magnetometer; otp-credentials; publickey-credentials-create; storage-access; web-share; window-management; fullscreen; geolocation",sandbox:"allow-scripts allow-same-origin allow-popups allow-top-navigation allow-storage-access-by-user-activation allow-forms allow-presentation",loading:"lazy",style:{width:"100%",height:"100%",border:"none"}},j):null,y?(0,s.jsx)(vitals_BinahErrorOverlay,{errorCode:y.code,errorMessage:y.message,onRetry:handleRetry,onGoBack:()=>{p.push("/ai-screening/general-wellness")},onCheckCompat:handleCheckCompat}):null,R?(0,s.jsx)(m.Z,{isOpen:R,onClose:()=>L(!1),compatResult:S,onContinue:()=>{L(!1),handleRetry()},onViewDemo:()=>{L(!1),p.push("/ai-screening/demo")}}):null]})}}},function(e){e.O(0,[9732,9774,2888,179],function(){return e(e.s=78250)}),_N_E=e.O()}]);
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.