"use strict";(()=>{var e={};e.id=2564,e.ids=[2564],e.modules={43036:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.r(t),a.d(t,{config:()=>g,default:()=>c,getServerSideProps:()=>m,getStaticPaths:()=>x,getStaticProps:()=>p,reportWebVitals:()=>h,routeModule:()=>P,unstable_getServerProps:()=>f,unstable_getServerSideProps:()=>q,unstable_getStaticParams:()=>j,unstable_getStaticPaths:()=>S,unstable_getStaticProps:()=>b});var r=a(63865),i=a(9455),n=a(30671),d=a(5583),u=a(53881),l=a(37418),o=e([l]);l=(o.then?(await o)():o)[0];let c=(0,n.M)(l,"default"),p=(0,n.M)(l,"getStaticProps"),x=(0,n.M)(l,"getStaticPaths"),m=(0,n.M)(l,"getServerSideProps"),g=(0,n.M)(l,"config"),h=(0,n.M)(l,"reportWebVitals"),b=(0,n.M)(l,"unstable_getStaticProps"),S=(0,n.M)(l,"unstable_getStaticPaths"),j=(0,n.M)(l,"unstable_getStaticParams"),f=(0,n.M)(l,"unstable_getServerProps"),q=(0,n.M)(l,"unstable_getServerSideProps"),P=new r.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:l});s()}catch(e){s(e)}})},51481:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.d(t,{A:()=>x});var r=a(8732),i=a(82015),n=a.n(i),d=a(37418),u=a(53926),l=a(66485),o=a(56331),c=a(67274),p=e([d]);function x(){let{databases:e,setTargetDatabase:t,user:a}=n().useContext(d.DatabasesContext);return(0,r.jsxs)(n().Fragment,{children:[(0,r.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,r.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,r.jsx)("h1",{className:"text-3xl m-0",children:"Databases"}),(0,r.jsxs)("a",{href:`/admin/${a?.id}/databases/add-database`,className:"button flex items-center gap-2",children:[(0,r.jsx)("span",{className:"symbol",children:"+"}),(0,r.jsx)("span",{children:"Add Database"})]})]}),(0,r.jsx)(u.A,{user:a})]}),a?.verification_status?.toString().match(/1/)?(0,r.jsxs)(n().Fragment,{children:[(0,r.jsx)(o.A,{databases:e,setTargetDatabase:t,user:a}),(0,r.jsx)(c.A,{user:a})]}):(0,r.jsx)(l.A,{})]})}d=(p.then?(await p)():p)[0],s()}catch(e){s(e)}})},37418:(e,t,a)=>{a.a(e,async(e,s)=>{try{a.r(t),a.d(t,{DatabasesContext:()=>g,default:()=>x,getServerSideProps:()=>m});var r=a(8732),i=a(82015),n=a.n(i),d=a(72837),u=a(92702),l=a(51481),o=a(70355),c=a(71934),p=e([d,l]);[d,l]=p.then?(await p)():p;let g=n().createContext({});function x({user:e,databases:t}){let a=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("title",{children:"Databases | Datasquirel"}),(0,r.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[s,i]=n().useState();return(0,r.jsx)(g.Provider,{value:{user:e,databases:t,targetDatabase:s,setTargetDatabase:i},children:(0,r.jsxs)(n().Fragment,{children:[(0,r.jsx)(d.A,{head:a,children:(0,r.jsx)(l.A,{})}),(0,r.jsx)(o.A,{targetDatabase:s})]})})}async function m({req:e,res:t,query:a}){let{user:s,appData:r}=await (0,u.A)(e,t);if(!s?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let i=await (0,c.A)("SELECT * FROM user_databases WHERE user_id=? ORDER BY id DESC",[s.id]);return{props:{user:s,appData:r,databases:i}}}s()}catch(e){s(e)}})},76102:e=>{e.exports=require("@moduletrace/datasquirel/dist/client")},13893:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},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")},27825:e=>{e.exports=require("lodash")},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")},9973:e=>{e.exports=require("serverless-mysql")},33873:e=>{e.exports=require("path")},75979:e=>{e.exports=import("tailwind-merge")}};var t=require("../../../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),s=t.X(0,[883,9821,3881,8892,4715],()=>a(43036));module.exports=s})();