"use strict";(()=>{vare={};e.id=2564,e.ids=[2564],e.modules={25316:(e,t,a)=>{a.r(t),a.d(t,{config:()=>w,default:()=>M,getServerSideProps:()=>D,getStaticPaths:()=>A,getStaticProps:()=>q,reportWebVitals:()=>E,routeModule:()=>W,unstable_getServerProps:()=>N,unstable_getServerSideProps:()=>R,unstable_getStaticParams:()=>F,unstable_getStaticPaths:()=>y,unstable_getStaticProps:()=>C});vars={};a.r(s),a.d(s,{DatabasesContext:()=>P,default:()=>v,getServerSideProps:()=>_});varr=a(63865),i=a(9455),n=a(30671),d=a(5583),u=a(19796),l=a(8732),o=a(82015),c=a.n(o),p=a(25562),x=a(92702),m=a(53926),g=a(66485),b=a(56331),S=a(67274);functionh(){let{databases:e,setTargetDatabase:t,user:a}=c().useContext(P);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,l.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,l.jsx)("h1",{className:"text-3xl m-0",children:"Databases"}),(0,l.jsxs)("a",{href:`/admin/${a?.id}/databases/add-database`,className:"button flex items-center gap-2",children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Database"})]})]}),(0,l.jsx)(m.A,{user:a})]}),a?.verification_status?.toString().match(/1/)?(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(b.A,{databases:e,setTargetDatabase:t,user:a}),(0,l.jsx)(S.A,{user:a})]}):(0,l.jsx)(g.A,{})]})}varf=a(70355),j=a(71934);letP=c().createContext({});functionv({user:e,databases:t}){leta=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"Databases | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[s,r]=c().useState();return(0,l.jsx)(P.Provider,{value:{user:e,databases:t,targetDatabase:s,setTargetDatabase:r},children:(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(p.A,{head:a,user:e,children:(0,l.jsx)(h,{})}),(0,l.jsx)(f.A,{targetDatabase:s})]})})}asyncfunction_({req:e,res:t,query:a}){lets=await(0,x.A)(e,t);if(!s?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};letr=await(0,j.A)("SELECT * FROM user_databases WHERE user_id=? ORDER BY id DESC",[s.id]);return{props:{user:s,databases:r}}}letM=(0,n.M)(s,"default"),q=(0,n.M)(s,"getStaticProps"),A=(0,n.M)(s,"getStaticPaths"),D=(0,n.M)(s,"getServerSideProps"),w=(0,n.M)(s,"config"),E=(0,n.M)(s,"reportWebVitals"),C=(0,n.M)(s,"unstable_getStaticProps"),y=(0,n.M)(s,"unstable_getStaticPaths"),F=(0,n.M)(s,"unstable_getStaticParams"),N=(0,n.M)(s,"unstable_getServerProps"),R=(0,n.M)(s,"unstable_getServerSideProps"),W=newr.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/databases",pathname:"/admin/[user_id]/databases",bundlePath:"",filename:""},components:{App:u.default,Document:d.default},userland:s})},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")}};vart=require("../../../webpack-runtime.js");t.C(e);vara=e=>t(t.s=e),s=t.X(0,[883,9821,9796,5392,6160],()=>a(25316));module.exports=s})();