1"use strict";(globalThis.webpackChunksophia_mvp_client||=[]).push([[197],{122(e,a,s){s.d(a,{A:()=>j});var l=s(5043),i=s(4505);const t={container:"RealtimeComparisonView_container__KMLJ8",header:"RealtimeComparisonView_header__N7yH7",title:"RealtimeComparisonView_title__pe0nV",subtitle:"RealtimeComparisonView_subtitle__Ow7bQ",cohortName:"RealtimeComparisonView_cohortName__i0kJO",daysActive:"RealtimeComparisonView_daysActive__6NZWm",metricsGrid:"RealtimeComparisonView_metricsGrid__kfQfK",metricCard:"RealtimeComparisonView_metricCard__CSlHL",metricIcon:"RealtimeComparisonView_metricIcon__0baGK",metricLabel:"RealtimeComparisonView_metricLabel__DiTYo",percentileContainer:"RealtimeComparisonView_percentileContainer__sjTj1",percentileBar:"RealtimeComparisonView_percentileBar__F28g1",percentileFill:"RealtimeComparisonView_percentileFill__bexmu",percentileValue:"RealtimeComparisonView_percentileValue__boFhZ",top:"RealtimeComparisonView_top__kmfKJ",high:"RealtimeComparisonView_high__sEkRF",average:"RealtimeComparisonView_average__TEt0+",building:"RealtimeComparisonView_building__HOn4S",metricMessage:"RealtimeComparisonView_metricMessage__Kjn3x",cohortSize:"RealtimeComparisonView_cohortSize__gOIcC",infoText:"RealtimeComparisonView_infoText__Id0GE",emptyState:"RealtimeComparisonView_emptyState__xr5V7",helpText:"RealtimeComparisonView_helpText__D4zaE"};var r=s(579);const n=function(e){let{cohortComparison:a,stageFriendlyName:s,daysActive:l}=e;if(!a)return(0,r.jsx)("div",{className:t.container,children:(0,r.jsxs)("div",{className:t.emptyState,children:[(0,r.jsx)("p",{children:"Comparison data not available yet."}),(0,r.jsx)("p",{className:t.helpText,children:"Keep interacting to build your progress profile!"})]})});const i=[{key:"todos",label:"Tasks"},{key:"learning",label:"Learning"},{key:"conversation",label:"Engagement"},{key:"barriers",label:"Self-Awareness",specialMessage:!0}].filter(e=>a[e.key]&&a[e.key].cohortSize>0);return(0,r.jsxs)("div",{className:t.container,children:[(0,r.jsxs)("div",{className:t.header,children:[(0,r.jsx)("h2",{className:t.title,children:"Your Progress Among Peers"}),(0,r.jsxs)("p",{className:t.subtitle,children:["Compared to ",(0,r.jsx)("span",{className:t.cohortName,children:s})]}),(0,r.jsxs)("p",{className:t.daysActive,children:["Day ",l," of your journey"]})]}),(0,r.jsx)("div",{className:t.metricsGrid,children:i.map(e=>{const s=a[e.key],l=s.rank||"building",i=s.percentile||0;return(0,r.jsxs)("div",{className:t.metricCard,children:[(0,r.jsx)("span",{className:t.metricLabel,children:e.label}),(0,r.jsxs)("div",{className:t.percentileContainer,children:[(0,r.jsx)("div",{className:t.percentileBar,children:(0,r.jsx)("div",{className:`${t.percentileFill} ${t[l]}`,style:{width:`${i}%`}})}),(0,r.jsxs)("span",{className:t.percentileValue,children:[i,"%"]})]}),(0,r.jsx)("p",{className:t.metricMessage,children:s.message}),s.cohortSize>5&&(0,r.jsxs)("p",{className:t.cohortSize,children:["vs. ",s.cohortSize," ",1===s.cohortSize?"user":"users"]})]},e.key)})}),(0,r.jsx)("p",{className:t.infoText,children:"Comparisons update as you progress"})]})};var c=s(6490);const d=function(e){let{weeklyComparison:a,daysActive:s}=e;if(!a||!a.metrics)return null;const{weekLabel:l,metrics:i}=a,n=[{label:"Task Completion",Icon:c.dS,data:i.todos},{label:"Learning Progress",Icon:c.vP,data:i.learning},{label:"Engagement Level",Icon:c.PB,data:i.conversation},{label:"Self-Awareness",Icon:c.uQ,data:i.barriers}];return(0,r.jsxs)("div",{className:t.container,children:[(0,r.jsxs)("div",{className:t.header,children:[(0,r.jsx)("h2",{className:t.title,children:"Your Weekly Progress"}),(0,r.jsxs)("p",{className:t.subtitle,children:[l," \u2022 Day ",s]})]}),(0,r.jsx)("div",{className:t.metricsGrid,children:n.map((e,a)=>{if(!e.data)return null;const{percentile:s,message:l,rank:i,cohortSize:n}=e.data;return(0,r.jsxs)("div",{className:t.metricCard,children:[(0,r.jsxs)("div",{className:t.metricHeader,children:[(0,r.jsx)("span",{className:t.metricIcon,children:(0,r.jsx)(e.Icon,{size:20})}),(0,r.jsx)("h3",{className:t.metricLabel,children:e.label})]}),(0,r.jsx)("div",{className:t.percentileContainer,children:(0,r.jsx)("div",{className:t.percentileBar,children:(0,r.jsx)("div",{className:`${t.percentileFill} ${t[i]}`,style:{width:`${s}%`},children:(0,r.jsxs)("span",{className:t.percentileValue,children:[s,"%"]})})})}),(0,r.jsxs)("div",{className:t.metricMessage,children:[(0,r.jsx)("p",{children:l}),n>5&&(0,r.jsxs)("p",{className:t.cohortSize,children:["vs. ",n," ",1===n?"user":"users"]})]})]},a)})}),(0,r.jsx)("div",{className:t.footer,children:(0,r.jsx)("p",{className:t.footerText,children:"Your progress is compared to other users in your journey week. Rankings update automatically as you engage with the platform."})})]})},o="BenchmarkCard_container__UjAw-",_="BenchmarkCard_loadingState__+3+gh",m="BenchmarkCard_spinner__njL2f",h="BenchmarkCard_loadingText__U773X",u="BenchmarkCard_errorState__YWFq3",x="BenchmarkCard_errorText__RQ4V-",g="BenchmarkCard_errorDetail__zqkVy";const j=function(e){let{onError:a}=e;const[s,t]=(0,l.useState)(null),[c,j]=(0,l.useState)(!0),[p,v]=(0,l.useState)(null);if((0,l.useEffect)(()=>{(async()=>{try{j(!0),v(null);const e=await i.mx.getBenchmarks();t(e)}catch(e){console.error("[BenchmarkCard] Error loading benchmarks:",e);const s=e.message||"Failed to load benchmark data";v(s),a&&a(e)}finally{j(!1)}})()},[a]),c)return(0,r.jsx)("div",{className:o,children:(0,r.jsxs)("div",{className:_,children:[(0,r.jsx)("div",{className:m}),(0,r.jsx)("p",{className:h,children:"Loading your progress comparison..."})]})});if(p)return(0,r.jsx)("div",{className:o,children:(0,r.jsxs)("div",{className:u,children:[(0,r.jsx)("p",{className:x,children:"Unable to load comparison data"}),(0,r.jsx)("p",{className:g,children:p})]})});if(!s)return null;const{benchmarkType:N,cohortComparison:b,stageFriendlyName:B,daysActive:C,weeklyComparison:y}=s;return"realtime"===N?(0,r.jsx)(n,{cohortComparison:b,stageFriendlyName:B,daysActive:C}):"weekly"===N?(0,r.jsx)(d,{weeklyComparison:y,daysActive:C}):null}},197(e,a,s){s.r(a),s.d(a,{default:()=>Ta});var l=s(5043),i=s(4505),t=s(2198),r=s(6490),n=s(240);const c="BeadDetailModal_header__aDpvL",d="BeadDetailModal_beadContainer__4pwj-",o="BeadDetailModal_beadImage__iedSK",_="BeadDetailModal_locked__jFvRI",m="BeadDetailModal_beadPlaceholder__8FCqn",h="BeadDetailModal_lockOverlay__V-Z1m",u="BeadDetailModal_lockIcon__R9jbw",x="BeadDetailModal_beadInfo__ZokWx",g="BeadDetailModal_beadName__qzmnP",j="BeadDetailModal_beadMeta__vImmN",p="BeadDetailModal_category__1E1K7",v="BeadDetailModal_earnedDate__UEYBm",N="BeadDetailModal_section__XJfKP",b="BeadDetailModal_sectionTitle__rgmOT",B="BeadDetailModal_description__JCy4g",C="BeadDetailModal_unlockStory__2VyfP",y="BeadDetailModal_quoteIcon__KW8nY",w="BeadDetailModal_unlockStoryText__1QtLa",k="BeadDetailModal_socialProof__6GAzd",f="BeadDetailModal_socialIcon__ZhuKx",S="BeadDetailModal_socialText__D95vY",D="BeadDetailModal_storiesList__rTt+O",E="BeadDetailModal_storyCard__etxRr",V="BeadDetailModal_storyQuote__9w9eo",M="BeadDetailModal_storyText__UaXU1",R="BeadDetailModal_storyAttribution__NzEuk",T="BeadDetailModal_triggerHint__Nsk+o",$="BeadDetailModal_loadingOverlay__1S7oS",A="BeadDetailModal_spinner__S-q9Q";var L=s(579);const F={first_steps:"First Steps",consistency:"Consistency",learning:"Learning",progress:"Progress",breakthrough:"Breakthrough",hidden:"Hidden"};const P=function(e){let{bead:a,isEarned:s,earnedAt:t,onClose:P}=e;const[G,I]=(0,l.useState)([]),[z,U]=(0,l.useState)(null),[Y,W]=(0,l.useState)(!0),O=F[null===a||void 0===a?void 0:a.bead_category]||"";return(0,l.useEffect)(()=>
1{if(null===a||void 0===a||!a.id)return;(async()=>{W(!0);try{const[e]=await Promise.all([i.aR.getBeadStories(a.bead_slug||a.bead_id||a.id),i.aR.getAggregateStats()]);I(e.stories||[]),U(e.earnedCount||null)}catch(e){console.error("[BeadDetailModal] Failed to fetch data:",e)}finally{W(!1)}})()},[null===a||void 0===a?void 0:a.id,null===a||void 0===a?void 0:a.bead_id,null===a||void 0===a?void 0:a.bead_slug]),a?(0,L.jsxs)(n.A,{isOpen:!0,onClose:P,labelledBy:"bead-detail-title",tone:"dark",size:"sm",children:[(0,L.jsxs)("div",{className:c,children:[(0,L.jsxs)("div",{className:d,children:[s?a.bead_image?(0,L.jsx)("img",{src:a.bead_image,alt:a.bead_name,className:o}):(0,L.jsx)("div",{className:m,style:{backgroundColor:"var(--color-primary)"}}):a.bead_shadow?(0,L.jsx)("img",{src:a.bead_shadow,alt:a.bead_name,className:`${o} ${_}`}):(0,L.jsx)("div",{className:`${m} ${_}`,style:{backgroundColor:"var(--color-ink)"}}),!s&&(0,L.jsx)("div",{className:h,children:(0,L.jsx)("svg",{className:u,viewBox:"0 0 24 24",fill:"currentColor",width:"24",height:"24",children:(0,L.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2z"})})})]}),(0,L.jsxs)("div",{className:x,children:[(0,L.jsx)("h2",{className:g,id:"bead-detail-title",children:a.bead_name}),O&&(0,L.jsx)("div",{className:j,children:(0,L.jsx)("span",{className:p,children:O})}),s&&t&&(0,L.jsxs)("p",{className:v,children:["Earned on ",(e=>{if(!e)return"";return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})(t)]})]})]}),s&&a.description&&(0,L.jsx)("div",{className:N,children:(0,L.jsx)("p",{className:B,children:a.description})}),s&&a.unlock_story&&(0,L.jsx)("div",{className:N,children:(0,L.jsxs)("div",{className:C,children:[(0,L.jsx)("span",{className:y,children:'"'}),(0,L.jsx)("p",{className:w,children:a.unlock_story})]})}),z&&(0,L.jsxs)("div",{className:k,children:[(0,L.jsx)("span",{className:f,children:(0,L.jsx)(r.c2,{size:18})}),(0,L.jsxs)("span",{className:S,children:[z.toLocaleString()," users earned this"]})]}),s&&G.length>0&&(0,L.jsxs)("div",{className:N,children:[(0,L.jsx)("h3",{className:b,children:"What others said"}),(0,L.jsx)("div",{className:D,children:G.map((e,a)=>(0,L.jsxs)("div",{className:E,children:[(0,L.jsx)("span",{className:V,children:(0,L.jsx)(r.PB,{size:18})}),(0,L.jsx)("p",{className:M,children:e.quote_text}),(0,L.jsxs)("span",{className:R,children:["\u2014 ",e.attribution||"User on similar journey"]})]},e.id||a))})]}),!s&&a.trigger_hint&&(0,L.jsxs)("div",{className:N,children:[(0,L.jsx)("h3",{className:b,children:"How to earn"}),(0,L.jsx)("p",{className:T,children:a.trigger_hint})]}),Y&&(0,L.jsx)("div",{className:$,children:(0,L.jsx)("div",{className:A})})]}):null},G="BeadCollection_container__gbyl1",I="BeadCollection_header__+Mvfn",z="BeadCollection_progressInfo__PFU+n",U="BeadCollection_progressCount__GbaGr",Y="BeadCollection_progressLabel__NIGdt",W="BeadCollection_progressBar__t9nrk",O="BeadCollection_progressFill__8p6O+",K="BeadCollection_categoryFilter__kuDPV",q="BeadCollection_categoryButton__Mkrhg",H="BeadCollection_active__wdO4T",J="BeadCollection_section__zE1gK",Z="BeadCollection_sectionTitle__jGO-T",Q="BeadCollection_beadGrid__OSpEL",X="BeadCollection_beadItem__ZA-KQ",ee="BeadCollection_locked__rCZGE",ae="BeadCollection_beadImage__vor3v",se="BeadCollection_beadPlaceholder__0jAh4",le="BeadCollection_beadShadow__h4cY3",ie="BeadCollection_beadShadowPlaceholder__BTnt0",te="BeadCollection_beadName__t1hN+",re="BeadCollection_newBadge__Y+zgo",ne="BeadCollection_hiddenHint__Ouvji",ce="BeadCollection_emptyState__cpYCe",de="BeadCollection_emptyText__nehkm",oe="BeadCollection_loading__hoYkU",_e="BeadCollection_spinner__GA1Dj",me="BeadCollection_error__0JT6I",he="BeadCollection_retryButton__-0yWj",ue=[{id:"all",name:"All"},{id:"first_steps",name:"First Steps"},{id:"consistency",name:"Consistency"},{id:"learning",name:"Learning"},{id:"progress",name:"Progress"},{id:"milestones",name:"Milestones"},{id:"breakthrough",name:"Breakthrough"},{id:"hidden",name:"Hidden"}],xe={silver:"#C0C0C0",gold:"#FFD700",bronze:"#C0C0C0",jade:"var(--color-primary)",rose_gold:"#C0C0C0",crystal:"#E8E8E8"};const ge=function(e){let{className:a,earnedBeads:s=[]}=e;const[t,r]=(0,l.useState)([]),[n,c]=(0,l.useState)(!0),[d,o]=(0,l.useState)(null),[_,m]=(0,l.useState)("all"),[h,u]=(0,l.useState)(null),x=s.length>0?new Set(s.map(e=>e.bead_slug)):null,g=(0,l.useCallback)(async()=>{c(!0),o(null);try{const e=await i.aR.getAllBeads();r(e.beads||[])}catch(e){console.error("[BeadCollection] Failed to fetch beads:",e),o("Failed to load collection")}finally{c(!1)}},[]);(0,l.useEffect)(()=>{g()},[g]);const j=(()=>
1{if(!x)return t;const e=new Set(t.map(e=>e.bead_slug));return[...t.map(e=>({...e,is_earned:x.has(e.bead_slug)||e.is_earned})),...s.filter(a=>a.bead_slug&&!e.has(a.bead_slug)).map(e=>({id:e.id||e.bead_id,bead_slug:e.bead_slug,bead_name:e.bead_name||e.bead_slug,bead_tier:e.bead_tier||"silver",bead_category:e.bead_category||"first_steps",bead_image:e.bead_image,bead_shadow:e.bead_shadow,description:e.description,is_earned:!0,is_hidden:!1,awarded_at:e.awarded_at,is_viewed:e.is_viewed}))]})(),p="all"===_?j:j.filter(e=>e.bead_category===_),v=p.filter(e=>e.is_earned),N=p.filter(e=>!e.is_earned&&!e.is_hidden),b=p.filter(e=>!e.is_earned&&e.is_hidden),B=j.filter(e=>e.is_earned).length,C=j.filter(e=>!e.is_hidden||e.is_earned).length,y=e=>{e.is_hidden&&!e.is_earned||u(e)};return n?(0,L.jsx)("div",{className:`${G} ${a||""}`,children:(0,L.jsxs)("div",{className:oe,children:[(0,L.jsx)("div",{className:_e}),(0,L.jsx)("span",{children:"Loading collection..."})]})}):d?(0,L.jsx)("div",{className:`${G} ${a||""}`,children:(0,L.jsxs)("div",{className:me,children:[(0,L.jsx)("span",{children:d}),(0,L.jsx)("button",{className:he,onClick:g,children:"Try again"})]})}):(0,L.jsxs)("div",{className:`${G} ${a||""}`,children:[(0,L.jsxs)("div",{className:I,children:[(0,L.jsxs)("div",{className:z,children:[(0,L.jsxs)("span",{className:U,children:[B," of ",C]}),(0,L.jsx)("span",{className:Y,children:"beads collected"})]}),(0,L.jsx)("div",{className:W,children:(0,L.jsx)("div",{className:O,style:{width:B/C*100+"%"}})})]}),(0,L.jsx)("div",{className:K,children:ue.map(e=>(0,L.jsx)("button",{className:`${q} ${_===e.id?H:""}`,onClick:()=>m(e.id),children:e.name},e.id))}),v.length>0&&(0,L.jsxs)("div",{className:J,children:[(0,L.jsxs)("h3",{className:Z,children:["Earned (",v.length,")"]}),(0,L.jsx)("div",{className:Q,children:v.map(e=>(0,L.jsxs)("button",{className:X,onClick:()=>y(e),children:[e.bead_image?(0,L.jsx)("img",{src:e.bead_image,alt:e.bead_name,className:ae}):(0,L.jsx)("div",{className:se,style:{backgroundColor:xe[e.bead_tier]||"#C0C0C0"}}),(0,L.jsx)("span",{className:te,children:e.bead_name}),!e.is_viewed&&(0,L.jsx)("span",{className:re,children:"NEW"})]},e.id))})]}),N.length>0&&(0,L.jsxs)("div",{className:J,children:[(0,L.jsxs)("h3",{className:Z,children:["Locked (",N.length,")"]}),(0,L.jsx)("div",{className:Q,children:N.map(e=>(0,L.jsxs)("button",{className:`${X} ${ee}`,onClick:()=>y(e),children:[e.bead_shadow?(0,L.jsx)("img",{src:e.bead_shadow,alt:e.bead_name,className:le}):(0,L.jsx)("div",{className:ie}),(0,L.jsx)("span",{className:te,children:e.bead_name})]},e.id))})]}),b.length>0&&"all"===_&&(0,L.jsx)("div",{className:ne,children:(0,L.jsxs)("span",{children:[b.length," secret beads await discovery..."]})}),0===p.length&&(0,L.jsx)("div",{className:ce,children:(0,L.jsx)("p",{className:de,children:"No beads in this category yet"})}),h&&(0,L.jsx)(P,{bead:h,isEarned:h.is_earned,earnedAt:h.awarded_at,onClose:()=>{u(null)}})]})},je="BraceletPreview_container__AlHBv",pe="BraceletPreview_userBracelet__XA7ip",ve="BraceletPreview_bracelet__LboDz",Ne="BraceletPreview_chain__+pklF",be="BraceletPreview_clasp__ngle+",Be="BraceletPreview_bead__-YyeY",Ce="BraceletPreview_beadImage__7wSXu",ye="BraceletPreview_emptyBead__oUVa6",we="BraceletPreview_count__mDdc-",ke={silver:"#C0C0C0",gold:"#FFD700",bronze:"#C0C0C0",jade:"var(--color-primary)",rose_gold:"#C0C0C0",crystal:"#E8E8E8"};const fe=function(e){let{beadSlugs:a=[],beadImages:s=[],beadCount:l=0,maxBeads:i=15,isUserBracelet:t=!1}=e;const r=Math.min(l||a.length,i),n=Math.max(0,i-r),c={};s.forEach(e=>{e.slug&&(c[e.slug]=e)});const d=e=>{if(!e)return"var(--color-neutral-500)";const a=c[e];return null!==a&&void 0!==a&&a.tier&&ke[a.tier]?ke[a.tier]:e.includes("gold")||e.includes("habit")||e.includes("champion")?ke.gold:e.includes("jade")||e.includes("mission")||e.includes("three")?ke.jade:e.includes("bronze")||e.includes("article")||e.includes("curious")?ke.bronze:e.includes("rose")||e.includes("fear")||e.includes("confidence")?ke.rose_gold:e.includes("crystal")||e.includes("breakthrough")?ke.crystal:ke.silver},o=[];return s.length>0?s.slice(0,r).forEach((e,a)=>{o.push({slug:e.slug,image:e.image,tier:e.tier,key:`img-${a}`})}):a.length>0?a.slice(0,r).forEach((e,a)=>{const s=c[e];o.push({slug:e,image:null===s||void 0===s?void 0:s.image,tier:null===s||void 0===s?void 0:s.tier,key:`slug-${a}`})}):r>0&&Array.from({length:r}
1).forEach((e,a)=>{o.push({slug:null,image:null,tier:"silver",key:`placeholder-${a}`})}),(0,L.jsxs)("div",{className:`${je} ${t?pe:""}`,children:[(0,L.jsxs)("div",{className:ve,children:[(0,L.jsx)("div",{className:Ne}),(0,L.jsx)("div",{className:be}),o.map(e=>e.image?(0,L.jsx)("img",{src:e.image,alt:e.slug||"bead",className:Ce,title:e.slug||"Bead"},e.key):(0,L.jsx)("div",{className:Be,style:{backgroundColor:d(e.slug)},title:e.slug||"Bead"},e.key)),Array.from({length:n}).map((e,a)=>(0,L.jsx)("div",{className:ye},`empty-${a}`)),(0,L.jsx)("div",{className:be})]}),(0,L.jsxs)("span",{className:we,children:[r," bead",1!==r?"s":""]})]})},Se="GhostBracelets_container__+aJ3n",De="GhostBracelets_header__A8k4P",Ee="GhostBracelets_title__Sheut",Ve="GhostBracelets_subtitle__U9dbO",Me="GhostBracelets_braceletLabel__JlwFa",Re="GhostBracelets_userSection__fRJ+9",Te="GhostBracelets_ghostSection__XYgNd",$e="GhostBracelets_ghostCard__D5Am4",Ae="GhostBracelets_emptyState__5aFsD",Le="GhostBracelets_emptyText__vuf-Z",Fe="GhostBracelets_privacyNote__e2clB",Pe="GhostBracelets_loading__8bT8U",Ge="GhostBracelets_spinner__0RDUS",Ie="GhostBracelets_error__lNLjz",ze="GhostBracelets_retryButton__qyyep";const Ue=function(e){let{className:a,earnedBeads:s=[]}=e;const[t,r]=(0,l.useState)(null),[n,c]=(0,l.useState)(!0),[d,o]=(0,l.useState)(null),_=(0,l.useCallback)(async()=>{c(!0),o(null);try{const e=await i.aR.getGhostBracelets();r(e)}catch(e){console.error("[GhostBracelets] Failed to fetch:",e),o("Failed to load")}finally{c(!1)}},[]);if((0,l.useEffect)(()=>{_()},[_]),n)return(0,L.jsx)("div",{className:`${Se} ${a||""}`,children:(0,L.jsxs)("div",{className:Pe,children:[(0,L.jsx)("div",{className:Ge}),(0,L.jsx)("span",{children:"Finding similar journeys..."})]})});if(d)return(0,L.jsx)("div",{className:`${Se} ${a||""}`,children:(0,L.jsxs)("div",{className:Ie,children:[(0,L.jsx)("span",{children:d}),(0,L.jsx)("button",{className:ze,onClick:_,children:"Try again"})]})});if(!t)return null;const{userBracelet:m,ghostBracelets:h,beadImageMap:u}=t,x=new Set(s.map(e=>e.bead_slug));return(0,L.jsxs)("div",{className:`${Se} ${a||""}`,children:[(0,L.jsxs)("div",{className:De,children:[(0,L.jsx)("h3",{className:Ee,children:"Similar Journeys"}),(0,L.jsx)("p",{className:Ve,children:"See how others on a similar path are progressing"})]}),m&&(0,L.jsxs)("div",{className:Re,children:[(0,L.jsx)("div",{className:Me,children:"You"}),(0,L.jsx)(fe,{beadSlugs:m.bead_slugs||[],beadImages:[...s].reverse().map(e=>({slug:e.bead_slug,image:e.bead_image,tier:e.bead_tier})),beadCount:s.length||m.bead_count,isUserBracelet:!0})]}),h&&h.length>0&&(0,L.jsx)("div",{className:Te,children:h.map((e,a)=>{return(0,L.jsxs)("div",{className:$e,children:[(0,L.jsxs)("div",{className:Me,children:[e.firstname||"Someone",e.label?` \xb7 ${e.label}`:""]}),(0,L.jsx)(fe,{beadSlugs:e.bead_slugs||[],beadImages:(s=e.bead_slugs,s&&u?s.map(e=>{const a=u[e];return{slug:e,image:x.has(e)?(null===a||void 0===a?void 0:a.image)||null:(null===a||void 0===a?void 0:a.shadow)||null,tier:(null===a||void 0===a?void 0:a.tier)||"silver"}}):[]),beadCount:e.bead_count,isUserBracelet:!1})]},`ghost-${a}`);var s})}),(!h||0===h.length)&&(0,L.jsx)("div",{className:Ae,children:(0,L.jsx)("p",{className:Le,children:"Keep going! We'll find similar journeys as more users join."})}),(0,L.jsx)("div",{className:Fe,children:(0,L.jsx)("span",{children:"First names and progress only - no other info shared"})})]})};var Ye=s(122),We=s(8532);const Oe="Bracelet_container__hRvwR",Ke="Bracelet_tabBar__MHERe",qe="Bracelet_tab__Ca5yq",He="Bracelet_activeTab__57O5P",Je="Bracelet_content__jQEC-",Ze="Bracelet_braceletView__OdV7L",Qe="Bracelet_collectionView__-XVr+",Xe="Bracelet_othersView__8AnjS",ea="Bracelet_braceletComponent__uxVpR",aa="Bracelet_recentSection__EyvCo",sa="Bracelet_sectionTitle__ZzUq6",la="Bracelet_recentList__ETfwK",ia="Bracelet_chartLoading__IV8r6",ta="Bracelet_winsList__ox7Tl",ra="Bracelet_winItem__kVWqQ",na="Bracelet_winCheck__y8pSZ",ca="Bracelet_winContent__+0tIw",da="Bracelet_winTask__PeXhy",oa="Bracelet_winDate__0Awyb",_a="Bracelet_nextList__JK5Up",ma="Bracelet_nextItem__WkJox",ha="Bracelet_nextBullet__ayEYY",ua="Bracelet_nextContent__vKY+d",xa="Bracelet_nextTask__SDGsP",ga="Bracelet_nextCategory__xmMnc",ja="Bracelet_viewAllButton__a94vE",pa="Bracelet_recentBead__DRroX",va="Bracelet_recentBeadImage__Ywaib",Na="Bracelet_recentBeadPlaceholder__WrqA5",ba="Bracelet_recentBeadInfo__Y97eV",Ba="Bracelet_recentBeadName__uk0FZ",Ca="Bracelet_recentBeadDate__rnUxr",ya="Bracelet_newBadge__igkaB",wa="Bracelet_loadingState__jFCzS",ka="Bracelet_spinner__nZpmD",fa="Bracelet_errorState__DtxiG",Sa="Bracelet_buttonGroup__7UQq0",Da="Bracelet_retryButton__olwaW",Ea="Bracelet_backButton__xEqnF",Va=(0,l.lazy)(()=>s.e(348).then(()=>s(348))),Ma=[{id:"bracelet",label:"Beads"},{id:"collection",label:"Collection"},{id:"others",label:"Others"}];function Ra(e){const a=new Date(e),s=new Date-a,l=Math.floor(s/864e5);return l<=0?"Today":1===l?"Yesterday":l<7?`${l} days ago`:l<30?`${Math.floor(l/7)} weeks ago`:a.toLocaleDateString("en-US",{month:"short",day:"numeric"})}const Ta=function(e){let{onBack:a,onNavigateToTasks:s,animateBeadSlug:r}=e;const[n,c]=(0,l.useState)("bracelet"),[d,o]=(0,l.useState)([]),[_,m]=(0,l.useState)(null),[h,u]=(0,l.useState)(!0),[x,g]=(0,l.useState)(null),[j,p]=(0,l.useState)(null),v=(0,l.useCallback)(async()=>{u(!0),g(null);try{const[e,a]=await Promise.all([i.aR.getEarnedBeads(),i.mx.getStats().catch(()=>null)]);o(e.beads||[]),m(a)}catch(e){console.error("[Bracelet] Error loading data:",e),g(e.message||"Failed to load beads")}finally{u(!1)}},[]);(0,l.useEffect)(()=>{v()},[v]),(0,l.useEffect)(()=>{const e=d.filter(e=>!1===e.is_viewed);e.length>0&&(console.log(`[Bracelet] ${e.length} unviewed bead(s) detected - triggering reveal`),window.dispatchEvent(new Event("checkBeads")))},[d]),(0,l.useEffect)(()=>{const e=()=>{console.log("[Bracelet] Bead viewed event received - reloading data"),v()};return window.addEventListener("beadViewed",e),()=>window.removeEventListener("beadViewed",e)},[v]);const N=(0,l.useMemo)(()=>d.filter(e=>!1!==e.is_viewed),[d]),b=d.length,B=d.filter(e=>!e.is_viewed).slice(0,3);return h?(0,L.jsx)("div",{className:Oe,children:(0,L.jsxs)("div",{className:wa,children:[(0,L.jsx)("div",{className:ka}),(0,L.jsx)("span",{children:"Loading your beads..."})]})}):x?(0,L.jsx)("div",{className:Oe,children:(0,L.jsxs)("div",{className:fa,children:[(0,L.jsx)("h2",{children:"Unable to Load"}),(0,L.jsx)("p",{children:x}),(0,L.jsxs)("div",{className:Sa,children:[(0,L.jsx)("button",{onClick:v,className:Da,children:"Retry"}),(0,L.jsx)("button",{onClick:a,className:Ea,children:"Back to Chat"})]})]})}):(0,L.jsxs)("div",{className:Oe,children:[(0,L.jsx)(We.A,{title:"Your Beads",subtitle:`${b} beads earned`,onBack:a,backLabel:"Chat"}),(0,L.jsx)("div",{className:Ke,children:Ma.map(e=>(0,L.jsx)("button",{className:`${qe} ${n===e.id?He:""}`,onClick:()=>c(e.id),children:e.label},e.id))}),(0,L.jsxs)("div",{className:Je,children:["bracelet"===n&&(0,L.jsxs)("div",{className:Ze,children:[(0,L.jsx)(t.A,{beads:N,animateBeadSlug:r,backgroundImage:"/assets/bracelet-background.webp",cordTexture:"/assets/rope-segment.png",leftClaspTexture:"/assets/clasp-left.png",rightClaspTexture:"/assets/clasp-right.png",className:ea}),B.length>0&&(0,L.jsxs)("div",{className:aa,children:[(0,L.jsx)("h3",{className:sa,children:"Recently Earned"}),(0,L.jsx)("div",{className:la,children:B.map(e=>(0,L.jsxs)("button",{className:pa,onClick:()=>(e=>{p(e)})(e),children:[e.bead_image?(0,L.jsx)("img",{src:e.bead_image,alt:e.bead_name,className:va}):(0,L.jsx)("div",{className:Na}),(0,L.jsxs)("div",{className:ba,children:[(0,L.jsx)("span",{className:Ba,children:e.bead_name}),(0,L.jsx)("span",{className:Ca,children:e.awarded_at?Ra(e.awarded_at):"Recently"})]}),(0,L.jsx)("span",{className:ya,children:"NEW"})]},e.id))})]}),(0,L.jsx)(Ye.A,{onError:e=>console.error("[Bracelet] Benchmark error:",e)}),(0,L.jsx)(l.Suspense,{fallback:(0,L.jsx)("div",{className:ia,children:"Loading insights..."}),children:(0,L.jsx)(Va,{})}),(null===_||void 0===_?void 0:_.recentWins)&&_.recentWins.length>0&&(0,L.jsxs)("div",{className:aa,children:[(0,L.jsx)("h3",{className:sa,children:"Recent Wins"}),(0,L.jsx)("div",{className:ta,children:_.recentWins.map((e,a)=>(0,L.jsxs)("div",{className:ra,children:[(0,L.jsx)("div",{className:na,children:"\u2713"}),(0,L.jsxs)("div",{className:ca,children:[(0,L.jsx)("p",{className:da,children:e.task}),e.completed_at&&(0,L.jsx)("p",{className:oa,children:new Date(e.completed_at).toLocaleDateString("en-US",{month:"short",day:"numeric"})})]})]},a))})]}),(null===_||void 0===_?void 0:_.whatsNext)&&_.whatsNext.length>0&&(0,L.jsxs)("div",{className:aa,children:[(0,L.jsx)("h3",{className:sa,children:"What's Next"}),(0,L.jsx)("div",{className:_a,children:_.whatsNext.map((e,a)=>(0,L.jsxs)("div",{className:ma,children:[(0,L.jsx)("div",{className:ha,children:"\u2022"}),(0,L.jsxs)("div",{className:ua,children:[(0,L.jsx)("p",{className:xa,children:e.task}),e.category&&(0,L.jsx)("p",{className:ga,children:e.category})]})]},a))}),(0,L.jsx)("button",{onClick:s,className:ja,children:"View Full Action Plan \u2192"})]})]}),"collection"===n&&(0,L.jsx)(ge,{className:Qe,earnedBeads:d}),"others"===n&&(0,L.jsx)(Ue,{className:Xe,earnedBeads:d})]}),j&&(0,L.jsx)(P,{bead:j,isEarned:!0,earnedAt:j.awarded_at,onClose:()=>{p(null)}})]})}}}]); 2//# sourceMappingURL=197.73645cb8.chunk.js.map
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.