"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[57771,1188],{57771:function(e,n,t){t.d(n,{v:function(){return B},a:function(){return r}});var l=t(85893),i=t(67294),a=t(84248),d=t(23795);function r(e){let{message:n}=e;return(0,i.useEffect)(()=>{let e=document.getElementById("portal");window&&e&&(e.style.position="absolute",e.style.zIndex="999")},[]),(0,l.jsx)(a.h,{removeBodyScroll:!1,children:(0,l.jsx)("div",{className:"relative flex h-screen w-screen flex-col items-center justify-center overflow-hidden bg-black/75",children:(0,l.jsx)(d.mn,{message:n})})})}var o=t(35337),s=t(49474),c=t(82833),u=t(73911),v=t(12011),y=t(75749),g=t(66914),m=t(81361),x=t(36647),p=t(11528),h=t(54213),f=t(19712),w=t(18445),b=t(27676),D=t(98304),S=t(42042),j=t(34466),N=t(3025),C=t(85719),Z=t(86647),M=t(26529),F=t(1188),k=t(14640);let I=(e,n)=>{var t,l,i,a,d,r,o,s,c,u,v,y,g,m,x,p,h,f,w,b,D,S,j,C;let Z=(0,N.Qb)({inclusivePricingToggle:!1,sailing:e,pricePerNight:n}),M=(0,N.Qb)({inclusivePricingToggle:!0,sailing:e,pricePerNight:n});return{...e,transformPrice:{outside:null!==(g=null==M?void 0:null===(t=M.outside)||void 0===t?void 0:t.regular)&&void 0!==g?g:0,inside:null!==(m=null==M?void 0:null===(l=M.inside)||void 0===l?void 0:l.regular)&&void 0!==m?m:0,balcony:null!==(x=null==M?void 0:null===(i=M.balcony)||void 0===i?void 0:i.regular)&&void 0!==x?x:0,suite:null!==(p=null==M?void 0:null===(a=M.suite)||void 0===a?void 0:a.regular)&&void 0!==p?p:0,oceanview:null!==(h=null==M?void 0:null===(d=M.oceanview)||void 0===d?void 0:d.regular)&&void 0!==h?h:0,window:null!==(f=null==M?void 0:null===(r=M.window)||void 0===r?void 0:r.regular)&&void 0!==f?f:0,suiteExclusive:null!==(w=null==Z?void 0:null===(o=Z.suite)||void 0===o?void 0:o.regular)&&void 0!==w?w:0,balconyExclusive:null!==(b=null==Z?void 0:null===(s=Z.balcony)||void 0===s?void 0:s.regular)&&void 0!==b?b:0,outsideExclusive:null!==(D=null==Z?void 0:null===(c=Z.outside)||void 0===c?void 0:c.regular)&&void 0!==D?D:0,insideExclusive:null!==(S=null==Z?void 0:null===(u=Z.inside)||void 0===u?void 0:u.regular)&&void 0!==S?S:0,oceanviewExclusive:null!==(j=null==Z?void 0:null===(v=Z.oceanview)||void 0===v?void 0:v.regular)&&void 0!==j?j:0,windowExclusive:null!==(C=null==Z?void 0:null===(y=Z.window)||void 0===y?void 0:y.regular)&&void 0!==C?C:0}}},P=e=>({departureDate:e.startDateFormatted,endDate:e.endDateFormatted,pricing:e.transformPrice,sailingId:e.id,inPenaltyBox:e.inPenaltyBox}),_=e=>0===Object.keys(e.pricing).length,B=(0,M.Z)(F)(e=>{var n,a;let{showCalendar:d,onCloseClick:r,sailing:M,showCTA:F,t:B}=e,E=(0,u.y3)(),T=(0,i.useRef)(null),[L,O]=(0,i.useState)(!0),[J,Q]=(0,i.useState)(M.id),[R,z]=(0,i.useState)(M),[A,U]=(0,i.useState)({start:(0,o.Z)(M.startDateFormatted,"yyyy-MM-dd",new Date),end:(0,o.Z)(M.endDateFormatted,"yyyy-MM-dd",new Date)}),X=(0,m.NQ)(),H=(0,k.useFormatter)(),V=null==X?void 0:X.isOn("price-per-night"),[W]=(0,g.Z)(["tmo-button-branding"]),G=W?x.ZP:x.hG,{inclusivePricingToggle:$}=(0,i.useContext)(y.Z),q=(0,Z.Z)(M),K=()=>(null==q?void 0:q.map(e=>I(e,V)).map(e=>P(e))).filter(e=>!_(e)),Y=(0,j.Z)({id:J,lineId:null===(a=M.ship)||void 0===a?void 0:null===(n=a.line)||void 0===n?void 0:n.id}),ee=()=>{t.g.analytics.track("Button Clicked",{label:"Itinerary Calendar",category:"click",sailing_id:null==M?void 0:M.id,location:"search",sublocation:"Itinerary Calendar",text:"Select Date",color:"#0066FF"})},en=()=>{t.g.analytics.track("Button Clicked",{label:"Sailing",category:"click",sailing_id:null==M?void 0:M.id,location:"Sailing",sublocation:"Itinerary Calendar",text:"X",color:"#989898"})},et=(0,i.useCallback)(e=>{t.g.analytics.track("Section scrolled",{category:"Scroll",label:"Itinerary Calendar Scrolled",percent_scrolled:"".concat(100*e,"%"),sailing_id:null==M?void 0:M.id,sailings_seen:[{departureDate:M.startDateFormatted,endDate:M.endDateFormatted,pricing:M.perPersonPricing,sailingId:M.id},...K()]})},[M,K]);return(0,C.$3)(T,et),(0,l.jsx)(l.Fragment,{children:d&&(0,l.jsx)(f.Z,{show:d,onCloseClick:()=>{r(!1),en()},withCloseButton:!0,closeButtonAbsolute:!0,classNameWrapper:E?"justify-end":"",className:"mt-6 h-full rounded-none px-0 md:w-[431px] ",closeButtonClassName:"top-[29px]",children:(0,l.jsxs)("div",{className:"flex h-full flex-col ",children:[L&&(0,l.jsx)("div",{className:"mt-7 px-7 md:px-[52px]",children:(0,l.jsx)(D.E,{name:M.name,nights:M.nights,line:M.ship.line.name,shipName:M.ship.name})}),(0,l.jsx)("div",{className:"mb-[22px] mt-3 flex flex-col items-center gap-4 px-7 md:px-[52px]",children:(0,l.jsx)(w.x,{className:"font-inter-semi-bold text-lg",children:B("chooseDates")})}),(0,l.jsxs)("div",{className:"mx-auto mb-1 mt-2 grid w-[334px] grid-cols-7 font-inter-semi-bold text-lg md:px-[52px]",children:[(0,l.jsx)("span",{className:"text-center",children:B("sunday")}),(0,l.jsx)("span",{className:"text-center",children:B("monday")}),(0,l.jsx)("span",{className:"text-center",children:B("tuesday")}),(0,l.jsx)("span",{className:"text-center",children:B("wednesday")}),(0,l.jsx)("span",{className:"text-center",children:B("thursday")}),(0,l.jsx)("span",{className:"text-center",children:B("friday")}),(0,l.jsx)("span",{className:"text-center",children:B("saturday")})]}),(0,l.jsx)(h.Z,{}),(0,l.jsx)("section",{className:"mx-auto  h-full w-fit overflow-y-auto md:px-[52px] ",onScroll:e=>{let n=e.target;n.scrollTop>=50&&n.scrollTop?O(!1):n.scrollTop<50&&O(!0)},ref:T,children:(0,l.jsx)(S.D,{start_date:(()=>{let e=(0,o.Z)(M.startDateFormatted,"yyyy-MM-dd",new Date),n=K();if((null==n?void 0:n.length)>0){let t=n.map(function(e){return e.departureDate}).sort()[0],l=(0,o.Z)(String(t),"yyyy-MM-dd",new Date);return -1===(0,s.Z)(e,l)?e:l}return e})(),endDate:(()=>{let e=K();if(null==e?void 0:e.length){let n=(0,o.Z)(M.endDateFormatted,"yyyy-MM-dd",new Date),t=e.map(function(e){return e.endDate}).sort().reverse()[0],l=(0,o.Z)(String(t),"yyyy-MM-dd",new Date);return 1===(0,s.Z)(n,l)?(0,o.Z)(M.startDateFormatted,"yyyy-MM-dd",new Date):l}return(0,o.Z)(M.startDateFormatted,"yyyy-MM-dd",new Date)})(),selectedDay:M.startDateFormatted,events:[{departureDate:M.startDateFormatted,endDate:M.endDateFormatted,pricing:M.perPersonPricing,sailingId:M.id,inPenaltyBox:null==M?void 0:M.inPenaltyBox},...K()],onClick:e=>{var n,l,i,a;U({start:(0,o.Z)(e.departureDate,"yyyy-MM-dd",new Date),end:(0,o.Z)(e.endDate,"yyyy-MM-dd",new Date)}),Q(e.sailingId),z(e);let d=q.find(n=>n.id===e.sailingId);if(!d)return;let r=(0,N.Dv)({inclusivePricingToggle:$,sailing:d}),s=(0,N.Qb)({inclusivePricingToggle:$,sailing:d});t.g.analytics.track("Button Clicked",{label:"Itinerary Calendar",category:"click",current_sailing_date:M.startDateFormatted,new_sailing_date:A.end,sailing_id:null==M?void 0:M.id,new_sailing_id:J,location:"Sailing",sublocation:"Itinerary Calendar",balconyPrice:null==s?void 0:null===(n=s.balcony)||void 0===n?void 0:n.regular,displayed_pricing:null==r?void 0:r.regular,oceanviewPrice:null==s?void 0:null===(l=s.outside)||void 0===l?void 0:l.regular,suitePrice:null==s?void 0:null===(i=s.suite)||void 0===i?void 0:i.regular,interiorPrice:null==s?void 0:null===(a=s.inside)||void 0===a?void 0:a.regular})},inclusivePricingToggle:$})}),(0,l.jsx)(h.Z,{}),(0,l.jsxs)("section",{className:(0,c.m)("\n                  mb-2 mt-4 flex h-[209px]  max-h-[209]  shrink-0 grow-0 flex-col gap-4 px-7\n                  md:px-[52px]"),children:[(0,l.jsxs)(w.x,{className:"flex items-center justify-center gap-2 font-inter-medium text-base",children:[(0,l.jsx)(p.Z,{name:"Calendar20x20"}),H.dateTimeRange(A.start,A.end,{year:"numeric",month:"long",day:"numeric"})]}),(0,l.jsx)(b.U,{inclusivePricingToggle:$,sailing:M,sailingSelected:R}),(0,l.jsx)(l.Fragment,{children:((null==q?void 0:q.length)>0||F)&&(0,l.jsx)(G,{brand:v.H2.CB,label:B("buttonLabel"),icon:"ArrowRight20x20","data-cy":"select-date",onClick:()=>{ee(),Y(),r(!1)}})})]})]})})})})},34466:function(e,n,t){var l=t(67294),i=t(7181),a=t(25427),d=t(73298),r=t(3218),o=t(14640),s=t(73131),c=t(25214),u=t(12011);n.Z=e=>{let{id:n,lineId:t}=e,{cabins:v}=(0,r.ZP)(),{guestAddlDetails:y}=(0,l.useContext)(a.zD),{activeQuery:g}=(0,l.useContext)(d.X),m=(0,o.useLocale)(),x=m===s.defaultLocale?"":"/".concat(m),{gclid:p}=(0,c.Z)(),{brand:h}=(0,l.useContext)(u.lF);return()=>{let e=new URLSearchParams;p&&e.append("gclid",p),h!==u.H2.CB&&e.append("brand",h);let l="".concat((0,i.SF)(n)).concat(e.size?"?".concat(e.toString()):""),a=window.open("".concat(window.location.origin).concat(x).concat(l));null==a||a.sessionStorage.setItem("activeQuery",JSON.stringify(g)),null==a||a.sessionStorage.setItem("guestAddlDetails",JSON.stringify(y)),null==a||a.sessionStorage.setItem("lineId",t.toString()),null==a||a.sessionStorage.setItem("cabinsSelector",JSON.stringify({state:{cabins:v},version:0}))}}},1188:function(e){e.exports=JSON.parse('{"en-US":{"chooseDates":"Choose dates","monday":"M","tuesday":"T","wednesday":"W","thursday":"T","friday":"F","saturday":"S","sunday":"S","buttonLabel":"Select date","cabinTypeNames":{"inside":"Interior","outside":"Oceanview","balcony":"Balcony","suite":"Suite"}},"es-MX":{"chooseDates":"Elige una fecha","monday":"L","tuesday":"M","wednesday":"M","thursday":"J","friday":"V","saturday":"S","sunday":"D","buttonLabel":"Elegir fecha","cabinTypeNames":{"inside":"Interior","outside":"Vista al mar","balcony":"Balc\xf3n","suite":"Suite"}}}')}}]);