"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[941],{30941:(e,t,l)=>{l.r(t),l.d(t,{default:()=>U});var n=l(37876),a=l(14232),o=l(66703),s=l(6995),i=l(72757),r=l(48953),d=l(71733),c=l(35003),u=l(62712),p=l(42224),x=l(84812),h=l(37261),m=l(16226),g=l(83517);l(97914);var f=l(90092);let v=e=>{let{isLoadingCurrentLocation:t,setLoadingCurrentLocation:l,setLocationEnabled:o,setLocation:s,zoneId:i,refetchCurrentLocation:r,setRerenderMap:c,isGeolocationEnabled:u,coords:p,fromMapModal:x}=e,[h,m]=(0,a.useState)(!1);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.A,{sx:{borderRadius:"50%",color:e=>e.palette.primary.main,backgroundColor:"background.paper",boxShadow:"0px 4.48276px 11.2069px rgba(0, 0, 0, 0.1)",width:{xs:"28px",md:"35px"},height:{xs:"28px",md:"35px"},display:"flex",alignItems:"center",justifyContent:"center"},onClick:async e=>{e.preventDefault(),p?(l(!0),o(!0),s({lat:null==p?void 0:p.latitude,lng:null==p?void 0:p.longitude}),l(!1),!x&&i&&localStorage.setItem("zoneid",i),await r(),c(e=>!e)):m(!0)},children:(0,n.jsx)(g.A,{sx:{fontSize:{xs:"18px",md:"24px"}}})}),h&&(0,n.jsx)(f.A,{handleCloseLocation:()=>{m(!1)},openLocation:h,isGeolocationEnabled:u})]})};var j=l(28249),A=l(28343),S=l(6781),b=l(82),y=l(73862),k=l(54427),C=l(11131),L=l(18538),w=l(74695),E=l(13880),z=l(97685);l(62415);var I=l(90233),_=l(89099),P=l(83230),D=l(66807),F=l(74748),B=l(89037),M=l(55125),R=l(70099);function T(e){return(0,n.jsxs)(B.A,{sx:{position:"relative"},children:[(0,n.jsx)(M.A,{variant:"determinate",sx:{color:e=>e.palette.grey["light"===e.palette.mode?200:800]},size:25,thickness:4,...e,value:100}),(0,n.jsx)(M.A,{variant:"indeterminate",disableShrink:!0,sx:{color:e=>e.palette.primary.main,animationDuration:"550ms",position:"absolute",left:0,["& .".concat(R.A.circle)]:{strokeLinecap:"round"}},size:25,thickness:4,...e})]})}var N=l(64660),O=l(75834),W=l(35502),G=l(91867),H=l(10602),J=l(30528);let U=(0,a.memo)(e=>{var t,l,g,f,B,M,R;let{open:U,handleClose:X,locationLoading:K,toparcel:Z,handleLocation:$,disableAutoFocus:q,fromReceiver:Q,fromStore:V,selectedLocation:Y}=e,ee=(0,_.useRouter)(),et=(0,o.A)(),el=(0,s.A)(et.breakpoints.down("sm")),{configData:en}=(0,w.d4)(e=>e.configData),{t:ea}=(0,b.Bd)(),[eo,es]=(0,a.useState)(""),[ei,er]=(0,a.useState)(!1),[ed,ec]=(0,a.useState)(!0),[eu,ep]=(0,a.useState)([]),[ex,eh]=(0,a.useState)(!1),[em,eg]=(0,a.useState)(!1),[ef,ev]=(0,a.useState)(""),[ej,eA]=(0,a.useState)(void 0),[eS,eb]=(0,a.useState)(Y||(null==en?void 0:en.default_location)),{selectedModule:ey}=(0,w.d4)(e=>e.utilsData),[ek,eC]=(0,a.useState)(void 0),[eL,ew]=(0,a.useState)(!1),[eE,ez]=(0,a.useState)({}),[eI,e_]=(0,a.useState)(!1),[eP,eD]=(0,a.useState)(!0),[eF,eB]=(0,a.useState)(!1),[eM,eR]=(0,a.useState)(!1),[eT,eN]=(0,a.useState)(!1),[eO,eW]=(0,a.useState)({description:null}),[eG,eH]=(0,a.useState)(!1),{data:eJ,isLoading:eU}=(0,y.A)(eo,ei),eX=(0,w.wA)(),{coords:eK,isGeolocationAvailable:eZ,isGeolocationEnabled:e$,getPosition:eq}=(0,D.L)({positionOptions:{enableHighAccuracy:!1},userDecisionTimeout:5e3,isGeolocationEnabled:!0});(0,a.useEffect)(()=>{if(eJ){var e;ep(null==eJ||null==(e=eJ.suggestions)?void 0:e.map(e=>{var t,l,n,a,o,s,i;return{place_id:null==e||null==(t=e.placePrediction)?void 0:t.placeId,description:"".concat(null==e||null==(a=e.placePrediction)||null==(n=a.structuredFormat)||null==(l=n.mainText)?void 0:l.text,", ").concat(null==e||null==(i=e.placePrediction)||null==(s=i.structuredFormat)||null==(o=s.secondaryText)?void 0:o.text)}}))}},[eJ]);let{data:eQ,refetch:eV}=(0,k.A)(eS,ed);(0,a.useEffect)(()=>{if(eQ){var e;eW({description:null==eQ||null==(e=eQ.results[0])?void 0:e.formatted_address})}else eW({description:""})},[eQ]);let{data:eY,error:e0,isLoading:e1}=(0,C.A)(eS,eP);(0,a.useEffect)(()=>{eY&&(eC(null==eY?void 0:eY.zone_id),"1"!==Q&&localStorage.setItem("zoneid",null==eY?void 0:eY.zone_id)),eY||eC(void 0)},[eY]);let{isLoading:e2,data:e3}=(0,L.A)(ef,ex,()=>{eB(!1)});(0,a.useEffect)(()=>{if(e3){var e,t;eb({lat:null==e3||null==(e=e3.location)?void 0:e.latitude,lng:null==e3||null==(t=e3.location)?void 0:t.longitude})}},[e3]),(0,a.useEffect)(()=>{ej&&ez(ej)},[ej]),(0,a.useEffect)(()=>{eK&&ez({lat:eK.latitude,lng:eK.longitude})},[]);let e5=e=>{ev(null==e?void 0:e.place_id),eA(null==e?void 0:e.description)},e4=(0,H.c)(),e7=e=>{eX((0,N.wv)(e))},{refetch:e8}=(0,O.f)(e7),{refetch:e6}=(0,J.$)(e7);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(i.A,{open:U,onClose:X,closeAfterTransition:!0,slots:{backdrop:r.A},slotProps:{backdrop:{timeout:500}},children:(0,n.jsxs)(h.U,{expand:eT?"true":"false",sx:{display:eG?"none":"inherit",padding:{xs:"15px",md:"2rem"},borderRadius:eT?"0px":{xs:"8px",md:"20px"},position:"relative"},children:[(0,n.jsx)(d.A,{onClick:X,sx:{position:"absolute",top:5,right:8,zIndex:999},children:(0,n.jsx)(j.A,{sx:{fontSize:{xs:"18px",md:"24px"}}})}),(0,n.jsx)(A.jB,{spacing:2,children:(0,n.jsxs)(I.A,{style:{maxHeight:eT?"100vh":"65vh",paddingRight:"15px"},children:[(0,n.jsx)(c.A,{fontSize:{xs:"14px",md:"1rem"},fontWeight:500,children:ea("Pick Location")}),(0,n.jsx)(c.A,{fontSize:{xs:"12px",md:"14px"},fontWeight:400,color:et.palette.neutral[500],children:ea("Sharing your accurate location enhances precision in search results and delivery estimates, ensures effortless order delivery.")}),(0,n.jsx)(A.jB,{children:eF?(0,n.jsx)(u.A,{width:"100%",height:"40px",variant:"rectangular"}):(0,n.jsx)(p.A,{fullWidth:!0,freeSolo:!0,id:"combo-box-demo",getOptionLabel:e=>e.description,options:eu,onChange:(e,t)=>{t&&(""!==t&&"string"==typeof t?(eB(!0),e5(eu[0])):e5(t)),eh(!0)},clearOnBlur:!1,value:eO,loading:eU,loadingText:ea("Search suggestions are loading..."),renderInput:e=>(0,n.jsx)(m.ZP,{sx:{borderRadius:"4px",border:e=>"1px solid ".concat(e.palette.neutral[200])},frommap:"true",label:null,...e,placeholder:ea("Search location"),onChange:e=>{es(e.target.value),e.target.value?er(!0):er(!1)},onKeyPress:e=>{"Enter"===e.key&&es(e.target.value)}})})}),(0,n.jsxs)(A.iv,{sx:{mt:2,color:e=>e.palette.neutral[1e3],p:"5px",position:"relative"},children:[(0,n.jsx)(h.NT,{children:(null==eQ||null==(t=eQ.results)?void 0:t.length)>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(S.A,{fontSize:"small",color:"primary"}),(0,n.jsx)(c.A,{children:null==eQ||null==(l=eQ.results[0])?void 0:l.formatted_address})]}):(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(u.A,{variant:"rounded",width:300,height:20})})}),eS?(0,n.jsx)(E.A,{setDisablePickButton:eR,setLocationEnabled:eg,setLocation:e=>{eb(e)},setCurrentLocation:ez,locationLoading:K,location:eS,setPlaceDetailsEnabled:eh,placeDetailsEnabled:ex,locationEnabled:em,setPlaceDescription:eA,isModalExpand:eT}):(0,n.jsxs)(A.jB,{alignItems:"center",justifyContent:"center",children:[(0,n.jsx)(T,{}),(0,n.jsx)(A.yo,{nodefaultfont:"true",children:ea("Please wait sometimes")})]}),(0,n.jsxs)(h.zS,{alignItems:"center",isXsmall:el,spacing:{xs:1,md:2},children:[(0,n.jsx)(G.A,{isModalExpand:eT,setIsModalExpand:eN,t:ea}),(0,n.jsx)(v,{setLoadingCurrentLocation:ew,setLocationEnabled:eg,setLocation:eb,coords:eK,refetchCurrentLocation:eV,setRerenderMap:e_,isLoadingCurrentLocation:eL,isGeolocationEnabled:e$,fromMapModal:!0})]})]}),(0,n.jsx)(A.jB,{justifyCenter:"center",alignItems:"center",sx:{position:"sticky",bottom:0,zIndex:9},children:(null==e0||null==(g=e0.response)?void 0:g.data)?(0,n.jsx)(x.A,{"aria-label":"picklocation",sx:{flex:"1 0",width:"100%",top:"-3rem"},disabled:K,variant:"contained",color:"error",onClick:()=>{ek&&localStorage.setItem("zoneid",ek),X()},children:null==e0||null==(M=e0.response)||null==(B=M.data)||null==(f=B.errors[0])?void 0:f.message}):(0,n.jsx)(h.jn,{disabled:e1||!(null==eQ||null==(R=eQ.results[0])?void 0:R.formatted_address),variant:"contained",onClick:()=>(()=>{if(ek&&eQ&&eS){var e,t;(0,W.g)()&&("rental"===e4?e6():e8()),"1"!==Q&&"1"!==Z&&localStorage.setItem("zoneid",ek),"1"!==Q&&"1"!==Z?(localStorage.setItem("location",null==eQ||null==(e=eQ.results[0])?void 0:e.formatted_address),localStorage.setItem("currentLatLng",JSON.stringify(eS))):z.Ay.success(ea("New location has been set.")),"1"===Z?($(eS,null==eQ||null==(t=eQ.results[0])?void 0:t.formatted_address),X()):V||eS&&ey?(window.location.reload(),X()):eH(!0)}})(),children:ea("Pick Locations")})})]})})]})}),eG&&(0,n.jsx)(P.J,{location:eE,closeModal:e=>{e&&(z.Ay.success(ea(F.gU)),ee.push("/home",void 0,{shallow:!0})),eH(!1),null==X||X()},disableAutoFocus:q,zoneId:ek})]})})},91867:(e,t,l)=>{l.d(t,{A:()=>x});var n=l(37876);l(14232);var a=l(35268),o=l(71733),s=l(66703),i=l(6995),r=l(7227),d=l(73303),c=l(2577);let u=(0,a.Ay)(o.A)(e=>{let{theme:t,isXSmall:l}=e;return{boxShadow:"0px 4.48276px 11.2069px rgba(0, 0, 0, 0.1)",borderRadius:"5.36207px",width:l?"38px":"35px",height:l?"38px":"35px",position:"relative",color:t.palette.primary.main,backgroundColor:t.palette.background.paper,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",maxWidth:"38px"}}),p=e=>{let{isModalExpand:t,setIsModalExpand:l,t:a}=e,o=(0,s.A)(),p=(0,i.A)(o.breakpoints.down("sm"));return(0,n.jsx)(u,{isXSmall:p,onClick:()=>l(e=>!e),children:t?(0,n.jsx)(r.A,{title:a("Close fullscreen"),arrow:!0,placement:"top",children:(0,n.jsx)(d.A,{sx:{fontSize:{xs:"24px",md:"24px"}}})}):(0,n.jsx)(r.A,{title:a("Fullscreen"),arrow:!0,placement:"top",children:(0,n.jsx)(c.A,{sx:{fontSize:{xs:"24px",md:"24px"}}})})})};p.propTypes={};let x=p}}]);