"use strict";(()=>{vare={};e.id=2735,e.ids=[2735],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){returnfunctione(r,t){returntinr?r[t]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,t)):"function"==typeofr&&"default"===t?r:void0}}})},21734:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>m,routeModule:()=>D});vars={};t.r(s),t.d(s,{default:()=>R});vari=t(89947),n=t(2706),a=t(96762),o=t(51348),u=t.n(o),l=t(83743),c=t.n(l),d=t(48225),E=t.n(d),_=t(6420),p=t.n(_);letS=t(29021),f=t(33873);asyncfunctionR(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitp()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});"production".match(/prod/i);try{awaitu()(`DELETE FROM users WHERE id='${t.id}'`),awaitu()(`DELETE FROM user_users WHERE invited_user_id='${t.id}' OR user_id='${t.id}'`),awaitu()(`DELETE FROM delegated_user_tables WHERE delegated_user_id='${t.id}' OR root_user_id='${t.id}'`),awaitu()(`DELETE FROM user_databases WHERE user_id='${t.id}'`),awaitu()(`DELETE FROM user_database_tables WHERE user_id='${t.id}'`),awaitu()(`DELETE FROM user_media WHERE user_id='${t.id}'`),awaitu()(`DELETE FROM delegated_users WHERE user_id='${t.id}' OR delegated_user_id='${t.id}'`),awaitu()(`DELETE FROM unsubscribes WHERE user_id='${t.id}'`),awaitu()(`DELETE FROM notifications WHERE user_id='${t.id}'`),awaitu()(`DELETE FROM api_keys WHERE user_id='${t.id}'`),awaitu()(`DELETE FROM invitations WHERE inviting_user_id='${t.id}' OR invited_user_email='${t.email}'`);lete=awaitu()("SELECT * FROM mariadb_users WHERE user_id = ?",[t.id]);for(letr=0;r<e.length;r++){let{username:t,host:s}=e[r];awaitu()(`DROP USER IF EXISTS '${t}'@'${s}'`)}lets=awaitu()(`SHOW databases LIKE 'datasquirel_user_${t.id}_%'`);for(lete=0;e<s.length;e++){letr=s[e],t=Object.values(r);awaitu()(`DROP database IF EXISTS ${t}`)}leti=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`;S.existsSync(i)&&S.unlinkSync(i);letn=process.env.DSQL_STATIC_SERVER_DIR;if(!n)throwconsole.log("Static File ENV not Found!"),Error("No Static Path!");leta=f.join(n,`images/user-images/user-${t.id}`);S.existsSync(a)&&c()({rootFolderPath:a}),r.json({success:!0})}catch(e){E()({component:"/api/addApiKey/catch-error",message:e.message,user:t}),r.json({success:!1,msg:"User could not be deleted!"})}}letm=(0,a.M)(s,"default"),g=(0,a.M)(s,"config"),D=newi.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/deleteUser",pathname:"/api/deleteUser",bundlePath:"",filename:""},userland:s})},83743:(e,r,t)=>{lets=t(29021);e.exports=function({rootFolderPath:e}){try{returnfunctione(r){try{lett=s.readdirSync(r);for(leti=0;i<t.length;i++){letn=t[i];n?.match(/\..{2,5}$/)?s.unlinkSync(`${r}/${n}`):e(`${r}/${n}`)}s.rmdirSync(`${r}`)}catch(e){try{s.unlinkSync(r)}catch(e){}}}(e),s.rmSync(`${e}`,{recursive:!0,force:!0}),!0}catch(e){returnconsole.log("ERROR in deleteFolderRecursively.js function =>",e.message),!1}}},6420:(e,r,t)=>{t(81630);lets=t(51348),i=t(72835),n=t(29021),a=t(31341);asyncfunctiono(e,r,t,o){let{keyCookieName:u,csrfCookieName:l}=a();if(!e.cookies?.[u]?.match(/./))returnnull;letc=i({encryptedString:e.cookies[u]});if(!c)returnnull;letd=JSON.parse(c);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;letE=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!E)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!n.existsSync(`${E}/${d.csrf_k}`))returnnull;if(0==d.verification_status&&!t){lete=awaits(`SELECT verification_status FROM users WHERE id='${d.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}returnd?.date&&Date.now()-d.date>6048e5?n