"use strict";exports.id=3704,exports.ids=[3704],exports.modules={83704:(e,a,t)=>{t.d(a,{A:()=>g});vars=t(29021),r=t.n(s),i=t(96052),l=t(33873),n=t.n(l),o=t(67580),d=t(30944),u=t(68829),c=t(98e3),m=t(49941);asyncfunction_({user:e,social_platform:a,invitation:t,database:s,additionalFields:r,useLocal:i}){letl=s||"datasquirel",n=`SELECT * FROM \`${l}\`.\`users\` WHERE email=? AND social_id=? AND social_platform=?`,o=[e.email,e.social_id,a],u=await(0,d.A)({database:l,queryString:n,queryValuesArray:o,useLocal:i});if(!u?.[0])return{success:!1,payload:null};letc=Math.random().toString(36).substring(2)+"-"+Math.random().toString(36).substring(2),_={id:u[0].id,first_name:u[0].first_name,last_name:u[0].last_name,username:u[0].username,user_type:u[0].user_type,email:u[0].email,social_id:u[0].social_id,image:u[0].image,image_thumbnail:u[0].image_thumbnail,verification_status:u[0].verification_status,social_login:u[0].social_login,social_platform:u[0].social_platform,csrf_k:c,logged_in_status:!0,date:Date.now()};returnr?.[0]&&r.forEach(e=>{_[e]=u[0][e]}),t&&(!s||s?.match(/^datasquirel$/))&&(0,m.A)({query:t,user:_,useLocal:i}),{success:!0,payload:_,csrf:c}}asyncfunctiong({database:e,social_id:a,email:t,social_platform:s,payload:l,invitation:m,supEmail:g,additionalFields:p,useLocal:f}){try{lety=[a.toString(),s],E=await(0,d.A)({database:e||"datasquirel",queryString:"SELECT * FROM datasquirel.users WHERE social_id = ? AND social_login='1' AND social_platform = ? ",queryValuesArray:y,useLocal:f});if(E&&E[0])returnawait_({user:E[0],social_platform:s,invitation:m,database:e,additionalFields:p,useLocal:f});letA=t||g||null;if(!A)return{success:!1,payload:null,msg:"No Email Present"};letS=`SELECT * FROM datasquirel.users WHERE email='${A}'`,b=await(0,d.A)({database:e||"datasquirel",queryString:S,useLocal:f});if(b&&b[0])return{success:!1,payload:null,msg:"This Email is already taken"};leth=[A,s,a],D=await(0,d.A)({database:e||"datasquirel",queryString:"SELECT * FROM datasquirel.users WHERE email=? AND social_login='1' AND social_platform=? AND social_id=?",queryValuesArray:h,useLocal:f});if(D&&D[0])returnawait_({user:l,social_platform:s,invitation:m,database:e,additionalFields:p,useLocal:f});letv=(0,u.A)({data:a.toString()}),R={social_login:"1",verification_status:g?"0":"1",password:v};Object.keys(l).forEach(e=>{R[e]=l[e]});letL=await(0,c.A)({dbContext:e?"Dsql User":void0,paradigm:e?"Full Access":void0,dbFullName:e||"datasquirel",tableName:"users",duplicateColumnName:"email",duplicateColumnValue:A,data:{...R,email:A},useLocal:f});if(!L?.insertId)returnconsole.log("Social User Failed to insert in 'handleSocialDb.ts' backend function =>",L),{success:!1,payload:null,msg:"Social User Failed to insert in 'handleSocialDb.ts' backend function"};{e||await(0,o.A)({userId:L.insertId,useLocal:f});leta=`SELECT * FROM datasquirel.users WHERE id='${L.insertId}'`,t=await(0,d.A)({database:e||"datasquirel",queryString:a,useLocal:f});if(!t||!t[0])return{success:!1,payload:null,msg:"User Insertion Failed!"};if(g&&e?.match(/^datasquirel$/)){lete=(0,u.A)({data:JSON.stringify({id:L.insertId,email:g,dateCode:Date.now()})});(0,i.A)({to:g,subject:"Verify Email Address",text:"Please click the link to verify your email address",html:r().readFileSync("./email/send-email-verification-link.html","utf8").replace(/{{host}}/,process.env.DSQL_HOST||"").replace(/{{token}}/,e||"")}).then(()=>{})}letl=process.env.DSQL_STATIC_SERVER_DIR;if(!l)returnconsole.log("Static File ENV not Found!"),{success:!1,payload:null,msg:"Static File ENV not Found!"};if(!e||e?.match(/^datasquirel$/)){lete=`${process.env.DSQL_USER_DB_SCHEMA_PATH}/user-${L.insertId}`,a=n().join(l,`images/user-images/user-${L.insertId}`);r().mkdirSync(e),r().mkdirSync(a),r().writeFileSync(`${e}/main.json`,JSON.stringify([]),"utf8")}returnawait_({user:t[0],social_platform:s,invitation:m,database:e,additionalFields:p,useLocal:f})}}catch(e){returnconsole.log("ERROR in 'handleSocialDb.ts' backend function =>",e.message),{success:!1,payload:null,msg:e.message}}}},49941:(e,a,t)=>{t.d(a,{A:()=