"use strict";(()=>{var e={};e.id=66,e.ids=[66],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")},20097:(e,t,s)=>{s.r(t),s.d(t,{originalPathname:()=>f,patchFetch:()=>N,requestAsyncStorage:()=>y,routeModule:()=>h,serverHooks:()=>x,staticGenerationAsyncStorage:()=>m});var o={};s.r(o),s.d(o,{DELETE:()=>l,POST:()=>d});var r=s(49303),n=s(88716),a=s(60670),i=s(87070),c=s(19191),u=s(70446),p=s(90455);async function d(e){let t=await (0,u.Gg)(),s=(0,p.LP)(t),o=t.user?.id;if(!s||!o)return i.NextResponse.json({error:"Not authenticated"},{status:401});let{businessId:r}=await e.json();if(!r)return i.NextResponse.json({error:"businessId required"},{status:400});try{let e=await (0,c.q)(`/customers/v1/${o}/click_on_search/businesses/${r}`,{apiBase:"mobile",token:s,method:"POST",cache:"no-store"});return i.NextResponse.json(e)}catch{return i.NextResponse.json({error:"Failed to save search"},{status:500})}}async function l(e){let t=await (0,u.Gg)(),s=(0,p.LP)(t),o=t.user?.id;if(!s||!o)return i.NextResponse.json({error:"Not authenticated"},{status:401});let{businessId:r}=await e.json();if(!r)return i.NextResponse.json({error:"businessId required"},{status:400});try{let e=await (0,c.q)(`/customers/v1/${o}/delete_from_search/businesses/${r}`,{apiBase:"mobile",token:s,method:"DELETE",cache:"no-store"});return i.NextResponse.json(e)}catch{return i.NextResponse.json({error:"Failed to remove search"},{status:500})}}let h=new r.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/search/history/route",pathname:"/api/search/history",filename:"route",bundlePath:"app/api/search/history/route"},resolvedPagePath:"/Users/ferlando/Desktop/baboon-nextjs/app/api/search/history/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:y,staticGenerationAsyncStorage:m,serverHooks:x}=h,f="/api/search/history/route";function N(){return(0,a.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:m})}},19191:(e,t,s)=>{s.d(t,{F:()=>a,q:()=>n});var o=s(47090),r=s(70446);async function n(e,t={}){let{apiBase:s="mobile",method:n="GET",body:a,token:i,langCode:c,notificationToken:u,headers:p={},revalidate:d,cache:l}=t,h=o.Y8[s],y=`${h}${e.startsWith("/")?e:"/"+e}`,m={"Content-Type":"application/json","User-Agent":"BaboonWeb",...p};i&&(m.Authorization=i),c&&(m.langCode=c);let x=u;if(!x)try{x=(await (0,r.Gg)()).fcmToken}catch{}x&&(m.notificationToken=x);let f={method:n,headers:m};a&&"GET"!==n&&(f.body=JSON.stringify(a)),void 0!==d&&(f.next={revalidate:d}),l&&(f.cache=l);let N=await fetch(y,f);if(!N.ok)throw Error(`API request failed: ${N.status} ${N.statusText}`);return N.json()}async function a(e,t={}){let{apiBase:s="mobile",method:n="GET",body:a,token:i,langCode:c,notificationToken:u,headers:p={}}=t,d=o.Y8[s],l=`${d}${e.startsWith("/")?e:"/"+e}`,h={"Content-Type":"application/json","User-Agent":"BaboonWeb",...p};i&&(h.Authorization=i),c&&(h.langCode=c);let y=u;if(!y)try{y=(await (0,r.Gg)()).fcmToken}catch{}y&&(h.notificationToken=y);let m={method:n,headers:h};return a&&"GET"!==n&&(m.body=JSON.stringify(a)),fetch(l,m)}},90455:(e,t,s)=>{function o(e){return e.token?e.token:e.user?.token?e.user.token:process.env.BABOON_APP_BUSINESS_TOKEN||""}function r(){return process.env.BABOON_APP_BUSINESS_TOKEN||""}s.d(t,{I2:()=>r,LP:()=>o})},47090:(e,t,s)=>{s.d(t,{RF:()=>o,Y8:()=>n,pH:()=>r});let o=["al","en","it"],r={AL:{latitude:41.327546,longitude:19.818698,cityId:1,countryId:1},XK:{latitude:42.662914,longitude:21.165503,cityId:2,countryId:2}},n={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:()=>n,l7:()=>a,yK:()=>c});var o=s(78632),r=s(71615);let n={password:process.env.SESSION_SECRET,cookieName:"baboon-session",cookieOptions:{secure:!0,httpOnly:!0,sameSite:"lax",maxAge:604800}},a={...n,cookieName:"baboon-admin-session"};async function i(){let e=await (0,r.cookies)();return(0,o.iW)(e,n)}async function c(){let e=await (0,r.cookies)();return(0,o.iW)(e,a)}}};var t=require("../../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),o=t.X(0,[8948,3314,8632,5972],()=>s(20097));module.exports=o})();