import{j as e}from"./react-vendor-xYZnmIII.js";import{B as d,C as h,L as j}from"./ui-components-CQM92IK3.js";import"./inertia-vendor-cBbDTmhJ.js";import"./ui-vendor-Ds9iwIxa.js";import"./interactive-vendor-B1OgcAgP.js";const N=({question:a,answer:c,onAnswerChange:r})=>{var o;const l=(c==null?void 0:c.selected_option_ids)||[],n=(s,t)=>{const i=t?[...l,s]:l.filter(x=>x!==s);r({selected_option_ids:i})},m=()=>{var t;const s=((t=a.question_options)==null?void 0:t.map(i=>i.id))||[];r({selected_option_ids:s})},p=()=>{r({selected_option_ids:[]})};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-sm text-gray-600",children:"Select all correct answers:"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(d,{variant:"ghost",size:"sm",onClick:m,children:"Select All"}),e.jsx(d,{variant:"ghost",size:"sm",onClick:p,disabled:l.length===0,children:"Clear All"})]})]}),e.jsx("div",{className:"space-y-3",children:(o=a.question_options)==null?void 0:o.map(s=>{const t=l.includes(s.id);return e.jsxs("div",{className:`flex items-start space-x-3 rounded-lg border-2 p-4 transition-colors ${t?"border-primary bg-primary/5":"border-gray-200 hover:border-gray-300"}`,children:[e.jsx(h,{id:`option-${s.id}`,checked:t,onCheckedChange:i=>n(s.id,i),className:"mt-0.5"}),e.jsx(j,{htmlFor:`option-${s.id}`,className:"flex-1 cursor-pointer font-normal",children:s.option_text})]},s.id)})}),l.length>0&&e.jsxs("p",{className:"text-sm text-gray-600",children:["Selected: ",e.jsx("span",{className:"font-semibold",children:l.length})," option(s)"]})]})};export{N as default};
