"use strict";(()=>{vare={};e.id=5757,e.ids=[5757],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")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},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}}})},96332:(e,r,t)=>{t.r(r),t.d(r,{config:()=>D,default:()=>f,routeModule:()=>S});vara={};t.r(a),t.d(a,{default:()=>_});vars=t(89947),n=t(2706),l=t(96762),o=t(29021),i=t.n(o),c=t(30944),u=t(67619),d=t(69842),p=t(48786);asyncfunction_(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await(0,d.A)(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});leta=e.body,{id:s,user_id:n,table_name:l,table_slug:o,table_description:_}=a.table,{db_full_name:f}=a.database;await(0,c.A)({database:f,queryString:`DROP TABLE \`${f}\`.\`${o}\``});letD=s?[s]:[o,t.id,a.database.id];await(0,p.A)(s?"DELETE FROM user_database_tables WHERE id=?":"DELETE FROM user_database_tables WHERE table_slug=? AND user_id=? AND db_id=?",D);try{lete;leta=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`,s=JSON.parse(i().readFileSync(a,"utf8")),n=s.filter((e,r)=>{if(e.dbFullName===f)return!0}),l=n[0].tables.filter((r,t)=>{if(r?.tableName===o)returne=t,!0});if(l[0].childTable){lete;letr=s.filter(e=>e.dbFullName===l[0].childTableDbFullName)[0].tables.filter(e=>{if(e.tableName===l[0].childTableName)return!0})[0];r.childrenTables?.filter((r,t)=>{r.tableName===o&&(e=t)}),"number"==typeofe&&r.childrenTables?.splice(e,1)}if(n[0].tables.splice(e,1),n[0].childrenDatabases)for(lete=0;e<n[0].childrenDatabases.length;e++){letr=n[0].childrenDatabases[e];try{lete=s.filter(e=>e.dbFullName===r.dbFullName)[0];e.tables=n[0].tables,await(0,p.A)("DELETE FROM user_database_tables WHERE table_slug=? AND user_id=? AND db_slug=?",[o,t.id,e.dbSlug])}catch(e){(0,u.A)({component:"/api/deleteUserTable/lines-125-128",message:e.message,user:t})}}i().writeFileSync(`${a}`,JSON.stringify(s),"utf8"),r.json({success:!0})}catch(e){(0,u.A)({component:"/api/deleteUserTable/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"File Updates Failed"})}}letf=(0,l.M)(a,"default"),D=(0,l.M)(a,"config"),S=news.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/deleteUserTable",pathname:"/api/deleteUserTable",bundlePath:"",filename:""},userland:a})},69842:(e,r,t)=>{t.d(r,{A:()=>n});vara=t(39908),s=t.n(a);asyncfunctionn(e,r,t){leta=s()({req:e,level:t?"deep":void0});returnconsole.log(a),a.payload}},43775:(e,r,t)=>{t.d(r,{A:()=>n});vara=t(95969);lets=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;asyncfunctionn({unparsedResults:e,tableSchema:r}){lett=[];try{for(letn=0;n<e.length;n++){letl=e[n],o=Object.keys(l);for(lete=0;e<o.length;e++){lett=o[e],n=r?.fields[e];if(t?.match(s))continue;leti=l[t];("number"==typeofi||i)&&n?.encrypted&&i?.match(/./)&&(l[t]=(0,a.A)({encryptedString:i}))}t.push(l)}returnt}catch(r){returnconsole.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>n});vara=t(29021),s=t.n(a);asyncfunctionn({user:e,message:r,component:t,noMail:a,req:n}){letl=newDate,o=(()=>{if(!n)returnnull;try{lete=n.headers["x-forwarded-for"],r=n.headers["x-real-ip"],t=n.headers["cf-connecting-ip"],a=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||a||r||n.socket.remoteAddress;if(!s)returnnull;returnString(s)}catch(e){returnnull}})();try{leta=`🚀 SERVER ERROR ===========================