module.exports=[933363,611552,a=>{"use strict";var b,c=a.i(187924),d=a.i(572131),e=a.i(50944),f=a.i(17790),g=((b={}).SetCategory="SET_CATEGORY",b.SetLocation="SET_LOCATION",b.SetDate="SET_DATE",b.SetTime="SET_TIME",b.SetSearchPredictions="SET_SEARCH_PREDICTIONS",b.SetLocationPLaceId="SET_LOCATION_PLACE_ID",b.Replace="REPLACE",b);let h=(a,b)=>{switch(b.type){case"SET_CATEGORY":return{...a,category:{categoryId:b.payload.id.toString(),query:b.payload.translation?.title||"",data:b.payload}};case"SET_LOCATION":case"SET_SEARCH_PREDICTIONS":return{...a,location:{...a.location,...b.payload}};case"SET_DATE":return{...a,date:{query:b.payload}};case"SET_TIME":return{...a,searchTime:{time:b.payload}};case"SET_LOCATION_PLACE_ID":return{...a,location:{...a.location,placeId:b.payload}};case"REPLACE":return b.payload;default:return a}};a.s(["Types",()=>g,"searchReducer",0,h],611552);let i={category:{},location:{status:""},date:{},searchTime:{time:null}},j=(0,d.createContext)({state:i,dispatch:()=>null});a.s(["default",0,({children:a})=>{let b=(0,e.useSearchParams)(),[k,l]=(0,d.useReducer)(h,i),m=b.toString();(0,d.useEffect)(()=>{let a,c;l({type:g.Replace,payload:{date:{...(c=(a=b.get("date"))?(0,f.formatSearchDate)(a)||a:void 0)&&{query:c}},location:{status:"",...b.has("location")&&{query:b.get("location")},...b.has("latitude")&&b.has("longitude")&&{geolocation:{longitude:b.get("longitude"),latitude:b.get("latitude")}}},category:{...b.has("revenue")&&{query:b.get("revenue")},...b.has("category_id")&&{categoryId:b.get("category_id")}},searchTime:{time:b.has("timeFrom")&&b.has("timeTo")?{from:b.get("timeFrom"),to:b.get("timeTo")}:null}}})},[m]);let n=(0,d.useMemo)(()=>({state:k,dispatch:l}),[k]);return(0,c.jsx)(j.Provider,{value:n,children:a})},"useSearch",0,()=>{let a=(0,d.useContext)(j);if(!a)throw Error("useSearch has to be used within <Search.Provider>");return a}],933363)}];

//# sourceMappingURL=context_search_search_provider_tsx_e4be4d69._.js.map