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]=`0bcddc6a-6f21-450c-afeb-804d2feae27b`,e._sentryDebugIdIdentifier=`sentry-dbid-0bcddc6a-6f21-450c-afeb-804d2feae27b`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{dm as e,mm as t}from"./entry.client-dr7r6s9a.js";e();var n=class extends Error{code;error;errorCode;errorDetails;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{config;fetch;constructor(e={},n=globalThis.fetch){this.config=e,this.fetch=t(n,{timeoutMs:e.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};