1import{l as h,k as r}from"./app-C23pyaid.js";import{u as S}from"./hook-Ctp552oP.js";import{B as _}from"./button-BJDSJoXt.js";import{T as $}from"./textarea-HRzz29yX.js";import{a as b}from"./utils-DvGlLt9s.js";import{StepFrame as T,Notice as B}from"./StepFrame-D-FliBHY.js";import{C as E}from"./check-Bcca0OH5.js";/* empty css */import"./useKeyboardInset-C7gDREak.js";import"./circle-alert-C_gfljDL.js";import"./createLucideIcon-DtkNhD0y.js";import"./arrow-left-C4b2GcAr.js";import"./x-DpaqY1h0.js";function J({step:s,question:e,busy:i,error:m,onAnswer:k,onBack:j,onClose:y}){var f,g;const{t:o}=S(),[n,d]=h.useState(((f=e.answer)==null?void 0:f.options)??[]),[u,N]=h.useState(((g=e.answer)==null?void 0:g.text)??""),c=e.options.length>0,a=u.trim(),v=t=>{if(!e.multiple){d([t]);return}d(l=>l.includes(t)?l.filter(C=>C!==t):[...l,t])},w=(e.text==="required"?a.length>=2:!0)&&(!c||(e.multiple?n.length>0||a.length>0:n.length===1)),p=`cancellation.questions.${e.key}.subtitle`,x=o(p);return r.jsx(T,{label:o(`cancellation.questions.${e.key}.label`),stepNumber:s.step_number,stepTotal:s.step_total,title:o(`cancellation.questions.${e.key}.title`),subtitle:x===p?null:x,canGoBack:s.can_go_back,busy:i,onBack:j,onClose:y,footer:r.jsx(_,{className:"h-11 w-full rounded-lg",disabled:!w||i,onClick:()=>k(n,a===""?null:a),children:o(i?"cancellation.sheet.working":"cancellation.sheet.continue")}),children:r.jsxs("div",{className:"flex flex-col gap-3",children:[c&&r.jsx("div",{role:e.multiple?"group":"radiogroup",className:"flex flex-col gap-2",children:e.options.map(t=>{const l=n.includes(t);return r.jsxs("button",{type:"button",role:e.multiple?"checkbox":"radio","aria-checked":l,onClick:()=>v(t),className:b("flex min-h-12 w-full items-center gap-3 rounded-lg border px-3.5 py-2.5 text-left text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",l?"border-primary bg-primary/5 text-foreground":"border-border bg-card text-foreground hover:bg-accent"),children:[r.jsx("span",{className:b("flex h-5 w-5 shrink-0 items-center justify-center border-2 transition-colors",e.multiple?"rounded-md":"rounded-full",l?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"),children:l&&(e.multiple?r.jsx(E,{className:"h-3.5 w-3.5",strokeWidth:3}):r.jsx("span",{className:"h-2 w-2 rounded-full bg-primary-foreground"}))}),o(`cancellation.options.${t}`)]},t)})}),e.text!=="none"&&r.jsx($,{id:`cancellation-${e.key}-text`,value:u,onChange:t=>N(t.target.value),maxLength:2e3,rows:c?3:5,placeholder:o(e.text==="required"?"cancellation.questions.text_required":"cancellation.questions.text_optional"),className:"resize-none text-base sm:text-sm"}),m&&r.jsx(B,{tone:"error",children:m})]})})}export{J as QuestionStep};
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.