import{j as e}from"./vendor-BKmmeuxg.js";import{L as m}from"./label-HmIcv5Yx.js";import{T as x}from"./textarea-CyndvowL.js";import"./index-WW_1X1qx.js";import"./utils-DxSsnXxD.js";const w=({question:s,answer:t,onAnswerChange:o})=>{var i,d;const n=(t==null?void 0:t.answer_text)||"",r=((i=s.options)==null?void 0:i.word_limit)||500,c=l=>{o({question_id:s.id,answer_text:l})},a=n.trim().split(/\s+/).filter(Boolean).length;return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-lg bg-blue-50 p-3",children:e.jsxs("p",{className:"text-sm text-blue-800",children:[e.jsx("span",{className:"font-semibold",children:"Note:"})," This answer will be manually graded by the instructor. Write a clear and detailed response."]})}),e.jsxs("div",{children:[e.jsx(m,{htmlFor:"answer",children:"Your Answer"}),e.jsx(x,{id:"answer",value:n,onChange:l=>c(l.target.value),placeholder:"Type your answer here...",rows:8,className:"mt-2"})]}),e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsxs("span",{className:"text-gray-600",children:["Word count: ",e.jsx("span",{className:`font-semibold ${a>r?"text-destructive":""}`,children:a}),` / ${r}`]}),a>r&&e.jsx("span",{className:"text-destructive",children:"Word limit exceeded!"})]}),((d=s.options)==null?void 0:d.expected_answer)&&e.jsxs("div",{className:"rounded-lg bg-gray-50 p-3",children:[e.jsx("p",{className:"mb-1 text-sm font-semibold text-gray-700",children:"Guidance:"}),e.jsx("p",{className:"text-sm text-gray-600",children:s.options.expected_answer})]})]})};export{w as default};