"use strict";(()=>{vare={};e.id=3e3,e.ids=[3e3],e.modules={39908:e=>{e.exports=require("@moduletrace/datasquirel/dist/users/user-auth")},75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},9973:e=>{e.exports=require("serverless-mysql")},29021:e=>{e.exports=require("fs")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){returnfunctione(r,s){returnsinr?r[s]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,s)):"function"==typeofr&&"default"===s?r:void0}}})},96257:(e,r,s)=>{s.r(r),s.d(r,{config:()=>S,default:()=>_,routeModule:()=>f});vart={};s.r(t),s.d(t,{default:()=>p});varn=s(89947),a=s(2706),o=s(96762),i=s(29021),l=s.n(i),c=s(48786),u=s(67619),d=s(69842),D=s(14160);asyncfunctionp(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lets=await(0,d.A)(e,r,!0);if(!s)returnr.json({success:!1,msg:"Unauthorized"});let{id:t,db_slug:n,db_full_name:a}=e.body;if(!a.match(`user_${s.id}_`))throwError("Database doesn't belong to user");await(0,D.A)(`DROP DATABASE \`${a}\``),await(0,c.A)("DELETE FROM user_databases WHERE id = ?",[t]),await(0,c.A)("DELETE FROM user_users WHERE user_id = ? AND `database` = ?",[s.id,n]);try{lete;lett=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${s.id}/main.json`,n=JSON.parse(l().readFileSync(t,"utf8")),o=n.filter((r,s)=>{if(r.dbFullName===a)returne=s,!0});if(o[0].childDatabase){lete=n.filter(e=>e.dbFullName===o[0].childDatabaseDbFullName)[0],r=e.childrenDatabases?.findIndex(e=>e.dbFullName===o[0].childDatabaseDbFullName);e.childrenDatabases&&"number"==typeofr&&e.childrenDatabases.splice(r,1)}n.splice(e,1),l().writeFileSync(`${t}`,JSON.stringify(n),"utf8"),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/deleteUserDatabase/main-catch-error",message:e.message,user:s}),r.json({success:!1,msg:"File Updates Failed"})}}let_=(0,o.M)(t,"default"),S=(0,o.M)(t,"config"),f=newn.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteUserDatabase",pathname:"/api/deleteUserDatabase",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>a});vart=s(39908),n=s.n(t);asyncfunctiona(e,r,s){lett=n()({req:e,level:s?"deep":void0});returnconsole.log(t),t.payload}},14160:(e,r,s)=>{s.d(r,{A:()=>i});vart=s(29021),n=s.n(t),a=s(67619),o=s(47546);asyncfunctioni(e){letr;"production".match(/dev/)&&n().appendFileSync("./.tmp/sqlQuery.sql",e+"\n"+Date()+"\n\n\n","utf8");try{r=await(0,o.A)(e)}catch(e){(0,a.A)({component:"noDatabaseDbHandler",message:e.message}),console.log("ERROR in noDatabaseDbHandler =>",e.message)}returnr||null}},67619:(e,r,s)=>{s.d(r,{A:()=>a});vart=s(29021),n=s.n(t);asyncfunctiona({user:e,message:r,component:s,noMail:t,req:a}){leto=newDate,i=(()=>{if(!a)returnnull;try{lete=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],s=a.headers["cf-connecting-ip"],t=Array.isArray(e)?e[0]:e?.split(",")[0],n=s||t||r||a.socket.remoteAddress;if(!n)returnnull;returnString(n)}catch(e){returnnull}})();try{lett=`🚀 SERVER ERROR ===========================