1import{L as T,a as F}from"./LevelheadPlaylistCopyButton-CRkdCl7E.js";import{d as I,_ as C,a as n,o as a,c as o,b as t,f as i,w as u,g as p,t as r,q as m,$ as D,S as V,K as W,I as q,r as v,a8 as R,n as $,F as _,e as k,a7 as S,M as b,z as E,A as j,p as z,h as G}from"./index-kY4EFsKJ.js";import{L as O}from"./LevelheadLevelsPager-HsE9Cm2Z.js";import{L as Y}from"./LevelheadPlayerFollowButton-DZeQkOdG.js";import{A as K,L as H,l as J,c as Q}from"./levelhead-ui-D0dGcIoC.js";import{c as X}from"./copy-v2KDzhft.js";import{L as Z}from"./LevelheadLookup-CP5G7pml.js";import{P as x}from"./PlatformIcon-DMUoPwPZ.js";import"./LevelheadLevelWidget-C_TbF9Sq.js";import"./LogoEpic-H7GGgRm7.js";const ee=I({components:{LevelheadPlaylistBookmarkButton:T,LevelheadPlaylistCopyButton:F},props:{playlist:{type:Object,required:!0}}}),te={class:"levelhead-playlist-widget"},se={"aria-label":"Playlist stats"},le={key:0},ae={class:"playlist-actions"};function ie(e,l,d,y,g,M){const c=n("router-link"),f=n("levelhead-playlist-bookmark-button"),w=n("levelhead-playlist-copy-button");return a(),o("div",te,[t("h2",null,[i(c,{to:{name:"levelhead-playlist",params:{playlistId:e.playlist.playlistId}}},{default:u(()=>[p(r(e.playlist.name),1)]),_:1},8,["to"])]),t("ul",se,[t("li",null,r(e.playlist.count)+" Levels",1)]),e.playlist.description?(a(),o("p",le,r(e.playlist.description),1)):m("",!0),t("div",ae,[i(f,{"level-ids":e.playlist.levelIds},null,8,["level-ids"]),i(c,{class:"levelhead-playlist-bookmark-button rumpus-button-small",to:{name:"levelhead-playlist",params:{playlistId:e.playlist.playlistId}}},{default:u(()=>[p(" View Levels ")]),_:1},8,["to"]),i(w,{"playlist-id":e.playlist.playlistId},null,8,["playlist-id"])])])}const oe=C(ee,[["render",ie],["__scopeId","data-v-15c136c4"]]),re=I({methods:{socialProviderNameToFAIcon(e){return["fab",e=="reddit"?"reddit-alien":e]},socialProviderProfilePage(e,l){return e=="reddit"?`https://www.reddit.com/user/${l}`:e=="steam"?`https://steamcommunity.com/id/${l}`:e=="twitch"?`https://www.twitch.tv/${l}`:e=="twitter"?`https://twitter.com/${l}`:e=="youtube"?`https://www.youtube.com/channel/${l}`:""}}}),ne=[{token:"pstat_numfollowing",stat:"NumFollowing"},{token:"pstat_shoes",stat:"Shoes"},{token:"pstat_levels_published",stat:"Published"},{token:"pstat_crowns",stat:"Crowns"},{token:"pstat_levels_played",stat:"LevelsPlayed"}],de=[{token:"pstat_cpprog",stat:"CampaignProg",transform:e=>`${e}%`},{token:"pstat_published_plays",stat:"Plays"},{token:"pstat_playtime_generated",stat:"PlayTime",transform:e=>Q(e)},{token:"pstat_favegen",stat:"FaveGen"},{token:"pstat_likegen",stat:"LikeGen"},{token:"pstat_dailybuild",stat:"DBComp"},{token:"pstat_wins",stat:"Wins"},{token:"pstat_fails",stat:"Fails"},{token:"pstat_dailychall",stat:"ChalWins"},{token:"pstat_timetrophies",stat:"TimeTrophies"},{token:"pstat_bucks_tipped",stat:"BucksTipped"},{token:"pstat_tips_earned",stat:"TipsGotten"}],ue=I({components:{LevelheadLookup:Z,Avatar:K,LevelheadPlaylistWidget:oe,LevelheadLevelStat:H,PlatformIcon:x,LevelheadLevelsPager:O,LevelheadPlayerFollowButton:Y},mixins:[D,V,X,re,W,q],data(){return{strings:J,playlists:[],fetchingPlaylists:!1,areMorePlaylists:!0,profile:null,stats:[],linkedStats:[],doesNotExist:!1,alias:null,connections:null,revertedLevelCount:0}},computed:{userId(){return this.$route.params.userId},shortlink(){let e="https://";return this.development&&(e+="dev."),e+=`levelhead.io/@${this.userId}`,e},currentUser(){return this.$store.getters.currentUser||{}},username(){return this.alias?this.alias:`@${this.userId}`},isSelf(){return this.currentUser.userId==this.userId}},watch:{currentUser(){this.updatePage()},"$route.params.userId"(){this.$route.params.userId&&this.updatePage()}},created(){this.updatePage()},methods:{redirectIfSelfWithoutUserId(){return this.$route.params.userId=="@me"?(this.$router.replace({params:{userId:this.currentUser.userId}}),!0):!1},async countRevertedLevels(){this.revertedLevelCount=0;const e=await v({method:"get",url:`/api/storage/crates/lh-published-levels/items?count=true&owners=${this.profile.userId}&stats=Deleted%3D%3Dtrue`});this.revertedLevelCount=e.data},async toggleMute(){const e=`/api/storage/crates/lh-profiles/items/${this.profile._id}/stats`,l=await v({url:e,method:"patch",params:{permissionsOverride:!0},data:{setStats:{Muted:!this.profile.stats.Muted}}});this.profile.stats.Muted=l.data.stats.Muted},async updatePage(){this.redirectIfSelfWithoutUserId()||(await this.fetchUserProfile(),await this.fetchConnections().catch(e=>console.log(e)),await this.fetchPlaylists(null,!0),this.currentUser.userId==this.profile.userId&&await this.countRevertedLevels(),R({title:`${this.alias} Levelhead Profile`,description:"Levelhead Player Profile,"}))},copyUrl(){this.copy(this.shortlink);const e={url:this.shortlink};navigator.canShare&&navigator.canShare(e)?navigator.share(e):this.showSuccessMessage("Sharecode URL copied!")},async fetchConnections(){try{const e=await v({method:"get",url:`/api/auth/accounts/${this.userId}/integrations`});e.data.length?this.connections=e.data.filter(l=>l.public):this.connections=[]}catch(e){console.log(e)}},async fetchUserProfile(){this.profile=null;const e=await v({method:"get",url:"/api/levelhead/profiles",params:{userIds:this.userId,limit:1,includeStats:!0,includeAliases:!0,includeMyInteractions:!0}});if(!e.data.length)return this.doesNotExist=!0,this.profile=!1,!1;this.profile=e.data[0],this.profile.alias=this.profile.alias||{},this.alias=this.profile.alias.alias,this.stats=[],this.linkedStats=[];for(const l of de){const d={value:0,...l};d.value=this.profile.stats[l.stat]||0,this.stats.push(d)}for(const l of ne){const d={value:0,...l};d.value=this.profile.stats[l.stat]||0,this.linkedStats.push(d)}},async fetchPlaylists(e,l){if(l&&(this.areMorePlaylists=!0,this.fetchingPlaylists=!1,this.playlists=[]),!this.areMorePlaylists||this.fetchingPlaylists)return!1;this.fetchingPlaylists=!0;const d={userId:this.userId,limit:5,createdBefore:""};if(this.playlists.length){const g=this.playlists[this.playlists.length-1];d.createdBefore=g.createdAt}const y=await v({method:"get",url:"/api/levelhead/playlists",params:d});this.fetchingPlaylists=!1,(!y.data.length||y.data.length%d.limit!==0)&&(this.areMorePlaylists=!1),this.playlists.push(...y.data)}}}),h=e=>(z("data-v-118e247a"),e=e(),G(),e),pe={class:"levelhead-profile-page"},he={style:{display:"flex","flex-wrap":"wrap","justify-content":"center",gap:"2ex","list-style":"none","margin-bottom":"1em"}},ce={key:0,class:"profile-panel animated fadeIn"},fe={class:"profile"},me={class:"avatar-panel"},ye={class:"lookup-panel"}
1,ve={"aria-label":"Levelhead Alias",class:"levelhead-alias"},_e={key:0,class:"connections"},ke=["href","title"],ge={key:1,class:"username"},we={key:1,class:"connections"},be={key:0,class:"admin-panel"},Ie=h(()=>t("h3",null,"Admin",-1)),Pe={class:"linked-stats","aria-label":"stats"},Le={class:"stats","aria-label":"stats"},$e={class:"levels-panel"},Se={class:"levels-header"},Ce={key:0,class:"playlist-section animated fadeIn"},Me=h(()=>t("h2",{id:"playlists"}," Level Playlists ",-1)),Ue={key:0},Be=h(()=>t("br",null,null,-1)),Ae={key:1,class:"playlists"},Ne=["disabled"],Te={key:1,class:"reverted-levels-section animated fadeIn"},Fe=h(()=>t("h2",null," Reverted Levels ",-1)),De=h(()=>t("p",null," We temporarily store your reverted levels just in case something goes wrong. You can recover them here. ",-1)),Ve=h(()=>t("p",null," After recovering a level here go back to the game, find the level in your list of published levels, and attempt to revert it into your workshop again. ",-1)),We={key:1,class:"italic"},qe={key:2},Re=h(()=>t("h3",null,"Profile Not Found",-1)),Ee=h(()=>t("p",null," Whoops, that user doesn't have a Levelhead profile! ",-1)),je=[Re,Ee];function ze(e,l,d,y,g,M){const c=n("icon"),f=n("router-link"),w=n("levelhead-lookup"),U=n("avatar"),B=n("levelhead-player-follow-button"),A=n("platform-icon"),P=n("levelhead-level-stat"),L=n("levelhead-levels-pager"),N=n("levelhead-playlist-widget");return a(),o("div",pe,[t("nav",he,[t("li",null,[i(f,{to:{name:"levelhead-creators"},title:"Browse Creators"},{default:u(()=>[i(c,{icon:"external-link-square-alt"}),p(" "+r(e.t("creator_browser")),1)]),_:1})]),t("li",null,[i(f,{to:{name:"levelhead-marketing"},title:"Visit the Marketing Department"},{default:u(()=>[i(c,{icon:"external-link-square-alt"}),p(" "+r(e.t("marketing")),1)]),_:1})]),t("li",null,[i(f,{to:{name:"levelhead-tower"},title:"Visit the Tower"},{default:u(()=>[i(c,{icon:"external-link-square-alt"}),p(" "+r(e.t("the_tower")),1)]),_:1})])]),t("div",{class:$(["lookup-section",{"profile-exists":e.profile}])},[i(w,{type:"player"})],2),e.profile?(a(),o("div",ce,[t("section",fe,[t("div",me,[i(U,{"avatar-id":e.profile.alias.avatarId||"bureau-employee",size:"256"},null,8,["avatar-id"]),i(B,{class:"followers-panel","user-id":e.profile.userId,subscribers:e.profile.stats.Subscribers,following:e.profile.interactions&&e.profile.interactions.following},null,8,["user-id","subscribers","following"])]),t("p",ye,[t("span",ve,r(e.username),1),t("a",{title:"Copy sharecode URL",role:"button",class:"levelhead-lookup",onClick:l[0]||(l[0]=(...s)=>e.copyUrl&&e.copyUrl(...s))},[p(" @"+r(e.userId)+" ",1),i(c,{icon:"copy"})])]),i(S,{name:"fade",mode:"out-in"},{default:u(()=>[e.connections&&e.connections.length?(a(),o("p",_e,[t("ul",null,[(a(!0),o(_,null,k(e.connections,s=>(a(),o("li",{key:s.provider,class:"connection"},[t("span",{class:$(`icon ${s.provider}`)},[i(A,{provider:s.provider},null,8,["provider"])],2),e.socialProviderProfilePage(s.provider,s.username)?(a(),o("a",{key:0,class:"username",href:e.socialProviderProfilePage(s.provider,s.username),target:"_blank",title:`Visit ${e.username}'s ${s.provider} profile`},r(s.alias||s.username),9,ke)):(a(),o("span",ge,r(s.alias||s.username),1))]))),128))])])):e.isSelf&&e.connections===null?(a(),o("p",we,[i(f,{to:"/account#connections",class:"manage-account btn rumpus-button-small"},{default:u(()=>[p(" Display linked social media accounts ")]),_:1})])):m("",!0)]),_:1}),e.currentUser.isAdmin&&e.profile?(a(),o("div",be,[Ie,t("button",{class:"btn rumpus-button-small",onClick:l[1]||(l[1]=(...s)=>e.toggleMute&&e.toggleMute(...s))},r(e.profile.stats.Muted?"":"un")+"muted ",1)])):m("",!0),t("p",Pe,[t("ul",null,[(a(!0),o(_,null,k(e.linkedStats,s=>(a(),b(P,{key:s.token,class:"stat",name:e.t(s.token),stat:s},null,8,["name","stat"]))),128))])]),t("p",Le,[t("ul",null,[(a(!0),o(_,null,k(e.stats,s=>(a(),b(P,{key:s.token,class:"stat",name:e.t(s.token),stat:s},null,8,["name","stat"]))),128))])])]),t("section",$e,[t("div",Se,[t("h2",null,r(e.t("published")),1),t("p",null,r(e.t("published_other_desc").replace("%r",e.profile.alias.alias)),1)]),i(S,{name:"fade"},{default:u(()=>[i(L,{class:"levels-panel",limit:5,"user-ids":[e.profile.userId]},null,8,["user-ids"])]),_:1})]),e.currentUser.userId==e.userId||e.playlists.length?(a(),o("section",Ce,[Me,e.userId==e.currentUser.userId?(a(),o("p",Ue,[p(" You can create and share custom level playlists on the web. Other players can make your playlists playable in Levelhead by adding the levels to their Bookmarks. "),Be,i(f,{tag:"button",to:{name:"levelhead-playlist",params:{playlistId:"@new"}},class:"new-playlist btn rumpus-button"},{default:u(()=>[p(" Create Playlist ")]),_:1})])):m("",!0),e.playlists.length?(a(),o("div",Ae,[(a(!0),o(_,null,k(e.playlists,s=>(a(),b(N,{key:s.playlistId,playlist:s,class:"playlist"},null,8,["playlist"]))),128)),E(t("button",{class:"btn rumpus-button",disabled:e.fetchingPlaylists,onClick:l[2]||(l[2]=(...s)=>e.fetchPlaylists&&e.fetchPlaylists(...s))},r(e.fetchingPlaylists?"working...":"Show More"),9,Ne),[[j,e.areMorePlaylists]])])):m("",!0)])):m("",!0),e.currentUser.userId==e.profile.userId&&e.revertedLevelCount?(a(),o("section",Te,[Fe,De,Ve,i(L,{limit:5,"user-ids":[e.profile.userId],deleted:!0}
1,null,8,["user-ids"])])):m("",!0)])):e.doesNotExist?(a(),o("div",qe,je)):(a(),o("p",We," Fetching player profile... "))])}const et=C(ue,[["render",ze],["__scopeId","data-v-118e247a"]]);export{et as default}; 2//# sourceMappingURL=LevelheadPlayer-BkyVILQZ.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.