PageSourceSearch

https://soulpreneuros.lovable.app/assets/MyLearning-Co8X5wjv.js

js soulpreneuros.lovable.app collected 2026-10-03 03:45:22 UTC 33,009 bytes, 5 lines download raw bytes

1import{j as e,cn as E,co as O,e4 as ue,t as N,dK as L,cp as q,u as ae,l as C,J as v,K as T,cL as re,_ as P,$ as I,bo as U,ck as D,g as k,v as le,b as oe,s as j,e5 as he,r as ge,bs as ne,cT as J,e6 as _,e7 as K,bl as pe,Y as fe,cy as W,a2 as be,cU as H,bt as je,bu as ye,cf as ie,ap as Ne,L as ve,af as G,O as Q,cJ as Y,k as ce,d6 as we,o as _e,ct as Z,ar as Ce,c as ke,N as X,au as ee,d0 as Be}from"./index-DGmFoSsk.js";import{T as Le,a as Te,b as M,c as F}from"./tabs-cPGM619F.js";import{p as Ae,u as Se}from"./progress-icon-CIKoBKRZ.js";import{L as ze}from"./lucide-react-B8VYaBNs.js";import{W as Ee}from"./WatchTrainingButton-DdZBuku8.js";import"./useToolTrainingLink-DlWPO-ul.js";const Oe={white:{bg:"bg-zinc-100",text:"text-zinc-700",hover:"hover:bg-zinc-200"},yellow:{bg:"bg-yellow-100",text:"text-yellow-800",hover:"hover:bg-yellow-200"},orange:{bg:"bg-orange-100",text:"text-orange-800",hover:"hover:bg-orange-200"},purple:{bg:"bg-purple-100",text:"text-purple-800",hover:"hover:bg-purple-200"},green:{bg:"bg-green-100",text:"text-green-800",hover:"hover:bg-green-200"},blue:{bg:"bg-blue-100",text:"text-blue-800",hover:"hover:bg-blue-200"},brown:{bg:"bg-amber-100",text:"text-amber-800",hover:"hover:bg-amber-200"},black:{bg:"bg-zinc-800",text:"text-zinc-100",hover:"hover:bg-zinc-700"},red:{bg:"bg-red-100",text:"text-red-800",hover:"hover:bg-red-200"}},qe=({name:l,icon:o,isUnlocked:s,onClick:a,beltColor:d})=>{const t=o?ue[o]:null,r=d?Oe[d.toLowerCase()]:null;return e.jsxs(E,{children:[e.jsx(O,{asChild:!0,children:e.jsxs("button",{onClick:i=>{i.stopPropagation(),s&&a()},disabled:!s,className:N("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium transition-all duration-200",s?r?N(r.bg,r.text,r.hover,"hover:scale-105 cursor-pointer"):"bg-primary/10 text-primary hover:bg-primary/20 hover:scale-105 cursor-pointer":"bg-muted/50 text-muted-foreground cursor-not-allowed"),children:[t&&e.jsx(t,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"truncate max-w-[140px]",children:l}),!s&&e.jsx(L,{className:"h-3 w-3 ml-0.5"})]})}),e.jsx(q,{side:"bottom",className:"text-xs",children:s?e.jsxs("span",{children:["Open ",l]}):e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(L,{className:"h-3 w-3"})," Unlock this belt first"]})})]})},w=["white","yellow","orange","purple","green","blue","brown","black","red"],Pe=({userId:l})=>{const o=ae(),{data:s,isLoading:a}=C({queryKey:["asset-trophy-wall",l],queryFn:async()=>{var A,S;const{data:t}
1=await j.from("assets").select("id, title, display_order, belt_color").order("display_order"),{data:r}=await j.from("student_assets").select("asset_id").eq("user_id",l).eq("status","approved"),{data:i}=await j.from("tools").select("id, name, icon, unlock_belt, route_path, is_active").eq("is_active",!0).order("display_order"),{data:h}=await j.from("student_tool_access").select("tool_id").eq("user_id",l),{data:g}=await j.from("student_progress").select("current_level_id, levels:current_level_id(belt_color)").eq("user_id",l).maybeSingle(),p=((S=(A=g==null?void 0:g.levels)==null?void 0:A.belt_color)==null?void 0:S.toLowerCase())||"hub",m=new Set((r==null?void 0:r.map(x=>x.asset_id))||[]),u=new Set((h==null?void 0:h.map(x=>x.tool_id))||[]),c=w.indexOf(p),f={},n={};w.forEach(x=>{f[x]=[],n[x]=[]}),t==null||t.forEach(x=>{var B;const b=((B=x.belt_color)==null?void 0:B.toLowerCase())||"white",y=he(b,x.display_order);f[b]||(f[b]=[]),f[b].push({...x,isCollected:m.has(x.id),emoji:y.emoji,name:y.name})}),i==null||i.forEach(x=>{var B;const b=((B=x.unlock_belt)==null?void 0:B.toLowerCase())||"white",y=w.indexOf(b);n[b]||(n[b]=[]),n[b].push({id:x.id,name:x.name,icon:x.icon,unlock_belt:b,route_path:x.route_path,isUnlocked:c>=y,hasAccessed:u.has(x.id)})});const R=(i==null?void 0:i.length)||0,$=(i==null?void 0:i.filter(x=>{var y;const b=w.indexOf(((y=x.unlock_belt)==null?void 0:y.toLowerCase())||"white");return c>=b}).length)||0;return{assetsByBelt:f,toolsByBelt:n,currentBelt:p,totalCollected:m.size,totalAssets:(t==null?void 0:t.length)||0,totalTools:R,unlockedToolsCount:$}},enabled:!!l});if(a)return e.jsx(v,{children:e.jsx(T,{className:"p-6",children:e.jsx(re,{className:"h-48 w-full"})})});const d=w.indexOf(s==null?void 0:s.currentBelt);return e.jsxs(v,{className:"border-2 border-primary/20 overflow-hidden",children:[e.jsx(P,{className:"bg-gradient-to-r from-amber-500/10 via-yellow-500/10 to-amber-500/10 py-4",children:e.jsxs(I,{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-amber-500/20 rounded-lg",children:e.jsx(U,{className:"h-6 w-6 text-amber-500"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-medium",children:"Asset Trophy Wall"}),e.jsx("p",{className:"text-sm text-muted-foreground font-normal",children:"Your collected business assets and unlocked tools"})]})]}),e.jsxs("div",{className:"text-right flex gap-6",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-amber-500",children:(s==null?void 0:s.totalCollected)||0}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",(s==null?void 0:s.totalAssets)||0," assets"]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold text-primary",children:(s==null?void 0:s.unlockedToolsCount)||0}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["of ",(s==null?void 0:s.totalTools)||0," tools"]})]})]})]})}),e.jsxs(T,{className:"p-6 space-y-6",children:[e.jsx(D,{children:w.map((t,r)=>{const i=(s==null?void 0:s.assetsByBelt[t])||[],h=(s==null?void 0:s.toolsByBelt[t])||[],g=le[t],p=i.filter(n=>n.isCollected).length,m=h.filter(n=>n.isUnlocked).length,u=r>d,c=r===d;return i.length>0||h.length>0?e.jsxs("div",{className:`space-y-3 ${u?"opacity-50":""}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:k(t),alt:t,className:`w-10 h-10 ${u?"grayscale":""}`,loading:"lazy"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("h3",{className:"font-semibold capitalize",children:[t," Belt"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["• ",g.subt
1itle]}),u&&e.jsx(L,{className:"h-3 w-3 text-muted-foreground"}),c&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 bg-primary/20 text-primary rounded font-medium",children:"CURRENT"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[i.length>0&&`${p} of ${i.length} assets`,i.length>0&&h.length>0&&" • ",h.length>0&&`${m} of ${h.length} tools`]})]})]}),i.length>0&&e.jsx("div",{className:"grid grid-cols-7 sm:grid-cols-7 md:grid-cols-14 gap-2 pl-13",children:i.map(n=>e.jsxs(E,{children:[e.jsx(O,{asChild:!0,children:e.jsxs("div",{className:`
2                              relative aspect-square rounded-lg flex items-center justify-center
3                              transition-all duration-300 cursor-pointer
4                              ${n.isCollected?"bg-gradient-to-br from-amber-100 to-yellow-50 dark:from-amber-900/30 dark:to-yellow-900/20 border-2 border-amber-400/50 shadow-lg shadow-amber-500/20 hover:shadow-xl hover:shadow-amber-500/30 hover:scale-110":u?"bg-muted/20 border border-muted/30":"bg-muted/40 border border-muted/50 hover:bg-muted/60 hover:scale-105 grayscale opacity-60"}
5                            `,children:[e.jsx("span",{className:`text-base sm:text-2xl ${!n.isCollected&&!u?"opacity-50":""}`,children:u?"🔒":n.emoji}),n.isCollected&&e.jsx("div",{className:"absolute -top-1 -right-1 bg-amber-500 rounded-full p-0.5 shadow-sm",children:e.jsx(oe,{className:"h-2.5 w-2.5 text-white"})})]})}),e.jsx(q,{side:"top",className:"max-w-xs",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"font-semibold",children:n.name}),e.jsxs("p",{className:"text-xs text-muted-foreground capitalize",children:[t," Belt Asset"]}),n.isCollected?e.jsx("p",{className:"text-xs text-green-500 mt-1",children:"✓ Collected"}):u?e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["🔒 Complete ",t," belt to unlock"]}):e.jsx("p",{className:"text-xs text-amber-500 mt-1",children:"Complete assignments to collect"})]})})]},n.id))}),h.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2 pl-13",children:h.map(n=>e.jsx(qe,{name:n.name,icon:n.icon,isUnlocked:n.isUnlocked,beltColor:t,onClick:()=>{n.route_path&&o(n.route_path)}},n.id))})]},t):null})}),w.filter(t=>{var r;return(((r=s==null?void 0:s.assetsByBelt[t])==null?void 0:r.length)||0)===0}).length>0&&e.jsx("div",{className:"text-center py-4 text-muted-foreground text-sm",children:e.jsx("p",{children:"More assets will be revealed as you progress through your journey 🚀"})})]})]})},Ie=["white","yellow","orange","purple","green","blue","brown","black","red"],Re=()=>{const[l,o]=ge.useState("white"),s=le[l];return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:Ie.map(a=>e.jsxs("button",{onClick:()=>o(a),className:N("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",l===a?"bg-primary text-primary-foreground shadow-md":"bg-muted hover:bg-muted/80 text-muted-foreground"),children:[e.jsx("img",{src:k(a),alt:a,className:"w-5 h-5",loading:"lazy"}),e.jsxs("span",{className:"capitalize",children:[a," Belt"]})]},a))}),e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-muted/30 rounded-xl",children:[e.jsx("img",{src:k(l),alt:l,className:"w-14 h-14",loading:"lazy"}),e.jsxs("div",{children:[e.jsxs("h3",{className:"text-base font-bold capitalize",children:[l," Belt Assets"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.subtitle}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[s.totalAssets," assets in this belt"]})]})]}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-7 gap-3",children:s.assets.map((a,d)=>e.jsxs(v,{className:"p-4 text-center hover:shadow-md transition-shadow bg-card",children:[e.jsx("div",{className:"text-2xl mb-2",children:a.emoji}),e.jsx("p",{className:"text-sm font-medium leading-tight",children:a.name})]},d))}),s.assets.length===0&&e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:e.jsx("p",{className:"text-sm",children:"No assets defined for this belt yet."})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"📚 More belt assets will be added as content is developed for Orange Belt and beyond."})]})},de=({currentBelt:l})=>{const o=ne(),s=(l||"orientation").toLowerCase(),a=J,d=a.indexOf(s),{data:t}=C({queryKey:["user-badges-wall",o],queryFn:async()=>
5{if(!o)return[];const{data:c}=await j.from("user_badges").select("badge_type").eq("user_id",o);return(c||[]).map(f=>String(f.badge_type).toLowerCase())},enabled:!!o}),{data:r}=C({queryKey:["stored-belt-badges",o],queryFn:async()=>{if(!o)return[];const{data:c}=await j.from("user_badges").select("badge_type, earned_at").eq("user_id",o).like("badge_type","%_belt");return(c||[]).map(f=>String(f.badge_type).toLowerCase().replace(/_belt$/,""))},enabled:!!o}),i=d>0?a.slice(0,d):[],h=new Set([...i,...(t||[]).filter(c=>a.includes(c)),...(r||[]).filter(c=>a.includes(c))]),g=a.filter(c=>h.has(c)),p=a.filter(c=>!g.includes(c)),m=a.length;if(g.length===0&&p.length===0)return null;const u=c=>_[c]||c;return e.jsxs(v,{className:"border-2 border-border/50",children:[e.jsxs(P,{className:"pb-3 pt-4",children:[e.jsxs(I,{className:"text-base flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-amber-500"}),"Achievement Journey"]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Collected ",g.length," of ",m," Badges"]})]}),e.jsxs(T,{className:"pb-4",children:[g.length>0&&e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-3 uppercase tracking-wide",children:"Earned Badges"}),e.jsx(D,{children:e.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-5 md:grid-cols-11 gap-3",children:g.map(c=>{const f=_[c],n=K[c];return e.jsxs(E,{children:[e.jsx(O,{asChild:!0,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 group cursor-help",children:[e.jsx("div",{className:"w-20 h-20 md:w-24 md:h-24 rounded-xl flex items-center justify-center bg-gradient-to-br from-amber-50 to-orange-50 dark:from-amber-950/20 dark:to-orange-950/10 shadow-md ring-2 ring-amber-500/30 transition-all duration-300 group-hover:scale-110 group-hover:ring-amber-500/50 group-hover:shadow-lg",children:e.jsx("img",{src:n,alt:`${f} Badge`,className:"w-16 h-16 md:w-20 md:h-20 object-contain",loading:"lazy"})}),e.jsx("p",{className:"text-[10px] md:text-xs font-medium capitalize text-muted-foreground",children:f})]})}),e.jsxs(q,{children:[e.jsx("p",{className:"font-semibold capitalize",children:u(c)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Completed ✓"})]})]},c)})})})]}),p.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-3 uppercase tracking-wide",children:"Future Path"}),e.jsx(D,{children:e.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-5 md:grid-cols-11 gap-3",children:p.map(c=>{const f=_[c],n=K[c];return e.jsxs(E,{children:[e.jsx(O,{asChild:!0,children:e.jsxs("div",{className:"flex flex-col items-center gap-2 group cursor-help",children:[e.jsx("div",{className:"w-16 h-16 md:w-20 md:h-20 rounded-xl flex items-center justify-center bg-muted/30 shadow-sm transition-all duration-300 group-hover:scale-105",children:e.jsx("img",{src:n,alt:`${f} Badge`,className:"w-12 h-12 md:w-16 md:h-16 object-contain opacity-30 grayscale",loading:"lazy"})}),e.jsx("p",{className:"text-[10px] md:text-xs font-medium capitalize text-muted-foreground/60",children:f})]})}),e.jsxs(q,{children:[e.jsx("p",{className:"font-semibold capitalize",children:u(c)}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Locked 🔒"})]})]},c)})})})]})]})]})},$e=["orientation",...W],Me=({userId:l})=>{const{data:o}=C({queryKey:["hq-progress-details",l],queryFn:async()=>{var c,f;const[{data:s},{data:a},{data:d},{data:t},{data:r}]=await Promise.all([j.from("student_progress").select("current_level_id, levels(belt_color)").eq("user_id",l).maybeSingle(),j.from("assignments").select("id, belt_color").neq("assignment_type","belt_quiz"),j.from("assignment_responses").select("assignment_id, quiz_passed, assignment:assignments(belt_color)").eq("user_id",l).eq("quiz_passed",!0),j.from("assets").select("id, belt_color"),j.from("student_assets").select("asset_id, status, asset:assets(belt_color)").eq("user_id",l).eq("status","approved")]),i={};$e.forEach(n=>{const R=(a==null?void 0:a.filter(x=>{var b;return((b=x.belt_color)==null?void 0:b.toLowerCase())===n}))||[],$=(d==null?void 0:d.filter(x=>{var b,y;return((y=(b=x.assignment)==null?void 0:b.belt_color)==null?void 0:y.toLowerCase())===n}))||[],A=(t==null?void 0:t.filter(x=>{var b;return((b=x.belt_color)==null?void 0:b.toLowerCase())===n}))||[],S=(r==null?void 0:r.filter(x=>{var b,y;return((y=(b=x.asset)==null?void 0:b.belt_color)==null?void 0:y.toLowerCase())===n}))||[];i[n]={assignments:$.length,totalAssignments:R.length,assets:S.length,totalAssets:A.length}});const h=((f=(c=s==null?void 0:s.levels)==null?void 0:c.belt_color)==null?void 0:f.toLowerCase())||"hub",g=(d==null?void 0:d.length)||0,p=(a==null?void 0:a.length)||0,m=(r==null?void 0:r.length)||0,u=(t==null?void 0:t.length)||0;return{currentBelt:h,beltProgress:i,totalCompletedAssignments:g,totalAssignments:p,totalCompletedAssets:m,totalAssets:u,assignmentProgress:p>0?Math.round(g/p*100):0,assetProgress:u>0?Math.round(m/u*100):0}
5},enabled:!!l,staleTime:3e5});return e.jsxs(v,{className:"border border-border/50 bg-card",children:[e.jsxs(P,{className:"pb-3 flex flex-row items-center gap-3",children:[e.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:e.jsx("img",{src:Ae,alt:"Progress",className:"w-5 h-5 object-contain"})}),e.jsxs("div",{children:[e.jsx(I,{className:"text-base",children:"Progress Details"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Your full breakdown across all belts"})]})]}),e.jsx(T,{className:"p-4 pt-0",children:e.jsxs(Le,{defaultValue:"belts",className:"w-full mt-4",children:[e.jsxs(Te,{className:"grid grid-cols-3 w-full mb-4",children:[e.jsxs(M,{value:"belts",className:"gap-1.5 text-xs sm:text-sm",children:[e.jsx(pe,{className:"w-3.5 h-3.5"}),"Belts"]}),e.jsxs(M,{value:"assets",className:"gap-1.5 text-xs sm:text-sm",children:[e.jsx(U,{className:"w-3.5 h-3.5"}),"Assets"]}),e.jsxs(M,{value:"asset-guide",className:"gap-1.5 text-xs sm:text-sm",children:[e.jsx(fe,{className:"w-3.5 h-3.5"}),"Asset Guide"]})]}),e.jsx(F,{value:"belts",className:"mt-0 space-y-4",children:o&&e.jsxs(e.Fragment,{children:[e.jsx(de,{currentBelt:o.currentBelt}),e.jsxs(v,{className:"bg-muted/20 border-border/40",children:[e.jsx(P,{className:"pb-2 pt-4 px-4",children:e.jsx(I,{className:"text-base font-semibold",children:"Progress by Belt"})}),e.jsx(T,{className:"px-4 pb-4",children:e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:W.map(s=>{const a=o.beltProgress[s],d=a.totalAssignments>0?Math.round(a.assignments/a.totalAssignments*100):0,t=a.totalAssets>0?Math.round(a.assets/a.totalAssets*100):0,r=d===100;return e.jsxs("div",{className:`p-3 bg-card rounded-xl border flex items-start gap-3 transition-all ${r?"border-accent/30 bg-accent/5":"border-border/50"}`,children:[e.jsx("img",{src:k(s),alt:s,className:`w-12 h-12 flex-shrink-0 ${r?"":"opacity-60 grayscale"}`,loading:"lazy"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1",children:[e.jsxs("span",{className:"font-semibold capitalize text-sm",children:[s," Belt"]}),r&&e.jsx("span",{className:"text-[10px] bg-accent/10 text-accent px-1.5 py-0.5 rounded-full font-medium shrink-0",children:"✓ Done"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:be(s)}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs mb-0.5",children:[e.jsx("span",{className:"text-muted-foreground",children:"Assignments"}),e.jsxs("span",{className:"font-medium",children:[a.assignments,"/",a.totalAssignments]})]}),e.jsx(H,{value:d,className:"h-1.5"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between text-xs mb-0.5",children:[e.jsx("span",{className:"text-muted-foreground",children:"Assets"}),e.jsxs("span",{className:"font-medium",children:[a.assets,"/",a.totalAssets]})]}),e.jsx(H,{value:t,className:"h-1.5"})]})]})]})]},s)})})})]})]})}),e.jsx(F,{value:"assets",className:"mt-0",children:e.jsx(Pe,{userId:l})}),e.jsx(F,{value:"asset-guide",className:"mt-0",children:e.jsx(Re,{})})]})})]})},z="journey_map_variant",se="A",me=()=>{const l=je(),{data:o=se,isLoading:s}=C({queryKey:["journey-map-variant"],queryFn:async()=>{const{data:t,error:r}=await j.from("ai_coach_config").select("config_value").eq("config_key",z).maybeSingle();if(r)throw r;return(t==null?void 0:t.config_value)||se},staleTime:5*60*1e3}),{mutateAsync:a,isPending:d}=ye({mutationFn:async t=>{const{data:r}=await j.from("ai_coach_config").select("id").eq("config_key",z).maybeSingle();if(r){const{error:i}=await j.from("ai_coach_config").update({config_value:t,updated_at:new Date().toISOString()}).eq("config_key",z);if(i)throw i}else{const{error:i}=await j.from("ai_coach_config").insert({config_key:z,config_value:t});if(i)throw i}},onSuccess:(t,r)=>{l.setQueryData(["journey-map-variant"],r)}});return{activeVariant:o,setVariant:a,isLoading:s,isSaving:d}},xe="/assets/journey-path-background-DcdQj9bF.png",Fe="/assets/cosmic-path-journey-CeyB5WQ8.png",De="/assets/sunrise-summit-journey-Djx2K0QW.png",Ve="/assets/spiritual-river-journey-zBIOj9a_.png",Ue="/assets/crystal-canyon-journey-BHZ-JNor.png",V=[{id:"A",name:"Enchanted Forest",image:xe},{id:"B",name:"Cosmic Path",image:Fe},{id:"C",name:"Sunrise Summit",image:De},{id:"D",name:"Spiritual River",image:Ve},{id:"E",name:"Crystal Canyon",image:Ue}],Je=l=>{var o;return((o=V.find(s=>s.id===l))==null?void 0:o.image)||xe},We=()=>{const{isAdmin:l}=ie(),{activeVariant:o,setVariant:s,isSaving:a}=me();if(!l)return null;const d=async t=>{var r;if(t!==o)try{await s(t);const i=(r=V.find(h=>h.id===t))==null?void 0:r.name;G.success(`Published "${i}" as the journey map for all users`)}catch{G.error("Failed to update journey map variant")}};return e.jsxs("div",{className:"rounded-xl border border-dashed border-primary/40 bg-primary/5 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-primary",children:[e.jsx(Ne,{className:"h-4 w-4"}),e.jsx("span",{children:"Admin: Journey Map Visual (visible only to you)"}),a&&e.jsx(ve,{className:"h-3 w-3 animate-spin ml-auto"})]}
5),e.jsx("div",{className:"grid grid-cols-5 gap-2",children:V.map(t=>{const r=t.id===o;return e.jsxs("button",{onClick:()=>d(t.id),disabled:a,className:N("relative rounded-lg overflow-hidden border-2 transition-all duration-200 group",r?"border-primary ring-2 ring-primary/30":"border-border/50 hover:border-primary/50",a&&"opacity-60 cursor-wait"),children:[e.jsx("div",{className:"aspect-video",children:e.jsx("img",{src:t.image,alt:t.name,className:"w-full h-full object-cover",loading:"lazy"})}),e.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent p-1.5",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"text-[10px] sm:text-xs font-medium text-white leading-tight",children:[t.id,". ",t.name]}),r&&e.jsx("div",{className:"bg-primary rounded-full p-0.5",children:e.jsx(oe,{className:"h-2.5 w-2.5 text-primary-foreground"})})]})}),r&&e.jsx("div",{className:"absolute top-1 right-1 bg-primary text-primary-foreground text-[9px] font-semibold px-1.5 py-0.5 rounded-full",children:"LIVE"})]},t.id)})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Select a visual to publish it for all students. The change takes effect immediately."})]})},te={A:[{left:10,top:87},{left:17,top:76},{left:13,top:64},{left:22,top:53},{left:17,top:42},{left:30,top:35},{left:42,top:28},{left:53,top:22},{left:64,top:16},{left:76,top:10}],B:[{left:15,top:80},{left:8,top:68},{left:20,top:58},{left:33,top:52},{left:46,top:48},{left:38,top:36},{left:55,top:30},{left:67,top:25},{left:78,top:16},{left:84,top:8}],C:[{left:18,top:88},{left:30,top:84},{left:40,top:78},{left:34,top:70},{left:44,top:62},{left:50,top:55},{left:46,top:46},{left:54,top:36},{left:52,top:26},{left:50,top:13}],D:[{left:12,top:80},{left:8,top:68},{left:22,top:58},{left:16,top:46},{left:34,top:40},{left:48,top:46},{left:60,top:36},{left:72,top:42},{left:82,top:28},{left:90,top:14}],E:[{left:14,top:84},{left:22,top:76},{left:30,top:68},{left:36,top:58},{left:42,top:50},{left:50,top:42},{left:56,top:34},{left:64,top:26},{left:72,top:18},{left:80,top:10}]},Ye=l=>te[l]||te.A,Ke=({currentBelt:l,completedBelts:o})=>{const s=(l==null?void 0:l.toLowerCase())||"orientation",{activeVariant:a}=me(),d=Je(a),t=Ye(a);return e.jsxs("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden shadow-lg border border-border/50",children:[e.jsx("img",{src:d,alt:"Freedom Path Journey Map",className:"w-full h-full object-cover"}),J.map((r,i)=>{const h=t[i];if(!h)return null;const g=o.includes(r),p=r===s,m=!g&&!p;return e.jsxs("div",{className:"absolute transform -translate-x-1/2 -translate-y-1/2 group",style:{left:`${h.left}%`,top:`${h.top}%`},children:[p&&e.jsx("div",{className:"absolute inset-0 -m-2 rounded-full bg-yellow-400/40 animate-pulse blur-md"}),e.jsxs("div",{className:N("relative w-12 h-12 md:w-16 md:h-16 lg:w-20 lg:h-20 rounded-full transition-all duration-300",p&&"ring-4 ring-yellow-400 ring-offset-2 ring-offset-transparent scale-110",g&&!p&&"ring-2 ring-green-500/50",m&&"opacity-50 grayscale"),children:[e.jsx("img",{src:k(r),alt:`${Q(r).name}`,className:N("w-full h-full object-contain drop-shadow-lg",m&&"filter brightness-50"),loading:"lazy"}),m&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"bg-black/60 rounded-full p-1",children:e.jsx("svg",{className:"w-4 h-4 md:w-5 md:h-5 text-white/80",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"})})})}),g&&!p&&e.jsx("div",{className:"absolute -bottom-1 -right-1 bg-emerald-600 rounded-full p-0.5 shadow-lg",children:e.jsx("svg",{className:"w-3 h-3 md:w-4 md:h-4 text-white",fill:"currentColor",viewBox:"0 0 20 20",children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})})]}),e.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 -bottom-8 opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none z-10",children:e.jsxs("div",{className:"bg-background/95 backdrop-blur-sm border border-border rounded-md px-2 py-1 shadow-lg whitespace-nowrap",children:[e.jsx("span",{className:"text-xs font-medium",children:Q(r).name}),m&&e.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(Locked)"}),p&&e.jsx("span",{className:"text-xs text-yellow-600 ml-1",children:"(Current)"}),g&&!p&&e.jsx("span",{className:"text-xs text-green-600 ml-1",children:"✓"})]})})]},r)}),e.jsx("div",{className:"absolute bottom-2 left-2 bg-background/80 backdrop-blur-sm rounded-lg px-3 py-2 border border-border/50",children:e.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-yellow-400 animate-pulse"}),e.jsx("span",{children:"Current"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-emerald-600"}),e.jsx("span",{children:"Completed"})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"w-3 h-3 rounded-full bg-gray-400 opacity-50"}),e.jsx("span",{children:"Locked"})]})]})})]})},He={white:"from-zinc-50 to-white border-zinc-200",yellow:"from-yellow-50 to-amber-50 border-yellow-300",orange:"from-orange-50 to-amber-50 border-orange-300",purple:"from-purple-50 to-fuchsia-50 border-purple-300",green:"from-emerald-50 to-green-50 border-emerald-300",blue:"from-sky-50 to-blue-50 border-blue-300",brown:"from-amber-50 to-stone-100 border-amber-700/40",black:"from-zinc-100 to-zinc-200 border-zinc-700",red:"from-red-50 to-rose-50 border-red-400"},Ge={white:"bg-zinc-300",yellow:"bg-yellow-400",orange:"bg-orange-500",purple:"bg-purple-500",green:"bg-emerald-500",blue:"bg-blue-500",brown:"bg-amber-700",black:"bg-zinc-900",red:"bg-red-500"},Qe=l=>l?ze[l]||Z:Z,Ze=({tool:l,locked:o,onClick:s})=>{const a=Qe(l.icon);return e.jsxs("button",{onClick:s,disabled:o&&!l.route_path,className:N("group flex flex-col items-center gap-1.5 w-[88px] text-center transition-all","hover:-translate-y-0.5"),title:l.name,children:[e.jsxs("div",{className:N("h-14 w-14 roun
5ded-2xl border flex items-center justify-center shadow-sm bg-white","group-hover:shadow-md transition-shadow relative",o&&"opacity-60"),children:[e.jsx(a,{className:"h-6 w-6 text-foreground/80"}),o&&e.jsx("div",{className:"absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-background border flex items-center justify-center",children:e.jsx(L,{className:"h-2.5 w-2.5 text-muted-foreground"})})]}),e.jsx("div",{className:"text-[11px] leading-tight text-foreground/80 line-clamp-2 font-medium",children:l.name})]})},Xe=()=>{const l=ae(),{currentBelt:o}=Y(),{isTeacher:s,isAdmin:a}=ie(),{hasPurchasedCourse:d}=ce(),t=s||a,r=t||d("orientation"),{data:i,isLoading:h}=C({queryKey:["soulpath-map-tools"],queryFn:async()=>{const{data:m,error:u}=await j.from("tools").select("id, name, description, unlock_belt, display_order, icon, route_path").order("unlock_belt").order("display_order");if(u)throw u;return m}}),g=o?we(o):-1,p=(i||[]).reduce((m,u)=>{var c;return(m[c=u.unlock_belt]||(m[c]=[])).push(u),m},{});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("h2",{className:"text-xl font-bold",children:"The SoulPreneur Path"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Orientation plus nine levels — and the tools that unlock at each stage."})]}),e.jsx(v,{className:"p-5 bg-gradient-to-br from-pink-50 to-rose-50 border-pink-200 cursor-pointer hover:shadow-md transition-shadow",onClick:()=>l("/entry-orientation"),title:r?"Open Orientation":"Unlock Orientation · $27",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"h-12 w-12 rounded-xl bg-white border flex items-center justify-center shadow-sm relative",children:[e.jsx(_e,{className:"h-6 w-6 text-pink-700"}),!r&&e.jsx("div",{className:"absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-background border flex items-center justify-center",children:e.jsx(L,{className:"h-2.5 w-2.5 text-muted-foreground"})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("h3",{className:"font-semibold",children:"Orientation"}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-pink-200/60 text-pink-900 px-1.5 py-0.5 rounded",children:"Level 0 · Foundation"}),!r&&e.jsx("span",{className:"text-[10px] uppercase tracking-wide bg-foreground
5/80 text-background px-1.5 py-0.5 rounded",children:"Unlock · $27"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r?"Set up your foundation, purge to your three products, and prepare to enter the belt journey.":"Set your foundation and purge to your three products. Purchase to begin."})]})]})}),e.jsx("div",{className:"space-y-3",children:h?Array.from({length:9}).map((m,u)=>e.jsx(re,{className:"h-28 w-full"},u)):W.map((m,u)=>{const c=p[m]||[],f=!t&&(g<0||u>g);return e.jsx(v,{className:N("p-4 bg-gradient-to-br border",He[m],f&&"opacity-80"),children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsxs("button",{onClick:()=>l(`/${m}-belt`),className:"flex flex-col items-center gap-2 w-24 shrink-0 group",title:`Go to ${_[m]} Belt`,children:[e.jsx("img",{src:k(m),alt:`${_[m]} belt`,className:"h-12 w-12 object-contain group-hover:scale-105 transition-transform"}),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"flex items-center gap-1 justify-center",children:[e.jsx("span",{className:N("h-1.5 w-1.5 rounded-full",Ge[m])}),e.jsxs("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:["L",u+1]})]}),e.jsx("div",{className:"text-xs font-semibold",children:_[m]})]})]}),e.jsx("div",{className:"flex-1 min-w-0",children:c.length===0?e.jsx("div",{className:"text-xs text-muted-foreground italic py-4",children:"Tools coming soon for this belt."}):e.jsx("div",{className:"flex flex-wrap gap-2",children:c.map(n=>e.jsx(Ze,{tool:n,locked:f,onClick:()=>{n.route_path&&(!f||t)?l(n.route_path):f&&l(`/${m}-belt`)}},n.id))})})]})},m)})}),e.jsx("p",{className:"text-[11px] text-center text-muted-foreground",children:"Tap a belt badge to open that course · tap a tool tile to launch it · locked tools unlock as you progress."})]})},es=()=>{const l=ne(),{currentBelt:o,loading:s}=Y(),{data:a=[]}=Se(l||null);if(s||!l)return e.jsx("div",{className:"flex items-center justify-center min-h-[40vh]",children:e.jsx("div",{className:"animate-pulse text-muted-foreground",children:"Loading your journey…"})});const d=(o==null?void 0:o.toLowerCase())||"orientation",t=J,r=t.indexOf(d),i=t.slice(0,Math.max(0,r)),h=a.map(p=>p.badge_type.toLowerCase()),g=Array.from(new Set([...i,...h]));return e.jsxs("div",{className:"space-y-6",children:[e.jsx(We,{}),e.jsx(Ke,{currentBelt:d,completedBelts:g}),e.jsx(Xe,{}),e.jsx(de,{currentBelt:d}),e.jsx(Me,{userId:l})]})},ns=()=>{const{session:l}=Ce(),{isLoading:o}=ke(),{loading:s}=ce(),{currentBelt:a,loading:d}=Y();return l?o||s?e.jsx(ee,{showBreadcrumbs:!1,children:e.jsx(Be,{})}):!d&&a==="hub"?e.jsx(X,{to:"/my-library",replace:!0}):e.jsxs(ee,{showBreadcrumbs:!1,maxWidth:"6xl",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"My Journey"}),e.jsx(Ee,{routePath:"/my-courses"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Your SoulPreneur journey — levels, achievements, and the path ahead. Your courses, workshops, and downloads live in My Library."})]}),e.jsx("div",{className:"mt-6",children:e.jsx(es,{})})]}):e.jsx(X,{to:"/freedom-path",replace:!0})};export{ns 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.