try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`d06ed05b-d794-4be1-8a28-507764d32592`,e._sentryDebugIdIdentifier=`sentry-dbid-d06ed05b-d794-4be1-8a28-507764d32592`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{$i as t,Ag as n,Yh as r,Zm as i,_r as a,jg as o,ng as s,op as c}from"./entry.client-mpghtlrl.js";import{P as l}from"./xds-icons-m106f2fc.js";import{n as u,r as d}from"./useWidget-nf2epnjz.js";import{t as f}from"./useWidgetNavigation-os2rjdn1.js";import{t as p}from"./WidgetInteractable-mzv6xcil.js";import{d as m}from"./data-k1o1noin.js";var h=e(o(),1),g=n(),_=s(),v=e=>{let t=(0,g.c)(21),{achievement:n}=e,r=`flex size-12 flex-shrink-0 items-center justify-center rounded-full border-2 ${n.unlocked?`border-yellow-400 bg-yellow-400/20`:`border-white/20 bg-white/5`}`,i=`text-2xl ${n.unlocked?``:`opacity-30`}`,a;t[0]===i?a=t[1]:(a=(0,_.jsx)(`div`,{className:i,children:`🏆`}),t[0]=i,t[1]=a);let o;t[2]!==r||t[3]!==a?(o=(0,_.jsx)(`div`,{className:r,children:a}),t[2]=r,t[3]=a,t[4]=o):o=t[4];let s;t[5]===n.name?s=t[6]:(s=(0,_.jsx)(`span`,{className:`truncate text-white type-body`,children:n.name}),t[5]=n.name,t[6]=s);let c;t[7]===n.description?c=t[8]:(c=(0,_.jsx)(`p`,{className:`text-white/60 type-caption`,children:n.description}),t[7]=n.description,t[8]=c);let l;t[9]===n.unlocked?l=t[10]:(l=n.unlocked&&(0,_.jsx)(`span`,{className:`text-green-400 type-caption`,children:`✓ Unlocked`}),t[9]=n.unlocked,t[10]=l);let u;t[11]!==s||t[12]!==c||t[13]!==l?(u=(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[s,c,l]}),t[11]=s,t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;t[15]===n.gamerscore?d=t[16]:(d=(0,_.jsxs)(`span`,{className:`flex-shrink-0 pt-0.5 text-white/80 type-caption`,children:[n.gamerscore,`G`]}),t[15]=n.gamerscore,t[16]=d);let f;return t[17]!==o||t[18]!==u||t[19]!==d?(f=(0,_.jsxs)(`div`,{className:`flex w-full items-start gap-3`,children:[o,u,d]}),t[17]=o,t[18]=u,t[19]=d,t[20]=f):f=t[20],f},y=0;function b(){return y}var x=e=>{let n=(0,g.c)(10),{navigate:r}=e,i,a;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={title:`Achievements`,icon:(0,_.jsx)(l,{})},n[0]=a):a=n[0],i=a,d(i);let o=b(),[s,c]=(0,h.useState)(o===0);t(!s);let y,x;n[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{if(o<=0)return;let e=setTimeout(()=>{c(!0)},o);return()=>clearTimeout(e)},x=[o],n[1]=y,n[2]=x):(y=n[1],x=n[2]),(0,h.useEffect)(y,x);let S;n[3]===r?S=n[4]:(S={getNavigateParams:w,getHeader:T,navigate:r},n[3]=r,n[4]=S);let{isReady:C,getItemProps:D}=f(S),{visibility:O}=u();if(!C||O===`hidden`)return null;if(!s){let e;return n[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,_.jsx)(`div`,{className:`flex h-full w-full flex-col gap-2 p-2`,children:[1,2,3].map(E)}),n[5]=e):e=n[5],e}let k;n[6]===D?k=n[7]:(k=m.map(e=>(0,_.jsx)(p,{className:`group flex cursor-pointer rounded p-3 text-start hover:bg-white/10`,...D(e),children:(0,_.jsx)(v,{achievement:e})},e.id)),n[6]=D,n[7]=k);let A;return n[8]===k?A=n[9]:(A=(0,_.jsx)(`div`,{className:`flex h-full w-full flex-col gap-2 p-2`,children:k}),n[8]=k,n[9]=A),A},S=a(x,()=>{let{router:e}=i(),{mutate:t}=r(e.mutations.navigate.getOptions());return{navigate:t}}),C=()=>{let e=(0,g.c)(2),t=S.useComponent(),n;return e[0]===t?n=e[1]:(n=(0,_.jsx)(t,{}),e[0]=t,e[1]=n),n};function w(e,t){return{key:t,to:c.widget.achievements.byId.id,params:{achievementId:e.id}}}function T(e){return{title:e.name}}function E(e){return(0,_.jsx)(`div`,{className:`h-20 animate-pulse rounded bg-white/5`},e)}export{C as Achievements,S as AchievementsConnection,x as PureAchievements};