1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="32459afe-3178-44f5-abc6-b0d25755159f",e._sentryDebugIdIdentifier="sentry-dbid-32459afe-3178-44f5-abc6-b0d25755159f")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3107],{13762:(e,t,l)=>{l.d(t,{A:()=>i});var o=l(74848);l(96540);var r=l(72209),n=l(33877);let i=e=>{let{mode:t,isActive:l,activeColor:i="#000000",inactiveColor:a="#000000",className:s=""}=e,d=l?i:a;return"pickup"===t?(0,o.jsxs)("svg",{width:"25",height:"25",className:"mr-3 ".concat(s),viewBox:"0 0 25 29",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,o.jsx)("path",{d:"M3.46796 4.30542L1 13.1796V27.4623H18.7483V13.1796L21.2859 4.31914",stroke:d,strokeWidth:"1.1907",strokeMiterlimit:"10",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M18.748 27.4623H24.0515V13.1796L21.7411 4.98804",stroke:d,strokeWidth:"1.1907",strokeMiterlimit:"10",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M18.748 27.5673L21.426 24.9418L24.0515 27.5673",stroke:d,strokeWidth:"1.1907",strokeMiterlimit:"10",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M21.4268 24.9418V14.0723",stroke:d,strokeWidth:"1.1907",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M21.2861 4.30536H2.47094C2.05086 3.93779 1.84082 3.41269 1.84082 2.83508C1.84082 2.25747 2.10337 1.73238 2.47094 1.36481H21.7271",stroke:d,strokeWidth:"1.1907",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M22.6083 2.99614C22.6083 3.53885 22.4754 4.00883 22.2837 4.32842C22.0866 4.65679 21.8759 4.76014 21.7263 4.76014C21.5767 4.76014 21.366 4.65679 21.169 4.32842C20.9772 4.00883 20.8443 3.53885 20.8443 2.99614C20.8443 2.45343 20.9772 1.98345 21.169 1.66386C21.366 1.33549 21.5767 1.23214 21.7263 1.23214C21.8759 1.23214 22.0866 1.33549 22.2837 1.66386C22.4754 1.98345 22.6083 2.45343 22.6083 2.99614Z",fill:l?i:"#FFFFFF",stroke:d,strokeWidth:"0.881998"})]}):"dinein"===t?(0,o.jsx)(r.cfp,{size:32,color:d,className:s}):"delivery"===t?(0,o.jsx)(n.Xpo,{size:32,color:d,className:s}):null}},82699:(e,t,l)=>{l.d(t,{A:()=>a});var o=l(74848),r=l(96540),n=l(18051),i=l.n(n);let a=e=>{let{primaryColor:t,secondaryColor:l,fontFamily:n,message:a}=e,[s,d]=(0,r.useState)(null);return(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("https://res.cloudinary.com/http-foodbot-ai/raw/upload/v1752233580/Food_Carousel_agkfib.json"),t=await e.json();d(t)}catch(e){console.error("Failed to load Lottie animation:",e)}})()},[]),(0,o.jsx)("div",{className:"fixed inset-0 flex items-center justify-center bg-opacity-50 bg-gray-500",style:{zIndex:1200},children:(0,o.jsxs)("div",{className:"flex flex-col items-center justify-center",children:[s?(0,o.jsx)(i(),{animationData:s,loop:!0,autoplay:!0,style:{height:200,width:300}}):(0,o.jsx)("div",{}),a&&(0,o.jsxs)("div",{style:{color:t||"#000",fontFamily:"".concat(n||"sans-serif")},className:"my-4 text-2xl font-black text-center",children:[a," . . ."]})]})})}},63118:(e,t,l)=>{l.d(t,{A:()=>D});var o=l(74848),r=l(96540),n=l(77255),i=l(32862),a=l(96438),s=l(14953),d=l.n(s),c=l(5595),u=l(67279),m=l(59616),v=l(84345),_=l(40961),g=l(22252);let p=e=>{let{onClose:t}=e,{t:l}=(0,n.Bd)(),i=(0,r.useRef)(null);return((0,r.useEffect)(()=>{let e=e=>{i.current&&!i.current.contains(e.target)&&t()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]),"undefined"==typeof document)?null:(0,_.createPortal)((0,o.jsxs)("div",{ref:i,style:{position:"fixed",top:"4px",left:"120px",zIndex:0x7fffffff,maxWidth:"260px",filter:"drop-shadow(0 4px 16px rgba(0,0,0,0.28))"},children:[(0,o.jsx)("div",{style:{width:0,height:0,borderLeft:"10px solid transparent",borderRight:"10px solid transparent",borderBottom:"12px solid #1f2937",marginLeft:"16px"}}),(0,o.jsxs)("div",{style:{backgroundColor:"#1f2937",borderRadius:"10px",padding:"14px 14px 12px 14px",color:"#ffffff",fontSize:"13px",lineHeight:"1.5",position:"relative"},children:[(0,o.jsx)("button",{onClick:t,style:{position:"absolute",top:"8px",right:"8px",background:"none",border:"none",color:"#9ca3af",cursor:"pointer",padding:"2px",lineHeight:1,fontSize:"16px"},"aria-label":"Close",children:"â"}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",ga
1p:"8px",paddingRight:"20px"},children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",style:{width:"18px",height:"18px",flexShrink:0,marginTop:"1px",color:"#60a5fa"},children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M11.54 22.351l.07.04.028.016a.76.76 0 00.723 0l.028-.015.071-.041a16.975 16.975 0 001.144-.742 19.58 19.58 0 002.683-2.282c1.944-2.003 3.5-4.697 3.5-8.327a8 8 0 10-16 0c0 3.63 1.556 6.324 3.5 8.327a19.58 19.58 0 002.682 2.282 16.975 16.975 0 001.145.742zM12 13.5a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})}),(0,o.jsx)("span",{children:l("allow_location_from_here","You can allow your location from here and refresh the page")})]}),(0,o.jsxs)("div",{style:{marginTop:"10px",paddingTop:"8px",borderTop:"1px solid #374151",display:"flex",alignItems:"center",gap:"6px",color:"#d1d5db",fontSize:"12px"},children:[(0,o.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{width:"13px",height:"13px",flexShrink:0},children:[(0,o.jsx)("polyline",{points:"23 4 23 10 17 10"}),(0,o.jsx)("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]}),l("refresh_after_allowing","After allowing, refresh the page")]})]})]}),document.body)},f=e=>{let{primaryColor:t,fontFamily:l,searchValue:i,onSearchChange:a,isDineInMode:s,onLocationRequest:d}=e,{t:c}=(0,n.Bd)(),[u,m]=(0,r.useState)(!1),v=async()=>{if("undefined"==typeof navigator||!navigator.permissions)return!1;try{let e=await navigator.permissions.query({name:"geolocation"});return"denied"===e.state}catch(e){return!1}},_=async()=>{if(d){if(await v()){m(!0);return}await d(),await v()&&m(!0)}};return(0,o.jsxs)(o.Fragment,{children:[u&&(0,o.jsx)(p,{onClose:()=>m(!1)}),(0,o.jsxs)("div",{className:"py-8 px-4 lg:mt-0 mt-12",children:[(0,o.jsx)("div",{style:{color:t,fontFamily:"".concat(l,", sans-serif")},className:"font-black pb-3 text-lg",children:c(s?"dine_in":"pick_up_at")}),(0,o.jsxs)("div",{className:"flex gap-2 w-full",children:[(0,o.jsx)("input",{style:{fontFamily:"".concat(l,", sans-serif")},type:"text",placeholder:c(s?"where_will_you_dine_in":"where_will_you_pick_order"),className:"bg-lightGray rounded-lg h-[50px] w-full font-bold px-2 border border-gray-300",value:i,onChange:e=>a(e.target.value)}),d&&(0,o.jsx)("button",{onClick:_,title:c("use_my_location"),className:"flex-shrink-0 flex items-center justify-center w-[50px] h-[50px] rounded-full hover:opacity-80 active:opacity-60 transition-opacity",style:{backgroundColor:t},children:(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"w-5 h-5",style:{color:"#ffffff"},children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M11.54 22.351l.07.04.028.016a.76.76 0 00.723 0l.028-.015.071-.041a16.975 16.975 0 001.144-.742 19.58 19.58 0 002.683-2.282c1.944-2.003 3.5-4.697 3.5-8.327a8 8 0 10-16 0c0 3.63 1.556 6.324 3.5 8.327a19.58 19.58 0 002.682 2.282 16.975 16.975 0 001.145.742zM12 13.5a3 3 0 100-6 3 3 0 000 6z",clipRule:"evenodd"})})})]})]})]})},h=e=>{var t,l,a,s;let{data:d,props:u}=e,[_,g]=(0,r.useState)(!1),[p,f]=(0,r.useState)(!1),{t:h}=(0,n.Bd)();(0,r.useContext)(i.ib);let y=e=>{let[t,l]=e.split(":"),o=parseInt(t,10);return"".concat(o%12||12,":").concat(l," ").concat(o>=12?"PM":"AM")},b=e=>{localStorage.removeItem("scheduledOrder_".concat((0,v.o)())),localStorage.removeItem("selected_delivery_partner_".concat((0,v.o)())),localStorage.removeItem("delivery_partners_".concat((0,v.o)())),localStorage.removeItem("dine_in_table"),localStorage.removeItem("dine_in_data"),localStorage.removeItem("current_scheduledOrder__".concat(u.alias)),u.setGetBranchId(e),u.setGetMode(u.isDineInMode?"dinein":"pickup"),u.setCheckItemurl(!1),u.isDineInMode||localStorage.setItem("is_dinein_tab_".concat(u.alias),"false"),u.checkItemurl&&localStorage.setItem("item_url_".concat((0,v.o)()),u.checkItemurl)};return(0,r.useEffect)(()=>{u.getBranchId&&("pickup"===u.getMode||"dinein"===u.getMode)&&u.setOpen(!1)},[u.getBranchId,u.getMode]),(0,r.useEffect)(()=>{let e=()=>{f((0,c.MQ)(d.branch_business_hours,d.timezone))};e();let t=setInterval(e,6e4);return()=>clearInterval(t)},[d.branch_business_hours,d.timezone]),console.log(p,"open menu in changemode"),(0,o.jsxs)("div",{className:"py-4 border-b border-lineGray px-4",children:[(0,o.jsxs)("div",{onClick:()=>b(d),className:"cursor-pointer",children:[(0,o.jsx)("div",{style:{color:u.primaryColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},className:"font-black text-lg",children:null==d?void 0:d.branch_name}),(0,o.jsx)("div",{style:{color:u.descriptionColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},className:"text-sm leading-4 pb-3",children:null==d?void 0:d.Complete_address})]}),(0,o.jsxs)("div",{className:"grid grid-cols-3 text-sm",children:[(0,o.jsx)("div",{style:{fontFamily:"".concat(u.fontFamily,", sans-serif")},className:"".concat(p?"text-brandGreen":u.ErrorPrimaryColor," my-auto font-bold"),children:p?h("open"):h("closed")}),(0,o.jsx)("div",{style:{color:u.primaryColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},onClick:()=>g(!_),className:"font-bold flex items-center cursor-pointer text-sm",children:_?h("hideschedule"):h("checkschedule")}),(u.isDineInMode?(null==d?void 0:null===(l=d.schedule_settings)||void 0===l?void 0:null===(t=l.dinein)||void 0===t?void 0:t.status)==1:(null==d?void 0:null===(s=d.schedule_settings)||void 0===s?void 0:null===(a=s.pickup)||void 0===a?void 0:a.status)==1)?(0,o.jsx)("div",{className:"flex justify-end",children:(0,o.jsx)("div",{style:{color:u.secondaryBtnTxtColor,backgroundColor:u.secondaryBtnColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},onClick:()=>{u.onBranchSelect(d),setTimeout(()=>{u.setOpenScheduleOrder(!0)},50)}
1,className:"py-1.5 cursor-pointer px-3 w-fit rounded-full text-center",children:h("schedule your order")})}):(0,o.jsxs)("div",{style:{color:u.primaryColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},className:"flex items-center justify-end",children:[(0,o.jsx)(m.A,{className:"h-4 pr-1 my-auto text-sm lg:text-base"}),"".concat(d.pickup_time_estimate," - ").concat(Number(d.pickup_time_estimate)+10)," ","min"]})]}),_&&(0,o.jsx)("div",{className:"py-3",children:d.branch_business_hours.map((e,t)=>(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"100px 1fr"},className:"py-1 gap-x-1 lg:gap-x-10 items-center space-x-4",children:[(0,o.jsx)("div",{style:{color:u.primaryColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},className:"text-sm font-bold",children:[h("Sunday"),h("Monday"),h("Tuesday"),h("Wednesday"),h("Thursday"),h("Friday"),h("Saturday")][parseInt(e.day)]}),(0,o.jsx)("div",{style:{color:u.primaryColor,fontFamily:"".concat(u.fontFamily,", sans-serif")},className:"text-sm",children:0===e.status?(0,o.jsx)("span",{style:{color:u.ErrorPrimaryColor},children:h("closed")}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("span",{className:"",children:y(e.open_time)})," -"," ",(0,o.jsx)("span",{className:"",children:y(e.close_time)})]})})]},t))})]})},y=e=>{let{t}=(0,n.Bd)(),{addresses:l,searchValue:a,onSearchChange:s,...d}=e,[u,m]=(0,r.useState)(null);(0,r.useContext)(i.ib),console.log("\uD83C\uDFEA PickUpAddress - Received addresses:",l),console.log("\uD83C\uDF7Dï¸ PickUpAddress - isDineInMode:",e.isDineInMode),console.log("\uD83D\uDD22 PickUpAddress - Addresses length:",null==l?void 0:l.length);let v=sessionStorage.getItem("direct_branch_id_".concat(e.alias)),_=(l||[]).filter(t=>{var l,o,r,n,i;if(console.log("\uD83D\uDD0D Filtering item:",t),console.log("\uD83D\uDD0D Item available_services:",null==t?void 0:t.available_services),console.log("\uD83D\uDD0D qsr_status value:",null==t?void 0:null===(l=t.available_services)||void 0===l?void 0:l.qsr_status,"| type:",typeof(null==t?void 0:null===(o=t.available_services)||void 0===o?void 0:o.qsr_status),"| isDineInMode:",e.isDineInMode),!e.isDineInMode)return(null==t?void 0:null===(i=t.available_services)||void 0===i?void 0:i.pickup)!==!1;{let e=(null==t?void 0:null===(r=t.available_services)||void 0===r?void 0:r.dinein)!==!1&&(null==t?void 0:null===(n=t.available_services)||void 0===n?void 0:n.qsr_status)==="yes";return console.log("\uD83D\uDD0D Branch",null==t?void 0:t.branch_name,"passes dine-in filter:",e),e}}).map(e=>{console.log("\uD83D\uDDFAï¸ Mapping item:",e),console.log("\uD83D\uDDFAï¸ Item branch_business_hours:",null==e?void 0:e.branch_business_hours),console.log("\uD83D\uDDFAï¸ Item timezone:",null==e?void 0:e.timezone);let t=!1;return(null==e?void 0:e.branch_business_hours)&&(null==e?void 0:e.timezone)?t=(0,c.MQ)(e.branch_business_hours,e.timezone):console.warn("â ï¸ Missing branch_business_hours or timezone for item:",e),console.log("\uD83D\uDDFAï¸ isOpen result:",t),{...e,isOpen:t}}).sort((e,t)=>{if(v){var l,o;let r=(null===(l=e.branch_id)||void 0===l?void 0:l.toString())===v,n=(null===(o=t.branch_id)||void 0===o?void 0:o.toString())===v;if(r&&!n)return -1;if(!r&&n)return 1}return(t.isOpen?1:0)-(e.isOpen?1:0)});console.log("\uD83D\uDCCA PickUpAddress - Sorted addresses:",_),console.log("\uD83D\uDD22 PickUpAddress - Sorted addresses length:",_.length);let p=t=>{m(t),setTimeout(()=>{e.setOpenScheduleOrder(!0)},50)};return console.log(u,"sssssssssssss",_),(0,o.jsx)("div",{children:e.openScheduleOrder&&u?(0,o.jsx)(g.default,{selectedBranch:u,setOpenScheduleOrder:e.setOpenScheduleOrder,setGetBranchId:e.setGetBranchId,setGetMode:e.setGetMode,secondaryBtnColor:e.secondaryBtnColor,secondaryBtnTxtColor:e.secondaryBtnTxtColor,primaryColor:e.primaryColor,fontFamily:e.fontFamily,secondaryColor:e.secondaryColor,bgColor:e.bgColor,ErrorPrimaryColor:e.ErrorPrimaryColor,ErrorSecondaryColor:e.ErrorSecondaryColor,checkitemurl:e.checkItemurl,setCheckItemurl:e.setCheckItemurl,isDineInMode:e.isDineInMode}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(f,{primaryColor:e.primaryColor,fontFamily:e.fontFamily,searchValue:a,onSearchChange:s,isDineInMode:e.isDineInMode,onLocationRequest:e.onLocationRequest}),(0,o.jsx)("div",{className:"border-t",children:_.length>0?_.map(e=>(0,o.jsx)(h,{data:e,props:{...d,onBranchSelect:p}},e.branch_name)):(0,o.jsx)("div",{className:"mx-auto p-4 h-screen",children:t("No Store Found")})})]})})};var b=l(18987),x=l(46240),w=l(70255),S=l(29965),j=l.n(S);let N=e=>{let{primaryColor:t,fontFamily:l}=e,{t:r}=(0,n.Bd)();return(0,o.jsxs)("div",{className:"flex flex-col mx-auto items-center",children:[(0,o.jsx)(j(),{height:250,width:250,src:"/ecomv2/noaddress.svg",alt:"No address available"}),(0,o.jsx)("div",{style:{color:t,fontFamily:"".concat(l," , sans-serif")},className:"py-3 mb-4",children:r("Looks like you dont have any saved address")})]})};var k=l(27528),C=l(24663),A=l(49505),I=l(11962),M=l(6210),F=l(13762);d()(()=>Promise.resolve().then(l.bind(l,22252)),{loadableGenerated:{webpack:()=>[22252]},ssr:!1,loading:()=>(0,o.jsx)(w.A,{})});let O=d()(()=>l.e(8767).then(l.bind(l,48767)),{loadableGenerated:{webpack:()=>[48767]},ssr:!1,loading:()=>(0,o.jsx)(w.A,{})}),D=e=>{var t,l,s,d,m,v,_,g,p,f;let{localalias:h,searchAddress:w,setSearchAddress:S,map:j,marker:D,setMarker:z,handleLocationSelect:E,autocompleteRef:L,getPickupBranches:B,getClickedBranchId:Y,restaurantSettingsServer:P,setIsOpen:T,triggerError:q,login:J,setOpenLoginModal:R,schedulesetting:G,validateCartItemsAgainstMenu:H,setCartItemDetails:V,setIsCartUpdated:U,setSaveCartCal:W,setTaxDetails:Z,cartpagevalidate:X,saveCartCal:K,checkItemurl:Q,setCheckItemurl:$,onRequestLocationSort:ee}=e,[et,el]=(0,r.useState)((null==P?void 0:null===(l=P.ecom_settings)||void 0===l?void 0:null===(t=l.general_settings)||void 0===t?void 0:t.ecom_default_ordertype)?null==P?void 0:null===(d=P.ecom_settings)||void 0===d?void 0:null===(s=d.general_settings)||void 0===s?void 0:s.ecom_default_ordertype:"pickup"),[eo,er]=(0,r.useState)((null==P?void 0:null===(v=P.ecom_settings)||void 0===v?void 0:null===(m=v.general_settings)||void 0===m?void 0:m.ecom_default_ordertype)==="dinein"),{t:en}=(0,n.Bd)(),{currentLang:ei}=(0,M.ok)(),[ea,es]=(0,r.useState)([]),[ed,ec]=(0,r.useState)(null),[eu,em]=(0,r.useState)(""),[ev,e_]=(0,r.useState)({}),[eg,ep]=(0,r.useState)(""),[ef,eh]=(0,r.useState)(!1),[ey,eb]=(0,r.useState)(""),[ex,ew]=(0,r.useState)(!1),[eS,ej]=(0,r.useState)(!1),[eN,ek]=(0,r.useState)(""),[eC,eA]=(0,r.useState)(""),[eI,eM]=(0,r.useState)({formattedaddress:!1,department:!1,alias:!1,external_number:!1,city:!1,lote:!1,manzana:!1}),[eF,eO]=(0,r.useState)(""),[eD,ez]=(0,r.useState)(""),[eE,eL]=(0,r.useState)(""),[eB,eY]=(0,r.useState)(!1),eP=["cancun","canc\xfan","playa del carmen"],[eT,eq]=(0,r.useState)(!1),eJ=localStorage.getItem("version"),eR=[{value:en("house"),label:en("house")},{value:en("apartment"),label:en("apartment")},{value:en("office"),label:en("office")}],eG=(()=>{var e;console.log("\uD83D\uDD0D Active Tab:",et),console.log("\uD83D\uDCE6 getPickupBranches:",B),console.log("\uD83C\uDF7Dï¸ dinein_branches:",null==B?void 0:B.dinein_branches),console.log("\uD83D\uDCCD branches_data:",null==B?void 0:B.branches_data);let t="dinein"===et?null==B?void 0:B.dinein_branches:null==B?void 0:B.branches_data;console.log("â
Selected branches array:",t),console.log("\uD83D\uDD22 Array length:",null==t?void 0:t.length);let l=null===(e=t||[])||void 0===e?void 0:e.filter(e=>{var t,l;return(null==e?void 0:null===(t=e.Complete_address)||void 0===t?void 0:t.toLowerCase().includes(eN.toLowerCase()))||(null==e?void 0:null===(l=e.branch_name)||void 0===l?void 0:l.toLowerCase().includes(eN.toLowerCase()))}),o=sessionStorage.getItem("direct_branch_id_".concat(h));if(o){let e=l.findIndex(e=>{var t;return(null==e?void 0:null===(t=e.branch_id)||void 0===t?void 0:t.toString())===o});if(e>0){let[t]=l.splice(e,1);l.unshift(t)}}return console.log("\uD83C\uDFAF Filtered addresses:",l),l})(),[eH,eV]=(0,r.useState)(null),[eU,eW]=(0,r.useState)(""),[eZ,eX]=(0,r.useState)([]),[eK,eQ]=(0,r.useState)({}),[e$,e0]=(0,r.useState)(!1),{handleApiError:e1}=(0,a.u)(),e2=(0,r.useContext)(i.ib);if(!e2)throw Error("IndexPage must be used within a MyProvider");let[e5,e4]=(0,r.useState)(""),[e7,e3]=(0,r.useState)({}),{restaurantData:e8,openFailureModalFunc:e9,sessionId:e6}=e2,te="profile_check_".concat(h);localStorage.getItem(te);let[tt,tl]=(0,r.useState)(!1),[to,tr]=(0,r.useState)(!1),[tn,ti]=(0,r.useState)(!1),[ta,ts]=(0,r.useState)(!1),[td,tc]=(0,r.useState)(!1),[tu,tm]=(0,r.useState)(!1),[tv,t_]=(0,r.useState)(null),[tg,tp]=(0,r.useState)(""),tf=(0,r.useRef)(null),th=(0,r.useRef)(Y);th.current=Y;let ty=(0,r.useRef)(null),[tb,tx]=(0,r.useState)(!1),tw=()=>window.google&&window.google.maps&&window.google.maps.Geocoder;(0,r.useEffect)(()=>{let e=()=>{tx(window.innerWidth<1280)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,r.useEffect)(()=>{tf.current&&(tf.current.scrollTop=0)},[et]),(0,r.useEffect)(()=>{td&&(console.log("Updated GetBranchDelivery:",eZ),tc(!1))},[eZ,td]),(0,r.useEffect)(()=>{let e=localStorage.getItem("resturantserversideTheme"),t=localStorage.getItem(te),l=localStorage.getItem("selected_branchmode_".concat(h));if(l)try{let e=JSON.parse(l);e3(e)}catch(e){console.error("Failed to parse storedChangeModeBranchId:",e)}{let e=localStorage.getItem("branch_delivery_".concat(h));if(e)try{let t=JSON.parse(e);eX(t)}catch(e){console.error("Failed to parse branch_delivery:",e)}else console.log("No restaurant settings found in localStorage")}if(t)try{let e=JSON.parse(t);eQ(e)}catch(e){console.error("Failed to parse user details:",e)}if(e)try{ec(JSON.parse(e))}catch(e){console.error("Failed to parse resturantserversideTheme:",e)}eH&&"delivery"==eU&&(eT?T(!1):console.log("API call was not successful, keeping modal open."))},[eH,eU,eT,localStorage.getItem(te),null==e7?void 0:null===(_=e7.branch)||void 0===_?void 0:_.pickup_time_estimate,h]),(0,r.useEffect)(()=>
1{if(!eH)return;let e="".concat(JSON.stringify(eH),"::").concat(eU);ty.current!==e&&(ty.current=e,th.current(eH,eU))},[eH,eU]),(0,r.useEffect)(()=>{(null==eK?void 0:eK.member_id)&&tT()},[null==eK?void 0:eK.member_id]);let tS=!1,tj=async()=>{if(!ev.formatted_address||!ev.address_type||!ev.address_label||!ev.external_number||to&&!ev.city||eB&&!eF||eB&&!eD){eM({formattedaddress:!ev.formatted_address,department:!ev.address_type,alias:!ev.address_label,external_number:!ev.external_number,city:to&&!ev.city,lote:eB&&!eF,manzana:eB&&!eD});return}let e=!!(null==eK?void 0:eK.member_id),t={...ev},l=tt?2:1;if(!ev.zipcode){eh(!0);try{let e="".concat(window.location.origin,"/"),l="https://order.foodbot.ai/apiv2";e&&(l=e+"apiv2");let o=await fetch("".concat(l,"/ecom/v1/getZipCode"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lat:ev.latitude,lng:ev.longitude,restaurant_id:null==P?void 0:P.restaurant_id,version:eJ,session_id:e6})}),r=await o.json();if(r.postalCodes&&r.postalCodes.length>0){let e=r.postalCodes[0].postalCode;t={...ev,zipcode:e,formatted_address:ev.formatted_address.includes(e)?ev.formatted_address:"".concat(ev.formatted_address,", ").concat(e)},await e_(t)}else{e9(en("Please Select an address with Zipcode")),eh(!1);return}}catch(e){console.error("Error fetching postal code:",e),e9(en("Error fetching postal code")),eh(!1);return}}let o=t.formatted_address||"";if(eB&&eF&&eD){let e="Lote-".concat(eF,", Manzana-").concat(eD).concat(eE?", Supermanzana-".concat(eE):""),l=o.indexOf(t.city||"");o=-1!==l?"".concat(o.slice(0,l)).concat(e,", ").concat(o.slice(l)):"".concat(e,", ").concat(o)}let r={formatted_address:o,unit_number:t.unit_number,latitude:t.latitude,longitude:t.longitude,zipcode:t.zipcode,city:t.city,state:t.state,country:t.country,external_number:t.external_number,street:t.street,address_type:t.address_type,residence_building:t.residence_building,address_label:t.address_label,external_type:l,delivery_instruction:tg.trim()||""};if(localStorage.setItem("selecteduserAddress_".concat(h),JSON.stringify(r)),!e){eh(!0);try{if(eA("addressadded"),e_({}),ep(""),S(""),eb(""),tp(""),eM({formattedaddress:!1,department:!1,alias:!1,external_number:!1,city:!1,lote:!1,manzana:!1}),eO(""),ez(""),eL(""),eY(!1),await tH(r,!1,"manual")&&"scheduleclose"===e5){let e="selected_branchmode_".concat(h),t={mode:"delivery",branch:{...eZ,...r,delivery_instruction:r.delivery_instruction||""}};eV(r),eW("delivery"),localStorage.setItem(e,JSON.stringify(t)),b.A.set(e,JSON.stringify(t),{expires:7}),localStorage.setItem("branch_delivery_".concat(h),JSON.stringify(eZ)),b.A.set("branch_delivery_".concat(h),JSON.stringify({branch:eZ}),{expires:7}),setTimeout(()=>{T(!1)},100)}else console.error("Skipping Schedule Form")}catch(e){console.error("Error in branches_deliveryapi:",e),e9(en("Error processing address"))}finally{eh(!1)}return}eh(!0);let n=(0,A.z)(),i=JSON.stringify({restaurant_id:null==P?void 0:P.restaurant_id,address:r,member_id:null==eK?void 0:eK.member_id,phone_number:(null==eK?void 0:eK.mobile_number)||(null==eK?void 0:eK.phone_number),sender_id:(null==eK?void 0:eK.mobile_number)||(null==eK?void 0:eK.phone_number),session_id:e6,lang:null==P?void 0:P.lang,source:"EcomV2",version:eJ,ui_request_timestamp:new Date().toISOString()});try{let e="".concat(window.location.origin,"/"),t="https://order.foodbot.ai/apiv2";e&&(t=e+"apiv2");let l=await fetch("".concat(t,"/ecom/v1/address-add"),{method:"POST",headers:n,body:i,redirect:"follow"}),o=await l.json();if((201==o.status_code||200==o.status_code)&&"success"==o.status){if(e_({}),ep(""),S(""),eb(""),tp(""),eM({formattedaddress:!1,department:!1,alias:!1,external_number:!1,city:!1,lote:!1,manzana:!1}),eO(""),ez(""),eL(""),eY(!1),em(""),await tH(r,!1,"manual")&&"scheduleclose"==e5){let e="selected_branchmode_".concat(h),t={mode:"delivery",branch:{...eZ,...r,delivery_instruction:r.delivery_instruction||""}};eV(r),eW("delivery"),localStorage.setItem(e,JSON.stringify(t)),b.A.set(e,JSON.stringify(t),{expires:7}),localStorage.setItem("branch_delivery_".concat(h),JSON.stringify(eZ)),b.A.set("branch_delivery_".concat(h),JSON.stringify({branch:eZ}),{expires:7}),setTimeout(()=>{T(!1)},100)}else console.error("Delivery API call failed.")}else{let e=e1(o.status_code);e9(o.message||e),console.error("Error"),em(en("we_do_not_deliver"))}}catch(e){console.error(e),e9("An error occurred")}finally{eh(!1)}},tN=e=>{if(e.startsWith("#")){let t=e.replace("#",""),l=parseInt(3===t.length?t[0]+t[0]:t.slice(0,2),16),o=parseInt(3===t.length?t[1]+t[1]:t.slice(2,4),16),r=parseInt(3===t.length?t[2]+t[2]:t.slice(4,6),16);return{rgb:"".concat(l,", ").concat(o,", ").concat(r)}}if(e.startsWith("rgb")){let t=e.match(/\d+/g);return{rgb:"".concat(t[0],", ").concat(t[1],", ").concat(t[2])}}return{rgb:"169, 169, 169"}};(0,r.useEffect)(()=>{document.documentElement.style.setProperty("--scrollbar-thumb-color",tC),document.documentElement.style.setProperty("--scrollbar-track-color","#f1f1f1")},[]);let tk=(null==ed?void 0:ed.primary_text_color)||"#000000",tC=(null==ed?void 0:ed.secondary_text_color)||"#FFCD00";null==ed||ed.highlight_text_color;let tA=(null==ed?void 0:ed.background_color)||"#FFFFF",tI=(null==ed?void 0:null===(g=ed.fonts)||void 0===g?void 0:g.name)||"sans-serif",tM=(null==ed?void 0:ed.primary_description_color)||"#00000",tF=ed?null==ed?void 0:ed.secondary_button_color:"#FFCD00",tO=(null==ed?void 0:ed.secondary_button_text_color)||"#000000",tD=(null==ed?void 0:ed.error_primary_color)||"#FF0000",tz=(null==ed?void 0:ed.error_secondary_color)||"#FFFFFF",tE=(null==ed?void 0:ed.third_button_color)||"#000000",tL=(null==ed?void 0:ed.third_button_text_color)||"#FFFFFF",tB=(null==ed?void 0:ed.third_button_text_two_color)||tC,tY=r.useMemo(()=>{var e;let t=(null==B?void 0:B.order_type_status)||[],l=[];return t.some(e=>(null==e?void 0:e.pickup_status)===1)&&l.push("pickup"),t.some(e=>(null==e?void 0:e.dinein_status)===1)&&(null==B?void 0:null===(e=B.dinein_branches)||void 0===e?void 0:e.some(e=>{var t;return(null==e?void 0:null===(t=e.available_services)||void 0===t?void 0:t.qsr_status)==="yes"}))&&l.push("dinein"),t.some(e=>(null==e?void 0:e.delivery_status)===1)&&l.push("delivery"),l},[null==B?void 0:B.order_type_status,null==B?void 0:B.dinein_branches]),tP=e=>{console.log("\uD83D\uDD04 Changing tab to:",e);let t="dinein"===e?"true":"false";console.log("\uD83C\uDFF7ï¸ Path alias:",h),console.log("\uD83C\uDF7Dï¸ Is dine-in mode:",t),el(e),ts(!1),"dinein"===e?er(!0):er(!1),localStorage.setItem("is_dinein_tab_".concat(h),t),console.log("â
Tab changed successfully")};(0,r.useEffect)(()=>{var e,t;let l="dinein"===et?"true":"false",o=(null==P?void 0:null===(t=P.ecom_settings)||void 0===t?void 0:null===(e=t.general_settings)||void 0===e?void 0:e.ecom_default_ordertype)==="dinein";er("dinein"===et),o&&localStorage.setItem("is_dinein_tab_".concat(h),l)},[et,h,P]),(0,r.useEffect)(()=>{tY.length&&(tY.includes(et)||el(tY[0]))},[et,tY]),localStorage.getItem("scheduledOrder_".concat(h));let tT=()=>{ew(!0);let e=(0,A.z)(),t=JSON.stringify({restaurant_id:null==P?void 0:P.restaurant_id,phone_number:null==eK?void 0:eK.mobile_number,member_id:eK&&(null==eK?void 0:eK.member_id),session_id:e6,lang:null==P?void 0:P.lang,source:"EcomV2",version:eJ,ui_request_timestamp:new Date().toISOString()}),l="".concat(window.location.origin,"/"),o="https://order.foodbot.ai/apiv2";l&&(o=l+"apiv2"),fetch("".concat(o,"/ecom/v1/address-list"),{method:"POST",headers:e,body:t,redirect:"follow"}).then(e=>e.json()).then(e=>{(200==e.status_code||201==e.status_code)&&"success"==e.status?e.data&&(es(e.data),localStorage.setItem("userAddress_".concat(h),JSON.stringify(e.data))):(console.log("error"),e9(e1(e.status_code)))}).catch(e=>console.error(e)).finally(()=>ew(!1))};(0,r.useEffect)(()=>()=>{(null==L?void 0:L.current)&&(L.current=null)},[L]);let tq=async()=>
1{if(tS=!0,window.google&&L.current&&L.current.getPlace){if(!tw()||!L.current){console.warn("Google Maps API not loaded or autocompleteRef is null");return}try{let p=L.current.getPlace();if(p&&p.geometry&&p.geometry.location){var e,t,l,o,r,n,i,a,s,d,c,u,m,v,_,g;let f=p.geometry.location.lat(),h=p.geometry.location.lng(),y={lat:f,lng:h},b=null===(t=p.address_components)||void 0===t?void 0:null===(e=t.find(e=>e.types.includes("street_number")))||void 0===e?void 0:e.long_name;tl(!b);let x=null===(o=p.address_components)||void 0===o?void 0:null===(l=o.find(e=>e.types.includes("locality")))||void 0===l?void 0:l.long_name;tr(!x);let w=(null===(n=p.address_components)||void 0===n?void 0:null===(r=n.find(e=>e.types.includes("administrative_area_level_2")))||void 0===r?void 0:r.long_name)||"",N=eP.includes((x||"").toLowerCase())||eP.includes(w.toLowerCase())||eP.some(e=>(p.formatted_address||"").toLowerCase().includes(e));if(eY(N),N||(eO(""),ez(""),eL("")),j&&j.panTo(y),z(y),p.formatted_address){S(p.formatted_address),eb(p.formatted_address),e_(e=>{var t,l,o,r,n,i,a,s,d,c;return{...e,street:p.name||"",formatted_address:p.formatted_address||"",external_number:b||"",city:x||"",state:(null===(l=p.address_components)||void 0===l?void 0:null===(t=l.find(e=>e.types.includes("administrative_area_level_1")))||void 0===t?void 0:t.long_name)||"",country:(null===(r=p.address_components)||void 0===r?void 0:null===(o=r.find(e=>e.types.includes("country")))||void 0===o?void 0:o.long_name)||"",zipcode:(null===(i=p.address_components)||void 0===i?void 0:null===(n=i.find(e=>e.types.includes("postal_code")))||void 0===n?void 0:n.long_name)||"",latitude:(null===(s=p.geometry)||void 0===s?void 0:null===(a=s.location)||void 0===a?void 0:a.lat())||"",longitude:(null===(c=p.geometry)||void 0===c?void 0:null===(d=c.location)||void 0===d?void 0:d.lng())||"",unit_number:e.unit_number||"",address_type:e.address_type||"house"}});let e={formatted_address:p.formatted_address||"",latitude:(null===(a=p.geometry)||void 0===a?void 0:null===(i=a.location)||void 0===i?void 0:i.lat())||"",longitude:(null===(d=p.geometry)||void 0===d?void 0:null===(s=d.location)||void 0===s?void 0:s.lng())||"",street:p.name||"",external_number:b||"",city:x||"",state:(null===(u=p.address_components)||void 0===u?void 0:null===(c=u.find(e=>e.types.includes("administrative_area_level_1")))||void 0===c?void 0:c.long_name)||"",country:(null===(v=p.address_components)||void 0===v?void 0:null===(m=v.find(e=>e.types.includes("country")))||void 0===m?void 0:m.long_name)||"",zipcode:(null===(g=p.address_components)||void 0===g?void 0:null===(_=g.find(e=>e.types.includes("postal_code")))||void 0===_?void 0:_.long_name)||"",unit_number:"",address_type:"house"};await tH(e,!1,"manual")?(console.log("Address validated successfully"),ej(!0),eA("verified"),tp("")):(console.log("Invalid address"),e9(en("we_do_not_deliver")),eA("notverified"),setTimeout(()=>{eb(""),S("")},500))}}}catch(e){console.error("Error in onPlaceSelected:",e),q(en("Error selecting location"))}}},tJ=e=>({...e,zipcode:e.zipcode||"",city:e.city||"",state:e.state||"",country:e.country||"",external_number:e.external_number||"",street:e.street||"",address_type:e.address_type||"house",unit_number:e.unit_number||""}),tR=(e,t,l)=>({restaurant_id:null==P?void 0:P.restaurant_id,branch_id:e,is_schedule:l,order_type:"delivery",source:{lat:Number(t.latitude),lng:Number(t.longitude)},destination:{lat:Number(t.latitude),lng:Number(t.longitude)},address:(e=>({formatted_address:e.formatted_address||"",unit_number:e.unit_number||"",latitude:e.latitude||"",longitude:e.longitude||"",zipcode:e.zipcode||"",city:e.city||"",state:e.state||"",country:e.country||"",external_number:e.external_number||"",street:e.street||"",address_type:e.address_type||"house"}))(t),is_callin:!1,lang:ei,api_source:"EcomV2",session_id:e6,version:eJ,ui_request_timestamp:new Date().toISOString()}),tG=e=>{e&&localStorage.setItem("item_url_".concat(h),e),setTimeout(()=>{$(!1)},300)},tH=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0;e0(!0);
1let o=(0,A.z)(),r=tJ(e),n=JSON.stringify({restaurant_alias:null==P?void 0:P.alias,formatted_address:e.formatted_address,restaurant_id:null==P?void 0:P.restaurant_id,lat:e.latitude,long:e.longitude,session_id:e6,version:eJ,source:"EcomV2",lang:null==P?void 0:P.lang,ui_request_timestamp:new Date().toISOString()});try{let e="".concat(window.location.origin,"/"),m="https://order.foodbot.ai/apiv2";e&&(m=e+"apiv2");let v=await fetch("".concat(m,"/ecom/v1/branches-delivery"),{method:"POST",headers:o,body:n}),_=await v.json();if(200===v.status&&"success"===_.status){if(_.data){let n=_.data.filter(e=>{var t,l;return e.delivery_partner_id&&e.delivery_partner_id.length>0&&((0,c.MQ)(e.branch_business_hours,e.timezone)||(null===(l=e.schedule_settingss)||void 0===l?void 0:null===(t=l.delivery)||void 0===t?void 0:t.status)==1)});if(0===n.length)return e9(en("no_delivery_partners_available")),!1;for(let c of n){var i,a,s,d,u;let n=(null===(a=c.schedule_settingss)||void 0===a?void 0:null===(i=a.delivery)||void 0===i?void 0:i.status)||0;if(console.log(c,"branch"),1==n){eA("addressadded"),e4("scheduleOpen"),ti(!0),localStorage.setItem("selecteduserAddress_".concat(h),JSON.stringify(r)),r.delivery_instruction;try{let t=await (0,k._)(h,null==c?void 0:c.branch_id,null==P?void 0:P.restaurant_id,null==P?void 0:P.brand_id,"delivery",e6,eJ,e);(null==t?void 0:t.status_code)==200&&(null==t?void 0:t.data)?(await (0,C.tE)("branchMenuDetail_".concat(h),null!==(d=null==t?void 0:null===(s=t.data)||void 0===s?void 0:s.menu_type)&&void 0!==d?d:[]),console.log("Menu data stored successfully in IndexedDB.",null==t?void 0:t.data)):console.warn("Failed to fetch or store menu.")}catch(e){console.error("Error fetching menu:",e)}return localStorage.setItem("branch_delivery_".concat(h),JSON.stringify(c)),b.A.set("branch_delivery_".concat(h),JSON.stringify({branch:c}),{expires:7}),eX(c),console.log(c,"branch::"),!0}if(0===n){e4("scheduleclose");let e=tR(c.branch_id,r,t);localStorage.removeItem("scheduledOrder_".concat(h)),localStorage.setItem("current_scheduledOrder__".concat(h),"false"),e4("scheduleclose");try{let t=await fetch("".concat(m,"/ecom/v1/payment-settings"),{method:"POST",headers:o,body:JSON.stringify(e)}),n=await t.json();if("success"!==n.status||!tS&&(null===(u=n.data)||void 0===u||!u.delivery_partners||!(n.data.delivery_partners.length>0)))return console.error("No valid delivery partners found in payment settings"),e9(en("no_delivery_partners_available")),!1;{console.log(n,"Payment settings fetched successfully"),localStorage.setItem("payment_method_".concat(h),JSON.stringify(n)),localStorage.removeItem("selected_delivery_partner_".concat(h)),b.A.set("payment_method_".concat(h),JSON.stringify(n),{expires:7});let e="selected_branchmode_".concat(h),t={mode:"delivery",branch:{...c,...r,delivery_instruction:r.delivery_instruction||""}};return"clickedaddress"==l&&(eV(r),eW("delivery"),localStorage.setItem(e,JSON.stringify(t)),b.A.set(e,JSON.stringify(t),{expires:7}),localStorage.setItem("selecteduserAddress_".concat(h),JSON.stringify(r)),localStorage.setItem("branch_delivery_".concat(h),JSON.stringify(c)),b.A.set("branch_delivery_".concat(h),JSON.stringify({branch:c}),{expires:7}),tG(Q),setTimeout(()=>{T(!1)},100)),eX(c),tc(!0),!0}}catch(e){return console.error("Error fetching payment settings:",e),e9(en("Error fetching payment settings")),!1}}}return e9(en("The branch is currently closed. You can place a scheduled order by clicking the button below")),!1}return e9(en("we_do_not_deliver")),!1}}catch(e){return console.error("Error in branches_deliveryapi:",e),e9(en("An error occurred")),!1}finally{e0(!1)}},tV=eZ&&(null==eZ?void 0:eZ.delivery_partner_id);if(ex)return(0,o.jsx)("div",{children:(0,o.jsx)(x.A,{bgColor:tA})});let tU=async e=>{t_(e),tm(!0),tp(e.delivery_instruction||"")},tW=async()=>{if(!tv)return;eh(!0);let e=(0,A.z)(),t=tv.external_number?1:2,l=JSON.stringify({restaurant_id:null==P?void 0:P.restaurant_id,address_id:tv.address_id,member_id:null==eK?void 0:eK.member_id,phone_number:(null==eK?void 0:eK.mobile_number)||(null==eK?void 0:eK.phone_number),sender_id:(null==eK?void 0:eK.mobile_number)||(null==eK?void 0:eK.phone_number),address:{formatted_address:tv.formatted_address,unit_number:tv.unit_number,latitude:tv.latitude,longitude:tv.longitude,zipcode:tv.zipcode,city:tv.city,state:tv.state,country:tv.country,external_number:tv.external_number,street:tv.street,address_type:tv.address_type,residence_building:tv.residence_building,address_label:tv.address_label,external_type:t,delivery_instruction:tg.trim()||""},session_id:e6,lang:ei,source:"EcomV2",version:eJ,ui_request_timestamp:new Date().toISOString()});try{let t="".concat(window.location.origin,"/"),n="https://order.foodbot.ai/apiv2";t&&(n=t+"apiv2");let i=await fetch("".concat(n,"/ecom/v1/address-update"),{method:"POST",headers:e,body:l,redirect:"follow"}),a=await i.json();if(200==a.status_code&&"success"==a.status){await tT(),eA("listClick"),localStorage.removeItem("dine_in_table"),localStorage.removeItem("dine_in_data"),localStorage.removeItem("scheduledOrder_".concat(h)),localStorage.setItem("current_scheduledOrder__".concat(h),"false");let e=tJ({...tv,delivery_instruction:tg.trim()||""}),t=await tH(e,!1,"clickedaddress");if(console.log("isValidAddress====",t),t){var o,r;null===(r=eZ.schedule_settingss)||void 0===r||null===(o=r.delivery)||void 0===o||o.status,tm(!1),t_(null),tp("")}
1else console.log("Address selected from list is invalid"),e9(en("The selected address is invalid.")),localStorage.removeItem("selected_branchmode_".concat(h)),localStorage.removeItem("branch_delivery_".concat(h)),localStorage.removeItem("scheduledOrder_".concat(h)),tm(!1),t_(null),tp("")}else{let e=e1(a.status_code);e9(a.message||e)}}catch(e){console.error("Error updating delivery instructions:",e),e9(en("An error occurred"))}finally{eh(!1)}};return(0,o.jsxs)(o.Fragment,{children:[e$&&(0,o.jsx)(I.A,{text:en("processing")}),(()=>{var e,t,l,r,n,i,a,s,d,c,u;let m=[null==B?void 0:null===(e=B.order_type_status)||void 0===e?void 0:e.some(e=>(null==e?void 0:e.pickup_status)==1),(null==B?void 0:null===(t=B.order_type_status)||void 0===t?void 0:t.some(e=>(null==e?void 0:e.dinein_status)==1))&&(null==B?void 0:null===(l=B.dinein_branches)||void 0===l?void 0:l.some(e=>{var t;return(null==e?void 0:null===(t=e.available_services)||void 0===t?void 0:t.qsr_status)==="yes"})),null==B?void 0:null===(r=B.order_type_status)||void 0===r?void 0:r.some(e=>(null==e?void 0:e.delivery_status)==1)].filter(Boolean).length;return(0,o.jsxs)("div",{className:"grid border-t-1 border-t-white ".concat(1===m?"grid-cols-1":2===m?"grid-cols-2":"grid-cols-3"," h-16 lg:rounded-t-none rounded-t-3xl z-80 sticky top-0 border-b border-black w-full"),children:[(null==B?void 0:null===(n=B.order_type_status)||void 0===n?void 0:n.some(e=>(null==e?void 0:e.pickup_status)===1))&&(0,o.jsxs)("div",{onClick:()=>{tP("pickup"),ti(!1)},className:" flex flex-col lg:flex-row items-center justify-center text-center lg:text-left cursor-pointer px-3 py-4 lg:py-3 gap-1 w-full border border-b lg:border-b-1 lg:border-r ",style:{backgroundColor:"pickup"===et?tE:tA,color:"pickup"===et?tL:tk,borderColor:"".concat(tk,"30")},children:[(0,o.jsx)("div",{className:"mb-2 lg:mb-0 lg:mr-2",children:(0,o.jsx)(F.A,{mode:"pickup",isActive:"pickup"===et,activeColor:tL,inactiveColor:tk})}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{style:{fontFamily:"".concat(tI,", sans-serif")},className:"font-bold",children:[en("pick_up_at"),":"]}),(0,o.jsx)("div",{style:{color:"pickup"===et&&tB||tC,fontFamily:"".concat(tI,", sans-serif")},className:"text-sm font-bold",children:(null==e7?void 0:null===(i=e7.branch)||void 0===i?void 0:i.pickup_time_estimate)?"".concat(Number(e7.branch.pickup_time_estimate)," - ").concat(Number(e7.branch.pickup_time_estimate)+10," ").concat(en("time_unit_min")):null})]})]}),(null==B?void 0:null===(a=B.order_type_status)||void 0===a?void 0:a.some(e=>(null==e?void 0:e.dinein_status)===1))&&(null==B?void 0:null===(s=B.dinein_branches)||void 0===s?void 0:s.some(e=>{var t;return(null==e?void 0:null===(t=e.available_services)||void 0===t?void 0:t.qsr_status)==="yes"}))&&(0,o.jsxs)("div",{onClick:()=>{tP("dinein"),ti(!1)},className:"flex flex-col border lg:flex-row items-center justify-center text-center lg:text-left cursor-pointer border-r w-full ".concat((null==B?void 0:null===(d=B.order_type_status)||void 0===d?void 0:d.some(e=>(null==e?void 0:e.delivery_status)===1))?"":"rounded-se-3xl lg:rounded-se-none"),style:{backgroundColor:"dinein"===et?tE:tA,color:"dinein"===et?tL:tk,borderColor:"".concat(tk,"30")},children:[(0,o.jsx)("div",{className:"mb-2 lg:mb-0 lg:mr-2",children:(0,o.jsx)(F.A,{mode:"dinein",isActive:"dinein"===et,activeColor:tL,inactiveColor:tk})}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{style:{fontFamily:"".concat(tI,", sans-serif")},className:"font-bold",children:[en("dine_in"),":"]}),(0,o.jsx)("div",{style:{color:"dinein"===et&&tB||tC,fontFamily:"".concat(tI,", sans-serif")},className:"text-sm font-bold",children:(null==e7?void 0:null===(c=e7.branch)||void 0===c?void 0:c.pickup_time_estimate)?"".concat(Number(e7.branch.pickup_time_estimate)," - ").concat(Number(e7.branch.pickup_time_estimate)+10," ").concat(en("time_unit_min")):null})]})]}),(null==B?void 0:null===(u=B.order_type_status)||void 0===u?void 0:u.some(e=>(null==e?void 0:e.delivery_status)===1))&&(0,o.jsxs)("div",{onClick:()=>tP("delivery"),className:"flex flex-col lg:flex-row items-center border-b justify-center cursor-pointer rounded-se-3xl lg:rou
1nded-se-none text-center lg:text-left w-full",style:{backgroundColor:"delivery"===et?tE:tA,color:"delivery"===et?tL:tk,borderColor:"".concat(tk,"30")},children:[(0,o.jsx)("div",{className:"mb-2 lg:mb-0 lg:mr-4",children:(0,o.jsx)(F.A,{mode:"delivery",isActive:"delivery"===et,activeColor:tL,inactiveColor:tk})}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{style:{fontFamily:"".concat(tI,", sans-serif")},className:"font-bold",children:[en("delivery"),":"]}),(0,o.jsx)("div",{style:{color:"delivery"===et&&tB||tC,fontFamily:"".concat(tI,", sans-serif")},className:"text-sm font-bold",children:(null==tV?void 0:tV.length)>0?"".concat(Number(null==eZ?void 0:eZ.delivery_time_estimate)," - ").concat(Number(null==eZ?void 0:eZ.delivery_time_estimate)+10," ").concat(en("time_unit_min")):null})]})]})]})})(),Q&&(0,o.jsxs)("div",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tk},className:"p-4 ",children:[en("do_you_want_to_pick_it_up_or_have_us_deliver_it_to_you")," ",(0,o.jsx)("span",{className:"font-bold",style:{color:tC},children:en("choose_an_option")})]}),(0,o.jsxs)("div",{ref:tf,className:"xl:block h-[400px] xl:h-[600px] custom-scrollbar ".concat(tb?"overflow-y-auto":" "),style:{"--scrollbar-thumb-color":tC,backgroundColor:tA},children:[(0,o.jsx)("div",{className:"",style:{backgroundColor:tA},children:("pickup"===et||"dinein"===et)&&((null==B?void 0:null===(p=B.order_type_status)||void 0===p?void 0:p.some(e=>"pickup"===et&&1==e.pickup_status||"dinein"===et&&1==e.dinein_status))?(0,o.jsx)("div",{className:"",children:(0,o.jsx)(y,{addresses:eG,primaryColor:tk,descriptionColor:tM,fontFamily:tI,setGetBranchId:eV,setGetMode:eW,setOpen:T,getMode:eU,getBranchId:eH,schedule:null==G?void 0:G.schedule_settings,setOpenScheduleOrder:ts,secondaryBtnTxtColor:tO,secondaryBtnColor:tF,searchValue:eN,onSearchChange:e=>ek(e),openScheduleOrder:ta,secondaryColor:tC,bgColor:tA,ErrorPrimaryColor:tD,ErrorSecondaryColor:tz,alias:h,checkItemurl:Q,setCheckItemurl:$,isDineInMode:eo,onLocationRequest:"cartpagevalidate"===X?void 0:async()=>{if(ee){e0(!0);try{await ee(),T(!1)}finally{e0(!1)}}}})}):(0,o.jsx)("div",{className:"h-[400px] flex items-center justify-center p-4",children:(0,o.jsxs)("div",{className:"bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg p-8 max-w-md w-full text-center",children:[(0,o.jsx)("h2",{className:"text-2xl font-semibold text-gray-800 mb-2",children:en("pickup_unavailable_title")}),(0,o.jsx)("p",{className:"text-gray-600 leading-relaxed",children:en("pickup_unavailable_message")})]})}))}),(0,o.jsx)("div",{className:"",style:{backgroundColor:tA},children:"delivery"===et&&((null==B?void 0:null===(f=B.order_type_status)||void 0===f?void 0:f.some(e=>1!==e.delivery_status))?(0,o.jsx)("div",{className:" h-[400px] flex items-center justify-center p-4",children:(0,o.jsxs)("div",{className:"bg-white/80 backdrop-blur-sm rounded-2xl shadow-lg p-8 max-w-md w-full text-center",children:[(0,o.jsx)("h2",{className:"text-2xl font-semibold text-gray-800 mb-2",children:en("delivery_unavailable_title")}),(0,o.jsx)("p",{className:"text-gray-600 leading-relaxed",children:en("delivery_unavailable_message")})]})}):tn&&"addressadded"==eC?(0,o.jsx)("div",{children:tn&&"addressadded"==eC&&(0,o.jsx)(O,{selectedBranch:eZ,setOpenScheduleDeliveryOrder:ti,setGetBranchId:eV,setGetMode:eW,setIsOpen:T,secondaryBtnColor:tF,secondaryBtnTxtColor:tO,primaryColor:tk,fontFamily:tI,resId:null==P?void 0:P.restaurant_id,bgColor:tA,openFailureModalFunc:e9,secondaryColor:tC,setGetBranchDelivery:eX,ErrorPrimaryColor:tD,validateCartItemsAgainstMenu:H,setCartItemDetails:V,setIsCartUpdated:U,setSaveCartCal:W,setTaxDetails:Z,cartpagevalidate:X,sessionID:e6,saveCartCal:K,checkitemurl:Q,setCheckItemurl:$})}):(0,o.jsx)("div",{children:eS&&"verified"==eC?(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"flex justify-start pt-4",children:(0,o.jsxs)("div",{onClick:()=>{ej(!1),S(""),e_({})},className:"flex my-auto px-4 ",children:[(0,o.jsx)("svg",{width:"8",height:"10",className:"my-auto mr-2",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)("path",{d:"M6.52548 1.47452L2 6L6.52548 10.5255",stroke:tk,strokeWidth:"2.5","stroke-linejoin":"round"})}),(0,o.jsx)("div",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tk},className:"my-auto text-[14px] font-bold",children:en("go_back")})]})}),(0,o.jsxs)("div",{className:"px-4 py-4",children:[(0,o.jsxs)("div",{className:"",children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:[en("direction"),"*"]}),(0,o.jsx)("div",{className:"flex pt-1",children:(0,o.jsxs)("div",{className:"w-full",children:[(0,o.jsx)(u.Autocomplete,{onLoad:e=>{L.current=e},onPlaceChanged:tq,options:{componentRestrictions:{country:null==P?void 0:P.country_prefix}},children:(0,o.jsx)("input",{type:"text",className:"w-full font-`${}` p-3 mt-0.5 rounded-lg font-bold bg-lightGray",placeholder:en("enter_your_street_address"),value:w||"",onChange:e=>{S(e.target.value),e_(t=>({...t,formatted_address:e.target.value})),eM(e=>({...e,formattedaddress:!1}))},style:{fontFamily:"".concat(tI,", sans-serif")},required:!0})}),eI.formattedaddress&&(0,o.jsxs)("p",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",en("Address is required")]})]})}),(0,o.jsx)("div",{className:"mt-2 text-sm",style:{color:tM,fontFamily:"".concat(tI,", sans-serif")},children:w})]}),(0,o.jsxs)("div",{children:[tt&&(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:[en("external_number"),"*"]}),(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-1 rounded-lg font-bold bg-lightGray",placeholder:en("enter_external_number"),value:ev.external_number||"",onChange:e=>{e_(t=>({...t,external_number:e.target.value})),eM(e=>({...e,external_number:!1}))},required:!0}),eI.external_number&&(0,o.jsxs)("p",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",en("External_number_is_required")]})]}),to&&(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:[en("city"),"*"]}),(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-1 rounded-lg font-bold bg-lightGray",placeholder:en("enter_city"),value:ev.city||"",onChange:e=>{e_(t=>({...t,city:e.target.value})),eM(e=>({...e,city:!1}))},required:!0}),eI.city&&(0,o.jsxs)("p",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",en("City is required")]})]})]}),eB&&(0,o.jsx)("div",{className:"mt-4",children:(0,o.jsxs)("div",{className:"grid grid-cols-3 gap-x-4",children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-semibold text-sm",children:[en("lote"),"*"]}),(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-0.5 rounded-lg bg-lightGray",placeholder:en("lote_placeholder"),value:eF,maxLength:20,onChange:e=>{eO(e.target.value),eM(e=>({...e,lote:!1}))}}),eI.lote&&(0,o.jsxs)("p",{style:{color:tD,fontFamily:"".concat(tI,", sans-serif")},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})}),en("lote_required")]})]}),(0,o.jsxs)("div",{children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-semibold text-sm",children:[en("manzana"),"*"]}),(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-0.5 rounded-lg bg-lightGray",placeholder:en("manzana_placeholder"),value:eD,maxLength:20,onChange:e=>{ez(e.target.value),eM(e=>({...e,manzana:!1}))}}),eI.manzana&&(0,o.jsxs)("p",{style:{color:tD,fontFamily:"".concat(tI,", sans-serif")},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})}),en("manzana_required")]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-semibold text-sm",children:en("supermanzana")}),(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-0.5 rounded-lg bg-lightGray",placeholder:en("supermanzana_placeholder"),value:eE,maxLength:20,onChange:e=>eL(e.target.value)})]})]})}),(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:[en("type_of_resident"),"*"]}),(0,o.jsxs)("div",{className:"relative pt-1",children:[(0,o.jsxs)("select",{required:!0,className:"w-full p-3 mt-0.5 rounded-lg bg-lightGray appearance-none",value:ev.address_type||"",onChange:e=>{ep(e.target.value),e_(t=>({...t,address_type:e.target.value})),eM(e=>({...e,department:!1}))},children:[(0,o.jsx)("option",{value:"",disabled:!0,className:"font-semibold text-sm ",children:en("Select one")}),eR.map(e=>(0,o.jsx)("option",{value:e.value,children:e.label},e.value))]}),(0,o.jsx)("div",{className:"absolute inset-y-0 top-3 right-2 flex items-center px-2 pointer-events-none",children:(0,o.jsx)("svg",{width:"11",height:"7",viewBox:"0 0 11 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)("path",{d:"M5.5 7L10.2631 0.25H0.73686L5.5 7Z",fill:"black"})})})]}),eI.department&&(0,o.jsxs)("p",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",en("Department is required")]})]}),(0,o.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 ",children:[(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsx)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:en("interior_number")}),(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-1 rounded-lg font-bold bg-lightGray",placeholder:"#",value:ev.unit_number,maxLength:25,onChange:e=>e_(t=>({...t,unit_number:e.target.value}))})]}),(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsxs)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:[en("alias"),"*"]}),(0,o.jsx)("input",{required:!0,type:"text",className:"w-full p-3 mt-1 rounded-lg font-bold bg-lightGray",placeholder:en("office"),value:ev.address_label||"",onChange:e=>{e_(t=>({...t,address_label:e.target.value})),eM(e=>({...e,alias:!1}))}}),eI.alias&&(0,o.jsxs)("p",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",en("Alias is required")]})]})]}),(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsx)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:en("delivery_instructions")}),(0,o.jsx)("textarea",{className:"w-full p-3 mt-1 rounded-lg bg-lightGray font-bold",placeholder:en("write_something_we_need_to_know"),value:tg,onChange:e=>{tp(e.target.value),e_(t=>({...t,locality:e.target.value}))},rows:4,maxLength:250,style:{fontFamily:"".concat(tI,", sans-serif")}}),(0,o.jsxs)("div",{className:"text-xs mt-1",style:{color:tM,fontFamily:"".concat(tI,", sans-serif")},children:[tg.length,"/250"]})]}),eu&&(0,o.jsxs)("div",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"
1currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",eu]}),(0,o.jsx)("div",{className:"flex justify-around",children:(0,o.jsx)("div",{className:"flex justify-center mt-8",children:(0,o.jsx)("button",{className:"text-sm font-black py-2.5 px-5 rounded-3xl",style:{backgroundColor:ef?"rgba(".concat(tN(tF).rgb,", 0.6)"):tF,color:ef?"rgba(".concat(tN(tO).rgb,", 0.6)"):tO,fontFamily:"".concat(tI,", sans-serif"),cursor:ef?"not-allowed":"pointer",transition:"all 0.3s ease"},onClick:()=>{tj(),tG(Q)},type:"button",disabled:ef,children:ef?"".concat(en("saving"),"..."):en("save")})})})]})]}):tu?(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:"flex justify-start pt-4",children:(0,o.jsxs)("div",{onClick:()=>{tm(!1),t_(null),tp("")},className:"flex my-auto px-4 ",children:[(0,o.jsx)("svg",{width:"8",height:"10",className:"my-auto mr-2",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)("path",{d:"M6.52548 1.47452L2 6L6.52548 10.5255",stroke:tk,strokeWidth:"2.5",strokeLinejoin:"round"})}),(0,o.jsx)("div",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tk},className:"my-auto text-[14px] font-bold",children:en("go_back")})]})}),(0,o.jsxs)("div",{className:"px-4 py-4",children:[(0,o.jsxs)("div",{className:"mb-4",children:[(0,o.jsx)("div",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-lg mb-2",children:null==tv?void 0:tv.address_label}),(0,o.jsx)("div",{style:{color:tM,fontFamily:"".concat(tI,", sans-serif")},className:"text-sm",children:null==tv?void 0:tv.formatted_address})]}),(0,o.jsxs)("div",{className:"mt-4",children:[(0,o.jsx)("label",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-sm",children:en("delivery_instructions")}),(0,o.jsx)("textarea",{className:"w-full p-3 mt-1 rounded-lg bg-lightGray font-bold",placeholder:en("write_something_we_need_to_know"),value:tg,onChange:e=>tp(e.target.value),rows:4,maxLength:250,style:{fontFamily:"".concat(tI,", sans-serif")}}),(0,o.jsxs)("div",{className:"text-xs mt-1",style:{color:tM,fontFamily:"".concat(tI,", sans-serif")},children:[tg.length,"/250"]})]}),(0,o.jsx)("div",{className:"flex justify-center mt-8",children:(0,o.jsx)("button",{className:"text-sm font-black py-2.5 px-8 rounded-3xl",style:{backgroundColor:tF,color:tO,fontFamily:"".concat(tI,", sans-serif")},onClick:tW,type:"button",children:en("continue")})})]})]}):(0,o.jsxs)("div",{className:"".concat(ea.length>0||!J?"h-screen":"","bg-").concat(tA),children:[(0,o.jsx)("div",{className:"pt-8 px-4 lg:mt-0 mt-12",children:(0,o.jsx)("div",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:" font-black pb-3 text-lg",children:en("deliver_to")})}),(0,o.jsxs)("div",{className:"flex justify-between px-4",children:[(0,o.jsxs)("div",{className:"w-[80%]",children:[(0,o.jsx)(u.Autocomplete,{onLoad:e=>{L.current=e},onPlaceChanged:tq,options:{componentRestrictions:{country:null==P?void 0:P.country_prefix}},children:(0,o.jsx)("input",{type:"text",className:"w-full p-3 mt-0.5 rounded-lg font-bold bg-lightGray",placeholder:en("enter_your_street_address"),value:w||"",onChange:e=>{S(e.target.value),e_(t=>({...t,formatted_address:e.target.value})),eM(e=>({...e,formattedaddress:!1}))},style:{fontFamily:"".concat(tI,", sans-serif")},required:!0})}),eI.formattedaddress&&(0,o.jsxs)("p",{style:{fontFamily:"".concat(tI,", sans-serif"),color:tD},className:"text-start mt-2 text-sm flex",children:[(0,o.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-5 w-5 mr-3",children:(0,o.jsx)("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})})," ",en("Address is required")]})]}),(0,o.jsx)("div",{className:"w-[20%]",children:(0,o.jsx)("div",{onClick:()=>
1{if(!tw()){console.warn("Google Maps API not loaded yet"),q(en("Google Maps is not available"));return}navigator.geolocation?navigator.geolocation.getCurrentPosition(async e=>{try{let{latitude:t,longitude:l}=e.coords,o=new google.maps.Geocoder,r=new google.maps.LatLng(t,l);o.geocode({location:r},async(e,o)=>{if(o===google.maps.GeocoderStatus.OK&&(null==e?void 0:e[0])){var r,n,i,a,s,d,c,u,m,v,_,g;let o=e[0].formatted_address;S(o),eb(o);let p=null===(n=e[0].address_components)||void 0===n?void 0:null===(r=n.find(e=>e.types.includes("street_number")))||void 0===r?void 0:r.long_name,f=null===(a=e[0].address_components)||void 0===a?void 0:null===(i=a.find(e=>e.types.includes("locality")))||void 0===i?void 0:i.long_name,h=(null===(d=e[0].address_components)||void 0===d?void 0:null===(s=d.find(e=>e.types.includes("administrative_area_level_2")))||void 0===s?void 0:s.long_name)||"",y=eP.includes((f||"").toLowerCase())||eP.includes(h.toLowerCase())||eP.some(e=>(o||"").toLowerCase().includes(e));eY(y),y||(eO(""),ez(""),eL("")),tl(!p),tr(!f),e_(r=>{var n,i,a,s,d,c;return{...r,formatted_address:o||"",street:e[0].name||"",latitude:t||"",longitude:l||"",city:f||"",state:(null===(i=e[0].address_components)||void 0===i?void 0:null===(n=i.find(e=>e.types.includes("administrative_area_level_1")))||void 0===n?void 0:n.long_name)||"",country:(null===(s=e[0].address_components)||void 0===s?void 0:null===(a=s.find(e=>e.types.includes("country")))||void 0===a?void 0:a.long_name)||"",zipcode:(null===(c=e[0].address_components)||void 0===c?void 0:null===(d=c.find(e=>e.types.includes("postal_code")))||void 0===d?void 0:d.long_name)||"",external_number:p||"",unit_number:r.unit_number||"",address_type:r.address_type||"house"}});let b={formatted_address:o||"",latitude:t||"",longitude:l||"",street:e[0].name||"",external_number:p||"",city:f||"",state:(null===(u=e[0].address_components)||void 0===u?void 0:null===(c=u.find(e=>e.types.includes("administrative_area_level_1")))||void 0===c?void 0:c.long_name)||"",country:(null===(v=e[0].address_components)||void 0===v?void 0:null===(m=v.find(e=>e.types.includes("country")))||void 0===m?void 0:m.long_name)||"",zipcode:(null===(g=e[0].address_components)||void 0===g?void 0:null===(_=g.find(e=>e.types.includes("postal_code")))||void 0===_?void 0:_.long_name)||"",unit_number:"",address_type:"house"};await tH(b,!1,"manual")?(ej(!0),eA("verified"),tp(""),console.log("Current location validated successfully")):(console.log("Current location is invalid for delivery"),e9(en("we_do_not_deliver")),eA("notverified"),setTimeout(()=>{eb(""),S(""),e_({})},500))}else console.error("Geocoder failed due to: "+o),e9(en("Unable to get your current location"))})}catch(e){console.error("Error processing geolocation:",e),q(en("Error processing your location"))}},e=>{console.error("Error getting user location:",e),e9(en("Unable to get your current location"))}):(console.error("Geolocation is not supported by this browser."),e9(en("Geolocation is not supported by your browser")))},style:{color:tC,backgroundColor:tk},className:"h-12 w-12 ml-4 rounded-full flex items-center justify-center",children:(0,o.jsx)("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)("path",{d:"M1.40039 7.1712L15.8004 1L9.62919 15.4L8.60039 8.2L1.40039 7.1712Z",stroke:tC,strokeWidth:"1.8",strokeLinejoin:"round"})})})})]}),(0,o.jsx)("div",{className:"mt-2 px-6 text-sm",style:{color:tM},children:w}),(0,o.jsxs)("div",{className:"px-4 py-4 border-b",children:[(0,o.jsx)("div",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-bold text-lg ",children:en("my_addresses")}),J?"":(0,o.jsx)("div",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},onClick:()=>{R(!0),localStorage.setItem("changemode","true")},className:"underline pt-1 ",children:en("login_add_address")})]}),ea.length>0?ea.map((e,t)=>{var l,r;let n=localStorage.getItem("branch_delivery_".concat(h)),i=n?JSON.parse(n):null;return i&&Array.isArray(i.delivery_partner_id)&&i.delivery_partner_id.length>0&&(null===(r=i.schedule_settingss)||void 0===r||null===(l=r.delivery)||void 0===l||l.status),(0,o.jsx)("div",{className:"p-5 border-b gap-x-3 border-[#D0D0D0]",children:(0,o.jsxs)("div",{onClick:()=>tU(e),className:"w-[80%] cursor-pointer",children:[(0,o.jsx)("div",{style:{color:tk,fontFamily:"".concat(tI,", sans-serif")},className:"font-black text-lg cursor-pointer",children:e.address_label}),(0,o.jsx)("div",{style:{color:tM,fontFamily:"".concat(tI,", sans-serif")},className:"text-sm",children:e.street}),(0,o.jsx)("div",{style:{color:tM,fontFamily:"".concat(tI," , sans-serif")},className:"text-sm pb-3 leading-4",children:e.formatted_address})]})},t)}):(0,o.jsx)("div",{children:J&&(0,o.jsx)(N,{fontFamily:tI,primaryColor:tk})})]})}))})]})]})}},46240:(e,t,l)=>{l.d(t,{A:()=>a});var o=l(74848),r=l(96540),n=l(18051),i=l.n(n);let a=e=>{let[t,l]=(0,r.useState)(null);return((0,r.useEffect)(()=>{(async()=>{let e=await fetch("https://res.cloudinary.com/http-foodbot-ai/raw/upload/v1752233991/Food_animation_p31gdz.json");l(await e.json())})()},[]),t)?(0,o.jsx)("div",{style:{backgroundColor:e.bgColor||"#fff",width:"100%",display:"flex",justifyContent:"center",alignItems:"center",height:"85vh"},children:(0,o.jsx)(i(),{animationData:t,loop:!0,autoplay:!0,style:{height:300,width:300}})}):null}},22252:(e,t,l)=>{l.r(t),l.d(t,{default:()=>h});var o=l(74848),r=l(96540),n=l(84345),i=l(77255),a=l(11962),s=l(74353),d=l.n(s),c=l(37872),u=l.n(c),m=l(8906),v=l.n(m),_=l(90445),g=l.n(_);l(47317),l(56007);var p=l(6210);d().locale("es"),d().extend(u()),d().extend(v()),d().extend(g());let f={SLOT_INTERVAL:30,MOVE_AHEAD_TIME:10,MAX_DAYS:5,SLOT_START_AFTER_OPEN:30},h=e=>{var t,l,s,c;let{selectedBranch:u,setOpenScheduleOrder:m,setGetBranchId:v,setGetMode:_,fontFamily:g,primaryColor:h,secondaryColor:y,secondaryBtnTxtColor:b,secondaryBtnColor:x,bgColor:w,ErrorPrimaryColor:S,checkitemurl:j,setCheckItemurl:N,isDineInMode:k}=e,[C,A]=(0,r.useState)([]),[I,M]=(0,r.useState)([]),[F,O]=(0,r.useState)(""),[D,z]=(0,r.useState)(""),[E,L]=(0,r.useState)(!1),[B,Y]=(0,r.useState)(null),[P,T]=(0,r.useState)(!1),{t:q}=(0,i.Bd)(),{currentLang:J}=(0,p.ok)(),R=(0,r.useRef)(null);(0,r.useEffect)(()=>{R.current&&R.current.scrollIntoView({behavior:"smooth",block:"start"})},[]),console.log("rendering ScheduleOrder",null==u?void 0:u.branch_name);let G=e=>{let[,t]=e.split(", "),l=d()(t,"YYYY-MM-DD"),o=d()().startOf("day");if(l.isSame(o,"day"))return q("today");switch(J){case"es":default:return l.format("D [de] MMMM");case"zh":return l.format("MæDæ¥");case"en":return l.format("MMMM D")}},H=(0,r.useCallback)(e=>{if(!Array.isArray(null==u?void 0:u.branch_business_hours))return null;let t=e.day(),l=u.branch_business_hours.find(e=>e.day==t||e.day.toString()===t.toString());return l&&1===l.status?{open:d()(l.open_time,"HH:mm:ss"),close:d()(l.close_time,"HH:mm:ss")}:null},[null==u?void 0:u.branch_business_hours]),V=(0,r.useCallback)(()=>
1{if(!Array.isArray(null==u?void 0:u.branch_business_hours))return!0;let e=d()(),t=H(e);if(t){let l=t.open.year(e.year()).month(e.month()).date(e.date()),o=t.close.year(e.year()).month(e.month()).date(e.date());if(o.isBefore(l)&&(o=o.add(1,"day")),e.isBetween(l,o,null,"[)"))return!1}let l=e.subtract(1,"day"),o=H(l);if(o){let t=o.open.year(l.year()).month(l.month()).date(l.date()),r=o.close.year(l.year()).month(l.month()).date(l.date());if(r.isBefore(t)&&(r=r.add(1,"day"),e.isBetween(t,r,null,"[)")))return!1}return!0},[null==u?void 0:u.branch_business_hours,H]),U=(0,r.useCallback)(e=>{if(!(null==u?void 0:u.branch_business_hours)||!Array.isArray(null==u?void 0:u.branch_business_hours))return!1;let t=e.getDay(),l=u.branch_business_hours.find(e=>e.day==t||e.day.toString()===t.toString());return l&&1===l.status},[null==u?void 0:u.branch_business_hours]),W=(0,r.useCallback)((e,t,l)=>{var o,r,n;let i=[],a=(null==u?void 0:null===(o=u.schedule_settings)||void 0===o?void 0:o.slot_interval)||f.SLOT_INTERVAL,s=(null==u?void 0:null===(r=u.schedule_settings)||void 0===r?void 0:r.move_aheadtime)||f.MOVE_AHEAD_TIME,c=(null==u?void 0:null===(n=u.schedule_settings)||void 0===n?void 0:n.slot_start_after_open)||f.SLOT_START_AFTER_OPEN,m=d()(t,"HH:mm:ss").year(e.year()).month(e.month()).date(e.date()).add(c,"minute"),v=d()(l,"HH:mm:ss").year(e.year()).month(e.month()).date(e.date());v.isBefore(m)&&(v=v.add(1,"day"));let _=d()().add(s,"minute"),g=m.minute()%a;g>0&&(m=m.add(a-g,"minute"));let p=0;for(;(m.isBefore(v)||m.isSame(v))&&p<400;){if(m.isAfter(_)){let t=12>m.hour()?"AM":"PM",l=m.hour()%12||12,o=m.minute().toString().padStart(2,"0"),r="".concat(l,":").concat(o," ").concat(t),n=!m.isSame(e,"day");i.push({time:r,isNextDay:n,fullDate:m})}m=m.add(a,"minute"),p++}return i},[null==u?void 0:u.schedule_settings]);(0,r.useEffect)(()=>{T(V())},[V]),(0,r.useEffect)(()=>{var e,t,l,o;if(!(null==u?void 0:u.branch_business_hours)||!Array.isArray(u.branch_business_hours)){Y("Business hours are not available"),A([]),O("");return}let r=d()(),n=k?(null==u?void 0:null===(t=u.schedule_settings)||void 0===t?void 0:null===(e=t.dinein)||void 0===e?void 0:e.days)||f.MAX_DAYS:(null==u?void 0:null===(o=u.schedule_settings)||void 0===o?void 0:null===(l=o.pickup)||void 0===l?void 0:l.days)||f.MAX_DAYS,i=[],a=d()(r),s=0,c=2*n;for(;s<n&&c>0;){if(U(a.toDate())){let e=a.format("dddd"),t="".concat(e,", ").concat(a.format("YYYY-MM-DD"));i.push(t),s++}a=a.add(1,"day"),c--}0===s&&Y(q("No available dates found within the allowed period")),A(i),i.length>0?O(i[0]):O("")},[k,null==u?void 0:null===(l=u.schedule_settings)||void 0===l?void 0:null===(t=l.pickup)||void 0===t?void 0:t.days,null==u?void 0:null===(c=u.schedule_settings)||void 0===c?void 0:null===(s=c.dinein)||void 0===s?void 0:s.days,null==u?void 0:u.branch_business_hours,U,q]),(0,r.useEffect)(()=>{if(u&&F){let e=F.split(", ")[1],t=d()(e,"YYYY-MM-DD"),l=t.isSame(d()(),"day"),o=[],r=H(t);if(r&&(o=[...o,...W(t,r.open.format("HH:mm:ss"),r.close.format("HH:mm:ss"))]),l){let e=t.subtract(1,"day"),l=H(e);l&&(o=[...W(e,l.open.format("HH:mm:ss"),l.close.format("HH:mm:ss")).filter(e=>e.fullDate.isSame(t,"day")),...o])}o.sort((e,t)=>e.fullDate.valueOf()-t.fullDate.valueOf());let n=o.map(e=>e.time),i=[];M(i=Array.from(new Set(i=l&&!P&&n.length>0?[q("now"),...n]:n))),i.length>0?z(i[0]):(z(""),Y(q("No available time slots for selected date")))}},[u,F,W,P,q,H]);let Z=async()=>{if(u&&F&&D){L(!0);try{let e=F.split(", ")[1],t=e;if(D!==q("now")){let l=D.match(/(\d+):(\d+)\s*(AM|PM)/i);if(l){let o=parseInt(l[1]),r=parseInt(l[2]),n=l[3].toUpperCase();"PM"===n&&12!==o?o+=12:"AM"===n&&12===o&&(o=0);let i=d()(e,"YYYY-MM-DD"),a=H(i);if(a){let e=d()(a.open,"HH:mm:ss");if(i.isSame(d()(),"day")){let e=i.hour(o).minute(r),l=i.add(1,"day").hour(o).minute(r);t=e.isAfter(d()())?e.format("YYYY-MM-DD"):l.format("YYYY-MM-DD")}else(o<e.hour()||0===o&&e.hour()>12)&&(t=i.add(1,"day").format("YYYY-MM-DD"))}}}let l={...u,scheduledDate:t,scheduledTime:D===q("now")?"ASAP":D,is_schedule:!0};localStorage.setItem("scheduledOrder_".concat((0,n.o)()),JSON.stringify({date:t,time:D===q("now")?"ASAP":D,branch:u})),v(l),_(k?"dinein":"pickup"),m(!1),j&&localStorage.setItem("item_url_".concat((0,n.o)()),j),setTimeout(()=>{N(!1)},300)}catch(e){console.error("Error scheduling order:",e),Y(q("Failed to schedule order. Please try again."))}finally{L(!1)}}},X=e=>{let[,t]=e.split(", ");return d()(t,"YYYY-MM-DD").isSame(d()(),"day")};return(0,o.jsxs)("div",{style:{backgroundColor:w},ref:R,className:"p-4",children:[(0,o.jsxs)("header",{onClick:()=>m(!1),className:"mb-6 flex items-center cursor-pointer",children:[(0,o.jsx)("svg",{width:"8",he
1ight:"12",viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)("path",{d:"M6.52548 1.47452L2 6L6.52548 10.5255",stroke:h,"stroke-width":"2.5","stroke-linejoin":"round"})}),(0,o.jsx)("span",{style:{color:h},className:"ml-2 text-[16px] font-black",children:q("go_back")})]}),(0,o.jsxs)("main",{children:[(0,o.jsxs)("div",{className:"flex items-center gap-3",children:[(0,o.jsx)("h1",{style:{color:h,fontFamily:"".concat(g,", sans-serif")},className:"text-2xl font-black",children:null==u?void 0:u.branch_name}),P&&(0,o.jsx)("span",{style:{color:S},className:"text-2xl font-black rounded-full",children:"- Cerrado"})]}),(0,o.jsx)("p",{style:{color:h,fontFamily:"".concat(g,", sans-serif")},className:"mt-3 text-[14px]",children:q(k?"Schedule your dine in order for later":"Schedule your pickup order for later")}),(0,o.jsx)("p",{style:{color:h,fontFamily:"".concat(g,", sans-serif")},className:"mb-3 text-[14px]",children:q("next_schedule")}),B&&(0,o.jsx)("div",{className:"mb-4 p-3 rounded-lg bg-red-50 border border-red-200",style:{fontFamily:"".concat(g,", sans-serif"),color:S},children:B}),(0,o.jsxs)("div",{className:"mb-6 flex flex-row space-x-4",children:[(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsxs)("label",{style:{color:h,fontFamily:"".concat(g,", sans-serif")},htmlFor:"date",className:"mb-2 block font-bold",children:[q("date"),"*"]}),(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsx)("select",{id:"date",className:"w-full appearance-none rounded-lg border border-gray-300 bg-white p-3 pr-10 focus:border-blue-500 focus:outline-none",value:F,onChange:e=>{O(e.target.value),Y(null)},children:C.map(e=>(0,o.jsx)("option",{value:e,children:G(e)},e))}),(0,o.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:(0,o.jsx)("svg",{width:"10",height:"7",viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-gray-400",children:(0,o.jsx)("path",{d:"M5.18529 7L9.67588 0.25H0.694696L5.18529 7Z",fill:h})})})]})]}),(0,o.jsxs)("div",{className:"flex-1",children:[(0,o.jsxs)("label",{style:{color:h,fontFamily:"".concat(g,", sans-serif")},htmlFor:"time",className:"mb-2 block font-bold",children:[q("time"),"*"]}),(0,o.jsxs)("div",{className:"relative",children:[(0,o.jsxs)("select",{id:"time",className:"w-full appearance-none rounded-lg border border-gray-300 bg-white p-3 pr-10 focus:border-blue-500 focus:outline-none",value:D,onChange:e=>{z(e.target.value),Y(null)},children:[(0,o.jsx)("option",{value:"",disabled:!0,children:"Selecciona un horario"}),I.length>0?I.map((e,t)=>(0,o.jsx)("option",{value:e,children:0===t&&X(F)&&!P?q("now"):e},e)):(0,o.jsx)("option",{value:"",children:q("No available time slots")})]}),(0,o.jsx)("div",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3",children:(0,o.jsx)("svg",{width:"10",height:"7",viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,o.jsx)("path",{d:"M5.18529 7L9.67588 0.25H0.694696L5.18529 7Z",fill:h})})})]})]})]}),(0,o.jsx)("div",{className:"lg:mt-[130px] mt-[100px] flex justify-center",children:(0,o.jsx)("button",{style:{color:b,backgroundColor:x,fontFamily:"".concat(g,", sans-serif")},onClick:Z,disabled:!F||!D||E,className:"relative w-fit rounded-full py-3 px-8 font-black focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 transition-opacity duration-200",children:E?q("Scheduling"):q("send")})})]}),E&&(0,o.jsx)(a.A,{text:q("Scheduling")})]})}},27528:(e,t,l)=>{l.d(t,{_:()=>n});var o=l(49505),r=l(8083);let n=async(e,t,l,n,i,a,s,d)=>{let c=(0,o.z)(),u="https://order.foodbot.ai/apiv2";d&&(u=d+"apiv2");let m=JSON.stringify({is_pos:2,restaurant_id:l||"",branch_id:t||"",brand_id:n||"",order_type:"pickup"==i?"takeout":"delivery"==i?"delivery":"dinein"==i?"dinein":"takeout",alias:e||"",session_id:a||"",version:s||"",source:"EcomV2",api_source:"EcomV2",request_timestamp:new Date().toISOString()}),v=await fetch("".concat(u,"/ecom/v1/restaurant-menu"),{method:"POST",headers:c,body:m,redirect:"follow"});try{let t=await v.json();if(201===t.status_code)return console.log("No menu available for this branch (201 status)"),{data:{menu_type:[],upselling:[],upselling_rules:[]},status:201};if(!v.ok)return{data:{menu_type:[],upselling:[],upselling_rules:[]},status:v.status};return(0,r.VW)(Array.isArray(e)?e[0]:e,null==t?void 0:t.data),t}catch(e){return{data:{menu_type:[],upselling:[],upselling_rules:[]},status:500}}}},24112:(e,t,l)=>{l.d(t,{d:()=>r});var o=l(49505);let r=async function(e){let t,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="https://order.foodbot.ai/apiv2";l&&l.currentDomain&&(r=l.currentDomain+"apiv2");let n=(0,o.z)();console.log(null==l?void 0:l.lang,"payload?.lang"),"pickup"===e||"dinein"===e?t=JSON.stringify({restaurant_id:(null==l?void 0:l.restaurant_id)||"",branch_id:(null==l?void 0:l.branch_id)||"",is_schedule:(null==l?void 0:l.is_schedule)||!1,order_type:(null==l?void 0:l.order_type)||"takeout",source:{lat:(null==l?void 0:null===(i=l.source)||void 0===i?void 0:i.lat)||"",lng:(null==l?void 0:null===(a=l.source)||void 0===a?void 0:a.lng)||""},is_callin:(null==l?void 0:l.is_callin)||!1,lang:(null==l?void 0:l.lang)||"es",api_source:(null==l?void 0:l.api_source)||"EcomV2",session_id:(null==l?void 0:l.session_id)||"",version:(null==l?void 0:l.version)||"",request_timestamp:(null==l?void 0:l.request_timestamp)||new Date().toISOString()}):"delivery"===e&&(t=JSON.stringify({restaurant_id:(null==l?void 0:l.restaurant_id)||"",branch_id:(null==l?void 0:l.branch_id)||"",is_schedule:(null==l?void 0:l.is_schedule)||!1,order_type:(null==l?void 0:l.order_type)||"delivery",source:{lat:(null==l?void 0:null===(s=l.s
1ource)||void 0===s?void 0:s.lat)||"",lng:(null==l?void 0:null===(d=l.source)||void 0===d?void 0:d.lng)||""},destination:{lat:(null==l?void 0:null===(c=l.destination)||void 0===c?void 0:c.lat)||"",lng:(null==l?void 0:null===(u=l.destination)||void 0===u?void 0:u.lng)||""},address:{formatted_address:(null==l?void 0:null===(m=l.address)||void 0===m?void 0:m.formatted_address)||"",unit_number:(null==l?void 0:null===(v=l.address)||void 0===v?void 0:v.unit_number)||"",latitude:(null==l?void 0:null===(_=l.address)||void 0===_?void 0:_.latitude)||"",longitude:(null==l?void 0:null===(g=l.address)||void 0===g?void 0:g.longitude)||"",zipcode:(null==l?void 0:null===(p=l.address)||void 0===p?void 0:p.zipcode)||"",city:(null==l?void 0:null===(f=l.address)||void 0===f?void 0:f.city)||"",state:(null==l?void 0:null===(h=l.address)||void 0===h?void 0:h.state)||"",country:(null==l?void 0:null===(y=l.address)||void 0===y?void 0:y.country)||"",external_number:(null==l?void 0:null===(b=l.address)||void 0===b?void 0:b.external_number)||"",street:(null==l?void 0:null===(x=l.address)||void 0===x?void 0:x.street)||"",address_type:(null==l?void 0:null===(w=l.address)||void 0===w?void 0:w.address_type)||""},is_callin:(null==l?void 0:l.is_callin)||!1,lang:(null==l?void 0:l.lang)||"es",api_source:(null==l?void 0:l.api_source)||"EcomV2",session_id:(null==l?void 0:l.session_id)||"",version:(null==l?void 0:l.version)||"",ui_request_timestamp:(null==l?void 0:l.ui_request_timestamp)||new Date().toISOString()}));var i,a,s,d,c,u,m,v,_,g,p,f,h,y,b,x,w,S={method:"POST",headers:n,body:t,redirect:"follow"};let j=await fetch("".concat(r,"/ecom/v1/payment-settings"),S);j.ok||console.log("This is error");try{let e=await j.json();return console.log("==============jsonData======================"),console.log(e),e}catch(e){console.error(e)}}},26474:(e,t,l)=>{l.r(t),l.d(t,{default:()=>c,trackFbEvent:()=>s,useFacebookPixel:()=>r});var o=l(96540);let r=e=>{let{id:t,resId:l,page:r,data:n}=e,s=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(!s.current){if(!t&&!l){console.log("No Facebook Pixel IDs provided. Exiting without initialization.");return}void 0===window.fbq&&function(e,t,l,o,r,n,i){e.fbq||(r=e.fbq=function(){r.callMethod?r.callMethod.apply(r,arguments):r.queue.push(arguments)},e._fbq||(e._fbq=r),r.push=r,r.loaded=!0,r.version="2.0",r.queue=[],(n=t.createElement(l)).async=!0,n.src=o,(i=t.getElementsByTagName(l)[0]).parentNode.insertBefore(n,i))}(window,document,"script","https://connect.facebook.net/en_US/fbevents.js"),l&&(window.fbq("init",l),a(l)),t&&(window.fbq("init",t),a(null!=t?t:"")),i(r,n,null!=t?t:"",null!=l?l:""),s.current=!0,window.fbq.disablePushState=!0}},[t,l,r,n])},n=e=>{let{mobile:t,token:l,...o}=e;return o},i=(e,t,l,o)=>{let r=n(t);"landing"===e?(window.fbq("track","PageView"),window.fbq("track","ViewContent",r)):"cart"===e?window.fbq("track","Purchase",r):"viewCart"===e?(window.fbq("track","PageView"),window.fbq("track","ViewContent",r),window.fbq("track","AddToCart",r)):"checkout"===e?window.fbq("track","InitiateCheckout",r):"itemDetails"===e&&window.fbq("track","ViewContent",r)},a=e=>{if(!e||""===e.trim()){console.warn("Invalid or empty Facebook Pixel ID for noscript fallback. Skipping request.");return}},s=(e,t)=>{"function"==typeof window.fbq&&window.fbq("track",e,t)},d=(0,o.memo)(e=>(r(e),null));d.displayName="FacebookPixelComponent";let c=d},11804:(e,t,l)=>{l.r(t),l.d(t,{default:()=>r});var o=l(96540);let r=o.memo(e=>{let{id:t,settings:l,page:r,data:n,page_location:i}=e;console.log("GoogleAnalyticsIntegration props:",{id:t,settings:l,page:r,data:n,page_location:i});let a=(0,o.useRef)(!1),s=(0,o.useRef)(!1),d=(0,o.useRef)(!1),c=e=>{if(!e||a.current)return;let t=document.createElement("script");t.async=!0,t.src="https://www.googletagmanager.com/gtag/js?id=".concat(e),document.head.appendChild(t),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",e,{send_page_view:!1}),a.current=!0},u=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};window.gtag?window.gtag("event",e,t):console.warn("gtag is not initialized yet or window is not defined.")};(0,o.useEffect)(()=>{let e=null==l?void 0:l.find(e=>"db0098c8-42dc-11ed-b878-0242ac120002"===e.platform&&"1"==e.status);if(t?(c(t),s.current||m(t)):console.log("Google Analytics 4 is either not configured or disabled for env"),e){let t=e.id;c(t),s.current||m(t)}else console.log("Google Analytics 4 is either not configured or disabled for dashboard")},[t,l]);let m=e=>{if(s.current)return;s.current=!0;let t=setInterval(()=>{window.gtag&&(clearInterval(t),("landing"===r||"viewCart"===r)&&u("page_view",{page_location:i,page_title:r}),"viewCart"===r?u("add_to_cart",n):"checkout"===r?u("begin_checkout",n):"cart"===r?(console.log("[GA Purchase] setupEventFiring cart check:",{alreadyFired:d.current,dataExists:!!n,dataKeys:n?Object.keys(n).length:0,value:null==n?void 0:n.value,transaction_id:null==n?void 0:n.transaction_id,items:null==n?void 0:n.items}),!d.current&&n&&Object.keys(n).length>0&&n.value&&(console.log("[GA Purchase] Firing purchase from setupEventFiring:",n),u("purchase",n),d.current=!0)):"itemDetails"===r&&(u("view_item",{page_location:i,...n}),u("customize_product",n)))},100);return()=>clearInterval(t)};return(0,o.useEffect)(()=>{console.log("Purchase event check:",{page:r,purchaseEventFired:d.current,dataExists:!!n,dataKeys:n?Object.keys(n).length:0,dataValue:null==n?void 0:n.value,windowDefined:!0,gtagDefined:void 0!==window.gtag}),console.log("[GA Purchase] data-watch effect triggered:",{page:r,alreadyFired:d.current,dataExists:!!n,dataKeys:n?Object.keys(n).length:0,value:null==n?void 0:n.value,transaction_id:null==n?void 0:n.transaction_id,items:null==n?void 0:n.items,gtagReady:void 0!==window.gtag}),"cart"===r&&!d.current&&n&&Object.keys(n).length>0&&n.value&&void 0!==window.gtag&&(console.log("[GA Purchase] Firing purchase from data-watch:",n),u("purchase",n),d.current=!0)},[n,r]),null})},95891:(e,t,l)=>{l.d(t,{Jq:()=>u,e5:()=>i,oM:()=>o,sS:()=>m});let o=(e,t)=>{let l=Number(e),o=String(t||"").trim().toLowerCase();return 1===l||"delivery"===o?"delivery":2===l||"takeout"===o||"pickup"===o?"pickup":3===l||"dinein"===o||"dine-in"===o?"dinein":(console.warn("[callin] getOrderModeFromApiType: unrecognized order type, defaulting to pickup",{orderType:e,orderTypeLabel:t}),"pickup")},r=["selected_branchmode_","cartItemDetails_","offer_details_","cartData_","branch_delivery_"],n=(e,t)=>localStorage.getItem("".concat(e).concat(t)),i=e=>{let t={};for(let l of r)t[l]=n(l,e);sessionStorage.setItem("callin_snapshot_".concat(e),JSON.stringify(t))},a=e=>{if(!e)return null;try{return JSON.parse(e)}catch(e){return null}},s=e=>Array.isArray(e)?e.map(e=>{var t,l;return"".concat(String(null!==(t=null==e?void 0:e.item_id)&&void 0!==t?t:""),":").concat(String(null!==(l=null==e?void 0:e.quantity)&&void 0!==l?l:""))}).sort().join("|"):"",d=e=>null==e||""===e?null:String(e),c=(e,t)=>{var l,o,r,n,i,c,u,m;let v=a(t);switch(e){case"selected_branchmode_":return{mode:null!==(o=null==v?void 0:v.mode)&&void 0!==o?o:null,branch_id:d(null==v?void 0:null===(l=v.branch)||void 0===l?void 0:l.branch_id)};case"branch_delivery_":return{branch_id:d(null!==(n=null==v?void 0:v.branch_id)&&void 0!==n?n:null==v?void 0:null===(r=v.branch)||void 0===r?void 0:r.branch_id)};case"offer_details_":return{offer_id:null!==(c=null!==(i=null==v?void 0:v.offer_id)&&void 0!==i?i:null==v?void 0:v.en_id)&&void 0!==c?c:null};case"cartItemDetails_":return{items:s(v)};case"cartData_":return{order_type:null!==(m=null==v?void 0:v.order_type)&&void 0!==m?m:null,branch_id:d(null==v?void 0:v.branch_id),items:s(null==v?void 0:null===(u=v.order_items)||void 0===u?void 0:u.item_details),promotion_applied:!!((null==v?void 0:v.promotion_applied)&&Object.keys(v.promotion_applied).length>0)};default:return t}},u=e=>{let t;let l=sessionStorage.getItem("callin_snapshot_".concat(e));if(!l)return[];try{t=JSON.parse(l)}catch(e){return[]}let o=[];for(let l of r){var i;let r=c(l,null!==(i=t[l])&&void 0!==i?i:null),a=c(l,n(l,e)),s=JSON.stringify(r),d=JSON.stringify(a);s!==d&&o.push({key:"".concat(l).concat(e),field:l.replace(/_$/,""),expected:s,actual:d})}return o},m=e=>{var t,l,o,r;let i=sessionStorage.getItem("callin_snapshot_".concat(e)),s=i?a(i):null;return{expected:null!==(o=null===(t=a(null==s?void 0:s.selected_branchmode_))||void 0===t?void 0:t.mode)&&void 0!==o?o:null,actual:null!==(r=null===(l=a(n("selected_branchmode_",e)))||void 0===l?void 0:l.mode)&&void 0!==r?r:null}}},18491:(e,t,l)=>{l.d(t,{H:()=>o});let o=e=>e?JSON.parse(JSON.stringify(e)):e},57185:(e,t,l)=>{l.d(t,{Fe:()=>r,gm:()=>i,zh:()=>n});let o=e=>{let t="";try{t=new URL(e).search}catch(o){let l=e.indexOf("?");-1!==l&&(t=e.slice(l))}if(!t||t.length<2)return;let l=t.slice(1),o=e=>{try{let t=atob(e);if(t.includes("+callin"))return t.split("+callin")[0]||void 0}catch(e){}},r=o(l);if(r)return r;try{for(let[e,l]of new URLSearchParams(t).entries())if(""===l)for(let t of[e,e+"=",e+"=="]){let e=o(t);if(e)return e}}catch(e){}},r=e=>{let t,l=e;try{l=decodeURIComponent(e)}catch(t){l=e}let r="";if(l.includes("?")){var n;r=(null===(n=l.split("?")[1])||void 0===n?void 0:n.split("#")[0])||""}else if(l.includes("#")){let e=l.split("#")[1]||"";e.includes("=")&&(r=e)}let i=new URLSearchParams(r),a=e=>{let t=new RegExp("[?&#]".concat(e,"=([^&#]*)")),o=l.match(t);
1return o?decodeURIComponent(o[1]):void 0},s=l.match(/\/status\/([A-Za-z0-9]+)(?:\/([0-9]+))?/);if(s)try{t=atob(s[1])}catch(e){t=s[1]}return{userkey:i.get("userkey")||a("userkey")||void 0,promo:i.get("promo")||a("promo")||void 0,target_link:i.get("target_link")||a("target_link")||void 0,restaurant_name:i.get("restaurant_name")||a("restaurant_name")||void 0,sender_id:i.get("sender_id")||a("sender_id")||void 0,user_name:i.get("user_name")||a("user_name")||void 0,token:i.get("token")||a("token")||void 0,mobile:i.get("mobile")||a("mobile")||void 0,ref:i.get("ref")||a("ref")||void 0,utm_campaign:i.get("utm_campaign")||a("utm_campaign")||void 0,order:i.get("order")||a("order")||void 0,cart:i.get("cart")||a("cart")||void 0,type:i.get("type")||a("type")||void 0,item:i.get("item")||a("item")||void 0,status:t||void 0,callin_order_id:o(e)}},n=e=>{let t=!!e.userkey,l=!!e.target_link,o="rewards"===e.target_link,r=!!e.promo,n=!!e.ref,i=!!e.utm_campaign,a=!!e.order,s=!!e.sender_id,d=!!e.cart,c=!!e.type;return{hasUserKey:t,hasTargetLink:l,hasTargetLinkRewards:o,hasPromo:r,hasRef:n,hasUtm_campaign:i,hasOrder:a,sender_id:s,hasCart:d,hastype:c,hasitem:!!e.item,hasStatus:!!e.status,hasCallin:!!e.callin_order_id}},i=e=>{let t=r(e);return{...n(t),userkey:t.userkey,target_link:t.target_link,user_name:t.user_name,mobile:t.mobile,ref:t.ref,order:t.order,sender_id:t.sender_id,cart:t.cart,type:t.type,item:t.item,status:t.status,callin_order_id:t.callin_order_id}}},64201:(e,t,l)=>{l.d(t,{x:()=>n});var o=l(18987),r=l(24663);let n=async function(e,t,l,n,i,a){var s,d,c,u,m,v,_,g,p,f,h,y,b,x,w,S,j,N,k,C,A;let I=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,M=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null,F=arguments.length>8&&void 0!==arguments[8]?arguments[8]:null,O=arguments.length>9?arguments[9]:void 0,D=arguments.length>10&&void 0!==arguments[10]?arguments[10]:null,z=arguments.length>11&&void 0!==arguments[11]?arguments[11]:null,E=arguments.length>12&&void 0!==arguments[12]?arguments[12]:null,L=arguments.length>13?arguments[13]:void 0,B=arguments.length>14?arguments[14]:void 0,Y=arguments.length>15?arguments[15]:void 0,P=arguments.length>16?arguments[16]:void 0,T=!(arguments.length>17)||void 0===arguments[17]||arguments[17],q=arguments.length>18?arguments[18]:void 0,J=arguments.length>19?arguments[19]:void 0,R=(arguments.length>20&&arguments[20],arguments.length>21&&void 0!==arguments[21]?arguments[21]:"unknown"),G=Array.isArray(q)?q[0]:q,H=localStorage.getItem("branch_delivery_".concat(G));H&&(B=JSON.parse(H));let V=localStorage.getItem("scheduledOrder_".concat(G)),U={branch:e,mode:t};"function"==typeof I&&I(U);let W="pickup"===t||"dinein"===t?e.branch_id:null==B?void 0:B.branch_id;z&&z("pickup"===t||"dinein"===t?e:JSON.parse(localStorage.getItem("branch_delivery_".concat(G))||"{}"));let Z={branch:{...e,branch_id:W},mode:t};if(localStorage.setItem("selected_branchmode_".concat(G),JSON.stringify(Z)),o.A.set("selected_branchmode_".concat(G),JSON.stringify(Z),{sameSite:"None",secure:!0,expires:7}),"delivery"===t){let e={branch_id:W,branch_latitude:null==B?void 0:B.branch_latitude,branch_longitude:null==B?void 0:B.branch_longitude,address:null==B?void 0:B.address};o.A.set("branch_delivery_".concat(G),JSON.stringify(e),{sameSite:"None",secure:!0,expires:7})}let X=null===(d=a.restaurant_settings)||void 0===d?void 0:null===(s=d.data)||void 0===s?void 0:s.restaurant_id,K="pickup"===t||"dinein"===t?e.branch_id:(null==B?void 0:B.branch_id)||(null===(u=a.pickupbranches)||void 0===u?void 0:null===(c=u.data.branches_data[0])||void 0===c?void 0:c.branch_id);try{let i;if(T&&E){let e=await E(G,K,X,null===(v=a.restaurant_settings)||void 0===v?void 0:null===(m=v.data)||void 0===m?void 0:m.brand_id,t,Y,P,J),l=null==e?void 0:null===(_=e.data)||void 0===_?void 0:_.menu_type,o=(null==e?void 0:null===(g=e.data)||void 0===g?void 0:g.upselling)||[];F&&F([...o]),void 0!==l&&(localStorage.setItem("handleBranchClickCaller_".concat(q),R),M&&M(l&&Array.isArray(l)&&l.length>0?l:[]),F&&F(o),console.log("menuType",l),l&&Array.isArray(l)&&l.length>0?await (0,r.tE)("branchMenuDetail_".concat(G),l):await (0,r.tE)("branchMenuDetail_".concat(G),[]),localStorage.setItem("upsellingMenuDetail_".concat(G),JSON.stringify(o)))}"pickup"===t||"dinein"===t?i={restaurant_id:l,branch_id:W,is_schedule:!!V,order_type:"dinein"===t?"dinein":"takeout",source:{lat:Number(e.branch_latitude),lng:Number(e.branch_longitude)},is_callin:!1,lang:n,api_source:"EcomV2",session_id:Y,version:P,request_timestamp:new Date().toISOString()}:"delivery"===t&&(null==B?void 0:B.branch_id)&&(i={restaurant_id:l,branch_id:W,is_schedule:!1,order_type:"delivery",source:{lat:Number(null==B?void 0:B.branch_latitude),lng:Number(null==B?void 0:B.branch_longitude)},destination:{lat:null===(p=U.branch)||void 0===p?void 0:p.latitude,lng:null===(f=U.branch)||void 0===f?void 0:f.longitude},address:{formatted_address:(null===(h=U.branch)||void 0===h?void 0:h.formatted_address)||"",unit_number:(null===(y=U.branch)||void 0===y?void 0:y.unit_number)||"",latitude:(null===(b=U.branch)||void 0===b?void 0:b.latitude)||"",longitude:(null===(x=U.branch)||void 0===x?void 0:x.longitude)||"",zipcode:(null===(w=U.branch)||void 0===w?void 0:w.zipcode)||"",city:(null===(S=U.branch)||void 0===S?void 0:S.city)||"",state:(null===(j=U.branch)||void 0===j?void 0:j.state)||"",country:(null===(N=U.branch)||void 0===N?void 0:N.country)||"",external_number:(null===(k=U.branch)||void 0===k?void 0:k.external_number)||"",street:(null===(C=U.branch)||void 0===C?void 0:C.street)||"",address_type:(null===(A=U.branch)||void 0===A?void 0:A.address_type)||""},is_callin:!1,lang:n,api_source:"EcomV2",session_id:Y,version:P,ui_request_timestamp:new Date().toISOString()}),i.currentDomain=J,console.log(i,"payload");let s=await L(t,i);if(O(s),localStorage.setItem("payload_".concat(G),JSON.stringify(i)),o.A.set("payload_".concat(G),JSON.stringify(i),{expires:7}),localStorage.setItem("payment_method_".concat(G),JSON.stringify(s)),localStorage.removeItem("selected_delivery_partner_".concat(G)),o.A.set("payment_method_".concat(G),JSON.stringify(s),{expires:7}),D&&D(e),z){let l="pickup"===t||"dinein"===t?e:JSON.parse(localStorage.getItem("branch_delivery_".concat(G))||"{}");z(l)}}catch(e){console.error("Error fetching menu or payment details:",e)}}},66895:(e,t,l)=>
1{function o(e,t,l,o){var r,n,i,a,s,d,c,u;if(!e)return null!=e?e:"";if(l===o||!Array.isArray(t)||0===t.length)return e;let m=t.find(e=>{var t;return(null===(t=e.language)||void 0===t?void 0:t.toLowerCase())===(null==l?void 0:l.toLowerCase())});return m&&(null!==(u=null!==(c=null!==(d=null!==(s=null!==(a=null!==(i=null!==(n=null!==(r=m.value)&&void 0!==r?r:m.display_text)&&void 0!==n?n:m.item_display_text)&&void 0!==i?i:m.item_description)&&void 0!==a?a:m.description)&&void 0!==s?s:m.item_name)&&void 0!==d?d:m.modifier_item_name)&&void 0!==c?c:m.category_display_text)&&void 0!==u?u:Object.values(m).find(e=>"string"==typeof e&&e!==m.language))||e}function r(e,t,l){return o(null==e?void 0:e.item_display_text,null==e?void 0:e.item_display_text_v1,t,l)}function n(e,t,l){return o(null==e?void 0:e.item_description,null==e?void 0:e.item_description_v1,t,l)}function i(e,t,l){return o(null==e?void 0:e.category_display_text,null==e?void 0:e.category_display_text_v1,t,l)}function a(e,t,l){return o(null==e?void 0:e.modifier_item_name,null==e?void 0:e.modifier_item_name_v1,t,l)}function s(e,t,l){return o(null==e?void 0:e.display_text,null==e?void 0:e.display_text_v1,t,l)}l.d(t,{EY:()=>a,HS:()=>o,M1:()=>i,Ui:()=>n,X5:()=>r,jO:()=>s})},69634:(e,t,l)=>{l.d(t,{M:()=>s,r:()=>c});var o=l(84345);let r=new Map,n=e=>"localhost"===e||e.endsWith(".localhost")||"127.0.0.1"===e||"::1"===e||"0.0.0.0"===e||e.endsWith(".local")||/^192\.168\./.test(e)||/^10\./.test(e)||/^172\.(1[6-9]|2\d|3[01])\./.test(e),i=()=>{let{hostname:e}=window.location;return e.includes("stage")||n(e)?"https://api-stage.foodbot.ai":"https://api-prod.foodbot.ai"},a=()=>"modifier_restriction_rules_".concat((0,o.o)());function s(e){try{let t=localStorage.getItem(a());if(!t)return[];let l=JSON.parse(t);if(null!=e&&""!==e&&l.restaurantId!==String(e))return[];return Array.isArray(l.rules)?l.rules:[]}catch(e){return[]}}let d=(e,t)=>{try{localStorage.setItem(a(),JSON.stringify({restaurantId:e,rules:t}))}catch(e){}};async function c(e){if(null==e||""===e)return[];let t=String(e),l=r.get(t);if(l)return l;let o=(async()=>{let e="".concat(i(),"/catalogue/v1/restaurants/").concat(t,"/modifier-restriction-rules/for-menu");try{let l=await fetch(e,{method:"GET"});if(!l.ok)return console.warn("Failed to fetch modifier restriction rules:",l.status),s(t);let o=await l.json(),r=Array.isArray(null==o?void 0:o.data)?o.data:[];return console.log("modifier restriction rules: ".concat(r.length," rule(s) for restaurant ").concat(t," from ").concat(e)),d(t,r),r}catch(e){return console.warn("Failed to fetch modifier restriction rules from catalogue service:",e),s(t)}finally{r.delete(t)}})();return r.set(t,o),o}},15837:(e,t,l)=>{l.d(t,{l:()=>o});let o=function(e,t,l){let o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",i=arguments.length>6?arguments[6]:void 0,a=arguments.length>7?arguments[7]:void 0,s=arguments.length>8&&void 0!==arguments[8]?arguments[8]:0;return JSON.stringify({restaurant_id:e,branch_id:t,order_type:l,phone_number:o,member_id:r,is_redeem:s,session_id:i,version:a,source:"EcomV2",ui_request_timestamp:new Date().toISOString(),lang:n})}},5595:(e,t,l)=>{l.d(t,{MQ:()=>c,YA:()=>m,po:()=>u});var o=l(74353),r=l.n(o),n=l(84345),i=l(88569),a=l.n(i),s=l(83826),d=l.n(s);r().extend(d()),r().extend(a());let c=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;if(!e||!Array.isArray(e)||0===e.length)return console.warn("â ï¸ isRestaurantOpen: Invalid schedule provided",e),!1;if(!t)return console.warn("â ï¸ isRestaurantOpen: Invalid timezone provided",t),!1;let o=r()().tz(t),n=o.day(),i=o.format("HH:mm:ss"),a=e.find(e=>parseInt(e.day)===n),s=0===n?6:n-1,d=e.find(e=>parseInt(e.day)===s),c=(e,t,l)=>r().tz("".concat(o.format("YYYY-MM-DD")," ").concat(e),t).tz(l).format("HH:mm:ss");if(a&&1===a.status){let e=c(a.open_time,l,t),o=c(a.close_time,l,t);if(a.open_time<=a.close_time){if(i>=e&&i<=o)return!0}else if(i>=e)return!0}return!!(d&&1===d.status&&d.open_time>d.close_time&&i<=c(d.close_time,l,t))},u=()=>{let e=new Date,t=e.getFullYear(),l=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return console.log("".concat(t,"-").concat(l,"-").concat(o),"day under timeutils"),"".concat(t,"-").concat(l,"-").concat(o)},m=(e,t)=>
1{if(e&&e.branch_business_hours&&e.timezone){let l=c(e.branch_business_hours,e.timezone,e.timezone);t(l),localStorage.setItem("restaurant_open_".concat((0,n.o)()),JSON.stringify(l))}}},8083:(e,t,l)=>{l.d(t,{FA:()=>L,LO:()=>E,RH:()=>h,Uy:()=>f,VW:()=>b,Xl:()=>B,_X:()=>z,bI:()=>y,hu:()=>p,iB:()=>j});var o=l(74353),r=l.n(o),n=l(83826),i=l.n(n),a=l(88569),s=l.n(a),d=l(8906),c=l.n(d),u=l(98867),m=l.n(u);r().extend(i()),r().extend(s()),r().extend(c()),r().extend(m());let v=e=>"upsellLinks_".concat(e),_=e=>{if(!e)return[];try{let t=JSON.parse(localStorage.getItem(v(e))||"[]");return Array.isArray(t)?t:[]}catch(e){return[]}},g=(e,t)=>{e&&localStorage.setItem(v(e),JSON.stringify(t))},p=(e,t,l)=>{if(!t||!l||t===l)return;let o=_(e);o.some(e=>e.parent_item_id===t&&e.child_item_id===l)||g(e,[...o,{parent_item_id:t,child_item_id:l}])},f=(e,t)=>{if(!Array.isArray(t)||0===t.length)return;let l=new Set(t.map(String));g(e,_(e).filter(e=>!l.has(String(e.parent_item_id))&&!l.has(String(e.child_item_id))))},h=(e,t,l)=>{if(!(null==t?void 0:t.item_id))return[];let o=Array.isArray(l)?l:[];if(o.some(e=>String(null==e?void 0:e.item_id)===String(t.item_id)))return[];let r=_(e).filter(e=>String(e.parent_item_id)===String(t.item_id)).map(e=>String(e.child_item_id));return 0===r.length?[]:o.filter(e=>r.includes(String(null==e?void 0:e.item_id)))},y=e=>"upsellingRulesDetail_".concat(e),b=(e,t)=>{if(!e)return;let l=y(e),o=null==t?void 0:t.upselling_rules;if(!Array.isArray(o)){console.log("[upsell] skipped write to ".concat(l,": response had no upselling_rules"));return}let r=Array.isArray(null==t?void 0:t.menu_type)&&t.menu_type.length>0;if(0===o.length&&!r){let e=localStorage.getItem(l);if(e&&"[]"!==e){console.log("[upsell] skipped write to ".concat(l,": empty fallback response, keeping stored rules"));return}}localStorage.setItem(l,JSON.stringify(o)),console.log("[upsell] stored ".concat(o.length," rule(s) in ").concat(l).concat(0===o.length?" (branch has none configured)":""))},x=e=>"all"===String(null!=e?e:"").trim().toLowerCase(),w=e=>{if(!(null==e?void 0:e.type))return[];let t="product"===e.type?e.product_ids:e.category_ids;if(Array.isArray(t)&&t.length>0)return t.map(e=>String(e).trim()).filter(Boolean);let l="product"===e.type?e.product_id:e.category_id;return String(null!=l?l:"").split(",").map(e=>e.trim()).filter(Boolean)},S=e=>"product"===e?"item_id":"category_id",j=(e,t)=>{let l=null==e?void 0:e.trigger_condition;if(!l||!l.type||"product"!==l.type&&"category"!==l.type)return!1;let o=Array.isArray(t)?t:[];if(0===o.length)return!1;let r=w(l);if(0===r.length)return!1;if(r.some(x))return!0;let n=S(l.type);return o.some(e=>r.some(t=>String(null==e?void 0:e[n])===t))},N=(e,t)=>(Array.isArray(t)?t:[]).some(t=>(null==t?void 0:t.item_id)==e.item_id&&(null==t?void 0:t.category_id)==e.category_id),k=e=>{var t,l,o;let r=Number(null!==(o=null!==(l=null!==(t=null==e?void 0:e.item_price_with_modifier)&&void 0!==t?t:null==e?void 0:e.item_price)&&void 0!==l?l:null==e?void 0:e.price)&&void 0!==o?o:0);return isNaN(r)?0:r},C=e=>({item_id:e.item_id,item_trx_id:e.item_trx_id,item_name:e.item_name,item_display_text:e.item_display_text,item_display_text_v1:e.item_display_text_v1,item_image:e.item_image,category_id:e.category_id,quantity:Number(e.quantity)||1,price:k(e)}),A=e=>e.reduce((e,t)=>null===e||k(t)>k(e)?t:e,null),I=(e,t)=>{let l=null==e?void 0:e.trigger_condition,o=Array.isArray(t)?t:[];if((null==l?void 0:l.type)!=="product"&&(null==l?void 0:l.type)!=="category")return null;let r=w(l),n=r.some(x),i=S(l.type),a=A(n?o:o.filter(e=>r.some(t=>String(null==e?void 0:e[i])===t)));return a?C(a):null},M=(e,t)=>{var l;return null!==(l=(Array.isArray(null==e?void 0:e.item_modifiers)?e.item_modifiers:[]).find(e=>{var l;return(null!==(l=null==e?void 0:e.modifier_category_id)&&void 0!==l?l:null==e?void 0:e.modifer_cat)==t}))&&void 0!==l?l:null},F=function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=A((Array.isArray(t)?t:[]).filter(t=>(null==t?void 0:t.item_id)==e));return o?l.withModifiers?{...C(o),item_modifiers:Array.isArray(o.item_modifiers)?o.item_modifiers:[]}:C(o):null},O=(e,t)=>{if(!e)return null;let l=A((Array.isArray(t)?t:[]).filter(t=>(null==t?void 0:t.category_id)==e));return l?C(l):null},D=(e,t,l)=>{if(!e)return!1;if(!e.menu_timing||!Array.isArray(e.menu_timing)||0===e.menu_timing.length)return!0;try{var o,n;let i;
1let a=(null==t?void 0:t.timezone)||(null==l?void 0:null===(o=l.branch)||void 0===o?void 0:o.timezone)||r().tz.guess()||"UTC";if(l&&l.date&&l.time){let e=l.date,t=String(l.time).trim().toUpperCase();if("ASAP"===t)i=r()().tz(a);else{let l;if(/^\d{2}:\d{2}$/.test(t))l=r().tz("".concat(e,"T").concat(t,":00"),a);else{if(!/^\d{1,2}:\d{2}\s?[APap][Mm]$/.test(t))return!1;let o=r()("".concat(e," ").concat(t),"YYYY-MM-DD hh:mm A");if(!o.isValid())return!1;l=r().tz("".concat(e,"T").concat(o.format("HH:mm:ss")),a)}if(!l.isValid())return!1;i=l}let o=null==l?void 0:null===(n=l.branch)||void 0===n?void 0:n.branch_business_hours;if(o&&Array.isArray(o)){let e=i.day(),t=o.find(t=>String(t.day)===String(e)&&1===t.status);if(!t)return!1;let l=i.format("YYYY-MM-DD"),n=r().tz("".concat(l," ").concat(t.open_time),"YYYY-MM-DD HH:mm:ss",a),s=r().tz("".concat(l," ").concat(t.close_time),"YYYY-MM-DD HH:mm:ss",a);if(s.isBefore(n)&&(s=s.add(1,"day")),!i.isSameOrAfter(n)||!i.isSameOrBefore(s))return!1}}else i=r()().tz(a);let s=i.day().toString(),d=e.menu_timing.find(e=>String(e.day)===s&&1===e.status);if(!d)return!1;let c=i.format("YYYY-MM-DD"),u=r().tz("".concat(c," ").concat(d.open_time),"YYYY-MM-DD HH:mm:ss",a),m=r().tz("".concat(c," ").concat(d.close_time),"YYYY-MM-DD HH:mm:ss",a);return(m.isBefore(u)||d.close_time.startsWith("00:"))&&(6>i.hour()&&d.close_time.startsWith("00:")?u=u.subtract(1,"day"):m=m.add(1,"day")),i.isSameOrAfter(u)&&i.isSameOrBefore(m)}catch(e){return console.error("Error checking upsell item availability",e),!1}},z=e=>{let t=Number((null==e?void 0:e.discounted_price)!==void 0&&(null==e?void 0:e.discounted_price)!==null?e.discounted_price:null==e?void 0:e.price);return isNaN(t)?0:t},E=e=>{let t=Number((null==e?void 0:e.original_price)!==void 0&&(null==e?void 0:e.original_price)!==null?e.original_price:null==e?void 0:e.price);return isNaN(t)?0:t},L=e=>E(e)>z(e),B=e=>{let{rules:t,cartItems:l,restaurantSettings:o,scheduledOrder:r}=e;if(!Array.isArray(t)||0===t.length)return[];let n=Array.isArray(l)?l:[],i=e=>D(e,o,r),a=[],s=(e,t,l)=>{var o,r,a,s,d,c,u;if(!e)return null;if("modifier"===e.type&&e.to_modifier){let t=e.product_item,l=F(e.product_id,n,{withModifiers:!0}),s=l?M(l,e.modifier_category_id):null,d=s&&String(s.modifier_item_id)===String(e.to_modifier_id);if(!l||d||!i(t))return null;let c=Number(e.extra_price)||0,u=Number(e.to_modifier.price)||0,m=s?Number((u-(Number(s.modifier_item_price)||0)).toFixed(2)):c;return{type:"modifier",product_id:e.product_id,modifier_category_id:e.modifier_category_id,from_modifier_id:null!==(o=e.from_modifier_id)&&void 0!==o?o:null,to_modifier_id:e.to_modifier_id,extra_price:c,product_item:t,modifier_category:null!==(r=e.modifier_category)&&void 0!==r?r:null,from_modifier:null!==(a=e.from_modifier)&&void 0!==a?a:null,to_modifier:e.to_modifier,cart_line:l,current_modifier:s,delta:m}}if("category"===e.type&&e.to_item){let o=e.to_item,r=null!==(s=O(e.from_category_id,n))&&void 0!==s?s:l?I(t,n):null;if(!r||!i(o)||N(o,n))return null;let a=Number(e.extra_price)||0,c=r.price?Number((z(o)-r.price).toFixed(2)):a;return{type:"category",from_category_id:e.from_category_id,to_product_id:e.to_product_id,extra_price:a,from_item:null,from_category:null!==(d=e.from_category)&&void 0!==d?d:null,to_item:o,cart_line:r,delta:c}}if(e.to_item){let o=e.to_item,r=null!==(c=F(e.from_product_id,n))&&void 0!==c?c:l?I(t,n):null;if(!r||!i(o)||N(o,n))return null;let a=Number(e.extra_price)||0,s=r.price?Number((z(o)-r.price).toFixed(2)):a;return{type:"product",from_product_id:e.from_product_id,to_product_id:e.to_product_id,extra_price:a,from_item:null!==(u=e.from_item)&&void 0!==u?u:null,to_item:o,cart_line:r,delta:s}}return null};for(let e of t){var d,c,u,m,v,_,g,p,f,h,y,b;if(!e||!j(e,n))continue;let t=(Array.isArray(e.products)?e.products:[]).filter(e=>i(e)&&!N(e,n)),l=Array.isArray(e.upgrade)?e.upgrade:e.upgrade?[e.upgrade]:[],o=1===l.length,r=[],x=new Set;for(let t of l){let l=s(t,e,o);if(!l)continue;let n="modifier"===l.type?"m:".concat(l.product_id,":").concat(l.modifier_category_id,":").concat(l.to_modifier_id):"".concat(null!==(_=null!==(v=null===(c=l.cart_line)||void 0===c?void 0:c.item_trx_id)&&void 0!==v?v:null===(u=l.cart_line)||void 0===u?void 0:u.item_id)&&void 0!==_?_:"","->").concat(null!==(g=null===(m=l.to_item)||void 0===m?void 0:m.item_id)&&void 0!==g?g:"");x.has(n)||(x.add(n),r.push(l))}let w=null!==(p=r[0])&&void 0!==p?p:null;0===r.length&&l.length>0&&console.log('[upsell] rule "'.concat(null!==(f=null==e?void 0:e.category_name)&&void 0!==f?f:"",'" upgrade not shown: none of ').concat(l.length," candidate swap(s) matched the cart"));let S=null,k=(Array.isArray(null===(d=e.combo)||void 0===d?void 0:d.items)?e.combo.items:[]).filter(e=>i(e)&&!N(e,n));if(k.length>0){let t=Number(k.reduce((e,t)=>
1e+z(t),0).toFixed(2)),l=Number(k.reduce((e,t)=>e+E(t),0).toFixed(2));S={discount:null!==(y=null===(h=e.combo)||void 0===h?void 0:h.discount)&&void 0!==y?y:null,items:k,total:t,original_total:l,saving:Number(Math.max(0,l-t).toFixed(2))}}(0!==t.length||0!==r.length||S)&&a.push({menu_id:null!==(b=e.menu_id)&&void 0!==b?b:null,category_name:e.category_name,tab:e.tab,display_settings:e.display_settings,trigger_condition:e.trigger_condition,products:t,upgrades:r,upgrade:w,combo:S,trigger_line:I(e,n)})}return a}},75538:(e,t,l)=>{l.d(t,{_:()=>r});var o=l(96540);let r=()=>{let[e,t]=(0,o.useState)(null),[l,r]=(0,o.useState)(null),[n,i]=(0,o.useState)(""),[a,s]=(0,o.useState)(!1),d=(0,o.useRef)(null),c={lat:19.4326,lng:-99.1332},u=()=>window.google&&window.google.maps;return{containerStyle:{width:"100%",height:"100%"},center:c,onLoad:e=>{try{t(e),s(!0),console.log("Google Map initialized, centered at:",c)}catch(e){console.error("Error in onLoad:",e)}},onMarkerClick:t=>{if(!u()||!t.latLng||!e){console.warn("Google Maps not ready or click data missing.");return}try{let e={lat:t.latLng.lat(),lng:t.latLng.lng()};r(e),console.log("Marker placed at:",e),new window.google.maps.Geocoder().geocode({location:e},(e,t)=>{t===google.maps.GeocoderStatus.OK&&e&&e[0]?(i(e[0].formatted_address||""),console.log("Geocoded address:",e[0].formatted_address)):(console.error("Geocoding failed:",t),i("Unable to retrieve address"))})}catch(e){console.error("Error in onMarkerClick:",e)}},getUserLocation:()=>{if(!u()){console.warn("Google Maps API not loaded yet");return}navigator.geolocation?navigator.geolocation.getCurrentPosition(e=>{try{let t={lat:e.coords.latitude,lng:e.coords.longitude};r(t),i("User's current location"),new window.google.maps.Geocoder().geocode({location:t},(e,t)=>{t===google.maps.GeocoderStatus.OK&&e&&e[0]&&i(e[0].formatted_address||"")})}catch(e){console.error("Error processing user location:",e)}},e=>{console.error("Error getting user location:",e)}):console.error("Geolocation is not supported by this browser.")},marker:l,autocompleteRef:d,handleLocationSelect:(t,l)=>{if(!u()||!e){console.warn("Google Maps API not loaded yet");return}try{r(l),i(t),e.panTo(l)}catch(e){console.error("Error in handleLocationSelect:",e)}},map:e,setMarker:r,address:n,setAddress:i,isReadyMap:a}}}}]);
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.