1import{j as e}from"./vendor-ui-CmKBJFmb.js";import{r as i,d as E}from"./vendor-react-DmLZEbX8.js";import{u as L,a1 as H,B as n,f as m,a2 as p,h as N,i as b,C as y,_ as T}from"./index-D1cVJMhq.js";import{P as z}from"./progress-DYEo4jwQ.js";import{C as M}from"./chevron-left-nI82Gr6A.js";import{H as A}from"./headphones-CFwB9h1L.js";import{T as F}from"./target-CG39nI7z.js";import"./vendor-query-X56ZNOSG.js";import"./vendor-supabase-CUHO7gZf.js";const I=["Self-Help","Business","Psychology","Science","History","Biography","Fiction","Philosophy","Health","Technology","Finance","Spirituality"],R=[{value:15,label:"15 mins",description:"Quick learner"},{value:30,label:"30 mins",description:"Balanced"},{value:60,label:"1 hour",description:"Dedicated"},{value:120,label:"2+ hours",description:"Power listener"}];function X(){const[a,g]=i.useState(0),[c,v]=i.useState("english"),[r,w]=i.useState([]),[l,S]=i.useState(30),[u,o]=i.useState(!1),x=E(),{updateProfile:f,profile:D}=L(),{toast:h}=H(),d=[{title:"Language",icon:T},{title:"Genres",icon:A},{title:"Goals",icon:F}],k=s=>{w(t=>t.includes(s)?t.filter(_=>_!==s):[...t,s])},C=()=>{a<d.length-1&&g(a+1)},G=()=>{a>0&&g(a-1)},B=async()=>{o(!0);try{const{error:s}=await f({language_preference:c,favorite_genres:r,listening_goals:{daily_minutes:l,weekly_books:Math.ceil(l/60*7/15)},onboarding_completed:!0});s?h({title:"Error",description:"Failed to save preferences. Please try again.",variant:"destructive"}):(h({title:"Welcome to BookPod: 15 Min Summaries!",description:"Your personalized experience is ready."}),x("/"))}catch{h({title:"Error",description:"An unexpected error occurred.",variant:"destructive"})}finally{o(!1)}},P=async()=>{o(!0);try{await f({onboarding_completed:!0}),x("/")}catch{x("/")}finally{o(!1)}},j=()=>{switch(a){case 0:return c!=="";case 1:return r.length>=1;case 2:return l>0;default:return!1}};return e.jsxs("div",{className:"min-h-screen flex flex-col p-4 bg-gradient-to-b from-primary/5 to-background",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:"/logo.png",alt:"BookPod: 15 Min Summaries",className:"w-10 h-10 rounded-xl object-cover"}),e.jsxs("span",{className:"font-heading font-semibold",children:[e.jsx("span",{className:"text-foreground",children:"BookPod:"})," ",e.jsx("span",{className:"text-[#3d9a8b]",children:"15 Min Summaries"})]})]}),e.jsx(n,{variant:"ghost",size:"sm",onClick:P,disabled:u,children:"Skip"})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:d.map((s,t)=>e.jsxs("div",{className:m("flex items-center gap-2",t<=a?"text-primary":"text-muted-foreground"),children:[e.jsx("div",{className:m("w-8 h-8 rounded-full flex items-center justify-center transition-colors",t<a?"bg-primary text-primary-foreground":t===a?"bg-primary/20 text-primary":"bg-muted"),children:t<a?e.jsx(p,{className:"h-4 w-4"}):e.jsx(s.icon,{className:"h-4 w-4"})}),e.jsx("span",{className:"hidden sm:inline text-sm font-medium",children:s.title})]},s.title))}),e.jsx(z,{value:(a+1)/d.length*100,className:"h-2"})]}),e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center max-w-lg mx-auto w-full",children:[a===0&&e.jsxs("div",{className:"w-full animate-scale-in",children:[e.jsx("h2",{className:"font-heading text-2xl font-bold text-center mb-2",children:"Choose your language"}),e.jsx("p",{className:"text-muted-foreground text-center mb-8",children:"Select your preferred language for book summaries"}),e.jsx("div",{className:"grid grid-cols-1 gap-3",children:[{value:"english",label:"English",flag:"ðºð¸"},{value:"hindi",label:"हिà¤à¤¦à¥ (Hindi)",flag:"ð®ð³"},{value:"both",label:"Both Languages",flag:"ð"}].map(s=>e.jsx(N,{className:m("cursor-pointer transition-all",c===s.value?"border-primary bg-primary/5 ring-2 ring-primary":"hover:border-primary/50"),onClick:()=>v(s.value),children:e.jsxs(b,{className:"flex items-center gap-4 p-4",children:[e.jsx("span",{className:"text-3xl",children:s.flag}),e.jsx("span",{className:"font-medium text-lg",children:s.label}),c===s.value&&e.jsx(p,{className:"h-5 w-5 text-primary ml-auto"})]})},s.value))})]}),a===1&&e.jsxs("div",{className:"w-full animate-scale-in",children:[e.jsx("h2",{className:"font-heading text-2xl font-bold text-center mb-2",children:"What interests you?"}),e.jsx("p",{className:"text-muted-foreground text-center mb-8",children:"Select at least one genre to personalize your experience"}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:I.map(s=>e.jsx(n,{variant:r.includes(s)?"default":"outline",size:"sm",className:"h-auto py-3",onClick:()=>k(s),children:s},s))}),e.jsxs("p",{className:"text-sm text-muted-foreground text-center mt-4",children:[r.length," genre",r.length!==1?"s":""," selected"]})]}),a===2&&e.jsxs("div",{className:"w-full animate-scale-in",children:[e.jsx("h2",{className:"font-heading text-2xl font-bold text-center mb-2",children:"Set your daily goal"}),e.jsx("p",{className:"text-muted-foreground text-center mb-8",children:"How much time do you want to spend listening each day?"}),e.jsx("div",{className:"grid grid-cols-2 gap-3",children:R.map(s=>e.jsx(N,{className:m("cursor-pointer transition-all",l===s.value?"border-primary bg-primary/5 ring-2 ring-primary":"hover:border-primary/50"),onClick:()=>
1S(s.value),children:e.jsxs(b,{className:"p-4 text-center",children:[e.jsx("span",{className:"font-heading text-2xl font-bold",children:s.label}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.description}),l===s.value&&e.jsx(p,{className:"h-5 w-5 text-primary mx-auto mt-2"})]})},s.value))})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-8 pt-4 border-t",children:[e.jsxs(n,{variant:"ghost",onClick:G,disabled:a===0,className:"gap-2",children:[e.jsx(M,{className:"h-4 w-4"}),"Back"]}),a<d.length-1?e.jsxs(n,{onClick:C,disabled:!j(),className:"gap-2",children:["Next",e.jsx(y,{className:"h-4 w-4"})]}):e.jsxs(n,{onClick:B,disabled:!j()||u,className:"gap-2",children:[u?"Saving...":"Get Started",e.jsx(y,{className:"h-4 w-4"})]})]})]})}export{X as default};
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.