"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[2912],{91547:function(e,t,n){n.d(t,{gA:function(){return A}});var r=n(37762),a=n(93433),o=n(29439),i=n(74165),s=n(15861),c=n(1413),l=n(47313),d=n(76088),u=n(16783),p=n(85281),x=n(88706),f=n(44453),h=n(46417),m="https://nominatim.openstreetmap.org/search",g="https://nominatim.openstreetmap.org/reverse",b=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=[],n=function(e,n){e&&t.push({long_name:e,short_name:e,types:n})};return n(e.house_number,["street_number"]),n(e.road||e.pedestrian,["route"]),n(e.suburb||e.neighbourhood||e.quarter,["sublocality_level_1","sublocality"]),n(e.city_district||e.county,["administrative_area_level_3"]),n(e.city||e.town||e.village,["locality"]),n(e.state,["administrative_area_level_1"]),n(e.country,["country"]),n(e.postcode,["postal_code"]),t},Z=function(e){var t;return{formatted_address:e.display_name,name:(null===(t=e.display_name)||void 0===t?void 0:t.split(",")[0])||"",geometry:{location:{lat:function(){return parseFloat(e.lat)},lng:function(){return parseFloat(e.lon)}}},address_components:b(e.address)}},v=function(e,t){var n=new AbortController,r=setTimeout((function(){return n.abort()}),8e3);return fetch(e,(0,c.Z)((0,c.Z)({},t),{},{signal:n.signal})).finally((function(){return clearTimeout(r)}))},j=new f.Z,S="23456789CFGHJMPQRVWX",k=new RegExp("[".concat(S,"]{2,8}\\+[").concat(S,"]{2,3}"),"i");function y(e,t){return _.apply(this,arguments)}function _(){return(_=(0,s.Z)((0,i.Z)().mark((function e(t,n){var r,a,o;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,r=new URLSearchParams({lat:String(t),lon:String(n),format:"json",addressdetails:"1"}),e.next=4,v("".concat(g,"?").concat(r.toString()),{headers:{Accept:"application/json"}});case 4:if((a=e.sent).ok){e.next=7;break}return e.abrupt("return",null);case 7:return e.next=9,a.json();case 9:if((o=e.sent)&&!o.error){e.next=12;break}return e.abrupt("return",null);case 12:return e.abrupt("return",o);case 15:return e.prev=15,e.t0=e.catch(0),e.abrupt("return",null);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})))).apply(this,arguments)}var C=function(){var e=(0,s.Z)((0,i.Z)().mark((function e(t,n){var r,a,o,s,l,d,u,p,x;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=null===t||void 0===t?void 0:t.match(k)){e.next=3;break}return e.abrupt("return",null);case 3:if(a=r[0].toUpperCase(),j.isValid(a)){e.next=6;break}return e.abrupt("return",null);case 6:if(e.prev=6,o=a,!j.isShort(a)){e.next=14;break}if(s=Number(null===n||void 0===n?void 0:n.lat),l=Number(null===n||void 0===n?void 0:n.lng),Number.isFinite(s)&&Number.isFinite(l)&&(0!==s||0!==l)){e.next=13;break}return e.abrupt("return",null);case 13:o=j.recoverNearest(a,s,l);case 14:if(j.isFull(o)){e.next=16;break}return e.abrupt("return",null);case 16:return d=j.decode(o),u=d.latitudeCenter,p=d.longitudeCenter,e.next=19,y(u,p);case 19:return x=e.sent,e.abrupt("return",(0,c.Z)((0,c.Z)({},x),{},{place_id:"pluscode-".concat(o),lat:String(u),lon:String(p),display_name:null!==x&&void 0!==x&&x.display_name?"".concat(x.display_name," (near ").concat(a,")"):"".concat(a," (Plus Code location)"),address:(null===x||void 0===x?void 0:x.address)||{}}));case 23:return e.prev=23,e.t0=e.catch(6),e.abrupt("return",null);case 26:case"end":return e.stop()}}),e,null,[[6,23]])})));return function(t,n){return e.apply(this,arguments)}}(),P=function(e,t){var n=new URLSearchParams({q:e,format:"json",addressdetails:"1",limit:"5"}),r=Number(null===t||void 0===t?void 0:t.lat),a=Number(null===t||void 0===t?void 0:t.lng);if(Number.isFinite(r)&&Number.isFinite(a)){var o=.5;n.set("viewbox","".concat(a-o,",").concat(r+o,",").concat(a+o,",").concat(r-o))}return n},w=function(){var e=(0,s.Z)((0,i.Z)().mark((function e(t,n){var r,a,o;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=P(t,n)).set("limit","1"),e.next=4,v("".concat(m,"?").concat(r.toString()),{headers:{Accept:"application/json"}});case 4:if((a=e.sent).ok){e.next=7;break}return e.abrupt("return",null);case 7:return e.next=9,a.json();case 9:return o=e.sent,e.abrupt("return",null!==o&&void 0!==o&&o.length?o[0]:null);case 11:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}();function A(e){return E.apply(this,arguments)}function E(){return E=(0,s.Z)((0,i.Z)().mark((function e(t){var n,a,o,s,c,l,d,u,p,x=arguments;return(0,i.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=x.length>1&&void 0!==x[1]?x[1]:{},a=n.bias,t){e.next=3;break}return e.abrupt("return",null);case 3:return e.next=5,C(t,a);case 5:if(!(o=e.sent)){e.next=8;break}return e.abrupt("return",Z(o));case 8:s=t.split(",").map((function(e){return e.trim()})).filter(Boolean),c=s.length>1?s.map((function(e,t){return s.slice(t).join(", ")})):[t],e.prev=10,l=(0,r.Z)(c),e.prev=12,l.s();case 14:if((d=l.n()).done){e.next=23;break}return u=d.value,e.next=18,w(u,a);case 18:if(!(p=e.sent)){e.next=21;break}return e.abrupt("return",Z(p));case 21:e.next=14;break;case 23:e.next=28;break;case 25:e.prev=25,e.t0=e.catch(12),l.e(e.t0);case 28:return e.prev=28,l.f(),e.finish(28);case 31:return e.abrupt("return",null);case 34:return e.prev=34,e.t1=e.catch(10),console.error("geocodeAddress error:",e.t1),e.abrupt("return",null);case 38:case"end":return e.stop()}}),e,null,[[10,34],[12,25,28,31]])}))),E.apply(this,arguments)}t.ZP=function(e){var t=e.id,n=e.label,r=e.placeholder,i=void 0===r?"Search address":r,s=e.value,f=e.onChange,g=e.onPlaceSelected,b=e.bias,j=e.sx,S=e.textFieldSx,k=e.fullWidth,y=void 0===k||k,_=e.disabled,w=e.inputRef,A=e.TextFieldProps,E=void 0===A?{}:A,I=(0,l.useState)(s||""),R=(0,o.Z)(I,2),D=R[0],T=R[1],Y=(0,l.useState)([]),W=(0,o.Z)(Y,2),M=W[0],z=W[1],L=(0,l.useState)(!1),N=(0,o.Z)(L,2),F=N[0],H=N[1];(0,l.useEffect)((function(){void 0!==s&&s!==D&&T(s||"")}),[s]);var O=(0,l.useMemo)((function(){return(0,x.Z)((function(e,t,n){if(e){var r=P(e,t),i=v("".concat(m,"?").concat(r.toString()),{headers:{Accept:"application/json"}}).then((function(e){return e.ok?e.json():[]})).catch((function(){return[]})),s=C(e,t).catch((function(){return null}));Promise.all([i,s]).then((function(e){var t=(0,o.Z)(e,2),r=t[0],i=t[1];n(i?[i].concat((0,a.Z)(r||[])):r||[])}))}else n([])}),500)}),[]);return(0,l.useEffect)((function(){var e=!0;return D?(H(!0),O(D,b,(function(t){e&&(H(!1),z(t))})),function(){e=!1}):(z([]),void H(!1))}),[D,null===b||void 0===b?void 0:b.lat,null===b||void 0===b?void 0:b.lng,O]),(0,h.jsx)(d.Z,{id:t,freeSolo:!0,fullWidth:y,disabled:_,sx:j,options:M,filterOptions:function(e){return e},getOptionLabel:function(e){return"string"===typeof e?e:e.display_name||""},isOptionEqualToValue:function(e,t){return e.place_id===(null===t||void 0===t?void 0:t.place_id)},noOptionsText:F?"Searching\u2026":D.trim().length>=3?"No match found \u2014 drop the business name/Plus Code, or try just City + Postcode":"Type an address to search",inputValue:D,onInputChange:function(e,t){T(t),null===f||void 0===f||f(t)},onChange:function(e,t){t&&"string"!==typeof t&&(T(t.display_name||""),null===g||void 0===g||g(Z(t)))},renderInput:function(e){var t,r,a,o;return(0,h.jsx)(u.Z,(0,c.Z)((0,c.Z)((0,c.Z)({},e),E),{},{inputRef:w,label:n,placeholder:i,sx:S,autoComplete:"off",InputProps:(0,c.Z)((0,c.Z)((0,c.Z)({},e.InputProps),E.InputProps),{},{startAdornment:null!==(t=null===(r=E.InputProps)||void 0===r?void 0:r.startAdornment)&&void 0!==t?t:e.InputProps.startAdornment,endAdornment:(0,h.jsxs)(h.Fragment,{children:[F?(0,h.jsx)(p.Z,{color:"inherit",size:16}):null,null!==(a=null===(o=E.InputProps)||void 0===o?void 0:o.endAdornment)&&void 0!==a?a:e.InputProps.endAdornment]})})}))}})}},62912:function(e,t,n){n.r(t);var r=n(93433),a=n(74165),o=n(15861),i=n(29439),s=n(1413),c=n(47313),l=n(42832),d=n(48119),u=n(61113),p=n(9019),x=n(57829),f=n(76088),h=n(16783),m=n(69099),g=n(47131),b=n(16429),Z=n(83929),v=n(44758),j=n(66212),S=n(70024),k=n(19536),y=n(85281),_=n(33604),C=n(49914),P=n(96467),w=n(11198),A=n(37159),E=n(36528),I=n(12058),R=n(88960),D=n(23195),T=n(58467),Y=n(22539),W=n(66277),M=n(56573),z=n(19860),L=n(91547),N=n(11577),F=(n(46926),n(97316),n(29736)),H=n(23208),O=n(45904),B=n(94469),U=n(10658),K=n.n(U),q=n(90842),G=n(40765),V=n(3745),X=n(70501),Q=n(46417),$=n(91635);K().extend($);var J=999,ee=16,te="0 14px 40px rgba(15, 23, 42, 0.10)",ne="0 8px 24px rgba(15, 23, 42, 0.08)",re="0 18px 50px rgba(15, 23, 42, 0.18)",ae="#0f172a",oe="#64748b",ie="#94a3b8",se="#e2e8f0",ce="#f1f5f9",le="#f8fafc",de=function(e,t){return"".concat(e).concat(t)},ue=function(e){return de(e,"08")},pe=function(e){return de(e,"18")},xe=function(e){return de(e,"26")},fe=function(e){return de(e,"55")},he="#662582",me="#9255AB",ge=function(e){var t=e.color,n=e.icon,r=e.title,a=e.subtitle,o=e.action;return(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{px:{xs:1.5,md:2},py:1.25,borderBottom:"1px solid ".concat(ce),background:"linear-gradient(90deg, ".concat(ue(t)," 0%, transparent 100%)")},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.25,children:[(0,Q.jsx)(d.Z,{sx:{width:32,height:32,bgcolor:t,color:"#fff",boxShadow:"0 6px 18px ".concat(xe(t))},children:n}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:ae,fontSize:14,lineHeight:1.1},children:r}),a&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:a})]})]}),o]})},be=function(e){var t=e.children,n=e.sx,r=void 0===n?{}:n;return(0,Q.jsx)(X.Z,{elevation:0,sx:(0,s.Z)({borderRadius:ee/8,border:"1px solid",borderColor:se,background:"#fff",overflow:"hidden",boxShadow:te,height:"100%"},r),children:t})},Ze=function(e){return(0,Q.jsx)(X.Z,(0,s.Z)((0,s.Z)({},e),{},{sx:{mt:.75,borderRadius:2,boxShadow:re,border:"1px solid",borderColor:"divider",overflow:"hidden"}}))};t.default=function(){var e=c.useState(""),t=(0,i.Z)(e,2),n=t[0],U=t[1],$=c.useState(""),re=(0,i.Z)($,2),de=re[0],ve=re[1],je=(0,c.useState)(""),Se=(0,i.Z)(je,2),ke=(Se[0],Se[1],(0,c.useState)("")),ye=(0,i.Z)(ke,2),_e=(ye[0],ye[1],(0,c.useState)("")),Ce=(0,i.Z)(_e,2),Pe=(Ce[0],Ce[1],(0,c.useState)("")),we=(0,i.Z)(Pe,2),Ae=(we[0],we[1],(0,c.useState)("")),Ee=(0,i.Z)(Ae,2),Ie=(Ee[0],Ee[1],(0,c.useState)("")),Re=(0,i.Z)(Ie,2),De=(Re[0],Re[1],(0,c.useState)("")),Te=(0,i.Z)(De,2),Ye=(Te[0],Te[1],(0,c.useState)("")),We=(0,i.Z)(Ye,2),Me=(We[0],We[1],(0,c.useState)("")),ze=(0,i.Z)(Me,2),Le=(ze[0],ze[1],(0,c.useState)("")),Ne=(0,i.Z)(Le,2),Fe=(Ne[0],Ne[1],(0,c.useState)("")),He=(0,i.Z)(Fe,2),Oe=(He[0],He[1],(0,c.useState)("")),Be=(0,i.Z)(Oe,2),Ue=(Be[0],Be[1],(0,c.useState)("")),Ke=(0,i.Z)(Ue,2),qe=(Ke[0],Ke[1],(0,c.useState)("")),Ge=(0,i.Z)(qe,2),Ve=(Ge[0],Ge[1],(0,c.useState)("")),Xe=(0,i.Z)(Ve,2),Qe=(Xe[0],Xe[1],(0,c.useState)("")),$e=(0,i.Z)(Qe,2),Je=($e[0],$e[1],(0,c.useState)(localStorage.getItem("locationid"))),et=(0,i.Z)(Je,2),tt=et[0],nt=et[1],rt=(0,c.useState)(!1),at=(0,i.Z)(rt,2),ot=at[0],it=at[1],st=(0,c.useRef)(null),ct=(0,c.useRef)(null),lt=(0,c.useState)(0),dt=(0,i.Z)(lt,2),ut=dt[0],pt=dt[1],xt=(0,c.useState)(1),ft=(0,i.Z)(xt,2),ht=ft[0],mt=ft[1],gt=localStorage.getItem("applocationid"),bt=(0,T.s0)(),Zt=(0,c.useState)({}),vt=(0,i.Z)(Zt,2),jt=(vt[0],vt[1],(0,c.useState)("")),St=(0,i.Z)(jt,2),kt=(St[0],St[1],(0,c.useState)(!1)),yt=(0,i.Z)(kt,2),_t=(yt[0],yt[1],(0,c.useState)(!1)),Ct=(0,i.Z)(_t,2),Pt=(Ct[0],Ct[1],(0,c.useState)(!1)),wt=(0,i.Z)(Pt,2),At=wt[0],Et=wt[1],It=(0,c.useState)(1),Rt=(0,i.Z)(It,2),Dt=(Rt[0],Rt[1],(0,c.useState)([])),Tt=(0,i.Z)(Dt,2),Yt=(Tt[0],Tt[1],(0,c.useState)([])),Wt=(0,i.Z)(Yt,2),Mt=Wt[0],zt=Wt[1],Lt=(0,c.useState)(""),Nt=(0,i.Z)(Lt,2),Ft=(Nt[0],Nt[1],(0,c.useState)(K()().format("MM-DD-YYYY"))),Ht=(0,i.Z)(Ft,2),Ot=Ht[0],Bt=Ht[1],Ut=(0,c.useState)(K()().add(1,"day").format("MM-DD-YYYY")),Kt=(0,i.Z)(Ut,2),qt=(Kt[0],Kt[1]),Gt=(0,c.useState)(),Vt=(0,i.Z)(Gt,2),Xt=Vt[0],Qt=Vt[1],$t=(0,c.useState)(),Jt=(0,i.Z)($t,2),en=Jt[0],tn=Jt[1],nn=(0,c.useState)([]),rn=(0,i.Z)(nn,2),an=rn[0],on=rn[1],sn=(0,c.useState)(""),cn=(0,i.Z)(sn,2),ln=(cn[0],cn[1],(0,c.useState)([])),dn=(0,i.Z)(ln,2),un=(dn[0],dn[1],(0,z.Z)()),pn=(0,c.useState)(""),xn=(0,i.Z)(pn,2),fn=xn[0],hn=xn[1],mn=(0,c.useState)([]),gn=(0,i.Z)(mn,2),bn=(gn[0],gn[1],(0,c.useState)([])),Zn=(0,i.Z)(bn,2),vn=(Zn[0],Zn[1],(0,c.useState)([])),jn=(0,i.Z)(vn,2),Sn=(jn[0],jn[1],(0,c.useState)([])),kn=(0,i.Z)(Sn,2),yn=(kn[0],kn[1],(0,c.useState)(!1)),_n=(0,i.Z)(yn,2),Cn=(_n[0],_n[1]),Pn=(0,c.useState)(!1),wn=(0,i.Z)(Pn,2),An=wn[0],En=wn[1],In=(0,c.useState)(!1),Rn=(0,i.Z)(In,2),Dn=Rn[0],Tn=Rn[1],Yn=(0,c.useState)([]),Wn=(0,i.Z)(Yn,2),Mn=Wn[0],zn=(Wn[1],(0,c.useState)([])),Ln=(0,i.Z)(zn,2),Nn=(Ln[0],Ln[1],(0,c.useState)([])),Fn=(0,i.Z)(Nn,2),Hn=(Fn[0],Fn[1]),On=(0,c.useState)(""),Bn=(0,i.Z)(On,2),Un=Bn[0],Kn=Bn[1],qn=(0,c.useState)(""),Gn=(0,i.Z)(qn,2),Vn=(Gn[0],Gn[1],(0,c.useState)({})),Xn=(0,i.Z)(Vn,2),Qn=(Xn[0],Xn[1],(0,c.useState)("")),$n=(0,i.Z)(Qn,2),Jn=$n[0],er=($n[1],(0,c.useState)([])),tr=(0,i.Z)(er,2),nr=(tr[0],tr[1]),rr=(0,c.useState)([]),ar=(0,i.Z)(rr,2),or=(ar[0],ar[1],(0,c.useState)()),ir=(0,i.Z)(or,2),sr=ir[0],cr=ir[1],lr=(0,c.useState)([]),dr=(0,i.Z)(lr,2),ur=(dr[0],dr[1],(0,c.useState)({})),pr=(0,i.Z)(ur,2),xr=pr[0],fr=pr[1],hr=(0,c.useState)({}),mr=(0,i.Z)(hr,2),gr=(mr[0],mr[1],(0,c.useState)("")),br=(0,i.Z)(gr,2),Zr=br[0],vr=br[1],jr=(0,c.useState)([]),Sr=(0,i.Z)(jr,2),kr=(Sr[0],Sr[1],(0,c.useState)()),yr=(0,i.Z)(kr,2),_r=(yr[0],yr[1]),Cr=(0,c.useState)(""),Pr=(0,i.Z)(Cr,2),wr=(Pr[0],Pr[1],(0,c.useState)(!0)),Ar=(0,i.Z)(wr,2),Er=(Ar[0],Ar[1],(0,c.useState)("B")),Ir=(0,i.Z)(Er,2),Rr=(Ir[0],Ir[1],(0,c.useState)(!1)),Dr=(0,i.Z)(Rr,2),Tr=(Dr[0],Dr[1],(0,c.useState)({latitude:0,longitude:0})),Yr=(0,i.Z)(Tr,2),Wr=Yr[0],Mr=Yr[1],zr=(0,c.useState)({latitude:0,longitude:0}),Lr=(0,i.Z)(zr,2),Nr=Lr[0],Fr=Lr[1],Hr=(0,c.useState)(!1),Or=(0,i.Z)(Hr,2),Br=Or[0],Ur=Or[1],Kr=(0,c.useState)(0),qr=(0,i.Z)(Kr,2),Gr=qr[0],Vr=qr[1],Xr=(0,c.useState)(0),Qr=(0,i.Z)(Xr,2),$r=Qr[0],Jr=Qr[1],ea=(0,c.useState)(0),ta=(0,i.Z)(ea,2),na=ta[0],ra=ta[1],aa=(0,c.useState)(0),oa=(0,i.Z)(aa,2),ia=oa[0],sa=oa[1],ca=(0,c.useState)(0),la=(0,i.Z)(ca,2),da=la[0],ua=la[1],pa=(0,c.useState)([]),xa=(0,i.Z)(pa,2),fa=xa[0],ha=xa[1],ma=(0,c.useState)("Select "),ga=(0,i.Z)(ma,2),ba=ga[0],Za=ga[1],va=(0,c.useState)(),ja=(0,i.Z)(va,2),Sa=ja[0],ka=ja[1],ya=(0,c.useState)(""),_a=(0,i.Z)(ya,2),Ca=(_a[0],_a[1]),Pa=localStorage.getItem("tenantid"),wa=(0,c.useState)(null),Aa=(0,i.Z)(wa,2),Ea=Aa[0],Ia=Aa[1],Ra=(0,c.useState)(!1),Da=(0,i.Z)(Ra,2),Ta=Da[0],Ya=Da[1],Wa=(0,c.useState)(""),Ma=(0,i.Z)(Wa,2),za=Ma[0],La=Ma[1],Na=(0,c.useState)([]),Fa=(0,i.Z)(Na,2),Ha=Fa[0],Oa=Fa[1],Ba=(0,c.useState)({}),Ua=(0,i.Z)(Ba,2),Ka=Ua[0],qa=Ua[1],Ga=(0,c.useState)({}),Va=(0,i.Z)(Ga,2),Xa=Va[0],Qa=Va[1],$a=(0,c.useState)(0),Ja=(0,i.Z)($a,2),eo=Ja[0],to=Ja[1],no=(0,c.useState)(0),ro=(0,i.Z)(no,2),ao=ro[0],oo=ro[1],io=(0,c.useState)(0),so=(0,i.Z)(io,2),co=so[0],lo=so[1],uo=(0,c.useState)([]),po=(0,i.Z)(uo,2),xo=po[0],fo=po[1],ho=(0,c.useState)(),mo=(0,i.Z)(ho,2),go=mo[0],bo=mo[1],Zo=(0,c.useState)(),vo=(0,i.Z)(Zo,2),jo=vo[0],So=vo[1],ko=(0,c.useState)(),yo=(0,i.Z)(ko,2),_o=yo[0],Co=yo[1],Po=Number.isFinite(Number(go))&&Number.isFinite(Number(jo))&&!(0===Number(go)&&0===Number(jo)),wo=(0,c.useState)(0),Ao=(0,i.Z)(wo,2),Eo=Ao[0],Io=Ao[1],Ro=(0,c.useState)(0),Do=(0,i.Z)(Ro,2),To=Do[0],Yo=Do[1],Wo=(0,c.useState)(0),Mo=(0,i.Z)(Wo,2),zo=Mo[0],Lo=Mo[1],No=(0,c.useState)(0),Fo=(0,i.Z)(No,2),Ho=Fo[0],Oo=Fo[1],Bo=(0,c.useState)(),Uo=(0,i.Z)(Bo,2),Ko=Uo[0],qo=Uo[1],Go=(0,c.useState)(),Vo=(0,i.Z)(Go,2),Xo=Vo[0],Qo=Vo[1],$o=(0,c.useState)(!1),Jo=(0,i.Z)($o,2),ei=Jo[0],ti=Jo[1],ni=(0,c.useState)(!1),ri=(0,i.Z)(ni,2),ai=ri[0],oi=ri[1],ii=(0,c.useState)(0),si=(0,i.Z)(ii,2),ci=si[0],li=si[1];(0,c.useEffect)((function(){console.log(ci)}),[ci]);var di=function(e){Ia(e)},ui=function(e){return{cursor:"pointer",backgroundColor:Ea===e?un.palette.primary.main:"default",color:Ea===e?"#fff":"","&:hover":{backgroundColor:Ea===e?un.palette.primary.main:un.palette.primary.light,color:"#fff"}}},pi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantpricing/?tenantid=").concat(Pa));case 3:t=e.sent,console.log("pricingResponse",t.data.details),Jr(t.data.details.baseprice),ra(t.data.details.priceperkm),sa(t.data.details.minkm),e.next=13;break;case 10:e.prev=10,e.t0=e.catch(0),console.log("fetchTenantPricing error",e.t0);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){pi()}),[]),(0,c.useEffect)((function(){console.log("startPoint",Wr),console.log("endPoint",Nr),0!=Wr.latitude&&0!=Wr.longitude&&0!=Nr.latitude&&0!=Nr.longitude&&xi(Wr,Nr)}),[Wr,Nr]);var xi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(t,n){var r,o,i;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,A.v)(t,n);case 3:r=e.sent,console.log("calculated distance in km:",r),Vr(r),o=(0,A.j)(r,$r,na,ia),console.log("total charge:",o),ua(o),Ur(!0),r>_o&&(Ur(!0),Et(!0)),40,i=Math.round(r/40*60),console.log("Distance: ".concat(r,", Duration: ").concat(i)),e.next=19;break;case 16:e.prev=16,e.t0=e.catch(0),console.error("Error calculating distance:",e.t0);case 19:case"end":return e.stop()}}),e,null,[[0,16]])})));return function(t,n){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){if(an[0]){var e=[];an.map((function(t){K()().diff(K()("".concat(K()(Ot).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&e.push(t)})),e[0]&&Hn([{sno:1,address:"",customerid:"",deliverytime:K()(e[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}])}}),[an]),(0,c.useEffect)((function(){if(Jn){var e=Mt.filter((function(e){return e.address.toLowerCase().includes(Jn.toLowerCase())||e.firstname.toLowerCase().includes(Jn.toLowerCase())||e.contactno.toLowerCase().includes(Jn.toLowerCase())}));console.log(e),nr((0,r.Z)(e))}else nr((0,r.Z)(Mt))}),[Jn]);var fi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),console.log("tid",Pa),e.next=4,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantinfo/?tenantid=").concat(Pa)).then((function(e){console.log("fetchtenantinfo",e),e.data.status&&(fr(e.data.details),_r(e.data.details.tenantid),gi(),ka(e.data.details.subcategoryid)),En(!1)})).catch((function(e){console.log(e),En(!1)}));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){fi()}),[]);var hi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getsubcategories/?moduleid=6")).then((function(e){console.log("subcateRes",e.data.details),e.data.status&&e.data.details?ha(e.data.details):ha([])})).catch((function(e){console.log(e),ha([])}));case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){hi()}),[]);var mi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocations/?applocationid=").concat(gt)).then((function(e){var t,n;console.log("fetchTiming",e);var r=null===(t=e.data)||void 0===t||null===(n=t.details)||void 0===n?void 0:n[0];if(e.data.status&&r){var a=r.opentime,o=r.closetime,i=r.latitude,s=r.longitude,c=r.radius;bo(i),So(s),Co(c),Qt("".concat(K()().format("MM-DD-YYYY")," ").concat(a)),tn("".concat(K()().format("MM-DD-YYYY")," ").concat(o)),console.log("starttime","".concat(K()().format("MM-DD-YYYY")," ").concat(a)),console.log("endtime","".concat(K()().format("MM-DD-YYYY")," ").concat(o," "));for(var l=[],d="".concat(K()().format("MM-DD-YYYY")," ").concat(a);K()("".concat(K()().format("MM-DD-YYYY")," ").concat(o," ")).diff(d,"m")>=0;d=K()(d).add(30,"m"))l.push(d);console.log("setTimeslotarr",l),on(l)}En(!1)})).catch((function(e){console.log(e),En(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){mi()}),[]);var gi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return En(!0),e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/utils/getapplocationconfig/?applocationid=").concat(gt)).then((function(e){var t=e.data.details.applocationadmins.map((function(e){return e.userfcmtokem}));console.log("fetchAppAdminTokens",e),console.log("userfcmtokemArray",t),e.data.status&&cr(t),En(!1)})).catch((function(e){console.log(e),En(!1)}));case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){Xt&&en&&gi()}),[Xt,en]);var bi=function(e,t,n){(0,q.yv)(e,{variant:t,anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:n||2e3}),console.log(Un)};var Zi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){var t,n;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},t={orders:{applocationid:xr.applolcationid,cancellled:"",categoryid:+xr.categoryid,configid:7,customerid:0==Eo&&+Ka.customerid||0,deliveryaddress:Xa.address||"",deliverycharge:+da.toFixed(2)||0,deliverycity:Xa.city||"",deliverycontactno:Xa.contactno||"",deliverycustomer:Xa.firstname||"",deliveryid:0==To&&+Xa.customerid||0,deliverylandmark:Xa.landmark||"",deliverylat:(Xa.latitude||0).toString(),deliverylocation:Xa.suburb||"",deliverylocationid:Xa.deliverylocationid||0,deliverylong:(Xa.longitude||0).toString(),deliverytime:"".concat(K()(Ot).format("YYYY-MM-DD")," ").concat(K()(Zr.$d).format("HH:mm:ss")),deliverytype:0!==Ka.customerid||0!==Xa.customerid?"B":"C",delivered:"",itemcount:1,kms:Gr.toString()||0,locationid:+tt,moduleid:+xr.moduleid,orderamount:+da.toFixed(2)||0,ordercharges:0,orderdate:K()().format("YYYY-MM-DD HH:mm:ss"),orderheaderid:0,orderid:"",ordernotes:fn,orderstatus:"created",ordervalue:+da.toFixed(2)||0,partnerid:xr.partnerid,paymentstatus:1,paymenttype:42,pending:"",pickupaddress:Ka.address||"",pickupcity:Ka.city||"",pickupcontactno:Ka.contactno||"",pickupcustomer:Ka.firstname||"",pickuplandmark:Ka.landmark||"",pickuplat:(Ka.latitude||0).toString(),pickuplocation:Ka.suburb||"",pickuplocationid:Ka.deliverylocationid||0,pickuplong:(Ka.longitude||0).toString(),processing:"",ready:"",remarks:"",smsdelivery:ci,subcategoryid:+Sa,taxamount:0,tenantid:xr.tenantid,tenantuserid:parseInt(localStorage.getItem("userid")),collectionamt:+ut||0,quantity:+ht||1},pickup:{address:Ka.address||"",applocationid:xr.applolcationid,city:Ka.city||"",configid:7,contactno:Ka.contactno||"",customertoken:"",customerid:0==Eo&&Ka.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Ka.doorno||"",email:Ka.email||"",firstname:Ka.firstname||"",landmark:Ka.landmark||"",latitude:(Ka.latitude||0).toString(),longitude:(Ka.longitude||0).toString(),locationid:Ka.deliverylocationid||0,postcode:Ka.postcode||"",primaryaddress:1,profileimage:"",state:Ka.state||"",suburb:Ka.suburb||"",tenantid:xr.tenantid},drop:{address:Xa.address||"",applocationid:xr.applolcationid,city:Xa.city||"",configid:7,contactno:Xa.contactno||"",customertoken:"",customerid:0==To&&Xa.customerid||0,devicetype:"",deviceid:"",dialcode:"+91",doorno:Xa.doorno||"",email:Xa.email||"",firstname:Xa.firstname||"",landmark:Xa.landmark||"",latitude:(Xa.latitude||0).toString(),longitude:(Xa.longitude||0).toString(),locationid:Xa.deliverylocationid||0,postcode:Xa.postcode||"",primaryaddress:1,profileimage:"",state:Xa.state||"",suburb:Xa.suburb||"",tenantid:xr.tenantid}},console.log("createsubmitobj2",t),Ka.firstname){e.next=7;break}bi("Enter Pickup Contact Name ","warning",2e3),e.next=87;break;case 7:if(Ka.contactno){e.next=11;break}bi("Enter Pickup Contact Number ","warning",2e3),e.next=87;break;case 11:if(10==Ka.contactno.length){e.next=15;break}bi("Check Pickup Contact Number ","error",2e3),e.next=87;break;case 15:if(Ka.suburb){e.next=19;break}bi("Enter Pickup Location ","warning",2e3),e.next=87;break;case 19:if(Ka.city){e.next=23;break}bi("Enter Pickup City ","warning",2e3),e.next=87;break;case 23:if(Ka.postcode){e.next=27;break}bi("Enter Pickup Postcode ","warning",2e3),e.next=87;break;case 27:if(Ka.landmark){e.next=31;break}bi("Enter Pickup Landmark ","warning",2e3),e.next=87;break;case 31:if(Ka.latitude&&Ka.longitude){e.next=35;break}bi("Could not locate Pickup address on map, please recheck the address","error",3e3),e.next=87;break;case 35:if(Xa.firstname){e.next=39;break}bi("Enter Drop Contact Name ","warning",2e3),e.next=87;break;case 39:if(Xa.contactno){e.next=43;break}bi("Enter Drop Contact Number","warning",2e3),e.next=87;break;case 43:if(10===Xa.contactno.length){e.next=47;break}bi("Check Drop Contact Number ","error",2e3),e.next=87;break;case 47:if(Xa.suburb){e.next=51;break}bi("Enter Drop Suburb ","warning",2e3),e.next=87;break;case 51:if(Xa.city){e.next=55;break}bi("Enter Drop City ","warning",2e3),e.next=87;break;case 55:if(Xa.postcode){e.next=59;break}bi("Enter Drop postcode ","warning",2e3),e.next=87;break;case 59:if(Xa.landmark){e.next=63;break}bi("Enter Drop Landmark ","warning",2e3),e.next=87;break;case 63:if(Xa.latitude&&Xa.longitude){e.next=67;break}bi("Could not locate Drop address on map, please recheck the address","error",3e3),e.next=87;break;case 67:if(Zr){e.next=71;break}bi("Choose deliverytime ","warning",2e3),e.next=87;break;case 71:if(ka){e.next=75;break}bi("Choose SubCategory ","warning",2e3),e.next=87;break;case 75:return e.prev=75,e.next=78,M.Z.post("".concat("https://jupiter.nearle.app/live/api/v2","/orders/createorder"),t);case 78:(n=e.sent).data.status?(console.log("createRes",n),(0,q.yv)("Order Created Successfully",{variant:"success",anchorOrigin:{vertical:"top",horizontal:"right"},autoHideDuration:1e3}),sr&¬ifyadmin(sr),bt("/nearle/orders")):bi("Something went wrong, Cannot create order","warning"),En(!1),console.log(n),e.next=87;break;case 84:e.prev=84,e.t0=e.catch(75),console.log("createResErr",e.t0);case 87:case"end":return e.stop()}}),e,null,[[75,84]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("shiftarr"),console.log(Mn)}),[Mn]);var vi=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cn(!0),e.prev=1,t=""==za?"".concat("https://jupiter.nearle.app/live/api/v1","/customers/gettenantcustomers/?tenantid=").concat(Pa,"&pageno=1&pagesize=20"):"".concat("https://jupiter.nearle.app/live/api/v1","/customers/search/?tenantid=").concat(Pa,"&keyword=").concat(za),e.next=5,M.Z.get(t).then((function(e){if(console.log("clientdetails",e.data.details),e.data.status&&e.data.details){zt(e.data.details||[]),Oa(e.data.details||[]);var t=[];e.data.details.map((function(e){t.push((0,s.Z)({label:"".concat(e.firstname," | ").concat(e.contactno)},e))})),nr(t)}else zt([]),Oa([]),nr([]);Cn(!1)})).catch((function(e){console.log(e),Cn(!1),bi("server error","warning")}));case 5:e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.log(e.t0),Cn(!1);case 11:case"end":return e.stop()}}),e,null,[[1,7]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){console.log("clientdetails, by search"),vi()}),[za.length>3,""==za]);var ji=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.overwriteFields,r=void 0===n||n,a=e.geometry.location.lat(),o=e.geometry.location.lng();if(Mr({latitude:a,longitude:o}),r){U("".concat(e.name,", ").concat(e.formatted_address)),qa((0,s.Z)((0,s.Z)({},Ka),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var i={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((function(e){e.types.forEach((function(t){switch(t){case"street_number":i.street_number=e.long_name;break;case"route":i.route=e.long_name;break;case"locality":i.locality=e.long_name;break;case"sublocality_level_1":i.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":i.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":i.administrative_area_level_1=e.long_name;break;case"country":i.country=e.long_name;break;case"postal_code":i.postal_code=e.long_name}}))})),qa((0,s.Z)((0,s.Z)({},Ka),{},{address:i.address,doorno:"".concat(i.street_number," ").concat(i.route),suburb:i.sublocality_level_1,city:i.locality,postcode:i.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))}else qa((function(e){return(0,s.Z)((0,s.Z)({},e),{},{latitude:a,longitude:o})}))},Si=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.overwriteFields,r=void 0===n||n,a=e.geometry.location.lat(),o=e.geometry.location.lng();if(Fr({latitude:a,longitude:o}),r){ve("".concat(e.name,", ").concat(e.formatted_address)),Qa((0,s.Z)((0,s.Z)({},Xa),{},{address:"".concat(e.name," ").concat(e.formatted_address)}));var i={address:"".concat(e.name," ").concat(e.formatted_address),street_number:"",route:"",locality:"",sublocality_level_1:"",administrative_area_level_3:"",administrative_area_level_1:"",country:"",postal_code:""};e.address_components.forEach((function(e){e.types.forEach((function(t){switch(t){case"street_number":i.street_number=e.long_name;break;case"route":i.route=e.long_name;break;case"locality":i.locality=e.long_name;break;case"sublocality_level_1":i.sublocality_level_1=e.long_name;break;case"administrative_area_level_3":i.administrative_area_level_3=e.long_name;break;case"administrative_area_level_1":i.administrative_area_level_1=e.long_name;break;case"country":i.country=e.long_name;break;case"postal_code":i.postal_code=e.long_name}}))})),Qa((0,s.Z)((0,s.Z)({},Xa),{},{address:i.address,doorno:"".concat(i.street_number," ").concat(i.route),suburb:i.sublocality_level_1,city:i.locality,postcode:i.postal_code,latitude:e.geometry.location.lat(),longitude:e.geometry.location.lng()}))}else Qa((function(e){return(0,s.Z)((0,s.Z)({},e),{},{latitude:a,longitude:o})}))};(0,c.useEffect)((function(){if(0===Wr.latitude&&0===Wr.longitude){var e=n&&n.trim().length>=6&&n||Ka.suburb&&Ka.city&&[Ka.doorno,Ka.suburb,Ka.city,Ka.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,o.Z)((0,a.Z)().mark((function t(){var n;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,L.gA)(e,{bias:{lat:go,lng:jo}});case 2:(n=t.sent)&&ji(n,{overwriteFields:!1});case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[n,Ka.doorno,Ka.suburb,Ka.city,Ka.postcode,go,jo]),(0,c.useEffect)((function(){if(0===Nr.latitude&&0===Nr.longitude){var e=de&&de.trim().length>=6&&de||Xa.suburb&&Xa.city&&[Xa.doorno,Xa.suburb,Xa.city,Xa.postcode].filter(Boolean).join(", ");if(e){var t=setTimeout((0,o.Z)((0,a.Z)().mark((function t(){var n;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(0,L.gA)(e,{bias:{lat:go,lng:jo}});case 2:(n=t.sent)&&Si(n,{overwriteFields:!1});case 4:case"end":return t.stop()}}),t)}))),800);return function(){return clearTimeout(t)}}}}),[de,Xa.doorno,Xa.suburb,Xa.city,Xa.postcode,go,jo]);var ki=function(){var e=(0,o.Z)((0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,M.Z.get("".concat("https://jupiter.nearle.app/live/api/v1","/tenants/gettenantlocations/?tenantid=").concat(Pa));case 3:t=e.sent,console.log("gettenantlocations",t.data.details),t.data&&t.data.details?(fo(t.data.details),1==t.data.details.length&&(it(!0),nt(t.data.details[0].locationid))):fo([]),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(0),console.log("gettenantlocations",e.t0),fo([]);case 12:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(){return e.apply(this,arguments)}}();return(0,c.useEffect)((function(){ki()}),[]),(0,Q.jsxs)(Q.Fragment,{children:[An&&(0,Q.jsx)(N.Z,{}),(0,Q.jsxs)(p.ZP,{container:!0,rowSpacing:2,columnSpacing:2.75,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(X.Z,{elevation:0,sx:{position:"sticky",top:"60px",zIndex:1e3,mb:1.5,p:{xs:1.5,sm:2,md:2.5},borderRadius:ee/8,border:"1px solid",borderColor:se,background:"linear-gradient(135deg, ".concat(ue(he)," 0%, ").concat(ue(me)," 100%)"),boxShadow:ne},children:(0,Q.jsxs)(l.Z,{direction:{xs:"column",sm:"row"},alignItems:{xs:"flex-start",sm:"center"},justifyContent:"space-between",spacing:{xs:1.5,sm:2},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:{xs:1.25,sm:1.75},children:[(0,Q.jsx)(d.Z,{sx:{width:{xs:40,sm:48},height:{xs:40,sm:48},bgcolor:he,color:"#fff",boxShadow:"0 6px 18px ".concat(xe(he))},children:(0,Q.jsx)(Y.tX2,{size:22})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h3",sx:{fontWeight:800,color:ae,lineHeight:1.1,fontSize:{xs:"1.25rem",sm:"1.5rem",md:"1.75rem"}},children:"Create Order"}),(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{mt:.5},children:[(0,Q.jsx)(x.Z,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:"#10b981",boxShadow:"0 0 0 4px rgba(16,185,129,0.18)"}}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:"Fill pickup, drop, schedule & pricing details"})]})]})]}),1===xo.length?(0,Q.jsxs)(x.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.75,px:1.5,py:.875,borderRadius:999,bgcolor:ue(he),border:"1.5px solid ".concat(fe(he)),color:he,fontWeight:800,fontSize:13},children:[(0,Q.jsx)(Y.x$F,{size:14})," ",xo[0].locationname]}):(0,Q.jsx)(f.Z,{options:xo||[],getOptionLabel:function(e){return e&&e.locationname?"".concat(e.locationname," (").concat(e.suburb||"",")"):""},isOptionEqualToValue:function(e,t){return(null===e||void 0===e?void 0:e.locationid)===(null===t||void 0===t?void 0:t.locationid)},PaperComponent:Ze,sx:{width:{xs:"100%",sm:300}},size:"small",renderInput:function(e){return(0,Q.jsx)(h.Z,(0,s.Z)((0,s.Z)({},e),{},{placeholder:"Select Business Location",InputProps:(0,s.Z)((0,s.Z)({},e.InputProps),{},{startAdornment:(0,Q.jsx)(l.Z,{direction:"row",alignItems:"center",spacing:.75,sx:{pl:.5},children:(0,Q.jsx)(d.Z,{sx:{width:22,height:22,bgcolor:he,color:"#fff"},children:(0,Q.jsx)(Y.x$F,{size:13})})})}),sx:{"& .MuiOutlinedInput-root":{borderRadius:J+"px",bgcolor:"#fff",fontWeight:600,"& fieldset":{borderColor:fe(he),borderWidth:1.5},"&:hover fieldset":{borderColor:he},"&.Mui-focused":{boxShadow:"0 0 0 3px ".concat(xe(he))},"&.Mui-focused fieldset":{borderColor:he,borderWidth:2}}}}))},onChange:function(e,t,n){t&&(nt(t.locationid),it(!0)),"clear"===n&&it(!1)}})]})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(x.Z,{sx:{overflow:"visible"},children:[(0,Q.jsx)(p.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(be,{children:[(0,Q.jsx)(ge,{color:"#0ea5e9",icon:(0,Q.jsx)(Y.$0r,{size:16}),title:"Pickup Details",subtitle:"Where the order is picked up",action:(0,Q.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(Y.Bjz,{size:14}),onClick:function(){ot?(Ya(!0),to(1),qa({}),U(""),La("")):bi("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:fe("#0ea5e9"),color:"#0ea5e9","&:hover":{borderColor:"#0ea5e9",bgcolor:ue("#0ea5e9"),boxShadow:"0 0 0 3px ".concat(xe("#0ea5e9"))}},children:"Saved Locations"})}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(p.ZP,{container:!0,spacing:2,children:(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:st,disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.Xws,{})})},variant:"outlined",label:"Contact Name",value:Ka.firstname,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{error:ei,disabled:!ot,fullWidth:!0,type:"number",InputProps:{inputProps:{maxLength:10},startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:ei&&"red"})})},variant:"outlined",label:"Contact Number",value:Ka.contactno,onChange:function(e){e.target.value.length<=10&&qa((0,s.Z)((0,s.Z)({},Ka),{},{contactno:e.target.value})),Ko==e.target.value?Lo(0):Lo(1),e.target.value.length<10?ti(!0):ti(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==ao?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{label:"Address",disabled:!ot||!Po,placeholder:Po?"Search address":"Loading location\u2026",id:"addressAuto1",fullWidth:!0,value:n,onChange:U,onPlaceSelected:ji,bias:{lat:go,lng:jo},TextFieldProps:{variant:"outlined",InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){U(""),qa((0,s.Z)((0,s.Z)({},Ka),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ur(!1),Mr({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){oo(0),qa((0,s.Z)((0,s.Z)({},Ka),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ur(!1),Mr({latitude:0,longitude:0})},children:(0,Q.jsx)(D.Z,{})})},variant:"outlined",placeholder:"Select",value:Ka.address,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{address:e.target.value})),""==e.target.value&&(oo(0),Ur(!1),Mr({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},variant:"outlined",label:"Door No / Street",value:Ka.doorno,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.GUT,{})})},variant:"outlined",label:"Location",value:Ka.suburb,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(Y.Ys1,{})})},variant:"outlined",label:"City",value:Ka.city,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.kk8,{})})},variant:"outlined",label:"Postcode",value:Ka.postcode,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.I2o,{})})},variant:"outlined",label:"Landmark",value:Ka.landmark,onChange:function(e){qa((0,s.Z)((0,s.Z)({},Ka),{},{landmark:e.target.value}))}})}),1==zo&&(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(b.Z,{children:(0,Q.jsx)(Z.Z,{control:(0,Q.jsx)(v.Z,{checked:1===Eo,onChange:function(e){Io(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(be,{children:[(0,Q.jsx)(ge,{color:he,icon:(0,Q.jsx)(Y.ili,{size:16}),title:"Drop Details",subtitle:"Where the order is delivered",action:(0,Q.jsx)(m.Z,{size:"small",variant:"outlined",startIcon:(0,Q.jsx)(Y.Bjz,{size:14}),onClick:function(){ot?(Ya(!0),to(2),ve(""),La("")):bi("Select Business Location","warning")},sx:{borderRadius:999,px:1.5,py:.375,fontSize:11.5,fontWeight:700,textTransform:"none",borderColor:fe(he),color:he,"&:hover":{borderColor:he,bgcolor:ue(he),boxShadow:"0 0 0 3px ".concat(xe(he))}},children:"Saved Locations"})}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,sx:{height:"100%"},children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{height:"100%"},children:(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{display:"none"},children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{mb:2},children:"Drop Details"}),(0,Q.jsx)(l.Z,{direction:"row",alignItems:"center",children:(0,Q.jsx)(m.Z,{variant:"outlined",sx:{"&:hover":{bgcolor:un.palette.primary.main,color:"white"}},onClick:function(){ot?(Ya(!0),to(2),ve(""),La("")):bi("Select Business Location","warning")},children:"Saved Locations"})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:4,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{inputRef:ct,disabled:!ot,fullWidth:!0,variant:"outlined",label:"Contact Name",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.Xws,{})})},value:Xa.firstname,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{firstname:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,error:ai,fullWidth:!0,type:"number",variant:"outlined",label:"Contact Number",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(E.DNl,{color:ai&&"red"})})},value:Xa.contactno,onChange:function(e){e.target.value.length<=10&&Qa((0,s.Z)((0,s.Z)({},Xa),{},{contactno:e.target.value})),Xo==e.target.value?Oo(0):Oo(1),e.target.value.length<10?oi(!0):oi(!1)}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(l.Z,{spacing:1.25,sx:{mt:0},children:0==co?(0,Q.jsx)("div",{children:(0,Q.jsx)(L.ZP,{id:"addressAuto2",disabled:!ot||!Po,placeholder:Po?"Search address":"Loading location\u2026",label:"Address",fullWidth:!0,value:de,onChange:ve,onPlaceSelected:Si,bias:{lat:go,lng:jo},TextFieldProps:{InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){ve(""),Qa((0,s.Z)((0,s.Z)({},Xa),{},{doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ur(!1),Fr({latitude:0,longitude:0})},size:"small",children:(0,Q.jsx)(w.Z,{})})}}})}):(0,Q.jsx)(h.Z,{disabled:!ot,InputProps:{endAdornment:(0,Q.jsx)(g.Z,{onClick:function(){lo(0),Qa((0,s.Z)((0,s.Z)({},Xa),{},{firstname:"",contactno:"",doorno:"",suburb:"",city:"",postcode:"",landmark:""})),Ur(!1),Fr({latitude:0,longitude:0})},children:(0,Q.jsx)(D.Z,{})})},variant:"outlined",placeholder:"Select",value:Xa.address,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{address:e.target.value})),""==e.target.value&&(lo(0),Ur(!1),Fr({latitude:0,longitude:0}))}})})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Door No / Street",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(I.Lmk,{})})},value:Xa.doorno,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{doorno:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Location",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.GUT,{})})},value:Xa.suburb,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{suburb:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"City",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(Y.Ys1,{})})},value:Xa.city,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{city:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:6,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Postcode",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(W.kk8,{})})},value:Xa.postcode,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{postcode:e.target.value}))}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,children:(0,Q.jsx)(h.Z,{disabled:!ot,fullWidth:!0,variant:"outlined",label:"Landmark",InputProps:{startAdornment:(0,Q.jsx)(g.Z,{children:(0,Q.jsx)(R.I2o,{})})},value:Xa.landmark,onChange:function(e){Qa((0,s.Z)((0,s.Z)({},Xa),{},{landmark:e.target.value}))}})}),1==Ho&&(0,Q.jsx)(p.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"end"},children:(0,Q.jsx)(b.Z,{children:(0,Q.jsx)(Z.Z,{control:(0,Q.jsx)(v.Z,{checked:1===To,onChange:function(e){Yo(e.target.checked?1:0)}}),label:"Save For Later"})})})]})})]})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsxs)(be,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(ge,{color:"#f59e0b",icon:(0,Q.jsx)(Y.k71,{size:16}),title:"Schedule",subtitle:"Pickup date & time slot"}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsx)(p.ZP,{container:!0,children:(0,Q.jsxs)(p.ZP,{item:!0,xs:12,children:[(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:oe,mb:1},children:"Date"}),(0,Q.jsx)(H._,{dateAdapter:O.y,sx:{},children:(0,Q.jsx)(F.M,{format:"DD-MM-YYYY",onChange:function(e){var t=K()().diff(K()("".concat(K()(e).format("YYYY-MM-DD"))),"d");if(console.log("dateres11"),console.log(t),vr(""),t<=0){console.log("startdate",e),Bt(e),qt(e);var n=[];an.map((function(t){K()().diff(K()("".concat(K()(e).format("MM-DD-YYYY")," ").concat(K()(t).format("HH:mm:ss"))),"m")<=0&&n.push(t)})),n[0]?Hn([{sno:1,address:"",customerid:"",deliverytime:K()(n[0])||"",deliverylocationid:"",clientname:"",contactno:"",latitude:"",longitude:""}]):Hn([])}else Kn("choose Upcoming Date"),bi("choose Upcoming Date","warning"),Bt(NaN)},value:K()(Ot),sx:{width:"100%",mt:2},disablePast:!0})}),(0,Q.jsx)(u.Z,{variant:"subtitle2",sx:{fontWeight:700,color:oe,mt:2,mb:1},children:"Time"}),(0,Q.jsx)(x.Z,{sx:{mt:.5,p:1.25,borderRadius:2,border:"1px solid",borderColor:ce,bgcolor:le,maxHeight:150,overflowY:"auto",scrollbarWidth:"thin","&::-webkit-scrollbar":{width:6},"&::-webkit-scrollbar-thumb":{backgroundColor:fe(he),borderRadius:6}},children:(0,Q.jsx)(l.Z,{direction:"row",flexWrap:"wrap",gap:.75,useFlexGap:!0,children:an.map((function(e,t){if(K()().diff(K()("".concat(K()(Ot).format("MM-DD-YYYY")," ").concat(K()(e).format("HH:mm:ss"))),"m")<=0){var n=K()(Zr).format("HH:mm")==K()(e).format("HH:mm");return(0,Q.jsxs)(x.Z,{onClick:function(){Gr>_o?Et(!0):Br?vr(e):bi("Select Pickup and Drop","error")},sx:{display:"inline-flex",alignItems:"center",gap:.5,px:1.25,py:.5,cursor:"pointer",borderRadius:999,border:"1.5px solid ".concat(n?"#f59e0b":fe("#f59e0b")),bgcolor:n?"#f59e0b":ue("#f59e0b"),color:n?"#fff":"#f59e0b",fontSize:12,fontWeight:800,transition:"all 0.15s",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"none","&:hover":{borderColor:"#f59e0b",boxShadow:n?"0 6px 18px ".concat(xe("#f59e0b")):"0 0 0 3px ".concat(xe("#f59e0b"))}},children:[(0,Q.jsx)(Y.Y8K,{size:11})," ",K()(e).format("hh:mm A")]},t)}}))})})]})})})]})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,sx:{},children:(0,Q.jsxs)(be,{sx:{mt:2,minHeight:390},children:[(0,Q.jsx)(ge,{color:"#10b981",icon:(0,Q.jsx)(Y.sF1,{size:16}),title:"Distance & Pricing",subtitle:"Auto-calculated from pickup \u2192 drop"}),(0,Q.jsxs)(x.Z,{sx:{p:{xs:2,md:2.5}},children:[Br&&(0,Q.jsxs)(l.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"space-between",mb:3},children:[(0,Q.jsx)(l.Z,{spacing:1.5,children:(0,Q.jsx)(j.Z,{label:"Distance: ".concat(Gr," km"),size:"medium",variant:"contained",color:"primary"})}),(0,Q.jsx)(l.Z,{spacing:1.5,children:(0,Q.jsx)(j.Z,{label:"Charge: \u20b9".concat(da.toFixed(2)),size:"medium",variant:"contained",color:"primary"})})]}),(0,Q.jsxs)(l.Z,{direction:"column",justifyContent:"space-between",sx:{mb:2},children:[(0,Q.jsx)(u.Z,{variant:"h5",children:"Category"}),(0,Q.jsx)(f.Z,{disablePortal:!0,id:"combo-box-demo",options:fa,getOptionLabel:function(e){return"".concat(e.subcategoryname)||""},sx:{my:2,zIndex:"100"},fullWidth:!0,renderInput:function(e){return(0,Q.jsx)(h.Z,(0,s.Z)((0,s.Z)({},e),{},{label:""==ba?xr.subcategoryname:ba}))},onChange:function(e,t,n){t&&(console.log(t),Za(t.subcategoryname),ka(t.subcategoryid))}})]}),(0,Q.jsx)(u.Z,{variant:"h5",children:"Weight"}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-evenly",sx:{border:"1px solid #eee",my:2,py:2},children:[(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"1-10kgs",sx:ui("1-10kgs"),onClick:function(){di("1-10kgs"),Ca("1-10kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"11-20kgs",sx:ui("11-20kgs"),onClick:function(){di("11-20kgs"),Ca("11-20kgs")}}),(0,Q.jsx)(j.Z,{variant:"contained",color:"default",label:"21-30kgs",sx:ui("21-30kgs"),onClick:function(){di("21-30kgs"),Ca("21-30kgs")}})]}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"space-between",sx:{mt:4},children:[(0,Q.jsx)(u.Z,{variant:"h5",children:"SMS Delivery"}),(0,Q.jsx)(S.Z,{checked:1===ci,onChange:function(e){li(e.target.checked?1:0)}})]})]})]})})]})})}),(0,Q.jsxs)(be,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:"#6366f1",icon:(0,Q.jsx)(Y.ByW,{size:16}),title:"Collection & Quantity",subtitle:"Cash to collect on delivery, total items"}),(0,Q.jsx)(x.Z,{sx:{p:{xs:2,md:2.5}},children:(0,Q.jsxs)(p.ZP,{container:!0,spacing:2,children:[(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:ut,fullWidth:!0,label:"Cash Collect",onChange:function(e){return pt(e.target.value)},inputProps:{min:0}})}),(0,Q.jsx)(p.ZP,{item:!0,xs:12,sm:6,children:(0,Q.jsx)(h.Z,{type:"number",value:ht,fullWidth:!0,label:"Quantity",onChange:function(e){return mt(e.target.value)},inputProps:{min:1}})})]})})]}),(0,Q.jsxs)(be,{sx:{mt:2},children:[(0,Q.jsx)(ge,{color:oe,icon:(0,Q.jsx)(Y.hKf,{size:16}),title:"Notes",subtitle:"Add anything the rider should know"}),(0,Q.jsxs)(x.Z,{sx:{p:{xs:2,md:2.5}},children:[(0,Q.jsx)(h.Z,{focused:!0,variant:"outlined",sx:{width:"100%",mb:2},multiline:!0,rows:2,label:"Notes",placeholder:"Special instructions, gate code, etc.",value:fn,onChange:function(e){return hn(e.target.value)}}),(0,Q.jsx)(k.Z,{sx:{my:1.5}}),(0,Q.jsxs)(l.Z,{direction:"row",justifyContent:"flex-end",alignItems:"center",spacing:1.25,children:[!Br&&(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:ie,fontWeight:700},children:"Set pickup & drop to enable"}),(0,Q.jsx)(m.Z,{size:"medium",disabled:!Br,variant:"contained",startIcon:Dn?null:(0,Q.jsx)(Y.ZSR,{size:16}),onClick:function(){En(!0),Tn(!0),Zi(),setTimeout((function(){En(!1),Tn(!1)}),1e3)},sx:{borderRadius:999,px:3,py:1,fontWeight:800,textTransform:"none",fontSize:13,background:"linear-gradient(135deg, ".concat(he," 0%, ").concat(me," 100%)"),color:"#fff",boxShadow:"0 8px 22px ".concat(xe(he)),transition:"all 0.18s","&:hover":{background:"linear-gradient(135deg, #4D1C61 0%, ".concat(he," 100%)"),transform:"translateY(-1px)",boxShadow:"0 10px 26px ".concat(xe(he))},"&.Mui-disabled":{background:ce,color:ie,boxShadow:"none"}},children:Dn?(0,Q.jsx)(y.Z,{size:18,thickness:5,sx:{color:"#fff"}}):"Create Order"})]})]})]})]})}),(0,Q.jsxs)(B.Z,{open:Ta,onClose:function(){return Ya(!1)},fullWidth:!0,maxWidth:"sm",PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsxs)(_.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ue(he)," 0%, ").concat(ue(me)," 100%)"),borderBottom:"1px solid ".concat(se)},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,sx:{mb:1.5},children:[(0,Q.jsx)(d.Z,{sx:{bgcolor:he,color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(xe(he))},children:(0,Q.jsx)(Y.Bjz,{size:20})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:ae},children:"Saved Locations"}),(0,Q.jsxs)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:["Pick a saved customer for ",1===eo?"Pickup":"Drop"]})]})]}),(0,Q.jsxs)(x.Z,{sx:{display:"flex",alignItems:"center",gap:.75,px:1.25,py:.5,borderRadius:999,bgcolor:"#fff",border:"1.5px solid ".concat(fe(he)),transition:"all 0.18s","&:focus-within":{borderColor:he,boxShadow:"0 0 0 3px ".concat(xe(he))}},children:[(0,Q.jsx)(G.Z,{style:{color:he,fontSize:14}}),(0,Q.jsx)(C.Z,{fullWidth:!0,placeholder:"Search saved customer",value:za,onChange:function(e){return La(e.target.value)},sx:{flex:1,"& .MuiOutlinedInput-input":{p:"6px 4px",fontSize:13,fontWeight:600},"& fieldset":{border:"none"}},endAdornment:za&&(0,Q.jsx)(g.Z,{size:"small",onClick:function(){return La("")},sx:{p:.25,color:he},children:(0,Q.jsx)(D.Z,{fontSize:"small"})}),autoComplete:"off"})]})]}),(0,Q.jsx)(P.Z,{sx:{p:2,bgcolor:le},children:0===Ha.length?(0,Q.jsxs)(l.Z,{alignItems:"center",justifyContent:"center",spacing:1.5,sx:{minHeight:480,maxHeight:480},children:[(0,Q.jsx)(d.Z,{sx:{width:56,height:56,bgcolor:pe("#94a3b8"),color:ie},children:(0,Q.jsx)(Y.Bjz,{size:26})}),(0,Q.jsx)(u.Z,{variant:"subtitle1",sx:{fontWeight:700,color:ae},children:"No saved locations"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe},children:za?"Try a different keyword.":"Save a customer from the order form to reuse it later."})]}):(0,Q.jsx)(l.Z,{spacing:1,sx:{minHeight:480,maxHeight:480,overflow:"auto",pr:.5},children:Ha.map((function(e,t){var n=Ka.customerid===e.customerid;return(0,Q.jsxs)(x.Z,{onClick:function(){n||(Ya(!1),1===eo?(oo(1),Mr({latitude:e.latitude,longitude:e.longitude}),qa(e),qo(e.contactno)):(lo(1),Fr({latitude:e.latitude,longitude:e.longitude}),Qa(e),Qo(e.contactno)))},sx:{display:"flex",alignItems:"flex-start",gap:1.25,p:1.5,borderRadius:2,border:"1px solid",borderColor:n?fe("#94a3b8"):se,bgcolor:n?le:"#fff",cursor:n?"not-allowed":"pointer",opacity:n?.6:1,transition:"all 0.15s","&:hover":n?{}:{borderColor:fe(he),bgcolor:ue(he),boxShadow:te}},children:[(0,Q.jsx)(d.Z,{sx:{width:36,height:36,bgcolor:pe(he),color:he,fontWeight:800},children:String(e.firstname||"?").charAt(0).toUpperCase()}),(0,Q.jsxs)(l.Z,{sx:{flex:1,minWidth:0},children:[(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:.75,flexWrap:"wrap",useFlexGap:!0,children:[(0,Q.jsx)(u.Z,{sx:{fontWeight:800,color:ae,fontSize:13.5},noWrap:!0,children:e.firstname}),(0,Q.jsxs)(x.Z,{sx:{display:"inline-flex",alignItems:"center",gap:.375,px:.75,py:.125,borderRadius:999,bgcolor:ue("#0ea5e9"),border:"1px solid ".concat(fe("#0ea5e9")),color:"#0ea5e9",fontSize:10.5,fontWeight:800},children:[(0,Q.jsx)(E.DNl,{size:9})," ",e.contactno]}),n&&(0,Q.jsx)(x.Z,{sx:{display:"inline-flex",alignItems:"center",px:.75,py:.125,borderRadius:999,bgcolor:ue("#94a3b8"),border:"1px solid ".concat(fe("#94a3b8")),color:oe,fontSize:10.5,fontWeight:800},children:"Already used"})]}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,mt:.25},noWrap:!0,children:e.address})]})]},t)}))})}),(0,Q.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(ce)},children:(0,Q.jsx)(m.Z,{variant:"outlined",onClick:function(){return Ya(!1)},sx:{borderRadius:999,px:2.5,borderColor:se,color:oe,fontWeight:700,textTransform:"none","&:hover":{borderColor:oe,bgcolor:le}},children:"Cancel"})})]}),(0,Q.jsxs)(B.Z,{open:At,onClose:function(){return Et(!1)},PaperProps:{sx:{borderRadius:3}},children:[(0,Q.jsx)(x.Z,{sx:{p:2.5,background:"linear-gradient(135deg, ".concat(ue("#ef4444")," 0%, ").concat(ue("#f59e0b")," 100%)"),borderBottom:"1px solid ".concat(se)},children:(0,Q.jsxs)(l.Z,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,Q.jsx)(d.Z,{sx:{bgcolor:"#ef4444",color:"#fff",width:40,height:40,boxShadow:"0 6px 18px ".concat(xe("#ef4444"))},children:(0,Q.jsx)(V.Z,{})}),(0,Q.jsxs)(l.Z,{children:[(0,Q.jsx)(u.Z,{variant:"h5",sx:{fontWeight:800,color:ae},children:"Out of Service Area"}),(0,Q.jsx)(u.Z,{variant:"caption",sx:{color:oe,fontWeight:600},children:"This drop point is outside the supported radius"})]})]})}),(0,Q.jsx)(P.Z,{sx:{pt:2.5},children:(0,Q.jsx)(u.Z,{sx:{color:oe,fontWeight:600},children:"Service is not available at this location. Try a different drop point within the coverage zone."})}),(0,Q.jsx)(l.Z,{direction:"row",justifyContent:"flex-end",sx:{p:2,borderTop:"1px solid ".concat(ce)},children:(0,Q.jsx)(m.Z,{variant:"contained",onClick:function(){return Et(!1)},sx:{borderRadius:999,px:3,bgcolor:"#ef4444",fontWeight:700,textTransform:"none",boxShadow:"0 6px 18px ".concat(xe("#ef4444")),"&:hover":{bgcolor:"#dc2626"}},children:"Close"})})]})]})]})}},37159:function(e,t,n){n.d(t,{j:function(){return i},v:function(){return o}});var r=n(74165),a=n(15861),o=function(){var e=(0,a.Z)((0,r.Z)().mark((function e(t,n){var a,o,i,s,c,l,d,u,p,x,f,h,m,g,b,Z;return(0,r.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null===t||void 0===t?void 0:t.latitude,o=null===t||void 0===t?void 0:t.longitude,i=null===n||void 0===n?void 0:n.latitude,s=null===n||void 0===n?void 0:n.longitude,null!=a&&null!=o&&null!=i&&null!=s){e.next=6;break}throw new Error("Invalid coordinates");case 6:return c={NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_API_URL:"https://mock-data-api-nextjs.vercel.app/",REACT_APP_AUTH0_CLIENT_ID:"",REACT_APP_AUTH0_DOMAIN:"",REACT_APP_AWS_APP_CLIENT_ID:"",REACT_APP_AWS_POOL_ID:"",REACT_APP_FIREBASE_API_KEY:"",REACT_APP_FIREBASE_APP_ID:"",REACT_APP_FIREBASE_AUTH_DOMAIN:"",REACT_APP_FIREBASE_MEASUREMENT_ID:"",REACT_APP_FIREBASE_MESSAGING_SENDER_ID:"",REACT_APP_FIREBASE_PROJECT_ID:"",REACT_APP_FIREBASE_STORAGE_BUCKET:"",REACT_APP_GOOGLE_MAPS_API_KEY:"AIzaSyCF4KatYCI3vqz1_H3kiHeyS3yCMfYToh8",REACT_APP_RIDER_ACCESS_ID:"AAAAILMpCEU:APA91bEavuOllBI6sFgYtxXAgNmAVwNA-MnCMHLGlR4_t7UqpLajAkdn3T0CZr_zaLBknLyim9ytFLMZgbeXmKqTad_PKCbqlYjHpaizVrLXtecxqyEy4UktIacK2UvHVUATHL-7VQQk",REACT_APP_STAFF_TOKEN:"",REACT_APP_URL:"https://jupiter.nearle.app/live/api/v1",REACT_APP_URL2:"https://jupiter.nearle.app/live/api/v2",REACT_APP_VERSION:"v2.1.0"}.REACT_APP_OSRM_URL||"https://router.project-osrm.org",e.prev=7,l="".concat(c,"/route/v1/driving/").concat(o,",").concat(a,";").concat(s,",").concat(i,"?overview=false"),e.next=11,fetch(l);case 11:if(!(d=e.sent).ok){e.next=20;break}return e.next=15,d.json();case 15:if(!((u=e.sent).routes&&u.routes.length>0)){e.next=20;break}return p=u.routes[0].distance,x=p/1e3,e.abrupt("return",Math.round(x));case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(7),console.warn("OSRM API failed, falling back to Haversine math:",e.t0);case 25:return 6371,h=(f=function(e){return e*Math.PI/180})(i-a),m=f(s-o),g=Math.sin(h/2)*Math.sin(h/2)+Math.cos(f(a))*Math.cos(f(i))*Math.sin(m/2)*Math.sin(m/2),b=2*Math.atan2(Math.sqrt(g),Math.sqrt(1-g)),Z=6371*b,e.abrupt("return",Math.round(1.3*Z));case 33:case"end":return e.stop()}}),e,null,[[7,22]])})));return function(t,n){return e.apply(this,arguments)}}(),i=function(e,t,n,r){return e