import{j as p,r as x}from"./vendor-tanstack-DE4ALVGD.js";import{C as h,aZ as f,I as j}from"./index-CNL5pSma.js";const I=({currentStepNum:e,onClick:s,steps:r,completedSteps:t,visitedSteps:o})=>p.jsx(h,{className:"p-4 flex flex-row items-center justify-around gap-4 overflow-x-auto",children:r.map((n,a)=>{const d=e===a,m=o.has(a),u=t.has(a);return p.jsx(C,{disabled:!m,onClick:()=>s({stepName:n,stepNum:a}),number:a,isActive:d,isComplete:u,name:n},n)})}),C=({isActive:e=!1,isComplete:s=!1,disabled:r=!1,onClick:t=()=>{},number:o,name:n})=>{const a=o+1,d=a<10?`0${a}`:String(a);return p.jsxs("button",{type:"button",className:f("flex items-center gap-3 text-nowrap",r&&"cursor-not-allowed"),disabled:r,onClick:()=>t({number:o,name:n}),children:[s?p.jsx(j,{id:"CircleCheck",color:e?"teal":"grey",className:"size-12"}):p.jsx(N,{isActive:e,label:d}),p.jsx("p",{className:f("text-lg text-gray-500 border-gray-500 whitespace-nowrap",e&&"text-teal-700 border-teal-700"),children:n})]})},N=({isActive:e=!1,label:s})=>p.jsx("div",{className:f("flex items-center justify-center size-12 rounded-full border-4 text-gray-500 border-gray-500",e&&"text-teal-700 border-teal-700"),children:p.jsx("p",{className:f("text-lg text-gray-500 border-gray-500",e&&"text-teal-700 border-teal-700"),children:s})}),g=(e=new Set)=>{const[s,r]=x.useState(e),t=x.useMemo(()=>({add:c=>r(l=>new Set([...Array.from(l),c])),remove:c=>r(l=>new Set([...Array.from(l).filter(S=>S!==c)])),toggle:c=>r(l=>l.has(c)?new Set(Array.from(l).filter(S=>S!==c)):new Set([...Array.from(l),c])),clear:()=>r(new Set),reset:()=>r(e)}),[e]),o={has:x.useCallback(n=>s.has(n),[s]),...t};return[s,o]},V=(e,s=0,r)=>{const[t,o]=x.useState(s),[n,{add:a,reset:d}]=g(r??new Set([0])),[m,{add:u,reset:c}]=g(new Set),l=()=>{t<e-1&&(u(t),a(t+1),o(i=>i+1))},S=()=>{t>0&&o(i=>i-1)},b=i=>{o(i)},y=()=>{c(),d(),o(s)},w=t===e-1;return{changeStep:b,completedStepsSet:m,currentStep:t,decrementStep:S,incrementStep:l,isFinalStep:w,isStartingStep:t===0,reset:y,visitedStepsSet:n}};export{I as S,V as u};
//# sourceMappingURL=use-stepper-CGpO08Vt.js.map
