1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7439],{15757:(e,t,o)=>{o.d(t,{A:()=>u});var r=o(82651),i=o(86249);let n=r.A.create({baseURL:"https://ikook-prod-9c50f663a33f.herokuapp.com",headers:{"Content-Type":"application/json"},withCredentials:!0,timeout:6e4});(0,i.Ay)(n,{retries:3,retryDelay:e=>1e3*e,retryCondition:e=>{var t,o;let r=null===(o=e.config)||void 0===o?void 0:null===(t=o.method)||void 0===t?void 0:t.toUpperCase();return(!r||"GET"===r)&&!!(i.Ay.isNetworkError(e)||e.response&&e.response.status>=500)},shouldResetTimeout:!0});let a=!1,l=[],s=e=>{l.forEach(t=>{e?t.reject(e):t.resolve()}),l=[]};n.interceptors.response.use(e=>e,async e=>{var t,o,r,i;let u=e.config;if((null===(t=e.response)||void 0===t?void 0:t.status)===401&&u&&!u._retry&&!(null===(o=u.url)||void 0===o?void 0:o.includes("/auth/login"))&&!(null===(r=u.url)||void 0===r?void 0:r.includes("/auth/signup"))&&!(null===(i=u.url)||void 0===i?void 0:i.includes("/auth/refresh"))){if(a)return new Promise((e,t)=>{l.push({resolve:e,reject:t})}).then(()=>n(u));u._retry=!0,a=!0;try{return await n.post("/users/auth/refresh/"),s(null),n(u)}catch(e){return s(e),window.location.pathname.includes("/login")||(window.location.href="/login"),Promise.reject(e)}finally{a=!1}
1}return Promise.reject(e)});let u=n},68383:(e,t,o)=>{o.d(t,{A:()=>s,w:()=>l});var r=o(95155),i=o(12115);let n="ikook_market_src",a=i.createContext(void 0);function l(e){let{children:t}=e,[o,l]=i.useState("NG"),[s,u]=i.useState(void 0),[c,d]=i.useState(void 0),[g,k]=i.useState(void 0);i.useEffect(()=>{l(function(){if("undefined"==typeof document)return"NG";let e=document.cookie.split("; ").find(e=>e.startsWith("".concat("ikook_market","="))),t=null==e?void 0:e.split("=")[1];return"NG"===t||"ZA"===t||"GB"===t?t:"NG"}());try{let e=localStorage.getItem("userLocation");if(e){let{latitude:t,longitude:o}=JSON.parse(e);"number"==typeof t&&"number"==typeof o&&(d(t),k(o))}}catch(e){}},[]),i.useEffect(()=>{var e;let t=!1;async function r(){try{let e=new AbortController,r=setTimeout(()=>e.abort(),3e3),i=await fetch("https://ipapi.co/json/",{signal:e.signal});if(clearTimeout(r),!i.ok){if(!(i=await fetch("https://ip-api.com/json/",{signal:e.signal})).ok)return;let o=await i.json();if(o.city&&!t&&u(o.city),"number"==typeof o.lat&&"number"==typeof o.lon&&!t){d(o.lat),k(o.lon);try{localStorage.setItem("userLocation",JSON.stringify({latitude:o.lat,longitude:o.lon}))}catch(e){}}return}let a=await i.json(),s=(a.country_code||"").toUpperCase(),c=a.city;if(c&&!t&&u(c),"number"==typeof a.latitude&&"number"==typeof a.longitude&&!t){d(a.latitude),k(a.longitude);try{localStorage.setItem("userLocation",JSON.stringify({latitude:a.latitude,longitude:a.longitude}))}catch(e){}}if(!s)return;let g="NG"===s||"ZA"===s||"GB"===s?s:"NG";t||g===o||(l(g),document.cookie="ikook_market=".concat(g,"; Path=/; Max-Age=").concat(2592e3,"; SameSite=Lax"),document.cookie="".concat(n,"=auto; Path=/; Max-Age=").concat(2592e3,"; SameSite=Lax"))}catch(e){}}return"user"!==("undefined"!=typeof document?null===(e=document.cookie.split("; ").find(e=>e.startsWith("".concat(n,"="))))||void 0===e?void 0:e.split("=")[1]:void 0)&&r(),()=>{t=!0}},[o]);let f=i.useMemo(()=>({market:o,city:s,latitude:c,longitude:g,setMarket:l}),[o,s,c,g]);return(0,r.jsx)(a.Provider,{value:f,children:t})}function s(){let e=i.useContext(a);if(!e)throw Error("useMarket must be used within MarketProvider");return e}},67610:(e,t,o)=>{o.d(t,{n:()=>d});var r=o(99827);let i="ikook_authenticated",n=()=>{localStorage.setItem(i,"true")},a=()=>"true"===localStorage.getItem(i),l=()=>{localStorage.removeItem(i)},s=e=>{{let{access_token:t,refresh_token:o,...r}=e;localStorage.setItem("ikook_user_data",JSON.stringify(r))}},u=()=>{{let e=localStorage.getItem("ikook_user_data");if(e)try{return JSON.parse(e)}catch(e){}}return null},c=()=>{localStorage.removeItem("ikook_user_data")},d=(0,r.v)((e,t)=>({userType:null,user:null,isAuthenticated:!1,isInitialized:!1,hostFormData:null,chefFormData:null,bookingMenu:(()=>{try{let e=localStorage.getItem("ikook_booking_menu");return e?JSON.parse(e):null}catch(e){}return null})(),bookingMenuSelection:(()=>{try{let e=localStorage.getItem("ikook_booking_menu_selection");return e?JSON.parse(e):null}catch(e){}return null})(),bookingSelectedAddons:(()=>{try{let e=localStorage.getItem("ikook_booking_selected_addons");return e?JSON.parse(e):null}catch(e){}return null})(),booking:null,bookingService:null,setBooking:t=>{e({booking:t})},setUserType:t=>{e({userType:t})},setUser:t=>{n(),s(t),e({user:t,isAuthenticated:!0,userType:"Host"===t.user_type?"host":"chef"})},logout:()=>{l(),c(),localStorage.removeItem("ikook_booking_selected_addons"),localStorage.removeItem("ikook_booking_menu"),localStorage.removeItem("ikook_booking_menu_selection"),e({user:null,isAuthenticated:!1,userType:null})},initializeAuth:()=>{if(a()){let t=u();t?e({user:t,isAuthenticated:!0,userType:"Host"===t.user_type?"host":"chef",isInitialized:!0}):e({isAuthenticated:!0,isInitialized:!0})}else c(),e({user:null,isAuthenticated:!1,userType:null,isInitialized:!0})},setHostFormData:t=>{e({hostFormData:t})},setChefFormData:t=>{e({chefFormData:t})},clearUserType:()=>{e({userType:null})},clearHostFormData:()=>{e({hostFormData:null})},clearChefFormData:()=>{e({chefFormData:null})},setBookingMenu:t=>{e({bookingMenu:t});try{localStorage.setItem("ikook_booking_menu",JSON.stringify(t))}catch(e){}},setBookingMenuSelection:t=>{e({bookingMenuSelection:t});try{localStorage.setItem("ikook_booking_menu_selection",JSON.stringify(t))}catch(e){}},setBookingSelectedAddons:t=>{e({bookingSelectedAddons:t});try{localStorage.setItem("ikook_booking_selected_addons",JSON.stringify(t))}catch(e){}},setBookingService:t=>{e({bookingService:t})}}))},26270:(e,t,o)=>{o.d(t,{handleApiError:()=>n,showToast:()=>i});var r=o(4817);let i={success:e=>{r.Ay.success(e,{duration:4e3,position:"top-right",style:{background:"#10B981",color:"#fff",borderRadius:"8px",fontSize:"14px"}})},error:e=>{r.Ay.error(e,{duration:5e3,position:"top-right",style:{background:"#EF4444",color:"#fff",borderRadius:"8px",fontSize:"14px"}})},warning:e=>{(0,r.Ay)(e,{duration:5e3,position:"top-right",style:{background:"#F59E0B",color:"#fff",borderRadius:"8px",fontSize:"14px"}})},loading:e=>r.Ay.loading(e,{position:"top-right",style:{background:"#F59E0B",color:"#fff",borderRadius:"8px",fontSize:"14px"}})},n=function(e){var t,o;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Something went wrong",n=r;(null==e?void 0:null===(o=e.response)||void 0===o?void 0:null===(t=o.data)||void 0===t?void 0:t.message)?n=e.response.data.message:(null==e?void 0:e.message)?n=e.message:"string"==typeof e&&(n=e),i.error(n)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.