1import{j as p}from"./jsx-runtime-v-CSYJwhbb.js";import{r as W}from"./chunk-WWGJGFF6-v-Bn9-2gQr.js";import{u as g}from"./cart-v-DgPPafGN.js";import{u as B}from"./DialogModal-v-lmIXxxYp.js";import"./Icon-v-SNrliBJ5.js";import{a as J,c as K}from"./react-v-CbOg5BWu.js";import{B as j}from"./layout-footer-v-DHPsMJuE.js";import{Q as O,s as P}from"./QuestionInstruction-v-Bc6CRdvI.js";import{C as X}from"./center-v-35whLoby.js";import{R as Y}from"./RoundedSquare-v-C6HIJ6g2.js";import{C as Z}from"./circle-v-Cd22N76o.js";import{t as s}from"./index-v-C8uNcIP5.js";import{u as $}from"./useControllable-v-DwlTmMx5.js";const q=({label:e,isSelected:a,isSuccess:x,isError:c,isViewingResult:o,isGame:r})=>r?p.jsx(Z,{w:"32px",h:"32px",fontWeight:700,borderWidth:"4px",borderStyle:"solid",borderColor:{base:o&&x?"success":o&&c?"error":a?"chosen":"#FFDAC7",_groupHover:o?void 0:"chosen"},bgColor:o&&x?"success":o&&c?"error":a?"chosen":"white",color:o&&x||o&&c||a?"white":"text.secondary",boxShadow:{base:r?o&&x?"0px 4px 0px 0px #3E8700":o&&c?"0px 4px 0px 0px #D44619":a?"0px 4px 0px 0px #007CC4":"0px 4px 0px 0px #FFC3A2":"none",_groupHover:r?o?void 0:"0px 4px 0px 0px #007CC4":"none"},children:e}):p.jsx(Y,{size:32,strokeWidth:1.5,bgColor:o&&x?s("colors.green"):o&&c?s("colors.orange"):a?s("colors.sky"):"white",borderColor:o&&x?s("colors.green"):o&&c?s("colors.orange"):a?s("colors.sky"):s("colors.neutral.600"),textColor:a||x||c?"white":s("colors.neutral.600"),children:e}),E=({data:e,label:a,isLayoutVertical:x,isSelected:c,isViewingResult:o,isSuccess:r,isError:l,isGame:n,onClick:C})=>{const h=B(),t=!x||h,d=!o,f=p.jsx(j,{position:n?"absolute":"unset",left:t?"unset":"-18px",bottom:t?"-18px":"unset",children:p.jsx(q,{label:a,isSelected:c,isViewingResult:o,isSuccess:r,isError:l,isGame:n})}),b=e.image?p.jsx("img",{src:e.image,draggable:!1,style:{borderRadius:"16px",maxHeight:h?"128px":"225px",width:h||t?"100%":"unset",maxWidth:h||t?"unset":"400px",objectFit:"contain"}}):null,u=J(e.content)?p.jsx(j,{textStyle:"medium.3.regular",color:"inherit",flex:1,dangerouslySetInnerHTML:{__html:e.content}}):e.content,y=g(()=>{d&&(C==null||C(e.id))});return p.jsx(j,{className:"group",color:o&&r?"success.darker":o&&l?"error.darker":"neutral.200",bg:n?"white":o&&r?"success.lighter":o&&l?"error.lighter":"white",borderWidth:n?"4px":"2px",borderStyle:"solid",borderColor:{base:o&&r?n?"success":"success.lighter":o&&l?n?"error":"error.lighter":c?"chosen":n?"#F
1FDAC7":"border",_hover:o&&(r||l)&&!n?"transparent":o&&!n?"border":o?void 0:"chosen"},boxShadow:{base:n?o&&r?"0px 8px 0px 0px #3E8700":o&&l?"0px 8px 0px 0px #D44619":c?"0px 8px 0px 0px #007CC4":"0px 8px 0px 0px #FFC3A2":"none",_hover:n?o?void 0:"0px 8px 0px 0px #007CC4":"none"},borderRadius:"24px",outlineStyle:"solid",outlineWidth:{base:8,_hover:8},outlineColor:{base:n?"transparent":!o&&c?"chosen.outline":"transparent",_hover:n||o?"transparent":"chosen.outline"},padding:n?"16px 32px":"16px",display:"flex",alignItems:"center",flexDir:t?"column":"row",gap:"16px",cursor:d?"pointer":"not-allowed",transition:"all",onClick:y,opacity:o&&!c?.5:1,w:h||x&&e.image&&e.content?"100%":"unset",h:!h&&!x&&e.image&&e.content?"100%":"unset",position:"relative",children:h?p.jsxs(p.Fragment,{children:[p.jsxs(X,{gap:"8px",children:[f,b]}),u]}):t?p.jsxs(p.Fragment,{children:[b,u,f]}):p.jsxs(p.Fragment,{children:[f,b,u]})})},S=({maxAnswers:e=1,questionId:a,defaultSelectingStates:x,selectingStates:c,onSelectingStatesChanged:o})=>{const[r,l]=$({defaultValue:x,value:c,onChange:t=>{typeof o=="function"&&o(a,t)}}),n=g(()=>{l(x)}),C=g(t=>{if(!r){l([t]);return}if(r.includes(t)){l(r.filter(d=>d!==t));return}if(e===1)l([t]);else{const d=r.concat(t);l(r.length<e?d:d.slice(1,e+1))}}),h=W.useCallback((t,d)=>{const f=!!(r!=null&&r.includes(t)),b=!!(d&&d.includes(t));return{isSelected:f,isSuccess:b,isError:!!(f&&!b)}},[r]);return{onClick:C,resetToDefault:n,checkChoiceItemState:h}},lo=({questionNumber:e,question:a,questionId:x,questionState:c,description:o,audio:r,image:l,data:n,isAnswerVertical:C,isGame:h,maxAnswers:t=1,defaultSelectingStates:d,selectingStates:f,onSelectingStatesChanged:b,isViewingResult:u,isViewingAnswerExplanation:y,answerExplanation:D,result:H,descriptionData:Q,onRefresh:F})=>{K(n.length>=t);const I=t<0||t>n.length?1:t,M=B(),m=W.useMemo(()=>!!(C||M||n.length>=5),[C,M,n]),{onClick:L,resetToDefault:v,checkChoiceItemState:T}=S({questionId:x,defaultSelectingStates:d,selectingStates:f,onSelectingStatesChanged:b,maxAnswers:I}),z=()=>{v==null||v(),F==null||F(x)};return p.jsxs(j,{children:[p.jsx(O,{isGame:h,questionId:x,questionNumber:e,question:a,questionState:c,description:o,image:l,descriptionData:Q,audio:u?void 0:r,onRefresh:u?void 0:z}),p.jsx(j,{gap:"24px",flexDirection:m?"column":"unset",flexWrap:m?"nowrap":"wrap",display:m?"flex":"grid",alignItems:"center",gridTemplateColumns:m?"unset":"repeat(auto-fill, minmax(249px, 1fr))",children:n.map(k=>{const A=k.label.toUpperCase(),{isSelected:N,isSuccess:U,isError:_}=T(k.id,H);return p.jsx(E,{data:k,label:A,isLayoutVertical:m,isViewingResult:u,isSelected:N,isSuccess:U,isError:_,isGame:h,onClick:L},k.id)})}),y&&p.jsx(P,{answerExplanation:D})]})};export{lo as M};
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.