"use strict";(()=>{vare={};e.id=2896,e.ids=[2896],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}}})},57237:(e,r,t)=>{t.r(r),t.d(r,{config:()=>g,default:()=>m,routeModule:()=>D});vars={};t.r(s),t.d(s,{default:()=>f});varn=t(89947),a=t(2706),o=t(96762),c=t(57638),i=t.n(c),l=t(48225),u=t.n(l),d=t(6420),p=t.n(d),_=t(72835),S=t.n(_);asyncfunctionf(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});lett=awaitp()(e,r);if(!t)returnr.json({success:!1,msg:"Unauthorized"});let{table:s,db:n,id:a}=e.body,o=e.body.schema;try{lete=`SELECT * FROM \`${s}\` WHERE id=?`,t=[a?.toString()||""],c=awaiti()({database:n?.toString()||"",queryString:e,queryValuesArray:t});if(!c||!c[0])returnr.json({success:!1,msg:"Entry not found"});letl=JSON.parse(o||"{}");try{for(lete=0;e<l.fields.length;e++){letr=l.fields[e];r.encrypted&&r.fieldName&&(c[0][r.fieldName]=S()({encryptedString:c[0][r.fieldName]}))}}catch(e){console.log("Error in parsing and decrypting fields in 'UpdateDbEntry' API ROute =>",e.message)}r.json({success:!0,entry:c[0]})}catch(e){u()({component:"/api/refreshEntry/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Deletion Failed!"})}}letm=(0,o.M)(s,"default"),g=(0,o.M)(s,"config"),D=newn.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/refreshEntry",pathname:"/api/refreshEntry",bundlePath:"",filename:""},userland:s})},6420:(e,r,t)=>{t(81630);lets=t(51348),n=t(72835),a=t(29021),o=t(31341);asyncfunctionc(e,r,t,c){let{keyCookieName:i,csrfCookieName:l}=o();if(!e.cookies?.[i]?.match(/./))returnnull;letu=n({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;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(t&&!a.existsSync(`${p}/${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=c},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",n=e?.database||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=r;e?.userId&&(a+=`user_${e.userId}_`),n&&(a+=`${n}_`),a+=t;leto=r;returne?.userId&&(o+=`user_${e.userId}_`),n&&(o+=`${n}_`),{keyCookieName:a,csrfCookieName:o+=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),n=t(30003);e.exports=asyncfunction({unparsedResults:e,tableSchema:r}){lett=[];try{for(leta=0;a<e.length;a++){leto=e[a],c=Object.keys(o);for(lete=0;e<c.length;e++){lett=c[e],a=r?.fields[e];if(t?.match(n))continue;leti=o[t];("number"==typeofi||i)&&a?.encrypted&&i?.match(/./)&&(o[t]=s({encryptedString:i}))}t.push(o)}returnt}catch(r){returnconsole.log("ERROR in parseDbResults Function =>",r.message),e}}},48225:(e,r,t)=>{lets=t(29021),{IncomingMessage:n}=t(81630);e.exports=asyncfunction({user:e,message:r,component:t,noMail:n,req:a}){leto=newDate,c=(()=>{if(!a)returnnull;try{lete=a.headers["x-forwarded-for"],r=a.headers["x-real-ip"],t=a.headers["cf-connecting-ip"],s=Array.isArray(e)?e[0]:e?.split(",")[0],n=t||s||r||a.socket.remoteAddress;if(!n)returnnull;returnString(n)}catch(e){returnnull