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]=`8acbd306-5d5d-4a15-989e-9fb6ad623959`,e._sentryDebugIdIdentifier=`sentry-dbid-8acbd306-5d5d-4a15-989e-9fb6ad623959`)}catch{}import{$m as e,Ag as t,Jf as n,Kf as r,ng as i,qf as a,yg as o}from"./entry.client-mpghtlrl.js";import{hn as s}from"./workspace-leaf-files-oergw4h0.js";import{n as c}from"./TabContentLayout-c956lcpz.js";var l=t(),u=i(),d=()=>{let t=(0,l.c)(4),{t:n}=e(`SettingsStorageTab`),r;t[0]===n?r=t[1]:(r=n(`There was an error fetching your save data, please try again`,{shortKey:`fetching_please_there_7207b4`}),t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,u.jsx)(c,{errorString:i}),t[2]=i,t[3]=a),a};function f(e){switch(e){case s.QuickResume:return`QuickResume`;case s.PersistentLocalStorage:return`ReservedSpace`;case s.ConnectedStorage:return`CloudSave`;case s.SharedLocalStorage:return`CloudSave360`;default:throw new r(`contentType`,a.Unsupported,`Unknown content type, received: ${e}`)}}var p=e=>({...e,expirationTime:new Date(e.expirationTime),lastSavedTime:new Date(e.lastSavedTime),contentType:f(e.contentType)}),m=e=>{if(!e)return[];let t=e.reduce((e,t)=>{if(!e[t.productId])e[t.productId]={productId:t.productId,lastSaved:new Date(t.lastSavedTime)};else{let n=e[t.productId].lastSaved.getTime();new Date(t.lastSavedTime).getTime()>n&&(e[t.productId].lastSaved=new Date(t.lastSavedTime))}try{let n=p(t);switch(n.contentType){case`CloudSave`:case`CloudSave360`:e[n.productId].save=n;break;case`QuickResume`:e[n.productId].quickResumeSave=n;break;case`ReservedSpace`:e[n.productId].reservedSpace=n;break}}catch(e){if(n(e))new o(`StorageTab`).error(`Parameter ${e.parameterName} is invalid: ${e.reason}`);else throw e}return e},{});return Object.values(t).sort((e,t)=>t.lastSaved.getTime()-e.lastSaved.getTime())};export{m as n,d as r,f as t};