"use strict";(()=>{vare={};e.id=8563,e.ids=[8563],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,s){returnsinr?r[s]:"then"inr&&"function"==typeofr.then?r.then(r=>e(r,s)):"function"==typeofr&&"default"===s?r:void0}}})},83469:(e,r,s)=>{s.r(r),s.d(r,{config:()=>f,default:()=>S,routeModule:()=>D});vart={};s.r(t),s.d(t,{default:()=>d});varn=s(89947),a=s(2706),o=s(96762),c=s(6420),i=s.n(c),l=s(48225),u=s.n(l),_=s(57638),p=s.n(_);asyncfunctiond(e,r){if("POST"!==e.method)returnr.json({user:null,msg:"Registration Failed!"});lets=awaiti()(e,r,!0);if(!s)returnr.json({success:!1,msg:"Unauthorized"});let{database:t,query:n,tables:a}=e.body;try{lete=awaitp()({database:`datasquirel_user_${s.id}_${t}`,queryString:n});if(!e)returnr.json({success:!1,msg:"Query Failed!"});r.json({success:!0,result:e})}catch(e){u()({component:"/api/runUserDbQuery/main-catch-error",message:e.message,user:s}),r.json({success:!1})}}s(29021);letS=(0,o.M)(t,"default"),f=(0,o.M)(t,"config"),D=newn.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/runUserDbQuery",pathname:"/api/runUserDbQuery",bundlePath:"",filename:""},userland:t})},6420:(e,r,s)=>{s(81630);lett=s(51348),n=s(72835),a=s(29021),o=s(31341);asyncfunctionc(e,r,s,c){let{keyCookieName:i,csrfCookieName:l}=o();if(!e.cookies?.[i]?.match(/./))returnnull;letu=n({encryptedString:e.cookies[i]});if(!u)returnnull;let_=JSON.parse(u);if(!_.csrf_k||s&&!e.headers["x-csrf-auth"]?.match(RegExp(`${_.csrf_k}`)))returnnull;letp=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!p)returnconsole.log("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable."),null;if(s&&!a.existsSync(`${p}/${_.csrf_k}`))returnnull;if(0==_.verification_status&&!s){lete=awaitt(`SELECT verification_status FROM users WHERE id='${_.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}return_?.date&&Date.now()-_.date>6048e5?null:_}e.exports=c},31341:e=>{e.exports=function(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=s;leto=r;returne?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=t}}},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,s)=>{lett=s(72835),n=s(30003);e.exports=asyncfunction({unparsedResults:e,tableSchema:r}){lets=[];try{for(leta=0;a<e.length;a++){leto=e[a],c=Object.keys(o);for(lete=0;e<c.length;e++){lets=c[e],a=r?.fields[e];if(s?.match(n))continue;leti=o[s];("number"==typeofi||i)&&a?.encrypted&&i?.match(/./)&&(o[s]=t({encryptedString:i}))}s.push(o)}returns}catch(r){returnconsole.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,s)=>{lett=s(29021),{IncomingMessage:n}=s(81630);e.exports=asyncfunction({user:e,message:r,component:s,noMail:n,req:a}){leto=newDate,c=(()=>{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{letn=`🚀 SERVER ERROR ===========================