1import{G as c,r as o,s as r}from"./index-CcCokqI7.js";const f={flow:null,step:0,data:{},completed:!1};function b(){const{user:a}=c(),[n,s]=o.useState(f),[i,d]=o.useState(!0);o.useEffect(()=>{if(!a){d(!1);return}let t=!0;return(async()=>{const{data:e}=await r.from("profiles").select("onboarding_flow,onboarding_step,onboarding_data,onboarding_completed").eq("user_id",a.id).maybeSingle();t&&(e&&s({flow:e.onboarding_flow??null,step:e.onboarding_step??0,data:e.onboarding_data??{},completed:!!e.onboarding_completed}),d(!1))})(),()=>{t=!1}},[a]);const l=o.useCallback(async t=>{if(!a)return;const e={...n,...t,data:{...n.data,...t.data??{}}};s(e),await r.from("profiles").update({onboarding_flow:e.flow,onboarding_step:e.step,onboarding_data:e.data,onboarding_completed:e.completed}).eq("user_id",a.id)},[n,a]),u=o.useCallback(async(t={})=>{a&&(await r.from("profiles").update({...t,onboarding_completed:!0,onboarding_step:99}).eq("user_id",a.id),s(e=>({...e,completed:!0})))},[a]);return{state:n,save:l,complete:u,loading:i}}export{b as u};
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.