1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mammoth.browser-B8MH9hJW.js","assets/index-CzMEFmtw.js","assets/index-BKdHRffB.css"])))=>i.map(i=>d[i]); 2import{e as te,r as d,y as $,j as e,aH as Rt,aJ as ye,L as J,a6 as Ye,aK as ts,ay as fe,aM as ss,aN as as,I as dt,aO as R,q as me,a0 as ue,h as mt,ba as rs,X as ve,bb as ns,k as os,bc as He,bd as nt,Z as jt,f as is,ab as ls,_ as ot,a8 as qt,a$ as cs,b0 as ds,S as ms,be as us,bf as K,aI as wt}from"./index-CzMEFmtw.js";import{G as xe,L as hs,l as Te,C as Oe,B as ke,a as ps}from"./badges-DaqdU7p1.js";import{L as ie}from"./loader-circle-B3V02kMX.js";import{L as xs,a as gs}from"./log-out-DqPt0kKm.js";import{W as ys,A as fs,a as bs}from"./wrench-BM7oAc0k.js";import{E as Ot}from"./eye-off-B7JO2O_O.js";import{C as js}from"./circle-help-aQqez_dA.js";import{P as Le}from"./plus-DZqQktxt.js";import{T as it}from"./trash-2-gzkfqCHP.js";import{T as ws}from"./trending-up-BfxTzfPQ.js";import{T as Ht}from"./triangle-alert-BAXlYilG.js";import{D as Gt}from"./download-D1O7GOuA.js";import{U as Ns}from"./upload-C1EWCH4L.js";/** 3 * @license lucide-react v0.462.0 - ISC 4 * 5 * This source code is licensed under the ISC license. 6 * See the LICENSE file in the root directory of this source tree. 7 */const vs=te("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** 8 * @license lucide-react v0.462.0 - ISC 9 * 10 * This source code is licensed under the ISC license. 11 * See the LICENSE file in the root directory of this source tree. 12 */const ks=te("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** 13 * @license lucide-react v0.462.0 - ISC 14 * 15 * This source code is licensed under the ISC license. 16 * See the LICENSE file in the root directory of this source tree. 17 */const Cs=te("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** 18 * @license lucide-react v0.462.0 - ISC 19 * 20 * This source code is licensed under the ISC license. 21 * See the LICENSE file in the root directory of this source tree. 22 */const Ut=te("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** 23 * @license lucide-react v0.462.0 - ISC 24 * 25 * This source code is licensed under the ISC license. 26 * See the LICENSE file in the root directory of this source tree. 27 */const Ss=te("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** 28 * @license lucide-react v0.462.0 - ISC 29 * 30 * This source code is licensed under the ISC license. 31 * See the LICENSE file in the root directory of this source tree. 32 */const As=te("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** 33 * @license lucide-react v0.462.0 - ISC 34 * 35 * This source code is licensed under the ISC license. 36 * See the LICENSE file in the root directory of this source tree. 37 */const Ps=te("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** 38 * @license lucide-react v0.462.0 - ISC 39 * 40 * This source code is licensed under the ISC license. 41 * See the LICENSE file in the root directory of this source tree. 42 */const ut=te("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** 43 * @license lucide-react v0.462.0 - ISC 44 * 45 * This source code is licensed under the ISC license. 46 * See the LICENSE file in the root directory of this source tree. 47 */const _s=te("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** 48 * @license lucide-react v0.462.0 - ISC 49 * 50 * This source code is licensed under the ISC license. 51 * See the LICENSE file in the root directory of this source tree. 52 */const Fs=te("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]),Ce={daily_login:{xp:0,cadence:"daily",label:"Daily login"},career_assessment:{xp:0,cadence:"once",label:"Career readiness asse
52ssment"},salary_calculator:{xp:0,cadence:"once",label:"AI salary calculator"},eligibility_checker:{xp:0,cadence:"once",label:"Country eligibility checker"},country_comparison:{xp:0,cadence:"once",label:"Country comparison"},roadmap_generator:{xp:0,cadence:"once",label:"Career roadmap generated"},resume_analyzer:{xp:0,cadence:"once",label:"Resume analyzed"},dataflow_checker:{xp:0,cadence:"once",label:"DataFlow readiness check"},quiz_completion:{xp:2,cadence:"daily",label:"Prometric practice quiz"},daily_challenge:{xp:1,cadence:"daily",label:"Daily career challenge"},daily_spin:{xp:0,cadence:"daily",label:"Daily spin wheel"},memory_match:{xp:1,cadence:"daily",label:"Medical memory match"},speed_round:{xp:2,cadence:"daily",label:"Clinical speed round"},word_guess:{xp:1,cadence:"daily",label:"Medical word guess"},webinar_registration:{xp:0,cadence:"once",label:"Webinar registration"},webinar_attendance:{xp:0,cadence:"once",label:"Webinar attendance"},profile_completion:{xp:0,cadence:"once",label:"Profile completed"},referral:{xp:0,cadence:"once",label:"Verified referral"}},le=()=>new Date().toISOString().slice(0,10),Es=(t,s)=>{const n=Ce[t].cadence,a=s?`${t}:${s}`:t;return n==="daily"?`${a}:${le()}`:a},lt=[{key:"m_quiz",title:"Finish a Prometric Quiz Challenge",xp:1,toolKey:"prometric-quiz"},{key:"m_spin",title:"Use your Daily Spin Wheel",xp:1,toolKey:"spin-wheel"},{key:"m_challenge",title:"Complete today's Career Challenge",xp:1,toolKey:"daily-challenge"},{key:"m_speed",title:"Survive the 60-second Clinical Speed Round",xp:1,toolKey:"speed-round"},{key:"m_memory",title:"Clear the Medical Memory Match board",xp:1,toolKey:"memory-match"},{key:"m_word",title:"Crack today's Medical Word Guess",xp:1,toolKey:"word-guess"}],Ls=(t,s)=>{const n=`${t}:${s}`;let a=0;for(let r=0;r<n.length;r++)a=a*31+n.charCodeAt(r)>>>0;return lt[a%lt.length]},Xt=d.createContext(void 0),Ts="https://nzaweyjfkrxnydlavsln.supabase.co/functions/v1/career-auth",$s=({children:t})=>{const[s,n]=d.useState(null),[a,r]=d.useState(null),[o,i]=d.useState(null),[h,l]=d.useState([]),[y,w]=d.useState({}),[g,c]=d.useState(null),[p,x]=d.useState([]),[u,f]=d.useState(!0),b=d.useRef(null),N=d.useCallback(async _=>{const[P,B,T,D,m]=await Promise.all([$.from("career_members").select("*").eq("user_id",_).maybeSingle(),$.from("career_achievements").select("badge_key").eq("user_id",_),$.from("career_tool_progress").select("tool_key, data, completed, runs, updated_at").eq("user_id",_),$.from("career_daily_missions").select("*").eq("user_id",_).eq("mission_date",le()).maybeSingle(),$.from("career_xp_events").select("id, event_key, xp, created_at").eq("user_id",_).order("created_at",{ascending:!1}).limit(12)]);i(P.data??null),l((B.data??[]).map(k=>k.badge_key));const C={};(T.data??[]).forEach(k=>C[k.tool_key]=k),w(C),c(D.data??null),x(m.data??[])},[]),v=d.useCallback(async()=>{a!=null&&a.id&&await N(a.id)},[a==null?void 0:a.id,N]),A=d.useCallback(async(_,P)=>{const B=Ce[_],T=(P==null?void 0:P.amount)??B.xp;if(!(a!=null&&a.id)||T<=0)return 0;const{data:D,error:m}=await $.rpc("career_award_xp",{_event_key:_,_dedupe_key:Es(_,P==null?void 0:P.suffix),_xp:T,_meta:(P==null?void 0:P.meta)??{}});if(m)return 0;const C=Array.isArray(D)?D[0]:D;return await N(a.id),C!=null&&C.awarded?T:0},[a==null?void 0:a.id,N]),I=d.useCallback(async _=>{a!=null&&a.id&&(await $.from("career_achievements").insert({user_id:a.id,badge_key:_}),l(P=>P.includes(_)?P:[...P,_]))},[a==null?void 0:a.id]),j=d.useCallback(async(_,P,B=!0)=>{if(!(a!=null&&a.id))return;const T=y[_];await $.from("career_tool_progress").upsert({user_id:a.id,tool_key:_,data:P,completed:B||(T==null?void 0:T.completed)||!1,runs:((T==null?void 0:T.runs)??0)+1},{onConflict:"user_id,tool_key"}),await N(a.id)},[a==null?void 0:a.id,y,N]),q=d.useCallback(async()=>{!(a!=null&&a.id)||!g||g.completed||(await $.rpc("career_complete_mission"),await N(a.id))},[a==null?void 0:a.id,g,N]),O=d.useCallback(async _=>{if(b.current===_)return;b.current=_;const{data:P}=await $.from("career_members").select("*").eq("user_id",_).maybeSingle();if(!P)return;const B=le(),T=P.last_login_date;if(T!==B){const C=new Date(Date.now()-864e5).toISOString().slice(0,10),k=T===C?P.streak_count+1:1;await $.from("career_members").update({last_login_date:B,streak_count:k}).eq("user_id",_),await $.from("career_login_history").insert({user_id:_,user_agent:navigator.userAgent}),await $.rpc("career_award_xp",{_event_key:"daily_login",_dedupe_key:`daily_login:${B}`,_xp:Ce.daily_login.xp,_meta:{}}),k>=30&&await $.from("career_achievements").insert({user_id:_,badge_key:"streak_30"})}await $.from("career_achievements").insert({user_id:_,badge_key:"first_login"});const D=Ls(_,B);await $.rpc("career_ensure_daily_mission",{_mission_key:D.key});const{data:m}=await $.from("career_members").select("xp, gold_unlocked").eq("user_id",_).maybeSingle();m&&m.xp>=xe&&await $.from("career_achievements").insert({user_id:_,badge_key:"healthserve_gold"}),await N(_)},[N]);d.useEffect(()=>{const{data:_}=$.auth.onAuthStateChange((P,B)=>{n(B),r((B==null?void 0:B.user)??null),B!=null&&B.user?setTimeout(()=>{N(B.user.id),O(B.user.id)},0):(i(null),l([]),w({}),c(null),b.current=null)});return $.auth.getSession().then(async({data:P})=>{var B,T;n(P.session),r(((B=P.session)==null?void 0:B.user)??null),(T=P.session)!=null&&T.user&&(await N(P.session.user.id),O(P.session.user.id)),f(!1)}),()=>_.subscription.unsubscribe()},[N,O]);const W=d.useCallback(async(_,P)=>{try{const B=await fetch(Ts,{method:"POST",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im56YXdleWpma3J4b
52nlkbGF2c2xuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzg5MjUwNjQsImV4cCI6MjA5NDUwMTA2NH0.E3JAGw56VmKq0Cb13TapBxP2rCYPEStF6AgZOQXck6E"},body:JSON.stringify({action:"login",username:_,password:P})}),T=await B.json();if(!B.ok||T!=null&&T.error)return{error:(T==null?void 0:T.error)??"Sign in failed."};const{error:D}=await $.auth.setSession({access_token:T.session.access_token,refresh_token:T.session.refresh_token});return D?{error:D.message}:{}}catch{return{error:"Network error. Please try again."}}},[]),S=d.useCallback(async()=>{await $.auth.signOut(),b.current=null},[]),E=d.useMemo(()=>({loading:u,session:s,user:a,member:o,badges:h,progress:y,mission:g,recentXp:p,refresh:v,awardXp:A,grantBadge:I,saveToolProgress:j,completeMission:q,signInWithUsername:W,signOut:S}),[u,s,a,o,h,y,g,p,v,A,I,j,q,W,S]);return e.jsx(Xt.Provider,{value:E,children:t})},V=()=>{const t=d.useContext(Xt);if(!t)throw new Error("useCareer must be used inside CareerAuthProvider");return t},Ms=["/career-hub/login","/career-hub/forgot-password","/career-hub/reset-password"],Bs=({onSignIn:t})=>e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-[#F2FBFF] via-white to-[#FFF6E8] flex items-center justify-center px-4 py-16",children:e.jsxs("div",{className:"w-full max-w-md text-center rounded-3xl border border-white/70 bg-white/85 backdrop-blur-xl shadow-[0_20px_60px_rgba(15,23,42,0.10)] p-8",children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-11 w-auto mx-auto mb-6"}),e.jsx("div",{className:"mx-auto mb-4 w-12 h-12 rounded-2xl bg-[#F9A01B]/12 flex items-center justify-center",children:e.jsx(hs,{className:"w-6 h-6 text-[#F9A01B]"})}),e.jsx("h1",{className:"font-heading text-2xl font-extrabold text-[#1a1a1a] mb-2",children:"Career Hub is coming soon"}),e.jsx("p",{className:"text-[15px] text-gray-600 mb-6",children:"The Healthserve Career Hub is currently in private preview while we put the finishing touches in place. It will open to everyone very soon."}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[e.jsx("button",{type:"button",onClick:t,className:"rounded-xl bg-[#F9A01B] px-5 py-3 text-sm font-bold text-white hover:brightness-105 transition",children:"Team sign in"}),e.jsx(J,{to:"/",className:"rounded-xl border border-gray-200 bg-white px-5 py-3 text-sm font-bold text-gray-700 hover:border-[#2CC5F4] transition",children:"Back to Healthserve"})]})]})}),Ds="https://nzaweyjfkrxnydlavsln.supabase.co/functions/v1/career-auth",Is=({children:t})=>{const{pathname:s}=Rt(),[n,a]=d.useState(!0),[r,o]=d.useState(!1);if(d.useEffect(()=>{let h=!1;const l=async w=>{let g=!1;try{const p=await(await fetch(Ds,{method:"POST",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im56YXdleWpma3J4b
52nlkbGF2c2xuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzg5MjUwNjQsImV4cCI6MjA5NDUwMTA2NH0.E3JAGw56VmKq0Cb13TapBxP2rCYPEStF6AgZOQXck6E",...w?{Authorization:`Bearer ${w}`}:{}},body:JSON.stringify({action:"access"})})).json();g=!!(p!=null&&p.allowed)}catch{g=!1}h||(o(g),a(!1))};$.auth.getSession().then(({data:w})=>{var g;return l((g=w.session)==null?void 0:g.access_token)});const{data:y}=$.auth.onAuthStateChange((w,g)=>{a(!0),l(g==null?void 0:g.access_token)});return()=>{h=!0,y.subscription.unsubscribe()}},[]),Ms.includes(s))return e.jsx(e.Fragment,{children:t});if(n)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white",children:e.jsx(ie,{className:"w-6 h-6 animate-spin text-[#2CC5F4]"})});const i=async()=>{try{await $.auth.signOut()}catch{}window.location.assign("/career-hub/login")};return r?e.jsx(e.Fragment,{children:t}):e.jsx(Bs,{onSignIn:i})},Rs=[{to:"/career-hub/dashboard",label:"Dashboard",icon:gs},{to:"/career-hub/tools",label:"Career tools",icon:ys},{to:"/career-hub/achievements",label:"Achievements",icon:as},{to:"/career-hub/gold",label:"Gold card",icon:Oe},{to:"/career-hub/profile",label:"Profile",icon:_s}],qs=()=>{const{loading:t,user:s,member:n,signOut:a}=V(),r=Ye();if(d.useEffect(()=>{!t&&!s&&r("/career-hub/login",{replace:!0})},[t,s,r]),t||!s)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-[#F7FAFC]",children:e.jsx("div",{className:"w-8 h-8 border-2 border-[#F9A01B] border-t-transparent rounded-full animate-spin"})});if(!n)return e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-[#F7FAFC] px-6 text-center",children:[e.jsx("p",{className:"text-gray-700 font-semibold",children:"This account isn't registered on the Career Hub yet."}),e.jsx("button",{onClick:()=>r("/career-hub/register"),className:"text-[#0b7fa3] font-bold underline",children:"Complete Career Hub registration"}),e.jsx("button",{onClick:()=>a(),className:"text-sm text-gray-500 underline",children:"Sign out"})]});const o=Te(n.xp);return e.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#F7FBFF] via-white to-[#FFF9F0]",children:[e.jsxs("header",{className:"sticky top-0 z-40 border-b border-gray-200/70 bg-white/80 backdrop-blur-xl",children:[e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 h-16 flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-8 w-auto"}),e.jsxs("div",{className:"hidden sm:block leading-tight",children:[e.jsx("div",{className:"font-heading text-sm font-extrabold text-[#1a1a1a]",children:"Career Hub"}),e.jsxs("div",{className:"text-[11px] text-gray-500",children:["Level ",o.current.level," · ",o.current.name]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"hidden sm:inline-flex items-center gap-1 rounded-full bg-[#F9A01B]/10 border border-[#F9A01B]/25 px-3 py-1 text-xs font-bold text-[#a3660b]",children:[e.jsx(Ut,{className:"w-3.5 h-3.5"})," ",n.streak_count," day streak"]}),e.jsxs("span",{className:"inline-flex items-center rounded-full bg-[#2CC5F4]/10 border border-[#2CC5F4]/25 px-3 py-1 font-mono text-xs font-bold text-[#0b7fa3]",children:[n.xp.toLocaleString()," XP"]}),e.jsx("button",{onClick:()=>a(),"aria-label":"Sign out",className:"p-2 rounded-lg text-gray-500 hover:bg-gray-100 hover:text-gray-800",children:e.jsx(xs,{className:"w-4 h-4"})})]})]}),e.jsx("nav",{className:"max-w-7xl mx-auto px-2 sm:px-6 flex gap-1 overflow-x-auto scrollbar-none",children:Rs.map(i=>e.jsxs(ts,{to:i.to,className:({isActive:h})=>fe("flex items-center gap-2 whitespace-nowrap px-3 py-2.5 text-[13px] font-semibold border-b-2 transition-colors",h?"border-[#F9A01B] text-[#1a1a1a]":"border-transparent text-gray-500 hover:text-gray-800"),children:[e.jsx(i.icon,{className:"w-4 h-4"}),i.label]},i.to))})]}),e.jsx("main",{className:"max-w-7xl mx-auto px-4 sm:px-6 py-6 sm:py-10",children:e.jsx(ss,{})})]})},F=({children:t,className:s,onClick:n,...a})=>e.jsx("div",{...a,onClick:n,className:fe("rounded-2xl border border-white/70 bg-white/80 backdrop-blur-xl shadow-[0_8px_30px_rgba(15,23,42,0.06)] transition-all duration-300",n&&"cursor-pointer hover:-translate-y-1 hover:shadow-[0_16px_44px_rgba(15,23,42,0.12)]",s),children:t}),ge=({title:t,subtitle:s})=>e.jsxs("div",{className:"mb-4",children:[e.jsx("h2",{className:"font-heading text-lg font-bold text-[#1a1a1a]",children:t}),s&&e.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:s})]}),Se=({value:t,size:s=140,stroke:n=12,label:a,sub:r})=>{const o=(s-n)/2,i=2*Math.PI*o,h=i-Math.max(0,Math.min(100,t))/100*i;return e.jsxs("div",{className:"relative inline-flex items-center justify-center",style:{width:s,height:s},children:[e.jsxs("svg",{width:s,height:s,className:"-rotate-90",children:[e.jsx("circle",{cx:s/2,cy:s/2,r:o,stroke:"#EEF2F6",strokeWidth:n,fill:"none"}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"ringGrad",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:"#2CC5F4"}),e.jsx("stop",{offset:"100%",stopColor:"#F9A01B"})]})}
52),e.jsx("circle",{cx:s/2,cy:s/2,r:o,stroke:"url(#ringGrad)",strokeWidth:n,strokeLinecap:"round",fill:"none",strokeDasharray:i,strokeDashoffset:h,style:{transition:"stroke-dashoffset 900ms cubic-bezier(.22,1,.36,1)"}})]}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[e.jsx("span",{className:"font-mono text-2xl font-bold text-[#1a1a1a]",children:a}),r&&e.jsx("span",{className:"text-[11px] uppercase tracking-wider text-gray-500",children:r})]})]})},Ge=({pct:t})=>e.jsx("div",{className:"h-2.5 w-full rounded-full bg-gray-100 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#2CC5F4] to-[#F9A01B] transition-[width] duration-700",style:{width:`${Math.max(2,t)}%`}})}),L=({children:t,tone:s="blue"})=>{const n={blue:"bg-[#2CC5F4]/10 text-[#0b7fa3] border-[#2CC5F4]/25",orange:"bg-[#F9A01B]/10 text-[#a3660b] border-[#F9A01B]/25",gray:"bg-gray-100 text-gray-600 border-gray-200",green:"bg-emerald-50 text-emerald-700 border-emerald-200"};return e.jsx("span",{className:fe("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-[11px] font-semibold",n[s]),children:t})},H=({children:t,onClick:s,type:n="button",variant:a="primary",disabled:r,className:o})=>e.jsx("button",{type:n,onClick:s,disabled:r,className:fe("inline-flex items-center justify-center gap-2 rounded-xl px-5 py-3 text-sm font-bold transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed",a==="primary"&&"bg-gradient-to-r from-[#F9A01B] to-[#f7b448] text-white shadow-lg shadow-[#F9A01B]/25 hover:shadow-xl hover:-translate-y-0.5",a==="outline"&&"border-2 border-[#2CC5F4] text-[#0b7fa3] hover:bg-[#2CC5F4]/10",a==="ghost"&&"text-gray-600 hover:bg-gray-100",o),children:t}),Nt="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 placeholder:text-gray-400 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",Be="healthserve_career_username",Os=()=>{var N;const t=Ye(),s=Rt(),{signInWithUsername:n,user:a,loading:r}=V(),[o,i]=d.useState(((N=s.state)==null?void 0:N.username)??localStorage.getItem(Be)??""),[h,l]=d.useState(""),[y,w]=d.useState(!!localStorage.getItem(Be)),[g,c]=d.useState(!1),[p,x]=d.useState(!1),[u,f]=d.useState("");d.useEffect(()=>{!r&&a&&t("/career-hub/dashboard",{replace:!0})},[r,a,t]);const b=async v=>{v.preventDefault(),f(""),x(!0);const{error:A}=await n(o.trim(),h);if(x(!1),A){f(A);return}y?localStorage.setItem(Be,o.trim()):localStorage.removeItem(Be),t("/career-hub/dashboard",{replace:!0})};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-[#F2FBFF] via-white to-[#FFF6E8] flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-11 w-auto mx-auto mb-4"}),e.jsx("h1",{className:"font-heading text-3xl font-extrabold text-[#1a1a1a]",children:"Career Hub sign in"}),e.jsx("p",{className:"text-gray-600 mt-2 text-sm",children:"Track your XP, tools and rewards."})]}),e.jsxs("form",{onSubmit:b,className:"rounded-3xl border border-white/70 bg-white/85 backdrop-blur-xl shadow-[0_20px_60px_rgba(15,23,42,0.10)] p-6 sm:p-8 space-y-5",children:[u&&e.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:u}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Username"}),e.jsx("input",{className:Nt,value:o,onChange:v=>i(v.target.value),autoComplete:"username",placeholder:"your_username"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{className:Nt,type:g?"text":"password",value:h,onChange:v=>l(v.target.value),autoComplete:"current-password"}),e.jsx("button",{type:"button",onClick:()=>c(v=>!v),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700",children:g?e.jsx(Ot,{className:"w-4 h-4"}):e.jsx(dt,{className:"w-4 h-4"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("label",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx("input",{type:"checkbox",checked:y,onChange:v=>w(v.target.checked),className:"accent-[#F9A01B]"}),"Remember me"]}),e.jsx(J,{to:"/career-hub/forgot-password",className:"font-semibold text-[#0b7fa3] hover:underline",children:"Forgot password?"})]}),e.jsxs(H,{type:"submit",disabled:p,className:"w-full",children:[p?e.jsx(ie,{className:"w-4 h-4 animate-spin"}):null,p?"Signing inâ¦":"Sign in"]}),e.jsxs("p",{className:"text-center text-sm text-gray-600",children:["New here?"," ",e.jsx(J,{to:"/career-hub/register",className:"font-bold text-[#0b7fa3] hover:underline",children:"Create an account"})]})]})]})})},Hs="/assets/game-quiz-Bmt4jq2H.jpg",Gs="/assets/game-spin-DLpfh4ae.jpg",Us="/assets/game-memory-ZTl9SuAd.jpg",Xs="/assets/game-speed-4rcP1MC5.jpg",Ys="/assets/game-word-CWiCAUgF.jpg",Vs="/assets/game-challenge-NtUtVnVS.jpg",pe=["United Arab Emirates","Saudi Arabia","Qatar","Kuwait","Oman","Bahrain","Germany","United Kingdom","Ireland","Canada","Australia"],De=["Registered Nurse","Doctor / Physician","Pharmacist","Lab Technologist","Radiogra
52pher","Physiotherapist","Dentist","Allied Health Other"],ae={"United Arab Emirates":{salary:2200,cost:1200,exam:"DHA / DOH / MOH (Prometric)",months:"2â4 months",language:"English",tax:"Tax free"},"Saudi Arabia":{salary:2e3,cost:900,exam:"SCFHS Prometric",months:"3â5 months",language:"English",tax:"Tax free"},Qatar:{salary:2400,cost:1100,exam:"QCHP Prometric",months:"3â6 months",language:"English",tax:"Tax free"},Kuwait:{salary:1900,cost:950,exam:"Kuwait MOH exam",months:"4â6 months",language:"English",tax:"Tax free"},Oman:{salary:1700,cost:850,exam:"OMSB Prometric",months:"3â5 months",language:"English",tax:"Tax free"},Bahrain:{salary:1800,cost:900,exam:"NHRA Prometric",months:"3â5 months",language:"English",tax:"Tax free"},Germany:{salary:3300,cost:1700,exam:"Anerkennung / Kenntnisprüfung",months:"12â18 months",language:"German B2",tax:"~35% deductions"},"United Kingdom":{salary:3100,cost:1900,exam:"NMC / GMC + OSCE",months:"8â12 months",language:"IELTS / OET",tax:"~25% deductions"},Ireland:{salary:3400,cost:1900,exam:"NMBI registration",months:"6â10 months",language:"IELTS / OET",tax:"~28% deductions"},Canada:{salary:4200,cost:2200,exam:"NNAS + NCLEX-RN",months:"12â24 months",language:"IELTS / CELBAN",tax:"~28% deductions"},Australia:{salary:4300,cost:2300,exam:"AHPRA / OBA",months:"9â15 months",language:"IELTS / OET",tax:"~30% deductions"}},be=(t,s=0)=>{const n=Number(t);return Number.isFinite(n)?n:s},ce=[{key:"salary-calculator",name:"AI Salary Calculator",tagline:"Live AI benchmark for the GCC & Germany",emoji:"ð°",category:"Money",xpKey:"salary_calculator",custom:"salary",howTo:"Enter your profession, target country and experience. The AI pulls current market pay standards (refreshed weekly) and returns a realistic salary band, allowances, tax and savings potential."},{key:"readiness-assessment",name:"Career Readiness Assessment",tagline:"Score how prepared you are to move abroad",emoji:"ð¯",category:"Assess",xpKey:"career_assessment",fields:[{key:"profession",label:"Profession",type:"select",options:De,required:!0},{key:"experience",label:"Years of experience",type:"number",required:!0},{key:"docs",label:"Are your documents (degree, transcripts, licence) ready?",type:"select",options:["All ready","Partly ready","Not started"],required:!0},{key:"exam",label:"Licensing exam status",type:"select",options:["Passed","Booked","Preparing","Not started"],required:!0},{key:"english",label:"English / language test",type:"select",options:["Achieved required score","Booked","Not started","Not required"],required:!0},{key:"dataflow",label:"DataFlow / primary source verification",type:"select",options:["Completed","In progress","Not started"],required:!0}],compute:t=>{let s=0;s+=Math.min(be(t.experience),8)*3,s+={"All ready":22,"Partly ready":12,"Not started":0}[t.docs]??0,s+={Passed:26,Booked:16,Preparing:8,"Not started":0}[t.exam]??0,s+={"Achieved required score":14,Booked:8,"Not started":0,"Not required":12}[t.english]??0,s+={Completed:14,"In progress":7,"Not started":0}[t.dataflow]??0,s=Math.min(100,s);const n=s>=80?"Ready to apply":s>=55?"Almost there":s>=30?"Building up":"Early stage";return{headline:`You are ${n.toLowerCase()} â readiness score ${s}/100`,score:s,scoreLabel:n,bullets:[t.docs!=="All ready"?"Collect and attest your degree, transcripts and experience letters â this is the most common delay.":"Documents ready â keep attested copies scanned in one folder.",t.exam!=="Passed"?"Book your licensing exam early; slots fill fast in peak months.":"Licensing exam cleared â you can start applying to employers now.",t.dataflow!=="Completed"?"Start DataFlow now: it runs in parallel and takes the longest.":"DataFlow complete â a major milestone."]}}},{key:"eligibility-checker",name:"Country Eligibility Checker",tagline:"See if you qualify for your target country",emoji:"ð",category:"Assess",xpKey:"eligibility_checker",fields:[{key:"country",label:"Target country",type:"select",options:pe,required:!0},{key:"profession",label:"Profession",type:"select",options:De,required:!0},{key:"qualification",label:"Highest qualification",type:"select",options:["Diploma","Bachelor's degree","Master's degree","Doctorate"],required:!0},{key:"experience",label:"Years of post-qualification experience",type:"number",required:!0},{key:"language",label:"Language readiness",type:"select",options:["Yes","In progress","No"],required:!0}],compute:t=>{const s=ae[t.country],n=be(t.experience),a=t.qualification!=="Diploma",r=["Germany","Canada","Australia","United Kingdom","Ireland"].includes(t.country)?1:2,o=n>=r&&(a||t.country==="United Arab Emirates"),i=Math.min(100,(o?60:30)+Math.min(n,6)*5+(t.language==="Yes"?10:0));return{headline:o?`You likely meet the core requirements for ${t.country}`:`You are close, but ${t.country} needs a bit more from you`,score:i,scoreLabel:o?"Eligible":"Conditional",stats:[{label:"Required exam",value:s.exam},{label:"Typical timeline",value:s.months},{label:"Language",value:s.language},{label:"Minimum experience",value:`${r}+ years`}],bullets:[n<r?`You need at least ${r} years of experience â ${r-n} more to go.`:"Experience requirement met.",a?"Your qualification level is accepted.":"Diploma holders face extra scrutiny; a bridging bachelor's helps significantly.",t.language!=="Yes"?`Language requirement (${s.language}) is still pending.`:"Language requirement satisfied."]}}},{key:"career-recommendation",name:"AI Career Recommendation",tagline:"Get a personalised next-best-move",emoji:"ð¤",category:"Plan",fields:[{key:"profession",label:"Profession",type:"select",options:De,required:!0},{key:"experience",label:"Years of experience",type:"number",required:!0},{key:"priority",label:"What matters most right now?",type:"select",options:["Highest salary","Fastest relocation","Family friendly","Long-term residency","Career growth"],required:!0},{key:"budget",label:"Budget available for the process (USD)",type:"number",placeholder:"e.g. 3000"}],compute:t=>{const s={"Highest salary":["Australia","Canada","Qatar"],"Fastest relocation":["United Arab Emirates","Saudi Arabia","Oman"],"Family friendly":["United Arab Emirates","Ireland","Canada"],"Long-term residency":["Canada","Australia","Germany"],"Career growth":["
52United Kingdom","Germany","United Arab Emirates"]},n=s[t.priority]??s["Fastest relocation"],a=be(t.budget);return{headline:`Best-fit destinations for you: ${n.join(", ")}`,steps:n.map((r,o)=>({title:`${o+1}. ${r}`,detail:`${ae[r].exam} · timeline ${ae[r].months} · avg base $${ae[r].salary}/mo`})),bullets:[a&&a<1500?"Your budget suits a GCC route first â lower upfront cost, faster payback.":"Your budget supports a western route with exam and language costs.",`With ${t.experience||0} years as a ${t.profession}, target employers hiring in your specialty directly.`,"Book a Healthserve consultation to lock the shortest path for your profile."]}}},{key:"country-comparison",name:"Country Comparison Tool",tagline:"Compare two destinations side by side",emoji:"âï¸",category:"Plan",xpKey:"country_comparison",fields:[{key:"a",label:"Country A",type:"select",options:pe,required:!0},{key:"b",label:"Country B",type:"select",options:pe,required:!0},{key:"experience",label:"Years of experience",type:"number"}],compute:t=>{const s=ae[t.a],n=ae[t.b],a=s.salary-s.cost,r=n.salary-n.cost;return{headline:a===r?`${t.a} and ${t.b} are evenly matched`:`${a>r?t.a:t.b} gives you more take-home each month`,stats:[{label:`${t.a} avg salary`,value:`$${s.salary}/mo`},{label:`${t.b} avg salary`,value:`$${n.salary}/mo`},{label:`${t.a} savings potential`,value:`$${a}/mo`},{label:`${t.b} savings potential`,value:`$${r}/mo`},{label:`${t.a} timeline`,value:s.months},{label:`${t.b} timeline`,value:n.months},{label:`${t.a} exam`,value:s.exam},{label:`${t.b} exam`,value:n.exam}],bullets:[`${t.a}: ${s.tax}, language ${s.language}.`,`${t.b}: ${n.tax}, language ${n.language}.`]}}},{key:"roadmap-generator",name:"Career Roadmap Generator",tagline:"A step-by-step plan to your licence",emoji:"ðºï¸",category:"Plan",xpKey:"roadmap_generator",fields:[{key:"country",label:"Target country",type:"select",options:pe,required:!0},{key:"profession",label:"Profession",type:"select",options:De,required:!0},{key:"start",label:"When do you want to relocate?",type:"select",options:["Within 3 months","3â6 months","6â12 months","Just exploring"],required:!0}],compute:t=>{const s=ae[t.country];return{headline:`Your ${t.country} roadmap as a ${t.profession}`,steps:[{title:"Step 1 · Document pack",detail:"Degree, transcripts, licence, experience letters, passport, photos â attested where required."},{title:"Step 2 · Primary source verification",detail:"DataFlow / PSV submission. Runs 6â12 weeks in the background."},{title:`Step 3 · ${s.exam}`,detail:"Prepare with Healthserve MCQ packages, then book the earliest slot."},{title:`Step 4 · Language (${s.language})`,detail:s.language==="English"?"No separate test needed for most employers.":"Book your language exam in parallel with PSV."},{title:"Step 5 · Licence issuance",detail:`Eligibility letter â exam pass â licence. Total ${s.months}.`},{title:"Step 6 · Employer offer & visa",detail:"Interview, offer letter, medical, visa stamping, relocation."}],bullets:[t.start==="Within 3 months"?"Tight timeline â start PSV and exam booking in the same week.":"You have runway: sequence documents first, then PSV."]}}},{key:"resume-builder",name:"Resume Builder",tagline:"Build a GCC-standard CV in minutes â then analyse your old one",emoji:"ð",category:"Assess",xpKey:"resume_analyzer",custom:"resume",howTo:"Pick a format, fill in your details and let AI write personalised, recruiter-ready content. Already have a CV? Switch to the Resume Analyzer tab and upload it."},{key:"dataflow-checker",name:"DataFlow Readiness Checker",tagline:"Avoid the most common PSV rejections",emoji:"ð§¾",category:"Assess",xpKey:"dataflow_checker",fields:[{key:"degree",label:"Degree certificate available",type:"select",options:["Yes","No"],required:!0},{key:"transcript",label:"Academic transcripts available",type:"select",options:["Yes","No"],required:!0},{key:"license",label:"Home country licence valid",type:"select",options:["Yes","Expired","No"],required:!0},{key:"experience",label:"Experience letters on letterhead with HR contact",type:"select",options:["Yes","Partly","No"],required:!0},{key:"passport",label:"Passport valid for 12+ months",type:"select",options:["Yes","No"],required:!0}],compute:t=>{const n=[t.degree==="Yes"?25:0,t.transcript==="Yes"?20:0,t.license==="Yes"?25:t.license==="Expired"?10:0,t.experience
52==="Yes"?20:t.experience==="Partly"?10:0,t.passport==="Yes"?10:0].reduce((a,r)=>a+r,0);return{headline:n>=85?"You're ready to submit DataFlow":"Fix these gaps before submitting DataFlow",score:n,scoreLabel:n>=85?"Ready":n>=55?"Nearly ready":"Not ready",bullets:[t.degree!=="Yes"?"â ï¸ Degree certificate missing â the #1 rejection cause.":"â
Degree certificate ready.",t.transcript!=="Yes"?"â ï¸ Request transcripts from your university now (4â8 weeks).":"â
Transcripts ready.",t.license!=="Yes"?"â ï¸ Renew your home licence before submission.":"â
Home licence valid.",t.experience!=="Yes"?"â ï¸ Experience letters must be on letterhead with a verifiable HR contact.":"â
Experience letters verifiable.",t.passport!=="Yes"?"â ï¸ Renew your passport first â details must match all documents.":"â
Passport valid."]}}},{key:"savings-calculator",name:"Savings Calculator",tagline:"Project what you'll actually save abroad",emoji:"ð¦",category:"Money",fields:[{key:"country",label:"Country",type:"select",options:pe,required:!0},{key:"salary",label:"Expected monthly salary (USD)",type:"number",required:!0},{key:"remit",label:"Monthly remittance home (USD)",type:"number",placeholder:"e.g. 500"},{key:"years",label:"Years planned abroad",type:"number",placeholder:"e.g. 3"}],compute:t=>{const s=ae[t.country],n=be(t.salary),a=be(t.remit),r=Math.max(1,be(t.years,1)),o=Math.max(0,n-s.cost-a);return{headline:`You could save about $${(o*12*r).toLocaleString()} over ${r} year${r>1?"s":""}`,stats:[{label:"Monthly savings",value:`$${o.toLocaleString()}`},{label:"Yearly savings",value:`$${(o*12).toLocaleString()}`},{label:"Living cost used",value:`$${s.cost.toLocaleString()}/mo`},{label:"Sent home",value:`$${(a*12*r).toLocaleString()} total`}],bullets:[`${s.tax} â factored into this estimate.`,"Employer housing can add 20â30% to real savings."]}}},{key:"license-timeline",name:"License Timeline Estimator",tagline:"Know when your licence will realistically land",emoji:"â±ï¸",category:"Plan",fields:[{key:"country",label:"Country",type:"select",options:pe,required:!0},{key:"stage",label:"Where are you now?",type:"select",options:["Not started","Documents ready","DataFlow submitted","Exam booked","Exam passed"],required:!0}],compute:t=>{const s=ae[t.country],a={"Not started":34,"Documents ready":26,"DataFlow submitted":16,"Exam booked":9,"Exam passed":4}
52[t.stage]??30,r=new Date(Date.now()+a*7*864e5/1e3*1e3);return{headline:`Estimated licence in ~${a} weeks (around ${r.toLocaleDateString(void 0,{month:"long",year:"numeric"})})`,stats:[{label:"Country",value:t.country},{label:"Official range",value:s.months},{label:"Your stage",value:t.stage},{label:"Remaining",value:`${a} weeks`}],bullets:["Running DataFlow and exam prep in parallel typically saves 6â8 weeks.","Healthserve fast-track support can reduce admin delays."]}}},{key:"progress-dashboard",name:"Career Progress Dashboard",tagline:"All your milestones in one view",emoji:"ð",category:"Assess",custom:"progress"},{key:"growth-tracker",name:"Professional Growth Tracker",tagline:"Track certifications and skills over time",emoji:"ð",category:"Assess",custom:"growth"},{key:"achievement-gallery",name:"Achievement Gallery",tagline:"Every badge you've unlocked",emoji:"ð
",category:"Assess",custom:"gallery"},{key:"career-passport",name:"Career Passport",tagline:"Your Healthserve identity and journey",emoji:"ð",category:"Assess",custom:"passport"},{key:"prometric-quiz",name:"Prometric Quiz Challenge",tagline:"10 exam-style questions, scored instantly",emoji:"ð§ ",category:"Play",game:!0,image:Hs,xpKey:"quiz_completion",custom:"quiz",howTo:"Answer 10 licensing-style MCQs. Finish once a day to earn XP."},{key:"speed-round",name:"Clinical Speed Round",tagline:"Beat the 60-second rapid-fire timer",emoji:"â±ï¸",category:"Play",game:!0,image:Xs,xpKey:"speed_round",custom:"speed",howTo:"Answer as many clinical questions as possible in 60 seconds."},{key:"memory-match",name:"Medical Memory Match",tagline:"Flip and pair 8 medical icons",emoji:"ð",category:"Play",game:!0,image:Us,xpKey:"memory_match",custom:"memory",howTo:"Clear the board in as few moves as you can."},{key:"word-guess",name:"Medical Word Guess",tagline:"Crack the hidden clinical term",emoji:"ð¤",category:"Play",game:!0,image:Ys,xpKey:"word_guess",custom:"word",howTo:"Guess letters before your 6 lives run out."},{key:"spin-wheel",name:"Daily Spin Wheel",tagline:"One free spin every day for 1â3 XP",emoji:"ð¡",category:"Play",game:!0,image:Gs,xpKey:"daily_spin",custom:"spin",howTo:"Spin once a day â pure luck, pure XP."},{key:"daily-challenge",name:"Daily Career Challenge",tagline:"One quick task to keep your streak alive",emoji:"â¡",category:"Play",game:!0,image:Vs,xpKey:"daily_challenge",custom:"challenge",howTo:"Complete today's mini task and mark it done."}],Ws=t=>ce.find(s=>s.key===t)??ce.find(s=>s.key===zs[t]),zs={"resume-analyzer":"resume-builder"},Qs="HS",Ks=()=>{const t=Array.from(crypto.getRandomValues(new Uint8Array(4))).map(s=>s.toString(36).toUpperCase().padStart(2,"0")).join("").slice(0,6);return`${Qs}-${new Date().getFullYear()}-${t}`},Js=t=>{const s=[];return t.length<8&&s.push("at least 8 characters"),/[A-Z]/.test(t)||s.push("one uppercase letter"),/[a-z]/.test(t)||s.push("one lowercase letter"),/\d/.test(t)||s.push("one number"),s},re=({label:t,children:s,hint:n,error:a})=>e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:t}),s,a?e.jsx("span",{className:"block text-[12px] text-red-600 mt-1",children:a}):n?e.jsx("span",{className:"block text-[12px] text-gray-500 mt-1",children:n}):null]}),ne="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 placeholder:text-gray-400 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",Zs=()=>{const t=Ye(),[s,n]=d.useState({full_name:"",username:"",password:"",confirm:"",email:"",dial:"+971",phone:"",country:"United Arab Emirates",city:""}),[a,r]=d.useState(!1),[o,i]=d.useState(!1),[h,l]=d.useState({}),y=(c,p)=>n(x=>({...x,[c]:p})),w=()=>{const c={};s.full_name.trim().length<3&&(c.full_name="Enter your full name."),/^[a-zA-Z0-9_]{4,20}$/.test(s.username)||(c.username="4â20 characters, letters, numbers or underscore.");const p=Js(s.password);return p.length&&(c.password=`Password needs ${p.join(", ")}.`),s.password!==s.confirm&&(c.confirm="Passwords do not match."),/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(s.email)||(c.email="Enter a valid email address."),/^\+\d{1,4}$/.test(s.dial)||(c.dial="Country code like +971."),/^\d{6,12}$/.test(s.phone)||(c.phone="Enter 6â12 digits, no spaces."),s.city.trim().length<2&&(c.city="Enter your city."),l(c),Ob
52ject.keys(c).length===0},g=async c=>{var p;if(c.preventDefault(),!!w()){i(!0);try{const{data:x}=await $.rpc("career_username_available",{_username:s.username});if(x===!1){l({username:"That username is already taken."}),i(!1);return}const{data:u,error:f}=await $.auth.signUp({email:s.email.trim().toLowerCase(),password:s.password,options:{emailRedirectTo:`${window.location.origin}/career-hub/login`,data:{full_name:s.full_name.trim()}}});if(f){const v=/already registered|already exists/i.test(f.message)?"An account already exists with this email.":f.message;l({email:v}),i(!1);return}const b=(p=u.user)==null?void 0:p.id;if(!b){R.error("Registration could not be completed. Please try again."),i(!1);return}const{error:N}=await $.from("career_members").insert({user_id:b,member_id:Ks(),full_name:s.full_name.trim(),username:s.username,email:s.email.trim().toLowerCase(),phone:`${s.dial}${s.phone}`,country:s.country,city:s.city.trim()});if(N){const v=/duplicate|unique/i.test(N.message);l({username:v?"Username or email is already registered.":N.message}),i(!1);return}await $.auth.signOut(),R.success("Career Hub account created. Please sign in."),t("/career-hub/login",{replace:!0,state:{username:s.username}})}finally{i(!1)}}};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-[#F2FBFF] via-white to-[#FFF6E8] flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-2xl",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-11 w-auto mx-auto mb-4"}),e.jsx("h1",{className:"font-heading text-3xl font-extrabold text-[#1a1a1a]",children:"Join the Career Hub"}),e.jsx("p",{className:"text-gray-600 mt-2 text-sm",children:"Create your free member account and start earning XP towards Healthserve Gold."})]}),e.jsxs("form",{onSubmit:g,className:"rounded-3xl border border-white/70 bg-white/85 backdrop-blur-xl shadow-[0_20px_60px_rgba(15,23,42,0.10)] p-6 sm:p-8 space-y-5",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-5",children:[e.jsx(re,{label:"Full name",error:h.full_name,children:e.jsx("input",{className:ne,value:s.full_name,onChange:c=>y("full_name",c.target.value),placeholder:"Aisha Rahman"})}),e.jsx(re,{label:"Username",error:h.username,hint:"You'll sign in with this.",children:e.jsx("input",{className:ne,value:s.username,onChange:c=>y("username",c.target.value.replace(/\s/g,"")),placeholder:"aisha_rn",autoComplete:"username"})}),e.jsx(re,{label:"Email address",error:h.email,children:e.jsx("input",{className:ne,type:"email",value:s.email,onChange:c=>y("email",c.target.value),placeholder:"[email protected]",autoComplete:"email"})}),e.jsxs("div",{className:"grid grid-cols-[100px_1fr] gap-2 items-start",children:[e.jsx(re,{label:"Code",error:h.dial,children:e.jsx("input",{className:ne,value:s.dial,onChange:c=>y("dial",c.target.value),placeholder:"+971"})}),e.jsx(re,{label:"Mobile number",error:h.phone,children:e.jsx("input",{className:ne,value:s.phone,onChange:c=>y("phone",c.target.value.replace(/\D/g,"")),placeholder:"501234567",inputMode:"numeric"})})]}),e.jsx(re,{label:"Country",children:e.jsx("select",{className:ne,value:s.country,onChange:c=>y("country",c.target.value),children:[...new Set([...pe,"India","Philippines","Pakistan","Nigeria","Egypt","Kenya","Nepal","Sri Lanka","Other"])].map(c=>e.jsx("option",{children:c},c))})}),e.jsx(re,{label:"City",error:h.city,children:e.jsx("input",{className:ne,value:s.city,onChange:c=>y("city",c.target.value),placeholder:"Dubai"})}),e.jsx(re,{label:"Password",error:h.password,hint:"8+ chars with upper, lower and a number.",children:e.jsxs("div",{className:"relative",children:[e.jsx("input",{className:ne,type:a?"text":"password",value:s.password,onChange:c=>y("password",c.target.value),autoComplete:"new-password"}),e.jsx("button",{type:"button",onClick:()=>r(c=>!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-700",children:a?e.jsx(Ot,{className:"w-4 h-4"}):e.jsx(dt,{className:"w-4 h-4"})})]})}),e.jsx(re,{label:"Confirm password",error:h.confirm,children:e.jsx("input",{className:ne,type:a?"text":"password",value:s.confirm,onChange:c=>y("confirm",c.target.value),autoComplete:"new-password"})})]}),e.jsxs(H,{type:"submit",disabled:o,className:"w-full",children:[o?e.jsx(ie,{className:"w-4 h-4 animate-spin"}):null,o?"Creating your accountâ¦":"Create my Career Hub account"]}),e.jsxs("p",{className:"text-center text-sm text-gray-600",children:["Already a member?"," ",e.jsx(J,{to:"/career-hub/login",className:"font-bold text-[#0b7fa3] hover:underline",children:"Sign in"})]})]})]})})},ea="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 placeholder:text-gray-400 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",ta=()=>
52{const[t,s]=d.useState(""),[n,a]=d.useState(!1),[r,o]=d.useState(!1),i=async h=>{h.preventDefault(),a(!0);try{await fetch("https://nzaweyjfkrxnydlavsln.supabase.co/functions/v1/career-auth",{method:"POST",headers:{"Content-Type":"application/json",apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im56YXdleWpma3J4bnlkbGF2c2xuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3Nzg5MjUwNjQsImV4cCI6MjA5NDUwMTA2NH0.E3JAGw56VmKq0Cb13TapBxP2rCYPEStF6AgZOQXck6E"},body:JSON.stringify({action:"forgot-password",identifier:t.trim(),redirectTo:`${window.location.origin}/career-hub/reset-password`})})}finally{a(!1),o(!0)}};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-[#F2FBFF] via-white to-[#FFF6E8] flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-11 w-auto mx-auto mb-4"}),e.jsx("h1",{className:"font-heading text-2xl font-extrabold text-[#1a1a1a]",children:"Reset your password"})]}),e.jsx("div",{className:"rounded-3xl border border-white/70 bg-white/85 backdrop-blur-xl shadow-[0_20px_60px_rgba(15,23,42,0.10)] p-6 sm:p-8",children:r?e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx(As,{className:"w-10 h-10 mx-auto text-[#2CC5F4]"}),e.jsx("p",{className:"text-gray-700 text-sm",children:"If an account matches what you entered, we've emailed a password reset link. Check your inbox and spam folder."}),e.jsx(J,{to:"/career-hub/login",className:"inline-block font-bold text-[#0b7fa3] hover:underline",children:"Back to sign in"})]}):e.jsxs("form",{onSubmit:i,className:"space-y-5",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Username or email"}),e.jsx("input",{className:ea,value:t,onChange:h=>s(h.target.value),placeholder:"your_username"})]}),e.jsxs(H,{type:"submit",disabled:n||t.trim().length<3,className:"w-full",children:[n?e.jsx(ie,{className:"w-4 h-4 animate-spin"}):null," Send reset link"]}),e.jsx("p",{className:"text-center text-sm text-gray-600",children:e.jsx(J,{to:"/career-hub/login",className:"font-bold text-[#0b7fa3] hover:underline",children:"Back to sign in"})})]})})]})})},vt="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",sa=()=>{const t=Ye(),[s,n]=d.useState(""),[a,r]=d.useState(""),[o,i]=d.useState(!1),[h,l]=d.useState(""),[y,w]=d.useState(!1);d.useEffect(()=>{let c=!1;return(async()=>{try{const p=new URL(window.location.href),x=new URLSearchParams(p.hash.replace(/^#/,"")),u=p.searchParams.get("code"),f=p.searchParams.get("token_hash")||p.searchParams.get("token"),b=p.searchParams.get("type")||x.get("type"),N=x.get("access_token"),v=x.get("refresh_token"),A=p.searchParams.get("error_description")||x.get("error_description");if(A)c||l(decodeURIComponent(A));else if(N&&v){const{error:j}=await $.auth.setSession({access_token:N,refresh_token:v});j&&!c&&l(j.message)}else if(u){const{error:j}=await $.auth.exchangeCodeForSession(u);j&&!c&&l(j.message)}else if(f){const{error:j}=await $.auth.verifyOtp({type:b||"recovery",token_hash:f});j&&!c&&l(j.message)}const{data:I}=await $.auth.getSession();!c&&!I.session&&l(j=>j||"This reset link is invalid or has expired. Please request a new one."),window.history.replaceState({},"",window.location.pathname)}finally{c||w(!0)}})(),()=>{c=!0}},[]);const g=async c=>{if(c.preventDefault(),l(""),s.length<8||!/[A-Z]/.test(s)||!/[a-z]/.test(s)||!/\d/.test(s)){l("Password needs at least 8 characters with upper, lower and a number.");return}if(s!==a){l("Passwords do not match.");return}i(!0);const{error:p}=await $.auth.updateUser({password:s});if(i(!1),p){l(p.message);return}await $.auth.signOut(),R.success("Password updated. Please sign in."),t("/career-hub/login",{replace:!0})};return e.jsx("div",{className:"min-h-screen bg-gradient-to-br from-[#F2FBFF] via-white to-[#FFF6E8] flex items-center justify-center px-4 py-12",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"text-center mb-6",children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-11 w-auto mx-auto mb-4"}),e.jsx("h1",{className:"font-heading text-2xl font-extrabold text-[#1a1a1a]",children:"Set a new password"})]}),e.jsxs("form",{onSubmit:g,className:"rounded-3xl border border-white/70 bg-white/85 backdrop-blur-xl shadow-[0_20px_60px_rgba(15,23,42,0.10)] p-6 sm:p-8 space-y-5",children:[h&&e.jsx("div",{className:"rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700",children:h}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"New password"}),e.jsx("input",{className:vt,type:"password",value:s,onChange:c=>n(c.target.value),autoComplete:"new-password"})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Confirm password"}),e.jsx("input",{className:vt,type:"password",value:a,onChange:c=>r(c.target.value),autoComplete:"new-password"})]}),e.jsxs(H,{type:"submit",disabled:o||!y,className:"w-full",children:[o||!y?e.jsx(ie,{className:"w-4 h-4 animate-spin"}):null,y?" Update password":" Verifying linkâ¦"]}),e.jsx("button",{type:"button",onClick:()=>t("/career-hub/forgot-password"),className:"w-full text-center text-[13px] font-semibold text-[#2CC5F4] hover:underline",children:"Request a new reset link"})]})]})})},aa=()=>
52{const{member:t,badges:s,progress:n,mission:a,recentXp:r,awardXp:o}=V(),[i,h]=d.useState(null);d.useEffect(()=>{$.from("webinars").select("id, slug, title, starts_at, badge").eq("published",!0).order("starts_at",{ascending:!0}).limit(1).maybeSingle().then(({data:g})=>h(g??null))},[]);const l=d.useMemo(()=>Te((t==null?void 0:t.xp)??0),[t==null?void 0:t.xp]),y=Object.values(n).filter(g=>g.completed).length;if(!t)return null;const w=l.next?`${l.xpForNext} XP to ${l.next.name}`:"Healthserve Gold unlocked";return e.jsxs("div",{className:"space-y-8",children:[e.jsx(F,{className:"p-6 sm:p-8",children:e.jsxs("div",{className:"grid lg:grid-cols-[1fr_auto] gap-8 items-center",children:[e.jsxs("div",{children:[e.jsxs(L,{tone:"blue",children:["Member ID · ",t.member_id]}),e.jsxs("h1",{className:"font-heading text-3xl sm:text-4xl font-extrabold text-[#1a1a1a] mt-3",children:["Hello, ",t.full_name.split(" ")[0]," ð"]}),e.jsxs("p",{className:"text-gray-600 mt-2 text-sm sm:text-base",children:["You're a ",e.jsxs("strong",{className:"text-[#0b7fa3]",children:["Level ",l.current.level," ",l.current.name]})," with"," ",e.jsxs("strong",{className:"font-mono",children:[t.xp.toLocaleString()," XP"]}),". ",w,"."]}),e.jsxs("div",{className:"mt-5 max-w-md",children:[e.jsxs("div",{className:"flex justify-between text-[12px] font-semibold text-gray-500 mb-1.5",children:[e.jsxs("span",{children:["Level ",l.current.level]}),e.jsx("span",{children:l.next?`Level ${l.next.level}`:"Max"})]}),e.jsx(Ge,{pct:l.pct})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-5",children:[e.jsxs(L,{tone:"orange",children:[e.jsx(Ut,{className:"w-3.5 h-3.5"})," ",t.streak_count,"-day streak"]}),e.jsxs(L,{tone:"green",children:[e.jsx(me,{className:"w-3.5 h-3.5"})," ",y," tools completed"]}),e.jsxs(L,{tone:"gray",children:["ð
",s.length,"/",ke.length," badges"]}),t.gold_unlocked&&e.jsx(L,{tone:"orange",children:"ð Gold unlocked"})]})]}),e.jsx("div",{className:"justify-self-center",children:e.jsx(Se,{value:l.pct,label:`${l.pct}%`,sub:`Lvl ${l.current.level}`})})]})}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-5",children:[e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[#a3660b] font-bold text-xs uppercase tracking-wide",children:[e.jsx(ue,{className:"w-4 h-4"})," Daily mission"]}),a?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-3 font-semibold text-[#1a1a1a] leading-snug",children:a.title}),e.jsxs("p",{className:"text-sm text-gray-500 mt-1",children:["Reward: +",a.xp_reward," XP"]}),a.completed?e.jsxs(L,{tone:"green",children:[e.jsx(me,{className:"w-3.5 h-3.5"})," Completed today"]}):e.jsx("p",{className:"mt-4 text-xs text-gray-500 leading-relaxed",children:"Complete this task in the Career Hub to earn the XP â it unlocks automatically once you've actually done it."})]}):e.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"Your mission for today is being preparedâ¦"})]}),e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[#0b7fa3] font-bold text-xs uppercase tracking-wide",children:[e.jsx(Ss,{className:"w-4 h-4"})," Next reward"]}),e.jsx("p",{className:"mt-3 font-semibold text-[#1a1a1a]",children:l.next?l.next.name:"Healthserve Gold Membership"}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:l.next?`${l.xpForNext} XP to go`:"Download your Gold Card from the Gold tab."}),e.jsxs("div",{className:"mt-4",children:[e.jsx(Ge,{pct:Math.min(100,Math.round(t.xp/xe*100))}),e.jsxs("p",{className:"text-[11px] text-gray-500 mt-1.5 font-mono",children:[t.xp.toLocaleString()," / ",xe.toLocaleString()," XP towards Gold"]})]})]}),e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[#0b7fa3] font-bold text-xs uppercase tracking-wide",children:[e.jsx(vs,{className:"w-4 h-4"})," Upcoming webinar"]}),i?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-3 font-semibold text-[#1a1a1a] leading-snug",children:i.title}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:i.starts_at?new Date(i.starts_at).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):i.badge}),e.jsxs(H,{variant:"outline",className:"mt-4 w-full",onClick:async()=>{await o("webinar_registration",{suffix:i.id}),window.open("/webinars","_blank")},children:["Register (+",Ce.webinar_registration.xp," XP)"]})]}):e.jsx("p",{className:"mt-3 text-sm text-gray-500",children:"No webinars scheduled right now."})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-[1.2fr_1fr] gap-5",children:[e.jsxs(F,{className:"p-6",children:[e.jsx(ge,{title:"ð® Game Zone â the only place you earn XP",subtitle:"Pick a game, play a minute, collect XP"}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:ce.filter(g=>g.game).map(g=>e.jsxs(J,{to:`/career-hub/tools/${g.key}`,className:"flex items-center gap-3 rounded-2xl border border-gray-100 bg-white p-3 hover:shadow-lg hover:-translate-y-0.5 transition-all",children:[g.image&&e.jsx("img",{src:g.image,alt:g.name,loading:"lazy",width:768,height:512,className:"w-14 h-14 roun
52ded-xl object-cover shrink-0"}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block font-bold text-sm text-[#1a1a1a] truncate",children:g.name}),e.jsx("span",{className:"block text-[12px] text-gray-500 truncate",children:g.tagline})]})]},g.key))}),e.jsxs(J,{to:"/career-hub/tools",className:"mt-4 inline-flex items-center gap-2 text-sm font-bold text-[#0b7fa3]",children:["Open the Game Zone ",e.jsx(mt,{className:"w-4 h-4"})]}),e.jsxs("div",{className:"mt-5",children:[e.jsx(ge,{title:"Achievement badges"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:ke.map(g=>{const c=s.includes(g.key);return e.jsxs("div",{title:g.description,className:`flex items-center gap-2 rounded-xl border px-3 py-2 text-xs font-semibold ${c?"border-[#F9A01B]/30 bg-[#F9A01B]/10 text-[#a3660b]":"border-gray-200 bg-gray-50 text-gray-400"}`,children:[e.jsx("span",{className:c?"":"grayscale opacity-50",children:g.emoji}),g.name]},g.key)})})]})]}),e.jsxs(F,{className:"p-6",children:[e.jsx(ge,{title:"Recent activity",subtitle:"Your latest XP earnings"}),e.jsxs("ul",{className:"space-y-3",children:[r.length===0&&e.jsx("li",{className:"text-sm text-gray-500",children:"No activity yet â try a career tool."}),r.map(g=>{var c;return e.jsxs("li",{className:"flex items-center justify-between gap-3 border-b border-gray-100 pb-2.5 last:border-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-[#1a1a1a] truncate",children:((c=Ce[g.event_key])==null?void 0:c.label)??g.event_key}),e.jsx("p",{className:"text-[11px] text-gray-400",children:new Date(g.created_at).toLocaleString()})]}),e.jsxs("span",{className:"font-mono text-sm font-bold text-[#0b7fa3] shrink-0",children:["+",g.xp]})]},g.id)})]})]})]})]})},Yt="hs_career_gamezone_tour_v1",ra=()=>{try{return localStorage.getItem(Yt)==="done"}catch{return!0}},na=()=>{try{localStorage.setItem(Yt,"done")}catch{}},Ie=10,oa=({steps:t,open:s,onClose:n})=>{const[a,r]=d.useState(0),[o,i]=d.useState(null),h=t[a],l=d.useCallback(()=>{if(!h)return;const f=document.querySelector(`[data-tour="${h.target}"]`);if(!f){i(null);return}const b=f.getBoundingClientRect();i({top:b.top-Ie,left:b.left-Ie,width:b.width+Ie*2,height:b.height+Ie*2})},[h]);d.useLayoutEffect(()=>{if(!s||!h)return;const f=document.querySelector(`[data-tour="${h.target}"]`);f==null||f.scrollIntoView({behavior:"smooth",block:"center"});const b=window.setTimeout(l,380);return()=>window.clearTimeout(b)},[s,h,l]),d.useEffect(()=>{if(s)return window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[s,l]),d.useEffect(()=>{s&&r(0)},[s]);const y=()=>{na(),n()};if(!s||!h)return null;const w=a===t.length-1,g=window.innerHeight,c=o?o.top+o.height+14:g/2,p=o?c+210>g:!1,x=o?p?Math.max(16,o.top-200):c:g/2-100,u=o?Math.min(Math.max(16,o.left),Math.max(16,window.innerWidth-360)):Math.max(16,window.innerWidth/2-170);return rs.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[100]",role:"dialog","aria-label":"Game Zone tour",children:[e.jsx("div",{className:"absolute inset-0 bg-[#0f172a]/60 transition-all duration-300",onClick:y,style:o?{clipPath:`polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 ${o.top}px, ${o.left}px ${o.top}px, ${o.left}px ${o.top+o.height}px, ${o.left+o.width}px ${o.top+o.height}px, ${o.left+o.width}px ${o.top}px, 0 ${o.top}px)`}:void 0}),o&&e.jsx("div",{className:"pointer-events-none absolute rounded-2xl ring-2 ring-[#F9A01B] shadow-[0_0_0_6px_rgba(249,160,27,0.18)] transition-all duration-300",style:{to
52p:o.top,left:o.left,width:o.width,height:o.height}}),e.jsxs("div",{className:"absolute w-[min(340px,calc(100vw-32px))] rounded-2xl border border-white/70 bg-white p-5 shadow-[0_20px_60px_rgba(15,23,42,0.28)] transition-all duration-300 animate-scale-in",style:{top:x,left:u},children:[e.jsx("button",{onClick:y,"aria-label":"Skip tour",className:"absolute right-3 top-3 rounded-lg p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-700",children:e.jsx(ve,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-extrabold uppercase tracking-wider text-[#a3660b]",children:[e.jsx(ue,{className:"h-3.5 w-3.5"})," Step ",a+1," of ",t.length]}),e.jsx("h3",{className:"font-heading mt-2 text-base font-extrabold text-[#1a1a1a]",children:h.title}),e.jsx("p",{className:"mt-1 text-sm leading-snug text-gray-600",children:h.body}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3",children:[e.jsx("div",{className:"flex gap-1.5",children:t.map((f,b)=>e.jsx("span",{className:`h-1.5 rounded-full transition-all ${b===a?"w-5 bg-[#F9A01B]":"w-1.5 bg-gray-200"}`},f.target+b))}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:y,className:"text-xs font-semibold text-gray-500 hover:text-gray-800",children:"Skip"}),e.jsxs("button",{onClick:()=>w?y():r(f=>f+1),className:"inline-flex items-center gap-1.5 rounded-xl bg-[#0b7fa3] px-3.5 py-2 text-sm font-bold text-white hover:bg-[#0a6f8f]",children:[w?"Start playing":"Next"," ",e.jsx(mt,{className:"h-3.5 w-3.5"})]})]})]})]})]}),document.body)},ia=[{key:"All",label:"All tools"},{key:"Plan",label:"Plan my move"},{key:"Assess",label:"Check myself"},{key:"Money",label:"Money"}],la=()=>{const{progress:t,mission:s}=V(),[n,a]=d.useState("All"),[r,o]=d.useState(""),[i,h]=d.useState(!1),l=d.useMemo(()=>ce.filter(x=>x.game),[]),y=d.useMemo(()=>{const x=r.trim().toLowerCase();return ce.filter(u=>!u.game).filter(u=>n==="All"?!0:u.category===n).filter(u=>x?`${u.name} ${u.tagline}`.toLowerCase().includes(x):!0)},[n,r]),w=l.filter(x=>{var u;return(u=t[x.key])==null?void 0:u.completed}).length,g=d.useMemo(()=>{var u;const x=lt.find(f=>f.key===(s==null?void 0:s.mission_key));return x!=null&&x.toolKey&&l.some(f=>f.key===x.toolKey)?x.toolKey:(u=l[0])==null?void 0:u.key},[s==null?void 0:s.mission_key,l]),c=d.useMemo(()=>[...l].sort((x,u)=>x.key===g?-1:u.key===g?1:0),[l,g]),p=d.useMemo(()=>[{target:"gamezone-hero",title:"This is the Game Zone",body:"Everything that earns XP lives here. The toolkit below is free to use, but XP only comes from these games."},{target:"start-here",title:"Start here today",body:"This is your pick of the day. Play it first â it also completes your daily mission and keeps your streak alive."},{target:"game-grid",title:"Then play the rest",body:"Each game can be played once a day for XP. The badge on every card shows what it pays."},{target:"toolkit",title:"Need answers, not points?",body:"Calculators, checkers and trackers are down here. Search or filter them â no XP, just results."}],[]);return d.useEffect(()=>{if(!ra()){const x=window.setTimeout(()=>h(!0),700);return()=>window.clearTimeout(x)}},[]),e.jsxs("div",{className:"space-y-12",children:[e.jsxs("section",{children:[e.jsx(F,{"data-tour":"gamezone-hero",className:"relative overflow-hidden p-6 sm:p-8 mb-6 bg-gradient-to-r from-[#2CC5F4]/12 via-white to-[#F9A01B]/12",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full bg-[#F9A01B] px-3 py-1 text-[11px] font-extrabold uppercase tracking-wider text-white",children:[e.jsx(ns,{className:"w-3.5 h-3.5"})," Game Zone"]}),e.jsx("h1",{className:"font-heading text-2xl sm:text-3xl font-extrabold text-[#1a1a1a] mt-3",children:"Play games. Earn XP. Reach Gold."}),e.jsxs("p",{className:"text-gray-600 text-sm mt-2 max-w-xl",children:["XP only comes from these ",l.length," games â everything else in the hub is free to use and simply saves your progress."]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(L,{tone:"orange",children:[e.jsx(ue,{className:"w-3.5 h-3.5"})," ",w,"/",l.length," games tried"]}),e.jsxs("button",{onClick:()=>h(!0),className:"inline-flex items-center gap-1.5 rounded-full border border-[#2CC5F4]/40 bg-white px-3 py-1.5 text-xs font-bold text-[#0b7fa3] hover:bg-[#2CC5F4]/10",children:[e.jsx(js,{className:"w-3.5 h-3.5"})," Show me where to start"]})]})]})}),e.jsx("div",{"data-tour":"game-grid",className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5",children:c.map(x=>{var N;const u=x.xpKey?Ce[x.xpKey].xp:0,f=(N=t[x.key])==null?void 0:N.completed,b=x.key===g;return e.jsx(J,{to:`/career-hub/tools/${x.key}`,className:"group","data-tour":b?"start-here":void 0,children:e.jsxs(F,{className:"h-full overflow-hidden hover:-translate-y-1 hover:shadow-[0_18px_50px_rgba(15,23,42,0.14)]",children:[e.jsxs("div",{className:"relative aspect-[16/9] overflow-hidden bg-gradient-to-br from-[#F2FBFF] to-white",children:[x.image&&e.jsx("img",{src:x.image,alt:`${x.name} game`,loading:"lazy",width:768,height:512,className:"w-full h-full object-cover transition-transform duration-500 group-hover:scale-105"}),b&&e.jsx("span",{className:"absolute bottom-3 left-3 rounded-full bg-[#0b7fa3] px-2.5 py-1 text-[11px] font-extrabold uppercase tracking-wide text-white shadow",children:"Start here today"}),e.jsxs("span",{className:"absolute top-3 left-3 rounded-full bg-white/90 backdrop-blur px-2.5 py-1 text-[11px] font-extrabold text-[#a3660b] shadow",children:["+",x.key==="spin-wheel"?"1â3":u," XP daily"]}),f&&e.jsx("span",{className:"absolute top-3 right-3 rounded-full bg-emerald-500 text-white p-1 shadow",children:e.jsx(me,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-5",children:[e.jsxs("h3",{className:"font-heading font-bold text-[#1a1a1a] group-hover:text-[#0b7fa3] transition-colors",children:[x.emoji," ",x.name]}),e.jsx("p",{className:"text-sm text-gray-500 mt-1 leading-snug",children:x.tagline}),x.howTo&&e.jsx("p",{className:"text-[12px] text-gray-400 mt-2",children:x.howTo}),e.jsx("span",{className:"mt-4 inline-flex items-center gap-2 text-sm font-bold text-[#0b7fa3]",children:"Play now â"})]})]})},x.key)})})]}),e.jsxs("section",{"data-tour":"toolkit",children:[e.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4 mb-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-heading text-xl sm:text-2xl font-extrabold text-[#1a1a1a]",children:"Career toolkit"}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:"Free c
52alculators, checkers and trackers. No XP â just answers."})]}),e.jsxs("div",{className:"relative",children:[e.jsx(os,{className:"w-4 h-4 text-gray-400 absolute left-3 top-1/2 -translate-y-1/2"}),e.jsx("input",{value:r,onChange:x=>o(x.target.value),placeholder:"Search toolsâ¦",className:"w-full sm:w-64 rounded-xl border border-gray-200 bg-white pl-9 pr-4 py-2.5 text-sm text-gray-900 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15"})]})]}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:ia.map(x=>e.jsx("button",{onClick:()=>a(x.key),className:`rounded-full px-4 py-2 text-sm font-bold transition ${n===x.key?"bg-[#0b7fa3] text-white shadow":"bg-white border border-gray-200 text-gray-600 hover:border-[#2CC5F4]"}`,children:x.label},x.key))}),e.jsxs("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5",children:[y.map(x=>{var f,b;const u=(f=t[x.key])==null?void 0:f.completed;return e.jsx(J,{to:`/career-hub/tools/${x.key}`,children:e.jsxs(F,{className:"group h-full p-6 hover:-translate-y-1 hover:shadow-[0_16px_44px_rgba(15,23,42,0.12)]",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("span",{className:"grid place-items-center w-12 h-12 rounded-2xl bg-gradient-to-br from-[#2CC5F4]/15 to-[#F9A01B]/15 text-2xl",children:x.emoji}),u&&e.jsx(me,{className:"w-5 h-5 text-emerald-500"})]}),e.jsx("h3",{className:"mt-4 font-heading font-bold text-[#1a1a1a] group-hover:text-[#0b7fa3] transition-colors",children:x.name}),e.jsx("p",{className:"text-sm text-gray-500 mt-1 leading-snug",children:x.tagline}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsx(L,{tone:"gray",children:x.category==="Money"?"Money":x.category==="Plan"?"Plan my move":"Check myself"}),(b=t[x.key])!=null&&b.runs?e.jsxs(L,{tone:"blue",children:[t[x.key].runs," run(s)"]}):null]})]})},x.key)}),y.length===0&&e.jsxs("p",{className:"text-sm text-gray-500",children:["No tools match â",r,"â."]})]})]}),e.jsx(oa,{steps:p,open:i,onClose:()=>h(!1)})]})},ca=(t,s=1100,n=[])=>{const[a,r]=d.useState(0);return d.useEffect(()=>{if(!Number.isFinite(t))return;let o=0;const i=performance.now(),h=l=>{const y=Math.min(1,(l-i)/s),w=1-Math.pow(1-y,3);r(t*w),y<1&&(o=requestAnimationFrame(h))};return o=requestAnimationFrame(h),()=>cancelAnimationFrame(o)},[t,s,...n]),a},ht=({value:t,prefix:s="",suffix:n="",duration:a=1100,className:r})=>{const o=typeof t=="number"&&Number.isFinite(t)?t:0,i=ca(o,a);return typeof t!="number"||!Number.isFinite(t)?e.jsx("span",{className:r,children:"â"}):e.jsxs("span",{className:r,children:[s,Math.round(i).toLocaleString(),n]})},Ve=({children:t,delay:s=0,className:n,animation:a="animate-slide-up-spring"})=>e.jsx("div",{className:fe("opacity-0",a,n),style:{animationDelay:`${s}ms`},children:t}),kt=["#F9A01B","#2CC5F4","#34d399","#f472b6","#facc15","#818cf8"],$e=({fire:t,pieces:s=60})=>{const n=d.useMemo(()=>Array.from({length:s},(a,r)=>({id:`${t}-${r}`,left:Math.random()*100,cx:`${(Math.random()-.5)*240}px`,cy:`${140+Math.random()*260}px`,cr:`${(Math.random()-.5)*1080}deg`,delay:Math.random()*260,color:kt[r%kt.length],size:6+Math.random()*8,round:Math.random()>.6})),[t,s]);return t?e.jsx("div",{className:"pointer-events-none fixed inset-0 z-[60] overflow-hidden","aria-hidden":!0,children:n.map(a=>e.jsx("span",{className:"absolute top-[18%] animate-confetti-fall",style:{left:`${a.left}%`,width:a.size,height:a.size*(a.round?1:1.6),background:a.color,borderRadius:a.round?"999px":"2px",animationDelay:`${a.delay}ms`,"--cx":a.cx,"--cy":a.cy,"--cr":a.cr}},a.id))}):null},Me=()=>{const[t,s]=d.useState(0),n=d.useRef(),a=()=>{s(r=>r+1),window.clearTimeout(n.current),n.current=window.setTimeout(()=>s(0),2200)};return d.useEffect(()=>()=>window.clearTimeout(n.current),[]),{fire:t,burst:a}},Vt=({text:t,tone:s="orange"})=>{const n={orange:"text-[#F9A01B]",blue:"text-[#0b7fa3]",green:"text-emerald-500"};return e.jsx("span",{className:fe("pointer-events-none absolute left-1/2 -translate-x-1/2 -top-2 font-heading text-lg font-extrabold animate-xp-float drop-shadow",n[s]),children:t})},da=({low:t,mid:s,high:n,format:a})=>{const o=[t,s,n].every(i=>typeof i=="number"&&Number.isFinite(i))&&n>t?Math.min(94,Math.max(6,(s-t)/(n-t)*100)):50;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"relative h-4 rounded-full bg-gray-100 overflow-hidden",children:e.jsx("div",{className:"h-full origin-left animate-bar-grow rounded-full bg-gradient-to-r from-[#2CC5F4] via-[#7dd3fc] to-[#F9A01B] bg-[length:200%_100%] animate-gradient-shift"})}),e.jsxs("div",{className:"relative h-6",children:[e.jsx("span",{className:"absolute -top-6 -translate-x-1/2 w-3 h-3 rounded-full bg-white border-[3px] border-[#1a1a1a] shadow transition-[left] duration-1000",style:{left:`${o}%`}}),e.jsxs("span",{className:"absolute top-1 -translate-x-1/2 whitespace-nowrap font-mono text-[11px] font-bold text-[#1a1a1a] transition-[left] duration-1000",style:{left:`${o}%`},children:["typical ",a(s)]})]}),e.jsxs("div",{className:"flex justify-between font-mono text-[11px] text-gray-500 mt-4",children:[e.jsx("span",{children:a(t)}),e.jsx("span",{children:a(n)})]})]})},Re=({className:t})=>e.jsx("div",{className:fe("rounded-xl bg-gradient-to-r from-gray-100 via-white to-gray-100 bg-[length:1000px_100%] animate-shimmer",t)}),ma=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsx(Re,{className:"h-7 w-2/3"}),e.jsx(Re,{className:"h-4 w-full"}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-3",children:Array.from({length:8}).map((t,s)=>e.jsx(Re,{className:"h-16"},s))}),e.jsx(Re,{className:"h-4 w-1/2"})]}),pt=({combo:t})=>{if(t<2)return null;const s=t>=8?"ð¥ð¥ð¥":t>=5?"ð¥ð¥":"ð¥";return e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-gradient-to-r from-[#F9A01B] to-[#f7b448] px-3 py-1 text-[12px] font-extrabold text-white shadow-lg shadow-[#F9A01B]/30 animate-pop-in",children:[s," ",t,"x combo"]},t)},xt=({emoji:t,title:s,subtitle:n,right:a})=>e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"grid place-items-center w-14 h-14 shrink-0 rounded-2xl bg-gradient-to-br from-[#2CC5F4]/20 to-[#F9A01B]/20 text-3xl animate-tilt-float",children:t}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h2",{className:"font-heading text-xl font-extrabold text-[#1a1a1a]",children:s}),n&&e.jsx("p",{className:"text-sm text-gray-600 mt-0.5",children:n})]}),a]}),Ne=[{category:"Vitals & Assessment",q:"The normal adult resting heart rate is:",a:"60â100 bpm",options:["40â60 bpm","60â100 bpm","100â120 bpm","120â140 bpm"],explain:"Below 60 is bradycardia, above 100 is tachycardia in a resting adult."},{category:"Vitals & Assessment",q:"Normal adult respiratory rate is:",a:"12â20 breaths/min",options:["6â10 breaths/min","12â20 breaths/min","22â30 breaths/min","30â40 breaths/min"]},{category:"Vitals & Assessment",q:"Normal adult oral temperature range is:",a:"36.5â37.5 °C",options:["35.0â36.0 °C","36.5â37.5 °C","38.0â39.0 °C","39.0â40.0 °C"]},{category:"Vitals & Assessment",q:"Target SpOâ for a healthy adult is:",a:"94â99%",options:["85â89%","90â93%","94â99%","100% only"]},{category:"Vitals & Assessment",q:"A blood pressure of 140/90 mmHg is classified as:",a:"Stage 2 hypertension (most guidelines)",options:["Normal","Elevated only","Stage 2 hypertension (most guidelines)","Hypotension"]},{category:"Vitals & Assessment",q:"The maximum Glasgow Coma Scale score is:",a:"15",options:["10","12","15","20"]},{category:"Vitals & Assessment",q:"Orthostatic hypotension is confirmed by a systolic drop of at least:",a:"20 mmHg on standing",options:["5 mmHg on standing","10 mmHg on standing","20 mmHg on standing","40 mmHg on standing"]},{category:"Vitals & Assessment",q:"Which pulse site is used to assess circulation in an unresponsive adult?",a:"Carotid",options:["Radial","Carotid","Brachial","Dorsalis pedis"]},{category:"Vitals & Assessment",q:"Which pulse site is used for an infant during CPR checks?",a:"Brachial",options:["Carotid","Brachial","Femoral","Popliteal"]},{category:"Vitals & Assessment",q:"A pain score of 8/10 on the numeric rating scale indicates:",a:"Severe pain",options:["No pain","Mild pain","Moderate pain","Severe pain"]}
52,{category:"Vitals & Assessment",q:"Pulse pressure is calculated as:",a:"Systolic minus diastolic",options:["Systolic plus diastolic","Systolic minus diastolic","Diastolic divided by systolic","Mean of both readings"]},{category:"Vitals & Assessment",q:"Capillary refill in a healthy adult should be under:",a:"2 seconds",options:["2 seconds","5 seconds","8 seconds","10 seconds"]},{category:"Emergency & Life Support",q:"The first action on finding an unresponsive adult is:",a:"Check the scene for danger and assess responsiveness",options:["Start chest compressions","Check the scene for danger and assess responsiveness","Give two rescue breaths","Call the family"]},{category:"Emergency & Life Support",q:"Adult chest compression depth should be:",a:"5â6 cm",options:["2â3 cm","5â6 cm","7â8 cm","About 1 cm"]},{category:"Emergency & Life Support",q:"Adult compression rate during CPR is:",a:"100â120 per minute",options:["60â80 per minute","80â100 per minute","100â120 per minute","140â160 per minute"]},{category:"Emergency & Life Support",q:"Single-rescuer adult CPR compression-to-ventilation ratio is:",a:"30:2",options:["15:2","30:2","5:1","10:1"]},{category:"Emergency & Life Support",q:"Two-rescuer infant CPR ratio is:",a:"15:2",options:["30:2","15:2","5:1","3:1"]},{category:"Emergency & Life Support",q:"First-line drug in adult cardiac arrest is:",a:"Adrenaline (epinephrine)",options:["Atropine","Adrenaline (epinephrine)","Amiodarone","Adenosine"]},{category:"Emergency & Life Support",q:"Which rhythm is shockable?",a:"Ventricular fibrillation",options:["Asystole","Pulseless electrical activity","Ventricular fibrillation","Sinus bradycardia"]},{category:"Emergency & Life Support",q:"Priority action for a suspected stroke patient is:",a:"Rapid neurological assessment and urgent imaging",options:["Give aspirin immediately","Rapid neurological assessment and urgent imaging","Encourage oral fluids","Ambulate the patient"]},{category:"Emergency & Life Support",q:"The recovery position is used for a patient who is:",a:"Unresponsive but breathing normally",options:["In cardiac arrest","Unresponsive but breathing normally","Having a seizure with clenched jaw","Fully alert with chest pain"]},{category:"Emergency & Life Support",q:"Recommended AED action once pads are attached is:",a:"Ensure nobody touches the patient during analysis",options:["Continue compressions during analysis","Ensure nobody touches the patient during analysis","Remove pads before the shock","Wait five minutes before shocking"]},{category:"Emergency & Life Support",q:"Choking adult who cannot speak or cough: first action is:",a:"Back blows followed by abdominal thrusts",options:["Blind finger sweep","Back blows followed by abdominal thrusts","Lay the patient flat","Offer water to drink"]},{category:"Emergency & Life Support",q:"In anaphylaxis, first-line treatment is:",a:"IM adrenaline into the anterolateral thigh",options:["IV hydrocortisone","IM adrenaline into the anterolateral thigh","Oral antihistamine","Nebulised saline"]},{category:"Emergency & Life Support",q:"First step in managing a major external haemorrhage is:",a:"Direct pressure over the wound",options:["Tourniquet immediately","Direct pressure over the wound","Elevate and wait","Clean the wound first"]},{category:"Medication & Pharmacology",q:"A patient on warfarin needs monitoring of:",a:"INR",options:["INR","HbA1c","Serum amylase","Serum calcium"]},{category:"Medication & Pharmacology",q:"Which is NOT one of the rights of medication administration?",a:"Right price",options:["Right patient","Right dose","Right price","Right route"]},{category:"Medication & Pharmacology",q:"Angle used for an intramuscular deltoid injection is:",a:"90 degrees",options:["15 degrees","45 degrees","90 degrees","10 degrees"]},{category:"Medication & Pharmacology",q:"Angle used for a subcutaneous injection is usually:",a:"45â90 degrees depending on tissue",options:["10â15 degrees","45â90 degrees depending on tissue","Always 15 degrees","Always 5 degrees"]},{category:"Medication & Pharmacology",q:"Antidote for opioid overdose is:",a:"Naloxone",options:["Flumazenil","Naloxone","Protamine sulphate","Vitamin K"]},{category:"Medication & Pharmacology",q:"Antidote for warfarin over-anticoagulation is:",a:"Vitamin K",options:["Protamine sulphate","Vitamin K","Naloxone","Atropine"]},{category:"Medication & Pharmacology",q:"Antidote for heparin overdose is:",a:"Protamine sulphate",options:["Vitamin K","Protamine sulphate","Flumazenil","N-acetylcysteine"]},{category:"Medication & Pharmacology",q:"Before giving digoxin, the nurse must check:",a:"Apical pulse for one full minute",options:["Respiratory rate","Apical pulse for one full minute","Blood glucose","Urine output"]},{category:"Medication & Pharmacology",q:"A common side effect of ACE inhibitors is:",a:"Dry persistent cough",options:["Dry persistent cough","Hair loss","Blurred vision","Hearing loss"]},{category:"Medication & Pharmacology",q:"Furosemide is classified as a:",a:"Loop diuretic",options:["Thiazide diuretic","Loop diuretic","Potassium-sparing diuretic","Beta blocker"]},{category:"Medication & Pharmacology",q:"Patients on furosemide need monitoring for:",a:"Hypokalaemia",options:["Hyperkalaemia","Hypokalaemia","Hypercalcaemia","Polycythaemia"]},{category:"Medication & Pharmacology",q:"Which insulin has the fastest onset?",a:"Rapid-acting analogue (e.g. lispro)",options:["NPH","Rapid-acting analogue (e.g. lispro)","Glargine","Detemir"]},{category:"Medication & Pharmacology",q:"High-alert medications require:",a:"Independent double-check before administration",options:["Verbal order only","Independent double-check before administration","No documentation","Administration by any staff member"]},{category:"Medication & Pharmacology",q:"Best practice for a verbal medication order in an emergency is:",a:"Repeat back and read back, then document immediately",options:["Give it and document later in the week","Repeat back and read back, then document immediately","Ask a colleague to remember it","Refuse all verbal orders in emergencie
52s"]},{category:"Infection Control",q:"The single most effective way to prevent healthcare-associated infection is:",a:"Hand hygiene",options:["Prophylactic antibiotics","Hand hygiene","Isolation rooms","Daily patient bathing"]},{category:"Infection Control",q:"Which PPE item is removed FIRST when doffing?",a:"Gloves",options:["Gloves","Mask","Gown","Goggles"]},{category:"Infection Control",q:"How many WHO moments of hand hygiene are there?",a:"5",options:["3","4","5","7"]},{category:"Infection Control",q:"Tuberculosis requires which type of precaution?",a:"Airborne",options:["Contact","Droplet","Airborne","Standard only"]},{category:"Infection Control",q:"Influenza requires which type of precaution?",a:"Droplet",options:["Contact","Droplet","Airborne","Protective isolation"]},{category:"Infection Control",q:"MRSA colonisation requires which type of precaution?",a:"Contact",options:["Contact","Droplet","Airborne","None"]},{category:"Infection Control",q:"Minimum duration for an alcohol-based hand rub is about:",a:"20â30 seconds",options:["3 seconds","20â30 seconds","2 minutes","5 minutes"]},{category:"Infection Control",q:"Used sharps must be disposed of in:",a:"A puncture-resistant sharps container at point of use",options:["A clinical waste bag","A puncture-resistant sharps container at point of use","A general waste bin","The linen skip"]},{category:"Infection Control",q:"Needles should never be:",a:"Recapped using two hands",options:["Used once","Recapped using two hands","Disposed of immediately","Handled with gloves"]},{category:"Infection Control",q:"First action after a needlestick injury is:",a:"Wash the site with soap and running water, then report",options:["Squeeze and suck the wound","Wash the site with soap and running water, then report","Apply neat bleach","Ignore it if the patient looks healthy"]},{category:"Infection Control",q:"Sterilisation differs from disinfection because it:",a:"Destroys all microorganisms including spores",options:["Only removes visible dirt","Destroys all microorganisms including spores","Kills only viruses","Is used only on skin"]},{category:"Patient Safety & Ethics",q:"Patient identification before any procedure should use:",a:"At least two approved identifiers",options:["Room number only","At least two approved identifiers","The patient's face","The diagnosis"]},{category:"Patient Safety & Ethics",q:"The purpose of the surgical safety checklist is to:",a:"Prevent wrong site, wrong procedure and wrong patient surgery",options:["Speed up theatre lists","Prevent wrong site, wrong procedure and wrong patient surgery","Reduce paperwork","Assign the surgeon"]},{category:"Patient Safety & Ethics",q:"An incident report should be completed:",a:"For any event or near-miss, as soon as possible",options:["Only for deaths","For any event or near-miss, as soon as possible","Only if the family complains","At the end of the month"]},{category:"Patient Safety & Ethics",q:"Autonomy in healthcare ethics means:",a:"Respecting the patient's right to decide",options:["Doing good for the patient","Avoiding harm","Respecting the patient's right to decide","Treating all patients equally"]},{category:"Patient Safety & Ethics",q:"Non-maleficence means:",a:"Do no harm",options:["Do good","Do no harm","Tell the truth","Keep promises"]},{category:"Patient Safety & Ethics",q:"Valid informed consent requires:",a:"Capacity, adequate information and voluntariness",options:["A signature only","Capacity, adequate information and voluntariness","Family agreement only","A verbal yes from any relative"]},{category:"Patient Safety & Ethics",q:"Falls risk assessment should be repeated:",a:"On admission, after any change in condition, and after a fall",options:["Only on admission","Only on discharge","On admission, after any change in condition, and after a fall","Once a year"]},{category:"Patient Safety & Ethics",q:"SBAR is used for:",a:"Structured clinical handover and escalation",options:["Wound classification","Structured clinical handover and escalation","Medication dosing","Triage scoring"]},{category:"Patient Safety & Ethics",q:"A pressure injury risk tool commonly used in practice is:",a:"Braden scale",options:["Braden scale","Apgar score","Bristol chart","Wells score"]},{category:"Patient Safety & Ethics",q:"Confidential patient information may be shared:",a:"Only with those directly involved in the patient's care",options:["With any colleague","Only with those directly involved in the patient's care","On social media without names","With family friends"]},{category:"Anatomy & Physiology",q:"The largest organ of the human body is:",a:"Skin",options:["Liver","Skin","Lungs","Brain"]},{category:"Anatomy & Physiology",q:"The number of chambers in the human heart is:",a:"4",options:["2","3","4","5"]},{category:"Anatomy & Physiology",q:"Gas exchange in the lungs occurs in the:",a:"Alveoli",options:["Bronchi","Trachea","Alveol
52i","Pleura"]},{category:"Anatomy & Physiology",q:"The functional unit of the kidney is the:",a:"Nephron",options:["Alveolus","Nephron","Neuron","Hepatocyte"]},{category:"Anatomy & Physiology",q:"Insulin is produced by which cells?",a:"Beta cells of the pancreas",options:["Alpha cells of the pancreas","Beta cells of the pancreas","Thyroid follicular cells","Adrenal cortex cells"]},{category:"Anatomy & Physiology",q:"Hypoxia means:",a:"Insufficient oxygen at tissue level",options:["Excess carbon dioxide in blood","Insufficient oxygen at tissue level","Low blood glucose","Low blood pressure"]},{category:"Anatomy & Physiology",q:"The normal adult total blood volume is approximately:",a:"5 litres",options:["2 litres","3 litres","5 litres","9 litres"]},{category:"Anatomy & Physiology",q:"Which blood type is the universal donor for red cells?",a:"O negative",options:["AB positive","O negative","A positive","B negative"]},{category:"Anatomy & Physiology",q:"The main muscle of respiration is the:",a:"Diaphragm",options:["Diaphragm","Latissimus dorsi","Pectoralis major","Rectus abdominis"]},{category:"Labs & Diagnostics",q:"Normal fasting blood glucose in mg/dL is approximately:",a:"70â100",options:["40â60","70â100","120â150","160â200"]}
52,{category:"Labs & Diagnostics",q:"Normal fasting blood glucose in mmol/L is approximately:",a:"3.9â5.5",options:["2.0â3.0","3.9â5.5","7.0â9.0","10.0â12.0"]},{category:"Labs & Diagnostics",q:"HbA1c reflects average glucose control over the past:",a:"2â3 months",options:["24 hours","1 week","2â3 months","1 year"]},{category:"Labs & Diagnostics",q:"Normal adult serum potassium is approximately:",a:"3.5â5.0 mmol/L",options:["1.5â2.5 mmol/L","3.5â5.0 mmol/L","6.0â7.5 mmol/L","8.0â9.0 mmol/L"]},{category:"Labs & Diagnostics",q:"Normal adult serum sodium is approximately:",a:"135â145 mmol/L",options:["115â125 mmol/L","135â145 mmol/L","150â165 mmol/L","170â180 mmol/L"]},{category:"Labs & Diagnostics",q:"Normal adult haemoglobin for males is approximately:",a:"13.5â17.5 g/dL",options:["8â10 g/dL","11â12 g/dL","13.5â17.5 g/dL","19â22 g/dL"]},{category:"Labs & Diagnostics",q:"Troponin is used mainly to diagnose:",a:"Myocardial infarction",options:["Pulmonary embolism","Myocardial infarction","
52Liver failure","Renal stones"]},{category:"Labs & Diagnostics",q:"Normal adult white cell count is approximately:",a:"4,000â11,000 /µL",options:["1,000â2,000 /µL","4,000â11,000 /µL","15,000â20,000 /µL","25,000â30,000 /µL"]},{category:"Labs & Diagnostics",q:"A blood culture should ideally be taken:",a:"Before starting antibiotics",options:["After the first antibiotic dose","Before starting antibiotics","Only after 48 hours of fever","Only at discharge"]},{category:"Maternal & Paediatric",q:"The Apgar score is assessed at:",a:"1 and 5 minutes after birth",options:["Birth only","1 and 5 minutes after birth","10 and 20 minutes after birth","24 hours after birth"]},{category:"Maternal & Paediatric",q:"Maximum Apgar score is:",a:"10",options:["5","8","10","15"]},{category:"Maternal & Paediatric",q:"Normal newborn heart rate is approximately:",a:"120â160 bpm",options:["60â80 bpm","80â100 bpm","120â160 bpm","180â200 bpm"]},{category:"Maternal & Paediatric",q:"Exclusive breastfeeding is recommended for the first:",a:"6 months",options:["6 weeks","3 months","6 months","2 years"]},{category:"Maternal & Paediatric",q:"Pre-eclampsia is characterised by:",a:"Hypertension with proteinuria after 20 weeks",options:["Hypotension with oedema","Hypertension with proteinuria after 20 weeks","Fever with rash","Low haemoglobin only"]},{category:"Maternal & Paediatric",q:"Paediatric dehydration is best assessed by:",a:"Weight change, skin turgor, mucous membranes and urine output",options:["Temperature alone","Weight change, skin turgor, mucous membranes and urine output","Parent report alone","Height percentile"]},{category:"Gulf Licensing & Careers",q:"DataFlow is best described as:",a:"Primary source verification of your documents",options:["A visa stamping service","Primary source verification of your documents","An airline booking portal","A hospital accreditation body"]},{category:"Gulf Licensing & Careers",q:"Prometric is:",a:"A computer-based testing provider used for licensing exams",options:["A recruitment agency","A computer-based testing provider used for licensing exams","A health insurance company","A nursing union"]},{category:"Gulf Licensing & Careers",q:"DHA licensing applies to healthcare professionals working in:",a:"Dubai",options:["Abu Dhabi","Dubai","Sharjah only","All GCC countries"]},{category:"Gulf Licensing & Careers",q:"DOH (formerly HAAD) licensing applies to:",a:"Abu Dhabi",options:["Dubai","Abu Dhabi","Ras Al Khaimah only","Oman"]},{category:"Gulf Licensing & Careers",q:"SCFHS is the healthcare regulator of:",a:"Saudi Arabia",options:["Qatar","Saudi Arabia","Bahrain","Oman"]},{category:"Gulf Licensing & Careers",q:"QCHP regulates healthcare practitioners in:",a:"Qatar",options:["Kuwait","Qatar","Bahrain","UAE"]},{category:"Gulf Licensing & Careers",q:"NHRA is the regulatory authority of:",a:"Bahrain",options:["Bahrain","Oman","Qatar","Saudi Arabia"]},{category:"Gulf Licensing & Careers",q:"OMSB is associated with:",a:"Oman",options:["Oman","Kuwait","Dubai","Qatar"]},{category:"Gulf Licensing & Careers",q:"For nursing recognition in Germany, the usual language requirement is at least:",a:"B1âB2 German",options:["A1 German","B1âB2 German","IELTS 5.0 only","No language requirement"]},{category:"Gulf Licensing & Careers",q:"The most common reason a licensing file gets delayed is:",a:"Incomplete or unverifiable documents",options:["Applying on a weekday","Incomplete or unverifiable documents","Having too much experience","Using a laptop to apply"]},{category:"Gulf Licensing & Careers",q:"A 'good standing certificate' is issued by:",a:"Your home country nursing or medical council",options:["Your employer's HR team","Your home country nursing or medical council","The airline","Any notary"]},{category:"Gulf Licensing & Careers",q:"Experience letters for Gulf licensing usually must include:",a:"Official letterhead, dates, designation and HR contact details",options:["A handwritten note","Official letterhead, dates, designation and HR contact details","Only your salary","A photograph"]}],ua=Array.from(new Set(Ne.map(t=>t.category))),gt=t=>{const s=[...t];for(let n=s.length-1;n>0;n--){const a=Math.floor(Math.random()*(n+1));[s[n],s[a]]=[s[a],s[n]]}return s},Wt=t=>{const s=gt(t.options);return{...t,shuffledOptions:s,answerIndex:s.indexOf(t.a)}},ha=(t,s)=>{const n=!s||s==="Mixed"?Ne:Ne.filter(r=>r.category===s),a=n.length>=t?n:Ne;return gt(a).slice(0,Math.min(t,a.length)).map(Wt)},pa=t=>{const s=[];for(;s.length<t;)s.push(...gt(Ne).map(Wt));return s.slice(0,t)},Ct=10,Ae=25,xa=({toolKey:t})=>{var yt;const{progress:s,awardXp:n,saveToolProgress:a,grantBadge:r}=V(),o=(yt=s[t])==null?void 0:yt.data,{fire:i,burst:h}
52=Me(),[l,y]=d.useState("setup"),[w,g]=d.useState("Mixed"),[c,p]=d.useState([]),[x,u]=d.useState(0),[f,b]=d.useState(null),[N,v]=d.useState(0),[A,I]=d.useState(0),[j,q]=d.useState(0),[O,W]=d.useState(0),[S,E]=d.useState(null),[_,P]=d.useState(Ae),[B,T]=d.useState([]),D=d.useRef(!1),m=c[x],C=c.length?Math.round(N/c.length*100):0,k=()=>{p(ha(Ct,w)),u(0),b(null),v(0),I(0),q(0),W(0),T([]),P(Ae),y("playing"),D.current=!1},M=d.useCallback(async(U,Y)=>{y("result");const Z=Math.round(U/Ct*100),se=Math.max((o==null?void 0:o.best)??0,Z);await a(t,{best:se,lastScore:Z,lastPoints:Y,plays:((o==null?void 0:o.plays)??0)+1,at:new Date().toISOString()}),Z>=80&&(await r("quiz_master"),h());const z=await n("quiz_completion");R.success(z?`Quiz complete â +${z} XP`:"Quiz complete. Today's quiz XP is already claimed.")},[n,h,r,a,o==null?void 0:o.best,o==null?void 0:o.plays,t]),X=d.useCallback((U,Y)=>{D.current=!1,x+1>=c.length?M(U,Y):(u(Z=>Z+1),b(null),P(Ae))},[c.length,M,x]),G=d.useCallback(U=>{if(!m||f!==null||D.current)return;D.current=!0;const Y=U===m.answerIndex,Z=Math.max(0,_)*2,se=Y?A+1:0,z=Y?100+Z+se*25:0,ft=N+(Y?1:0),bt=O+z;b(U??-1),I(se),q(Qe=>Math.max(Qe,se)),v(ft),W(bt),E({id:Date.now(),text:Y?`+${z}`:"Missed",tone:Y?"green":"orange"}),T(Qe=>[...Qe,{q:m.q,correct:Y,answer:m.a}]),window.setTimeout(()=>X(ft,bt),1150)},[A,m,_,X,f,O,N]);d.useEffect(()=>{if(l!=="playing"||f!==null)return;if(_<=0){G(null);return}const U=window.setTimeout(()=>P(Y=>Y-1),1e3);return()=>window.clearTimeout(U)},[l,_,f,G]);const ee=_/Ae*100,ze=d.useMemo(()=>C>=90?"Outstanding â that's well above Prometric pass standard.":C>=80?"Excellent â you're at Prometric pass standard.":C>=60?"Solid. A few more rounds and you'll be at pass standard.":"Keep practising â replay for a fresh set of questions.",[C]);return l==="setup"?e.jsxs(F,{className:"p-6 sm:p-8 max-w-2xl mx-auto",children:[e.jsx(xt,{emoji:"ð§ ",title:"Prometric Practice Arena",subtitle:`${Ne.length} questions in the bank · 10 random ones each round · options reshuffled every play`}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-5",children:[(o==null?void 0:o.best)!=null&&e.jsxs(L,{tone:"orange",children:["Best score: ",o.best,"%"]}),o!=null&&o.plays?e.jsxs(L,{tone:"gray",children:[o.plays," rounds played"]}):null,e.jsxs(L,{tone:"blue",children:[e.jsx(He,{className:"w-3.5 h-3.5"})," ",Ae,"s per question"]})]}),e.jsx("p",{className:"text-[12px] font-bold uppercase tracking-wide text-gray-600 mt-6",children:"Choose your topic"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["Mixed",...ua].map(U=>e.jsx("button",{onClick:()=>g(U),className:`rounded-full border px-3.5 py-1.5 text-[12px] font-bold transition-all duration-200 hover:-translate-y-0.5 ${w===U?"border-transparent bg-gradient-to-r from-[#2CC5F4] to-[#0b7fa3] text-white shadow-lg shadow-[#2CC5F4]/30":"border-gray-200 bg-white text-gray-600 hover:border-[#2CC5F4]"}`,children:U},U))}),e.jsx("div",{className:"mt-6 rounded-2xl border border-[#F9A01B]/25 bg-gradient-to-br from-[#F9A01B]/10 to-white p-4",children:e.jsxs("p",{className:"text-sm text-gray-700",children:[e.jsx("strong",{children:"Scoring:"})," 100 points per correct answer, plus a speed bonus for every second left and a growing combo bonus for each answer you get right in a row. Break the chain and the combo resets."]})}
52),e.jsxs(H,{className:"mt-6 w-full",onClick:k,children:[e.jsx(nt,{className:"w-4 h-4"})," Start the round"]})]}):l==="playing"&&m?e.jsxs("div",{className:"max-w-2xl mx-auto space-y-4",children:[e.jsxs(F,{className:"p-4 sm:p-5",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(L,{tone:"gray",children:["Question ",x+1," / ",c.length]}),e.jsxs(L,{tone:"blue",children:[e.jsx(He,{className:"w-3.5 h-3.5"})," ",_,"s"]}),e.jsxs(L,{tone:"orange",children:[O.toLocaleString()," pts"]}),e.jsx(pt,{combo:A})]}),e.jsx("div",{className:"mt-3 h-2 rounded-full bg-gray-100 overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-[width] duration-1000 ease-linear ${ee<25?"bg-red-400":"bg-gradient-to-r from-[#2CC5F4] to-[#F9A01B]"}`,style:{width:`${ee}%`}})})]}),e.jsxs(F,{className:"relative p-6 sm:p-8 animate-pop-in",children:[S&&e.jsx(Vt,{text:S.text,tone:S.tone==="green"?"green":"orange"},S.id),e.jsx(L,{tone:"blue",children:m.category}),e.jsx("h3",{className:"font-heading text-lg sm:text-xl font-bold text-[#1a1a1a] mt-3 leading-snug",children:m.q}),e.jsx("div",{className:"grid gap-3 mt-5",children:m.shuffledOptions.map((U,Y)=>{const Z=Y===m.answerIndex,se=f===Y,z=f!==null;return e.jsxs("button",{disabled:z,onClick:()=>G(Y),className:`group flex items-center gap-3 rounded-xl border px-4 py-3.5 text-left text-sm font-semibold transition-all duration-200 ${z&&Z?"border-emerald-400 bg-emerald-50 text-emerald-800 scale-[1.01]":z&&se?"border-red-300 bg-red-50 text-red-700 animate-shake-x":z?"border-gray-200 bg-white text-gray-400":"border-gray-200 bg-white text-gray-800 hover:-translate-y-0.5 hover:border-[#2CC5F4] hover:bg-[#2CC5F4]/5 hover:shadow-md"}`,children:[e.jsx("span",{className:`grid place-items-center w-7 h-7 shrink-0 rounded-lg text-[12px] font-extrabold transition ${z&&Z?"bg-emerald-500 text-white":z&&se?"bg-red-400 text-white":"bg-gray-100 text-gray-500 group-hover:bg-[#2CC5F4] group-hover:text-white"}`,children:z&&Z?e.jsx(jt,{className:"w-4 h-4"}):z&&se?e.jsx(ve,{className:"w-4 h-4"}):String.fromCharCode(65+Y)}),U]},U)})}),f!==null&&m.explain&&e.jsxs("p",{className:"mt-4 rounded-xl bg-[#F7FBFF] border border-gray-100 p-3 text-sm text-gray-700 animate-fade-in",children:["ð¡ ",m.explain]})]},x)]}):e.jsxs("div",{className:"max-w-2xl mx-auto space-y-4",children:[e.jsx($e,{fire:i}),e.jsx(F,{className:"p-6 sm:p-8 animate-pop-in",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-center gap-6",children:[e.jsx(Se,{value:C,label:`${C}%`,sub:"score",size:130}),e.jsxs("div",{className:"flex-1 text-center sm:text-left",children:[e.jsx("h3",{className:"font-heading text-2xl font-extrabold text-[#1a1a1a]",children:e.jsx(ht,{value:O,suffix:" pts"})}),e.jsxs("p",{className:"text-sm text-gray-600 mt-1",children:[N," of ",c.length," correct · best combo ",j,"x"]}),e.jsx("p",{className:"text-sm text-gray-700 mt-2",children:ze}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-4 justify-center sm:justify-start",children:[e.jsxs(H,{onClick:k,children:[e.jsx(nt,{className:"w-4 h-4"})," Play a fresh round"]}),e.jsx(H,{variant:"outline",onClick:()=>y("setup"),children:"Change topic"})]})]})]})}),e.jsxs(F,{className:"p-6",children:[e.jsx("p",{className:"text-[12px] font-bold uppercase tracking-wide text-gray-600",children:"Round review"}),e.jsx("ul",{className:"mt-3 space-y-2",children:B.map((U,Y)=>e.jsx(Ve,{delay:Y*60,animation:"animate-fade-up",children:e.jsxs("li",{className:"flex items-start gap-3 rounded-xl border border-gray-100 bg-white p-3",children:[e.jsx("span",{className:`grid place-items-center w-6 h-6 shrink-0 rounded-lg text-white ${U.correct?"bg-emerald-500":"bg-red-400"}`,children:U.correct?e.jsx(jt,{className:"w-3.5 h-3.5"}):e.jsx(ve,{className:"w-3.5 h-3.5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-semibold text-[#1a1a1a]",children:U.q}),e.jsxs("p",{className:"text-[13px] text-gray-600 mt-0.5",children:["Correct answer: ",U.answer]})]})]})},Y))})]})]})},Pe=[1,1,2,1,3,1,2,1],ga=({toolKey:t})=>{var p;const{progress:s,awardXp:n,saveToolProgress:a}=V(),r=(p=s[t])==null?void 0:p.data,o=(r==null?void 0:r.lastSpin)===le(),[i,h]=d.useState(0),[l,y]=d.use
52State(!1),[w,g]=d.useState(o?(r==null?void 0:r.lastPrize)??null:null),c=async()=>{if(l||o)return;y(!0);const x=Math.floor(Math.random()*Pe.length),u=360/Pe.length,f=360*6+(360-x*u-u/2);h(f),setTimeout(async()=>{const b=Pe[x];g(b),y(!1),await a(t,{lastSpin:le(),lastPrize:b});const N=await n("daily_spin",{amount:b});R.success(N?`You won +${b} XP!`:"You've already spun today.")},3600)};return e.jsx("div",{className:"flex flex-col items-center gap-6",children:e.jsxs(F,{className:"p-8 flex flex-col items-center",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 z-10 w-0 h-0 border-l-8 border-r-8 border-t-[18px] border-l-transparent border-r-transparent border-t-[#F9A01B]"}),e.jsx("div",{className:"w-64 h-64 rounded-full border-8 border-white shadow-2xl",style:{transform:`rotate(${i}deg)`,transition:"transform 3.5s cubic-bezier(.17,.67,.16,1)",background:`conic-gradient(${Pe.map((x,u)=>{const f=100/Pe.length;return`${u%2===0?"#2CC5F4":"#F9A01B"} ${u*f}% ${(u+1)*f}%`}).join(", ")})`}}
52),e.jsx("div",{className:"absolute inset-0 grid place-items-center pointer-events-none",children:e.jsx("div",{className:"w-16 h-16 rounded-full bg-white shadow-lg grid place-items-center font-heading font-extrabold text-[#1a1a1a] text-sm",children:"XP"})})]}),e.jsxs("div",{className:"mt-6 text-center",children:[w!=null&&e.jsxs(L,{tone:"orange",children:["Today's prize: +",w," XP"]}),e.jsx("div",{className:"mt-4",children:e.jsx(H,{onClick:c,disabled:l||o,children:o?"Come back tomorrow":l?"Spinningâ¦":"Spin the wheel"})}),e.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"One spin per day · 1â3 XP"})]})]})})},St=["Update one section of your CV with a measurable achievement.","Message one recruiter or Healthserve counsellor about your target country.","Revise 20 MCQs from your licensing exam syllabus.","Collect one missing document for DataFlow.","Research salary bands for your specialty in your target country.","Watch a 10-minute clinical refresher on your weakest topic.","Write a 3-line professional summary for your CV."],ya=({toolKey:t})=>{var l;const{progress:s,awardXp:n,saveToolProgress:a}=V(),r=new Date().toISOString().slice(0,10),o=(l=s[t])==null?void 0:l.data,i=(o==null?void 0:o.day)===r,h=d.useMemo(()=>{let y=0;for(const w of r)y=y*31+w.charCodeAt(0)>>>0;return St[y%St.length]},[r]);return e.jsxs(F,{className:"p-8 text-center max-w-xl mx-auto",children:[e.jsx("div",{className:"text-4xl",children:"â¡"}),e.jsx("h2",{className:"font-heading text-xl font-bold text-[#1a1a1a] mt-4",children:"Today's challenge"}),e.jsx("p",{className:"text-gray-600 mt-2",children:h}),e.jsx("div",{className:"mt-6",children:i?e.jsxs(L,{tone:"green",children:[e.jsx(me,{className:"w-3.5 h-3.5"})," Completed today"]}):e.jsx(H,{onClick:async()=>{await a(t,{day:r,challenge:h});const y=await n("daily_challenge");R.success(y?`+${y} XP earned`:"Already claimed today.")},children:"I completed this (+5 XP)"})})]})},zt=()=>{const{badges:t}=V();return e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-5",children:ke.map(s=>{const n=t.includes(s.key);return e.jsxs(F,{className:`p-6 text-center ${n?"":"opacity-70"}`,children:[e.jsx("div",{className:`text-4xl ${n?"":"grayscale opacity-50"}`,children:s.emoji}),e.jsx("h3",{className:"font-heading font-bold text-[#1a1a1a] mt-3",children:s.name}),e.jsx("p",{className:"text-sm text-gray-500 mt-1",children:s.description}),e.jsx("div",{className:"mt-3",children:n?e.jsx(L,{tone:"green",children:"Unlocked"}):e.jsx(L,{tone:"gray",children:"Locked"})})]},s.key)})})},fa=()=>{const{member:t,badges:s,progress:n}=V();if(!t)return null;const a=Te(t.xp),r=Object.values(n).filter(o=>o.completed).length;return e.jsxs(F,{className:"max-w-2xl mx-auto overflow-hidden",children:[e.jsxs("div",{className:"bg-gradient-to-r from-[#0b7fa3] to-[#2CC5F4] text-white p-6",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-[0.2em] opacity-80",children:"Healthserve Career Passport"}),e.jsx("h2",{className:"font-heading text-2xl font-extrabold mt-1",children:t.full_name}),e.jsx("p",{className:"font-mono text-sm opacity-90",children:t.member_id})]}),e.jsx("div",{className:"p-6 grid sm:grid-cols-2 gap-x-8 gap-y-4 text-sm",children:[["Username",t.username],["Level",`${a.current.level} · ${a.current.name}`],["Experience",`${t.xp.toLocaleString()} XP`],["Streak",`${t.streak_count} days`],["Country",t.country],["City",t.city],["Member since",new Date(t.registered_at).toLocaleDateString()],["Tools completed",`${r} / ${ce.length}`],["Badges",`${s.length} / ${ke.length}`],["Gold status",t.gold_approved?"Approved":t.gold_unlocked?"Unlocked (pending verification)":"Locked"]].map(([o,i])=>e.jsxs("div",{className:"flex justify-between gap-4 border-b border-gray-100 pb-2",children:[e.jsx("span",{className:"text-gray-500",children:o}),e.jsx("span",{className:"font-semibold text-[#1a1a1a] text-right",children:i})]},o))})]})},ba=()=>{const{member:t,progress:s,recentXp:n}=V();if(!t)return null;const a=Te(t.xp),r=ce.filter(o=>o.compute||o.custom);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(F,{className:"p-6 flex flex-col sm:flex-row items-center gap-8",children:[e.jsx(Se,{value:a.pct,label:`${a.pct}%`,sub:`Lvl ${a.current.level}`}),e.jsxs("div",{className:"flex-1 w-full",children:[e.jsx("h3",{className:"font-heading text-xl font-bold text-[#1a1a1a]",children:a.current.name}),e.jsx("p",{className:"text-sm text-gray-600 mt-1",children:a.next?`${a.xpForNext} XP until ${a.next.name}`:"You've reached the top tier."}),e.jsx("div",{className:"mt-4 space-y-3",children:ps.map(o=>e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:`text-xs font-bold w-32 shrink-0 ${t.xp>=o.min?"text-[#0b7fa3]":"text-gray-400"}`,children:["L",o.level," ",o.name]}),e.jsx("div",{className:"flex-1",children:e.jsx(Ge,{pct:t.xp>=o.max?100:t.xp<=o.min?0:(t.xp-o.min)/(o.max-o.min)*100})})]},o.level))})]})]}),e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading font-bold text-[#1a1a1a] mb-4",children:"Tool completion"}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-2",children:r.map(o=>{var h;const i=(h=s[o.key])==null?void 0:h.completed;return e.jsxs("div",{className:"flex items-center gap-2 text-sm py-1.5",children:[i?e.jsx(me,{className:"w-4 h-4 text-emerald-500"}):e.jsx(ks,{className:"w-4 h-4 text-gray-300"}),e.jsx("span",{className:i?"text-[#1a1a1a] font-medium":"text-gray-500",children:o.name})]},o.key)})})]}),e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading font-bold text-[#1a1a1a] mb-4",children:"XP history"}),e.jsxs("ul",{className:"space-y-2 text-sm",children:[n.map(o=>e.jsxs("li",{className:"flex justify-between border-b border-gray-100 pb-2 last:border-0",children:[e.jsx("span",{className:"text-gray-600",children:o.event_key.replace(/_/g," ")}),e.jsxs("span",{className:"font-mono font-bold text-[#0b7fa3]",children:["+",o.xp]})]},o.id)),n.length===0&&e.jsx("li",{className:"text-gray-500",children:"No XP earned yet."})]})]})]})},ja=({toolKey:t})=>{var w,g;const{progress:s,saveToolProgress:n}=V(),a=((g=(w=s[t])==null?void 0:w.data)==null?void 0:g.items)??[],[r,o]=d.useState(a),[i,h]=d.useState({title:"",type:"Certification",date:new Date().toISOString().slice(0,10)}),l=async c=>{o(c),await n(t,{items:c},c.length>0)},y="w-full rounded-xl border border-gray-200 bg-white px-4 py-2.5 text-sm outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15";return e.jsxs("div",{className:"space-y-5",children:[e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading font-bold text-[#1a1a1a] mb-4",children:"Add a milestone"}),e.jsxs("div",{className:"grid sm:grid-cols-[2fr_1fr_1fr_auto] gap-3 items-end",children:[e.jsx("input",{className:y,placeholder:"e.g. ACLS certification",value:i.title,onChange:c=>h({...i,title:c.target.value})}
52),e.jsx("select",{className:y,value:i.type,onChange:c=>h({...i,type:c.target.value}),children:["Certification","Training","Promotion","Exam","Publication","Skill"].map(c=>e.jsx("option",{children:c},c))}),e.jsx("input",{className:y,type:"date",value:i.date,onChange:c=>h({...i,date:c.target.value})}),e.jsxs(H,{disabled:i.title.trim().length<2,onClick:()=>{l([{id:crypto.randomUUID(),...i,title:i.title.trim()},...r]),h({...i,title:""}),R.success("Milestone saved")},children:[e.jsx(Le,{className:"w-4 h-4"})," Add"]})]})]}),e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading font-bold text-[#1a1a1a] mb-4",children:"Your growth timeline"}),r.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:"Nothing logged yet. Add your certifications and training above."}):e.jsx("ul",{className:"space-y-3",children:r.map(c=>e.jsxs("li",{className:"flex items-center gap-3 border-l-2 border-[#2CC5F4] pl-4 py-1",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-semibold text-[#1a1a1a] text-sm",children:c.title}),e.jsxs("p",{className:"text-xs text-gray-500",children:[c.type," · ",new Date(c.date).toLocaleDateString()]})]}),e.jsx("button",{onClick:()=>l(r.filter(p=>p.id!==c.id)),className:"text-gray-400 hover:text-red-600",children:e.jsx(it,{className:"w-4 h-4"})})]},c.id))})]})]})},At=[["ð«","ð©º","ð","ð§¬","ð©¹","ð§ª","ð¦´","ð«"],["ð","ð","ð©»","ð§«","ð§ ","ðï¸","ð¦·","ð©¸"],["ð¡ï¸","ð§¤","ð·","ð¥","ð","âï¸","ð¬","ð«"]],Pt=()=>{const t=At[Math.floor(Math.random()*At.length)];return[...t,...t].map((s,n)=>({id:n,icon:s,flipped:!1,matched:!1})).sort(()=>Math.random()-.5).map((s,n)=>({...s,id:n}))},wa=({toolKey:t})=>{var S;const{progress:s,awardXp:n,saveToolProgress:a}=V(),r=(S=s[t])==null?void 0:S.data,o=(r==null?void 0:r.lastPlayed)===le(),{fire:i,burst:h}=Me(),[l,y]=d.useState(Pt),[w,g]=d.useState([]),[c,p]=d.useState(0),[x,u]=d.useState(0),[f,b]=d.useState(0),[N,v]=d.useState(!1),A=d.useRef(!1),I=l.filter(E=>E.matched).length/2,j=l.length/2;d.useEffect(()=>{if(N)return;const E=window.setInterval(()=>b(_=>_+1),1e3);return()=>window.clearInterval(E)},[N]);const q=()=>{y(Pt()),g([]),p(0),u(0),b(0),v(!1),A.current=!1},O=d.useCallback(async E=>{v(!0),h();const _=Math.min(E,(r==null?void 0:r.bestMoves)??1/0);await a(t,{lastPlayed:le(),bestMoves:_},!0);const P=await n("memory_match");R.success(P?`Matched them all! +${P} XP`:"Nice! You already earned today's XP.")},[n,h,a,r==null?void 0:r.bestMoves,t]),W=E=>{if(A.current||N)return;const _=l[E];if(_.flipped||_.matched)return;const P=l.map((T,D)=>D===E?{...T,flipped:!0}:T),B=[...w,E];if(y(P),g(B),B.length===2){const T=c+1;p(T);const[D,m]=B;if(P[D].icon===P[m].icon){const C=P.map((k,M)=>M===D||M===m?{...k,matched:!0}:k);y(C),g([]),u(k=>k+1),C.every(k=>k.matched)&&O(T)}else A.current=!0,u(0),setTimeout(()=>{y(C=>C.map((k,M)=>M===D||M===m?{...k,flipped:!1}:k)),g([]),A.current=!1},700)}};return e.jsxs(F,{className:"p-6 sm:p-8 max-w-2xl mx-auto",children:[e.jsx($e,{fire:i}),e.jsx(xt,{emoji:"ð§©",title:"Medical Memory Match",subtitle:"Clear the board in as few moves as you can."}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 mt-5",children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(L,{tone:"blue",children:["Moves: ",c]}),e.jsxs(L,{tone:"gray",children:[e.jsx(He,{className:"w-3.5 h-3.5"})," ",f,"s"]}),r!=null&&r.bestMoves?e.jsxs(L,{tone:"orange",children:["Best: ",r.bestMoves]}):null,e.jsx(pt,{combo:x}),o&&e.jsxs(L,{tone:"green",children:[e.jsx(me,{className:"w-3.5 h-3.5"})," XP claimed today"]})]}),e.jsxs(H,{variant:"outline",onClick:q,children:[e.jsx(ut,{className:"w-4 h-4"})," New board"]})]}),e.jsx("div",{className:"mt-4 h-2 rounded-full bg-gray-100 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-[#2CC5F4] to-[#F9A01B] transition-[width] duration-500",style:{width:`${I/j*100}%`}})}),e.jsx("div",{className:"grid grid-cols-4 gap-3 mt-6",style:{perspective:"900px"},children:l.map((E,_)=>{const P=E.flipped||E.matched;return e.jsx("button",{onClick:()=>W(_),className:`aspect-square rounded-2xl text-3xl grid place-items-center border transition-all duration-300 ${P?"bg-white border-[#2CC5F4]/50 shadow-lg animate-card-flip":"bg-gradient-to-br from-[#2CC5F4] to-[#0b7fa3] border-white/60 hover:-translate-y-1 hover:shadow-xl active:scale-95"} ${E.matched?"opacity-70 ring-2 ring-emerald-300":""}`,style:{transformStyle:"preserve-3d"},children:P?e.jsx("span",{className:"animate-pop-in",children:E.icon}):e.jsx("span",{className:"text-white/80 text-xl font-bold",children:"?"})},E.id)})}),e.jsx("p",{className:"text-center text-sm text-gray-600 mt-6",children:N?`ð Board cleared in ${c} moves and ${f}s. Come back tomorrow for more XP.`:"Match every pair. +1 XP once a day â the board changes every game."})]})},Ke=60,Na=({toolKey:t})=>{var T;const{progress:s,awardXp:n,saveToolProgress:a}=V(),r=(T=s[t])==null?void 0:T.data,{fire:o,burst:i}
52=Me(),[h,l]=d.useState("idle"),[y,w]=d.useState(Ke),[g,c]=d.useState(0),[p,x]=d.useState(0),[u,f]=d.useState(0),[b,N]=d.useState(0),[v,A]=d.useState(0),[I,j]=d.useState(null),[q,O]=d.useState(null),[W,S]=d.useState([]),E=d.useCallback(async(D,m)=>{l("done");const C=Math.max(D,(r==null?void 0:r.best)??0),k=Math.max(m,(r==null?void 0:r.bestPoints)??0);D>((r==null?void 0:r.best)??0)&&i(),await a(t,{lastPlayed:le(),best:C,bestPoints:k},!0);const M=await n("speed_round");R.success(M?`Round over â +${M} XP`:`Round over! Score ${D}`)},[n,i,a,r==null?void 0:r.best,r==null?void 0:r.bestPoints,t]);d.useEffect(()=>{if(h!=="playing")return;if(y<=0){E(p,u);return}const D=window.setTimeout(()=>w(m=>m-1),1e3);return()=>window.clearTimeout(D)},[h,y,p,u,E]);const _=()=>{S(pa(60)),c(0),x(0),f(0),N(0),A(0),j(null),w(Ke),l("playing")},P=W[g],B=D=>{if(!P)return;const m=D===P.answerIndex,C=m?b+1:0,k=m?50+C*15:0;x(M=>M+(m?1:0)),f(M=>M+k),N(C),A(M=>Math.max(M,C)),j(m?"right":"wrong"),O({id:Date.now(),text:m?`+${k}`:"â",tone:m?"green":"orange"}),window.setTimeout(()=>j(null),320),c(M=>M+1)};return e.jsxs(F,{className:`relative p-6 sm:p-8 max-w-2xl mx-auto transition-shadow duration-200 ${I==="right"?"ring-4 ring-emerald-300/60":I==="wrong"?"ring-4 ring-red-300/60":""}`,children:[e.jsx($e,{fire:o}),h==="idle"&&e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-5xl animate-tilt-float",children:"â¡"}),e.jsx("h2",{className:"font-heading text-2xl font-extrabold text-[#1a1a1a] mt-3",children:"60-second Speed Round"}),e.jsx("p",{className:"text-gray-600 text-sm mt-2 max-w-md mx-auto",children:"Rapid-fire clinical questions pulled at random from the full bank. Chain correct answers to build a combo multiplier and push your point score higher."}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mt-4",children:[r!=null&&r.best?e.jsxs(L,{tone:"orange",children:["Best: ",r.best," correct"]}):null,r!=null&&r.bestPoints?e.jsxs(L,{tone:"blue",children:["Top score: ",r.bestPoints," pts"]}):null]}
52),e.jsxs(H,{className:"mt-6",onClick:_,children:[e.jsx(nt,{className:"w-4 h-4"})," Start the round"]})]}),h==="playing"&&P&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsxs(L,{tone:y<=10?"orange":"blue",children:[e.jsx(He,{className:"w-3.5 h-3.5"})," ",y,"s"]}),e.jsx(pt,{combo:b}),e.jsxs(L,{tone:"orange",children:[u," pts"]})]}),e.jsx("div",{className:"h-2 rounded-full bg-gray-100 mt-3 overflow-hidden",children:e.jsx("div",{className:`h-full transition-[width] duration-1000 ease-linear ${y<=10?"bg-red-400":"bg-gradient-to-r from-[#2CC5F4] to-[#F9A01B]"}`,style:{width:`${y/Ke*100}%`}})}),e.jsxs("div",{className:"relative mt-6 animate-pop-in",children:[q&&e.jsx(Vt,{text:q.text,tone:q.tone==="green"?"green":"orange"},q.id),e.jsx(L,{tone:"gray",children:P.category}),e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mt-2 leading-snug",children:P.q}),e.jsx("div",{className:"grid gap-3 mt-4",children:P.shuffledOptions.map((D,m)=>e.jsx("button",{onClick:()=>B(m),className:"rounded-xl border border-gray-200 bg-white px-4 py-3 text-left text-sm font-semibold text-gray-800 transition-all duration-150 hover:-translate-y-0.5 hover:border-[#2CC5F4] hover:bg-[#2CC5F4]/5 hover:shadow-md active:scale-[0.98]",children:D},D))})]},g)]}),h==="done"&&e.jsxs("div",{className:"text-center animate-pop-in",children:[e.jsx("div",{className:"text-5xl",children:"ð"}),e.jsx("h2",{className:"font-heading text-2xl font-extrabold text-[#1a1a1a] mt-3",children:e.jsx(ht,{value:u,suffix:" pts"})}),e.jsxs("p",{className:"text-gray-600 text-sm mt-2",children:[p," correct · best combo ",v,"x · personal best ",Math.max(p,(r==null?void 0:r.best)??0)]}
52),e.jsxs(H,{className:"mt-6",onClick:_,children:[e.jsx(ut,{className:"w-4 h-4"})," Play again"]})]})]})},Je=[{word:"STETHOSCOPE",hint:"Used to listen to heart and lung sounds"},{word:"TRIAGE",hint:"Sorting patients by urgency"},{word:"DATAFLOW",hint:"Primary source verification for Gulf licensing"},{word:"PROMETRIC",hint:"Computer-based licensing exam provider"},{word:"ANTIBIOTIC",hint:"Drug class used against bacterial infection"},{word:"HYPOXIA",hint:"Low oxygen in the tissues"},{word:"CANNULA",hint:"Thin tube inserted into a vein"},{word:"SUTURE",hint:"Stitch used to close a wound"},{word:"DEFIBRILLATOR",hint:"Delivers a shock to restore rhythm"},{word:"ANAESTHESIA",hint:"Induced loss of sensation for surgery"},{word:"TACHYCARDIA",hint:"Heart rate above 100 bpm at rest"},{word:"BRADYCARDIA",hint:"Heart rate below 60 bpm at rest"},{word:"SPHYGMOMANOMETER",hint:"Instrument that measures blood pressure"},{word:"NEPHRON",hint:"Functional unit of the kidney"},{word:"ALVEOLI",hint:"Where gas exchange happens in the lung"},{word:"DIAPHRAGM",hint:"The main muscle of respiration"},{word:"SEPSIS",hint:"Life-threatening response to infection"},{word:"ASEPSIS",hint:"Absence of disease-causing microorganisms"},{word:"INTUBATION",hint:"Placing a tube to secure the airway"},{word:"CATHETER",hint:"Tube used to drain the bladder"},{word:"PALLIATIVE",hint:"Care focused on comfort, not cure"},{word:"ANAPHYLAXIS",hint:"Severe, rapid allergic reaction"},{word:"HAEMATOMA",hint:"Collection of blood outside a vessel"},{word:"ISOLATION",hint:"Separating an infectious patient"},{word:"VENTILATOR",hint:"Machine that supports breathing"},{word:"PHLEBOTOMY",hint:"Drawing blood from a vein"},{word:"ARRHYTHMIA",hint:"Irregular heart rhythm"},{word:"ANALGESIC",hint:"Medication that relieves pain"},{word:"HYPERGLYCAEMIA",hint:"Blood glucose that is too high"},{word:"AUSCULTATION",hint:"Listening to body sounds during assessment"}],va="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),Ze=6,ka=({toolKey:t})=>{var N;const{progress:s,awardXp:n,saveToolProgress:a}=V(),r=(N=s[t])==null?void 0:N.data,{fire:o,burst:i}=Me(),h=()=>Je[Math.floor(Math.random()*Je.length)],[l,y]=d.useState(h),[w,g]=d.useState([]),[c,p]=d.useState((r==null?void 0:r.streak)??0),x=w.filter(v=>!l.word.includes(v)),u=d.useMemo(()=>l.word.split("").every(v=>v===" "||w.includes(v)),[l,w]),f=x.length>=Ze;d.useEffect(()=>{u&&(i(),p(v=>v+1),(async()=>{await a(t,{lastPlayed:le(),solved:((r==null?void 0:r.solved)??0)+1,streak:c+1},!0);const v=await n("word_guess");R.success(v?`Solved it! +${v} XP`:"Solved it! Today's XP already claimed.")})())},[u]),d.useEffect(()=>{f&&p(0)},[f]);const b=()=>{y(h()),g([])};return e.jsxs(F,{className:"p-6 sm:p-8 max-w-2xl mx-auto text-center",children:[e.jsx($e,{fire:o}),e.jsx(xt,{emoji:"ð¤",title:"Medical Word Guess",subtitle:`${Je.length} clinical terms · random every round`}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-2 mt-5",children:[e.jsxs(L,{tone:"blue",children:["Hint: ",l.hint]}),c>1&&e.jsxs(L,{tone:"orange",children:["ð¥ ",c," word streak"]}),r!=null&&r.solved?e.jsxs(L,{tone:"gray",children:[r.solved," solved"]}):null]}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2 mt-6",children:l.word.split("").map((v,A)=>{const I=w.includes(v)||f;return e.jsx("span",{className:`w-9 h-11 sm:w-10 sm:h-12 grid place-items-center rounded-xl border-2 font-heading text-lg font-extrabold transition-all duration-300 ${I?"border-[#2CC5F4]/60 bg-gradient-to-br from-white to-[#F7FBFF] text-[#1a1a1a] animate-pop-in shadow-sm":"border-dashed border-gray-300 bg-white/60 text-transparent"}`,style:{animationDelay:`${A*40}ms`},children:I?v:"â¢"},A)})}),e.jsx("div",{className:"flex items-center justify-center gap-1.5 mt-5",children:Array.from({length:Ze}).map((v,A)=>e.jsx(is,{className:`w-5 h-5 transition-all duration-300 ${A<Ze-x.length?"text-red-400 fill-red-400":"text-gray-200 scale-90"}`},A))}),e.jsx("div",{className:"flex flex-wrap justify-center gap-1.5 mt-5",children:va.map(v=>{const A=w.includes(v),I=A&&l.word.includes(v);return e.jsx("button",{disabled:A||u||f,onClick:()=>g(j=>[...j,v]),className:`w-8 h-9 rounded-lg text-sm font-bold transition-all duration-150 ${I?"bg-emerald-500 text-white scale-105":A?"bg-gray-200 text-gray-400":"bg-white border border-gray-200 text-gray-700 hover:-translate-y-0.5 hover:border-[#F9A01B] hover:text-[#a3660b] hover:shadow active:scale-95"} disabled:cursor-not-allowed`,children:v},v)})}),(u||f)&&e.jsxs("div",{className:"mt-6 animate-pop-in",children:[e.jsx("p",{className:"font-heading text-lg font-bold text-[#1a1a1a]",children:u?"ð Correct!":`The word was ${l.word}`}
52),e.jsxs(H,{className:"mt-3",onClick:b,children:[e.jsx(ut,{className:"w-4 h-4"})," Next word"]})]})]})},_t={"United Arab Emirates":{title:"DHA / DOH / MOH Licensing Support",desc:"Most UAE employers shortlist candidates who already hold (or have started) their DHA, DOH or MOH licence. We handle DataFlow, exam booking and the full application for you.",href:"/services/dha-licensing",cta:"Start UAE licensing",tone:"orange"},"Saudi Arabia":{title:"SCFHS (Saudi) Licensing Support",desc:"Saudi hospitals move fast on candidates with SCFHS classification in progress. We manage DataFlow, Prometric booking and the classification file end to end.",href:"/services/gcc-licensing",cta:"Start SCFHS licensing",tone:"orange"},Qatar:{title:"QCHP (Qatar) Licensing Support",desc:"Getting your QCHP evaluation and Prometric done early usually shortens the wait between an offer and joining. We can run the whole file for you.",href:"/services/gcc-licensing",cta:"Start QCHP licensing",tone:"orange"},Oman:{title:"OMSB (Oman) Licensing Support",desc:"Oman employers prefer applicants with OMSB prometric already cleared. We prepare, verify and submit everything for you.",href:"/services/gcc-licensing",cta:"Start OMSB licensing",tone:"orange"},Bahrain:{title:"NHRA (Bahrain) Licensing Support",desc:"An NHRA file that is already in progress makes your profile far easier for a Bahrain employer to act on. We take care of the paperwork.",href:"/services/gcc-licensing",cta:"Start NHRA licensing",tone:"orange"},Kuwait:{title:"GCC Licensing Support",desc:"Licensing is usually the slowest step of a Gulf move. Starting it early can meaningfully shorten your timeline.",href:"/services/gcc-licensing",cta:"Explore GCC licensing",tone:"orange"},Germany:{title:"Germany Nursing Programme",desc:"Our sponsored Germany pathway covers German language training, recognition (Anerkennung) and visa support for nurses and physiotherapists.",href:"/german-nursing-program",cta:"See the Germany pathway",tone:"blue"}},Ca={title:"GCC Licensing Support",desc:"DHA, DOH, MOH, SCFHS, QCHP, OMSB and NHRA â we manage DataFlow, exams and the full application so your profile is employer-ready sooner.",href:"/services/gcc-licensing",cta:"Explore licensing",tone:"orange"},et={title:"DataFlow Verification Assistance",desc:"Document rejections are the most common reason a licence stalls. We pre-check and submit your DataFlow correctly the first time.",href:"/services/dataflow-assistance",cta:"Get DataFlow help",tone:"blue"},Ft={title:"Prometric Exam Assistance",desc:"Guided preparation, booking support and exam-day coaching for DHA, HAAD, MOH, SCFHS, QCHP and NHRA exams.",href:"/services/prometric-assistance",cta:"Prepare for Prometric",tone:"orange"},Et={title:"MCQ Question Banks & Mock Tests",desc:"Exam-grade question banks with timed mocks â a natural next step after practising here in the Career Hub.",href:"/mcq-packages",cta:"See MCQ packages",tone:"blue"},_e={title:"Accredited Clinical Trainings",desc:"AHA BLS/ACLS/PALS, Infection Control, CPHQ, CPPS and CNA â recruiters notice these certificates on a CV.",href:"/training",cta:"Browse trainings",tone:"orange"},Sa={title:"BLS & ACLS (AHA Certified)",desc:"Life-support certification is requested by almost every Gulf employer. One or two days of training keeps your CV competitive.",href:"/training/bls-aha",cta:"Book BLS / ACLS",tone:"orange"},tt={title:"International CNA Programme",desc:"A flexible 3-month online track with job assistance â useful if you are still building the experience employers ask for.",href:"/training/cna",cta:"View CNA programme",tone:"blue"},Aa={title:"Infection Control Certification",desc:"A short accredited course that strengthens a clinical CV, especially for candidates with fewer years of hospital experience.",href:"/training/infection-control",cta:"View course",tone:"blue"},Pa={title:"CPHQ â Healthcare Quality",desc:"For experienced professionals aiming at senior, quality or leadership roles where pay bands are noticeably higher.",href:"/training/cphq",cta:"Explore CPHQ",tone:"orange"},Lt={title:"Free Consultation with a Counsellor",desc:"Tell us where you are and we will suggest the shortest realistic route for your profile.",href:"/book-consultation",cta:"Book a free call",tone:"blue"},Tt={title:"Free Eligibility Assessment",desc:"A quick check of your qual
52ification, experience and documents against the authority's current requirements.",href:"/eligibility-checker",cta:"Check my eligibility",tone:"blue"},_a=t=>["prometric-quiz","speed-round","memory-match","word-guess","spin-wheel","daily-challenge"].includes(t),Fa=t=>{const s=parseFloat(String(t??"").replace(/[^0-9.]/g,""));return Number.isFinite(s)?s:void 0},Fe=t=>(t??"").toLowerCase(),Ea=(t,s={})=>{const n=s.values??{},a=s.country??n.country,r=s.profession??n.profession,o=s.score,i=Fe(n.license_status??n.licence??n.license??n.licensing_status),h=Fe(n.dataflow??n.dataflow_status??n.verification),l=Fe(n.exam_status??n.prometric??n.exam),y=Fe(n.language??n.language_level??n.german),w=Fa(n.experience??n.years??n.years_experience??n.exp),g=Fe(n.experience??n.years_experience),c=[],p=(v,A)=>{c.some(I=>I.href===v.href)||c.push(A?{...v,reason:A}:v)},x=a&&_t[a]||Ca,u=a??"your target country",f=i.includes("not")||i.includes("no ")||i==="no"||i.includes("planning")||i.includes("none"),b=i.includes("progress")||i.includes("applied")||i.includes("dataflow"),N=i.includes("hold")||i.includes("active")||i.includes("yes")||i.includes("licensed");return _a(t)?(p(Et,"You just tested yourself here â a full exam-grade bank is the natural next level."),p(Ft,`Turning practice scores into a booked ${a?`${u} `:""}Prometric pass is the step employers actually check.`),p(_e,"Certificates like BLS/ACLS sit alongside exam results on a shortlisted CV.")):t==="salary-calculator"?(p(x,N?`You already hold a licence â we can help you transfer or add a second authority for ${u}.`:`The bands you just saw for ${u} are typically offered to candidates who are already licensed there.`),a==="Germany"?p(_e,"German-track employers look for recognised clinical certifications alongside language level."):w!==void 0&&w<3?p(tt,`With around ${w} year(s) of experience, added certification is the fastest way to move up a band.`):p(Sa,"AHA life-support certification is one of the quickest CV upgrades before salary negotiation."),w!==void 0&&w>=5&&p(Pa,`With ${w}+ years behind you, quality/leadership certification opens the higher bands you saw above.`),p(et,"Salary offers only become real once verification clears â starting DataFlow early avoids the usual delay.")):t==="dataflow-checker"||t==="resume-analyzer"||t==="resume-builder"?(p(et,o!==void 0&&o<70?`Your score of ${o} suggests gaps that commonly trigger a DataFlow rejection â we pre-check those before submission.`:"We pre-check every document so your file clears the first time."),p(x,`Once verification clears, the ${u} licence application is the next step and we can run it for you.`),p(_e,"Adding an accredited certificate is the simplest way to strengthen the CV you just analysed.")):t==="license-timeline"||t==="eligibility-checker"||t==="roadmap-generator"?(p(x,f?`You indicated you haven't started your licence yet â this is the single biggest item on your ${u} timeline.`:b?"Your licence is already in progress â we can take over the remaining steps and follow up with the authority.":`Based on your answers, this is the licence route that matches ${u}.`),p(Ft,l.includes("not")||l.includes("no")?"You haven't cleared the Prometric exam yet â preparation and booking support usually saves weeks here.":"Exam readiness keeps your timeline on track."),p(et,h.includes("not")||h.includes("no")?"DataFlow hasn't been started in your answers â it is the longest-running step, so starting now shortens everything after it.":"Verification issues are the most common cause of a stalled application.")):t==="readiness-assessment"||t==="career-recommendation"?(p(x,o!==void 0?`Your readiness score of ${o} improves most quickly once your ${u} licence file is moving.`:`Licensing is the step that most affects your readiness for ${u}.`),o!==void 0&&o<60&&p(Lt,`A score of ${o} usually means a couple of specific gaps â a counsellor can map the shortest fix.`),p(_e,"Accredited certificates lift the parts of your profile the assessment scored lowest."),w!==void 0&&w<2?p(tt,"With under two years of experience, the CNA track adds the hands-on credential employers ask for."):p(Aa,"A short accredited course is a quick, visible addition to your CV.")):(p(x,`Matched to ${u} from your answers.`),p(_e,"Certifications strengthen the profile you just described."),p(Et,"Exam practice keeps you ready when your licence file reaches the exam stage.")),r&&["Registered Nurse","Physiotherapist"].includes(r)&&a!=="Germany"&&(!y||!y.includes("none"))&&p(_t.Germany,`Open to ${r}s â our sponsored Germany pathway covers language, recognition and visa.`),(g.includes("fresh")||g.includes("graduate")||w!==void 0&&w<1)&&p(tt,"You indicated you are early in your career â this programme is built for exactly that stage."),!c.some(v=>v.href===Tt.href)&&c.length<4&&p(Tt,"A free formal check confirms what this tool estimated."),p(Lt,"Free call â we will sanity-check the plan above against your actual documents."),c.slice(0,4)},Ue=({toolKey:t,country:s,profession:n,values:a,score:r})=>{const o=Ea(t,{country:s,profession:n,values:a,score:r});return o.length?e.jsxs(F,{className:"p-6 sm:p-8",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[#0b7fa3] text-xs font-bold uppercase tracking-wide",children:[e.jsx(ue,{className:"w-4 h-4"})," Suggested for you, based on your answers"]}),e.jsx("h3",{className:"font-heading text-xl font-bold text-[#1a1a1a] mt-2",children:"Complete these and employers can move on your profile much faster"}),e.jsx("p",{className:"text-sm text-gray-600 mt-1.5",children:"These are suggestions based on what you just filled
52in â not a guarantee of a job offer. Candidates who arrive licence-ready and certified are simply easier for recruiters to shortlist."}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-4 mt-6",children:o.map(i=>e.jsxs("div",{className:"rounded-2xl border border-gray-100 bg-gradient-to-br from-[#F7FBFF] to-white p-5 flex flex-col",children:[e.jsx(L,{tone:i.tone??"blue",children:"Healthserve service"}),e.jsx("p",{className:"font-heading font-bold text-[#1a1a1a] mt-3",children:i.title}),i.reason&&e.jsx("p",{className:"text-[13px] text-[#0b7fa3] mt-1.5 font-semibold leading-relaxed",children:i.reason}),e.jsx("p",{className:"text-sm text-gray-600 mt-1.5 leading-relaxed flex-1",children:i.desc}),e.jsxs(J,{to:i.href,className:"mt-4 inline-flex items-center gap-1.5 text-sm font-bold text-[#0b7fa3] hover:text-[#F9A01B] transition",children:[i.cta," ",e.jsx(mt,{className:"w-4 h-4"})]})]},i.href))}),e.jsx("p",{className:"text-xs text-gray-400 mt-5",children:"Suggestions only â outcomes depend on your experience, documents, exam results and employer requirements."})]}):null},oe="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 placeholder:text-gray-400 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",La=["United Arab Emirates","Saudi Arabia","Qatar","Oman","Bahrain","Germany"],Ta=["Registered Nurse","Physiotherapist","Doctor / Physician","Specialist / Consultant","Dentist","Pharmacist","Lab Technologist","Radiographer","Allied Health Other"],qe=["Registered Nurse","Physiotherapist"],de=(t,
52s="")=>typeof t=="number"&&Number.isFinite(t)?`${s}${Math.round(t).toLocaleString()}`:"â",$a=({toolKey:t})=>{var v,A,I;const{progress:s,awardXp:n,saveToolProgress:a,grantBadge:r}=V(),o=(v=s[t])==null?void 0:v.data,[i,h]=d.useState((o==null?void 0:o.values)??{profession:"",country:"",experience:"",specialty:"",sector:"Any",city:"",qualification:"Bachelor",licensed:"In process",language:"None"}),[l,y]=d.useState((o==null?void 0:o.benchmark)??null),[w,g]=d.useState(!1),{fire:c,burst:p}=Me(),x=(j,q)=>h(O=>({...O,[j]:q})),u=i.country==="Germany"&&i.profession&&!qe.includes(i.profession),f=La.filter(j=>j!=="Germany"||!i.profession||qe.includes(i.profession)),b=async()=>{if(!i.profession||!i.country||!i.experience){R.error("Please fill profession, country and years of experience.");return}if(u){R.error("Germany is open only for Registered Nurses and Physiotherapists.");return}g(!0);try{const{data:j,error:q}=await $.functions.invoke("ai-salary-benchmark",{body:{country:i.country,profession:i.profession,experience:Number(i.experience)||0,specialty:i.specialty??"",sector:i.sector||"Any",city:i.city??"",qualification:i.qualification||"Bachelor",licensed:i.licensed||"In process",language:i.language||"None"}});if(q)throw q;if(j!=null&&j.error)throw new Error(j.error);const O=j;y(O),p(),await a(t,{values:i,benchmark:O}),await r("career_explorer"),await r("salary_expert");const W=await n("salary_calculator");W&&R.success(`+${W} XP earned`)}catch(j){console.error("salary benchmark failed:",j),R.error(j instanceof Error?j.message:"Could not fetch the benchmark. Please try again.")}finally{g(!1)}},N=l!=null&&l.currency?`${l.currency} `:"";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(F,{className:"p-6 sm:p-8",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[#0b7fa3] text-xs font-bold uppercase tracking-wide",children:[e.jsx(ue,{className:"w-4 h-4"})," Live AI market benchmark"]}),e.jsx("p",{className:"text-sm text-gray-600 mt-2",children:"Covers the GCC (UAE, Saudi Arabia, Qatar, Oman, Bahrain) and Germany. Germany is currently open only for Registered Nurses and Physiotherapists. Market data is refreshed from current pay standards every week."}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-5 mt-6",children:[e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:["Profession ",e.jsx("span",{className:"text-[#F9A01B]",children:"*"})]}),e.jsxs("select",{className:oe,value:i.profession,onChange:j=>{const q=j.target.value;h(O=>({...O,profession:q,country:O.country==="Germany"&&!qe.includes(q)?"":O.country}))},children:[e.jsx("option",{value:"",children:"Selectâ¦"}),Ta.map(j=>e.jsx("option",{children:j},j))]})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:["Target country ",e.jsx("span",{className:"text-[#F9A01B]",children:"*"})]}),e.jsxs("select",{className:oe,value:i.country,onChange:j=>x("country",j.target.value),children:[e.jsx("option",{value:"",children:"Selectâ¦"}),f.map(j=>e.jsx("option",{children:j},j))]}),i.profession&&!qe.includes(i.profession)&&e.jsx("span",{className:"block text-[12px] text-gray-500 mt-1",children:"Germany is available for Registered Nurses and Physiotherapists only."})]}),e.jsxs("label",{className:"block",children:[e.jsxs("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:["Years of experience ",e.jsx("span",{className:"text-[#F9A01B]",children:"*"})]}),e.jsx("input",{className:oe,type:"number",min:0,max:50,placeholder:"e.g. 4",value:i.experience,onChange:j=>x("experience",j.target.value)})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Specialty / department"}),e.jsx("input",{className:oe,placeholder:"e.g. ICU, Emergency, Ortho",value:i.specialty,onChange:j=>x("specialty",j.target.value)})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Highe
52st qualification"}),e.jsx("select",{className:oe,value:i.qualification,onChange:j=>x("qualification",j.target.value),children:["Diploma","Bachelor","Master","PhD / Board certified"].map(j=>e.jsx("option",{children:j},j))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Employer sector"}),e.jsx("select",{className:oe,value:i.sector,onChange:j=>x("sector",j.target.value),children:["Any","Government","Private hospital","Private clinic"].map(j=>e.jsx("option",{children:j},j))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Licensing status"}),e.jsx("select",{className:oe,value:i.licensed,onChange:j=>x("licensed",j.target.value),children:["Licensed already","Exam passed","In process","Not started"].map(j=>e.jsx("option",{children:j},j))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Language level"}),e.jsx("select",{className:oe,value:i.language,onChange:j=>x("language",j.target.value),children:["None","IELTS / OET","German A2","German B1","German B2","German C1"].map(j=>e.jsx("option",{children:j},j))})]}),e.jsxs("label",{className:"block sm:col-span-2",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"City / region (optional)"}),e.jsx("input",{className:oe,placeholder:"e.g. Dubai, Riyadh, Munich",value:i.city,onChange:j=>x("city",j.target.value)})]})]}),e.jsx(H,{onClick:b,disabled:w,className:"mt-6 w-full sm:w-auto",children:w?"Analysing live market dataâ¦":l?"Recalculate":"Calculate my salary range"})]}),w&&!l&&e.jsx(ma,{}),l&&e.jsxs(F,{className:"p-6 sm:p-8 animate-pop-in",children:[e.jsx($e,{fire:c}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("h3",{className:"font-heading text-xl font-bold text-[#1a1a1a] flex-1",children:[i.profession," in ",i.country]}),l.demand&&e.jsxs(L,{tone:l.demand==="High"?"green":l.demand==="Low"?"gray":"orange",children:[e.jsx(ws,{className:"w-3.5 h-3.5"})," ",l.demand," demand"]})]}),e.jsxs("div",{className:"mt-4 text-center sm:text-left",children:[e.jsx("p",{className:"text-[12px] font-bold uppercase tracking-wide text-gray-500",children:"Typical monthly package"}),e.jsx("p",{className:"font-heading text-4xl sm:text-5xl font-extrabold bg-gradient-to-r from-[#F9A01B] to-[#2CC5F4] bg-clip-text text-transparent mt-1",children:e.jsx(ht,{value:l.monthly_mid??0,prefix:`${N} `})})]}),e.jsx(da,{low:l.monthly_low??0,mid:l.monthly_mid??0,high:l.monthly_high??0,format:j=>de(j,N)}),e.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-4 gap-3 mt-6",children:[["Entry of band",`${de(l.monthly_low,N)}/mo`],["Typical (mid)",`${de(l.monthly_mid,N)}/mo`],["Top of band",`${de(l.monthly_high,N)}/mo`],["Typical in USD",`$${de(l.monthly_mid_usd)}/mo`],["Annual (USD, mid)",`$${de(l.annual_mid_usd)}`],["Living cost (USD)",`$${de(l.cost_of_living_usd)}/mo`],["Est. monthly savings",`$${de(typeof l.monthly_mid_usd=="number"&&typeof l.cost_of_living_usd=="number"?Math.max(0,l.monthly_mid_usd-l.cost_of_living_usd):void 0)}`],["Tax",l.tax??"â"]].map(([j,q],O)=>e.jsx(Ve,{delay:O*70,animation:"animate-fade-up",children:e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-gradient-to-br from-[#F7FBFF] to-white p-3 transition-transform duration-200 hover:-translate-y-1 hover:shadow-md",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:j}),e.jsx("p",{className:"font-semibold text-[#1a1a1a] mt-0.5 text-sm",children:q})]})},j))}),e.jsxs("div",{className:"mt-6 space-y-2 text-sm text-gray-700 leading-relaxed",children:[l.allowances&&e.jsxs("p",{children:["ð¼ ",l.allowances]}),l.net_note&&e.jsxs("p",{children:["ð¸ ",l.net_note]})]}),!!((A=l.boosters)!=null&&A.length)&&e.jsxs("div",{className:"mt-6",children:[e.jsx("p",{className:"text-[12px] font-bold uppercase tracking-wide text-gray-600",children:"How to earn more"}),e.jsx("ul",{className:"mt-2 space-y-2",children:l.boosters.map((j,q)=>e.jsx("li",{className:"text-sm text-gray-700 border-l-2 border-[#F9A01B] pl-3",children:j},q))})]}),!!((I=l.sources)!=null&&I.length)&&e.jsxs("p",{className:"text-xs text-gray-400 mt-6",children:["Referenced standards: ",l.sources.join(" · ")]}),l.refreshed_at&&e.jsxs("p",{className:"text-xs text-gray-400 mt-2 flex items-center gap-1.5",children:[e.jsx(ls,{className:"w-3 h-3"})," Market data last refreshed"," ",new Date(l.refreshed_at).toLocaleDateString()," · auto-updates weekly"]}),e.jsxs("div",{className:"mt-6 rounded-xl border border-[#F9A01B]/30 bg-[#F9A01B]/10 p-4 flex gap-3",children:[e.jsx(Ht,{className:"w-5 h-5 text-[#a3660b] shrink-0 mt-0.5"}),e.jsxs("p",{className:"text-[13px] text-[#7a4d08] leading-relaxed",children:[e.jsx("strong",{children:"Disclaimer:"})," This is an AI-generated calculator showing standard market salary ranges only. Actual salaries vary according to your experience, skills, specialty, employer, interview performance and negotiation. Healthserve does not guarantee any figure shown here."]})]})]}),l&&e.jsx(Ue,{toolKey:t,country:i.country,profession:i.profession,values:i})]})},Qt=[{key:"summary",label:"Professional Summary",hint:"3â4 line pitch"},{key:"experience",label:"Clinical / Work Experience",hint:"Roles + achievements"},{key:"education",label:"Education",hint:"Degrees & institutions"},{key:"certifications",label:"Licences & Certifications",hint:"DHA, BLS, ACLSâ¦"},{key:"skills",label:"Core Skills",hint:"Clinical competencies"},{key:"itSkills",label:"Systems & IT Skills",hint:"EMR, Cerner, Epicâ¦"},{key:"trainings",label:"Training & Courses",hint:"CPD, workshops"},{key:"achievements",label:"Key Achievements",hint:"Quantified wins"},{key:"awards",label:"Awards & Recognition",hint:"Employee of the monthâ¦"},{key:"projects",label:"Projects & Quality Initiatives",hint:"Audits, QI projects"},{key:"publications",label:"Publications & Research",hint:"Papers, posters"},{key:"memberships",label:"Professional Memberships",hint:"Councils, associations"},{key:"volunteer",label:"Volunteering & Community",hint:"Camps, outreach"},{key:"languages",label:"Languages",hint:"Spoken languages"},{key:"interests",label:"Interests",hint:"Optional personal touch"},{key:"references",label:"References",hint:"Or 'available on request'"}],$t=["certifications","skills","itSkills","trainings","achievements","awards","projects","publications","memberships","volunteer","languages","interests"],Mt=[{key:"classic",name:"ATS Classic",blurb:"Single column, parses perfectly in every hospital ATS."},{key:"modern",name:"Modern Header",blurb:"Coloured header band â popular with GCC private groups."},{key:"sidebar",name:"Clinical Sidebar",blurb:"Left rail for licences, skills and languages."}
52,{key:"executive",name:"Executive Two-Column",blurb:"Wide main column with a soft-tinted right rail."},{key:"editorial",name:"Editorial Serif",blurb:"Elegant serif headings for consultants and specialists."},{key:"gradient",name:"Gradient Impact",blurb:"Bold gradient masthead with photo â stands out instantly."}],Bt=[{key:"orange",name:"Healthserve Orange",value:"#F9A01B"},{key:"blue",name:"Clinical Blue",value:"#2CC5F4"},{key:"navy",name:"Executive Navy",value:"#1E3A8A"},{key:"teal",name:"Care Teal",value:"#0F766E"},{key:"maroon",name:"Consultant Maroon",value:"#7F1D1D"},{key:"graphite",name:"Graphite",value:"#334155"},{key:"emerald",name:"Emerald",value:"#047857"},{key:"violet",name:"Royal Violet",value:"#6D28D9"},{key:"rose",name:"Rose",value:"#BE185D"},{key:"sky",name:"Deep Sky",value:"#0369A1"},{key:"amber",name:"Amber",value:"#B45309"},{key:"forest",name:"Forest",value:"#14532D"},{key:"plum",name:"Plum",value:"#581C87"},{key:"coral",name:"Coral",value:"#EA580C"},{key:"slate",name:"Midnight Slate",value:"#0F172A"},{key:"cyan",name:"Aqua",value:"#0891B2"}],We=["summary","experience","education","certifications","skills","languages"],Kt=()=>({name:"",title:"",phone:"",email:"",location:"",linkedin:"",portfolio:"",photoUrl:"",country:"United Arab Emirates",profession:"Registered Nurse",specialty:"",summary:"",experience:[{role:"",employer:"",location:"",period:"",bullets:[""]}],education:[{degree:"",school:"",year:""}],certifications:[],skills:[],languages:["English"],achievements:[],trainings:[],publications:[],memberships:[],awards:[],volunteer:[],projects:[],interests:[],itSkills:[],references:"",customSections:[],order:[...We]}),Ma=t=>{var s;return{...Kt(),...t??{},order:(s=t==null?void 0:t.order)!=null&&s.length?t.order:[...We],customSections:(t==null?void 0:t.customSections)??[]}},Xe=(t,s)=>{var n,a;if(typeof t=="string"&&t.startsWith("custom-")){const r=Number(t.split("-")[1]);return((n=s.customSections.find(o=>o.id===r))==null?void 0:n.title)||"Custom Section"}return((a=Qt.find(r=>r.key===t))==null?void 0:a.label)??t},Ba=({title:t,accent:s,serif:n})=>e.jsx("h3",{className:`text-[11px] font-bold uppercase tracking-[0.16em] pb-1 mb-2 border-b ${n?"font-serif":""}`,style:{color:s,borderColor:`${s}55`},children:t}),ct=({items:t,accent:s})=>e.jsx("ul",{className:"space-y-1",children:t.filter(n=>n.trim()).map((n,a)=>e.jsxs("li",{className:"flex gap-2 text-[11px] leading-[1.5] text-gray-800",children:[e.jsx("span",{style:{color:s},children:"â¢"}),e.jsx("span",{children:n})]},a))}),Da=({items:t,accent:s})=>e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.filter(Boolean).map((n,a)=>e.jsx("span",{className:"rounded px-2 py-[3px] text-[10px] font-medium",style:{background:`${s}14`,color:"#1f2937",border:`1px solid ${s}33`},children:n},a))}),Ia=({data:t,accent:s})=>e.jsx("div",{className:"space-y-3",children:t.experience.filter(n=>n.role||n.employer).map((n,a)=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("p",{className:"text-[12px] font-bold text-gray-900",children:n.role||"Role"}),e.jsx("p",{className:"text-[10px] text-gray-500 shrink-0",children:n.period})]}),e.jsx("p",{className:"text-[11px] font-medium",style:{color:s},children:[n.employer,n.location].filter(Boolean).join(" · ")}),e.jsx("div",{className:"mt-1",children:e.jsx(ct,{items:n.bullets,accent:s})})]},a))}),Ra=({data:t})=>e.jsx("div",{className:"space-y-1.5",children:t.education.filter(s=>s.degree||s.school).map((s,n)=>e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsxs("p",{className:"text-[11px] text-gray-800",children:[e.jsx("span",{className:"font-semibold",children:s.degree}),s.school?` â ${s.school}`:""]}),e.jsx("p",{className:"text-[10px] text-gray-500 shrink-0",children:s.year})]},n))}),je=t=>[t.phone,t.email,t.location,t.linkedin,t.portfolio].filter(Boolean),Jt=(t,s)=>{var n;if(typeof t=="string"&&t.startsWith("custom-")){const a=Number(t.split("-")[1]);return!!((n=s.customSections.find(r=>r.id===a))!=null&&n.items.filter(Boolean).length)}return t==="summary"?!!s.summary.trim():t==="references"?!!s.references.trim():t==="experience"?s.experience.s
52ome(a=>a.role||a.employer):t==="education"?s.education.some(a=>a.degree||a.school):(s[t]??[]).filter(Boolean).length>0},qa=["skills","itSkills","interests","languages"],we=({data:t,accent:s,keys:n,serif:a})=>e.jsx(e.Fragment,{children:n.filter(r=>Jt(r,t)).map(r=>{const o=Xe(r,t);let i=null;if(r==="summary")i=e.jsx("p",{className:"text-[11px] leading-[1.6] text-gray-800",children:t.summary});else if(r==="experience")i=e.jsx(Ia,{data:t,accent:s});else if(r==="education")i=e.jsx(Ra,{data:t});else if(r==="references")i=e.jsx("p",{className:"text-[11px] text-gray-800",children:t.references});else if(typeof r=="string"&&r.startsWith("custom-")){const h=t.customSections.find(l=>l.id===Number(r.split("-")[1]));i=e.jsx(ct,{items:(h==null?void 0:h.items)??[],accent:s})}else qa.includes(r)?i=e.jsx(Da,{items:t[r],accent:s}):i=e.jsx(ct,{items:t[r],accent:s});return e.jsxs("section",{className:"mt-4 break-inside-avoid",children:[e.jsx(Ba,{title:o,accent:s,serif:a}),i]},r)})}),Oa=({title:t,items:s,chips:n})=>e.jsxs("div",{className:"mt-5",children:[e.jsx("p",{className:"text-[9.5px] font-bold uppercase tracking-[0.16em] opacity-80",children:t}),n?e.jsx("p",{className:"mt-1.5 text-[10px] leading-snug",children:s.filter(
52Boolean).join(", ")}):e.jsx("ul",{className:"mt-1.5 space-y-1 text-[10px] leading-snug",children:s.filter(Boolean).map((a,r)=>e.jsxs("li",{children:["⢠",a]},r))})]}),Ee=({url:t,size:s=74,ring:n})=>t?e.jsx("img",{src:t,alt:"Profile",className:"rounded-full object-cover shrink-0",style:{width:s,height:s,border:`2px solid ${n??"rgba(255,255,255,.8)"}`}}):null,Dt=({data:t,template:s,accent:n,printable:a})=>{const r=t.name||"Your Name",o=t.title||t.profession,i=t.order.length?t.order:We,h=["certifications","skills","itSkills","languages","interests"].filter(c=>i.includes(c)&&Jt(c,t)),y=s==="sidebar"||s==="executive"?i.filter(c=>!h.includes(c)):i,w={width:794,minHeight:1123,background:"#fff"},g=({dark:c})=>e.jsxs("aside",{className:c?"p-6 text-white":"p-6",style:c?{background:`linear-gradient(180deg, ${n}, ${n}d9)`}:{background:`${n}0F`,borderLeft:`1px solid ${n}33`,color:"#1f2937"},children:[c&&e.jsxs(e.Fragment,{children:[t.photoUrl&&e.jsx("div",{className:"mb-3",children:e.jsx(Ee,{url:t.photoUrl,size:86})}),e.jsx("h1",{className:"font-heading text-[19px] font-extrabold leading-tight",children:r}),e.jsx("p",{className:"text-[11px] font-semibold opacity-95 mt-0.5",children:o}),e.jsx("div",{className:"mt-4 space-y-1 text-[10px] opacity-95 break-words",children:je(t).map(p=>e.jsx("p",{children:p},p))})]}),h.map(p=>e.jsx(Oa,{title:Xe(p,t),items:t[p]??[],chips:p==="languages"||p==="interests"},p))]});return e.jsxs("div",{id:a?"resume-print-sheet":void 0,className:"resume-sheet text-gray-900",style:w,children:[s==="classic"&&e.jsxs("div",{className:"p-10",children:[e.jsxs("header",{className:"text-center border-b pb-3",style:{borderColor:`${n}55`},children:[e.jsx("h1",{className:"font-heading text-[26px] font-extrabold tracking-tight",children:r}),e.jsx("p",{className:"text-[12px] font-semibold",style:{color:n},children:o}),e.jsx("p",{className:"text-[10px] text-gray-600 mt-1",children:je(t).join(" | ")})]}),e.jsx(we,{data:t,accent:n,keys:i})]}),s==="modern"&&e.jsxs("div",{children:[e.jsxs("header",{className:"px-10 py-7 text-white flex items-center gap-5",style:{background:`linear-gradient(120deg, ${n}, ${n}bb)`},children:[e.jsx(Ee,{url:t.photoUrl}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-[28px] font-extrabold leading-tight",children:r}),e.jsx("p",{className:"text-[13px] font-semibold opacity-95",children:o}),e.jsx("p",{className:"text-[10px] opacity-90 mt-1",children:je(t).join(" · ")})]})]}),e.jsx("div",{className:"px-10 pb-10 pt-2",children:e.jsx(we,{data:t,accent:n,keys:i})})]}),s==="sidebar"&&e.jsxs("div",{className:"grid",style:{gridTemplateColumns:"33% 67%",minHeight:1123},children:[e.jsx(g,{dark:!0}),e.jsx("div",{className:"p-8 pt-7",children:e.jsx(we,{data:t,accent:n,keys:y})})]}),s==="executive"&&e.jsxs("div",{children:[e.jsxs("header",{className:"px-9 pt-9 pb-5 flex items-center gap-5",style:{borderBottom:`3px solid ${n}`},children:[e.jsx(Ee,{url:t.photoUrl,ring:n}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-[27px] font-extrabold tracking-tight text-gray-900",children:r}),e.jsx("p",{className:"text-[12.5px] font-semibold",style:{color:n},children:o}),e.jsx("p",{className:"text-[10px] text-gray-600 mt-1",children:je(t).join(" · ")})]})]}),e.jsxs("div",{className:"grid",style:{gridTemplateColumns:"64% 36%"},children:[e.jsx("div",{className:"px-9 pb-9 pt-1",children:e.jsx(we,{data:t,accent:n,keys:y})}),e.jsx(g,{dark:!1})]})]}),s==="editorial"&&e.jsxs("div",{className:"p-10",children:[e.jsxs("header",{className:"pb-4 mb-1",style:{borderBottom:`1px solid ${n}66`},children:[e.jsxs("div",{className:"flex items-end justify-between gap-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-serif text-[32px] font-bold leading-none tracking-tight text-gray-900",children:r}),e.jsx("p",{className:"font-serif italic text-[13px] mt-1.5",style:{color:n},children:o})]}),e.jsx(Ee,{url:t.photoUrl,size:68,ring:n})]}),e.jsx("p",{className:"text-[10px] text-gray-600 mt-3 tracking-wide",children:je(t).join(" / ")})]}),e.jsx(we,{data:t,accent:n,keys:i,serif:!0})]}),s==="gradient"&&e.jsxs("div",{children:[e.jsxs("header",{className:"px-10 pt-9 pb-8 text-white relative overflow-hidden",style:{background:`linear-gradient(135deg, ${n} 0%, #0f172a 130%)`},children:[e.jsx("div",{className:"absolute -right-16 -top-16 w-56 h-56 rounded-full",style:{background:"rgba(255,255,255,.14)"}}),e.jsxs("div",{className:"relative flex items-center gap-5",children:[e.jsx(Ee,{url:t.photoUrl,size:90}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[10px] uppercase tracking-[0.3em] opacity-80",children:t.profession}),e.jsx("h1",{className:"font-heading text-[32px] font-extrabold leading-tight",children:r}),e.jsx("p",{className:"text-[13px] font-semibold opacity-95",children:o})]})]}),e.jsx("div",{className:"relative mt-4 flex flex-wrap gap-2",children:je(t).map(c=>e.jsx("span",{className:"rounded-full bg-white/15 px-3 py-1 text-[10px]",children:c},c))})]}),e.jsx("div",{className:"px-10 pb-10 pt-2",children:e.jsx(we,{data:t,accent:n,keys:i})})]})]})},st=({data:t,template:s,accent:n,printable:a=!1,scaleToFit:r=!0})=>{const o=d.useRef(null),i=d.useRef(null),[h,l]=d.useState(1),[y,w]=d.use
52State(1123);return d.useEffect(()=>{if(!r)return;const g=()=>{var f,b;const p=((f=o.current)==null?void 0:f.clientWidth)??794,x=Math.min(1,p/794);l(x);const u=((b=i.current)==null?void 0:b.scrollHeight)??1123;w(Math.max(1123,u)*x)};g();const c=new ResizeObserver(g);return o.current&&c.observe(o.current),i.current&&c.observe(i.current),()=>c.disconnect()},[r,t,s]),r?e.jsx("div",{ref:o,style:{width:"100%",height:y},className:"relative",children:e.jsx("div",{ref:i,style:{transform:`scale(${h})`,transformOrigin:"top left",width:794},className:"absolute top-0 left-0 resume-print-wrap",children:e.jsx(Dt,{data:t,template:s,accent:n,printable:a})})}):e.jsx(Dt,{data:t,template:s,accent:n,printable:a})},Q="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 placeholder:text-gray-400 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",Zt=["United Arab Emirates","Saudi Arabia","Qatar","Oman","Bahrain","Kuwait","Germany"],es=["Registered Nurse","Midwife","Doctor / Physician","Specialist / Consultant","Dentist","Pharmacist","Physiotherapist","Lab Technologist","Radiographer","Respiratory Therapist","Dietitian","Allied Health Other"],Ha={...Kt(),name:"Aisha Rahman",title:"Registered Nurse · Critical Care",phone:"+971 50 000 0000",email:"[email protected]",location:"Dubai, UAE",summary:"Critical care nurse with 6 years in tertiary ICU settings, DHA-eligible, experienced in ventilated and post-op cardiac patients, consistently rated top quartile on patient safety audits.",experience:[{role:"Staff Nurse â Adult ICU",employer:"Tertiary Care Hospital",location:"Kochi, India",period:"2019 â Present",bullets:["Managed 1:2 ventilated caseload across 18-bed ICU","Led sepsis bundle compliance from 74% to 96%","Precepted 12 new graduate nurses through orientation"]}],education:[{degree:"BSc Nursing",school:"University of Kerala",year:"2018"}],certifications:["BLS (AHA)","ACLS (AHA)","DataFlow verified"],skills:["Ventilator management","ACLS","Triage","Infection control","Wound care"],itSkills:["Cerner","Epic","MS Office"],achievements:["Reduced CLABSI rate by 40% over 12 months"],languages:["English","Hindi","Arabic (basic)"],order:["summary","experience","education","certifications","skills","itSkills","achievements","languages"]},at=t=>t.join(` 53`),Ga=t=>t.split(` 54`).map(s=>s.trim()).filter(Boolean),Ua=({toolKey:t})=>{var _,P,B,T,D;const{progress:s,saveToolProgress:n}=V(),a=(_=s[t])==null?void 0:_.data,[r,o]=d.useState(Ma(a==null?void 0:a.resume)),[i,h]=d.useState((a==null?void 0:a.template)??"modern"),[l,y]=d.useState((a==null?void 0:a.accent)??Bt[0].value),[w,g]=d.useState(!1),[c,p]=d.useState(null),[x,u]=d.useState(!1),f=(m,C)=>o(k=>({...k,[m]:C})),b=r.order,N=m=>b.includes(m),v=m=>f("order",N(m)?b.filter(C=>C!==m):[...b,m]),A=(m,C)=>{const k=b.indexOf(m),M=k+C;if(k<0||M<0||M>=b.length)return;const X=[...b];[X[k],X[M]]=[X[M],X[k]],f("order",X)},I=()=>{const m=Date.now();o(C=>({...C,customSections:[...C.customSections,{id:m,title:"New Section",items:[""]}],order:[...C.order,`custom-${m}`]}))},j=m=>o(C=>({...C,customSections:C.customSections.filter(k=>k.id!==m),order:C.order.filter(k=>k!==`custom-${m}`)})),q=d.useMemo(()=>{const m=[!!r.name,!!r.title,!!r.email,!!r.phone,r.summary.length>60,r.experience.some(C=>C.role&&C.bullets.filter(Boolean).length>=2),r.education.some(C=>C.degree),r.certifications.length>=2,r.skills.length>=5,r.languages.filter(Boolean).length>=1,b.length>=6];return Math.round(m.filter(Boolean).length/m.length*100)},[r,b]),O=async()=>{var m,C;g(!0);try{const{data:k,error:M}=await $.functions.invoke("resume-ai",{body:{mode:"build",profession:r.profession,specialty:r.specialty,country:r.country,experience:r.experience.length?3:0,currentRole:((m=r.experience[0])==null?void 0:m.role)??"",employer:((C=r.experience[0])==null?void 0:C.employer)??"",education:r.education.map(G=>`${G.degree} ${G.school} ${G.year}`).join("; "),licenses:r.certifications.join("; "),highlights:r.experience.flatMap(G=>G.bullets).join("; ").slice(0,1800)}});if(M)throw M;if(k!=null&&k.error)throw new Error(typeof k.error=="string"?k.error:"Could not generate");const X=k.data;p(X),o(G=>({...G,summary:G.summary||X.summary||"",skills:G.skills.length?G.skills:X.skills??[],certifications:G.certifications.length?G.certifications:X.certifications??[],experience:G.experience.map((ee,ze)=>
54ze===0&&ee.bullets.filter(Boolean).length===0?{...ee,bullets:(X.bullets??[]).slice(0,5)}:ee)})),R.success("Personalised content ready â edit anything you like")}catch(k){R.error(k instanceof Error?k.message:"Generation failed")}finally{g(!1)}},W=async()=>{await n(t,{resume:r,template:i,accent:l}),R.success("Resume saved to your Career Hub")},S=()=>window.print(),E=r.name||r.summary?r:Ha;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3 mb-4",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a]",children:"Choose your format"}),e.jsx("p",{className:"text-sm text-gray-500",children:"Full A4 snapshots of the formats GCC recruiters shortlist in 2026."})]}),e.jsxs(L,{tone:"green",children:[q,"% complete"]})]}),e.jsx("div",{className:"grid sm:grid-cols-3 gap-4",children:Mt.map(m=>e.jsxs("button",{onClick:()=>h(m.key),className:`group rounded-2xl border-2 p-2 text-left transition-all ${i===m.key?"border-[#F9A01B] shadow-lg -translate-y-0.5":"border-gray-200 hover:border-[#2CC5F4]/60"}`,children:[e.jsx("div",{className:"overflow-hidden rounded-xl border border-gray-100 bg-white",style:{height:250},children:e.jsx("div",{style:{width:794,transform:"scale(0.222)",transformOrigin:"top left"},children:e.jsx(st,{data:E,template:m.key,accent:l,scaleToFit:!1})})}),e.jsx("p",{className:"mt-2 text-sm font-bold text-[#1a1a1a]",children:m.name}),e.jsx("p",{className:"text-[11px] text-gray-500 leading-snug",children:m.blurb})]},m.key))}),e.jsxs("div",{className:"mt-5",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"Accent colour"}),e.jsx("div",{className:"flex flex-wrap gap-2",children:Bt.map(m=>e.jsx("button",{title:m.name,onClick:()=>y(m.value),className:`w-9 h-9 rounded-full border-2 transition-transform hover:scale-110 ${l===m.value?"border-gray-900 scale-110":"border-white shadow"}`,style:{background:m.value}},m.key))})]})]}),e.jsxs("div",{className:"grid lg:grid-cols-2 gap-6 items-start",children:[e.jsxs("div",{className:"space-y-5",children:[e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mb-4",children:"1 · Your details"}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[[["name","Full name"],["title","Headline (e.g. Registered Nurse · ICU)"],["phone","Phone (with country code)"],["email","Email"],["location","City, country"],["specialty","Specialty / unit"],["linkedin","LinkedIn (optional)"],["portfolio","Portfolio / website (optional)"],["photoUrl","Photo URL (optional)"]].map(([m,C])=>e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:C}),e.jsx("input",{className:Q,value:r[m],onChange:k=>f(m,k.target.value)})]},m)),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Profession"}),e.jsx("select",{className:Q,value:r.profession,onChange:m=>f("profession",m.target.value),children:es.map(m=>e.jsx("option",{children:m},m))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Target country"}),e.jsx("select",{className:Q,value:r.country,onChange:m=>f("country",m.target.value),children:Zt.map(m=>e.jsx("option",{children:m},m))})]})]}),e.jsx(H,{onClick:O,disabled:w,className:"mt-5 w-full sm:w-auto",children:w?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 animate-spin"})," Writing your contentâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(Fs,{className:"w-4 h-4"})," Generate personalised content"]})})]}),e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2 mb-1",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a]",children:"2 · Build your sections"}),e.jsxs("button",{onClick:I,className:"inline-flex items-center gap-1 text-xs font-bold text-[#0b7fa3]",children:[e.jsx(Le,{className:"w-3.5 h-3.5"})," Custom section"]})]}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"Tick what you want on your resume, then reorder it. Every section is optional â build the page your way."}),e.jsx("div",{className:"flex flex-wrap gap-2 mb-5",children:Qt.map(m=>e.jsxs("button",{onClick:()=>v(m.key),title:m.hint,className:`rounded-full px-3 py-1.5 text-[12px] font-semibold border transition ${N(m.key)?"bg-[#F9A01B] text-white border-[#F9A01B] shadow-sm":"bg-white text-gray-600 border-gray-200 hover:border-[#2CC5F4]"}`,children:[N(m.key)?"â ":"+ ",m.label]},m.key))}),e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"Order on the page"}),e.jsxs("div",{className:"space-y-2",children:[b.map((m,C)=>e.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-gray-100 bg-white px-3 py-2",children:[e.jsx("span",{className:"w-6 h-6 rounded-lg bg-[#2CC5F4]/10 text-[#0b7fa3] text-[11px] font-bold grid place-items-center",children:C+1}),e.jsx("span",{className:"flex-1 text-sm font-semibold text-gray-800",children:Xe(m,r)}),e.jsx("button",{onClick:()=>A(m,-1),className:"p-1 text-gray-400 hover:text-[#0b7fa3]",children:e.jsx(fs,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>A(m,1),className:"p-1 text-gray-400 hover:text-[#0b7fa3]",children:e.jsx(bs,{className:"w-4 h-4"})}),e.jsx("button",{onClick:()=>v(m),className:"p-1 text-gray-300 hover:text-red-500",children:e.jsx(ve,{className:"w-4 h-4"})})]},m)),b.length===0&&e.jsx("button",{onClick:()=>f("order",[...We]),className:"text-xs font-bold text-[#0b7fa3]",children:"Restore recommended sections"})]})]}),N("summary")&&e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mb-4",children:"Professional summary"}),e.jsx("textarea",{className:`${Q} min-h-[120px]`,placeholder:"3â4 lines describing your specialty, years of experience and licence statusâ¦",value:r.summary,onChange:m=>f("summary",m.target.value)}),(c==null?void 0:c.summary)&&c.summary!==r.summary&&e.jsx("button",{onClick:()=>f("summary",c.summary),className:"mt-2 text-xs font-bold text-[#0b7fa3] underline",children:"Use AI suggestion"})]}),N("experience")&&e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a]",children:"Experience"}),e.jsxs("button",{onClick:()=>f("experience",[...r.experience,{role:"",employer:"",location:"",period:"",bullets:[""]}]),className:"inline-flex items-center gap-1 text-xs font-bold text-[#0b7fa3]",children:[e.jsx(Le,{className:"w-3.5 h-3.5"})," Add role"]})]}),e.jsx("div",{className:"space-y-5",children:r.experience.map((m,C)=>e.jsxs("div",{className:"rounded-xl border border-gray-100 p-4",children:[e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:[["role","Job title"],["employer","Employer"],["location","
54Location"],["period","Period (e.g. 2021 â Present)"]].map(([k,M])=>e.jsx("input",{className:Q,placeholder:M,value:m[k],onChange:X=>f("experience",r.experience.map((G,ee)=>ee===C?{...G,[k]:X.target.value}:G))},k))}),e.jsx("textarea",{className:`${Q} min-h-[110px] mt-3`,placeholder:"One achievement per lineâ¦",value:at(m.bullets),onChange:k=>f("experience",r.experience.map((M,X)=>X===C?{...M,bullets:k.target.value.split(` 55`)}:M))}),r.experience.length>1&&e.jsxs("button",{onClick:()=>f("experience",r.experience.filter((k,M)=>M!==C)),className:"mt-2 inline-flex items-center gap-1 text-xs font-semibold text-gray-400 hover:text-red-600",children:[e.jsx(it,{className:"w-3.5 h-3.5"})," Remove role"]})]},C))}),(P=c==null?void 0:c.bullets)!=null&&P.length?e.jsxs("div",{className:"mt-5 rounded-xl bg-gradient-to-br from-[#F7FBFF] to-white border border-gray-100 p-4",children:[e.jsxs("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:[e.jsx(ue,{className:"w-3 h-3 inline mr-1"}),"Suggested achievement lines"]}),e.jsx("ul",{className:"space-y-2",children:c.bullets.map((m,C)=>e.jsxs("li",{className:"flex items-start gap-2 text-sm text-gray-700",children:[e.jsx("button",{onClick:()=>f("experience",r.experience.map((k,M)=>M===0?{...k,bullets:[...k.bullets,m]}:k)),className:"text-[#0b7fa3] font-bold shrink-0",title:"Add to first role",children:e.jsx(Le,{className:"w-4 h-4"})}),m]},C))})]}):null]}),N("education")&&e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mb-4",children:"Education"}),e.jsxs("div",{className:"space-y-3",children:[r.education.map((m,C)=>e.jsx("div",{className:"grid sm:grid-cols-3 gap-3",children:[["degree","Degree"],["school","Institution"],["year","Year"]].map(([k,M])=>e.jsx("input",{className:Q,placeholder:M,value:m[k],onChange:X=>f("education",r.education.map((G,ee)=>ee===C?{...G,[k]:X.target.value}:G))},k))},C)),e.jsxs("button",{onClick:()=>f("education",[...r.education,{degree:"",school:"",year:""}]),className:"inline-flex items-center gap-1 text-xs font-bold text-[#0b7fa3]",children:[e.jsx(Le,{className:"w-3.5 h-3.5"})," Add education"]})]})]}),$t.some(m=>N(m))&&e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mb-1",children:"Lists"}),e.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"One item per line."}),$t.filter(m=>N(m)).map(m=>e.jsxs("label",{className:"block mt-4",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:Xe(m,r)}),e.jsx("textarea",{className:`${Q} min-h-[90px]`,value:at(r[m]),onChange:C=>f(m,Ga(C.target.value))})]},m)),(B=c==null?void 0:c.keywords)!=null&&B.length?e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"ATS keywords to include"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:c.keywords.map(m=>e.jsx(L,{tone:"orange",children:m},m))})]}):null]}),N("references")&&e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mb-4",children:"References"}),e.jsx("textarea",{className:`${Q} min-h-[80px]`,placeholder:"Available on request â or list referee name, title and contact.",value:r.references,onChange:m=>f("references",m.target.value)})]}),r.customSections.length>0&&e.jsxs(F,{className:"p-6 space-y-5",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a]",children:"Custom sections"}),r.customSections.map(m=>e.jsxs("div",{className:"rounded-xl border border-gray-100 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{className:Q,value:m.title,placeholder:"Section title",onChange:C=>f("customSections",r.customSections.map(k=>k.id===m.id?{...k,title:C.target.value}:k))}),e.jsx("button",{onClick:()=>j(m.id),className:"p-2 text-gray-300 hover:text-red-500",children:e.jsx(it,{className:"w-4 h-4"})})]}),e.jsx("textarea",{className:`${Q} min-h-[90px] mt-3`,placeholder:"One line per pointâ¦",value:at(m.items),onChange:C=>f("customSections",r.customSections.map(k=>k.id===m.id?{...k,items:C.target.value.split(` 56`)}:k))})]},m.id))]}),(T=c==null?void 0:c.tips)!=null&&T.length?e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading text-lg font-bold text-[#1a1a1a] mb-3",children:"Recruiter tips for you"}),e.jsx("ul",{className:"space-y-2",children:c.tips.map((m,C)=>e.jsx("li",{className:"border-l-2 border-[#F9A01B] pl-3 text-sm text-gray-700",children:m},C))})]}):null]}),e.jsxs("div",{className:"lg:sticky lg:top-24 space-y-4",children:[e.jsx(Ve,{children:e.jsxs(F,{className:"p-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3 gap-2 flex-wrap",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500",children:"Live A4 preview"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>u(!0),className:"inline-flex items-center gap-1 text-[11px] font-bold text-[#0b7fa3]",children:[e.jsx(dt,{className:"w-3.5 h-3.5"})," Full size"]}),e.jsx(L,{tone:"blue",children:(D=Mt.find(m=>m.key===i))==null?void 0:D.name})]})]}),e.jsx("div",{className:"rounded-xl overflow-hidden border border-gray-200 shadow-lg bg-white",children:e.jsx(st,{data:r,template:i,accent:l,printable:!0})})]})}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsxs(H,{onClick:S,children:[e.jsx(Ps,{className:"w-4 h-4"})," Download PDF"]}),e.jsxs(H,{variant:"outline",onClick:W,children:[e.jsx(Gt,{className:"w-4 h-4"})," Save to my hub"]})]}),e.jsxs("p",{className:"text-xs text-gray-400",children:['"Download PDF" opens your browser print dialog â choose ',e.jsx("strong",{children:"Save as PDF"}),', A4, margins "None". AI content is a suggestion: always check every line is true for you before sending it to an employer.']})]})]}),x&&e.jsxs("div",{className:"fixed inset-0 z-[100] bg-black/70 backdrop-blur-sm overflow-auto p-4 sm:p-8",onClick:()=>u(!1),children:[e.jsx("button",{className:"fixed top-4 right-4 z-10 rounded-full bg-white p-2 shadow-lg",onClick:()=>u(!1),children:e.jsx(ve,{className:"w-5 h-5"})}
56),e.jsx("div",{className:"mx-auto shadow-2xl",style:{width:794},onClick:m=>m.stopPropagation(),children:e.jsx(st,{data:r,template:i,accent:l,scaleToFit:!1})})]})]})},Xa=".pdf,.docx,.doc,.txt,.rtf,.md",Ya=8*1024*1024,Va=t=>new Promise((s,n)=>{const a=new FileReader;a.onload=()=>s(String(a.result??"")),a.onerror=()=>n(new Error("Could not read the file")),a.readAsText(t)}),Wa=async t=>{const s=await ot(()=>import("./pdf-CZ9a0SDA.js"),[]),n=(await ot(async()=>{const{default:i}=await import("./pdf.worker.min-CevBI0zc.js");return{default:i}},[])).default;s.GlobalWorkerOptions.workerSrc=n;const a=await t.arrayBuffer(),r=await s.getDocument({data:a}).promise,o=[];for(let i=1;i<=Math.min(r.numPages,12);i++){const l=await(await r.getPage(i)).getTextContent();o.push(l.items.map(y=>"str"in y?y.str:"").join(" ").replace(/\s+/g," "))}return o.join(` 57 58`)},za=async t=>{const s=await ot(()=>import("./mammoth.browser-B8MH9hJW.js").then(r=>r.m),__vite__mapDeps([0,1,2])),n=await t.arrayBuffer();return(await s.extractRawText({arrayBuffer:n})).value??""};async function Qa(t){if(t.size>Ya)throw new Error("File is larger than 8MB");const s=t.name.toLowerCase();let n="";if(s.endsWith(".pdf"))n=await Wa(t);else if(s.endsWith(".docx"))n=await za(t);else if(/\.(txt|md|rtf)$/.test(s))n=await Va(t);else throw s.endsWith(".doc")?new Error("Old .doc files aren't supported â save as PDF or DOCX first"):new Error("Unsupported file. Upload PDF, DOCX or TXT");if(n=n.replace(/\u0000/g,"").trim(),n.length<80)throw new Error("We couldn't read enough text â the file may be a scanned image. Paste the text instead.");return n.slice(0,2e4)}const Ka=({onAnalyzed:t})=>{var A,I,j,q,O,W;const[s,n]=d.useState("United Arab Emirates"),[a,r]=d.useState("Registered Nurse"),[o,i]=d.useState(""),[h,l]=d.useState(""),[y,w]=d.useState(!1),[g,c]=d.useState(!1),[p,x]=d.useState(!1),[u,f]=d.useState(null),b=d.useRef(null),N=async S=>{if(S){w(!0);try{const E=await Qa(S);i(E),l(S.name),R.success(`${S.name} read â ${E.split(/\s+/).length} words extracted`)}catch(E){R.error(E instanceof Error?E.message:"Could not read that file")}finally{w(!1)}}},v=async()=>{if(o.trim().length<80){R.error("Upload a CV file or paste at least a few lines of your CV");return}c(!0),f(null);try{const{data:S,error:E}=await $.functions.invoke("resume-ai",{body:{mode:"analyze",country:s,profession:a,resume:o.slice(0,2e4)}});if(E)throw E;if(S!=null&&S.error)throw new Error(S.error);f(S.data),t==null||t(S.data,{country:s,profession:a})}catch(S){R.error(S instanceof Error?S.message:"Analysis failed â please retry")}finally{c(!1)}};return e.jsxs("div",{className:"space-y-5",children:[e.jsxs(F,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsxs(L,{tone:"blue",children:[e.jsx(ue,{className:"w-3 h-3"})," AI CV audit"]}),e.jsx(L,{tone:"gray",children:"PDF · DOCX · TXT"})]}),e.jsxs("div",{onDragOver:S=>{S.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:S=>{var E;S.preventDefault(),x(!1),N((E=S.dataTransfer.files)==null?void 0:E[0])},onClick:()=>{var S;return(S=b.current)==null?void 0:S.click()},className:`cursor-pointer rounded-2xl border-2 border-dashed p-8 text-center transition ${p?"border-[#2CC5F4] bg-[#2CC5F4]/5 scale-[1.01]":"border-gray-200 hover:border-[#2CC5F4]/60 hover:bg-[#F7FBFF]"}`,children:[e.jsx("input",{ref:b,type:"file",accept:Xa,className:"hidden",onChange:S=>{var E;return void N((E=S.target.files)==null?void 0:E[0])}}),y?e.jsxs("div",{className:"flex flex-col items-center gap-2 text-gray-600",children:[e.jsx(ie,{className:"w-7 h-7 animate-spin text-[#2CC5F4]"}),e.jsx("p",{className:"text-sm font-semibold",children:"Reading your documentâ¦"})]}):h?e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(qt,{className:"w-8 h-8 text-[#0b7fa3]"}),e.jsx("p",{className:"text-sm font-bold text-[#1a1a1a]",children:h}),e.jsxs("button",{className:"inline-flex items-center gap-1 text-xs font-semibold text-gray-500 hover:text-red-600",onClick:S=>{S.stopPropagation(),l(""),i(""),f(null)},children:[e.jsx(ve,{className:"w-3 h-3"})," Remove"]})]}):e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("span",{className:"grid place-items-center w-12 h-12 rounded-2xl bg-gradient-to-br from-[#2CC5F4]/15 to-[#F9A01B]/15",children:e.jsx(Ns,{className:"w-5 h-5 text-[#0b7fa3]"})}),e.jsx("p",{className:"text-sm font-bold text-[#1a1a1a]",children:"Drop your CV here or click to upload"}),e.jsx("p",{className:"text-xs text-gray-500",children:"PDF, DOCX or TXT · up to 8MB · we read the text in your browser"})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4 mt-5",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Target country"}),e.jsx("select",{className:Q,value:s,onChange:S=>n(S.target.value),children:Zt.map(S=>e.jsx("option",{children:S},S))})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Profession"}),e.jsx("select",{className:Q,value:a,onChange:S=>r(S.target.value),children:es.map(S=>e.jsx("option",{children:S},S))})]})]}),e.jsxs("label",{className:"block mt-4",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Or paste your CV text"}),e.jsx("textarea",{className:`${Q} min-h-[150px]`,placeholder:"Paste the full text of your existing CV hereâ¦",value:o,onChange:S=>{i(S.target.value),l("")}})]}),e.jsx(H,{onClick:v,disabled:g||y,className:"mt-5 w-full sm:w-auto",children:g?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 animate-spin"})," Auditing your CVâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"w-4 h-4"})," Analyse my CV"]})})]}),u&&e.jsx(Ve,{children:e.jsxs(F,{className:"p-6 sm:p-7",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row gap-6 items-start",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx(Se,{value:u.score??0,label:`${u.score??0}`,sub:"market fit",size:120}),e.jsx(Se,{value:u.ats_score??0,label:`${u.ats_score??0}`,sub:"ATS score",size:120})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-heading text-xl font-bold text-[#1a1a1a]",children:u.verdict}),e.jsx("p",{className:"text-sm text-gray-600 mt-2 leading-relaxed",children:u.market_fit}),(A=u.missing_keywords)!=null&&A.length?e.jsxs("div",{className:"mt-4",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"Missing keywords"}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:u.missing_keywords.map(S=>e.jsx(L,{tone:"orange",children:S},S))})]}):null]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-5 mt-7",children:[(I=u.strengths)!=null&&I.length?e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"What's working"}),e.jsx("ul",{className:"space-y-2",children:u.strengths.map((S,E)=>e.jsxs("li",{className:"flex gap-2 text-sm text-gray-700",children:[e.jsx(me,{className:"w-4 h-4 text-emerald-500 shrink-0 mt-0.5"}),S]},E))})]}):null,(j=u.gaps)!=null&&j.length?e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"Fix these first"}),e.jsx("ul",{className:"space-y-2",children:u.gaps.map((S,E)=>e.jsxs("li",{className:"flex gap-2 text-sm text-gray-700",children:[e.jsx(Ht,{className:"w-4 h-4 text-[#F9A01B] shrink-0 mt-0.5"}),e.jsxs("span",{children:[e.jsx("span",{className:"font-semibold",children:S.issue})," â ",S.fix]})]},E))})]}):null]}),(q=u.value_add)!=null&&q.length?e.jsxs("div",{className:"mt-7",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"Value-added content to add"}),e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:u.value_add.map((S,E)=>e.jsx("div",{className:"rounded-xl border border-gray-100 bg-gradient-to-br from-[#F7FBFF] to-white p-3 text-sm text-gray-700",children:S},E))})]}):null,(O=u.rewrites)!=null&&O.length?e.jsxs("div",{className:"mt-7",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-wide text-gray-500 mb-2",children:"Line rewrites"}),e.jsx("div",{className:"space-y-3",children:u.rewrites.map((S,E)=>e.jsxs("div",{className:"rounded-xl border border-gray-100 p-3",children:[e.jsx("p",{className:"text-xs text-gray-400 line-through",children:S.before}
58),e.jsx("p",{className:"text-sm text-gray-800 font-medium mt-1",children:S.after})]},E))})]}):null,(W=u.next_steps)!=null&&W.length?e.jsx("ol",{className:"mt-7 space-y-3",children:u.next_steps.map((S,E)=>e.jsx("li",{className:"border-l-2 border-[#F9A01B] pl-4 text-sm text-gray-700",children:S},E))}):null,e.jsx("p",{className:"text-xs text-gray-400 mt-6",children:"This is an AI review based on current GCC hiring patterns. Shortlisting always depends on your experience, licence status and each employer's own criteria."})]})})]})},Ja=({toolKey:t})=>{const[s,n]=d.useState("build"),[a,r]=d.useState(null),[o,i]=d.useState(),h=[{key:"build",label:"Resume Builder",icon:qt,sub:"Build a standardised CV in minutes"},{key:"analyze",label:"Resume Analyzer",icon:Cs,sub:"Already have a CV? Audit it for the GCC"}];return e.jsxs("div",{className:"space-y-6",children:[e.jsx("div",{className:"grid sm:grid-cols-2 gap-3",children:h.map(l=>e.jsxs("button",{onClick:()=>n(l.key),className:`rounded-2xl border-2 p-4 text-left transition-all ${s===l.key?"border-[#F9A01B] bg-white shadow-lg -translate-y-0.5":"border-gray-200 bg-white/70 hover:border-[#2CC5F4]/60"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(l.icon,{className:`w-4 h-4 ${s===l.key?"text-[#F9A01B]":"text-gray-400"}`}),e.jsx("span",{className:"font-heading font-bold text-[#1a1a1a]",children:l.label})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:l.sub})]},l.key))}),s==="build"?e.jsx(Ua,{toolKey:t}):e.jsx(Ka,{onAnalyzed:(l,y)=>{r(y),i(l.score)}}),s==="analyze"&&a&&e.jsx(Ue,{toolKey:"resume-analyzer",country:a.country,profession:a.profession,values:a,score:o})]})},rt="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 placeholder:text-gray-400 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",Za=({result:t})=>e.jsx(F,{className:"p-6 sm:p-8",children:e.jsxs("div",{className:"flex flex-col sm:flex-row items-start gap-6",children:[typeof t.score=="number"&&e.jsx(Se,{value:t.score,label:`${t.score}`,sub:t.scoreLabel??"score",size:130}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"font-heading text-xl font-bold text-[#1a1a1a]",children:t.headline}),t.stats&&e.jsx("div",{className:"grid sm:grid-cols-2 gap-3 mt-5",children:t.stats.map(s=>e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-gradient-to-br from-[#F7FBFF] to-white p-3",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:s.label}),e.jsx("p",{className:"font-semibold text-[#1a1a1a] mt-0.5",children:s.value})]},s.label))}),t.steps&&e.jsx("ol",{className:"mt-5 space-y-3",children:t.steps.map(s=>e.jsxs("li",{className:"border-l-2 border-[#F9A01B] pl-4",children:[e.jsx("p",{className:"font-semibold text-[#1a1a1a] text-sm",children:s.title}),e.jsx("p",{className:"text-sm text-gray-600",children:s.detail})]},s.title))}),t.bullets&&e.jsx("ul",{className:"mt-5 space-y-2",children:t.bullets.map((s,n)=>e.jsx("li",{className:"text-sm text-gray-700 leading-relaxed",children:s},n))}),t.note&&e.jsx("p",{className:"text-xs text-gray-400 mt-5",children:t.note})]})]})}),er=()=>{var u,f;const{toolKey:t=""}=cs(),s=Ws(t),{progress:n,awardXp:a,saveToolProgress:r,grantBadge:o}=V(),i=(u=n[t])==null?void 0:u.data,[h,l]=d.useState((i==null?void 0:i.values)??{}),[y,w]=d.useState((i==null?void 0:i.result)??null),[g,c]=d.useState(!1);if(!s)return e.jsxs(F,{className:"p-8 text-center",children:[e.jsx("p",{className:"text-gray-600",children:"That tool doesn't exist."}),e.jsx(J,{to:"/career-hub/tools",className:"text-[#0b7fa3] font-bold underline mt-3 inline-block",children:"Back to tools"})]});const p=async()=>{const b=(s.fields??[]).filter(A=>{var I;return A.required&&!((I=h[A.key])!=null&&I.toString().trim())});if(b.length){R.error(`Please fill: ${b.map(A=>A.label).join(", ")}`);return}c(!0);const N=s.compute(h);if(w(N),await r(s.key,{values:h,result:N}),await o("career_explorer"),s.key==="salary-calculator"&&await o("salary_expert"),s.key==="eligibility-checker"){const A=h.country??"";["United Arab Emirates","Saudi Arabia","Qatar","Kuwait","Oman","Bahrain"].includes(A)&&await o("gcc_ready"),A==="Germany"&&await o("germany_ready")}if(Object.values(n).filter(A=>A.completed).length+1>=8&&await o("career_champion"),s.xpKey){const A=await a(s.xpKey);A&&R.success(`+${A} XP earned`)}c(!1)},x=()=>{switch(s.custom){case"quiz":return e.jsx(xa,{toolKey:s.key});case"spin":return e.jsx(ga,{toolKey:s.key});case"challenge":return e.jsx(ya,{toolKey:s.key});case"gallery":return e.jsx(zt,{});case"passport":return e.jsx(fa,{});case"progress":return e.jsx(ba,{});case"growth":return e.jsx(ja,{toolKey:s.key});case"memory":return e.jsx(wa,{toolKey:s.key});case"speed":return e.jsx(Na,{toolKey:s.key});case"word":return e.jsx(ka,{toolKey:s.key});case"salary":return e.jsx($a,{toolKey:s.key});case"resume":return e.jsx(Ja,{toolKey:s.key});default:return null}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(J,{to:"/career-hub/tools",className:"inline-flex items-center gap-2 text-sm font-semibold text-gray-500 hover:text-gray-800",children:[e.jsx(ds,{className:"w-4 h-4"})," All tools"]}),e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("span",{className:"grid place-items-center w-14 h-14 roun
58ded-2xl bg-gradient-to-br from-[#2CC5F4]/15 to-[#F9A01B]/15 text-3xl shrink-0",children:s.emoji}),e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-2xl sm:text-3xl font-extrabold text-[#1a1a1a]",children:s.name}),e.jsx("p",{className:"text-gray-600 text-sm mt-1",children:s.tagline}),((f=n[s.key])==null?void 0:f.completed)&&e.jsx("div",{className:"mt-2",children:e.jsxs(L,{tone:"green",children:["Progress saved · ",n[s.key].runs," run(s)"]})})]})]}),s.custom?e.jsxs(e.Fragment,{children:[x(),s.custom!=="salary"&&s.custom!=="resume"&&e.jsx(Ue,{toolKey:s.key,country:h.country,profession:h.profession,values:h})]}):e.jsxs(e.Fragment,{children:[e.jsxs(F,{className:"p-6 sm:p-8",children:[e.jsx("div",{className:"grid sm:grid-cols-2 gap-5",children:(s.fields??[]).map(b=>{var N;return e.jsxs("label",{className:b.type==="textarea"?"sm:col-span-2 block":"block",children:[e.jsxs("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:[b.label,b.required&&e.jsx("span",{className:"text-[#F9A01B]",children:" *"})]}),b.type==="select"?e.jsxs("select",{className:rt,value:h[b.key]??"",onChange:v=>l(A=>({...A,[b.key]:v.target.value})),children:[e.jsx("option",{value:"",children:"Selectâ¦"}),(N=b.options)==null?void 0:N.map(v=>e.jsx("option",{children:v},v))]}):b.type==="textarea"?e.jsx("textarea",{className:`${rt} min-h-[180px]`,placeholder:b.placeholder,value:h[b.key]??"",onChange:v=>l(A=>({...A,[b.key]:v.target.value}))}):e.jsx("input",{className:rt,type:b.type,placeholder:b.placeholder,value:h[b.key]??"",onChange:v=>l(A=>({...A,[b.key]:v.target.value}))}),b.help&&e.jsx("span",{className:"block text-[12px] text-gray-500 mt-1",children:b.help})]},b.key)})}),e.jsx(H,{onClick:p,disabled:g,className:"mt-6 w-full sm:w-auto",children:g?"Workingâ¦":y?"Run again":"Get my result"})]}),y&&e.jsx(Za,{result:y}),y&&e.jsx(Ue,{toolKey:s.key,country:h.country??h.a,profession:h.profession,values:h,score:y.score})]})]})},tr=()=>{const{badges:t}=V();return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-3xl font-extrabold text-[#1a1a1a]",children:"Achievements"}),e.jsxs("p",{className:"text-gray-600 mt-2 text-sm",children:[t.length," of ",ke.length," badges unlocked."]})]}),e.jsx(zt,{})]})},It=t=>`https://api.qrserver.com/v1/create-qr-code/?size=220x220&margin=0&data=${encodeURIComponent(t)}`,sr=()=>{const{member:t,user:s,refresh:n}=V(),[a,r]=d.useState(null),[o,i]=d.useState(!1),h=d.useRef(null);if(d.useEffect(()=>{s!=null&&s.id&&$.from("career_gold_cards").select("card_number, issued_at, approved, xp_at_issue").eq("user_id",s.id).maybeSingle().then(({data:g})=>r(g??null))},[s==null?void 0:s.id]),!t)return null;const l=t.xp>=xe,y=async()=>{if(!(s!=null&&s.id))return;i(!0);const g=`HSG-${new Date().getFullYear()}-${t.member_id.split("-").pop()}`,{error:c}=await $.from("career_gold_cards").insert({user_id:s.id,card_number:g,xp_at_issue:t.xp});if(i(!1),c){R.error("Could not issue your card. Please try again.");return}r({card_number:g,issued_at:new Date().toISOString(),approved:!1,xp_at_issue:t.xp}),await n(),R.success("Your Healthserve Gold Card has been issued.")},w=async()=>{if(!h.current)return;const c=document.createElement("canvas"),p=1e3,x=620;c.width=p,c.height=x;const u=c.getContext("2d"),f=u.createLinearGradient(0,0,p,x);f.addColorStop(0,"#1c1c1c"),f.addColorStop(.55,"#3a2c10"),f.addColorStop(1,"#F9A01B"),u.fillStyle=f,u.fillRect(0,0,p,x),u.fillStyle="rgba(255,255,255,0.9)",u.font="bold 26px sans-serif",u.fillText("HEALTHSERVE",60,80),u.font="500 18px sans-serif",u.fillStyle="rgba(255,255,255,0.7)",u.fillText("GOLD MEMBERSHIP",60,110),u.fillStyle="#ffffff",u.font="bold 52px sans-serif",u.fillText(t.full_name,60,250),u.font="500 22px monospace",u.fillStyle="rgba(255,255,255,0.85)",u.fillText(`Member ID: ${t.member_id}`,60,300),u.fillText(`Card No: ${(a==null?void 0:a.card_number)??"-"}`,60,340),u.fillText(`XP: ${t.xp.toLocaleString()}`,60,380),u.fillText(`Issued: ${new Date((a==null?void 0:a.issued_at)??Date.now()).toLocaleDateString()}`,60,420),u.fillText("Status: GOLD",60,460),u.font="500 16px sans-serif",u.fillStyle="rgba(255,255,255,0.65)",u.fillText("Present this card to the Healthserve team for verification.",60,545);try{const A=await(await fetch(It(`HEALTHSERVE-GOLD|${t.member_id}|${(a==null?void 0:a.card_number)??""}|${t.xp}`))).blob(),I=await createImageBitmap(A);u.fillStyle="#ffffff",u.fillRect(700,200,240,240),u.drawImage(I,710,210,220,220)}catch{}const b=c.toDataURL("image/png"),N=document.createElement("a");N.href=b,N.download=`healthserve-gold-${t.member_id}.png`,N.click(),R.success("Gold Card downloaded. Send it to the Healthserve team for verification.")};return e.jsxs("div",{className:"space-y-6 max-w-3xl",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-3xl font-extrabold text-[#1a1a1a]",children:"Healthserve Gold"}),e.jsx("p",{className:"text-gray-600 mt-2 text-sm",children:"Reach 5,
58000 XP to unlock your premium digital Gold Card."})]}),!l&&e.jsxs(F,{className:"p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 font-bold text-[#a3660b]",children:[e.jsx(Oe,{className:"w-5 h-5"})," ",(xe-t.xp).toLocaleString()," XP to go"]}),e.jsxs("div",{className:"mt-4",children:[e.jsx(Ge,{pct:Math.round(t.xp/xe*100)}),e.jsxs("p",{className:"text-[11px] font-mono text-gray-500 mt-1.5",children:[t.xp.toLocaleString()," / ",xe.toLocaleString()," XP"]})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{ref:h,className:"relative overflow-hidden rounded-3xl p-7 text-white shadow-2xl",style:{background:"linear-gradient(135deg,#1c1c1c 0%,#3a2c10 55%,#F9A01B 100%)"},children:[e.jsxs("div",{className:"flex justify-between items-start",children:[e.jsxs("div",{children:[e.jsx("img",{src:ye,alt:"Healthserve",className:"h-8 w-auto brightness-0 invert opacity-90"}),e.jsx("p",{className:"text-[11px] tracking-[0.25em] mt-2 opacity-70",children:"GOLD MEMBERSHIP"})]}),e.jsx(Oe,{className:"w-8 h-8 text-[#F9A01B]"})]}),e.jsxs("div",{className:"mt-8 grid sm:grid-cols-[1fr_auto] gap-6 items-end",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"font-heading text-2xl sm:text-3xl font-extrabold",children:t.full_name}),e.jsxs("div",{className:"mt-3 space-y-1 font-mono text-xs opacity-85",children:[e.jsxs("p",{children:["Member ID · ",t.member_id]}),e.jsxs("p",{children:["Card No · ",(a==null?void 0:a.card_number)??"Not issued"]}),e.jsxs("p",{children:["XP · ",t.xp.toLocaleString()]}),e.jsxs("p",{children:["Issued · ",a?new Date(a.issued_at).toLocaleDateString():"â"]}),e.jsxs("p",{children:["Status · ",a!=null&&a.approved?"GOLD (VERIFIED)":"GOLD"]})]})]}),e.jsx("div",{className:"bg-white rounded-xl p-2 justify-self-start sm:justify-self-end",children:e.jsx("img",{src:It(`HEALTHSERVE-GOLD|${t.member_id}|${(a==null?void 0:a.card_number)??""}|${t.xp}`),alt:"Gold membership QR code",className:"w-28 h-28"})})]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[a?e.jsxs(H,{onClick:w,children:[e.jsx(Gt,{className:"w-4 h-4"})," Download Gold Card"]}):e.jsxs(H,{onClick:y,disabled:o,children:[o?e.jsx(ie,{className:"w-4 h-4 animate-spin"}):e.jsx(Oe,{className:"w-4 h-4"})," Issue my Gold Card"]}),a&&(a.approved?e.jsx(L,{tone:"green",children:"Verified by Healthserve"}):e.jsx(L,{tone:"orange",children:"Pending verification"}))]}),e.jsxs(F,{className:"p-6",children:[e.jsx("h3",{className:"font-heading font-bold text-[#1a1a1a]",children:"Your Gold benefits"}),e.jsxs("ul",{className:"mt-3 space-y-2 text-sm text-gray-700",children:[e.jsx("li",{children:"â 5% discount on eligible Healthserve services"}),e.jsx("li",{children:"â Priority consultation slots"}),e.jsx("li",{children:"â Early access to webinars"}),e.jsx("li",{children:"â Exclusive resources and study material"})]}),e.jsxs("p",{className:"mt-4 rounded-xl bg-[#F9A01B]/10 border border-[#F9A01B]/25 p-4 text-sm text-[#7a4d08]",children:[e.jsx("strong",{children:"Important:"})," the discount is not applied automatically. Download your Gold Card and send it to the Healthserve team. Once our team verifies it manually, your discount is approved."]})]})]})]})},he="w-full rounded-xl border border-gray-200 bg-white px-4 py-3 text-[15px] text-gray-900 outline-none focus:border-[#2CC5F4] focus:ring-4 focus:ring-[#2CC5F4]/15 transition",ar=()=>{const{member:t,badges:s,progress:n,mission:a,awardXp:r,refresh:o}=V(),[i,h]=d.useState({full_name:(t==null?void 0:t.full_name)??"",phone:(t==null?void 0:t.phone)??"",country:(t==null?void 0:t.country)??"",city:(t==null?void 0:t.city)??""}),[l,y]=d.useState(!1);if(!t)return null;const w=Te(t.xp),g=Object.entries(n).filter(([,p])=>p.completed),c=async()=>{y(!0);const{error:p}=await $.from("career_members").update(i).eq("user_id",t.user_id);if(y(!1),p)return R.error(p.message);if(i.full_name&&i.phone&&i.country&&i.city){const u=await r("profile_completion");u?R.success(`Profile saved â +${u} XP`):R.success("Profile saved")}else R.success("Profile saved");await o()};return e.jsxs("div",{className:"space-y-6 max-w-4xl",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"font-heading text-3xl font-extrabold text-[#1a1a1a]",children:"My profile"}),e.jsxs("p",{className:"text-gray-600 mt-2 text-sm",children:["Member since ",new Date(t.registered_at).toLocaleDateString()]})]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-5",children:[e.jsxs(F,{className:"p-6",children:[e.jsx(ge,{title:"Account details"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Full name"}),e.jsx("input",{className:he,value:i.full_name,onChange:p=>h({...i,full_name:p.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Username"}),e.jsx("input",{className:`${he} bg-gray-50 text-gray-500`,value:t.username,disabled:!0})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Member ID"}),e.jsx("input",{className:`${he} bg-gray-50 font-mono text-gray-500`,value:t.member_id,disabled:!0})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Email"}),e.jsx("input",{className:`${he} bg-gray-50 text-gray-500`,value:t.email,disabled:!0})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Mobile"}),e.jsx("input",{className:he,value:i.phone,onChange:p=>h({...i,phone:p.target.value})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"Country"}),e.jsx("input",{className:he,value:i.country,onChange:p=>h({...i,country:p.target.value})})]}),e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"block text-[12px] font-bold uppercase tracking-wide text-gray-600 mb-1.5",children:"City"}),e.jsx("input",{className:he,value:i.city,onChange:p=>h({...i,city:p.target.value})})]})]}),e.jsx(H,{onClick:c,disabled:l,children:l?"Savingâ¦":"Save profile"})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs(F,{className:"p-6",children:[e.jsx(ge,{title:"Career status"}),e.jsx("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[["Level",`${w.current.level} · ${w.current.name}
58`],["XP",t.xp.toLocaleString()],["Streak",`${t.streak_count} days`],["Status",t.status],["Gold",t.gold_approved?"Verified":t.gold_unlocked?"Unlocked":"Locked"],["Badges",`${s.length}/${ke.length}`]].map(([p,x])=>e.jsxs("div",{className:"rounded-xl border border-gray-100 bg-gradient-to-br from-[#F7FBFF] to-white p-3",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:p}),e.jsx("p",{className:"font-semibold text-[#1a1a1a] mt-0.5 capitalize",children:x})]},p))})]}),e.jsxs(F,{className:"p-6",children:[e.jsx(ge,{title:"Completed tools",subtitle:`${g.length} of ${ce.length}`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[g.length===0&&e.jsx("p",{className:"text-sm text-gray-500",children:"No tools completed yet."}),g.map(([p])=>{var x;return e.jsx(L,{tone:"green",children:((x=ce.find(u=>u.key===p))==null?void 0:x.name)??p},p)})]})]}),e.jsxs(F,{className:"p-6",children:[e.jsx(ge,{title:"Upcoming mission"}),a?e.jsxs("p",{className:"text-sm text-gray-700",children:[a.title," · ",e.jsxs("strong",{children:["+",a.xp_reward," XP"]})," ",a.completed&&e.jsx(L,{tone:"green",children:"Done"})]}):e.jsx("p",{className:"text-sm text-gray-500",children:"A new mission arrives each day."})]})]})]})]})},yr=()=>e.jsxs($s,{children:[e.jsx(ms,{title:"Healthserve Career Hub | Gamified Healthcare Career Platform",description:"Track your licensing journey, earn XP, unlock badges and reach Healthserve Gold with free AI-powered healthcare career tools.",path:"/career-hub"}),e.jsx(Is,{children:e.jsxs(us,{children:[e.jsx(K,{index:!0,element:e.jsx(wt,{to:"dashboard",replace:!0})}),e.jsx(K,{path:"login",element:e.jsx(Os,{})}),e.jsx(K,{path:"register",element:e.jsx(Zs,{})}),e.jsx(K,{path:"forgot-password",element:e.jsx(ta,{})}),e.jsx(K,{path:"reset-password",element:e.jsx(sa,{})}),e.jsxs(K,{element:e.jsx(qs,{}),children:[e.jsx(K,{path:"dashboard",element:e.jsx(aa,{})}),e.jsx(K,{path:"tools",element:e.jsx(la,{})}),e.jsx(K,{path:"tools/:toolKey",element:e.jsx(er,{})}),e.jsx(K,{path:"achievements",element:e.jsx(tr,{})}),e.jsx(K,{path:"gold",element:e.jsx(sr,{})}),e.jsx(K,{path:"profile",element:e.jsx(ar,{})})]}),e.jsx(K,{path:"*",element:e.jsx(wt,{to:"dashboard",replace:!0})})]})})]});export{yr as default};
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.