"use strict";(()=>{var e={};e.id=2101,e.ids=[2101],e.modules={76102:e=>{e.exports=require("@moduletrace/datasquirel/dist/client")},39383:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/actions/users/user-auth")},65967:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/ejson")},93726:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/numberfy")},30889:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/slugify")},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}}})},85607:(e,r,t)=>{t.r(r),t.d(r,{config:()=>d,default:()=>_,routeModule:()=>S});var s={};t.r(s),t.d(s,{default:()=>u});var n=t(89947),a=t(2706),o=t(96762),l=t(67619),i=t(69842),c=t(30944);async function u(e,r){if("GET"!==e.method)return r.json({msg:"Failed!"});let{user:t}=await (0,i.A)(e,r);if(!t)return r.json({success:!1,msg:"Unauthorized"});let s=e.query.table,n=e.query.db,a=e.query.field,o=String(e.query.term),u=e.query.operator;try{let e=n?.toString()?.replace(/[^a-z0-9_]/g,""),t=`SELECT * FROM \`${e}\`.\`${s}\` WHERE LOWER(\`${a}\`) ${u?.toString()?.match(/equal/i)?"=":" LIKE "}? ORDER BY id DESC LIMIT 20`,l=[u?.toString()?.match(/equal/i)?o.toLowerCase():"%"+o.toLowerCase()+"%"],i=await (0,c.A)({database:e,queryString:t,queryValuesArray:l}),_=await (0,c.A)({database:e,queryString:t.replace(/\*/,"COUNT(id) AS count").replace(/ ORDER BY .*/,""),queryValuesArray:l});r.json({success:!0,result:i,count:_?.[0]?.count})}catch(e){(0,l.A)({component:"/api/queryEntriesSearchTerm/main-catch-error",message:e.message,user:t}),r.json({success:!1,msg:"Failed!"})}}let _=(0,o.M)(s,"default"),d=(0,o.M)(s,"config"),S=new n.PagesAPIRouteModule({definition:{kind:a.A.PAGES_API,page:"/api/queryEntriesSearchTerm",pathname:"/api/queryEntriesSearchTerm",bundlePath:"",filename:""},userland:s})},55153:(e,r,t)=>{t.d(r,{On:()=>n.a,_n:()=>o}),t(76102);var s=t(65967),n=t.n(s);t(30889);var a=t(93726);let o=t.n(a)()},69842:(e,r,t)=>{t.d(r,{A:()=>o});var s=t(39383),n=t.n(s),a=t(55153);async function o(e,r,t,s){let o=n()({req:e,level:t?"deep":void 0}),l={DSQL_REMOTE_SQL_HOST:process.env.DSQL_REMOTE_SQL_HOST,DSQL_SU_USER_ID:process.env.DSQL_SU_USER_ID,DSQL_HOST_ENV:process.env.DSQL_HOST_ENV,DSQL_HOST:process.env.DSQL_HOST,DSQL_STATIC_HOST:process.env.DSQL_STATIC_HOST,DSQL_GOOGLE_CLIENT_ID:process.env.DSQL_GOOGLE_CLIENT_ID,DSQL_TINY_MCE_API_KEY:process.env.DSQL_TINY_MCE_API_KEY};return s&&o.payload?.id&&(0,a._n)(process.env.DSQL_SU_USER_ID)!==o.payload.id?{user:null,appData:l}:{user:o.payload,appData:l}}},43775:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(95969);let n=/^id$|^uuid$|^date_created$|^date_created_code$|^date_created_timestamp$|^date_updated$|^date_updated_code$|^date_updated_timestamp$/;async function a({unparsedResults:e,tableSchema:r}){let t=[];try{for(let a=0;a<e.length;a++){let o=e[a],l=Object.keys(o);for(let e=0;e<l.length;e++){let t=l[e],a=r?.fields[e];if(t?.match(n))continue;let i=o[t];("number"==typeof i||i)&&a?.encrypted&&i?.match(/./)&&(o[t]=(0,s.A)({encryptedString:i}))}t.push(o)}return t}catch(r){return console.log("ERROR in parseDbResults Function =>",r.message),e}}},67619:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(29021),n=t.n(s);async function a({user:e,message:r,component:t,noMail:s,req:a}){let o=new Date,l=(()=>{if(!a)return null;try{let e=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)return null;return String(n)}catch(e){return null}})();try{let s=`🚀 SERVER ERROR ===========================
Error Message: ${r}
Component: ${t}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(s+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),a?.url&&(s+=`
URL: ${a.url}`),a?.body&&(s+=`
Request Body: ${JSON.stringify(a.body,null,4)}`),l&&(s+=`
IP: ${l}`),s+=`
Date: ${o.toDateString()}
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let i=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",s),n().appendFileSync("./.tmp/error.log",`




${i}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},30944:(e,r,t)=>{t.d(r,{A:()=>l});var s=t(43775),n=t(67619),a=t(7447),o=t(64292);async function l({queryString:e,queryValuesArray:r,database:t,tableSchema:l,debug:i}){let c=(0,a.A)({fa:!0});global.DSQL_USE_LOCAL&&(c=(0,a.A)({local:!0})),t?.match(/^datasquirel$/)&&(c=(0,a.A)()),i&&(console.log("varDatabaseDbHandler:query:",e),console.log("varDatabaseDbHandler:values:",r),console.log("varDatabaseDbHandler:CONNECTION:",c.getConfig()));let u=await (0,o.A)(c,e,r);if(i&&console.log("varDatabaseDbHandler:results:",u),u&&l)try{return await (0,s.A)({unparsedResults:u,tableSchema:l})}catch(e){return console.log("\x1b[31mvarDatabaseDbHandler ERROR\x1b[0m =>",t,e),(0,n.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:()=>o});var s=t(55511),n=t(79428),a=t(31542);function o({encryptedString:e,encryptionKey:r,encryptionSalt:t}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let{key:o,salt:l,keyLen:i,algorithm:c,bufferAllocSize:u}=(0,a.A)({encryptionKey:r});if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!l?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let _=(0,s.scryptSync)(o,l,i),d=n.Buffer.alloc(u,0),S=(0,s.createDecipheriv)(c,_,d);try{let r=S.update(e,"hex","utf8");return r+=S.final("utf8")}catch(r){return console.log("Error in decrypting =>",r.message),e}}},64292:(e,r,t)=>{async function s(e,r,t){try{if(!e)throw Error("No Connection Found!");if(!r)throw Error("Query String Required!");if("string"==typeof r){let s=await e.query(n(r),t);return JSON.parse(JSON.stringify(s))}if("object"!=typeof r)return null;{let t=[];for(let s=0;s<r.length;s++)try{let a=r[s],o=await e.query(n(a.query),a.values);t.push(JSON.parse(JSON.stringify(o)))}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 n(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}t.d(r,{A:()=>s})},7447:(e,r,t)=>{t.d(r,{A:()=>a});var s=t(9973),n=t.n(s);function a(e){return global.DSQL_USE_LOCAL||e?.local?global.DSQL_DB_CONN||n()({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||n()({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||n()({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||n()({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:()=>n});var s=t(82535);function n(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,s.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,r,t)=>{t.d(r,{A:()=>s});function s(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=85607);module.exports=t})();