1import{j as e,m as _}from"./kinematics-Di5PXsRQ.js";import{a as h,af as $,aB as C,aQ as M,aR as T,bl as E,J as b,H as L}from"./glyphs-myXpDwvS.js";import{B as N}from"./student-portal-DSGij66U.js";import{D as R,h as S}from"./algebra-CcXhFBFE.js";import"./chemistry-lab-TYyt26Gh.js";import"./acoustics-DPHqfUB8.js";import"./meteorology-7juZoOw8.js";import"./earth-science-52cTImor.js";import"./periodic-table-QDa7g7Xi.js";const i={bg:"hsl(216 32% 6%)",surface:"hsl(216 26% 9%)",elevated:"hsl(216 22% 12%)",border:"hsl(216 20% 16%)",text:"hsl(0 0% 96%)",textSub:"hsl(216 15% 48%)",textMuted:"hsl(216 12% 32%)"};function z(n){let o=n.trim();return o.startsWith("@")&&(o=o.slice(1)),o}function Q({username:n,onNavigate:o,embedded:p}){var v;const[t,m]=h.useState(null),[y,x]=h.useState(""),[I,g]=h.useState(!0),a=z(n);h.useEffect(()=>{let s=!1;const d=()=>{g(!0),x(""),fetch(`/api/user/${encodeURIComponent(a)}`,{credentials:"include"}).then(async c=>{const l=await c.json();if(!c.ok)throw new Error(l.error||"Not found");s||m(l.user)}).catch(c=>{s||x(c.message||"Failed to load profile")}).finally(()=>{s||g(!1)})};d();const f=c=>{const l=c.detail,w=l!=null&&l.username?String(l.username):"";w&&z(w)===a?(m(W=>({...W||{},...l})),x(""),g(!1)):d()};return window.addEventListener("rosin-profile-updated",f),window.addEventListener("rosin-profile-updated",f),()=>{s=!0,window.removeEventListener("rosin-profile-updated",f),window.removeEventListener("rosin-profile-updated",f)}},[a]);const r=(t==null?void 0:t.profile_color)||"#4d8dff",j=(t==null?void 0:t.display_name)||(t==null?void 0:t.username)||a,k=s=>{o?o(`${S.mu()}?t=${s.id}`):window.location.href=`/?m=${encodeURIComponent(`${S.mu()}?t=${s.id}`)}`};return I?e.jsx("div",{className:"profile-page",style:{...u(p),display:"flex",alignItems:"center",justifyContent:"center",color:i.textMuted,fontSize:13},children:"Loading profileâ¦"}):y||!t?e.jsxs("div",{className:"profile-page",style:{...u(p),display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:10},children:[e.jsx($,{size:28,style:{color:i.textMuted}}),e.jsx("p",{style:{color:i.text,fontSize:15,fontWeight:650,margin:0},children:y||"User not found"}),e.jsxs("p",{style:{color:i.textMuted,fontSize:12,margin:0},children:["@",a]})]}):e.jsxs("div",{className:"profile-page",style:u(p),children:[e.jsxs("div",{className:"profile-banner",style:{position:"relative",height:p?160:220,background:i.elevated,overflow:"hidden"},children:[t.banner_url?e.jsx("img",{src:t.banner_url,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("div",{style:{width:"100%",height:"100%",background:`linear-gradient(135deg, ${r}55 0%, hsl(216 32% 8%) 55%, hsl(250 30% 12%) 100%)`}}),e.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to top, hsl(216 32% 6%) 0%, transparent 55%)"}})]}),e.jsxs("div",{className:"profile-body",style:{maxWidth:720,margin:"0 auto",padding:"0 24px 48px",position:"relative"},children:[e.jsxs("div",{className:"profile-identity",style:{display:"flex",alignItems:"flex-end",gap:18,marginTop:-48},children:[e.jsx("div",{className:"profile-avatar",style:{width:96,height:96,borderRadius:24,overflow:"hidden",border:`3px solid ${i.bg}`,background:i.surface,flexShrink:0,boxShadow:`0 0 0 2px ${r}66`},children:t.avatar_url?e.jsx("img",{src:t.avatar_url,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontSize:36,fontWeight:700,color:r,background:i.elevated},children:(j[0]||"?").toUpperCase()})}),e.jsxs("div",{style:{flex:1,minWidth:0,paddingBottom:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("h1",{className:"profile-name",style:{fontSize:24,fontWeight:750,color:i.text,margin:0},children:j}),(t.is_admin||0)>0&&e.jsxs("span",{style:{fontSize:10,fontWeight:700,padding:"3px 8px",borderRadius:6,background:`${r}22`,color:r,display:"inline-flex",alignItems:"center",gap:4},children:[e.jsx(C,{size:10})," Staff"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap",marginTop:4},children:[e.jsxs("p",{style:{fontSize:13,color:i.textSub,margin:0},children:["@",t.username||a]}),!!((v=t.badges)!=null&&v.length)&&e.jsx(N,{badges:t.badges,max:8,size:12,subtle:!0})]})]})]}),t.status&&e.jsx(_.p,{initial:{opacity:0,y:4}
1,animate:{opacity:1,y:0},style:{marginTop:16,padding:"10px 14px",borderRadius:10,background:`${r}14`,border:`1px solid ${r}33`,color:i.text,fontSize:13,fontStyle:"italic"},children:t.status}),t.bio!=null&&String(t.bio).trim()!==""&&e.jsx("p",{style:{marginTop:14,color:i.textSub,fontSize:14,lineHeight:1.55,marginBottom:0,whiteSpace:"pre-wrap"},children:t.bio}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:14,marginTop:14,color:i.textMuted,fontSize:12},children:[t.location&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx(M,{size:12})," ",t.location]}),t.website&&e.jsxs("a",{href:t.website,target:"_blank",rel:"noreferrer",style:{display:"inline-flex",alignItems:"center",gap:5,color:r,textDecoration:"none"},children:[e.jsx(T,{size:12})," ",t.website.replace(/^https?:\/\//,"")]}),t.created_at&&e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5},children:[e.jsx(E,{size:12})," Joined ",new Date(t.created_at).toLocaleDateString("en-US",{month:"short",year:"numeric"})]})]}),e.jsxs("div",{style:{marginTop:32},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:14},children:[e.jsx(b,{size:14,style:{color:r}}),e.jsx("h2",{style:{fontSize:13,fontWeight:700,color:i.text,margin:0,letterSpacing:"0.04em",textTransform:"uppercase"},children:"Favorite music"})]}),(!t.favorite_music||t.favorite_music.length===0)&&e.jsx("p",{style:{color:i.textMuted,fontSize:12},children:"No favorite tracks yet."}),e.jsx("div",{className:"profile-music-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(220px, 1fr))",gap:10},children:(t.favorite_music||[]).map(s=>e.jsxs("button",{onClick:()=>k(s),style:{display:"flex",alignItems:"center",gap:12,padding:10,borderRadius:12,background:i.surface,border:`1px solid ${i.border}`,cursor:"pointer",textAlign:"left"},children:[e.jsxs("div",{style:{width:48,height:48,borderRadius:9,overflow:"hidden",background:i.elevated,flexShrink:0,position:"relative"},children:[s.artwork?e.jsx(R,{src:s.artwork,alt:"",style:{width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:i.textMuted},children:e.jsx(b,{size:16})}),e.jsx("div",{style:{position:"absolute",inset:0,background:"hsl(216 32% 6% / 0.35)",display:"flex",alignItems:"center",justifyContent:"center",opacity:0},onMouseEnter:d=>{d.currentTarget.style.opacity="1"},onMouseLeave:d=>{d.currentTarget.style.opacity="0"},children:e.jsx(L,{size:14,fill:"#fff",color:"#fff"})})]}),e.jsxs("div",{style:{minWidth:0},children:[e.jsx("p",{style:{fontSize:12,fontWeight:650,color:i.text,margin:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.title}),e.jsx("p",{style:{fontSize:10,color:i.textMuted,margin:"3px 0 0",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.artist})]})]},s.id))})]})]})]})}function u(n){return{position:n?"absolute":"relative",inset:n?0:void 0,minHeight:n?void 0:"100vh",height:n?"100%":void 0,overflow:"auto",background:i.bg,color:i.text}}export{Q 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.