"use strict";(()=>{var e={};e.id=6856,e.ids=[6856],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")},96762:(e,r)=>{Object.defineProperty(r,"M",{enumerable:!0,get:function(){return function e(r,t){return t in r?r[t]:"then"in r&&"function"==typeof r.then?r.then(r=>e(r,t)):"function"==typeof r&&"default"===t?r:void 0}}})},88525:(e,r,t)=>{t.r(r),t.d(r,{config:()=>u,default:()=>i,routeModule:()=>_});var n={};t.r(n),t.d(n,{default:()=>c});var s=t(89947),o=t(2706),a=t(96762),l=t(30944);async function c(e,r){if("GET"!==e.method)return r.json({success:!1,msg:"Failed!"});let{type:t,value:n,tableName:s,dbFullName:o,userId:a,dbId:c,userType:i,database:u}=e.query,_=o&&"string"==typeof o?o.replace(/[^a-z0-9_]/g,""):"datasquirel",p=`SELECT \`${t}\` FROM ${_}.\`${s}\` WHERE \`${t}\`=?`,d=[n];a&&(p+=" AND user_id=?",d.push(a)),c&&(p+=" AND db_id=?",d.push(c)),i&&(p+=" AND user_type=?",d.push(i)),u&&(p+=" AND `database`=?",d.push(u));let D=await (0,l.A)({queryString:p,queryValuesArray:d,database:_});r.json({result:!!D&&!!D[0]})}let i=(0,a.M)(n,"default"),u=(0,a.M)(n,"config"),_=new s.PagesAPIRouteModule({definition:{kind:o.A.PAGES_API,page:"/api/checkDuplicateData",pathname:"/api/checkDuplicateData",bundlePath:"",filename:""},userland:n})},43775:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(95969);let s=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function o({unparsedResults:e,tableSchema:r}){let t=[];try{for(let o=0;o<e.length;o++){let a=e[o],l=Object.keys(a);for(let e=0;e<l.length;e++){let t=l[e],o=r?.fields[e];if(t?.match(s))continue;let c=a[t];("number"==typeof c||c)&&o?.encrypted&&c?.match(/./)&&(a[t]=(0,n.A)({encryptedString:c}))}t.push(a)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(29021),s=t.n(n);async function o({user:e,message:r,component:t,noMail:n,req:o}){let a=new Date,l=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],r=o.headers["x-real-ip"],t=o.headers["cf-connecting-ip"],n=Array.isArray(e)?e[0]:e?.split(",")[0],s=t||n||r||o.socket.remoteAddress;if(!s)return null;return String(s)}catch(e){return null}})();try{let n=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(n+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),o?.url&&(n+=`
URL: ${o.url}`),o?.body&&(n+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),l&&(n+=`
IP: ${l}`),n+=`
Date: ${a.toDateString()}
========================================`,s().existsSync("./.tmp/error.log")||s().writeFileSync("./.tmp/error.log","","utf-8");let c=s().readFileSync("./.tmp/error.log","utf-8");s().writeFileSync("./.tmp/error.log",n),s().appendFileSync("./.tmp/error.log",`




${c}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>l});var n=t(43775),s=t(67619),o=t(7447),a=t(64292);async function l({queryString:e,queryValuesArray:r,database:t,tableSchema:l,debug:c}){let i=(0,o.A)({fa:!0});global.DSQL_USE_LOCAL&&(i=(0,o.A)({local:!0})),t?.match(/^datasquirel$/)&&(i=(0,o.A)()),c&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",i.getConfig()));let u=await (0,a.A)(i,e,r);if(c&&console.log("varDatabaseDbHandler:results:",u),u&&l)try{return await (0,n.A)({unparsedResults:u,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,s.A)({component:"varDatabaseDbHandler/lines-52-53",message:e.message}),null}else if(u)return u;else return null}},95969:(e,r,t)=>{t.d(r,{A:()=>a});var n=t(55511),s=t(79428),o=t(31542);function a({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:a,salt:l,keyLen:c,algorithm:i,bufferAllocSize:u}=(0,o.A)({encryptionKey:r});if(!a?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,n.scryptSync)(a,l,c),p=s.Buffer.alloc(u,0),d=(0,n.createDecipheriv)(i,_,p);try{let r=d.update(e,"hex","utf8");return r+=d.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},64292:(e,r,t)=>{async function n(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let n=await e.query(s(r),t);return JSON.parse(JSON.stringify(n))}if("object"!=typeof r)return null;{let t=[];for(let n=0;n<r.length;n++)try{let o=r[n],a=await e.query(s(o.query),o.values);t.push(JSON.parse(JSON.stringify(a)))}catch(e){console.log(`connDbHandler Query Error: ${e.message}`),t.push(null)}return t}}catch(r){return console.log(`connDbHandler Error: ${r.message}`),console.log(e?.config()),null}finally{e?.end()}}function s(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>n})},7447:(e,r,t)=>{t.d(r,{A:()=>o});var n=t(9973),s=t.n(n);function o(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.ro?global.DSQL_READ_ONLY_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_READ_ONLY_USERNAME,password:process.env.DSQL_DB_READ_ONLY_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):e?.fa?global.DSQL_FULL_ACCESS_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_FULL_ACCESS_USERNAME,password:process.env.DSQL_DB_FULL_ACCESS_PASSWORD,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}}):global.DSQL_DB_CONN||s()({config:{host:process.env.DSQL_DB_HOST,user:process.env.DSQL_DB_USERNAME,password:process.env.DSQL_DB_PASSWORD,database:e?.noDb?void 0:process.env.DSQL_DB_NAME,port:process.env.DSQL_DB_PORT?Number(process.env.DSQL_DB_PORT):void 0,charset:"utf8mb4"}})}},31542:(e,r,t)=>{t.d(r,{A:()=>s});var n=t(82535);function s(e){return{key:e?.encryptionKey||process.env.DSQL_ENCRYPTION_PASSWORD,keyLen:process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24,salt:e?.encryptionSalt||process.env.DSQL_ENCRYPTION_SALT,apiKey:e?.apiKey||process.env.DSQL_API_KEY,algorithm:e?.algorithm||process.env.DSQL_ENCRYPTION_ALGORITHM||"aes-192-cbc",bufferAllocSize:e?.bufferAllocSize||(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE?(0,n.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>n});function n(e,r){try{let t=Number(e);if("number"!=typeof t||isNaN(t))return 0;if(r)return Number(t.toFixed(r));return Math.round(t)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,r)=>{Object.defineProperty(r,"A",{enumerable:!0,get:function(){return t}});var t=function(e){return e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE",e}({})},89947:(e,r,t)=>{e.exports=t(75600)}};var r=require("../../webpack-api-runtime.js");r.C(e);var t=r(r.s=88525);module.exports=t})();