"use strict";(()=>{vare={};e.id=7015,e.ids=[7015],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}}})},33336:(e,r,t)=>{t.r(r),t.d(r,{config:()=>A,default:()=>S,routeModule:()=>y});varn={};t.r(n),t.d(n,{default:()=>f});vars=t(89947),a=t(2706),i=t(96762),o=t(29021),l=t.n(o),u=t(95969),c=t(67619),d=t(69842),_=t(61932),p=t(56081);asyncfunctionf(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"});let{id:n,key:s,user_id:a}=e.body;try{lete=process.env.DSQL_API_KEYS_PATH;if(!e)throwError("process.env.DSQL_API_KEYS_PATH variable not found");leta=(0,p.A)({key:String((0,u.A)({encryptedString:s})),user_id:t.id});if(!a?.sign)throwawait(0,_.A)({dbFullName:"datasquirel",tableName:"api_keys",identifierColumnName:"id",identifierValue:n}),Error("API KEY is Invalid");try{letr=`${e}/${a?.sign}`;l().unlinkSync(r)}catch(e){console.log("Error Deleting API key",e.message)}await(0,_.A)({dbFullName:"datasquirel",tableName:"api_keys",identifierColumnName:"id",identifierValue:n}),r.json({success:!0})}catch(e){console.log(`ERROR Deleting API Key => ${e.message}`),(0,c.A)({component:"/api/deleteApiKey/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Deletion Failed!"})}}letS=(0,i.M)(n,"default"),A=(0,i.M)(n,"config"),y=news.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/deleteApiKey",pathname:"/api/deleteApiKey",bundlePath:"",filename:""},userland:n})},69842:(e,r,t)=>{t.d(r,{A:()=>a});varn=t(39908),s=t.n(n);asyncfunctiona(e,r,t){letn=s()({req:e,level:t?"deep":void0});returnconsole.log(n),n.payload}},56081:(e,r,t)=>{t.d(r,{A:()=>i});varn=t(29021),s=t.n(n),a=t(95969);leti=({key:e,database:r,table:t,user_id:n,media:i})=>{if(!e||!n)returnnull;try{leto=process.env.DSQL_API_KEYS_PATH;if(!o)throwError("process.env.DSQL_API_KEYS_PATH variable not found");letl=(0,a.A)({encryptedString:e}),u=JSON.parse(l||""),c=s().existsSync(`${o}/${u.sign}`);if(String(u.user_id)!==String(n)||!c)returnnull;if(!u.target_database||i)returnu;if(!r&&u.target_database)returnnull;letd=u.target_database?.split(",").includes(String(r));if(d&&!u.target_table)returnu;if(d&&!t&&u.target_table)returnnull;if(u.target_table?.split(",").includes(String(t)))returnu;returnnull}catch(e){returnconsole.log(`api-cred ERROR: ${e.message}`),{error:`api-cred ERROR: ${e.message}`}}}},61932:(e,r,t)=>{t.d(r,{A:()=>i});varn=t(48786),s=t(37897),a=t(62050);asyncfunctioni({dbContext:e,paradigm:r,dbFullName:t,tableName:i,identifierColumnName:o,identifierValue:l,useLocal:u}){try{letc=!!u||!e?.match(/dsql.user/i)&&(!t||!!t.match(/^datasquirel$/)),d=u?a.A:c?n.A:s.A,_=`DELETE FROM \`${t}\`.\`${i}\` WHERE \`${o}\`=?`;returnc?awaitd(_,[l]):awaitd({paradigm:r,queryString:_,queryValues:[l]})}catch(e){returnnull}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});varn=t(29021),s=t.n(n);asyncfunctiona({user:e,message:r,component:t,noMail:n,req:a}){leti=newDate,o=(()=>{if(!a)returnnull;try{lete=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||a.socket.remoteAddress;if(!s)returnnull;returnString(s)}catch(e){returnnull}})();try{letn=`🚀 SERVER ERROR ===========================