"use strict";(()=>{vare={};e.id=9187,e.ids=[9187],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},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")},3931:(e,r,s)=>{s.r(r),s.d(r,{config:()=>_,default:()=>l,routeModule:()=>p});vart={};s.r(t),s.d(t,{default:()=>c});vara=s(89947),i=s(2706),o=s(96762),n=s(83919),d=s(69842),u=s(98e3);asyncfunctionc(e,r){if("POST"!==e.method)returnr.json({msg:"Failed!"});if(!await(0,d.A)(e,r,!0))returnr.json({success:!1,msg:"Unauthorized"});let{payload:s,dbFullName:t,dbId:a}=e.body,i=await(0,u.A)({dbContext:"Dsql User",paradigm:"Full Access",dbFullName:t,tableName:"users",data:(()=>{lete=Object.keys(s),r={};returne.forEach(e=>{e?.match(/paradigm|priviledge|database_access|databases|confirm/)||(r[e]=s[e])}),r.password=(0,n.A)({encryptionKey:process.env.DSQL_ENCRYPTION_PASSWORD||"",password:s.password}),r.email=s.email_address,r.image="/images/user-preset.png",r.image_thumbnail="/images/user-preset-thumbnail.png",deleter.email_address,r})()});r.json({success:!!i?.insertId,msg:"New User User Added",newUserId:i.insertId})}letl=(0,o.M)(t,"default"),_=(0,o.M)(t,"config"),p=newa.PagesAPIRouteModule({definition:{kind:i.A.PAGES_API,page:"/api/addDbUser",pathname:"/api/addDbUser",bundlePath:"",filename:""},userland:t})},69842:(e,r,s)=>{s.d(r,{A:()=>d});vart=s(48786),a=s(95969),i=s(29021),o=s.n(i),n=s(89159);asyncfunctiond(e,r,s){try{let{keyCookieName:i,csrfCookieName:d}=(0,n.A)();if(!e.cookies?.[i]?.match(/./))throwError("Request Cookies not Found!");letu=(0,a.A)({encryptedString:e.cookies[i]});if(!u)throwError("Couldn't decrypt auth cookie!");letc=JSON.parse(u);if(!c.csrf_k)throwError("No `csrf_k` present in user Object!");if(s&&!Object.keys(e.headers).find(e=>e.includes(c.csrf_k)))throwError("Deep Auth Failed. `csrf` key not found in request headers!");letl=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!l)throwError("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(s&&!o().existsSync(`${l}/${c.csrf_k}`))throwError("Key not found in Auth Keys Folder!");if(0==c.verification_status&&!s){lete=await(0,t.A)(`SELECT verification_status FROM users WHERE id='${c.id}'`);e&&e[0]&&1==e[0].verification_status&&r.setHeader("Set-Cookie",["user_refresh=1"])}if(c?.date&&Date.now()-c.date>6048e5)throwError("Key expired!");returnc}catch(r){returnconsole.log(`userAuth Error for ${e.url}: ${r.message}`),null}}},89159:(e,r,s)=>{s.d(r,{A:()=>t});functiont(e){letr=process.env.DSQL_COOKIES_PREFIX||"dsql_",s=process.env.DSQL_COOKIES_KEY_NAME||"key",t=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",a=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",i=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),o=r;e?.userId&&(o+=`user_${e.userId}_`),i&&(o+=`${i}_`),o+=s;letn=r;e?.userId&&(n+=`user_${e.userId}_`),i&&(n+=`${i}_`),n+=t;letd=r;returne?.userId&&(d+=`user_${e.userId}_`),i&&(d+=`${i}_`),{keyCookieName:o,csrfCookieName:n,oneTimeCodeName:d+=a}}},95969:(e,r,s)=>{s.d(r,{A:()=>i});vart=s(55511),a=s(79428);functioni({encryptedString:e,encryptionKey:r,encryptionSalt:s}){if(!e?.match(/./))returnconsole.log("Encrypted string is invalid"),e;leti=r||process.env.DSQL_ENCRYPTION_PASSWORD,o=s||process.env.DSQL_ENCRYPTION_SALT,n=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!i?.match(/.{8,}/))returnconsole.log("Decrption key is invalid"),e;if(!o?.match(/.{8,}/))returnconsole.log("Decrption salt is invalid"),e;letd=(0,t.scryptSync)(i,o,n),u=a.Buffer.alloc(16,0),c=(0,t.createDecipheriv)("aes-192-cbc",d,u);try{letr=c.update(e,"hex","utf8");returnr+=c.final("utf8")}catch(r){returnconsole.log("Error in decrypting =>",r.message),e}}},83919:(e,r,s)=>{s.d(r,{A:()=>a});vart=s(55511);functiona({password:e,encryptionKey:r}){lets=r||process.env.DSQL_ENCRYPTION_P