1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="3fed4619-145f-4fd8-85cf-51db99947c54",e._sentryDebugIdIdentifier="sentry-dbid-3fed4619-145f-4fd8-85cf-51db99947c54")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9077],{12820:(e,t,s)=>{"use strict";s.d(t,{I:()=>n});let r=["en","ar","hi","ml","ur","ta","bn"];function n(e,t){let s=(null==t?void 0:t.toLowerCase())||"en",n=r.includes(s)?s:"en",a="en"===n?"".concat(e,".mp4"):"".concat(e,"_").concat(n,".mp4");return"".concat("https://d14z4ic00ui5wl.cloudfront.net/Walkthrough+Videos/Onboarding/").concat(a)}},19217:(e,t,s)=>{"use strict";s.d(t,{A:()=>a});var r=s(95155);s(12115);var n=s(38564);let a=e=>{let{size:t=20,correctAnswers:s,totalQuestions:a,notStarted:o=!1}=e,l=o?0:0===a||s===a?3:s>0?2:1;return(0,r.jsx)("div",{className:"flex space-x-0.5",children:[0,1,2].map(e=>(0,r.jsx)(n.A,{size:t,className:"transition-all duration-5000 ".concat(e<l?"text-yellow-400 fill-yellow-400 filter drop-shadow-sm":"text-gray-300")},e))})}},41397:(e,t,s)=>{"use strict";s.d(t,{k:()=>o});var r=s(95155),n=s(12115),a=s(5765);let o=n.forwardRef((e,t)=>{let{className:s,value:n=0,max:o=100,...l}=e,i=Math.min(Math.max(n/o*100,0),100);return(0,r.jsx)("div",{ref:t,className:(0,a.cn)("relative h-2 w-full overflow-hidden rounded-full bg-gray-200",s),...l,children:(0,r.jsx)("div",{className:"h-full w-full flex-1 bg-blue-600 transition-all duration-300 ease-in-out",style:{transform:"translateX(-".concat(100-i,"%)")}})})});o.displayName="Progress"},41893:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>eK});var r=s(95155),n=s(11518),a=s.n(n),o=s(12115),l=s(55028),i=s(31462),c=s(69894),d=s(61106),u=s(28833),m=s(84109),h=s(23274),f=s(19217),g=s(8882),p=s(98603),x=s(71772),w=s(13052),b=s(42355);let y=e=>{let{currentPage:t,totalPages:s,isRTL:n,prevLabel:a,nextLabel:o,onPrev:l,onNext:i}=e;if(s<=1)return null;let c=(t+1)/s*100;return(0,r.jsxs)("div",{className:"mt-4 flex w-full items-center gap-2 sm:mt-6 sm:gap-3",dir:n?"rtl":"ltr",children:[(0,r.jsx)("button",{type:"button",onClick:l,disabled:0===t,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-gray-200 bg-white text-gray-700 shadow-sm disabled:opacity-40","aria-label":a,children:n?(0,r.jsx)(w.A,{className:"h-6 w-6"}):(0,r.jsx)(b.A,{className:"h-6 w-6"})}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col items-center gap-1.5",children:[(0,r.jsx)("div",{className:"flex h-1.5 w-full max-w-[16rem] overflow-hidden rounded-full bg-gray-200 ".concat(n?"justify-end":""),dir:"ltr",role:"progressbar","aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":t+1,children:(0,r.jsx)("div",{className:"h-full rounded-full bg-customBlue-600 transition-all duration-300",style:{width:"".concat(c,"%")}})}),(0,r.jsxs)("span",{className:"text-xs font-medium tabular-nums text-gray-600",dir:"ltr",children:[t+1," / ",s]})]}),(0,r.jsx)("button",{type:"button",onClick:i,disabled:t===s-1,className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full border border-gray-200 bg-white text-gray-700 shadow-sm disabled:opacity-40","aria-label":o,children:n?(0,r.jsx)(b.A,{className:"h-6 w-6"}):(0,r.jsx)(w.A,{className:"h-6 w-6"})})]})};var v=s(70499),j=s(29210),N=s(38098),k=s(48494);function A(){return"undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)}let S=e=>{let{initialRecommendedLessons:t,courseStatus:s,courseProgress:n,currentActiveModuleAndSubmodule:a,daysLeft:l,courseSlug:i="foodstars"}=e,{enrollmentStatus:c,enterpriseId:w}=(0,h.A)(),b="67876e01f4a1d7f0a2a5a163"===w,S="attempting"===c,{t:I}=(0,g.Bd)("common"),C=(0,x.a)(),{logEvent:D}=(0,v.Z)(),E=(0,k.A)(),[P,L]=(0,o.useState)(t),[R,T]=(0,o.useState)(!1),[M,F]=(0,o.useState)(null),{systemCheck:H,runCheck:O,hasSeenInSession:_,markAsSeen:B}=(0,j.B)(),W="inProgress"===s?(()=>{if("inProgress"===s&&(null==n?void 0:n.moduleProgress)&&a){let[e,t]=a.split("."),s=n.moduleProgress[parseInt(e)];if(s){let e=s.lessonProgress[parseInt(t)];if(e)return{lessonId:e.lessonId,lessonName:e.lessonName,moduleId:s.moduleId,moduleName:s.moduleName,correctAnswers:e.correctAnswers||0,totalQuestions:e.totalQuestions||0,timeTaken:e.lessonTimeTaken||0,timeEstimate:e.timeEstimate||0}}}return null})():P[0],[z,U]=o.useState(0),q=o.useMemo(()=>"attempted"===s||"completed"===s?P.slice(3*z,(z+1)*3):[],[P,z,s,3]);o.useEffect(()=>{let e=Math.max(0,Math.ceil(P.length/3)-1);U(t=>Math.min(t,e))},[3,P.length]);let G=Math.ceil(P.length/3),V=(0,o.useCallback)((e,t)=>{if(!n||!n.moduleProgress)return void console.error("Course Progress or Module Progress
1is undefined. Please ensure the trainee has a valid enrollment.");if(!_()){F({lessonId:e,moduleId:t}),O(),T(!0);return}Q(e,t)},[n,_,O]),Q=(0,o.useCallback)((e,t)=>{if(!n||!n.moduleProgress)return;let s=n.moduleProgress.find(e=>e.moduleId===t);if(s){let r,a=n.moduleProgress.findIndex(e=>e.moduleId===t)+1,o=s.lessonProgress.findIndex(t=>t.lessonId===e)+1,l="moduleIndex=".concat(a,".").concat(o),c=C?A()?"iOS":"Android":"Desktop",d="/courses/".concat(i);r=C?"".concat(d,"/").concat(A()?"pwa":"mobile","?").concat(l):"".concat(d,"/training?").concat(l),["/pwa","/mobile","/mobiledev"].some(e=>r.includes(e))?window.location.href=r:window.open(r,"_blank","noopener,noreferrer"),D("GameLaunch","Game Launched on ".concat(c," for Module ").concat(a,".").concat(o)),L(t=>{let s=t.findIndex(t=>t.lessonId===e);if(-1!==s){let e=[...t],[r]=e.splice(s,1);return[...e,r]}return t})}},[n,C,i,D]),Y=(0,o.useCallback)(()=>{B(),T(!1),M&&(Q(M.lessonId,M.moduleId),F(null))},[B,M,Q]),K=(0,o.useCallback)(()=>{T(!1),F(null)},[]),Z=(e,t)=>0===t?0:Math.round(e/t*100),$=(e,t,s,r)=>{var n,a;let o=I("traineeModules",{returnObjects:!0});if(t)return(null==(n=o[(0,p.Cb)(s||"")])?void 0:n.title)||s||e;{if(!s||!r)return console.warn("Missing moduleName or lessonName for lesson translation",{moduleName:s,lessonName:r,id:e}),e;let t=(0,p.Cb)(s),n=(0,p.Kp)(r);return(null==(a=o[t])?void 0:a.subModules[n])||r||e}},J=E?"rtl":"ltr",X="min-w-0 flex-1 text-start font-semibold text-sm sm:text-lg transition-colors duration-300",ee="break-words whitespace-normal sm:truncate",et="text-xs sm:text-sm font-normal text-gray-500 break-words whitespace-normal sm:truncate";return(0,r.jsxs)("div",{className:"w-full min-w-0 max-w-full bg-gray-50 border border-gray-200/40 rounded-xl p-3 sm:p-6 mx-auto my-2 sm:my-4 ".concat(E?"rtl":"ltr"),children:[(0,r.jsx)("div",{className:"mb-2 w-full min-w-0",children:(0,r.jsx)("h3",{className:"w-full min-w-0 text-start text-lg leading-snug font-semibold text-gray-900 break-words text-balance sm:text-2xl sm:leading-snug lg:text-3xl",dir:J,children:I("callToAction.title.".concat("inProgress"===s?"inProgress":"completed"))})}),"notStarted"!==s&&"N/A"!==l&&(0,r.jsx)("p",{className:"text-sm text-gray-600 mb-4 break-words",dir:J,children:"N/A"===l?I("callToAction.daysLeft.noExpiration"):I("callToAction.daysLeft.".concat(1===Number(l)?"singular":"plural"),{count:Number(l)})}),"inProgress"===s&&W&&(0,r.jsx)("div",{className:"bg-white rounded-lg p-3 sm:p-4 shadow-md transition-all duration-300 hover:shadow-lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 py-1 sm:flex-row sm:items-center sm:gap-3 sm:py-2",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center",children:[(0,r.jsx)(d.A,{className:"mx-2 h-4 w-4 sm:h-6 sm:w-6 text-gray-300 flex-shrink-0"}),(0,r.jsxs)("button",{onClick:()=>V(W.lessonId,W.moduleId),disabled:S||b,className:"".concat(X," ").concat(S||b?"text-gray-300 cursor-not-allowed":"text-gray-700 hover:text-customBlue-600"),dir:J,children:[(0,r.jsx)("div",{className:ee,children:$(W.lessonId,!1,W.moduleName,W.lessonName)}),(0,r.jsxs)("div",{className:et,children:["(",$(W.moduleId,!0,W.moduleName),")"]})]})]}),(0,r.jsxs)("div",{className:"flex w-full min-w-0 items-center justify-between gap-2 px-2 sm:w-auto sm:justify-end sm:gap-4 sm:px-0",children:[(0,r.jsx)(f.A,{score:Z(W.correctAnswers,W.totalQuestions),correctAnswers:W.correctAnswers,totalQuestions:W.totalQuestions,size:C?14:20,notStarted:!0}),(0,r.jsx)("span",{className:"whitespace-nowrap text-[10px] text-gray-400 sm:text-sm",children:I("callToAction.lesson.timeEstimate",{time:W.timeEstimate})}),(0,r.jsx)("button",{onClick:()=>V(W.lessonId,W.moduleId),disabled:S||b,className:S||b?"cursor-not-allowed":"cursor-pointer",children:(0,r.jsx)(u.A,{className:"h-8 w-8 sm:h-12 sm:w-12 bg-customBlue-200 p-1 rounded-full text-gray-900 flex-shrink-0"})})]})]})}),("attempted"===s||"completed"===s)&&P.length>0&&(0,r.jsxs)("div",{className:"min-w-0",children:[q.map(e=>(0,r.jsx)("div",{className:"bg-white rounded-lg p-3 sm:p-4 shadow-md transition-all duration-300 hover:shadow-lg mb-3 sm:mb-4",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 py-1 sm:flex-row sm:items-center sm:gap-3 sm:py-2",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center",children:[(0,r.jsx)(d.A,{className:"mx-2 h-5 w-5 sm:h-6 sm:w-6 text-gray-300 flex-shrink-0"}),(0,r.jsxs)("button",{onClick:()=>V(e.lessonId,e.moduleId),className:"".concat(X," text-customBlue-700 hover:text-customBlue-800"),dir:J,children:[(0,r.jsx)("div",{className:ee,children:$(e.lessonId,!1,e.moduleName,e.lessonName)}),(0,r.jsxs)("div",{className:et,children:["(",$(e.moduleId,!0,e.moduleName),")"]})]})]}),(0,r.jsxs)("div",{className:"flex w-full min-w-0 items-center justify-between gap-2 px-2 sm:w-auto
1sm:justify-end sm:gap-4 sm:px-0",children:[(0,r.jsx)(f.A,{score:Z(e.correctAnswers,e.totalQuestions),correctAnswers:e.correctAnswers,totalQuestions:e.totalQuestions,size:C?16:20,notStarted:!1}),(0,r.jsx)("span",{className:"whitespace-nowrap text-xs text-green-600 sm:text-sm",children:I("callToAction.lesson.timeEstimate",{time:e.timeEstimate})}),(0,r.jsx)("button",{onClick:()=>V(e.lessonId,e.moduleId),className:"cursor-pointer",children:(0,r.jsx)(m.A,{className:"h-8 w-8 sm:h-10 sm:w-10 bg-customBlue-200 p-1 rounded-full text-gray-900 flex-shrink-0"})})]})]})},e.lessonId)),(0,r.jsx)(y,{currentPage:z,totalPages:G,isRTL:E,prevLabel:I("callToAction.pagination.prev"),nextLabel:I("callToAction.pagination.next"),onPrev:()=>U(e=>Math.max(0,e-1)),onNext:()=>U(e=>Math.min(G-1,e+1))})]}),R&&H&&(0,r.jsx)(N.A,{isOpen:R,onClose:K,onContinue:Y,systemCheck:H})]})},I=e=>{let{recommendedLessons:t,courseStatus:s,courseProgress:n,currentActiveModuleAndSubmodule:a,daysLeft:l,courseSlug:i="foodstars"}=e,{enrollmentStatus:c}=(0,h.A)(),w="attempting"===c,{t:b}=(0,g.Bd)("common"),v=(0,k.A)(),A=(0,x.a)(),[S,I]=o.useState(!1),[C,D]=o.useState(null),{systemCheck:E,runCheck:P,hasSeenInSession:L,markAsSeen:R}=(0,j.B)(),T="inProgress"===s?(()=>{if("inProgress"===s&&(null==n?void 0:n.moduleProgress)&&a){let[e,t]=a.split("."),s=n.moduleProgress[parseInt(e)];if(s){let e=s.lessonProgress[parseInt(t)];if(e)return{lessonId:e.lessonId,lessonName:e.lessonName,moduleId:s.moduleId,moduleName:s.moduleName,correctAnswers:e.correctAnswers||0,totalQuestions:e.totalQuestions||0,timeTaken:e.lessonTimeTaken||0,timeEstimate:e.timeEstimate||0}}}return null})():t[0],[M,F]=o.useState(0),H=o.useMemo(()=>"attempted"===s||"completed"===s?t.slice(3*M,(M+1)*3):[],[t,M,s,3]);o.useEffect(()=>{let e=Math.max(0,Math.ceil(t.length/3)-1);F(t=>Math.min(t,e))},[3,t.length]);let O=Math.ceil(t.length/3),_=(0,o.useCallback)((e,t)=>{if(!n||!n.moduleProgress)return void console.error("Course Progress or Module Progress is undefined");if(!L()){D({lessonId:e,moduleId:t}),P(),I(!0);return}B(e,t)},[n,L,P]),B=(0,o.useCallback)((e,t)=>{if(!n||!n.moduleProgress)return;let s=n.moduleProgress.find(e=>e.moduleId===t);if(s){let r,a=n.moduleProgress.findIndex(e=>e.moduleId===t)+1,o=s.lessonProgress.findIndex(t=>t.lessonId===e)+1,l="moduleIndex=".concat(a,".").concat(o),c="/courses/".concat(i);r=A?"".concat(c,"/").concat("undefined"!=typeof navigator&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1)?"pwa":"mobile","?").concat(l):"".concat(c,"/training?").concat(l),["/pwa","/mobile","/mobiledev"].some(e=>r.includes(e))?window.location.href=r:window.open(r,"_blank","noopener,noreferrer")}},[n,A,i]),W=(0,o.useCallback)(()=>{R(),I(!1),C&&(B(C.lessonId,C.moduleId),D(null))},[R,C,B]),z=(0,o.useCallback)(()=>{I(!1),D(null)},[]),U=(e,t)=>0===t?0:Math.round(e/t*100),q=(e,t,s,r)=>{var n,a;let o=b("traineeModules",{returnObjects:!0});if(t)return(null==(n=o[(0,p.Cb)(s||"")])?void 0:n.title)||s||e;{if(!s||!r)return console.warn("Missing moduleName or lessonName for lesson translation",{moduleName:s,lessonName:r,id:e}),e;let t=(0,p.Cb)(s),n=(0,p.Kp)(r);return(null==(a=o[t])?void 0:a.subModules[n])||r||e}},G=v?"rtl":"ltr",V="min-w-0 flex-1 text-start font-semibold text-sm sm:text-lg transition-colors duration-300",Q="font-arabic break-words whitespace-normal sm:truncate",Y="font-arabic text-xs sm:text-sm font-normal text-gray-500 break-words whitespace-normal sm:truncate";return(0,r.jsxs)("div",{className:"w-full min-w-0 max-w-full bg-gray-50 border border-gray-200/40 rounded-xl p-3 sm:p-6 mx-auto my-2 sm:my-4 ".concat(v?"rtl":"ltr"),children:[(0,r.jsxs)("div",{className:"mb-2 w-full min-w-0 text-start",children:[(0,r.jsx)("h3",{className:"font-arabic w-full min-w-0 text-start text-lg leading-snug font-semibold text-gray-900 break-words text-balance sm:text-2xl sm:leading-snug lg:text-3xl",dir:G,children:b("callToAction.title.".concat("inProgress"===s?"inProgress":"completed"))}),(0,r.jsx)("p",{className:"font-arabic text-sm my-2 text-gray-600 break-words",dir:G,children:"N/A"===l?b("callToAction.daysLeft.noExpiration"):b("callToAction.daysLeft.".concat(1===Number(l)?"singular":"plural"),{count:Number(l)})})]}),"inProgress"===s&&T&&(0,r.jsx)("div",{className:"bg-white rounded-lg p-3 sm:p-4 shadow-md transition-all duration-300 hover:shadow-lg",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 py-1 sm:flex-row sm:items-center sm:gap-0 sm:py-2",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center",children:[(0,r.jsx)(d.A,{className:"mx-2 h-5 w-5 sm:h-6 sm:w-6 text-gray-300 flex-shrink-0"}),(0,r.jsxs)("button",{onClick:()=>_(T.lessonId,T.moduleId),disabled:w,className:"".concat(V," ").concat(w?"text-gray-300 cursor-not-allowed":"text-gray-700 hover:text-customBlue-600"),dir:G,children:[(0,r.jsx)("div",{className:Q,children:q(T.lessonId,!1,T.moduleName,T.lessonName)}),(0,r.jsxs)("div",{className:Y,children:["(",q(T.moduleId,!0,T.moduleName),")"]})]})]}),(0,r.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 px-2 sm:w-auto
1sm:justify-end sm:gap-4 sm:px-0",children:[(0,r.jsx)(f.A,{score:U(T.correctAnswers,T.totalQuestions),correctAnswers:T.correctAnswers,totalQuestions:T.totalQuestions,size:A?14:20,notStarted:!0}),(0,r.jsx)("span",{className:"whitespace-nowrap text-xs text-gray-400 sm:text-sm",children:b("callToAction.lesson.timeEstimate",{time:T.timeEstimate})}),(0,r.jsx)("button",{onClick:()=>_(T.lessonId,T.moduleId),disabled:w,className:w?"cursor-not-allowed":"cursor-pointer",children:(0,r.jsx)(u.A,{className:"h-8 w-8 sm:h-12 sm:w-12 bg-customBlue-200 p-1 rounded-full text-gray-900 flex-shrink-0"})})]})]})}),("attempted"===s||"completed"===s)&&t.length>0&&(0,r.jsxs)("div",{children:[H.map(e=>(0,r.jsx)("div",{className:"bg-white rounded-lg p-3 sm:p-4 shadow-md transition-all duration-300 hover:shadow-lg mb-3 sm:mb-4",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2 py-1 sm:flex-row sm:items-center sm:gap-0 sm:py-2",children:[(0,r.jsxs)("div",{className:"flex min-w-0 flex-1 items-center",children:[(0,r.jsx)(d.A,{className:"mx-2 h-5 w-5 sm:h-6 sm:w-6 text-gray-300 flex-shrink-0"}),(0,r.jsxs)("button",{onClick:()=>_(e.lessonId,e.moduleId),className:"".concat(V," text-customBlue-700 hover:text-customBlue-800"),dir:G,children:[(0,r.jsx)("div",{className:Q,children:q(e.lessonId,!1,e.moduleName,e.lessonName)}),(0,r.jsxs)("div",{className:Y,children:["(",q(e.moduleId,!0,e.moduleName),")"]})]})]}),(0,r.jsxs)("div",{className:"flex w-full items-center justify-between gap-2 px-2 sm:w-auto sm:justify-end sm:gap-4 sm:px-0",children:[(0,r.jsx)(f.A,{score:U(e.correctAnswers,e.totalQuestions),correctAnswers:e.correctAnswers,totalQuestions:e.totalQuestions,size:A?16:20,notStarted:!1}),(0,r.jsx)("span",{className:"whitespace-nowrap text-xs text-green-600 sm:text-sm",children:b("callToAction.lesson.timeEstimate",{time:e.timeEstimate})}),(0,r.jsx)("button",{onClick:()=>_(e.lessonId,e.moduleId),className:"cursor-pointer",children:(0,r.jsx)(m.A,{className:"h-8 w-8 sm:h-10 sm:w-10 bg-customBlue-200 p-1 rounded-full text-gray-900 flex-shrink-0"})})]})]})},e.lessonId)),(0,r.jsx)(y,{currentPage:M,totalPages:O,isRTL:v,prevLabel:b("callToAction.pagination.prev"),nextLabel:b("callToAction.pagination.next"),onPrev:()=>F(e=>Math.max(0,e-1)),onNext:()=>F(e=>Math.min(O-1,e+1))})]}),S&&E&&(0,r.jsx)(N.A,{isOpen:S,onClose:z,onContinue:W,systemCheck:E})]})};var C=s(79971),D=s(32960),E=s(87948),P=s(618),L=s(35695),R=s(49595),T=s(47579),M=s(18686),F=s(92657),H=s(97207),O=s(81284),_=s(53904),B=s(75525),W=s(54416),z=s(40646),U=s(1243),q=s(92138),G=s(88482),V=s(97168),Q=s(41397),Y=s(33716),K=s(71327),Z=s(93902),$=s(45061),J=s(1236),X=s(74168),ee=s(81029),et=s(51523),es=s(42865),er=s(31356),en=s(66497),ea=s(38200),eo=s(91218),el=s(41896),ei=s(59211),ec=s(49789);function ed(){let{t:e}=(0,eo.Bd)("common"),t=(0,el.qY)(e=>(0,ei.z5)(e));return(0,r.jsxs)("div",{className:"space-y-3",children:[t.map(t=>{let s=ec.Iw[t.code],n=null==s?void 0:s.icon,a=e("proctoring.violations.overlay.".concat(t.code,".title")),o=e("proctoring.violations.".concat(t.code));return(0,r.jsx)("div",{className:"rounded-lg border border-gray-200 p-3",children:(0,r.jsxs)("div",{className:"flex items-start gap-2",children:[n?(0,r.jsx)(n,{className:"h-4 w-4 mt-0.5 text-red-600"}):null,(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-gray-900",children:a}),(0,r.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:o})]})]})},t.code)}),0===t.length&&(0,r.jsx)("p",{className:"text-sm text-gray-500",children:e("proctoring.setup.noLiveDetectors")})]})}var eu=s(88056),em=s(58615),eh=s(58168),ef=s(73950),eg=s(11168),ep=s(81741);function ex(e){let{ready:t}=e,s=(0,o.useId)(),n="face-guide-oval-".concat(s.replace(/:/g,"")),a=100*ep.qC.centreX,l=100*ep.qC.centreY,i=ep.qC.width/2*100,c=ep.qC.height/2*100;return(0,r.jsxs)("svg",{className:"pointer-events-none absolute inset-0 h-full w-full",viewBox:"0 0 100 100",preserveAspectRatio:"xMidYMid slice","aria-hidden":"true",children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("mask",{id:n,children:[(0,r.jsx)("rect",{x:"0",y:"0",width:"100",height:"100",fill:"white"}),(0,r.jsx)("ellipse",{cx:a,cy:l,rx:i,ry:c,fill:"black"})]})}),(0,r.jsx)("rect",{x:"0",y:"0",width:"100",height:"100",fill:"rgba(11,18,32,0.55)",mask:"url(#".concat(n,")")}),(0,r.jsx)("ellipse",{cx:a,cy:l,rx:i,ry:c,fill:"none",stroke:t?"#22c55e":"rgba(255,255,255,0.7)",strokeWidth:"1.4"})]})}function ew(e,t){let s=t.marginDb.toFixed(1);switch(t.reasonCode){case"muted":return e("proctoring.setup.gate.muted");case"noisy":return e("proctoring.setup.gate.noisy");case"hearing_low":return e("proctoring.setup.gate.hearingLow",{margin:s});case"hearing_marginal":return e("proctoring.setup.gate.hearingMarginal",{margin:s});case"unavailable":return e("proctoring.setup.gate.unavailable");default:return t.reason||e("proctoring.setup.steps.environment.checkFailed")}}let eb=function(e,t,s){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:eh.r8;return[{id:"copyright",title:s("proctoring.setup.steps.copyright.title"),description:s("proctoring.setup.steps.copyright.description"),mobileDescription:s("proctoring.setup.steps.copyright.description"),icon:M.A,status:"pending",required:!0,estimatedTime:"30 seconds",instructions:[]},{id:"face-detection",title:s("proctoring.setup.steps.faceDetection.title"),description:s("proctoring.setup.steps.faceDetection.description"),mobileDescription:s("proctoring.setup.steps.faceDetection.mobileDescription"),icon:F.A,status:"pending",required:!0,estimatedTime:"2 minutes",instructions:[s("proctoring.setup.steps.faceDetection.instructions.0"),s("proctoring.setup.steps.faceDetection.instructions.1"),s("proctoring.setup.steps.faceDetection.instructions.2")],troubleshooting:[s("proctoring.setup.steps.camera.troubleshooting.0"),s("proctoring.setup.steps.camera.troubleshooting.1"),s("proctoring.setup.steps.camera.troubleshooting.2"),s("proctoring.setup.steps.faceDetection.troubleshooting.0"),s("proctoring.setup.steps.faceDetection.troubleshooting.1"),s("proctoring.setup.steps.faceDetection.troubleshooting.2"),s("proctoring.setup.steps.faceDetection.troubleshooting.3")]},{id:"microphone-setup",title:s("proctoring.setup.steps.environment.title"),description:s("proctoring.setup.steps.environment.description"),mobileDescription:s("proctoring.setup.steps.environment.mobileDescription"),icon:H.A,status:"pending",required:!0,estimatedTime:"1 minute",instructions:r.environment?[s("proctoring.setup.steps.environment.instructions.0"),s("proctoring.setup.steps.environment.instructions.1")]:[],troubleshooting:[s("proctoring.setup.steps.microphone.troubleshooting.0"),s("proctoring.setup.steps.microphone.troubleshooting.1"),s("proctoring.setup.steps.microphone.troubleshooting.2"),...r.environment?[s("proctoring.setup.steps.environment.troubleshooting.0"),s("proctoring.setup.steps.environment.troubleshooting.1"),s("proctoring.setup.steps.environment.troubleshooting.2")]:[]]},{id:"rules",title:s("proctoring.setup.steps.rules.title"),description:s("proctoring.setup.steps.rules.description"),mobileDescription:s("proctoring.setup.steps.rules.description"),icon:O.A,status:"pending",required:!0,estimatedTime:"30 seconds",instructions:[]}].filter(e=>(!e.mobileOnly||!!t)&&(!e.desktopOnly||!t)&&("face-detection"!==e.id||!!r.camera||!!r.faceDetection)&&("microphone-setup"!==e.id||!!r.microphone||!!r.environment))};function ey(){var e=(0,em.o6)([],Date.now());try{sessionStorage.setItem("proctoringPreflightReport",JSON.stringify(e)),window.proctoringPreflightReport=e}catch(e){}}function ev(){ey(),window.proctoringSetupData||(window.proctoringSetupData={ski
1ppedByPolicy:!0})}let ej=e=>{var t,n;let{onSetupComplete:a,onCancel:l,assessmentId:i,userId:c,courseId:d,onAudioGatePass:u}=e,{t:m}=(0,eo.Bd)("common"),h=(0,k.A)(),f=(0,eu.Q)(),g=(0,o.useRef)(a);g.current=a;let{state:p,dispatch:x,setError:w}=(0,K.aD)(),{deviceType:b,isMobile:y}=(0,K.Lj)(),v=(0,o.useCallback)((e,t,s)=>{i&&"default-assessment"!==i&&(0,ef.kW)({enrollmentId:i,step:e,failureType:t,details:s})},[i]),j=(0,o.useCallback)(e=>{let t="",s="";if(e instanceof Error)t=e.message.toLowerCase(),s=e.name;else{if("string"!=typeof e)return m("proctoring.setup.errors.setupError");t=e.toLowerCase()}return t.includes("permission denied")||t.includes("notallowederror")||t.includes("not allowed")||"NotAllowedError"===s?m("proctoring.setup.errors.permissionDenied"):e instanceof Error?e.message:"string"==typeof e?e:m("proctoring.setup.errors.setupError")},[m]);(0,Z.e)({enableRealTimeSync:!1,enableOptimisticUpdates:!0,enableAutoHeartbeat:!1,enableEventLogging:!0}),(0,$.Hu)(b),(0,$.kH)();let[N,A]=(0,o.useState)(0),[S,I]=(0,o.useState)(eh.r8),[C,D]=(0,o.useState)(!1),[E,P]=(0,o.useState)([]);(0,o.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await f.getRuntimeProctoringConfig(d,i);if(e)return;if((0,ei.Ny)({proctoringEnabled:(null==t?void 0:t.proctoringEnabled)!==!1,watermarkEnabled:(null==t?void 0:t.watermarkEnabled)===!0,integrityEnabled:(null==t?void 0:t.integrityEnabled)!==!1,trackedCodes:(null==t?void 0:t.trackedCodes)||[],featureConfig:null==t?void 0:t.featureConfig,integrity:null==t?void 0:t.integrity,coverage:null==t?void 0:t.coverage}),(null==t?void 0:t.proctoringEnabled)===!1){let e=(0,eh.dW)({});I(e),P(eb(b,y,m,e).filter(e=>"copyright"===e.id));return}let s=(0,eh.dW)(null==t?void 0:t.featureConfig);I(s),P(eb(b,y,m,s))}catch(s){if(e)return;let t=(0,eh.dW)();I(t),P(eb(b,y,m,t))}finally{e||D(!0)}})(),()=>{e=!0}},[f,i,d,b,y,m]);let[L,R]=(0,o.useState)(!0),[T,M]=(0,o.useState)(!0),[H,J]=(0,o.useState)(!1),[el,ec]=(0,o.useState)(!1),[em,ej]=(0,o.useState)(!1),[eN,ek]=(0,o.useState)("fair"),[eA,eS]=(0,o.useState)(null),[eI,eC]=(0,o.useState)(!1),[eD,eE]=(0,o.useState)(0),[eP,eL]=(0,o.useState)(!1),[eR,eT]=(0,o.useState)(null),[eM,eF]=(0,o.useState)(!1),[eH,eO]=(0,o.useState)(0),[e_,eB]=(0,o.useState)(0),[eW,ez]=(0,o.useState)(!1),[eU,eq]=(0,o.useState)([]),[eG,eV]=(0,o.useState)({count:0,required:y?en.SJ:en.yW,startTime:null}),[eQ,eY]=(0,o.useState)(["front"]),[eK,eZ]=(0,o.useState)(null),[e$,eJ]=(0,o.useState)(null),[eX,e0]=(0,o.useState)([]),[e1,e2]=(0,o.useState)(null),[e4,e5]=(0,o.useState)(!1),[e3,e6]=(0,o.useState)(null),[e7,e8]=(0,o.useState)(!1),[e9,te]=(0,o.useState)(!1),[tt,ts]=(0,o.useState)(!1),[tr,tn]=(0,o.useState)(null),[ta,to]=(0,o.useState)(""),[tl,ti]=(0,o.useState)(!1),[tc,td]=(0,o.useState)(!1),[tu,tm]=(0,o.useState)(null),[th,tf]=(0,o.useState)(null),tg=(0,o.useRef)(null),tp=(0,o.useRef)(null),tx=(0,o.useRef)(!1),tw=(0,o.useRef)(null),tb=(0,o.useRef)(null),ty=(0,o.useRef)(null),tv=(0,o.useRef)(null),tj=(0,o.useRef)(!1),tN=(0,o.useRef)(!1),tk=(0,o.useRef)(!1),tA=(0,o.useRef)("front"),tS=(0,o.useRef)(null),tI=(0,o.useRef)(!1),tC=(0,o.useRef)(null),tD=(0,o.useRef)(async()=>{}),tE=(0,o.useRef)(0),tP=(0,o.useRef)(!1),tL=(0,o.useRef)(null),tR=(0,o.useRef)(()=>{}),tT=(0,o.useRef)(!1),tM=(0,o.useRef)(null),tF=(0,o.useRef)(null),tH=(0,o.useRef)(null),tO=(0,o.useRef)(!1),t_=(0,o.useRef)(!1),tB=(0,o.useRef)(0),tW=(0,o.useRef)(async()=>{}),tz=(0,o.useRef)(null),tU=(0,o.useRef)([]),tq=(0,o.useRef)(null),tG=(0,o.useCallback)(function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=tH.current;if(t){try{t.stopMeter()}catch(e){}if(e)try{t.stream.getTracks().forEach(e=>e.stop())}catch(e){}(0,X.w6)(t.audioContext),tH.current=null,tM.current&&(tM.current=null)}},[]),tV=(0,o.useCallback)(async()=>{if(!em&&!tT.current){tT.current=!0;try{let e=await (0,es.Wk)();if(!e.success)throw Error(e.errors.join(", ")||"SFace model failed to load");ej(!0)}catch(e){throw Error("Identity model could not be loaded. Please refresh and try again.")}finally{tT.current=!1}}},[em]),tQ=(0,o.useRef)(tV);tQ.current=tV;let tY=(0,o.useCallback)((e,t)=>{P(s=>s.map(s=>s.id===e?{...s,status:t}:s))},[]),tK=(0,o.useCallback)(()=>{A(e=>e+1)},[]),tZ=(0,o.useCallback)(()=>{!tx.current&&(E.some(e=>e.required&&"rules"!==e.id&&"success"!==e.status&&"skipped"!==e.status)||(tx.current=!0,tY("rules","success"),S.faceDetection||ev(),ey(),g.current(!0)))},[S.faceDetection,E,tY]),t$=(0,o.useCallback)(()=>{tE.current+=1,tb.current&&(clearInterval(tb.current),tb.current=null),ty.current&&(clearTimeout(ty.current),t
1y.current=null),tv.current&&(clearTimeout(tv.current),tv.current=null),tL.current&&(clearInterval(tL.current),tL.current=null),eF(!1),eL(!1),eT(null),ec(!1),e5(!1),e6(null),e8(!1),te(!1),ts(!1),tn(null),tI.current=!1,tC.current=null,t_.current=!1,eV({count:0,required:y?en.SJ:en.yW,startTime:null})},[y]),tJ=(0,o.useCallback)(()=>{t$(),tp.current&&(tp.current.getTracks().forEach(e=>e.stop()),tp.current=null,eS(null)),tG(!0),l()},[t$,l,tG]),tX=(0,o.useCallback)(async()=>{let e=tg.current;if(!e||!tp.current)return!1;try{let t=await function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{let{quality:r=.8,format:n="jpeg",maxWidth:a=1920,maxHeight:o=1080}=t,l=e.videoWidth,i=e.videoHeight;if(0===l||0===i)throw Error("Video element has no dimensions");let c=l,d=i;c>a&&(d=d*a/c,c=a),d>o&&(c=c*o/d,d=o);let u=(e,t)=>({blob:e,blobUrl:URL.createObjectURL(e),width:c,height:d,size:e.size,format:e.type,timestamp:Date.now(),metadata:{originalWidth:l,originalHeight:i,quality:r,captureMethod:t}}),m=()=>new Promise((t,s)=>{let a=document.createElement("canvas"),o=a.getContext("2d");if(!o)return void s(Error("Failed to get canvas context"));a.width=c,a.height=d,o.drawImage(e,0,0,c,d);let l=!1,i=(e,r)=>{l||(l=!0,window.clearTimeout(m),e?s(e):t(r))},m=window.setTimeout(()=>{i(Error("Image capture timeout"))},3e3);a.toBlob(e=>{if(!e)return void i(Error("Failed to create image blob"));i(void 0,u(e,"video_canvas"))},"image/".concat(n),r)});if("jpeg"===n&&"function"==typeof createImageBitmap)return(async()=>{try{let{grabVisionFrame:t}=await s.e(8665).then(s.bind(s,38665)),{getVisionWorkerClient:n}=await s.e(1689).then(s.bind(s,11689)),a=await t(e,Math.max(c,d));if(a){let e=n();if(await e.ready,e.isAvailable()){let t=await e.encode(a,r);if(t)return u(t,"vision_worker")}else try{a.close()}catch(e){}}}catch(e){}return m()})();return m()}catch(e){return console.error("Failed to capture image from video:",e),null}}(e,{quality:.8,format:"jpeg",maxWidth:1280,maxHeight:720});if(t)return await (0,et.Ay)({blob:t.blob,assessmentId:i,userId:c,metadata:{width:t.width,height:t.height,size:t.blob.size,format:"jpeg",quality:.8}}),URL.revokeObjectURL(t.blobUrl),tP.current=!0,eC(!0),!0}catch(e){throw Error("Baseline image capture failed: ".concat(e instanceof Error?e.message:"Unknown error"))}return!1},[i,c]),t0=(0,o.useCallback)(async()=>{try{tp.current&&(tp.current.getTracks().forEach(e=>e.stop()),tp.current=null,eS(null));let e=await (0,er.p)(y);tg.current&&(tg.current.srcObject=e,tg.current.muted=!0,tg.current.playsInline=!0,await (0,er.m)(tg.current,4e3)),tp.current=e,eS(e),S.faceDetection||tY("face-detection","success"),(async()=>{try{let{createMediaPipeDetection:e}=await s.e(9343).then(s.bind(s,29343)),{getMediaPipeModelUrl:t}=await Promise.resolve().then(s.bind(s,42865)),r=(0,ee.bO)();await e({modelAssetPath:t(),runningMode:"VIDEO",numFaces:r.maxFaces,minFaceDetectionConfidence:r.confidence,minFacePresenceConfidence:r.presenceConfidence,minTrackingConfidence:r.trackingConfidence,outputFaceBlendshapes:!1,outputFacialTransformationMatrixes:!1,personSwap:{enabled:!1}})}catch(e){}})()}catch(t){tY("face-detection","error");let e=j(t);w(e||m("proctoring.setup.errors.cameraFailed")),v("face-detection",(0,ef.bL)(t),e||m("proctoring.setup.errors.cameraFailed"))}},[y,tY,w,j,m,S.faceDetection,v]),t1=(0,o.useCallback)(async()=>{let e=++tB.current;tO.current=!1,tY("microphone-setup","testing"),w(null),ez(!1),tf(null);try{tG(!0);let t=await (0,X.Gq)();if(e!==tB.current)return void t.stream.getTracks().forEach(e=>e.stop());let s=t.applied.deviceId;if(s){to(s);try{sessionStorage.setItem("proctoringAudioDeviceId",s)}catch(e){}}tH.current={stream:t.stream,applied:t.applied,stopMeter:()=>{}},tM.current=()=>tG(!0),S.environment?await tW.current(e):tY("microphone-setup","success")}catch(s){if(e!==tB.current)return;tG(!0),tY("microphone-setup","error");let t=s instanceof X.Cd?s.message:j(s)||m("proctoring.setup.errors.microphoneFailed");w(t),v("microphone-setup",s instanceof X.Cd?s.code.toLowerCase():(0,ef.bL)(s),t)}},[tY,w,j,m,tG,S.environment,v]),t2=(0,o.useCallback)(e=>{if(tj.current)return;tj.current=!0,t$(),tY("face-detection","error"),e2(null),eZ(null);let t="identity-image"===e?"proctoring.setup.errors.identityImageFailed":"too-far"===e?"proctoring.setup.errors.tooFarFromCamera":"pose-timeout"===e?"proctoring.setup.errors.poseTimeout":"proctoring.setup.errors.faceDetectionFailed";w(m(t)),eE(e=>e+1),v("face-detection",e||"face_detection_failed",m(t))},[t$,tY,w,m,v]),t4=(0,o.useCallback)(async()=>{let e=tE.current;if(!em||!tg.current||!tp.current)return void t2();tg.current.srcObject!==tp.current&&(tg.current.srcObject=tp.current);try{await (0,er.m)(tg.current,4e3)}catch(t){if(e!==tE.current)return;t2();return}if(e===tE.current){if(0===tg.current.videoWidth||0===tg.current.videoHeight)return void t2();try{await (0,ea.ensureSfaceSession)()}catch(t){if(e!==tE.current)return;t2();return}if(e===tE.current){tY("face-detection","testing"),w(null),eV({count:0,required:y?en.SJ:en.yW,startTime:Date.now()});try{let{createMediaPipeDetection:t}=await s.e(9343).then(s.bind(s,29343)),{getMediaPipeModelUrl:r}=await Promise.resolve().then(s.bind(s,42865));if(e!==tE.current)return;let n=(0,ee.bO)(),a=await t({modelAssetPath:r(),runningMode:"VIDEO",numFaces:n.maxFaces,minFaceDetectionConfidence:n.confidence,minFacePresenceConfidence:n.presenceConfidence,minTrackingConfidence:n.trackingConfidence,outputFaceBlendshapes:!1,outputFacialTransformationMatrixes:!1,personSwap:{enabled:!1}});if(e!==tE.current)return;if(!a)throw Error("Failed to initialize MediaPipe for unified setup");let o=0,l=null,i=null,d=null,u=tl?null:await (0,et.y3)(c),m=(0,eg.NM)().personSwapEnrollmentPoses,h=(0,ep.QU)((0,ei.z5)("PERSON_
1SWAP")||m.length>1,m);eY(h),e0([]),eZ("front"),eJ(null),e2("front"),tA.current="front";let f={},g=h.filter(e=>"front"!==e),p=0,x=null,b=async()=>{if(e!==tE.current||!l||!i||!d||!tP.current)return;tb.current&&(clearInterval(tb.current),tb.current=null),ty.current&&(clearTimeout(ty.current),ty.current=null),f.front||(f.front=i),await a.setEnrolledPerson(i,d,f);let t={gazeCalibrationData:l,faceDescriptor:i,enrolledPersonId:d,mediaPipeInstance:a,faceGallery:f,enrollmentPoses:h};window.proctoringSetupData=t,e2(null),tA.current="front",tY("face-detection","success"),setTimeout(()=>{e===tE.current&&t$()},100)},v=e=>{g=e,p=Date.now(),tA.current="pose",e2("pose"),eF(!1),eZ(e[0]),eJ(null),e5(!1),tn(null),tS.current=null,e6(null)},j=()=>{tS.current=null,e6(null)},N=()=>{e8(!0),window.setTimeout(()=>e8(!1),ep.R_)};tD.current=async()=>{if(e!==tE.current||tI.current)return;let t=tC.current,s=tg.current;if(!t||!s)return void j();tI.current=!0,te(!0);try{let r="pose"===tA.current&&g[0]||"front";if(!((e,t,s)=>{let r=(0,ep.eX)(t,s.videoWidth,s.videoHeight);return!!r&&(0,ep.m6)(e,r,x)})(r,t.landmarks,s)){j(),e5(!1);return}l||(l={baselineGaze:{x:t.gaze.x,y:t.gaze.y},timestamp:Date.now(),confidence:Math.max(t.gaze.confidence,.5),sessionId:"session_".concat(Date.now())});let n=await a.extractFaceDescriptorForEnrollment(s,t.landmarks);if(e!==tE.current)return;if(!n)return void j();if("front"===r){let e=(0,ep.eX)(t.landmarks,s.videoWidth,s.videoHeight);e&&(x=e.pitch);let r=(0,en.dW)(u)&&u&&(0,en.Pv)((0,en.Lb)(n,u.descriptor),en.sU)?u.enrolledPersonId:"person_".concat(Date.now());i=n,d=r,f={front:n},await a.setEnrolledPerson(i,d,f),(0,et.$i)({userId:c,descriptor:Array.from(n),enrolledPersonId:d,modelId:en.pz,poses:(0,ep.Zk)(f)}),tP.current||await tX(),N(),e0(["front"]),0===g.length?await b():v(g);return}if(!f.front)return void j();if(f[r]=n,(0,et.$i)({userId:c,descriptor:Array.from(f.front),enrolledPersonId:d||"person_".concat(Date.now()),modelId:en.pz,poses:(0,ep.Zk)(f)}),g=g.slice(1),N(),e0(h.filter(e=>"front"===e||!!f[e])),tn(null),0===g.length)return void await b();v(g)}finally{tI.current=!1,te(!1)}};let k=async()=>{if(e===tE.current&&!t_.current&&tg.current){t_.current=!0;try{var t,s;let r=await a.detectFromVideo(tg.current,Date.now(),{scoreIdentity:!1});if(e!==tE.current)return;if(tg.current.videoWidth>0&&tg.current.videoHeight>0){let e=null!=(t=tw.current)?t:tw.current=document.createElement("canvas");ek(function(e,t){let s=e.getContext("2d",{willReadFrequently:!0});if(!s||t.videoWidth<1||t.videoHeight<1)return"fair";let r=Math.max(1,Math.round(t.videoHeight/t.videoWidth*64));64!==e.width&&(e.width=64),e.height!==r&&(e.height=r),s.drawImage(t,0,0,64,r);let n=s.getImageData(0,0,64,r).data,a=0,o=n.length/4;for(let e=0;e<n.length;e+=4)a+=(n[e]+n[e+1]+n[e+2])/3;let l=a/o;return l>120?"good":l>60?"fair":"poor"}(e,tg.current))}if(r&&1===r.faces.length){ts(!1);let e=r.faces[0],t=tg.current,n="pose"===tA.current&&g[0]||"front",a=(0,en.GK)((null==(s=e.boundingBox)?void 0:s.width)>0?e.boundingBox:e.landmarks,t.videoWidth,t.videoHeight,"front"===n?ep.MZ:en.Ic),i="close"!==n&&"chin-down"!==n;if("pose"===tA.current&&Date.now()-p>ep.Y2&&null==tS.current&&!tI.current)return void t2("pose-timeout");o=0,J(!0),w(null),tC.current={landmarks:e.landmarks,gaze:e.gazeDirection},i&&a?(tk.current=!0,tN.current=!0,ec(!0),e5(!1)):(tN.current=!1,ec(!1));let c=(0,ep.eX)(e.landmarks,t.videoWidth,t.videoHeight),d=!!c&&(0,ep.m6)(n,c,x)&&!(i&&a);c?(eJ((0,ep.hO)(n,c,x)),e5(d)):(eJ("look-straight"),e5(!1)),d&&null==tS.current&&!tI.current?(tS.current=ep.ep,e6(ep.ep)):d||null==tS.current||tI.current||(tS.current=null,e6(null)),!l&&e.gazeDirection.confidence>.3&&(l={baselineGaze:{x:e.gazeDirection.x,y:e.gazeDirection.y},timestamp:Date.now(),confidence:e.gazeDirection.confidence,sessionId:"session_".concat(Date.now())}),eV(e=>({...e,count:Math.min(e.required,e.count+1)}))}else r&&r.faces.length>1?(o++,tC.current=null,J(!1),e5(!1),ts(!0),ec(!1),tN.current=!1,null!=tS.current&&(tS.current=null,e6(null)),o>3&&t2()):(tC.current=null,J(!1),e5(!1),ts(!1),tN.current=!1,ec(!1),null!=tS.current&&(tS.current=null,e6(null)));o>=10&&t2(tk.current?"too-far":void 0)}catch(e){o++}finally{t_.current=!1}}};eF(!1),k(),tb.current=setInterval(()=>{e===tE.current&&k().catch(()=>{e===tE.current&&++o>=10&&t2(tk.current?"too-far":void 0)})},y?en.Mr:en.el),ty.current=setTimeout(()=>{e===tE.current&&"pose"!==tA.current&&(i?tP.current||t2("identity-image"):t2(tk.current?"too-far":void 0))},45e3)}catch(t){if(e!==tE.current)return;t2()}}}},[em,y,tX,t2,t$,tY,w,tl,c]),t5=(0,o.useCallback)(()=>{tL.current&&(clearInterval(tL.current),tL.current=null);let e=tE.current;tj.current=!1,ec(!1),tN.current=!1,tk.current=!1,tA.current="front",e2("front"),eZ("front"),eJ(null),e0([]),e5(!1),e6(null),e8(!1),tn(null),eL(!0),eT(null),eF(!0),ts(!1),eO(0),eV({count:0,required:y?en.SJ:en.yW,startTime:Date.now()}),tC.current=null,tE.current===e&&t4()},[t4,y]);tR.current=t5,(0,o.useEffect)(()=>
1{if(tS.current=e3,null===e3)return;if(e3<=0){e6(null),tD.current();return}let e=window.setTimeout(()=>{e6(e=>null===e?null:e-1)},1e3);return()=>window.clearTimeout(e)},[e3]);let t3=(0,o.useCallback)(async e=>{let t=null!=e?e:tB.current;if(!tO.current){tO.current=!0,tY("microphone-setup","testing"),ez(!0),eB(0),eq([]),tf(null);try{var s;if(tF.current){try{tF.current()}catch(e){}tF.current=null}null==(s=tH.current)||s.stopMeter();let e=Array(48).fill(0),r=tH.current,n=!!r&&(!ta||r.applied.deviceId===ta),a=(0,X.oN)((0,ei.W0)("AUDIO_NOISY_PLACE",-30)),o=await (0,X.al)({deviceId:ta||void 0,durationMs:5e3,minDurationMs:2500,noisyMinDbfs:a.noisyMin,marginFailDb:a.marginFail,marginWarnDb:a.marginWarn,existingStream:n?r.stream:void 0,existingApplied:n?r.applied:void 0,onProgress:(t,s)=>{eB(s);let r=Math.max(0,Math.min(1,(s+65)/35));(e=e.slice(1)).push(r);let n=e[0],a=e.map((e,t)=>0===t?(n=e,e):n=.4*n+.6*e);eq(a)}});if(t!==tB.current)return;if(tG(!0),"fail"===o.verdict){tY("microphone-setup","error");let e=ew(m,o);w(e),ez(!1),v("microphone-setup",o.reasonCode||"environment_check_failed",e);return}tm(o),tz.current=o;try{sessionStorage.setItem("proctoringAudioGate",JSON.stringify(o)),window.proctoringAudioGate=o}catch(e){}null==u||u(o),"warn"===o.verdict&&o.reason&&tf(o.reasonCode||"hearing_marginal"),tY("microphone-setup","success"),ez(!1)}catch(e){if(t!==tB.current)return;if(tG(!0),tY("microphone-setup","error"),w(m("proctoring.setup.steps.environment.checkFailed")),ez(!1),v("microphone-setup","environment_check_failed",m("proctoring.setup.steps.environment.checkFailed")),tF.current){try{tF.current()}catch(e){}tF.current=null}}finally{t===tB.current&&(tO.current=!1)}}},[ta,tY,w,m,u,tG,v]);tW.current=t3,(0,o.useEffect)(()=>{let e=tU.current[N],t=tq.current;if(e&&t){let s=t.getBoundingClientRect(),r=e.getBoundingClientRect(),n=s.width/2,a=r.left-s.left+r.width/2,o=t.scrollLeft+a-n;t.scrollTo({left:o,behavior:"smooth"})}},[N]);let t6=null==(t=E[N])?void 0:t.id,t7=null==(n=E[N])?void 0:n.status;(0,o.useEffect)(()=>{if(t6&&"pending"===t7)switch(t6){case"face-detection":tp.current||t0();break;case"microphone-setup":t1()}},[t6,t7,t0,t1,t3]),(0,o.useEffect)(()=>{if("success"!==t7||"face-detection"!==t6&&"microphone-setup"!==t6)return;let e=setTimeout(()=>{tK()},"face-detection"===t6?2e3:700);return()=>clearTimeout(e)},[t6,t7,tK]),(0,o.useEffect)(()=>{"face-detection"===t6&&(0,et.y3)(c).then(e=>{td((0,en.dW)(e))}).catch(()=>{td(!1)})},[t6,c]),(0,o.useEffect)(()=>{if(!C)return;let e=(0,eg.NM)().personSwapEnrollmentPoses;eY((0,ep.QU)((0,ei.z5)("PERSON_SWAP")||e.length>1,e))},[C]),(0,o.useEffect)(()=>{if(!C)return;let e=!1;return(async()=>{try{if(R(!0),x({type:"INITIALIZE",payload:{assessmentId:i,userId:c}}),S.camera||S.faceDetection?await tQ.current():ej(!0),e)return;if(!(0,ei.Ai)()){ev(),tx.current||(tx.current=!0,g.current(!0)),R(!1);return}R(!1)}catch(t){if(e)return;w(m("proctoring.setup.errors.initializationFailed")),R(!1),v("initialization","model_load_failed",m("proctoring.setup.errors.initializationFailed"))}})(),()=>{if(e=!0,tp.current&&(tp.current.getTracks().forEach(e=>e.stop()),tp.current=null),tb.current&&clearInterval(tb.current),ty.current&&clearTimeout(ty.current),tv.current&&clearTimeout(tv.current),tG(!0),tF.current){try{tF.current()}catch(e){}tF.current=null}tO.current=!1}},[x,i,c,w,tG,C,S.camera,S.faceDetection,v]),(0,o.useEffect)(()=>{"face-detection"===t6&&eA&&tg.current&&tg.current.srcObject!==eA&&(tg.current.srcObject=eA,tg.current.play().catch(()=>{}))},[t6,eA]);let t8=(0,o.useCallback)(()=>{let e=E[N];if(e){if("face-detection"===e.id){t$(),tj.current=!1,tN.current=!1,tk.current=!1,tP.current=!1,w(null),ec(!1),J(!1),eC(!1),ti(!1),eO(0),ek("fair"),e2(null),eZ(null),eJ(null),delete window.proctoringSetupData,(0,et.yH)(),tY("face-detection","pending");let e=tp.current;e&&tg.current&&(tg.current.srcObject!==e&&(tg.current.srcObject=e),setTimeout(()=>tR.current(),50));return}if(w(null),"microphone-setup"===e.id){if(tG(!0),tF.current){try{tF.current()}catch(e){}tF.current=null}ez(!1),eB(0),eq([]),tf(null),tO.current=!1}tY(e.id,"pending")}},[E,N,t$,tG,w,tY]),t9=E[N],se=Math.max(1,eQ.length),st=eX.length,ss=eK||"front",sr=Math.max(0,eQ.indexOf(ss)),sn=e4&&!e9&&null===e3&&H&&!tt&&!el,sa=t9&&"face-detection"===t9.id?"success"===t9.status?m("proctoring.setup.steps.faceDetection.identityVerified"):e9?m("proctoring.setup.steps.faceDetection.capturing"):null!==e3?m("proctoring.setup.steps.faceDetection.holdStill"):"mismatch"===tr?m("proctoring.setup.steps.faceDetection.didNotMatch"):eM?m("proctoring.setup.steps.faceDetection.preparing"):eP?tt?m("proctoring.setup.steps.faceDetection.onlyOnePerson"):el?m("proctoring.setup.steps.faceDetection.tooFarFromCamera"):H?e4?m("proctoring.setup.steps.faceDetection.captureHint"):e$?m("proctoring.setup.steps.faceDetection.poseHints.".concat(e$)):m("proctoring.setup.steps.faceDetection.poses.".concat(ss,".hint")):m("proctoring.setup.steps.faceDetection.fillOval"):m("proctoring.setup.steps.faceDetection.ready"):"";return L||!C?(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black p-0 sm:bg-black/50 sm:p-4",children:(0,r.jsx)(G.Zp,{className:"h-[100dvh] w-full max-w-none rounded-none sm:h-auto sm:max-w-md
1sm:rounded-lg",children:(0,r.jsx)(G.Wu,{className:"p-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,r.jsx)(_.A,{className:"h-8 w-8 animate-spin text-blue-500"}),(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("h3",{className:"font-medium mb-2",children:m("proctoring.setup.initializing")}),(0,r.jsx)("p",{className:"text-sm text-gray-600",children:y?m("proctoring.setup.loadingModels"):m("proctoring.setup.loadingDesktop")})]}),(0,r.jsx)(Q.k,{value:em?100:50,className:"w-full"})]})})})}):t9?(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black p-0 sm:bg-black/70 sm:p-4 sm:backdrop-blur-sm",children:(0,r.jsxs)(G.Zp,{className:"mx-auto flex h-[100dvh] w-full max-w-none flex-col rounded-none shadow-lg sm:h-auto sm:max-h-[95vh] sm:max-w-4xl sm:rounded-lg",dir:h?"rtl":"ltr",children:[(0,r.jsxs)(G.aR,{className:"shrink-0 border-b border-border p-4 pb-3 pt-[max(1rem,env(safe-area-inset-top))] sm:p-6 sm:pt-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,r.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,r.jsx)("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-blue-50 sm:h-12 sm:w-12",children:(0,r.jsx)(B.A,{className:"h-5 w-5 text-blue-600 sm:h-6 sm:w-6"})}),(0,r.jsx)("div",{className:"min-w-0",children:(0,r.jsxs)(G.ZB,{className:"text-lg font-semibold text-gray-900 sm:text-xl",dir:h?"rtl":"ltr",children:[(0,r.jsx)("span",{className:"sm:hidden",children:m("proctoring.setup.mobileTitle")}),(0,r.jsx)("span",{className:"hidden sm:inline",children:m("proctoring.setup.title")})]})})]}),(0,r.jsx)(V.$,{variant:"ghost",size:"sm",onClick:tJ,className:"h-10 w-10 shrink-0 rounded-full p-0 hover:bg-gray-100 sm:h-8 sm:w-8",title:m("proctoring.setup.buttons.cancel"),children:(0,r.jsx)(W.A,{className:"h-4 w-4 text-gray-600"})})]}),(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-3",dir:h?"rtl":"ltr",children:m("proctoring.setup.stepProgress",{current:N+1,total:E.length})})]}),(0,r.jsx)(G.Wu,{className:"min-h-0 flex-1 overflow-y-auto p-4 sm:p-6",children:(0,r.jsxs)("div",{className:"space-y-4 p-0 sm:space-y-6 sm:p-2",children:[p.error&&(0,r.jsx)(Y.A,{type:"error",title:m("proctoring.setup.errors.setupError"),message:p.error,variant:"face-detection"===t9.id?"simple":"withButtons",actionLabel:m("proctoring.setup.buttons.retry"),onAction:t8,persistentAlert:!0},eD),(0,r.jsx)("div",{ref:tq,className:"mt-1 overflow-x-auto no-scrollbar",dir:h?"rtl":"ltr",children:(0,r.jsx)("div",{className:"flex items-center gap-2 min-w-max",children:E.map((e,t)=>{let s=t===N,n="success"===e.status||"skipped"===e.status,a=e.icon;return(0,r.jsxs)("div",{ref:e=>{tU.current[t]=e},className:"flex items-center gap-2 px-3 py-1.5 rounded-full border text-xs transition-all duration-300 select-none ".concat(s?"bg-blue-600 text-white border-blue-600 shadow":n?"bg-green-50 text-green-700 border-green-200":"bg-gray-50 text-gray-600 border-gray-200"),children:[(0,r.jsx)(a,{className:"h-3.5 w-3.5 ".concat(s?"text-white":n?"text-green-600":"text-blue-600")}),(0,r.jsx)("span",{className:"whitespace-nowrap",children:e.title})]},e.id)})})}),t9&&(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsx)("h3",{className:"text-base font-semibold text-gray-900 sm:text-lg",dir:h?"rtl":"ltr",children:t9.title}),"face-detection"!==t9.id&&(0,r.jsx)("p",{className:"text-sm text-gray-600",dir:h?"rtl":"ltr",children:y&&t9.mobileDescription?t9.mobileDescription:t9.description})]}),"copyright"===t9.id&&(0,r.jsxs)("div",{className:"mx-auto max-w-lg space-y-4 text-center",children:[(0,r.jsx)("p",{className:"text-sm text-gray-700",dir:h?"rtl":"ltr",children:m("proctoring.setup.copyrightBody1")}),(0,r.jsx)("p",{className:"text-sm text-gray-700",dir:h?"rtl":"ltr",children:m("proctoring.setup.copyrightBody2")}),(0,r.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-3 text-sm font-medium text-gray-900",children:m("proctoring.setup.copyrightCallout")}),(0,r.jsx)("a",{href:"/terms-and-conditions",target:"_blank",rel:"noreferrer",className:"inline-block text-sm text-blue-700 underline",children:m("proctoring.setup.copyrightLearnMore")})]}),"rules"===t9.id&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsx)("p",{className:"text-sm text-gray-700",children:m("proctoring.setup.rulesIntro")}),(0,r.jsx)(ed,{})]}),"microphone-setup"===t9.id&&(0,r.jsxs)("div",{className:"mx-auto max-w-md
1space-y-4",children:[(0,r.jsx)("p",{className:"text-sm text-gray-600",children:eW?m("proctoring.setup.steps.environment.checking"):m("proctoring.setup.steps.environment.willCheck")}),th&&"success"===t9.status&&(0,r.jsxs)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-900",children:[(0,r.jsx)("p",{className:"mb-2",children:tu?ew(m,tu):m("proctoring.setup.gate.hearingMarginal",{margin:"0"})}),(0,r.jsxs)(V.$,{variant:"outline",size:"sm",onClick:()=>{tf(null),tY("microphone-setup","pending")},className:"gap-1",children:[(0,r.jsx)(_.A,{className:"h-3 w-3"}),m("proctoring.setup.buttons.retry")]})]}),tu&&"success"===t9.status&&!th&&(0,r.jsxs)("p",{className:"text-center text-xs text-gray-500",children:["Floor ",tu.roomFloorDbfs.toFixed(1)," dBFS \xb7 margin ",tu.marginDb.toFixed(1)," dB"]}),eW&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-gray-200 bg-white p-4",children:[(0,r.jsx)("h4",{className:"mb-2 text-center text-sm font-medium text-gray-900",children:m("proctoring.setup.steps.environment.audioCheck")}),(0,r.jsx)("div",{className:"h-24 overflow-hidden rounded-lg border border-gray-300 bg-gray-100",children:(0,r.jsxs)("svg",{className:"h-full w-full",viewBox:"0 0 100 100",preserveAspectRatio:"none",children:[(0,r.jsx)("defs",{children:(0,r.jsxs)("linearGradient",{id:"waveGradient",x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:[(0,r.jsx)("stop",{offset:"0%",stopColor:"#10b981"}),(0,r.jsx)("stop",{offset:"50%",stopColor:"#f59e0b"}),(0,r.jsx)("stop",{offset:"100%",stopColor:"#ef4444"})]})}),(0,r.jsx)("path",{d:"M 0,50 ".concat(eU.map((e,t)=>"L ".concat(t/Math.max(1,eU.length-1)*100,",").concat(50-40*e)).join(" ")," L 100,50"),fill:"none",stroke:"url(#waveGradient)",strokeWidth:"1.5"}),(0,r.jsx)("line",{x1:"0",y1:"50",x2:"100",y2:"50",stroke:"#9ca3af",strokeWidth:"0.3"})]})})]}),(0,r.jsx)("div",{className:"text-center",children:(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-lg bg-blue-50 px-4 py-2",children:[(0,r.jsx)("div",{className:"h-2 w-2 animate-pulse rounded-full bg-blue-500"}),(0,r.jsx)("span",{className:"text-sm font-medium text-blue-700",children:m("proctoring.setup.steps.environment.analyzing")})]})})]})]}),(eA||"face-detection"===t9.id)&&"face-detection"===t9.id&&(0,r.jsxs)("div",{className:"mx-auto w-full max-w-[420px] space-y-4",children:[eP&&se>1&&"success"!==t9.status&&(0,r.jsx)("p",{className:"text-center text-xs text-gray-500",dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.poseProgress",{current:Math.min(se,st+1),total:se})}),(0,r.jsxs)("div",{className:"relative mx-auto aspect-square w-full overflow-hidden rounded-xl border-2 border-gray-200 bg-gray-900 shadow-md",children:[(0,r.jsx)("video",{ref:tg,autoPlay:!0,muted:!0,playsInline:!0,className:"absolute inset-0 h-full w-full bg-gray-900 object-cover",style:{transform:"scaleX(-1)"}}),!eA&&"error"!==t9.status&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:(0,r.jsx)("p",{className:"px-4 text-center text-sm text-white",children:m("proctoring.setup.requestingCamera")})}),eA&&eP&&"success"!==t9.status&&"error"!==t9.status&&(0,r.jsx)(ex,{ready:e4&&H&&!tt&&!el}),S.faceDetection&&"pending"===t9.status&&!eP&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center bg-black/25",children:(0,r.jsxs)("div",{className:"space-y-4 px-4 text-center",children:[(0,r.jsxs)(V.$,{onClick:t5,className:"min-h-12 w-full max-w-xs rounded-xl bg-customBlue-600 px-6 py-3 text-base font-medium text-white shadow-lg transition-all duration-200 hover:bg-customBlue-700 sm:w-auto sm:px-8 sm:text-lg",disabled:!eA,children:[(0,r.jsx)(F.A,{className:"mr-2 h-5 w-5"}),m("proctoring.setup.steps.faceDetection.startButton")]}),(0,r.jsx)("p",{className:"rounded-lg bg-black/50 px-3 py-2 text-xs font-medium text-white sm:px-4",dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.makeSureLooking")})]})}),null!==e3&&e3>0&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center",children:(0,r.jsx)("span",{className:"text-7xl font-bold text-white drop-shadow-[0_2px_12px_rgba(0,0,0,0.85)] sm:text-8xl",children:e3})}),e7&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-emerald-500/45",children:(0,r.jsx)(z.A,{className:"h-16 w-16 text-white drop-shadow"})}),"success"===t9.status&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-emerald-950/70",children:(0,r.jsxs)("div",{className:"px-4 text-center",children:[(0,r.jsx)("div",{className:"mx-auto mb-3 flex h-16 w-16 items-center justify-center rounded-full bg-emerald-500 shadow-lg",children:(0,r.jsx)(z.A,{className:"h-9 w-9 text-white"})}),(0,r.jsx)("p",{className:"text-lg font-semibold text-white",dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.identityVerified")}),(0,r.jsx)("p",{className:"mt-1 text-sm text-emerald-100",dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.identityVerifiedHint")})]})}),"poor"===eN&&"success"!==t9.status&&(0,r.jsx)("div",{className:"absolute right-3 top-3 z-10 rounded-lg bg-red-500/90 px-2 py-1.5 text-xs font-medium text-white shadow-lg backdrop-blur-sm sm:px-3",children:(0,r.jsx)("span",{dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.poorLighting")})}),"error"===t9.status&&(0,r.jsx)("div",{className:"absolute inset-0 z-20 flex flex-col items-center justify-center bg-black/55 px-4",children:(0,r.jsxs)("div",{className:"w-full max-w-xs space-y-4 text-center",children:[p.error&&(0,r.jsx)("p",{className:"rounded-lg bg-black/50 px-3 py-2 text-sm font-medium text-white",dir:h?"rtl":"ltr",children:p.error}),(0,r.jsxs)(V.$,{onClick:t8,className:"min-h-12 w-full rounded-xl bg-customBlue-600 px-6 py-3 text-base font-medium text-white shadow-lg transition-all duration-200 hover:bg-customBlue-700 sm:text-lg",children:[(0,r.jsx)(_.A,{className:"mr-2 h-5 w-5"}),m("proctoring.setup.buttons.retry")]})]})})]}
1),eP&&"success"!==t9.status&&"error"!==t9.status&&(0,r.jsxs)("div",{className:"space-y-1 text-center",children:[(0,r.jsx)("p",{className:"text-base font-semibold text-gray-900",dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.poses.".concat(ss,".title"))}),(0,r.jsx)("p",{className:"text-sm text-gray-600",dir:h?"rtl":"ltr",children:m("proctoring.setup.steps.faceDetection.poses.".concat(ss,".hint"))}),(0,r.jsx)("p",{className:"text-sm font-medium ".concat(sn?"text-emerald-600":"text-gray-700"),dir:h?"rtl":"ltr",children:sa})]}),eP&&(0,r.jsx)("div",{className:"flex items-center justify-center gap-2",role:"progressbar","aria-valuemin":0,"aria-valuemax":se,"aria-valuenow":st,children:eQ.map((e,t)=>{let s=eX.includes(e),n=t===sr&&"success"!==t9.status;return(0,r.jsx)("span",{className:"h-2.5 w-2.5 rounded-full ".concat(s?"bg-emerald-500":n?"bg-sky-500":"bg-gray-300")},e)})}),tc&&!eP&&"pending"===t9.status&&(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("button",{type:"button",onClick:async()=>{ti(!0),await (0,et.FJ)(c),td(!1)},className:"text-xs text-gray-500 underline underline-offset-2 hover:text-gray-800",children:m("proctoring.setup.reEnrollIdentity")})})]}),"error"===t9.status&&t9.troubleshooting&&(0,r.jsxs)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-xl p-4 space-y-4",children:[(0,r.jsxs)("h4",{className:"font-semibold text-yellow-900 flex items-center gap-2",dir:h?"rtl":"ltr",children:[(0,r.jsx)(U.A,{className:"h-5 w-5"}),m("proctoring.setup.troubleshooting")]}),(0,r.jsx)("ul",{className:"text-sm text-yellow-800 space-y-3",children:t9.troubleshooting.map((e,t)=>(0,r.jsxs)("li",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"flex-shrink-0 w-5 h-5 bg-yellow-600 text-white rounded-full flex items-center justify-center text-xs font-medium mt-0.5",children:"\uD83D\uDCA1"}),(0,r.jsx)("span",{className:"leading-relaxed",children:e})]},t))})]}),T&&t9.instructions.length>0&&!("face-detection"===t9.id&&(eP||"testing"===t9.status))&&(0,r.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-xl p-4 space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(O.A,{className:"h-4 w-4 text-blue-600"}),(0,r.jsx)("h3",{className:"font-semibold text-blue-900",dir:h?"rtl":"ltr",children:m("proctoring.setup.guidelines")})]}),(0,r.jsx)(V.$,{variant:"ghost",size:"sm",onClick:()=>M(!1),className:"h-6 w-6 p-0 hover:bg-blue-100",children:(0,r.jsx)(W.A,{className:"h-3 w-3"})})]}),(0,r.jsx)("ul",{className:"text-sm text-blue-800 space-y-3",children:t9.instructions.map((e,t)=>(0,r.jsxs)("li",{className:"flex items-start gap-3",children:[(0,r.jsx)("span",{className:"flex-shrink-0 w-2 h-2 bg-blue-600 rounded-full mt-2"}),(0,r.jsx)("span",{className:"leading-relaxed",children:e})]},t))})]})]})]})}),("copyright"===t9.id||"rules"===t9.id||"error"===t9.status&&"face-detection"!==t9.id)&&(0,r.jsxs)("div",{className:"shrink-0 border-t border-gray-200 bg-gray-50/50 p-3 sm:p-4 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:["copyright"===t9.id&&(0,r.jsx)("div",{className:"flex justify-stretch sm:justify-end",children:(0,r.jsxs)(V.$,{onClick:()=>{if(tY("copyright","success"),N>=E.length-1){if(tx.current)return;tx.current=!0,ey(),g.current(!0);return}tK()},className:"h-11 min-h-11 w-full min-w-0 bg-customBlue-600 text-white hover:bg-customBlue-700 sm:h-10 sm:w-auto sm:min-w-[160px]",children:[m("proctoring.setup.iUnderstand"),(0,r.jsx)(q.A,{className:"h-4 w-4 ".concat(h?"mr-2 rotate-180":"ml-2")})]})}),"copyright"!==t9.id&&(0,r.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:["error"===t9.status&&(0,r.jsxs)(V.$,{variant:"outline",onClick:t8,className:"flex h-11 min-h-11 w-full items-center justify-center gap-2 sm:h-10 sm:w-auto",children:[(0,r.jsx)(_.A,{className:"h-4 w-4"}),m("proctoring.setup.buttons.retry")]}),"rules"===t9.id&&(0,r.jsxs)(V.$,{onClick:tZ,className:"h-11 min-h-11 w-full bg-customBlue-600 text-white hover:bg-customBlue-700 sm:h-10 sm:w-auto",children:[m("proctoring.setup.buttons.startAssessment"),(0,r.jsx)(q.A,{className:"h-4 w-4 ".concat(h?"mr-2 rotate-180":"ml-2")})]})]})]})]})}):(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black p-0 sm:bg-black/50 sm:p-4",children:(0,r.jsx)(G.Zp,{className:"h-[100dvh] w-full max-w-none rounded-none sm:h-auto sm:max-w-md
1sm:rounded-lg",children:(0,r.jsx)(G.Wu,{className:"p-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[(0,r.jsx)(_.A,{className:"h-8 w-8 animate-spin text-blue-500"}),(0,r.jsx)("div",{className:"text-center",children:(0,r.jsx)("h3",{className:"font-medium mb-2",children:m("proctoring.setup.initializing")})})]})})})})},eN=e=>(0,r.jsx)(J.A,{assessmentId:e.assessmentId,userId:e.userId,maxRetries:3,enableReporting:!0,children:(0,r.jsx)(ej,{...e})}),ek=e=>{let{onComplete:t,onCancel:s,assessmentId:n,userId:a,courseId:o}=e;return(0,r.jsx)(eN,{onSetupComplete:e=>{e&&t()},onCancel:s,assessmentId:n,userId:a,courseId:o})};var eA=s(91788),eS=s(5196),eI=s(31595),eC=s(37718);let eD=async(e,t,s,r,n)=>{try{let a=(null==r?void 0:r.toLowerCase())==="abu dhabi",o=t.includes("Guide.pdf");if(!o&&(0,eC.I1)(n))return void s({type:"warning",title:"Download Disabled",message:"Certificate download is not available for this course."});if(s({type:"warning",title:o?"Guide Download Started":"Certificate Download Started",message:"Your download is being prepared..."}),o){let e=(0,eI.u6)(n),t=(0,eI.Eu)(n),s=document.createElement("a");s.href=e,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s)}else{let s=(0,C.getCookie)("auth_token"),r=await fetch("".concat("https://www.thefoodstars.com","/api/analytics/download-certificate?userId=").concat(e),{headers:{Authorization:"Bearer ".concat(s)}});if(403===r.status){let e=await r.json().catch(()=>null);throw Error((null==e?void 0:e.message)||"Certificate download is restricted for this course.")}if(!r.ok)throw Error("Unable to prepare your download. Please try again.");let n=(await r.json()).url,a=await fetch(n);if(!a.ok)throw Error("Unable to download the file. Please try again.");let o=await a.blob(),l=window.URL.createObjectURL(o),i=document.createElement("a");i.href=l,i.download=t,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(l)}s({type:"success",title:o?"Guide Download Complete":"Certificate Download Complete",message:o?a?"Your ADAFSA EFST registration guide has been downloaded successfully.":"Your registration guide has been downloaded successfully.":a?"Your ADAFSA EFST certificate has been downloaded successfully.":"Your certificate has been downloaded successfully."})}catch(e){console.error("Error downloading file:",e),s({type:"error",title:"Download Failed",message:e instanceof TypeError&&/Failed to fetch|fetch failed|Load failed/i.test(e.message)||"undefined"!=typeof navigator&&!navigator.onLine?"Could not download the file. Please check your internet connection and try again.":e instanceof Error?e.message:"Failed to download the file. Please try again later."})}};var eE=s(53770);let eP=e=>{let{courseProgress:t,enrollmentStatus:s,setIsModalOpen:n,currentUserId:a,userName:o,setAlertInfo:l,locationCity:i,courseId:c,courseSlug:d="foodstars"}=e,{t:m}=(0,g.Bd)("common"),h=(0,k.A)(),f=(0,eI.cs)(c),p=(0,eC.I1)(c),x=(0,eE.HY)(s),w=(null==t?void 0:t.overallProgressPercentage)===100&&!x||x,b=["certified","ROA Ready"].includes(s)&&!p,y=(null==t?void 0:t.overallProgressPercentage)===100&&(!["certified"].includes(s)||"ROA Ready"===s),v=()=>!x&&w&&t.averageScore>=70;return(0,r.jsx)("div",{className:"mx-auto w-full max-w-7xl pt-4 sm:pb-4 sm:px-2 md:px-4",dir:h?"rtl":"ltr",children:(0,r.jsxs)("div",{className:"mx-auto w-full space-y-4",children:[b&&(0,r.jsx)("div",{className:"w-full bg-customBlue-600 rounded-lg shadow-md p-4 lg:p-6 ".concat(y?"mt-4":""),children:(0,r.jsxs)("div",{className:"mb-4 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"min-w-0 w-full sm:flex-1 text-start",children:[(0,r.jsx)("h3",{className:"mb-2 w-full text-start text-xl font-bold text-white lg:text-2xl",children:m("foodStarsDashboard.certified.title")}),(0,r.jsx)("p",{className:"w-full text-start text-base text-white lg:text-lg",children:m("foodStarsDashboard.certified.message")})]}),(0,r.jsxs)("button",{onClick:()=>{f?eD(a,"Guide.pdf",l,i,c):eD(a,"".concat(o,"_FoodStars_Certificate.pdf"),l,i,c)},className:"flex w-full sm:w-auto items-center justify-center gap-2 bg-white font-medium py-2 lg:py-3 px-4 roun
1ded-lg transition duration-300 text-gray-700 hover:bg-customBlue-100",children:[(0,r.jsx)(eA.A,{className:"shrink-0",size:20}),m(f?"foodStarsDashboard.certified.downloadGuide":"foodStarsDashboard.certified.downloadCertificate")]})]})}),y&&(0,r.jsxs)("div",{className:"w-full bg-customBlue-600 rounded-lg shadow-md p-4 lg:p-6",children:[(0,r.jsxs)("div",{className:"mb-4 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"min-w-0 w-full sm:flex-1 text-start",children:[(0,r.jsx)("h3",{className:"mb-2 w-full text-start text-xl font-bold text-white lg:text-2xl",children:m((0,eE.f6)(s)?"foodStarsDashboard.assessmentReady.retakeAssessmentTitle":"foodStarsDashboard.assessmentReady.title")}),t.averageScore<80&&!x?(0,r.jsx)("p",{className:"w-full text-start text-base text-white lg:text-lg",children:m((0,eE.f6)(s)?"foodStarsDashboard.assessmentReady.retakeAssessmentNeedPreparation":"foodStarsDashboard.assessmentReady.needPreparation")}):(0,r.jsx)("p",{className:"w-full text-start text-base text-white lg:text-lg",children:m(f?"foodStarsDashboard.assessmentReady.readyMessageROA":"foodStarsDashboard.assessmentReady.readyMessageCOC")})]}),(0,r.jsxs)("button",{onClick:()=>{x||n(!0)},className:"flex min-h-11 w-full shrink-0 items-center justify-center gap-2 rounded-lg bg-white px-5 py-2.5 text-center text-sm font-medium transition duration-300 sm:w-auto sm:min-w-fit lg:py-3\n ".concat(v()?"text-gray-700 hover:bg-customBlue-100":"text-gray-400 cursor-not-allowed"),disabled:!v(),children:[(0,r.jsx)(u.A,{className:"shrink-0",size:20}),(0,r.jsx)("span",{className:"min-w-0 text-balance text-center",dir:h?"rtl":"ltr",children:m((0,eE.f6)(s)?"foodStarsDashboard.assessmentReady.retakeAssessment":"foodStarsDashboard.assessmentReady.takeAssessment")})]})]}),(0,r.jsx)("div",{className:"bg-white mb-2 rounded-lg p-4 w-full",children:(0,r.jsxs)("div",{className:"flex flex-col items-start justify-start gap-4 sm:w-9/12 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(eS.A,{className:"w-5 h-5 ".concat(100===t.overallProgressPercentage?"text-green-600":"text-gray-300")}),(0,r.jsx)("span",{className:"text-gray-700",children:m("foodStarsDashboard.requirements.completion")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(eS.A,{className:"w-5 h-5 ".concat(t.averageScore>=70?"text-green-600":"text-gray-300")}),(0,r.jsx)("span",{className:"text-gray-700",children:m("foodStarsDashboard.requirements.minimumScore")})]})]})})]})]})})},eL=e=>{let{courseProgress:t,enrollmentStatus:s,setIsModalOpen:n,currentUserId:a,userName:o,setAlertInfo:l,locationCity:i,courseId:c,courseSlug:d="foodstars"}=e,{t:m}=(0,g.Bd)("common"),h=(0,k.A)(),f=(0,eI.cs)(c),p=(0,eC.I1)(c),x=(0,eE.HY)(s),w=(null==t?void 0:t.overallProgressPercentage)===100&&!x||x,b=["certified","ROA Ready"].includes(s)&&!p,y=(null==t?void 0:t.overallProgressPercentage)===100&&(!["certified"].includes(s)||"ROA Ready"===s),v=()=>!x&&w&&t.averageScore>=70;return(0,r.jsx)("div",{className:"mx-auto w-full max-w-7xl pt-4 sm:pb-4 sm:px-2 md:px-4",dir:h?"rtl":"ltr",children:(0,r.jsxs)("div",{className:"mx-auto w-full space-y-4",children:[b&&(0,r.jsx)("div",{className:"w-full bg-customBlue-600 rounded-lg shadow-md p-4 lg:p-6 ".concat(y?"mt-4":""),children:(0,r.jsxs)("div",{className:"mb-4 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"min-w-0 w-full sm:flex-1 text-start",children:[(0,r.jsx)("h3",{className:"mb-2 w-full text-start text-xl font-bold text-white lg:text-2xl",children:m("foodStarsDashboard.certified.title")}),(0,r.jsx)("p",{className:"w-full text-start text-base text-white lg:text-lg",children:m("foodStarsDashboard.certified.message")})]}),(0,r.jsxs)("button",{onClick:()=>{f?eD(a,"Guide.pdf",l,i,c):eD(a,"".concat(o,"_FoodStars_Certificate.pdf"),l,i,c)},className:"flex w-full sm:w-auto items-center justify-center gap-2 bg-white font-medium py-2 lg:py-3 px-4 roun
1ded-lg transition duration-300 text-gray-700 hover:bg-customBlue-100",children:[(0,r.jsx)(eA.A,{className:"shrink-0",size:20}),m(f?"foodStarsDashboard.certified.downloadGuide":"foodStarsDashboard.certified.downloadCertificate")]})]})}),y&&(0,r.jsxs)("div",{className:"w-full bg-customBlue-600 rounded-lg shadow-md p-4 lg:p-6",children:[(0,r.jsxs)("div",{className:"mb-4 flex flex-col items-start justify-between gap-4 sm:flex-row sm:items-center",children:[(0,r.jsxs)("div",{className:"min-w-0 w-full sm:flex-1 text-start",children:[(0,r.jsx)("h3",{className:"mb-2 w-full text-start text-xl font-bold text-white lg:text-2xl",children:m((0,eE.f6)(s)?"foodStarsDashboard.assessmentReady.retakeAssessmentTitle":"foodStarsDashboard.assessmentReady.title")}),t.averageScore<80&&!x?(0,r.jsx)("p",{className:"w-full text-start text-base text-white lg:text-lg",children:m((0,eE.f6)(s)?"foodStarsDashboard.assessmentReady.retakeAssessmentNeedPreparation":"foodStarsDashboard.assessmentReady.needPreparation")}):(0,r.jsx)("p",{className:"w-full text-start text-base text-white lg:text-lg",children:m(["ROA Received"].includes(s)?"foodStarsDashboard.assessmentReady.readyMessageROAReceived":f?"foodStarsDashboard.assessmentReady.readyMessageROA":"foodStarsDashboard.assessmentReady.readyMessageCOC")})]}),(0,r.jsxs)("button",{onClick:()=>{x||n(!0)},className:"flex min-h-11 w-full shrink-0 items-center justify-center gap-2 rounded-lg bg-white px-5 py-2.5 text-center text-sm font-medium transition duration-300 sm:w-auto sm:min-w-fit lg:py-3\n ".concat(v()?"text-gray-700 hover:bg-customBlue-100":"text-gray-400 cursor-not-allowed"),disabled:!v(),children:[(0,r.jsx)(u.A,{className:"shrink-0",size:20}),(0,r.jsx)("span",{className:"min-w-0 text-balance text-center",dir:h?"rtl":"ltr",children:m((0,eE.f6)(s)?"foodStarsDashboard.assessmentReady.retakeAssessment":"foodStarsDashboard.assessmentReady.takeAssessment")})]})]}),(0,r.jsx)("div",{className:"bg-white mb-2 rounded-lg p-4 w-full",children:(0,r.jsxs)("div",{className:"flex flex-col items-start justify-start gap-4 sm:w-9/12 sm:flex-row sm:items-center sm:justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(eS.A,{className:"w-5 h-5 ".concat(100===t.overallProgressPercentage?"text-green-600":"text-gray-300")}),(0,r.jsx)("span",{className:"text-gray-700",children:m("foodStarsDashboard.requirements.completion")})]}),(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)(eS.A,{className:"w-5 h-5 ".concat(t.averageScore>=70?"text-green-600":"text-gray-300")}),(0,r.jsx)("span",{className:"text-gray-700",children:m("foodStarsDashboard.requirements.minimumScore")})]})]})})]})]})})};var eR=s(39681),eT=s(98572),eM=s(65511),eF=s(28883),eH=s(99961),eO=s(37466),e_=s(94052),eB=s(12820),eW=s(57569),ez=s(32257),eU=s(6853),eq=s(24182),eG=s(3458);let eV=(0,l.default)(()=>s.e(8120).then(s.bind(s,88120)).then(e=>o.memo(e.default)),{loadableGenerated:{webpack:()=>[88120]},loading:()=>(0,r.jsx)(i.A,{message:eq.A.t("foodStarsDashboard.loading.modules")})});function eQ(e){let{adminName:t,adminEmail:s,status:n}=e,{t:o}=(0,g.Bd)("common"),l=(0,k.A)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:{animation:"fadeIn 0.3s ease-out"},className:"jsx-bc4b8176a0016927 fixed inset-0 bg-black/70 z-40 backdrop-blur-sm"}),(0,r.jsx)("div",{style:{marginTop:"64px"},className:"jsx-bc4b8176a0016927 fixed inset-0 z-40 flex items-center justify-center p-4",children:(0,r.jsx)("div",{style:{animation:"scaleIn 0.3s ease-out"},dir:l?"rtl":"ltr",className:"jsx-bc4b8176a0016927 "+"bg-white dark:bg-gray-800 rounded-xl shadow-2xl max-w-md w-full p-6 border border-gray-100 dark:border-gray-700 ".concat(l?"rtl":"ltr"),children:(0,r.jsxs)("div",{className:"jsx-bc4b8176a0016927 flex flex-col items-center text-center",children:[(0,r.jsx)("div",{className:"jsx-bc4b8176a0016927 w-20 h-20 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center mb-5 transform transition-all",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",className:"jsx-bc4b8176a0016927 h-10 w-10 text-red-600 dark:text-red-400",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z",className:"jsx-bc4b8176a0016927"})})}),(0,r.jsx)("h2",{className:"jsx-bc4b8176a0016927 text-2xl font-bold mb-3 text-gray-900 dark:text-white",children:o("courseLocked.title","Course Acce
1ss Expired")}),(0,r.jsx)("p",{dir:l?"rtl":"ltr",className:"jsx-bc4b8176a0016927 "+"text-gray-600 dark:text-gray-300 mb-6 ".concat(l?"text-right":"text-left"),children:"ROA Received"===n?o("courseLocked.messageROAReceived","Your access to this course has expired. Please contact your administrator to allow revision of the course."):o("courseLocked.message","Your access to this course has expired. Please contact your administrator to extend your access period and complete the course.")}),(0,r.jsx)("div",{className:"jsx-bc4b8176a0016927 w-full border-t border-gray-200 dark:border-gray-700 my-5"}),(0,r.jsxs)("div",{className:"jsx-bc4b8176a0016927 w-full bg-gray-50 dark:bg-gray-800/50 p-4 rounded-lg mb-5",children:[(0,r.jsxs)("p",{className:"jsx-bc4b8176a0016927 "+"font-medium mb-2 ".concat(l?"text-right":"text-left"," text-gray-900 dark:text-white"),children:[o("courseLocked.contactAdmin","Administrator Info"),":"]}),(0,r.jsxs)("div",{className:"jsx-bc4b8176a0016927 "+"flex items-center mb-1 ".concat(l?"flex-row-reverse":""),children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",className:"jsx-bc4b8176a0016927 "+"h-5 w-5 text-gray-500 dark:text-gray-400 ".concat(l?"ml-2":"mr-2"),children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z",className:"jsx-bc4b8176a0016927"})}),(0,r.jsx)("p",{className:"jsx-bc4b8176a0016927 text-gray-700 dark:text-gray-300",children:t})]}),(0,r.jsxs)("div",{className:"jsx-bc4b8176a0016927 "+"flex items-center ".concat(l?"flex-row-reverse":""),children:[(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",className:"jsx-bc4b8176a0016927 "+"h-5 w-5 text-gray-500 dark:text-gray-400 ".concat(l?"ml-2":"mr-2"),children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z",className:"jsx-bc4b8176a0016927"})}),(0,r.jsx)("p",{className:"jsx-bc4b8176a0016927 text-gray-700 dark:text-gray-300",children:s})]})]}),(0,r.jsxs)(V.$,{onClick:()=>{let e=encodeURIComponent(o("courseLocked.emailSubject","Request to Unlock FoodSTARS Course")),r=encodeURIComponent(o("courseLocked.emailBody","Dear {{adminName}},\n\nI would like to request access to continue my FoodSTARS training course as my access has expired. Please extend my course access period.\n\nThank you.",{adminName:t}));window.open("mailto:".concat(s,"?subject=").concat(e,"&body=").concat(r))},className:"w-full flex items-center justify-center gap-2 bg-customBlue-600 hover:bg-customBlue-700 transition-colors",children:[(0,r.jsx)(eF.A,{className:"h-4 w-4"}),o("courseLocked.emailAdmin","Contact Administrator")]})]})})}),(0,r.jsx)(a(),{id:"bc4b8176a0016927",children:"@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes scaleIn{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}"})]})}function eY(){let e=(0,L.useRouter)(),t=(0,k.A)(),{userId:s,setEnrollmentId:n,enrollmentId:a,setEnrollmentStatus:l,enrollmentStatus:d,userName:u,isLoggedIn:m,isAuthChecked:f,locationCity:w,courseId:b}=(0,h.A)(),{t:y,i18n:j}=(0,g.Bd)("common"),{mapModuleNames:N}=(0,p.jc)(),{captureError:A,addBreadcrumb:M,setContext:F}=(0,eH.n)(),H=s||"",[O,_]=(0,o.useState)(null),[B,W]=(0,o.useState)(!1),z=(0,x.a)(),[U,q]=(0,o.useState)(!1),[G,V]=(0,o.useState)(null),[Q,K]=(0,o.useState)(!1),{logEvent:Z}=(0,v.Z)(),{reset:$}=(0,eO.C)(),[J,X]=(0,e_.ZA)("action",e_.tU.withOptions({history:"replace",shallow:!1}));(0,o.useEffect)(()=>{W("ar"===j.language||"ur"===j.language)},[j.language]),(0,o.useEffect)(()=>{s&&u&&(F("course",{courseId:b||"unknown",enrollmentId:a||"unknown",enrollmentStatus:d||"unknown",language:j.language,locationCity:w||"unknown"}),M("Course dashboard loaded","navigation",{courseId:b,enrollmentStatus:d,language:j.language}))},[s,u,b,a,d,j.language,w,F,M]);let{data:ee,error:et,isLoading:es,refetch:er}=(0,D.I)({queryKey:["courseProgress",H,b,a,d],queryFn:async()=>{try{let e=(0,C.getCookie)("auth_token"),[t,s]=await Promise.all([fetch("/api/users/".concat(H,"/progress/").concat(b),{headers:{Authorization:"Bearer ".concat(e)},credentials:"include"}),fetch("/api/courses/".concat(b,"/modules"),{headers:{Authorization:"Bearer ".concat(e)},credentials:"include"})]);if(!t.ok||!s.ok){let e=Error("Failed to fetch course progress and modules. Please try again later.");throw A(e,{progressResponseStatus:t.status,moduleResponseStatus:s.status,userId:H,courseId:b||"unknown"}),e}let[r,a]=await Promise.all([t.json(),s.json()]);return"attempting"!==d&&l(r.enrollmentStatus),r.adminName&&r.adminEmail&&V({name:r.adminName,email:r.adminEmail}),n(r.enrollmentId),l(r.enrollmentStatus),M("Course data fetched successfully","api",{overallProgress:r.courseProgress.overallProgressPercentage,moduleCount:a.length}),[r,a]}catch(e){throw A(e,{operation:"fetchCourseData",userId:H,courseId:b||"unknown"}),e}},enabled:!!H}),{data:en,isLoading:ea,refetch:eo}=(0,D.I)({queryKey:["quizAnalytics",a,d],queryFn:async()=>{let e=(0,C.getCookie)("auth_token"),t=await fetch("".concat("https://www.thefoodstars.com","/api/analytics/quiz-analytics/").concat(a),{method:"GET",headers:{Authorization:"Bearer ".concat(e)}});if(!t.ok){if(404===t.status)return[];throw Error("Failed to fetch quiz analytics. Please try again later.")}let s=await t.json();return er(),s.incorrectLessonIds||[]},enabled:!!a&&(0,eE.f5)(d)});(0,o.useEffect)(()=>{(0,ez.Mo)()},[]),(0,o.useEffect)(()=>
1{if(!(0,eE.HY)(d)||!a)return;let e=!1;return(async()=>{let t=await (0,eU.Fw)(a,"assessment_refresh_no_resume");!e&&t&&l(t)})(),()=>{e=!0}},[a,d,l]),(0,o.useEffect)(()=>{(async()=>{if(a)try{let e=(0,C.getCookie)("auth_token"),t=await fetch("".concat("https://www.thefoodstars.com","/api/enrollments/status/").concat(a),{headers:{Authorization:"Bearer ".concat(e)}});if(t.ok){let e=await t.json();!0===e.proctoringDisabled?eN(!0):eN(!1)}}catch(e){console.error("Error checking proctoring disabled status:",e),eN(!1)}})()},[a]);let{courseProgress:el,activeModuleRedirectUrl:ei,recommendedLessons:ec,activeModuleIndex:ed}=(0,o.useMemo)(()=>{if(!ee)return{courseProgress:null,moduleDetails:[],activeModuleRedirectUrl:"",recommendedLessons:[],activeModuleIndex:null};let[e,t]=ee,s=N(e.courseProgress.moduleProgress.map(e=>{let s=t.find(t=>t._id===e.moduleId);return{...e,description:(null==s?void 0:s.description)||"",imagePath:(null==s?void 0:s.imagePath)||"",redirectUrl:(null==s?void 0:s.redirectUrl)||"",timeEstimate:(null==s?void 0:s.timeEstimate)||0,status:e.moduleStatus||"Not Started",lessonProgress:e.lessonProgress.map(e=>{var t;return{...e,timeEstimate:(null==s||null==(t=s.lessons.find(t=>t._id===e.lessonId))?void 0:t.timeEstimate)||0}})}})),r=s.find(e=>"In Progress"===e.status)||s.find(e=>"Completed"!==e.status),n=(null==r?void 0:r.redirectUrl)||"",a=r?s.findIndex(e=>e.moduleId===r.moduleId):s.length>0&&"Not Started"===s[0].lessonProgress[0].lessonStatus?-1:0,o="attempted"===d&&en&&en.length>0?s.flatMap(e=>e.lessonProgress.filter(e=>en.includes(e.lessonId)).map((t,s)=>({lessonId:t.lessonId,lessonName:t.lessonName,moduleId:e.moduleId,moduleName:e.moduleName,progress:t.lessonProgressPercentage,order:s+1,score:t.lessonScore,correctAnswers:t.correctAnswers,totalQuestions:t.totalQuestions,timeTaken:t.timeTaken,timeEstimate:t.timeEstimate}))):s.flatMap(e=>e.lessonProgress.map((t,s)=>({...t,moduleId:e.moduleId,moduleName:e.moduleName,order:s+1}))).sort((e,t)=>e.lessonScore-t.lessonScore).filter(e=>e.lessonScore<90).map(e=>({lessonId:e.lessonId,lessonName:e.lessonName,moduleId:e.moduleId,moduleName:e.moduleName,progress:e.lessonProgressPercentage,order:e.order,score:e.lessonScore,correctAnswers:e.correctAnswers,totalQuestions:e.totalQuestions,timeTaken:e.timeTaken,timeEstimate:e.timeEstimate}));return{courseProgress:{courseId:e.courseProgress.courseId,courseName:e.courseProgress.courseName,overallProgressPercentage:e.courseProgress.overallProgressPercentage,moduleProgress:s,daysLeft:e.daysLeft,expirationDate:e.expirationDate,totalTimeSpent:e.totalTimeSpent,averageScore:e.averageScore,estimatedTime:e.estimatedTime||0},moduleDetails:t,activeModuleRedirectUrl:n,recommendedLessons:o,activeModuleIndex:a}},[ee,en,d,N]);(0,eG.WR)(f&&m&&!es&&!ea&&!et&&!!el);let[eu,em]=(0,o.useState)(!1),[eh,eg]=(0,o.useState)(1),[ep,ex]=(0,o.useState)(!1);(0,o.useEffect)(()=>{"take-assessment"===J&&!es&&el&&(X(null),"ROA Ready"!==d&&"ROA Received"!==d&&l("completed"),ex(!0),Z("AssessmentRetake","User initiated assessment retake from results page"))},[J,X,es,el,d,l,ex,Z]);let[ew,eb]=(0,o.useState)(!1),[ey,ev]=(0,o.useState)(!1),[ej,eN]=(0,o.useState)(!1),eA=(0,o.useCallback)(e=>{let t=z?"Mobile":"Desktop";if("1.1"===e){let e=z?"/courses/foodstars/mobile":"/courses/foodstars/training";window.open(e,"_blank"),Z("GameLaunch","Game Launched on ".concat(t));return}if("attempting"===d)return;let s=z?"/courses/foodstars/mobile":"/courses/foodstars/training",r=e?"".concat(s,"?moduleIndex=").concat(e):s;window.open(r,"_blank"),Z("GameLaunch","Game Launched on ".concat(t," for Module ").concat(e))},[d,z,Z]),eS=(0,o.useCallback)(()=>{if(!el)return null;for(let e=0;e<el.moduleProgress.length;e++){let t=el.moduleProgress[e];if("In Progress"===t.status){for(let s=0;s<t.lessonProgress.length;s++){let r=t.lessonProgress[s];if("In Progress"===r.lessonStatus||"Not Started"===r.lessonStatus)return"".concat(e,".").concat(s)}return"".concat(e,".0")}}for(let e=0;e<el.moduleProgress.length;e++){let t=el.moduleProgress[e];if("Completed"!==t.status){for(let s=0;s<t.lessonProgress.length;s++)if("Completed"!==t.lessonProgress[s].lessonStatus)return"".concat(e,".").concat(s);return"".concat(e,".0")}}let e=el.moduleProgress.length-1,t=el.moduleProgress[e].lessonProgress.length-1;return"".concat(e,".").concat(t)},[el]);(0,o.useCallback)(()=>{var e;if(!el)return"";let t=eS();if(!t)return"";let[s]=t.split(".");return(null==(e=el.moduleProgress[parseInt(s)])?void 0:e.moduleName)||""},[el,eS]),(0,o.useCallback)(()=>{var e,t;if(!el)return"";let s=eS();if(!s)return"";let[r,n]=s.split(".");return(null==(t=el.moduleProgress[parseInt(r)])||null==(e=t.lessonProgress[parseInt(n)])?void 0:e.lessonName)||""},[el,eS]);let eI=(0,o.useCallback)(async()=>{try{await $()}catch(e){console.warn("â ï¸ Failed to clear violation data before assessment start:",e)}ex(!1);let t=ej;if(a)try{let e=(0,C.getCookie)("auth_token"),s=await fetch("".concat("https://www.thefoodstars.com","/api/enrollments/status/").concat(a),{headers:{Authorization:"Bearer ".concat(e)}});if(s.ok){let e=await s.json();t=!0===e.proctoringDisabled,eN(t)}}catch(e){console.error("Error re-checking proctoring disabled status:",e)}if(t)return void e.push("/courses/foodstars/assessment");a&&(0,ef.KY)(a),ev(!0)},[a,ej,$,e]),eD=(0,o.useCallback)(()=>{e.push("/courses/foodstars/assessment")},[e]),eF=(0,o.useCallback)(()=>{ev(!1)},[]),eq=(0,o.useMemo)(()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-full",children:(0,r.jsx)(R.A,{activeModuleIndex:ed,currentProgress:eS(),expirationDate:null==el?void 0:el.expirationDate,overallProgressPercentage:null==el?void 0:el.overallProgressPercentage,setIsModalOpen:ex,alwaysShowButton:!0})}),(0,r.jsx)("div",{className:"w-full bg-white",children:(0,r.jsxs)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 pt-6",children:["attempting"===d&&!(0,ez.iC)()&&(0,r.jsx)(P.t,{}),(0,r.jsx)("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1e3,opacity:eh,transition:"opacity 1s ease-out"},children:eu&&(0,r.jsx)(E.A,{})}),B?(0,r.jsx)(eP,{courseProgress:el,enrollmentStatus:d||"",setIsModalOpen:ex,currentUserId:H,userName:u||"",setAlertInfo:_,courseId:b||""}):(0,r.jsx)(eL,{courseProgress:el,enrollmentStatus:d||"",setIsModalOpen:ex,currentUserId:H,userName:u||"",setAlertInfo:_,locationCity:w||"",courseId:b||""}),B?(0,r.jsx)("div",{className:"flex flex-col lg:flex-row gap-12",children:(0,r.jsx)("div",{className:"lg:w-full",children:el&&el.overallProgressPercentage>0&&(0,r.jsx)("div",{className:"recommendations-section ".concat("attempting"===d?"opacity-50 pointer-events-none":""),children:(0,r.jsx)(I,{recommendedLessons:ec,courseStatus:"attempted"===d?"attempted":100===el.overallProgressPercentage?"completed":"inProgress",onGameStart:()=>eA(null),onModuleStart:e=>eA(e),courseProgress:el,currentActiveModuleAndSubmodule:eS(),daysLeft:el.daysLeft||"N/A",isLocked:["attempting"].includes(d||"")})})})}):(0,r.jsx)("div",{className:"flex flex-col lg:flex-row gap-12",children:(0,r.jsx)("div",{className:"lg:w-full",children:el&&el.overallProgressPercentage>0&&(0,r.jsx)("div",{className:"recommendations-section ".concat("attempting"===d?"opacity-50 pointer-events-none":""),children:(0,r.jsx)(S,{initialRecommendedLessons:ec,courseStatus:"attempted"===d?"attempted":100===el.overallProgressPercentage?"completed":"inProgress",onGameStart:()=>eA(null),onModuleStart:e=>eA(e),courseProgress:el,currentActiveModuleAndSubmodule:eS(),daysLeft:el.daysLeft||"N/A",isLocked:["attempting"].includes(d||"")})})})}),B?(0,r.jsx)(eR.A,{percentage:(null==el?void 0:el.overallProgressPercentage)||0,totalTimeSpent:(null==el?void 0:el.totalTimeSpent)||0,estimatedTime:(null==el?void 0:el.estimatedTime)||0,score:(null==el?void 0:el.averageScore)||0}):(0,r.jsx)(c.A,{percentage:(null==el?void 0:el.overallProgressPercentage)||0,totalTimeSpent:(null==el?void 0:el.totalTimeSpent)||0,estimatedTime:(null==el?void 0:el.estimatedTime)||0,score:(null==el?void 0:el.averageScore)||0}),(0,r.jsxs)("div",{className:"mx-auto py-6 sm:px-2 md:px-4 lg:px-8 max-w-7xl",children:[(0,r.jsx)("h2",{className:"text-2xl font-semibold tracking-tight py-2 text-gray-900 text-start",children:y("foodStarsDashboard.myModules.title")}),el&&(0,r.jsx)(eV,{courseProgress:el,isLocked:"attempting"===d||"certified"===d})]}),(0,r.jsx)(T.A,{isOpen:ep,onClose:()=>ex(!1),onStartAssessment:eI}
1),ey&&(0,r.jsx)(ek,{onComplete:eD,onCancel:eF,isMobile:z,assessmentId:a||"default-assessment",userId:s||"unknown-user",courseId:b||void 0,assessmentInfo:{title:"Essential Food Safety Training Assessment",totalQuestions:(0,eW._o)(b),timeLimit:(0,eW.i0)(b),passingScore:eW.kR}})]})})]}),[el,ec,eu,eh,d,eA,ed,eS,ep,s,j.language,B,t,z,a,b,u,H,w,y,eI,eD,eF,ey]);return((0,o.useEffect)(()=>{if((null==el?void 0:el.overallProgressPercentage)===100){em(!0),eg(1);let e=setTimeout(()=>{eg(0)},4e3),t=setTimeout(()=>{em(!1)},5e3);return()=>{clearTimeout(e),clearTimeout(t)}}},[null==el?void 0:el.overallProgressPercentage]),(0,o.useEffect)(()=>{let e=new EventSource("".concat("https://www.thefoodstars.com","/api/enrollments/sse"),{withCredentials:!0});return e.addEventListener("progressUpdate",e=>{JSON.parse(e.data).enrollmentId===(null==el?void 0:el.courseId)&&er()}),e.onerror=t=>{console.error("SSE error:",t),e.close()},()=>{e.close()}},[null==el?void 0:el.courseId,er]),(0,o.useEffect)(()=>{f&&!m&&e.push("/sign-in")},[f,m,e]),(0,o.useEffect)(()=>{"attempted"===d&&en&&er()},[en,d,er]),(0,o.useEffect)(()=>{let e=sessionStorage.getItem("scrollToRecommendations"),t=sessionStorage.getItem("scrollTimestamp");if(e&&t){let e=parseInt(t);Date.now()-e<5e3&&(sessionStorage.removeItem("scrollToRecommendations"),sessionStorage.removeItem("scrollTimestamp"),[100,500,1e3,2e3].forEach(e=>{setTimeout(()=>{(()=>{let e=document.querySelector(".recommendations-section");if(e){let t=e.getBoundingClientRect().top+window.pageYOffset-100;return window.scrollTo({top:t,behavior:"smooth"})}})()},e)}))}},[el]),(0,o.useEffect)(()=>{eb("Quiz Passed"===d&&!(0,eC.I1)(b))},[d,b]),(0,o.useEffect)(()=>{let e=localStorage.getItem("hasSeenFoodstarsDashboardWalkthrough"),t=localStorage.getItem("isFirstTimeUserFlow");!e&&t&&q(!0)},[]),(0,o.useEffect)(()=>{el&&(0===parseInt(el.daysLeft)?K(!0):K(!1))},[el]),(0,o.useEffect)(()=>{"take-assessment"===J&&!es&&el&&(X(null),"ROA Ready"!==d&&"ROA Received"!==d&&l("completed"),ex(!0),Z("AssessmentRetake","User initiated assessment retake from results page"))},[J,X,es,el,d,l,Z]),f)?m?es||ea?(0,r.jsx)(i.A,{onDark:!0,message:y("foodStarsDashboard.loading.content")}):et?(0,r.jsx)(i.A,{onDark:!0,error:et.message}):(0,r.jsx)("div",{className:"w-full ".concat(t?"rtl":"ltr"),children:(0,r.jsxs)("div",{className:"w-full",children:[O&&(0,r.jsx)(Y.A,{type:O.type,title:O.title,message:O.message,onDismiss:()=>_(null)}),el?eq:(0,r.jsx)(i.A,{onDark:!0,message:y("foodStarsDashboard.loading.preparing")}),ew&&(0,r.jsx)(eM.A,{onClose:()=>{eb(!1),er(),eo()}}),Q&&G&&(0,r.jsx)(eQ,{adminName:G.name,adminEmail:G.email,status:d||""}),el&&(0,r.jsx)(eT.A,{videoSrc:(0,eB.I)("Walkthrough_Foodstars",j.language),title:y("walkthrough.courseDashboard.title"),description:y("walkthrough.courseDashboard.description"),autoOpen:U,acknowledgmentHeader:y("walkthrough.courseReminder.header"),acknowledgmentContent:y("walkthrough.courseReminder.content"),acknowledgmentButton:y("walkthrough.courseReminder.button"),anchor:"heroTitle"})]},j.language)},j.language):null:(0,r.jsx)(i.A,{onDark:!0,message:y("foodStarsDashboard.loading.auth")})}function eK(){return(0,r.jsx)(o.Suspense,{fallback:(0,r.jsx)(i.A,{onDark:!0}),children:(0,r.jsx)(eY,{})})}},47772:(e,t,s)=>{Promise.resolve().then(s.bind(s,41893))},49789:(e,t,s)=>{"use strict";s.d(t,{$e:()=>x,Fq:()=>y,Iw:()=>p,Kl:()=>v,Kt:()=>b,n:()=>N,py:()=>j,xs:()=>k});var r=s(92657),n=s(17580),a=s(66029),o=s(91168),l=s(19420),i=s(42785),c=s(14738),d=s(84355),u=s(85604),m=s(97207),h=s(46767),f=s(32152);let g={kind:"none",hint:"This is a yes/no event. There is no sensitivity slider â it either happens or it does not."},p={FACE_NOT_DETECTED:{title:"Face not in view",description:"Flags when the camera feed has no enrolled face for a sustained period.",icon:r.A,threshold:{kind:"confidence",label:"Absence confidence",hint:"How sure the model must be that nobody is in frame before this fires.",low:"Flags sooner, even on brief gaps",high:"Only when the frame is clearly empty",asPercent:!0},cooldownLabel:"Wait before flagging absence again",cooldownHint:"Stops back-to-back absence events while they sit still out of frame.",warningLabel:"Warn trainee after this many absence events",warningHint:"0 logs the event for review only. The exam is not stopped."},MULTIPLE_FACES:{title:"More than one person",description:"Flags when extra faces appear next to the enrolled trainee.",icon:n.A,threshold:{kind:"count",label:"Extra faces before a flag",hint:"1 means a
1second person is enough. Raise this only if a second face should be tolerated.",unit:"extra faces"},cooldownLabel:"Wait before flagging extra faces again",cooldownHint:"Gives time for someone to walk through the background.",warningLabel:"Warn trainee after this many extra-face events",warningHint:"0 logs only. The exam continues."},GAZE_DIRECTION:{title:"Looking away from the screen",description:"Flags sustained gaze off the assessment window.",icon:a.A,threshold:{kind:"confidence",label:"Look-away certainty",hint:"How clearly they must be looking off-screen. Does not measure âhow farâ.",low:"Small glances can count",high:"Only a clear, held look-away",asPercent:!0},cooldownLabel:"Ignore repeated look-aways for",cooldownHint:"Keeps one long look-away from becoming a stream of events.",warningLabel:"Warn trainee after this many look-away events",warningHint:"0 logs only. Brief glances below this count stay silent."},PERSON_SWAP:{title:"Different person in view",description:"Compares the live face to the face enrolled at setup.",icon:o.A,threshold:{kind:"confidence",label:"Identity mismatch",hint:"How different the live face must be from enrollment. This value is used by the live detector.",low:"Flags similar-looking people",high:"Only obvious swaps",asPercent:!0},cooldownLabel:"Wait before recording another swap",cooldownHint:"Spaces the next PERSON_SWAP record after one has already been logged. Identity checks keep running during this wait.",warningLabel:"Warn trainee after this many identity-change events",warningHint:"0 logs only.",minDurationLabel:"Minimum time the other person must stay in view",minDurationHint:"How long the live face must keep mismatching enrollment before this fires. Brief walk-throughs do not count.",checkIntervalLabel:"Wait before another identity check",checkIntervalHint:"How often the live face is compared to enrollment. This is not the violation cool-down.",enrollmentPosesLabel:"Identity enrollment poses",enrollmentPosesHint:"Front is always required. Extra poses are captured during camera setup so live matching still works if they turn or lean. Ignored when this detector is off."},PHONE_DETECTED:{title:"Phone in the camera",description:"Flags when a phone is visible in the webcam frame.",icon:l.A,threshold:{kind:"confidence",label:"Phone detection confidence",hint:"How sure the vision model must be that the object is a phone.",low:"Flags ambiguous rectangles",high:"Only a clear phone",asPercent:!0},cooldownLabel:"Donât re-flag a visible phone for",cooldownHint:"One phone left on the desk should not spam events.",warningLabel:"Warn trainee after this many phone events",warningHint:"Default 1 warns the first time a phone is seen."},POOR_LIGHTING:{title:"Room too dark",description:"Flags when the webcam image is too dark for reliable face monitoring.",icon:i.A,threshold:{kind:"confidence",label:"Darkness cutoff",hint:"How dark the frame must be. This is a lighting floor, not a âconfidenceâ score.",low:"Flags dim rooms",high:"Only near-black frames",asPercent:!0},cooldownLabel:"Re-check lighting after",cooldownHint:"Lets them turn a light on without stacking events.",warningLabel:"Warn trainee after this many lighting events",warningHint:"0 logs only."},TAB_SWITCH:{title:"Left the assessment tab",description:"Flags when the browser tab or window is switched away from the exam.",icon:c.A,threshold:{kind:"count",label:"Switches that count as one event",hint:"Rapid Alt-Tab bursts collapse into one record at this count.",unit:"switches"},cooldownLabel:"Ignore further switches for",cooldownHint:"One trip to another tab should not create a new event every click.",warningLabel:"Warn trainee after this many tab-switch events",warningHint:"0 logs only."},WINDOW_BLUR:{title:"Left window",description:"Flags when the assessment window is no longer the active window.",icon:c.A,threshold:{kind:"count",label:"Focus-loss events that count as one record",hint:"Clicking out and back quickly can be collapsed at this count.",unit:"focus losses"},cooldownLabel:"Ignore further focus loss for",cooldownHint:"Stops OS notifications from creating a burst of records.",warningLabel:"Warn trainee after this many focus-loss events",warningHint:"0 logs only."},FULLSCREEN_EXIT:{title:"Left fullscreen",description:"Flags when the exam leaves fullscreen. This is a single action, not a score.",icon:c.A,threshold:g,cooldownLabel:"Ignore further fullscreen exits for",cooldownHint:"Leaving and re-entering fullscreen should not stack
1instantly.",warningLabel:"Warn trainee after this many fullscreen-exit events",warningHint:"0 logs only."},BROWSER_DEVTOOLS:{title:"Developer tools opened",description:"Flags when browser developer tools are opened during the exam.",icon:c.A,threshold:g,cooldownLabel:"Ignore further detections for",cooldownHint:"Keeping tools open should not emit an event every second.",warningLabel:"Warn trainee after this many devtools events",warningHint:"0 logs only."},SCREENSHOT_ATTEMPT:{title:"Screenshot attempt",description:"Flags known screenshot / capture key combinations.",icon:d.A,threshold:g,cooldownLabel:"Ignore further attempts for",cooldownHint:"Holding a capture shortcut should not flood the log.",warningLabel:"Warn trainee after this many screenshot events",warningHint:"0 logs only."},CLIPBOARD_EVENT:{title:"Copy, cut, or paste",description:"Flags keyboard copy, cut, and paste shortcuts, and clipboard events, during the exam.",icon:u.A,threshold:g,cooldownLabel:"Ignore further clipboard events for",cooldownHint:"Holding Ctrl+C should not flood the log.",warningLabel:"Warn trainee after this many copy/paste events",warningHint:"Default 3 matches High-risk trainee alerts."},CAMERA_REVOKED:{title:"Camera turned off",description:"Flags when camera permission is revoked or the webcam track ends.",icon:d.A,threshold:g,cooldownLabel:"Wait before flagging camera-off again",cooldownHint:"A dropped webcam should not emit a new event every poll.",warningLabel:"Warn trainee after this many camera-off events",warningHint:"Default 1 warns on the first time they turn the camera off."},CAMERA_DEVICE_CHANGE:{title:"Camera hardware change",description:"Flags when a webcam is added, removed, or swapped mid-exam.",icon:d.A,threshold:g,cooldownLabel:"Ignore further camera hardware changes for",cooldownHint:"Plugging in a webcam can fire several browser events at once.",warningLabel:"Warn trainee after this many camera hardware-change events",warningHint:"0 logs only. Camera-off still uses its own event."},AUDIO_DEVICE_CHANGE:{title:"Microphone hardware change",description:"Flags when a microphone is added, removed, or swapped mid-exam.",icon:m.A,threshold:g,cooldownLabel:"Ignore further microphone hardware changes for",cooldownHint:"Plugging in a headset can fire several browser events at once.",warningLabel:"Warn trainee after this many microphone hardware-change events",warningHint:"0 logs only. Microphone-lost still uses its own event."},DEVICE_MOVEMENT:{title:"Excessive device movement",description:"Flags when the camera or device is shaken or walked around with.",icon:h.A,threshold:{kind:"motion",label:"Shake intensity",hint:"How much the device must move. This is motion energy, not a 0â1 confidence.",low:"Small jitters count",high:"Only large shakes / walking"},cooldownLabel:"Wait after movement settles",cooldownHint:"One walk across the room should not keep firing.",warningLabel:"Warn trainee after this many movement events",warningHint:"0 logs only. Also controls the âkeep stillâ line in the rules guide."},AUDIO_SPEECH_DETECTED:{title:"Speech on the microphone",description:"Voice-activity detection on the exam mic. This value is used live by the mic pipeline.",icon:m.A,threshold:{kind:"vad",label:"Speech confidence",hint:"Silero voice-activity score (0â1). Raise this if fans, traffic, or TV are flagged as talking.",low:"Picks up quiet speech and more room sound",high:"Only clearer, voiced speech"},cooldownLabel:"Wait before recording again",cooldownHint:"Minimum time between speech violation records. A warning is shown only when a record reaches the warn count.",warningLabel:"Warn trainee after this many speech events",warningHint:"0 logs only.",minDurationLabel:"Minimum speech duration",minDurationHint:"How long speech must last before it counts. The stored violation duration is this detection period.",onsetHoldLabel:"Ignore brief spikes",onsetHoldHint:"How long the signal must stay speech-like before a segment starts. Filters coughs and bangs.",minSilenceLabel:"Quiet time to end speech",minSilenceHint:"How long the mic must stay below the gate before the clip closes. Longer ignores pauses inside a sentence."}
1,AUDIO_CAPTURE_LOST:{title:"Microphone dropped",description:"Flags when the mic track mutes, stalls, or is revoked.",icon:f.A,threshold:g,cooldownLabel:"Wait before flagging mic-lost again",cooldownHint:"A flaky USB mic should not emit an event every poll.",warningLabel:"Warn trainee after this many mic-lost events",warningHint:"Default 1 warns the first time capture is lost."},AUDIO_SOURCE_UNVERIFIED:{title:"Unverified microphone",description:"Flags virtual cables, unlabeled mics, or sources that cannot be verified as a real device.",icon:m.A,threshold:g,cooldownLabel:"Wait before flagging the mic source again",cooldownHint:"A virtual device present for the whole exam should not spam.",warningLabel:"Warn trainee after this many unverified-source events",warningHint:"Default 1 warns on first detection."},AUDIO_NOISY_PLACE:{title:"Noisy place",description:"Flags when the room becomes too noisy after the assessment has started. Uses the same loudness bands as microphone setup.",icon:f.A,threshold:{kind:"noise",label:"Noise level",hint:"How loud the room must be before this fires. Same cutoff is used in microphone setup. Measured in dBFS (0 is full scale).",low:"Flags quieter rooms",high:"Only very loud rooms"},cooldownLabel:"Wait before recording again",cooldownHint:"Minimum time between noisy-place violation records. A warning is shown only when a record reaches the warn count.",warningLabel:"Warn trainee after this many noisy-place events",warningHint:"Default 1 warns the first time the room is too noisy.",minDurationLabel:"Minimum noise duration",minDurationHint:"How long the room must stay loud before a violation is recorded. Brief spikes do not count."}},x={vision:{label:"Camera",blurb:"Needs webcam and face enrollment in setup. Turn all of these off to skip camera setup. Includes camera-off, camera hardware changes, and device movement."},screen:{label:"Browser",blurb:"No extra setup. Watches the exam tab, focus, fullscreen, tools, and capture keys."},audio:{label:"Microphone",blurb:"Needs microphone setup. Turn all of these off to skip the mic step. Includes microphone hardware changes."}},w={CAMERA_REVOKED:"vision",CAMERA_DEVICE_CHANGE:"vision",DEVICE_MOVEMENT:"vision",AUDIO_DEVICE_CHANGE:"audio"};function b(e){return"device"!==e.channel?e.channel:w[e.code]||"vision"}function y(e){return p[e.code]||{title:e.label,description:e.code,icon:r.A,threshold:g,cooldownLabel:"Minimum time between reports",cooldownHint:"Prevents the same event from repeating immediately.",warningLabel:"Warn trainee after this many events",warningHint:"0 logs only."}}function v(e,t,s){var r,n;if("none"===e.kind)return"";if("confidence"===e.kind&&e.asPercent)return"".concat(Math.round(100*t),"%");if("count"===e.kind)return"".concat(Math.round(t)," ").concat(e.unit);if("vad"===e.kind){let e=null!=(r=null==s?void 0:s.step)?r:.05;return t.toFixed(e<.01?3:2)}if("noise"===e.kind)return"".concat(Math.round(t)," dBFS");let a=null!=(n=null==s?void 0:s.step)?n:.1;return t.toFixed(a<.1?2:+(a<1))}function j(e){return Math.round(e/1e3)}function N(e){return Math.max(0,1e3*Math.round(e))}let k={LOW:"bg-sky-100 text-sky-800 border-sky-200",MEDIUM:"bg-amber-100 text-amber-800 border-amber-200",HIGH:"bg-orange-100 text-orange-800 border-orange-200",CRITICAL:"bg-red-100 text-red-800 border-red-200"}},98572:(e,t,s)=>{"use strict";s.d(t,{A:()=>h});var r=s(95155),n=s(12115),a=s(47650),o=s(81284),l=s(85339),i=s(85690),c=s(99840),d=s(97168),u=s(48494),m=s(68311);function h(e){let{videoSrc:t,title:s,description:h,autoOpen:f=!1,thumbnailFrame:g,firstFrame:p,zoom:x=1,acknowledgmentHeader:w,acknowledgmentContent:b,acknowledgmentButton:y,anchor:v="inline"}
1=e,[j,N]=(0,n.useState)(!1),[k,A]=(0,n.useState)(!1),[S,I]=(0,n.useState)(!1),[C,D]=(0,n.useState)(null),[E,P]=(0,n.useState)(!1),[L,R]=(0,n.useState)(!1),[T,M]=(0,n.useState)(null),F=(0,u.A)(),H="heroTitle"===v;(0,n.useLayoutEffect)(()=>{if(!H)return void M(null);let e=()=>document.getElementById(m.i9);M(e());let t=new MutationObserver(()=>{let t=e();M(e=>e===t?e:t)});return t.observe(document.body,{childList:!0,subtree:!0}),()=>t.disconnect()},[H]),(0,n.useEffect)(()=>{f&&!k&&(N(!0),A(!0),w&&b&&y&&P(!0))},[f,k,w,b,y]),(0,n.useEffect)(()=>{if(C||!t)return;let e=!1,s=document.createElement("video");s.preload="metadata",s.crossOrigin="anonymous",s.src=t;let r=()=>{s.removeAttribute("src"),s.load()},n=()=>{if(!e)try{if(!s.videoWidth||!s.videoHeight)return;let e=document.createElement("canvas");e.width=s.videoWidth,e.height=s.videoHeight;let t=e.getContext("2d");if(!t)return;t.drawImage(s,0,0,e.width,e.height),D(e.toDataURL("image/jpeg"))}catch(e){}finally{r()}},a=()=>{let e=Number.isFinite(s.duration)?s.duration:0,t=void 0!==g?g:1,r=e>0?Math.min(Math.max(t,0),Math.max(e-.1,0)):0;if(r<=0)return void n();try{s.currentTime=r}catch(e){n()}};return s.addEventListener("loadeddata",a),s.addEventListener("seeked",n),s.addEventListener("error",r),()=>{e=!0,s.removeEventListener("loadeddata",a),s.removeEventListener("seeked",n),s.removeEventListener("error",r),r()}},[C,t,g]);let O=async e=>{if(S){e.pause(),I(!1);return}try{let t=void 0!==p?p:1;if(e.readyState>=HTMLMediaElement.HAVE_METADATA&&e.currentTime<t)try{e.currentTime=t}catch(e){}await e.play(),I(!0)}catch(e){I(!1)}},_=e=>{(e||!E||L)&&(e||(I(!1),P(!1),R(!1)),N(e))},B=(0,r.jsxs)(c.lG,{open:j,onOpenChange:_,children:[(0,r.jsx)(c.zM,{asChild:!0,children:(0,r.jsx)("button",{type:"button","aria-label":s,className:H?"inline-flex shrink-0 items-center justify-center rounded-full p-1 text-white text-shadow-custom hover:bg-white/20 focus:outline-none focus-visible:ring-2 focus-visible:ring-white":"inline-flex shrink-0 items-center justify-center rounded-full p-0.5 text-gray-400 hover:text-customBlue-600 focus:outline-none focus-visible:ring-2 focus-visible:ring-customBlue-500",children:(0,r.jsx)(o.A,{className:H?"h-6 w-6 sm:h-7 sm:w-7":"h-5 w-5","aria-hidden":"true"})})}),(0,r.jsx)(c.Cf,{animationVariant:"walkthrough",className:"sm:max-w-[800px] rounded-lg",hideCloseButton:E&&!L,onEscapeKeyDown:e=>{E&&!L&&e.preventDefault()},onInteractOutside:e=>{E&&!L&&e.preventDefault()},children:E&&!L?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.c7,{className:"".concat(F?"text-right pr-12":"text-left"),children:(0,r.jsxs)("div",{className:"flex items-center gap-3 ".concat(F?"flex-row-reverse":""),children:[(0,r.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-amber-100 flex-shrink-0",children:(0,r.jsx)(l.A,{className:"h-6 w-6 text-amber-600"})}),(0,r.jsx)(c.L3,{className:"text-2xl ".concat(F?"text-right":"text-left"),dir:F?"rtl":"ltr",children:w})]})}),(0,r.jsxs)("div",{className:"mt-6 space-y-6",children:[(0,r.jsx)("p",{className:"text-base leading-relaxed text-gray-700 ".concat(F?"text-right pr-2":"text-left"),dir:F?"rtl":"ltr",children:b}),(0,r.jsx)("div",{className:"flex justify-end pt-4",children:(0,r.jsx)(d.$,{onClick:()=>{R(!0),P(!1),f&&(localStorage.setItem("hasSeenFoodstarsDashboardWalkthrough","true"),localStorage.removeItem("isFirstTimeUserFlow"))},className:"bg-customBlue-500 hover:bg-customBlue-600 text-white px-8 py-2.5 rounded-lg font-medium transition-colors",children:y})})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(c.c7,{className:"".concat(F?"text-right pr-12":"text-left"),children:[(0,r.jsx)(c.L3,{dir:F?"rtl":"ltr",children:s}),(0,r.jsx)(c.rr,{dir:F?"rtl":"ltr",children:h})]}),(0,r.jsxs)("div",{className:"mt-4 aspect-video w-full relative shadow-2xl rounded-lg overflow-hidden",children:[(0,r.jsx)("video",{poster:C||void 0,src:t,style:{transform:"scale(".concat(x,")"),transformOrigin:"center center"},className:"w-full h-full rounded-lg object-cover",preload:"metadata",playsInline:!0,onClick:e=>{O(e.currentTarget)},onPlay:()=>I(!0),onPause:()=>I(!1),onEnded:()=>_(!1),children:"Your browser does not support the video tag."}),!S&&(0,r.jsxs)("div",{className:"absolute inset-0 cursor-pointer",onClick:e=>{O(e.currentTarget.previousElementSibling)},children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gray-900 opacity-50 pointer-events-none rounded-lg"}),(0,r.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,r.jsx)(i.A,{className:"w-20 h-20 text-white transition-all duration-300 hover:scale-105 drop-shadow-lg hover:drop-shadow-2xl filter z-10"})})]})]})]})})]});return H?T?(0,a.createPortal)(B,T):null:B}},99840:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>f,Es:()=>p,HM:()=>m,L3:()=>x,c7:()=>g,cB:()=>b,lG:()=>c,rr:()=>w,zM:()=>d});var r=s(95155),n=s(12115),a=s(15452),o=s(2564),l=s(54416),i=s(5765);let c=a.bL,d=a.l9,u=a.ZL,m=a.bm,h=n.forwardRef((e,t)=>
1{let{className:s,...n}=e;return(0,r.jsx)(a.hJ,{ref:t,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...n})});h.displayName=a.hJ.displayName;let f=n.forwardRef((e,t)=>{let{className:s,children:n,animationVariant:o="default",hideCloseButton:c=!1,...d}=e;return(0,r.jsxs)(u,{children:[(0,r.jsx)(h,{}),(0,r.jsxs)(a.UC,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200","data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-10 data-[state=closed]:slide-out-to-left-full data-[state=closed]:slide-out-to-bottom-half cubic-bezier(0.4, 0, 0.2, 1)",s),...d,children:[n,!c&&(0,r.jsxs)(a.bm,{className:"absolute right-4 top-4 roun
1ded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,r.jsx)(l.A,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});f.displayName=a.UC.displayName;let g=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...s})};g.displayName="DialogHeader";let p=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};p.displayName="DialogFooter";let x=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)(a.hE,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",s),...n})});x.displayName=a.hE.displayName;let w=n.forwardRef((e,t)=>{let{className:s,...n}=e;return(0,r.jsx)(a.VY,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",s),...n})});w.displayName=a.VY.displayName;let b=n.forwardRef((e,t)=>{let{children:s,...n}=e;return(0,r.jsx)(o.bL,{children:(0,r.jsx)(a.hE,{ref:t,...n,children:s})})});b.displayName="VisuallyHiddenDialogTitle"}},e=>{e.O(0,[2643,1479,8247,9323,5033,1639,4903,9507,3692,3983,8882,2960,3119,7631,4277,4772,3063,1757,4134,95,832,3090,1083,8663,3099,5508,6242,6619,6243,7944,1331,1462,9115,7373,7783,566,2506,4850,8441,4833,7358],()=>e(e.s=47772)),_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.