import{jsxs as s,jsx as e}from"react/jsx-runtime";import{I as f}from"./input-error-BbsDx4-P.js";import{L as a,B as l,I as v}from"./ui-components-B24mpb8o.js";import{Plus as b,Trash2 as A}from"lucide-react";import{useEffect as N}from"react";import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const D=({data:p,setData:n,errors:c})=>{var m;const o=((m=p.options)==null?void 0:m.answers)||[];N(()=>{o.length===0&&n("options",{answers:[""]})},[]);const d=()=>{const t=[...o,""];n("options",{answers:t})},h=t=>{const r=o.filter((i,u)=>u!==t);n("options",{answers:r})},w=(t,r)=>{const i=[...o];i[t]=r,n("options",{answers:i})};return s("div",{className:"space-y-4",children:[s("div",{children:[e(a,{children:"Instructions"}),s("div",{className:"p-3 bg-blue-50 rounded-md text-sm text-blue-900",children:[e("p",{className:"font-medium mb-1",children:"How to use fill-in-the-blank questions:"}),e("p",{children:"1. Write your question in the title field above"}),e("p",{children:"2. Use underscores (___) or brackets [blank] to mark where students should fill in answers"}),e("p",{children:"3. Add the correct answer(s) below"})]})]}),s("div",{className:"space-y-3",children:[s("div",{className:"flex items-center justify-between",children:[e(a,{children:"Accepted Answers *"}),s(l,{type:"button",variant:"outline",size:"sm",onClick:d,children:[e(b,{className:"h-4 w-4"}),"Add Alternative Answer"]})]}),e("p",{className:"text-sm text-gray-600",children:"Add multiple variations if there are different ways to answer correctly"}),o.map((t,r)=>s("div",{className:"flex gap-2",children:[e("div",{className:"flex-1",children:e(v,{placeholder:`Correct answer ${r+1}`,value:t,onChange:i=>w(r,i.target.value)})}),o.length>1&&e(l,{type:"button",variant:"ghost",size:"sm",onClick:()=>h(r),className:"text-red-600",children:e(A,{className:"h-4 w-4"})})]},r))]}),e(f,{message:c.options})]})};export{D as default};
