1import{_ as N}from"./Checkbox-BLfmsTpy.js";import{_ as C}from"./InputLabel-BWamd_x9.js";import{_ as Q}from"./PrimaryButton-CNrxCghz.js";import{_ as S}from"./Radio-DachmLAU.js";import{_ as T}from"./SecondaryButton-D3ZBnHX0.js";import{_ as $}from"./SelectInput-_BQJKGUX.js";import{_ as O}from"./SwitchInput-BcTX_p79.js";import{_ as j}from"./TextArea-C54CfF6M.js";import{_ as x}from"./TextInput-AzIcQ4VN.js";import{C as V}from"./circle-x-Dv8H28gD.js";import{M as F}from"./message-square-CVmxsOI4.js";import{C as A}from"./chevron-right-D1ja-zeG.js";import{C as U}from"./chevron-down-BCdrPqJw.js";import{I as z,ab as G,o as r,d as p,a as i,b as a,w as f,e as d,h as k,F as L,g as M,t as B,f as g,c as b,D as R}from"./app-Dsu_9ZFr.js";import"./useButtonClasses-DaBVTZqM.js";import"./DropdownLink-CnrycL-H.js";import"./x-CdR-vzUA.js";import"./createLucideIcon-CYXWfzkQ.js";import"./check-Dpc42qNa.js";import"./dynamic-import-helper-BheWnx7M.js";const X={class:"space-y-6"},H={class:"flex flex-wrap gap-6"},J={class:"grid gap-1 mb-4"},K={class:"flex items-center gap-1"},P={class:"grid gap-1 mb-4"},W={key:0,class:"grid gap-1 mb-4"},Y={class:"grid gap-2 mb-8"},Z={class:"flex items-center gap-4"},_={class:"p-3 mb-4 border rounded-lg bg-gray-50"},I={class:"flex items-center gap-4 mb-3"},ee={class:"mt-2"},te=["onClick"],se={key:0,class:"mt-2"},le=["onClick"],oe={key:0},Ve={__name:"MultipleChoiceChallengeBuilder",props:{contentForm:{type:Object,required:!0},index:{type:Number,required:!0}},setup(t){const h=t,c=z({});G(()=>{var s,n,l,u;const o=h.contentForm.sections[h.index];o.schema.multiple=((s=o.schema)==null?void 0:s.multiple)==!0,o.schema.answerLayout=["list","dropdown"].includes((n=o.schema)==null?void 0:n.answerLayout)?o.schema.answerLayout:"list";const e={columns:o.settings.columns??"1"};o.settings=e,o.schema=(u=(l=o.schema)==null?void 0:l.questions)!=null&&u.length?o.schema:{questions:[{question:"",answers:[{text:"",isCorrect:!1,feedback:""}]}]},o.schema.questions&&o.schema.questions.forEach((m,y)=>{c[`question-${y}`]=!!m.feedback,m.answers&&(m.answers=m.answers.map((w,E)=>(c[`answer-${y}-${E}`]=!!w.feedback,{text:w.text||"",isCorrect:w.isCorrect||!1,feedback:w.feedback||""})))})});const v=o=>{c[o]=!c[o]},q=(o,e)=>{const s=h.contentForm.sections[h.index].schema.questions[o];h.contentForm.sections[h.index].schema.multiple?s.answers[e].isCorrect=s.answers[e].isCorrect==!0?0:1:s.answers.forEach((l,u)=>{l.isCorrect=u===e})},D=()=>{const o=h.contentForm.sections[h.index];o.schema.multiple||o.schema.questions.forEach(e=>{if(e.answers.filter(n=>n.isCorrect).length>1){let n=!1;e.answers.forEach(l=>{l.isCorrect&&!n?n=!0:l.isCorrect&&(l.isCorrect=!1)})}})};return(o,e)=>(r(),p("div",X,[i("div",null,[i("div",H,[i("div",J,[a(C,null,{default:f(()=>e[4]||(e[4]=[d("Answer Type")])),_:1}),i("div",K,[a(C,null,{default:f(()=>e[5]||(e[5]=[d("Single")])),_:1}),a(O,{modelValue:t.contentForm.sections[t.index].schema.multiple,"onUpdate:modelValue":[e[0]||(e[0]=s=>t.contentForm.sections[t.index].schema.multiple=s),D]},null,8,["modelValue"]),a(C,null,{default:f(()=>e[6]||(e[6]=[d("Multiple")])),_:1})])]),i("div",P,[a(C,null,{default:f(()=>e[7]||(e[7]=[d("Answer Layout")])),_:1}),a($,{modelValue:t.contentForm.sections[t.index].schema.answerLayout,"onUpdate:modelValue":e[1]||(e[1]=s=>t.contentForm.sections[t.index].schema.answerLayout=s),options:[{label:"List",value:"list"},{label:"Dropdown",value:"dropdown"}]},null,8,["modelValue"])]),t.contentForm.sections[t.index].schema.answerLayout==="list"?(r(),p("div",W,[a(C,null,{default:f(()=>e[8]||(e[8]=[d("Grid Columns")])),_:1}),a($,{modelValue:t.contentForm.sections[t.index].settings.columns,"onUpdate:modelValue":e[2]||(e[2]=s=>t.contentForm.sections[t.index].settings.columns=s),modelModifiers:{number:!0},options:[{label:"1 Column",value:"1"},{label:"2 Columns",value:"2"},{label:"3 Columns",value:"3"},{label:"4 Columns",value:"4"}]},null,8,["modelValue"]),e[9]||(e[9]=i("p",{class:"text-xs text-gray-500"}," Controls how many columns the questions are displayed in. Only applies to list layout. ",-1))])):k("",!0)]),(r(!0),p(L,null,M(t.contentForm.sections[t.index].schema.questions,(s,n)=>(r(),p("div",Y,[d(" Question "+B(n+1)+" of "+B(t.contentForm.sections[t.index].schema.questions.length)+" ",1),i("div",Z,[a(x,{type:"text",class:"flex-1",modelValue:s.question,"onUpdate:modelValue":l=>s.question=l,placeholder:"Question"},null,8,["modelValue","onUpdate:modelValue"]),a(g(V),{class:"w-6 h-6 text-red-500 cursor-pointer",onClick:l=>t.contentForm.sections[t.index].schema.questions.splice(n,1)},null,8,["onClick"])]),i("div",null,[(r(!0),p(L,null,M(s.answers,(l,u)=>(r(),p("div",_,[i("div",I,[a(x,{type:"text",class:"flex-1",modelValue:l.text,"onUpdate:modelValue":m=>l.text=m,placeholder:"Answer"},null,8,["modelValue","onUpdate:modelValue"]),i("div",null,[(r(),b(R(t.contentForm.sections[t.index].schema.multiple==!0?N:S),{name:`question-${n}`,value:!0,checked:l.isCorrect==!0,onChange:m=>q(n,u)},null,40,["name","checked","onChange"])),a(C,null,{default:f(()=>e[10]||(e[10]=[d("Correct?")])),_:1})]),a(g(V),{class:"w-6 h-6 text-red-500 cursor-pointer",onClick:m=>s.answers.splice(u,1)},null,8,["onClick"])]),i("div",ee,[i("button",{type:"button",onClick:m=>v(`answer-${n}-${u}`),class:"flex items-center gap-2 text-xs text-gray-600 transition-colors hover:text-gray-800"},[a(g(F),{class:"w-3 h-3"}),e[11]||(e[11]=i("span",null,"Answer Feedback",-1)),c[`answer-${n}-${u}`]?(r(),b(g(U),{key:1,class:"w-3 h-3"})):(r(),b(g(A),{key:0,class:"w-3 h-3"}))],8,te),c[`answer-${n}-${u}`]?(r(),p("div",se,[a(x,{type:"text",class:"w-full text-sm",modelValue:l.feedback,"onUpdate:modelValue":m=>l.feedback=m,placeholder:"Feedback for this specific answer..."},null,8,["modelValue","onUpdate:modelValue"])])):k("",!0)])]))),256)),a(Q,{size:"small",onClick:()=>{const l=s.answers.length;s.answers.push({text:"",isCorrect:!1,feedback:""}),c[`answer-${n}-${l}`]=!1}},{default:f(()=>e[12]||(e[12]=[d("Add Answer")])),_:2},1032,["onClick"])]),i("div",null,[i("button",{type:"button",onClick:l=>v(`question-${n}`),class:"flex items-center gap-2 mb-2 text-sm text-gray-600 transition-colors hover:text-gray-800"},[a(g(F),{class:"w-4 h-4"}),e[13]||(e[13]=i("span",null,"Question Feedback",-1)),c[`question-${n}`]?(r(),b(g(U),{key:1,class:"w-4 h-4"})):(r(),b(g(A),{key:0,class:"w-4 h-4"}))],8,le),c[`question-${n}`]?(r(),p("div",oe,[a(C,null,{default:f(()=>e[14]||(e[14]=[d("Feedback (optional)")])),_:1}),a(j,{type:"text",class:"w-full",modelValue:s.feedback,"onUpdate:modelValue":l=>s.feedback=l,placeholder:"Feedback for this question..."},null,8,["modelValue","onUpdate:modelValue"])])):k("",!0)])]))),256))]),i("div",null,[a(T,{onClick:e[3]||(e[3]=()=>{const s=t.contentForm.sections[t.index].schema.questions.length;t.contentForm.sections[t.index].schema.questions.push({question:"",answers:[{text:"",isCorrect:!1,feedback:""}]}),c[`question-${s}`]=!1,c[`answer-${s}-0`]=!1})},{default:f(()=>e[15]||(e[15]=[d("Add Question")])),_:1})])]))}};export{Ve 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.