1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4679],{34679:(e,t,a)=>{a.r(t),a.d(t,{default:()=>eK});var r=a(73365),s=a(1521),i=a(1702),l=a(77587),n=a(76156),o=a(42766),d=a(77600);let c=e=>{let[t,a]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{(()=>{if(!window?.grecaptcha?.enterprise&&!t){a(!0);let t=document.createElement("script");t.src=`https://www.google.com/recaptcha/enterprise.js?render=${e}`,t.onload=()=>{a(!1)},(document.head||document.body||document.documentElement).appendChild(t)}})()},[e,t]),(0,s.useCallback)(t=>new Promise((a,r)=>{window?.grecaptcha?.enterprise?window.grecaptcha.enterprise.ready(()=>{window.grecaptcha.enterprise.execute(e,{action:t}).then(a).catch(r)}):r(Error("reCAPTCHA not loaded"))}),[e])};var m=a(53069),u=a(14487),p=a(70348),g=a(93785);function h({currentStep:e="dates"}){let{globalSettings:t,isWaitlistMode:a}=(0,o.useTourBooking)(),s=[{key:"dates",label:t?.bookingStepChooseDatesLabel||"Dates & Pricing"},{key:"customize",label:t?.bookingStepCustomizeLabel||"Customize"},{key:"guests",label:t?.bookingStepGuestsLabel||"Guests"},{key:"payment",label:t?.bookingStepPaymentLabel||"Payment"}],i=a?s.filter(e=>"payment"!==e.key):s;return(0,r.jsx)("div",{className:"relative max-w-4xl mx-auto",children:(0,r.jsxs)("div",{className:"relative flex justify-between items-center",children:[(0,r.jsx)("div",{className:"tb-progress-line"}),i.map((t,a)=>{let s=(t=>{let a=i.findIndex(t=>t.key===e),r=i.findIndex(e=>e.key===t);return r<a?"completed":r===a?"current":"upcoming"})(t.key),l="completed"===s,n="current"===s,o=a===i.length-1;return(0,r.jsxs)("div",{className:"flex flex-col items-center relative z-10",children:[0===a&&(0,r.jsx)("div",{className:"tb-progress-mask--first"}),o&&(0,r.jsx)("div",{className:"tb-progress-mask--last"}),(0,r.jsx)("div",{className:`w-4 h-4 rounded-full flex items-center justify-center border-[2px] border-obsidian relative z-10 ${l?"bg-obsidian":n?"bg-aurora":"bg-white"}`}),(0,r.jsxs)("span",{className:`mt-3 text-center type-caption ${l||n?"text-obsidian":"text-cool-granite-3"} ${l&&"flex items-center gap-2"}`,children:[l&&(0,r.jsx)(g.A,{name:"check",width:"11px",height:"11px"}),t.label]})]},t.key)})]})})}var b=a(24712),f=a(16968),x=a(46204),_=a(64620),v=a(80353),y=a(63440),j=a(34801),N=a.n(j);function w({showImage:e=!0}){let{tourData:t}=(0,o.useTourBooking)(),a=(0,v.U)(y.HP.md);if(!t)return null;let s=t.ts_metadata?.name||"Tour Title",i=t?.highlightImage?.cloudinaryAsset||void 0,l=i?.asset?.secure_url,n=t?.highlightImage?.altText||"",d=i?.asset?.metadata?.alt_text||"",c=n||d||s||"",m=i?.asset?.width,u=i?.asset?.height,p=i?.asset?.metadata?.focal_point||"middle_center",{maxWidth:g,sizes:h}=(0,_.eP)("thumbnail");return(0,r.jsxs)("div",{className:N()("flex flex-col-reverse md:flex-row items-start gap-8",{"gap-0!":!a&&(!e||!l)}),children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(b.A,{level:"h2",text:(0,f.m)(s),className:"text-left"})}),(0,r.jsx)("div",{className:"w-[50%] md:w-75 min-w-41 rounded-lg overflow-hidden shrink-0",children:e&&l?(0,r.jsx)(x.A,{src:l,alt:c,width:m,height:u,aspectRatio:"16-9",focalPoint:p,maxWidth:g,sizes:h}):a?(0,r.jsx)("div",{className:"aspect-video"}):null})]})}var S=a(9670),T=a(50284),A=a(51921),k=a(56598);let L={[A.db.PRE_TOUR_HOTEL]:A.db.PRE_TOUR_EXTRA_EXPERIENCE,[A.db.POST_TOUR_HOTEL]:A.db.POST_TOUR_EXTRA_EXPERIENCE},C=e=>{let t=e?.ts_metadata,a=t?.departure_date;if(!a)return[];let r=(0,k.k)(a);return Array.from({length:Math.max(1,t?.duration??1)},(e,t)=>{let a=new Date(r.getTime());return a.setUTCDate(a.getUTCDate()+t),a.getTime()})},E=(e,t)=>{let a=L[(0,A.uA)(e)];if(!a)return!1;let r=C(e);if(0===r.length)return!1;let s=new Set(r);return t.some(e=>(0,A.uA)(e)===a&&C(e).some(e=>s.has(e)))};var P=a(4317),R=a(94645);let O=({className:e="",headingClassName:t="heading-4",enabled:a=!1})=>{let{bookingState:i,applyPromoCode:l,removePromoCode:n,globalSettings:d}=(0,o.useTourBooking)(),[c,m]=(0,s.useState)(""),[u,g]=(0,s.useState)(!1),h=async()=>{if(c.trim()){g(!0);try{await l(c.trim())&&m("")}finally{g(!1)}}};return a?(0,r.jsxs)("div",{className:`space-y-4 md:space-y-6 ${e}`,children:[(0,r.jsx)("div",{className:t,children:d?.promoCodeSectionLabel||"Promo Code"}),"applied"===i.promo_code_status&&i.promo_code&&(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-green-50 border border-green-200 rounded",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-green-700 font-medium",children:i.promo_code}),(0,r.jsx)("span",{className:"text-green-600 text-sm",children:d?.promoCodeAppliedLabel||"Applied"})]}),(0,r.jsx)(p.A,{type:"button",variant:"text-link",onClick:()=>{n(),m("")},className:"text-green-700 hover:text-green-800",children:d?.promoCodeRemoveLabel||"Remove"})]}),"removed"===i.promo_code_status&&(0,r.jsx)("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded",children:(0,r.jsx)("span",{className:"text-yellow-700 text-sm",children:d?.promoCodeRemovedLabel||"Removed"})}),("none"===i.promo_code_status||"invalid"===i.promo_code_status||"removed"===i.promo_code_status)&&(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)(R.pd,{type:"text",value:c,onChange:e=>m(e.target.value),onKeyPress:e=>{"Enter"===e.key&&h()},placeholder:d?.promoCodePlaceholder||"Enter Promo Code",error:"invalid"===i.promo_code_status,disabled:u}),"invalid"===i.promo_code_status&&(0,r.jsx)("div",{className:"text-red-600 text-sm mt-1",children:d?.promoCodeInvalidMessage||"Invalid promo code"})]}),(0,r.jsx)(p.A,{type:"button",variant:"primary",onClick:h,disabled:!c.trim()||u,className:"shrink-0",children:u?d?.promoCodeApplyingLabel||"Applying...":d?.promoCodeApplyLabel||"Apply"})]})]}):null};function $({isWaitlistMode:e,isFullPaymentDue:t,isConfirmation:a=!1,settings:r}){return e?r?.waitlistDueTodayLabel||"No deposit due today":a?t?r?.customizeTotalPaidTodayLabel||"Total paid today":r?.customizeDepositPaidTodayLabel||"Deposit paid today":t?r?.customizeTotalDueTodayLabel||"Total due today":r?.customizeDepositDueTodayLabel||"Deposit due today"}let F=({showPromoCode:e=!1,showDeposit:t=!0,className:a="mt-12 mb-10 md:mb-6"})=>{let{summaryData:s,globalSettings:i,isWaitlistMode:l}=(0,o.useTourBooking)(),n=$({isWaitlistMode:l,isFullPaymentDue:s.isFullPaymentDue,settings:i});return(0,r.jsxs)("div",{className:a,children:[(0,r.jsx)("div",{className:"heading-2",children:i?.customizeSummaryLabel||"Summary"}),e&&(0,r.jsx)(O,{className:"mt-6"}),(0,r.jsxs)("div",{className:`space-y-2 border-t border-moss mt-10 md:mt-8 ${l?"mb-0":""}`,children:[t&&(0,r.jsxs)("div",{className:"tb-subsection heading-4 bg-pollen p-6 md:p-8",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"heading-4 block mb-1",children:n}),l&&(0,r.jsx)("div",{className:"type-caption",children:i?.customizeNoPaymentRequiredLabel||"No payment required to join waitlist."})]}),(0,r.jsxs)("span",{className:"heading-4",children:["$",(0,P.$g)({amount:l?0:s.amountDueToday})]})]}),(0,r.jsxs)("div",{className:"tb-subsection heading-4 p-6 md:p-8 mb-0",children:[(0,r.jsx)("span",{children:s.totalLabel}),(0,r.jsxs)("span",{children:["$",(0,P.$g)({amount:s.grandTotal})]})]})]})]})};var I=a(76873);let D=({heading:e,description:t,style:a="success",url:s,title:i,tourId:l,disablePageActions:n=!1}
1)=>{let{globalSettings:d}=(0,o.useTourBooking)(),c=N()({"bg-bolt":"onRequest"===a||"waitlist"===a,"bg-a11y-trailblaze":"warning"===a,"bg-aurora":"success"===a}),m=N()({"heading-2":"warning"!==a&&"waitlist"!==a,"heading-4":"warning"===a||"waitlist"===a,"mb-4":"waitlist"===a}),u=N()("type-paragraph",{"font-bold":"warning"!==a,"mb-8":!n,"container-small mb-0":"waitlist"===a,"flex items-center gap-4":"success"===a},"print:mb-0!"),p=(0,v.U)(y.HP.md);return(0,r.jsxs)("div",{className:`${c} rounded-xl px-8 py-6 md:px-14 md:py-12 mb-12 flex flex-col items-center justify-center text-center print:mb-0!`,"data-testid":"booking-status-banner",children:[(0,r.jsx)("div",{className:`${m} mb-2`,"data-testid":"banner-heading",children:e}),(0,r.jsxs)("div",{className:`${u}`,"data-testid":"banner-description",children:["success"===a&&(0,r.jsx)(g.A,{name:"check-mark-filled",width:"38px",height:"38px"}),t]}),!n&&(0,r.jsx)(I.A,{variant:"secondary",globalSettings:d,url:s,title:i,tourId:l,favoriteDisabled:!0,fullWidthButtons:!p})]})};var q=a(70857);function B({className:e="my-6 md:my-8"}){let{globalSettings:t}=(0,o.useTourBooking)();return(0,r.jsxs)("div",{className:`flex flex-col ${e}`,children:[(0,r.jsxs)("div",{className:"type-caption text-canyon flex items-center gap-2 relative mb-5",children:[t?.bookingOnRequestLabel||"On Request",(0,r.jsxs)(q.A,{placement:"top",children:[(0,r.jsx)(q.A.Trigger,{"aria-label":t?.bookingOnRequestAriaLabel||"On Request Information",children:(0,r.jsx)(g.A,{name:"info-icon",width:"24px",height:"24px"})}),(0,r.jsx)(q.A.Content,{className:"max-w-[250px] z-500",children:t?.bookingOnRequestTooltip||"Some selections may have limited availability."})]})]}),(0,r.jsx)("div",{className:"type-fine-print",children:t?.bookingOnRequestFinePrint||"For this tour, we will verify your hotel rooms before we confirm your reservation. Please do not book your own flights or make additional travel plans until we contact you with confirmation details (typically within 5 business days)."})]})}var M=a(1101);function U({isPackageMode:e,isWaitlistMode:t,guestCountOptions:a,roomingPreferenceOptions:i,bedCountOptions:l,showRoomingPreference:n,showTravelCompanionName:d,showBedSelection:c,onlyOneSpaceAvailable:m,isSingleOwnRoom:u}){let{globalSettings:p,bookingState:h,setGuestCount:b,setRoomingPreference:f,setTravelCompanionName:x,setBedCount:_,togglePrice:v,selectedDeparture:y,isPriceActive:j}=(0,o.useTourBooking)(),N=(0,s.useMemo)(()=>{let t=y?.ts_metadata?.prices||[],a=e?A.db.TOUR_PLUS_TRAVEL_PACKAGE:A.db.TOUR,r=t.find(e=>(0,A.uA)(e)===a&&(0,A.qt)(e,j));if(!r)return[];let s=[],i=r.ts_metadata?.id||r.id;if(i){let e=r.ts_metadata?.vendor_data,t=e?.[0]?.vendor_service,a=t?.label,l=t?.ts_metadata?.cost_name,n=t?.tooltip,o=r.ts_metadata?.name;s.push({id:i,name:a||l||o||p?.customizeStandardRoomLabel||"Standard Room",priceAmount:parseFloat(r.ts_metadata?.price_amount||"0"),singleSupplement:parseFloat(r.ts_metadata?.single_supplement?.price_amount||"0"),priceUnit:r.ts_metadata?.price_unit,isBase:!0,tooltip:n||void 0})}return(r.ts_metadata?.upgrades||[]).forEach(e=>{let t=e.ts_metadata?.id||e.id;if(!t)return;let a=e.ts_metadata?.vendor_data,r=a?.[0]?.vendor_service,i=r?.label,l=r?.ts_metadata?.cost_name,n=r?.tooltip,o=e.ts_metadata?.name;s.push({id:t,name:i||l||o||"Room Upgrade Option",priceAmount:parseFloat(e.ts_metadata?.price_amount||"0"),singleSupplement:parseFloat(e.ts_metadata?.single_supplement?.price_amount||"0"),priceUnit:e.ts_metadata?.price_unit,isBase:!1,tooltip:n||void 0})}),s.sort((e,t)=>e.priceAmount-t.priceAmount)},[y,e,p?.customizeStandardRoomLabel,j]),{control:w,register:T,setValue:k,formState:{errors:L}}=(0,S.xW)();return(0,r.jsxs)(r.Fragment,{children:[e&&(0,r.jsx)("div",{className:"heading-4 mb-10",children:p?.customizePackageModeHeading||"Tour + Travel Package"}),(0,r.jsxs)(R.D0,{label:p?.customizeGuestCountLabel||"How many guests",required:!0,id:"number_of_guests",error:L.number_of_guests?.message,className:"mb-10",labelClassName:"!heading-5",children:[(0,r.jsx)(S.xI,{name:"number_of_guests",control:w,rules:{required:p?.customizeGuestCountValidation||"Please select number of guests"},render:({field:e})=>(0,r.jsx)(R.l6,{id:"number_of_guests",value:e.value,onChange:t=>{let a=Number(t.target.value);e.onChange(a),b(a)},error:!!L.number_of_guests,"aria-invalid":!!L.number_of_guests||void 0,children:a.map(e=>(0,r.jsx)("option",{value:e.value,disabled:e.disabled,children:e.label},e.value))})}),m&&(0,r.jsx)("div",{className:"type-caption text-misc-danger mt-3",children:p?.customizeOnlyOneSpaceLeftLabel||"Only 1 space left"})]}),n&&(0,r.jsx)(R.D0,{label:p?.customizeRoomingPreferenceLabel||"Rooming Preference",required:!0,asFieldset:!0,error:L.rooming_preference?.message,id:"rooming_preference",className:"mb-10",labelClassName:"!heading-5",children:(0,r.jsx)(S.xI,{name:"rooming_preference",control:w,rules:{required:p?.customizeRoomingPreferenceValidation||"Please select a rooming preference"},render:({field:e})=>(0,r.jsx)(R.z6,{name:"rooming_preference",idBase:"rooming_preference",value:e.value||"",onChange:t=>{e.onChange(t),"solo"===t&&(k("travel_companion_name",""),x("")),k("number_of_beds",M.xl),_(M.xl),f(t)},options:i,hasError:!!L.rooming_preference})})}),d&&(0,r.jsx)(R.D0,{label:p?.customizeTravelCompanionLabel||"Travel Companion Name",required:!0,id:"travel_companion_name",error:L.travel_companion_name?.message,className:"mb-10",children:(0,r.jsx)(S.xI,{name:"travel_companion_name",control:w,rules:{required:p?.customizeTravelCompanionValidation||"Travel companion name is required"},render:({field:e})=>(0,r.jsx)(R.pd,{id:"travel_companion_name",name:"travel_companion_name",type:"text",placeholder:p?.customizeTravelCompanionPlaceholder||"Enter companion's name",value:e.value||"",onChange:t=>{e.onChange(t.target.value),x(t.target.value)},error:!!L.travel_companion_name})})}),c&&(0,r.jsx)(R.D0,{label:p?.customizeNumberOfBedsLabel||"Number of Beds",required:!0,id:"number_of_beds",error:L.number_of_beds?.message,className:"mb-10",labelClassName:"!heading-5",children:(0,r.jsx)(R.l6,{id:"number_of_beds",...T("number_of_beds",{required:p?.customizeNumberOfBedsValidation||"Please select number of beds",valueAsNumber:!0,onChange:e=>_(Number(e.target.value))}),error:!!L.number_of_beds,"aria-invalid":!!L.number_of_beds||void 0,children:l.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))})}),!t&&N.length>1&&(0,r.jsxs)("div",{className:"my-10 md:my-12",children:[(0,r.jsx)("div",{className:"tb-subsection-heading",children:p?.customizeRoomTypeRequiredLabel||"Room Type *"}),L.room_type?.message&&(0,r.jsx)("div",{className:"text-misc-danger type-caption mt-2",children:L.room_type.message}),(0,r.jsx)(S.xI,{name:"room_type",control:w,rules:{required:"Please select a room type"},render:({field:e})=>(0,r.jsx)("div",{className:"space-y-2",children:N.map(t=>{let a=(e.value||"")===t.id;return(0,r.jsxs)("label",{htmlFor:`room-type-${t.id}`,className:"flex flex-col md:flex-row md:items-center gap-4 md:justify-between p-5 border-b border-moss cursor-pointer",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(R.sx,{id:`room-type-${t.id}`,name:"room_type",value:t.id,checked:a,onChange:()=>{e.onChange(t.id),N.filter(e=>
1e.id!==t.id).forEach(e=>{(h.prices||[]).includes(e.id)&&v(e.id)}),t.id&&!(h.prices||[]).includes(t.id)&&v(t.id)}}),(0,r.jsx)("span",{className:"type-button",children:t.name}),t.tooltip&&(0,r.jsxs)(q.A,{placement:"top",children:[(0,r.jsx)(q.A.Trigger,{"aria-label":`More info about ${t.name}`,as:"span",className:"text-gray-400 hover:text-gray-600",children:(0,r.jsx)(g.A,{name:"info-icon",width:"24px",height:"24px"})}),(0,r.jsx)(q.A.Content,{className:"max-w-[250px] z-500",children:t.tooltip})]})]}),(0,r.jsxs)("div",{className:"max-md:ml-9.5 md:text-right",children:[(0,r.jsxs)("div",{className:"type-body mb-0",children:["$",(0,P.$g)({amount:t.priceAmount})]}),(0,r.jsx)("div",{className:"type-caption mb-0",children:t.priceUnit||"per person"}),u&&t.singleSupplement>0&&(0,r.jsxs)("div",{className:"type-caption mt-2 mb-0",children:[p?.customizeSingleSupplementLabel||"Single supplement:"," ","$",(0,P.$g)({amount:t.singleSupplement})]})]})]},t.id)})})})]})]})}function z({flightPreferenceOptions:e,watchedValues:t}){let{globalSettings:a,setFlightPreference:s,setSelectedAirport:i}=(0,o.useTourBooking)(),{setValue:l}=(0,S.xW)();return(0,r.jsxs)("div",{className:"tb-section",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-end tb-subsection-heading",children:[(0,r.jsx)("div",{className:"heading-4",children:a?.customizeFlightsLabel||"Flights"}),(0,r.jsx)("div",{className:"type-body mb-0",children:a?.customizeOptionalLabel||"(Optional)"})]}),(0,r.jsx)(R.z6,{name:"flight_preference",className:"!gap-0",itemsClassName:"border-b border-moss py-5",value:t.flight_preference||"",onChange:e=>{l("flight_preference",e),s(e),"book_own"===e&&(l("selected_airport",""),i(void 0))},options:e})]})}let V=({label:e="Included"}={})=>(0,r.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,r.jsx)("div",{className:"text-aurora",children:(0,r.jsx)(g.A,{name:"check",width:"13px",height:"13px",className:"text-aurora"})}),(0,r.jsx)("div",{className:"type-body mb-0",children:e})]});function Q(){let{globalSettings:e,bookingState:t,getSelectedAirportInfo:a,openSelectDepartureCity:s}=(0,o.useTourBooking)(),i=a();return t.selected_airport&&i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"tb-subsection-heading",children:e?.customizeRoundtripFlightsLabel||"Roundtrip International Flights"}),(0,r.jsxs)("div",{className:"tb-subsection",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"type-body mb-3",children:["From"," ",(0,r.jsxs)("strong",{children:[i?.name," (",i?.code,")"]})]}),(0,r.jsx)(p.A,{type:"button",variant:"text-link",className:"type-caption py-0",onClick:()=>s(),children:e?.customizeChangeDepartureCityLabel||"Change Departure City"}),(0,r.jsx)("div",{className:"type-fine-print",children:e?.customizeChangeCityNote||"Note: Changing departure city may affect cost."})]}),(()=>{let e=parseFloat(i?.amount||"0");return isFinite(e)&&0!==e?(0,r.jsxs)("div",{className:"type-body",children:["+$",(0,P.$g)({amount:e,showFractionDigits:!0})]}):V()})()]})]}):null}var H=a(17150);function G(){let{globalSettings:e,selectedDeparture:t,tourData:a}=(0,o.useTourBooking)(),{hasPickup:i,hasDropoff:l}=(0,s.useMemo)(()=>{let e=t?.ts_metadata?.prices||[];return{hasPickup:(0,A.qq)(e,A.Sx.AIRPORT_PICKUP).length>0,hasDropoff:(0,A.qq)(e,A.Sx.AIRPORT_DROPOFF).length>0}},[t]);return!(0,H.L)(a)&&(i||l)?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"tb-subsection-heading",children:e?.customizeAirportTransportationLabel||"Airport Transportation"}),i&&(0,r.jsxs)("div",{className:`tb-subsection ${l?"mb-4":""}`,children:[(0,r.jsx)("div",{className:"type-body font-bold mb-0",children:e?.customizeAirportPickupLabel||"Airport Pickup"}),V()]}),l&&(0,r.jsxs)("div",{className:"tb-subsection",children:[(0,r.jsx)("div",{className:"type-body font-bold mb-0",children:e?.customizeAirportDropoffLabel||"Airport Dropoff"}),V()]})]}):null}function Y(){let{globalSettings:e,selectedDeparture:t,bookingState:a}=(0,o.useTourBooking)(),s=(t?.ts_metadata?.prices||[]).filter(e=>(0,A.qq)([e],A.Sx.HOTELS).length>0&&!!e.ts_metadata?.included_in_price);if(0===s.length)return null;let i=(t?.ts_metadata?.prices||[]).filter(e=>{if(!((0,A.qq)([e],A.Sx.EXTRA_EXPERIENCES).length>0))return!1;let t=e.ts_metadata?.id||e.id;return!!t&&(a.prices||[]).includes(t)}),l=t?.ts_metadata?.accommodations||[];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"tb-subsection-heading",children:e?.customizeAdditionalHotelNightsLabel||"Additional Hotel Nights"}),s.sort(A.v5).map(t=>{let a=(e=>{let t="pre_tour_hotel"===(0,A.uA)(e)?"pre-hotel":"post-hotel";return l.find(e=>(e?.ts_metadata?.vendor_item_category?.name||"").toLowerCase()===t)})(t),s=(0,A.uA)(t),n=t.ts_metadata,o=t.ts_metadata?.name||"Hotel Night",d=n?.duration??a?.ts_metadata?.duration??a?.duration,c=n?.departure_date??a?.ts_metadata?.start_date??a?.start_date,m=E(t,i);return(0,r.jsxs)("div",{className:"tb-subsection mb-4",children:[(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)("div",{className:"type-body font-bold mb-1",children:o}),null!=d&&(0,r.jsx)("div",{className:"type-body mb-0",children:`${d} ${1===d?e?.customizeNightLabel||"Night":e?.customizeNightsLabel||"Nights"}${(0,k.sL)(c)?`: ${(0,k.sL)(c)}`:""}`})]}),m?(0,r.jsx)("div",{className:"type-body mb-0 text-gray-600",children:"pre_tour_hotel"===s?e?.customizeNotRequiredWithPreTourLabel||"Not Required with Pre-Tour Extra Experience":e?.customizeNotRequiredWithPostTourLabel||"Not Required with Post-Tour Extra Experience"}):V()]},t.ts_metadata?.id)})]})}function W({extraExperienceAddOns:e,isSingleOwnRoom:t,templateExtrasByKey:a,templateExtrasByTypeAndName:s,templateAllExtraExperiences:i,buildExtraKey:l,getExtraImageUrlLocal:n,getExtraImageAltTextLocal:d,getExtraIdentifierLocal:c,getExtraNameLocal:m,findAccommodationByCategoryNameLocal:u,preHotelAddOn:p,postHotelAddOn:g}){let{globalSettings:h,bookingState:b,togglePrice:f,autoSelectHotel:v,autoDeselectHotel:y,isHotelAutoSelected:j}=(0,o.useTourBooking)();return 0===e.length?null:(0,r.jsxs)("div",{className:"tb-section my-10 md:my-12",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-end tb-subsection-heading",children:[(0,r.jsx)("div",{className:"heading-4",children:h?.customizeExtraExperiencesLabel||"Extra Experiences"}),(0,r.jsx)("div",{className:"type-body mb-0",children:h?.customizeOptionalLabel||"(Optional)"})]}),(0,r.jsx)("div",{className:"space-y-0",children:[...e].sort(A.v5).map(e=>{let o=e.ts_metadata?.id||e?.id;if(!o)return null;let N=e.ts_metadata?.price_amount?parseFloat(e.ts_metadata.price_amount):0,w=e.ts_metadata?.single_supplement?.price_amount?parseFloat(e.ts_metadata.single_supplement.price_amount):0,S=(b.prices||[]).includes(o),T=(0,A.uA)(e),L=u("pre_tour_extra_experience"===T?"pre-experience hotel":"post-experience hotel"),C=e.ts_metadata,E=C?.duration??L?.ts_metadata?.duration??L?.duration,O=C?.departure_date??L?.ts_metadata?.start_date??L?.start_date,$=e.ts_metadata?.price_unit;
1return(0,r.jsx)("label",{htmlFor:`addon-${o}`,className:"flex items-center justify-between p-5 border-b border-moss cursor-pointer",children:(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[1fr_290px_188px] md:items-center w-full",children:[(0,r.jsxs)("div",{className:"flex flex-col",children:[(0,r.jsx)(R.Sc,{id:`addon-${o}`,name:`addon-${o}`,label:m(e),labelClassName:"font-bold!",checked:S,toolTip:(()=>{let t=e.extension?.description;if(Array.isArray(t))return t;let r=l(e),n=a.get(r),o=n?.extension?.description;if(Array.isArray(o))return o;let d=(0,A.uA)(e),m=(e.ts_metadata?.name||"").toString().trim().toLowerCase(),u=s.get(`${d}|${m}`),p=u?.extension?.description;if(Array.isArray(p))return p;let g=i.find(e=>(e.ts_metadata?.name||"").toString().trim().toLowerCase()===m),h=g?.extension?.description;return Array.isArray(h)?h:c(e)||""})(),onChange:()=>{if(o){let e=(b.prices||[]).includes(o);if(f(o),e){if("pre_tour_extra_experience"===T){let e=p?.ts_metadata?.id||p?.id;e&&j(e)&&y(e)}else if("post_tour_extra_experience"===T){let e=g?.ts_metadata?.id||g?.id;e&&j(e)&&y(e)}}else if("pre_tour_extra_experience"===T){let e=p?.ts_metadata?.id||p?.id;e&&v(e)}else if("post_tour_extra_experience"===T){let e=g?.ts_metadata?.id||g?.id;e&&v(e)}}}}),null!=E&&(0,r.jsx)("div",{className:"ml-9.5 mt-3",children:(0,r.jsx)("div",{className:"type-button",children:`${E} ${1===E?h?.customizeNightLabel||"Night":h?.customizeNightsLabel||"Nights"}${(0,k.sL)(O)?`: ${(0,k.sL)(O)}`:""}`})})]}),(()=>{let t=n(e);if(!t)return(0,r.jsx)("div",{className:"hidden md:block w-full aspect-[16/9] bg-cool-granite-1 rounded-xl"});let a=d(e)||"",{maxWidth:s,sizes:i}=(0,_.eP)("thumbnail");return(0,r.jsx)("div",{className:"hidden md:flex w-full items-center justify-center",children:(0,r.jsx)(x.A,{src:t,alt:a,aspectRatio:"16-9",maxWidth:s,sizes:i})})})(),(0,r.jsxs)("div",{className:"max-md:ml-9.5 md:text-right",children:[(0,r.jsxs)("div",{className:"type-body mb-0",children:["$",(0,P.$g)({amount:N})," ",(0,r.jsx)("div",{className:"type-caption",children:$||"per person"})]}),t&&w>0&&(0,r.jsxs)("div",{className:"type-caption mt-2 mb-0",children:[h?.customizeSingleSupplementLabel||"Single supplement:"," $",(0,P.$g)({amount:w})]})]})]})},o)})})]})}function X({addOnPrices:e,isSingleOwnRoom:t,templateExtrasByKey:a,buildExtraKeyWithAccommodation:s,getExtraIdentifierLocal:i,getExtraNameLocal:l,findAccommodationByCategoryNameLocal:n,requirePreHotel:d,requirePostHotel:c,preHotelCovered:m,postHotelCovered:u}){let{globalSettings:p,bookingState:g,togglePrice:h}=(0,o.useTourBooking)(),b=(0,A.qq)(e,A.Sx.HOTELS);return 0===b.length?null:(0,r.jsxs)("div",{className:"tb-section my-10 md:my-12",children:[(0,r.jsxs)("div",{className:"tb-subsection-heading space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 items-end",children:[(0,r.jsx)("div",{className:"heading-4",children:p?.customizeExtraHotelNightsLabel||"Extra Hotel Nights"}),(0,r.jsx)("div",{className:"type-body mb-0",children:p?.customizeOptionalLabel||"(Optional)"})]}),(0,r.jsx)("div",{className:"type-body mb-0",children:p?.customizeExtraHotelNightsDescription||"We recommend arriving the day before the tour starts and leaving a day after the tour ends."})]}),(0,r.jsx)("div",{className:"space-y-2",children:b.sort(A.v5).map(e=>{let o=e.ts_metadata?.id||e?.id;if(!o)return null;let b=e.ts_metadata?.price_amount?parseFloat(e.ts_metadata.price_amount):0,f=e.ts_metadata?.single_supplement?.price_amount?parseFloat(e.ts_metadata.single_supplement.price_amount):0,x=(0,A.uA)(e),_=n("pre_tour_hotel"===x?"pre-hotel":"post-hotel"),v=e.ts_metadata,y=v?.duration??_?.ts_metadata?.duration??_?.duration,j=v?.departure_date??_?.ts_metadata?.start_date??_?.start_date,N="pre_tour_hotel"===x&&m||"post_tour_hotel"===x&&u,w=!N&&("pre_tour_hotel"===x&&d||"post_tour_hotel"===x&&c),S=!N&&(g.prices||[]).includes(o),T=e.ts_metadata?.price_unit;return(0,r.jsxs)("label",{htmlFor:`addon-${o}`,className:"flex flex-col md:flex-row md:items-center gap-4 md:justify-between p-5 border-b border-moss cursor-pointer",children:[(0,r.jsxs)("div",{className:"flex flex-col items-start",children:[(0,r.jsx)(R.Sc,{id:`addon-${o}`,name:`addon-${o}`,label:l(e),labelClassName:"font-bold!",checked:S,disabled:w||N,toolTip:(()=>{let t=e.extension?.description;if(Array.isArray(t))return t;let r=s(e),l=a.get(r),n=l?.extension?.description;return Array.isArray(n)?n:i(e)||""})(),onChange:()=>{o&&h(o)}}),(0,r.jsxs)("div",{className:"ml-9.5 mt-3",children:[(0,r.jsx)("div",{className:"type-button",children:`${y??"X"} ${1===y?p?.customizeNightLabel||"Night":p?.customizeNightsLabel||"Nights"}: ${(0,k.sL)(j)}`}),N?(0,r.jsx)("div",{className:"type-caption mt-1",children:"pre_tour_hotel"===x?p?.customizeNotRequiredWithPreTourLabel||"Not Required with Pre-Tour Extra Experience":p?.customizeNotRequiredWithPostTourLabel||"Not Required with Post-Tour Extra Experience"}):w&&(0,r.jsx)("div",{className:"type-caption mt-1",children:"pre_tour_hotel"===x?p?.customizeRequiredWithPreTourLabel||"Required with Pre-Tour Extra Experience":p?.customizeRequiredWithPostTourLabel||"Required with Post-Tour Extra Experience"})]})]}),(0,r.jsxs)("div",{className:"max-md:ml-9.5 md:text-right",children:[(0,r.jsxs)("div",{className:"type-body mb-0",children:["$",(0,P.$g)({amount:b})," ",(0,r.jsx)("div",{className:"type-caption mb-0",children:T||"per person"})]}),t&&f>0&&(0,r.jsxs)("div",{className:"type-caption mt-2 mb-0",children:[p?.customizeSingleSupplementLabel||"Single supplement:"," $",(0,P.$g)({amount:f})]})]})]},o)})})]})}function Z(){let{globalSettings:e,openSelectDepartureCity:t}=(0,o.useTourBooking)();return(0,r.jsx)("div",{className:"tb-section--upsell",children:(0,r.jsxs)("div",{className:"tb-section--upsell--content",children:[e?.customizeUpsellHeading&&(0,r.jsx)("div",{className:"heading-4 mb-8",children:e?.customizeUpsellHeading}),e?.customizeUpsellDescription&&(0,r.jsx)("p",{className:"type-paragraph mb-12",children:e?.customizeUpsellDescription}),(0,r.jsx)(p.A,{type:"button",variant:"primary",iconAfter:(0,r.jsx)(g.A,{name:"arrow-right"}),onClick:()=>{t()},children:e?.customizeUpsellButtonLabel||"Switch to Tour + Travel Package"})]})})}function J(){let{globalSettings:e,setTripBuildingMode:t}=(0,o.useTourBooking)();return(0,r.jsxs)(r.Fragment,{children:[e?.customizePackageConfirmationAlert&&(0,r.jsxs)("div",{className:"flex gap-4 items-center heading-5 mt-8 mb-8 md:mb-12 text-canyon",children:[(0,r.jsx)(g.A,{name:"alert",width:"32px",height:"32px"}),(0,r.jsx)("div",{className:"heading-5 mt-8 mb-8 md:mb-12 text-canyon",children:e?.customizePackageConfirmationAlert})]}),(0,r.jsx)("div",{className:"tb-section--upsell tb-section--selected",children:(0,r.jsxs)("div",{className:"tb-section--upsell--content",children:[e?.customizePackageConfirmationHeading&&(0,r.jsx)("div",{className:"heading-4 mb-8",children:e?.customizePackageConfirmationHeading}),e?.customizePackageConfirmationDescription&&(0,r.jsx)("p",{className:"type-paragraph mb-12",children:e?.customizePackageConfirmationDescription}),(0,r.jsx)("div",{className:"mt-4",children:(0,r.jsx)(p.A,{type:"button",variant:"secondary",onClick:()=>t("tour"),iconBefore:(0,r.jsx)(g.A,{name:"arrow-left"}),children:e?.customizePackageSwitchBackLabel||"Switch back to Tour Only"})})]})})]})}let K=(0,s.forwardRef)(function({onSubmitValid:e},t){(0,T.uV)({selector:'select[id="number_of_guests"]'});let{bookingState:a,tourData:i,isPackageMode:l,isWaitlistMode:n,isOnRequest:d,setPrimaryPrice:c,togglePrice:m,autoSelectHotel:u,autoDeselectHotel:p,isHotelAutoSelected:g,getPriceById:h,globalSettings:b,setGuestCount:f,selectedDeparture:x,accommodations:_,departureStatuses:v,justSwitchedToPackage:j,isPriceActive:N}=(0,o.useTourBooking)(),w=(0,S.mN)({mode:"onChange",reValidateMode:"onChange",defaultValues:{number_of_guests:a.number_of_guests??2,rooming_preference:a.rooming_preference,travel_companion_name:a.travel_companion_name??"",number_of_beds:a.number_of_beds??1,flight_preference:a.flight_preference,selected_airport:a.selected_airport??"",room_type:a.prices?.[0]||""}}),{watch:k}=w,L=k();(0,s.useImperativeHandle)(t,()=>({submitAndGetValues:async()=>
1{if(!await w.trigger()){let e=Object.keys(w.formState.errors)[0];if(e){let t=document.querySelector(`#${e}`)||document.querySelector(`[name="${e}"]`);t&&(t.focus(),t.scrollIntoView({behavior:"smooth",block:"center"}))}return null}let t=w.getValues();return t.room_type&&c(t.room_type),e?.(t),t}}));let C=1===L.number_of_guests,P=1===L.number_of_guests&&"share"===L.rooming_preference,R=L.number_of_guests>1||1===L.number_of_guests&&"share"===L.rooming_preference,O=(0,s.useMemo)(()=>{let e=x?.ts_metadata?.prices||[],t=l?A.db.TOUR_PLUS_TRAVEL_PACKAGE:A.db.TOUR,a=e.find(e=>(0,A.uA)(e)===t&&(0,A.qt)(e,N));return a?.ts_metadata?.id||a?.id},[x,l,N]),$=(L.number_of_guests??1)===1&&"solo"===L.rooming_preference,I=(0,s.useCallback)(e=>(0,T.YD)(e,_),[_]),q=(0,s.useCallback)(e=>{let t=x?.ts_metadata?.prices||[],a=e?A.db.TOUR_PLUS_TRAVEL_PACKAGE:A.db.TOUR,r=t.find(e=>(0,A.uA)(e)===a&&(0,A.qt)(e,N));if(!r)return[];let s=[],i=r.ts_metadata?.id||r.id;return i&&s.push(i),(r.ts_metadata?.upgrades||[]).forEach(e=>{let t=e.ts_metadata?.id||e.id;t&&s.push(t)}),s},[x,N]),M=(0,s.useMemo)(()=>q(l),[q,l]),V=(0,s.useMemo)(()=>[...new Set([...q(!1),...q(!0)])],[q]);(0,s.useEffect)(()=>{if(!O)return;let e=w.getValues("room_type");!(e&&M.includes(e))&&(e&&V.includes(e)&&(a.prices||[]).includes(e)&&m(e),w.setValue("room_type",O,{shouldValidate:!1,shouldDirty:!0}),(a.prices||[]).includes(O)||m(O))},[O,w,a.prices,m,M,V]);let H=(0,s.useMemo)(()=>{if(n)return!1;let e=a.departure;if(!e)return!1;let t=v.get(e);return t?.available_spaces===1},[a.departure,v,n]);(0,s.useEffect)(()=>{H&&2===w.getValues("number_of_guests")&&(w.setValue("number_of_guests",1),f(1))},[H,w,f]),(0,s.useEffect)(()=>{let e=w.getValues("selected_airport");a.selected_airport&&a.selected_airport!==e&&w.setValue("selected_airport",a.selected_airport)},[a.selected_airport,w]),(0,s.useEffect)(()=>{if(void 0!==a.number_of_beds){let e=w.getValues("number_of_beds");a.number_of_beds!==e&&w.setValue("number_of_beds",a.number_of_beds)}},[a.number_of_beds,w]),(0,s.useEffect)(()=>{if(a.travel_companion_name){let e=w.getValues("travel_companion_name");a.travel_companion_name!==e&&w.setValue("travel_companion_name",a.travel_companion_name)}},[a.travel_companion_name,w]);let K=[{value:"1",label:b?.customizeOneGuestOptionLabel||"1 Guest",disabled:!1},{value:"2",label:b?.customizeTwoGuestsOptionLabel||"2 Guests",disabled:H}],ee=[{value:"solo",label:b?.customizeRoomingPreferenceSoloLabel||"I prefer my own room"},{value:"share",label:b?.customizeRoomingPreferenceShareLabel||"I will be sharing a room with a travel companion"}],et=[{value:"1",label:b?.customizeBedOptionOneLabel||"One shared bed"},{value:"2",label:b?.customizeBedOptionTwoLabel||"Two Separate Beds"}],ea=[{value:"send_quote",label:b?.customizeFlightQuoteOption||"Send me a quote for flights"},{value:"book_own",label:b?.customizeBookOwnFlightOption||"I will book my own flights"}],er=(x?.ts_metadata?.prices||[]).filter(e=>{let t=(0,A.uA)(e),a=e.ts_metadata?.optional,r=l?t===A.db.TOUR_PLUS_TRAVEL_PACKAGE:t===A.db.TOUR,s=!!e.ts_metadata?.included_in_price;if(!(a&&!r&&!(l&&s)))return!1;let i=e.ts_metadata?.id||e.id;return!!i&&N(i)}),es=(0,A.r4)({prices:er,typeName:A.db.PRE_TOUR_HOTEL}),ei=(0,A.r4)({prices:er,typeName:A.db.POST_TOUR_HOTEL}),el=(0,A.qq)(er,[A.db.PRE_TOUR_EXTRA_EXPERIENCE,A.db.POST_TOUR_EXTRA_EXPERIENCE]).filter(T.DR),en=e=>(0,T.cq)(e,I),eo=(()=>{try{return(i?.ts_metadata?.template_departures||[]).flatMap(e=>e?.ts_metadata?.prices||[]).filter(e=>{let t=(0,A.qq)([e],[A.db.PRE_TOUR_EXTRA_EXPERIENCE,A.db.POST_TOUR_EXTRA_EXPERIENCE]).length>0,a=!!e.ts_metadata?.included_in_price;return t&&!(l&&a)})}catch{return[]}})(),ed=(()=>{try{let e=new Set(el.map(T.X4));return eo.filter(t=>!e.has((0,T.X4)(t)))}catch{return[]}})(),ec=(0,s.useMemo)(()=>new Map(eo.map(e=>[en(e),e])),[eo]),em=(0,s.useMemo)(()=>{let e=new Map;return eo.forEach(t=>{let a=(0,A.uA)(t),r=(t.ts_metadata?.name?.toString()||"").trim().toLowerCase();e.set(`${a}|${r}`,t)}),e},[eo]),eu=e=>(0,T.us)(e,ec,em,ed,en),ep=e=>(0,T.ay)(e,ec,em,ed,en),eg=(a.prices||[]).some(e=>{let t=h(e);return t&&(0,A.uA)(t)===A.db.PRE_TOUR_EXTRA_EXPERIENCE}),eh=(a.prices||[]).some(e=>{let t=h(e);return t&&(0,A.uA)(t)===A.db.POST_TOUR_EXTRA_EXPERIENCE}),eb=(0,A.qq)(er,[A.db.PRE_TOUR_EXTRA_EXPERIENCE,A.db.POST_TOUR_EXTRA_EXPERIENCE]).filter(e=>{let t=e.ts_metadata?.id||e.id;return!!t&&(a.prices||[]).includes(t)}),ef=E(es,eb),ex=E(ei,eb);(0,s.useEffect)(()=>{let e=e=>e?.ts_metadata?.id||e?.id,t=(e,t,a)=>{e&&(a?p(e):t?u(e):g(e)&&p(e))};
1t(e(es),eg,ef),t(e(ei),eh,ex)},[eg,eh,ef,ex]);let e_=e=>(0,T.YD)(e,_),ev=!!i&&(0,T.Vj)(i),ey=!!i&&(0,T.LP)(i),ej=i?.ts_metadata?.package_options?.tour_plus_travel_package!=null&&i?.ts_metadata?.package_options?.tour_plus_travel_package.from_price!=null,eN=(0,s.useMemo)(()=>{let e=(i?.ts_metadata?.destinations||[]).find(e=>e.ts_metadata?.primary_destination===!0),t=e?.ts_metadata?.destination,a=t?._id||t?._ref;return!!a&&y.JN.includes(a)},[i]);return i?(0,r.jsx)(S.Op,{...w,children:(0,r.jsx)("div",{className:"mx-auto",children:(0,r.jsxs)("form",{onSubmit:t=>{t.preventDefault(),(async()=>{if(!await (async()=>{let t=await w.trigger();return t&&e?.(w.getValues()),t})()){let e=Object.keys(w.formState.errors)[0];if(e){let t=document.querySelector(`[name="${e}"]`);t?.focus(),t?.scrollIntoView({behavior:"smooth",block:"center"})}}})()},children:[n&&(0,r.jsx)(D,{heading:"You are joining a waitlist",description:"Your reservation is not guaranteed. We will confirm your reservation if space becomes available.",style:"waitlist",disablePageActions:!0}),!n&&!l&&ev&&(0,r.jsx)(Z,{}),!n&&l&&j&&(0,r.jsx)(J,{}),!l&&(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-4 mt-12 mb-10 md:mb-6",children:[(0,r.jsx)("div",{className:"heading-3",children:b?.customizeGuestsOccupancyHeading||"Guests and Occupancy"}),(0,r.jsx)("div",{className:"type-paragraph mb-0 md:self-end",children:b?.customizeRequiredFieldsNote||"* Required"})]}),(0,r.jsxs)("div",{className:"tb-section",children:[(0,r.jsx)(U,{isPackageMode:l,isWaitlistMode:n,guestCountOptions:K,roomingPreferenceOptions:ee,bedCountOptions:et,showRoomingPreference:C,showTravelCompanionName:P,showBedSelection:R,onlyOneSpaceAvailable:H,isSingleOwnRoom:$}),!n&&l&&(0,r.jsx)(Q,{}),!n&&l&&ev&&!ey&&(0,r.jsx)(G,{}),l&&ej&&(0,r.jsx)(Y,{})]}),(!n&&!l&&!eN||el.length>0||(0,A.qq)(er,A.Sx.HOTELS).length>0)&&(0,r.jsx)("div",{className:"flex flex-col md:flex-row gap-4 mt-12 mb-10 md:mb-6",children:(0,r.jsx)("div",{className:"heading-3",children:b?.customizeAddOnsLabel||"Add-Ons"})}),!n&&!l&&!eN&&(0,r.jsx)(z,{flightPreferenceOptions:ea,watchedValues:L}),(0,r.jsx)(W,{extraExperienceAddOns:el,isSingleOwnRoom:$,templateExtrasByKey:ec,templateExtrasByTypeAndName:em,templateAllExtraExperiences:eo,buildExtraKey:T.cq,getExtraImageUrlLocal:e=>(0,T.Hl)(e,ec,em,ed,en),getExtraImageAltTextLocal:e=>(0,T.yA)(e,ec,em,ed,en),getExtraIdentifierLocal:eu,getExtraNameLocal:ep,findAccommodationByCategoryNameLocal:e_,preHotelAddOn:es,postHotelAddOn:ei}),(0,r.jsx)(X,{addOnPrices:er,isSingleOwnRoom:$,templateExtrasByKey:ec,buildExtraKeyWithAccommodation:en,getExtraIdentifierLocal:eu,getExtraNameLocal:ep,findAccommodationByCategoryNameLocal:e_,requirePreHotel:eg,requirePostHotel:eh,preHotelCovered:ef,postHotelCovered:ex}),(0,r.jsx)(F,{}),d&&(0,r.jsx)(B,{className:"mt-12 mb-10 md:mb-6"})]})})}):null});var ee=a(32134);function et({error:e,required:t=!0,onClearError:a,fieldSuffix:s,flightsIncludedLabel:i="Includes Roundtrip International Flights",selectDepartureFirstOption:l="Select a departure date first",noAirportsOption:n="No airports available for this departure",chooseCityOption:d="Choose your departure city",noteText:c="Note: Changing departure city may affect cost",fieldLabel:m,forceShow:u=!1,isTourBookingModal:p=!1}){let{bookingState:g,isPackageMode:h,getAvailableAirports:b,setSelectedAirport:f}=(0,o.useTourBooking)();if(!h&&!u)return null;let x=!!g.departure,_=x&&g.departure?b(g.departure):[];return(0,r.jsxs)("div",{className:"p-6 md:px-8 bg-sleet rounded-[12px]",children:[!p&&(0,r.jsx)("div",{className:"mb-3",children:(0,r.jsx)("div",{className:"text-caption font-medium mb-2",children:i})}),(0,r.jsx)(R.D0,{label:m||d,required:x&&_.length>0&&t,id:`departure-city-select${s?`_${s}`:""}`,error:e,children:(0,r.jsx)(R.l6,{id:`departure-city-select${s?`_${s}`:""}`,value:g.selected_airport||"",onChange:e=>{f(e.target.value||void 0),a&&a()},disabled:!x,error:!!e,"aria-invalid":!!e||void 0,className:"mb-4",children:x?0===_.length?(0,r.jsx)("option",{value:"",children:n}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("option",{value:"",children:d}),_.map(e=>(0,r.jsxs)("option",{value:e.code,children:[e.name," (",e.code,")","0.0000"!==e.amount?` â +${(0,P.$g)({amount:parseFloat(e.amount||"0"),show
1FractionDigits:!0})}`:" â Included",e.primary?" â Primary":""]},e.id))]}):(0,r.jsx)("option",{value:"",children:l})})}),(p&&h||!p)&&(0,r.jsx)("div",{className:"text-caption font-medium mb-2",children:c})]})}function ea(){let e=(0,s.useId)(),{tourData:t,globalSettings:a,filteredDepartures:i,bookingState:l,setFilterMonth:n,setFilterSpots:d,setFilterShowSoldOut:c,setFiltersIsFiltered:m,clearFilters:u,departureStatuses:h,isLoadingStatuses:b}=(0,o.useTourBooking)(),f={spotsAvailable:l.filter_spots,showSoldOut:l.filter_show_sold_out,isFiltered:l.filters_is_filtered},x=s.useMemo(()=>{if(0===h.size)return 0;let e=0;return Array.from(h.values()).filter(e=>"Template"!==e.status).forEach(t=>{t.available_spaces>e&&(e=t.available_spaces)}),e},[h]),_=s.useMemo(()=>{let e=[],t=Math.min(x,8);for(let a=1;a<t;a++)e.push({value:a.toString(),label:1===a?`${a} spot`:`${a} spots`});return x>0&&(x>=8?e.push({value:t.toString(),label:`${t}+ spots`}):e.push({value:x.toString(),label:1===x?`${x} spot`:`${x} spots`})),e},[x]);if(!t)return null;let v=i&&i.length?i:t.ts_metadata?.departures||[],y=e=>{if(!e)return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return new Date(t?Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])):e)},j=e=>{let t=e?.ts_metadata||{};return y(t.pre_extension_departure_date)||y(t.tour_only_departure_date)||null},N=e=>y((e?.ts_metadata||{}).return_date)||j(e),w=e=>`${e.getUTCFullYear()}-${String(e.getUTCMonth()+1).padStart(2,"0")}`,S=e=>e.toLocaleString("en-US",{month:"long",year:"numeric",timeZone:"UTC"}),T=new Map;for(let e of v){let t=j(e),a=N(e);if(!t||!a)continue;let r=t.getUTCFullYear(),s=t.getUTCMonth(),i=a.getUTCFullYear(),l=a.getUTCMonth();for(;r<i||r===i&&s<=l;){let e=new Date(Date.UTC(r,s,1));T.set(w(e),S(e)),(s+=1)>11&&(s=0,r+=1)}}let A=Array.from(T.entries()).sort(([e],[t])=>e<t?-1:+(e>t)),k=[{value:"",label:a?.bookingFiltersSelectMonthOption||"Select"},...A.map(([e,t])=>({value:e,label:t}))],L=[{value:"show_sold_out",label:a?.bookingFiltersShowSoldOutOption||"Show Sold Out and Waitlist Dates"}];return(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsx)("div",{className:"type-body font-semibold mb-0",children:a?.bookingFiltersLabel||"Filters"}),f.isFiltered&&(0,r.jsx)(p.A,{variant:"text-link",className:"!mb-0 py-0",onClick:()=>{u()},iconBefore:(0,r.jsx)(g.A,{name:"close"}),children:a?.bookingFiltersClearAll||"Clear All"})]}),(0,r.jsxs)("div",{className:"space-y-6 max-md:border-b max-md:border-moss ",children:[(0,r.jsx)(R.D0,{label:a?.bookingFiltersMonthLabel||"Tour Departure Month",id:`${e}-departure-month-filter`,children:(0,r.jsx)(R.l6,{id:`${e}-departure-month-filter`,name:"departure-month-filter",value:l.filter_month,onChange:e=>{let t=e.target.value;n(t),m(!!t||!!f.spotsAvailable||f.showSoldOut)},disabled:0===A.length,children:k.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))})}),(0,r.jsx)(R.D0,{label:a?.bookingFiltersSpotsLabel||"Spots Available",id:`${e}-spots-available-filter`,children:(0,r.jsxs)(R.l6,{id:`${e}-spots-available-filter`,name:"spots-available-filter",value:f.spotsAvailable.toString(),onChange:e=>{let t=""===e.target.value?"":Number(e.target.value);d(t),m(!!t||!!l.filter_month||f.showSoldOut)},disabled:b||0===_.length,children:[(0,r.jsx)("option",{value:"",children:b?"Loading...":"Select"}),_.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]})}),(0,r.jsx)(R.D0,{children:(0,r.jsx)(R.$Q,{idBase:`${e}-show-sold-out-filter`,name:"show-sold-out-filter",value:f.showSoldOut?["show_sold_out"]:[],onChange:e=>{let t=e.includes("show_sold_out");c(t),m(t||!!l.filter_month||!!f.spotsAvailable)},options:L,className:"mt-8 booking-flow-show-sold-out-filter max-md:mb-12"})})]})]})}var er=a(92936),es=a(14771),ei=a(2596);let el=[{title:"Strong",value:"strong"},{title:"Italic",value:"em"},{title:"Underline",value:"underline"},{title:"Strike",value:"strike-through"},{title:"Subscript",value:"sub",icon:()=>(0,r.jsxs)(r.Fragment,{children:["X",(0,r.jsx)("sub",{children:"S"})]}),component:({children:e})=>(0,r.jsx)("sub",{children:e})},{title:"Superscript",value:"sup",icon:()=>(0,r.jsxs)(r.Fragment,{children:["X",(0,r.jsx)("sup",{children:"S"})]}),component:({children:e})=>(0,r.jsx)("sup",{children:e})},{title:"Placeholder",value:"placeholder",icon:()=>(0,r.jsx)(r.Fragment,{children:"{_}"}),component:({children:e})=>(0,r.jsx)("span",{"data-placeholder":!0,children:e})}];var en=a(91677);let eo=[{title:"None",value:"none"},en.zJ,en.wH,en.VY,en.oY,en.$c,en.ZI,en.uo,en.pS,en.JV],ed=[{title:"None",value:"none"},en.zJ,en.N6,en.zO,en.$c,en.TB,en.xO],ec=({required:e=!0,showLinkLabel:t=!0,showIconBefore:a=!0,showIconAfter:r=!0,showBtnVariant:s=!1,labelInitialValue:i="",...l})=>
1(0,ei.MI)({name:l.name,title:l.title,description:l.description,fieldset:l.fieldset,options:{collapsible:!0,collapsed:l.collapsed??!1},group:l.group,hidden:l.hidden??!1,type:"object",fieldsets:[{title:"Advanced",name:"advanced",options:{collapsible:!0,collapsed:!0}}],fields:[(0,ei.MI)({name:"internal",title:"Internal Link?",type:"boolean",initialValue:!0}),(0,ei.MI)({name:"href",title:"URL",type:"url",validation:t=>t.uri({scheme:["http","https","mailto","tel"]}).custom((t,a)=>!(!a?.parent.internal&&!t&&(e||!e&&a.parent?.label))||"Please provide a URL for the external link."),hidden:({parent:e})=>!0==!!e?.internal}),(0,ei.MI)({name:"reference",title:"Page",type:"reference",weak:!0,to:en.xB,hidden:({parent:e})=>!1==!!e?.internal,validation:t=>t.custom((t,a)=>!(a.parent?.internal&&!t&&(e||!e&&a?.parent?.label))||"Reference page is required for internal links")}),...t?[(0,ei.MI)({name:"label",title:"Link Text",type:"string",initialValue:i,validation:t=>t.custom((t,a)=>!(!a?.parent.internal&&!t&&(e||!e&&a?.parent?.href))||"Link Text is required for external links")})]:[],(e=>(0,ei.MI)({name:e.name,title:e.title,description:e.description,fieldset:e.fieldset,group:e.group,type:"string",hidden:e.hidden,initialValue:e?.initialValue,validation:t=>t.custom(t=>e.required&&!t?"This field is required.":!!(!t||/^[A-Za-z]+[A-Za-z0-9\-_]*$/.test(t))||"Must begin with a letter and be followed by letters, digits, hyphens, or underscores.")}))({name:"anchor",title:"Anchor"}),(0,ei.MI)({name:"target",title:"Target",type:"string",options:{list:[{title:"Open in same tab",value:"_self"},{title:"Open in new tab",value:"_blank"}],layout:"dropdown"},initialValue:"_self"}),...s?[(0,ei.MI)({name:"btnVariant",title:"Button Variant",type:"string",options:{list:[{value:"primary",title:"Primary"},{value:"secondary",title:"Secondary"},{value:"tertiary",title:"Tertiary"}],layout:"dropdown"},initialValue:"secondary",fieldset:"advanced"})]:[],(0,ei.MI)({name:"accessibilityLabel",title:"Accessibility Label",type:"string",fieldset:"advanced"}),...a?[(0,ei.MI)({name:"iconBefore",title:"Icon Before",description:"Show an icon before the link text",type:"string",options:{list:eo,layout:"dropdown"},initialValue:"none",fieldset:"advanced"})]:[],...r?[(0,ei.MI)({name:"iconAfter",title:"Icon After",description:"Show an icon after the link text",type:"string",options:{list:ed,layout:"dropdown"},initialValue:"none",fieldset:"advanced"})]:[]],preview:{select:{label:"label",internal:"reference",reference:"reference"},prepare:({label:e,internal:t,reference:a})=>({title:e||(t&&a?"Internal Link":void 0)||"Untitled Link"})}}),em=[ec({name:"link",title:"Link",showLinkLabel:!1,showIconBefore:!1,showIconAfter:!1})];ec({name:"link",title:"Link",showLinkLabel:!1,showIconBefore:!1,showIconAfter:!1});let eu=()=>(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 23 19",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,r.jsx)("path",{d:"M6.9 9.2L0 18.4H14.95C15.3142 18.4 15.6592 18.3185 15.985 18.1556C16.3108 17.9927 16.5792 17.7675 16.79 17.48L23 9.2L16.79 0.92C16.5792 0.6325 16.3108 0.407292 15.985 0.244375C15.6592 0.0814583 15.3142 0 14.95 0H0L6.9 9.2Z",fill:"currentColor"}),(0,r.jsx)("path",{d:"M0 18.4L6.9 9.2L0 0H14.95C15.3142 0 15.6592 0.0814583 15.985 0.244375C16.3108 0.407292 16.5792 0.6325 16.79 0.92L23 9.2L16.79 17.48C16.5792 17.7675 16.3108 17.9927 15.985 18.1556C15.6592 18.3185 15.3142 18.4 14.95 18.4H0ZM4.6 16.1H14.95L20.125 9.2L14.95 2.3H4.6L9.775 9.2L4.6 16.1Z",fill:"currentColor",fillOpacity:"0.3"})]});var ep=a(92275);function eg(e){let t;if(!e)return[];let a=es.S.compile({name:"defaultSchema",types:[{type:"object",name:"RTEWithAllOptions",fields:[(t={name:"examplePB",title:"Example Portable block",showStyledLists:!0},(0,ei.MI)({name:t.name,title:t.title,description:t.description,fieldset:t.fieldset,group:t.group,hidden:t.hidden??!1,type:"array",of:[{type:"block",styles:t.noStyles?[{title:"Normal",value:"normal"},{title:"Heading 2",value:"h2"},{title:"Heading 3",value:"h3"},{title:"Heading 4",value:"h4"},{title:"Heading 5",value:"h5"},{title:"Quote",value:"blockquote"}]:[],lists:t.showStyledLists?[{title:"Bullet List",value:"bullet"},{title:"Numbered List",value:"number"},{title:"Styled Bullet List",value:"styled-bullet",icon:eu},{title:"Styled Numbered List",value:"styled-number",icon:()=>"â "}]:[{title:"Bullet List",value:"bullet"},{title:"Numbered List",value:"number"}],marks:{decorators:el,annotations:em}}],validation:t.required?e=>e.required():t.validation?t.validation:void 0}))]}]}).get("RTEWithAllOptions").fields.find(e=>"examplePB"===e.name).type,r=e.replaceAll("<>","").replaceAll("</>",""),s=(0,ep.l$)(r,a);return s?function(e,t){let a=t.includes("styled-bullet"),r=t.includes("styled-number");if(!a&&!r)return e;let s=null;return e.map(e=>{if("block"===e._type&&e.listItem){if(null===s&&(a&&t.includes("<ul styled-bullet>")&&(s="bullet"===e.listItem?"styled-bullet":null),r&&t.includes("<ol styled-number>")&&(s="number"===e.listItem?"styled-number":null)),s)return{...e,listItem:s}}else s=null;return e})}(s,r):s}var eh=a(77705),eb=a(45843),ef=a(16530),ex=a(84390),e_=a(70573);function ev({error:e,dateHeadingLabel:t="Date",priceHeadingLabel:a="Price",includesDaysLabel:i="Includes Travel Days",includesFlightsCaption:l="Includes Flights, Hotels & Transfers",includesFlightsSelfGuidedCaption:d="Includes Flights & Hotels",singleSupplementPrefix:c="Single Supplement From",departureListFinePrint:m="Every effort has been made to produce this information accurately. We reserve the right to correct errors. Prices are based on preferences selected, including meals and sightseeing as specified in What's Included. All prices are subject to change. Departure dates and prices shown may be updated several times daily, and apply to new bookings only.",priceTooltip:u,singleSupplementTooltip:p}){let{tourData:h,bookingState:b,setDeparture:f,isPackageMode:x,isDraftMode:_,getAvailableAirports:v,filteredDepartures:y,allowedDepartureIds:j,selectedDeparture:N,getPriceByIdAsObjectPrice:w,accommodations:S,departureStatuses:k,fetchDepartureStatuses:L,globalSettings:C}=(0,o.useTourBooking)(),E=(0,n.n4)(h?.ts_metadata?.departures),O=!!e,$=(0,H.L)(h)?d:l;s.useEffect(()=>{L()},[]);let F=(0,M.rv)(C),I=x?"tour_plus_travel_package":"tour",D=e=>(e?.ts_metadata?.prices||[]).some(e=>(0,A.uA)(e)===I&&e?.ts_metadata?.status?.toLowerCase()==="active"),q=E?y.filter(e=>e?.ts_metadata?.groups?.some(e=>e.id===E.id)):y,B=j?q.filter(e=>j.includes(e?.ts_metadata?.id??"")):q;if(s.useEffect(()=>{if(!E||1!==B.length)return;let e=B[0]?.ts_metadata?.id;e&&e!==b.departure&&(e=>{let t=k.get(e?.ts_metadata?.id??"");if(!t)return!1;let a=D(e);return a&&(0,ex.y)(t,x,F,a,e?.ts_metadata?.groups).isSelectable})(B[0])&&f(e)},[E,B,k,x,b.departure]),!h?.ts_metadata?.departures)return null;let U=(e=>{let t=b.filter_show_sold_out,a=e.filter(e=>{let t=e.ts_metadata?.id;return!!t&&(!!k.get(t)||_)});return t||(0,e_.RH)(E,b.number_of_guests)?a:a.filter(e=>{let t=e.ts_metadata?.id;if(!t)return!1;let a=k.get(t);if(!a)return!1;let r=(0,ex.y)(a,x,F,!0,e?.ts_metadata?.groups);return"waitlist"!==r.displayStatus&&"privateGroup"!==r.displayStatus})})((e=>{let t=b.filter_spots;return t?e.filter(e=>{let a=e.ts_metadata?.id;if(!a)return!1;let r=k.get(a);
1return!!r&&r.available_spaces+(0,e_.GT)(E)>=t}):e})((e=>{let t=b.filter_month;if(!t)return e;let[a,r]=t.split("-"),s=Number(a),i=Number(r)-1,l=new Date(Date.UTC(s,i,1)),n=new Date(Date.UTC(s,i+1,0));return e.filter(e=>{let t=e?.ts_metadata||{},a=e=>{if(!e)return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return new Date(t?Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3])):e)},r=a(t.pre_extension_departure_date)||a(t.tour_only_departure_date),s=a(t.return_date)||r;return!!r&&r<=n&&s>=l})})(B))),z=y.reduce((e,t)=>{let a=(0,ef.g)(t);if(!a)return e;let r=a.getUTCFullYear();return e[r]||(e[r]=[]),e[r].push(t),e},{}),V=U.reduce((e,t)=>{let a=(0,ef.g)(t);if(!a)return e;let r=a.getUTCFullYear();return e[r]||(e[r]=[]),e[r].push(t),e},{});return(0,r.jsxs)("div",{className:"space-y-8",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2 md:gap-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(er.A,{level:"h4",as:"div",text:eg(t)||[],headingAlignment:"left",className:"leading-tight mb-0 md:mb-1"}),(0,r.jsx)("div",{className:"type-caption mt-1 mb-0 md:mt-0",children:i})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsxs)("div",{className:"flex items-center gap-4 justify-end",children:[(0,r.jsx)(er.A,{level:"h4",as:"div",text:eg(a)||[],headingAlignment:"right",className:"leading-tight mb-0 md:mb-1"}),u&&(0,r.jsxs)(eb.Ay,{children:[(0,r.jsx)(eb.Ay.Trigger,{children:(0,r.jsx)(g.A,{name:"info-icon",width:"24px",height:"24px"})}),(0,r.jsx)(eb.Ay.Content,{className:"max-w-[250px] z-500",children:u})]})]}),(0,r.jsx)("div",{className:"type-tags inline-flex items-center justify-end gap-1 mt-1 md:mt-0",children:x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{children:$}),(0,r.jsx)(g.A,{name:"airplane",className:"w-4 h-4"})]})})]})]}),0===Object.keys(z).length?(0,r.jsx)("div",{className:"px-4.5 py-6.5 border-b type-button",children:C?.noResultsLabel||"No tours available that match your criteria."}):Object.keys(z).sort((e,t)=>parseInt(e)-parseInt(t)).map(t=>{var a;let s=z[Number(t)]||[],i=V[Number(t)]||[];return(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"bg-duskridge text-white p-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h3",{className:"type-body font-semibold mb-0",children:t}),(0,r.jsxs)("div",{className:"type-caption mb-0 flex items-center gap-4 justify-end",children:[c+" $",(0,P.$g)({amount:(a=s[0],(0,P.ch)({departure:a,isPackageMode:x}))}),p&&(0,r.jsxs)(eb.Ay,{children:[(0,r.jsx)(eb.Ay.Trigger,{children:(0,r.jsx)(g.A,{name:"info-icon",width:"24px",height:"24px"})}),(0,r.jsx)(eb.Ay.Content,{className:"max-w-[250px] z-500",children:p})]})]})]})}),0===i.length?(0,r.jsx)("div",{className:"px-4.5 py-6.5 border-b type-button",children:C?.noResultsLabel||"No tours available that match your criteria."}):(0,r.jsx)("div",{children:i.map(e=>{let a=e.ts_metadata?.id,s=b.departure===a,i=a?k.get(a):void 0,l=D(e),n=(0,ex.y)(i,x,F,l,e?.ts_metadata?.groups),o=!n.isSelectable||!l,d=((e,t=!1)=>{let a=b.departure?v(b.departure):[];return(0,P.y8)({departure:e,isPackageMode:x,selectedAirport:b.selected_airport,availableAirports:a,includeInactive:t})})(e,!l),c=`form-label flex items-center justify-between px-4.5 py-6.5 border-b !mb-0 ${s?"bg-sleet":""} ${O?"bg-danger-bg":""} ${o?"opacity-50":""}`,m=(0,r.jsxs)("div",{className:"w-full grid items-center gap-3 md:gap-4 grid-cols-[60%_40%_1fr_auto] md:grid-cols-[38.3%_28.3%_1fr_auto] md:[grid-template-areas:'left_center_right']",children:[(0,r.jsxs)("div",{className:"col-start-1 row-start-1 md:[grid-area:left] flex items-center",children:[(0,r.jsx)("div",{className:"mr-3.25",children:(0,r.jsx)(R.sx,{id:`departure-${a}`,name:"departure",value:a,checked:s,onChange:async()=>{o||await f(a||null)},disabled:o,hasError:O,errorId:O?`departure-${t}-error`:void 0})}),(0,r.jsx)("div",{className:"type-button",children:(e=>{let t=e?.ts_metadata;if(!t)return(0,T.tX)(void 0,void 0);let a=e.ts_metadata?.id===b.departure,r=a?S:e.ts_metadata?.accommodations||[],s=[];if(a&&N){let e=(0,T.wR)(N);s=(0,T.Y$)(b.prices||[],e,w)}let{startDateStr:i,endDateStr:l}=(0,T.JJ)(t,x,s,a&&N||e,r);return(0,T.tX)(i,l)})(e)})]}),(0,r.jsx)("div",{className:"col-start-2 row-start-1 md:[grid-area:right] text-right",children:(0,r.jsxs)("div",{className:"inline-flex items-center justify-end gap-1 mt-1 md:mt-0",children:[(0,r.jsxs)("span",{className:"type-button",children:["$",(0,P.$g)({amount:d.totalPrice})]}),x&&(0,r.jsx)(g.A,{name:"airplane",className:"w-4 h-4"})]})}),(n.messages.length>0||_&&e.ts_metadata?.templateApproved===!1)&&(0,r.jsxs)("div",{className:"pl-9.5 md:pl-0 col-span-2 row-start-2 md:col-auto md:row-auto md:[grid-area:center] text-left md:text-center flex flex-wrap gap-1 md:justify-center",children:[n.messages.length>0&&(0,r.jsx)("div",{className:`type-tags ${n.className}`,children:n.messages.join(", ")}),_&&e.ts_metadata?.templateApproved===!1&&(0,r.jsx)("div",{className:"type-tags text-amber-700 bg-amber-100 px-1.5 rounded",children:"Unapproved"})]})]});return o?(0,r.jsx)("div",{className:c,children:m},e.ts_metadata?.id):(0,r.jsx)(R.JU,{className:c,children:m},e.ts_metadata?.id)})}),O&&(0,r.jsx)(eh.A,{message:e,id:`departure-${t}-error`,className:"mt-4"})]},t)}),(0,r.jsx)("div",{className:"type-fine-print mt-8",children:m})]})}let ey=(0,s.forwardRef)(function(e,t){let{tourData:a,bookingState:i,isPackageMode:l,globalSettings:n,hasTourPackages:d}=(0,o.useTourBooking)(),c=(0,s.useRef)(null),m=(0,S.mN)({});(0,T.uV)({containerRef:c});let{clearErrors:u,setError:p}=m;(0,s.useEffect)(()=>{i.departure&&u("departure")},[i.departure,u]),(0,s.useEffect)(()=>{i.selected_airport&&u("selected_airport")},[i.selected_airport,u]);let g=async()=>{u();let e=!i.departure,t=l&&!i.selected_airport;if(e&&p("departure",{type:"manual",message:"Please select a departure date to continue"}),t&&p("selected_airport",{type:"manual",message:"Please choose your departure city"}),e){let e=document.querySelector('input[name="departure"]');return e?.focus(),e?.scrollIntoView({behavior:"smooth",block:"center"}),!1}if(t){let e=document.getElementById("departure-city-select");return e?.focus(),e?.scrollIntoView({behavior:"smooth",block:"center"}),!1}return!0};return(s.useImperativeHandle(t,()=>({submitAndValidate:g})),a)?(0,r.jsx)(S.Op,{...m,children:(0,r.jsxs)("div",{ref:c,children:[(0,r.jsx)("div",{className:"mb-8",children:(0,r.jsx)(b.A,{level:"h4",as:"div",text:(0,f.m)(n?.chooseDatesSelectTourDateLabel||"Select Tour Date"),className:"text-left"})}),(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-7 md:gap-8",children:[(0,r.jsxs)("div",{className:"w-full md:w-[32.5%]",children:[d&&(0,r.jsxs)("div",{className:"border-b border-moss pb-9.25 mb-9.25 md:mb-10.25",children:[(0,r.jsx)(ee.A,{fieldSetLabel:n?.tourTypeSelectorFieldsetLabel,standardTourLabel:n?.tourTypeSelectorStandardTourLabel,standardTourTooltip:n?.tourTypeSelectorStandardTourTooltip,tourPlusTravelPackageLabel:n?.tourTypeSelectorTourPlusTravelPackageLabel,tourPlusTravelPackageTooltip:n?.tourTypeSelectorTourPlusTravelPackageTooltip,className:"booking-flow-selector"}),(0,r.jsx)(et,{error:m.formState.errors.selected_airport?.message,onClearError:()=>u("selected_airport"),flightsIncludedLabel:n?.departureCityFlightsIncludedLabel,selectDepartureFirstOption:n?.departureCitySelectDepartureFirstOption,noAirportsOption:n?.departureCityNoAirportsOption,chooseCityOption:n?.departureCityChooseCityOption,noteText:n?.departureCityNoteText,fieldLabel:n?.departureCityFieldLabel})]}),(0,r.jsx)(ea,{})]}),(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(ev,{error:m.formState.errors.departure?.message,dateHeadingLabel:n?.departureListDateHeading,priceHeadingLabel:n?.departureListPriceHeading,includesDaysLabel:n?.departureListIncludesDaysLabel,includesFlightsCaption:n?.departureListIncludesFlightsCaption,includesFlightsSelfGuidedCaption:n?.departureListIncludesFlightsSelfGuidedCaption,singleSupplementPrefix:n?.departureListSingleSupplementPrefix,departureListFinePrint:n?.departureListFinePrint,priceTooltip:n?.departureListPriceTooltip,singleSupplementTooltip:n?.departureListSingleSupplementTooltip})})]})]})}):null});var ej=a(84023),eN=a(38070);let ew=({defaultExpanded:e=!1,className:t="",showCredits:a=!0})=>{let{summaryData:i,isPackageMode:l,globalSettings:n,isPriceBreakdownExpanded:d,setPriceBreakdownExpanded:c,bookingState:m,selectedDeparture:u,getPriceByIdAsObjectPrice:h,isPriceActive:b}=(0,o.useTourBooking)(),{addOnsByCategory:f,addOnSingleSuppTotal:x}=(0,s.useMemo)(()=>{let e=i.guests,t=i.isSingleOwnRoom,a=m.prices||[];if(!u?.ts_metadata?.prices||0===a.length)return{addOnsByCategory:[],addOnSingleSuppTotal:0};let r=[],s=u.ts_metadata.prices,o=l?A.db.TOUR_PLUS_TRAVEL_PACKAGE:A.db.TOUR,d=s.find(e=>(0,A.uA)(e)===o&&(0,A.qt)(e,b)),c=d?.ts_metadata?.id||d?.id;
1c&&r.push(c),(d?.ts_metadata?.upgrades||[]).forEach(e=>{let t=e.ts_metadata?.id||e.id;t&&r.push(t)});let p=a.filter(e=>!r.includes(e)),g=0,f=0,x=0,_=0,v=0;for(let a of p){let r=h(a);if(!r)continue;let s=r.ts_metadata,i=(0,A.uA)(r);if(l&&c&&s?.included_in_price===c)continue;let n=(0,T.i)(s?.price_amount),o=t?(0,T.i)(s?.single_supplement?.price_amount):0,d=n*e;A.Sx.EXTRA_EXPERIENCES.includes(i)?(g+=d,f++,v+=o*e):A.Sx.HOTELS.includes(i)&&(x+=d,_++,v+=o*e)}let y=[];return g>0&&y.push({total:g,count:f,singularLabel:n?.summaryExtraExperienceSingularLabel||"Extra Experience",pluralLabel:n?.summaryExtraExperiencesPluralLabel||"Extra Experiences"}),x>0&&y.push({total:x,count:_,singularLabel:n?.summaryExtraHotelNightSingularLabel||"Extra Hotel Night",pluralLabel:n?.summaryExtraHotelNightsPluralLabel||"Extra Hotel Nights"}),{addOnsByCategory:y,addOnSingleSuppTotal:v}},[i.guests,i.isSingleOwnRoom,m.prices,u,l,h,n,b]),_=i.roomSingleSuppPerPerson*i.guests+x;s.useEffect(()=>{e&&!d&&c(!0)},[]);let v=N()("space-y-3 mt-4",{visible:d,hidden:!d},"print:visible! print:block!");return(0,r.jsxs)("div",{className:t,children:[(0,r.jsx)(p.A,{type:"button",variant:"text-link",onClick:()=>c(!d),className:"flex items-center gap-2 text-left w-full justify-start p-0",iconAfter:(0,r.jsx)(g.A,{name:d?"chevron-up":"chevron-down"}),children:n?.priceBreakdownToggleLabel||"Show price breakdown"}),(0,r.jsxs)("div",{className:v,children:[(0,r.jsxs)("div",{className:"flex gap-2 justify-between type-paragraph mb-0",children:[(0,r.jsx)("span",{children:l?n?.tourPlusPackageLabel||"Tour + Travel Package":n?.tourOnlyLabel||"Tour"}),(0,r.jsxs)("span",{className:"self-top",children:["$",(0,P.$g)({amount:(i.roomPerPerson-i.roomSingleSuppPerPerson)*i.guests})]})]}),f.map((e,t)=>(0,r.jsxs)("div",{className:`flex gap-2 justify-between type-paragraph${t<f.length-1?" mb-0":""}`,children:[(0,r.jsx)("span",{children:1===e.count?e.singularLabel:e.pluralLabel}),(0,r.jsxs)("span",{className:"self-top",children:["$",(0,P.$g)({amount:e.total})]})]},t)),_>0&&(0,r.jsxs)("div",{className:"flex gap-2 justify-between type-paragraph",children:[(0,r.jsx)("span",{children:n?.singleSupplementLabel||"Single Supplement"}),(0,r.jsxs)("span",{className:"self-top",children:["$",(0,P.$g)({amount:_})]})]}),l&&i.airportFee>0&&(0,r.jsxs)("div",{className:"flex gap-2 justify-between type-paragraph",children:[(0,r.jsx)("span",{children:n?.airportFeeLabel||"Airport Fee"}),(0,r.jsxs)("span",{className:"self-top",children:["$",(0,P.$g)({amount:i.airportFee*i.guests})]})]}),a&&i.promoDiscount>0&&(0,r.jsxs)("div",{className:"flex gap-2 justify-between type-paragraph",children:[(0,r.jsx)("span",{children:n?.promoDiscountLabel||"Promo Code Discount"}),(0,r.jsxs)("span",{className:"self-top",children:["(-$",(0,P.$g)({amount:i.promoDiscount}),")"]})]}),a&&i.creditsTotal>0&&(0,r.jsx)(r.Fragment,{children:i.hasExcessCredits?n?.summaryCreditsContactMessage&&(0,r.jsx)("div",{className:"type-paragraph mb-0",children:(0,r.jsx)(eN.A,{...n.summaryCreditsContactMessage,marginTop:"none",marginBottom:"none",showSectionBlock:!1,textType:"body"})}):i.travelerCredits.filter(e=>parseFloat(e?.credits||"0")>0).sort((e,t)=>parseFloat(t.credits||"0")-parseFloat(e.credits||"0")).map((e,t)=>(0,r.jsxs)("div",{className:"flex gap-2 justify-between type-paragraph mb-0",children:[(0,r.jsx)("span",{children:"Itemized Credit"}),(0,r.jsxs)("span",{className:"self-top",children:["(-$",(0,P.$g)({amount:parseFloat(e.credits)}),")"]})]},t))})]})]})};var eS=a(58765);let eT=({showPriceBreakdown:e=!0,showPromoCode:t=!1,showRemainingBalance:a=!0,className:s="",isConfirmation:i=!1})=>{let{summaryData:l,isPackageMode:d,isWaitlistMode:c,selectedDeparture:m,globalSettings:u,isOnRequest:p,tourData:g}=(0,o.useTourBooking)(),h=(0,n.n4)(g?.ts_metadata?.departures),x=$({isWaitlistMode:c,isFullPaymentDue:l.isFullPaymentDue,isConfirmation:i,settings:u}),_=m?.ts_metadata?.final_payment_date,v=(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"space-y-1 mb-6 md:mb-5",children:[(0,r.jsxs)("div",{className:"type-paragraph mb-0 capitalize",children:[l.guests," ",1===l.guests?u?.bookingSummaryGuestSingularLabel||"guest":u?.bookingSummaryGuestPluralLabel||"guests"]}),(0,r.jsx)("div",{className:"type-paragraph mb-0 capitalize",children:l.occupancyLabel}),(0,r.jsx)("div",{className:"type-paragraph mb-0",children:d?u?.customizePackageModeHeading||"Tour + Travel Package":u?.tourTypeSelectorStandardTourLabel||"Tour"}),p&&(0,r.jsx)(B,{})]}),e&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("hr",{className:"mb-6 border-moss"}),(0,r.jsx)("div",{className:"mb-6 px-6 md:px-5",children:(0,r.jsx)(ew,{})})]}),c&&(0,r.jsxs)("div",{className:"mb-6 md:mb-8",children:[(0,r.jsx)("div",{className:"heading-5 mb-2",children:i?u?.joinedWaitlistLabel||"Waitlist Joined":u?.joiningWaitlistLabel||"Joining waitlist"}),(0,r.jsx)("div",{className:"type-fine-print",children:i?u?.joinedWaitlistDescription||"You have joined the waitlist for this tour. We will confirm your reservation if space becomes available.":u?.joiningWaitlistDescription||"You can join the waitlist for this tour, however, your reservation is not guaranteed. We will confirm your reservation if space becomes available."})]}),(0,r.jsxs)("div",{className:"space-y-2 border-t border-moss mt-6",children:[c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"tb-subsection type-paragraph p-6 md:p-5 mb-0",children:[(0,r.jsx)("span",{className:"font-bold",children:u?.bookingSummaryTotalLabel||"Total"}),(0,r.jsxs)("span",{className:"heading-5",children:["$",(0,P.$g)({amount:l.grandTotal})]})]}),(0,r.jsxs)("div",{className:"tb-subsection heading-5 bg-pollen p-6 md:p-5",children:[(0,r.jsxs)("span",{className:"heading-5 block mb-1",children:[x,(0,r.jsx)("div",{className:"type-caption mb-0",children:u?.customizeNoPaymentRequiredLabel||"No payment required to join waitlist."})]}),(0,r.jsxs)("span",{children:["$",(0,P.$g)({amount:0})]})]})]}),!c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"tb-subsection type-paragraph p-6 md:p-5 mb-0",children:[(0,r.jsx)("span",{className:"font-bold",children:u?.bookingSummaryTotalLabel||"Total"}),(0,r.jsxs)("span",{className:"heading-5",children:["$",(0,P.$g)({amount:l.grandTotal})]})]}),(0,r.jsxs)("div",{className:"tb-subsection heading-5 bg-pollen p-6 md:p-5 mb-0",children:[(0,r.jsx)("span",{children:x}),(0,r.jsxs)("span",{children:["$",(0,P.$g)({amount:l.amountDueToday})]})]}),!l.isFullPaymentDue&&a&&l.remainingBalance>0&&(0,r.jsxs)("div",{className:"tb-subsection p-6 md:p-5 mb-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"type-paragraph font-bold mb-0",children:u?.bookingSummaryRemainingCostLabel||"Remaining Cost"}),(0,r.jsxs)("div",{className:"type-caption",children:[u?.bookingSummaryDueLabel||"Due"," ",(0,k.gl)(_)]})]}),(0,r.jsxs)("span",{className:"heading-5",children:["$",(0,P.$g)({amount:l.remainingBalance})]})]})]})]}),t&&(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(O,{headingClassName:"type-paragraph font-bold"})})]});return(0,r.jsxs)(eS.A,{className:`drawer--mobile-only border-2! max-md:border-x-0! border-obsidian! bg-sleet md:rounded-lg px-8 py-6 md:px-12 md:py-8 ${s}`,expandedByDefault:!0,children:[(0,r.jsx)(eS.A.Toggle,{as:"div",className:"flex items-center justify-between md:pointer-events-none px-0! mb-0!",children:(0,r.jsx)("div",{className:"heading-4 mb-2",children:u?.bookingSummaryHeadingLabel||"Booking Summary"})}),h&&(0,r.jsxs)("div",{className:"mb-6 bg-bolt rounded-[12px] p-8 flex flex-col items-center justify-center gap-6 text-center",children:[(0,r.jsx)("p",{className:"type-body-no-margin",children:"You're traveling with"}),(0,r.jsx)(b.A,{level:"h5",text:(0,f.m)(h.group_name||"Group",{em:!0})}),h.group_number&&(0,r.jsxs)("p",{className:"type-body-no-margin",children:["Group Number: ",(0,r.jsx)("strong",{children:h.group_number})]})]}),(0,r.jsx)(eS.A.Content,{className:"drawer-content--mobile-only",innerClassName:"mb-0! md:mb-0! p-0!",children:v})]})},eA=e=>/^[a-zA-Z0-9._+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e);function ek(e){let t=new Set;for(let{field:a,person:r}of e){let e=(r.email||"").trim().toLowerCase();if(e&&t.has(e))return{field:`${a}.email`,message:"Each traveler must have a unique email address."};e&&t.add(e)}return null}var eL=a(42323);function eC(e){return[{field:"customer",person:e.customer},...e.travelers.map((e,t)=>({field:`travelers.${t}`,person:e}))]}let eE=(0,f.m)("Your bookings will be associated to the email address for your logged-in profile. Please contact customer service to change the email address associated to your bookings."),eP=(0,f.m)("Provide an email address to associate to your booking. Note that you will not be able to access bookings in your My Account if they do not match the email address of your logged-in profile."),eR=()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("option",{value:"",children:"Select"}),(0,r.jsx)("optgroup",{label:"US States",children:y.Ky.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,r.jsx)("optgroup",{label:"US Territories",children:y.OO.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,r.jsx)("optgroup",{label:"Canadian Provinces",children:y.lh.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))}),(0,r.jsx)("optgroup",{label:"Other",children:y.gk.filter(e=>!e?.usTerritory&&e?.value!=="US"&&e?.value!=="CA").map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))})]}),eO=({guestIndex:e,isPrimary:t,baseName:a,fieldIdPrefix:s,guestLabel:i,guestErrors:l,methods:n,control:o,dobRef:d,phoneRef:c,isPrimaryTraveler:m,onPrimaryTravelerChange:u,primaryTravelerCheckboxLabel:p,primaryTravelerCheckboxTooltip:h,emailLockedMessage:b,emailUnlockedMessage:f,isAuthenticated:x})=>{let _=t&&m&&x;return(0,r.jsxs)(r.Fragment,{children:[e>0&&(0,r.jsx)("hr",{className:"border-moss"}),(0,r.jsx)("h3",{className:"heading-3",children:i}),(0,r.jsxs)("div",{className:"flex flex-col",children:[t&&x&&(0,r.jsx)("section",{className:"mb-8",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(R.Sc,{id:"is_primary_traveler",name:"is_primary_traveler",label:p||"I am the primary traveler",checked:m,onChange:e=>u?.(e)}),h&&h.length>0&&(0,r.jsxs)(q.A,{placement:"top",children:[(0,r.jsx)(q.A.Trigger,{"aria-label":"More info about primary traveler",as:"span",className:"text-gray-400 hover:text-gray-600",children:(0,r.jsx)(g.A,{name:"info-icon",width:"24px",height:"24px"})}),(0,r.jsx)(q.A.Content,{className:"max-w-[250px] z-500",children:(0,r.jsx)(eL.A,{text:h,textType:"caption"})})]})]})}),t&&(0,r.jsxs)("section",{className:"space-y-5 mb-8",children:[(0,r.jsx)(R.D0,{id:`${s}.email`,label:"Email",required:!0,error:l?.email?.message,children:(0,r.jsx)(R.pd,{type:"email",...n.register(`${a}.email`,{required:"Email is required",validate:{format:e=>eA(e||"")||"Please enter a valid email address",unique:(e,t)=>
1{let r=ek(eC(t));return!r||r.field!==`${a}.email`||r.message}}}),error:!!l?.email,id:`${s}.email`,placeholder:"Email",readOnly:_,disabled:_,className:_?"bg-gray-100 cursor-not-allowed":""})}),t&&x&&(0,r.jsx)(eL.A,{text:m?b||eE:f||eP,textType:"caption"})]}),(0,r.jsxs)("section",{className:"space-y-5 mb-12",children:[(0,r.jsx)("div",{className:"heading-5",children:"Name"}),(0,r.jsx)(R.D0,{id:`${s}.first_name`,label:"First Name",required:!0,error:l?.first_name?.message,children:(0,r.jsx)(R.pd,{...n.register(`${a}.first_name`,{required:"First name is required"}),error:!!l?.first_name,id:`${s}.first_name`,placeholder:"First Name"})}),(0,r.jsx)(R.D0,{id:`${s}.last_name`,label:"Last Name",required:!0,error:l?.last_name?.message,children:(0,r.jsx)(R.pd,{...n.register(`${a}.last_name`,{required:"Last name is required"}),error:!!l?.last_name,id:`${s}.last_name`,placeholder:"Last Name"})})]}),(0,r.jsxs)("section",{className:"space-y-5 mb-12",children:[(0,r.jsx)("div",{className:"heading-5",children:"Birthday"}),(0,r.jsx)(R.D0,{id:`${s}.date_of_birth`,label:"Date of Birth",required:!0,error:l?.date_of_birth?.message,children:(0,r.jsx)(S.xI,{name:`${a}.date_of_birth`,control:o,rules:{required:"Birthday is required",validate:e=>{if(!e)return!0;let t=e.match(/^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/((19|20)\d{2})$/);if(!t)return"Invalid date format";let[,a,r,s]=t,i=new Date(Date.UTC(parseInt(s),parseInt(a)-1,parseInt(r)));if(i.getUTCMonth()+1!==parseInt(a)||i.getUTCDate()!==parseInt(r))return"Invalid date";let l=new Date().getUTCFullYear()-i.getUTCFullYear();return l<18?"Must be at least 18 years old":!(l>120)||"Must enter a valid age"}},render:({field:e})=>(0,r.jsx)(ej.o,{...e,value:e.value||"",ref:d,mask:[/[0-1]/,/\d/,"/",/[0-3]/,/\d/,"/",/[1-2]/,/\d/,/\d/,/\d/],placeholder:"MM/DD/YYYY",guide:!1,type:"text",className:`form-input type-button ${l?.date_of_birth?"form-input--error":""}`})})})]}),(0,r.jsxs)("section",{className:"space-y-5",children:[(0,r.jsx)("div",{className:"heading-5",children:"Contact"}),!t&&(0,r.jsx)(R.D0,{id:`${s}.email`,label:"Email",required:!0,error:l?.email?.message,children:(0,r.jsx)(R.pd,{type:"email",...n.register(`${a}.email`,{required:"Email is required",validate:{format:e=>eA(e||"")||"Please enter a valid email address",unique:(e,t)=>{let r=ek(eC(t));return!r||r.field!==`${a}.email`||r.message}}}),error:!!l?.email,id:`${s}.email`,placeholder:"Email"})}),(0,r.jsx)(R.D0,{id:`${s}.phone`,label:"Phone",required:!0,error:l?.phone?.message,children:(0,r.jsx)(S.xI,{name:`${a}.phone`,control:o,rules:{required:"Phone is required",validate:e=>!e||/^\d{3}-\d{3}-\d{4}$/.test(e)||"Invalid phone format (use ###-###-####)"},render:({field:e})=>(0,r.jsx)(ej.o,{...e,value:e.value||"",ref:c,mask:[/\d/,/\d/,/\d/,"-",/\d/,/\d/,/\d/,"-",/\d/,/\d/,/\d/,/\d/],placeholder:"###-###-####",guide:!1,type:"tel",className:`form-input type-button ${l?.phone?"form-input--error":""}`})})}),(0,r.jsx)(R.D0,{id:`${s}.address.state_or_province`,label:"State/Province",required:!0,error:l?.address?.state_or_province?.message,children:(0,r.jsx)(R.l6,{...n.register(`${a}.address.state_or_province`,{required:"State is required"}),error:!!l?.address?.state_or_province,id:`${s}.address.state_or_province`,children:(0,r.jsx)(eR,{})})})]})]})]})},e$=(0,s.forwardRef)(function({onSubmitValid:e},t){let{bookingState:a,globalSettings:i}=(0,o.useTourBooking)(),l=(0,d.ge)(),n=l?.isAuthenticated??!1,c=l?.user,[m,u]=(0,s.useState)(()=>{let e=a.customer?.email,t=c?.email;return!e||!t||e===t});(0,T.uV)({selector:'input[name="customer.first_name"]'});let p=(0,S.mN)({mode:"onChange",reValidateMode:"onChange",defaultValues:{customer:{first_name:a.customer?.first_name?a.customer.first_name:c?.given_name?c.given_name:"",last_name:a.customer?.last_name?a.customer.last_name:c?.family_name?c.family_name:"",date_of_birth:a.customer?.date_of_birth||"",email:a.customer?.email?a.customer.email:n&&c?.email?c.email:"",phone:a.customer?.phone||"",address:{state_or_province:a.customer?.address?.state_or_province||""}},travelers:a.travelers.map(e=>({first_name:e.first_name||"",last_name:e.last_name||"",date_of_birth:e.date_of_birth||"",email:e.email||"",phone:e.phone||"",address:{state_or_province:e.address?.state_or_province||""}})),activity_level_consent:a.activity_level_consent,trip_terms_consent:a.trip_terms_consent}}),g=e=>{u(e),e&&c?.email?p.setValue("customer.email",c.email):a.customer?.email||p.setValue("customer.email","")};(0,s.useEffect)(()=>
1{if(!c)return;let e=p.getValues();!e.customer.first_name&&c.given_name&&p.setValue("customer.first_name",c.given_name),!e.customer.last_name&&c.family_name&&p.setValue("customer.last_name",c.family_name),m&&!e.customer.email&&c.email&&p.setValue("customer.email",c.email)},[c,m,p]);let{control:h,formState:{errors:b}}=p,f=(0,S.jz)({control:h,name:"travelers"}),x=1+f.fields.length;(0,s.useEffect)(()=>{let e=["customer.email",...f.fields.map((e,t)=>`travelers.${t}.email`)],t=p.watch((t,{name:a})=>{a&&e.includes(a)&&p.trigger(e)});return()=>t.unsubscribe()},[p,f.fields]);let _=s.useMemo(()=>Array.from({length:x},()=>({dobRef:s.createRef(),phoneRef:s.createRef()})),[x]);return(0,s.useImperativeHandle)(t,()=>({submitAndGetValues:async()=>{if(!await p.trigger()){let e=(t,a="")=>{if(!t||"object"!=typeof t)return null;for(let r of Object.keys(t)){let s=t[r],i=a?`${a}.${r}`:r;if(s&&"object"==typeof s&&"message"in s)return i;let l=e(s,i);if(l)return l}return null},t=e(p.formState.errors)||void 0;if(t){p.setFocus(t);let e=document.querySelector(`[name="${t}"]`);e?.scrollIntoView({behavior:"smooth",block:"center"})}return null}let t=p.getValues();return e?.(t),t}})),(0,r.jsx)(S.Op,{...p,children:(0,r.jsx)("form",{className:"space-y-8","aria-live":"polite",onSubmit:e=>e.preventDefault(),children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[3.11fr_2fr] gap-10 md:gap-12",children:[(0,r.jsx)("div",{className:"md:hidden",children:(0,r.jsx)(eT,{})}),(0,r.jsxs)("div",{className:"space-y-14",children:[Array.from({length:x},(e,t)=>{let a=0===t,s=t-1,l=a?"customer":`travelers.${s}`,o=a?"Guest 1 (Primary)":`Guest ${t+1}`,d=a?"customer":`traveler-${s}`,u=a?b.customer:b.travelers?.[s];return(0,r.jsx)(eO,{guestIndex:t,isPrimary:a,baseName:l,fieldIdPrefix:d,guestLabel:o,guestErrors:u,methods:p,control:h,dobRef:_[t].dobRef,phoneRef:_[t].phoneRef,isPrimaryTraveler:m,onPrimaryTravelerChange:g,profileEmail:c?.email,primaryTravelerCheckboxLabel:i?.guestsPrimaryTravelerCheckboxLabel,primaryTravelerCheckboxTooltip:i?.guestsPrimaryTravelerCheckboxTooltip,emailLockedMessage:i?.guestsPrimaryTravelerEmailLockedMessage,emailUnlockedMessage:i?.guestsPrimaryTravelerEmailUnlockedMessage,isAuthenticated:n},a?"customer":`traveler-${s}`)}),(0,r.jsx)("hr",{className:"border-moss"}),(0,r.jsxs)("section",{className:"space-y-12",children:[(0,r.jsx)("div",{children:(0,r.jsx)(S.xI,{name:"activity_level_consent",control:p.control,rules:{validate:e=>!0===e||"This consent is required"},render:({field:e,fieldState:t})=>(0,r.jsx)(R.Sc,{id:"activity_level_consent",name:"activity_level_consent",label:(0,r.jsx)("span",{children:"I have reviewed and accept the Activity Level of this tour"}),labelClassName:"type-button!",className:"gap-0!",required:!0,checked:!!e.value,onChange:t=>e.onChange(t),errorMessage:t.error?.message})})}),(0,r.jsx)("div",{children:(0,r.jsx)(S.xI,{name:"trip_terms_consent",control:p.control,rules:{validate:e=>!0===e||"This consent is required"},render:({field:e,fieldState:t})=>(0,r.jsx)(R.Sc,{id:"trip_terms_consent",name:"trip_terms_consent",label:(0,r.jsx)("span",{children:"I agree to the Terms & Conditions"}),labelClassName:"type-button!",required:!0,className:"gap-0!",checked:!!e.value,onChange:t=>e.onChange(t),errorMessage:t.error?.message})})})]})]}),(0,r.jsx)("div",{className:"hidden md:block",children:(0,r.jsx)(eT,{className:"md:sticky top-4"})})]})})})}),eF=(0,s.forwardRef)(function(e,t){let a=c("6Lfu7LYrAAAAAOxmqcqfbO-9g0YPb1ozGdf_LFPT"),i=((e,t)=>{let[a,r]=(0,s.useState)({clientLibrary:null,captureContext:null}),i=(0,s.useRef)(!1);return(0,s.useEffect)(()=>{let a=()=>{fetch(`${e}${t}`).then(e=>e.json()).then(e=>{r(e)}).catch(e=>m.v.error(e))};i.current||(i.current=!0,a());let s=setInterval(a,84e4);return()=>clearInterval(s)},[e,t]),a})("https://api.vbt.com",y.B1),{bookingState:l,updateBilling:n,setFlexResponse:d,fetchTravelerCredits:u,summaryData:g}=(0,o.useTourBooking)();(0,T.uV)({selector:'input[name="cardholder_name"]'});
1let[h,b]=(0,s.useState)(!1),[f,x]=(0,s.useState)({}),[_,v]=(0,s.useState)(l.billing?.billingMasks||{}),[j,N]=(0,s.useState)(null),w=(0,s.useRef)(null),A=(0,s.useRef)(null),k=(0,S.mN)({mode:"onChange",defaultValues:{cardholder_name:l.billing?.cardholderName||(l.billing?.first_name?`${l.billing.first_name} ${l.billing.last_name||""}`.trim():""),exp_date:l.billing?.expDate||"",billing_first_name:l.billing?.first_name||l.customer?.first_name||"",billing_middle_name:l.billing?.middle_name||"",billing_last_name:l.billing?.last_name||l.customer?.last_name||"",billing_email:l.billing?.email||l.customer?.email||"",billing_address:{line1:l.billing?.address?.line1||"",line2:l.billing?.address?.line2||"",city:l.billing?.address?.city||"",state_or_province:l.billing?.address?.state_or_province||"",postal_code:l.billing?.address?.postal_code||"",country:l.billing?.address?.country||"US"}}}),L=k.watch("exp_date");(0,s.useEffect)(()=>{!l.customer?.first_name||l.billing?.first_name||j||(k.setValue("billing_first_name",l.customer.first_name),k.setValue("billing_last_name",l.customer.last_name||""),k.setValue("billing_email",l.customer.email||""))},[l.customer,l.billing,j,k]),(0,s.useEffect)(()=>{l.flexresponse&&!j&&N(l.flexresponse)},[l.flexresponse,j]),(0,s.useEffect)(()=>{let e=()=>{b(window.innerWidth<y.yF.md)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let C=(0,s.useRef)(!1);(0,s.useEffect)(()=>{l.booking_id&&l.customer?.email&&!g.travelerCredits?.length&&!C.current&&(C.current=!0,a("fetch_traveler_credits").then(e=>{e&&u(e)}).catch(e=>{m.v.error("Failed to fetch traveler credits:",e),C.current=!1}))},[]),(0,s.useEffect)(()=>{if(j||!i?.clientLibrary||!i?.captureContext)return;let e=document.querySelector(`script[src="${i.clientLibrary}"]`);e&&e.remove();let t=document.createElement("script");return t.src=i.clientLibrary,t.async=!0,t.onload=()=>{if(!window.Flex)return void m.v.error("Flex is not available in window");let e=new window.Flex(i.captureContext);if("function"!=typeof e.microform)return void m.v.error("microform is not a constructor in Flex");let t={input:{"font-size":h?y.w:y.fi,"font-family":y.kA,color:"#000000"},"::placeholder":{color:"#9ca3af"},invalid:{color:"#dc2626"}},a=e.microform({styles:t,fields:{number:{selector:"#card-number-container"},securityCode:{selector:"#security-code-container"}}}),r=a.createField("number",{placeholder:"Card Number",disabled:!!j}),s=a.createField("securityCode",{placeholder:y.Pd,disabled:!!j});r.load("#card-number-container"),s.load("#security-code-container"),r.on("change",e=>{if(e.couldBeValid?x(e=>({...e,number:""})):x(e=>({...e,number:"Invalid card number"})),e.valid&&e.card?.[0]){let t=e.card[0],a=t.lengths[0],r=t.spaces,s=y.Ng.repeat(a);for(let e=0;e<r.length;e++){let t=r[e]+e;s=s.slice(0,t)+" "+s.slice(t)}let i=t.securityCode.length;v({currentCardMask:s,currentCardSecurityMask:y.Ng.repeat(i),brandedName:t?.brandedName||"",securityCodeLabel:t?.securityCode?.name||y.Pd})}else v({})}),s.on("change",e=>{e.couldBeValid?x(e=>({...e,securityCode:""})):x(e=>({...e,securityCode:"Invalid security code"}))}),w.current=a},document.body.appendChild(t),()=>{let e=document.querySelector("#card-number-container"),t=document.querySelector("#security-code-container");e&&(e.innerHTML=""),t&&(t.innerHTML=""),w.current&&(w.current=null);let a=document.querySelector(`script[src="${i.clientLibrary}"]`);a&&a.remove(),window.Flex&&delete window.Flex}},[i,j,h]),(0,s.useImperativeHandle)(t,()=>({submitAndGetValues:async()=>{let e=await k.trigger(),t=k.formState.errors,r=null,s=null;try{r=await new Promise((e,t)=>{if(j)return void e(j);if(!w.current)return void t(Error("Microform instance is not available"));let a=L?.split("/")||[],r={expirationMonth:a[0],expirationYear:`20${a[1]}`};w.current.createToken(r,(a,r)=>{if(a){let e=a?.details?.reduce((e,t)=>(e[t.location]=t.message,e),{});x(e||{}),t(Error(`Validation error: ${JSON.stringify(e)}`));return}e(r)})})}catch(e){s=e}if(!e||s){let e=Object.keys(t)[0];return e&&k.setFocus(e),null}let i=k.getValues();try{let e=await a("submit_payment");
1if(!r||!e)throw Error("Failed to get required tokens");N(r);let t=L?.split("/")||[];return n({first_name:i.billing_first_name,middle_name:i.billing_middle_name,last_name:i.billing_last_name,email:i.billing_email,address:i.billing_address,expiration_month:t[0],expiration_year:`20${t[1]}`,cardholderName:i.cardholder_name,expDate:L,billingMasks:_}),d(r),{billing:{first_name:i.billing_first_name,middle_name:i.billing_middle_name,last_name:i.billing_last_name,email:i.billing_email,address:i.billing_address,expiration_month:t[0],expiration_year:`20${t[1]}`,cardholderName:i.cardholder_name,expDate:L,billingMasks:_},flexresponse:r}}catch(e){return m.v.error("Failed to submit payment:",e),null}}}));let E=k.watch("billing_address.country"),P=(0,s.useMemo)(()=>"CA"===E?y.lh:y.Ky,[E]),O=(0,s.useMemo)(()=>"CA"===E?"Postal Code":"US"===E?"Zip Code":"Zip/Postal Code",[E]),$=(0,s.useMemo)(()=>"CA"===E?"Postal code is required":"US"===E?"Zip code is required":"Zip/Postal Code is required",[E]),F=(0,s.useMemo)(()=>"CA"===E?"Province":"US"===E?"State":"State/Province/Region",[E]);return(0,r.jsx)("div",{className:"tour-payment",children:(0,r.jsx)(S.Op,{...k,children:(0,r.jsx)("form",{onSubmit:e=>e.preventDefault(),children:(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[3.11fr_2fr] gap-10 md:gap-12",children:[(0,r.jsx)("div",{className:"md:hidden",children:(0,r.jsx)(eT,{})}),(0,r.jsxs)("div",{className:"space-y-14",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("div",{className:"heading-5",children:"Payment Information"}),j&&(0,r.jsx)(p.A,{type:"button",variant:"text-link",onClick:()=>{N(null),v({}),k.setValue("exp_date",""),n({...l.billing,expiration_month:void 0,expiration_year:void 0,cardholderName:void 0,expDate:void 0,billingMasks:void 0}),d("")},children:"Edit Card"})]}),(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsx)("div",{children:(0,r.jsx)(R.D0,{label:"Cardholder Name",required:!0,error:k.formState.errors.cardholder_name?.message,id:"cardholder_name",children:(0,r.jsx)(R.pd,{id:"cardholder_name",placeholder:"Cardholder Name",error:!!k.formState.errors.cardholder_name?.message,...k.register("cardholder_name",{required:"Cardholder name is required"}),disabled:!!j})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)(R.JU,{required:!0,children:"Card Number"}),j?(0,r.jsx)(R.pd,{value:_.currentCardMask||"",disabled:!0}):(0,r.jsx)("div",{id:"card-number-container",className:`form-input type-button flex-microform ${f.number?"form-input--error":""}`}),f.number&&(0,r.jsx)("p",{className:"text-sm text-red-600 mt-1",children:f.number})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsx)("div",{children:(0,r.jsx)(R.D0,{label:"Expiration Date",required:!0,error:k.formState.errors.exp_date?.message,id:"exp_date",children:(0,r.jsx)(S.xI,{name:"exp_date",control:k.control,rules:{required:"Expiration date is required",validate:e=>{let t=e.match(/^(0[1-9]|1[0-2])\/(\d{2})$/);if(!t)return"Format must be MM/YY";let[,,a]=t,r=new Date().getFullYear()%100;return parseInt(a)<r?"Card has expired":!(parseInt(a)>r+10)||"Expiration year is too far in the future"}},render:({field:e})=>(0,r.jsx)(ej.o,{...e,ref:A,mask:[/[0-1]/,/\d/,"/",/\d/,/\d/],placeholder:"MM/YY",guide:!1,type:"text",disabled:!!j,className:`form-input type-button ${k.formState.errors.exp_date?.message?"form-input--error":""}`})})})}),(0,r.jsxs)("div",{children:[(0,r.jsx)(R.JU,{required:!0,children:"Security Code"}),j?(0,r.jsx)(R.pd,{value:_.currentCardSecurityMask||"",disabled:!0}):(0,r.jsx)("div",{id:"security-code-container",className:`form-input type-button flex-microform ${f.securityCode?"form-input--error":""}`}),f.securityCode&&(0,r.jsx)("p",{className:"text-sm text-red-600 mt-1",children:f.securityCode})]})]})]}),(0,r.jsx)("div",{className:"heading-5",children:"Billing Address"}),(0,r.jsxs)("div",{className:"flex flex-col gap-8",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[(0,r.jsx)(R.D0,{label:"First Name",required:!0,error:k.formState.errors.billing_first_name?.message,id:"billing_first_name",children:(0,r.jsx)(R.pd,{id:"billing_first_name",placeholder:"First Name",...k.register("billing_first_name",{required:"First name is required"}),disabled:!!j,error:!!k.formState.errors.billing_first_name?.message})}),(0,r.jsx)(R.D0,{label:"Middle Name",error:k.formState.errors.billing_middle_name?.message,id:"billing_middle_name",children:(0,r.jsx)(R.pd,{id:"billing_middle_name",placeholder:"Middle Name",...k.register("billing_middle_name"),disabled:!!j})}),(0,r.jsx)(R.D0,{label:"Last Name",required:!0,error:k.formState.errors.billing_last_name?.message,id:"billing_last_name",children:(0,r.jsx)(R.pd,{id:"billing_last_name",placeholder:"Last Name",...k.register("billing_last_name",{required:"Last name is required"}),disabled:!!j,error:!!k.formState.errors.billing_last_name?.message})})]}),(0,r.jsx)(R.D0,{label:"Email Address",required:!0,error:k.formState.errors.billing_email?.message,id:"billing_email",children:(0,r.jsx)(R.pd,{id:"billing_email",type:"email",placeholder:"Email Address",...k.register("billing_email",{required:"Email address is required",validate:e=>eA(e)||"Please enter a valid email address"}),disabled:!!j,error:!!k.formState.errors.billing_email?.message})}),(0,r.jsx)(R.D0,{label:"Address Line 1",required:!0,error:k.formState.errors.billing_address?.line1?.message,id:"billing_address.line1",children:(0,r.jsx)(R.pd,{id:"billing_address.line1",placeholder:"Address Line 1",...k.register("billing_address.line1",{required:"Address is required"}),disabled:!!j,error:!!k.formState.errors.billing_address?.line1?.message})}),(0,r.jsx)(R.D0,{label:"Address Line 2",error:k.formState.errors.billing_address?.line2?.message,id:"billing_address.line2",children:(0,r.jsx)(R.pd,{id:"billing_address.line2",placeholder:"Address Line 2",...k.register("billing_address.line2"),disabled:!!j})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsx)(R.D0,{label:"City",required:!0,error:k.formState.errors.billing_address?.city?.message,id:"billing_address.city",children:(0,r.jsx)(R.pd,{...k.register("billing_address.city",{required:"City is required"}),disabled:!!j,id:"billing_address.city",placeholder:"City",error:!!k.formState.errors.billing_address?.city?.message})}),(0,r.jsx)(R.D0,{label:F,required:"CA"===E||"US"===E,error:"CA"===E||"US"===E?k.formState.errors.billing_address?.state_or_province?.message:void 0,id:"billing_address.state_or_province",children:"CA"===E||"US"===E?(0,r.jsxs)(R.l6,{...k.register("billing_address.state_or_province",{required:`${"CA"===E?"Province":"State"} is required`}),disabled:!!j,id:"billing_address.state_or_province",error:!!k.formState.errors.billing_address?.state_or_province?.message,children:[(0,r.jsxs)("option",{value:"",children:["Select ",F]}),P.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]}):(0,r.jsx)(R.pd,{...k.register("billing_address.state_or_province"),disabled:!!j,id:"billing_address.state_or_province",placeholder:F})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsx)(R.D0,{label:O,required:!0,error:k.formState.errors.billing_address?.postal_code?.message,id:"billing_address.postal_code",children:(0,r.jsx)(R.pd,{...k.register("billing_address.postal_code",{required:$,validate:e=>(e=>"CA"===E?/^(?!.*[DFIOQU])[A-VXY][0-9][A-Z] ?[0-9][A-Z][0-9]$/.test(e)||"Invalid postal code":"US"===E?/^\d{5}$|^\d{5}-\d{4}$/.test(e)||"Invalid zip code":""!==e||"Invalid zip/postal code")(e)}),disabled:!!j,id:"billing_address.postal_code",placeholder:O,error:!!k.formState.errors.billing_address?.postal_code?.message})}),(0,r.jsx)(R.D0,{label:"Country",required:!0,error:k.formState.errors.billing_address?.country?.message,id:"billing_address.country",children:(0,r.jsxs)(R.l6,{...k.register("billing_address.country",{required:"Country is required"}),disabled:!!j,id:"billing_address.country",error:!!k.formState.errors.billing_address?.country?.message,children:[(0,r.jsx)("option",{value:"",children:"Country"}),y.gk.map(e=>(0,r.jsx)("option",{value:e.value,children:e.label},e.value))]})})]})]})]}),(0,r.jsx)("div",{className:"hidden md:block",children:(0,r.jsx)(eT,{className:"md:sticky top-4"})})]})})})})});var eI=a(18197),eD=a.n(eI);
1let eq=({className:e="",showDetails:t=!0})=>{let{summaryData:a,bookingState:i,isPackageMode:l,getSelectedAirportInfo:n,selectedDeparture:d,getPriceByIdAsObjectPrice:c,isPriceActive:m,globalSettings:u}=(0,o.useTourBooking)(),p=n(),g=$({isWaitlistMode:!1,isFullPaymentDue:a.isFullPaymentDue,settings:u}),{hotelNightsTotal:h,hotelNightsPerPerson:b,addOnDetails:f}=s.useMemo(()=>{let e=a.guests,t=a.isSingleOwnRoom,r=i.prices||[];if(!d?.ts_metadata?.prices||0===r.length)return{hotelNightsTotal:0,hotelNightsPerPerson:0,addOnDetails:[]};let s=[],n=d.ts_metadata.prices,o=l?A.db.TOUR_PLUS_TRAVEL_PACKAGE:A.db.TOUR,u=n.find(e=>(0,A.uA)(e)===o&&(0,A.qt)(e,m)),p=u?.ts_metadata?.id||u?.id;p&&s.push(p),(u?.ts_metadata?.upgrades||[]).forEach(e=>{let t=e.ts_metadata?.id||e.id;t&&s.push(t)});let g=r.filter(e=>!s.includes(e)),h=0,b=0,f=[];for(let a of g){let r=c(a);if(!r)continue;let s=r.ts_metadata,i=(0,A.uA)(r);if(l&&p&&s?.included_in_price===p)continue;let n=(0,T.i)(s?.price_amount)+(t?(0,T.i)(s?.single_supplement?.price_amount):0),o=n*e;if(A.Sx.EXTRA_EXPERIENCES.includes(i)){let e="string"==typeof s?.name?s.name:"Add-on",t="string"==typeof s?.price_unit?s.price_unit:"per person";f.push({name:e,amount:o,perPersonAmount:n,priceUnit:t})}else A.Sx.HOTELS.includes(i)&&(h+=o,b+=n)}return{hotelNightsTotal:h,hotelNightsPerPerson:b,addOnDetails:f}},[a.guests,a.isSingleOwnRoom,i.prices,d,l,c,m]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:`tb-section my-10 md:my-12 ${e}`,children:[(0,r.jsx)("div",{className:"tb-subsection-heading mb-0 pb-6",children:(0,r.jsx)("div",{className:"flex gap-2 items-end",children:(0,r.jsx)("div",{className:"heading-4",children:"Tour Summary"})})}),(0,r.jsxs)("div",{className:"tb-subsection type-body mb-0 p-7",children:[(0,r.jsx)("span",{className:"font-bold",children:l?u?.customizePackageModeHeading||"Tour + Travel Package":u?.tourTypeSelectorStandardTourLabel||"Tour"}),(0,r.jsxs)("span",{children:["$",(0,P.$g)({amount:a.roomPerPerson*a.guests})]})]}),t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"tb-subsection type-body mb-0 p-7",children:[(0,r.jsx)("span",{className:"font-bold",children:u?.tourSummaryNumberOfGuestsLabel||"Number of guests"}),(0,r.jsx)("span",{children:a.guests})]}),(0,r.jsxs)("div",{className:"tb-subsection type-body mb-0 p-7",children:[(0,r.jsx)("span",{className:"font-bold",children:u?.tourSummaryNumberOfBedsLabel||"Number of beds"}),(0,r.jsx)("span",{children:1===i.number_of_beds?u?.customizeBedOptionOneLabel||"One Shared Bed":u?.customizeBedOptionTwoLabel||"Two Separate Beds"})]}),l&&p&&(0,r.jsxs)("div",{className:"tb-subsection type-body mb-0 p-7",children:[(0,r.jsx)("span",{className:"font-bold",children:u?.customizeFlightsLabel||"Flights"}),(0,r.jsxs)("span",{children:["From ",p.name," (",p.code,")"]})]}),f.length>0&&f.map((e,t)=>(0,r.jsxs)("div",{className:"tb-subsection type-body mb-0 p-7",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("div",{className:"font-bold mb-1",children:u?.customizeExtraExperiencesLabel||"Extra Experience(s)"}),(0,r.jsx)("div",{children:e.name})]}),(0,r.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,r.jsxs)("div",{children:["$",(0,P.$g)({amount:e.amount})]}),a.guests>1&&(0,r.jsxs)("div",{className:"type-caption mt-1",children:["($",(0,P.$g)({amount:e.perPersonAmount})," ",e.priceUnit,")"]})]})]},`addon-${t}`)),h>0&&(0,r.jsxs)("div",{className:"tb-subsection type-body mb-0 p-7",children:[(0,r.jsx)("span",{className:"font-bold",children:u?.customizeExtraHotelNightsLabel||"Extra Hotel Night(s)"}),(0,r.jsxs)("div",{className:"flex flex-col items-end gap-1",children:[(0,r.jsxs)("div",{children:["$",(0,P.$g)({amount:h})]}),a.guests>1&&b>0&&(0,r.jsxs)("div",{className:"type-caption",children:["($",(0,P.$g)({amount:b})," per person)"]})]})]})]}),(0,r.jsxs)("div",{className:"tb-subsection mb-0 p-7",children:[(0,r.jsx)("span",{className:"heading-4",children:a.totalLabel}),(0,r.jsxs)("span",{className:"heading-4",children:["$",(0,P.$g)({amount:a.grandTotal})]})]}),(0,r.jsxs)("div",{className:"bg-pollen tb-subsection mb-0 p-7",children:[(0,r.jsx)("span",{className:"heading-4",children:g}),(0,r.jsxs)("span",{className:"heading-4",children:["$",(0,P.$g)({amount:a.amountDueToday})]})]})]}),u?.tourSummaryTermsAndConditions&&(0,r.jsx)(eN.A,{...u.tourSummaryTermsAndConditions,marginTop:"none",marginBottom:"none",className:"type-fine-print max-w-[var(--container-small-max-width)]"})]})};var eB=a(86710);let eM=()=>{let{globalSettings:e,tourData:t,bookingState:a}=(0,o.useTourBooking)(),i=(0,s.useRef)(null);(0,T.uV)({containerRef:i});let l=a?.trip_building_select,n=a?.departure,d=(()=>{let e=new URLSearchParams;l&&e.set("mode",l),n&&e.set("departureID",n);let t=e.toString();return`${window.location.origin}${window.location.pathname}${t?`?${t}`:""}#tab:itinerary`})(),c=e?.saveForLaterViewCartCta,m=(0,eB.k)(c),u=c?.label||"View My Cart",h=e?.saveForLaterShareEnabled!==!1;return(0,r.jsxs)("div",{ref:i,children:[(0,r.jsxs)("div",{className:"mb-8 max-w-[var(--container-small-max-width)]",children:[(0,r.jsx)("div",{className:"heading-3 italic mb-6",children:e?.
1saveForLaterHeading||"Your tour is saved in your cart."}),(0,r.jsx)("p",{className:"type-paragraph mb-8",children:e?.saveForLaterDescription||"You can view the tour in your cart, share the tour with a friend, and resume booking it at any time. But don't wait too long, space is limited and it may sell out!"}),(0,r.jsx)("div",{className:"flex flex-wrap gap-4",children:(0,r.jsx)(I.A,{labelClassName:"type-button",iconBeforeClassName:"mr-2",slotFirstButton:(0,r.jsx)(p.A,{as:eD(),href:m,variant:"secondary",className:"type-button",iconBefore:(0,r.jsx)(g.A,{name:"cart",width:"24px",height:"24px",className:"mr-2"}),target:c?.target||"_self",children:u}),variant:"secondary",globalSettings:e,url:d,title:t?.ts_metadata?.name||"",shareButtonLabelOverride:e?.saveForLaterShareLabel||void 0,downloadDisabled:!0,printDisabled:!0,favoriteDisabled:!0,shareDisabled:!h})})]}),(0,r.jsx)(eq,{showDetails:!0})]})};var eU=a(95681),ez=a(29436),eV=a(1044);let eQ=()=>{let{globalSettings:e,tourData:t,selectedDeparture:a,isWaitlistMode:i,isOnRequest:l,bookingState:n,summaryData:d}=(0,o.useTourBooking)(),c=(0,s.useRef)(null),m=(0,v.U)(y.HP.md);(0,T.uV)({containerRef:c});let u=i?"waitlist":l?"onRequest":"success";(0,s.useEffect)(()=>{let e=(t?.ts_metadata?.destinations??[]).find(e=>e.ts_metadata?.primary_destination===!0),r=e?.ts_metadata?.destination?.name??null;window?.dataLayer?.push({event:"BookingFormSubmitted",tourName:t?.ts_metadata?.name??null,destination:r,tourType:n.trip_building_select,departureDate:a?.ts_metadata?.tour_only_departure_date??null,numberOfGuests:n.number_of_guests,numberOfBeds:n.number_of_beds,roomingPreference:n.rooming_preference??null,flightPreference:n.flight_preference??null,totalPrice:d?.grandTotal??null,depositAmount:d?.amountDueToday??null,confirmationStatus:u})},[]);let p=function(e){switch(e){case"waitlist":return"waitlist";case"onRequest":return"onRequest";default:return"success"}}(u),g=function(e,t){switch(e){case"waitlist":return t?.confirmationWaitlistHeading||"You're added to the waitlist.";case"onRequest":return t?.confirmationOnRequestHeading||"Your booking is on request";default:return t?.confirmationHeading||"Booking Confirmed!"}}(u,e),h=function(e,t){switch(e){case"waitlist":return t?.confirmationWaitlistMessage||"We'll contact you if space opens up.";case"onRequest":return t?.confirmationOnRequestMessage||"We're confirming your booking.";default:return t?.confirmationMessage||"Thank you for your booking. You will receive a confirmation email shortly."}}(u,e),b=a?.ts_metadata?.final_payment_date,f={date:(0,k.gl)(b)??""},x="waitlist"===u?e?.confirmationWaitlistPageBuilder:e?.confirmationPageBuilder,_=()=>(0,r.jsx)("div",{className:"booking-summary-container mt-10 md:mt-0",children:(0,r.jsx)(eT,{showPriceBreakdown:!0,showPromoCode:!1,showRemainingBalance:!0,isConfirmation:!0,className:"md:sticky md:top-4"})});return(0,r.jsxs)("div",{ref:c,children:[(0,r.jsx)("div",{children:(0,r.jsx)(D,{heading:g,description:h,style:p})}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-[3.11fr_2fr] gap-10 md:gap-12 print:grid-cols-1 print:gap-10",children:[(0,r.jsxs)("div",{className:"mb-8 print:mb-0!",children:[(0,r.jsx)("div",{className:"tour-booking-confirmation-image print:hidden",children:(0,r.jsx)(eU.A,{marginBottom:"none",marginTop:"none",size:"full-width",asset:{image:{...t?.highlightImage}},aspectRatio:"16-9"})}),!m&&_(),(0,r.jsx)("div",{className:"tour-booking-confirmation-content",children:x?.map((e,t)=>(0,r.jsx)("div",{children:e.items?.map((e,t)=>((e,t)=>"inlineHeading"===e._type?(0,r.jsx)(ez.A,{...e,marginTop:"sm",marginBottom:4,className:"p-0!"},`${e._type}-${t}`):"textBlock"===e._type?(0,r.jsx)(eN.A,{...e,stringReplacements:f,marginTop:"none",marginBottom:"mb-8 md:mb-10 p-0! print:mb-0!"},`${e._type}-${t}`):null)(e,t))},e._key||t))})]}),m&&_()]}),e?.confirmationCtaBanner&&((e.confirmationCtaBanner.heading?.text?.length??0)>0||(e.confirmationCtaBanner.ctas?.length??0)>0)&&(0,r.jsx)("div",{className:"mt-10 print:hidden",children:(0,r.jsx)(eV.A,{...e.confirmationCtaBanner,marginTop:"none",marginBottom:"none"})})]})};var eH=a(33788);let eG=()=>{let{globalSettings:e,tourData:t}=(0,o.useTourBooking)(),a=(0,s.useRef)(null);(0,T.uV)({containerRef:a});let i=e?.bookingDisabledPageBuilder,l={_id:"booking-disabled",_type:"booking-disabled",pageBuilder:i};return(0,r.jsxs)("div",{ref:a,className:"tour-booking-disabled",children:[i?.map((a,s)=>(0,r.jsx)("div",{children:a.items?.map((a,s)=>(0,r.jsx)(eH.A,{index:s,block:a,page:l,globalSettings:e,fullPage:t},a._key||`block-${s}`))},a._key||`container-${s}`)),(!i||0===i.length)&&(0,r.jsx)("div",{className:"text-center py-12",children:(0,r.jsx)("p",{className:"type-paragraph text-cool-granite-3",children:"Booking is currently unavailable. Please check back later."})})]})},eY=({className:e="heading-4"})=>{let{bookingState:t,isPackageMode:a,getDepartureById:i,selectedDeparture:l,getPriceByIdAsObjectPrice:n,accommodations:d,globalSettings:c}=(0,o.useTourBooking)(),m=(0,s.useMemo)(()=>{let e=t.departure?i(t.departure):null,r=e?.ts_metadata;if(!r)return(0,T.gP)(void 0,void 0);let s=l?(0,T.wR)(l):[],o=(0,T.Y$)(t.prices||[],s,n),{startDateStr:c,endDateStr:m}=(0,T.JJ)(r,a,o,l||void 0,d);return(0,T.gP)(c,m)},[t.departure,t.prices,i,l,a,n,d]),u=c?.bookingDateRangeSubtext||"";return(0,r.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,r.jsx)("div",{className:e,children:m}),(0,r.jsx)("span",{className:"type-fine-print",children:u})]})}
1,eW=({onStartOver:e,hideStartOver:t=!1})=>{let{startOver:a,globalSettings:s}=(0,o.useTourBooking)();return(0,r.jsxs)("div",{className:"mb-0 md:mb-8 flex flex-col md:flex-row md:items-center justify-between gap-5 md:gap-0",children:[(0,r.jsx)(eY,{}),!t&&(0,r.jsx)(p.A,{type:"button",variant:"text-link",onClick:()=>{e?e():a()},iconBefore:(0,r.jsx)(g.A,{name:"start-over"}),children:s?.customizeStartOverLabel||"Start over"})]})};function eX(){let{tourData:e,applyCustomize:t,applyGuests:a,closeBookingModal:l,globalSettings:b,bookingError:f,clearBookingError:x,resumeBooking:_,isLoadingBooking:v,bookingState:y,openBookingModal:j,failedBookingIds:N,updateUrlStep:S,isBookingModalOpen:T,submitBooking:A,bookingCompleted:k,markStepCompleted:L,isPackageMode:C,isWaitlistMode:E,isVerifyingDeparture:P,verifySelectedDepartureStatus:R,departureStatuses:O,startLoading:$,stopLoading:F,startOver:I,saveStateBeforeAuth:q,pendingModalConfig:B,clearPendingModalConfig:U,openSelectDepartureCity:z,fetchTravelerCredits:V}=(0,o.useTourBooking)(),Q=(0,i.useRouter)(),H=(0,i.usePathname)(),G=e?.ts_metadata?.departures,Y=(0,n.n4)(G),W=!!Y,X=(0,d.ge)(),Z=X?.isAuthenticated??!1,J=X?.isAuthLoading??!0,ee=X?.refreshCart,{disableCart:et}=X??{disableCart:!1},ea=c("6Lfu7LYrAAAAAOxmqcqfbO-9g0YPb1ozGdf_LFPT"),[er,es]=(0,s.useState)(M.Q3.DATES),[ei,el]=(0,s.useState)(!1),[en,eo]=(0,s.useState)(null),ed=(0,s.useRef)(!1),ec=(0,s.useRef)(null),em=(0,s.useRef)(!1),[eu,ep]=(0,s.use
1State)(!1),[eg,eh]=(0,s.useState)(null),eb=(0,s.useMemo)(()=>{if(!y.departure)return!1;let e=O.get(y.departure);if(!e||e.stop_sell_flag)return!1;let t=(0,M.rv)(b),a=G?.find(e=>e.ts_metadata?.id===y.departure),r=(0,ex.y)(e,C,t,!0,a?.ts_metadata?.groups),s=("waitlist"===r.displayStatus||"privateGroup"===r.displayStatus)&&!y.filter_show_sold_out&&!(0,e_.RH)(Y,y.number_of_guests);return r.isSelectable&&!s},[G,y.departure,O,C,b,y.filter_show_sold_out,y.number_of_guests,Y]);(0,s.useEffect)(()=>{er!==M.Q3.CUSTOMIZE&&en&&eo(null)},[er,en]),(0,s.useEffect)(()=>{er===M.Q3.CUSTOMIZE&&en&&y.selected_airport&&eo(null)},[er,en,y.selected_airport]),(0,s.useEffect)(()=>{b?.disableBookingFlow||er===M.Q3.CUSTOMIZE&&C&&!y.selected_airport&&(m.v.log("Package mode without airport - opening airport selector as required"),z(!0))},[er,C,y.selected_airport,z,b?.disableBookingFlow]),(0,s.useEffect)(()=>{f&&ek.current&&ek.current.scrollIntoView({behavior:"smooth",block:"start"})},[f]);let ef=(0,s.useCallback)(e=>{let{departure:t,number_of_guests:a,rooming_preference:r,travel_companion_name:s,number_of_beds:i,selected_airport:l,customer:n,travelers:o}=y;switch(e){case M.Q3.DATES:return!0;case M.Q3.CUSTOMIZE:if(!t)return!1;let d=O.get(t);if(!d||d.stop_sell_flag||C&&!l)return!1;return!0;case M.Q3.GUESTS:{if(!t)return!1;let e=O.get(t);if(!e||e.stop_sell_flag||C&&!l)return!1;if(1===a){if(!r||"share"===r&&(!s||!i))return!1}else if(a>1&&!i)return!1;return!0}case M.Q3.PAYMENT:{if(E||!t)return!1;let e=O.get(t);if(!e||e.stop_sell_flag||!n.first_name||!n.last_name||!n.email||!n.phone||!n.date_of_birth)return!1;let r=a-1;if(r>0){if(o.length<r)return!1;for(let e=0;e<r;e++){let t=o[e];if(!t||!t.first_name||!t.last_name||!t.email||!t.phone||!t.date_of_birth)return!1}}return!0}case M.Q3.SAVE_FOR_LATER:if(!t)return!1;let c=O.get(t);if(!c||c.stop_sell_flag||C&&!l)return!1;if(1===a){if(!r||"share"===r&&(!s||!i))return!1}else if(a>1&&!i)return!1;return!0;case M.Q3.CONFIRMATION:return!0===k;default:return!1}},[y,C,E,k,O]),ev=(0,s.useCallback)(e=>{let t=y.completedSteps||new Set;switch(e){case M.Q3.DATES:return!0;case M.Q3.CUSTOMIZE:if(t.has("dates")){if(!y.departure)return!1;return!0}if(t.size>0&&!t.has("dates"))return!1;return ef(e);case M.Q3.SAVE_FOR_LATER:if(t.has("customize")){if(!y.departure)return!1;return!0}if(t.size>0&&!t.has("customize"))return!1;return ef(e);case M.Q3.GUESTS:if(!Z)return!1;if(t.has("customize")){if(!y.departure)return!1;return!0}if(t.size>0&&!t.has("dates")&&!t.has("customize"))return!1;return ef(e);case M.Q3.PAYMENT:if(!Z||E)return!1;if(t.has("guests")){if(!y.departure||!y.number_of_guests)return!1;return!0}if(t.size>0&&!t.has("dates")&&!t.has("customize")&&!t.has("guests"))return!1;return ef(e);case M.Q3.CONFIRMATION:return!0===k;default:return!1}},[y.completedSteps,y.departure,y.number_of_guests,E,k,ef,Z]),ej=(0,s.useCallback)(()=>{let e=[M.Q3.DATES,M.Q3.CUSTOMIZE,M.Q3.GUESTS,M.Q3.PAYMENT,M.Q3.CONFIRMATION];for(let t=e.length-1;t>=0;t--)if(ev(e[t]))return e[t];return M.Q3.DATES},[ev]);(0,s.useEffect)(()=>{if(!T||!B)return;let e=B.targetStep,t=e===M.Q3.GUESTS||e===M.Q3.PAYMENT;if(t&&J)return void m.v.log("Pending modal config: waiting for auth to load (requestedStep =",e,")");if(m.v.log("Applying pending modal config:",B),B.markCompleted&&B.markCompleted.forEach(e=>{L(e)}),e){if(B.submitSaveForLater&&e===M.Q3.SAVE_FOR_LATER){if(em.current)return;em.current=!0,es(M.Q3.CUSTOMIZE),F(),(async()=>{let e=async()=>{let e;for(let t=0;t<10;t++)try{return await ea("save_for_later")}catch(a){e=a,t<9&&await new Promise(e=>setTimeout(e,1e3))}throw e};try{let t=await e();(await A(t,void 0,!0)).success?(ep(!0),es(M.Q3.SAVE_FOR_LATER)):(m.v.error("Save For Later: Draft save failed after auth redirect"),x(),eh(b?.saveForLaterErrorLabel||"Problem saving tour to cart. Please try again."),setTimeout(()=>{eL.current?.scrollIntoView({behavior:"smooth",block:"center"})},100))}catch(e){m.v.error("[Post-Auth] Draft save error:",e),x(),eh(b?.saveForLaterErrorLabel||"Problem saving tour to cart. Please try again."),setTimeout(()=>{eL.current?.scrollIntoView({behavior:"smooth",block:"center"})},100)}finally{U()}})();return}let a=!t||Z?e:ej();m.v.log("Pending modal navigation: requested =",e,", actual =",a,", requiresAuth =",t,", isAuthenticated =",Z,", isAuthLoading =",J),es(a)}U(),F()},[T,B,L,U,F,Z,J,ej,ea,A,x,b]),(0,s.useEffect)(()=>{eu&&Z&&ee&&(ep(!1),ee())},[eu,Z,ee]),(0,s.useEffect)(()=>
1{if(m.v.log("URL Update Effect: currentStep =",er,", fromBrowserNav =",ed.current,", pendingModalConfig =",B?"set":"null"),!eE.current){let e=window.location.hash.replace("#","");if(new URL(window.location.href).searchParams.get("bookingID")&&M.dm.includes(e))return void m.v.log("URL Update Effect: Skipping (preserving valid step hash during deep link)")}if(ed.current){m.v.log("URL Update Effect: Skipping (browser navigation)"),ed.current=!1;return}if(B)return void m.v.log("URL Update Effect: Skipping (pendingModalConfig is set)");ec.current=er,m.v.log("URL Update Effect: Updating URL to",er),S(er);let e=setTimeout(()=>{m.v.log("URL Update Effect: Clearing pending step change"),ec.current=null},100);return()=>clearTimeout(e)},[er,S,B]),(0,s.useEffect)(()=>{let e=()=>{let e=window.location.hash.replace("#","");if(m.v.log("Hash Navigation: hash =",e,", currentStep =",er,", pendingStep =",ec.current,", bookingCompleted =",k),!eE.current&&new URL(window.location.href).searchParams.get("bookingID"))return void m.v.log("Hash Navigation: Deferring to deep link handler (bookingID pending)");if(k&&e!==M.Q3.CONFIRMATION&&T){m.v.log("Booking completed, closing modal and redirecting to tour page (attempted to navigate to:",e||"no hash",")"),l(!0),Q.push(H);return}if(ec.current)return void m.v.log("Hash Navigation: Ignoring (pending manual change to",ec.current,")");if(B)return void m.v.log("Hash Navigation: Deferring to pendingModalConfig");if(e&&M.dm.includes(e)){let t=ev(e);if(m.v.log("Hash Navigation: Checking access to",e,", canAccess =",t,", completedSteps =",Array.from(y.completedSteps||[]),", departure =",y.departure),!t){let t=ej();m.v.log("Hash Navigation: Cannot access step",e,"- redirecting to",t),ed.current=!0,es(t),S(t);return}T||(m.v.log("Hash Navigation: Opening modal"),j()),e!==er&&(m.v.log("Hash Navigation: Setting step from",er,"to",e),ed.current=!0,es(e))}else e||!T||ec.current||(m.v.log("Hash Navigation: Closing modal (no hash)"),l(!0))};return window.addEventListener("hashchange",e),window.addEventListener("popstate",e),e(),()=>{window.removeEventListener("hashchange",e),window.removeEventListener("popstate",e)}},[er,T,l,j,k,Q,H,y.completedSteps,y.departure,ev,ej,S,B]);let eN=(0,s.useRef)(null),ew=(0,s.useRef)(null),eS=(0,s.useRef)(null),eT=(0,s.useRef)(null),eA=(0,s.useRef)(null),ek=(0,s.useRef)(null),eL=(0,s.useRef)(null),eC=(0,s.useRef)(new Set),eE=(0,s.useRef)(!1);(0,s.useEffect)(()=>{if(!Z)return;if(window.localStorage.getItem("auth-return"))return void m.v.log("Auth return detected, deferring to Context for state restoration");let e=(0,u.RY)().filter(e=>"booking"===e.type);if(e.length>0){let t=e[0];if("continue"===t.payload.action&&t.payload.step){let e=t.payload.step;if(e===M.Q3.SAVE_FOR_LATER)return void m.v.log("Save For Later action detected, deferring to pendingModalConfig effect");let a=ev(e)?e:ej();m.v.log("Returning from login: requested step =",e,", actual step =",a),es(a)}(0,u.OX)("booking")}},[Z,ev,ej]),(0,s.useEffect)(()=>{if(m.v.log("Deep linking effect running"),eE.current)return;let e=new URL(window.location.href),t=e.searchParams.get("bookingID"),a=e.searchParams.get("departureID"),r=e.searchParams.get("mode"),s=e.searchParams.get("airport"),i=window.location.hash.replace("#","");if(i&&M.dm.includes(i)&&!t&&!a){eE.current=!0;return}if(t){if(J)return;if(!Z)return void(0,u.Gr)({type:"booking",payload:{action:"continue",step:i||"guests"}},window.location.href);if(v)return;if(m.v.log("Booking ID from state:",y.booking_id),m.v.log("Booking ID from URL:",t),m.v.log("Failed booking IDs:",N),m.v.log("Attempted booking IDs:",eC.current),m.v.log("Is loading booking:",v),y.booking_id!==t){if(N.has(t)){eE.current=!0,es("dates");return}if(eC.current.has(t))return;eC.current.add(t),_(t,{modeHint:"tour_plus_travel_package"===r||"tour"===r?r
1:void 0}).then(e=>{eE.current=!0,e.success?(m.v.log("Resume successful, opening at step:",e.targetStep),j(e.targetStep)):es(M.Q3.DATES)}).catch(()=>{eE.current=!0,es(M.Q3.DATES)});return}eE.current=!0;let e=ej();return m.v.log("Booking already loaded, going to furthest accessible step:",e),j(),void es(e)}if(a&&r&&s){eE.current=!0,j(),es(M.Q3.CUSTOMIZE);return}if(a){eE.current=!0,j(),es(M.Q3.DATES);return}if(r){eE.current=!0;return}eE.current=!0},[Z,J,y.booking_id,j,_,N,v,ej]);let eP=async()=>{eh(null),m.v.log("Save For Later: Starting");let e=await ew.current?.submitAndGetValues();if(m.v.log("Save For Later: Form values:",e),!e)return void m.v.log("Save For Later: No values, returning");if(m.v.log("Save For Later: Applying customize"),t({number_of_guests:e.number_of_guests,number_of_beds:e.number_of_beds,rooming_preference:e.rooming_preference,travel_companion_name:e.travel_companion_name,flight_preference:e.flight_preference,selected_airport:e.selected_airport}),!Z){m.v.log("Save For Later: Not authenticated, redirecting"),q(M.Q3.SAVE_FOR_LATER,["customize"],{number_of_guests:e.number_of_guests,number_of_beds:e.number_of_beds,rooming_preference:e.rooming_preference,travel_companion_name:e.travel_companion_name,flight_preference:e.flight_preference,selected_airport:e.selected_airport}),(0,u.Gr)({type:"booking",payload:{action:"continue",step:M.Q3.SAVE_FOR_LATER}},window.location.href);return}try{m.v.log("Save For Later: Creating/updating draft booking");let e=await ea("save_for_later");(await A(e,void 0,!0)).success?(ee?.(),m.v.log("Save For Later: Draft saved, going to save-for-later screen"),L("customize"),es(M.Q3.SAVE_FOR_LATER)):(m.v.error("Save For Later: Draft save failed"),x(),eh(b?.saveForLaterErrorLabel||"Problem saving tour to cart. Please try again."))}catch(e){m.v.error("Failed to save booking:",e),x(),eh(b?.saveForLaterErrorLabel||"Problem saving tour to cart. Please try again.")}},eR=async()=>{if(el(!0),er===M.Q3.DATES){if($("navigating"),!await eN.current?.submitAndValidate()){el(!1),F();return}if(y.departure){let e=await R(y.departure);if(e.shouldClearSelection){m.v.warn("Cannot proceed: Selected departure is no longer available"),el(!1),F();return}if(e.removedPrices||e.clearedAirport){let t=[];e.removedPrices&&e.removedPrices.length>0&&t.push(`${e.removedPrices.length} selected option${e.removedPrices.length>1?"s":""} ${e.removedPrices.length>1?"are":"is"} no longer available and ${e.removedPrices.length>1?"have":"has"} been removed`),e.clearedAirport&&t.push("Your selected airport is no longer available and has been cleared"),eo(t.join(". ")+".")}}L("dates"),ec.current=M.Q3.CUSTOMIZE,es(M.Q3.CUSTOMIZE),el(!1),F()}else if(er===M.Q3.SAVE_FOR_LATER)$("navigating"),ec.current=M.Q3.GUESTS,es(M.Q3.GUESTS),el(!1),F();else if(er===M.Q3.CUSTOMIZE){m.v.log("Customize -> Guests: Starting"),$("navigating");let e=await ew.current?.submitAndGetValues();if(m.v.log("Customize -> Guests: Form values:",e),!e){m.v.log("Customize -> Guests: No values, returning"),el(!1),F();return}if(!Z){m.v.log("Customize -> Guests: Not authenticated, redirecting"),$("pre-auth"),q("guests",["customize"],{number_of_guests:e.number_of_guests,number_of_beds:e.number_of_beds,rooming_preference:e.rooming_preference,travel_companion_name:e.travel_companion_name,flight_preference:e.flight_preference,selected_airport:e.selected_airport,travelers:e.number_of_guests>1?[{}]:[],prices:e.room_type?[e.room_type,...(y.prices||[]).filter(t=>t!==e.room_type)]:y.prices}),(0,u.Gr)({type:"booking",payload:{action:"continue",step:"guests"}},(()=>{let e=new URL(window.location.href);e.searchParams.set("isAuth","true");let t=e.href;return m.v.log("Original URL:",window.location.href),m.v.log("Modified Return URL:",t),t})());return}m.v.log("Customize -> Guests: Applying customize"),t({number_of_guests:e.number_of_guests,number_of_beds:e.number_of_beds,rooming_preference:e.rooming_preference,travel_companion_name:e.travel_companion_name,flight_preference:e.flight_preference,selected_airport:e.selected_airport}),L("customize");try{m.v.log("Customize -> Guests: Creating draft booking");let t=await ea("submit_customize");(await A(t,void 0,!0,void 0,{number_of_guests:e.number_of_guests,rooming_preference:e.rooming_preference,travel_companion_name:e.travel_companion_name})).success&&(ee?.(),m.v.log("Customize -> Guests: Draft booking created, proceeding to guests")),es(M.Q3.GUESTS),el(!1),F()}catch(e){es(M.Q3.GUESTS),el(!1),F(),m.v.error("Failed to create draft booking:",e)}}else if(er===M.Q3.GUESTS){$("navigating");let e=await eS.current?.submitAndGetValues();if(!e){el(!1),F();return}if(!Z){el(!1);let t=E?"confirmation":"payment";q(t,["guests"],{customer:e.customer,travelers:e.travelers,activity_level_consent:e.activity_level_consent,trip_terms_consent:e.trip_terms_consent}),(0,u.Gr)({type:"booking",payload:{action:"continue",step:t}},window.location.href);return}if(a({customer:e.customer,travelers:e.travelers,activity_level_consent:e.activity_level_consent,trip_terms_consent:e.trip_terms_consent}),L("guests"),E)try{let t=await ea("join_waitlist");(await A(t,e,!1)).success&&(ee?.(),es(M.Q3.CONFIRMATION)),el(!1),F()}catch(e){el(!1),F(),m.v.error("Failed to join waitlist:",e)}else try{let t=await ea("submit_guest_information");if((await A(t,e,!0)).success){ee?.();try{let t=await ea("fetch_traveler_credits");await V(t,e)}catch(e){m.v.error("Failed to fetch traveler credits:",e)}es(M.Q3.PAYMENT),el(!1),F()}else el(!1),F()}catch(e){el(!1),F(),m.v.error("Failed to submit guest information:",e)}}else if(er===M.Q3.PAYMENT){if(E){m.v.warn("Payment step accessed in waitlist mode, redirecting to confirmation"),$("submitting"),es(M.Q3.CONFIRMATION),el(!1),F();return}$("submitting");let e=await eT.current?.submitAndGetValues();if(!e){el(!1),F();return}try{let t=await ea("complete_booking");(await A(t,void 0,!1,e)).success?(ee?.(),el(!1),F(),L("payment"),es(M.Q3.CONFIRMATION)):(el(!1),F())}catch(e){el(!1),F(),m.v.error("Failed to complete booking:",e)}}},eO=()=>{I(),es(M.Q3.DATES)};return e?b?.disableBookingFlow===!0?(0,r.jsxs)("div",{className:"tour-booking-container",children:[(0,r.jsx)("div",{className:"flex-1",children:(0,r.jsx)(eG,{})}),(0,r.jsx)("div",{className:"flex flex-col md:flex-row items-center justify-center mt-14 md:mt-24",children:(0,r.jsx)(p.A,{type:"button",variant:"secondary",iconBefore:(0,r.jsx)(g.A,{name:"close"}),onClick:()=>l(!1),className:"w-full md:w-auto",children:b?.bookingCloseButtonLabel||"Close"})})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"tour-booking-container",children:[(0,r.jsxs)("div",{className:"flex-1",children:[er!==M.Q3.CONFIRMATION&&(0,r.jsx)("div",{className:"mb-8",children:(0,r.jsx)(h,{currentStep:er===M.Q3.SAVE_FOR_LATER?M.Q3.CUSTOMIZE:er})}),f&&(0,r.jsx)("div",{ref:ek,children:(0,r.jsx)(D,{heading:f,description:b?.bookingCallToContinueBooking||"Please call 800-245-3868 to continue booking.",style:"warning",disablePageActions:!0})}),en&&(0,r.jsx)(D,{heading:b?.bookingAvailabilityUpdateHeading||"Availability Update",description:en,style:"warning",disablePageActions:!0}),(0,r.jsx)("div",{className:"mb-4.5 md:mb-3.5",children:(0,r.jsx)(w,{showImage:er!==M.Q3.CONFIRMATION})}),(er===M.Q3.CUSTOMIZE||er===M.Q3.GUESTS||er===M.Q3.PAYMENT||er===M.Q3.SAVE_FOR_LATER||er===M.Q3.CONFIRMATION)&&(0,r.jsx)("div",{className:"my-4.5 mb-6 md:my-3.5",children:(0,r.jsx)(eW,{onStartOver:eO,hideStartOver:er===M.Q3.CONFIRMATION||W})}),(0,r.jsxs)("div",{className:"my-4.5 md:my-3.5 transform-gpu",id:"stepContent",ref:eA,tabIndex:-1,
1children:[er===M.Q3.DATES&&(0,r.jsx)(ey,{ref:eN}),er===M.Q3.CUSTOMIZE&&(0,r.jsx)(K,{ref:ew,onSubmitValid:e=>t({number_of_guests:e.number_of_guests,number_of_beds:e.number_of_beds,rooming_preference:e.rooming_preference,travel_companion_name:e.travel_companion_name,flight_preference:e.flight_preference,selected_airport:e.selected_airport}),onStartOver:eO}),er===M.Q3.SAVE_FOR_LATER&&(0,r.jsx)(eM,{}),er===M.Q3.GUESTS&&(0,r.jsx)(e$,{ref:eS,onSubmitValid:()=>es(M.Q3.PAYMENT)}),er===M.Q3.PAYMENT&&!E&&(0,r.jsx)(eF,{ref:eT}),er===M.Q3.CONFIRMATION&&(0,r.jsx)(eQ,{})]},er)]}),(0,r.jsxs)("div",{className:"flex flex-col md:flex-row items-center justify-between mt-14 md:mt-24 transform-gpu",children:[er!==M.Q3.CONFIRMATION&&(0,r.jsxs)(r.Fragment,{children:[er!==M.Q3.SAVE_FOR_LATER&&(0,r.jsxs)("div",{className:"flex flex-col md:flex-row gap-4 md:gap-2 w-full md:w-auto order-2 md:order-0",children:[er===M.Q3.DATES&&(0,r.jsx)(p.A,{type:"button",variant:"secondary",iconBefore:(0,r.jsx)(g.A,{name:"close"}),onClick:()=>l(!1),className:"w-full md:w-auto",children:b?.bookingCloseButtonLabel||"Close"}),er!==M.Q3.DATES&&(0,r.jsxs)(p.A,{type:"button",variant:"secondary",onClick:()=>{x(),er===M.Q3.CUSTOMIZE?es(M.Q3.DATES):er===M.Q3.GUESTS?es(M.Q3.CUSTOMIZE):er===M.Q3.PAYMENT&&(E&&m.v.warn("Back button on payment step in waitlist mode, going to guests"),es(M.Q3.GUESTS))},iconBefore:(0,r.jsx)(g.A,{name:"arrow-left"}),className:"w-full md:w-auto",children:[er===M.Q3.CUSTOMIZE&&(b?.bookingBackFromCustomizeLabel||"Back: Dates & Pricing"),er===M.Q3.GUESTS&&(b?.bookingBackFromGuestsLabel||"Back: Customize Tour Options"),er===M.Q3.PAYMENT&&(b?.bookingBackFromPaymentLabel||"Back: Guest Information")]})]}),!et&&er===M.Q3.CUSTOMIZE&&(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 w-full md:w-auto order-1 md:order-1",children:[(0,r.jsx)("div",{className:"flex flex-col md:flex-row gap-4 md:gap-2",children:(0,r.jsx)(p.A,{type:"button",variant:"text-link",onClick:eP,iconBefore:(0,r.jsx)(g.A,{name:"cart"}),children:b?.saveForLaterButtonLabel||"Save For Later"})}),eg&&(0,r.jsxs)("div",{className:"flex items-center gap-2 text-canyon",ref:eL,children:[(0,r.jsx)(g.A,{name:"alert",width:"2rem",height:"2rem",className:"shrink-0 text-canyon"}),(0,r.jsx)("span",{className:"type-caption mb-0",children:eg})]})]}),er===M.Q3.SAVE_FOR_LATER&&(0,r.jsx)("div",{className:"flex flex-col md:flex-row gap-4 md:gap-2 w-full md:w-auto order-1 md:order-1",children:(0,r.jsx)(p.A,{type:"button",variant:"secondary",onClick:eO,iconBefore:(0,r.jsx)(g.A,{name:"start-over"}),children:b?.saveForLaterStartNewBookingLabel||"Start a New Booking"})}),(0,r.jsx)("div",{className:"flex flex-col md:flex-row gap-4 md:gap-2 w-full md:w-auto order-0 md:order-2",children:(0,r.jsxs)(p.A,{type:"button",variant:"primary",iconAfter:(0,r.jsx)(g.A,{name:"arrow-right"}),onClick:eR,disabled:ei||P&&er===M.Q3.DATES||er===M.Q3.DATES&&!eb,className:"w-full md:w-auto order-1 md:order-2 max-md:mb-4",children:[er===M.Q3.DATES&&P&&"Verifying availability...",er===M.Q3.DATES&&!P&&(b?.bookingNextFromDatesLabel||"Next: Customize Tour Options"),er===M.Q3.CUSTOMIZE&&(b?.bookingNextFromCustomizeLabel||"Next: Guest Information"),er===M.Q3.SAVE_FOR_LATER&&"Continue Booking This Tour",er===M.Q3.GUESTS&&(E?b?.bookingJoinWaitlistLabel||"Join Waitlist":b?.bookingNextFromGuestsLabel||"Next: Payment"),er===M.Q3.PAYMENT&&(b?.bookingCompleteLabel||"Complete Booking")]})})]}),er===M.Q3.CONFIRMATION&&(0,r.jsx)(p.A,{type:"button",variant:"secondary",iconBefore:(0,r.jsx)(g.A,{name:"close"}),onClick:()=>l(!1),className:"w-full md:w-auto mx-auto print:hidden",children:b?.bookingCloseButtonLabel||"Close"})]})]})}):null}var eZ=a(82282);let eJ={base:"overflow-x-hidden overflow-y-auto overscroll-contain max-md:px-0 h-[100dvh] !fixed md:!pb-[var(--page-gutter-desktop)] print:static! print:overflow-visible!",dialog:{mobile:"max-md:w-[100vw]! max-w-[100vw]!",desktop:"md:w-[1344px]! md:max-w-[100%]! max-md:rounded-none! md:p-12!",layout:"mx-auto max-h-none !relative max-md:translate-none! max-md:top-[0]! max-md:left-[0]! !translate-y-[0] !top-[0] md:!top-[var(--page-gutter-desktop)] md:!mb-[var(--page-gutter-desktop)]"}};function eK(){let{isBookingModalOpen:e,closeBookingModal:t,isSelectDepartureCityOpen:a,closeSelectDepartureCity:n,bookingState:d,openBookingModal:c,setTripBuildingMode:m,setJustSwitchedToPackage:u,isPackageMode:h,globalSettings:b,isLoadingBooking:f,loadingState:x,startLoading:_}=(0,o.useTourBooking)(),v=(0,i.useSearchParams)().get("isAuth"),[y,j]=(0,s.use
1State)("true"===v);(0,s.useEffect)(()=>{if(y){_("auth"),j(!1);let e=new URL(window.location.href);e.searchParams.delete("isAuth"),window.history.replaceState({},"",e.toString())}},[y,_]);let N=(0,S.mN)({}),w=(0,s.useRef)(null),T=(0,s.useMemo)(()=>!!y||!!e&&(f||x.isLoading)&&!0,[f,x.isLoading,!0,y,e]);return(0,s.useEffect)(()=>{let t=()=>{let t=window.location.hash.replace("#","");t&&M.dm.includes(t)&&!e&&c()};return window.addEventListener("hashchange",t),window.addEventListener("popstate",t),t(),()=>{window.removeEventListener("hashchange",t),window.removeEventListener("popstate",t)}},[e,c]),(0,s.useEffect)(()=>{(f||x.isLoading)&&w.current&&w.current.scrollIntoView({behavior:"smooth",block:"start"})},[f,x.isLoading]),(0,s.useEffect)(()=>(e?document.body.classList.add("overflow-hidden","tour-booking-modal-open"):document.body.classList.remove("overflow-hidden","tour-booking-modal-open"),()=>{document.body.classList.remove("overflow-hidden","tour-booking-modal-open")}),[e]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.A,{show:a,onHide:n,className:`${eJ.base} flex! items-center justify-center`,dialogClassName:"absolute! max-w-[683px]! bg-sleet! left-[50%]! translate-x-[-50%]! top-[50%]! translate-y-[-50%]!",backdropBlur:!0,children:[(0,r.jsx)(l.A.Header,{closeBtnLabel:b?.tourBookingModalCloseLabel||"Close",children:(0,r.jsx)(l.A.Title,{className:"heading-5",as:"h2",children:" "})}),(0,r.jsx)(l.A.Body,{className:"max-h-none md:h-full md:w-full !overflow-y-visible",children:(0,r.jsx)(S.Op,{...N,children:(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)("div",{className:"heading-4 mb-6",children:h?b?.departureCityModalChangeTitle||"Change Departure City":b?.departureCityModalSelectTitle||"Select Departure City"}),!h&&(0,r.jsx)("p",{className:"type-paragraph mb-6",children:b?.departureCityModalDescription||"The Tour + Travel Package includes flights, airport transportation, and extra hotel nights. Select your departure city to continue booking."}),(0,r.jsx)(et,{required:!0,fieldSuffix:"select_city_modal",forceShow:!0,isTourBookingModal:!0}),(0,r.jsx)("div",{className:"flex gap-3",children:(0,r.jsx)(p.A,{type:"button",variant:"primary",iconAfter:(0,r.jsx)(g.A,{name:"arrow-right"}),fullWidth:!0,onClick:()=>{if(!d.selected_airport){let e=document.getElementById("departure-city-select_select_city_modal");e?.focus();return}h?n():(m("tour_plus_travel_package"),u(!0),n(),c())},children:h?b?.departureCityModalContinueLabel||"Continue â":b?.departureCityModalContinueBookingLabel||"Continue booking Tour + Travel Package"})})]})})})]}),(0,r.jsxs)(l.A,{show:e,onHide:t,className:eJ.base,dialogClassName:`${eJ.dialog.mobile} ${eJ.dialog.desktop} ${eJ.dialog.layout}`,id:"tour-booking-modal",children:[(0,r.jsx)(l.A.Header,{closeBtnLabel:b?.tourBookingModalCloseLabel||"Close",children:(0,r.jsx)(l.A.Title,{className:"heading-5",as:"div",children:(0,r.jsx)("span",{id:"tour-booking-modal-title"})})}),(0,r.jsx)(l.A.Body,{className:"max-h-none md:h-full md:w-full !overflow-y-visible",children:(0,r.jsx)(eX,{})})]}),T&&(0,r.jsx)(eZ.A,{ref:w,loadingType:x.loadingType,isLoadingBooking:f,globalSettings:b,authLoading:y})]})}},82282:(e,t,a)=>{a.d(t,{A:()=>d});var r=a(73365),s=a(1521),i=a(91414),l=a(34801),n=a.n(l);let o=(0,s.forwardRef)(({loadingType:e,isLoadingBooking:t,authLoading:a,labels:s,globalSettings:l,className:o,backDropClassName:d},c)=>{let m={...l,...s},u=n()("fixed inset-0 z-500 flex items-center justify-center overflow-hidden",o),p=n()("absolute inset-0 bg-black/50 backdrop-blur-sm",d);return(0,r.jsxs)("div",{className:u,children:[(0,r.jsx)("div",{className:p}),(0,r.jsx)("div",{className:"relative",ref:c,"aria-live":"polite",children:(0,r.jsx)("div",{className:"bg-white rounded-lg p-4 md:p-16 max-w-md mx-4",children:(0,r.jsxs)("div",{className:"flex flex-col items-center text-center gap-6",children:[(0,r.jsx)(i.A,{className:"w-12 h-12"}),(0,r.jsx)("p",{className:"type-body font-medium",children:"searching"===e?m.searchLoadingResultsLabel||"Loading results...":"pre-auth"===e?m.bookingRedirectingToLoginLabel||"Redirecting to login":a||"auth"===e?m.bookingLoggedInLoadingBookingLabel||"Logged in, loading booking":"navigating"===e?m.bookingLoadingLabel||"Loading":"submitting"===e?m.bookingSubmittingBookingLabel||"Submitting booking":"fetching_statuses"===e?m.bookingCheckingAvailabilityLabel||"Checking availability":"verifying_departure"===e?m.bookingVerifyingDepartureAvailabilityLabel||"Verifying departure availability":"fetching_credits"===e?m.bookingLoadingTravelerCreditsLabel||"Loading traveler credits":"resuming_booking"===e?m.bookingLoadingBookingLabel||"Loading booking":"applying_promo"===e?m.bookingApplyingPromoCodeL
1abel||"Applying promo code":!e&&t?m.bookingLoadingBookingInformationLabel||"Loading booking information":m.bookingLoadingLabel||"Loading"})]})})})]})});o.displayName="LoadingModal";let d=o}}]);
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.