"use strict";(()=>{var e={};e.id=2915,e.ids=[2915],e.modules={72934:e=>{e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},6005:e=>{e.exports=require("node:crypto")},29261:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>g,patchFetch:()=>h,requestAsyncStorage:()=>l,routeModule:()=>p,serverHooks:()=>m,staticGenerationAsyncStorage:()=>y});var n={};s.r(n),s.d(n,{POST:()=>d});var o=s(49303),a=s(88716),r=s(60670),i=s(87070),u=s(70446),c=s(19191);async function d(){let e=await (0,u.yK)();if(!e.username||!e.password)return i.NextResponse.json({error:"No stored credentials"},{status:401});try{let t=await (0,c.q)("/authenticationuser/v2/authentication",{apiBase:"sysadmin",method:"POST",body:{username:e.username,password:e.password,userType:0},cache:"no-store"});if(200!==t.statusMessage.status)return e.destroy(),i.NextResponse.json({error:"Relogin failed"},{status:401});let{user:s,token:n}=t.data;return e.user=s,e.token=n,await e.save(),i.NextResponse.json({success:!0})}catch{return i.NextResponse.json({error:"Relogin failed"},{status:500})}}let p=new o.AppRouteRouteModule({definition:{kind:a.x.APP_ROUTE,page:"/api/auth/sysadmin-relogin/route",pathname:"/api/auth/sysadmin-relogin",filename:"route",bundlePath:"app/api/auth/sysadmin-relogin/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/auth/sysadmin-relogin/route.ts",nextConfigOutput:"standalone",userland:n}),{requestAsyncStorage:l,staticGenerationAsyncStorage:y,serverHooks:m}=p,g="/api/auth/sysadmin-relogin/route";function h(){return(0,r.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:y})}},19191:(e,t,s)=>{s.d(t,{F:()=>r,q:()=>a});var n=s(47090),o=s(70446);async function a(e,t={}){let{apiBase:s="mobile",method:a="GET",body:r,token:i,langCode:u,notificationToken:c,headers:d={},revalidate:p,cache:l}=t,y=n.Y8[s],m=`${y}${e.startsWith("/")?e:"/"+e}`,g={"Content-Type":"application/json","User-Agent":"BaboonWeb",...d};i&&(g.Authorization=i),u&&(g.langCode=u);let h=c;if(!h)try{h=(await (0,o.Gg)()).fcmToken}catch{}h&&(g.notificationToken=h);let x={method:a,headers:g};r&&"GET"!==a&&(x.body=JSON.stringify(r)),void 0!==p&&(x.next={revalidate:p}),l&&(x.cache=l);let f=await fetch(m,x);if(!f.ok)throw Error(`API request failed: ${f.status} ${f.statusText}`);return f.json()}async function r(e,t={}){let{apiBase:s="mobile",method:a="GET",body:r,token:i,langCode:u,notificationToken:c,headers:d={}}=t,p=n.Y8[s],l=`${p}${e.startsWith("/")?e:"/"+e}`,y={"Content-Type":"application/json","User-Agent":"BaboonWeb",...d};i&&(y.Authorization=i),u&&(y.langCode=u);let m=c;if(!m)try{m=(await (0,o.Gg)()).fcmToken}catch{}m&&(y.notificationToken=m);let g={method:a,headers:y};return r&&"GET"!==a&&(g.body=JSON.stringify(r)),fetch(l,g)}},47090:(e,t,s)=>{s.d(t,{RF:()=>n,Y8:()=>a,pH:()=>o});let n=["al","en","it"],o={AL:{latitude:41.327546,longitude:19.818698,cityId:1,countryId:1},XK:{latitude:42.662914,longitude:21.165503,cityId:2,countryId:2}},a={mobile:process.env.BABOON_API_MOBILE_URL,legacy:process.env.BABOON_API_URL,sysadmin:process.env.BABOON_API_SYSADMIN_URL,payment:process.env.BABOON_API_PAYMENT_URL}},70446:(e,t,s)=>{s.d(t,{Gg:()=>i,dx:()=>a,l7:()=>r,yK:()=>u});var n=s(78632),o=s(71615);let a={password:process.env.SESSION_SECRET,cookieName:"baboon-session",cookieOptions:{secure:!0,httpOnly:!0,sameSite:"lax",maxAge:604800}},r={...a,cookieName:"baboon-admin-session"};async function i(){let e=await (0,o.cookies)();return(0,n.iW)(e,a)}async function u(){let e=await (0,o.cookies)();return(0,n.iW)(e,r)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),n=t.X(0,[8948,3314,8632,5972],()=>s(29261));module.exports=n})();