1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2259],{2171:(e,t,s)=>{s.d(t,{$:()=>d});var a=s(5155),r=s(2115),n=s(2467),l=s(3101),o=s(8456);let i=(0,l.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-lg hover:shadow-xl transition-all",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-11 px-8 py-2",sm:"h-9 rounded-md px-3",lg:"h-12 rounded-md px-8 text-base",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=r.forwardRef((e,t)=>{let{className:s,variant:r,size:l,asChild:d=!1,...c}=e;return d&&n.DX,(0,a.jsx)("button",{className:(0,o.cn)(i({variant:r,size:l,className:s})),ref:t,...c})});d.displayName="Button"},2259:(e,t,s)=>{s.d(t,{L:()=>w});var a=s(5155),r=s(2115),n=s(3255),l=s(2171),o=s(1517),i=s(6331),d=s(1733),c=s(3407),u=s(5917),m=s(512),x=s(1873),p=s(1169),h=s(508),g=s(5299),f=s(8519),b=s(7978),y=s(9488),v=s(7067),j=s(4620);let N=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=new Date;return t.setDate(t.getDate()+e),new Date(t.getTime()-6e4*t.getTimezoneOffset()).toISOString().split("T")[0]};function w(e){let{tour:t,externalOpen:s,onExternalOpenChange:w,children:_,buttonLabel:k}=e,[T,P]=(0,r.useState)(!1),C=void 0!==s,S=C?s:T,A=C?e=>null==w?void 0:w(e):P,[F,J]=(0,r.useState)(!1),[E,D]=(0,r.useState)("form"),[$,O]=(0,r.useState)(0),[M,U]=(0,r.useState)(25e3),{addToCart:B}=(0,v._)(),[I,L]=(0,r.useState)(!1);(0,r.useEffect)(()=>{S?window.dispatchEvent(new Event("booking-modal-open")):window.dispatchEvent(new Event("booking-modal-close"))},[S]);let V=(0,r.useMemo)(()=>(0,c.yf)(t),[t]),G=V.length>0,q=!G&&null!=t.private_price&&t.private_price>0,z=t.payment_methods||"both",[H,R]=(0,r.useState)(0),W=G?V[H]||V[0]:null,[Y,K]=(0,r.useState)("group"),X=(0,r.useMemo)(()=>!!W&&"hotel"===W.pickup_type,[W]),Q=(0,r.useMemo)(()=>W&&"meeting_point"===W.pickup_type&&W.subtitle||null,[W]),[Z,ee]=(0,r.useState)(!1),[et,es]=(0,r.useState)("cash"===z?"cash":"paypal"),ea=N(0),er=N(90);(0,r.useEffect)(()=>{S&&(d.FH.get("/settings/exchange_rate_usd_vnd").then(e=>{var t;let s=Number(null==(t=e.data)?void 0:t.value);s>0&&U(s)}).catch(()=>{}),O(e=>e+1))},[S]),(0,r.useEffect)(()=>{"cash"===(t.payment_methods||"both")?es("cash"):es("paypal")},[t.id,t.payment_methods]);let en=(0,r.useMemo)(()=>(0,c.L3)(t.languages),[t.languages]),el=(0,r.useMemo)(()=>(null==W?void 0:W.languages)&&W.languages.length>0?W.languages:en,[W,en]),eo=!!t.dropoff_enabled,[ei,ed]=(0,r.useState)({customerName:"",customerEmail:"",whatsApp:"",sex:"Male",nationality:"",date:"",tourTime:"",hotelName:"",hotelAddress:"",dropoffAddress:"",language:el[0]||"English",room:"",foodNotes:"",foodPref:"",note:"",adult:2,young:0,child:0,infant:0});(0,r.useEffect)(()=>{ed(e=>({...e,language:el.includes(e.language)?e.language:el[0]||"English"}))},[t.id,el]);let[ec,eu]=(0,r.useState)([]),[em,ex]=(0,r.useState)(""),[ep,eh]=(0,r.useState)(""),[eg,ef]=(0,r.useState)(!1),[eb,ey]=(0,r.useState)({}),[ev,ej]=(0,r.useState)(!1),eN=(null==W?void 0:W.max_pax)&&W.max_pax>0?W.max_pax:t.max_pax||8,ew=ei.tourTime?eb[ei.tourTime]:null,e_=(0,r.useMemo)(()=>{if(!ev||!ew)return eN;let e="private"===Y?ew.private:ew.group;return e<=0?0:Math.min(eN,e)},[eN,ev,ew,Y]);(0,r.useEffect)(()=>{if(!ei.date||!t.id){eu([]),ex(""),ey({}),ej(!1),ed(e=>({...e,tourTime:""}));return}ef(!0),d.FH.post("/check-tour-time",{tour_id:t.id,tour_date:ei.date}).then(e=>{let t=e.data;if("warning"===t.status||t.times&&0===t.times.length)eu([]),ex(t.message||"This tour is full on this day."),ey({}),ej(!1),ed(e=>({...e,tourTime:""}));else{let e=t.times||[];eu(e),ex(t.message||""),ey(t.remaining||{}),ej("limited"===t.status),ed(t=>({...t,tourTime:e.length>0?e[0]:""}))}}).catch(()=>
1{if(t.duration_time){let e=t.duration_time.split(" or ").map(e=>e.trim()).filter(Boolean);eu(e),ex(""),ey({}),ej(!1),ed(t=>({...t,tourTime:e.length>0?e[0]:""}))}}).finally(()=>ef(!1))},[ei.date,t.id,t.duration_time,$]);let ek=(0,r.useMemo)(()=>(null==W?void 0:W.time_slots)&&0!==W.time_slots.length?ec.filter(e=>W.time_slots.includes(e)):ec,[ec,W]);(0,r.useEffect)(()=>{ek.length>0&&!ek.includes(ei.tourTime)&&ed(e=>({...e,tourTime:ek[0]}))},[ek]);let eT=e=>{let{name:t,value:s,type:a}=e.target;if("whatsApp"===t){if("+"===s)return void ed({...ei,whatsApp:"+"});let e=s.replace(/[^0-9]/g,"").slice(0,15);return e?void ed({...ei,whatsApp:"+"+e}):void ed({...ei,whatsApp:""})}if("date"===t){if(s<ea){ed({...ei,[t]:ea}),eh("Please select a date from today onwards."),setTimeout(()=>eh(""),4e3);return}if(s>er){ed({...ei,[t]:er}),eh("You can only book tours up to 90 days in advance."),setTimeout(()=>eh(""),4e3);return}eh("")}let r="number"===a?Math.max(0,Number(s)):s;ed({...ei,[t]:r})},eP=()=>{"group"===Y&&!Z&&ei.adult+ei.young+ei.child+ei.infant>0&&ei.adult+ei.young+ei.child+ei.infant<2&&e$(!0)},eC=ei.adult+ei.young+ei.child+ei.infant,eS=eC>e_,[eA,eF]=(0,r.useState)(null),[eJ,eE]=(0,r.useState)(null),[eD,e$]=(0,r.useState)(!1);(0,r.useEffect)(()=>{if("group"===Y&&!Z&&eC>0&&eC<2){let e=setTimeout(()=>{e$(!0)},3e3);return()=>clearTimeout(e)}e$(!1)},[eC,Z,Y]),(0,r.useEffect)(()=>{W&&K(W.type)},[W]),(0,r.useEffect)(()=>{if(!ei.date||!t.id||"group"!==(W?W.type:Y)){ee(!1),eF(null);return}let e=W?V.indexOf(W):0;d.FH.post("/check-group-discount",{tour_id:t.id,tour_date:ei.date,tour_time:ei.tourTime,option_index:e}).then(e=>{let t=e.data;if(ee((null==t?void 0:t.has_existing_booking)||!1),t){var s,a,r,n;eF({remaining_slots:null!=(s=t.remaining_slots)?s:8,min_pax:null!=(a=t.min_pax)?a:2,is_new_group:null==(r=t.is_new_group)||r,total_booked_pax:null!=(n=t.total_booked_pax)?n:0})}}).catch(()=>{ee(!1),eF(null)})},[ei.date,ei.tourTime,t.id,W,Y,V]);let eO=(0,r.useMemo)(()=>W?(0,c.Tw)(W.price,W.type,ei.adult,ei.young,ei.child,Z):(0,c.eJ)(t,Y,ei.adult,ei.young,ei.child),[t,Y,W,ei.adult,ei.young,ei.child,Z]),eM=eO.netTotal,eU=(0,r.useMemo)(()=>"paypal"!==et||eM<=0?0:(.05*eM+.3)/.956,[eM,et]),eB=(eM+eU).toFixed(2),eI=e=>({tour_id:t.id,customer_name:ei.customerName,email:ei.customerEmail,phone:ei.whatsApp,sex:ei.sex,country:ei.nationality,tour_date:ei.date,tour_time:ei.tourTime,hotel_name:ei.hotelName,hotel_address:ei.hotelAddress,dropoff_address:eo?ei.dropoffAddress:"",language:ei.language,room:ei.room,food_notes:ei.foodPref?("non-veg"===ei.foodPref?"Non-vegetarians":"Vegetarians inclusive fish and eggs")+(ei.foodNotes?". "+ei.foodNotes:""):ei.foodNotes||"undefined",note:ei.note,adult:ei.adult,young:ei.young,child:ei.child,kids:ei.infant,tour_type:Y,option_index:W?V.indexOf(W):0,option_label:(null==W?void 0:W.label)||("private"===Y?"Private Tour":"Group Tour"),payment_method:et,payment_id:e||"",total_cost:eM,amount:Number(eB)}),eL=()=>
1{if(!ei.date)return alert("Please select a tour date."),!1;if(!ei.tourTime)return alert("Please select a tour time."),!1;let e=new Date().toISOString().split("T")[0];if(ei.date<e)return alert("Please select a future date."),!1;if(ec.length>0&&!ei.tourTime)return alert("Please select a tour time."),!1;if(em&&0===ec.length)return alert(em),!1;if(ev&&ew){let e="private"===Y?ew.private:ew.group;if(e<=0)return alert("No ".concat(Y," tour slots remaining for this time. Please choose a different time or date.")),!1;if(eC>e)return alert("Only ".concat(e," ").concat(Y," slot(s) remaining for this time. You selected ").concat(eC," guests.")),!1}return eS?(alert("Maximum ".concat(e_," guests per booking.")),!1):ei.customerName&&ei.customerEmail&&ei.whatsApp?!X||!!ei.hotelAddress||(alert("Please enter your hotel address for hotel pickup."),!1):(alert("Please fill in your Full Name, Email, and WhatsApp number."),!1)},eV=async()=>{if(eL()){J(!0);try{let e=await d.FH.post("/bookings",eI());eE({orderId:e.data.data.id,items:[{tour:t,tourDate:ei.date,tourTime:ei.tourTime,optionLabel:(null==W?void 0:W.label)||("private"===Y?"Private Tour":"Group Tour"),adult:ei.adult,young:ei.young,child:ei.child,kids:ei.infant}],totalToPay:eM}),D("success")}catch(e){console.error(e),alert("Failed to create booking. Please try again.")}finally{J(!1)}}},eG=async(e,s)=>{J(!0);try{let e=await s.order.capture(),a=await d.FH.post("/bookings",eI(e.id));eE({orderId:a.data.data.id,items:[{tour:t,tourDate:ei.date,tourTime:ei.tourTime,optionLabel:(null==W?void 0:W.label)||("private"===Y?"Private Tour":"Group Tour"),adult:ei.adult,young:ei.young,child:ei.child,kids:ei.infant}],totalToPay:eM}),D("success")}catch(e){console.error(e),alert("Payment completed but failed to save booking. Contact support.")}finally{J(!1)}},eq=e=>{A(e),e||D("form")},ez="paypal"===z||"both"===z;return(0,a.jsxs)(n.lG,{open:S,onOpenChange:eq,children:[!C&&(0,a.jsx)(n.zM,{asChild:!0,children:_||(0,a.jsx)(l.$,{className:"w-full size-lg bg-[#f57e16] hover:bg-[#e06d0a] text-white font-bold mt-4",children:k||(!1!==t.bookable?"Book Now":"Request this tour")})}),(0,a.jsxs)(n.Cf,{className:"sm:max-w-[700px] max-h-[85vh] overflow-y-auto max-sm:h-[100dvh] max-sm:max-h-[100dvh] max-sm:rounded-none max-sm:pb-[env(safe-area-inset-bottom)]",children:[(0,a.jsx)(n.c7,{children:(0,a.jsxs)(n.L3,{children:[!1!==t.bookable?"Book":"Request"," ",t.tour_name]})}),"success"===E?(0,a.jsxs)("div",{className:"py-6 space-y-6",children:[(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"mx-auto w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mb-4",children:(0,a.jsx)(u.A,{className:"w-8 h-8 text-green-600"})}),(0,a.jsx)("h3",{className:"text-2xl font-bold text-green-700 mb-2",children:"Booking Confirmed!"}),(0,a.jsx)("p",{className:"text-muted-foreground",children:"cash"===et?"Your booking is pending. Our team will c
1ontact you via WhatsApp to confirm and arrange payment.":"Payment received! A confirmation email has been sent."})]}),eJ&&(0,a.jsxs)("div",{className:"border rounded-xl overflow-hidden mt-6 text-left",children:[(0,a.jsxs)("div",{className:"bg-gray-50 px-4 py-3 border-b text-sm text-gray-500 font-medium",children:["Booking Number: ",(0,a.jsx)("span",{className:"text-gray-900 font-bold",children:582527+Number(eJ.orderId)})]}),(0,a.jsx)("div",{className:"divide-y divide-gray-200",children:eJ.items.map((e,t)=>(0,a.jsxs)("div",{className:"py-2",children:[(0,a.jsxs)("div",{className:"flex py-2 px-4 text-sm",children:[(0,a.jsx)("div",{className:"w-[30%] sm:w-1/3 text-gray-900 font-bold",children:"Tour Name:"}),(0,a.jsx)("div",{className:"w-[70%] sm:w-2/3 text-gray-900 font-normal",children:e.tour.tour_name})]}),(0,a.jsxs)("div",{className:"flex py-2 px-4 text-sm",children:[(0,a.jsx)("div",{className:"w-[30%] sm:w-1/3 text-gray-900 font-bold",children:"Date & Time:"}),(0,a.jsx)("div",{className:"w-[70%] sm:w-2/3 text-gray-900 font-normal",children:(()=>{let t=e.tourDate;try{let s=new Date(e.tourDate);isNaN(s.getTime())||(t=s.toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}))}catch(e){}let s=e.tourTime?e.tourTime.split(";")[0].trim():"";return"".concat(t).concat(s?", ".concat(s):"")})()})]}),(0,a.jsxs)("div",{className:"flex py-2 px-4 text-sm",children:[(0,a.jsx)("div",{className:"w-[30%] sm:w-1/3 text-gray-900 font-bold",children:"Option:"}),(0,a.jsx)("div",{className:"w-[70%] sm:w-2/3 text-gray-900 font-normal",children:e.optionLabel||("private"===e.tourType?"Private":"Group")})]}),(0,a.jsxs)("div",{className:"flex py-2 px-4 text-sm",children:[(0,a.jsx)("div",{className:"w-[30%] sm:w-1/3 text-gray-900 font-bold",children:"Guests:"}),(0,a.jsx)("div",{className:"w-[70%] sm:w-2/3 text-gray-900 font-normal",children:[e.adult>0?"".concat(e.adult," Adults"):null,e.young>0?"".concat(e.young," Child(7-12)"):null,e.child>0?"".concat(e.child," Child(5-6)"):null,e.kids>0?"".concat(e.kids," Infants"):null].filter(Boolean).join(", ")})]})]},t))}),(0,a.jsxs)("div",{className:"bg-gray-50 px-3 sm:px-4 py-4 border-t text-[13px] sm:text-[15px] tracking-tight sm:tracking-normal text-center sm:text-left text-gray-900 whitespace-nowrap overflow-x-auto",children:[(0,a.jsx)("span",{className:"font-medium text-gray-600",children:"cash"===et?"Amount Due (to be paid on tour): ":"Total Paid: "}),(0,a.jsx)("span",{className:"font-bold text-[#f57e16]",children:"cash"===et?"".concat((eJ.totalToPay*M).toLocaleString("en-US")," VND"):"$".concat(eJ.totalToPay)})]})]}),(0,a.jsx)("div",{className:"text-center pt-4",children:(0,a.jsx)(l.$,{onClick:()=>eq(!1),className:"w-full sm:w-auto bg-[#f57e16] hover:bg-[#e06d0a] text-white",children:"Close"})})]}):"added"===E?(0,a.jsxs)("div",{className:"text-center py-8 space-y-4",children:[(0,a.jsx)("div",{className:"mx-auto w-16 h-16 bg-[#f57e16]/10 rounded-full flex items-center justify-center",children:(0,a.jsx)(m.A,{className:"w-8 h-8 text-[#f57e16]"})}),(0,a.jsx)("h3",{className:"text-xl font-bold text-[#f57e16]",children:"Added to Cart!"}),(0,a.jsxs)("p",{className:"text-muted-foreground",children:[t.tour_name," has been added to your cart."]}),(0,a.jsxs)("div",{className:"flex gap-3 justify-center",children:[(0,a.jsx)(l.$,{variant:"outline",onClick:()=>{D("form"),eq(!1)},children:"Continue Shopping"}),(0,a.jsx)(l.$,{className:"bg-[#f57e16] hover:bg-[#e06d0a] text-white",onClick:()=>{eq(!1),window.location.href="/checkout"},children:"Checkout Now"})]})]}):(0,a.jsxs)(a.Fragment,{children:[G?(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(i.J,{className:"text-sm font-bold mb-2 block",children:"Select Option"}),(0,a.jsx)("div",{className:"space-y-2",children:V.map((e,t)=>{let s=e.tour_type||"group",r=!!ev&&!!ew&&("private"===s?ew.private<=0:ew.group<=0);return(0,a.jsxs)("button",{type:"button",disabled:r,className:"w-full text-left p-3 rounded-lg border-2 transition-all ".concat(r?"border-gray-200 bg-gray-50 opacity-50 cursor-not-allowed":H===t?"border-[#f57e16] bg-[#f57e16]/5":"border-gray-200 hover:border-gray-300"),onClick:()=>!r&&R(t),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-4 h-4 rounded-full border-2 flex items-center justify-center ".concat(r?"border-gray-300":H===t?"border-[#f57e16]":"border-gray-300"),children:!r&&H===t&&(0,a.jsx)("div",{className:"w-2 h-2 rounded-full bg-[#f57e16]"})}),(0,a.jsx)("span",{className:"font-semibold text-sm ".concat(r?"text-gray-400 line-through":H===t?"text-[#f57e16]":"text-gray-700"),children:e.label}),r&&(0,a.jsx)("span",{className:"text-xs bg-red-100 text-red-600 px-2 py-0.5 rounded-full font-medium",children:"Sold out"})]}),(0,a.jsxs)("span",{className:"font-bold text-sm ".concat(r?"text-gray-400":"text-[#f57e16]"),children:["$",e.price," per person"]})]}),e.subtitle&&(0,a.jsxs)("p",{className:"text-xs text-gray-500 mt-1 ml-6 flex items-center gap-1",children:["meeting_point"===e.pickup_type&&(0,a.jsx)(x.A,{className:"w-3 h-3 flex-shrink-0"}),e.subtitle]})]},t)})})]}):q?(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(i.J,{className:"text-sm font-bold mb-2 block",children:"Tour Type"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("button",{type:"button",disabled:!!ew&&ew.group<=0,
1className:"flex items-center justify-center gap-2 py-3 px-4 rounded-lg border-2 transition-all font-semibold text-sm ".concat("group"===Y?"border-[#f57e16] bg-[#f57e16]/10 text-[#f57e16]":ew&&ew.group<=0?"border-gray-200 text-gray-300 cursor-not-allowed opacity-50":"border-gray-200 text-gray-500 hover:border-gray-300"),onClick:()=>K("group"),children:[(0,a.jsx)(p.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Group Tour"}),(0,a.jsxs)("span",{className:"ml-auto font-bold",children:["$",Number(t.price).toFixed(0)]})]}),(0,a.jsxs)("button",{type:"button",disabled:!!ew&&ew.private<=0,className:"flex items-center justify-center gap-2 py-3 px-4 rounded-lg border-2 transition-all font-semibold text-sm ".concat("private"===Y?"border-[#f57e16] bg-[#f57e16]/10 text-[#f57e16]":ew&&ew.private<=0?"border-gray-200 text-gray-300 cursor-not-allowed opacity-50":"border-gray-200 text-gray-500 hover:border-gray-300"),onClick:()=>K("private"),children:[(0,a.jsx)(h.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Private Tour"}),(0,a.jsxs)("span",{className:"ml-auto font-bold",children:["$",Number(t.private_price).toFixed(0)]})]})]})]}):null,(0,a.jsxs)("div",{className:"space-y-4 py-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-full",children:[(0,a.jsxs)("div",{className:"space-y-1.5 min-w-0 max-w-full",children:[(0,a.jsxs)(i.J,{className:"text-sm font-semibold",children:["Tour Date ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),(0,a.jsx)(o.p,{suppressHydrationWarning:!0,name:"date",type:"date",required:!0,value:ei.date,onChange:eT,min:ea,max:er,className:"block w-full max-w-full min-w-0 appearance-none text-sm px-2"}),ep&&(0,a.jsx)("p",{className:"text-xs text-red-500 mt-1 animate-in fade-in duration-300",children:ep})]}),(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsxs)(i.J,{className:"text-sm font-semibold",children:["Tour Time ",(0,a.jsx)("span",{className:"text-red-500",children:"*"})]}),eg?(0,a.jsxs)("div",{className:"flex items-center gap-2 h-10 text-sm text-muted-foreground px-3",children:[(0,a.jsx)(g.A,{className:"w-4 h-4 animate-spin"}),"Checking..."]}):em&&0===ec.length?(0,a.jsxs)("div",{className:"text-xs text-red-600 font-medium bg-red-50 border border-red-200 rounded-md px-3 py-2.5 leading-tight",children:["â ",em]}):ek.length>0?(0,a.jsx)("select",{name:"tourTime",value:ei.tourTime,onChange:eT,className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:ek.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}):ec.length>0?(0,a.jsx)("div",{className:"text-xs text-orange-600 font-medium bg-orange-50 border border-orange-200 rounded-md px-3 py-2.5 leading-tight",children:"â No time slots available for this option"}):(0,a.jsx)("div",{className:"flex items-center h-10 text-xs text-muted-foreground px-3 border border-dashed rounded-md",children:"Pick a date first"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)(i.J,{className:"text-sm font-semibold mb-2 block",children:["Guests",ev&&ew?(0,a.jsxs)("span",{className:"text-xs text-orange-600 font-normal ml-2",children:["(","private"===Y?ew.private:ew.group," ",Y," slot(s) remaining)"]}):(0,a.jsxs)("span",{className:"text-xs text-muted-foreground font-normal ml-2",children:["(max ",e_," per booking)"]})]}),eD&&(0,a.jsx)("div",{className:"text-xs mb-3 font-medium px-3 py-2 rounded-md border bg-orange-50 text-orange-600 border-orange-200",children:"Group tours require a minimum of 2 guests to operate. If you are the first and only guest booked, you may still confirm the tour by paying the 2-guest minimum."}),(0,a.jsxs)("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(i.J,{className:"text-xs text-muted-foreground",children:["Adult ",ei.adult>0&&(0,a.jsxs)("span",{className:"text-primary font-medium",children:["$",eO.adultUnitPrice.toFixed(0)," per person"]})]}),(0,a.jsx)(o.p,{type:"number",name:"adult",min:"1",max:e_,value:ei.adult,onChange:eT,onBlur:eP,className:"h-9"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(i.J,{className:"text-xs text-muted-foreground",children:["Child 7-12 ",ei.young>0&&(0,a.jsxs)("span",{className:"text-primary font-medium",children:["$",eO.youngUnitPrice.toFixed(0)," per person"]})]}),(0,a.jsx)(o.p,{type:"number",name:"young",min:"0",max:e_,value:ei.young,onChange:eT,onBlur:eP,className:"h-9"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(i.J,{className:"text-xs text-muted-foreground",children:["Child 5-6 ",ei.child>0&&(0,a.jsxs)("span",{className:"text-primary font-medium",children:["$",eO.childUnitPrice.toFixed(0)," per person"]})]}),(0,a.jsx)(o.p,{type:"number",name:"child",min:"0",max:e_,value:ei.child,onChange:eT,onBlur:eP,className:"h-9"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(i.J,{className:"text-xs text-muted-foreground",children:["Under 5 ",(0,a.jsx)("span",{className:"text-green-600 font-medium",children:"Free"})]}),(0,a.jsx)(o.p,{type:"number",name:"infant",min:"0",max:e_,value:ei.infant,onChange:eT,onBlur:eP,className:"h-9"})]})]}),eS&&(0,a.jsxs)("p",{className:"text-xs text-red-600 font-medium mt-1.5",children:["â Maximum ",e_," guests per booking. You have ",eC,"."]}),ev&&ew&&!eS&&(0,a.jsxs)("p",{className:"text-xs text-orange-600 font-medium mt-1.5",children:["â Limited availability: ",ew.group>0?"".concat(ew.group," group"):"",ew.group>0&&ew.private>0?" / ":"",ew.private>0?"".concat(ew.private," private"):""," slot(s) remaining"]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1.5",children:[(0,a.jsx)(i.J,{className:"text-xs text-muted-foreground",children:"Food Preferences"}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,a.jsx)("input",{type:"radio",name:"foodPref",value:"non-veg",checked:"non-veg"===ei.foodPref,onChange:()=>ed({...ei,foodPref:"non-veg"}),className:"accent-[#f57e16]"}),"Non-vegetarians"]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,a.jsx)("input",{type:"radio",name:"foodPref",value:"veg",checked:"veg"===ei.foodPref,onChange:()=>ed({...ei,foodPref:"veg"}),className:"accent-[#f57e16]"}),"Vegetarians inclusive fish and eggs"]})]})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs text-muted-foreground",children:"Your food notes (optional)"}),(0,a.jsx)(o.p,{name:"foodNotes",value:ei.foodNotes,onChange:eT,placeholder:"Allergies",className:"h-9"})]})]}),(0,a.jsx)("div",{className:"bg-orange-50 border border-orange-200 rounded-lg p-3 text-sm text-orange-900",children:(0,a.jsxs)("p",{children:[(0,a.jsx)("strong",{className:"text-orange-700",children:"! Important:"})," ",t.booking_note||"The tours are only included pickup and drop-off passengers from (to) inside Cantho city center. So if your Can Tho hotel/homestay is outside the city center, please contact us before you book. Type the name of the place in Your hotel name, the address in Your hotel address."]})})]}),I&&(0,a.jsxs)("div",{className:"border rounded-xl p-4 space-y-3 bg-gray-50/50",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"font-bold text-sm",children:"Customer Info (for Direct Booking)"}),(0,a.jsx)("button",{type:"button",onClick:()=>L(!1),className:"text-xs text-muted-foreground hover:text-primary underline underline-offset-4",children:"â Back"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"Full Name *"}),(0,a.jsx)(o.p,{name:"customerName",required:!0,value:ei.customerName,onChange:eT})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"Gender"}),(0,a.jsxs)("select",{name:"sex",value:ei.sex,onChange:eT,className:"flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm",children:[(0,a.jsx)("option",{value:"Male",children:"Male"}),(0,a.jsx)("option",{value:"Female",children:"Female"}),(0,a.jsx)("option",{value:"Prefer not to say",children:"Prefer not to say"})]})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"Nationality"}),(0,a.jsx)(o.p,{name:"nationality",value:ei.nationality,onChange:eT})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"WhatsApp with country code *"}),(0,a.jsx)(o.p,{name:"whatsApp",type:"tel",autoComplete:"off",required:!0,value:ei.whatsApp,onChange:eT,placeholder:"+84 xxx xxx xxx"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"Email *"}),(0,a.jsx)(o.p,{name:"customerEmail",type:"email",required:!0,value:ei.customerEmail,onChange:eT})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"Tour guide language"}),1===el.length?(0,a.jsx)("div",{className:"flex items-center h-10 px-3 text-sm border rounded-md bg-muted/30 text-foreground",children:el[0]}):(0,a.jsx)("select",{name:"language",value:ei.language,onChange:eT,className:"flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm",children:el.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]})]}),Q&&(0,a.jsxs)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3 text-sm text-blue-800 flex items-start gap-2",children:[(0,a.jsx)(x.A,{className:"w-4 h-4 mt-0.5 flex-shrink-0 text-blue-600"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-semibold text-xs text-blue-700 mb-0.5",children:"Meeting Point"}),(0,a.jsx)("p",{className:"text-xs",children:Q})]})]}),(!W||"meeting_point"!==W.pickup_type)&&(0,a.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(i.J,{className:"text-xs",children:["Pickup hotel/place",X?" *":""]}),(0,a.jsx)(o.p,{name:"hotelName",value:ei.hotelName,onChange:eT,placeholder:"e.g. Victoria Hotel, Ninh Kieu Wharf"})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsxs)(i.J,{className:"text-xs",children:["Pickup address",X?" *":""]}),(0,a.jsx)(j.$,{value:ei.hotelAddress,onChange:e=>ed({...ei,hotelAddress:e}),placeholder:X?"Search or type your pickup address":"Optional â search or type address",required:X})]})]}),eo&&(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(i.J,{className:"text-xs",children:"Drop-off hotel/place"}),(0,a.jsx)(j.$,{value:ei.dropoffAddress,onChange:e=>ed({...ei,dropoffAddress:e}),placeholder:t.dropoff_placeholder||"Search or type your drop-off place",required:!1})]})]}),(0,a.jsxs)("div",{className:"bg-muted/30 p-4 rounded-lg space-y-2",children:[(0,a.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,a.jsx)("span",{children:G?"Option:":"Tour Type:"}),(0,a.jsx)("span",{className:"font-semibold text-right max-w-[60%]",children:(null==W?void 0:W.label)||"".concat(Y.charAt(0).toUpperCase()+Y.slice(1)," Tour")})]}),ei.adult>0&&(0,a.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,a.jsxs)("span",{children:[ei.adult," Adult",ei.adult>1?"s":""," \xd7 $",eO.adultUnitPrice.toFixed(0)]}),(0,a.jsxs)("span",{children:["$",eO.adultTotal.toFixed(2)]})]}),ei.young>0&&(0,a.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,a.jsxs)("span",{children:[ei.young," Child 7-12 \xd7 $",eO.youngUnitPrice.toFixed(0)]}),(0,a.jsxs)("span",{children:["$",eO.youngTotal.toFixed(2)]})]}),ei.child>0&&(0,a.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,a.jsxs)("span",{children:[ei.child," Child 5-6 \xd7 $",eO.childUnitPrice.toFixed(0)]}),(0,a.jsxs)("span",{children:["$",eO.childTotal.toFixed(2)]})]}),ei.infant>0&&(0,a.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,a.jsxs)("span",{children:[ei.infant," Under 5"]}),(0,a.jsx)("span",{children:"Free"})]}),I&&"paypal"===et&&eU>0&&(0,a.jsxs)("div",{className:"flex justify-between text-sm text-muted-foreground",children:[(0,a.jsx)("span",{children:"Transaction Fee (PayPal):"}),(0,a.jsxs)("span",{children:["$",eU.toFixed(2)]})]}),(0,a.jsxs)("div",{className:"flex justify-between font-bold text-lg pt-2 border-t",children:[(0,a.jsx)("span",{children:I?"Total to Pay:":"Subtotal:"}),(0,a.jsxs)("span",{className:"text-primary",children:["$",I?eB:eM.toFixed(2)]})]}),I&&"cash"===et&&eM>0&&(0,a.jsxs)("div",{className:"flex justify-between text-sm font-semibold text-green-700 bg-green-50 p-2 rounded mt-1",children:[(0,a.jsxs)("span",{children:["VND (rate: ",M.toLocaleStr
1ing("en-US"),")"]}),(0,a.jsxs)("span",{children:[(eM*M).toLocaleString("en-US")," VND"]})]})]}),!I&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(l.$,{onClick:()=>L(!0),className:"w-full py-6 text-base font-bold bg-[#f57e16] hover:bg-[#e06d0a] text-white",children:"Book Now"}),(0,a.jsxs)(l.$,{onClick:()=>{if(!ei.date)return void alert("Please select a tour date.");let e=new Date().toISOString().split("T")[0];if(ei.date<e)return void alert("Please select a future date.");if(em&&0===ec.length)return void alert(em);if(ev&&ew){let e="private"===Y?ew.private:ew.group;if(e<=0)return void alert("No ".concat(Y," tour slots remaining for this time. Please choose a different time or date."));if(eC>e)return void alert("Only ".concat(e," ").concat(Y," slot(s) remaining for this time. You selected ").concat(eC," guests."))}if(eS)return void alert("Maximum ".concat(e_," guests per booking."));B({tour:t,tourDate:ei.date,tourTime:ei.tourTime,adult:ei.adult,young:ei.young,child:ei.child,kids:ei.infant,tourType:Y,optionIndex:W?V.indexOf(W):0,optionLabel:(null==W?void 0:W.label)||("private"===Y?"Private Tour":"Group Tour"),subtotal:eM,foodNotes:ei.foodPref?("non-veg"===ei.foodPref?"Non-vegetarians":"Vegetarians inclusive fish and eggs")+(ei.foodNotes?". "+ei.foodNotes:""):ei.foodNotes||"undefined",note:ei.note},{openCart:!1}),D("added")},variant:"outline",className:"w-full py-6 text-base font-bold border-[#f57e16] text-[#f57e16] hover:bg-[#f57e16] hover:text-white transition-colors",children:[(0,a.jsx)(m.A,{className:"w-5 h-5 mr-2"}),"Add to Cart"]})]}),I?(0,a.jsxs)(a.Fragment,{children:[ez&&("cash"===z||"both"===z)&&(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)(i.J,{className:"text-sm font-bold mb-2 block",children:"Payment Method"}),(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,a.jsxs)("button",{type:"button",className:"flex items-center justify-center gap-2 py-3 px-4 rounded-lg border-2 transition-all font-semibold text-sm ".concat("paypal"===et?"border-blue-500 bg-blue-50 text-blue-700":"border-gray-200 text-gray-500 hover:border-gray-300"),onClick:()=>es("paypal"),children:[(0,a.jsx)(f.A,{className:"w-4 h-4"}),"PayPal / Card"]}),(0,a.jsxs)("button",{type:"button",className:"flex items-center justify-center gap-2 py-3 px-4 rounded-lg border-2 transition-all font-semibold text-sm ".concat("cash"===et?"border-green-500 bg-green-50 text-green-700":"border-gray-200 text-gray-500 hover:border-gray-300"),onClick:()=>es("cash"),children:[(0,a.jsx)(b.A,{className:"w-4 h-4"}),"Cash on Tour Day"]})]})]}),(0,a.jsx)("div",{className:"mt-4",children:"paypal"===et&&ez?(0,a.jsx)(y.ag,{options:{clientId:"AVbwX7yGljk0KmgKOythl0ibiIiqFJDN3s2pzwFlj3MCAK-btHWR7pT704Ank2vLdmDI34eORUTvbLo4"},children:(0,a.jsx)(y.JV,{style:{layout:"horizontal"},createOrder:(e,t)=>eL()?t.order.create({intent:"CAPTURE",purchase_units:[{amount:{currency_code:"USD",value:eB}}]}):Promise.reject(Error("Validation failed")),onApprove:eG})}):(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-3 text-sm text-amber-800",children:["Book now and pay later: We accept ",(0,a.jsx)("strong",{children:"VND cash only"})," on the day of the tour."]}),(0,a.jsxs)(l.$,{onClick:eV,disabled:F,className:"w-full bg-green-600 hover:bg-green-700 text-white py-6 whitespace-nowrap text-[13px] sm:text-base font-bold",children:[F?(0,a.jsx)(g.A,{className:"h-5 w-5 animate-spin"}):(0,a.jsx)(b.A,{className:"w-5 h-5"}),"Confirm Booking â Pay ",(eM*M).toLocaleString("en-US")," VND Cash"]})]})})]}):null]})]})]})}},3407:(e,t,s)=>{function a(e){if(!e.pricing_tiers)return null;try{return JSON.parse(e.pricing_tiers)}catch(e){return null}}function r(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t<=0)return 0;let a=e[String(t)];if(void 0!==a)return a*t;let r=Object.keys(e).map(Number).sort((e,t)=>e-t),n=r[r.length-1];if(t<=n){let s=r[0];for(let e of r)e<=t&&(s=e);return e[String(s)]*t}let l=e[String(n)];return l*n+(t-n)*(s>0?s:l)}function n(e,t,s,a){let r=Math.max(t,2)*e,n=.75*e,l=.5*e,o=s*n,i=a*l;return{adultTotal:r,youngTotal:o,childTotal:i,infantTotal:0,adultUnitPrice:t>0?r/t:e,youngUnitPrice:n,childUnitPrice:l,netTotal:r+o+i}}function l(e,t,s,l,o){let i=a(e);return"private"===t&&null!=e.private_price&&e.private_price>0?n(Number(e.private_price),s,l,o):"v2"===e.pricing_mode&&i&&i.adult?function(e,t,s,a){let n=e.adult?r(e.adult,t,e.extra_adult_price||0):0,l=e.child_7_12?r(e.child_7_12,s,e.extra_child_7_12_price||0):0,o=e.child_5_6?r(e.child_5_6,a,e.extra_child_5_6_price||0):0,i=t>0?n/t:0,d=s>0?l/s:0,c=a>0?o/a:0;return{adultTotal:n,youngTotal:l,childTotal:o,infantTotal:0,adultUnitPrice:i,youngUnitPrice:d,childUnitPrice:c,netTotal:n+l+o}}(i,s,l,o):n(Number(e.price),s,l,o)}function o(e){let t=a(e);if(!t||!t.adult)return null;let s=Object.keys(t.adult).map(Number).sort((e,t)=>
1e-t),r=Math.max(...s),n=[];for(let e=1;e<=r;e++){var l,o,i,d,c,u,m,x,p;n.push({pax:e,adult:null!=(c=t.adult[String(e)])?c:t.adult[String(s[s.length-1])],child712:null!=(m=null!=(u=null==(l=t.child_7_12)?void 0:l[String(e)])?u:null==(o=t.child_7_12)?void 0:o[String(Object.keys(t.child_7_12||{}).pop()||"1")])?m:0,child56:null!=(p=null!=(x=null==(i=t.child_5_6)?void 0:i[String(e)])?x:null==(d=t.child_5_6)?void 0:d[String(Object.keys(t.child_5_6||{}).pop()||"1")])?p:0})}return n}function i(e){return(function(e){if(!e.tour_options)return[];try{let t=JSON.parse(e.tour_options);return Array.isArray(t)?t:[]}catch(e){return[]}})(e).filter(e=>e.enabled&&e.price>0)}function d(e){if(!e)return["English"];let t=e.trim();if(t.startsWith("["))try{let e=JSON.parse(t);if(Array.isArray(e)){let t=e.map(e=>String(e).trim()).filter(Boolean);return t.length>0?t:["English"]}}catch(e){}let s=t.split(",").map(e=>e.trim()).filter(Boolean);return s.length>0?s:["English"]}function c(e,t,s,a,r){let l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if("group"===t&&l){let t=s*e,n=.75*e*a,l=.5*e*r;return{adultTotal:t,youngTotal:n,childTotal:l,infantTotal:0,adultUnitPrice:e,youngUnitPrice:.75*e,childUnitPrice:.5*e,netTotal:t+n+l}}return n(e,s,a,r)}s.d(t,{L3:()=>d,Lt:()=>o,Tw:()=>c,eJ:()=>l,yf:()=>i})},4620:(e,t,s)=>{s.d(t,{$:()=>n});var a=s(5155),r=s(6755);function n(e){let{value:t,onChange:s,placeholder:n,required:l,className:o}=e;return(0,a.jsx)(r.default,{apiKey:"AIzaSyBuIoMVnGJt45QN1vBo0sp6SeK-S886x4I",onPlaceSelected:e=>{e&&s(e.formatted_address||e.name||"")},options:{types:["establishment","geocode"],componentRestrictions:{country:"vn"}},defaultValue:t,onChange:e=>s(e.target.value),placeholder:n,className:o||"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"})}},6331:(e,t,s)=>{s.d(t,{J:()=>d});var a=s(5155),r=s(2115),n=s(2894),l=s(3101),o=s(8456);let i=(0,l.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef((e,t)=>{let{className:s,...r}=e;return(0,a.jsx)(n.b,{ref:t,className:(0,o.cn)(i(),s),...r})});d.displayName=n.b.displayName}}]);
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.