(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2945],{52819:function(e,s,n){Promise.resolve().then(n.bind(n,53596))},53596:function(e,s,n){"use strict";n.r(s),n.d(s,{default:function(){return c}});var i,r=n(27573),l=n(88280);n(39838);var a=n(70007),o=(n(7653),n(412),n(39e3),n(74531),n(41664),n(74859),n(87882)),t=n(74859),c=((i=function(){return console.log("\uD83E\uDEE1 API Server is running at: ",t.env.NEXT_PUBLIC_API||"(undefined - please set NEXT_PUBLIC_API in your environment)"),console.log("\uD83E\uDEE1 Reverse proxy is running at: ",t.env.NEXT_PUBLIC_REVERSE_PROXY||"(undefined - please set NEXT_PUBLIC_REVERSE_PROXY in your environment)"),console.log("\uD83E\uDEE1 REST API endpoint:","http://localhost:8000"),(0,r.jsx)(l.Z,{children:(0,r.jsx)(a.Z,{activeNavItem:"/webui/",children:(0,r.jsx)("main",{className:"py-0",children:(0,r.jsx)("div",{className:"px-4 sm:px-6 lg:px-8",children:(0,r.jsx)("div",{className:"mx-auto max-w-7xl px-4 sm:px-6 lg:px-8",children:(0,r.jsx)(o.Z,{})})})})})})}).displayName||i.name,i)},41664:function(e,s,n){"use strict";n.d(s,{Z:function(){return g}});var i=n(27573),r=n(7653),l=n(1930),a=n(97747),o=n(88146),t=n(36531),c=n(93296),d=n(39e3),u=n(412);function g(){let e=(0,u.I0)(),[s,n]=(0,r.useState)(""),[g,m]=(0,r.useState)(""),[p,x]=(0,r.useState)("");async function h(){try{c.ZP.loading("Logging in...",{id:"login-loading"}),console.log("email",s),console.log("password",g);let n=await fetch("/webui_api/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s,password:g})});if(console.log("response",n),401===n.status){x("Invalid email or password"),c.ZP.error("Invalid email or password",{id:"login-error"}),c.ZP.dismiss("login-loading"),e((0,d.v)({token:""}));return}if(200===n.status){let s=await n.json();console.log("response.data",s),e((0,d.v)(s)),console.log("Login successful"),window.location.assign("/webui"),c.ZP.success("Login successful.",{id:"login-success",duration:3e3,style:{backgroundColor:"#10B981",color:"#fff"}}),c.ZP.dismiss("login-loading")}else{let s=await n.text()||"An error occurred while loading!";x(s),e((0,d.v)({token:""})),c.ZP.error(s,{id:"login-error"}),c.ZP.dismiss("login-loading")}}catch(s){console.error("An error occurred:",s),c.ZP.error("An error occurred. Please try again later.",{id:"login-error"}),c.ZP.dismiss("login-loading"),e((0,d.v)({token:""}))}}return(0,i.jsx)("div",{className:"w-full lg:grid lg:min-h-[600px] lg:grid-cols-1 place-items-center",children:(0,i.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,i.jsxs)("div",{className:"mx-auto grid w-[350px] gap-6",children:[(0,i.jsx)("div",{className:"grid gap-2 text-center",children:(0,i.jsx)("div",{className:"flex h-auto shrink-0 items-center pb-4",children:(0,i.jsx)("a",{href:"/webui",children:(0,i.jsx)("img",{className:"h-auto w-auto",src:"/webui_asset/purple-dark.png",alt:"SuperDuperDB Inc."})})})}),(0,i.jsxs)("div",{className:"grid gap-4",children:[(0,i.jsxs)("div",{className:"grid gap-2",children:[(0,i.jsx)(a._,{htmlFor:"email",children:"Username or email"}),(0,i.jsx)(l.I,{id:"email",type:"email",placeholder:"m@example.com",required:!0,value:s,onChange:e=>n(e.target.value)})]}),(0,i.jsxs)("div",{className:"grid gap-2",children:[(0,i.jsxs)("div",{className:"flex items-center",children:[(0,i.jsx)(a._,{htmlFor:"password",children:"Password"}),(0,i.jsx)(o.default,{href:"/webui/support",className:"ml-auto inline-block text-sm underline",children:"Forgot your password?"})]}),(0,i.jsx)(l.I,{id:"password",type:"password",required:!0,value:g,onChange:e=>m(e.target.value)})]}),p&&(0,i.jsx)("p",{className:"text-red-500",children:p}),(0,i.jsx)(t.z,{id:"login-button-homepage",className:"w-full",onClick:h,children:"Log in"})]}),(0,i.jsxs)("div",{className:"mt-4 text-center text-sm",children:["Don't have an account?"," ",(0,i.jsx)(o.default,{href:"/webui/support",className:"underline",children:"Contact Enterprise Support"})]})]})})})}}},function(e){e.O(0,[5458,7441,3296,8320,8374,3908,7653,7050,6340,4112,790,8307,9115,3098,7635,5554,3696,935,1826,8238,5865,5141,1293,1528,1744],function(){return e(e.s=52819)}),_N_E=e.O()}]);