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