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]=`85da97ee-5105-4f8f-8df8-5921f222cc04`,e._sentryDebugIdIdentifier=`sentry-dbid-85da97ee-5105-4f8f-8df8-5921f222cc04`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{E as t}from"./vendor-misc-dys7qi6h.js";import{Ag as n,Bm as r,Gu as i,Lm as a,Mi as o,Oi as s,Qh as c,Um as l,Wh as u,Yi as d,Zm as f,_f as p,_r as m,jg as h,ng as g,pg as _,sn as v}from"./entry.client-mpghtlrl.js";import{a as y,d as b,i as x,n as S,r as C,t as w}from"./UserProfilePageUnauthenticated-feoyjza1.js";var T=e(h(),1),E=n(),D=class extends u{ROOT_QUERY_KEY=[`view-system`,`user-profile-page`];constructor(e){super(e),this.queries=this.createQueries(),this.processQueries(this.queries)}createQueries=()=>({playActivity:this.createRelationalQuery({staleTime:5*_,gcTime:5*_,queryKey:this.ROOT_QUERY_KEY.concat(`playActivityData`),getDependencyOptions:({xuid:e})=>[this.env.systems.notifications.queries.gameInvites.getActiveUserQuery().getOptions({filter:t=>t.actor.xuid===e}),this.env.systems.notifications.queries.partyInvites.getActiveUserQuery().getOptions({filter:t=>t.actor.xuid===e}),this.env.systems.title.queries.userTitleHistory.getActiveUserQuery().getOptions({maxRequested:10,xuid:e,supportedPlatform:`StreamableOnly`})],fetcher:([e,t,n])=>({gameInvites:e,mruTitleInfos:n,numberOfActivities:e.length+t.length+n.length,partyInvites:t}),meta:{isSerializable:!1}})})},O=g(),k=e=>{let t=(0,E.c)(7),{context:n,env:r,system:i,children:a}=e,{Provider:o}=n??b,s,c;t[0]!==i||t[1]!==r?(c=i??new D(r),t[0]=i,t[1]=r,t[2]=c):c=t[2],s=c;let l=s,u;return t[3]!==o||t[4]!==l||t[5]!==a?(u=(0,O.jsx)(o,{value:l,children:a}),t[3]=o,t[4]=l,t[5]=a,t[6]=u):u=t[6],u},A=`flex-1 bg-cover bg-center flex-col-px`,j=m(e=>{let t=(0,E.c)(11),{gamertag:n,gamertagFromActiveUser:r,isFullySignedIn:i,isActiveLightweightUserViewingSelf:a,isActiveUserInfoLoading:o,isLoading:s}=e,c=C.useComponent(),l=w.useComponent(),u=S.useComponent();if(s){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsxs)(`section`,{className:A,children:[(0,O.jsx)(x,{}),`;`]}),t[0]=e):e=t[0],e}if(!n&&(o||r)){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,O.jsxs)(`section`,{className:A,children:[(0,O.jsx)(x,{}),`;`]}),t[1]=e):e=t[1],e}if(!n){let e;return t[2]===l?e=t[3]:(e=(0,O.jsx)(`section`,{className:A,children:(0,O.jsx)(l,{})}),t[2]=l,t[3]=e),e}let d;return t[4]!==i||t[5]!==c||t[6]!==n||t[7]!==a||t[8]!==u||t[9]!==l?(d=(0,O.jsx)(`section`,{className:A,children:i?(0,O.jsx)(c,{gamertag:n}):a?(0,O.jsx)(u,{}):(0,O.jsx)(l,{gamertag:n})}),t[4]=i,t[5]=c,t[6]=n,t[7]=a,t[8]=u,t[9]=l,t[10]=d):d=t[10],d},({gamertag:e})=>{let{authentication:t}=f(),n=v(),{authenticationState:a,isLoading:o}=r(),{data:s,isLoading:l}=c(t.queries.userInfo.getActiveUserQuery().getOptions()),u=s?.gamertag.legacyGamertag;(0,T.useEffect)(()=>{!e&&!o&&u&&n(i.user.$buildPath({params:{gamertag:u}}),{replace:!0})},[e,o,n,u]);let d=a===p.LightweightSignedIn&&s!=null&&u?.toLowerCase()===e?.toLowerCase();return{gamertag:e,gamertagFromActiveUser:u,isFullySignedIn:a===p.FullySignedIn,isActiveLightweightUserViewingSelf:d,isActiveUserInfoLoading:l,isLoading:o}}),M=a(s(()=>{let e=l(),n=j.useComponent(),{gamertag:r}=t(i.user);return(0,O.jsx)(o,{location:`UserProfilePage`,renderFallback:()=>(0,O.jsx)(y,{}),children:(0,O.jsx)(k,{env:e,children:(0,O.jsx)(n,{gamertag:r})})})},`UserProfilePage`));export{d as clientLoader,M as default};