"use strict";(()=>{var e={};e.id=7122,e.ids=[3220,7122],e.modules={30671:(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}}})},92192:(e,t,r)=>{r.r(t),r.d(t,{config:()=>A,default:()=>E,getServerSideProps:()=>v,getStaticPaths:()=>j,getStaticProps:()=>P,reportWebVitals:()=>b,routeModule:()=>k,unstable_getServerProps:()=>I,unstable_getServerSideProps:()=>L,unstable_getStaticParams:()=>O,unstable_getStaticPaths:()=>D,unstable_getStaticProps:()=>N});var s={};r.r(s),r.d(s,{default:()=>S,getServerSideProps:()=>y});var n=r(63865),o=r(9455),a=r(30671),i=r(5583),c=r(19796),l=r(8732),u=r(82015),d=r.n(u),p=r(27912),m=r.n(p),g=r(29021),f=r.n(g),h=r(92702);r(46169),r(45731);var _=r(16757),x=r(41939);function S({user:e,query:t}){let r=(0,l.jsxs)(d().Fragment,{children:[(0,l.jsx)("title",{children:"Loging Out | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Login you out"}),(0,l.jsx)("script",{src:"https://accounts.google.com/gsi/client"}),(0,l.jsx)("script",{src:"https://connect.facebook.net/en_US/sdk.js",crossOrigin:"anonymous"})]});return(0,l.jsxs)(d().Fragment,{children:[(0,l.jsx)(m(),{children:r}),(0,l.jsx)("main",{className:"w-screen h-screen flex items-center justify-center p-4 md:p-8",children:(0,l.jsxs)("div",{className:"card max-w-md flex-col items-center bg-white p-6 rounded border border-slate-200 border-solid",children:[(0,l.jsxs)("a",{href:"/",className:"flex items-center gap-2",children:[(0,l.jsx)("img",{src:"/images/logo-icon-alt-2.png",alt:"Logo Icon",width:37}),(0,l.jsx)("span",{className:"font-bold text-2xl",children:"Datasquirel"})]}),(0,l.jsx)("h3",{className:"text-lg m-0 mt-4 text-slate-400",children:"Logging out"}),(0,l.jsx)(_.A,{position:"relative",width:"20px"})]})})]})}async function y({req:e,res:t,query:r}){let s=await (0,h.A)(e,t);if(s){console.log(s.csrf_k);try{let e=process.env.DSQL_USER_LOGIN_KEYS_PATH,t=`${e}/${s.csrf_k}`;console.log("allowedAuthKeyPath",t),f().unlinkSync(t)}catch(e){console.log(`Logout API error: ${e.message}`)}}let{keyCookieName:n,csrfCookieName:o}=(0,x.A)();return t.setHeader("Set-Cookie",[`${n}=none;max-age=0`,`${o}=null;max-age=0`]),{props:{user:s,logged_out:!0,query:r}}}let E=(0,a.M)(s,"default"),P=(0,a.M)(s,"getStaticProps"),j=(0,a.M)(s,"getStaticPaths"),v=(0,a.M)(s,"getServerSideProps"),A=(0,a.M)(s,"config"),b=(0,a.M)(s,"reportWebVitals"),N=(0,a.M)(s,"unstable_getStaticProps"),D=(0,a.M)(s,"unstable_getStaticPaths"),O=(0,a.M)(s,"unstable_getStaticParams"),I=(0,a.M)(s,"unstable_getServerProps"),L=(0,a.M)(s,"unstable_getServerSideProps"),k=new n.PagesRouteModule({definition:{kind:o.A.PAGES,page:"/logout",pathname:"/logout",bundlePath:"",filename:""},components:{App:c.default,Document:i.default},userland:s})},92702:(e,t,r)=>{r.d(t,{A:()=>c});var s=r(71934),n=r(71205),o=r(29021),a=r.n(o),i=r(41939);async function c(e,t,r){try{let{keyCookieName:o,csrfCookieName:c}=(0,i.A)();if(!e.cookies?.[o]?.match(/./))throw Error("Request Cookies not Found!");let l=(0,n.A)({encryptedString:e.cookies[o]});if(!l)throw Error("Couldn't decrypt auth cookie!");let u=JSON.parse(l);if(!u.csrf_k)throw Error("No `csrf_k` present in user Object!");if(r&&!Object.keys(e.headers).find(e=>e.includes(u.csrf_k)))throw Error("Deep Auth Failed. `csrf` key not found in request headers!");let d=process.env.DSQL_USER_LOGIN_KEYS_PATH;if(!d)throw Error("DSQL_USER_LOGIN_KEYS_PATH env variable not found. Please set this variable.");if(r&&!a().existsSync(`${d}/${u.csrf_k}`))throw Error("Key not found in Auth Keys Folder!");if(0==u.verification_status&&!r){let e=await (0,s.A)(`SELECT verification_status FROM users WHERE id='${u.id}'`);e&&e[0]&&1==e[0].verification_status&&t.setHeader("Set-Cookie",["user_refresh=1"])}if(u?.date&&Date.now()-u.date>6048e5)throw Error("Key expired!");return u}catch(e){return console.log(`userAuth Error: ${e.message}`),null}}},45731:(e,t,r)=>{r.d(t,{A:()=>s});async function s(){try{let e=await caches.keys();e[0]&&await Promise.all(e.map(e=>caches.delete(e)))}catch(e){console.log("Error in clearing cache =>",e.message)}}},41939:(e,t,r)=>{r.d(t,{A:()=>s});function s(e){let t=process.env.DSQL_COOKIES_PREFIX||"dsql_",r=process.env.DSQL_COOKIES_KEY_NAME||"key",s=process.env.DSQL_COOKIES_CSRF_NAME||"csrf",n=process.env.DSQL_COOKIES_ONE_TIME_CODE_NAME||"one-time-code",o=e?.database?.replace(/^datasquirel_user_\d+_/,"")||process.env.DSQL_DB_NAME?.replace(/^datasquirel_user_\d+_/,""),a=t;e?.userId&&(a+=`user_${e.userId}_`),o&&(a+=`${o}_`),a+=r;let i=t;e?.userId&&(i+=`user_${e.userId}_`),o&&(i+=`${o}_`),i+=s;let c=t;return e?.userId&&(c+=`user_${e.userId}_`),o&&(c+=`${o}_`),{keyCookieName:a,csrfCookieName:i,oneTimeCodeName:c+=n}}},71205:(e,t,r)=>{r.d(t,{A:()=>o});var s=r(55511),n=r(79428);function o({encryptedString:e,encryptionKey:t,encryptionSalt:r}){if(!e?.match(/./))return console.log("Encrypted string is invalid"),e;let o=t||process.env.DSQL_ENCRYPTION_PASSWORD,a=r||process.env.DSQL_ENCRYPTION_SALT,i=process.env.DSQL_ENCRYPTION_KEY_LENGTH?Number(process.env.DSQL_ENCRYPTION_KEY_LENGTH):24;if(!o?.match(/.{8,}/))return console.log("Decrption key is invalid"),e;if(!a?.match(/.{8,}/))return console.log("Decrption salt is invalid"),e;let c=(0,s.scryptSync)(o,a,i),l=n.Buffer.alloc(16,0),u=(0,s.createDecipheriv)("aes-192-cbc",c,l);try{let t=u.update(e,"hex","utf8");return t+=u.final("utf8")}catch(t){return console.log("Error in decrypting =>",t.message),e}}},71934:(e,t,r)=>{r.d(t,{A:()=>s});async function s(...e){let t=global.DSQL_DB_CONN;try{if(!t)throw Error("No Connection provided to DB_HANDLER function!");let r=await t.query(...e);return JSON.parse(JSON.stringify(r))}catch(e){return console.log("DB Error =>",e),{success:!1,error:e.message}}finally{await t?.end()}}},5583:(e,t,r)=>{r.r(t),r.d(t,{default:()=>o});var s=r(8732);r(82015);var n=r(20883);function o(){return(0,s.jsxs)(n.Html,{lang:"en",children:[(0,s.jsxs)(n.Head,{children:[(0,s.jsx)("meta",{name:"author",content:"Datasquirel"}),(0,s.jsx)("meta",{name:"Copyright",content:`Copyright (c) ${new Date().getFullYear()} Datasquirel`}),"dev_dev".match(/dev/)&&(0,s.jsx)("meta",{name:"robots",content:"noindex,nofollow"}),(0,s.jsx)("link",{rel:"preconnect",href:"https://fonts.googleapis.com/",crossOrigin:"anonymous"}),(0,s.jsx)("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),(0,s.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Poppins"}),(0,s.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=Inter"}),(0,s.jsx)("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css?family=IBM+Plex+Mono"}),(0,s.jsx)("script",{src:"/scripts/themeSelector.js"}),(0,s.jsx)("meta",{httpEquiv:"Content-Type",content:"text/html; charset=UTF-8"}),(0,s.jsx)("meta",{property:"og:site_name",content:"DATASQUIREL"}),(0,s.jsx)("meta",{property:"og:type",content:"website"}),(0,s.jsx)("meta",{name:"twitter:card",content:"summary"}),(0,s.jsx)("meta",{property:"og:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,s.jsx)("meta",{itemProp:"image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,s.jsx)("meta",{name:"twitter:image",content:"https://static.datasquirel.com/images/user-images/user-2/email-banner.jpeg"}),(0,s.jsx)("link",{rel:"stylesheet",href:"/styles/prism.css"}),(0,s.jsx)("script",{src:"/scripts/prism.js",async:!0}),(0,s.jsx)("script",{dangerouslySetInnerHTML:{__html:"var DSQL = {}"}})]}),(0,s.jsxs)("body",{children:[(0,s.jsx)(n.Main,{}),(0,s.jsx)(n.NextScript,{})]})]})}},9455:(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}({})},13893:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},33873:e=>{e.exports=require("path")}};var t=require("../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[883,9821,9796],()=>r(92192));module.exports=s})();