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]=`de3bccc7-8997-4831-a378-cf8261f0142b`,e._sentryDebugIdIdentifier=`sentry-dbid-de3bccc7-8997-4831-a378-cf8261f0142b`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{t}from"./useIntraDialogHistory-jdzxwi77.js";import{Ag as n,Dg as r,Fg as i,If as a,Ig as o,Qn as s,Yn as c,ch as l,dn as u,hn as d,ig as f,or as p,qp as m,sh as h,uh as g,wg as _,zp as v}from"./entry.client-dr7r6s9a.js";import{t as y}from"./useDeferRestore-dt4p0xnv.js";import{n as b}from"./HeaderContext-hexqpul9.js";import{r as x}from"./classNames-ikl45qo7.js";import{t as S}from"./TabContentLayout-ltqqpnab.js";import{r as C,t as w}from"./utils-njknyvpy.js";var T=e(o(),1),E=i(),D=e(p(),1),O=`SettingsStorageTab`;function k(e,t){return{actions:{delete:()=>e(`Delete`,{ns:O,shortKey:`delete_action`}),dontDelete:()=>e(`Don't delete`,{ns:O,shortKey:`dontdelete_action`}),refresh:()=>e(`Refresh`,{ns:O,shortKey:`refresh_action`}),dontRefresh:()=>e(`Don't Refresh`,{ns:O,shortKey:`dontrefresh_action`})},descriptions:{cloudSave:t=>e(`This will replace your saved data for {productTitle} on the Xbox Cloud Gaming platform with your most recent saved data from the Xbox network.

If your saved data on the Xbox network is less recent than your Cloud Gaming data, you might lose progress when you refresh.`,{ns:O,shortKey:`refresh_save_subtitle`,values:{productTitle:t}}),cloudSave360:t=>e(`This deletes all Xbox 360 game and profile data for {productTitle} on the Xbox Cloud Gaming platform.

Your saved games will remain on the Xbox network, however, and they will be synced the next time you play.`,{ns:O,shortKey:`delete_360_save_subtitle`,values:{productTitle:t}}),reservedSpace:t=>e(`Deleting reserved space for {productTitle} will return the game to its default installation state.

You won't lose game progress, but the game might need to re-reserve space to let you pick up where you left off.`,{ns:O,shortKey:`delete_reserved_space_subtitle`,values:{productTitle:t}}),saveEverywhere:(t,n,r)=>n?e(`All your trial data for {productTitle} will be removed from the Xbox network.

If this game shares or accesses data between editions or other games, that data might be deleted too.`,{ns:O,shortKey:`delete_save_everywhere_subtitle_lightweight_user`,values:{productTitle:t}}):e(`All of {gamertag}'s data for {productTitle} will be removed from the Xbox network.

If this game shares or accesses data between editions or other games, that data might be deleted too.`,{ns:O,shortKey:`delete_save_everywhere_subtitle`,values:{gamertag:r,productTitle:t}}),quickResume:()=>e(`Deleting the Quick Resume file will return your game progress to the last save point.`,{ns:O,shortKey:`delete_resume_quick_773d16`})},titles:{cloudSave:()=>e(`Refresh game data from the Xbox network?`,{ns:O,shortKey:`refresh_save_title`}),cloudSave360:()=>e(`Delete cloud data for this game?`,{ns:O,shortKey:`delete_360_save_title`}),reservedSpace:()=>e(`Delete reserved space?`,{ns:O,shortKey:`delete_reserved_space_title`}),saveEverywhere:()=>e(`This permanently deletes all saved data for this game.`,{ns:O,shortKey:`delete_save_everywhere_title`}),quickResume:t=>e(`Are you sure you want to delete Quick Resume for {productTitle}?`,{ns:O,shortKey:`prompt_delete_resume_quick_773d16`,values:{productTitle:t}})}}}var A=()=>g(O,k),j=n(),M=u(e=>{let t=(0,E.c)(44),{onAction:n,onCancel:r,contentType:i,productTitle:a,isLightweightUser:o,gamertag:l,isLoading:u,isError:f}=e,p=A(),m,h,g,_=!1;bb0:switch(i){case`QuickResume`:{let e;t[0]===p.descriptions?e=t[1]:(e=p.descriptions.quickResume(),t[0]=p.descriptions,t[1]=e),m=e;let n;t[2]===p.actions?n=t[3]:(n=p.actions.delete(),t[2]=p.actions,t[3]=n),h=n;let r;t[4]===p.actions?r=t[5]:(r=p.actions.dontDelete(),t[4]=p.actions,t[5]=r),g=r;break bb0}case`CloudSave`:{let e;t[6]!==p.descriptions||t[7]!==a?(e=p.descriptions.cloudSave(a),t[6]=p.descriptions,t[7]=a,t[8]=e):e=t[8],m=e;let n;t[9]===p.actions?n=t[10]:(n=p.actions.refresh(),t[9]=p.actions,t[10]=n),h=n;let r;t[11]===p.actions?r=t[12]:(r=p.actions.dontRefresh(),t[11]=p.actions,t[12]=r),g=r;break bb0}case`CloudSave360`:{let e;t[13]!==p.descriptions||t[14]!==a?(e=p.descriptions.cloudSave360(a),t[13]=p.descriptions,t[14]=a,t[15]=e):e=t[15],m=e;let n;t[16]===p.actions?n=t[17]:(n=p.actions.delete(),t[16]=p.actions,t[17]=n),h=n;let r;t[18]===p.actions?r=t[19]:(r=p.actions.dontDelete(),t[18]=p.actions,t[19]=r),g=r;break bb0}case`ReservedSpace`:{let e;t[20]!==p.descriptions||t[21]!==a?(e=p.descriptions.reservedSpace(a),t[20]=p.descriptions,t[21]=a,t[22]=e):e=t[22],m=e;let n;t[23]===p.actions?n=t[24]:(n=p.actions.delete(),t[23]=p.actions,t[24]=n),h=n;let r;t[25]===p.actions?r=t[26]:(r=p.actions.dontDelete(),t[25]=p.actions,t[26]=r),g=r;break bb0}case`GameSaves`:{let e;t[27]!==p.descriptions||t[28]!==a||t[29]!==o||t[30]!==l?(e=p.descriptions.saveEverywhere(a,o,l),t[27]=p.descriptions,t[28]=a,t[29]=o,t[30]=l,t[31]=e):e=t[31],m=e;let n;t[32]===p.actions?n=t[33]:(n=p.actions.delete(),t[32]=p.actions,t[33]=n),h=n;let r;t[34]===p.actions?r=t[35]:(r=p.actions.dontDelete(),t[34]=p.actions,t[35]=r),g=r;break bb0}default:m=``,h=``,g=``,_=!0}if(f||_){let e;return t[36]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,j.jsx)(C,{}),t[36]=e):e=t[36],e}let v;return t[37]!==u||t[38]!==m||t[39]!==n||t[40]!==h||t[41]!==r||t[42]!==g?(v=u?(0,j.jsx)(`div`,{className:`flex w-full flex-col gap-4`,children:(0,j.jsxs)(s,{children:[(0,j.jsx)(c,{className:`m-internal-container-padding-tight h-[32px] w-full`}),(0,j.jsxs)(`div`,{className:`m-internal-container-padding-tight flex flex-col items-center gap-4 self-stretch sm-20:flex-row`,children:[(0,j.jsx)(c,{className:`h-[32px] w-full`}),(0,j.jsx)(c,{className:`h-[32px] w-full`})]})]})}):(0,j.jsxs)(`div`,{className:`flex w-full flex-col gap-4`,children:[(0,j.jsx)(`div`,{className:(0,D.default)(`my-internal-container-padding-tight whitespace-pre text-wrap text-noninteractive-content-secondary-content type-body`,x),children:m}),(0,j.jsxs)(`div`,{className:`m-internal-container-padding-tight flex flex-col items-center gap-4 self-stretch sm-20:flex-row`,children:[(0,j.jsx)(d,{as:`button`,size:`large`,className:`w-full min-w-component-action-text-standard-min-width flex-1 content-center items-center py-component-action-text-standard-container-padding-top-and-bottom`,onPress:n,kind:`destructive`,children:h}),(0,j.jsx)(d,{as:`button`,size:`large`,className:`w-full min-w-component-action-text-standard-min-width flex-1 content-center items-center py-component-action-text-standard-container-padding-top-and-bottom`,onPress:r,children:g})]})]}),t[37]=u,t[38]=m,t[39]=n,t[40]=h,t[41]=r,t[42]=g,t[43]=v):v=t[43],v},()=>{let{authentication:{queries:{userInfo:e}},catalog:{queries:{productInfo:n}},gameSaves:{mutations:{deleteAllSaves:i}},services:{gameStream:{play:{queries:{userContent:o},mutations:{deleteUserContent:s}}}}}=h(),{trackUserAction:c}=l(),{productId:u,contentType:d}=m({from:v.dialog.settings.storage.confirmStorageDelete.id}),p=d,{setTitle:g,setSubtitle:x}=b(),{data:S,isLoading:C,isError:E}=r(n.basic.getOptions({productId:u})),D=S?.title??``,{data:O,isLoading:k,isError:j}=r(e.getActiveUserQuery().getOptions()),M=O?.isLightweightUser??!1,N=O?.gamertag?.uniqueGamertag??``,P=A(),{data:F,isLoading:I,isError:L}=r(o.getActiveUserQuery().getOptions()),{mutate:R}=_(s.getActiveUserMutation().getOptions()),{mutate:z}=_(i.getActiveUserMutation().getOptions()),B=F?.find(e=>{let t=w(e.contentType);return e.productId===u&&t===p}),V=!1,H,U=!1;switch(p){case`QuickResume`:H=P.titles.quickResume(D);break;case`CloudSave`:H=P.titles.cloudSave();break;case`CloudSave360`:H=P.titles.cloudSave360();break;case`ReservedSpace`:H=P.titles.reservedSpace();break;case`GameSaves`:H=P.titles.saveEverywhere(),U=!0;break;default:H=``,V=!0}(0,T.useEffect)(()=>{g(H),x(``)},[g,x,H]);let W=t(),G=()=>{if(W.canGoBack)W.goBack();else throw new a(`NavigationStack`,`previous`)},K=()=>{if(O)try{U?z({productId:u}):B&&R({contentType:B.contentType,storageId:B.storageId}),c(`DeleteGameContent`,{gameId:u,contentType:p,succeeded:!0},`Press`)}catch(e){c(`DeleteGameContent`,{gameId:u,contentType:p,succeeded:!1,failureReason:f(e).message},`Press`)}G()},q=()=>{G()},J=V||E||j||L,Y=C||k||I;return y(Y),{onAction:K,onCancel:q,contentType:p,productTitle:D,isLightweightUser:M,gamertag:N,isLoading:Y,isError:J}}),N=()=>{let e=(0,E.c)(2),t=M.useComponent(),n;return e[0]===t?n=e[1]:(n=(0,j.jsx)(S,{telemetryLocation:`ConfirmStorageDataDeletion`,children:(0,j.jsx)(t,{})}),e[0]=t,e[1]=n),n};export{N as ConfirmStorageDataDeletion};