"use strict";exports.id=6060,exports.ids=[6060],exports.modules={96762:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},98e3:(e,t,r)=>{r.d(t,{A:()=>c});var a=r(72583),n=r.n(a),o=r(92652),l=r(30802),i=r(68829),s=r(64292),u=r(52939);async function c({dbContext:e,paradigm:t,dbFullName:r,tableName:a,data:c,tableSchema:d,duplicateColumnName:p,duplicateColumnValue:f,update:g,encryptionKey:_,encryptionSalt:y,forceLocal:$}){let m=!!$||(0,u.A)({dbContext:e,dbFullName:r}),N=m?global.DSQL_DB_CONN:global.DSQL_FULL_ACCESS_DB_CONN||global.DSQL_DB_CONN,h=m?global.DSQL_DB_CONN:global.DSQL_READ_ONLY_DB_CONN||global.DSQL_DB_CONN;if(c?.date_created_timestamp&&delete c.date_created_timestamp,c?.date_updated_timestamp&&delete c.date_updated_timestamp,c?.date_updated&&delete c.date_updated,c?.date_updated_code&&delete c.date_updated_code,c?.date_created&&delete c.date_created,c?.date_created_code&&delete c.date_created_code,p&&"string"==typeof p){let t=`SELECT * FROM ${m?"":`\`${r}\`.`}\`${a}\` WHERE \`${p}\`=?`,n=await (0,s.A)(h,t,[f]);if(n?.[0]&&!g)return null;if(n&&n[0]&&g)return await (0,l.A)({dbContext:e,dbFullName:r,tableName:a,data:c,tableSchema:d,encryptionKey:_,encryptionSalt:y,identifierColumnName:p,identifierValue:f||""})}let E=Object.keys(c),S=[],A=[];for(let e=0;e<E.length;e++)try{let t=E[e],r=c?.[t],a=d?d?.fields?.filter(e=>e.fieldName==t):null,l=a&&a[0]?a[0]:null;if(null==r||void 0==r||l?.dataType?.match(/int$/i)&&"string"==typeof r&&!r?.match(/./))continue;l?.encrypted&&(r=(0,i.A)({data:r,encryptionKey:_,encryptionSalt:y}),console.log("DSQL: Encrypted value =>",r));let s=/<[^>]+>/g;(l?.richText||String(r).match(s))&&(r=n()(r,o.A)),l?.pattern&&!new RegExp(l.pattern,l.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),S.push("`"+t+"`"),"object"==typeof r&&(r=JSON.stringify(r)),"number"==typeof r?A.push(String(r)):A.push(r)}catch(e){console.log("DSQL: Error in parsing data keys =>",e.message);continue}c?.date_created||(S.push("`date_created`"),A.push(Date())),c?.date_created_code||(S.push("`date_created_code`"),A.push(Date.now())),c?.date_updated||(S.push("`date_updated`"),A.push(Date())),c?.date_updated_code||(S.push("`date_updated_code`"),A.push(Date.now()));let L=`INSERT INTO ${m?"":`\`${r}\`.`}\`${a}\` (${S.join(",")}) VALUES (${A.map(()=>"?").join(",")})`;return await (0,s.A)(N,L,A)}},30802:(e,t,r)=>{r.d(t,{A:()=>u});var a=r(72583),n=r.n(a),o=r(92652),l=r(68829),i=r(52939),s=r(64292);async function u({dbContext:e,dbFullName:t,tableName:r,data:a,tableSchema:u,identifierColumnName:c,identifierValue:d,encryptionKey:p,encryptionSalt:f,forceLocal:g}){if(!a||!Object.keys(a).length)return null;let _=!!g||(0,i.A)({dbContext:e,dbFullName:t}),y=_?global.DSQL_DB_CONN:global.DSQL_FULL_ACCESS_DB_CONN||global.DSQL_DB_CONN;_?global.DSQL_DB_CONN:global.DSQL_READ_ONLY_DB_CONN||global.DSQL_DB_CONN;let $=Object.keys(a),m=[],N=[];for(let e=0;e<$.length;e++)try{let t=$[e],r=a[t],i=u?u?.fields?.filter(e=>e.fieldName===t):null,s=i&&i[0]?i[0]:null;if(null==r||void 0==r)continue;let c=/<[^>]+>/g;(s?.richText||String(r).match(c))&&(r=n()(r,o.A)),s?.encrypted&&(r=(0,l.A)({data:r,encryptionKey:p,encryptionSalt:f})),"object"==typeof r&&(r=JSON.stringify(r)),s?.pattern&&!new RegExp(s.pattern,s.patternFlags||"").test(r)&&(console.log("DSQL: Pattern not matched =>",r),r=""),"string"==typeof r&&r.match(/^null$/i)&&(r={toSqlString:function(){return"NULL"}}),"string"!=typeof r||r.match(/./i)||(r={toSqlString:function(){return"NULL"}}),m.push(`\`${t}\`=?`),"number"==typeof r?N.push(String(r)):N.push(r)}catch(e){console.log("DSQL: Error in parsing data keys in update function =>",e.message);continue}m.push(`date_updated='${Date()}'`),m.push(`date_updated_code='${Date.now()}'`);let h=`UPDATE ${_?"":`\`${t}\`.`}\`${r}\` SET ${m.join(",")} WHERE \`${c}\`=?`;return N.push(d),await (0,s.A)(y,h,N)}},92652:(e,t,r)=>{r.d(t,{A:()=>a});let a={allowedTags:["b","i","em","strong","a","p","span","ul","ol","li","h1","h2","h3","h4","h5","h6","img","div","button","pre","code","br"],allowedAttributes:{a:["href"],img:["src","alt","width","height","class","style"],"*":["style","class"]}}},67619:(e,t,r)=>{r.d(t,{A:()=>o});var a=r(29021),n=r.n(a);async function o({user:e,message:t,component:r,noMail:a,req:o}){let l=new Date,i=(()=>{if(!o)return null;try{let e=o.headers["x-forwarded-for"],t=o.headers["x-real-ip"],r=o.headers["cf-connecting-ip"],a=Array.isArray(e)?e[0]:e?.split(",")[0],n=r||a||t||o.socket.remoteAddress;if(!n)return null;return String(n)}catch(e){return null}})();try{let a=`🚀 SERVER ERROR ===========================
Error Message: ${t}
Component: ${r}`;e?.id&&e?.first_name&&e?.last_name&&e?.email&&(a+=`
User Id: ${e?.id}
User Name: ${e?.first_name} ${e?.last_name}
User Email: ${e?.email}`),o?.url&&(a+=`
URL: ${o.url}`),o?.body&&(a+=`
Request Body: ${JSON.stringify(o.body,null,4)}`),i&&(a+=`
IP: ${i}`),a+=`
Date: ${l.toDateString()}
========================================`,n().existsSync("./.tmp/error.log")||n().writeFileSync("./.tmp/error.log","","utf-8");let s=n().readFileSync("./.tmp/error.log","utf-8");n().writeFileSync("./.tmp/error.log",a),n().appendFileSync("./.tmp/error.log",`




${s}`)}catch(e){console.log("Server Error Reporting Error:",e.message)}}},68829:(e,t,r)=>{r.d(t,{A:()=>l});var a=r(55511),n=r(79428),o=r(31542);function l({data:e,encryptionKey:t,encryptionSalt:r}){if(!e?.match(/./))return console.log("Encryption string is invalid"),e;let{key:l,salt:i,keyLen:s,algorithm:u,bufferAllocSize:c}=(0,o.A)({encryptionKey:t});if(!l?.match(/.{8,}/))return console.log("Encryption key is invalid"),e;if(!i?.match(/.{8,}/))return console.log("Encryption salt is invalid"),e;let d=(0,a.scryptSync)(l,i,s),p=n.Buffer.alloc(c,0),f=(0,a.createCipheriv)(u,d,p);try{let t=f.update(e,"utf8","hex");return t+=f.final("hex")}catch(t){return console.log("Error in encrypting =>",t.message),e}}},1111:(e,t,r)=>{r.d(t,{A:()=>a});function a({tableName:e,genObject:t,dbFullName:r}){if(!t)return;let a=t.query?t.query:void 0,n=a?Object.keys(a):void 0,o=[],l=r?`${r}.`:"";function i({queryObj:t,join:r,field:a}){let n=t?.tableName?`${l}${t.tableName}.${a}`:r?`${l}${e}.${a}`:a,i=`${n}=?`;if("string"==typeof t.value||"number"==typeof t.value){let e=String(t.value);"LIKE"==t.equality?i=`LOWER(${n}) LIKE LOWER('%${e}%')`:("NOT EQUAL"==t.equality&&(i=`${n} != ?`),o.push(e))}else if(Array.isArray(t.value)){let e=[];t.value.forEach(r=>{"LIKE"==t.equality?e.push(`LOWER(${n}) LIKE LOWER('%${r}%')`):("NOT EQUAL"==t.equality?e.push(`${n} != ?`):e.push(`${n} = ?`),o.push(r))}),i="("+e.join(` ${t.operator||"AND"} `)+")"}return i}let s=n?.map(e=>{let r=a?.[e];if(r){if(r.__query){let e=r.__query;return"("+Object.keys(e).map(r=>i({queryObj:e?.[r],field:r,join:t.join})).join(` ${r.operator||"AND"} `)+")"}return i({queryObj:r,field:e,join:t.join})}});function u(t,r){return`${l}${"object"==typeof t.source?t.source.tableName:e}.${"object"==typeof t.source?t.source.fieldName:t.source}=${t.targetLiteral?`'${t.targetLiteral}'`:r.alias?`${l}${"object"==typeof t.target?t.target.tableName:r.alias}.${"object"==typeof t.target?t.target.fieldName:t.target}`:`${l}${"object"==typeof t.target?t.target.tableName:r.tableName}.${"object"==typeof t.target?t.target.fieldName:t.target}`}`}let c=(()=>{let r="SELECT";if(t.selectFields?.[0]?t.join?r+=` ${t.selectFields?.map(t=>`${l}${e}.${t}`).join(",")}`:r+=` ${t.selectFields?.join(",")}`:t.join?r+=` ${l}${e}.*`:r+=" *",t.join){let a=[e];r+=","+t.join.map(e=>{let t=e.alias?e.alias:e.tableName;return a.includes(t)?null:(a.push(t),e.selectFields)?e.selectFields.map(e=>{if("string"==typeof e)return`${l}${t}.${e}`;if("object"==typeof e){let r=e.count?`COUNT(${l}${t}.${e.field})`:`${l}${t}.${e.field}`;return e.alias&&(r+=` AS ${e.alias}`),r}}).join(","):`${l}${t}.*`}).filter(e=>!!e).join(",")}return r+=` FROM ${l}${e}`,t.join&&(r+=" "+t.join.map(e=>e.joinType+" "+(e.alias?`${l}${e.tableName} `+e.alias:`${l}${e.tableName}`)+" ON "+(Array.isArray(e.match)?"("+e.match.map(t=>u(t,e)).join(e.operator?` ${e.operator} `:" AND ")+")":"object"==typeof e.match?u(e.match,e):void 0)).join(" ")),r})();if(s?.[0]&&s.find(e=>e)){let e=t?.searchOperator||"AND";c+=` WHERE ${s.join(` ${e} `)} `}return t.order&&(c+=` ORDER BY ${t.join?`${l}${e}.${String(t.order.field)}`:String(t.order.field)} ${t.order.strategy}`),t.limit&&(c+=` LIMIT ${t.limit}`),t.offset&&(c+=` OFFSET ${t.offset}`),{string:c,values:o}}},52939:(e,t,r)=>{r.d(t,{A:()=>a});function a({dbContext:e,dbFullName:t}){return!e?.match(/dsql.user/i)&&(!!global.DSQL_USE_LOCAL||!t||!!t.match(/^datasquirel$/))}},64292:(e,t,r)=>{async function a(e,t,r){try{if(!e)throw Error("No Connection Found!");if(!t)throw Error("Query String Required!");if("string"==typeof t){let a=await e.query(n(t),r);return JSON.parse(JSON.stringify(a))}if("object"!=typeof t)return null;{let r=[];for(let a=0;a<t.length;a++)try{let o=t[a],l=await e.query(n(o.query),o.values);r.push(JSON.parse(JSON.stringify(l)))}catch(e){console.log(`connDbHandler Query Error: ${e.message}`),r.push(null)}return r}}catch(t){return console.log(`connDbHandler Error: ${t.message}`),console.log(e?.config()),null}finally{e?.end()}}function n(e){return e.replace(/\n/gm,"").replace(/ {2,}/g,"").trim()}r.d(t,{A:()=>a})},31542:(e,t,r)=>{r.d(t,{A:()=>n});var a=r(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,a.A)(process.env.DSQL_ENCRYPTION_BUFFER_ALLOCATION_SIZE):void 0)||16}}},82535:(e,t,r)=>{r.d(t,{A:()=>a});function a(e,t){try{let r=Number(e);if("number"!=typeof r||isNaN(r))return 0;if(t)return Number(r.toFixed(t));return Math.round(r)}catch(e){return console.log(`Numberfy ERROR: ${e.message}`),0}}},2706:(e,t)=>{Object.defineProperty(t,"A",{enumerable:!0,get:function(){return r}});var r=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,t,r)=>{e.exports=r(75600)}};