(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,360149,218993,e=>{"use strict";var t,a=e.i(843476),o=e.i(271645),r=e.i(618566),i=e.i(249439),c=((t={}).SetCategory="SET_CATEGORY",t.SetLocation="SET_LOCATION",t.SetDate="SET_DATE",t.SetTime="SET_TIME",t.SetSearchPredictions="SET_SEARCH_PREDICTIONS",t.SetLocationPLaceId="SET_LOCATION_PLACE_ID",t.Replace="REPLACE",t);let l=(e,t)=>{switch(t.type){case"SET_CATEGORY":return{...e,category:{categoryId:t.payload.id.toString(),query:t.payload.translation?.title||"",data:t.payload}};case"SET_LOCATION":case"SET_SEARCH_PREDICTIONS":return{...e,location:{...e.location,...t.payload}};case"SET_DATE":return{...e,date:{query:t.payload}};case"SET_TIME":return{...e,searchTime:{time:t.payload}};case"SET_LOCATION_PLACE_ID":return{...e,location:{...e.location,placeId:t.payload}};case"REPLACE":return t.payload;default:return e}};e.s(["Types",()=>c,"searchReducer",0,l],218993);let s={category:{},location:{status:""},date:{},searchTime:{time:null}},u=(0,o.createContext)({state:s,dispatch:()=>null});e.s(["default",0,({children:e})=>{let t=(0,r.useSearchParams)(),[d,n]=(0,o.useReducer)(l,s),T=t.toString();(0,o.useEffect)(()=>{let e,a;n({type:c.Replace,payload:{date:{...(a=(e=t.get("date"))?(0,i.formatSearchDate)(e)||e:void 0)&&{query:a}},location:{status:"",...t.has("location")&&{query:t.get("location")},...t.has("latitude")&&t.has("longitude")&&{geolocation:{longitude:t.get("longitude"),latitude:t.get("latitude")}}},category:{...t.has("revenue")&&{query:t.get("revenue")},...t.has("category_id")&&{categoryId:t.get("category_id")}},searchTime:{time:t.has("timeFrom")&&t.has("timeTo")?{from:t.get("timeFrom"),to:t.get("timeTo")}:null}}})},[T]);let S=(0,o.useMemo)(()=>({state:d,dispatch:n}),[d]);return(0,a.jsx)(u.Provider,{value:S,children:e})},"useSearch",0,()=>{let e=(0,o.useContext)(u);if(!e)throw Error("useSearch has to be used within <Search.Provider>");return e}],360149)}]);