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]=`4ffea2b0-1a4c-4279-8f0d-9c346e1b0f4a`,e._sentryDebugIdIdentifier=`sentry-dbid-4ffea2b0-1a4c-4279-8f0d-9c346e1b0f4a`)}catch{}import"./rolldown-runtime-nx40z1zs.js";import{Ap as e,Dp as t,Hp as n,Lp as r,Np as i,Pp as a,Uf as o,Xp as s,zf as c}from"./entry.client-mpghtlrl.js";r(),i(),t();var l={Active:`Active`,Cloaked:`Cloaked`},u=c({state:o()});function d(e){return u.parse(e)}var f=`https://userpresence.xboxlive.com/users/`,p=`3`,m=class{get baseUrl(){let e=this.config.baseUrl??f;return e.endsWith(`/`)?e:`${e}/`}constructor(t,r,i,o=globalThis.fetch){this.config=t,this.fetch=n(o,{authenticator:new a(i),interceptors:{request:[new e(r)]},timeoutMs:this.config.timeoutMs})}async cloakUserPresence(e,t){let n=new URL(`xuid(${e})/state`,this.baseUrl),r=await this.fetch(n.toString(),{method:`PUT`,headers:{[s.XXBLContractVersion]:p,[s.Accept]:`application/json`,[s.ContentType]:`application/json`},body:JSON.stringify({state:l.Cloaked}),signal:t?.signal});if(r.status>=300)throw Error(`Failed to cloak user: status ${r.status}, text ${r.statusText}`)}async uncloakUserPresence(e,t){let n=new URL(`xuid(${e})/state`,this.baseUrl),r=await this.fetch(n.toString(),{method:`PUT`,headers:{[s.XXBLContractVersion]:p,[s.Accept]:`application/json`,[s.ContentType]:`application/json`},body:JSON.stringify({state:l.Active}),signal:t?.signal});if(r.status>=300)throw Error(`Failed to uncloak user: status ${r.status}, text ${r.statusText}`)}async isUserPresenceCloaked(e,t){let n=new URL(`xuid(${e})/state`,this.baseUrl),r=await this.fetch(n.toString(),{method:`GET`,headers:{[s.XXBLContractVersion]:p,[s.Accept]:`application/json`,[s.ContentType]:`application/json`},signal:t?.signal});if(r.status>=300)throw Error(`Failed to retrieve user cloak state: status ${r.status}, text ${r.statusText}`);return d(await r.json()).state===l.Cloaked}};export{m as UserPresenceService};