"use strict";(()=>{vare={};e.id=5757,e.ids=[5757],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}}})},77379:(e,r,t)=>{t.r(r),t.d(r,{config:()=>E,default:()=>D,routeModule:()=>g});vars={};t.r(s),t.d(s,{default:()=>m});vara=t(89947),n=t(2706),l=t(96762),o=t(57638),i=t.n(o),c=t(48225),u=t.n(c),d=t(6420),_=t.n(d),p=t(51348),S=t.n(p);letf=t(29021);asyncfunctionm(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=await_()(e,r,!0);if(!t)returnr.json({success:!1,msg:"Unauthorized"});lets=e.body,{id:a,user_id:n,table_name:l,table_slug:o,table_description:c}=s.table,{db_full_name:d}=s.database;awaiti()({database:d,queryString:`DROP TABLE \`${o}\``});letp=a?[a]:[o,t.id,s.database.id];awaitS()(a?"DELETE FROM user_database_tables WHERE id=?":"DELETE FROM user_database_tables WHERE table_slug=? AND user_id=? AND db_id=?",p);try{lete;lets=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${t.id}/main.json`,a=JSON.parse(f.readFileSync(s,"utf8")),n=a.filter((e,r)=>{if(e.dbFullName===d)return!0}),l=n[0].tables.filter((r,t)=>{if(r?.tableName===o)returne=t,!0});if(l[0].childTable){lete;letr=a.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=a.filter(e=>e.dbFullName===r.dbFullName)[0];e.tables=n[0].tables,awaitS()("DELETE FROM user_database_tables WHERE table_slug=? AND user_id=? AND db_slug=?",[o,t.id,e.dbSlug])}catch(e){u()({component:"/api/deleteUserTable/lines-125-128",message:e.message,user:t})}}f.writeFileSync(`${s}`,JSON.stringify(a),"utf8"),r.json({success:!0})}catch(e){u()({component:"/api/deleteUserTable/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"File Updates Failed"})}}letD=(0,l.M)(s,"default"),E=(0,l.M)(s,"config"),g=newa.PagesAPIRouteModule({definition:{kind:n.A.PAGES_API,page:"/api/deleteUserTable",pathname:"/api/deleteUserTable",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);lets=t(51348),a=t(72835),n=t(29021),l=t(31341);asyncfunctiono(e,r,t,o){let{keyCookieName:i,csrfCookieName:c}=l();if(!e.cookies?.[i]?.match(/./))returnnull;letu=a({encryptedString:e.cookies[i]});if(!u)returnnull;letd=JSON.parse(u);if(!d.csrf_k||t&&!e.headers["x-csrf-auth"]?.match(RegExp(`${d.csrf_k}`)))returnnull;let_=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!_)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(t&&!n.existsSync(`${_}/${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?null:d}e.exports=o},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",t=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),n=r;e?.userId&&(n+=`user_${e.userId}_`),a&&(n+=`${a}_`),n+=t;letl=r;returne?.userId&&(l+=`user_${e.userId}_`),a&&(l+=`${a}_`),{keyCookieName:n,csrfCookieName:l+=s}}},30003:e=>{e.exports=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/},6061:(e,r,t)=>{lets=t(72835),a=t(30003);e.exports