e.target === e.currentTarget && onclose()}>
{#if loading || !profile}
{:else}

{profile.username}

{#if profile.level_info?.title} {profile.level_info.title} {/if}
{profile.online ? 'Online now' : `Seen ${ago(profile.last_seen)}`} • {profile.friends_count} Friends • Level {profile.level_info?.level ?? 1}
{#if profile.guild || profile.rank}
{#if profile.guild}{/if} {#if profile.rank} {profile.rank.display}{/if}
{/if}
{#if isMe} {/if}
{#if !isMe && profile.relationship}
{#if profile.relationship === 'accepted'} {#if confirmRemove} Remove {profile.username} from your friends? {:else} {/if} {:else if profile.relationship === 'pending_incoming'} {profile.username} wants to be friends {:else if profile.relationship === 'pending_outgoing'} Friend request sent {:else} {/if}
{/if}
{#if editing}
Accent colour
{#each swatches as c} {/each} (editAccent = e.currentTarget.value)} aria-label="Custom colour" />
{:else if profile.bio}

{profile.bio}

{/if} {#if profile.badges && profile.badges.length > 0}
{#each profile.badges as badge} {badge} {/each}
{/if}
{#if activeTab === 'overview'}
Level{profile.level_info?.level ?? 1}
Playtime{formatPlaytime(profile.stats?.playtime_secs ?? 0)}
K/D{kd}
Wealth{money(profile.wealth ?? 0)}
Favourite server{profile.favorite_server ?? '–'}
Joined{new Date(profile.created_at).toLocaleDateString()}
{#if profile.featured_achievement}
Featured{profile.featured_achievement.title}
{/if} {#if profile.mutual_friends && profile.mutual_friends.length}

{profile.mutual_friends.length} mutual friend{profile.mutual_friends.length === 1 ? '' : 's'}

{#each profile.mutual_friends as m (m.uuid)} {/each}
{/if}

Recent activity

{#if profile.recent_activity && profile.recent_activity.length}
{#each profile.recent_activity as a} {@const Icon = activityIcon[a.kind] ?? Sparkles}
{a.text}{ago(a.at)}
{/each}
{:else}

Nothing yet. Activity shows up as they play.

{/if}
{:else if activeTab === 'feed'}
{#if isMe}
{/if} {#if profile.posts.length === 0}

No posts yet from {profile.username}.

{:else}
{#each profile.posts as post (post.id)}
{profile.username} {new Date(post.created_at).toLocaleString()}

{post.content}

{#if post.image_url}
Post Attachment
{/if}
{/each}
{/if}
{:else if activeTab === 'progression'}
Account Progression

SCOPENET Global Level

Level {profile.level_info.level}
{profile.level_info.current_xp.toLocaleString()} XP {profile.level_info.next_level_xp.toLocaleString()} XP
{#if profile.server_levels && profile.server_levels.length > 0}

Server Specific Levels

{#each profile.server_levels as sl}
{sl.server_name} {#if sl.rank_title} {sl.rank_title} {/if}
Lv. {sl.level}
{sl.current_xp} / {sl.next_level_xp} XP
{/each}
{:else}

No server levels recorded yet.

{/if}
{:else if activeTab === 'achievements'}
{#if profile.achievements.length === 0}

No achievements unlocked yet.

{:else}
{#each profile.achievements as ach (ach.id)}
{ach.title}

{ach.description}

+{ach.xp_reward} XP
{/each}
{/if}
{:else if activeTab === 'stats'}
{#if profile.stats}
Playtime {formatPlaytime(profile.stats.playtime_secs)}
Player Kills {profile.stats.player_kills.toLocaleString()}
Mob Kills {profile.stats.mob_kills.toLocaleString()}
Blocks Mined {profile.stats.blocks_broken.toLocaleString()}
Blocks Placed {profile.stats.blocks_placed.toLocaleString()}
Server Joins {profile.stats.joins.toLocaleString()}
{:else}

No statistics recorded yet for this player.

{/if}
{/if}
{/if}