`,[`datasquirel_user_${t.id}%`]),o=(Array.isArray(e)?e:[]).reduce((e,r,t)=>e?.mb?e.mb+r.mb:e+r.mb,0),n=0,i=process.env.DSQL_STATIC_SERVER_DIR;if(!i)throw console.log("Static File ENV not Found!"),Error("No Static Path!");i||c().existsSync(i)||c().mkdirSync(i,{recursive:!0});let a=u().join(i,`images/user-images/user-${t.id}`);c().existsSync(a)||c().mkdirSync(a,{recursive:!0});let l=u().join(i,`images/user-images/user-${t.id}`),f=u().join(i,`videos/user-videos/user-${t.id}`);async function s(e){try{let r=c().readdirSync(e);for(let t=0;t<r.length;t++){let o=r[t],a=e+"/"+o;if(!o.match(/\..{3,4}$/)){await s(a);continue}if(c().existsSync(a)){let e=c().statSync(a);n+=e.size/1024/1024}else{if("production".match(/production/),!i)throw console.log("Static File ENV not Found!"),Error("No Static Path!");let e=a.replace(i,process.env.DSQL_STATIC_HOST||""),r=a.replace(i,"");await (0,d.A)("DELETE FROM user_media WHERE media_path = ? OR media_thumbnail_path = ? OR media_url=? OR media_thumbnail_url=?",[r,r,e,e]),console.log(`MEDIA=>${e}DELETEDFROMDATABASE`)}}}catch(e){console.log("ERROR in getDiskUsage API route =>",e.message),(0,_.A)({component:"/api/getDiskUsage/lines-93-101",message:e.message})}}c().existsSync(f)||c().mkdirSync(f,{recursive:!0}),await s(l),await s(f);let E=n+o;r.json({success:!0,total:E})}catch(e){(0,_.A)({component:"/api/getDiskUsage/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Disk Usage Calculation Error!"})}}let p=(0,i.M)(s,"default"),m=(0,i.M)(s,"config"),S=new o.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/getDiskUsage",pathname:"/api/getDiskUsage",bundlePath:"",filename:""},userland:s})},69842:(e,r,t)=>{t.d(r,{A:()=>c});var s=t(48786),o=t(95969),n=t(29021),i=t.n(n),a=t(89159);async function c(e,r,t){try{let{keyCookieName:n,csrfCookieName:c}=(0,a.A)();if(!e.cookies?.[n]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,o.A)({encryptedString:e.cookies[n]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(t&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw console.log("req.headers",e.headers),console.log("userObject",u),Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(t&&!i().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!t){let e=await (0,s.A)(`SELECTverification_statusFROMusersWHEREid='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuthError:${e.message}`),null}}},89159:(e,r,t)=>{t.d(r,{A:()=>s});function s(e){let r=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",o=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",n=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),i=r;e?.userId&&(i+=`user_${e.userId}_`),n&&(i+=`${n}_`),i+=t;let a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;let c=r;return e?.userId&&(c+=`user_${e.userId}_`),n&&(c+=`${n}_`),{keyCookieName:i,csrfCookieName:a,oneTimeCodeName:c+=o}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});var s=t(29021),o=t.n(s);async function n({user:e,message:r,component:t,noMail:s,req:n}){let i=new Date,a=(()=>{if(!n)return null;try{let e=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],o=t||s||r||n.socket.remoteAddress;if(!o)return null;return String(o)}catch(e){return null}})();try{let s=`🚀SERVERERROR===========================