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]=`27ad66be-f49a-4c54-b071-0d390cc27681`,e._sentryDebugIdIdentifier=`sentry-dbid-27ad66be-f49a-4c54-b071-0d390cc27681`)}catch{}import"./rolldown-runtime-nx40z1zs.js";import{Hp as e,Lp as t}from"./entry.client-mpghtlrl.js";t();var n=class extends Error{constructor(e){super(e.errorMessage),this.name=`PlayFabError`,this.code=e.code,this.error=e.error,this.errorCode=e.errorCode,this.errorDetails=e.errorDetails}};function r(e){return`https://${e}.playfabapi.com`}var i=class{constructor(t={},n=globalThis.fetch){this.config=t,this.fetch=e(n,{timeoutMs:t.timeoutMs,responseValidator:()=>!0})}async loginWithXbox(e,t,n=!1,i){let a=`${r(e)}/Client/LoginWithXbox`,o=await this.fetch(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({TitleId:e,XboxToken:t,CreateAccount:n}),signal:i?.signal});return this.handleResponse(o)}async listManifests(e,t,n){let i=`${r(e)}/GameSave/ListManifests`,a=await this.fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,"X-EntityToken":t},body:JSON.stringify({}),signal:n?.signal});return this.handleResponse(a)}async deleteAllManifests(e,t,n){let i=`${r(e)}/GameSave/DeleteAllManifests`,a=await this.fetch(i,{method:`POST`,headers:{"Content-Type":`application/json`,"X-EntityToken":t},body:JSON.stringify({}),signal:n?.signal});a.ok||await this.throwPlayFabError(a)}async handleResponse(e){return e.ok||await this.throwPlayFabError(e),(await e.json()).data}async throwPlayFabError(e){let t;try{t=await e.json()}catch{throw Error(`PlayFab API request failed: status ${e.status} ${e.statusText}`)}throw new n(t)}};export{i as PlayFabService};