1import{aQ as E,a4 as F,e as q,aA as T,r as t,s as c,j as e,N as R,C as z,I as B,B as j,J as P,A as Q}from"./index-BPJdZEqy.js";import{T as D}from"./target-D0SWPVb9.js";import{C as L}from"./circle-check-D2z1cvsn.js";function $(){const{itemId:i}=E(),[N]=F(),d=N.get("courseId"),o=q(),{toast:x}=T(),[v,w]=t.useState(!0),[u,g]=t.useState(!1),[b,f]=t.useState(""),[k,y]=t.useState(""),[p,C]=t.useState(""),[l,A]=t.useState({target_questions:5,time_per_question_seconds:30,passing_percentage:50}),a=i==="course-final";t.useEffect(()=>{S()},[i,d]);const S=async()=>{try{const{data:{session:s}}=await c.auth.getSession();if(!s){o("/auth");return}const{data:r}=await c.from("courses").select("name, slug, assessment_config").eq("id",d??"").single();if(r&&(y(r.name),C(r.slug),A(r.assessment_config||l),a&&f("Final Assessment")),!a&&i){const{data:n}=await c.from("curriculum_items").select("title").eq("id",i).single();n&&f(n.title)}}catch(s){console.error("Error loading info:",s),x({title:"Error",description:"Failed to load assessment information",variant:"destructive"})}finally{w(!1)}},_=async()=>{g(!0);try{const{data:{session:s}}=await c.auth.getSession();if(!s){o("/auth");return}const{data:r,error:n}=await c.functions.invoke("start-adaptive-assessment",{body:{curriculumItemId:a?null:i,courseId:d,isCourseFinalAssessment:a}});if(n){let m=n.message||"Failed to start assessment";const h=n.context;if(h)try{m=(await h.clone().json()).error||m}catch{}throw new Error(m)}o(`/assessments/adaptive/${r.sessionId}`)}catch(s){console.error("Error starting assessment:",s),x({title:"Error",description:s.message||"Failed to start assessment",variant:"destructive"})}finally{g(!1)}};if(v)return e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{backgroundColor:"#f5f5f5",backgroundImage:"radial-gradient(circle, #d1d1d1 1px, transparent 1px)",backgroundSize:"24px 24px"},children:e.jsx("div",{className:"text-center text-foreground/60 tracking-widest uppercase text-sm",children:"Loading..."})});const I=Math.ceil(l.target_questions*l.time_per_question_seconds/60);return e.jsxs("div",{className:"min-h-screen",style:{backgroundColor:"#f5f5f5",backgroundImage:"radial-gradient(circle, #d1d1d1 1px, transparent 1px)",backgroundSize:"24px 24px"},children:[e.jsx(R,{}),e.jsxs("div",{className:"container mx-auto px-4 py-16 md:py-24 max-w-7xl",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4 mb-12",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-5 py-2.5 rounded-full border border-foreground
1/20 bg-white text-sm font-medium tracking-widest uppercase",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-foreground"}),"Ready"]}),e.jsx("span",{className:"text-sm font-medium tracking-widest uppercase text-foreground/60",children:a?"Final Assessment":"Course Assessment"})]}),e.jsxs("div",{className:"grid lg:grid-cols-5 gap-12 lg:gap-16",children:[e.jsxs("div",{className:"lg:col-span-3 space-y-8",children:[e.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight leading-[1.1]",children:a?"Complete Your Assessment":b||"Course Assessment"}),e.jsx("p",{className:"text-lg md:text-xl text-foreground/60 max-w-xl leading-relaxed",children:k}),e.jsxs("div",{className:"flex flex-wrap items-end gap-8 pt-8 border-t border-foreground/10",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"w-2 h-2 rounded-full bg-foreground"}),e.jsx("span",{className:"text-sm font-medium tracking-widest uppercase",children:"Adaptive"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium tracking-widest uppercase text-foreground/50 mb-1",children:"Questions"}),e.jsxs("p",{className:"text-3xl font-bold",children:["~",l.target_questions]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium tracking-widest uppercase text-foreground/50 mb-1",children:"Duration"}),e.jsxs("p",{className:"text-3xl font-bold",children:["~",I," min"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium tracking-widest uppercase text-foreground/50 mb-1",children:"Passing"}),e.jsxs("p",{className:"text-3xl font-bold",children:[l.passing_percentage,"%"]})]})]}),e.jsxs("div",{className:"pt-8",children:[e.jsx("h2",{className:"text-xs font-medium tracking-widest uppercase text-foreground/50 mb-4",children:"How It Works"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"bg-white rounded-2xl p-5 flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-foreground
1/5 flex items-center justify-center flex-shrink-0",children:e.jsx(D,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Adaptive Difficulty"}),e.jsx("p",{className:"text-sm text-foreground/60",children:"Questions adapt to your skill level in real-time"})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl p-5 flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-foreground/5 flex items-center justify-center flex-shrink-0",children:e.jsx(z,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Timed Questions"}),e.jsx("p",{className:"text-sm text-foreground/60",children:"Each question has a time limit to complete"})]})]}),e.jsxs("div",{className:"bg-white rounded-2xl p-5 flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-foreground/5 flex items-center justify-center flex-shrink-0",children:e.jsx(L,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Instant Feedback"}),e.jsx("p",{className:"text-sm text-foreground/60",children:"Receive immediate feedback and a detailed score report"})]})]})]})]})]}),e.jsx("div",{className:"lg:col-span-2",children:e.jsxs("div",{className:"bg-white rounded-3xl p-8 shadow-xs sticky top-24",children:[e.jsxs("div",{className:"flex items-start justify-between mb-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-medium tracking-widest uppercase text-foreground/50 mb-2",children:"Assessment"}),e.jsx("h3",{className:"text-xl font-bold",children:"Ready to Begin"})]}
1),e.jsx("div",{className:"w-12 h-12 rounded-full bg-foreground/5 flex items-center justify-center",children:e.jsx(B,{className:"w-6 h-6"})})]}),e.jsx("p",{className:"text-foreground/60 mb-6 leading-relaxed",children:"Complete this assessment to earn your course certificate. The assessment adapts to your knowledge level."}),e.jsx(j,{variant:"gradient",size:"lg",className:"w-full",onClick:_,disabled:u,children:u?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"w-5 h-5 mr-2 animate-spin"}),"Starting..."]}):e.jsxs(e.Fragment,{children:["Start Assessment",e.jsx(Q,{className:"w-5 h-5 ml-2"})]})}),e.jsx(j,{variant:"outline",size:"lg",className:"w-full mt-3",onClick:()=>o(p?`/courses/${p}/learn`:`/courses/${d}/learn`),children:"Back to Course"}),e.jsx("div",{className:"border-t border-foreground/10 my-6"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground"}),e.jsx("span",{children:"Unlimited retakes available"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground"}),e.jsx("span",{children:"Certificate on passing"})]}),e.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-foreground"}),e.jsx("span",{children:"Detailed performance report"})]})]})]})})]})]})]})}const W=$;export{W as component};
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.